text: /*! 
   * MetroUI :: ChartJS - Create different charts in js
   * https://pimenov.com.ua
   *
   * Copyright 2021 Serhii Pimenov
   * Released under the MIT license
   */
  !function(){"use strict";var t={width:1,lineType:"solid",color:"#e3e3e3",radius:0},i={style:"normal",family:"Helvetica, sans-serif",size:12,weight:"normal",lineHeight:1.2,color:"#000"},e=Object.assign({},i,{weight:"bold"}),s={top:0,bottom:0,left:0,right:0},a={dpi:1,height:200,width:"100%",padding:{top:40,left:40,right:40,bottom:40},margin:s,background:"#fff",color:"#000",font:i,border:t,title:{display:!0,align:"center",
  // start, center, end
  rtl:!1,color:"#000",text:"",font:Object.assign({},i,{weight:"bold",size:24}),padding:{top:10,bottom:10,left:10,right:10}},legend:{rtl:!1,margin:s,padding:{top:0,bottom:0,left:0,right:0},font:e,border:t,dash:[],background:"#fff",vertical:!1,position:"top-left"},tooltip:{width:"auto",background:"#fff",color:"#000",font:i,border:t,padding:{top:10,bottom:10,left:10,right:10},shadow:{shiftX:2,shiftY:2,blur:4,stretch:0,color:"rgba(0,0,0,.5)"}},boundaries:!1,colors:Object.values({aliceBlue:"#f0f8ff",antiqueWhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedAlmond:"#ffebcd",blue:"#0000ff",blueViolet:"#8a2be2",brown:"#a52a2a",burlyWood:"#deb887",cadetBlue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerBlue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkBlue:"#00008b",darkCyan:"#008b8b",darkGoldenRod:"#b8860b",darkGray:"#a9a9a9",darkGreen:"#006400",darkKhaki:"#bdb76b",darkMagenta:"#8b008b",darkOliveGreen:"#556b2f",darkOrange:"#ff8c00",darkOrchid:"#9932cc",darkRed:"#8b0000",darkSalmon:"#e9967a",darkSeaGreen:"#8fbc8f",darkSlateBlue:"#483d8b",darkSlateGray:"#2f4f4f",darkTurquoise:"#00ced1",darkViolet:"#9400d3",deepPink:"#ff1493",deepSkyBlue:"#00bfff",dimGray:"#696969",dodgerBlue:"#1e90ff",fireBrick:"#b22222",floralWhite:"#fffaf0",forestGreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#DCDCDC",ghostWhite:"#F8F8FF",gold:"#ffd700",goldenRod:"#daa520",gray:"#808080",green:"#008000",greenYellow:"#adff2f",honeyDew:"#f0fff0",hotPink:"#ff69b4",indianRed:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderBlush:"#fff0f5",lawnGreen:"#7cfc00",lemonChiffon:"#fffacd",lightBlue:"#add8e6",lightCoral:"#f08080",lightCyan:"#e0ffff",lightGoldenRodYellow:"#fafad2",lightGray:"#d3d3d3",lightGreen:"#90ee90",lightPink:"#ffb6c1",lightSalmon:"#ffa07a",lightSeaGreen:"#20b2aa",lightSkyBlue:"#87cefa",lightSlateGray:"#778899",lightSteelBlue:"#b0c4de",lightYellow:"#ffffe0",lime:"#00ff00",limeGreen:"#32dc32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumAquaMarine:"#66cdaa",mediumBlue:"#0000cd",mediumOrchid:"#ba55d3",mediumPurple:"#9370db",mediumSeaGreen:"#3cb371",mediumSlateBlue:"#7b68ee",mediumSpringGreen:"#00fa9a",mediumTurquoise:"#48d1cc",mediumVioletRed:"#c71585",midnightBlue:"#191970",mintCream:"#f5fffa",mistyRose:"#ffe4e1",moccasin:"#ffe4b5",navajoWhite:"#ffdead",navy:"#000080",oldLace:"#fdd5e6",olive:"#808000",oliveDrab:"#6b8e23",orange:"#ffa500",orangeRed:"#ff4500",orchid:"#da70d6",paleGoldenRod:"#eee8aa",paleGreen:"#98fb98",paleTurquoise:"#afeeee",paleVioletRed:"#db7093",papayaWhip:"#ffefd5",peachPuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderBlue:"#b0e0e6",purple:"#800080",rebeccaPurple:"#663399",red:"#ff0000",rosyBrown:"#bc8f8f",royalBlue:"#4169e1",saddleBrown:"#8b4513",salmon:"#fa8072",sandyBrown:"#f4a460",seaGreen:"#2e8b57",seaShell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",slyBlue:"#87ceeb",slateBlue:"#6a5acd",slateGray:"#708090",snow:"#fffafa",springGreen:"#00ff7f",steelBlue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whiteSmoke:"#f5f5f5",yellow:"#ffff00",yellowGreen:"#9acd32"}),animate:!1,onDrawLabelY:null,onDrawLabelX:null,onTooltipShow:null,onHover:null,onLeave:null};
  /**
       * Simple object check.
       * @param item
       * @returns {boolean}
       */
  function o(t){return t&&"object"==typeof t&&!Array.isArray(t)}
  /**
       * Deep merge two objects.
       * @param target
       * @param ...sources
       */function r(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;s<i;s++)e[s-1]=arguments[s];if(!e.length)return t;var a=e.shift();if(o(t)&&o(a))for(var n in a)o(a[n])?(t[n]||Object.assign(t,{[n]:{}}),r(t[n],a[n])):Object.assign(t,{[n]:a[n]});return r(t,...e)}var n=function(t,i,e){var[s,a]=e,{align:o="left",baseLine:r="middle",color:n="#000",stroke:h="#000",font:l,angle:d=0,translate:c=[0,0]}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{style:f="normal",weight:p="normal",size:u=12,lineHeight:g=1,family:m="sans-serif"}=l,v=0,b=0;"number"==typeof c?v=b=c:Array.isArray(c)&&([v,b]=c),t.save(),t.beginPath(),t.textAlign=o,t.fillStyle=n,t.strokeStyle=h,t.font="".concat(f," ").concat(p," ").concat(u,"px/").concat(g," ").concat(m),t.translate(v,b),t.rotate(d*Math.PI/180),t.textBaseline=r;var x=i.toString().split("\n");x.map(((i,e)=>{t.fillText(i,s,a+a*e*g)})),t.closePath(),t.restore()},h=(t,i,e)=>{var s,{font:a=null}=e,o=0;if(t.save(),a){var{style:r="normal",weight:n="normal",size:h=12,lineHeight:l=1.2,family:d="sans-serif"}=a;t.font="".concat(r," ").concat(n," ").concat(h,"px/").concat(l," ").concat(d)}for(var c=0;c<i.length;c++)(s=t.measureText(i[c][0]).width)>o&&(o=s);return t.restore(),o},l=function(t,i){var[e,s,a]=i,{color:o="#000",fill:r="#fff",size:n=1,dash:h=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(h),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.rect(e-a,s-a,2*a,2*a),t.fill(),t.stroke(),t.restore(),t.closePath()},d=t=>"number"==typeof t?{top:t,left:t,right:t,bottom:t}:t,c=t=>"number"==typeof t?{top:t,left:t,right:t,bottom:t}:t,f={legend(){return!0===this.options.legend.vertical?this.legendVertical():this.legendHorizontal()},legendHorizontal(){var t=this.options,i=d(t.padding),e=t.legend,s=this.ctx,a=this.legendItems;if(e&&o(e)&&a&&Array.isArray(a)&&a.length){var r,f,p,u,g=d(e.padding),m=c(e.margin),v=0;u=e.font.size/2,r=e.font.size*e.font.lineHeight,p=i.top+this.viewHeight+(e.font.size+g.top+m.top),f=i.left+g.left+m.left;for(var b=0;b<a.length;b++){var[x,y,w]=a[b];v+=h(s,[[e.showValue?"".concat(x," - ").concat(w):x]],{font:e.font})+2*u+5}v=(this.viewWidth-v)/2;for(var Y=0;Y<a.length;Y++){var[X,k,z]=a[Y],W=h(s,[[e.showValue?"".concat(X," - ").concat(z):X]],{font:e.font});f+W>this.viewWidth&&(f=i.left+g.left+m.left,p+=r),l(s,[v+f,p,u],{color:k,fill:k}),n(s,e.showValue?"".concat(X," - ").concat(z):X,[v+f+u+5,p+u/2],{color:e.font.color,stroke:e.font.color,font:t.font}),f+=u+W+20}}},legendVertical(){var t,i,e,s,a,r,f=this.options,p=f.legend,u=null!==(t=p.font)&&void 0!==t?t:f.font,g=u.size/2,m=this.ctx,v=this.legendItems,b=d(p.padding),x=c(p.margin),y=d(f.padding);if(p&&o(p)&&v&&Array.isArray(v)&&v.length){i=u.size*u.lineHeight,a=h(m,v,{font:u})+b.left+b.right+3*g+5,r=v.length*i+b.top+b.bottom+5,"top-left"===p.position?(e=b.left+x.left,s=b.top+x.top):"top-right"===p.position?(e=this.dpiWidth-a-x.right-y.right,s=b.top+x.top):"bottom-left"===p.position?(e=b.left+x.left,s=this.dpiHeight-r-b.bottom-x.bottom):(e=this.dpiWidth-a-x.right-b.right,s=this.dpiHeight-r-b.bottom-x.bottom),function(t,i){var[e,s,a,o]=i,{color:r="#fff",borderColor:n="#000",dash:h=[],size:l=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.save(),t.beginPath(),t.strokeStyle=n,t.fillStyle=r,t.setLineDash(h),t.lineWidth=l,t.clearRect(e,s,a,o),t.fillRect(e,s,a,o),l&&t.strokeRect(e,s,a,o),t.closePath(),t.restore()}(m,[e,s,a,r],{color:p.background,dash:p.dash,size:p.border.width,borderColor:p.border.color}),e+=g+5+b.left,s+=g+5+b.top;for(var w=0;w<v.length;w++){var[Y,X,k]=v[w];l(m,[e,s,g],{color:X,fill:X}),n(m,p.showValue?"".concat(Y," - ").concat(k):Y,[e+g+5,s+1],{color:p.font.color,stroke:p.font.color,font:p.font}),s+=i}}}},p={showTooltip(t,i){var e=this.options;if(this.tooltip&&(this.tooltip.remove(),this.tooltip=null),e.tooltip){var{x:s,y:a}=this.proxy.mouse,o=document.createElement("div"),r=e.onTooltipShow,n=e.tooltip.font,h=e.tooltip.shadow,l=e.tooltip.border,c=d(e.tooltip.padding);o.style.position="fixed",o.style.border="".concat(l.width,"px ").concat(l.lineType," ").concat(l.color),o.style.borderRadius="".concat(l.radius),o.style.padding="".concat(c.top,"px ").concat(c.right,"px ").concat(c.bottom,"px ").concat(c.left,"px"),o.style.background="".concat(e.tooltip.background),o.style.font="".concat(n.style," ").concat(n.weight," ").concat(n.size,"px/").concat(n.lineHeight," ").concat(n.family),o.style.boxShadow="".concat(h.shiftX,"px ").concat(h.shiftY,"px ").concat(h.blur,"px ").concat(h.color),o.innerHTML=r&&"function"==typeof r?r.apply(null,[t,i]):t,document.querySelector("body").appendChild(o),o.style.top="".concat(a-o.clientHeight-15,"px"),o.style.left="".concat(s-o.clientWidth/2-5,"px"),this.tooltip=o}}};class u{constructor(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unknown";if(this.el=document.querySelector(t),!this.el)throw new Error("You must define a selector for chart wrapper element!");this.options=r({},a,e),this.data=i,this.canvas=null,this.ctx=null,this.raf=null,this.tooltip=null,this.legendItems=[],this.chartType=s,this.rect=this.el.getBoundingClientRect(),this.canvasRect=null,this.static=!1;var o=this;this.proxy=new Proxy({},{set(){var t=Reflect.set(...arguments);return o.raf=requestAnimationFrame(o.draw.bind(o)),t}}),this.options.border&&(this.el.style.border="".concat(this.options.border.width,"px ").concat(this.options.border.lineType," ").concat(this.options.border.color)),this.calcInternalValues(),this.createCanvas(),this.addEvents()}createCanvas(){this.canvas=document.createElement("canvas"),this.el.innerHTML="",this.el.style.overflow="hidden",this.el.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d"),this.setCanvasSize(),this.canvasRect=this.canvas.getBoundingClientRect()}setCanvasSize(){var t=this.options;this.canvas.style.height=this.height+"px",this.canvas.style.width=this.width+"px",this.canvas.width=t.dpi*this.width,this.canvas.height=t.dpi*this.height}calcInternalValues(){var t,i,e=this.options,s=d(e.padding),a=this.el.getBoundingClientRect(),{width:o,height:r}=a;t=e.width.toString().includes("%")?o/100*parseInt(e.width):+e.width,i=e.height.toString().includes("%")?r/100*parseInt(e.height):+e.height,this.width=t,this.height=i,this.dpi=e.dpi,this.dpiHeight=this.dpi*i,this.dpiWidth=this.dpi*t,this.viewHeight=this.dpiHeight-(s.top+s.bottom),this.viewWidth=this.dpiWidth-(s.left+s.right),this.center=[this.dpiWidth/2,this.dpiHeight/2],this.radius=Math.min(this.viewHeight,this.viewWidth)/2}title(){var t,i=this.options.title,e=this.ctx;if(i&&i.text){var{text:s,align:a,color:o,font:r}=i;switch(a){case"center":t=this.dpiWidth/2;break;case"right":t=this.dpiWidth-5;break;default:t=5}n(e,s,[t,r.size+5],{align:i.align,color:i.color,stroke:i.color,font:i.font})}}draw(){this.clear(),this.title()}clear(){this.ctx.clearRect(0,0,this.dpiWidth,this.dpiHeight)}setData(t,i){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];void 0!==i?this.data[i].data=t:this.data=t,e&&this.resize()}setBoundaries(t){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=["minX","minY","minZ","maxX","maxY","maxZ","min","max"];for(var s in t)e.includes(s)&&(this[s]=t[s],this.options.boundaries[s]=t[s]);i&&this.draw()}mouseMove(t){var i=this.options.onHover,{clientX:e,clientY:s}=t.changedTouches?t.touches[0]:t;"function"==typeof i&&i.apply(null,[e,s]),this.proxy.mouse={x:e,y:s},t.cancelable&&t.preventDefault()}mouseLeave(){var t=this.options.onLeave;"function"==typeof t&&t.apply(null,[]),this.proxy.mouse=null}resize(){this.calcInternalValues(),this.setCanvasSize(),this.rect=this.el.getBoundingClientRect(),this.canvasRect=this.canvas.getBoundingClientRect(),this.draw()}addEvents(){var t=this.canvas;t.addEventListener("mousemove",this.mouseMove.bind(this)),t.addEventListener("touchmove",this.mouseMove.bind(this),{passive:!1}),t.addEventListener("mouseleave",this.mouseLeave.bind(this)),window.addEventListener("resize",this.resize.bind(this))}destroy(){var t=this.canvas;cancelAnimationFrame(this.raf),t.removeEventListener("mousemove",this.mouseMove.bind(this)),t.removeEventListener("mouseleave",this.mouseLeave.bind(this)),window.removeEventListener("resize",this.resize.bind(this))}}function g(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function m(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),e.push.apply(e,s)}return e}function v(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?m(Object(e),!0).forEach((function(i){g(t,i,e[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):m(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}))}return t}Object.assign(u.prototype,f),Object.assign(u.prototype,p);var b={color:"#000",font:e,count:5,fixed:!1,opposite:!1,angle:0,align:"center",shift:{x:0,y:0},skip:0,showLine:!0,showLabel:!0,showMin:!0},x={line:{color:"#e3e3e3",size:1,dash:[],shortLineSize:5},label:b},y={x:x,y:v(v({},x),{},{label:v(v({},b),{},{align:"right"})})},w={size:1,color:"#bbb",dash:[5,3]},Y={color:"#7d7d7d",size:1,dash:[],factorX:5,factorY:5,outside:0},X={x:Y,y:Y},k={axis:y,cross:w,showDots:!0,accuracy:2,arrows:X},z=function(){var t,i,e,s,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"x";if("number"==typeof o)s=o;else switch(o.toString().toLowerCase()){case"y":s=1;break;case"z":s=2;break;default:s=0}for(var r of a)e=r[s],(isNaN(t)||t>e)&&(t=e),(isNaN(i)||i<e)&&(i=e);return[t,i]},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[Math.min.apply(null,t),Math.max.apply(null,t)]},N=function(t,i){var[e,s,a]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.arc(e,s,a,0,2*Math.PI),t.fill(),t.stroke(),t.restore(),t.closePath()},S=function(t,i){var[e,s,a]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.moveTo(e,s-a),t.lineTo(e+a,s+a),t.lineTo(e-a,s+a),t.lineTo(e,s-a),t.fill(),t.stroke(),t.restore(),t.closePath()},M=function(t,i){var[e,s,a]=i,{color:o="#000",fill:r="#fff",size:n=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=n,t.strokeStyle=o,t.fillStyle=r,t.moveTo(e,s-a),t.lineTo(e+a,s),t.lineTo(e,s+a),t.lineTo(e-a,s),t.lineTo(e,s-a),t.fill(),t.stroke(),t.restore(),t.closePath()},D={cross(){var t=this.options,i=t.cross,e=d(t.padding),s=this.ctx,a=this.canvas.getBoundingClientRect();if(t.cross&&(!t.cross||this.proxy.mouse)){var{x:o,y:r}=this.proxy.mouse;o-=a.left,r-=a.top,o-e.left+1<0||o>this.viewWidth+e.left+1||r-e.top+1<0||r>this.viewHeight+e.top+1||(s.beginPath(),s.setLineDash(t.cross.dash),s.lineWidth=i.size,s.strokeStyle=i.color,// vertical line
  s.moveTo(o,e.top),s.lineTo(o,this.viewHeight+e.top),// Horizontal line
  s.moveTo(e.left,r),s.lineTo(this.viewWidth+e.left,r),s.arc(o,r,10,0,2*Math.PI),s.stroke(),s.closePath())}}},P=function(t,i){var[e,s,a,o]=i,{color:r="#000",size:n=1,dash:h=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(h),t.lineWidth=n,t.strokeStyle=r,t.moveTo(e,s),t.lineTo(a,o),t.stroke(),t.restore(),t.closePath()},T={axisX(){var t,i,e=this.ctx,s=this.options,a=d(s.padding);if(s.axis.x){var o,r,h,l,c,f,p=s.axis.x,u=p.label,g=p.line,m=p.arrow,v=null!==(t=u&&u.font)&&void 0!==t?t:s.font,b=u.count?(this.maxX-this.minX)/u.count:0,x=null!==(i=g.shortLineSize)&&void 0!==i?i:0;l=a.left,c=a.top,f=a.top+this.viewHeight+v.size+5,r=this.minX,h=0;for(var y=0;y<=u.count;y++){var w,Y,X;
  // short line
  if(o="number"==typeof u.fixed?r.toFixed(u.fixed):r,"function"==typeof s.onDrawLabelX&&(o=s.onDrawLabelX.apply(null,[r])),u.showLine&&P(e,[l,c,l,c+this.viewHeight],{color:g.color,size:g.size,dash:g.dash}),u.skip&&h!==u.skip)h++;else if(h=1,u.showLabel&&(y||u.showMin))P(e,[l,this.viewHeight+a.top-x,l,this.viewHeight+a.top+x],{color:m&&m.color?m.color:g.color}),// label
  n(e,o.toString(),[0,0],{color:null!==(w=u.color)&&void 0!==w?w:s.color,align:u.align,font:v,translate:[l+(null!==(Y=u.shift.x)&&void 0!==Y?Y:0),f+(null!==(X=u.shift.y)&&void 0!==X?X:0)],angle:u.angle});r+=b,l=a.left+(r-this.minX)*this.ratioX}}},axisY(){var t,i,e=this.ctx,s=this.options,a=d(s.padding);if(s.axis.y){var o,r,h,l,c,f,p,u=s.axis.y,g=u.label,m=u.line,v=u.arrow,b=null!==(t=g&&g.font)&&void 0!==t?t:s.font,x=g.count?(this.maxY-this.minY)/g.count:0,y=null!==(i=m.shortLineSize)&&void 0!==i?i:0;l=a.left,f=a.left,c=this.viewHeight+a.top,r=this.minY,h=0,g.opposite?(f+=this.viewWidth+10+y,p=a.left+this.viewWidth,g.align="left"):(f-=10,p=l-y);for(var w=0;w<g.count+1;w++){var Y,X,k;
  // short line
  if(o="number"==typeof g.fixed?r.toFixed(g.fixed):r,"function"==typeof s.onDrawLabelY&&(o=s.onDrawLabelY.apply(null,[r])),g.showLine&&P(e,[l,c,this.viewWidth+a.left,c],{color:m.color,size:m.size,dash:m.dash}),0!==w&&g.skip&&h!==g.skip)h++;else if(h=1,g.showLabel&&(w||g.showMin))P(e,[p,c,p+2*y,c],{color:v&&v.color?v.color:m.color}),n(e,o.toString(),[0,0],{color:null!==(Y=g&&g.color)&&void 0!==Y?Y:s.color,align:g.align,font:b,translate:[f+(null!==(X=g.shift.x)&&void 0!==X?X:0),c+1+(null!==(k=g.shift.y)&&void 0!==k?k:0)],angle:g.angle});r+=x,c=a.top+this.viewHeight-(r-this.minY)*this.ratioY}}},axisXY(){if(this.options.axis)return this.axisX(),this.axisY(),this}},L={addPoint(t,i){var e,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=this.options;if(!this.data){this.data=[];for(var o=0;o<t+1;o++)this.data[o]=[]}e=this.data[t],s&&e.length&&(a.graphSize?e.length>=a.graphSize&&(e=e.slice(1)):e=e.slice(1)),this.data[t]=e,this.data[t].push(i)}},H=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",size:s=1,dash:a=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(a),t.lineWidth=s,t.strokeStyle=e,i.map((i=>{var[e,s]=i;t.lineTo(e,s)})),t.stroke(),t.restore(),t.closePath()},O={arrowX(){var t=this.options,i=this.ctx,e=d(t.padding);if(t.arrows.x){var s=t.arrows.x,a=e.left,o=this.viewHeight+e.top;!function(t,i){var[e,s,a,o,r,n]=i,{color:h="#000",dash:l=[],size:d=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.strokeStyle=h,t.lineWidth=d,t.setLineDash(l),t.moveTo(e,s),t.lineTo(a,o),t.moveTo(a,o),t.lineTo(a-r,o-n),t.moveTo(a,o),t.lineTo(a-r,o+n),t.stroke(),t.closePath()}(i,[a,o,e.left+this.viewWidth+s.outside,o,s.factorX,s.factorY],{color:s.color,size:s.size,dash:s.dash})}},arrowY(){var t=this.options,i=this.ctx,e=d(t.padding);if(t.arrows.y){var s=t.arrows.y,a=e.left;!function(t,i){var[e,s,a,o,r,n]=i,{color:h="#000",dash:l=[],size:d=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.strokeStyle=h,t.lineWidth=d,t.setLineDash(l),t.moveTo(e,s),t.lineTo(a,o),t.moveTo(a,o),t.lineTo(a-r,o+n),t.moveTo(a,o),t.lineTo(a+r,o+n),t.stroke(),t.closePath()}(i,[a,this.viewHeight+e.top,a,e.top-s.outside,s.factorX,s.factorY],{color:s.color,size:s.size,dash:s.dash})}},arrows(){if(this.options.arrows)return this.arrowX(),this.arrowY(),this}};class C extends u{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r({},k,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"area"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[];var i=this.options.legend,e=this.options.areas,s=this.options.colors;if(i)for(var a=0;a<this.data.length;a++)this.legendItems.push([e[a].name,s[a]]);this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e of this.data)if(Array.isArray(e))for(var[s,a]of e)i.push([s,a]);var[o,r]=z(i,"x"),[n,h]=z(i,"y");this.minX=t.boundaries&&!isNaN(t.boundaries.minX)?t.boundaries.minX:o,this.maxX=t.boundaries&&!isNaN(t.boundaries.maxX)?t.boundaries.maxX:r,this.minY=t.boundaries&&!isNaN(t.boundaries.minY)?t.boundaries.minY:n,this.maxY=t.boundaries&&!isNaN(t.boundaries.maxY)?t.boundaries.maxY:h,isNaN(this.minX)&&(this.minX=0),isNaN(this.maxX)&&(this.maxX=100),isNaN(this.minY)&&(this.minX=0),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratioX=this.viewWidth/(this.maxX===this.minX?this.maxX:this.maxX-this.minX),this.ratioY=this.viewHeight/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}areas(){var t,i=this,e=this.options,s=d(e.padding),a=this.ctx;if(this.data&&this.data.length)for(var o=function(o){var r,n,h,d,c,f=e.areas[o],p=i.data[o],u=null!==(r=f.color)&&void 0!==r?r:e.colors[o],g=null!==(n=f.fill)&&void 0!==n?n:u;for(var[m,v]of((t=[]).push([s.left,i.viewHeight+s.top,0,0]),p)){var b=Math.floor((m-i.minX)*i.ratioX+s.left),x=Math.floor(i.viewHeight+s.top-(v-i.minY)*i.ratioY);t.push([b,x,m,v])}t.push([t[t.length-1][0],i.viewHeight+s.top,0,0]),function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",fill:s="#000",size:a=1,dash:o=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(o),t.lineWidth=a,t.strokeStyle=e,t.fillStyle=s,i.map((i=>{var[e,s]=i;t.lineTo(e,s)})),t.lineTo(i[0][0],i[0][1]),t.fill(),t.restore(),t.closePath()}(a,t,{color:u,fill:g,size:f.size});var y=f.dots?f.dots:{type:"dot"},w={color:null!==(h=y.color)&&void 0!==h?h:u,fill:null!==(d=y.fill)&&void 0!==d?d:u,radius:null!==(c=y.size)&&void 0!==c?c:4},Y=void 0;switch(y.type){case"square":Y=l;break;case"triangle":Y=S;break;case"diamond":Y=M;break;default:Y=N}f.dots&&!1!==e.showDots&&t.map((t=>{var[i,e]=t;Y(a,[i,e,w.radius],w)})),i.coords[f.name]={area:f,coords:t,drawPointFn:Y,opt:w},t.shift(),t.pop(),!1!==f.showLines&&H(a,t,{color:u,fill:g,size:f.size})},r=0;r<this.data.length;r++)o(r)}floatPoint(){var t=this.options,i=this.ctx,e=this.canvas.getBoundingClientRect(),s=!1;if(this.data&&this.data.length&&this.proxy.mouse){var{x:a,y:o}=this.proxy.mouse,r=a-e.left,n=o-e.top;for(var h in this.coords){var l=this.coords[h],d=l.drawPointFn,c=l.opt;for(var[f,p,u,g]of l.coords){var m=+(t.accuracy||c.radius),v=f-m,b=f+m,x=p-m,y=p+m;if(r>v&&r<b&&"default"!==t.hoverMode&&d(i,[f,p,c.radius],{color:c.color,fill:c.fill}),r>v&&r<b&&n>x&&n<y){"default"===t.hoverMode&&d(i,[f,p,2*c.radius],{color:c.color,fill:c.fill}),t.tooltip&&(this.showTooltip([u,g],l.graph),s=!0);break}}!s&&this.tooltip&&(this.tooltip.remove(),this.tooltip=null)}}}add(t,i,e){var[s,a]=i;this.addPoint(t,[s,a],e),this.minX=this.data[t][0][0],this.maxX=s,a<this.minY&&(this.minY=a),a>this.maxY&&(this.maxY=a),this.resize()}draw(){super.draw(),this.calcRatio(),this.axisXY(),this.arrows(),this.areas(),this.floatPoint(),this.cross(),this.legend()}}Object.assign(C.prototype,D),Object.assign(C.prototype,T),Object.assign(C.prototype,L),Object.assign(C.prototype,O);var A={groupDistance:0,barDistance:0,axis:v({},y),dataAxisX:!1,labels:{font:e,color:"#000"},arrows:X,onDrawLabel:null},R=function(t,i){var[e,s,a,o]=i,{color:r="#000",fill:n="#fff",size:h=1,dash:l=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(l),t.lineWidth=h,t.strokeStyle=r,t.fillStyle=n,t.rect(e,s,a,o),t.fill(),t.stroke(),t.restore(),t.closePath()};class j extends u{constructor(t,i,e){super(t,i,r({},A,e),"bar"),this.groups=0,this.barWidth=0,this.maxY=0,this.maxX=0,this.minY=0,this.minX=0,this.viewAxis=this.options.dataAxisX?this.viewHeight:this.viewWidth,this.legendItems=[];var s=this.options.legend;if(s&&s.titles&&s.titles.length)for(var a=0;a<s.titles.length;a++)this.legendItems.push([s.titles[a],this.options.colors[a]]);this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e in this.data){var s=this.data[e].data;i=[].concat(i,s)}for(var a in this.data)this.data[a].data.length,this.groups++;var[,o]=W(i);this.maxX=this.maxY=t.boundaries&&!isNaN(t.boundaries.max)?t.boundaries.max:o,isNaN(this.maxX)&&(this.maxX=100),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratio=(this.options.dataAxisX?this.viewWidth:this.viewHeight)/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}calcBarWidth(){var t=this.options,i=0;for(var e of this.data)i+=e.data.length;var s=(t.dataAxisX?this.viewHeight:this.viewWidth)-(this.data.length+1)*t.groupDistance-(i-this.data.length)*t.barDistance;// space between bars
  this.barWidth=s/i}bars(){var t,i,e,s,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=this.options,r=d(o.padding),h=this.ctx,l=this.canvas.getBoundingClientRect(),c=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-l.left,s=this.proxy.mouse.y-l.top),t=a?r.left:r.left+o.groupDistance,i=a?r.top+o.groupDistance:this.viewHeight+r.top;for(var f=0;f<this.data.length;f++){for(var p=this.data[f],u=p.data,g=o.labels.color,m=p.name,b=0,x=0;x<u.length;x++){var y=u[x]*this.ratio,w=1===u.length?o.colors[f]:o.colors[x],Y={color:w,fill:w},X=a?[t,i,t+y-r.right,this.barWidth]:[t,i-y,this.barWidth-1,y];R(h,X,Y);var k=a?[t,t+y]:[t,t+this.barWidth-1],z=a?[i,i+this.barWidth-1]:[i-y,i];e>k[0]&&e<k[1]&&s>z[0]&&s<z[1]&&(R(h,X,v(v({},Y),{},{fill:"rgba(255,255,255,.3)"})),o.tooltip&&(this.showTooltip([o.legend.titles?o.legend.titles[x]:m,u[x]],p),c=!0)),b+=this.barWidth+o.barDistance,a?i+=o.barDistance+this.barWidth:t+=o.barDistance+this.barWidth}a?i-=o.barDistance:t-=o.barDistance,b-=o.barDistance,"function"==typeof o.onDrawLabel&&(m=o.onDrawLabel.apply(null,m)),n(h,m,[0,0],{align:"center",color:g,stroke:g,font:o.font,angle:a?90:0,translate:a?[t-20,i-b/2]:[t-b/2,i+20]}),a?i+=o.groupDistance:t+=o.groupDistance}!c&&this.tooltip&&(this.tooltip.remove(),this.tooltip=null),this.static=!0}}draw(){var t=this.options;super.draw(),this.calcBarWidth(),this.calcRatio(),t.dataAxisX?this.axisX():this.axisY(),this.bars(t.dataAxisX),this.arrows(),this.legend()}}Object.assign(j.prototype,T),Object.assign(j.prototype,O);var B={axis:y,cross:w,arrows:X};class I extends u{constructor(t,i,e){if(super(t,i,r({},B,e),"bubble"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.minZ=0,this.maxZ=0,this.legendItems=[],this.options.legend)for(var s=0;s<this.data.length;s++)this.legendItems.push([this.data[s].name,this.options.colors[s]]);this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e in this.data){var s=this.data[e].data;Array.isArray(s)&&i.push(s)}var[a,o]=z(i,"x"),[r,n]=z(i,"y"),[h,l]=z(i,"z");this.minX=t.boundaries&&!isNaN(t.boundaries.minX)?t.boundaries.minX:a,this.maxX=t.boundaries&&!isNaN(t.boundaries.maxX)?t.boundaries.maxX:o,this.minY=t.boundaries&&!isNaN(t.boundaries.minY)?t.boundaries.minY:r,this.maxY=t.boundaries&&!isNaN(t.boundaries.maxY)?t.boundaries.maxY:n,this.minZ=t.boundaries&&!isNaN(t.boundaries.minZ)?t.boundaries.minZ:h,this.maxZ=t.boundaries&&!isNaN(t.boundaries.maxZ)?t.boundaries.maxZ:l,isNaN(this.minX)&&(this.minX=0),isNaN(this.maxX)&&(this.maxX=100),isNaN(this.minY)&&(this.minX=0),isNaN(this.maxY)&&(this.maxX=100),isNaN(this.minZ)&&(this.minX=0),isNaN(this.maxZ)&&(this.maxX=100)}calcRatio(){this.ratioX=this.viewWidth/(this.maxX===this.minX?this.maxX:this.maxX-this.minX),this.ratioY=this.viewHeight/(this.maxY===this.minY?this.maxY:this.maxY-this.minY),this.ratioZ=this.maxZ/(this.maxZ===this.minZ?this.maxZ:this.maxZ-this.minZ)}bubbles(){var t=this.options,i=d(t.padding),e=this.ctx;if(this.data&&this.data.length)for(var s=0;s<this.data.length;s++){var a=this.data[s],o=t.colors[s],[r,n,h]=a.data,l=Math.floor((r-this.minX)*this.ratioX+i.left),c=Math.floor(this.viewHeight+i.top-(n-this.minY)*this.ratioY),f=Math.floor(h*this.ratioZ);N(e,[l,c,f],{fill:o,color:o})}}floatPoint(){this.data&&this.data.length}add(t,i){var[e,s,a]=i,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.addPoint(t,[e,s,a],o),e<this.minX&&(this.minX=e),e>this.maxX&&(this.maxX=e),s<this.minY&&(this.minY=s),s>this.maxY&&(this.maxY=s),a<this.minZ&&(this.minZ=a),a>this.maxZ&&(this.maxZ=a),this.resize()}draw(){super.draw(),this.calcRatio(),this.axisXY(),this.arrows(),this.bubbles(),this.floatPoint(),this.cross(),this.legend()}}Object.assign(I.prototype,D),Object.assign(I.prototype,T),Object.assign(I.prototype,O);var Z={barWidth:10,axis:v(v({},y),{},{x:v(v({},y.x),{},{arrow:!1}),y:v(v({},y.y),{},{arrow:!1})}),cross:w,graphSize:40,bars:{stroke:"#fff"}};class G extends u{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r({},Z,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"histogram"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[];var i=this.options.legend,e=this.options.bars,s=this.options.colors;if(i)for(var a=0;a<this.data.length;a++)this.legendItems.push([e[a].name,s[a]]);this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e of this.data)if(Array.isArray(e))for(var[s,a,o]of e)i.push([s,a,o]);var[r,n]=z(i,0),[h,l]=z(i,1),[d,c]=z(i,2);this.minX=t.boundaries&&!isNaN(t.boundaries.minX)?t.boundaries.minX:Math.min(r,h),this.maxX=t.boundaries&&!isNaN(t.boundaries.maxX)?t.boundaries.maxX:Math.max(n,l),this.minY=t.boundaries&&!isNaN(t.boundaries.minY)?t.boundaries.minY:d,this.maxY=t.boundaries&&!isNaN(t.boundaries.maxY)?t.boundaries.maxY:c,isNaN(this.minX)&&(this.minX=0),isNaN(this.maxX)&&(this.maxX=100),isNaN(this.minY)&&(this.minX=0),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratioX=this.viewWidth/(this.maxX===this.minX?this.maxX:this.maxX-this.minX),this.ratioY=this.viewHeight/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}bars(){var t=this.options,i=d(t.padding),e=this.ctx;if(this.data&&this.data.length)for(var s=0;s<this.data.length;s++){var a=t.bars[s],o=this.data[s],r=a.color||t.colors[s]||"#000",n=a.stroke||"#fff";for(var[h,l,c]of o){var f=Math.floor((h-this.minX)*this.ratioX+i.left),p=Math.floor((l-this.minX)*this.ratioX+i.left)-f,u=(c-this.minY)*this.ratioY,g=Math.floor(this.viewHeight+i.top-u);R(e,[f,g,p,u],{fill:r,color:n})}}}add(t,i){var[e,s,a]=i,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.addPoint(t,[e,s,a],o),this.minX=this.data[t][0][0],this.maxX=s,a<this.minY&&(this.minY=a),a>this.maxY&&(this.maxY=a),this.resize()}draw(){super.draw(),this.calcRatio(),this.axisXY(),this.bars(),this.cross(),this.legend()}}Object.assign(G.prototype,D),Object.assign(G.prototype,T),Object.assign(G.prototype,L);var V={hoverMode:"default",
  // default, advanced
  axis:y,cross:w,showDots:!0,type:"line",
  // line, curve
  accuracy:2,lines:[],arrows:X},q="line",F="default";class E extends u{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r({},V,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),"line"),this.coords={},this.minX=0,this.maxX=0,this.minY=0,this.maxY=0,this.legendItems=[];var i=this.options.legend,e=this.options.lines,s=this.options.colors;if(i)for(var a=0;a<e.length;a++)this.legendItems.push([e[a].name,s[a]]);this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e of this.data)if(Array.isArray(e))for(var[s,a]of e)i.push([s,a]);var[o,r]=z(i,"x"),[n,h]=z(i,"y");this.minX=t.boundaries&&!isNaN(t.boundaries.minX)?t.boundaries.minX:o,this.maxX=t.boundaries&&!isNaN(t.boundaries.maxX)?t.boundaries.maxX:r,this.minY=t.boundaries&&!isNaN(t.boundaries.minY)?t.boundaries.minY:n,this.maxY=t.boundaries&&!isNaN(t.boundaries.maxY)?t.boundaries.maxY:h,isNaN(this.minX)&&(this.minX=0),isNaN(this.maxX)&&(this.maxX=100),isNaN(this.minY)&&(this.minX=0),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratioX=this.viewWidth/(this.maxX===this.minX?this.maxX:this.maxX-this.minX),this.ratioY=this.viewHeight/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}lines(){var t,i=this,e=this.options,s=d(e.padding),a=this.ctx;if(this.data&&this.data.length)for(var r=function(r){var n,h,d,c=e.lines[r],f=i.data[r],p=e.colors[r],u=c.type||e.type||q;for(var[g,m]of(t=[],f)){var v=Math.floor((g-i.minX)*i.ratioX+s.left),b=Math.floor(i.viewHeight+s.top-(m-i.minY)*i.ratioY);t.push([v,b,g,m])}!1!==c.showLine&&(u!==q?function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],{color:e="#000",size:s=1,dash:a=[],tension:o=.25}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(a),t.lineWidth=s,t.strokeStyle=e,t.moveTo(i[0][0],i[0][1]);for(var r=0;r<i.length-1;r++){var n=(i[r][0]+i[r+1][0])/2,h=(i[r][1]+i[r+1][1])/2,l=(n+i[r][0])/2,d=(n+i[r+1][0])/2;//let cp_y2 = (y_mid + coords[i + 1][1]) / 2;
  t.quadraticCurveTo(l,i[r][1],n,h),t.quadraticCurveTo(d,i[r+1][1],i[r+1][0],i[r+1][1])}t.stroke(),t.restore(),t.closePath()}(a,t,{color:p,size:c.size}):H(a,t,{color:p,size:c.size}));var x=function(){for(var t={},i=arguments.length,e=new Array(i),s=0;s<i;s++)e[s]=arguments[s];return e.forEach((i=>{i&&o(i)&&Object.assign(t,i)})),t}({type:"circle"},e.dots,c.dots),y={color:null!==(n=x.color)&&void 0!==n?n:p,fill:null!==(h=x.fill)&&void 0!==h?h:p,radius:null!==(d=x.size)&&void 0!==d?d:2},w=void 0;switch(x.type){case"square":w=l;break;case"triangle":w=S;break;case"diamond":w=M;break;default:w=N}c.dots&&!1!==e.showDots&&t.map((t=>{var[i,e]=t;w(a,[i,e,y.radius],y)})),i.coords[c.name]={line:c,coords:t,drawPointFn:w,opt:y}},n=0;n<this.data.length;n++)r(n)}floatPoint(){var t=this.options,i=this.ctx,e=this.canvas.getBoundingClientRect(),s=!1;if(this.data&&this.data.length&&this.proxy.mouse){var{x:a,y:o}=this.proxy.mouse,r=a-e.left,n=o-e.top;for(var h in this.coords){var l=this.coords[h],d=l.drawPointFn,c=l.opt;// const graph = item.graph
  for(var[f,p,u,g]of l.coords){var m=+(t.accuracy||c.radius),v=f-m,b=f+m,x=p-m,y=p+m;if(r>v&&r<b&&t.hoverMode!==F&&d(i,[f,p,c.radius],{color:c.color,fill:c.fill}),r>v&&r<b&&n>x&&n<y){t.hoverMode===F&&d(i,[f,p,2*c.radius],{color:c.color,fill:c.fill}),t.tooltip&&(this.showTooltip([u,g],l.graph),s=!0);break}}!s&&this.tooltip&&(this.tooltip.remove(),this.tooltip=null)}}}add(t,i,e){var[s,a]=i;this.addPoint(t,[s,a],e),this.minX=this.data[t][0][0],this.maxX=s,a<this.minY&&(this.minY=a),a>this.maxY&&(this.maxY=a),this.resize()}draw(){super.draw(),this.calcRatio(),this.axisXY(),this.arrows(),this.lines(),this.floatPoint(),this.cross(),this.legend()}}Object.assign(E.prototype,D),Object.assign(E.prototype,T),Object.assign(E.prototype,L),Object.assign(E.prototype,O);var K={other:{color:"#eaeaea"},labels:{font:e,color:"#fff"},showValue:!1,padding:0,onDrawValue:null},J=function(t,i){var[e,s,a=4,o,r]=i,{color:n="#000",fill:h="#fff",size:l=1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=l,t.strokeStyle=n,t.fillStyle=h,t.arc(e,s,a,o,r),t.lineTo(e,s),t.fill(),t.stroke(),t.restore(),t.closePath()};class Q extends u{constructor(t,i,e){super(t,i,r({},K,e),"pie"),this.total=this.data.reduce(((t,i)=>t+i),0),this.legendItems=[];var s=this.options.legend;if(s&&s.titles&&s.titles.length)for(var a=0;a<s.titles.length;a++)this.legendItems.push([s.titles[a],this.options.colors[a],this.data[a]]);this.resize()}sectors(){var t,i,e=this.ctx,s=this.options,[a,o]=this.center,r=this.radius,l=0,d=360,c=0,f="";if(this.data&&this.data.length){for(var p=0;p<this.data.length;p++){var u=this.data[p],g=s.colors[p];d=2*Math.PI*u/this.total,J(e,[a,o,r,l,l+d],{fill:g,color:g}),l+=d}l=0;for(var m=0;m<this.data.length;m++){var v,b,x=this.data[m],y=null!==(v=this.legendItems[m]&&this.legendItems[m][0])&&void 0!==v?v:"";d=2*Math.PI*x/this.total,c=0,b=Math.round(100*x/this.total),f=s.showValue?x:b+"%","function"==typeof s.onDrawValue&&(f=s.onDrawValue.apply(null,[y,x,b])),t=a+(r/2+c)*Math.cos(l+d/2),i=o+(r/2+c)*Math.sin(l+d/2);var w=h(e,[x+"%"],{font:s.labels.font});n(e,f,[t-w/2,i+s.labels.font.size/2],{color:s.labels.color,font:s.labels.font}),l+=d}}}draw(){super.draw(),this.sectors(),this.legend()}resize(){super.resize(),this.center=[this.dpiWidth/2,this.dpiHeight/2]}}var U={groupDistance:0,axis:y,dataAxisX:!1,arrows:X,onDrawLabel:null};class $ extends u{constructor(t,i,e){super(t,i,r({},U,e),"stacked-bar"),this.barWidth=0,this.maxY=0,this.maxX=0,this.minY=0,this.minX=0,this.viewAxis=this.options.dataAxisX?this.viewHeight:this.viewWidth,this.ratioX=0,this.ratioY=0,this.legendItems=[];var s=this.options.legend;if(s&&s.titles&&s.titles.length)for(var a=0;a<s.titles.length;a++)this.legendItems.push([s.titles[a],this.options.colors[a]]);this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e in this.data){var s=this.data[e].data;i.push(s.reduce(((t,i)=>t+i),0))}var[,a]=W(i);this.maxX=this.maxY=t.boundaries&&!isNaN(t.boundaries.max)?t.boundaries.maxY:a,isNaN(this.maxX)&&(this.maxX=100),isNaN(this.maxY)&&(this.maxX=100)}calcRatio(){this.ratio=this.ratioY=this.ratioX=(this.options.dataAxisX?this.viewWidth:this.viewHeight)/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}calcBarWidth(){var t=this.options,i=this.data.length,e=(t.dataAxisX?this.viewHeight:this.viewWidth)-(this.data.length+1)*t.groupDistance;// space between groups
  this.barWidth=e/i}barsX(){var t,i,e,s,a=this.options,o=d(a.padding),r=this.ctx,h=this.canvas.getBoundingClientRect(),l=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-h.left,s=this.proxy.mouse.y-h.top),t=o.left,i=o.top+a.groupDistance;var c=Array.isArray(a.colors)?a.colors:a.colors.split(",").map((t=>t.trim()));for(var f of this.data){for(var p=f.data,u=f.name,g=c.length>1?a.color:c[0],m=0,v=0;v<p.length;v++){var b=p[v]*this.ratio,x=c[v],y=c[v],w=a.values[v];R(r,[t+m,i,b,this.barWidth],{color:x,fill:y}),e>t+m&&e<t+b+m&&s>i&&s<i+this.barWidth&&(R(r,[t+m,i,b,this.barWidth-1],{color:"rgba(255,255,255,.3)",fill:"rgba(255,255,255,.3)"}),a.tooltip&&(this.showTooltip([w,p[v]],f),l=!0)),m+=b}i+=a.groupDistance+this.barWidth,"function"==typeof a.onDrawLabel&&(u=a.onDrawLabel.apply(null,u)),n(r,u,[0,0],{align:"center",color:g,stroke:g,font:a.font,translate:[t-20,i-this.barWidth/2],angle:90})}!l&&this.tooltip&&(this.tooltip.remove(),this.tooltip=null)}}barsY(){var t,i,e,s,a=this.options,o=d(a.padding),r=this.ctx,h=this.canvas.getBoundingClientRect(),l=!1;if(this.data&&this.data.length){this.proxy.mouse&&(e=this.proxy.mouse.x-h.left,s=this.proxy.mouse.y-h.top),t=o.left+a.groupDistance,i=this.viewHeight+o.top;var c=Array.isArray(a.colors)?a.colors:a.colors.split(",").map((t=>t.trim()));for(var f of this.data){for(var p=f.data,u=f.name,g=c.length>1?a.color:c[0],m=0,v=0;v<p.length;v++){var b=p[v]*this.ratio,x=c[v],y=c[v],w=a.values[v];R(r,[t,i-b-m,this.barWidth,b],{color:x,fill:y}),e>t&&e<t+this.barWidth-1&&s>i-b-m&&s<i-m&&(R(r,[t,i-b-m,this.barWidth,b],{color:"rgba(255,255,255,.3)",fill:"rgba(255,255,255,.3)"}),a.tooltip&&(this.showTooltip([w,p[v]],f),l=!0)),m+=b}t+=a.groupDistance+this.barWidth,"function"==typeof a.onDrawLabel&&(u=a.onDrawLabel.apply(null,u)),n(r,u,[0,0],{align:"center",color:g,stroke:g,font:a.font,translate:[t-a.groupDistance-this.barWidth/2,i+20],angle:0})}!l&&this.tooltip&&(this.tooltip.remove(),this.tooltip=null)}}draw(){var t=this.options;super.draw(),this.calcBarWidth(),this.calcRatio(),t.dataAxisX?(this.axisX(),this.barsX()):(this.axisY(),this.barsY()),this.arrows(),this.legend()}}Object.assign($.prototype,T),Object.assign($.prototype,O);var _={font:i,fixed:!1,color:"#000",angle:0,shift:{x:0,y:0}},tt={backStyle:"#a7a7a7",fillStyle:"#8f8",startFactor:.85,endFactor:.15,backWidth:32,valueWidth:32,radius:100,boundaries:{min:0,max:100},value:_,label:{min:_,max:_},padding:{left:0,right:0}},it=function(t,i){var[e,s,a,o,r]=i,{stroke:n="#000",fill:h="#fff",size:l=1,dash:d=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash(d),t.lineWidth=l,t.strokeStyle=n,t.fillStyle=h,t.arc(e,s,a,o,r),t.stroke(),t.restore(),t.closePath()},et=(t,i)=>{for(var e="#fff",s=0,a=0;a<i.length;a++){var o=i[a][0];t>=s&&t<=o&&(e=i[a][1],s=i[a][0])}return e};class st extends u{constructor(t,i,e){super(t,i,r({},tt,e),"gauge"),this.min=this.options.boundaries.min,this.max=this.options.boundaries.max,this.resize()}gauge(){var t=this.ctx,i=this.options,e=d(i.padding),[s,a]=this.center;s+=e.left,a+=e.top;var o=Math.PI,r=o*i.startFactor,h=o*(2+i.endFactor),l=i.radius*this.radius/100-i.backWidth,c=this.data[0],f=Math.round(Math.abs(100*(c-this.min)/(this.max-this.min))),p=r+(h-r)*f/100,u=f,g=[];if("function"==typeof i.onDrawValue&&(u=i.onDrawValue.apply(null,[c,f])),it(t,[s,a,l,r,h],{size:i.backWidth,stroke:i.backStyle}),"string"==typeof i.fillStyle)g.push([100,i.fillStyle]);else if(Array.isArray(i.fillStyle))for(var m of i.fillStyle)g.push(m);it(t,[s,a,l,r,p],{size:i.valueWidth,stroke:et(f,g)}),n(t,u,[0,0],{align:"center",baseLine:"middle",color:i.value.color,stroke:i.value.color,font:i.value.font||i.font,translate:[s+i.value.shift.x,a+i.value.shift.y],angle:i.value.angle}),i.label.min&&n(t,i.boundaries.min,[0,0],{align:"left",baseLine:"middle",color:i.label.min.color,stroke:i.label.min.color,font:i.label.min.font||i.font,translate:[s+l*Math.cos(r)+i.backWidth+i.label.min.shift.x,a+l*Math.sin(r)+i.label.min.shift.y],angle:0}),i.label.max&&n(t,i.boundaries.max,[0,0],{align:"right",baseLine:"middle",color:i.label.max.color,stroke:i.label.max.color,font:i.label.max.font||i.font,translate:[s+l*Math.cos(h)-i.backWidth+i.label.max.shift.x,a+l*Math.sin(h)+i.label.max.shift.y],angle:0})}draw(){super.draw(),this.gauge()}}var at={backStyle:"#a7a7a7",fillStyle:"#8f8",backWidth:100,valueWidth:100,radius:100,boundaries:{min:0,max:100},label:{font:i,fixed:!1,color:"#000",angle:0,shift:{x:0,y:0}},padding:0};class ot extends u{constructor(t,i,e){super(t,i,r({},at,e),"donut"),this.total=this.data.reduce(((t,i)=>t+i),0),this.min=this.options.boundaries.min,this.max=this.options.boundaries.max,this.legendItems=[];var s=this.options.legend;if(s&&s.titles&&s.titles.length)for(var a=0;a<s.titles.length;a++)this.legendItems.push([s.titles[a],this.options.colors[a],this.data[a]]);this.resize()}gauge(){var t=this.ctx,i=this.options,[e,s]=this.center,a=Math.PI,o=this.radius-i.backWidth/2;it(t,[e,s,o,0,2*a],{size:i.backWidth,stroke:i.backStyle});for(var r=0,h=0,l=0;l<this.data.length;l++){var d=i.colors[l],c=this.data[l];if(h=2*Math.PI*c/this.total,it(t,[e,s,o,r,r+h],{size:i.valueWidth,stroke:d}),i.label){var f,p,u,g=null!==(f=this.legendItems[l]&&this.legendItems[l][0])&&void 0!==f?f:"",m=Math.round(100*c/this.total),v=i.showValue?c:m+"%";"function"==typeof i.onDrawValue&&(v=i.onDrawValue.apply(null,[g,c,m])),p=e+o*Math.cos(r+h/2),u=s+o*Math.sin(r+h/2),n(t,v,[p,u],{color:i.label.color,font:i.label.font})}r+=h}}draw(){super.draw(),this.gauge(),this.legend()}resize(){super.resize(),this.center=[this.dpiWidth/2,this.dpiHeight/2]}}var rt={segment:{count:100,distance:4,rowDistance:4,height:10,radius:0},ghost:{color:"#f1f1f1"},colors:[[70,"#60a917"],[90,"#f0a30a"],[100,"#a20025"]],padding:0,margin:0},nt=function(t,i){var[e,s,a,o]=i,{color:r="#000",fill:n="#fff",size:h=1,dash:l=[],radius:d=4}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("number"==typeof d)d={tl:d,tr:d,br:d,bl:d};else{var c={tl:0,tr:0,br:0,bl:0};for(var f in c)d[f]=d[f]||c[f]}t.beginPath(),t.fillStyle=n,t.strokeStyle=r,t.moveTo(e+d.tl,s),t.lineTo(e+a-d.tr,s),t.quadraticCurveTo(e+a,s,e+a,s+d.tr),t.lineTo(e+a,s+o-d.br),t.quadraticCurveTo(e+a,s+o,e+a-d.br,s+o),t.lineTo(e+d.bl,s+o),t.quadraticCurveTo(e,s+o,e,s+o-d.bl),t.lineTo(e,s+d.tl),t.quadraticCurveTo(e,s,e+d.tl,s),t.fill(),t.stroke(),t.closePath()};class ht extends u{constructor(t,i,e){var s=Array.isArray(i)?i:[i],o=r({},a,rt,e),n=d(o.padding),{height:h,distance:l,rowDistance:c}=o.segment,f=((h+c)*s.length-c+(n.top+n.bottom))*o.dpi+c;super(t,i,v(v({},o),{},{height:f}),"segment"),this.min=0,this.max=100,this.values=s,this.resize()}segments(){var t,i=this.ctx,e=this.options,s=e.segment,a=s.count?s.count:20,o=s.distance*e.dpi,r=s.rowDistance*e.dpi,n=this.viewWidth/a-o,h=s.height,l=[],c=d(e.padding),f=c.top+o;if("string"==typeof e.colors)l.push([100,e.colors]);else if(Array.isArray(e.colors))for(var p of e.colors)l.push(p);for(var u=0;u<this.values.length;u++){var g=a*this.values[u]/100;t=c.left+1;for(var m=0;m<a;m++){var v=et(100*m/a,l);m<=g?nt(i,[t,f,n,h],{color:v,fill:v,radius:s.radius}):e.ghost&&nt(i,[t,f,n,h],{color:e.ghost.color,fill:e.ghost.color,radius:s.radius}),t+=n+o}f+=h+r}}setData(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.values[i]=t,e&&this.resize()}draw(){super.draw(),this.segments()}}var lt={axis:y,boundaries:{minY:0},candle:{size:1,width:"auto",white:"green",black:"red",distance:4,cutoff:!1},ghost:{stroke:"#e3e3e3",fill:"#e3e3e3"},arrows:X},dt=function(t,i){var[e,s,a,o,r,n]=i,{color:h="red",size:l=1,leg:d=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.beginPath(),t.save(),t.setLineDash([]),t.lineWidth=l,t.strokeStyle=h,t.fillStyle=h,t.moveTo(e,s),t.lineTo(e,s+a),d&&(t.moveTo(e-r/2,s),t.lineTo(e+r/2,s),t.moveTo(e-r/2,s+a),t.lineTo(e+r/2,s+a)),t.rect(e-r/2,o,r,n),t.stroke(),t.fill(),t.restore(),t.closePath()};class ct extends u{constructor(t,i,e){super(t,i,r({},lt,e),"candlesticks"),this.minY=0,this.maxY=0,this.labels=[],this.coords=[],this.calcMinMax(),this.resize()}calcMinMax(){var t=this.options,i=[];for(var e in this.labels.length=0,this.data){var[s,a,o]=this.data[e];i.push([0,a]),i.push([0,o]),this.labels.push(s)}var[r,n]=z(i,"y");this.minY=t.boundaries&&!isNaN(t.boundaries.minY)?t.boundaries.minY:r,this.maxY=t.boundaries&&!isNaN(t.boundaries.maxY)?t.boundaries.maxY:n}calcRatio(){this.ratioY=this.viewHeight/(this.maxY===this.minY?this.maxY:this.maxY-this.minY)}getCandleSize(){var t=this.options.candle,i=this.data.length;return"auto"===t.width?(this.viewWidth-2*t.distance-t.distance*(i-1))/i:t.width}candlesticks(){
  // data [x, hi, low, open, close]
  var t,i,e=this.ctx,s=this.options,a=s.candle,o=s.ghost,r=d(s.padding),n=this.data.length,h=this.canvas.getBoundingClientRect(),l=this.getCandleSize(),c=!1;this.proxy.mouse&&(t=this.proxy.mouse.x-h.left,i=this.proxy.mouse.y-h.top);var f=r.left+l/2+a.distance;this.coords.length=0;for(var p=0;p<n;p++){var u,g,m,v,[b,x,y,w,Y]=this.data[p],X=Y>w,k=X?a.white:a.black,z=f-l/2-a.distance/2,W=f+l/2+a.distance/2;u=r.top+this.viewHeight-(x-this.minY)*this.ratioY,g=r.top+this.viewHeight-(y-this.minY)*this.ratioY,m=r.top+this.viewHeight-(w-this.minY)*this.ratioY,v=r.top+this.viewHeight-(Y-this.minY)*this.ratioY,t>=z&&t<=W&&R(e,[z,r.top,l+a.distance,this.viewHeight],{color:o.stroke,fill:o.fill}),dt(e,[f,u,g-u,m,l,v-m],{color:k,size:a.size,leg:a.leg}),t>=z&&t<=W&&i>=u&&i<=g&&s.tooltip&&(this.showTooltip(this.data[p],{type:X}),c=!0),this.coords.push(f),f+=l+a.distance}!c&&this.tooltip&&(this.tooltip.remove(),this.tooltip=null)}axis(){var t,i;
  // draw default axis Y
  this.axisY();for(// draw axis X
  var e=this.ctx,s=this.options,a=s.candle,o=d(s.padding),r=s.axis.x,h=r.label,l=r.line,c=r.arrow,f=null!==(t=h&&h.font)&&void 0!==t?t:s.font,p=null!==(i=l.shortLineSize)&&void 0!==i?i:0,u=this.getCandleSize(),g=o.left+u/2+a.distance,m=o.top+this.viewHeight,v=0,b=0;b<this.labels.length;b++){var x,y,w,Y=this.labels[b],X=Y;if("function"==typeof s.onDrawLabelX&&(X=s.onDrawLabelX.apply(null,[Y])),0!==b&&h.skip&&v!==h.skip)v++;else v=1,// short line
  P(e,[g,m-p,g,m+p],{color:c&&c.color?c.color:l.color}),// label
  n(e,X.toString(),[0,0],{color:null!==(x=h.color)&&void 0!==x?x:s.color,align:h.align,font:f,translate:[g+(null!==(y=h.shift.x)&&void 0!==y?y:0),m+f.size+5+(null!==(w=h.shift.y)&&void 0!==w?w:0)],angle:h.angle});g+=u+a.distance}}add(t){var i,[e,s,a,o,r]=t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],h=this.options;this.data||(this.data=[]),i=this.data,n&&i.length&&(h.graphSize?i.length>=h.graphSize&&(i=i.slice(1)):i=i.slice(1)),this.data=i,this.data.push([e,s,a,o,r]),this.calcMinMax(),this.resize()}draw(){super.draw(),this.calcRatio(),this.axis(),this.arrows(),this.candlesticks()}}Object.assign(ct.prototype,T),Object.assign(ct.prototype,p),Object.assign(ct.prototype,O);globalThis.chart={areaChart:(t,i,e)=>new C(t,i,e),barChart:(t,i,e)=>new j(t,i,e),bubbleChart:(t,i,e)=>new I(t,i,e),histogramChart:(t,i,e)=>new G(t,i,e),lineChart:(t,i,e)=>new E(t,i,e),pieChart:(t,i,e)=>new Q(t,i,e),stackedBarChart:(t,i,e)=>new $(t,i,e),gauge:(t,i,e)=>new st(t,i,e),donut:(t,i,e)=>new ot(t,i,e),segment:(t,i,e)=>new ht(t,i,e),candlestickChart:(t,i,e)=>new ct(t,i,e)}}();
  