const z={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},ie=8,Z={"&":"&","<":"<",">":">",'"':""","'":"'"};function W(i,e){return typeof i=="number"?i+e:i}function H(i){if(typeof i=="string"){const e=/^(\d+)\s*(.*)$/g.exec(i);return{value:e?+e[1]:0,unit:e?.[2]||void 0}}return{value:Number(i)}}function re(i){return String.fromCharCode(97+i%26)}const G=2221e-19;function ae(i){return Math.floor(Math.log(Math.abs(i))/Math.LN10)}function L(i,e,n){return e/n.range*i}function oe(i,e){const n=Math.pow(10,ie);return Math.round(i*n)/n}function le(i){if(i===1)return i;function e(a,o){return a%o===0?o:e(o,a%o)}function n(a){return a*a+1}let t=2,s=2,r;if(i%2===0)return 2;do t=n(t)%i,s=n(n(s))%i,r=e(Math.abs(t-s),i);while(r===1);return r}function he(i,e,n){let t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const s={high:e.high,low:e.low,valueRange:0,oom:0,step:0,min:0,max:0,range:0,numberOfSteps:0,values:[]};s.valueRange=s.high-s.low,s.oom=ae(s.valueRange),s.step=Math.pow(10,s.oom),s.min=Math.floor(s.low/s.step)*s.step,s.max=Math.ceil(s.high/s.step)*s.step,s.range=s.max-s.min,s.numberOfSteps=Math.round(s.range/s.step);const a=L(i,s.step,s)<n,o=t?le(s.range):0;if(t&&L(i,1,s)>=n)s.step=1;else if(t&&o<s.step&&L(i,o,s)>=n)s.step=o;else{let f=0;for(;;){if(a&&L(i,s.step,s)<=n)s.step*=2;else if(!a&&L(i,s.step/2,s)>=n){if(s.step/=2,t&&s.step%1!==0){s.step*=2;break}}else break;if(f++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}}s.step=Math.max(s.step,G);function l(f,d){return f===(f+=d)&&(f*=1+(d>0?G:-G)),f}let u=s.min,c=s.max;for(;u+s.step<=s.low;)u=l(u,s.step);for(;c-s.step>=s.high;)c=l(c,-s.step);s.min=u,s.max=c,s.range=s.max-s.min;const m=[];for(let f=s.min;f<=s.max;f=l(f,s.step)){const d=oe(f);d!==m[m.length-1]&&m.push(d)}return s.values=m,s}function S(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};for(var e=arguments.length,n=new Array(e>1?e-1:0),t=1;t<e;t++)n[t-1]=arguments[t];for(let s=0;s<n.length;s++){const r=n[s],a=Object.getPrototypeOf(i);for(const o in r){if(a!==null&&o in a)continue;const l=r[o];typeof l=="object"&&l!==null&&!(l instanceof Array)?i[o]=S(i[o],l):i[o]=l}}return i}const q=i=>i;function D(i,e){return Array.from({length:i},e?(n,t)=>e(t):()=>{})}function y(i,e){return i!==null&&typeof i=="object"&&Reflect.has(i,e)}function P(i){return i!==null&&isFinite(i)}function ue(i){return!i&&i!==0}function O(i){return P(i)?Number(i):void 0}function ce(i){return Array.isArray(i)?i.every(Array.isArray):!1}function fe(i,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,t=0;i[n?"reduceRight":"reduce"]((s,r,a)=>e(r,t++,a),void 0)}function me(i,e){const n=Array.isArray(i)?i[e]:y(i,"data")?i.data[e]:null;return y(n,"meta")?n.meta:void 0}function te(i){return i==null||typeof i=="number"&&isNaN(i)}function de(i){return Array.isArray(i)&&i.every(e=>Array.isArray(e)||y(e,"data"))}function ge(i){return typeof i=="object"&&i!==null&&(Reflect.has(i,"x")||Reflect.has(i,"y"))}function F(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";return ge(i)&&y(i,e)?O(i[e]):O(i)}function pe(i,e,n){e={...e,...n?n==="x"?e.axisX:e.axisY:{}};const t={high:e.high===void 0?-Number.MAX_VALUE:+e.high,low:e.low===void 0?Number.MAX_VALUE:+e.low},s=e.high===void 0,r=e.low===void 0;function a(o){if(!te(o))if(Array.isArray(o))for(let l=0;l<o.length;l++)a(o[l]);else{const l=Number(n&&y(o,n)?o[n]:o);s&&l>t.high&&(t.high=l),r&&l<t.low&&(t.low=l)}}return(s||r)&&a(i),(e.referenceValue||e.referenceValue===0)&&(t.high=Math.max(e.referenceValue,t.high),t.low=Math.min(e.referenceValue,t.low)),t.high<=t.low&&(t.low===0?t.high=1:t.low<0?t.high=0:(t.high>0||(t.high=1),t.low=0)),t}function ve(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2?arguments[2]:void 0,t=arguments.length>3?arguments[3]:void 0,s;const r={labels:(i.labels||[]).slice(),series:ye(i.series,n,t)},a=r.labels.length;return ce(r.series)?(s=Math.max(a,...r.series.map(o=>o.length)),r.series.forEach(o=>{o.push(...D(Math.max(0,s-o.length)))})):s=r.series.length,r.labels.push(...D(Math.max(0,s-a),()=>"")),e&&we(r),r}function we(i){var e;(e=i.labels)===null||e===void 0||e.reverse(),i.series.reverse();for(const n of i.series)y(n,"data")?n.data.reverse():Array.isArray(n)&&n.reverse()}function xe(i,e){let n,t;if(typeof i!="object"){const s=O(i);e==="x"?n=s:t=s}else y(i,"x")&&(n=O(i.x)),y(i,"y")&&(t=O(i.y));if(!(n===void 0&&t===void 0))return{x:n,y:t}}function J(i,e){if(!te(i))return e?xe(i,e):O(i)}function Q(i,e){return Array.isArray(i)?i.map(n=>y(n,"value")?J(n.value,e):J(n,e)):Q(i.data,e)}function ye(i,e,n){if(de(i))return i.map(s=>Q(s,e));const t=Q(i,e);return n?t.map(s=>[s]):t}function be(i,e,n){const t={increasingX:!1,fillHoles:!1,...n},s=[];let r=!0;for(let a=0;a<i.length;a+=2)F(e[a/2].value)===void 0?t.fillHoles||(r=!0):(t.increasingX&&a>=2&&i[a]<=i[a-2]&&(r=!0),r&&(s.push({pathCoordinates:[],valueData:[]}),r=!1),s[s.length-1].pathCoordinates.push(i[a],i[a+1]),s[s.length-1].valueData.push(e[a/2]));return s}function K(i){let e="";return i==null?i:(typeof i=="number"?e=""+i:typeof i=="object"?e=JSON.stringify({data:i}):e=String(i),Object.keys(Z).reduce((n,t)=>n.replaceAll(t,Z[t]),e))}class Ee{call(e,n){return this.svgElements.forEach(t=>Reflect.apply(t[e],t,n)),this}attr(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("attr",n)}elem(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("elem",n)}root(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("root",n)}getNode(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("getNode",n)}foreignObject(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("foreignObject",n)}text(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("text",n)}empty(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("empty",n)}remove(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("remove",n)}addClass(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("addClass",n)}removeClass(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("removeClass",n)}removeAllClasses(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("removeAllClasses",n)}animate(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return this.call("animate",n)}constructor(e){this.svgElements=[];for(let n=0;n<e.length;n++)this.svgElements.push(new E(e[n]))}}const ne={easeInSine:[.47,0,.745,.715],easeOutSine:[.39,.575,.565,1],easeInOutSine:[.445,.05,.55,.95],easeInQuad:[.55,.085,.68,.53],easeOutQuad:[.25,.46,.45,.94],easeInOutQuad:[.455,.03,.515,.955],easeInCubic:[.55,.055,.675,.19],easeOutCubic:[.215,.61,.355,1],easeInOutCubic:[.645,.045,.355,1],easeInQuart:[.895,.03,.685,.22],easeOutQuart:[.165,.84,.44,1],easeInOutQuart:[.77,0,.175,1],easeInQuint:[.755,.05,.855,.06],easeOutQuint:[.23,1,.32,1],easeInOutQuint:[.86,0,.07,1],easeInExpo:[.95,.05,.795,.035],easeOutExpo:[.19,1,.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[.6,.04,.98,.335],easeOutCirc:[.075,.82,.165,1],easeInOutCirc:[.785,.135,.15,.86],easeInBack:[.6,-.28,.735,.045],easeOutBack:[.175,.885,.32,1.275],easeInOutBack:[.68,-.55,.265,1.55]};function _(i,e,n){let t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;const{easing:r,...a}=n,o={};let l,u;r&&(l=Array.isArray(r)?r:ne[r]),a.begin=W(a.begin,"ms"),a.dur=W(a.dur,"ms"),l&&(a.calcMode="spline",a.keySplines=l.join(" "),a.keyTimes="0;1"),t&&(a.fill="freeze",o[e]=a.from,i.attr(o),u=H(a.begin||0).value,a.begin="indefinite");const c=i.elem("animate",{attributeName:e,...a});t&&setTimeout(()=>{try{c._node.beginElement()}catch{o[e]=a.to,i.attr(o),c.remove()}},u);const m=c.getNode();s&&m.addEventListener("beginEvent",()=>s.emit("animationBegin",{element:i,animate:m,params:n})),m.addEventListener("endEvent",()=>{s&&s.emit("animationEnd",{element:i,animate:m,params:n}),t&&(o[e]=a.to,i.attr(o),c.remove())})}class E{attr(e,n){return typeof e=="string"?n?this._node.getAttributeNS(n,e):this._node.getAttribute(e):(Object.keys(e).forEach(t=>{if(e[t]!==void 0)if(t.indexOf(":")!==-1){const s=t.split(":");this._node.setAttributeNS(z[s[0]],t,String(e[t]))}else this._node.setAttribute(t,String(e[t]))}),this)}elem(e,n,t){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return new E(e,n,t,this,s)}parent(){return this._node.parentNode instanceof SVGElement?new E(this._node.parentNode):null}root(){let e=this._node;for(;e.nodeName!=="svg"&&e.parentElement;)e=e.parentElement;return new E(e)}querySelector(e){const n=this._node.querySelector(e);return n?new E(n):null}querySelectorAll(e){const n=this._node.querySelectorAll(e);return new Ee(n)}getNode(){return this._node}foreignObject(e,n,t){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r;if(typeof e=="string"){const o=document.createElement("div");o.innerHTML=e,r=o.firstChild}else r=e;r instanceof Element&&r.setAttribute("xmlns",z.xmlns);const a=this.elem("foreignObject",n,t,s);return a._node.appendChild(r),a}text(e){return this._node.appendChild(document.createTextNode(e)),this}empty(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}remove(){var e;return(e=this._node.parentNode)===null||e===void 0||e.removeChild(this._node),this.parent()}replace(e){var n;return(n=this._node.parentNode)===null||n===void 0||n.replaceChild(e._node,this._node),e}append(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)&&this._node.firstChild?this._node.insertBefore(e._node,this._node.firstChild):this._node.appendChild(e._node),this}classes(){const e=this._node.getAttribute("class");return e?e.trim().split(/\s+/):[]}addClass(e){return this._node.setAttribute("class",this.classes().concat(e.trim().split(/\s+/)).filter(function(n,t,s){return s.indexOf(n)===t}).join(" ")),this}removeClass(e){const n=e.trim().split(/\s+/);return this._node.setAttribute("class",this.classes().filter(t=>n.indexOf(t)===-1).join(" ")),this}removeAllClasses(){return this._node.setAttribute("class",""),this}height(){return this._node.clientHeight}width(){return this._node.clientWidth}animate(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=arguments.length>2?arguments[2]:void 0;return Object.keys(e).forEach(s=>{const r=e[s];Array.isArray(r)?r.forEach(a=>_(this,s,a,!1,t)):_(this,s,r,n,t)}),this}constructor(e,n,t,s,r=!1){e instanceof Element?this._node=e:(this._node=document.createElementNS(z.svg,e),e==="svg"&&this.attr({"xmlns:ct":z.ct})),n&&this.attr(n),t&&this.addClass(t),s&&(r&&s._node.firstChild?s._node.insertBefore(this._node,s._node.firstChild):s._node.appendChild(this._node))}}E.Easing=ne;function Ae(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"100%",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"100%",t=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!i)throw new Error("Container element is not found");Array.from(i.querySelectorAll("svg")).filter(a=>a.getAttributeNS(z.xmlns,"ct")).forEach(a=>i.removeChild(a));const r=new E("svg").attr({width:e,height:n}).attr({style:"width: ".concat(e,"; height: ").concat(n,";")});return t&&r.addClass(t),s&&r.attr({viewBox:"0 0 ".concat(s.width," ").concat(s.height)}),i.appendChild(r.getNode()),r}function Ce(i){return typeof i=="number"?{top:i,right:i,bottom:i,left:i}:i===void 0?{top:0,right:0,bottom:0,left:0}:{top:typeof i.top=="number"?i.top:0,right:typeof i.right=="number"?i.right:0,bottom:typeof i.bottom=="number"?i.bottom:0,left:typeof i.left=="number"?i.left:0}}function Me(i,e){var n,t,s,r,a,o;const l=!!(e.axisX||e.axisY),u=((n=e.axisY)===null||n===void 0?void 0:n.offset)||0,c=((t=e.axisX)===null||t===void 0?void 0:t.offset)||0,m=(s=e.axisY)===null||s===void 0?void 0:s.position,f=(r=e.axisX)===null||r===void 0?void 0:r.position;let d=((a=e.viewBox)===null||a===void 0?void 0:a.width)||i.width()||H(e.width).value||0,h=((o=e.viewBox)===null||o===void 0?void 0:o.height)||i.height()||H(e.height).value||0;const v=Ce(e.chartPadding);d=Math.max(d,u+v.left+v.right),h=Math.max(h,c+v.top+v.bottom);const g={x1:0,x2:0,y1:0,y2:0,padding:v,width(){return this.x2-this.x1},height(){return this.y1-this.y2}};return l?(f==="start"?(g.y2=v.top+c,g.y1=Math.max(h-v.bottom,g.y2+1)):(g.y2=v.top,g.y1=Math.max(h-v.bottom-c,g.y2+1)),m==="start"?(g.x1=v.left+u,g.x2=Math.max(d-v.right,g.x1+1)):(g.x1=v.left,g.x2=Math.max(d-v.right-u,g.x1+1))):(g.x1=v.left,g.x2=Math.max(d-v.right,g.x1+1),g.y2=v.top,g.y1=Math.max(h-v.bottom,g.y2+1)),g}function Oe(i,e,n,t,s,r,a,o){const l={["".concat(n.units.pos,"1")]:i,["".concat(n.units.pos,"2")]:i,["".concat(n.counterUnits.pos,"1")]:t,["".concat(n.counterUnits.pos,"2")]:t+s},u=r.elem("line",l,a.join(" "));o.emit("draw",{type:"grid",axis:n,index:e,group:r,element:u,...l})}function Le(i,e,n,t){const s=i.elem("rect",{x:e.x1,y:e.y2,width:e.width(),height:e.height()},n,!0);t.emit("draw",{type:"gridBackground",group:i,element:s})}function Ne(i,e,n,t,s,r,a,o,l,u){const c={[s.units.pos]:i+a[s.units.pos],[s.counterUnits.pos]:a[s.counterUnits.pos],[s.units.len]:e,[s.counterUnits.len]:Math.max(0,r-10)},m=Math.round(c[s.units.len]),f=Math.round(c[s.counterUnits.len]),d=document.createElement("span");d.className=l.join(" "),d.style[s.units.len]=m+"px",d.style[s.counterUnits.len]=f+"px",d.textContent=String(t);const h=o.foreignObject(d,{style:"overflow: visible;",...c});u.emit("draw",{type:"label",axis:s,index:n,group:o,element:h,text:t,...c})}function k(i,e,n){let t;const s=[];function r(o){const l=t;t=S({},i),e&&e.forEach(u=>{window.matchMedia(u[0]).matches&&(t=S({},t,u[1]))}),n&&o&&n.emit("optionsChanged",{previousOptions:l,currentOptions:t})}function a(){s.forEach(o=>o.removeEventListener("change",r))}if(window.matchMedia)e&&e.forEach(o=>{const l=window.matchMedia(o[0]);l.addEventListener("change",r),s.push(l)});else throw new Error("window.matchMedia not found! Make sure you're using a polyfill.");return r(),{removeMediaQueryListeners:a,getCurrentOptions(){return t}}}const T={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},ze={accuracy:3};function I(i,e,n,t,s,r){const a={command:s?i.toLowerCase():i.toUpperCase(),...e,...r?{data:r}:{}};n.splice(t,0,a)}function Y(i,e){i.forEach((n,t)=>{T[n.command.toLowerCase()].forEach((s,r)=>{e(n,s,t,r,i)})})}class A{static join(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=arguments.length>2?arguments[2]:void 0;const s=new A(n,t);for(let r=0;r<e.length;r++){const a=e[r];for(let o=0;o<a.pathElements.length;o++)s.pathElements.push(a.pathElements[o])}return s}position(e){return e!==void 0?(this.pos=Math.max(0,Math.min(this.pathElements.length,e)),this):this.pos}remove(e){return this.pathElements.splice(this.pos,e),this}move(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3?arguments[3]:void 0;return I("M",{x:+e,y:+n},this.pathElements,this.pos++,t,s),this}line(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3?arguments[3]:void 0;return I("L",{x:+e,y:+n},this.pathElements,this.pos++,t,s),this}curve(e,n,t,s,r,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!1,l=arguments.length>7?arguments[7]:void 0;return I("C",{x1:+e,y1:+n,x2:+t,y2:+s,x:+r,y:+a},this.pathElements,this.pos++,o,l),this}arc(e,n,t,s,r,a,o){let l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,u=arguments.length>8?arguments[8]:void 0;return I("A",{rx:e,ry:n,xAr:t,lAf:s,sf:r,x:a,y:o},this.pathElements,this.pos++,l,u),this}parse(e){const n=e.replace(/([A-Za-z])(-?[0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce((s,r)=>(r.match(/[A-Za-z]/)&&s.push([]),s[s.length-1].push(r),s),[]);n[n.length-1][0].toUpperCase()==="Z"&&n.pop();const t=n.map(s=>{const r=s.shift(),a=T[r.toLowerCase()];return{command:r,...a.reduce((o,l,u)=>(o[l]=+s[u],o),{})}});return this.pathElements.splice(this.pos,0,...t),this.pos+=t.length,this}stringify(){const e=Math.pow(10,this.options.accuracy);return this.pathElements.reduce((n,t)=>{const s=T[t.command.toLowerCase()].map(r=>{const a=t[r];return this.options.accuracy?Math.round(a*e)/e:a});return n+t.command+s.join(",")},"")+(this.close?"Z":"")}scale(e,n){return Y(this.pathElements,(t,s)=>{t[s]*=s[0]==="x"?e:n}),this}translate(e,n){return Y(this.pathElements,(t,s)=>{t[s]+=s[0]==="x"?e:n}),this}transform(e){return Y(this.pathElements,(n,t,s,r,a)=>{const o=e(n,t,s,r,a);(o||o===0)&&(n[t]=o)}),this}clone(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const n=new A(e||this.close);return n.pos=this.pos,n.pathElements=this.pathElements.slice().map(t=>({...t})),n.options={...this.options},n}splitByCommand(e){const n=[new A];return this.pathElements.forEach(t=>{t.command===e.toUpperCase()&&n[n.length-1].pathElements.length!==0&&n.push(new A),n[n.length-1].pathElements.push(t)}),n}constructor(e=!1,n){this.close=e,this.pathElements=[],this.pos=0,this.options={...ze,...n}}}function V(i){const e={fillHoles:!1,...i};return function(t,s){const r=new A;let a=!0;for(let o=0;o<t.length;o+=2){const l=t[o],u=t[o+1],c=s[o/2];F(c.value)!==void 0?(a?r.move(l,u,!1,c):r.line(l,u,!1,c),a=!1):e.fillHoles||(a=!0)}return r}}function Se(i){const e={fillHoles:!1,...i};return function n(t,s){const r=be(t,s,{fillHoles:e.fillHoles,increasingX:!0});if(r.length){if(r.length>1)return A.join(r.map(a=>n(a.pathCoordinates,a.valueData)));{if(t=r[0].pathCoordinates,s=r[0].valueData,t.length<=4)return V()(t,s);const a=[],o=[],l=t.length/2,u=[],c=[],m=[],f=[];for(let h=0;h<l;h++)a[h]=t[h*2],o[h]=t[h*2+1];for(let h=0;h<l-1;h++)m[h]=o[h+1]-o[h],f[h]=a[h+1]-a[h],c[h]=m[h]/f[h];u[0]=c[0],u[l-1]=c[l-2];for(let h=1;h<l-1;h++)c[h]===0||c[h-1]===0||c[h-1]>0!=c[h]>0?u[h]=0:(u[h]=3*(f[h-1]+f[h])/((2*f[h]+f[h-1])/c[h-1]+(f[h]+2*f[h-1])/c[h]),isFinite(u[h])||(u[h]=0));const d=new A().move(a[0],o[0],!1,s[0]);for(let h=0;h<l-1;h++)d.curve(a[h]+f[h]/3,o[h]+u[h]*f[h]/3,a[h+1]-f[h]/3,o[h+1]-u[h+1]*f[h]/3,a[h+1],o[h+1],!1,s[h+1]);return d}}else return V()([],[])}}class Be{on(e,n){const{allListeners:t,listeners:s}=this;e==="*"?t.add(n):(s.has(e)||s.set(e,new Set),s.get(e).add(n))}off(e,n){const{allListeners:t,listeners:s}=this;if(e==="*")n?t.delete(n):t.clear();else if(s.has(e)){const r=s.get(e);n?r.delete(n):r.clear(),r.size||s.delete(e)}}emit(e,n){const{allListeners:t,listeners:s}=this;s.has(e)&&s.get(e).forEach(r=>r(n)),t.forEach(r=>r(e,n))}constructor(){this.listeners=new Map,this.allListeners=new Set}}const U=new WeakMap;class je{update(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e&&(this.data=e||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),n&&(this.options=S({},t?this.options:this.defaultOptions,n),!this.initializeTimeoutId)){var s;(s=this.optionsProvider)===null||s===void 0||s.removeMediaQueryListeners(),this.optionsProvider=k(this.options,this.responsiveOptions,this.eventEmitter)}return!this.initializeTimeoutId&&this.optionsProvider&&this.createChart(this.optionsProvider.getCurrentOptions()),this}detach(){if(this.initializeTimeoutId)window.clearTimeout(this.initializeTimeoutId);else{var e;window.removeEventListener("resize",this.resizeListener),(e=this.optionsProvider)===null||e===void 0||e.removeMediaQueryListeners()}return U.delete(this.container),this}on(e,n){return this.eventEmitter.on(e,n),this}off(e,n){return this.eventEmitter.off(e,n),this}initialize(){window.addEventListener("resize",this.resizeListener),this.optionsProvider=k(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.on("optionsChanged",()=>this.update()),this.options.plugins&&this.options.plugins.forEach(e=>{Array.isArray(e)?e[0](this,e[1]):e(this)}),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=null}constructor(e,n,t,s,r){this.data=n,this.defaultOptions=t,this.options=s,this.responsiveOptions=r,this.eventEmitter=new Be,this.resizeListener=()=>this.update(),this.initializeTimeoutId=setTimeout(()=>this.initialize(),0);const a=typeof e=="string"?document.querySelector(e):e;if(!a)throw new Error("Target element ".concat(typeof e=="string"?'"'.concat(e,'"'):""," is not found"));this.container=a;const o=U.get(a);o&&o.detach(),U.set(a,this)}}const M={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}};class se{createGridAndLabels(e,n,t,s){const r=this.units.pos==="x"?t.axisX:t.axisY,a=this.ticks.map((l,u)=>this.projectValue(l,u)),o=this.ticks.map(r.labelInterpolationFnc);a.forEach((l,u)=>{const c=o[u],m={x:0,y:0};let f;a[u+1]?f=a[u+1]-l:f=Math.max(this.axisLength-l,this.axisLength/this.ticks.length),!(c!==""&&ue(c))&&(this.units.pos==="x"?(l=this.chartRect.x1+l,m.x=t.axisX.labelOffset.x,t.axisX.position==="start"?m.y=this.chartRect.padding.top+t.axisX.labelOffset.y+5:m.y=this.chartRect.y1+t.axisX.labelOffset.y+5):(l=this.chartRect.y1-l,m.y=t.axisY.labelOffset.y-f,t.axisY.position==="start"?m.x=this.chartRect.padding.left+t.axisY.labelOffset.x:m.x=this.chartRect.x2+t.axisY.labelOffset.x+10),r.showGrid&&Oe(l,u,this,this.gridOffset,this.chartRect[this.counterUnits.len](),e,[t.classNames.grid,t.classNames[this.units.dir]],s),r.showLabel&&Ne(l,f,u,c,this,r.offset,m,n,[t.classNames.label,t.classNames[this.units.dir],r.position==="start"?t.classNames[r.position]:t.classNames.end],s))})}constructor(e,n,t){this.units=e,this.chartRect=n,this.ticks=t,this.counterUnits=e===M.x?M.y:M.x,this.axisLength=n[this.units.rectEnd]-n[this.units.rectStart],this.gridOffset=n[this.units.rectOffset]}}class Ie extends se{projectValue(e){const n=Number(F(e,this.units.pos));return this.axisLength*(n-this.bounds.min)/this.bounds.range}constructor(e,n,t,s){const r=s.highLow||pe(n,s,e.pos),a=he(t[e.rectEnd]-t[e.rectStart],r,s.scaleMinSpace||20,s.onlyInteger),o={min:a.min,max:a.max};super(e,t,a.values),this.bounds=a,this.range=o}}class Pe extends se{projectValue(e,n){return this.stepLength*n}constructor(e,n,t,s){const r=s.ticks||[];super(e,t,r);const a=Math.max(1,r.length-(s.stretch?1:0));this.stepLength=this.axisLength/a,this.stretch=!!s.stretch}}function N(i,e,n){var t;if(y(i,"name")&&i.name&&(!((t=e.series)===null||t===void 0)&&t[i.name])){const r=(e?.series[i.name])[n];return r===void 0?e[n]:r}else return e[n]}const ee={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:q,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:q,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};class Xe extends je{createChart(e){const{data:n}=this,t=ve(n,e.reverseData,!0),s=Ae(this.container,e.width,e.height,e.classNames.chart,e.viewBox);this.svg=s;const r=s.elem("g").addClass(e.classNames.gridGroup),a=s.elem("g"),o=s.elem("g").addClass(e.classNames.labelGroup),l=Me(s,e);let u,c;e.axisX.type===void 0?u=new Pe(M.x,t.series,l,{...e.axisX,ticks:t.labels,stretch:e.fullWidth}):u=new e.axisX.type(M.x,t.series,l,e.axisX),e.axisY.type===void 0?c=new Ie(M.y,t.series,l,{...e.axisY,high:P(e.high)?e.high:e.axisY.high,low:P(e.low)?e.low:e.axisY.low}):c=new e.axisY.type(M.y,t.series,l,e.axisY),u.createGridAndLabels(r,o,e,this.eventEmitter),c.createGridAndLabels(r,o,e,this.eventEmitter),e.showGridBackground&&Le(r,l,e.classNames.gridBackground,this.eventEmitter),fe(n.series,(m,f)=>{const d=a.elem("g"),h=y(m,"name")&&m.name,v=y(m,"className")&&m.className,g=y(m,"meta")?m.meta:void 0;h&&d.attr({"ct:series-name":h}),g&&d.attr({"ct:meta":K(g)}),d.addClass([e.classNames.series,v||"".concat(e.classNames.series,"-").concat(re(f))].join(" "));const R=[],$=[];t.series[f].forEach((x,p)=>{const w={x:l.x1+u.projectValue(x,p,t.series[f]),y:l.y1-c.projectValue(x,p,t.series[f])};R.push(w.x,w.y),$.push({value:x,valueIndex:p,meta:me(m,p)})});const C={lineSmooth:N(m,e,"lineSmooth"),showPoint:N(m,e,"showPoint"),showLine:N(m,e,"showLine"),showArea:N(m,e,"showArea"),areaBase:N(m,e,"areaBase")};let X;typeof C.lineSmooth=="function"?X=C.lineSmooth:X=C.lineSmooth?Se():V();const B=X(R,$);if(C.showPoint&&B.pathElements.forEach(x=>{const{data:p}=x,w=d.elem("line",{x1:x.x,y1:x.y,x2:x.x+.01,y2:x.y},e.classNames.point);if(p){let b,j;y(p.value,"x")&&(b=p.value.x),y(p.value,"y")&&(j=p.value.y),w.attr({"ct:value":[b,j].filter(P).join(","),"ct:meta":K(p.meta)})}this.eventEmitter.emit("draw",{type:"point",value:p?.value,index:p?.valueIndex||0,meta:p?.meta,series:m,seriesIndex:f,axisX:u,axisY:c,group:d,element:w,x:x.x,y:x.y,chartRect:l})}),C.showLine){const x=d.elem("path",{d:B.stringify()},e.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:t.series[f],path:B.clone(),chartRect:l,index:f,series:m,seriesIndex:f,meta:g,axisX:u,axisY:c,group:d,element:x})}if(C.showArea&&c.range){const x=Math.max(Math.min(C.areaBase,c.range.max),c.range.min),p=l.y1-c.projectValue(x);B.splitByCommand("M").filter(w=>w.pathElements.length>1).map(w=>{const b=w.pathElements[0],j=w.pathElements[w.pathElements.length-1];return w.clone(!0).position(0).remove(1).move(b.x,p).line(b.x,b.y).position(w.pathElements.length+1).line(j.x,p)}).forEach(w=>{const b=d.elem("path",{d:w.stringify()},e.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:t.series[f],path:w.clone(),series:m,seriesIndex:f,axisX:u,axisY:c,chartRect:l,index:f,group:d,element:b,meta:g})})}},e.reverseData),this.eventEmitter.emit("created",{chartRect:l,axisX:u,axisY:c,svg:s,options:e})}constructor(e,n,t,s){super(e,n,ee,S({},ee,t),s),this.data=n}}window.LineChart=Xe;