@gemafajarramadhan/dynamic-ui 1.1.20 → 1.1.21

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.
@@ -8563,7 +8563,7 @@ For more information, see https://www.reka-ui.com/docs/components/${n}`,c=`Warni
8563
8563
  * Released under the MIT License
8564
8564
  */class SX{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,o,r){const i=n.listeners[r],s=n.duration;i.forEach(c=>c({chart:e,initial:n.initial,numSteps:s,currentStep:Math.min(o-n.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=nD.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((o,r)=>{if(!o.running||!o.items.length)return;const i=o.items;let s=i.length-1,c=!1,d;for(;s>=0;--s)d=i[s],d._active?(d._total>o.duration&&(o.duration=d._total),d.tick(e),c=!0):(i[s]=i[i.length-1],i.pop());c&&(r.draw(),this._notify(r,o,e,"progress")),i.length||(o.running=!1,this._notify(r,o,e,"complete"),o.initial=!1),n+=i.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let o=n.get(e);return o||(o={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,o)),o}listen(e,n,o){this._getAnims(e).listeners[n].push(o)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((o,r)=>Math.max(o,r._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const o=n.items;let r=o.length-1;for(;r>=0;--r)o[r].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var pa=new SX;const PD="transparent",IX={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const o=sD(t||PD),r=o.valid&&sD(e||PD);return r&&r.valid?r.mix(o,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class _X{constructor(e,n,o,r){const i=n[o];r=jS([e.to,r,i,e.from]);const s=jS([e.from,i,r]);this._active=!0,this._fn=e.fn||IX[e.type||typeof s],this._easing=s1[e.easing]||s1.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=o,this._from=s,this._to=r,this._promises=void 0}active(){return this._active}update(e,n,o){if(this._active){this._notify(!1);const r=this._target[this._prop],i=o-this._start,s=this._duration-i;this._start=o,this._duration=Math.floor(Math.max(s,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=jS([e.to,n,r,e.from]),this._from=jS([e.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,o=this._duration,r=this._prop,i=this._from,s=this._loop,c=this._to;let d;if(this._active=i!==c&&(s||n<o),!this._active){this._target[r]=c,this._notify(!0);return}if(n<0){this._target[r]=i;return}d=n/o%2,d=s&&d>1?2-d:d,d=this._easing(Math.min(1,Math.max(0,d))),this._target[r]=this._fn(i,c,d)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,o)=>{e.push({res:n,rej:o})})}_notify(e){const n=e?"res":"rej",o=this._promises||[];for(let r=0;r<o.length;r++)o[r][n]()}}class DD{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!we(e))return;const n=Object.keys(Fe.animation),o=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{const i=e[r];if(!we(i))return;const s={};for(const c of n)s[c]=i[c];($e(i.properties)&&i.properties||[r]).forEach(c=>{(c===r||!o.has(c))&&o.set(c,s)})})}_animateOptions(e,n){const o=n.options,r=AX(e,o);if(!r)return[];const i=this._createAnimations(r,o);return o.$shared&&BX(e.options.$animations,o).then(()=>{e.options=o},()=>{}),i}_createAnimations(e,n){const o=this._properties,r=[],i=e.$animations||(e.$animations={}),s=Object.keys(n),c=Date.now();let d;for(d=s.length-1;d>=0;--d){const h=s[d];if(h.charAt(0)==="$")continue;if(h==="options"){r.push(...this._animateOptions(e,n));continue}const u=n[h];let p=i[h];const y=o.get(h);if(p)if(y&&p.active()){p.update(y,u,c);continue}else p.cancel();if(!y||!y.duration){e[h]=u;continue}i[h]=p=new _X(y,e,h,u),r.push(p)}return r}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const o=this._createAnimations(e,n);if(o.length)return pa.add(this._chart,o),!0}}function BX(t,e){const n=[],o=Object.keys(e);for(let r=0;r<o.length;r++){const i=t[o[r]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function AX(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function qD(t,e){const n=t&&t.options||{},o=n.reverse,r=n.min===void 0?e:0,i=n.max===void 0?e:0;return{start:o?i:r,end:o?r:i}}function VX(t,e,n){if(n===!1)return!1;const o=qD(t,n),r=qD(e,n);return{top:r.end,right:o.end,bottom:r.start,left:o.start}}function PX(t){let e,n,o,r;return we(t)?(e=t.top,n=t.right,o=t.bottom,r=t.left):e=n=o=r=t,{top:e,right:n,bottom:o,left:r,disabled:t===!1}}function zD(t,e){const n=[],o=t._getSortedDatasetMetas(e);let r,i;for(r=0,i=o.length;r<i;++r)n.push(o[r].index);return n}function ED(t,e,n,o={}){const r=t.keys,i=o.mode==="single";let s,c,d,h;if(e===null)return;let u=!1;for(s=0,c=r.length;s<c;++s){if(d=+r[s],d===n){if(u=!0,o.all)continue;break}h=t.values[d],We(h)&&(i||e===0||Xt(e)===Xt(h))&&(e+=h)}return!u&&!o.all?0:e}function DX(t,e){const{iScale:n,vScale:o}=e,r=n.axis==="x"?"x":"y",i=o.axis==="x"?"x":"y",s=Object.keys(t),c=new Array(s.length);let d,h,u;for(d=0,h=s.length;d<h;++d)u=s[d],c[d]={[r]:u,[i]:t[u]};return c}function pB(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function qX(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function zX(t){const{min:e,max:n,minDefined:o,maxDefined:r}=t.getUserBounds();return{min:o?e:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}function EX(t,e,n){const o=t[e]||(t[e]={});return o[n]||(o[n]={})}function TD(t,e,n,o){for(const r of e.getMatchingVisibleMetas(o).reverse()){const i=t[r.index];if(n&&i>0||!n&&i<0)return r.index}return null}function OD(t,e){const{chart:n,_cachedMeta:o}=t,r=n._stacks||(n._stacks={}),{iScale:i,vScale:s,index:c}=o,d=i.axis,h=s.axis,u=qX(i,s,o),p=e.length;let y;for(let f=0;f<p;++f){const m=e[f],{[d]:k,[h]:g}=m,b=m._stacks||(m._stacks={});y=b[h]=EX(r,u,k),y[c]=g,y._top=TD(y,s,!0,o.type),y._bottom=TD(y,s,!1,o.type);const w=y._visualValues||(y._visualValues={});w[c]=g}}function yB(t,e){const n=t.scales;return Object.keys(n).filter(o=>n[o].axis===e).shift()}function TX(t,e){return ms(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function OX(t,e,n){return ms(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function h1(t,e){const n=t.controller.index,o=t.vScale&&t.vScale.axis;if(o){e=e||t._parsed;for(const r of e){const i=r._stacks;if(!i||i[o]===void 0||i[o][n]===void 0)return;delete i[o][n],i[o]._visualValues!==void 0&&i[o]._visualValues[n]!==void 0&&delete i[o]._visualValues[n]}}}const fB=t=>t==="reset"||t==="none",HD=(t,e)=>e?t:Object.assign({},t),HX=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:zD(n,!0),values:null};class Ms{constructor(e,n){this.chart=e,this._ctx=e.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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=pB(e.vScale,e),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(e){this.index!==e&&h1(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,o=this.getDataset(),r=(p,y,f,m)=>p==="x"?y:p==="r"?m:f,i=n.xAxisID=be(o.xAxisID,yB(e,"x")),s=n.yAxisID=be(o.yAxisID,yB(e,"y")),c=n.rAxisID=be(o.rAxisID,yB(e,"r")),d=n.indexAxis,h=n.iAxisID=r(d,i,s,c),u=n.vAxisID=r(d,s,i,c);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(s),n.rScale=this.getScaleForId(c),n.iScale=this.getScaleForId(h),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&tD(this._data,this),e._stacked&&h1(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),o=this._data;if(we(n)){const r=this._cachedMeta;this._data=DX(n,r)}else if(o!==n){if(o){tD(o,this);const r=this._cachedMeta;h1(r),r._parsed=[]}n&&Object.isExtensible(n)&&xK(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,o=this.getDataset();let r=!1;this._dataCheck();const i=n._stacked;n._stacked=pB(n.vScale,n),n.stack!==o.stack&&(r=!0,h1(n),n.stack=o.stack),this._resyncElements(e),(r||i!==n._stacked)&&(OD(this,n._parsed),n._stacked=pB(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),o=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(o,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:o,_data:r}=this,{iScale:i,_stacked:s}=o,c=i.axis;let d=e===0&&n===r.length?!0:o._sorted,h=e>0&&o._parsed[e-1],u,p,y;if(this._parsing===!1)o._parsed=r,o._sorted=!0,y=r;else{$e(r[e])?y=this.parseArrayData(o,r,e,n):we(r[e])?y=this.parseObjectData(o,r,e,n):y=this.parsePrimitiveData(o,r,e,n);const f=()=>p[c]===null||h&&p[c]<h[c];for(u=0;u<n;++u)o._parsed[u+e]=p=y[u],d&&(f()&&(d=!1),h=p);o._sorted=d}s&&OD(this,y)}parsePrimitiveData(e,n,o,r){const{iScale:i,vScale:s}=e,c=i.axis,d=s.axis,h=i.getLabels(),u=i===s,p=new Array(r);let y,f,m;for(y=0,f=r;y<f;++y)m=y+o,p[y]={[c]:u||i.parse(h[m],m),[d]:s.parse(n[m],m)};return p}parseArrayData(e,n,o,r){const{xScale:i,yScale:s}=e,c=new Array(r);let d,h,u,p;for(d=0,h=r;d<h;++d)u=d+o,p=n[u],c[d]={x:i.parse(p[0],u),y:s.parse(p[1],u)};return c}parseObjectData(e,n,o,r){const{xScale:i,yScale:s}=e,{xAxisKey:c="x",yAxisKey:d="y"}=this._parsing,h=new Array(r);let u,p,y,f;for(u=0,p=r;u<p;++u)y=u+o,f=n[y],h[u]={x:i.parse(hs(f,c),y),y:s.parse(hs(f,d),y)};return h}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,o){const r=this.chart,i=this._cachedMeta,s=n[e.axis],c={keys:zD(r,!0),values:n._stacks[e.axis]._visualValues};return ED(c,s,i.index,{mode:o})}updateRangeFromParsed(e,n,o,r){const i=o[n.axis];let s=i===null?NaN:i;const c=r&&o._stacks[n.axis];r&&c&&(r.values=c,s=ED(r,i,this._cachedMeta.index)),e.min=Math.min(e.min,s),e.max=Math.max(e.max,s)}getMinMax(e,n){const o=this._cachedMeta,r=o._parsed,i=o._sorted&&e===o.iScale,s=r.length,c=this._getOtherScale(e),d=HX(n,o,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:p}=zX(c);let y,f;function m(){f=r[y];const k=f[c.axis];return!We(f[e.axis])||u>k||p<k}for(y=0;y<s&&!(!m()&&(this.updateRangeFromParsed(h,e,f,d),i));++y);if(i){for(y=s-1;y>=0;--y)if(!m()){this.updateRangeFromParsed(h,e,f,d);break}}return h}getAllParsedValues(e){const n=this._cachedMeta._parsed,o=[];let r,i,s;for(r=0,i=n.length;r<i;++r)s=n[r][e.axis],We(s)&&o.push(s);return o}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,o=n.iScale,r=n.vScale,i=this.getParsed(e);return{label:o?""+o.getLabelForValue(i[o.axis]):"",value:r?""+r.getLabelForValue(i[r.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=PX(be(this.options.clip,VX(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,o=this._cachedMeta,r=o.data||[],i=n.chartArea,s=[],c=this._drawStart||0,d=this._drawCount||r.length-c,h=this.options.drawActiveElementsOnTop;let u;for(o.dataset&&o.dataset.draw(e,i,c,d),u=c;u<c+d;++u){const p=r[u];p.hidden||(p.active&&h?s.push(p):p.draw(e,i))}for(u=0;u<s.length;++u)s[u].draw(e,i)}getStyle(e,n){const o=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(o):this.resolveDataElementOptions(e||0,o)}getContext(e,n,o){const r=this.getDataset();let i;if(e>=0&&e<this._cachedMeta.data.length){const s=this._cachedMeta.data[e];i=s.$context||(s.$context=OX(this.getContext(),e,s)),i.parsed=this.getParsed(e),i.raw=r.data[e],i.index=i.dataIndex=e}else i=this.$context||(this.$context=TX(this.chart.getContext(),this.index)),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=o,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",o){const r=n==="active",i=this._cachedDataOpts,s=e+"-"+n,c=i[s],d=this.enableOptionSharing&&n1(o);if(c)return HD(c,d);const h=this.chart.config,u=h.datasetElementScopeKeys(this._type,e),p=r?[`${e}Hover`,"hover",e,""]:[e,""],y=h.getOptionScopes(this.getDataset(),u),f=Object.keys(Fe.elements[e]),m=()=>this.getContext(o,r,n),k=h.resolveNamedOptions(y,f,m,p);return k.$shared&&(k.$shared=d,i[s]=Object.freeze(HD(k,d))),k}_resolveAnimations(e,n,o){const r=this.chart,i=this._cachedDataOpts,s=`animation-${n}`,c=i[s];if(c)return c;let d;if(r.options.animation!==!1){const u=this.chart.config,p=u.datasetAnimationScopeKeys(this._type,n),y=u.getOptionScopes(this.getDataset(),p);d=u.createResolver(y,this.getContext(e,o,n))}const h=new DD(r,d&&d.animations);return d&&d._cacheable&&(i[s]=Object.freeze(h)),h}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||fB(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const o=this.resolveDataElementOptions(e,n),r=this._sharedOptions,i=this.getSharedOptions(o),s=this.includeOptions(n,i)||i!==r;return this.updateSharedOptions(i,n,o),{sharedOptions:i,includeOptions:s}}updateElement(e,n,o,r){fB(r)?Object.assign(e,o):this._resolveAnimations(n,r).update(e,o)}updateSharedOptions(e,n,o){e&&!fB(n)&&this._resolveAnimations(void 0,n).update(e,o)}_setStyle(e,n,o,r){e.active=r;const i=this.getStyle(n,r);this._resolveAnimations(n,o,r).update(e,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(e,n,o){this._setStyle(e,o,"active",!1)}setHoverStyle(e,n,o){this._setStyle(e,o,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,o=this._cachedMeta.data;for(const[c,d,h]of this._syncList)this[c](d,h);this._syncList=[];const r=o.length,i=n.length,s=Math.min(i,r);s&&this.parse(0,s),i>r?this._insertElements(r,i-r,e):i<r&&this._removeElements(i,r-i)}_insertElements(e,n,o=!0){const r=this._cachedMeta,i=r.data,s=e+n;let c;const d=h=>{for(h.length+=n,c=h.length-1;c>=s;c--)h[c]=h[c-n]};for(d(i),c=e;c<s;++c)i[c]=new this.dataElementType;this._parsing&&d(r._parsed),this.parse(e,n),o&&this.updateElements(i,e,n,"reset")}updateElements(e,n,o,r){}_removeElements(e,n){const o=this._cachedMeta;if(this._parsing){const r=o._parsed.splice(e,n);o._stacked&&h1(o,r)}o.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,o,r]=e;this[n](o,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const o=arguments.length-2;o&&this._sync(["_insertElements",e,o])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}se(Ms,"defaults",{}),se(Ms,"datasetElementType",null),se(Ms,"dataElementType",null);function FX(t,e){if(!t._cache.$bar){const n=t.getMatchingVisibleMetas(e);let o=[];for(let r=0,i=n.length;r<i;r++)o=o.concat(n[r].controller.getAllParsedValues(t));t._cache.$bar=aD(o.sort((r,i)=>r-i))}return t._cache.$bar}function $X(t){const e=t.iScale,n=FX(e,t.type);let o=e._length,r,i,s,c;const d=()=>{s===32767||s===-32768||(n1(c)&&(o=Math.min(o,Math.abs(s-c)||o)),c=s)};for(r=0,i=n.length;r<i;++r)s=e.getPixelForValue(n[r]),d();for(c=void 0,r=0,i=e.ticks.length;r<i;++r)s=e.getPixelForTick(r),d();return o}function jX(t,e,n,o){const r=n.barThickness;let i,s;return Ie(r)?(i=e.min*n.categoryPercentage,s=n.barPercentage):(i=r*o,s=1),{chunk:i/o,ratio:s,start:e.pixels[t]-i/2}}function RX(t,e,n,o){const r=e.pixels,i=r[t];let s=t>0?r[t-1]:null,c=t<r.length-1?r[t+1]:null;const d=n.categoryPercentage;s===null&&(s=i-(c===null?e.end-e.start:c-i)),c===null&&(c=i+i-s);const h=i-(i-Math.min(s,c))/2*d;return{chunk:Math.abs(c-s)/2*d/o,ratio:n.barPercentage,start:h}}function NX(t,e,n,o){const r=n.parse(t[0],o),i=n.parse(t[1],o),s=Math.min(r,i),c=Math.max(r,i);let d=s,h=c;Math.abs(s)>Math.abs(c)&&(d=c,h=s),e[n.axis]=h,e._custom={barStart:d,barEnd:h,start:r,end:i,min:s,max:c}}function FD(t,e,n,o){return $e(t)?NX(t,e,n,o):e[n.axis]=n.parse(t,o),e}function $D(t,e,n,o){const r=t.iScale,i=t.vScale,s=r.getLabels(),c=r===i,d=[];let h,u,p,y;for(h=n,u=n+o;h<u;++h)y=e[h],p={},p[r.axis]=c||r.parse(s[h],h),d.push(FD(y,p,i,h));return d}function mB(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function UX(t,e,n){return t!==0?Xt(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function WX(t){let e,n,o,r,i;return t.horizontal?(e=t.base>t.x,n="left",o="right"):(e=t.base<t.y,n="bottom",o="top"),e?(r="end",i="start"):(r="start",i="end"),{start:n,end:o,reverse:e,top:r,bottom:i}}function GX(t,e,n,o){let r=e.borderSkipped;const i={};if(!r){t.borderSkipped=i;return}if(r===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:s,end:c,reverse:d,top:h,bottom:u}=WX(t);r==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===o?r=h:(n._bottom||0)===o?r=u:(i[jD(u,s,c,d)]=!0,r=h)),i[jD(r,s,c,d)]=!0,t.borderSkipped=i}function jD(t,e,n,o){return o?(t=YX(t,e,n),t=RD(t,n,e)):t=RD(t,e,n),t}function YX(t,e,n){return t===e?n:t===n?e:t}function RD(t,e,n){return t==="start"?e:t==="end"?n:t}function KX(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class GS extends Ms{parsePrimitiveData(e,n,o,r){return $D(e,n,o,r)}parseArrayData(e,n,o,r){return $D(e,n,o,r)}parseObjectData(e,n,o,r){const{iScale:i,vScale:s}=e,{xAxisKey:c="x",yAxisKey:d="y"}=this._parsing,h=i.axis==="x"?c:d,u=s.axis==="x"?c:d,p=[];let y,f,m,k;for(y=o,f=o+r;y<f;++y)k=n[y],m={},m[i.axis]=i.parse(hs(k,h),y),p.push(FD(hs(k,u),m,s,y));return p}updateRangeFromParsed(e,n,o,r){super.updateRangeFromParsed(e,n,o,r);const i=o._custom;i&&n===this._cachedMeta.vScale&&(e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const n=this._cachedMeta,{iScale:o,vScale:r}=n,i=this.getParsed(e),s=i._custom,c=mB(s)?"["+s.start+", "+s.end+"]":""+r.getLabelForValue(i[r.axis]);return{label:""+o.getLabelForValue(i[o.axis]),value:c}}initialize(){this.enableOptionSharing=!0,super.initialize();const e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,e)}updateElements(e,n,o,r){const i=r==="reset",{index:s,_cachedMeta:{vScale:c}}=this,d=c.getBasePixel(),h=c.isHorizontal(),u=this._getRuler(),{sharedOptions:p,includeOptions:y}=this._getSharedOptions(n,r);for(let f=n;f<n+o;f++){const m=this.getParsed(f),k=i||Ie(m[c.axis])?{base:d,head:d}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,u),b=(m._stacks||{})[c.axis],w={horizontal:h,base:k.base,enableBorderRadius:!b||mB(m._custom)||s===b._top||s===b._bottom,x:h?k.head:g.center,y:h?g.center:k.head,height:h?g.size:Math.abs(k.size),width:h?Math.abs(k.size):g.size};y&&(w.options=p||this.resolveDataElementOptions(f,e[f].active?"active":r));const S=w.options||e[f].options;GX(w,S,b,s),KX(w,S,u.ratio),this.updateElement(e[f],f,w,r)}}_getStacks(e,n){const{iScale:o}=this._cachedMeta,r=o.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),i=o.options.stacked,s=[],c=this._cachedMeta.controller.getParsed(n),d=c&&c[o.axis],h=u=>{const p=u._parsed.find(f=>f[o.axis]===d),y=p&&p[u.vScale.axis];if(Ie(y)||isNaN(y))return!0};for(const u of r)if(!(n!==void 0&&h(u))&&((i===!1||s.indexOf(u.stack)===-1||i===void 0&&u.stack===void 0)&&s.push(u.stack),u.index===e))break;return s.length||s.push(void 0),s}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(e).filter(o=>e[o].axis===n).shift()}_getAxis(){const e={},n=this.getFirstScaleIdForIndexAxis();for(const o of this.chart.data.datasets)e[be(this.chart.options.indexAxis==="x"?o.xAxisID:o.yAxisID,n)]=!0;return Object.keys(e)}_getStackIndex(e,n,o){const r=this._getStacks(e,o),i=n!==void 0?r.indexOf(n):-1;return i===-1?r.length-1:i}_getRuler(){const e=this.options,n=this._cachedMeta,o=n.iScale,r=[];let i,s;for(i=0,s=n.data.length;i<s;++i)r.push(o.getPixelForValue(this.getParsed(i)[o.axis],i));const c=e.barThickness;return{min:c||$X(n),pixels:r,start:o._startPixel,end:o._endPixel,stackCount:this._getStackCount(),scale:o,grouped:e.grouped,ratio:c?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:n,_stacked:o,index:r},options:{base:i,minBarLength:s}}=this,c=i||0,d=this.getParsed(e),h=d._custom,u=mB(h);let p=d[n.axis],y=0,f=o?this.applyStack(n,d,o):p,m,k;f!==p&&(y=f-p,f=p),u&&(p=h.barStart,f=h.barEnd-h.barStart,p!==0&&Xt(p)!==Xt(h.barEnd)&&(y=0),y+=p);const g=!Ie(i)&&!u?i:y;let b=n.getPixelForValue(g);if(this.chart.getDataVisibility(e)?m=n.getPixelForValue(y+f):m=b,k=m-b,Math.abs(k)<s){k=UX(k,n,c)*s,p===c&&(b-=k/2);const w=n.getPixelForDecimal(0),S=n.getPixelForDecimal(1),C=Math.min(w,S),x=Math.max(w,S);b=Math.max(Math.min(b,x),C),m=b+k,o&&!u&&(d._stacks[n.axis]._visualValues[r]=n.getValueForPixel(m)-n.getValueForPixel(b))}if(b===n.getPixelForValue(c)){const w=Xt(k)*n.getLineWidthForValue(c)/2;b+=w,k-=w}return{size:k,base:b,head:m,center:m+k/2}}_calculateBarIndexPixels(e,n){const o=n.scale,r=this.options,i=r.skipNull,s=be(r.maxBarThickness,1/0);let c,d;const h=this._getAxisCount();if(n.grouped){const u=i?this._getStackCount(e):n.stackCount,p=r.barThickness==="flex"?RX(e,n,r,u*h):jX(e,n,r,u*h),y=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(be(y,this.getFirstScaleIdForIndexAxis())),m=this._getStackIndex(this.index,this._cachedMeta.stack,i?e:void 0)+f;c=p.start+p.chunk*m+p.chunk/2,d=Math.min(s,p.chunk*p.ratio)}else c=o.getPixelForValue(this.getParsed(e)[o.axis],e),d=Math.min(s,n.min*n.ratio);return{base:c-d/2,head:c+d/2,center:c,size:d}}draw(){const e=this._cachedMeta,n=e.vScale,o=e.data,r=o.length;let i=0;for(;i<r;++i)this.getParsed(i)[n.axis]!==null&&!o[i].hidden&&o[i].draw(this._ctx)}}se(GS,"id","bar"),se(GS,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),se(GS,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function XX(t,e,n){let o=1,r=1,i=0,s=0;if(e<ze){const c=t,d=c+e,h=Math.cos(c),u=Math.sin(c),p=Math.cos(d),y=Math.sin(d),f=(S,C,x)=>i1(S,c,d,!0)?1:Math.max(C,C*n,x,x*n),m=(S,C,x)=>i1(S,c,d,!0)?-1:Math.min(C,C*n,x,x*n),k=f(0,h,p),g=f(Re,u,y),b=m(Ae,h,p),w=m(Ae+Re,u,y);o=(k-b)/2,r=(g-w)/2,i=-(k+b)/2,s=-(g+w)/2}return{ratioX:o,ratioY:r,offsetX:i,offsetY:s}}class il extends Ms{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const o=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=o;else{let i=d=>+o[d];if(we(o[e])){const{key:d="value"}=this._parsing;i=h=>+hs(o[h],d)}let s,c;for(s=e,c=e+n;s<c;++s)r._parsed[s]=i(s)}}_getRotation(){return ha(this.options.rotation-90)}_getCircumference(){return ha(this.options.circumference)}_getRotationExtents(){let e=ze,n=-ze;for(let o=0;o<this.chart.data.datasets.length;++o)if(this.chart.isDatasetVisible(o)&&this.chart.getDatasetMeta(o).type===this._type){const r=this.chart.getDatasetMeta(o).controller,i=r._getRotation(),s=r._getCircumference();e=Math.min(e,i),n=Math.max(n,i+s)}return{rotation:e,circumference:n-e}}update(e){const n=this.chart,{chartArea:o}=n,r=this._cachedMeta,i=r.data,s=this.getMaxBorderWidth()+this.getMaxOffset(i)+this.options.spacing,c=Math.max((Math.min(o.width,o.height)-s)/2,0),d=Math.min(oK(this.options.cutout,c),1),h=this._getRingWeight(this.index),{circumference:u,rotation:p}=this._getRotationExtents(),{ratioX:y,ratioY:f,offsetX:m,offsetY:k}=XX(p,u,d),g=(o.width-s)/y,b=(o.height-s)/f,w=Math.max(Math.min(g,b)/2,0),S=UP(this.options.radius,w),C=Math.max(S*d,0),x=(S-C)/this._getVisibleDatasetWeightTotal();this.offsetX=m*S,this.offsetY=k*S,r.total=this.calculateTotal(),this.outerRadius=S-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*h,0),this.updateElements(i,0,i.length,e)}_circumference(e,n){const o=this.options,r=this._cachedMeta,i=this._getCircumference();return n&&o.animation.animateRotate||!this.chart.getDataVisibility(e)||r._parsed[e]===null||r.data[e].hidden?0:this.calculateCircumference(r._parsed[e]*i/ze)}updateElements(e,n,o,r){const i=r==="reset",s=this.chart,c=s.chartArea,h=s.options.animation,u=(c.left+c.right)/2,p=(c.top+c.bottom)/2,y=i&&h.animateScale,f=y?0:this.innerRadius,m=y?0:this.outerRadius,{sharedOptions:k,includeOptions:g}=this._getSharedOptions(n,r);let b=this._getRotation(),w;for(w=0;w<n;++w)b+=this._circumference(w,i);for(w=n;w<n+o;++w){const S=this._circumference(w,i),C=e[w],x={x:u+this.offsetX,y:p+this.offsetY,startAngle:b,endAngle:b+S,circumference:S,outerRadius:m,innerRadius:f};g&&(x.options=k||this.resolveDataElementOptions(w,C.active?"active":r)),b+=S,this.updateElement(C,w,x,r)}}calculateTotal(){const e=this._cachedMeta,n=e.data;let o=0,r;for(r=0;r<n.length;r++){const i=e._parsed[r];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(r)&&!n[r].hidden&&(o+=Math.abs(i))}return o}calculateCircumference(e){const n=this._cachedMeta.total;return n>0&&!isNaN(e)?ze*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,o=this.chart,r=o.data.labels||[],i=nB(n._parsed[e],o.options.locale);return{label:r[e]||"",value:i}}getMaxBorderWidth(e){let n=0;const o=this.chart;let r,i,s,c,d;if(!e){for(r=0,i=o.data.datasets.length;r<i;++r)if(o.isDatasetVisible(r)){s=o.getDatasetMeta(r),e=s.data,c=s.controller;break}}if(!e)return 0;for(r=0,i=e.length;r<i;++r)d=c.resolveDataElementOptions(r),d.borderAlign!=="inner"&&(n=Math.max(n,d.borderWidth||0,d.hoverBorderWidth||0));return n}getMaxOffset(e){let n=0;for(let o=0,r=e.length;o<r;++o){const i=this.resolveDataElementOptions(o);n=Math.max(n,i.offset||0,i.hoverOffset||0)}return n}_getRingWeightOffset(e){let n=0;for(let o=0;o<e;++o)this.chart.isDatasetVisible(o)&&(n+=this._getRingWeight(o));return n}_getRingWeight(e){return Math.max(be(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}se(il,"id","doughnut"),se(il,"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"}),se(il,"descriptors",{_scriptable:e=>e!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),se(il,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data,{labels:{pointStyle:o,textAlign:r,color:i,useBorderRadius:s,borderRadius:c}}=e.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((d,h)=>{const p=e.getDatasetMeta(0).controller.getStyle(h);return{text:d,fillStyle:p.backgroundColor,fontColor:i,hidden:!e.getDataVisibility(h),lineDash:p.borderDash,lineDashOffset:p.borderDashOffset,lineJoin:p.borderJoinStyle,lineWidth:p.borderWidth,strokeStyle:p.borderColor,textAlign:r,pointStyle:o,borderRadius:s&&(c||p.borderRadius),index:h}}):[]}},onClick(e,n,o){o.chart.toggleDataVisibility(n.index),o.chart.update()}}}});class YS extends Ms{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const n=this._cachedMeta,{dataset:o,data:r=[],_dataset:i}=n,s=this.chart._animationsDisabled;let{start:c,count:d}=CK(n,r,s);this._drawStart=c,this._drawCount=d,LK(n)&&(c=0,d=r.length),o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!i._decimated,o.points=r;const h=this.resolveDatasetElementOptions(e);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(o,void 0,{animated:!s,options:h},e),this.updateElements(r,c,d,e)}updateElements(e,n,o,r){const i=r==="reset",{iScale:s,vScale:c,_stacked:d,_dataset:h}=this._cachedMeta,{sharedOptions:u,includeOptions:p}=this._getSharedOptions(n,r),y=s.axis,f=c.axis,{spanGaps:m,segment:k}=this.options,g=r1(m)?m:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||i||r==="none",w=n+o,S=e.length;let C=n>0&&this.getParsed(n-1);for(let x=0;x<S;++x){const M=e[x],v=b?M:{};if(x<n||x>=w){v.skip=!0;continue}const L=this.getParsed(x),I=Ie(L[f]),_=v[y]=s.getPixelForValue(L[y],x),A=v[f]=i||I?c.getBasePixel():c.getPixelForValue(d?this.applyStack(c,L,d):L[f],x);v.skip=isNaN(_)||isNaN(A)||I,v.stop=x>0&&Math.abs(L[y]-C[y])>g,k&&(v.parsed=L,v.raw=h.data[x]),p&&(v.options=u||this.resolveDataElementOptions(x,M.active?"active":r)),b||this.updateElement(M,x,v,r),C=L}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,o=n.options&&n.options.borderWidth||0,r=e.data||[];if(!r.length)return o;const i=r[0].size(this.resolveDataElementOptions(0)),s=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(o,i,s)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}se(YS,"id","line"),se(YS,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),se(YS,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class kB extends il{}se(kB,"id","pie"),se(kB,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function xs(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class gB{constructor(e){se(this,"options");this.options=e||{}}static override(e){Object.assign(gB.prototype,e)}init(){}formats(){return xs()}parse(){return xs()}format(){return xs()}add(){return xs()}diff(){return xs()}startOf(){return xs()}endOf(){return xs()}}var ZX={_date:gB};function JX(t,e,n,o){const{controller:r,data:i,_sorted:s}=t,c=r._cachedMeta.iScale,d=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(c&&e===c.axis&&e!=="r"&&s&&i.length){const h=c._reversePixels?bK:ps;if(o){if(r._sharedOptions){const u=i[0],p=typeof u.getRange=="function"&&u.getRange(e);if(p){const y=h(i,e,n-p),f=h(i,e,n+p);return{lo:y.lo,hi:f.hi}}}}else{const u=h(i,e,n);if(d){const{vScale:p}=r._cachedMeta,{_parsed:y}=t,f=y.slice(0,u.lo+1).reverse().findIndex(k=>!Ie(k[p.axis]));u.lo-=Math.max(0,f);const m=y.slice(u.hi).findIndex(k=>!Ie(k[p.axis]));u.hi+=Math.max(0,m)}return u}}return{lo:0,hi:i.length-1}}function KS(t,e,n,o,r){const i=t.getSortedVisibleDatasetMetas(),s=n[e];for(let c=0,d=i.length;c<d;++c){const{index:h,data:u}=i[c],{lo:p,hi:y}=JX(i[c],e,s,r);for(let f=p;f<=y;++f){const m=u[f];m.skip||o(m,h,f)}}}function QX(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(o,r){const i=e?Math.abs(o.x-r.x):0,s=n?Math.abs(o.y-r.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(s,2))}}function bB(t,e,n,o,r){const i=[];return!r&&!t.isPointInArea(e)||KS(t,n,e,function(c,d,h){!r&&!c1(c,t.chartArea,0)||c.inRange(e.x,e.y,o)&&i.push({element:c,datasetIndex:d,index:h})},!0),i}function eZ(t,e,n,o){let r=[];function i(s,c,d){const{startAngle:h,endAngle:u}=s.getProps(["startAngle","endAngle"],o),{angle:p}=QP(s,{x:e.x,y:e.y});i1(p,h,u)&&r.push({element:s,datasetIndex:c,index:d})}return KS(t,n,e,i),r}function tZ(t,e,n,o,r,i){let s=[];const c=QX(n);let d=Number.POSITIVE_INFINITY;function h(u,p,y){const f=u.inRange(e.x,e.y,r);if(o&&!f)return;const m=u.getCenterPoint(r);if(!(!!i||t.isPointInArea(m))&&!f)return;const g=c(e,m);g<d?(s=[{element:u,datasetIndex:p,index:y}],d=g):g===d&&s.push({element:u,datasetIndex:p,index:y})}return KS(t,n,e,h),s}function MB(t,e,n,o,r,i){return!i&&!t.isPointInArea(e)?[]:n==="r"&&!o?eZ(t,e,n,r):tZ(t,e,n,o,r,i)}function ND(t,e,n,o,r){const i=[],s=n==="x"?"inXRange":"inYRange";let c=!1;return KS(t,n,e,(d,h,u)=>{d[s]&&d[s](e[n],r)&&(i.push({element:d,datasetIndex:h,index:u}),c=c||d.inRange(e.x,e.y,r))}),o&&!c?[]:i}var aZ={modes:{index(t,e,n,o){const r=gs(e,t),i=n.axis||"x",s=n.includeInvisible||!1,c=n.intersect?bB(t,r,i,o,s):MB(t,r,i,!1,o,s),d=[];return c.length?(t.getSortedVisibleDatasetMetas().forEach(h=>{const u=c[0].index,p=h.data[u];p&&!p.skip&&d.push({element:p,datasetIndex:h.index,index:u})}),d):[]},dataset(t,e,n,o){const r=gs(e,t),i=n.axis||"xy",s=n.includeInvisible||!1;let c=n.intersect?bB(t,r,i,o,s):MB(t,r,i,!1,o,s);if(c.length>0){const d=c[0].datasetIndex,h=t.getDatasetMeta(d).data;c=[];for(let u=0;u<h.length;++u)c.push({element:h[u],datasetIndex:d,index:u})}return c},point(t,e,n,o){const r=gs(e,t),i=n.axis||"xy",s=n.includeInvisible||!1;return bB(t,r,i,o,s)},nearest(t,e,n,o){const r=gs(e,t),i=n.axis||"xy",s=n.includeInvisible||!1;return MB(t,r,i,n.intersect,o,s)},x(t,e,n,o){const r=gs(e,t);return ND(t,r,"x",n.intersect,o)},y(t,e,n,o){const r=gs(e,t);return ND(t,r,"y",n.intersect,o)}}};const UD=["left","top","right","bottom"];function u1(t,e){return t.filter(n=>n.pos===e)}function WD(t,e){return t.filter(n=>UD.indexOf(n.pos)===-1&&n.box.axis===e)}function p1(t,e){return t.sort((n,o)=>{const r=e?o:n,i=e?n:o;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function nZ(t){const e=[];let n,o,r,i,s,c;for(n=0,o=(t||[]).length;n<o;++n)r=t[n],{position:i,options:{stack:s,stackWeight:c=1}}=r,e.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:s&&i+s,stackWeight:c});return e}function oZ(t){const e={};for(const n of t){const{stack:o,pos:r,stackWeight:i}=n;if(!o||!UD.includes(r))continue;const s=e[o]||(e[o]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=i}return e}function rZ(t,e){const n=oZ(t),{vBoxMaxWidth:o,hBoxMaxHeight:r}=e;let i,s,c;for(i=0,s=t.length;i<s;++i){c=t[i];const{fullSize:d}=c.box,h=n[c.stack],u=h&&c.stackWeight/h.weight;c.horizontal?(c.width=u?u*o:d&&e.availableWidth,c.height=r):(c.width=o,c.height=u?u*r:d&&e.availableHeight)}return n}function iZ(t){const e=nZ(t),n=p1(e.filter(h=>h.box.fullSize),!0),o=p1(u1(e,"left"),!0),r=p1(u1(e,"right")),i=p1(u1(e,"top"),!0),s=p1(u1(e,"bottom")),c=WD(e,"x"),d=WD(e,"y");return{fullSize:n,leftAndTop:o.concat(i),rightAndBottom:r.concat(d).concat(s).concat(c),chartArea:u1(e,"chartArea"),vertical:o.concat(r).concat(d),horizontal:i.concat(s).concat(c)}}function GD(t,e,n,o){return Math.max(t[n],e[n])+Math.max(t[o],e[o])}function YD(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function sZ(t,e,n,o){const{pos:r,box:i}=n,s=t.maxPadding;if(!we(r)){n.size&&(t[r]-=n.size);const p=o[n.stack]||{size:0,count:1};p.size=Math.max(p.size,n.horizontal?i.height:i.width),n.size=p.size/p.count,t[r]+=n.size}i.getPadding&&YD(s,i.getPadding());const c=Math.max(0,e.outerWidth-GD(s,t,"left","right")),d=Math.max(0,e.outerHeight-GD(s,t,"top","bottom")),h=c!==t.w,u=d!==t.h;return t.w=c,t.h=d,n.horizontal?{same:h,other:u}:{same:u,other:h}}function lZ(t){const e=t.maxPadding;function n(o){const r=Math.max(e[o]-t[o],0);return t[o]+=r,r}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function cZ(t,e){const n=e.maxPadding;function o(r){const i={left:0,top:0,right:0,bottom:0};return r.forEach(s=>{i[s]=Math.max(e[s],n[s])}),i}return o(t?["left","right"]:["top","bottom"])}function y1(t,e,n,o){const r=[];let i,s,c,d,h,u;for(i=0,s=t.length,h=0;i<s;++i){c=t[i],d=c.box,d.update(c.width||e.w,c.height||e.h,cZ(c.horizontal,e));const{same:p,other:y}=sZ(e,n,c,o);h|=p&&r.length,u=u||y,d.fullSize||r.push(c)}return h&&y1(r,e,n,o)||u}function XS(t,e,n,o,r){t.top=n,t.left=e,t.right=e+o,t.bottom=n+r,t.width=o,t.height=r}function KD(t,e,n,o){const r=n.padding;let{x:i,y:s}=e;for(const c of t){const d=c.box,h=o[c.stack]||{placed:0,weight:1},u=c.stackWeight/h.weight||1;if(c.horizontal){const p=e.w*u,y=h.size||d.height;n1(h.start)&&(s=h.start),d.fullSize?XS(d,r.left,s,n.outerWidth-r.right-r.left,y):XS(d,e.left+h.placed,s,p,y),h.start=s,h.placed+=p,s=d.bottom}else{const p=e.h*u,y=h.size||d.width;n1(h.start)&&(i=h.start),d.fullSize?XS(d,i,r.top,y,n.outerHeight-r.bottom-r.top):XS(d,i,e.top+h.placed,y,p),h.start=i,h.placed+=p,i=d.right}}e.x=i,e.y=s}var gt={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,o){if(!t)return;const r=kt(t.options.layout.padding),i=Math.max(e-r.width,0),s=Math.max(n-r.height,0),c=iZ(t.boxes),d=c.vertical,h=c.horizontal;Be(t.boxes,k=>{typeof k.beforeLayout=="function"&&k.beforeLayout()});const u=d.reduce((k,g)=>g.box.options&&g.box.options.display===!1?k:k+1,0)||1,p=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:i,availableHeight:s,vBoxMaxWidth:i/2/u,hBoxMaxHeight:s/2}),y=Object.assign({},r);YD(y,kt(o));const f=Object.assign({maxPadding:y,w:i,h:s,x:r.left,y:r.top},r),m=rZ(d.concat(h),p);y1(c.fullSize,f,p,m),y1(d,f,p,m),y1(h,f,p,m)&&y1(d,f,p,m),lZ(f),KD(c.leftAndTop,f,p,m),f.x+=f.w,f.y+=f.h,KD(c.rightAndBottom,f,p,m),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},Be(c.chartArea,k=>{const g=k.box;Object.assign(g,t.chartArea),g.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class XD{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,o){}removeEventListener(e,n,o){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,o,r){return n=Math.max(0,n||e.width),o=o||e.height,{width:n,height:Math.max(0,r?Math.floor(n/r):o)}}isAttached(e){return!0}updateConfig(e){}}class dZ extends XD{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ZS="$chartjs",hZ={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ZD=t=>t===null||t==="";function uZ(t,e){const n=t.style,o=t.getAttribute("height"),r=t.getAttribute("width");if(t[ZS]={initial:{height:o,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",ZD(r)){const i=wD(t,"width");i!==void 0&&(t.width=i)}if(ZD(o))if(t.style.height==="")t.height=t.width/(e||2);else{const i=wD(t,"height");i!==void 0&&(t.height=i)}return t}const JD=yX?{passive:!0}:!1;function pZ(t,e,n){t&&t.addEventListener(e,n,JD)}function yZ(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,JD)}function fZ(t,e){const n=hZ[t.type]||t.type,{x:o,y:r}=gs(t,e);return{type:n,chart:e,native:t,x:o!==void 0?o:null,y:r!==void 0?r:null}}function JS(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function mZ(t,e,n){const o=t.canvas,r=new MutationObserver(i=>{let s=!1;for(const c of i)s=s||JS(c.addedNodes,o),s=s&&!JS(c.removedNodes,o);s&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function kZ(t,e,n){const o=t.canvas,r=new MutationObserver(i=>{let s=!1;for(const c of i)s=s||JS(c.removedNodes,o),s=s&&!JS(c.addedNodes,o);s&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const f1=new Map;let QD=0;function eq(){const t=window.devicePixelRatio;t!==QD&&(QD=t,f1.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function gZ(t,e){f1.size||window.addEventListener("resize",eq),f1.set(t,e)}function bZ(t){f1.delete(t),f1.size||window.removeEventListener("resize",eq)}function MZ(t,e,n){const o=t.canvas,r=o&&uB(o);if(!r)return;const i=oD((c,d)=>{const h=r.clientWidth;n(c,d),h<r.clientWidth&&n()},window),s=new ResizeObserver(c=>{const d=c[0],h=d.contentRect.width,u=d.contentRect.height;h===0&&u===0||i(h,u)});return s.observe(r),gZ(t,i),s}function xB(t,e,n){n&&n.disconnect(),e==="resize"&&bZ(t)}function xZ(t,e,n){const o=t.canvas,r=oD(i=>{t.ctx!==null&&n(fZ(i,t))},t);return pZ(o,e,r),r}class wZ extends XD{acquireContext(e,n){const o=e&&e.getContext&&e.getContext("2d");return o&&o.canvas===e?(uZ(e,n),o):null}releaseContext(e){const n=e.canvas;if(!n[ZS])return!1;const o=n[ZS].initial;["height","width"].forEach(i=>{const s=o[i];Ie(s)?n.removeAttribute(i):n.setAttribute(i,s)});const r=o.style||{};return Object.keys(r).forEach(i=>{n.style[i]=r[i]}),n.width=n.width,delete n[ZS],!0}addEventListener(e,n,o){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),s={attach:mZ,detach:kZ,resize:MZ}[n]||xZ;r[n]=s(e,n,o)}removeEventListener(e,n){const o=e.$proxies||(e.$proxies={}),r=o[n];if(!r)return;({attach:xB,detach:xB,resize:xB}[n]||yZ)(e,n,r),o[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,o,r){return pX(e,n,o,r)}isAttached(e){const n=e&&uB(e);return!!(n&&n.isConnected)}}function vZ(t){return!hB()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?dZ:wZ}let ya=(hI=class{constructor(){se(this,"x");se(this,"y");se(this,"active",!1);se(this,"options");se(this,"$animations")}tooltipPosition(e){const{x:n,y:o}=this.getProps(["x","y"],e);return{x:n,y:o}}hasValue(){return r1(this.x)&&r1(this.y)}getProps(e,n){const o=this.$animations;if(!n||!o)return this;const r={};return e.forEach(i=>{r[i]=o[i]&&o[i].active()?o[i]._to:this[i]}),r}},se(hI,"defaults",{}),se(hI,"defaultRoutes"),hI);function CZ(t,e){const n=t.options.ticks,o=LZ(t),r=Math.min(n.maxTicksLimit||o,o),i=n.major.enabled?IZ(e):[],s=i.length,c=i[0],d=i[s-1],h=[];if(s>r)return _Z(e,h,i,s/r),h;const u=SZ(i,e,r);if(s>0){let p,y;const f=s>1?Math.round((d-c)/(s-1)):null;for(QS(e,h,u,Ie(f)?0:c-f,c),p=0,y=s-1;p<y;p++)QS(e,h,u,i[p],i[p+1]);return QS(e,h,u,d,Ie(f)?e.length:d+f),h}return QS(e,h,u),h}function LZ(t){const e=t.options.offset,n=t._tickSize(),o=t._length/n+(e?0:1),r=t._maxLength/n;return Math.floor(Math.min(o,r))}function SZ(t,e,n){const o=BZ(t),r=e.length/n;if(!o)return Math.max(r,1);const i=uK(o);for(let s=0,c=i.length-1;s<c;s++){const d=i[s];if(d>r)return d}return Math.max(r,1)}function IZ(t){const e=[];let n,o;for(n=0,o=t.length;n<o;n++)t[n].major&&e.push(n);return e}function _Z(t,e,n,o){let r=0,i=n[0],s;for(o=Math.ceil(o),s=0;s<t.length;s++)s===i&&(e.push(t[s]),r++,i=n[r*o])}function QS(t,e,n,o,r){const i=be(o,0),s=Math.min(be(r,t.length),t.length);let c=0,d,h,u;for(n=Math.ceil(n),r&&(d=r-o,n=d/Math.floor(d/n)),u=i;u<0;)c++,u=Math.round(i+c*n);for(h=Math.max(i,0);h<s;h++)h===u&&(e.push(t[h]),c++,u=Math.round(i+c*n))}function BZ(t){const e=t.length;let n,o;if(e<2)return!1;for(o=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==o)return!1;return o}const AZ=t=>t==="left"?"right":t==="right"?"left":t,tq=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,aq=(t,e)=>Math.min(e||t,t);function nq(t,e){const n=[],o=t.length/e,r=t.length;let i=0;for(;i<r;i+=o)n.push(t[Math.floor(i)]);return n}function VZ(t,e,n){const o=t.ticks.length,r=Math.min(e,o-1),i=t._startPixel,s=t._endPixel,c=1e-6;let d=t.getPixelForTick(r),h;if(!(n&&(o===1?h=Math.max(d-i,s-d):e===0?h=(t.getPixelForTick(1)-d)/2:h=(d-t.getPixelForTick(r-1))/2,d+=r<e?h:-h,d<i-c||d>s+c)))return d}function PZ(t,e){Be(t,n=>{const o=n.gc,r=o.length/2;let i;if(r>e){for(i=0;i<r;++i)delete n.data[o[i]];o.splice(0,r)}})}function m1(t){return t.drawTicks?t.tickLength:0}function oq(t,e){if(!t.display)return 0;const n=Ke(t.font,e),o=kt(t.padding);return($e(t.text)?t.text.length:1)*n.lineHeight+o.height}function DZ(t,e){return ms(t,{scale:e,type:"scale"})}function qZ(t,e,n){return ms(t,{tick:n,index:e,type:"tick"})}function zZ(t,e,n){let o=eB(t);return(n&&e!=="right"||!n&&e==="right")&&(o=AZ(o)),o}function EZ(t,e,n,o){const{top:r,left:i,bottom:s,right:c,chart:d}=t,{chartArea:h,scales:u}=d;let p=0,y,f,m;const k=s-r,g=c-i;if(t.isHorizontal()){if(f=Ye(o,i,c),we(n)){const b=Object.keys(n)[0],w=n[b];m=u[b].getPixelForValue(w)+k-e}else n==="center"?m=(h.bottom+h.top)/2+k-e:m=tq(t,n,e);y=c-i}else{if(we(n)){const b=Object.keys(n)[0],w=n[b];f=u[b].getPixelForValue(w)-g+e}else n==="center"?f=(h.left+h.right)/2-g+e:f=tq(t,n,e);m=Ye(o,s,r),p=n==="left"?-Re:Re}return{titleX:f,titleY:m,maxWidth:y,rotation:p}}class sl extends ya{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:o,_suggestedMax:r}=this;return e=Kt(e,Number.POSITIVE_INFINITY),n=Kt(n,Number.NEGATIVE_INFINITY),o=Kt(o,Number.POSITIVE_INFINITY),r=Kt(r,Number.NEGATIVE_INFINITY),{min:Kt(e,o),max:Kt(n,r),minDefined:We(e),maxDefined:We(n)}}getMinMax(e){let{min:n,max:o,minDefined:r,maxDefined:i}=this.getUserBounds(),s;if(r&&i)return{min:n,max:o};const c=this.getMatchingVisibleMetas();for(let d=0,h=c.length;d<h;++d)s=c[d].controller.getMinMax(this,e),r||(n=Math.min(n,s.min)),i||(o=Math.max(o,s.max));return n=i&&n>o?o:n,o=r&&n>o?n:o,{min:Kt(n,Kt(o,n)),max:Kt(o,Kt(n,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Pe(this.options.beforeUpdate,[this])}update(e,n,o){const{beginAtZero:r,grace:i,ticks:s}=this.options,c=s.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=o=Object.assign({left:0,right:0,top:0,bottom:0},o),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+o.left+o.right:this.height+o.top+o.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=UK(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const d=c<this.ticks.length;this._convertTicksToLabels(d?nq(this.ticks,c):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||s.source==="auto")&&(this.ticks=CZ(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),d&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,o;this.isHorizontal()?(n=this.left,o=this.right):(n=this.top,o=this.bottom,e=!e),this._startPixel=n,this._endPixel=o,this._reversePixels=e,this._length=o-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Pe(this.options.afterUpdate,[this])}beforeSetDimensions(){Pe(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(){Pe(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),Pe(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Pe(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let o,r,i;for(o=0,r=e.length;o<r;o++)i=e[o],i.label=Pe(n.callback,[i.value,o,e],this)}afterTickToLabelConversion(){Pe(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Pe(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,o=aq(this.ticks.length,e.ticks.maxTicksLimit),r=n.minRotation||0,i=n.maxRotation;let s=r,c,d,h;if(!this._isVisible()||!n.display||r>=i||o<=1||!this.isHorizontal()){this.labelRotation=r;return}const u=this._getLabelSizes(),p=u.widest.width,y=u.highest.height,f=Ge(this.chart.width-p,0,this.maxWidth);c=e.offset?this.maxWidth/o:f/(o-1),p+6>c&&(c=f/(o-(e.offset?.5:1)),d=this.maxHeight-m1(e.grid)-n.padding-oq(e.title,this.chart.options.font),h=Math.sqrt(p*p+y*y),s=mK(Math.min(Math.asin(Ge((u.highest.height+6)/c,-1,1)),Math.asin(Ge(d/h,-1,1))-Math.asin(Ge(y/h,-1,1)))),s=Math.max(r,Math.min(i,s))),this.labelRotation=s}afterCalculateLabelRotation(){Pe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Pe(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:o,title:r,grid:i}}=this,s=this._isVisible(),c=this.isHorizontal();if(s){const d=oq(r,n.options.font);if(c?(e.width=this.maxWidth,e.height=m1(i)+d):(e.height=this.maxHeight,e.width=m1(i)+d),o.display&&this.ticks.length){const{first:h,last:u,widest:p,highest:y}=this._getLabelSizes(),f=o.padding*2,m=ha(this.labelRotation),k=Math.cos(m),g=Math.sin(m);if(c){const b=o.mirror?0:g*p.width+k*y.height;e.height=Math.min(this.maxHeight,e.height+b+f)}else{const b=o.mirror?0:k*p.width+g*y.height;e.width=Math.min(this.maxWidth,e.width+b+f)}this._calculatePadding(h,u,g,k)}}this._handleMargins(),c?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,o,r){const{ticks:{align:i,padding:s},position:c}=this.options,d=this.labelRotation!==0,h=c!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,p=this.right-this.getPixelForTick(this.ticks.length-1);let y=0,f=0;d?h?(y=r*e.width,f=o*n.height):(y=o*e.height,f=r*n.width):i==="start"?f=n.width:i==="end"?y=e.width:i!=="inner"&&(y=e.width/2,f=n.width/2),this.paddingLeft=Math.max((y-u+s)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-p+s)*this.width/(this.width-p),0)}else{let u=n.height/2,p=e.height/2;i==="start"?(u=0,p=e.height):i==="end"&&(u=n.height,p=0),this.paddingTop=u+s,this.paddingBottom=p+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(){Pe(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,o;for(n=0,o=e.length;n<o;n++)Ie(e[n].label)&&(e.splice(n,1),o--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let o=this.ticks;n<o.length&&(o=nq(o,n)),this._labelSizes=e=this._computeLabelSizes(o,o.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,o){const{ctx:r,_longestTextCache:i}=this,s=[],c=[],d=Math.floor(n/aq(n,o));let h=0,u=0,p,y,f,m,k,g,b,w,S,C,x;for(p=0;p<n;p+=d){if(m=e[p].label,k=this._resolveTickFontOptions(p),r.font=g=k.string,b=i[g]=i[g]||{data:{},gc:[]},w=k.lineHeight,S=C=0,!Ie(m)&&!$e(m))S=dD(r,b.data,b.gc,S,m),C=w;else if($e(m))for(y=0,f=m.length;y<f;++y)x=m[y],!Ie(x)&&!$e(x)&&(S=dD(r,b.data,b.gc,S,x),C+=w);s.push(S),c.push(C),h=Math.max(S,h),u=Math.max(C,u)}PZ(i,n);const M=s.indexOf(h),v=c.indexOf(u),L=I=>({width:s[I]||0,height:c[I]||0});return{first:L(0),last:L(n-1),widest:L(M),highest:L(v),widths:s,heights:c}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return gK(this._alignToPixels?fs(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&e<n.length){const o=n[e];return o.$context||(o.$context=qZ(this.getContext(),e,o))}return this.$context||(this.$context=DZ(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=ha(this.labelRotation),o=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),i=this._getLabelSizes(),s=e.autoSkipPadding||0,c=i?i.widest.width+s:0,d=i?i.highest.height+s:0;return this.isHorizontal()?d*o>c*r?c/o:d/r:d*r<c*o?d/o:c/r}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,o=this.chart,r=this.options,{grid:i,position:s,border:c}=r,d=i.offset,h=this.isHorizontal(),p=this.ticks.length+(d?1:0),y=m1(i),f=[],m=c.setContext(this.getContext()),k=m.display?m.width:0,g=k/2,b=function(T){return fs(o,T,k)};let w,S,C,x,M,v,L,I,_,A,V,q;if(s==="top")w=b(this.bottom),v=this.bottom-y,I=w-g,A=b(e.top)+g,q=e.bottom;else if(s==="bottom")w=b(this.top),A=e.top,q=b(e.bottom)-g,v=w+g,I=this.top+y;else if(s==="left")w=b(this.right),M=this.right-y,L=w-g,_=b(e.left)+g,V=e.right;else if(s==="right")w=b(this.left),_=e.left,V=b(e.right)-g,M=w+g,L=this.left+y;else if(n==="x"){if(s==="center")w=b((e.top+e.bottom)/2+.5);else if(we(s)){const T=Object.keys(s)[0],H=s[T];w=b(this.chart.scales[T].getPixelForValue(H))}A=e.top,q=e.bottom,v=w+g,I=v+y}else if(n==="y"){if(s==="center")w=b((e.left+e.right)/2);else if(we(s)){const T=Object.keys(s)[0],H=s[T];w=b(this.chart.scales[T].getPixelForValue(H))}M=w-g,L=M-y,_=e.left,V=e.right}const O=be(r.ticks.maxTicksLimit,p),N=Math.max(1,Math.ceil(p/O));for(S=0;S<p;S+=N){const T=this.getContext(S),H=i.setContext(T),j=c.setContext(T),Z=H.lineWidth,P=H.color,D=j.dash||[],G=j.dashOffset,ne=H.tickWidth,te=H.tickColor,ce=H.tickBorderDash||[],pe=H.tickBorderDashOffset;C=VZ(this,S,d),C!==void 0&&(x=fs(o,C,Z),h?M=L=_=V=x:v=I=A=q=x,f.push({tx1:M,ty1:v,tx2:L,ty2:I,x1:_,y1:A,x2:V,y2:q,width:Z,color:P,borderDash:D,borderDashOffset:G,tickWidth:ne,tickColor:te,tickBorderDash:ce,tickBorderDashOffset:pe}))}return this._ticksLength=p,this._borderValue=w,f}_computeLabelItems(e){const n=this.axis,o=this.options,{position:r,ticks:i}=o,s=this.isHorizontal(),c=this.ticks,{align:d,crossAlign:h,padding:u,mirror:p}=i,y=m1(o.grid),f=y+u,m=p?-u:f,k=-ha(this.labelRotation),g=[];let b,w,S,C,x,M,v,L,I,_,A,V,q="middle";if(r==="top")M=this.bottom-m,v=this._getXAxisLabelAlignment();else if(r==="bottom")M=this.top+m,v=this._getXAxisLabelAlignment();else if(r==="left"){const N=this._getYAxisLabelAlignment(y);v=N.textAlign,x=N.x}else if(r==="right"){const N=this._getYAxisLabelAlignment(y);v=N.textAlign,x=N.x}else if(n==="x"){if(r==="center")M=(e.top+e.bottom)/2+f;else if(we(r)){const N=Object.keys(r)[0],T=r[N];M=this.chart.scales[N].getPixelForValue(T)+f}v=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")x=(e.left+e.right)/2-f;else if(we(r)){const N=Object.keys(r)[0],T=r[N];x=this.chart.scales[N].getPixelForValue(T)}v=this._getYAxisLabelAlignment(y).textAlign}n==="y"&&(d==="start"?q="top":d==="end"&&(q="bottom"));const O=this._getLabelSizes();for(b=0,w=c.length;b<w;++b){S=c[b],C=S.label;const N=i.setContext(this.getContext(b));L=this.getPixelForTick(b)+i.labelOffset,I=this._resolveTickFontOptions(b),_=I.lineHeight,A=$e(C)?C.length:1;const T=A/2,H=N.color,j=N.textStrokeColor,Z=N.textStrokeWidth;let P=v;s?(x=L,v==="inner"&&(b===w-1?P=this.options.reverse?"left":"right":b===0?P=this.options.reverse?"right":"left":P="center"),r==="top"?h==="near"||k!==0?V=-A*_+_/2:h==="center"?V=-O.highest.height/2-T*_+_:V=-O.highest.height+_/2:h==="near"||k!==0?V=_/2:h==="center"?V=O.highest.height/2-T*_:V=O.highest.height-A*_,p&&(V*=-1),k!==0&&!N.showLabelBackdrop&&(x+=_/2*Math.sin(k))):(M=L,V=(1-A)*_/2);let D;if(N.showLabelBackdrop){const G=kt(N.backdropPadding),ne=O.heights[b],te=O.widths[b];let ce=V-G.top,pe=0-G.left;switch(q){case"middle":ce-=ne/2;break;case"bottom":ce-=ne;break}switch(v){case"center":pe-=te/2;break;case"right":pe-=te;break;case"inner":b===w-1?pe-=te:b>0&&(pe-=te/2);break}D={left:pe,top:ce,width:te+G.width,height:ne+G.height,color:N.backdropColor}}g.push({label:C,font:I,textOffset:V,options:{rotation:k,color:H,strokeColor:j,strokeWidth:Z,textAlign:P,textBaseline:q,translation:[x,M],backdrop:D}})}return g}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-ha(this.labelRotation))return e==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:o,mirror:r,padding:i}}=this.options,s=this._getLabelSizes(),c=e+i,d=s.widest.width;let h,u;return n==="left"?r?(u=this.right+i,o==="near"?h="left":o==="center"?(h="center",u+=d/2):(h="right",u+=d)):(u=this.right-c,o==="near"?h="right":o==="center"?(h="center",u-=d/2):(h="left",u=this.left)):n==="right"?r?(u=this.left+i,o==="near"?h="right":o==="center"?(h="center",u-=d/2):(h="left",u-=d)):(u=this.left+c,o==="near"?h="left":o==="center"?(h="center",u+=d/2):(h="right",u=this.right)):h="right",{textAlign:h,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:o,top:r,width:i,height:s}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(o,r,i,s),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(i=>i.value===e);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(e){const n=this.options.grid,o=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let i,s;const c=(d,h,u)=>{!u.width||!u.color||(o.save(),o.lineWidth=u.width,o.strokeStyle=u.color,o.setLineDash(u.borderDash||[]),o.lineDashOffset=u.borderDashOffset,o.beginPath(),o.moveTo(d.x,d.y),o.lineTo(h.x,h.y),o.stroke(),o.restore())};if(n.display)for(i=0,s=r.length;i<s;++i){const d=r[i];n.drawOnChartArea&&c({x:d.x1,y:d.y1},{x:d.x2,y:d.y2},d),n.drawTicks&&c({x:d.tx1,y:d.ty1},{x:d.tx2,y:d.ty2},{color:d.tickColor,width:d.tickWidth,borderDash:d.tickBorderDash,borderDashOffset:d.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:n,options:{border:o,grid:r}}=this,i=o.setContext(this.getContext()),s=o.display?i.width:0;if(!s)return;const c=r.setContext(this.getContext(0)).lineWidth,d=this._borderValue;let h,u,p,y;this.isHorizontal()?(h=fs(e,this.left,s)-s/2,u=fs(e,this.right,c)+c/2,p=y=d):(p=fs(e,this.top,s)-s/2,y=fs(e,this.bottom,c)+c/2,h=u=d),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(h,p),n.lineTo(u,y),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const o=this.ctx,r=this._computeLabelArea();r&&HS(o,r);const i=this.getLabelItems(e);for(const s of i){const c=s.options,d=s.font,h=s.label,u=s.textOffset;d1(o,h,0,u,d,c)}r&&FS(o)}drawTitle(){const{ctx:e,options:{position:n,title:o,reverse:r}}=this;if(!o.display)return;const i=Ke(o.font),s=kt(o.padding),c=o.align;let d=i.lineHeight/2;n==="bottom"||n==="center"||we(n)?(d+=s.bottom,$e(o.text)&&(d+=i.lineHeight*(o.text.length-1))):d+=s.top;const{titleX:h,titleY:u,maxWidth:p,rotation:y}=EZ(this,d,n,c);d1(e,o.text,0,0,i,{color:o.color,maxWidth:p,rotation:y,textAlign:zZ(c,n,r),textBaseline:"middle",translation:[h,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,o=be(e.grid&&e.grid.z,-1),r=be(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==sl.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:o,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),o=this.axis+"AxisID",r=[];let i,s;for(i=0,s=n.length;i<s;++i){const c=n[i];c[o]===this.id&&(!e||c.type===e)&&r.push(c)}return r}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return Ke(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class eI{constructor(e,n,o){this.type=e,this.scope=n,this.override=o,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let o;HZ(n)&&(o=this.register(n));const r=this.items,i=e.id,s=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+e);return i in r||(r[i]=e,TZ(e,s,o),this.override&&Fe.override(e.id,e.overrides)),s}get(e){return this.items[e]}unregister(e){const n=this.items,o=e.id,r=this.scope;o in n&&delete n[o],r&&o in Fe[r]&&(delete Fe[r][o],this.override&&delete ys[o])}}function TZ(t,e,n){const o=t1(Object.create(null),[n?Fe.get(n):{},Fe.get(e),t.defaults]);Fe.set(e,o),t.defaultRoutes&&OZ(e,t.defaultRoutes),t.descriptors&&Fe.describe(e,t.descriptors)}function OZ(t,e){Object.keys(e).forEach(n=>{const o=n.split("."),r=o.pop(),i=[t].concat(o).join("."),s=e[n].split("."),c=s.pop(),d=s.join(".");Fe.route(i,r,d,c)})}function HZ(t){return"id"in t&&"defaults"in t}class FZ{constructor(){this.controllers=new eI(Ms,"datasets",!0),this.elements=new eI(ya,"elements"),this.plugins=new eI(Object,"plugins"),this.scales=new eI(sl,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,o){[...n].forEach(r=>{const i=o||this._getRegistryForType(r);o||i.isForType(r)||i===this.plugins&&r.id?this._exec(e,i,r):Be(r,s=>{const c=o||this._getRegistryForType(s);this._exec(e,c,s)})})}_exec(e,n,o){const r=Z_(e);Pe(o["before"+r],[],o),n[e](o),Pe(o["after"+r],[],o)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const o=this._typedRegistries[n];if(o.isForType(e))return o}return this.plugins}_get(e,n,o){const r=n.get(e);if(r===void 0)throw new Error('"'+e+'" is not a registered '+o+".");return r}}var Zt=new FZ;class $Z{constructor(){this._init=void 0}notify(e,n,o,r){if(n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const i=r?this._descriptors(e).filter(r):this._descriptors(e),s=this._notify(i,e,n,o);return n==="afterDestroy"&&(this._notify(i,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),s}_notify(e,n,o,r){r=r||{};for(const i of e){const s=i.plugin,c=s[o],d=[n,r,i.options];if(Pe(c,d,s)===!1&&r.cancelable)return!1}return!0}invalidate(){Ie(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const o=e&&e.config,r=be(o.options&&o.options.plugins,{}),i=jZ(o);return r===!1&&!n?[]:NZ(e,i,r,n)}_notifyStateChanges(e){const n=this._oldCache||[],o=this._cache,r=(i,s)=>i.filter(c=>!s.some(d=>c.plugin.id===d.plugin.id));this._notify(r(n,o),e,"stop"),this._notify(r(o,n),e,"start")}}function jZ(t){const e={},n=[],o=Object.keys(Zt.plugins.items);for(let i=0;i<o.length;i++)n.push(Zt.getPlugin(o[i]));const r=t.plugins||[];for(let i=0;i<r.length;i++){const s=r[i];n.indexOf(s)===-1&&(n.push(s),e[s.id]=!0)}return{plugins:n,localIds:e}}function RZ(t,e){return!e&&t===!1?null:t===!0?{}:t}function NZ(t,{plugins:e,localIds:n},o,r){const i=[],s=t.getContext();for(const c of e){const d=c.id,h=RZ(o[d],r);h!==null&&i.push({plugin:c,options:UZ(t.config,{plugin:c,local:n[d]},h,s)})}return i}function UZ(t,{plugin:e,local:n},o,r){const i=t.pluginScopeKeys(e),s=t.getOptionScopes(o,i);return n&&e.defaults&&s.push(e.defaults),t.createResolver(s,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function wB(t,e){const n=Fe.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function WZ(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function GZ(t,e){return t===e?"_index_":"_value_"}function rq(t){if(t==="x"||t==="y"||t==="r")return t}function YZ(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function vB(t,...e){if(rq(t))return t;for(const n of e){const o=n.axis||YZ(n.position)||t.length>1&&rq(t[0].toLowerCase());if(o)return o}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function iq(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function KZ(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(o=>o.xAxisID===t||o.yAxisID===t);if(n.length)return iq(t,"x",n[0])||iq(t,"y",n[0])}return{}}function XZ(t,e){const n=ys[t.type]||{scales:{}},o=e.scales||{},r=wB(t.type,e),i=Object.create(null);return Object.keys(o).forEach(s=>{const c=o[s];if(!we(c))return console.error(`Invalid scale configuration for scale: ${s}`);if(c._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${s}`);const d=vB(s,c,KZ(s,t),Fe.scales[c.type]),h=GZ(d,r),u=n.scales||{};i[s]=a1(Object.create(null),[{axis:d},c,u[d],u[h]])}),t.data.datasets.forEach(s=>{const c=s.type||t.type,d=s.indexAxis||wB(c,e),u=(ys[c]||{}).scales||{};Object.keys(u).forEach(p=>{const y=WZ(p,d),f=s[y+"AxisID"]||y;i[f]=i[f]||Object.create(null),a1(i[f],[{axis:y},o[f],u[p]])})}),Object.keys(i).forEach(s=>{const c=i[s];a1(c,[Fe.scales[c.type],Fe.scale])}),i}function sq(t){const e=t.options||(t.options={});e.plugins=be(e.plugins,{}),e.scales=XZ(t,e)}function lq(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function ZZ(t){return t=t||{},t.data=lq(t.data),sq(t),t}const cq=new Map,dq=new Set;function tI(t,e){let n=cq.get(t);return n||(n=e(),cq.set(t,n),dq.add(n)),n}const k1=(t,e,n)=>{const o=hs(e,n);o!==void 0&&t.add(o)};class JZ{constructor(e){this._config=ZZ(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=lq(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),sq(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return tI(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return tI(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return tI(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,o=this.type;return tI(`${o}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const o=this._scopeCache;let r=o.get(e);return(!r||n)&&(r=new Map,o.set(e,r)),r}getOptionScopes(e,n,o){const{options:r,type:i}=this,s=this._cachedScopes(e,o),c=s.get(n);if(c)return c;const d=new Set;n.forEach(u=>{e&&(d.add(e),u.forEach(p=>k1(d,e,p))),u.forEach(p=>k1(d,r,p)),u.forEach(p=>k1(d,ys[i]||{},p)),u.forEach(p=>k1(d,Fe,p)),u.forEach(p=>k1(d,oB,p))});const h=Array.from(d);return h.length===0&&h.push(Object.create(null)),dq.has(n)&&s.set(n,h),h}chartOptionScopes(){const{options:e,type:n}=this;return[e,ys[n]||{},Fe.datasets[n]||{},{type:n},Fe,oB]}resolveNamedOptions(e,n,o,r=[""]){const i={$shared:!0},{resolver:s,subPrefixes:c}=hq(this._resolverCache,e,r);let d=s;if(eJ(s,n)){i.$shared=!1,o=Ra(o)?o():o;const h=this.createResolver(e,o,c);d=nl(s,o,h)}for(const h of n)i[h]=d[h];return i}createResolver(e,n,o=[""],r){const{resolver:i}=hq(this._resolverCache,e,o);return we(n)?nl(i,n,void 0,r):i}}function hq(t,e,n){let o=t.get(e);o||(o=new Map,t.set(e,o));const r=n.join();let i=o.get(r);return i||(i={resolver:lB(e,n),subPrefixes:n.filter(c=>!c.toLowerCase().includes("hover"))},o.set(r,i)),i}const QZ=t=>we(t)&&Object.getOwnPropertyNames(t).some(e=>Ra(t[e]));function eJ(t,e){const{isScriptable:n,isIndexable:o}=yD(t);for(const r of e){const i=n(r),s=o(r),c=(s||i)&&t[r];if(i&&(Ra(c)||QZ(c))||s&&$e(c))return!0}return!1}var tJ="4.5.1";const aJ=["top","bottom","left","right","chartArea"];function uq(t,e){return t==="top"||t==="bottom"||aJ.indexOf(t)===-1&&e==="x"}function pq(t,e){return function(n,o){return n[t]===o[t]?n[e]-o[e]:n[t]-o[t]}}function yq(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),Pe(n&&n.onComplete,[t],e)}function nJ(t){const e=t.chart,n=e.options.animation;Pe(n&&n.onProgress,[t],e)}function fq(t){return hB()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const aI={},mq=t=>{const e=fq(t);return Object.values(aI).filter(n=>n.canvas===e).pop()};function oJ(t,e,n){const o=Object.keys(t);for(const r of o){const i=+r;if(i>=e){const s=t[r];delete t[r],(n>0||i>e)&&(t[i+n]=s)}}}function rJ(t,e,n,o){return!n||t.type==="mouseout"?null:o?e:t}class fa{static register(...e){Zt.add(...e),kq()}static unregister(...e){Zt.remove(...e),kq()}constructor(e,n){const o=this.config=new JZ(n),r=fq(e),i=mq(r);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=o.createResolver(o.chartOptionScopes(),this.getContext());this.platform=new(o.platform||vZ(r)),this.platform.updateConfig(o);const c=this.platform.acquireContext(r,s.aspectRatio),d=c&&c.canvas,h=d&&d.height,u=d&&d.width;if(this.id=nK(),this.ctx=c,this.canvas=d,this.width=u,this.height=h,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 $Z,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=wK(p=>this.update(p),s.resizeDelay||0),this._dataChanges=[],aI[this.id]=this,!c||!d){console.error("Failed to create chart: can't acquire context from the given item");return}pa.listen(this,"complete",yq),pa.listen(this,"progress",nJ),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:o,height:r,_aspectRatio:i}=this;return Ie(e)?n&&i?i:r?o/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Zt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():xD(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return hD(this.canvas,this.ctx),this}stop(){return pa.stop(this),this}resize(e,n){pa.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const o=this.options,r=this.canvas,i=o.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(r,e,n,i),c=o.devicePixelRatio||this.platform.getDevicePixelRatio(),d=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,xD(this,c,!0)&&(this.notifyPlugins("resize",{size:s}),Pe(o.onResize,[this,s],this),this.attached&&this._doResize(d)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Be(n,(o,r)=>{o.id=r})}buildOrUpdateScales(){const e=this.options,n=e.scales,o=this.scales,r=Object.keys(o).reduce((s,c)=>(s[c]=!1,s),{});let i=[];n&&(i=i.concat(Object.keys(n).map(s=>{const c=n[s],d=vB(s,c),h=d==="r",u=d==="x";return{options:c,dposition:h?"chartArea":u?"bottom":"left",dtype:h?"radialLinear":u?"category":"linear"}}))),Be(i,s=>{const c=s.options,d=c.id,h=vB(d,c),u=be(c.type,s.dtype);(c.position===void 0||uq(c.position,h)!==uq(s.dposition))&&(c.position=s.dposition),r[d]=!0;let p=null;if(d in o&&o[d].type===u)p=o[d];else{const y=Zt.getScale(u);p=new y({id:d,type:u,ctx:this.ctx,chart:this}),o[p.id]=p}p.init(c,e)}),Be(r,(s,c)=>{s||delete o[c]}),Be(o,s=>{gt.configure(this,s,s.options),gt.addBox(this,s)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,o=e.length;if(e.sort((r,i)=>r.index-i.index),o>n){for(let r=n;r<o;++r)this._destroyDatasetMeta(r);e.splice(n,o-n)}this._sortedMetasets=e.slice(0).sort(pq("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((o,r)=>{n.filter(i=>i===o._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let o,r;for(this._removeUnreferencedMetasets(),o=0,r=n.length;o<r;o++){const i=n[o];let s=this.getDatasetMeta(o);const c=i.type||this.config.type;if(s.type&&s.type!==c&&(this._destroyDatasetMeta(o),s=this.getDatasetMeta(o)),s.type=c,s.indexAxis=i.indexAxis||wB(c,this.options),s.order=i.order||0,s.index=o,s.label=""+i.label,s.visible=this.isDatasetVisible(o),s.controller)s.controller.updateIndex(o),s.controller.linkScales();else{const d=Zt.getController(c),{datasetElementType:h,dataElementType:u}=Fe.datasets[c];Object.assign(d,{dataElementType:Zt.getElement(u),datasetElementType:h&&Zt.getElement(h)}),s.controller=new d(this,o),e.push(s.controller)}}return this._updateMetasets(),e}_resetElements(){Be(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const o=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!o.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let h=0,u=this.data.datasets.length;h<u;h++){const{controller:p}=this.getDatasetMeta(h),y=!r&&i.indexOf(p)===-1;p.buildOrUpdateElements(y),s=Math.max(+p.getMaxOverflow(),s)}s=this._minPadding=o.layout.autoPadding?s:0,this._updateLayout(s),r||Be(i,h=>{h.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(pq("z","_idx"));const{_active:c,_lastEvent:d}=this;d?this._eventHandler(d,!0):c.length&&this._updateHoverStyles(c,c,!0),this.render()}_updateScales(){Be(this.scales,e=>{gt.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),o=new Set(e.events);(!YP(n,o)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:o,start:r,count:i}of n){const s=o==="_removeElements"?-i:i;oJ(e,r,s)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,o=i=>new Set(e.filter(s=>s[0]===i).map((s,c)=>c+","+s.splice(1).join(","))),r=o(0);for(let i=1;i<n;i++)if(!YP(r,o(i)))return;return Array.from(r).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;gt.update(this,this.width,this.height,e);const n=this.chartArea,o=n.width<=0||n.height<=0;this._layers=[],Be(this.boxes,r=>{o&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,i)=>{r._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,o=this.data.datasets.length;n<o;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,o=this.data.datasets.length;n<o;++n)this._updateDataset(n,Ra(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const o=this.getDatasetMeta(e),r={meta:o,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",r)!==!1&&(o.controller._update(n),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(pa.has(this)?this.attached&&!pa.running(this)&&pa.start(this):(this.draw(),yq({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:o,height:r}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(o,r)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,o=[];let r,i;for(r=0,i=n.length;r<i;++r){const s=n[r];(!e||s.visible)&&o.push(s)}return o}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,o={meta:e,index:e.index,cancelable:!0},r=VD(this,e);this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(r&&HS(n,r),e.controller.draw(),r&&FS(n),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return c1(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,o,r){const i=aZ.modes[n];return typeof i=="function"?i(this,e,o,r):[]}getDatasetMeta(e){const n=this.data.datasets[e],o=this._metasets;let r=o.filter(i=>i&&i._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},o.push(r)),r}getContext(){return this.$context||(this.$context=ms(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const o=this.getDatasetMeta(e);return typeof o.hidden=="boolean"?!o.hidden:!n.hidden}setDatasetVisibility(e,n){const o=this.getDatasetMeta(e);o.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,o){const r=o?"show":"hide",i=this.getDatasetMeta(e),s=i.controller._resolveAnimations(void 0,r);n1(n)?(i.data[n].hidden=!o,this.update()):(this.setDatasetVisibility(e,o),s.update(i,{visible:o}),this.update(c=>c.datasetIndex===e?r:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),pa.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),hD(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete aI[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,o=(i,s)=>{n.addEventListener(this,i,s),e[i]=s},r=(i,s,c)=>{i.offsetX=s,i.offsetY=c,this._eventHandler(i)};Be(this.options.events,i=>o(i,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,o=(d,h)=>{n.addEventListener(this,d,h),e[d]=h},r=(d,h)=>{e[d]&&(n.removeEventListener(this,d,h),delete e[d])},i=(d,h)=>{this.canvas&&this.resize(d,h)};let s;const c=()=>{r("attach",c),this.attached=!0,this.resize(),o("resize",i),o("detach",s)};s=()=>{this.attached=!1,r("resize",i),this._stop(),this._resize(0,0),o("attach",c)},n.isAttached(this.canvas)?c():s()}unbindEvents(){Be(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},Be(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,o){const r=o?"set":"remove";let i,s,c,d;for(n==="dataset"&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller["_"+r+"DatasetHoverStyle"]()),c=0,d=e.length;c<d;++c){s=e[c];const h=s&&this.getDatasetMeta(s.datasetIndex).controller;h&&h[r+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],o=e.map(({datasetIndex:i,index:s})=>{const c=this.getDatasetMeta(i);if(!c)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:c.data[s],index:s}});!zS(o,n)&&(this._active=o,this._lastEvent=null,this._updateHoverStyles(o,n))}notifyPlugins(e,n,o){return this._plugins.notify(this,e,n,o)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,o){const r=this.options.hover,i=(d,h)=>d.filter(u=>!h.some(p=>u.datasetIndex===p.datasetIndex&&u.index===p.index)),s=i(n,e),c=o?e:i(e,n);s.length&&this.updateHoverStyle(s,r.mode,!1),c.length&&r.mode&&this.updateHoverStyle(c,r.mode,!0)}_eventHandler(e,n){const o={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},r=s=>(s.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",o,r)===!1)return;const i=this._handleEvent(e,n,o.inChartArea);return o.cancelable=!1,this.notifyPlugins("afterEvent",o,r),(i||o.changed)&&this.render(),this}_handleEvent(e,n,o){const{_active:r=[],options:i}=this,s=n,c=this._getActiveElements(e,r,o,s),d=cK(e),h=rJ(e,this._lastEvent,o,d);o&&(this._lastEvent=null,Pe(i.onHover,[e,c,this],this),d&&Pe(i.onClick,[e,c,this],this));const u=!zS(c,r);return(u||n)&&(this._active=c,this._updateHoverStyles(c,r,n)),this._lastEvent=h,u}_getActiveElements(e,n,o,r){if(e.type==="mouseout")return[];if(!o)return n;const i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,r)}}se(fa,"defaults",Fe),se(fa,"instances",aI),se(fa,"overrides",ys),se(fa,"registry",Zt),se(fa,"version",tJ),se(fa,"getChart",mq);function kq(){return Be(fa.instances,t=>t._plugins.invalidate())}function iJ(t,e,n){const{startAngle:o,x:r,y:i,outerRadius:s,innerRadius:c,options:d}=e,{borderWidth:h,borderJoinStyle:u}=d,p=Math.min(h/s,dt(o-n));if(t.beginPath(),t.arc(r,i,s-h/2,o+p/2,n-p/2),c>0){const y=Math.min(h/c,dt(o-n));t.arc(r,i,c+h/2,n-y/2,o+y/2,!0)}else{const y=Math.min(h/2,s*dt(o-n));if(u==="round")t.arc(r,i,y,n-Ae/2,o+Ae/2,!0);else if(u==="bevel"){const f=2*y*y,m=-f*Math.cos(n+Ae/2)+r,k=-f*Math.sin(n+Ae/2)+i,g=f*Math.cos(o+Ae/2)+r,b=f*Math.sin(o+Ae/2)+i;t.lineTo(m,k),t.lineTo(g,b)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function sJ(t,e,n){const{startAngle:o,pixelMargin:r,x:i,y:s,outerRadius:c,innerRadius:d}=e;let h=r/c;t.beginPath(),t.arc(i,s,c,o-h,n+h),d>r?(h=r/d,t.arc(i,s,d,n+h,o-h,!0)):t.arc(i,s,r,n+Re,o-Re),t.closePath(),t.clip()}function lJ(t){return sB(t,["outerStart","outerEnd","innerStart","innerEnd"])}function cJ(t,e,n,o){const r=lJ(t.options.borderRadius),i=(n-e)/2,s=Math.min(i,o*e/2),c=d=>{const h=(n-Math.min(i,d))*o/2;return Ge(d,0,Math.min(i,h))};return{outerStart:c(r.outerStart),outerEnd:c(r.outerEnd),innerStart:Ge(r.innerStart,0,s),innerEnd:Ge(r.innerEnd,0,s)}}function ll(t,e,n,o){return{x:n+t*Math.cos(e),y:o+t*Math.sin(e)}}function nI(t,e,n,o,r,i){const{x:s,y:c,startAngle:d,pixelMargin:h,innerRadius:u}=e,p=Math.max(e.outerRadius+o+n-h,0),y=u>0?u+o+n+h:0;let f=0;const m=r-d;if(o){const N=u>0?u-o:0,T=p>0?p-o:0,H=(N+T)/2,j=H!==0?m*H/(H+o):m;f=(m-j)/2}const k=Math.max(.001,m*p-n/Ae)/p,g=(m-k)/2,b=d+g+f,w=r-g-f,{outerStart:S,outerEnd:C,innerStart:x,innerEnd:M}=cJ(e,y,p,w-b),v=p-S,L=p-C,I=b+S/v,_=w-C/L,A=y+x,V=y+M,q=b+x/A,O=w-M/V;if(t.beginPath(),i){const N=(I+_)/2;if(t.arc(s,c,p,I,N),t.arc(s,c,p,N,_),C>0){const Z=ll(L,_,s,c);t.arc(Z.x,Z.y,C,_,w+Re)}const T=ll(V,w,s,c);if(t.lineTo(T.x,T.y),M>0){const Z=ll(V,O,s,c);t.arc(Z.x,Z.y,M,w+Re,O+Math.PI)}const H=(w-M/y+(b+x/y))/2;if(t.arc(s,c,y,w-M/y,H,!0),t.arc(s,c,y,H,b+x/y,!0),x>0){const Z=ll(A,q,s,c);t.arc(Z.x,Z.y,x,q+Math.PI,b-Re)}const j=ll(v,b,s,c);if(t.lineTo(j.x,j.y),S>0){const Z=ll(v,I,s,c);t.arc(Z.x,Z.y,S,b-Re,I)}}else{t.moveTo(s,c);const N=Math.cos(I)*p+s,T=Math.sin(I)*p+c;t.lineTo(N,T);const H=Math.cos(_)*p+s,j=Math.sin(_)*p+c;t.lineTo(H,j)}t.closePath()}function dJ(t,e,n,o,r){const{fullCircles:i,startAngle:s,circumference:c}=e;let d=e.endAngle;if(i){nI(t,e,n,o,d,r);for(let h=0;h<i;++h)t.fill();isNaN(c)||(d=s+(c%ze||ze))}return nI(t,e,n,o,d,r),t.fill(),d}function hJ(t,e,n,o,r){const{fullCircles:i,startAngle:s,circumference:c,options:d}=e,{borderWidth:h,borderJoinStyle:u,borderDash:p,borderDashOffset:y,borderRadius:f}=d,m=d.borderAlign==="inner";if(!h)return;t.setLineDash(p||[]),t.lineDashOffset=y,m?(t.lineWidth=h*2,t.lineJoin=u||"round"):(t.lineWidth=h,t.lineJoin=u||"bevel");let k=e.endAngle;if(i){nI(t,e,n,o,k,r);for(let g=0;g<i;++g)t.stroke();isNaN(c)||(k=s+(c%ze||ze))}m&&sJ(t,e,k),d.selfJoin&&k-s>=Ae&&f===0&&u!=="miter"&&iJ(t,e,k),i||(nI(t,e,n,o,k,r),t.stroke())}class g1 extends ya{constructor(n){super();se(this,"circumference");se(this,"endAngle");se(this,"fullCircles");se(this,"innerRadius");se(this,"outerRadius");se(this,"pixelMargin");se(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,o,r){const i=this.getProps(["x","y"],r),{angle:s,distance:c}=QP(i,{x:n,y:o}),{startAngle:d,endAngle:h,innerRadius:u,outerRadius:p,circumference:y}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),f=(this.options.spacing+this.options.borderWidth)/2,m=be(y,h-d),k=i1(s,d,h)&&d!==h,g=m>=ze||k,b=ua(c,u+f,p+f);return g&&b}getCenterPoint(n){const{x:o,y:r,startAngle:i,endAngle:s,innerRadius:c,outerRadius:d}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:h,spacing:u}=this.options,p=(i+s)/2,y=(c+d+u+h)/2;return{x:o+Math.cos(p)*y,y:r+Math.sin(p)*y}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:o,circumference:r}=this,i=(o.offset||0)/4,s=(o.spacing||0)/2,c=o.circular;if(this.pixelMargin=o.borderAlign==="inner"?.33:0,this.fullCircles=r>ze?Math.floor(r/ze):0,r===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const d=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(d)*i,Math.sin(d)*i);const h=1-Math.sin(Math.min(Ae,r||0)),u=i*h;n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,dJ(n,this,u,s,c),hJ(n,this,u,s,c),n.restore()}}se(g1,"id","arc"),se(g1,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),se(g1,"defaultRoutes",{backgroundColor:"backgroundColor"}),se(g1,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function gq(t,e,n=e){t.lineCap=be(n.borderCapStyle,e.borderCapStyle),t.setLineDash(be(n.borderDash,e.borderDash)),t.lineDashOffset=be(n.borderDashOffset,e.borderDashOffset),t.lineJoin=be(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=be(n.borderWidth,e.borderWidth),t.strokeStyle=be(n.borderColor,e.borderColor)}function uJ(t,e,n){t.lineTo(n.x,n.y)}function pJ(t){return t.stepped?EK:t.tension||t.cubicInterpolationMode==="monotone"?TK:uJ}function bq(t,e,n={}){const o=t.length,{start:r=0,end:i=o-1}=n,{start:s,end:c}=e,d=Math.max(r,s),h=Math.min(i,c),u=r<s&&i<s||r>c&&i>c;return{count:o,start:d,loop:e.loop,ilen:h<d&&!u?o+h-d:h-d}}function yJ(t,e,n,o){const{points:r,options:i}=e,{count:s,start:c,loop:d,ilen:h}=bq(r,n,o),u=pJ(i);let{move:p=!0,reverse:y}=o||{},f,m,k;for(f=0;f<=h;++f)m=r[(c+(y?h-f:f))%s],!m.skip&&(p?(t.moveTo(m.x,m.y),p=!1):u(t,k,m,y,i.stepped),k=m);return d&&(m=r[(c+(y?h:0))%s],u(t,k,m,y,i.stepped)),!!d}function fJ(t,e,n,o){const r=e.points,{count:i,start:s,ilen:c}=bq(r,n,o),{move:d=!0,reverse:h}=o||{};let u=0,p=0,y,f,m,k,g,b;const w=C=>(s+(h?c-C:C))%i,S=()=>{k!==g&&(t.lineTo(u,g),t.lineTo(u,k),t.lineTo(u,b))};for(d&&(f=r[w(0)],t.moveTo(f.x,f.y)),y=0;y<=c;++y){if(f=r[w(y)],f.skip)continue;const C=f.x,x=f.y,M=C|0;M===m?(x<k?k=x:x>g&&(g=x),u=(p*u+C)/++p):(S(),t.lineTo(C,x),m=M,p=0,k=g=x),b=x}S()}function CB(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?fJ:yJ}function mJ(t){return t.stepped?fX:t.tension||t.cubicInterpolationMode==="monotone"?mX:bs}function kJ(t,e,n,o){let r=e._path;r||(r=e._path=new Path2D,e.path(r,n,o)&&r.closePath()),gq(t,e.options),t.stroke(r)}function gJ(t,e,n,o){const{segments:r,options:i}=e,s=CB(e);for(const c of r)gq(t,i,c.style),t.beginPath(),s(t,e,c,{start:n,end:n+o-1})&&t.closePath(),t.stroke()}const bJ=typeof Path2D=="function";function MJ(t,e,n,o){bJ&&!e.options.segment?kJ(t,e,n,o):gJ(t,e,n,o)}class Ua extends ya{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,n){const o=this.options;if((o.tension||o.cubicInterpolationMode==="monotone")&&!o.stepped&&!this._pointsUpdated){const r=o.spanGaps?this._loop:this._fullLoop;sX(this._points,o,e,r,n),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=wX(this,this.options.segment))}first(){const e=this.segments,n=this.points;return e.length&&n[e[0].start]}last(){const e=this.segments,n=this.points,o=e.length;return o&&n[e[o-1].end]}interpolate(e,n){const o=this.options,r=e[n],i=this.points,s=_D(this,{property:n,start:r,end:r});if(!s.length)return;const c=[],d=mJ(o);let h,u;for(h=0,u=s.length;h<u;++h){const{start:p,end:y}=s[h],f=i[p],m=i[y];if(f===m){c.push(f);continue}const k=Math.abs((r-f[n])/(m[n]-f[n])),g=d(f,m,k,o.stepped);g[n]=e[n],c.push(g)}return c.length===1?c[0]:c}pathSegment(e,n,o){return CB(this)(e,this,n,o)}path(e,n,o){const r=this.segments,i=CB(this);let s=this._loop;n=n||0,o=o||this.points.length-n;for(const c of r)s&=i(e,this,c,{start:n,end:n+o-1});return!!s}draw(e,n,o,r){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(e.save(),MJ(e,this,o,r),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}se(Ua,"id","line"),se(Ua,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),se(Ua,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),se(Ua,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function Mq(t,e,n,o){const r=t.options,{[n]:i}=t.getProps([n],o);return Math.abs(e-i)<r.radius+r.hitRadius}class oI extends ya{constructor(n){super();se(this,"parsed");se(this,"skip");se(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,o,r){const i=this.options,{x:s,y:c}=this.getProps(["x","y"],r);return Math.pow(n-s,2)+Math.pow(o-c,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,o){return Mq(this,n,"x",o)}inYRange(n,o){return Mq(this,n,"y",o)}getCenterPoint(n){const{x:o,y:r}=this.getProps(["x","y"],n);return{x:o,y:r}}size(n){n=n||this.options||{};let o=n.radius||0;o=Math.max(o,o&&n.hoverRadius||0);const r=o&&n.borderWidth||0;return(o+r)*2}draw(n,o){const r=this.options;this.skip||r.radius<.1||!c1(this,o,this.size(r)/2)||(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.fillStyle=r.backgroundColor,iB(n,r,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}se(oI,"id","point"),se(oI,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),se(oI,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function xq(t,e){const{x:n,y:o,base:r,width:i,height:s}=t.getProps(["x","y","base","width","height"],e);let c,d,h,u,p;return t.horizontal?(p=s/2,c=Math.min(n,r),d=Math.max(n,r),h=o-p,u=o+p):(p=i/2,c=n-p,d=n+p,h=Math.min(o,r),u=Math.max(o,r)),{left:c,top:h,right:d,bottom:u}}function Wa(t,e,n,o){return t?0:Ge(e,n,o)}function xJ(t,e,n){const o=t.options.borderWidth,r=t.borderSkipped,i=pD(o);return{t:Wa(r.top,i.top,0,n),r:Wa(r.right,i.right,0,e),b:Wa(r.bottom,i.bottom,0,n),l:Wa(r.left,i.left,0,e)}}function wJ(t,e,n){const{enableBorderRadius:o}=t.getProps(["enableBorderRadius"]),r=t.options.borderRadius,i=al(r),s=Math.min(e,n),c=t.borderSkipped,d=o||we(r);return{topLeft:Wa(!d||c.top||c.left,i.topLeft,0,s),topRight:Wa(!d||c.top||c.right,i.topRight,0,s),bottomLeft:Wa(!d||c.bottom||c.left,i.bottomLeft,0,s),bottomRight:Wa(!d||c.bottom||c.right,i.bottomRight,0,s)}}function vJ(t){const e=xq(t),n=e.right-e.left,o=e.bottom-e.top,r=xJ(t,n/2,o/2),i=wJ(t,n/2,o/2);return{outer:{x:e.left,y:e.top,w:n,h:o,radius:i},inner:{x:e.left+r.l,y:e.top+r.t,w:n-r.l-r.r,h:o-r.t-r.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,i.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(r.b,r.r))}}}}function LB(t,e,n,o){const r=e===null,i=n===null,c=t&&!(r&&i)&&xq(t,o);return c&&(r||ua(e,c.left,c.right))&&(i||ua(n,c.top,c.bottom))}function CJ(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function LJ(t,e){t.rect(e.x,e.y,e.w,e.h)}function SB(t,e,n={}){const o=t.x!==n.x?-e:0,r=t.y!==n.y?-e:0,i=(t.x+t.w!==n.x+n.w?e:0)-o,s=(t.y+t.h!==n.y+n.h?e:0)-r;return{x:t.x+o,y:t.y+r,w:t.w+i,h:t.h+s,radius:t.radius}}class rI extends ya{constructor(e){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,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:o,backgroundColor:r}}=this,{inner:i,outer:s}=vJ(this),c=CJ(s.radius)?$S:LJ;e.save(),(s.w!==i.w||s.h!==i.h)&&(e.beginPath(),c(e,SB(s,n,i)),e.clip(),c(e,SB(i,-n,s)),e.fillStyle=o,e.fill("evenodd")),e.beginPath(),c(e,SB(i,n)),e.fillStyle=r,e.fill(),e.restore()}inRange(e,n,o){return LB(this,e,n,o)}inXRange(e,n){return LB(this,e,null,n)}inYRange(e,n){return LB(this,null,e,n)}getCenterPoint(e){const{x:n,y:o,base:r,horizontal:i}=this.getProps(["x","y","base","horizontal"],e);return{x:i?(n+r)/2:n,y:i?o:(o+r)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}se(rI,"id","bar"),se(rI,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),se(rI,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function SJ(t,e,n){const o=t.segments,r=t.points,i=e.points,s=[];for(const c of o){let{start:d,end:h}=c;h=iI(d,h,r);const u=IB(n,r[d],r[h],c.loop);if(!e.segments){s.push({source:c,target:u,start:r[d],end:r[h]});continue}const p=_D(e,u);for(const y of p){const f=IB(n,i[y.start],i[y.end],y.loop),m=ID(c,r,f);for(const k of m)s.push({source:k,target:y,start:{[n]:wq(u,f,"start",Math.max)},end:{[n]:wq(u,f,"end",Math.min)}})}}return s}function IB(t,e,n,o){if(o)return;let r=e[t],i=n[t];return t==="angle"&&(r=dt(r),i=dt(i)),{property:t,start:r,end:i}}function IJ(t,e){const{x:n=null,y:o=null}=t||{},r=e.points,i=[];return e.segments.forEach(({start:s,end:c})=>{c=iI(s,c,r);const d=r[s],h=r[c];o!==null?(i.push({x:d.x,y:o}),i.push({x:h.x,y:o})):n!==null&&(i.push({x:n,y:d.y}),i.push({x:n,y:h.y}))}),i}function iI(t,e,n){for(;e>t;e--){const o=n[e];if(!isNaN(o.x)&&!isNaN(o.y))break}return e}function wq(t,e,n,o){return t&&e?o(t[n],e[n]):t?t[n]:e?e[n]:0}function vq(t,e){let n=[],o=!1;return $e(t)?(o=!0,n=t):n=IJ(t,e),n.length?new Ua({points:n,options:{tension:0},_loop:o,_fullLoop:o}):null}function Cq(t){return t&&t.fill!==!1}function _J(t,e,n){let r=t[e].fill;const i=[e];let s;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!We(r))return r;if(s=t[r],!s)return!1;if(s.visible)return r;i.push(r),r=s.fill}return!1}function BJ(t,e,n){const o=DJ(t);if(we(o))return isNaN(o.value)?!1:o;let r=parseFloat(o);return We(r)&&Math.floor(r)===r?AJ(o[0],e,r,n):["origin","start","end","stack","shape"].indexOf(o)>=0&&o}function AJ(t,e,n,o){return(t==="-"||t==="+")&&(n=e+n),n===e||n<0||n>=o?!1:n}function VJ(t,e){let n=null;return t==="start"?n=e.bottom:t==="end"?n=e.top:we(t)?n=e.getPixelForValue(t.value):e.getBasePixel&&(n=e.getBasePixel()),n}function PJ(t,e,n){let o;return t==="start"?o=n:t==="end"?o=e.options.reverse?e.min:e.max:we(t)?o=t.value:o=e.getBaseValue(),o}function DJ(t){const e=t.options,n=e.fill;let o=be(n&&n.target,n);return o===void 0&&(o=!!e.backgroundColor),o===!1||o===null?!1:o===!0?"origin":o}function qJ(t){const{scale:e,index:n,line:o}=t,r=[],i=o.segments,s=o.points,c=zJ(e,n);c.push(vq({x:null,y:e.bottom},o));for(let d=0;d<i.length;d++){const h=i[d];for(let u=h.start;u<=h.end;u++)EJ(r,s[u],c)}return new Ua({points:r,options:{}})}function zJ(t,e){const n=[],o=t.getMatchingVisibleMetas("line");for(let r=0;r<o.length;r++){const i=o[r];if(i.index===e)break;i.hidden||n.unshift(i.dataset)}return n}function EJ(t,e,n){const o=[];for(let r=0;r<n.length;r++){const i=n[r],{first:s,last:c,point:d}=TJ(i,e,"x");if(!(!d||s&&c)){if(s)o.unshift(d);else if(t.push(d),!c)break}}t.push(...o)}function TJ(t,e,n){const o=t.interpolate(e,n);if(!o)return{};const r=o[n],i=t.segments,s=t.points;let c=!1,d=!1;for(let h=0;h<i.length;h++){const u=i[h],p=s[u.start][n],y=s[u.end][n];if(ua(r,p,y)){c=r===p,d=r===y;break}}return{first:c,last:d,point:o}}class Lq{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,n,o){const{x:r,y:i,radius:s}=this;return n=n||{start:0,end:ze},e.arc(r,i,s,n.end,n.start,!0),!o.bounds}interpolate(e){const{x:n,y:o,radius:r}=this,i=e.angle;return{x:n+Math.cos(i)*r,y:o+Math.sin(i)*r,angle:i}}}function OJ(t){const{chart:e,fill:n,line:o}=t;if(We(n))return HJ(e,n);if(n==="stack")return qJ(t);if(n==="shape")return!0;const r=FJ(t);return r instanceof Lq?r:vq(r,o)}function HJ(t,e){const n=t.getDatasetMeta(e);return n&&t.isDatasetVisible(e)?n.dataset:null}function FJ(t){return(t.scale||{}).getPointPositionForValue?jJ(t):$J(t)}function $J(t){const{scale:e={},fill:n}=t,o=VJ(n,e);if(We(o)){const r=e.isHorizontal();return{x:r?o:null,y:r?null:o}}return null}function jJ(t){const{scale:e,fill:n}=t,o=e.options,r=e.getLabels().length,i=o.reverse?e.max:e.min,s=PJ(n,e,i),c=[];if(o.grid.circular){const d=e.getPointPositionForValue(0,i);return new Lq({x:d.x,y:d.y,radius:e.getDistanceFromCenterForValue(s)})}for(let d=0;d<r;++d)c.push(e.getPointPositionForValue(d,s));return c}function _B(t,e,n){const o=OJ(e),{chart:r,index:i,line:s,scale:c,axis:d}=e,h=s.options,u=h.fill,p=h.backgroundColor,{above:y=p,below:f=p}=u||{},m=r.getDatasetMeta(i),k=VD(r,m);o&&s.points.length&&(HS(t,n),RJ(t,{line:s,target:o,above:y,below:f,area:n,scale:c,axis:d,clip:k}),FS(t))}function RJ(t,e){const{line:n,target:o,above:r,below:i,area:s,scale:c,clip:d}=e,h=n._loop?"angle":e.axis;t.save();let u=i;i!==r&&(h==="x"?(Sq(t,o,s.top),BB(t,{line:n,target:o,color:r,scale:c,property:h,clip:d}),t.restore(),t.save(),Sq(t,o,s.bottom)):h==="y"&&(Iq(t,o,s.left),BB(t,{line:n,target:o,color:i,scale:c,property:h,clip:d}),t.restore(),t.save(),Iq(t,o,s.right),u=r)),BB(t,{line:n,target:o,color:u,scale:c,property:h,clip:d}),t.restore()}function Sq(t,e,n){const{segments:o,points:r}=e;let i=!0,s=!1;t.beginPath();for(const c of o){const{start:d,end:h}=c,u=r[d],p=r[iI(d,h,r)];i?(t.moveTo(u.x,u.y),i=!1):(t.lineTo(u.x,n),t.lineTo(u.x,u.y)),s=!!e.pathSegment(t,c,{move:s}),s?t.closePath():t.lineTo(p.x,n)}t.lineTo(e.first().x,n),t.closePath(),t.clip()}function Iq(t,e,n){const{segments:o,points:r}=e;let i=!0,s=!1;t.beginPath();for(const c of o){const{start:d,end:h}=c,u=r[d],p=r[iI(d,h,r)];i?(t.moveTo(u.x,u.y),i=!1):(t.lineTo(n,u.y),t.lineTo(u.x,u.y)),s=!!e.pathSegment(t,c,{move:s}),s?t.closePath():t.lineTo(n,p.y)}t.lineTo(n,e.first().y),t.closePath(),t.clip()}function BB(t,e){const{line:n,target:o,property:r,color:i,scale:s,clip:c}=e,d=SJ(n,o,r);for(const{source:h,target:u,start:p,end:y}of d){const{style:{backgroundColor:f=i}={}}=h,m=o!==!0;t.save(),t.fillStyle=f,NJ(t,s,c,m&&IB(r,p,y)),t.beginPath();const k=!!n.pathSegment(t,h);let g;if(m){k?t.closePath():_q(t,o,y,r);const b=!!o.pathSegment(t,u,{move:k,reverse:!0});g=k&&b,g||_q(t,o,p,r)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function NJ(t,e,n,o){const r=e.chart.chartArea,{property:i,start:s,end:c}=o||{};if(i==="x"||i==="y"){let d,h,u,p;i==="x"?(d=s,h=r.top,u=c,p=r.bottom):(d=r.left,h=s,u=r.right,p=c),t.beginPath(),n&&(d=Math.max(d,n.left),u=Math.min(u,n.right),h=Math.max(h,n.top),p=Math.min(p,n.bottom)),t.rect(d,h,u-d,p-h),t.clip()}}function _q(t,e,n,o){const r=e.interpolate(n,o);r&&t.lineTo(r.x,r.y)}var UJ={id:"filler",afterDatasetsUpdate(t,e,n){const o=(t.data.datasets||[]).length,r=[];let i,s,c,d;for(s=0;s<o;++s)i=t.getDatasetMeta(s),c=i.dataset,d=null,c&&c.options&&c instanceof Ua&&(d={visible:t.isDatasetVisible(s),index:s,fill:BJ(c,s,o),chart:t,axis:i.controller.options.indexAxis,scale:i.vScale,line:c}),i.$filler=d,r.push(d);for(s=0;s<o;++s)d=r[s],!(!d||d.fill===!1)&&(d.fill=_J(r,s,n.propagate))},beforeDraw(t,e,n){const o=n.drawTime==="beforeDraw",r=t.getSortedVisibleDatasetMetas(),i=t.chartArea;for(let s=r.length-1;s>=0;--s){const c=r[s].$filler;c&&(c.line.updateControlPoints(i,c.axis),o&&c.fill&&_B(t.ctx,c,i))}},beforeDatasetsDraw(t,e,n){if(n.drawTime!=="beforeDatasetsDraw")return;const o=t.getSortedVisibleDatasetMetas();for(let r=o.length-1;r>=0;--r){const i=o[r].$filler;Cq(i)&&_B(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,n){const o=e.meta.$filler;!Cq(o)||n.drawTime!=="beforeDatasetDraw"||_B(t.ctx,o,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Bq=(t,e)=>{let{boxHeight:n=e,boxWidth:o=e}=t;return t.usePointStyle&&(n=Math.min(n,e),o=t.pointStyleWidth||Math.min(o,e)),{boxWidth:o,boxHeight:n,itemHeight:Math.max(e,n)}},WJ=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Aq extends ya{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,o){this.maxWidth=e,this.maxHeight=n,this._margins=o,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=Pe(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(o=>e.filter(o,this.chart.data))),e.sort&&(n=n.sort((o,r)=>e.sort(o,r,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const o=e.labels,r=Ke(o.font),i=r.size,s=this._computeTitleHeight(),{boxWidth:c,itemHeight:d}=Bq(o,i);let h,u;n.font=r.string,this.isHorizontal()?(h=this.maxWidth,u=this._fitRows(s,i,c,d)+10):(u=this.maxHeight,h=this._fitCols(s,r,c,d)+10),this.width=Math.min(h,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,n,o,r){const{ctx:i,maxWidth:s,options:{labels:{padding:c}}}=this,d=this.legendHitBoxes=[],h=this.lineWidths=[0],u=r+c;let p=e;i.textAlign="left",i.textBaseline="middle";let y=-1,f=-u;return this.legendItems.forEach((m,k)=>{const g=o+n/2+i.measureText(m.text).width;(k===0||h[h.length-1]+g+2*c>s)&&(p+=u,h[h.length-(k>0?0:1)]=0,f+=u,y++),d[k]={left:0,top:f,row:y,width:g,height:r},h[h.length-1]+=g+c}),p}_fitCols(e,n,o,r){const{ctx:i,maxHeight:s,options:{labels:{padding:c}}}=this,d=this.legendHitBoxes=[],h=this.columnSizes=[],u=s-e;let p=c,y=0,f=0,m=0,k=0;return this.legendItems.forEach((g,b)=>{const{itemWidth:w,itemHeight:S}=GJ(o,n,i,g,r);b>0&&f+S+2*c>u&&(p+=y+c,h.push({width:y,height:f}),m+=y+c,k++,y=f=0),d[b]={left:m,top:f,col:k,width:w,height:S},y=Math.max(y,w),f+=S+c}),p+=y,h.push({width:y,height:f}),p}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:o,labels:{padding:r},rtl:i}}=this,s=rl(i,this.left,this.width);if(this.isHorizontal()){let c=0,d=Ye(o,this.left+r,this.right-this.lineWidths[c]);for(const h of n)c!==h.row&&(c=h.row,d=Ye(o,this.left+r,this.right-this.lineWidths[c])),h.top+=this.top+e+r,h.left=s.leftForLtr(s.x(d),h.width),d+=h.width+r}else{let c=0,d=Ye(o,this.top+e+r,this.bottom-this.columnSizes[c].height);for(const h of n)h.col!==c&&(c=h.col,d=Ye(o,this.top+e+r,this.bottom-this.columnSizes[c].height)),h.top=d,h.left+=this.left+r,h.left=s.leftForLtr(s.x(h.left),h.width),d+=h.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;HS(e,this),this._draw(),FS(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:o,ctx:r}=this,{align:i,labels:s}=e,c=Fe.color,d=rl(e.rtl,this.left,this.width),h=Ke(s.font),{padding:u}=s,p=h.size,y=p/2;let f;this.drawTitle(),r.textAlign=d.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=h.string;const{boxWidth:m,boxHeight:k,itemHeight:g}=Bq(s,p),b=function(M,v,L){if(isNaN(m)||m<=0||isNaN(k)||k<0)return;r.save();const I=be(L.lineWidth,1);if(r.fillStyle=be(L.fillStyle,c),r.lineCap=be(L.lineCap,"butt"),r.lineDashOffset=be(L.lineDashOffset,0),r.lineJoin=be(L.lineJoin,"miter"),r.lineWidth=I,r.strokeStyle=be(L.strokeStyle,c),r.setLineDash(be(L.lineDash,[])),s.usePointStyle){const _={radius:k*Math.SQRT2/2,pointStyle:L.pointStyle,rotation:L.rotation,borderWidth:I},A=d.xPlus(M,m/2),V=v+y;uD(r,_,A,V,s.pointStyleWidth&&m)}else{const _=v+Math.max((p-k)/2,0),A=d.leftForLtr(M,m),V=al(L.borderRadius);r.beginPath(),Object.values(V).some(q=>q!==0)?$S(r,{x:A,y:_,w:m,h:k,radius:V}):r.rect(A,_,m,k),r.fill(),I!==0&&r.stroke()}r.restore()},w=function(M,v,L){d1(r,L.text,M,v+g/2,h,{strikethrough:L.hidden,textAlign:d.textAlign(L.textAlign)})},S=this.isHorizontal(),C=this._computeTitleHeight();S?f={x:Ye(i,this.left+u,this.right-o[0]),y:this.top+u+C,line:0}:f={x:this.left+u,y:Ye(i,this.top+C+u,this.bottom-n[0].height),line:0},vD(this.ctx,e.textDirection);const x=g+u;this.legendItems.forEach((M,v)=>{r.strokeStyle=M.fontColor,r.fillStyle=M.fontColor;const L=r.measureText(M.text).width,I=d.textAlign(M.textAlign||(M.textAlign=s.textAlign)),_=m+y+L;let A=f.x,V=f.y;d.setWidth(this.width),S?v>0&&A+_+u>this.right&&(V=f.y+=x,f.line++,A=f.x=Ye(i,this.left+u,this.right-o[f.line])):v>0&&V+x>this.bottom&&(A=f.x=A+n[f.line].width+u,f.line++,V=f.y=Ye(i,this.top+C+u,this.bottom-n[f.line].height));const q=d.x(A);if(b(q,V,M),A=vK(I,A+m+y,S?A+_:this.right,e.rtl),w(d.x(A),V,M),S)f.x+=_+u;else if(typeof M.text!="string"){const O=h.lineHeight;f.y+=Vq(M,O)+u}else f.y+=x}),CD(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,o=Ke(n.font),r=kt(n.padding);if(!n.display)return;const i=rl(e.rtl,this.left,this.width),s=this.ctx,c=n.position,d=o.size/2,h=r.top+d;let u,p=this.left,y=this.width;if(this.isHorizontal())y=Math.max(...this.lineWidths),u=this.top+h,p=Ye(e.align,p,this.right-y);else{const m=this.columnSizes.reduce((k,g)=>Math.max(k,g.height),0);u=h+Ye(e.align,this.top,this.bottom-m-e.labels.padding-this._computeTitleHeight())}const f=Ye(c,p,p+y);s.textAlign=i.textAlign(eB(c)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=o.string,d1(s,n.text,f,u,o)}_computeTitleHeight(){const e=this.options.title,n=Ke(e.font),o=kt(e.padding);return e.display?n.lineHeight+o.height:0}_getLegendItemAt(e,n){let o,r,i;if(ua(e,this.left,this.right)&&ua(n,this.top,this.bottom)){for(i=this.legendHitBoxes,o=0;o<i.length;++o)if(r=i[o],ua(e,r.left,r.left+r.width)&&ua(n,r.top,r.top+r.height))return this.legendItems[o]}return null}handleEvent(e){const n=this.options;if(!XJ(e.type,n))return;const o=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const r=this._hoveredItem,i=WJ(r,o);r&&!i&&Pe(n.onLeave,[e,r,this],this),this._hoveredItem=o,o&&!i&&Pe(n.onHover,[e,o,this],this)}else o&&Pe(n.onClick,[e,o,this],this)}}function GJ(t,e,n,o,r){const i=YJ(o,t,e,n),s=KJ(r,o,e.lineHeight);return{itemWidth:i,itemHeight:s}}function YJ(t,e,n,o){let r=t.text;return r&&typeof r!="string"&&(r=r.reduce((i,s)=>i.length>s.length?i:s)),e+n.size/2+o.measureText(r).width}function KJ(t,e,n){let o=t;return typeof e.text!="string"&&(o=Vq(e,n)),o}function Vq(t,e){const n=t.text?t.text.length:0;return e*n}function XJ(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var ZJ={id:"legend",_element:Aq,start(t,e,n){const o=t.legend=new Aq({ctx:t.ctx,options:n,chart:t});gt.configure(t,o,n),gt.addBox(t,o)},stop(t){gt.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const o=t.legend;gt.configure(t,o,n),o.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const o=e.datasetIndex,r=n.chart;r.isDatasetVisible(o)?(r.hide(o),e.hidden=!0):(r.show(o),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:o,textAlign:r,color:i,useBorderRadius:s,borderRadius:c}}=t.legend.options;return t._getSortedDatasetMetas().map(d=>{const h=d.controller.getStyle(n?0:void 0),u=kt(h.borderWidth);return{text:e[d.index].label,fillStyle:h.backgroundColor,fontColor:i,hidden:!d.visible,lineCap:h.borderCapStyle,lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:h.borderColor,pointStyle:o||h.pointStyle,rotation:h.rotation,textAlign:r||h.textAlign,borderRadius:s&&(c||h.borderRadius),datasetIndex:d.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Pq extends ya{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,n){const o=this.options;if(this.left=0,this.top=0,!o.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const r=$e(o.text)?o.text.length:1;this._padding=kt(o.padding);const i=r*Ke(o.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:o,bottom:r,right:i,options:s}=this,c=s.align;let d=0,h,u,p;return this.isHorizontal()?(u=Ye(c,o,i),p=n+e,h=i-o):(s.position==="left"?(u=o+e,p=Ye(c,r,n),d=Ae*-.5):(u=i-e,p=Ye(c,n,r),d=Ae*.5),h=r-n),{titleX:u,titleY:p,maxWidth:h,rotation:d}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const o=Ke(n.font),i=o.lineHeight/2+this._padding.top,{titleX:s,titleY:c,maxWidth:d,rotation:h}=this._drawArgs(i);d1(e,n.text,0,0,o,{color:n.color,maxWidth:d,rotation:h,textAlign:eB(n.align),textBaseline:"middle",translation:[s,c]})}}function JJ(t,e){const n=new Pq({ctx:t.ctx,options:e,chart:t});gt.configure(t,n,e),gt.addBox(t,n),t.titleBlock=n}var QJ={id:"title",_element:Pq,start(t,e,n){JJ(t,n)},stop(t){const e=t.titleBlock;gt.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const o=t.titleBlock;gt.configure(t,o,n),o.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 b1={average(t){if(!t.length)return!1;let e,n,o=new Set,r=0,i=0;for(e=0,n=t.length;e<n;++e){const c=t[e].element;if(c&&c.hasValue()){const d=c.tooltipPosition();o.add(d.x),r+=d.y,++i}}return i===0||o.size===0?!1:{x:[...o].reduce((c,d)=>c+d)/o.size,y:r/i}},nearest(t,e){if(!t.length)return!1;let n=e.x,o=e.y,r=Number.POSITIVE_INFINITY,i,s,c;for(i=0,s=t.length;i<s;++i){const d=t[i].element;if(d&&d.hasValue()){const h=d.getCenterPoint(),u=J_(e,h);u<r&&(r=u,c=d)}}if(c){const d=c.tooltipPosition();n=d.x,o=d.y}return{x:n,y:o}}};function Jt(t,e){return e&&($e(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function ma(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
8565
8565
  `)>-1?t.split(`
8566
- `):t}function eQ(t,e){const{element:n,datasetIndex:o,index:r}=e,i=t.getDatasetMeta(o).controller,{label:s,value:c}=i.getLabelAndValue(r);return{chart:t,label:s,parsed:i.getParsed(r),raw:t.data.datasets[o].data[r],formattedValue:c,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function Dq(t,e){const n=t.chart.ctx,{body:o,footer:r,title:i}=t,{boxWidth:s,boxHeight:c}=e,d=Ke(e.bodyFont),h=Ke(e.titleFont),u=Ke(e.footerFont),p=i.length,y=r.length,f=o.length,m=kt(e.padding);let k=m.height,g=0,b=o.reduce((C,x)=>C+x.before.length+x.lines.length+x.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,p&&(k+=p*h.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),b){const C=e.displayColors?Math.max(c,d.lineHeight):d.lineHeight;k+=f*C+(b-f)*d.lineHeight+(b-1)*e.bodySpacing}y&&(k+=e.footerMarginTop+y*u.lineHeight+(y-1)*e.footerSpacing);let w=0;const S=function(C){g=Math.max(g,n.measureText(C).width+w)};return n.save(),n.font=h.string,Be(t.title,S),n.font=d.string,Be(t.beforeBody.concat(t.afterBody),S),w=e.displayColors?s+2+e.boxPadding:0,Be(o,C=>{Be(C.before,S),Be(C.lines,S),Be(C.after,S)}),w=0,n.font=u.string,Be(t.footer,S),n.restore(),g+=m.width,{width:g,height:k}}function tQ(t,e){const{y:n,height:o}=e;return n<o/2?"top":n>t.height-o/2?"bottom":"center"}function aQ(t,e,n,o){const{x:r,width:i}=o,s=n.caretSize+n.caretPadding;if(t==="left"&&r+i+s>e.width||t==="right"&&r-i-s<0)return!0}function nQ(t,e,n,o){const{x:r,width:i}=n,{width:s,chartArea:{left:c,right:d}}=t;let h="center";return o==="center"?h=r<=(c+d)/2?"left":"right":r<=i/2?h="left":r>=s-i/2&&(h="right"),aQ(h,t,e,n)&&(h="center"),h}function qq(t,e,n){const o=n.yAlign||e.yAlign||tQ(t,n);return{xAlign:n.xAlign||e.xAlign||nQ(t,e,n,o),yAlign:o}}function oQ(t,e){let{x:n,width:o}=t;return e==="right"?n-=o:e==="center"&&(n-=o/2),n}function rQ(t,e,n){let{y:o,height:r}=t;return e==="top"?o+=n:e==="bottom"?o-=r+n:o-=r/2,o}function zq(t,e,n,o){const{caretSize:r,caretPadding:i,cornerRadius:s}=t,{xAlign:c,yAlign:d}=n,h=r+i,{topLeft:u,topRight:p,bottomLeft:y,bottomRight:f}=al(s);let m=oQ(e,c);const k=rQ(e,d,h);return d==="center"?c==="left"?m+=h:c==="right"&&(m-=h):c==="left"?m-=Math.max(u,y)+r:c==="right"&&(m+=Math.max(p,f)+r),{x:Ge(m,0,o.width-e.width),y:Ge(k,0,o.height-e.height)}}function sI(t,e,n){const o=kt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-o.right:t.x+o.left}function Eq(t){return Jt([],ma(t))}function iQ(t,e,n){return ms(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Tq(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const Oq={beforeTitle:da,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,o=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(o>0&&e.dataIndex<o)return n[e.dataIndex]}return""},afterTitle:da,beforeBody:da,beforeLabel:da,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Ie(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.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(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:da,afterBody:da,beforeFooter:da,footer:da,afterFooter:da};function ot(t,e,n,o){const r=t[e].call(n,o);return typeof r>"u"?Oq[e].call(n,o):r}class AB extends ya{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,o=this.options.setContext(this.getContext()),r=o.enabled&&n.options.animation&&o.animations,i=new DD(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=iQ(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:o}=n,r=ot(o,"beforeTitle",this,e),i=ot(o,"title",this,e),s=ot(o,"afterTitle",this,e);let c=[];return c=Jt(c,ma(r)),c=Jt(c,ma(i)),c=Jt(c,ma(s)),c}getBeforeBody(e,n){return Eq(ot(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:o}=n,r=[];return Be(e,i=>{const s={before:[],lines:[],after:[]},c=Tq(o,i);Jt(s.before,ma(ot(c,"beforeLabel",this,i))),Jt(s.lines,ot(c,"label",this,i)),Jt(s.after,ma(ot(c,"afterLabel",this,i))),r.push(s)}),r}getAfterBody(e,n){return Eq(ot(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:o}=n,r=ot(o,"beforeFooter",this,e),i=ot(o,"footer",this,e),s=ot(o,"afterFooter",this,e);let c=[];return c=Jt(c,ma(r)),c=Jt(c,ma(i)),c=Jt(c,ma(s)),c}_createItems(e){const n=this._active,o=this.chart.data,r=[],i=[],s=[];let c=[],d,h;for(d=0,h=n.length;d<h;++d)c.push(eQ(this.chart,n[d]));return e.filter&&(c=c.filter((u,p,y)=>e.filter(u,p,y,o))),e.itemSort&&(c=c.sort((u,p)=>e.itemSort(u,p,o))),Be(c,u=>{const p=Tq(e.callbacks,u);r.push(ot(p,"labelColor",this,u)),i.push(ot(p,"labelPointStyle",this,u)),s.push(ot(p,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=s,this.dataPoints=c,c}update(e,n){const o=this.options.setContext(this.getContext()),r=this._active;let i,s=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const c=b1[o.position].call(this,r,this._eventPosition);s=this._createItems(o),this.title=this.getTitle(s,o),this.beforeBody=this.getBeforeBody(s,o),this.body=this.getBody(s,o),this.afterBody=this.getAfterBody(s,o),this.footer=this.getFooter(s,o);const d=this._size=Dq(this,o),h=Object.assign({},c,d),u=qq(this.chart,o,h),p=zq(o,h,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:p.x,y:p.y,width:d.width,height:d.height,caretX:c.x,caretY:c.y}}this._tooltipItems=s,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&o.external&&o.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,o,r){const i=this.getCaretPosition(e,o,r);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(e,n,o){const{xAlign:r,yAlign:i}=this,{caretSize:s,cornerRadius:c}=o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:p}=al(c),{x:y,y:f}=e,{width:m,height:k}=n;let g,b,w,S,C,x;return i==="center"?(C=f+k/2,r==="left"?(g=y,b=g-s,S=C+s,x=C-s):(g=y+m,b=g+s,S=C-s,x=C+s),w=g):(r==="left"?b=y+Math.max(d,u)+s:r==="right"?b=y+m-Math.max(h,p)-s:b=this.caretX,i==="top"?(S=f,C=S-s,g=b-s,w=b+s):(S=f+k,C=S+s,g=b+s,w=b-s),x=S),{x1:g,x2:b,x3:w,y1:S,y2:C,y3:x}}drawTitle(e,n,o){const r=this.title,i=r.length;let s,c,d;if(i){const h=rl(o.rtl,this.x,this.width);for(e.x=sI(this,o.titleAlign,o),n.textAlign=h.textAlign(o.titleAlign),n.textBaseline="middle",s=Ke(o.titleFont),c=o.titleSpacing,n.fillStyle=o.titleColor,n.font=s.string,d=0;d<i;++d)n.fillText(r[d],h.x(e.x),e.y+s.lineHeight/2),e.y+=s.lineHeight+c,d+1===i&&(e.y+=o.titleMarginBottom-c)}}_drawColorBox(e,n,o,r,i){const s=this.labelColors[o],c=this.labelPointStyles[o],{boxHeight:d,boxWidth:h}=i,u=Ke(i.bodyFont),p=sI(this,"left",i),y=r.x(p),f=d<u.lineHeight?(u.lineHeight-d)/2:0,m=n.y+f;if(i.usePointStyle){const k={radius:Math.min(h,d)/2,pointStyle:c.pointStyle,rotation:c.rotation,borderWidth:1},g=r.leftForLtr(y,h)+h/2,b=m+d/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,iB(e,k,g,b),e.strokeStyle=s.borderColor,e.fillStyle=s.backgroundColor,iB(e,k,g,b)}else{e.lineWidth=we(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,e.strokeStyle=s.borderColor,e.setLineDash(s.borderDash||[]),e.lineDashOffset=s.borderDashOffset||0;const k=r.leftForLtr(y,h),g=r.leftForLtr(r.xPlus(y,1),h-2),b=al(s.borderRadius);Object.values(b).some(w=>w!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,$S(e,{x:k,y:m,w:h,h:d,radius:b}),e.fill(),e.stroke(),e.fillStyle=s.backgroundColor,e.beginPath(),$S(e,{x:g,y:m+1,w:h-2,h:d-2,radius:b}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(k,m,h,d),e.strokeRect(k,m,h,d),e.fillStyle=s.backgroundColor,e.fillRect(g,m+1,h-2,d-2))}e.fillStyle=this.labelTextColors[o]}drawBody(e,n,o){const{body:r}=this,{bodySpacing:i,bodyAlign:s,displayColors:c,boxHeight:d,boxWidth:h,boxPadding:u}=o,p=Ke(o.bodyFont);let y=p.lineHeight,f=0;const m=rl(o.rtl,this.x,this.width),k=function(L){n.fillText(L,m.x(e.x+f),e.y+y/2),e.y+=y+i},g=m.textAlign(s);let b,w,S,C,x,M,v;for(n.textAlign=s,n.textBaseline="middle",n.font=p.string,e.x=sI(this,g,o),n.fillStyle=o.bodyColor,Be(this.beforeBody,k),f=c&&g!=="right"?s==="center"?h/2+u:h+2+u:0,C=0,M=r.length;C<M;++C){for(b=r[C],w=this.labelTextColors[C],n.fillStyle=w,Be(b.before,k),S=b.lines,c&&S.length&&(this._drawColorBox(n,e,C,m,o),y=Math.max(p.lineHeight,d)),x=0,v=S.length;x<v;++x)k(S[x]),y=p.lineHeight;Be(b.after,k)}f=0,y=p.lineHeight,Be(this.afterBody,k),e.y-=i}drawFooter(e,n,o){const r=this.footer,i=r.length;let s,c;if(i){const d=rl(o.rtl,this.x,this.width);for(e.x=sI(this,o.footerAlign,o),e.y+=o.footerMarginTop,n.textAlign=d.textAlign(o.footerAlign),n.textBaseline="middle",s=Ke(o.footerFont),n.fillStyle=o.footerColor,n.font=s.string,c=0;c<i;++c)n.fillText(r[c],d.x(e.x),e.y+s.lineHeight/2),e.y+=s.lineHeight+o.footerSpacing}}drawBackground(e,n,o,r){const{xAlign:i,yAlign:s}=this,{x:c,y:d}=e,{width:h,height:u}=o,{topLeft:p,topRight:y,bottomLeft:f,bottomRight:m}=al(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(c+p,d),s==="top"&&this.drawCaret(e,n,o,r),n.lineTo(c+h-y,d),n.quadraticCurveTo(c+h,d,c+h,d+y),s==="center"&&i==="right"&&this.drawCaret(e,n,o,r),n.lineTo(c+h,d+u-m),n.quadraticCurveTo(c+h,d+u,c+h-m,d+u),s==="bottom"&&this.drawCaret(e,n,o,r),n.lineTo(c+f,d+u),n.quadraticCurveTo(c,d+u,c,d+u-f),s==="center"&&i==="left"&&this.drawCaret(e,n,o,r),n.lineTo(c,d+p),n.quadraticCurveTo(c,d,c+p,d),n.closePath(),n.fill(),r.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,o=this.$animations,r=o&&o.x,i=o&&o.y;if(r||i){const s=b1[e.position].call(this,this._active,this._eventPosition);if(!s)return;const c=this._size=Dq(this,e),d=Object.assign({},s,this._size),h=qq(n,e,d),u=zq(e,d,h,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=c.width,this.height=c.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let o=this.opacity;if(!o)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},i={x:this.x,y:this.y};o=Math.abs(o)<.001?0:o;const s=kt(n.padding),c=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&c&&(e.save(),e.globalAlpha=o,this.drawBackground(i,e,r,n),vD(e,n.textDirection),i.y+=s.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),CD(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const o=this._active,r=e.map(({datasetIndex:c,index:d})=>{const h=this.chart.getDatasetMeta(c);if(!h)throw new Error("Cannot find a dataset at index "+c);return{datasetIndex:c,element:h.data[d],index:d}}),i=!zS(o,r),s=this._positionChanged(r,n);(i||s)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,o=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,i=this._active||[],s=this._getActiveElements(e,i,n,o),c=this._positionChanged(s,e),d=n||!zS(s,i)||c;return d&&(this._active=s,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),d}_getActiveElements(e,n,o,r){const i=this.options;if(e.type==="mouseout")return[];if(!r)return n.filter(c=>this.chart.data.datasets[c.datasetIndex]&&this.chart.getDatasetMeta(c.datasetIndex).controller.getParsed(c.index)!==void 0);const s=this.chart.getElementsAtEventForMode(e,i.mode,i,o);return i.reverse&&s.reverse(),s}_positionChanged(e,n){const{caretX:o,caretY:r,options:i}=this,s=b1[i.position].call(this,e,n);return s!==!1&&(o!==s.x||r!==s.y)}}se(AB,"positioners",b1);var sQ={id:"tooltip",_element:AB,positioners:b1,afterInit(t,e,n){n&&(t.tooltip=new AB({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Oq},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const lQ=(t,e,n,o)=>(typeof e=="string"?(n=t.push(e)-1,o.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function cQ(t,e,n,o){const r=t.indexOf(e);if(r===-1)return lQ(t,e,n,o);const i=t.lastIndexOf(e);return r!==i?n:r}const dQ=(t,e)=>t===null?null:Ge(Math.round(t),0,e);function Hq(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class VB extends sl{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const o=this.getLabels();for(const{index:r,label:i}of n)o[r]===i&&o.splice(r,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(Ie(e))return null;const o=this.getLabels();return n=isFinite(n)&&o[n]===e?n:cQ(o,e,be(n,e),this._addedLabels),dQ(n,o.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:o,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(o=0),n||(r=this.getLabels().length-1)),this.min=o,this.max=r}buildTicks(){const e=this.min,n=this.max,o=this.options.offset,r=[];let i=this.getLabels();i=e===0&&n===i.length-1?i:i.slice(e,n+1),this._valueRange=Math.max(i.length-(o?0:1),1),this._startValue=this.min-(o?.5:0);for(let s=e;s<=n;s++)r.push({value:s});return r}getLabelForValue(e){return Hq.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}se(VB,"id","category"),se(VB,"defaults",{ticks:{callback:Hq}});function hQ(t,e){const n=[],{bounds:r,step:i,min:s,max:c,precision:d,count:h,maxTicks:u,maxDigits:p,includeBounds:y}=t,f=i||1,m=u-1,{min:k,max:g}=e,b=!Ie(s),w=!Ie(c),S=!Ie(h),C=(g-k)/(p+1);let x=ZP((g-k)/m/f)*f,M,v,L,I;if(x<1e-14&&!b&&!w)return[{value:k},{value:g}];I=Math.ceil(g/x)-Math.floor(k/x),I>m&&(x=ZP(I*x/m/f)*f),Ie(d)||(M=Math.pow(10,d),x=Math.ceil(x*M)/M),r==="ticks"?(v=Math.floor(k/x)*x,L=Math.ceil(g/x)*x):(v=k,L=g),b&&w&&i&&yK((c-s)/i,x/1e3)?(I=Math.round(Math.min((c-s)/x,u)),x=(c-s)/I,v=s,L=c):S?(v=b?s:v,L=w?c:L,I=h-1,x=(L-v)/I):(I=(L-v)/x,o1(I,Math.round(I),x/1e3)?I=Math.round(I):I=Math.ceil(I));const _=Math.max(JP(x),JP(v));M=Math.pow(10,Ie(d)?_:d),v=Math.round(v*M)/M,L=Math.round(L*M)/M;let A=0;for(b&&(y&&v!==s?(n.push({value:s}),v<s&&A++,o1(Math.round((v+A*x)*M)/M,s,Fq(s,C,t))&&A++):v<s&&A++);A<I;++A){const V=Math.round((v+A*x)*M)/M;if(w&&V>c)break;n.push({value:V})}return w&&y&&L!==c?n.length&&o1(n[n.length-1].value,c,Fq(c,C,t))?n[n.length-1].value=c:n.push({value:c}):(!w||L===c)&&n.push({value:L}),n}function Fq(t,e,{horizontal:n,minRotation:o}){const r=ha(o),i=(n?Math.sin(r):Math.cos(r))||.001,s=.75*e*(""+t).length;return Math.min(e/i,s)}class uQ extends sl{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return Ie(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:o}=this.getUserBounds();let{min:r,max:i}=this;const s=d=>r=n?r:d,c=d=>i=o?i:d;if(e){const d=Xt(r),h=Xt(i);d<0&&h<0?c(0):d>0&&h>0&&s(0)}if(r===i){let d=i===0?1:Math.abs(i*.05);c(i+d),e||s(r-d)}this.min=r,this.max=i}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:o}=e,r;return o?(r=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let o=this.getTickLimit();o=Math.max(2,o);const r={maxTicks:o,bounds:e.bounds,min:e.min,max:e.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=hQ(r,i);return e.bounds==="ticks"&&fK(s,this,"value"),e.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const e=this.ticks;let n=this.min,o=this.max;if(super.configure(),this.options.offset&&e.length){const r=(o-n)/Math.max(e.length-1,1)/2;n-=r,o+=r}this._startValue=n,this._endValue=o,this._valueRange=o-n}getLabelForValue(e){return nB(e,this.chart.options.locale,this.options.ticks.format)}}class PB extends uQ{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=We(e)?e:0,this.max=We(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,o=ha(this.options.ticks.minRotation),r=(e?Math.sin(o):Math.cos(o))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}se(PB,"id","linear"),se(PB,"defaults",{ticks:{callback:cD.formatters.numeric}});const lI={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}},rt=Object.keys(lI);function $q(t,e){return t-e}function jq(t,e){if(Ie(e))return null;const n=t._adapter,{parser:o,round:r,isoWeekday:i}=t._parseOpts;let s=e;return typeof o=="function"&&(s=o(s)),We(s)||(s=typeof o=="string"?n.parse(s,o):n.parse(s)),s===null?null:(r&&(s=r==="week"&&(r1(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,r)),+s)}function Rq(t,e,n,o){const r=rt.length;for(let i=rt.indexOf(t);i<r-1;++i){const s=lI[rt[i]],c=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-e)/(c*s.size))<=o)return rt[i]}return rt[r-1]}function pQ(t,e,n,o,r){for(let i=rt.length-1;i>=rt.indexOf(n);i--){const s=rt[i];if(lI[s].common&&t._adapter.diff(r,o,s)>=e-1)return s}return rt[n?rt.indexOf(n):0]}function yQ(t){for(let e=rt.indexOf(t)+1,n=rt.length;e<n;++e)if(lI[rt[e]].common)return rt[e]}function Nq(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:o,hi:r}=Q_(n,e),i=n[o]>=e?n[o]:n[r];t[i]=!0}}function fQ(t,e,n,o){const r=t._adapter,i=+r.startOf(e[0].value,o),s=e[e.length-1].value;let c,d;for(c=i;c<=s;c=+r.add(c,1,o))d=n[c],d>=0&&(e[d].major=!0);return e}function Uq(t,e,n){const o=[],r={},i=e.length;let s,c;for(s=0;s<i;++s)c=e[s],r[c]=s,o.push({value:c,major:!1});return i===0||!n?o:fQ(t,o,r,n)}class cI extends sl{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const o=e.time||(e.time={}),r=this._adapter=new ZX._date(e.adapters.date);r.init(n),a1(o.displayFormats,r.formats()),this._parseOpts={parser:o.parser,round:o.round,isoWeekday:o.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:jq(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,o=e.time.unit||"day";let{min:r,max:i,minDefined:s,maxDefined:c}=this.getUserBounds();function d(h){!s&&!isNaN(h.min)&&(r=Math.min(r,h.min)),!c&&!isNaN(h.max)&&(i=Math.max(i,h.max))}(!s||!c)&&(d(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&d(this.getMinMax(!1))),r=We(r)&&!isNaN(r)?r:+n.startOf(Date.now(),o),i=We(i)&&!isNaN(i)?i:+n.endOf(Date.now(),o)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],o=e[e.length-1]),{min:n,max:o}}buildTicks(){const e=this.options,n=e.time,o=e.ticks,r=o.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,s=this.max,c=MK(r,i,s);return this._unit=n.unit||(o.autoSkip?Rq(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):pQ(this,c.length,n.minUnit,this.min,this.max)),this._majorUnit=!o.major.enabled||this._unit==="year"?void 0:yQ(this._unit),this.initOffsets(r),e.reverse&&c.reverse(),Uq(this,c,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,o=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?n=1-r:n=(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),e.length===1?o=i:o=(i-this.getDecimalForValue(e[e.length-2]))/2);const s=e.length<3?.5:.25;n=Ge(n,0,s),o=Ge(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const e=this._adapter,n=this.min,o=this.max,r=this.options,i=r.time,s=i.unit||Rq(i.minUnit,n,o,this._getLabelCapacity(n)),c=be(r.ticks.stepSize,1),d=s==="week"?i.isoWeekday:!1,h=r1(d)||d===!0,u={};let p=n,y,f;if(h&&(p=+e.startOf(p,"isoWeek",d)),p=+e.startOf(p,h?"day":s),e.diff(o,n,s)>1e5*c)throw new Error(n+" and "+o+" are too far apart with stepSize of "+c+" "+s);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(y=p,f=0;y<o;y=+e.add(y,c,s),f++)Nq(u,y,m);return(y===o||r.bounds==="ticks"||f===1)&&Nq(u,y,m),Object.keys(u).sort($q).map(k=>+k)}getLabelForValue(e){const n=this._adapter,o=this.options.time;return o.tooltipFormat?n.format(e,o.tooltipFormat):n.format(e,o.displayFormats.datetime)}format(e,n){const r=this.options.time.displayFormats,i=this._unit,s=n||r[i];return this._adapter.format(e,s)}_tickFormatFunction(e,n,o,r){const i=this.options,s=i.ticks.callback;if(s)return Pe(s,[e,n,o],this);const c=i.time.displayFormats,d=this._unit,h=this._majorUnit,u=d&&c[d],p=h&&c[h],y=o[n],f=h&&p&&y&&y.major;return this._adapter.format(e,r||(f?p:u))}generateTickLabels(e){let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n],r.label=this._tickFormatFunction(r.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,o=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+o)*n.factor)}getValueForPixel(e){const n=this._offsets,o=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+o*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,o=this.ctx.measureText(e).width,r=ha(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),s=Math.sin(r),c=this._resolveTickFontOptions(0).size;return{w:o*i+c*s,h:o*s+c*i}}_getLabelCapacity(e){const n=this.options.time,o=n.displayFormats,r=o[n.unit]||o.millisecond,i=this._tickFormatFunction(e,0,Uq(this,[e],this._majorUnit),r),s=this._getLabelSize(i),c=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return c>0?c:1}getDataTimestamps(){let e=this._cache.data||[],n,o;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,o=r.length;n<o;++n)e=e.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,o;if(e.length)return e;const r=this.getLabels();for(n=0,o=r.length;n<o;++n)e.push(jq(this,r[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return aD(e.sort($q))}}se(cI,"id","time"),se(cI,"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 dI(t,e,n){let o=0,r=t.length-1,i,s,c,d;n?(e>=t[o].pos&&e<=t[r].pos&&({lo:o,hi:r}=ps(t,"pos",e)),{pos:i,time:c}=t[o],{pos:s,time:d}=t[r]):(e>=t[o].time&&e<=t[r].time&&({lo:o,hi:r}=ps(t,"time",e)),{time:i,pos:c}=t[o],{time:s,pos:d}=t[r]);const h=s-i;return h?c+(d-c)*(e-i)/h:c}class Wq extends cI{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=dI(n,this.min),this._tableRange=dI(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:o}=this,r=[],i=[];let s,c,d,h,u;for(s=0,c=e.length;s<c;++s)h=e[s],h>=n&&h<=o&&r.push(h);if(r.length<2)return[{time:n,pos:0},{time:o,pos:1}];for(s=0,c=r.length;s<c;++s)u=r[s+1],d=r[s-1],h=r[s],Math.round((u+d)/2)!==h&&i.push({time:h,pos:s/(c-1)});return i}_generate(){const e=this.min,n=this.max;let o=super.getDataTimestamps();return(!o.includes(e)||!o.length)&&o.splice(0,0,e),(!o.includes(n)||o.length===1)&&o.push(n),o.sort((r,i)=>r-i)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),o=this.getLabelTimestamps();return n.length&&o.length?e=this.normalize(n.concat(o)):e=n.length?n:o,e=this._cache.all=e,e}getDecimalForValue(e){return(dI(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,o=this.getDecimalForPixel(e)/n.factor-n.end;return dI(this._table,o*this._tableRange+this._minPos,!0)}}se(Wq,"id","timeseries"),se(Wq,"defaults",cI.defaults);const mQ={key:0,class:"mb-2 text-sm font-medium text-gray-700"},kQ={key:0,class:"text-red-500 ml-1"},gQ={key:0,class:"absolute inset-0 flex items-center justify-center bg-white"},bQ={key:1,class:"absolute inset-0 flex items-center justify-center bg-red-50 border border-red-200 rounded"},MQ={class:"text-red-600 text-sm"},xQ={key:1,class:"mt-2 text-xs text-gray-500"},wQ={key:0},Gq=Wl(a.defineComponent({name:"DCodeChart",__name:"DCodeChart",props:{type:{default:"line"},width:{default:400},height:{default:300},required:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{default:null},showInfo:{type:Boolean,default:!1},responsive:{type:Boolean,default:!0},maintainAspectRatio:{type:Boolean,default:!1},theme:{default:"light"},colors:{default:()=>["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16"]},data:{},modelValue:{},options:{},onClick:{},onHover:{},label:{}},emits:["update:modelValue","click","hover","ready"],setup(t,{expose:e,emit:n}){fa.register(VB,PB,oI,Ua,rI,g1,QJ,sQ,ZJ,UJ,YS,GS,kB,il);const o=t,r=n,i=a.ref(null),s=a.ref(null),c=a.computed(()=>({"opacity-50 pointer-events-none":o.loading||o.error})),d=()=>{const p=o.theme==="dark";return{responsive:o.responsive,maintainAspectRatio:o.maintainAspectRatio,animation:{duration:1e3,easing:"easeInOutQuart",delay:y=>{let f=0;return y.type==="data"&&y.mode==="default"&&(f=y.dataIndex*100+y.datasetIndex*50),f},onComplete:()=>{}},plugins:{legend:{position:"top",labels:{color:p?"#E5E7EB":"#374151",font:{size:12}}},tooltip:{backgroundColor:p?"#1F2937":"#FFFFFF",titleColor:p?"#F3F4F6":"#111827",bodyColor:p?"#D1D5DB":"#4B5563",borderColor:p?"#374151":"#E5E7EB",borderWidth:1,animation:{duration:200,easing:"easeInOutQuad"}}},scales:o.type!=="pie"&&o.type!=="doughnut"&&o.type!=="polarArea"?{x:{grid:{color:p?"#374151":"#E5E7EB"},ticks:{color:p?"#D1D5DB":"#6B7280"}},y:{grid:{color:p?"#374151":"#E5E7EB"},ticks:{color:p?"#D1D5DB":"#6B7280"}}}:void 0}},h=p=>!p||!p.datasets?p:{...p,datasets:p.datasets.map((y,f)=>({...y,borderColor:y.borderColor||o.colors[f%o.colors.length],backgroundColor:y.backgroundColor||o.colors[f%o.colors.length]+"20",pointBackgroundColor:y.pointBackgroundColor||o.colors[f%o.colors.length],pointBorderColor:y.pointBorderColor||o.colors[f%o.colors.length],hoverBackgroundColor:y.hoverBackgroundColor||o.colors[f%o.colors.length]+"40",hoverBorderColor:y.hoverBorderColor||o.colors[f%o.colors.length]}))},u=async()=>{if(!i.value)return;await a.nextTick(),s.value&&s.value.destroy();const p=h(o.data||o.modelValue);if(!p)return;const y={...d(),...o.options};s.value=new fa(i.value,{type:o.type,data:p,options:y,onClick:(f,m)=>{r("click",f,m),o.onClick&&o.onClick(f,m)},onHover:(f,m)=>{r("hover",f,m),o.onHover&&o.onHover(f,m)}}),r("ready",s.value)};return a.watch(()=>[o.data,o.modelValue,o.type,o.options,o.theme],()=>{u()},{deep:!0}),a.watch(()=>[o.width,o.height],()=>{s.value&&s.value.resize()}),a.onMounted(()=>{u()}),a.onUnmounted(()=>{s.value&&s.value.destroy()}),e({chart:s,updateChart:u}),(p,y)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["d-code-chart",c.value])},[t.label?(a.openBlock(),a.createElementBlock("div",mQ,[a.createTextVNode(a.toDisplayString(t.label)+" ",1),t.required?(a.openBlock(),a.createElementBlock("span",kQ,"*")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"relative",style:a.normalizeStyle({height:t.height+"px"})},[a.createElementVNode("canvas",{ref_key:"chartCanvas",ref:i},null,512),t.loading?(a.openBlock(),a.createElementBlock("div",gQ,[...y[0]||(y[0]=[a.createElementVNode("div",{class:"animate-pulse-slow rounded-full h-8 w-8 border-b-2 border-blue-600"},null,-1)])])):a.createCommentVNode("",!0),t.error?(a.openBlock(),a.createElementBlock("div",bQ,[a.createElementVNode("div",MQ,a.toDisplayString(t.error),1)])):a.createCommentVNode("",!0)],4),t.showInfo&&p.chartData?(a.openBlock(),a.createElementBlock("div",xQ,[p.chartData.datasets?(a.openBlock(),a.createElementBlock("div",wQ,a.toDisplayString(p.chartData.datasets.length)+" dataset(s) • "+a.toDisplayString(p.chartData.labels?p.chartData.labels.length:0)+" data points ",1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-5b6eaeb4"]]),vQ=["aria-busy"],CQ={key:0,class:"h-4 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse"},LQ={key:1,class:"flex justify-end"},SQ=["for"],IQ={key:0,class:"ml-1 text-destructive"},_Q={class:"relative w-full group"},BQ={class:"flex items-center self-stretch px-3 bg-gray-50 dark:bg-neutral-800 border-r border-gray-300 dark:border-gray-700"},AQ={class:"text-sm font-semibold text-gray-500 dark:text-gray-400 whitespace-nowrap select-none"},VQ=["id","disabled","readonly","placeholder","maxlength"],PQ={key:0,class:"absolute top-full right-0 z-10 text-[11px] text-gray-400 dark:text-gray-500 opacity-0 transition-opacity pointer-events-none group-focus-within:opacity-100 mt-0.5"},DQ={key:1,class:"flex items-center gap-1 text-xs text-destructive"},Yq=a.defineComponent({name:"DCodeCurrencyField",inheritAttrs:!1,__name:"DCodeCurrencyField",props:{modelValue:{},currency:{default:"IDR"},locale:{},label:{},placeholder:{},error:{},disabled:{type:Boolean},readonly:{type:Boolean},clearable:{type:Boolean},hideClearWhenEmpty:{type:Boolean,default:!0},prependInner:{},skeleton:{type:Boolean,default:!1},showCharCount:{type:Boolean,default:!0}},emits:["update:modelValue","clear"],setup(t,{emit:e}){const n=a.useAttrs(),o=e,r=t,i=Math.random().toString(36).slice(2,7),s=a.computed(()=>`app-currency-field-${n.id||r.label||"currency-field"}-${i}`),c=a.computed(()=>{const A=n.required,V=n["aria-required"];return A===""||A===!0||A==="true"||(V==="true"||V===!0)}),d=a.computed(()=>{const A=n.maxlength??n.maxLength;let V=Number.NaN;return typeof A=="number"?V=A:typeof A=="string"&&(V=Number.parseInt(A,10)),Number.isFinite(V)&&V>0?V:void 0}),h=a.computed(()=>r.locale?r.locale:"en-US"),u=a.computed(()=>r.prependInner?r.prependInner:r.currency==="USD"?"$":r.currency==="IDR"?"Rp":r.currency),p=a.computed(()=>new Intl.NumberFormat(h.value,{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0})),y=A=>{const V=A.replaceAll(/\D/g,"");return V?Number(V):null},f=A=>p.value.format(A),m=a.ref(""),k=a.ref(null);a.watch(()=>r.modelValue,A=>{A==null?m.value="":y(m.value)!==A&&(m.value=f(A))},{immediate:!0});const g=(A,V)=>{let q=0;for(let O=0;O<V;O++)/\d/.test(A[O])&&q++;return q},b=(A,V)=>{let q=0;for(let O=0;O<A.length;O++)if(/\d/.test(A[O])&&(q++,q===V))return O+1;return A.length},w=A=>{const V=A.target,q=V.value,O=V.selectionStart??q.length,N=y(q);if(N===null){m.value="",o("update:modelValue",null);return}const T=f(N);if(q!==T){const H=g(q,O);m.value=T,a.nextTick(()=>{if(k.value){const j=b(T,H);k.value.setSelectionRange(j,j)}})}o("update:modelValue",N)},S=()=>{m.value="",o("update:modelValue",null),o("clear")},C=a.computed(()=>!r.clearable||r.disabled||r.readonly?!1:r.hideClearWhenEmpty?m.value.length>0:!0),x=a.computed(()=>!!r.error),M=a.computed(()=>{const{class:A,maxlength:V,maxLength:q,...O}=n;return O}),v=a.computed(()=>m.value.length),L=a.computed(()=>r.showCharCount?(d.value??0)>0:!1),I=a.computed(()=>L.value&&v.value>0),_=a.computed(()=>`${v.value} / ${d.value}`);return(A,V)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["flex flex-col gap-1.5 w-full",a.unref(n).class]),"aria-busy":r.skeleton},[r.skeleton?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[t.label?(a.openBlock(),a.createElementBlock("div",CQ)):a.createCommentVNode("",!0),V[2]||(V[2]=a.createElementVNode("div",{class:"relative w-full"},[a.createElementVNode("div",{class:"h-10 w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse"})],-1)),L.value?(a.openBlock(),a.createElementBlock("div",LQ,[...V[1]||(V[1]=[a.createElementVNode("div",{class:"h-3 w-14 rounded bg-gray-200 dark:bg-gray-700 animate-pulse"},null,-1)])])):a.createCommentVNode("",!0)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:s.value,class:"text-sm font-medium text-gray-700 dark:text-gray-300"},[a.createTextVNode(a.toDisplayString(t.label)+" ",1),c.value?(a.openBlock(),a.createElementBlock("span",IQ,"*")):a.createCommentVNode("",!0)],8,SQ)):a.createCommentVNode("",!0),a.createElementVNode("div",_Q,[a.createElementVNode("div",{class:a.normalizeClass(["flex items-center w-full rounded-lg border overflow-hidden transition-all duration-200","bg-white dark:bg-neutral-900",x.value?"border-destructive ring-1 ring-destructive":"border-gray-300 dark:border-gray-700 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500 dark:focus-within:border-blue-400",r.disabled?"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-neutral-800":""])},[a.createElementVNode("div",BQ,[a.createElementVNode("span",AQ,a.toDisplayString(u.value),1)]),a.withDirectives(a.createElementVNode("input",a.mergeProps({id:s.value,ref_key:"inputRef",ref:k,"onUpdate:modelValue":V[0]||(V[0]=q=>m.value=q),onInput:w,type:"text",inputmode:"numeric"},M.value,{disabled:r.disabled,readonly:r.readonly,placeholder:r.placeholder,maxlength:d.value,class:["flex-1 h-10 px-3 py-2 text-sm bg-transparent text-foreground dark:text-gray-300 outline-none placeholder:text-gray-400",C.value?"pr-8":""]}),null,16,VQ),[[a.vModelText,m.value]]),C.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"flex items-center justify-center w-8 h-10 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors flex-shrink-0","aria-label":"Clear input",onClick:S},[a.createVNode(a.unref(Mt),{class:"w-3.5 h-3.5"})])):a.createCommentVNode("",!0)],2),I.value&&!x.value?(a.openBlock(),a.createElementBlock("p",PQ,a.toDisplayString(_.value),1)):a.createCommentVNode("",!0)]),x.value?(a.openBlock(),a.createElementBlock("p",DQ,[a.createVNode(a.unref(At),{class:"w-3.5 h-3.5 flex-shrink-0"}),a.createTextVNode(" "+a.toDisplayString(r.error),1)])):a.createCommentVNode("",!0)],64))],10,vQ))}}),Kq=a.defineComponent({__name:"DCodeDialogCloseBtn",props:{icon:{default:"X"},iconSize:{default:22}},setup(t){const e=t,n=a.computed(()=>La[e.icon]??Mt);return(o,r)=>(a.openBlock(),a.createBlock(a.unref(Se),{type:"button",variant:"secondary",size:"icon",class:"rounded-full shadow-sm"},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value),{size:Number(t.iconSize)},null,8,["size"]))]),_:1}))}}),qQ={key:0,class:"text-xs text-muted-foreground"},zQ=["src"],EQ={key:1,class:"h-full w-full flex flex-col items-center justify-center text-muted-foreground gap-2 p-4 text-center"},TQ={class:"space-y-0.5"},OQ={class:"text-sm font-medium truncate max-w-[180px]"},HQ={class:"text-xs opacity-70"},FQ={class:"absolute top-2 inset-x-2 flex items-center justify-between"},$Q={key:1},jQ={class:"absolute left-2 bottom-2 z-10 inline-block max-w-[calc(100%-16px)] rounded-xl border px-3 py-2 shadow-lg backdrop-blur opacity-0 translate-y-1 scale-[0.99] transition-all duration-200 group-hover:opacity-100 group-hover:translate-y-0 group-hover:scale-100 border-border/60 dark:border-border/50 bg-background/80 dark:bg-background/30"},RQ={class:"text-[11px] text-foreground/90 space-y-1 whitespace-nowrap"},NQ={class:"flex gap-2"},UQ={class:"font-medium truncate"},WQ={class:"flex gap-2"},GQ={class:"font-medium"},YQ={class:"flex gap-2"},KQ={class:"font-medium truncate"},DB=a.defineComponent({__name:"DCodeFileResult",props:{file:{},title:{default:"File Terpilih"},description:{default:""},disabled:{type:Boolean,default:!1},previewHeight:{default:190},previewWidth:{default:220},showEdit:{type:Boolean,default:!0},showReplace:{type:Boolean,default:!0},showRemove:{type:Boolean,default:!0},forceFileIcon:{type:Boolean,default:!1}},emits:["edit","replace","remove"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.computed(()=>n.forceFileIcon||!n.file?!1:(n.file.type||"").startsWith("image/"));a.watch(()=>n.file,d=>{r.value&&URL.revokeObjectURL(r.value),r.value=d?URL.createObjectURL(d):null},{immediate:!0}),a.onBeforeUnmount(()=>{r.value&&URL.revokeObjectURL(r.value)});function s(d){const h=d/1024,u=h/1024;return u>=1?`${u.toFixed(2)} MB`:h>=1?`${h.toFixed(1)} KB`:`${d} B`}const c=a.computed(()=>n.file?{name:n.file.name,size:s(n.file.size),type:n.file.type||"unknown"}:null);return(d,h)=>t.file?(a.openBlock(),a.createBlock(Qs,{key:0,class:a.normalizeClass(t.disabled?"opacity-60 pointer-events-none":"")},{default:a.withCtx(()=>[a.createVNode(Xl,{class:"pb-2"},{default:a.withCtx(()=>[a.createVNode(BS,{class:"text-sm font-semibold"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.title),1)]),_:1}),t.description?(a.openBlock(),a.createElementBlock("div",qQ,a.toDisplayString(t.description),1)):a.createCommentVNode("",!0)]),_:1}),a.createVNode(el,{class:"pt-2"},{default:a.withCtx(()=>{var u,p,y,f,m;return[a.createElementVNode("div",{class:"group relative rounded-xl overflow-hidden bg-muted border-2 border-dashed border-border w-full transition-colors duration-200 hover:border-primary/50 hover:bg-primary/5",style:a.normalizeStyle({height:`${t.previewHeight}px`})},[i.value&&r.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:r.value,alt:"Preview",class:"h-full w-full object-contain"},null,8,zQ)):(a.openBlock(),a.createElementBlock("div",EQ,[a.createVNode(a.unref(Cs),{class:"w-10 h-10"}),a.createElementVNode("div",TQ,[a.createElementVNode("p",OQ,a.toDisplayString((u=c.value)==null?void 0:u.name),1),a.createElementVNode("p",HQ,a.toDisplayString((p=c.value)==null?void 0:p.size),1)])])),a.createElementVNode("div",FQ,[t.showEdit&&i.value?(a.openBlock(),a.createBlock(Wt,{key:0,icon:"Pencil",size:"icon",variant:"secondary",disabled:t.disabled,class:"h-8 w-8 shadow transition-transform duration-200 group-hover:scale-[1.02]",onClick:h[0]||(h[0]=k=>o("edit"))},null,8,["disabled"])):(a.openBlock(),a.createElementBlock("div",$Q)),t.showRemove?(a.openBlock(),a.createBlock(Wt,{key:2,icon:"Trash2",size:"icon",variant:"destructive",disabled:t.disabled,class:"h-8 w-8 shadow transition-transform duration-200 group-hover:scale-[1.02]",onClick:h[1]||(h[1]=k=>o("remove"))},null,8,["disabled"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",jQ,[a.createElementVNode("div",RQ,[a.createElementVNode("div",NQ,[h[2]||(h[2]=a.createElementVNode("span",{class:"w-14 shrink-0 text-muted-foreground"},"Nama",-1)),a.createElementVNode("span",UQ,a.toDisplayString((y=c.value)==null?void 0:y.name),1)]),a.createElementVNode("div",WQ,[h[3]||(h[3]=a.createElementVNode("span",{class:"w-14 shrink-0 text-muted-foreground"},"Ukuran",-1)),a.createElementVNode("span",GQ,a.toDisplayString((f=c.value)==null?void 0:f.size),1)]),a.createElementVNode("div",YQ,[h[4]||(h[4]=a.createElementVNode("span",{class:"w-14 shrink-0 text-muted-foreground"},"Tipe",-1)),a.createElementVNode("span",KQ,a.toDisplayString((m=c.value)==null?void 0:m.type),1)])])])],4)]}),_:1})]),_:1},8,["class"])):a.createCommentVNode("",!0)}}),XQ={class:"space-y-3"},ZQ={key:1,class:"flex items-center justify-center p-6 border rounded-lg bg-muted/30"},JQ={name:"DCodeFileField"},Xq=a.defineComponent({...JQ,props:{modelValue:{default:null},label:{default:"Upload File"},hint:{},disabled:{type:Boolean,default:!1},previewHeight:{default:190},previewWidth:{default:void 0},allowedTypes:{default:null},accept:{default:void 0},minSizeMb:{default:null},maxSizeMb:{default:5},endpoint:{},uploadFn:{}},emits:["update:modelValue","error","uploaded"],setup(t,{emit:e}){const n=t,o=e,r=a.computed({get:()=>n.modelValue,set:M=>o("update:modelValue",M)}),i=a.ref(null),s=a.ref(null);function c(M){s.value=M,o("error",M)}function d(){s.value=null}const h=a.computed(()=>{const M=(n.allowedTypes??"").trim();return M?M.split(/[,\s;]+/g).map(L=>L.trim().toLowerCase()).filter(Boolean).map(L=>L.includes("/")||L.startsWith(".")?L:`.${L}`):[]});function u(M){const v=M.lastIndexOf(".");return v>=0?M.slice(v).toLowerCase():""}const p=a.computed(()=>{if(h.value.length){const M=h.value.filter(L=>L.startsWith("."));return[...h.value.filter(L=>L.includes("/")),...M].join(",")}return n.accept}),y=a.computed(()=>h.value.length?h.value.join(", "):n.accept||"Semua File");function f(M){if(h.value.length){const v=(M.type||"").toLowerCase(),L=u(M.name);return h.value.some(I=>I.includes("/")?v===I:I.startsWith(".")?L===I:L===`.${I}`)}if(n.accept){if(n.accept==="*/*")return!0;const v=n.accept.split(",").map(_=>_.trim().toLowerCase()),L=(M.type||"").toLowerCase(),I=u(M.name);return v.some(_=>{if(_.endsWith("/*")){const A=_.slice(0,-2);return L.startsWith(A)}return _.startsWith(".")?I===_:L===_})}return!0}function m(M){return M*1024*1024}async function k(M){return M?f(M)?n.minSizeMb!=null&&M.size<m(n.minSizeMb)?`Ukuran file terlalu kecil. Minimal ${n.minSizeMb}MB`:n.maxSizeMb!=null&&M.size>m(n.maxSizeMb)?`Ukuran file terlalu besar. Maks ${n.maxSizeMb}MB`:null:`File Type not allowed. Allowed: ${y.value}`:"File tidak valid"}const{DCodeApi:g}=nt(),b=F_(),w=a.ref(!1);async function S(M){var v;if(n.uploadFn){try{w.value=!0;const L=await n.uploadFn(M);r.value=M,o("uploaded",L)}catch(L){console.error("Upload Error",L),b.error("Upload Failed",(L==null?void 0:L.message)||"Unknown error"),c((L==null?void 0:L.message)||"Upload Failed")}finally{w.value=!1}return}if(!((v=n.endpoint)!=null&&v.apiUrl)){r.value=M;return}if(typeof g!="function"){c("useApi() must expose DCodeApi()");return}try{w.value=!0;const L=new FormData;L.append("doc",M);const I=(n.endpoint.apiMethod||"POST").toUpperCase(),_=n.endpoint.apiUrl,A=await g("","",L,{_url:_,_method:I,withCredentials:!0,transformRequest:[(q,O)=>(O&&(delete O["Content-Type"],delete O["content-type"]),q)]}),V=(A==null?void 0:A.data)??A;r.value=M,o("uploaded",V)}catch(L){console.error("Upload Error",L),b.error("Upload Failed",(L==null?void 0:L.message)||"Unknown error"),c((L==null?void 0:L.message)||"Upload Failed")}finally{w.value=!1}}async function C(M){var L;if(n.disabled)return;d();const v=await k(M);if(v){c(v);return}i.value=M,n.uploadFn||(L=n.endpoint)!=null&&L.apiUrl?await S(M):r.value=M}function x(){d(),r.value=null,i.value=null}return a.watch(()=>n.modelValue,M=>{M&&!i.value&&(i.value=M),M||(i.value=null)},{immediate:!0}),(M,v)=>(a.openBlock(),a.createElementBlock("div",XQ,[r.value?w.value?(a.openBlock(),a.createElementBlock("div",ZQ,[...v[1]||(v[1]=[a.createElementVNode("span",{class:"text-sm text-muted-foreground animate-pulse"},"Uploading...",-1)])])):(a.openBlock(),a.createBlock(DB,{key:2,file:r.value,title:t.label,description:t.hint,disabled:t.disabled,"show-edit":!1,"show-replace":!1,"show-remove":!0,"force-file-icon":!0,"preview-height":t.previewHeight,"preview-width":t.previewWidth,onRemove:x},null,8,["file","title","description","disabled","preview-height","preview-width"])):(a.openBlock(),a.createBlock(AS,{key:0,label:t.label,hint:t.hint,accept:p.value,maxSizeMb:t.maxSizeMb,disabled:t.disabled||w.value,onPicked:C,error:s.value,onError:v[0]||(v[0]=L=>c(L))},null,8,["label","hint","accept","maxSizeMb","disabled","error"]))]))}}),QQ=["for"],eee={key:0,class:"ml-1 text-destructive"},tee={class:"!relative !w-full"},aee={key:0,class:"flex items-center text-muted-foreground",style:{position:"absolute !important",left:"0.75rem !important",top:"50% !important",transform:"translateY(-50%) !important","z-index":"10 !important"}},nee=["id","readonly","disabled","placeholder"],oee={key:1,class:"flex items-center",style:{position:"absolute !important",right:"0.75rem !important",top:"50% !important",transform:"translateY(-50%) !important","z-index":"10 !important"}},ree={key:2,class:"absolute z-50 mt-1 w-full rounded-xl border bg-white dark:bg-neutral-900 shadow-lg"},iee={key:0,class:"flex items-center justify-center py-10 text-muted-foreground gap-2"},see={key:1,class:"text-sm text-muted-foreground text-center"},lee=["onClick","title"],cee={class:"flex flex-col items-center justify-between gap-2 py-1 min-h-[72px]"},dee={class:"flex items-center justify-center flex-1"},hee={class:"text-[10px] leading-tight text-muted-foreground truncate w-full text-center block flex-shrink-0"},uee={key:3,class:"pt-2 text-[11px] text-muted-foreground text-center"},Zq=a.defineComponent({name:"DCodeIconDropdown",__name:"DCodeIconDropdown",props:{modelValue:{},label:{},placeholder:{default:"Pilih icon…"},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},columns:{default:4},maxHeight:{default:"335px"},iconSize:{default:20},pageSize:{default:120}},emits:["update:modelValue","clear"],setup(t,{emit:e}){const n=t,o=e,r=La,i=a.ref(null),s=a.ref(null),c=Math.random().toString(36).slice(2,7),d=a.computed(()=>`dcode-icon-dropdown-${n.label||"icon-dropdown"}-${c}`),h=a.ref(!1),u=a.computed(()=>(n.modelValue??"").trim()||""),p=a.ref(""),y=a.ref(!1),f=a.ref(!1),m=a.ref(!1),k=a.shallowRef([]),g=a.ref(n.pageSize),b=new Set(["default","createLucideIcon","LucideIcon","Icon","icons","toKebabCase","camelCase","children","IconNode"]),w=async()=>{if(f.value||m.value)return;m.value=!0,await new Promise(D=>setTimeout(D,0));const P=Object.keys(r).filter(D=>!b.has(D)).filter(D=>/^[A-Z]/.test(D)).filter(D=>typeof r[D]=="function"||typeof r[D]=="object"&&r[D]).sort((D,G)=>D.localeCompare(G));k.value=P,f.value=!0,m.value=!1},S=a.computed(()=>!f.value||!u.value||!k.value.includes(u.value)?null:r[u.value]),C=a.ref(u.value),x=a.computed(()=>!!u.value&&!h.value),M=a.computed(()=>{if(!f.value)return[];const P=(p.value??"").trim().toLowerCase();return P?k.value.filter(D=>D.toLowerCase().includes(P)):k.value}),v=a.computed(()=>M.value.slice(0,g.value)),L=a.computed(()=>{const P=n.columns;return P<=2?"grid-cols-2":P===3?"grid-cols-3":P===4?"grid-cols-4":P===5?"grid-cols-5":P>=8?"grid-cols-8":"grid-cols-6"});a.computed(()=>n.clearable?"!pr-10":"!pr-3"),a.computed(()=>S.value&&!h.value?"!pl-12":"!pl-3");const I=async()=>{var P;await a.nextTick(),(P=s.value)==null||P.focus()},_=async P=>{if(n.disabled)return;const D=P!==!1;if(y.value){y.value=!1;return}h.value=!0,await w(),D&&(p.value="",C.value=""),g.value=n.pageSize,await I()},A=()=>{h.value=!1,p.value="",C.value=u.value,g.value=n.pageSize},V=async()=>{n.disabled||(h.value?A():await _())};let q=null;const O=async P=>{if(n.disabled)return;o("update:modelValue",null),h.value||await _(!1),q&&clearTimeout(q);const D=C.value;q=setTimeout(()=>{p.value=D},300)},N=P=>{n.disabled||(o("update:modelValue",P),A(),queueMicrotask(()=>{var D;return(D=s.value)==null?void 0:D.blur()}))},T=()=>{n.disabled||(o("update:modelValue",null),o("clear"),y.value=!0,A(),queueMicrotask(()=>{var P;return(P=s.value)==null?void 0:P.focus()}))},H=P=>{if(P.key==="Escape"){P.preventDefault(),A();return}if(P.key==="Enter"&&h.value){const D=M.value[0];D&&(P.preventDefault(),N(D))}},j=P=>{if(!h.value)return;const D=P.target;i.value&&!i.value.contains(D)&&A()},Z=P=>{const D=P.target;D.scrollTop+D.clientHeight>=D.scrollHeight-24&&g.value<M.value.length&&(g.value=Math.min(g.value+n.pageSize,M.value.length))};return a.onMounted(()=>{document.addEventListener("mousedown",j),queueMicrotask(()=>{var P;s.value=((P=i.value)==null?void 0:P.querySelector("input"))??null}),u.value&&w()}),a.onBeforeUnmount(()=>{document.removeEventListener("mousedown",j),q&&clearTimeout(q)}),a.watch(u,P=>{h.value||(C.value=P)}),a.watch(()=>p.value,()=>{g.value=n.pageSize}),(P,D)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"rootEl",ref:i,class:"w-full"},[n.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:d.value,class:"text-sm font-medium mb-1 block"},[a.createTextVNode(a.toDisplayString(n.label)+" ",1),n.required?(a.openBlock(),a.createElementBlock("span",eee,"*")):a.createCommentVNode("",!0)],8,QQ)):a.createCommentVNode("",!0),a.createElementVNode("div",tee,[S.value&&!h.value?(a.openBlock(),a.createElementBlock("div",aee,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(S.value),{size:18}))])):a.createCommentVNode("",!0),a.withDirectives(a.createElementVNode("input",{id:d.value,"onUpdate:modelValue":D[0]||(D[0]=G=>C.value=G),readonly:x.value,disabled:n.disabled,placeholder:n.placeholder,class:a.normalizeClass(["w-full h-10 rounded-lg border bg-white dark:bg-neutral-900 text-foreground dark:text-gray-300 border-gray-300 dark:border-gray-700",[S.value&&!h.value?"pl-12":"pl-5",x.value?"cursor-pointer select-none":""]]),onClick:_,onFocus:_,onInput:O,onKeydown:H},null,42,nee),[[a.vModelText,C.value]]),n.clearable?(a.openBlock(),a.createElementBlock("div",oee,[u.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"!p-0 !m-0 !bg-transparent !border-0 text-muted-foreground hover:text-foreground transition",onMousedown:D[1]||(D[1]=a.withModifiers(()=>{},["prevent"])),onClick:T,title:"Clear"},[a.createVNode(a.unref(Mt),{class:"h-4 w-4"})],32)):(a.openBlock(),a.createElementBlock("button",{key:1,type:"button",class:"!p-0 !m-0 !bg-transparent !border-0 text-muted-foreground hover:text-foreground transition-transform",onMousedown:D[2]||(D[2]=a.withModifiers(()=>{},["prevent"])),onClick:V,title:"Open"},[a.createVNode(a.unref(Bt),{class:"h-4 w-4"})],32))])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",ree,[a.createElementVNode("div",{class:"p-2 overflow-auto",style:a.normalizeStyle({maxHeight:n.maxHeight}),onScroll:Z},[m.value?(a.openBlock(),a.createElementBlock("div",iee,[a.createVNode(a.unref(bt),{class:"h-4 w-4 animate-spin"}),D[3]||(D[3]=a.createElementVNode("span",{class:"text-sm"},"Loading icons…",-1))])):f.value&&M.value.length===0?(a.openBlock(),a.createElementBlock("div",see," Icon tidak ditemukan ")):(a.openBlock(),a.createElementBlock("div",{key:2,class:a.normalizeClass(["grid gap-2",L.value])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(v.value,G=>(a.openBlock(),a.createElementBlock("button",{key:G,type:"button",class:a.normalizeClass(["group rounded-lg border p-2 hover:bg-muted/40 transition",u.value===G?"ring-1 ring-primary":""]),onClick:ne=>N(G),title:G},[a.createElementVNode("div",cee,[a.createElementVNode("div",dee,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(r)[G]),{size:n.iconSize,class:"shrink-0"},null,8,["size"]))]),a.createElementVNode("span",hee,a.toDisplayString(G),1)])],10,lee))),128))],2)),f.value&&M.value.length>0?(a.openBlock(),a.createElementBlock("div",uee," Showing "+a.toDisplayString(v.value.length)+" / "+a.toDisplayString(M.value.length),1)):a.createCommentVNode("",!0)],36)])):a.createCommentVNode("",!0)])],512))}}),qB=a.defineComponent({name:"DCodeLabel",inheritAttrs:!1,__name:"DCodeLabel",props:{label:{},text:{},textSize:{},textType:{},icon:{},iconClass:{}},setup(t){const e=a.useAttrs(),n=t,o=a.computed(()=>n.icon&&La[n.icon]||null),r=a.computed(()=>n.textSize?`text-${n.textSize}`:"text-xs"),i={xs:"w-3 h-3",sm:"w-3.5 h-3.5",base:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5","2xl":"w-6 h-6","3xl":"w-7 h-7","4xl":"w-8 h-8","5xl":"w-10 h-10","6xl":"w-12 h-12"},s=a.computed(()=>i[n.textSize??"xs"]??"w-3 h-3"),c=a.computed(()=>n.textType==="BOLD"?"font-bold":n.textType==="ITALIC"?"italic font-normal":"font-normal"),d=a.computed(()=>{const u=`${r.value} ${c.value} text-slate-600 ml-1 inline-flex items-center gap-1`,p=e.class??"";return[u,p].filter(Boolean).join(" ")}),h=a.computed(()=>{const{class:u,...p}=e;return p});return(u,p)=>(a.openBlock(),a.createElementBlock("span",a.mergeProps({class:d.value},h.value),[o.value?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.value),{key:0,class:a.normalizeClass(["shrink-0",s.value,t.iconClass])},null,8,["class"])):a.createCommentVNode("",!0),a.createTextVNode(" "+a.toDisplayString(t.label||t.text),1)],16))}}),pee=["aria-busy"],yee={key:0,class:"h-4 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse"},fee={key:0,class:"ml-1 text-destructive"},mee={class:"min-w-0 flex-1 text-left"},kee={key:0,class:"flex flex-wrap gap-1.5"},gee={class:"max-w-[220px] truncate"},bee=["onClick"],Mee={key:1,class:"text-muted-foreground truncate"},xee={class:"flex items-center gap-2 shrink-0"},wee={key:0,class:"p-2 border-b border-gray-200 dark:border-gray-800"},vee={key:0,class:"h-full flex items-center justify-center px-3 text-sm text-muted-foreground"},Cee=["disabled","onClick"],Lee={class:"truncate"},See={key:0,class:"text-primary-600 dark:text-primary-400"},Iee={key:1,class:"h-full flex items-center justify-center text-sm text-muted-foreground"},_ee={key:0},Bee={key:1},Aee={key:1,class:"text-xs text-destructive"},Vee={name:"DCodeMultiSelect"},Jq=a.defineComponent({...Vee,name:"DCodeMultiSelect",inheritAttrs:!1,props:{modelValue:{},items:{default:()=>[]},endpoint:{default:void 0},fetchItems:{},autoFetchOnOpen:{type:Boolean,default:!0},autoFetchOnMount:{type:Boolean,default:!1},refreshOnOpen:{type:Boolean,default:!1},label:{default:""},placeholder:{default:"Pilih data…"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:"Cari…"},visible:{type:Boolean,default:!0},skeleton:{type:Boolean,default:!1},maxChips:{default:2},maxSelected:{default:3},itemTitle:{type:[String,Function],default:"name"},itemValue:{type:[String,Function],default:"id"},returnObject:{type:Boolean,default:!1},virtual:{type:Boolean,default:!0},itemHeight:{default:40},maxRows:{default:5},overscan:{default:6},error:{default:null},required:{type:Boolean,default:!1}},emits:["update:modelValue","clear","max"],setup(t,{emit:e}){const n=a.useAttrs(),o=e,r=t,i=a.computed(()=>(r.label||n.label)??void 0),s=a.computed(()=>r.visible??!0),c=Math.random().toString(36).slice(2,7),d=a.computed(()=>`app-multiselect-${n.id||i.value||"field"}-${c}`),h=a.computed(()=>{if(r.required)return!0;const Y=n.required,Q=n["aria-required"];return Y===""||Y===!0||Y==="true"||(Q==="true"||Q===!0)}),u=a.computed(()=>!!r.error);function p(Y){return Y?typeof r.itemTitle=="function"?r.itemTitle(Y)??"":String((Y==null?void 0:Y[r.itemTitle])??""):""}function y(Y){return Y?typeof r.itemValue=="function"?r.itemValue(Y):Y==null?void 0:Y[r.itemValue]:null}function f(Y,Q){return y(Y)??Q}const m=a.computed(()=>Array.isArray(r.modelValue)?r.modelValue:[]),k=a.computed(()=>{var Y;return!!((Y=r.endpoint)!=null&&Y.apiUrl)||!!r.fetchItems}),g=a.ref([]),b=a.ref(!1),w=a.ref(!1),S=a.computed(()=>{var Q;const Y=(Q=r.endpoint)==null?void 0:Q.apiOptions;if(Y)return typeof Y=="function"?Y():Y}),C=a.computed(()=>{var me,He;const Y=((me=r.endpoint)==null?void 0:me.apiUrl)??"",Q=(((He=r.endpoint)==null?void 0:He.apiMethod)??"GET").toUpperCase(),ae=JSON.stringify(S.value??null);return`${Q} ${Y} :: ${ae}`}),x=a.computed(()=>k.value?g.value:r.items||[]);async function M(){var Y;if(k.value&&!(!((Y=r.endpoint)!=null&&Y.apiUrl)&&!r.fetchItems)&&!b.value){b.value=!0;try{let Q;if(r.fetchItems){const ae=await r.fetchItems(),me=(ae==null?void 0:ae.data)??ae;Q=(me==null?void 0:me.data)??me}else{const{DCodeApi:ae}=nt();if(typeof ae!="function"){console.error("[DCodeMultiSelectChips] useApi() must expose DCodeApi()");return}const me={page:1,perPage:100,...S.value||{}},He=await ae("","",me,{_url:r.endpoint.apiUrl,_method:(r.endpoint.apiMethod||"GET").toUpperCase()}),It=(He==null?void 0:He.data)??He;Q=(It==null?void 0:It.data)??It}g.value=Array.isArray(Q)?Q:[],w.value=!0}catch(Q){console.error("[DCodeMultiSelectChips][fetchOptions] ERROR:",Q),g.value=[]}finally{b.value=!1}}}a.watch(()=>C.value,()=>{g.value=[],w.value=!1}),a.onMounted(()=>{r.autoFetchOnMount&&k.value&&M()});const v=a.computed(()=>{const Y=m.value;if(r.returnObject)return Y;const Q=new Map;for(const ae of x.value)Q.set(y(ae),ae);return Y.map(ae=>Q.get(ae)??{[r.itemValue]:ae,[r.itemTitle]:String(ae)})}),L=a.computed(()=>r.maxChips===null?v.value:v.value.slice(0,r.maxChips));function I(Y){const Q=m.value;if(r.returnObject){const ae=y(Y);return Q.some(me=>y(me)===ae)}return Q.includes(y(Y))}const _=a.computed(()=>{if(r.maxSelected===null||r.maxSelected===void 0)return null;const Y=Number(r.maxSelected);return Number.isFinite(Y)&&Y>0?Y:null}),A=a.computed(()=>{const Y=_.value;return Y===null?!1:m.value.length>=Y});function V(Y){return!I(Y)&&A.value}const q=a.computed(()=>{const Y=m.value,Q=new Set;if(r.returnObject)for(const ae of Y)Q.add(y(ae));else for(const ae of Y)Q.add(ae);return Q}),O=a.computed(()=>{const Y=q.value;return(x.value||[]).filter(Q=>!Y.has(y(Q)))}),N=a.computed(()=>x.value.length===0?!1:O.value.length===0),T=a.ref(null),H=a.ref(null),j=a.ref(null),Z=a.ref(!1),P=a.ref(""),D=a.ref(0),G=a.ref(0),{floatingStyles:ne}=gS(T,H,{whileElementsMounted:yS,placement:"bottom-start",middleware:[fS(8),jl(),mS({padding:8}),kS({apply({rects:Y,elements:Q}){Object.assign(Q.floating.style,{width:`${Y.reference.width}px`,"--floating-width":`${Y.reference.width}px`})}})]}),te=a.computed(()=>ne.value),ce=a.computed(()=>{const Y=Number(r.maxRows);return Number.isFinite(Y)&&Y>0?Y:5});async function pe(){r.disabled||(Z.value=!0,G.value=0,requestAnimationFrame(()=>{j.value&&(j.value.scrollTop=0),D.value=0}),k.value&&r.autoFetchOnOpen&&(r.refreshOnOpen||!w.value)&&!b.value&&await M())}function le(){Z.value=!1}function Le(){Z.value?le():pe()}function ue(Y){var ae,me;if(!Z.value)return;const Q=Y.target;(ae=T.value)!=null&&ae.contains(Q)||(me=H.value)!=null&&me.contains(Q)||le()}a.onMounted(()=>document.addEventListener("mousedown",ue)),a.onBeforeUnmount(()=>document.removeEventListener("mousedown",ue));function U(Y){if(r.disabled)return;if(V(Y)){o("max");return}const Q=[...m.value];if(r.returnObject){const ae=y(Y);if(Q.some(He=>y(He)===ae))return;o("update:modelValue",[...Q,Y])}else{const ae=y(Y);if(Q.includes(ae))return;o("update:modelValue",[...Q,ae])}P.value="",G.value=0,requestAnimationFrame(()=>{j.value&&(j.value.scrollTop=0),D.value=0})}function z(Y){if(r.disabled)return;const Q=[...m.value];if(r.returnObject){const ae=y(Y);o("update:modelValue",Q.filter(me=>y(me)!==ae))}else{const ae=y(Y);o("update:modelValue",Q.filter(me=>me!==ae))}}function W(){r.disabled||(o("update:modelValue",[]),o("clear"),le())}const ee=a.computed(()=>{const Y=P.value.trim().toLowerCase(),Q=O.value;return Y?Q.filter(ae=>p(ae).toLowerCase().includes(Y)):Q}),fe=a.computed(()=>ee.value.length);a.watch(Z,Y=>{Y||(P.value="")});const Te=a.computed(()=>{if(N.value)return r.itemHeight;const Y=fe.value;return(Y<=0?1:Math.min(Y,ce.value))*r.itemHeight}),xe=a.computed(()=>r.virtual?fe.value*r.itemHeight:0),Qe=a.computed(()=>r.virtual?Math.ceil(Te.value/r.itemHeight)+r.overscan:fe.value),it=a.computed(()=>{if(!r.virtual)return 0;const Y=Math.floor(D.value/r.itemHeight)-Math.floor(r.overscan/2);return Math.max(0,Y)}),St=a.computed(()=>r.virtual?Math.min(fe.value,it.value+Qe.value):fe.value),M1=a.computed(()=>r.virtual?it.value*r.itemHeight:0),ht=a.computed(()=>{const Y=ee.value;return r.virtual?Y.slice(it.value,St.value):Y});function ka(Y){const Q=Y.target;D.value=Q.scrollTop}function x1(Y){return Y===G.value}function $(Y){const Q=j.value;if(!Q||!r.virtual)return;const ae=Y*r.itemHeight,me=ae+r.itemHeight,He=Q.scrollTop,It=Q.scrollTop+Q.clientHeight;ae<He?Q.scrollTop=ae:me>It&&(Q.scrollTop=me-Q.clientHeight)}function J(Y){const Q=Math.max(0,fe.value-1);G.value=Math.min(Q,Math.max(0,G.value+Y)),$(G.value)}function de(){const Y=ee.value[G.value];Y&&U(Y)}const Ve=a.computed(()=>r.clearable&&!r.disabled&&v.value.length>0),Oe=a.computed(()=>u.value?"border-red-500 ring-[0.5px] ring-red-500":Z.value?"border-gray-700 ring-[0.5px] ring-gray-700 dark:border-gray-300 dark:ring-gray-300":"");return(Y,Q)=>a.withDirectives((a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["flex flex-col gap-1 w-full",a.unref(n).class]),"aria-busy":r.skeleton},[r.skeleton?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[i.value?(a.openBlock(),a.createElementBlock("div",yee)):a.createCommentVNode("",!0),Q[3]||(Q[3]=a.createElementVNode("div",{class:"h-10 w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse"},null,-1))],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[i.value?(a.openBlock(),a.createBlock(a.unref(Xs),{key:0,for:d.value,class:"text-sm font-medium"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(i.value)+" ",1),h.value?(a.openBlock(),a.createElementBlock("span",fee,"*")):a.createCommentVNode("",!0)]),_:1},8,["for"])):a.createCommentVNode("",!0),a.createElementVNode("div",{ref_key:"referenceEl",ref:T,class:"relative"},[a.createVNode(a.unref(Se),{id:d.value,type:"button",variant:"outline",class:a.normalizeClass(["w-full justify-between h-auto min-h-10 px-3 py-2 transition border",["bg-white dark:bg-neutral-900 border-gray-300 dark:border-gray-700 text-foreground dark:text-gray-300",Oe.value]]),disabled:r.disabled,onClick:Le},{default:a.withCtx(()=>[a.createElementVNode("div",mee,[v.value.length?(a.openBlock(),a.createElementBlock("div",kee,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(L.value,(ae,me)=>(a.openBlock(),a.createBlock(a.unref(Oa),{key:`chip-${f(ae,me)}`,variant:"secondary",class:"gap-1"},{default:a.withCtx(()=>[a.createElementVNode("span",gee,a.toDisplayString(p(ae)),1),r.disabled?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:0,class:"ml-1 opacity-70 hover:opacity-100",onClick:a.withModifiers(He=>z(ae),["stop"]),"aria-label":"Remove"}," ✕ ",8,bee))]),_:2},1024))),128)),r.maxChips!==null&&v.value.length>r.maxChips?(a.openBlock(),a.createBlock(a.unref(Oa),{key:0,variant:"secondary"},{default:a.withCtx(()=>[a.createTextVNode(" +"+a.toDisplayString(v.value.length-(r.maxChips??0)),1)]),_:1})):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",Mee,a.toDisplayString(r.placeholder),1))]),a.createElementVNode("div",xee,[Ve.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"text-muted-foreground hover:text-foreground",onClick:a.withModifiers(W,["stop"]),"aria-label":"Clear"}," ✕ ")):a.createCommentVNode("",!0),a.createVNode(a.unref(Bt),{class:"h-4 w-4 text-muted-foreground"})])]),_:1},8,["id","disabled","class"]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[Z.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"floatingEl",ref:H,class:"-mt-1 z-[9999] w-[var(--floating-width)] rounded-lg border shadow-lg overflow-hidden bg-white dark:bg-neutral-900 border-gray-200 dark:border-gray-800",style:a.normalizeStyle(te.value)},[r.searchable&&!N.value?(a.openBlock(),a.createElementBlock("div",wee,[a.createVNode(a.unref(_S),{modelValue:P.value,"onUpdate:modelValue":Q[0]||(Q[0]=ae=>P.value=ae),placeholder:r.searchPlaceholder,class:"h-10",onKeydown:[Q[1]||(Q[1]=a.withKeys(a.withModifiers(ae=>J(1),["prevent"]),["down"])),Q[2]||(Q[2]=a.withKeys(a.withModifiers(ae=>J(-1),["prevent"]),["up"])),a.withKeys(a.withModifiers(de,["prevent"]),["enter"]),a.withKeys(a.withModifiers(le,["prevent"]),["esc"])]},null,8,["modelValue","placeholder","onKeydown"])])):a.createCommentVNode("",!0),a.createElementVNode("div",{ref_key:"listEl",ref:j,class:"relative overflow-auto",style:a.normalizeStyle({height:Te.value+"px"}),onScroll:ka},[N.value?(a.openBlock(),a.createElementBlock("div",vee," All items have been selected ")):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[r.virtual?(a.openBlock(),a.createElementBlock("div",{key:0,style:a.normalizeStyle({height:xe.value+"px"})},null,4)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(r.virtual?"absolute left-0 top-0 w-full":""),style:a.normalizeStyle(r.virtual?{transform:`translateY(${M1.value}px)`}:void 0)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ht.value,(ae,me)=>(a.openBlock(),a.createElementBlock("button",{key:String(f(ae,it.value+me)),type:"button",class:a.normalizeClass(["w-full px-3 text-left text-sm flex items-center justify-between gap-3",[V(ae)?"cursor-not-allowed opacity-50":"hover:bg-neutral-50 dark:hover:bg-neutral-800/60",x1(it.value+me)?"bg-neutral-50 dark:bg-neutral-800/60":"",I(ae)?"font-semibold":"font-normal"]]),style:a.normalizeStyle({height:r.itemHeight+"px"}),disabled:r.disabled||V(ae),onClick:He=>U(ae)},[a.createElementVNode("span",Lee,a.toDisplayString(p(ae)),1),I(ae)?(a.openBlock(),a.createElementBlock("span",See,"✓")):a.createCommentVNode("",!0)],14,Cee))),128))],6),fe.value===0?(a.openBlock(),a.createElementBlock("div",Iee,[b.value?(a.openBlock(),a.createElementBlock("span",_ee,"Loading data…")):(a.openBlock(),a.createElementBlock("span",Bee,"Tidak ada data"))])):a.createCommentVNode("",!0)],64))],36)],4)):a.createCommentVNode("",!0)]))],512),u.value?(a.openBlock(),a.createElementBlock("p",Aee,a.toDisplayString(r.error),1)):a.createCommentVNode("",!0)],64))],10,pee)),[[a.vShow,s.value]])}}),Pee={class:"w-full"},Dee={key:0,class:"flex items-center justify-between mb-2"},qee={key:0,class:"text-sm font-medium text-gray-700"},zee={key:1,class:"text-sm text-gray-600"},Eee={name:"DCodeProgress"},Qq=a.defineComponent({...Eee,name:"DCodeProgress",inheritAttrs:!1,props:{modelValue:{default:0},max:{default:100},label:{default:""},showValue:{type:Boolean,default:!1},color:{default:"blue"},size:{default:"md"},striped:{type:Boolean,default:!1},animated:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=a.computed(()=>Math.min(n.modelValue/n.max*100,100)),r=a.computed(()=>["w-full rounded-full overflow-hidden",{sm:"h-1",md:"h-2",lg:"h-3"}[n.size],"bg-gray-200"].join(" ")),i=a.computed(()=>{const c={blue:"bg-blue-500",green:"bg-green-500",red:"bg-red-500",yellow:"bg-yellow-500",purple:"bg-purple-500",gray:"bg-gray-500"},d=["h-full transition-all duration-300 ease-out",c[n.color]||c.blue];return n.striped&&d.push("bg-gradient-to-r from-transparent via-white/20 to-transparent"),n.animated&&d.push("animate-pulse"),d.join(" ")}),s=a.computed(()=>`${Math.round(o.value)}%`);return(c,d)=>(a.openBlock(),a.createElementBlock("div",Pee,[t.label||t.showValue?(a.openBlock(),a.createElementBlock("div",Dee,[t.label?(a.openBlock(),a.createElementBlock("span",qee,a.toDisplayString(t.label),1)):a.createCommentVNode("",!0),t.showValue?(a.openBlock(),a.createElementBlock("span",zee,a.toDisplayString(s.value),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(r.value)},[a.createElementVNode("div",{class:a.normalizeClass(i.value),style:a.normalizeStyle({width:`${o.value}%`})},null,6)],2)]))}}),Tee={key:0,class:"fixed top-0 left-0 right-0 z-[10000] h-[3px]"},ez=Wl(a.defineComponent({name:"DCodeProgressBar",__name:"DCodeProgressBar",props:{isApiLoading:{type:Boolean,default:!1},apiProgress:{default:0}},setup(t){return(e,n)=>(a.openBlock(),a.createBlock(a.Transition,{name:"fade"},{default:a.withCtx(()=>[t.isApiLoading?(a.openBlock(),a.createElementBlock("div",Tee,[a.createElementVNode("div",{class:"h-full bg-primary-600 shadow-[0_0_15px_rgba(37,99,235,0.8)] transition-all duration-300 ease-out",style:a.normalizeStyle({width:`${t.apiProgress}%`})},null,4)])):a.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-5a7c62fb"]]),Oee={class:"flex flex-col"},Hee={key:0,class:"flex items-center gap-2 text-sm text-gray-500 mb-2"},Fee={class:"relative flex-shrink-0 mt-0.5"},$ee=["id","name","value","checked","disabled","required","onChange"],jee=["onClick"],Ree=["for"],Nee={key:0,class:"ml-1 text-red-500"},Uee={key:1,class:"flex items-center gap-1 text-sm text-red-500 mt-1"},tz=a.defineComponent({name:"DCodeRadio",inheritAttrs:!1,__name:"DCodeRadio",props:{modelValue:{default:void 0},label:{default:"name"},options:{default:()=>[]},apiUrl:{default:""},apiMethod:{default:"GET"},dataPath:{default:""},layout:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{default:null},size:{default:"md"},color:{default:"blue"},model:{default:"id"},id:{default:""}},emits:["update:modelValue","change"],setup(t,{emit:e}){a.useAttrs();const{apiUrl:n}=nt(),o=e,r=t,i=a.ref([]),s=a.ref(!1),c=a.ref(null),d=async()=>{if(r.apiUrl){s.value=!0,c.value=null;try{const S={page:1,perPage:100},C=await n(r.apiUrl,r.apiMethod,S);let x=C;r.dataPath?x=r.dataPath.split(".").reduce((v,L)=>v&&v[L]!=="undefined"?v[L]:void 0,C):typeof C=="object"&&!Array.isArray(C)&&C.data&&(x=C.data),Array.isArray(x)?i.value=x:(console.warn("DCodeRadio: Format response tidak terdeteksi sebagai Array. Gunakan prop 'dataPath'."),c.value="Format respons data tidak valid. Array tidak ditemukan.")}catch(S){console.error("DCodeRadio fetch error:",S),c.value="Gagal memuat data dari endpoint."}finally{s.value=!1}}};a.onMounted(()=>{r.apiUrl&&d()});const h=a.computed(()=>r.options&&r.options.length>0?r.options:i.value.length>0?i.value:r.model!==void 0||r.label?[{[r.model]:r.model,[r.label]:r.label}]:[]),u=S=>typeof S=="object"?S[r.model]:S,p=S=>typeof S=="object"?S[r.label]:String(S),y=a.computed(()=>r.model||`radio-group-${Math.random().toString(36).substr(2,9)}`),f=a.computed(()=>!!r.error||!!c.value),m=a.computed(()=>r.error||c.value),k=S=>S==null?r.modelValue===S:String(r.modelValue)===String(S),g=a.computed(()=>({sm:{radio:"w-3 h-3",label:"text-sm",container:"gap-2"},md:{radio:"w-4 h-4",label:"text-base",container:"gap-2"},lg:{radio:"w-5 h-5",label:"text-lg",container:"gap-3"}})[r.size]),b=(S,C)=>{C.target.checked&&(o("update:modelValue",S),o("change",S))},w=S=>{!r.disabled&&!k(S)&&(o("update:modelValue",S),o("change",S))};return(S,C)=>(a.openBlock(),a.createElementBlock("div",Oee,[s.value?(a.openBlock(),a.createElementBlock("div",Hee,[a.createVNode(a.unref(bt),{class:"w-4 h-4 animate-spin"}),C[0]||(C[0]=a.createTextVNode(" Sedang memuat opsi... ",-1))])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["flex",t.layout?"flex-row flex-wrap gap-4":"flex-col gap-3"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(h.value,(x,M)=>(a.openBlock(),a.createElementBlock("div",{key:M,class:a.normalizeClass(["flex items-start",g.value.container,t.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"])},[a.createElementVNode("div",Fee,[a.createElementVNode("input",{id:t.id?`${t.id}-${M}`:`${y.value}-${M}`,name:y.value,type:"radio",value:u(x),checked:k(u(x)),disabled:t.disabled,required:t.required&&M===0,onChange:v=>b(u(x),v),class:"w-5 h-5 text-blue-600 focus:ring-blue-500 border-gray-300"},null,40,$ee)]),a.createElementVNode("div",{class:"flex-1 min-w-0",onClick:v=>w(u(x))},[a.createElementVNode("label",{for:t.id?`${t.id}-${M}`:`${y.value}-${M}`,class:a.normalizeClass([g.value.label,"font-medium cursor-pointer select-none text-gray-900",t.disabled?"cursor-not-allowed opacity-50":""])},[a.createTextVNode(a.toDisplayString(p(x))+" ",1),t.required&&h.value.length===1&&t.label?(a.openBlock(),a.createElementBlock("span",Nee,"*")):a.createCommentVNode("",!0)],10,Ree)],8,jee)],2))),128))],2),f.value&&m.value?(a.openBlock(),a.createElementBlock("div",Uee,[a.createVNode(a.unref(At),{class:"w-4 h-4 flex-shrink-0"}),a.createTextVNode(" "+a.toDisplayString(m.value),1)])):a.createCommentVNode("",!0)]))}}),Wee={class:"flex flex-col"},Gee={key:0,class:"flex items-center gap-2 text-sm text-gray-500 mb-2"},Yee=["onClick"],Kee=["id","name","value","checked","disabled","required","onChange"],Xee={key:1,class:"w-6 h-6",fill:"currentColor",viewBox:"0 0 20 20"},Zee=["for"],Jee={key:0,class:"ml-1 text-red-500"},Qee={key:1,class:"flex items-center gap-1 text-sm text-red-500 mt-2"},az=a.defineComponent({name:"DCodeRadioCustom",inheritAttrs:!1,__name:"DCodeRadioCustom",props:{modelValue:{default:void 0},icon:{},label:{default:"name"},options:{default:()=>[]},apiUrl:{default:""},apiMethod:{default:"GET"},dataPath:{default:""},layout:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{default:null},size:{default:"md"},color:{default:"blue"},model:{default:"id"},id:{default:""}},emits:["update:modelValue","change"],setup(t,{emit:e}){a.useAttrs();const{apiUrl:n}=nt(),o=e,r=t,i=a.ref(r.modelValue??void 0);a.watch(()=>r.modelValue,M=>{i.value=M},{immediate:!0});const s=a.ref([]),c=a.ref(!1),d=a.ref(null),h=async()=>{if(r.apiUrl){c.value=!0,d.value=null;try{const M={page:1,perPage:100},v=await n(r.apiUrl,r.apiMethod,M);let L=v;r.dataPath?L=r.dataPath.split(".").reduce((_,A)=>_&&_[A]!=="undefined"?_[A]:void 0,v):typeof v=="object"&&!Array.isArray(v)&&v.data&&(L=v.data),Array.isArray(L)?s.value=L:(console.warn("DCodeRadioCustom: Format response tidak terdeteksi sebagai Array. Gunakan prop 'dataPath'."),d.value="Format respons data tidak valid. Array tidak ditemukan.")}catch(M){console.error("DCodeRadioCustom fetch error:",M),d.value="Gagal memuat data dari endpoint."}finally{c.value=!1}}};a.onMounted(()=>{r.apiUrl&&h()});const u=a.computed(()=>r.options&&r.options.length>0?r.options:s.value.length>0?s.value:r.model!==void 0||r.label?[{[r.model]:r.model,[r.label]:r.label}]:[]),p=M=>typeof M=="object"?M[r.model]:M,y=M=>typeof M=="object"?M[r.label]:String(M),f=Math.random().toString(36).slice(2,7),m=a.computed(()=>r.id?`radio-custom-${r.id}`:`radio-custom-${r.model}-${f}`),k=a.computed(()=>!!r.error||!!d.value),g=a.computed(()=>r.error||d.value),b=M=>{const v=i.value;return M==null?v===M:String(v)===String(M)},w=a.computed(()=>({sm:{radio:"w-3 h-3",label:"text-sm",container:"gap-2"},md:{radio:"w-4 h-4",label:"text-base",container:"gap-2"},lg:{radio:"w-5 h-5",label:"text-lg",container:"gap-3"}})[r.size]),S=a.computed(()=>r.icon&&La[r.icon]||null),C=(M,v)=>{v.target.checked&&(i.value=M,o("update:modelValue",M),o("change",M))},x=M=>{r.disabled||b(M)||(i.value=M,o("update:modelValue",M),o("change",M))};return(M,v)=>(a.openBlock(),a.createElementBlock("div",Wee,[c.value?(a.openBlock(),a.createElementBlock("div",Gee,[a.createVNode(a.unref(bt),{class:"w-4 h-4 animate-spin"}),v[0]||(v[0]=a.createTextVNode(" Sedang memuat opsi... ",-1))])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["grid",t.layout?"grid-cols-2 sm:grid-cols-3":"grid-cols-1","gap-3"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(L,I)=>(a.openBlock(),a.createElementBlock("div",{key:I,class:a.normalizeClass(["relative flex flex-col items-center justify-center gap-2 p-4 rounded-xl border-2 transition-all duration-200",b(p(L))?"border-blue-500 bg-blue-50 shadow-md shadow-blue-100":"border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm",t.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]),onClick:_=>!t.disabled&&x(p(L))},[a.createElementVNode("input",{id:t.id?`${t.id}-${I}`:`${m.value}-${I}`,name:m.value,type:"radio",value:p(L),checked:b(p(L)),disabled:t.disabled,required:t.required&&I===0,onChange:_=>C(p(L),_),class:"sr-only",tabindex:"-1"},null,40,Kee),a.createElementVNode("div",{class:a.normalizeClass(["w-10 h-10 rounded-full flex items-center justify-center transition-all duration-200",b(p(L))?"bg-blue-100 text-blue-600":"bg-gray-100 text-gray-400"])},[S.value?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(S.value),{key:0,class:"w-6 h-6"})):(a.openBlock(),a.createElementBlock("svg",Xee,[...v[1]||(v[1]=[a.createElementVNode("circle",{cx:"10",cy:"10",r:"6"},null,-1)])]))],2),a.createElementVNode("label",{for:t.id?`${t.id}-${I}`:`${m.value}-${I}`,class:a.normalizeClass([w.value.label,"font-medium text-center leading-tight select-none transition-colors duration-200",b(p(L))?"text-blue-700":"text-gray-700",t.disabled?"cursor-not-allowed":"cursor-pointer"])},[a.createTextVNode(a.toDisplayString(y(L))+" ",1),t.required&&u.value.length===1&&t.label?(a.openBlock(),a.createElementBlock("span",Jee,"*")):a.createCommentVNode("",!0)],10,Zee)],10,Yee))),128))],2),k.value&&g.value?(a.openBlock(),a.createElementBlock("div",Qee,[a.createVNode(a.unref(At),{class:"w-4 h-4 flex-shrink-0"}),a.createTextVNode(" "+a.toDisplayString(g.value),1)])):a.createCommentVNode("",!0)]))}}),ete={key:0,class:"ml-1 text-destructive"},tte={class:"relative w-full"},ate={key:0,class:"mb-2 flex items-center justify-between"},nte={class:"text-sm text-muted-foreground"},ote={class:"text-sm font-medium text-foreground"},rte={class:"text-sm text-muted-foreground"},ite={class:"relative"},ste=["id","value","min","max","step","disabled","placeholder"],lte={key:1,class:"relative mt-2"},cte={class:"text-xs text-muted-foreground mt-1"},dte={key:1,class:"flex items-center gap-1 text-sm text-destructive"},hte={name:"DCodeSlider"},nz=a.defineComponent({...hte,name:"DCodeSlider",inheritAttrs:!1,props:{modelValue:{default:0},min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1},label:{default:""},placeholder:{default:""},required:{type:Boolean,default:!1},error:{default:null},showValue:{type:Boolean,default:!0},valuePrefix:{default:""},valueSuffix:{default:""},marks:{default:()=>[]},color:{default:"blue"},size:{default:"md"}},emits:["update:modelValue","change","input"],setup(t,{emit:e}){const n=a.useAttrs(),o=e,r=t,i=a.ref(),s=a.ref(!1),c=a.computed(()=>!!r.error),d=a.computed(()=>`slider-${Math.random().toString(36).substr(2,9)}`),h=a.computed(()=>(r.label||n.label)??void 0),u=a.computed(()=>!0),p=a.computed(()=>{const x={sm:"h-2",md:"h-2.5",lg:"h-3"},M={blue:"accent-blue-500",green:"accent-green-500",red:"accent-red-500",yellow:"accent-yellow-500",purple:"accent-purple-500",gray:"accent-gray-500"};return["w-full appearance-none bg-gray-200 rounded-lg outline-none transition-all cursor-pointer","disabled:opacity-50 disabled:cursor-not-allowed",x[r.size],M[r.color]||M.blue,c.value?"accent-red-500":"",n.class].filter(Boolean).join(" ")}),y=a.computed(()=>["appearance-none bg-white border-2 border-current rounded-full cursor-pointer transition-all","hover:scale-110 focus:scale-110","shadow-md hover:shadow-lg focus:shadow-lg","focus:outline-none focus:ring-2 focus:ring-offset-2",{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r.size],r.color==="blue"?"focus:ring-blue-500":r.color==="green"?"focus:ring-green-500":r.color==="red"?"focus:ring-red-500":r.color==="yellow"?"focus:ring-yellow-500":r.color==="purple"?"focus:ring-purple-500":"focus:ring-gray-500"].join(" ")),f=a.computed(()=>`${r.valuePrefix}${r.modelValue}${r.valueSuffix}`),m=a.computed(()=>{const x=r.max-r.min;return(r.modelValue-r.min)/x*100}),k=x=>{const M=x.target,v=parseFloat(M.value);o("update:modelValue",v),o("input",v)},g=x=>{const M=x.target,v=parseFloat(M.value);o("change",v)},b=()=>{s.value=!0},w=()=>{s.value=!1},S=x=>{const M=r.max-r.min;return(x-r.min)/M*100},C=a.computed(()=>{const x={sm:16,md:20,lg:24};return`
8566
+ `):t}function eQ(t,e){const{element:n,datasetIndex:o,index:r}=e,i=t.getDatasetMeta(o).controller,{label:s,value:c}=i.getLabelAndValue(r);return{chart:t,label:s,parsed:i.getParsed(r),raw:t.data.datasets[o].data[r],formattedValue:c,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function Dq(t,e){const n=t.chart.ctx,{body:o,footer:r,title:i}=t,{boxWidth:s,boxHeight:c}=e,d=Ke(e.bodyFont),h=Ke(e.titleFont),u=Ke(e.footerFont),p=i.length,y=r.length,f=o.length,m=kt(e.padding);let k=m.height,g=0,b=o.reduce((C,x)=>C+x.before.length+x.lines.length+x.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,p&&(k+=p*h.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),b){const C=e.displayColors?Math.max(c,d.lineHeight):d.lineHeight;k+=f*C+(b-f)*d.lineHeight+(b-1)*e.bodySpacing}y&&(k+=e.footerMarginTop+y*u.lineHeight+(y-1)*e.footerSpacing);let w=0;const S=function(C){g=Math.max(g,n.measureText(C).width+w)};return n.save(),n.font=h.string,Be(t.title,S),n.font=d.string,Be(t.beforeBody.concat(t.afterBody),S),w=e.displayColors?s+2+e.boxPadding:0,Be(o,C=>{Be(C.before,S),Be(C.lines,S),Be(C.after,S)}),w=0,n.font=u.string,Be(t.footer,S),n.restore(),g+=m.width,{width:g,height:k}}function tQ(t,e){const{y:n,height:o}=e;return n<o/2?"top":n>t.height-o/2?"bottom":"center"}function aQ(t,e,n,o){const{x:r,width:i}=o,s=n.caretSize+n.caretPadding;if(t==="left"&&r+i+s>e.width||t==="right"&&r-i-s<0)return!0}function nQ(t,e,n,o){const{x:r,width:i}=n,{width:s,chartArea:{left:c,right:d}}=t;let h="center";return o==="center"?h=r<=(c+d)/2?"left":"right":r<=i/2?h="left":r>=s-i/2&&(h="right"),aQ(h,t,e,n)&&(h="center"),h}function qq(t,e,n){const o=n.yAlign||e.yAlign||tQ(t,n);return{xAlign:n.xAlign||e.xAlign||nQ(t,e,n,o),yAlign:o}}function oQ(t,e){let{x:n,width:o}=t;return e==="right"?n-=o:e==="center"&&(n-=o/2),n}function rQ(t,e,n){let{y:o,height:r}=t;return e==="top"?o+=n:e==="bottom"?o-=r+n:o-=r/2,o}function zq(t,e,n,o){const{caretSize:r,caretPadding:i,cornerRadius:s}=t,{xAlign:c,yAlign:d}=n,h=r+i,{topLeft:u,topRight:p,bottomLeft:y,bottomRight:f}=al(s);let m=oQ(e,c);const k=rQ(e,d,h);return d==="center"?c==="left"?m+=h:c==="right"&&(m-=h):c==="left"?m-=Math.max(u,y)+r:c==="right"&&(m+=Math.max(p,f)+r),{x:Ge(m,0,o.width-e.width),y:Ge(k,0,o.height-e.height)}}function sI(t,e,n){const o=kt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-o.right:t.x+o.left}function Eq(t){return Jt([],ma(t))}function iQ(t,e,n){return ms(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function Tq(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const Oq={beforeTitle:da,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,o=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(o>0&&e.dataIndex<o)return n[e.dataIndex]}return""},afterTitle:da,beforeBody:da,beforeLabel:da,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Ie(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.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(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:da,afterBody:da,beforeFooter:da,footer:da,afterFooter:da};function ot(t,e,n,o){const r=t[e].call(n,o);return typeof r>"u"?Oq[e].call(n,o):r}class AB extends ya{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,o=this.options.setContext(this.getContext()),r=o.enabled&&n.options.animation&&o.animations,i=new DD(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=iQ(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:o}=n,r=ot(o,"beforeTitle",this,e),i=ot(o,"title",this,e),s=ot(o,"afterTitle",this,e);let c=[];return c=Jt(c,ma(r)),c=Jt(c,ma(i)),c=Jt(c,ma(s)),c}getBeforeBody(e,n){return Eq(ot(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:o}=n,r=[];return Be(e,i=>{const s={before:[],lines:[],after:[]},c=Tq(o,i);Jt(s.before,ma(ot(c,"beforeLabel",this,i))),Jt(s.lines,ot(c,"label",this,i)),Jt(s.after,ma(ot(c,"afterLabel",this,i))),r.push(s)}),r}getAfterBody(e,n){return Eq(ot(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:o}=n,r=ot(o,"beforeFooter",this,e),i=ot(o,"footer",this,e),s=ot(o,"afterFooter",this,e);let c=[];return c=Jt(c,ma(r)),c=Jt(c,ma(i)),c=Jt(c,ma(s)),c}_createItems(e){const n=this._active,o=this.chart.data,r=[],i=[],s=[];let c=[],d,h;for(d=0,h=n.length;d<h;++d)c.push(eQ(this.chart,n[d]));return e.filter&&(c=c.filter((u,p,y)=>e.filter(u,p,y,o))),e.itemSort&&(c=c.sort((u,p)=>e.itemSort(u,p,o))),Be(c,u=>{const p=Tq(e.callbacks,u);r.push(ot(p,"labelColor",this,u)),i.push(ot(p,"labelPointStyle",this,u)),s.push(ot(p,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=s,this.dataPoints=c,c}update(e,n){const o=this.options.setContext(this.getContext()),r=this._active;let i,s=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const c=b1[o.position].call(this,r,this._eventPosition);s=this._createItems(o),this.title=this.getTitle(s,o),this.beforeBody=this.getBeforeBody(s,o),this.body=this.getBody(s,o),this.afterBody=this.getAfterBody(s,o),this.footer=this.getFooter(s,o);const d=this._size=Dq(this,o),h=Object.assign({},c,d),u=qq(this.chart,o,h),p=zq(o,h,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:p.x,y:p.y,width:d.width,height:d.height,caretX:c.x,caretY:c.y}}this._tooltipItems=s,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&o.external&&o.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,o,r){const i=this.getCaretPosition(e,o,r);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(e,n,o){const{xAlign:r,yAlign:i}=this,{caretSize:s,cornerRadius:c}=o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:p}=al(c),{x:y,y:f}=e,{width:m,height:k}=n;let g,b,w,S,C,x;return i==="center"?(C=f+k/2,r==="left"?(g=y,b=g-s,S=C+s,x=C-s):(g=y+m,b=g+s,S=C-s,x=C+s),w=g):(r==="left"?b=y+Math.max(d,u)+s:r==="right"?b=y+m-Math.max(h,p)-s:b=this.caretX,i==="top"?(S=f,C=S-s,g=b-s,w=b+s):(S=f+k,C=S+s,g=b+s,w=b-s),x=S),{x1:g,x2:b,x3:w,y1:S,y2:C,y3:x}}drawTitle(e,n,o){const r=this.title,i=r.length;let s,c,d;if(i){const h=rl(o.rtl,this.x,this.width);for(e.x=sI(this,o.titleAlign,o),n.textAlign=h.textAlign(o.titleAlign),n.textBaseline="middle",s=Ke(o.titleFont),c=o.titleSpacing,n.fillStyle=o.titleColor,n.font=s.string,d=0;d<i;++d)n.fillText(r[d],h.x(e.x),e.y+s.lineHeight/2),e.y+=s.lineHeight+c,d+1===i&&(e.y+=o.titleMarginBottom-c)}}_drawColorBox(e,n,o,r,i){const s=this.labelColors[o],c=this.labelPointStyles[o],{boxHeight:d,boxWidth:h}=i,u=Ke(i.bodyFont),p=sI(this,"left",i),y=r.x(p),f=d<u.lineHeight?(u.lineHeight-d)/2:0,m=n.y+f;if(i.usePointStyle){const k={radius:Math.min(h,d)/2,pointStyle:c.pointStyle,rotation:c.rotation,borderWidth:1},g=r.leftForLtr(y,h)+h/2,b=m+d/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,iB(e,k,g,b),e.strokeStyle=s.borderColor,e.fillStyle=s.backgroundColor,iB(e,k,g,b)}else{e.lineWidth=we(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,e.strokeStyle=s.borderColor,e.setLineDash(s.borderDash||[]),e.lineDashOffset=s.borderDashOffset||0;const k=r.leftForLtr(y,h),g=r.leftForLtr(r.xPlus(y,1),h-2),b=al(s.borderRadius);Object.values(b).some(w=>w!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,$S(e,{x:k,y:m,w:h,h:d,radius:b}),e.fill(),e.stroke(),e.fillStyle=s.backgroundColor,e.beginPath(),$S(e,{x:g,y:m+1,w:h-2,h:d-2,radius:b}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(k,m,h,d),e.strokeRect(k,m,h,d),e.fillStyle=s.backgroundColor,e.fillRect(g,m+1,h-2,d-2))}e.fillStyle=this.labelTextColors[o]}drawBody(e,n,o){const{body:r}=this,{bodySpacing:i,bodyAlign:s,displayColors:c,boxHeight:d,boxWidth:h,boxPadding:u}=o,p=Ke(o.bodyFont);let y=p.lineHeight,f=0;const m=rl(o.rtl,this.x,this.width),k=function(L){n.fillText(L,m.x(e.x+f),e.y+y/2),e.y+=y+i},g=m.textAlign(s);let b,w,S,C,x,M,v;for(n.textAlign=s,n.textBaseline="middle",n.font=p.string,e.x=sI(this,g,o),n.fillStyle=o.bodyColor,Be(this.beforeBody,k),f=c&&g!=="right"?s==="center"?h/2+u:h+2+u:0,C=0,M=r.length;C<M;++C){for(b=r[C],w=this.labelTextColors[C],n.fillStyle=w,Be(b.before,k),S=b.lines,c&&S.length&&(this._drawColorBox(n,e,C,m,o),y=Math.max(p.lineHeight,d)),x=0,v=S.length;x<v;++x)k(S[x]),y=p.lineHeight;Be(b.after,k)}f=0,y=p.lineHeight,Be(this.afterBody,k),e.y-=i}drawFooter(e,n,o){const r=this.footer,i=r.length;let s,c;if(i){const d=rl(o.rtl,this.x,this.width);for(e.x=sI(this,o.footerAlign,o),e.y+=o.footerMarginTop,n.textAlign=d.textAlign(o.footerAlign),n.textBaseline="middle",s=Ke(o.footerFont),n.fillStyle=o.footerColor,n.font=s.string,c=0;c<i;++c)n.fillText(r[c],d.x(e.x),e.y+s.lineHeight/2),e.y+=s.lineHeight+o.footerSpacing}}drawBackground(e,n,o,r){const{xAlign:i,yAlign:s}=this,{x:c,y:d}=e,{width:h,height:u}=o,{topLeft:p,topRight:y,bottomLeft:f,bottomRight:m}=al(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(c+p,d),s==="top"&&this.drawCaret(e,n,o,r),n.lineTo(c+h-y,d),n.quadraticCurveTo(c+h,d,c+h,d+y),s==="center"&&i==="right"&&this.drawCaret(e,n,o,r),n.lineTo(c+h,d+u-m),n.quadraticCurveTo(c+h,d+u,c+h-m,d+u),s==="bottom"&&this.drawCaret(e,n,o,r),n.lineTo(c+f,d+u),n.quadraticCurveTo(c,d+u,c,d+u-f),s==="center"&&i==="left"&&this.drawCaret(e,n,o,r),n.lineTo(c,d+p),n.quadraticCurveTo(c,d,c+p,d),n.closePath(),n.fill(),r.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,o=this.$animations,r=o&&o.x,i=o&&o.y;if(r||i){const s=b1[e.position].call(this,this._active,this._eventPosition);if(!s)return;const c=this._size=Dq(this,e),d=Object.assign({},s,this._size),h=qq(n,e,d),u=zq(e,d,h,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=c.width,this.height=c.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let o=this.opacity;if(!o)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},i={x:this.x,y:this.y};o=Math.abs(o)<.001?0:o;const s=kt(n.padding),c=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&c&&(e.save(),e.globalAlpha=o,this.drawBackground(i,e,r,n),vD(e,n.textDirection),i.y+=s.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),CD(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const o=this._active,r=e.map(({datasetIndex:c,index:d})=>{const h=this.chart.getDatasetMeta(c);if(!h)throw new Error("Cannot find a dataset at index "+c);return{datasetIndex:c,element:h.data[d],index:d}}),i=!zS(o,r),s=this._positionChanged(r,n);(i||s)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,o=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,i=this._active||[],s=this._getActiveElements(e,i,n,o),c=this._positionChanged(s,e),d=n||!zS(s,i)||c;return d&&(this._active=s,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),d}_getActiveElements(e,n,o,r){const i=this.options;if(e.type==="mouseout")return[];if(!r)return n.filter(c=>this.chart.data.datasets[c.datasetIndex]&&this.chart.getDatasetMeta(c.datasetIndex).controller.getParsed(c.index)!==void 0);const s=this.chart.getElementsAtEventForMode(e,i.mode,i,o);return i.reverse&&s.reverse(),s}_positionChanged(e,n){const{caretX:o,caretY:r,options:i}=this,s=b1[i.position].call(this,e,n);return s!==!1&&(o!==s.x||r!==s.y)}}se(AB,"positioners",b1);var sQ={id:"tooltip",_element:AB,positioners:b1,afterInit(t,e,n){n&&(t.tooltip=new AB({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Oq},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const lQ=(t,e,n,o)=>(typeof e=="string"?(n=t.push(e)-1,o.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function cQ(t,e,n,o){const r=t.indexOf(e);if(r===-1)return lQ(t,e,n,o);const i=t.lastIndexOf(e);return r!==i?n:r}const dQ=(t,e)=>t===null?null:Ge(Math.round(t),0,e);function Hq(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class VB extends sl{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const o=this.getLabels();for(const{index:r,label:i}of n)o[r]===i&&o.splice(r,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(Ie(e))return null;const o=this.getLabels();return n=isFinite(n)&&o[n]===e?n:cQ(o,e,be(n,e),this._addedLabels),dQ(n,o.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:o,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(o=0),n||(r=this.getLabels().length-1)),this.min=o,this.max=r}buildTicks(){const e=this.min,n=this.max,o=this.options.offset,r=[];let i=this.getLabels();i=e===0&&n===i.length-1?i:i.slice(e,n+1),this._valueRange=Math.max(i.length-(o?0:1),1),this._startValue=this.min-(o?.5:0);for(let s=e;s<=n;s++)r.push({value:s});return r}getLabelForValue(e){return Hq.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}se(VB,"id","category"),se(VB,"defaults",{ticks:{callback:Hq}});function hQ(t,e){const n=[],{bounds:r,step:i,min:s,max:c,precision:d,count:h,maxTicks:u,maxDigits:p,includeBounds:y}=t,f=i||1,m=u-1,{min:k,max:g}=e,b=!Ie(s),w=!Ie(c),S=!Ie(h),C=(g-k)/(p+1);let x=ZP((g-k)/m/f)*f,M,v,L,I;if(x<1e-14&&!b&&!w)return[{value:k},{value:g}];I=Math.ceil(g/x)-Math.floor(k/x),I>m&&(x=ZP(I*x/m/f)*f),Ie(d)||(M=Math.pow(10,d),x=Math.ceil(x*M)/M),r==="ticks"?(v=Math.floor(k/x)*x,L=Math.ceil(g/x)*x):(v=k,L=g),b&&w&&i&&yK((c-s)/i,x/1e3)?(I=Math.round(Math.min((c-s)/x,u)),x=(c-s)/I,v=s,L=c):S?(v=b?s:v,L=w?c:L,I=h-1,x=(L-v)/I):(I=(L-v)/x,o1(I,Math.round(I),x/1e3)?I=Math.round(I):I=Math.ceil(I));const _=Math.max(JP(x),JP(v));M=Math.pow(10,Ie(d)?_:d),v=Math.round(v*M)/M,L=Math.round(L*M)/M;let A=0;for(b&&(y&&v!==s?(n.push({value:s}),v<s&&A++,o1(Math.round((v+A*x)*M)/M,s,Fq(s,C,t))&&A++):v<s&&A++);A<I;++A){const V=Math.round((v+A*x)*M)/M;if(w&&V>c)break;n.push({value:V})}return w&&y&&L!==c?n.length&&o1(n[n.length-1].value,c,Fq(c,C,t))?n[n.length-1].value=c:n.push({value:c}):(!w||L===c)&&n.push({value:L}),n}function Fq(t,e,{horizontal:n,minRotation:o}){const r=ha(o),i=(n?Math.sin(r):Math.cos(r))||.001,s=.75*e*(""+t).length;return Math.min(e/i,s)}class uQ extends sl{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return Ie(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:o}=this.getUserBounds();let{min:r,max:i}=this;const s=d=>r=n?r:d,c=d=>i=o?i:d;if(e){const d=Xt(r),h=Xt(i);d<0&&h<0?c(0):d>0&&h>0&&s(0)}if(r===i){let d=i===0?1:Math.abs(i*.05);c(i+d),e||s(r-d)}this.min=r,this.max=i}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:o}=e,r;return o?(r=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let o=this.getTickLimit();o=Math.max(2,o);const r={maxTicks:o,bounds:e.bounds,min:e.min,max:e.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=hQ(r,i);return e.bounds==="ticks"&&fK(s,this,"value"),e.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const e=this.ticks;let n=this.min,o=this.max;if(super.configure(),this.options.offset&&e.length){const r=(o-n)/Math.max(e.length-1,1)/2;n-=r,o+=r}this._startValue=n,this._endValue=o,this._valueRange=o-n}getLabelForValue(e){return nB(e,this.chart.options.locale,this.options.ticks.format)}}class PB extends uQ{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=We(e)?e:0,this.max=We(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,o=ha(this.options.ticks.minRotation),r=(e?Math.sin(o):Math.cos(o))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}se(PB,"id","linear"),se(PB,"defaults",{ticks:{callback:cD.formatters.numeric}});const lI={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}},rt=Object.keys(lI);function $q(t,e){return t-e}function jq(t,e){if(Ie(e))return null;const n=t._adapter,{parser:o,round:r,isoWeekday:i}=t._parseOpts;let s=e;return typeof o=="function"&&(s=o(s)),We(s)||(s=typeof o=="string"?n.parse(s,o):n.parse(s)),s===null?null:(r&&(s=r==="week"&&(r1(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,r)),+s)}function Rq(t,e,n,o){const r=rt.length;for(let i=rt.indexOf(t);i<r-1;++i){const s=lI[rt[i]],c=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-e)/(c*s.size))<=o)return rt[i]}return rt[r-1]}function pQ(t,e,n,o,r){for(let i=rt.length-1;i>=rt.indexOf(n);i--){const s=rt[i];if(lI[s].common&&t._adapter.diff(r,o,s)>=e-1)return s}return rt[n?rt.indexOf(n):0]}function yQ(t){for(let e=rt.indexOf(t)+1,n=rt.length;e<n;++e)if(lI[rt[e]].common)return rt[e]}function Nq(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:o,hi:r}=Q_(n,e),i=n[o]>=e?n[o]:n[r];t[i]=!0}}function fQ(t,e,n,o){const r=t._adapter,i=+r.startOf(e[0].value,o),s=e[e.length-1].value;let c,d;for(c=i;c<=s;c=+r.add(c,1,o))d=n[c],d>=0&&(e[d].major=!0);return e}function Uq(t,e,n){const o=[],r={},i=e.length;let s,c;for(s=0;s<i;++s)c=e[s],r[c]=s,o.push({value:c,major:!1});return i===0||!n?o:fQ(t,o,r,n)}class cI extends sl{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const o=e.time||(e.time={}),r=this._adapter=new ZX._date(e.adapters.date);r.init(n),a1(o.displayFormats,r.formats()),this._parseOpts={parser:o.parser,round:o.round,isoWeekday:o.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:jq(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,o=e.time.unit||"day";let{min:r,max:i,minDefined:s,maxDefined:c}=this.getUserBounds();function d(h){!s&&!isNaN(h.min)&&(r=Math.min(r,h.min)),!c&&!isNaN(h.max)&&(i=Math.max(i,h.max))}(!s||!c)&&(d(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&d(this.getMinMax(!1))),r=We(r)&&!isNaN(r)?r:+n.startOf(Date.now(),o),i=We(i)&&!isNaN(i)?i:+n.endOf(Date.now(),o)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],o=e[e.length-1]),{min:n,max:o}}buildTicks(){const e=this.options,n=e.time,o=e.ticks,r=o.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,s=this.max,c=MK(r,i,s);return this._unit=n.unit||(o.autoSkip?Rq(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):pQ(this,c.length,n.minUnit,this.min,this.max)),this._majorUnit=!o.major.enabled||this._unit==="year"?void 0:yQ(this._unit),this.initOffsets(r),e.reverse&&c.reverse(),Uq(this,c,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,o=0,r,i;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?n=1-r:n=(this.getDecimalForValue(e[1])-r)/2,i=this.getDecimalForValue(e[e.length-1]),e.length===1?o=i:o=(i-this.getDecimalForValue(e[e.length-2]))/2);const s=e.length<3?.5:.25;n=Ge(n,0,s),o=Ge(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const e=this._adapter,n=this.min,o=this.max,r=this.options,i=r.time,s=i.unit||Rq(i.minUnit,n,o,this._getLabelCapacity(n)),c=be(r.ticks.stepSize,1),d=s==="week"?i.isoWeekday:!1,h=r1(d)||d===!0,u={};let p=n,y,f;if(h&&(p=+e.startOf(p,"isoWeek",d)),p=+e.startOf(p,h?"day":s),e.diff(o,n,s)>1e5*c)throw new Error(n+" and "+o+" are too far apart with stepSize of "+c+" "+s);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(y=p,f=0;y<o;y=+e.add(y,c,s),f++)Nq(u,y,m);return(y===o||r.bounds==="ticks"||f===1)&&Nq(u,y,m),Object.keys(u).sort($q).map(k=>+k)}getLabelForValue(e){const n=this._adapter,o=this.options.time;return o.tooltipFormat?n.format(e,o.tooltipFormat):n.format(e,o.displayFormats.datetime)}format(e,n){const r=this.options.time.displayFormats,i=this._unit,s=n||r[i];return this._adapter.format(e,s)}_tickFormatFunction(e,n,o,r){const i=this.options,s=i.ticks.callback;if(s)return Pe(s,[e,n,o],this);const c=i.time.displayFormats,d=this._unit,h=this._majorUnit,u=d&&c[d],p=h&&c[h],y=o[n],f=h&&p&&y&&y.major;return this._adapter.format(e,r||(f?p:u))}generateTickLabels(e){let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n],r.label=this._tickFormatFunction(r.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,o=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+o)*n.factor)}getValueForPixel(e){const n=this._offsets,o=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+o*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,o=this.ctx.measureText(e).width,r=ha(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),s=Math.sin(r),c=this._resolveTickFontOptions(0).size;return{w:o*i+c*s,h:o*s+c*i}}_getLabelCapacity(e){const n=this.options.time,o=n.displayFormats,r=o[n.unit]||o.millisecond,i=this._tickFormatFunction(e,0,Uq(this,[e],this._majorUnit),r),s=this._getLabelSize(i),c=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return c>0?c:1}getDataTimestamps(){let e=this._cache.data||[],n,o;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,o=r.length;n<o;++n)e=e.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,o;if(e.length)return e;const r=this.getLabels();for(n=0,o=r.length;n<o;++n)e.push(jq(this,r[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return aD(e.sort($q))}}se(cI,"id","time"),se(cI,"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 dI(t,e,n){let o=0,r=t.length-1,i,s,c,d;n?(e>=t[o].pos&&e<=t[r].pos&&({lo:o,hi:r}=ps(t,"pos",e)),{pos:i,time:c}=t[o],{pos:s,time:d}=t[r]):(e>=t[o].time&&e<=t[r].time&&({lo:o,hi:r}=ps(t,"time",e)),{time:i,pos:c}=t[o],{time:s,pos:d}=t[r]);const h=s-i;return h?c+(d-c)*(e-i)/h:c}class Wq extends cI{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=dI(n,this.min),this._tableRange=dI(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:o}=this,r=[],i=[];let s,c,d,h,u;for(s=0,c=e.length;s<c;++s)h=e[s],h>=n&&h<=o&&r.push(h);if(r.length<2)return[{time:n,pos:0},{time:o,pos:1}];for(s=0,c=r.length;s<c;++s)u=r[s+1],d=r[s-1],h=r[s],Math.round((u+d)/2)!==h&&i.push({time:h,pos:s/(c-1)});return i}_generate(){const e=this.min,n=this.max;let o=super.getDataTimestamps();return(!o.includes(e)||!o.length)&&o.splice(0,0,e),(!o.includes(n)||o.length===1)&&o.push(n),o.sort((r,i)=>r-i)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),o=this.getLabelTimestamps();return n.length&&o.length?e=this.normalize(n.concat(o)):e=n.length?n:o,e=this._cache.all=e,e}getDecimalForValue(e){return(dI(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,o=this.getDecimalForPixel(e)/n.factor-n.end;return dI(this._table,o*this._tableRange+this._minPos,!0)}}se(Wq,"id","timeseries"),se(Wq,"defaults",cI.defaults);const mQ={key:0,class:"mb-2 text-sm font-medium text-gray-700"},kQ={key:0,class:"text-red-500 ml-1"},gQ={key:0,class:"absolute inset-0 flex items-center justify-center bg-white"},bQ={key:1,class:"absolute inset-0 flex items-center justify-center bg-red-50 border border-red-200 rounded"},MQ={class:"text-red-600 text-sm"},xQ={key:1,class:"mt-2 text-xs text-gray-500"},wQ={key:0},Gq=Wl(a.defineComponent({name:"DCodeChart",__name:"DCodeChart",props:{type:{default:"line"},width:{default:400},height:{default:300},required:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{default:null},showInfo:{type:Boolean,default:!1},responsive:{type:Boolean,default:!0},maintainAspectRatio:{type:Boolean,default:!1},theme:{default:"light"},colors:{default:()=>["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16"]},data:{},modelValue:{},options:{},onClick:{},onHover:{},label:{}},emits:["update:modelValue","click","hover","ready"],setup(t,{expose:e,emit:n}){fa.register(VB,PB,oI,Ua,rI,g1,QJ,sQ,ZJ,UJ,YS,GS,kB,il);const o=t,r=n,i=a.ref(null),s=a.ref(null),c=a.computed(()=>({"opacity-50 pointer-events-none":o.loading||o.error})),d=()=>{const p=o.theme==="dark";return{responsive:o.responsive,maintainAspectRatio:o.maintainAspectRatio,animation:{duration:1e3,easing:"easeInOutQuart",delay:y=>{let f=0;return y.type==="data"&&y.mode==="default"&&(f=y.dataIndex*100+y.datasetIndex*50),f},onComplete:()=>{}},plugins:{legend:{position:"top",labels:{color:p?"#E5E7EB":"#374151",font:{size:12}}},tooltip:{backgroundColor:p?"#1F2937":"#FFFFFF",titleColor:p?"#F3F4F6":"#111827",bodyColor:p?"#D1D5DB":"#4B5563",borderColor:p?"#374151":"#E5E7EB",borderWidth:1,animation:{duration:200,easing:"easeInOutQuad"}}},scales:o.type!=="pie"&&o.type!=="doughnut"&&o.type!=="polarArea"?{x:{grid:{color:p?"#374151":"#E5E7EB"},ticks:{color:p?"#D1D5DB":"#6B7280"}},y:{grid:{color:p?"#374151":"#E5E7EB"},ticks:{color:p?"#D1D5DB":"#6B7280"}}}:void 0}},h=p=>!p||!p.datasets?p:{...p,datasets:p.datasets.map((y,f)=>({...y,borderColor:y.borderColor||o.colors[f%o.colors.length],backgroundColor:y.backgroundColor||o.colors[f%o.colors.length]+"20",pointBackgroundColor:y.pointBackgroundColor||o.colors[f%o.colors.length],pointBorderColor:y.pointBorderColor||o.colors[f%o.colors.length],hoverBackgroundColor:y.hoverBackgroundColor||o.colors[f%o.colors.length]+"40",hoverBorderColor:y.hoverBorderColor||o.colors[f%o.colors.length]}))},u=async()=>{if(!i.value)return;await a.nextTick(),s.value&&s.value.destroy();const p=h(o.data||o.modelValue);if(!p)return;const y={...d(),...o.options};s.value=new fa(i.value,{type:o.type,data:p,options:y,onClick:(f,m)=>{r("click",f,m),o.onClick&&o.onClick(f,m)},onHover:(f,m)=>{r("hover",f,m),o.onHover&&o.onHover(f,m)}}),r("ready",s.value)};return a.watch(()=>[o.data,o.modelValue,o.type,o.options,o.theme],()=>{u()},{deep:!0}),a.watch(()=>[o.width,o.height],()=>{s.value&&s.value.resize()}),a.onMounted(()=>{u()}),a.onUnmounted(()=>{s.value&&s.value.destroy()}),e({chart:s,updateChart:u}),(p,y)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["d-code-chart",c.value])},[t.label?(a.openBlock(),a.createElementBlock("div",mQ,[a.createTextVNode(a.toDisplayString(t.label)+" ",1),t.required?(a.openBlock(),a.createElementBlock("span",kQ,"*")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"relative",style:a.normalizeStyle({height:t.height+"px"})},[a.createElementVNode("canvas",{ref_key:"chartCanvas",ref:i},null,512),t.loading?(a.openBlock(),a.createElementBlock("div",gQ,[...y[0]||(y[0]=[a.createElementVNode("div",{class:"animate-pulse-slow rounded-full h-8 w-8 border-b-2 border-blue-600"},null,-1)])])):a.createCommentVNode("",!0),t.error?(a.openBlock(),a.createElementBlock("div",bQ,[a.createElementVNode("div",MQ,a.toDisplayString(t.error),1)])):a.createCommentVNode("",!0)],4),t.showInfo&&p.chartData?(a.openBlock(),a.createElementBlock("div",xQ,[p.chartData.datasets?(a.openBlock(),a.createElementBlock("div",wQ,a.toDisplayString(p.chartData.datasets.length)+" dataset(s) • "+a.toDisplayString(p.chartData.labels?p.chartData.labels.length:0)+" data points ",1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-5b6eaeb4"]]),vQ=["aria-busy"],CQ={key:0,class:"h-4 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse"},LQ={key:1,class:"flex justify-end"},SQ=["for"],IQ={key:0,class:"ml-1 text-destructive"},_Q={class:"relative w-full group"},BQ={class:"flex items-center self-stretch px-3 bg-gray-50 dark:bg-neutral-800 border-r border-gray-300 dark:border-gray-700"},AQ={class:"text-sm font-semibold text-gray-500 dark:text-gray-400 whitespace-nowrap select-none"},VQ=["id","disabled","readonly","placeholder","maxlength"],PQ={key:0,class:"absolute top-full right-0 z-10 text-[11px] text-gray-400 dark:text-gray-500 opacity-0 transition-opacity pointer-events-none group-focus-within:opacity-100 mt-0.5"},DQ={key:1,class:"flex items-center gap-1 text-xs text-destructive"},Yq=a.defineComponent({name:"DCodeCurrencyField",inheritAttrs:!1,__name:"DCodeCurrencyField",props:{modelValue:{},currency:{default:"IDR"},locale:{},label:{},placeholder:{},error:{},disabled:{type:Boolean},readonly:{type:Boolean},clearable:{type:Boolean},hideClearWhenEmpty:{type:Boolean,default:!0},prependInner:{},skeleton:{type:Boolean,default:!1},showCharCount:{type:Boolean,default:!0}},emits:["update:modelValue","clear"],setup(t,{emit:e}){const n=a.useAttrs(),o=e,r=t,i=Math.random().toString(36).slice(2,7),s=a.computed(()=>`app-currency-field-${n.id||r.label||"currency-field"}-${i}`),c=a.computed(()=>{const A=n.required,V=n["aria-required"];return A===""||A===!0||A==="true"||(V==="true"||V===!0)}),d=a.computed(()=>{const A=n.maxlength??n.maxLength;let V=Number.NaN;return typeof A=="number"?V=A:typeof A=="string"&&(V=Number.parseInt(A,10)),Number.isFinite(V)&&V>0?V:void 0}),h=a.computed(()=>r.locale?r.locale:"en-US"),u=a.computed(()=>r.prependInner?r.prependInner:r.currency==="USD"?"$":r.currency==="IDR"?"Rp":r.currency),p=a.computed(()=>new Intl.NumberFormat(h.value,{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0})),y=A=>{const V=A.replaceAll(/\D/g,"");return V?Number(V):null},f=A=>p.value.format(A),m=a.ref(""),k=a.ref(null);a.watch(()=>r.modelValue,A=>{A==null?m.value="":y(m.value)!==A&&(m.value=f(A))},{immediate:!0});const g=(A,V)=>{let q=0;for(let O=0;O<V;O++)/\d/.test(A[O])&&q++;return q},b=(A,V)=>{let q=0;for(let O=0;O<A.length;O++)if(/\d/.test(A[O])&&(q++,q===V))return O+1;return A.length},w=A=>{const V=A.target,q=V.value,O=V.selectionStart??q.length,N=y(q);if(N===null){m.value="",o("update:modelValue",null);return}const T=f(N);if(q!==T){const H=g(q,O);m.value=T,a.nextTick(()=>{if(k.value){const j=b(T,H);k.value.setSelectionRange(j,j)}})}o("update:modelValue",N)},S=()=>{m.value="",o("update:modelValue",null),o("clear")},C=a.computed(()=>!r.clearable||r.disabled||r.readonly?!1:r.hideClearWhenEmpty?m.value.length>0:!0),x=a.computed(()=>!!r.error),M=a.computed(()=>{const{class:A,maxlength:V,maxLength:q,...O}=n;return O}),v=a.computed(()=>m.value.length),L=a.computed(()=>r.showCharCount?(d.value??0)>0:!1),I=a.computed(()=>L.value&&v.value>0),_=a.computed(()=>`${v.value} / ${d.value}`);return(A,V)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["flex flex-col gap-1.5 w-full",a.unref(n).class]),"aria-busy":r.skeleton},[r.skeleton?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[t.label?(a.openBlock(),a.createElementBlock("div",CQ)):a.createCommentVNode("",!0),V[2]||(V[2]=a.createElementVNode("div",{class:"relative w-full"},[a.createElementVNode("div",{class:"h-10 w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse"})],-1)),L.value?(a.openBlock(),a.createElementBlock("div",LQ,[...V[1]||(V[1]=[a.createElementVNode("div",{class:"h-3 w-14 rounded bg-gray-200 dark:bg-gray-700 animate-pulse"},null,-1)])])):a.createCommentVNode("",!0)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[t.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:s.value,class:"text-sm font-medium text-gray-700 dark:text-gray-300"},[a.createTextVNode(a.toDisplayString(t.label)+" ",1),c.value?(a.openBlock(),a.createElementBlock("span",IQ,"*")):a.createCommentVNode("",!0)],8,SQ)):a.createCommentVNode("",!0),a.createElementVNode("div",_Q,[a.createElementVNode("div",{class:a.normalizeClass(["flex items-center w-full rounded-lg border overflow-hidden transition-all duration-200","bg-white dark:bg-neutral-900",x.value?"border-destructive ring-1 ring-destructive":"border-gray-300 dark:border-gray-700 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500 dark:focus-within:border-blue-400",r.disabled?"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-neutral-800":""])},[a.createElementVNode("div",BQ,[a.createElementVNode("span",AQ,a.toDisplayString(u.value),1)]),a.withDirectives(a.createElementVNode("input",a.mergeProps({id:s.value,ref_key:"inputRef",ref:k,"onUpdate:modelValue":V[0]||(V[0]=q=>m.value=q),onInput:w,type:"text",inputmode:"numeric"},M.value,{disabled:r.disabled,readonly:r.readonly,placeholder:r.placeholder,maxlength:d.value,class:["flex-1 h-10 px-3 py-2 text-sm bg-transparent text-foreground dark:text-gray-300 outline-none placeholder:text-gray-400",C.value?"pr-8":""]}),null,16,VQ),[[a.vModelText,m.value]]),C.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"flex items-center justify-center w-8 h-10 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors flex-shrink-0","aria-label":"Clear input",onClick:S},[a.createVNode(a.unref(Mt),{class:"w-3.5 h-3.5"})])):a.createCommentVNode("",!0)],2),I.value&&!x.value?(a.openBlock(),a.createElementBlock("p",PQ,a.toDisplayString(_.value),1)):a.createCommentVNode("",!0)]),x.value?(a.openBlock(),a.createElementBlock("p",DQ,[a.createVNode(a.unref(At),{class:"w-3.5 h-3.5 flex-shrink-0"}),a.createTextVNode(" "+a.toDisplayString(r.error),1)])):a.createCommentVNode("",!0)],64))],10,vQ))}}),Kq=a.defineComponent({__name:"DCodeDialogCloseBtn",props:{icon:{default:"X"},iconSize:{default:22}},setup(t){const e=t,n=a.computed(()=>La[e.icon]??Mt);return(o,r)=>(a.openBlock(),a.createBlock(a.unref(Se),{type:"button",variant:"secondary",size:"icon",class:"rounded-full shadow-sm"},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value),{size:Number(t.iconSize)},null,8,["size"]))]),_:1}))}}),qQ={key:0,class:"text-xs text-muted-foreground"},zQ=["src"],EQ={key:1,class:"h-full w-full flex flex-col items-center justify-center text-muted-foreground gap-2 p-4 text-center"},TQ={class:"space-y-0.5"},OQ={class:"text-sm font-medium truncate max-w-[180px]"},HQ={class:"text-xs opacity-70"},FQ={class:"absolute top-2 inset-x-2 flex items-center justify-between"},$Q={key:1},jQ={class:"absolute left-2 bottom-2 z-10 inline-block max-w-[calc(100%-16px)] rounded-xl border px-3 py-2 shadow-lg backdrop-blur opacity-0 translate-y-1 scale-[0.99] transition-all duration-200 group-hover:opacity-100 group-hover:translate-y-0 group-hover:scale-100 border-border/60 dark:border-border/50 bg-background/80 dark:bg-background/30"},RQ={class:"text-[11px] text-foreground/90 space-y-1 whitespace-nowrap"},NQ={class:"flex gap-2"},UQ={class:"font-medium truncate"},WQ={class:"flex gap-2"},GQ={class:"font-medium"},YQ={class:"flex gap-2"},KQ={class:"font-medium truncate"},DB=a.defineComponent({__name:"DCodeFileResult",props:{file:{},title:{default:"File Terpilih"},description:{default:""},disabled:{type:Boolean,default:!1},previewHeight:{default:190},previewWidth:{default:220},showEdit:{type:Boolean,default:!0},showReplace:{type:Boolean,default:!0},showRemove:{type:Boolean,default:!0},forceFileIcon:{type:Boolean,default:!1}},emits:["edit","replace","remove"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.computed(()=>n.forceFileIcon||!n.file?!1:(n.file.type||"").startsWith("image/"));a.watch(()=>n.file,d=>{r.value&&URL.revokeObjectURL(r.value),r.value=d?URL.createObjectURL(d):null},{immediate:!0}),a.onBeforeUnmount(()=>{r.value&&URL.revokeObjectURL(r.value)});function s(d){const h=d/1024,u=h/1024;return u>=1?`${u.toFixed(2)} MB`:h>=1?`${h.toFixed(1)} KB`:`${d} B`}const c=a.computed(()=>n.file?{name:n.file.name,size:s(n.file.size),type:n.file.type||"unknown"}:null);return(d,h)=>t.file?(a.openBlock(),a.createBlock(Qs,{key:0,class:a.normalizeClass(t.disabled?"opacity-60 pointer-events-none":"")},{default:a.withCtx(()=>[a.createVNode(Xl,{class:"pb-2"},{default:a.withCtx(()=>[a.createVNode(BS,{class:"text-sm font-semibold"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.title),1)]),_:1}),t.description?(a.openBlock(),a.createElementBlock("div",qQ,a.toDisplayString(t.description),1)):a.createCommentVNode("",!0)]),_:1}),a.createVNode(el,{class:"pt-2"},{default:a.withCtx(()=>{var u,p,y,f,m;return[a.createElementVNode("div",{class:"group relative rounded-xl overflow-hidden bg-muted border-2 border-dashed border-border w-full transition-colors duration-200 hover:border-primary/50 hover:bg-primary/5",style:a.normalizeStyle({height:`${t.previewHeight}px`})},[i.value&&r.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:r.value,alt:"Preview",class:"h-full w-full object-contain"},null,8,zQ)):(a.openBlock(),a.createElementBlock("div",EQ,[a.createVNode(a.unref(Cs),{class:"w-10 h-10"}),a.createElementVNode("div",TQ,[a.createElementVNode("p",OQ,a.toDisplayString((u=c.value)==null?void 0:u.name),1),a.createElementVNode("p",HQ,a.toDisplayString((p=c.value)==null?void 0:p.size),1)])])),a.createElementVNode("div",FQ,[t.showEdit&&i.value?(a.openBlock(),a.createBlock(Wt,{key:0,icon:"Pencil",size:"icon",variant:"secondary",disabled:t.disabled,class:"h-8 w-8 shadow transition-transform duration-200 group-hover:scale-[1.02]",onClick:h[0]||(h[0]=k=>o("edit"))},null,8,["disabled"])):(a.openBlock(),a.createElementBlock("div",$Q)),t.showRemove?(a.openBlock(),a.createBlock(Wt,{key:2,icon:"Trash2",size:"icon",variant:"destructive",disabled:t.disabled,class:"h-8 w-8 shadow transition-transform duration-200 group-hover:scale-[1.02]",onClick:h[1]||(h[1]=k=>o("remove"))},null,8,["disabled"])):a.createCommentVNode("",!0)]),a.createElementVNode("div",jQ,[a.createElementVNode("div",RQ,[a.createElementVNode("div",NQ,[h[2]||(h[2]=a.createElementVNode("span",{class:"w-14 shrink-0 text-muted-foreground"},"Nama",-1)),a.createElementVNode("span",UQ,a.toDisplayString((y=c.value)==null?void 0:y.name),1)]),a.createElementVNode("div",WQ,[h[3]||(h[3]=a.createElementVNode("span",{class:"w-14 shrink-0 text-muted-foreground"},"Ukuran",-1)),a.createElementVNode("span",GQ,a.toDisplayString((f=c.value)==null?void 0:f.size),1)]),a.createElementVNode("div",YQ,[h[4]||(h[4]=a.createElementVNode("span",{class:"w-14 shrink-0 text-muted-foreground"},"Tipe",-1)),a.createElementVNode("span",KQ,a.toDisplayString((m=c.value)==null?void 0:m.type),1)])])])],4)]}),_:1})]),_:1},8,["class"])):a.createCommentVNode("",!0)}}),XQ={class:"space-y-3"},ZQ={key:1,class:"flex items-center justify-center p-6 border rounded-lg bg-muted/30"},JQ={name:"DCodeFileField"},Xq=a.defineComponent({...JQ,props:{modelValue:{default:null},label:{default:"Upload File"},hint:{},disabled:{type:Boolean,default:!1},previewHeight:{default:190},previewWidth:{default:void 0},allowedTypes:{default:null},accept:{default:void 0},minSizeMb:{default:null},maxSizeMb:{default:5},endpoint:{},uploadFn:{}},emits:["update:modelValue","error","uploaded"],setup(t,{emit:e}){const n=t,o=e,r=a.computed({get:()=>n.modelValue,set:M=>o("update:modelValue",M)}),i=a.ref(null),s=a.ref(null);function c(M){s.value=M,o("error",M)}function d(){s.value=null}const h=a.computed(()=>{const M=(n.allowedTypes??"").trim();return M?M.split(/[,\s;]+/g).map(L=>L.trim().toLowerCase()).filter(Boolean).map(L=>L.includes("/")||L.startsWith(".")?L:`.${L}`):[]});function u(M){const v=M.lastIndexOf(".");return v>=0?M.slice(v).toLowerCase():""}const p=a.computed(()=>{if(h.value.length){const M=h.value.filter(L=>L.startsWith("."));return[...h.value.filter(L=>L.includes("/")),...M].join(",")}return n.accept}),y=a.computed(()=>h.value.length?h.value.join(", "):n.accept||"Semua File");function f(M){if(h.value.length){const v=(M.type||"").toLowerCase(),L=u(M.name);return h.value.some(I=>I.includes("/")?v===I:I.startsWith(".")?L===I:L===`.${I}`)}if(n.accept){if(n.accept==="*/*")return!0;const v=n.accept.split(",").map(_=>_.trim().toLowerCase()),L=(M.type||"").toLowerCase(),I=u(M.name);return v.some(_=>{if(_.endsWith("/*")){const A=_.slice(0,-2);return L.startsWith(A)}return _.startsWith(".")?I===_:L===_})}return!0}function m(M){return M*1024*1024}async function k(M){return M?f(M)?n.minSizeMb!=null&&M.size<m(n.minSizeMb)?`Ukuran file terlalu kecil. Minimal ${n.minSizeMb}MB`:n.maxSizeMb!=null&&M.size>m(n.maxSizeMb)?`Ukuran file terlalu besar. Maks ${n.maxSizeMb}MB`:null:`File Type not allowed. Allowed: ${y.value}`:"File tidak valid"}const{DCodeApi:g}=nt(),b=F_(),w=a.ref(!1);async function S(M){var v;if(n.uploadFn){try{w.value=!0;const L=await n.uploadFn(M);r.value=M,o("uploaded",L)}catch(L){console.error("Upload Error",L),b.error("Upload Failed",(L==null?void 0:L.message)||"Unknown error"),c((L==null?void 0:L.message)||"Upload Failed")}finally{w.value=!1}return}if(!((v=n.endpoint)!=null&&v.apiUrl)){r.value=M;return}if(typeof g!="function"){c("useApi() must expose DCodeApi()");return}try{w.value=!0;const L=new FormData;L.append("doc",M);const I=(n.endpoint.apiMethod||"POST").toUpperCase(),_=n.endpoint.apiUrl,A=await g("","",L,{_url:_,_method:I,withCredentials:!0,transformRequest:[(q,O)=>(O&&(delete O["Content-Type"],delete O["content-type"]),q)]}),V=(A==null?void 0:A.data)??A;r.value=M,o("uploaded",V)}catch(L){console.error("Upload Error",L),b.error("Upload Failed",(L==null?void 0:L.message)||"Unknown error"),c((L==null?void 0:L.message)||"Upload Failed")}finally{w.value=!1}}async function C(M){var L;if(n.disabled)return;d();const v=await k(M);if(v){c(v);return}i.value=M,n.uploadFn||(L=n.endpoint)!=null&&L.apiUrl?await S(M):r.value=M}function x(){d(),r.value=null,i.value=null}return a.watch(()=>n.modelValue,M=>{M&&!i.value&&(i.value=M),M||(i.value=null)},{immediate:!0}),(M,v)=>(a.openBlock(),a.createElementBlock("div",XQ,[r.value?w.value?(a.openBlock(),a.createElementBlock("div",ZQ,[...v[1]||(v[1]=[a.createElementVNode("span",{class:"text-sm text-muted-foreground animate-pulse"},"Uploading...",-1)])])):(a.openBlock(),a.createBlock(DB,{key:2,file:r.value,title:t.label,description:t.hint,disabled:t.disabled,"show-edit":!1,"show-replace":!1,"show-remove":!0,"force-file-icon":!0,"preview-height":t.previewHeight,"preview-width":t.previewWidth,onRemove:x},null,8,["file","title","description","disabled","preview-height","preview-width"])):(a.openBlock(),a.createBlock(AS,{key:0,label:t.label,hint:t.hint,accept:p.value,maxSizeMb:t.maxSizeMb,disabled:t.disabled||w.value,onPicked:C,error:s.value,onError:v[0]||(v[0]=L=>c(L))},null,8,["label","hint","accept","maxSizeMb","disabled","error"]))]))}}),QQ=["for"],eee={key:0,class:"ml-1 text-destructive"},tee={class:"relative w-full"},aee={key:0,class:"absolute inset-y-0 left-3 flex items-center text-muted-foreground"},nee=["id","readonly","disabled","placeholder"],oee={key:1,class:"absolute inset-y-0 right-3 flex items-center"},ree={key:2,class:"absolute z-50 mt-1 w-full rounded-xl border bg-white dark:bg-neutral-900 shadow-lg"},iee={key:0,class:"flex items-center justify-center py-10 text-muted-foreground gap-2"},see={key:1,class:"text-sm text-muted-foreground text-center"},lee=["onClick","title"],cee={class:"flex flex-col items-center justify-between gap-2 py-1 min-h-[72px]"},dee={class:"flex items-center justify-center flex-1"},hee={class:"text-[10px] leading-tight text-muted-foreground truncate w-full text-center block flex-shrink-0"},uee={key:3,class:"pt-2 text-[11px] text-muted-foreground text-center"},Zq=a.defineComponent({name:"DCodeIconDropdown",__name:"DCodeIconDropdown",props:{modelValue:{},label:{},placeholder:{default:"Pilih icon…"},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},columns:{default:4},maxHeight:{default:"335px"},iconSize:{default:20},pageSize:{default:120}},emits:["update:modelValue","clear"],setup(t,{emit:e}){const n=t,o=e,r=La,i=a.ref(null),s=a.ref(null),c=Math.random().toString(36).slice(2,7),d=a.computed(()=>`dcode-icon-dropdown-${n.label||"icon-dropdown"}-${c}`),h=a.ref(!1),u=a.computed(()=>(n.modelValue??"").trim()||""),p=a.ref(""),y=a.ref(!1),f=a.ref(!1),m=a.ref(!1),k=a.shallowRef([]),g=a.ref(n.pageSize),b=new Set(["default","createLucideIcon","LucideIcon","Icon","icons","toKebabCase","camelCase","children","IconNode"]),w=async()=>{if(f.value||m.value)return;m.value=!0,await new Promise(D=>setTimeout(D,0));const P=Object.keys(r).filter(D=>!b.has(D)).filter(D=>/^[A-Z]/.test(D)).filter(D=>typeof r[D]=="function"||typeof r[D]=="object"&&r[D]).sort((D,G)=>D.localeCompare(G));k.value=P,f.value=!0,m.value=!1},S=a.computed(()=>!f.value||!u.value||!k.value.includes(u.value)?null:r[u.value]),C=a.ref(u.value),x=a.computed(()=>!!u.value&&!h.value),M=a.computed(()=>{if(!f.value)return[];const P=(p.value??"").trim().toLowerCase();return P?k.value.filter(D=>D.toLowerCase().includes(P)):k.value}),v=a.computed(()=>M.value.slice(0,g.value)),L=a.computed(()=>{const P=n.columns;return P<=2?"grid-cols-2":P===3?"grid-cols-3":P===4?"grid-cols-4":P===5?"grid-cols-5":P>=8?"grid-cols-8":"grid-cols-6"});a.computed(()=>n.clearable?"!pr-10":"!pr-3"),a.computed(()=>S.value&&!h.value?"!pl-12":"!pl-3");const I=async()=>{var P;await a.nextTick(),(P=s.value)==null||P.focus()},_=async P=>{if(n.disabled)return;const D=P!==!1;if(y.value){y.value=!1;return}h.value=!0,await w(),D&&(p.value="",C.value=""),g.value=n.pageSize,await I()},A=()=>{h.value=!1,p.value="",C.value=u.value,g.value=n.pageSize},V=async()=>{n.disabled||(h.value?A():await _())};let q=null;const O=async P=>{if(n.disabled)return;o("update:modelValue",null),h.value||await _(!1),q&&clearTimeout(q);const D=C.value;q=setTimeout(()=>{p.value=D},300)},N=P=>{n.disabled||(o("update:modelValue",P),A(),queueMicrotask(()=>{var D;return(D=s.value)==null?void 0:D.blur()}))},T=()=>{n.disabled||(o("update:modelValue",null),o("clear"),y.value=!0,A(),queueMicrotask(()=>{var P;return(P=s.value)==null?void 0:P.focus()}))},H=P=>{if(P.key==="Escape"){P.preventDefault(),A();return}if(P.key==="Enter"&&h.value){const D=M.value[0];D&&(P.preventDefault(),N(D))}},j=P=>{if(!h.value)return;const D=P.target;i.value&&!i.value.contains(D)&&A()},Z=P=>{const D=P.target;D.scrollTop+D.clientHeight>=D.scrollHeight-24&&g.value<M.value.length&&(g.value=Math.min(g.value+n.pageSize,M.value.length))};return a.onMounted(()=>{document.addEventListener("mousedown",j),queueMicrotask(()=>{var P;s.value=((P=i.value)==null?void 0:P.querySelector("input"))??null}),u.value&&w()}),a.onBeforeUnmount(()=>{document.removeEventListener("mousedown",j),q&&clearTimeout(q)}),a.watch(u,P=>{h.value||(C.value=P)}),a.watch(()=>p.value,()=>{g.value=n.pageSize}),(P,D)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"rootEl",ref:i,class:"w-full"},[n.label?(a.openBlock(),a.createElementBlock("label",{key:0,for:d.value,class:"text-sm font-medium mb-1 block"},[a.createTextVNode(a.toDisplayString(n.label)+" ",1),n.required?(a.openBlock(),a.createElementBlock("span",eee,"*")):a.createCommentVNode("",!0)],8,QQ)):a.createCommentVNode("",!0),a.createElementVNode("div",tee,[S.value&&!h.value?(a.openBlock(),a.createElementBlock("div",aee,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(S.value),{size:18}))])):a.createCommentVNode("",!0),a.withDirectives(a.createElementVNode("input",{id:d.value,"onUpdate:modelValue":D[0]||(D[0]=G=>C.value=G),readonly:x.value,disabled:n.disabled,placeholder:n.placeholder,class:a.normalizeClass(["w-full h-10 rounded-lg border bg-white dark:bg-neutral-900 text-foreground dark:text-gray-300 border-gray-300 dark:border-gray-700",[S.value&&!h.value?"pl-12":"pl-5",x.value?"cursor-pointer select-none":""]]),onClick:_,onFocus:_,onInput:O,onKeydown:H},null,42,nee),[[a.vModelText,C.value]]),n.clearable?(a.openBlock(),a.createElementBlock("div",oee,[u.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"p-0 m-0 bg-transparent border-0 text-muted-foreground hover:text-foreground transition",onMousedown:D[1]||(D[1]=a.withModifiers(()=>{},["prevent"])),onClick:T,title:"Clear"},[a.createVNode(a.unref(Mt),{class:"h-4 w-4"})],32)):(a.openBlock(),a.createElementBlock("button",{key:1,type:"button",class:"p-0 m-0 bg-transparent border-0 text-muted-foreground hover:text-foreground transition-transform",onMousedown:D[2]||(D[2]=a.withModifiers(()=>{},["prevent"])),onClick:V,title:"Open"},[a.createVNode(a.unref(Bt),{class:"h-4 w-4"})],32))])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",ree,[a.createElementVNode("div",{class:"p-2 overflow-auto",style:a.normalizeStyle({maxHeight:n.maxHeight}),onScroll:Z},[m.value?(a.openBlock(),a.createElementBlock("div",iee,[a.createVNode(a.unref(bt),{class:"h-4 w-4 animate-spin"}),D[3]||(D[3]=a.createElementVNode("span",{class:"text-sm"},"Loading icons…",-1))])):f.value&&M.value.length===0?(a.openBlock(),a.createElementBlock("div",see," Icon tidak ditemukan ")):(a.openBlock(),a.createElementBlock("div",{key:2,class:a.normalizeClass(["grid gap-2",L.value])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(v.value,G=>(a.openBlock(),a.createElementBlock("button",{key:G,type:"button",class:a.normalizeClass(["group rounded-lg border p-2 hover:bg-muted/40 transition",u.value===G?"ring-1 ring-primary":""]),onClick:ne=>N(G),title:G},[a.createElementVNode("div",cee,[a.createElementVNode("div",dee,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(r)[G]),{size:n.iconSize,class:"shrink-0"},null,8,["size"]))]),a.createElementVNode("span",hee,a.toDisplayString(G),1)])],10,lee))),128))],2)),f.value&&M.value.length>0?(a.openBlock(),a.createElementBlock("div",uee," Showing "+a.toDisplayString(v.value.length)+" / "+a.toDisplayString(M.value.length),1)):a.createCommentVNode("",!0)],36)])):a.createCommentVNode("",!0)])],512))}}),qB=a.defineComponent({name:"DCodeLabel",inheritAttrs:!1,__name:"DCodeLabel",props:{label:{},text:{},textSize:{},textType:{},icon:{},iconClass:{}},setup(t){const e=a.useAttrs(),n=t,o=a.computed(()=>n.icon&&La[n.icon]||null),r=a.computed(()=>n.textSize?`text-${n.textSize}`:"text-xs"),i={xs:"w-3 h-3",sm:"w-3.5 h-3.5",base:"w-4 h-4",lg:"w-5 h-5",xl:"w-5 h-5","2xl":"w-6 h-6","3xl":"w-7 h-7","4xl":"w-8 h-8","5xl":"w-10 h-10","6xl":"w-12 h-12"},s=a.computed(()=>i[n.textSize??"xs"]??"w-3 h-3"),c=a.computed(()=>n.textType==="BOLD"?"font-bold":n.textType==="ITALIC"?"italic font-normal":"font-normal"),d=a.computed(()=>{const u=`${r.value} ${c.value} text-slate-600 ml-1 inline-flex items-center gap-1`,p=e.class??"";return[u,p].filter(Boolean).join(" ")}),h=a.computed(()=>{const{class:u,...p}=e;return p});return(u,p)=>(a.openBlock(),a.createElementBlock("span",a.mergeProps({class:d.value},h.value),[o.value?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.value),{key:0,class:a.normalizeClass(["shrink-0",s.value,t.iconClass])},null,8,["class"])):a.createCommentVNode("",!0),a.createTextVNode(" "+a.toDisplayString(t.label||t.text),1)],16))}}),pee=["aria-busy"],yee={key:0,class:"h-4 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse"},fee={key:0,class:"ml-1 text-destructive"},mee={class:"min-w-0 flex-1 text-left"},kee={key:0,class:"flex flex-wrap gap-1.5"},gee={class:"max-w-[220px] truncate"},bee=["onClick"],Mee={key:1,class:"text-muted-foreground truncate"},xee={class:"flex items-center gap-2 shrink-0"},wee={key:0,class:"p-2 border-b border-gray-200 dark:border-gray-800"},vee={key:0,class:"h-full flex items-center justify-center px-3 text-sm text-muted-foreground"},Cee=["disabled","onClick"],Lee={class:"truncate"},See={key:0,class:"text-primary-600 dark:text-primary-400"},Iee={key:1,class:"h-full flex items-center justify-center text-sm text-muted-foreground"},_ee={key:0},Bee={key:1},Aee={key:1,class:"text-xs text-destructive"},Vee={name:"DCodeMultiSelect"},Jq=a.defineComponent({...Vee,name:"DCodeMultiSelect",inheritAttrs:!1,props:{modelValue:{},items:{default:()=>[]},endpoint:{default:void 0},fetchItems:{},autoFetchOnOpen:{type:Boolean,default:!0},autoFetchOnMount:{type:Boolean,default:!1},refreshOnOpen:{type:Boolean,default:!1},label:{default:""},placeholder:{default:"Pilih data…"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:"Cari…"},visible:{type:Boolean,default:!0},skeleton:{type:Boolean,default:!1},maxChips:{default:2},maxSelected:{default:3},itemTitle:{type:[String,Function],default:"name"},itemValue:{type:[String,Function],default:"id"},returnObject:{type:Boolean,default:!1},virtual:{type:Boolean,default:!0},itemHeight:{default:40},maxRows:{default:5},overscan:{default:6},error:{default:null},required:{type:Boolean,default:!1}},emits:["update:modelValue","clear","max"],setup(t,{emit:e}){const n=a.useAttrs(),o=e,r=t,i=a.computed(()=>(r.label||n.label)??void 0),s=a.computed(()=>r.visible??!0),c=Math.random().toString(36).slice(2,7),d=a.computed(()=>`app-multiselect-${n.id||i.value||"field"}-${c}`),h=a.computed(()=>{if(r.required)return!0;const Y=n.required,Q=n["aria-required"];return Y===""||Y===!0||Y==="true"||(Q==="true"||Q===!0)}),u=a.computed(()=>!!r.error);function p(Y){return Y?typeof r.itemTitle=="function"?r.itemTitle(Y)??"":String((Y==null?void 0:Y[r.itemTitle])??""):""}function y(Y){return Y?typeof r.itemValue=="function"?r.itemValue(Y):Y==null?void 0:Y[r.itemValue]:null}function f(Y,Q){return y(Y)??Q}const m=a.computed(()=>Array.isArray(r.modelValue)?r.modelValue:[]),k=a.computed(()=>{var Y;return!!((Y=r.endpoint)!=null&&Y.apiUrl)||!!r.fetchItems}),g=a.ref([]),b=a.ref(!1),w=a.ref(!1),S=a.computed(()=>{var Q;const Y=(Q=r.endpoint)==null?void 0:Q.apiOptions;if(Y)return typeof Y=="function"?Y():Y}),C=a.computed(()=>{var me,He;const Y=((me=r.endpoint)==null?void 0:me.apiUrl)??"",Q=(((He=r.endpoint)==null?void 0:He.apiMethod)??"GET").toUpperCase(),ae=JSON.stringify(S.value??null);return`${Q} ${Y} :: ${ae}`}),x=a.computed(()=>k.value?g.value:r.items||[]);async function M(){var Y;if(k.value&&!(!((Y=r.endpoint)!=null&&Y.apiUrl)&&!r.fetchItems)&&!b.value){b.value=!0;try{let Q;if(r.fetchItems){const ae=await r.fetchItems(),me=(ae==null?void 0:ae.data)??ae;Q=(me==null?void 0:me.data)??me}else{const{DCodeApi:ae}=nt();if(typeof ae!="function"){console.error("[DCodeMultiSelectChips] useApi() must expose DCodeApi()");return}const me={page:1,perPage:100,...S.value||{}},He=await ae("","",me,{_url:r.endpoint.apiUrl,_method:(r.endpoint.apiMethod||"GET").toUpperCase()}),It=(He==null?void 0:He.data)??He;Q=(It==null?void 0:It.data)??It}g.value=Array.isArray(Q)?Q:[],w.value=!0}catch(Q){console.error("[DCodeMultiSelectChips][fetchOptions] ERROR:",Q),g.value=[]}finally{b.value=!1}}}a.watch(()=>C.value,()=>{g.value=[],w.value=!1}),a.onMounted(()=>{r.autoFetchOnMount&&k.value&&M()});const v=a.computed(()=>{const Y=m.value;if(r.returnObject)return Y;const Q=new Map;for(const ae of x.value)Q.set(y(ae),ae);return Y.map(ae=>Q.get(ae)??{[r.itemValue]:ae,[r.itemTitle]:String(ae)})}),L=a.computed(()=>r.maxChips===null?v.value:v.value.slice(0,r.maxChips));function I(Y){const Q=m.value;if(r.returnObject){const ae=y(Y);return Q.some(me=>y(me)===ae)}return Q.includes(y(Y))}const _=a.computed(()=>{if(r.maxSelected===null||r.maxSelected===void 0)return null;const Y=Number(r.maxSelected);return Number.isFinite(Y)&&Y>0?Y:null}),A=a.computed(()=>{const Y=_.value;return Y===null?!1:m.value.length>=Y});function V(Y){return!I(Y)&&A.value}const q=a.computed(()=>{const Y=m.value,Q=new Set;if(r.returnObject)for(const ae of Y)Q.add(y(ae));else for(const ae of Y)Q.add(ae);return Q}),O=a.computed(()=>{const Y=q.value;return(x.value||[]).filter(Q=>!Y.has(y(Q)))}),N=a.computed(()=>x.value.length===0?!1:O.value.length===0),T=a.ref(null),H=a.ref(null),j=a.ref(null),Z=a.ref(!1),P=a.ref(""),D=a.ref(0),G=a.ref(0),{floatingStyles:ne}=gS(T,H,{whileElementsMounted:yS,placement:"bottom-start",middleware:[fS(8),jl(),mS({padding:8}),kS({apply({rects:Y,elements:Q}){Object.assign(Q.floating.style,{width:`${Y.reference.width}px`,"--floating-width":`${Y.reference.width}px`})}})]}),te=a.computed(()=>ne.value),ce=a.computed(()=>{const Y=Number(r.maxRows);return Number.isFinite(Y)&&Y>0?Y:5});async function pe(){r.disabled||(Z.value=!0,G.value=0,requestAnimationFrame(()=>{j.value&&(j.value.scrollTop=0),D.value=0}),k.value&&r.autoFetchOnOpen&&(r.refreshOnOpen||!w.value)&&!b.value&&await M())}function le(){Z.value=!1}function Le(){Z.value?le():pe()}function ue(Y){var ae,me;if(!Z.value)return;const Q=Y.target;(ae=T.value)!=null&&ae.contains(Q)||(me=H.value)!=null&&me.contains(Q)||le()}a.onMounted(()=>document.addEventListener("mousedown",ue)),a.onBeforeUnmount(()=>document.removeEventListener("mousedown",ue));function U(Y){if(r.disabled)return;if(V(Y)){o("max");return}const Q=[...m.value];if(r.returnObject){const ae=y(Y);if(Q.some(He=>y(He)===ae))return;o("update:modelValue",[...Q,Y])}else{const ae=y(Y);if(Q.includes(ae))return;o("update:modelValue",[...Q,ae])}P.value="",G.value=0,requestAnimationFrame(()=>{j.value&&(j.value.scrollTop=0),D.value=0})}function z(Y){if(r.disabled)return;const Q=[...m.value];if(r.returnObject){const ae=y(Y);o("update:modelValue",Q.filter(me=>y(me)!==ae))}else{const ae=y(Y);o("update:modelValue",Q.filter(me=>me!==ae))}}function W(){r.disabled||(o("update:modelValue",[]),o("clear"),le())}const ee=a.computed(()=>{const Y=P.value.trim().toLowerCase(),Q=O.value;return Y?Q.filter(ae=>p(ae).toLowerCase().includes(Y)):Q}),fe=a.computed(()=>ee.value.length);a.watch(Z,Y=>{Y||(P.value="")});const Te=a.computed(()=>{if(N.value)return r.itemHeight;const Y=fe.value;return(Y<=0?1:Math.min(Y,ce.value))*r.itemHeight}),xe=a.computed(()=>r.virtual?fe.value*r.itemHeight:0),Qe=a.computed(()=>r.virtual?Math.ceil(Te.value/r.itemHeight)+r.overscan:fe.value),it=a.computed(()=>{if(!r.virtual)return 0;const Y=Math.floor(D.value/r.itemHeight)-Math.floor(r.overscan/2);return Math.max(0,Y)}),St=a.computed(()=>r.virtual?Math.min(fe.value,it.value+Qe.value):fe.value),M1=a.computed(()=>r.virtual?it.value*r.itemHeight:0),ht=a.computed(()=>{const Y=ee.value;return r.virtual?Y.slice(it.value,St.value):Y});function ka(Y){const Q=Y.target;D.value=Q.scrollTop}function x1(Y){return Y===G.value}function $(Y){const Q=j.value;if(!Q||!r.virtual)return;const ae=Y*r.itemHeight,me=ae+r.itemHeight,He=Q.scrollTop,It=Q.scrollTop+Q.clientHeight;ae<He?Q.scrollTop=ae:me>It&&(Q.scrollTop=me-Q.clientHeight)}function J(Y){const Q=Math.max(0,fe.value-1);G.value=Math.min(Q,Math.max(0,G.value+Y)),$(G.value)}function de(){const Y=ee.value[G.value];Y&&U(Y)}const Ve=a.computed(()=>r.clearable&&!r.disabled&&v.value.length>0),Oe=a.computed(()=>u.value?"border-red-500 ring-[0.5px] ring-red-500":Z.value?"border-gray-700 ring-[0.5px] ring-gray-700 dark:border-gray-300 dark:ring-gray-300":"");return(Y,Q)=>a.withDirectives((a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["flex flex-col gap-1 w-full",a.unref(n).class]),"aria-busy":r.skeleton},[r.skeleton?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[i.value?(a.openBlock(),a.createElementBlock("div",yee)):a.createCommentVNode("",!0),Q[3]||(Q[3]=a.createElementVNode("div",{class:"h-10 w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse"},null,-1))],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[i.value?(a.openBlock(),a.createBlock(a.unref(Xs),{key:0,for:d.value,class:"text-sm font-medium"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(i.value)+" ",1),h.value?(a.openBlock(),a.createElementBlock("span",fee,"*")):a.createCommentVNode("",!0)]),_:1},8,["for"])):a.createCommentVNode("",!0),a.createElementVNode("div",{ref_key:"referenceEl",ref:T,class:"relative"},[a.createVNode(a.unref(Se),{id:d.value,type:"button",variant:"outline",class:a.normalizeClass(["w-full justify-between h-auto min-h-10 px-3 py-2 transition border",["bg-white dark:bg-neutral-900 border-gray-300 dark:border-gray-700 text-foreground dark:text-gray-300",Oe.value]]),disabled:r.disabled,onClick:Le},{default:a.withCtx(()=>[a.createElementVNode("div",mee,[v.value.length?(a.openBlock(),a.createElementBlock("div",kee,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(L.value,(ae,me)=>(a.openBlock(),a.createBlock(a.unref(Oa),{key:`chip-${f(ae,me)}`,variant:"secondary",class:"gap-1"},{default:a.withCtx(()=>[a.createElementVNode("span",gee,a.toDisplayString(p(ae)),1),r.disabled?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:0,class:"ml-1 opacity-70 hover:opacity-100",onClick:a.withModifiers(He=>z(ae),["stop"]),"aria-label":"Remove"}," ✕ ",8,bee))]),_:2},1024))),128)),r.maxChips!==null&&v.value.length>r.maxChips?(a.openBlock(),a.createBlock(a.unref(Oa),{key:0,variant:"secondary"},{default:a.withCtx(()=>[a.createTextVNode(" +"+a.toDisplayString(v.value.length-(r.maxChips??0)),1)]),_:1})):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",Mee,a.toDisplayString(r.placeholder),1))]),a.createElementVNode("div",xee,[Ve.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"text-muted-foreground hover:text-foreground",onClick:a.withModifiers(W,["stop"]),"aria-label":"Clear"}," ✕ ")):a.createCommentVNode("",!0),a.createVNode(a.unref(Bt),{class:"h-4 w-4 text-muted-foreground"})])]),_:1},8,["id","disabled","class"]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[Z.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"floatingEl",ref:H,class:"-mt-1 z-[9999] w-[var(--floating-width)] rounded-lg border shadow-lg overflow-hidden bg-white dark:bg-neutral-900 border-gray-200 dark:border-gray-800",style:a.normalizeStyle(te.value)},[r.searchable&&!N.value?(a.openBlock(),a.createElementBlock("div",wee,[a.createVNode(a.unref(_S),{modelValue:P.value,"onUpdate:modelValue":Q[0]||(Q[0]=ae=>P.value=ae),placeholder:r.searchPlaceholder,class:"h-10",onKeydown:[Q[1]||(Q[1]=a.withKeys(a.withModifiers(ae=>J(1),["prevent"]),["down"])),Q[2]||(Q[2]=a.withKeys(a.withModifiers(ae=>J(-1),["prevent"]),["up"])),a.withKeys(a.withModifiers(de,["prevent"]),["enter"]),a.withKeys(a.withModifiers(le,["prevent"]),["esc"])]},null,8,["modelValue","placeholder","onKeydown"])])):a.createCommentVNode("",!0),a.createElementVNode("div",{ref_key:"listEl",ref:j,class:"relative overflow-auto",style:a.normalizeStyle({height:Te.value+"px"}),onScroll:ka},[N.value?(a.openBlock(),a.createElementBlock("div",vee," All items have been selected ")):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[r.virtual?(a.openBlock(),a.createElementBlock("div",{key:0,style:a.normalizeStyle({height:xe.value+"px"})},null,4)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(r.virtual?"absolute left-0 top-0 w-full":""),style:a.normalizeStyle(r.virtual?{transform:`translateY(${M1.value}px)`}:void 0)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ht.value,(ae,me)=>(a.openBlock(),a.createElementBlock("button",{key:String(f(ae,it.value+me)),type:"button",class:a.normalizeClass(["w-full px-3 text-left text-sm flex items-center justify-between gap-3",[V(ae)?"cursor-not-allowed opacity-50":"hover:bg-neutral-50 dark:hover:bg-neutral-800/60",x1(it.value+me)?"bg-neutral-50 dark:bg-neutral-800/60":"",I(ae)?"font-semibold":"font-normal"]]),style:a.normalizeStyle({height:r.itemHeight+"px"}),disabled:r.disabled||V(ae),onClick:He=>U(ae)},[a.createElementVNode("span",Lee,a.toDisplayString(p(ae)),1),I(ae)?(a.openBlock(),a.createElementBlock("span",See,"✓")):a.createCommentVNode("",!0)],14,Cee))),128))],6),fe.value===0?(a.openBlock(),a.createElementBlock("div",Iee,[b.value?(a.openBlock(),a.createElementBlock("span",_ee,"Loading data…")):(a.openBlock(),a.createElementBlock("span",Bee,"Tidak ada data"))])):a.createCommentVNode("",!0)],64))],36)],4)):a.createCommentVNode("",!0)]))],512),u.value?(a.openBlock(),a.createElementBlock("p",Aee,a.toDisplayString(r.error),1)):a.createCommentVNode("",!0)],64))],10,pee)),[[a.vShow,s.value]])}}),Pee={class:"w-full"},Dee={key:0,class:"flex items-center justify-between mb-2"},qee={key:0,class:"text-sm font-medium text-gray-700"},zee={key:1,class:"text-sm text-gray-600"},Eee={name:"DCodeProgress"},Qq=a.defineComponent({...Eee,name:"DCodeProgress",inheritAttrs:!1,props:{modelValue:{default:0},max:{default:100},label:{default:""},showValue:{type:Boolean,default:!1},color:{default:"blue"},size:{default:"md"},striped:{type:Boolean,default:!1},animated:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=a.computed(()=>Math.min(n.modelValue/n.max*100,100)),r=a.computed(()=>["w-full rounded-full overflow-hidden",{sm:"h-1",md:"h-2",lg:"h-3"}[n.size],"bg-gray-200"].join(" ")),i=a.computed(()=>{const c={blue:"bg-blue-500",green:"bg-green-500",red:"bg-red-500",yellow:"bg-yellow-500",purple:"bg-purple-500",gray:"bg-gray-500"},d=["h-full transition-all duration-300 ease-out",c[n.color]||c.blue];return n.striped&&d.push("bg-gradient-to-r from-transparent via-white/20 to-transparent"),n.animated&&d.push("animate-pulse"),d.join(" ")}),s=a.computed(()=>`${Math.round(o.value)}%`);return(c,d)=>(a.openBlock(),a.createElementBlock("div",Pee,[t.label||t.showValue?(a.openBlock(),a.createElementBlock("div",Dee,[t.label?(a.openBlock(),a.createElementBlock("span",qee,a.toDisplayString(t.label),1)):a.createCommentVNode("",!0),t.showValue?(a.openBlock(),a.createElementBlock("span",zee,a.toDisplayString(s.value),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(r.value)},[a.createElementVNode("div",{class:a.normalizeClass(i.value),style:a.normalizeStyle({width:`${o.value}%`})},null,6)],2)]))}}),Tee={key:0,class:"fixed top-0 left-0 right-0 z-[10000] h-[3px]"},ez=Wl(a.defineComponent({name:"DCodeProgressBar",__name:"DCodeProgressBar",props:{isApiLoading:{type:Boolean,default:!1},apiProgress:{default:0}},setup(t){return(e,n)=>(a.openBlock(),a.createBlock(a.Transition,{name:"fade"},{default:a.withCtx(()=>[t.isApiLoading?(a.openBlock(),a.createElementBlock("div",Tee,[a.createElementVNode("div",{class:"h-full bg-primary-600 shadow-[0_0_15px_rgba(37,99,235,0.8)] transition-all duration-300 ease-out",style:a.normalizeStyle({width:`${t.apiProgress}%`})},null,4)])):a.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-5a7c62fb"]]),Oee={class:"flex flex-col"},Hee={key:0,class:"flex items-center gap-2 text-sm text-gray-500 mb-2"},Fee={class:"relative flex-shrink-0 mt-0.5"},$ee=["id","name","value","checked","disabled","required","onChange"],jee=["onClick"],Ree=["for"],Nee={key:0,class:"ml-1 text-red-500"},Uee={key:1,class:"flex items-center gap-1 text-sm text-red-500 mt-1"},tz=a.defineComponent({name:"DCodeRadio",inheritAttrs:!1,__name:"DCodeRadio",props:{modelValue:{default:void 0},label:{default:"name"},options:{default:()=>[]},apiUrl:{default:""},apiMethod:{default:"GET"},dataPath:{default:""},layout:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{default:null},size:{default:"md"},color:{default:"blue"},model:{default:"id"},id:{default:""}},emits:["update:modelValue","change"],setup(t,{emit:e}){a.useAttrs();const{apiUrl:n}=nt(),o=e,r=t,i=a.ref([]),s=a.ref(!1),c=a.ref(null),d=async()=>{if(r.apiUrl){s.value=!0,c.value=null;try{const S={page:1,perPage:100},C=await n(r.apiUrl,r.apiMethod,S);let x=C;r.dataPath?x=r.dataPath.split(".").reduce((v,L)=>v&&v[L]!=="undefined"?v[L]:void 0,C):typeof C=="object"&&!Array.isArray(C)&&C.data&&(x=C.data),Array.isArray(x)?i.value=x:(console.warn("DCodeRadio: Format response tidak terdeteksi sebagai Array. Gunakan prop 'dataPath'."),c.value="Format respons data tidak valid. Array tidak ditemukan.")}catch(S){console.error("DCodeRadio fetch error:",S),c.value="Gagal memuat data dari endpoint."}finally{s.value=!1}}};a.onMounted(()=>{r.apiUrl&&d()});const h=a.computed(()=>r.options&&r.options.length>0?r.options:i.value.length>0?i.value:r.model!==void 0||r.label?[{[r.model]:r.model,[r.label]:r.label}]:[]),u=S=>typeof S=="object"?S[r.model]:S,p=S=>typeof S=="object"?S[r.label]:String(S),y=a.computed(()=>r.model||`radio-group-${Math.random().toString(36).substr(2,9)}`),f=a.computed(()=>!!r.error||!!c.value),m=a.computed(()=>r.error||c.value),k=S=>S==null?r.modelValue===S:String(r.modelValue)===String(S),g=a.computed(()=>({sm:{radio:"w-3 h-3",label:"text-sm",container:"gap-2"},md:{radio:"w-4 h-4",label:"text-base",container:"gap-2"},lg:{radio:"w-5 h-5",label:"text-lg",container:"gap-3"}})[r.size]),b=(S,C)=>{C.target.checked&&(o("update:modelValue",S),o("change",S))},w=S=>{!r.disabled&&!k(S)&&(o("update:modelValue",S),o("change",S))};return(S,C)=>(a.openBlock(),a.createElementBlock("div",Oee,[s.value?(a.openBlock(),a.createElementBlock("div",Hee,[a.createVNode(a.unref(bt),{class:"w-4 h-4 animate-spin"}),C[0]||(C[0]=a.createTextVNode(" Sedang memuat opsi... ",-1))])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["flex",t.layout?"flex-row flex-wrap gap-4":"flex-col gap-3"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(h.value,(x,M)=>(a.openBlock(),a.createElementBlock("div",{key:M,class:a.normalizeClass(["flex items-start",g.value.container,t.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"])},[a.createElementVNode("div",Fee,[a.createElementVNode("input",{id:t.id?`${t.id}-${M}`:`${y.value}-${M}`,name:y.value,type:"radio",value:u(x),checked:k(u(x)),disabled:t.disabled,required:t.required&&M===0,onChange:v=>b(u(x),v),class:"w-5 h-5 text-blue-600 focus:ring-blue-500 border-gray-300"},null,40,$ee)]),a.createElementVNode("div",{class:"flex-1 min-w-0",onClick:v=>w(u(x))},[a.createElementVNode("label",{for:t.id?`${t.id}-${M}`:`${y.value}-${M}`,class:a.normalizeClass([g.value.label,"font-medium cursor-pointer select-none text-gray-900",t.disabled?"cursor-not-allowed opacity-50":""])},[a.createTextVNode(a.toDisplayString(p(x))+" ",1),t.required&&h.value.length===1&&t.label?(a.openBlock(),a.createElementBlock("span",Nee,"*")):a.createCommentVNode("",!0)],10,Ree)],8,jee)],2))),128))],2),f.value&&m.value?(a.openBlock(),a.createElementBlock("div",Uee,[a.createVNode(a.unref(At),{class:"w-4 h-4 flex-shrink-0"}),a.createTextVNode(" "+a.toDisplayString(m.value),1)])):a.createCommentVNode("",!0)]))}}),Wee={class:"flex flex-col"},Gee={key:0,class:"flex items-center gap-2 text-sm text-gray-500 mb-2"},Yee=["onClick"],Kee=["id","name","value","checked","disabled","required","onChange"],Xee={key:1,class:"w-6 h-6",fill:"currentColor",viewBox:"0 0 20 20"},Zee=["for"],Jee={key:0,class:"ml-1 text-red-500"},Qee={key:1,class:"flex items-center gap-1 text-sm text-red-500 mt-2"},az=a.defineComponent({name:"DCodeRadioCustom",inheritAttrs:!1,__name:"DCodeRadioCustom",props:{modelValue:{default:void 0},icon:{},label:{default:"name"},options:{default:()=>[]},apiUrl:{default:""},apiMethod:{default:"GET"},dataPath:{default:""},layout:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},error:{default:null},size:{default:"md"},color:{default:"blue"},model:{default:"id"},id:{default:""}},emits:["update:modelValue","change"],setup(t,{emit:e}){a.useAttrs();const{apiUrl:n}=nt(),o=e,r=t,i=a.ref(r.modelValue??void 0);a.watch(()=>r.modelValue,M=>{i.value=M},{immediate:!0});const s=a.ref([]),c=a.ref(!1),d=a.ref(null),h=async()=>{if(r.apiUrl){c.value=!0,d.value=null;try{const M={page:1,perPage:100},v=await n(r.apiUrl,r.apiMethod,M);let L=v;r.dataPath?L=r.dataPath.split(".").reduce((_,A)=>_&&_[A]!=="undefined"?_[A]:void 0,v):typeof v=="object"&&!Array.isArray(v)&&v.data&&(L=v.data),Array.isArray(L)?s.value=L:(console.warn("DCodeRadioCustom: Format response tidak terdeteksi sebagai Array. Gunakan prop 'dataPath'."),d.value="Format respons data tidak valid. Array tidak ditemukan.")}catch(M){console.error("DCodeRadioCustom fetch error:",M),d.value="Gagal memuat data dari endpoint."}finally{c.value=!1}}};a.onMounted(()=>{r.apiUrl&&h()});const u=a.computed(()=>r.options&&r.options.length>0?r.options:s.value.length>0?s.value:r.model!==void 0||r.label?[{[r.model]:r.model,[r.label]:r.label}]:[]),p=M=>typeof M=="object"?M[r.model]:M,y=M=>typeof M=="object"?M[r.label]:String(M),f=Math.random().toString(36).slice(2,7),m=a.computed(()=>r.id?`radio-custom-${r.id}`:`radio-custom-${r.model}-${f}`),k=a.computed(()=>!!r.error||!!d.value),g=a.computed(()=>r.error||d.value),b=M=>{const v=i.value;return M==null?v===M:String(v)===String(M)},w=a.computed(()=>({sm:{radio:"w-3 h-3",label:"text-sm",container:"gap-2"},md:{radio:"w-4 h-4",label:"text-base",container:"gap-2"},lg:{radio:"w-5 h-5",label:"text-lg",container:"gap-3"}})[r.size]),S=a.computed(()=>r.icon&&La[r.icon]||null),C=(M,v)=>{v.target.checked&&(i.value=M,o("update:modelValue",M),o("change",M))},x=M=>{r.disabled||b(M)||(i.value=M,o("update:modelValue",M),o("change",M))};return(M,v)=>(a.openBlock(),a.createElementBlock("div",Wee,[c.value?(a.openBlock(),a.createElementBlock("div",Gee,[a.createVNode(a.unref(bt),{class:"w-4 h-4 animate-spin"}),v[0]||(v[0]=a.createTextVNode(" Sedang memuat opsi... ",-1))])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:a.normalizeClass(["grid",t.layout?"grid-cols-2 sm:grid-cols-3":"grid-cols-1","gap-3"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(u.value,(L,I)=>(a.openBlock(),a.createElementBlock("div",{key:I,class:a.normalizeClass(["relative flex flex-col items-center justify-center gap-2 p-4 rounded-xl border-2 transition-all duration-200",b(p(L))?"border-blue-500 bg-blue-50 shadow-md shadow-blue-100":"border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm",t.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]),onClick:_=>!t.disabled&&x(p(L))},[a.createElementVNode("input",{id:t.id?`${t.id}-${I}`:`${m.value}-${I}`,name:m.value,type:"radio",value:p(L),checked:b(p(L)),disabled:t.disabled,required:t.required&&I===0,onChange:_=>C(p(L),_),class:"sr-only",tabindex:"-1"},null,40,Kee),a.createElementVNode("div",{class:a.normalizeClass(["w-10 h-10 rounded-full flex items-center justify-center transition-all duration-200",b(p(L))?"bg-blue-100 text-blue-600":"bg-gray-100 text-gray-400"])},[S.value?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(S.value),{key:0,class:"w-6 h-6"})):(a.openBlock(),a.createElementBlock("svg",Xee,[...v[1]||(v[1]=[a.createElementVNode("circle",{cx:"10",cy:"10",r:"6"},null,-1)])]))],2),a.createElementVNode("label",{for:t.id?`${t.id}-${I}`:`${m.value}-${I}`,class:a.normalizeClass([w.value.label,"font-medium text-center leading-tight select-none transition-colors duration-200",b(p(L))?"text-blue-700":"text-gray-700",t.disabled?"cursor-not-allowed":"cursor-pointer"])},[a.createTextVNode(a.toDisplayString(y(L))+" ",1),t.required&&u.value.length===1&&t.label?(a.openBlock(),a.createElementBlock("span",Jee,"*")):a.createCommentVNode("",!0)],10,Zee)],10,Yee))),128))],2),k.value&&g.value?(a.openBlock(),a.createElementBlock("div",Qee,[a.createVNode(a.unref(At),{class:"w-4 h-4 flex-shrink-0"}),a.createTextVNode(" "+a.toDisplayString(g.value),1)])):a.createCommentVNode("",!0)]))}}),ete={key:0,class:"ml-1 text-destructive"},tte={class:"relative w-full"},ate={key:0,class:"mb-2 flex items-center justify-between"},nte={class:"text-sm text-muted-foreground"},ote={class:"text-sm font-medium text-foreground"},rte={class:"text-sm text-muted-foreground"},ite={class:"relative"},ste=["id","value","min","max","step","disabled","placeholder"],lte={key:1,class:"relative mt-2"},cte={class:"text-xs text-muted-foreground mt-1"},dte={key:1,class:"flex items-center gap-1 text-sm text-destructive"},hte={name:"DCodeSlider"},nz=a.defineComponent({...hte,name:"DCodeSlider",inheritAttrs:!1,props:{modelValue:{default:0},min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1},label:{default:""},placeholder:{default:""},required:{type:Boolean,default:!1},error:{default:null},showValue:{type:Boolean,default:!0},valuePrefix:{default:""},valueSuffix:{default:""},marks:{default:()=>[]},color:{default:"blue"},size:{default:"md"}},emits:["update:modelValue","change","input"],setup(t,{emit:e}){const n=a.useAttrs(),o=e,r=t,i=a.ref(),s=a.ref(!1),c=a.computed(()=>!!r.error),d=a.computed(()=>`slider-${Math.random().toString(36).substr(2,9)}`),h=a.computed(()=>(r.label||n.label)??void 0),u=a.computed(()=>!0),p=a.computed(()=>{const x={sm:"h-2",md:"h-2.5",lg:"h-3"},M={blue:"accent-blue-500",green:"accent-green-500",red:"accent-red-500",yellow:"accent-yellow-500",purple:"accent-purple-500",gray:"accent-gray-500"};return["w-full appearance-none bg-gray-200 rounded-lg outline-none transition-all cursor-pointer","disabled:opacity-50 disabled:cursor-not-allowed",x[r.size],M[r.color]||M.blue,c.value?"accent-red-500":"",n.class].filter(Boolean).join(" ")}),y=a.computed(()=>["appearance-none bg-white border-2 border-current rounded-full cursor-pointer transition-all","hover:scale-110 focus:scale-110","shadow-md hover:shadow-lg focus:shadow-lg","focus:outline-none focus:ring-2 focus:ring-offset-2",{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r.size],r.color==="blue"?"focus:ring-blue-500":r.color==="green"?"focus:ring-green-500":r.color==="red"?"focus:ring-red-500":r.color==="yellow"?"focus:ring-yellow-500":r.color==="purple"?"focus:ring-purple-500":"focus:ring-gray-500"].join(" ")),f=a.computed(()=>`${r.valuePrefix}${r.modelValue}${r.valueSuffix}`),m=a.computed(()=>{const x=r.max-r.min;return(r.modelValue-r.min)/x*100}),k=x=>{const M=x.target,v=parseFloat(M.value);o("update:modelValue",v),o("input",v)},g=x=>{const M=x.target,v=parseFloat(M.value);o("change",v)},b=()=>{s.value=!0},w=()=>{s.value=!1},S=x=>{const M=r.max-r.min;return(x-r.min)/M*100},C=a.computed(()=>{const x={sm:16,md:20,lg:24};return`
8567
8567
  input[type="range"]::-webkit-slider-thumb {
8568
8568
  ${y.value}
8569
8569
  width: ${x[r.size]}px;