import "./chunk-ELXAK55F.js"; // node_modules/frappe-charts/dist/frappe-charts.min.esm.js function styleInject(t7, e) { e === void 0 && (e = {}); var n = e.insertAt; if (t7 && typeof document != "undefined") { var i = document.head || document.getElementsByTagName("head")[0], a = document.createElement("style"); a.type = "text/css", n === "top" && i.firstChild ? i.insertBefore(a, i.firstChild) : i.appendChild(a), a.styleSheet ? a.styleSheet.cssText = t7 : a.appendChild(document.createTextNode(t7)); } } function $(t7, e) { return typeof t7 == "string" ? (e || document).querySelector(t7) : t7 || null; } function getOffset(t7) { var e = t7.getBoundingClientRect(); return { top: e.top + (document.documentElement.scrollTop || document.body.scrollTop), left: e.left + (document.documentElement.scrollLeft || document.body.scrollLeft) }; } function isHidden(t7) { return t7.offsetParent === null; } function isElementInViewport(t7) { var e = t7.getBoundingClientRect(); return e.top >= 0 && e.left >= 0 && e.bottom <= (window.innerHeight || document.documentElement.clientHeight) && e.right <= (window.innerWidth || document.documentElement.clientWidth); } function getElementContentWidth(t7) { var e = window.getComputedStyle(t7), n = parseFloat(e.paddingLeft) + parseFloat(e.paddingRight); return t7.clientWidth - n; } function fire(t7, e, n) { var i = document.createEvent("HTMLEvents"); i.initEvent(e, true, true); for (var a in n) i[a] = n[a]; return t7.dispatchEvent(i); } function getTopOffset(t7) { return t7.titleHeight + t7.margins.top + t7.paddings.top; } function getLeftOffset(t7) { return t7.margins.left + t7.paddings.left; } function getExtraHeight(t7) { return t7.margins.top + t7.margins.bottom + t7.paddings.top + t7.paddings.bottom + t7.titleHeight + t7.legendHeight; } function getExtraWidth(t7) { return t7.margins.left + t7.margins.right + t7.paddings.left + t7.paddings.right; } function _classCallCheck$4(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function floatTwo(t7) { return parseFloat(t7.toFixed(2)); } function fillArray(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 && arguments[3]; n || (n = i ? t7[0] : t7[t7.length - 1]); var a = new Array(Math.abs(e)).fill(n); return t7 = i ? a.concat(t7) : t7.concat(a); } function getStringWidth(t7, e) { return (t7 + "").length * e; } function getPositionByAngle(t7, e) { return { x: Math.sin(t7 * ANGLE_RATIO) * e, y: Math.cos(t7 * ANGLE_RATIO) * e }; } function isValidNumber(t7) { var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1]; return !Number.isNaN(t7) && (t7 !== void 0 && (!!Number.isFinite(t7) && !(e && t7 < 0))); } function round(t7) { return Number(Math.round(t7 + "e4") + "e-4"); } function deepClone(t7) { var e = void 0, n = void 0, i = void 0; if (t7 instanceof Date) return new Date(t7.getTime()); if ((t7 === void 0 ? "undefined" : _typeof$2(t7)) !== "object" || t7 === null) return t7; e = Array.isArray(t7) ? [] : {}; for (i in t7) n = t7[i], e[i] = deepClone(n); return e; } function getBarHeightAndYAttr(t7, e) { var n = void 0, i = void 0; return t7 <= e ? (n = e - t7, i = t7) : (n = t7 - e, i = e), [n, i]; } function equilizeNoOfElements(t7, e) { var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length - t7.length; return n > 0 ? t7 = fillArray(t7, n) : e = fillArray(e, n), [t7, e]; } function truncateString(t7, e) { if (t7) return t7.length > e ? t7.slice(0, e - 3) + "..." : t7; } function shortenLargeNumber(t7) { var e = void 0; if (typeof t7 == "number") e = t7; else if (typeof t7 == "string" && (e = Number(t7), Number.isNaN(e))) return t7; var n = Math.floor(Math.log10(Math.abs(e))); if (n <= 2) return e; var i = Math.floor(n / 3), a = Math.pow(10, n - 3 * i) * +(e / Math.pow(10, n)).toFixed(1); return Math.round(100 * a) / 100 + " " + ["", "K", "M", "B", "T"][i]; } function getSplineCurvePointsStr(t7, e) { for (var n = [], i = 0; i < t7.length; i++) n.push([t7[i], e[i]]); var a = function(t8, e2) { var n2 = e2[0] - t8[0], i2 = e2[1] - t8[1]; return { length: Math.sqrt(Math.pow(n2, 2) + Math.pow(i2, 2)), angle: Math.atan2(i2, n2) }; }, r = function(t8, e2, n2, i2) { var r2 = a(e2 || t8, n2 || t8), o = r2.angle + (i2 ? Math.PI : 0), s = 0.2 * r2.length; return [t8[0] + Math.cos(o) * s, t8[1] + Math.sin(o) * s]; }; return function(t8, e2) { return t8.reduce(function(t9, n2, i2, a2) { return i2 === 0 ? n2[0] + "," + n2[1] : t9 + " " + e2(n2, i2, a2); }, ""); }(n, function(t8, e2, n2) { var i2 = r(n2[e2 - 1], n2[e2 - 2], t8), a2 = r(t8, n2[e2 - 1], n2[e2 + 1], true); return "C " + i2[0] + "," + i2[1] + " " + a2[0] + "," + a2[1] + " " + t8[0] + "," + t8[1]; }); } function limitColor(t7) { return t7 > 255 ? 255 : t7 < 0 ? 0 : t7; } function lightenDarkenColor(t7, e) { var n = getColor(t7), i = false; n[0] == "#" && (n = n.slice(1), i = true); var a = parseInt(n, 16), r = limitColor((a >> 16) + e), o = limitColor((a >> 8 & 255) + e), s = limitColor((255 & a) + e); return (i ? "#" : "") + (s | o << 8 | r << 16).toString(16); } function isValidColor(t7) { var e = /(^\s*)(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/i; return /(^\s*)(#)((?:[A-Fa-f0-9]{3}){1,2})$/i.test(t7) || e.test(t7); } function $$1(t7, e) { return typeof t7 == "string" ? (e || document).querySelector(t7) : t7 || null; } function createSVG(t7, e) { var n = document.createElementNS("http://www.w3.org/2000/svg", t7); for (var i in e) { var a = e[i]; if (i === "inside") $$1(a).appendChild(n); else if (i === "around") { var r = $$1(a); r.parentNode.insertBefore(n, r), n.appendChild(r); } else i === "styles" ? (a === void 0 ? "undefined" : _typeof$1(a)) === "object" && Object.keys(a).map(function(t8) { n.style[t8] = a[t8]; }) : (i === "className" && (i = "class"), i === "innerHTML" ? n.textContent = a : n.setAttribute(i, a)); } return n; } function renderVerticalGradient(t7, e) { return createSVG("linearGradient", { inside: t7, id: e, x1: 0, x2: 0, y1: 0, y2: 1 }); } function setGradientStop(t7, e, n, i) { return createSVG("stop", { inside: t7, style: "stop-color: " + n, offset: e, "stop-opacity": i }); } function makeSVGContainer(t7, e, n, i) { return createSVG("svg", { className: e, inside: t7, width: n, height: i }); } function makeSVGDefs(t7) { return createSVG("defs", { inside: t7 }); } function makeSVGGroup(t7) { var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0, i = { className: t7, transform: e }; return n && (i.inside = n), createSVG("g", i); } function makePath(t7) { return createSVG("path", { className: arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", d: t7, styles: { stroke: arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "none", fill: arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "none", "stroke-width": arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 2 } }); } function makeArcPathStr(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = n.y + e.y; return "M" + n.x + " " + n.y + "\n L" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u + " z"; } function makeCircleStr(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = 2 * n.y, c = n.y + e.y; return "M" + n.x + " " + n.y + "\n L" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u + " z\n L" + o + " " + u + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + c + " z"; } function makeArcStrokePathStr(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = n.y + e.y; return "M" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u; } function makeStrokeCircleStr(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = n.x + t7.x, s = n.y + t7.y, l = n.x + e.x, u = 2 * i + s, c = n.y + t7.y; return "M" + o + " " + s + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + u + "\n M" + o + " " + u + "\n A " + i + " " + i + " 0 " + r + " " + (a ? 1 : 0) + "\n " + l + " " + c; } function makeGradient(t7, e) { var n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], i = "path-fill-gradient-" + e + "-" + (n ? "lighter" : "default"), a = renderVerticalGradient(t7, i), r = [1, 0.6, 0.2]; return n && (r = [0.4, 0.2, 0]), setGradientStop(a, "0%", e, r[0]), setGradientStop(a, "50%", e, r[1]), setGradientStop(a, "100%", e, r[2]), i; } function percentageBar(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : PERCENTAGE_BAR_DEFAULT_DEPTH, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "none"; return createSVG("rect", { className: "percentage-bar", x: t7, y: e, width: n, height: i, fill: r, styles: { stroke: lightenDarkenColor(r, -25), "stroke-dasharray": "0, " + (i + n) + ", " + n + ", " + i, "stroke-width": a } }); } function heatSquare(t7, e, n, i, a) { var r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : "none", o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : {}, s = { className: t7, x: e, y: n, width: i, height: i, rx: a, fill: r }; return Object.keys(o).map(function(t8) { s[t8] = o[t8]; }), createSVG("rect", s); } function legendBar(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "none", a = arguments[4]; a = arguments.length > 5 && arguments[5] !== void 0 && arguments[5] ? truncateString(a, LABEL_MAX_CHARS) : a; var r = { className: "legend-bar", x: 0, y: 0, width: n, height: "2px", fill: i }, o = createSVG("text", { className: "legend-dataset-text", x: 0, y: 0, dy: 2 * FONT_SIZE + "px", "font-size": 1.2 * FONT_SIZE + "px", "text-anchor": "start", fill: FONT_FILL, innerHTML: a }), s = createSVG("g", { transform: "translate(" + t7 + ", " + e + ")" }); return s.appendChild(createSVG("rect", r)), s.appendChild(o), s; } function legendDot(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "none", a = arguments[4]; a = arguments.length > 5 && arguments[5] !== void 0 && arguments[5] ? truncateString(a, LABEL_MAX_CHARS) : a; var r = { className: "legend-dot", cx: 0, cy: 0, r: n, fill: i }, o = createSVG("text", { className: "legend-dataset-text", x: 0, y: 0, dx: FONT_SIZE + "px", dy: FONT_SIZE / 3 + "px", "font-size": 1.2 * FONT_SIZE + "px", "text-anchor": "start", fill: FONT_FILL, innerHTML: a }), s = createSVG("g", { transform: "translate(" + t7 + ", " + e + ")" }); return s.appendChild(createSVG("circle", r)), s.appendChild(o), s; } function makeText(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, r = a.fontSize || FONT_SIZE; return createSVG("text", { className: t7, x: e, y: n, dy: (a.dy !== void 0 ? a.dy : r / 2) + "px", "font-size": r + "px", fill: a.fill || FONT_FILL, "text-anchor": a.textAnchor || "start", innerHTML: i }); } function makeVertLine(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}; a.stroke || (a.stroke = BASE_LINE_COLOR); var r = createSVG("line", { className: "line-vertical " + a.className, x1: 0, x2: 0, y1: n, y2: i, styles: { stroke: a.stroke } }), o = createSVG("text", { x: 0, y: n > i ? n + LABEL_MARGIN : n - LABEL_MARGIN - FONT_SIZE, dy: FONT_SIZE + "px", "font-size": FONT_SIZE + "px", "text-anchor": "middle", innerHTML: e + "" }), s = createSVG("g", { transform: "translate(" + t7 + ", 0)" }); return s.appendChild(r), s.appendChild(o), s; } function makeHoriLine(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}; a.stroke || (a.stroke = BASE_LINE_COLOR), a.lineType || (a.lineType = ""), a.shortenNumbers && (e = shortenLargeNumber(e)); var r = createSVG("line", { className: "line-horizontal " + a.className + (a.lineType === "dashed" ? "dashed" : ""), x1: n, x2: i, y1: 0, y2: 0, styles: { stroke: a.stroke } }), o = createSVG("text", { x: n < i ? n - LABEL_MARGIN : n + LABEL_MARGIN, y: 0, dy: FONT_SIZE / 2 - 2 + "px", "font-size": FONT_SIZE + "px", "text-anchor": n < i ? "end" : "start", innerHTML: e + "" }), s = createSVG("g", { transform: "translate(0, " + t7 + ")", "stroke-opacity": 1 }); return o !== 0 && o !== "0" || (s.style.stroke = "rgba(27, 31, 35, 0.6)"), s.appendChild(r), s.appendChild(o), s; } function yLine(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; isValidNumber(t7) || (t7 = 0), i.pos || (i.pos = "left"), i.offset || (i.offset = 0), i.mode || (i.mode = "span"), i.stroke || (i.stroke = BASE_LINE_COLOR), i.className || (i.className = ""); var a = -1 * AXIS_TICK_LENGTH, r = i.mode === "span" ? n + AXIS_TICK_LENGTH : 0; return i.mode === "tick" && i.pos === "right" && (a = n + AXIS_TICK_LENGTH, r = n), a += i.offset, r += i.offset, makeHoriLine(t7, e, a, r, { stroke: i.stroke, className: i.className, lineType: i.lineType, shortenNumbers: i.shortenNumbers }); } function xLine(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; isValidNumber(t7) || (t7 = 0), i.pos || (i.pos = "bottom"), i.offset || (i.offset = 0), i.mode || (i.mode = "span"), i.stroke || (i.stroke = BASE_LINE_COLOR), i.className || (i.className = ""); var a = n + AXIS_TICK_LENGTH, r = i.mode === "span" ? -1 * AXIS_TICK_LENGTH : n; return i.mode === "tick" && i.pos === "top" && (a = -1 * AXIS_TICK_LENGTH, r = 0), makeVertLine(t7, e, a, r, { stroke: i.stroke, className: i.className, lineType: i.lineType }); } function yMarker(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; i.labelPos || (i.labelPos = "right"); var a = createSVG("text", { className: "chart-label", x: i.labelPos === "left" ? LABEL_MARGIN : n - getStringWidth(e, 5) - LABEL_MARGIN, y: 0, dy: FONT_SIZE / -2 + "px", "font-size": FONT_SIZE + "px", "text-anchor": "start", innerHTML: e + "" }), r = makeHoriLine(t7, "", 0, n, { stroke: i.stroke || BASE_LINE_COLOR, className: i.className || "", lineType: i.lineType }); return r.appendChild(a), r; } function yRegion(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, r = t7 - e, o = createSVG("rect", { className: "bar mini", styles: { fill: "rgba(228, 234, 239, 0.49)", stroke: BASE_LINE_COLOR, "stroke-dasharray": n + ", " + r }, x: 0, y: 0, width: n, height: r }); a.labelPos || (a.labelPos = "right"); var s = createSVG("text", { className: "chart-label", x: a.labelPos === "left" ? LABEL_MARGIN : n - getStringWidth(i + "", 4.5) - LABEL_MARGIN, y: 0, dy: FONT_SIZE / -2 + "px", "font-size": FONT_SIZE + "px", "text-anchor": "start", innerHTML: i + "" }), l = createSVG("g", { transform: "translate(0, " + e + ")" }); return l.appendChild(o), l.appendChild(s), l; } function datasetBar(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "", r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0, s = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : {}, l = getBarHeightAndYAttr(e, s.zeroLine), u = _slicedToArray(l, 2), c = u[0], h = u[1]; h -= o, c === 0 && (c = s.minHeight, h -= s.minHeight), isValidNumber(t7) || (t7 = 0), isValidNumber(h) || (h = 0), isValidNumber(c, true) || (c = 0), isValidNumber(n, true) || (n = 0); var d = createSVG("rect", { className: "bar mini", style: "fill: " + i, "data-point-index": r, x: t7, y: h, width: n, height: c }); if ((a += "") || a.length) { d.setAttribute("y", 0), d.setAttribute("x", 0); var f = createSVG("text", { className: "data-point-value", x: n / 2, y: 0, dy: FONT_SIZE / 2 * -1 + "px", "font-size": FONT_SIZE + "px", "text-anchor": "middle", innerHTML: a }), p = createSVG("g", { "data-point-index": r, transform: "translate(" + t7 + ", " + h + ")" }); return p.appendChild(d), p.appendChild(f), p; } return d; } function datasetDot(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "", r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, o = createSVG("circle", { style: "fill: " + i, "data-point-index": r, cx: t7, cy: e, r: n }); if ((a += "") || a.length) { o.setAttribute("cy", 0), o.setAttribute("cx", 0); var s = createSVG("text", { className: "data-point-value", x: 0, y: 0, dy: FONT_SIZE / 2 * -1 - n + "px", "font-size": FONT_SIZE + "px", "text-anchor": "middle", innerHTML: a }), l = createSVG("g", { "data-point-index": r, transform: "translate(" + t7 + ", " + e + ")" }); return l.appendChild(o), l.appendChild(s), l; } return o; } function getPaths(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, r = e.map(function(e2, n2) { return t7[n2] + "," + e2; }).join("L"); i.spline && (r = getSplineCurvePointsStr(t7, e)); var o = makePath("M" + r, "line-graph-path", n); if (i.heatline) { var s = makeGradient(a.svgDefs, n); o.style.stroke = "url(#" + s + ")"; } var l = { path: o }; if (i.regionFill) { var u = makeGradient(a.svgDefs, n, true), c = "M" + t7[0] + "," + a.zeroLine + "L" + r + "L" + t7.slice(-1)[0] + "," + a.zeroLine; l.region = makePath(c, "region-fill", "none", "url(#" + u + ")"); } return l; } function translate(t7, e, n, i) { var a = typeof e == "string" ? e : e.join(", "); return [t7, { transform: n.join(", ") }, i, STD_EASING, "translate", { transform: a }]; } function translateVertLine(t7, e, n) { return translate(t7, [n, 0], [e, 0], MARKER_LINE_ANIM_DUR); } function translateHoriLine(t7, e, n) { return translate(t7, [0, n], [0, e], MARKER_LINE_ANIM_DUR); } function animateRegion(t7, e, n, i) { var a = e - n, r = t7.childNodes[0]; return [[r, { height: a, "stroke-dasharray": r.getAttribute("width") + ", " + a }, MARKER_LINE_ANIM_DUR, STD_EASING], translate(t7, [0, i], [0, n], MARKER_LINE_ANIM_DUR)]; } function animateBar(t7, e, n, i) { var a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0, r = getBarHeightAndYAttr(n, (arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}).zeroLine), o = _slicedToArray$2(r, 2), s = o[0], l = o[1]; return l -= a, t7.nodeName !== "rect" ? [[t7.childNodes[0], { width: i, height: s }, UNIT_ANIM_DUR, STD_EASING], translate(t7, t7.getAttribute("transform").split("(")[1].slice(0, -1), [e, l], MARKER_LINE_ANIM_DUR)] : [[t7, { width: i, height: s, x: e, y: l }, UNIT_ANIM_DUR, STD_EASING]]; } function animateDot(t7, e, n) { return t7.nodeName !== "circle" ? [translate(t7, t7.getAttribute("transform").split("(")[1].slice(0, -1), [e, n], MARKER_LINE_ANIM_DUR)] : [[t7, { cx: e, cy: n }, UNIT_ANIM_DUR, STD_EASING]]; } function animatePath(t7, e, n, i, a) { var r = [], o = n.map(function(t8, n2) { return e[n2] + "," + t8; }).join("L"); a && (o = getSplineCurvePointsStr(e, n)); var s = [t7.path, { d: "M" + o }, PATH_ANIM_DUR, STD_EASING]; if (r.push(s), t7.region) { var l = e[0] + "," + i + "L", u = "L" + e.slice(-1)[0] + ", " + i, c = [t7.region, { d: "M" + l + o + u }, PATH_ANIM_DUR, STD_EASING]; r.push(c); } return r; } function animatePathStr(t7, e) { return [t7, { d: e }, UNIT_ANIM_DUR, STD_EASING]; } function _toConsumableArray$1(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function animateSVGElement(t7, e, n) { var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "linear", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : void 0, r = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, o = t7.cloneNode(true), s = t7.cloneNode(true); for (var l in e) { var u = void 0; u = l === "transform" ? document.createElementNS("http://www.w3.org/2000/svg", "animateTransform") : document.createElementNS("http://www.w3.org/2000/svg", "animate"); var c = r[l] || t7.getAttribute(l), h = e[l], d = { attributeName: l, from: c, to: h, begin: "0s", dur: n / 1e3 + "s", values: c + ";" + h, keySplines: EASING[i], keyTimes: "0;1", calcMode: "spline", fill: "freeze" }; a && (d.type = a); for (var f in d) u.setAttribute(f, d[f]); o.appendChild(u), a ? s.setAttribute(l, "translate(" + h + ")") : s.setAttribute(l, h); } return [o, s]; } function transform(t7, e) { t7.style.transform = e, t7.style.webkitTransform = e, t7.style.msTransform = e, t7.style.mozTransform = e, t7.style.oTransform = e; } function animateSVG(t7, e) { var n = [], i = []; e.map(function(t8) { var e2 = t8[0], a2 = e2.parentNode, r = void 0, o = void 0; t8[0] = e2; var s = animateSVGElement.apply(void 0, _toConsumableArray$1(t8)), l = _slicedToArray$1(s, 2); r = l[0], o = l[1], n.push(o), i.push([r, a2]), a2 && a2.replaceChild(r, e2); }); var a = t7.cloneNode(true); return i.map(function(t8, i2) { t8[1] && (t8[1].replaceChild(n[i2], t8[0]), e[i2][0] = n[i2]); }), a; } function runSMILAnimation(t7, e, n) { if (n.length !== 0) { var i = animateSVG(e, n); e.parentNode == t7 && (t7.removeChild(e), t7.appendChild(i)), setTimeout(function() { i.parentNode == t7 && (t7.removeChild(i), t7.appendChild(e)); }, REPLACE_ALL_NEW_DUR); } } function downloadFile(t7, e) { var n = document.createElement("a"); n.style = "display: none"; var i = new Blob(e, { type: "image/svg+xml; charset=utf-8" }), a = window.URL.createObjectURL(i); n.href = a, n.download = t7, document.body.appendChild(n), n.click(), setTimeout(function() { document.body.removeChild(n), window.URL.revokeObjectURL(a); }, 300); } function prepareForExport(t7) { var e = t7.cloneNode(true); e.classList.add("chart-container"), e.setAttribute("xmlns", "http://www.w3.org/2000/svg"), e.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); var n = $.create("style", { innerHTML: CSSTEXT }); e.insertBefore(n, e.firstChild); var i = $.create("div"); return i.appendChild(e), i.innerHTML; } function _classCallCheck$3(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _classCallCheck$2(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn$1(t7, e) { if (!t7) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || typeof e != "object" && typeof e != "function" ? t7 : e; } function _inherits$1(t7, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); } function treatAsUtc(t7) { var e = new Date(t7); return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e; } function getYyyyMmDd(t7) { var e = t7.getDate(), n = t7.getMonth() + 1; return [t7.getFullYear(), (n > 9 ? "" : "0") + n, (e > 9 ? "" : "0") + e].join("-"); } function clone(t7) { return new Date(t7.getTime()); } function getWeeksBetween(t7, e) { var n = setDayToSunday(t7); return Math.ceil(getDaysBetween(n, e) / NO_OF_DAYS_IN_WEEK); } function getDaysBetween(t7, e) { var n = SEC_IN_DAY * NO_OF_MILLIS; return (treatAsUtc(e) - treatAsUtc(t7)) / n; } function areInSameMonth(t7, e) { return t7.getMonth() === e.getMonth() && t7.getFullYear() === e.getFullYear(); } function getMonthName(t7) { var e = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], n = MONTH_NAMES[t7]; return e ? n.slice(0, 3) : n; } function getLastDateInMonth(t7, e) { return new Date(e, t7 + 1, 0); } function setDayToSunday(t7) { var e = clone(t7), n = e.getDay(); return n !== 0 && addDays(e, -1 * n), e; } function addDays(t7, e) { t7.setDate(t7.getDate() + e); } function _classCallCheck$5(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function getComponent(t7, e, n) { var i = Object.keys(componentConfigs).filter(function(e2) { return t7.includes(e2); }), a = componentConfigs[i[0]]; return Object.assign(a, { constants: e, getData: n }), new ChartComponent(a); } function _toConsumableArray(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function _classCallCheck$1(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn(t7, e) { if (!t7) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || typeof e != "object" && typeof e != "function" ? t7 : e; } function _inherits(t7, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); } function _toConsumableArray$2(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function _classCallCheck$6(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn$2(t7, e) { if (!t7) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || typeof e != "object" && typeof e != "function" ? t7 : e; } function _inherits$2(t7, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); } function _toConsumableArray$4(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function normalize(t7) { if (t7 === 0) return [0, 0]; if (isNaN(t7)) return { mantissa: -6755399441055744, exponent: 972 }; var e = t7 > 0 ? 1 : -1; if (!isFinite(t7)) return { mantissa: 4503599627370496 * e, exponent: 972 }; t7 = Math.abs(t7); var n = Math.floor(Math.log10(t7)); return [e * (t7 / Math.pow(10, n)), n]; } function getChartRangeIntervals(t7) { var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = Math.ceil(t7), i = Math.floor(e), a = n - i, r = a, o = 1; a > 5 && (a % 2 != 0 && (a = ++n - i), r = a / 2, o = 2), a <= 2 && (o = a / (r = 4)), a === 0 && (r = 5, o = 1); for (var s = [], l = 0; l <= r; l++) s.push(i + o * l); return s; } function getChartIntervals(t7) { var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = normalize(t7), i = _slicedToArray$4(n, 2), a = i[0], r = i[1], o = e ? e / Math.pow(10, r) : 0, s = getChartRangeIntervals(a = a.toFixed(6), o); return s = s.map(function(t8) { return t8 * Math.pow(10, r); }); } function calcChartIntervals(t7) { function e(t8, e2) { for (var n2 = getChartIntervals(t8), i2 = n2[1] - n2[0], a2 = 0, r2 = 1; a2 < e2; r2++) a2 += i2, n2.unshift(-1 * a2); return n2; } var n = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = Math.max.apply(Math, _toConsumableArray$4(t7)), a = Math.min.apply(Math, _toConsumableArray$4(t7)), r = []; if (i >= 0 && a >= 0) normalize(i)[1], r = n ? getChartIntervals(i, a) : getChartIntervals(i); else if (i > 0 && a < 0) { var o = Math.abs(a); i >= o ? (normalize(i)[1], r = e(i, o)) : (normalize(o)[1], r = e(o, i).reverse().map(function(t8) { return -1 * t8; })); } else if (i <= 0 && a <= 0) { var s = Math.abs(a), l = Math.abs(i); normalize(s)[1], r = (r = n ? getChartIntervals(s, l) : getChartIntervals(s)).reverse().map(function(t8) { return -1 * t8; }); } return r; } function getZeroIndex(t7) { var e = getIntervalSize(t7); return t7.indexOf(0) >= 0 ? t7.indexOf(0) : t7[0] > 0 ? -1 * t7[0] / e : -1 * t7[t7.length - 1] / e + (t7.length - 1); } function getIntervalSize(t7) { return t7[1] - t7[0]; } function getValueRange(t7) { return t7[t7.length - 1] - t7[0]; } function scale(t7, e) { return floatTwo(e.zeroLine - t7 * e.scaleMultiplier); } function getClosestInArray(t7, e) { var n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], i = e.reduce(function(e2, n2) { return Math.abs(n2 - t7) < Math.abs(e2 - t7) ? n2 : e2; }, []); return n ? e.indexOf(i) : i; } function calcDistribution(t7, e) { for (var n = Math.max.apply(Math, _toConsumableArray$4(t7)), i = 1 / (e - 1), a = [], r = 0; r < e; r++) { var o = n * (i * r); a.push(o); } return a; } function getMaxCheckpoint(t7, e) { return e.filter(function(e2) { return e2 < t7; }).length; } function _toConsumableArray$3(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function _classCallCheck$7(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn$3(t7, e) { if (!t7) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || typeof e != "object" && typeof e != "function" ? t7 : e; } function _inherits$3(t7, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); } function _toConsumableArray$6(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function dataPrep(t7, e) { t7.labels = t7.labels || []; var n = t7.labels.length, i = t7.datasets, a = new Array(n).fill(0); return i || (i = [{ values: a }]), i.map(function(t8) { if (t8.values) { var i2 = t8.values; i2 = (i2 = i2.map(function(t9) { return isNaN(t9) ? 0 : t9; })).length > n ? i2.slice(0, n) : fillArray(i2, n - i2.length, 0), t8.values = i2; } else t8.values = a; t8.chartType || (AXIS_DATASET_CHART_TYPES.includes(e), t8.chartType = e); }), t7.yRegions && t7.yRegions.map(function(t8) { if (t8.end < t8.start) { var e2 = [t8.end, t8.start]; t8.start = e2[0], t8.end = e2[1]; } }), t7; } function zeroDataPrep(t7) { var e = t7.labels.length, n = new Array(e).fill(0), i = { labels: t7.labels.slice(0, -1), datasets: t7.datasets.map(function(t8) { return { name: "", values: n.slice(0, -1), chartType: t8.chartType }; }) }; return t7.yMarkers && (i.yMarkers = [{ value: 0, label: "" }]), t7.yRegions && (i.yRegions = [{ start: 0, end: 0, label: "" }]), i; } function getShortenedLabels(t7) { var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], n = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2], i = t7 / e.length; i <= 0 && (i = 1); var a = i / DEFAULT_CHAR_WIDTH, r = void 0; if (n) { var o = Math.max.apply(Math, _toConsumableArray$6(e.map(function(t8) { return t8.length; }))); r = Math.ceil(o / a); } return e.map(function(t8, e2) { return (t8 += "").length > a && (n ? e2 % r != 0 && (t8 = "") : t8 = a - 3 > 0 ? t8.slice(0, a - 3) + " ..." : t8.slice(0, a) + ".."), t8; }); } function _toConsumableArray$5(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function _classCallCheck$8(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn$4(t7, e) { if (!t7) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || typeof e != "object" && typeof e != "function" ? t7 : e; } function _inherits$4(t7, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); } function _toConsumableArray$7(t7) { if (Array.isArray(t7)) { for (var e = 0, n = Array(t7.length); e < t7.length; e++) n[e] = t7[e]; return n; } return Array.from(t7); } function _classCallCheck$9(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn$5(t7, e) { if (!t7) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || typeof e != "object" && typeof e != "function" ? t7 : e; } function _inherits$5(t7, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t7.prototype = Object.create(e && e.prototype, { constructor: { value: t7, enumerable: false, writable: true, configurable: true } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t7, e) : t7.__proto__ = e); } function _classCallCheck(t7, e) { if (!(t7 instanceof e)) throw new TypeError("Cannot call a class as a function"); } function getChartByType() { var t7 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "line", e = arguments[1], n = arguments[2]; return t7 === "axis-mixed" ? (n.type = "line", new AxisChart(e, n)) : chartTypes[t7] ? new chartTypes[t7](e, n) : void console.error("Undefined chart type: " + t7); } var css_248z = '.chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ol,.graph-svg-tip ul{padding-left:0;display:-webkit-box;display:-ms-flexbox;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:" ";border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}'; styleInject(css_248z); var _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t7) { return typeof t7; } : function(t7) { return t7 && typeof Symbol == "function" && t7.constructor === Symbol && t7 !== Symbol.prototype ? "symbol" : typeof t7; }; $.create = function(t7, e) { var n = document.createElement(t7); for (var i in e) { var a = e[i]; if (i === "inside") $(a).appendChild(n); else if (i === "around") { var r = $(a); r.parentNode.insertBefore(n, r), n.appendChild(r); } else i === "styles" ? (a === void 0 ? "undefined" : _typeof(a)) === "object" && Object.keys(a).map(function(t8) { n.style[t8] = a[t8]; }) : i in n ? n[i] = a : n.setAttribute(i, a); } return n; }; var BASE_MEASURES = { margins: { top: 10, bottom: 10, left: 20, right: 20 }, paddings: { top: 20, bottom: 40, left: 30, right: 10 }, baseHeight: 240, titleHeight: 20, legendHeight: 30, titleFontSize: 12 }; var INIT_CHART_UPDATE_TIMEOUT = 700; var CHART_POST_ANIMATE_TIMEOUT = 400; var AXIS_DATASET_CHART_TYPES = ["line", "bar"]; var AXIS_LEGEND_BAR_SIZE = 100; var BAR_CHART_SPACE_RATIO = 0.5; var MIN_BAR_PERCENT_HEIGHT = 0; var LINE_CHART_DOT_SIZE = 4; var DOT_OVERLAY_SIZE_INCR = 4; var PERCENTAGE_BAR_DEFAULT_HEIGHT = 20; var PERCENTAGE_BAR_DEFAULT_DEPTH = 2; var HEATMAP_DISTRIBUTION_SIZE = 5; var HEATMAP_SQUARE_SIZE = 10; var HEATMAP_GUTTER_SIZE = 2; var DEFAULT_CHAR_WIDTH = 7; var TOOLTIP_POINTER_TRIANGLE_HEIGHT = 5; var DEFAULT_CHART_COLORS = ["light-blue", "blue", "violet", "red", "orange", "yellow", "green", "light-green", "purple", "magenta", "light-grey", "dark-grey"]; var HEATMAP_COLORS_GREEN = ["#ebedf0", "#c6e48b", "#7bc96f", "#239a3b", "#196127"]; var DEFAULT_COLORS = { bar: DEFAULT_CHART_COLORS, line: DEFAULT_CHART_COLORS, pie: DEFAULT_CHART_COLORS, percentage: DEFAULT_CHART_COLORS, heatmap: HEATMAP_COLORS_GREEN, donut: DEFAULT_CHART_COLORS }; var ANGLE_RATIO = Math.PI / 180; var FULL_ANGLE = 360; var _createClass$3 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var SvgTip = function() { function t7(e) { var n = e.parent, i = n === void 0 ? null : n, a = e.colors, r = a === void 0 ? [] : a; _classCallCheck$4(this, t7), this.parent = i, this.colors = r, this.titleName = "", this.titleValue = "", this.listValues = [], this.titleValueFirst = 0, this.x = 0, this.y = 0, this.top = 0, this.left = 0, this.setup(); } return _createClass$3(t7, [{ key: "setup", value: function() { this.makeTooltip(); } }, { key: "refresh", value: function() { this.fill(), this.calcPosition(); } }, { key: "makeTooltip", value: function() { var t8 = this; this.container = $.create("div", { inside: this.parent, className: "graph-svg-tip comparison", innerHTML: '\n \n
' }), this.hideTip(), this.title = this.container.querySelector(".title"), this.dataPointList = this.container.querySelector(".data-point-list"), this.parent.addEventListener("mouseleave", function() { t8.hideTip(); }); } }, { key: "fill", value: function() { var t8 = this, e = void 0; this.index && this.container.setAttribute("data-point-index", this.index), e = this.titleValueFirst ? "" + this.titleValue + "" + this.titleName : this.titleName + "" + this.titleValue + "", this.title.innerHTML = e, this.dataPointList.innerHTML = "", this.listValues.map(function(e2, n) { var i = t8.colors[n] || "black", a = e2.formatted === 0 || e2.formatted ? e2.formatted : e2.value, r = $.create("li", { styles: { "border-top": "3px solid " + i }, innerHTML: '' + (a === 0 || a ? a : "") + "\n " + (e2.title ? e2.title : "") }); t8.dataPointList.appendChild(r); }); } }, { key: "calcPosition", value: function() { var t8 = this.container.offsetWidth; this.top = this.y - this.container.offsetHeight - TOOLTIP_POINTER_TRIANGLE_HEIGHT, this.left = this.x - t8 / 2; var e = this.parent.offsetWidth - t8, n = this.container.querySelector(".svg-pointer"); if (this.left < 0) n.style.left = "calc(50% - " + -1 * this.left + "px)", this.left = 0; else if (this.left > e) { var i = "calc(50% + " + (this.left - e) + "px)"; n.style.left = i, this.left = e; } else n.style.left = "50%"; } }, { key: "setValues", value: function(t8, e) { var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [], a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1; this.titleName = n.name, this.titleValue = n.value, this.listValues = i, this.x = t8, this.y = e, this.titleValueFirst = n.valueFirst || 0, this.index = a, this.refresh(); } }, { key: "hideTip", value: function() { this.container.style.top = "0px", this.container.style.left = "0px", this.container.style.opacity = "0"; } }, { key: "showTip", value: function() { this.container.style.top = this.top + "px", this.container.style.left = this.left + "px", this.container.style.opacity = "1"; } }]), t7; }(); var _typeof$2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t7) { return typeof t7; } : function(t7) { return t7 && typeof Symbol == "function" && t7.constructor === Symbol && t7 !== Symbol.prototype ? "symbol" : typeof t7; }; var PRESET_COLOR_MAP = { "light-blue": "#7cd6fd", blue: "#5e64ff", violet: "#743ee2", red: "#ff5858", orange: "#ffa00a", yellow: "#feef72", green: "#28a745", "light-green": "#98d85b", purple: "#b554ff", magenta: "#ffa3ef", black: "#36114C", grey: "#bdd3e6", "light-grey": "#f0f4f7", "dark-grey": "#b8c2cc" }; var getColor = function(t7) { return /rgb[a]{0,1}\([\d, ]+\)/gim.test(t7) ? /\D+(\d*)\D+(\d*)\D+(\d*)/gim.exec(t7).map(function(t8, e) { return e !== 0 ? Number(t8).toString(16) : "#"; }).reduce(function(t8, e) { return "" + t8 + e; }) : PRESET_COLOR_MAP[t7] || t7; }; var _slicedToArray = function() { function t7(t8, e) { var n = [], i = true, a = false, r = void 0; try { for (var o, s = t8[Symbol.iterator](); !(i = (o = s.next()).done) && (n.push(o.value), !e || n.length !== e); i = true) ; } catch (t9) { a = true, r = t9; } finally { try { !i && s.return && s.return(); } finally { if (a) throw r; } } return n; } return function(e, n) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return t7(e, n); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; }(); var _typeof$1 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t7) { return typeof t7; } : function(t7) { return t7 && typeof Symbol == "function" && t7.constructor === Symbol && t7 !== Symbol.prototype ? "symbol" : typeof t7; }; var AXIS_TICK_LENGTH = 6; var LABEL_MARGIN = 4; var LABEL_MAX_CHARS = 15; var FONT_SIZE = 10; var BASE_LINE_COLOR = "#dadada"; var FONT_FILL = "#555b51"; var makeOverlay = { bar: function(t7) { var e = void 0; t7.nodeName !== "rect" && (e = t7.getAttribute("transform"), t7 = t7.childNodes[0]); var n = t7.cloneNode(); return n.style.fill = "#000000", n.style.opacity = "0.4", e && n.setAttribute("transform", e), n; }, dot: function(t7) { var e = void 0; t7.nodeName !== "circle" && (e = t7.getAttribute("transform"), t7 = t7.childNodes[0]); var n = t7.cloneNode(), i = t7.getAttribute("r"), a = t7.getAttribute("fill"); return n.setAttribute("r", parseInt(i) + DOT_OVERLAY_SIZE_INCR), n.setAttribute("fill", a), n.style.opacity = "0.6", e && n.setAttribute("transform", e), n; }, heat_square: function(t7) { var e = void 0; t7.nodeName !== "circle" && (e = t7.getAttribute("transform"), t7 = t7.childNodes[0]); var n = t7.cloneNode(), i = t7.getAttribute("r"), a = t7.getAttribute("fill"); return n.setAttribute("r", parseInt(i) + DOT_OVERLAY_SIZE_INCR), n.setAttribute("fill", a), n.style.opacity = "0.6", e && n.setAttribute("transform", e), n; } }; var updateOverlay = { bar: function(t7, e) { var n = void 0; t7.nodeName !== "rect" && (n = t7.getAttribute("transform"), t7 = t7.childNodes[0]); var i = ["x", "y", "width", "height"]; Object.values(t7.attributes).filter(function(t8) { return i.includes(t8.name) && t8.specified; }).map(function(t8) { e.setAttribute(t8.name, t8.nodeValue); }), n && e.setAttribute("transform", n); }, dot: function(t7, e) { var n = void 0; t7.nodeName !== "circle" && (n = t7.getAttribute("transform"), t7 = t7.childNodes[0]); var i = ["cx", "cy"]; Object.values(t7.attributes).filter(function(t8) { return i.includes(t8.name) && t8.specified; }).map(function(t8) { e.setAttribute(t8.name, t8.nodeValue); }), n && e.setAttribute("transform", n); }, heat_square: function(t7, e) { var n = void 0; t7.nodeName !== "circle" && (n = t7.getAttribute("transform"), t7 = t7.childNodes[0]); var i = ["cx", "cy"]; Object.values(t7.attributes).filter(function(t8) { return i.includes(t8.name) && t8.specified; }).map(function(t8) { e.setAttribute(t8.name, t8.nodeValue); }), n && e.setAttribute("transform", n); } }; var _slicedToArray$2 = function() { function t7(t8, e) { var n = [], i = true, a = false, r = void 0; try { for (var o, s = t8[Symbol.iterator](); !(i = (o = s.next()).done) && (n.push(o.value), !e || n.length !== e); i = true) ; } catch (t9) { a = true, r = t9; } finally { try { !i && s.return && s.return(); } finally { if (a) throw r; } } return n; } return function(e, n) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return t7(e, n); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; }(); var UNIT_ANIM_DUR = 350; var PATH_ANIM_DUR = 350; var MARKER_LINE_ANIM_DUR = UNIT_ANIM_DUR; var REPLACE_ALL_NEW_DUR = 250; var STD_EASING = "easein"; var _slicedToArray$1 = function() { function t7(t8, e) { var n = [], i = true, a = false, r = void 0; try { for (var o, s = t8[Symbol.iterator](); !(i = (o = s.next()).done) && (n.push(o.value), !e || n.length !== e); i = true) ; } catch (t9) { a = true, r = t9; } finally { try { !i && s.return && s.return(); } finally { if (a) throw r; } } return n; } return function(e, n) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return t7(e, n); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; }(); var EASING = { ease: "0.25 0.1 0.25 1", linear: "0 0 1 1", easein: "0.1 0.8 0.2 1", easeout: "0 0 0.58 1", easeinout: "0.42 0 0.58 1" }; var CSSTEXT = ".chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans','Droid Sans','Helvetica Neue',sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ul{padding-left:0;display:flex}.graph-svg-tip ol{padding-left:0;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:' ';border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}"; var _createClass$2 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var BaseChart = function() { function t7(e, n) { if (_classCallCheck$3(this, t7), n = deepClone(n), this.parent = typeof e == "string" ? document.querySelector(e) : e, !(this.parent instanceof HTMLElement)) throw new Error("No `parent` element to render on was provided."); this.rawChartArgs = n, this.title = n.title || "", this.type = n.type || "", this.realData = this.prepareData(n.data), this.data = this.prepareFirstData(this.realData), this.colors = this.validateColors(n.colors, this.type), this.config = { showTooltip: 1, showLegend: 1, isNavigable: n.isNavigable || 0, animate: n.animate !== void 0 ? n.animate : 1, truncateLegends: n.truncateLegends || 1 }, this.measures = JSON.parse(JSON.stringify(BASE_MEASURES)); var i = this.measures; this.setMeasures(n), this.title.length || (i.titleHeight = 0), this.config.showLegend || (i.legendHeight = 0), this.argHeight = n.height || i.baseHeight, this.state = {}, this.options = {}, this.initTimeout = INIT_CHART_UPDATE_TIMEOUT, this.config.isNavigable && (this.overlays = []), this.configure(n); } return _createClass$2(t7, [{ key: "prepareData", value: function(t8) { return t8; } }, { key: "prepareFirstData", value: function(t8) { return t8; } }, { key: "validateColors", value: function(t8, e) { var n = []; return (t8 = (t8 || []).concat(DEFAULT_COLORS[e])).forEach(function(t9) { var e2 = getColor(t9); isValidColor(e2) ? n.push(e2) : console.warn('"' + t9 + '" is not a valid color.'); }), n; } }, { key: "setMeasures", value: function() { } }, { key: "configure", value: function() { var t8 = this, e = this.argHeight; this.baseHeight = e, this.height = e - getExtraHeight(this.measures), this.boundDrawFn = function() { return t8.draw(true); }, ResizeObserver && (this.resizeObserver = new ResizeObserver(this.boundDrawFn), this.resizeObserver.observe(this.parent)), window.addEventListener("resize", this.boundDrawFn), window.addEventListener("orientationchange", this.boundDrawFn); } }, { key: "destroy", value: function() { this.resizeObserver && this.resizeObserver.disconnect(), window.removeEventListener("resize", this.boundDrawFn), window.removeEventListener("orientationchange", this.boundDrawFn); } }, { key: "setup", value: function() { this.makeContainer(), this.updateWidth(), this.makeTooltip(), this.draw(false, true); } }, { key: "makeContainer", value: function() { this.parent.innerHTML = ""; var t8 = { inside: this.parent, className: "chart-container" }; this.independentWidth && (t8.styles = { width: this.independentWidth + "px" }), this.container = $.create("div", t8); } }, { key: "makeTooltip", value: function() { this.tip = new SvgTip({ parent: this.container, colors: this.colors }), this.bindTooltip(); } }, { key: "bindTooltip", value: function() { } }, { key: "draw", value: function() { var t8 = this, e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0], n = arguments.length > 1 && arguments[1] !== void 0 && arguments[1]; e && isHidden(this.parent) || (this.updateWidth(), this.calc(e), this.makeChartArea(), this.setupComponents(), this.components.forEach(function(e2) { return e2.setup(t8.drawArea); }), this.render(this.components, false), n && (this.data = this.realData, setTimeout(function() { t8.update(t8.data); }, this.initTimeout)), this.renderLegend(), this.setupNavigation(n)); } }, { key: "calc", value: function() { } }, { key: "updateWidth", value: function() { this.baseWidth = getElementContentWidth(this.parent), this.width = this.baseWidth - getExtraWidth(this.measures); } }, { key: "makeChartArea", value: function() { this.svg && this.container.removeChild(this.svg); var t8 = this.measures; this.svg = makeSVGContainer(this.container, "frappe-chart chart", this.baseWidth, this.baseHeight), this.svgDefs = makeSVGDefs(this.svg), this.title.length && (this.titleEL = makeText("title", t8.margins.left, t8.margins.top, this.title, { fontSize: t8.titleFontSize, fill: "#666666", dy: t8.titleFontSize })); var e = getTopOffset(t8); this.drawArea = makeSVGGroup(this.type + "-chart chart-draw-area", "translate(" + getLeftOffset(t8) + ", " + e + ")"), this.config.showLegend && (e += this.height + t8.paddings.bottom, this.legendArea = makeSVGGroup("chart-legend", "translate(" + getLeftOffset(t8) + ", " + e + ")")), this.title.length && this.svg.appendChild(this.titleEL), this.svg.appendChild(this.drawArea), this.config.showLegend && this.svg.appendChild(this.legendArea), this.updateTipOffset(getLeftOffset(t8), getTopOffset(t8)); } }, { key: "updateTipOffset", value: function(t8, e) { this.tip.offset = { x: t8, y: e }; } }, { key: "setupComponents", value: function() { this.components = new Map(); } }, { key: "update", value: function(t8) { t8 || console.error("No data to update."), this.data = this.prepareData(t8), this.calc(), this.render(this.components, this.config.animate), this.renderLegend(); } }, { key: "render", value: function() { var t8 = this, e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.components, n = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]; this.config.isNavigable && this.overlays.map(function(t9) { return t9.parentNode.removeChild(t9); }); var i = []; e.forEach(function(t9) { i = i.concat(t9.update(n)); }), i.length > 0 ? (runSMILAnimation(this.container, this.svg, i), setTimeout(function() { e.forEach(function(t9) { return t9.make(); }), t8.updateNav(); }, CHART_POST_ANIMATE_TIMEOUT)) : (e.forEach(function(t9) { return t9.make(); }), this.updateNav()); } }, { key: "updateNav", value: function() { this.config.isNavigable && (this.makeOverlay(), this.bindUnits()); } }, { key: "renderLegend", value: function() { } }, { key: "setupNavigation", value: function() { var t8 = this, e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0]; this.config.isNavigable && e && (this.bindOverlay(), this.keyActions = { 13: this.onEnterKey.bind(this), 37: this.onLeftArrow.bind(this), 38: this.onUpArrow.bind(this), 39: this.onRightArrow.bind(this), 40: this.onDownArrow.bind(this) }, document.addEventListener("keydown", function(e2) { isElementInViewport(t8.container) && (e2 = e2 || window.event, t8.keyActions[e2.keyCode] && t8.keyActions[e2.keyCode]()); })); } }, { key: "makeOverlay", value: function() { } }, { key: "updateOverlay", value: function() { } }, { key: "bindOverlay", value: function() { } }, { key: "bindUnits", value: function() { } }, { key: "onLeftArrow", value: function() { } }, { key: "onRightArrow", value: function() { } }, { key: "onUpArrow", value: function() { } }, { key: "onDownArrow", value: function() { } }, { key: "onEnterKey", value: function() { } }, { key: "addDataPoint", value: function() { } }, { key: "removeDataPoint", value: function() { } }, { key: "getDataPoint", value: function() { } }, { key: "setCurrentDataPoint", value: function() { } }, { key: "updateDataset", value: function() { } }, { key: "export", value: function() { var t8 = prepareForExport(this.svg); downloadFile(this.title || "Chart", [t8]); } }]), t7; }(); var _createClass$1 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var _get$1 = function t(e, n, i) { e === null && (e = Function.prototype); var a = Object.getOwnPropertyDescriptor(e, n); if (a === void 0) { var r = Object.getPrototypeOf(e); return r === null ? void 0 : t(r, n, i); } if ("value" in a) return a.value; var o = a.get; if (o !== void 0) return o.call(i); }; var AggregationChart = function(t7) { function e(t8, n) { return _classCallCheck$2(this, e), _possibleConstructorReturn$1(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t8, n)); } return _inherits$1(e, t7), _createClass$1(e, [{ key: "configure", value: function(t8) { _get$1(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "configure", this).call(this, t8), this.config.formatTooltipY = (t8.tooltipOptions || {}).formatTooltipY, this.config.maxSlices = t8.maxSlices || 20, this.config.maxLegendPoints = t8.maxLegendPoints || 20; } }, { key: "calc", value: function() { var t8 = this, e2 = this.state, n = this.config.maxSlices; e2.sliceTotals = []; var i = this.data.labels.map(function(e3, n2) { var i2 = 0; return t8.data.datasets.map(function(t9) { i2 += t9.values[n2]; }), [i2, e3]; }).filter(function(t9) { return t9[0] >= 0; }), a = i; if (i.length > n) { i.sort(function(t9, e3) { return e3[0] - t9[0]; }), a = i.slice(0, n - 1); var r = 0; i.slice(n - 1).map(function(t9) { r += t9[0]; }), a.push([r, "Rest"]), this.colors[n - 1] = "grey"; } e2.labels = [], a.map(function(t9) { e2.sliceTotals.push(round(t9[0])), e2.labels.push(t9[1]); }), e2.grandTotal = e2.sliceTotals.reduce(function(t9, e3) { return t9 + e3; }, 0), this.center = { x: this.width / 2, y: this.height / 2 }; } }, { key: "renderLegend", value: function() { var t8 = this, e2 = this.state; this.legendArea.textContent = "", this.legendTotals = e2.sliceTotals.slice(0, this.config.maxLegendPoints); var n = 0, i = 0; this.legendTotals.map(function(a, r) { var o = 150, s = Math.floor((t8.width - getExtraWidth(t8.measures)) / o); t8.legendTotals.length < s && (o = t8.width / t8.legendTotals.length), n > s && (n = 0, i += 20); var l = o * n + 5, u = t8.config.truncateLegends ? truncateString(e2.labels[r], o / 10) : e2.labels[r], c = t8.config.formatTooltipY ? t8.config.formatTooltipY(a) : a, h = legendDot(l, i, 5, t8.colors[r], u + ": " + c, false); t8.legendArea.appendChild(h), n++; }); } }]), e; }(BaseChart); var NO_OF_YEAR_MONTHS = 12; var NO_OF_DAYS_IN_WEEK = 7; var NO_OF_MILLIS = 1e3; var SEC_IN_DAY = 86400; var MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var DAY_NAMES_SHORT = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var _slicedToArray$3 = function() { function t7(t8, e) { var n = [], i = true, a = false, r = void 0; try { for (var o, s = t8[Symbol.iterator](); !(i = (o = s.next()).done) && (n.push(o.value), !e || n.length !== e); i = true) ; } catch (t9) { a = true, r = t9; } finally { try { !i && s.return && s.return(); } finally { if (a) throw r; } } return n; } return function(e, n) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return t7(e, n); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; }(); var _createClass$4 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var ChartComponent = function() { function t7(e) { var n = e.layerClass, i = n === void 0 ? "" : n, a = e.layerTransform, r = a === void 0 ? "" : a, o = e.constants, s = e.getData, l = e.makeElements, u = e.animateElements; _classCallCheck$5(this, t7), this.layerTransform = r, this.constants = o, this.makeElements = l, this.getData = s, this.animateElements = u, this.store = [], this.labels = [], this.layerClass = i, this.layerClass = typeof this.layerClass == "function" ? this.layerClass() : this.layerClass, this.refresh(); } return _createClass$4(t7, [{ key: "refresh", value: function(t8) { this.data = t8 || this.getData(); } }, { key: "setup", value: function(t8) { this.layer = makeSVGGroup(this.layerClass, this.layerTransform, t8); } }, { key: "make", value: function() { this.render(this.data), this.oldData = this.data; } }, { key: "render", value: function(t8) { var e = this; this.store = this.makeElements(t8), this.layer.textContent = "", this.store.forEach(function(t9) { e.layer.appendChild(t9); }), this.labels.forEach(function(t9) { e.layer.appendChild(t9); }); } }, { key: "update", value: function() { var t8 = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0]; this.refresh(); var e = []; return t8 && (e = this.animateElements(this.data) || []), e; } }]), t7; }(); var componentConfigs = { donutSlices: { layerClass: "donut-slices", makeElements: function(t7) { return t7.sliceStrings.map(function(e, n) { var i = makePath(e, "donut-path", t7.colors[n], "none", t7.strokeWidth); return i.style.transition = "transform .3s;", i; }); }, animateElements: function(t7) { return this.store.map(function(e, n) { return animatePathStr(e, t7.sliceStrings[n]); }); } }, pieSlices: { layerClass: "pie-slices", makeElements: function(t7) { return t7.sliceStrings.map(function(e, n) { var i = makePath(e, "pie-path", "none", t7.colors[n]); return i.style.transition = "transform .3s;", i; }); }, animateElements: function(t7) { return this.store.map(function(e, n) { return animatePathStr(e, t7.sliceStrings[n]); }); } }, percentageBars: { layerClass: "percentage-bars", makeElements: function(t7) { var e = this; return t7.xPositions.map(function(n, i) { return percentageBar(n, 0, t7.widths[i], e.constants.barHeight, e.constants.barDepth, t7.colors[i]); }); }, animateElements: function(t7) { if (t7) return []; } }, yAxis: { layerClass: "y axis", makeElements: function(t7) { var e = this; return t7.positions.map(function(n, i) { return yLine(n, t7.labels[i], e.constants.width, { mode: e.constants.mode, pos: e.constants.pos, shortenNumbers: e.constants.shortenNumbers }); }); }, animateElements: function(t7) { var e = t7.positions, n = t7.labels, i = this.oldData.positions, a = this.oldData.labels, r = equilizeNoOfElements(i, e), o = _slicedToArray$3(r, 2); i = o[0], e = o[1]; var s = equilizeNoOfElements(a, n), l = _slicedToArray$3(s, 2); return a = l[0], n = l[1], this.render({ positions: i, labels: n }), this.store.map(function(t8, n2) { return translateHoriLine(t8, e[n2], i[n2]); }); } }, xAxis: { layerClass: "x axis", makeElements: function(t7) { var e = this; return t7.positions.map(function(n, i) { return xLine(n, t7.calcLabels[i], e.constants.height, { mode: e.constants.mode, pos: e.constants.pos }); }); }, animateElements: function(t7) { var e = t7.positions, n = t7.calcLabels, i = this.oldData.positions, a = this.oldData.calcLabels, r = equilizeNoOfElements(i, e), o = _slicedToArray$3(r, 2); i = o[0], e = o[1]; var s = equilizeNoOfElements(a, n), l = _slicedToArray$3(s, 2); return a = l[0], n = l[1], this.render({ positions: i, calcLabels: n }), this.store.map(function(t8, n2) { return translateVertLine(t8, e[n2], i[n2]); }); } }, yMarkers: { layerClass: "y-markers", makeElements: function(t7) { var e = this; return t7.map(function(t8) { return yMarker(t8.position, t8.label, e.constants.width, { labelPos: t8.options.labelPos, mode: "span", lineType: "dashed" }); }); }, animateElements: function(t7) { var e = equilizeNoOfElements(this.oldData, t7), n = _slicedToArray$3(e, 2); this.oldData = n[0]; var i = (t7 = n[1]).map(function(t8) { return t8.position; }), a = t7.map(function(t8) { return t8.label; }), r = t7.map(function(t8) { return t8.options; }), o = this.oldData.map(function(t8) { return t8.position; }); return this.render(o.map(function(t8, e2) { return { position: o[e2], label: a[e2], options: r[e2] }; })), this.store.map(function(t8, e2) { return translateHoriLine(t8, i[e2], o[e2]); }); } }, yRegions: { layerClass: "y-regions", makeElements: function(t7) { var e = this; return t7.map(function(t8) { return yRegion(t8.startPos, t8.endPos, e.constants.width, t8.label, { labelPos: t8.options.labelPos }); }); }, animateElements: function(t7) { var e = equilizeNoOfElements(this.oldData, t7), n = _slicedToArray$3(e, 2); this.oldData = n[0]; var i = (t7 = n[1]).map(function(t8) { return t8.endPos; }), a = t7.map(function(t8) { return t8.label; }), r = t7.map(function(t8) { return t8.startPos; }), o = t7.map(function(t8) { return t8.options; }), s = this.oldData.map(function(t8) { return t8.endPos; }), l = this.oldData.map(function(t8) { return t8.startPos; }); this.render(s.map(function(t8, e2) { return { startPos: l[e2], endPos: s[e2], label: a[e2], options: o[e2] }; })); var u = []; return this.store.map(function(t8, e2) { u = u.concat(animateRegion(t8, r[e2], i[e2], s[e2])); }), u; } }, heatDomain: { layerClass: function() { return "heat-domain domain-" + this.constants.index; }, makeElements: function(t7) { var e = this, n = this.constants, i = n.index, a = n.colWidth, r = n.rowHeight, o = n.squareSize, s = n.radius, l = n.xTranslate, u = 0; return this.serializedSubDomains = [], t7.cols.map(function(t8, n2) { n2 === 1 && e.labels.push(makeText("domain-name", l, -12, getMonthName(i, true).toUpperCase(), { fontSize: 9 })), t8.map(function(t9, n3) { if (t9.fill) { var i2 = { "data-date": t9.yyyyMmDd, "data-value": t9.dataValue, "data-day": n3 }, a2 = heatSquare("day", l, u, o, s, t9.fill, i2); e.serializedSubDomains.push(a2); } u += r; }), u = 0, l += a; }), this.serializedSubDomains; }, animateElements: function(t7) { if (t7) return []; } }, barGraph: { layerClass: function() { return "dataset-units dataset-bars dataset-" + this.constants.index; }, makeElements: function(t7) { var e = this.constants; return this.unitType = "bar", this.units = t7.yPositions.map(function(n, i) { return datasetBar(t7.xPositions[i], n, t7.barWidth, e.color, t7.labels[i], i, t7.offsets[i], { zeroLine: t7.zeroLine, barsWidth: t7.barsWidth, minHeight: e.minHeight }); }), this.units; }, animateElements: function(t7) { var e = t7.xPositions, n = t7.yPositions, i = t7.offsets, a = t7.labels, r = this.oldData.xPositions, o = this.oldData.yPositions, s = this.oldData.offsets, l = this.oldData.labels, u = equilizeNoOfElements(r, e), c = _slicedToArray$3(u, 2); r = c[0], e = c[1]; var h = equilizeNoOfElements(o, n), d = _slicedToArray$3(h, 2); o = d[0], n = d[1]; var f = equilizeNoOfElements(s, i), p = _slicedToArray$3(f, 2); s = p[0], i = p[1]; var v = equilizeNoOfElements(l, a), g = _slicedToArray$3(v, 2); l = g[0], a = g[1], this.render({ xPositions: r, yPositions: o, offsets: s, labels: a, zeroLine: this.oldData.zeroLine, barsWidth: this.oldData.barsWidth, barWidth: this.oldData.barWidth }); var y = []; return this.store.map(function(a2, r2) { y = y.concat(animateBar(a2, e[r2], n[r2], t7.barWidth, i[r2], { zeroLine: t7.zeroLine })); }), y; } }, lineGraph: { layerClass: function() { return "dataset-units dataset-line dataset-" + this.constants.index; }, makeElements: function(t7) { var e = this.constants; return this.unitType = "dot", this.paths = {}, e.hideLine || (this.paths = getPaths(t7.xPositions, t7.yPositions, e.color, { heatline: e.heatline, regionFill: e.regionFill, spline: e.spline }, { svgDefs: e.svgDefs, zeroLine: t7.zeroLine })), this.units = [], e.hideDots || (this.units = t7.yPositions.map(function(n, i) { return datasetDot(t7.xPositions[i], n, t7.radius, e.color, e.valuesOverPoints ? t7.values[i] : "", i); })), Object.values(this.paths).concat(this.units); }, animateElements: function(t7) { var e = t7.xPositions, n = t7.yPositions, i = t7.values, a = this.oldData.xPositions, r = this.oldData.yPositions, o = this.oldData.values, s = equilizeNoOfElements(a, e), l = _slicedToArray$3(s, 2); a = l[0], e = l[1]; var u = equilizeNoOfElements(r, n), c = _slicedToArray$3(u, 2); r = c[0], n = c[1]; var h = equilizeNoOfElements(o, i), d = _slicedToArray$3(h, 2); o = d[0], i = d[1], this.render({ xPositions: a, yPositions: r, values: i, zeroLine: this.oldData.zeroLine, radius: this.oldData.radius }); var f = []; return Object.keys(this.paths).length && (f = f.concat(animatePath(this.paths, e, n, t7.zeroLine, this.constants.spline))), this.units.length && this.units.map(function(t8, i2) { f = f.concat(animateDot(t8, e[i2], n[i2])); }), f; } } }; var _createClass = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var _get = function t2(e, n, i) { e === null && (e = Function.prototype); var a = Object.getOwnPropertyDescriptor(e, n); if (a === void 0) { var r = Object.getPrototypeOf(e); return r === null ? void 0 : t2(r, n, i); } if ("value" in a) return a.value; var o = a.get; if (o !== void 0) return o.call(i); }; var PercentageChart = function(t7) { function e(t8, n) { _classCallCheck$1(this, e); var i = _possibleConstructorReturn(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t8, n)); return i.type = "percentage", i.setup(), i; } return _inherits(e, t7), _createClass(e, [{ key: "setMeasures", value: function(t8) { var e2 = this.measures; this.barOptions = t8.barOptions || {}; var n = this.barOptions; n.height = n.height || PERCENTAGE_BAR_DEFAULT_HEIGHT, n.depth = n.depth || PERCENTAGE_BAR_DEFAULT_DEPTH, e2.paddings.right = 30, e2.legendHeight = 60, e2.baseHeight = 8 * (n.height + 0.5 * n.depth); } }, { key: "setupComponents", value: function() { var t8 = this.state, e2 = [["percentageBars", { barHeight: this.barOptions.height, barDepth: this.barOptions.depth }, function() { return { xPositions: t8.xPositions, widths: t8.widths, colors: this.colors }; }.bind(this)]]; this.components = new Map(e2.map(function(t9) { var e3 = getComponent.apply(void 0, _toConsumableArray(t9)); return [t9[0], e3]; })); } }, { key: "calc", value: function() { var t8 = this; _get(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "calc", this).call(this); var n = this.state; n.xPositions = [], n.widths = []; var i = 0; n.sliceTotals.map(function(e2) { var a = t8.width * e2 / n.grandTotal; n.widths.push(a), n.xPositions.push(i), i += a; }); } }, { key: "makeDataByIndex", value: function() { } }, { key: "bindTooltip", value: function() { var t8 = this, e2 = this.state; this.container.addEventListener("mousemove", function(n) { var i = t8.components.get("percentageBars").store, a = n.target; if (i.includes(a)) { var r = i.indexOf(a), o = getOffset(t8.container), s = getOffset(a), l = s.left - o.left + parseInt(a.getAttribute("width")) / 2, u = s.top - o.top, c = (t8.formattedLabels && t8.formattedLabels.length > 0 ? t8.formattedLabels[r] : t8.state.labels[r]) + ": ", h = e2.sliceTotals[r] / e2.grandTotal; t8.tip.setValues(l, u, { name: c, value: (100 * h).toFixed(1) + "%" }), t8.tip.showTip(); } }); } }]), e; }(AggregationChart); var _createClass$5 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var _get$2 = function t3(e, n, i) { e === null && (e = Function.prototype); var a = Object.getOwnPropertyDescriptor(e, n); if (a === void 0) { var r = Object.getPrototypeOf(e); return r === null ? void 0 : t3(r, n, i); } if ("value" in a) return a.value; var o = a.get; if (o !== void 0) return o.call(i); }; var PieChart = function(t7) { function e(t8, n) { _classCallCheck$6(this, e); var i = _possibleConstructorReturn$2(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t8, n)); return i.type = "pie", i.initTimeout = 0, i.init = 1, i.setup(), i; } return _inherits$2(e, t7), _createClass$5(e, [{ key: "configure", value: function(t8) { _get$2(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "configure", this).call(this, t8), this.mouseMove = this.mouseMove.bind(this), this.mouseLeave = this.mouseLeave.bind(this), this.hoverRadio = t8.hoverRadio || 0.1, this.config.startAngle = t8.startAngle || 0, this.clockWise = t8.clockWise || false; } }, { key: "calc", value: function() { var t8 = this; _get$2(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "calc", this).call(this); var n = this.state; this.radius = this.height > this.width ? this.center.x : this.center.y; var i = this.radius, a = this.clockWise, r = n.slicesProperties || []; n.sliceStrings = [], n.slicesProperties = []; var o = 180 - this.config.startAngle; n.sliceTotals.map(function(e2, s) { var l = o, u = e2 / n.grandTotal * FULL_ANGLE, c = u > 180 ? 1 : 0, h = a ? -u : u, d = o += h, f = getPositionByAngle(l, i), p = getPositionByAngle(d, i), v = t8.init && r[s], g = void 0, y = void 0; t8.init ? (g = v ? v.startPosition : f, y = v ? v.endPosition : f) : (g = f, y = p); var m = u === 360 ? makeCircleStr(g, y, t8.center, t8.radius, a, c) : makeArcPathStr(g, y, t8.center, t8.radius, a, c); n.sliceStrings.push(m), n.slicesProperties.push({ startPosition: f, endPosition: p, value: e2, total: n.grandTotal, startAngle: l, endAngle: d, angle: h }); }), this.init = 0; } }, { key: "setupComponents", value: function() { var t8 = this.state, e2 = [["pieSlices", {}, function() { return { sliceStrings: t8.sliceStrings, colors: this.colors }; }.bind(this)]]; this.components = new Map(e2.map(function(t9) { var e3 = getComponent.apply(void 0, _toConsumableArray$2(t9)); return [t9[0], e3]; })); } }, { key: "calTranslateByAngle", value: function(t8) { var e2 = this.radius, n = this.hoverRadio, i = getPositionByAngle(t8.startAngle + t8.angle / 2, e2); return "translate3d(" + i.x * n + "px," + i.y * n + "px,0)"; } }, { key: "hoverSlice", value: function(t8, e2, n, i) { if (t8) { var a = this.colors[e2]; if (n) { transform(t8, this.calTranslateByAngle(this.state.slicesProperties[e2])), t8.style.fill = lightenDarkenColor(a, 50); var r = getOffset(this.svg), o = i.pageX - r.left + 10, s = i.pageY - r.top - 10, l = (this.formatted_labels && this.formatted_labels.length > 0 ? this.formatted_labels[e2] : this.state.labels[e2]) + ": ", u = (100 * this.state.sliceTotals[e2] / this.state.grandTotal).toFixed(1); this.tip.setValues(o, s, { name: l, value: u + "%" }), this.tip.showTip(); } else transform(t8, "translate3d(0,0,0)"), this.tip.hideTip(), t8.style.fill = a; } } }, { key: "bindTooltip", value: function() { this.container.addEventListener("mousemove", this.mouseMove), this.container.addEventListener("mouseleave", this.mouseLeave); } }, { key: "mouseMove", value: function(t8) { var e2 = t8.target, n = this.components.get("pieSlices").store, i = this.curActiveSliceIndex, a = this.curActiveSlice; if (n.includes(e2)) { var r = n.indexOf(e2); this.hoverSlice(a, i, false), this.curActiveSlice = e2, this.curActiveSliceIndex = r, this.hoverSlice(e2, r, true, t8); } else this.mouseLeave(); } }, { key: "mouseLeave", value: function() { this.hoverSlice(this.curActiveSlice, this.curActiveSliceIndex, false); } }]), e; }(AggregationChart); var _slicedToArray$4 = function() { function t7(t8, e) { var n = [], i = true, a = false, r = void 0; try { for (var o, s = t8[Symbol.iterator](); !(i = (o = s.next()).done) && (n.push(o.value), !e || n.length !== e); i = true) ; } catch (t9) { a = true, r = t9; } finally { try { !i && s.return && s.return(); } finally { if (a) throw r; } } return n; } return function(e, n) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return t7(e, n); throw new TypeError("Invalid attempt to destructure non-iterable instance"); }; }(); var _createClass$6 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var COL_WIDTH = HEATMAP_SQUARE_SIZE + HEATMAP_GUTTER_SIZE; var ROW_HEIGHT = COL_WIDTH; var Heatmap = function(t7) { function e(t8, n) { _classCallCheck$7(this, e); var i = _possibleConstructorReturn$3(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t8, n)); i.type = "heatmap", i.countLabel = n.countLabel || ""; var a = ["Sunday", "Monday"], r = a.includes(n.startSubDomain) ? n.startSubDomain : "Sunday"; return i.startSubDomainIndex = a.indexOf(r), i.setup(), i; } return _inherits$3(e, t7), _createClass$6(e, [{ key: "setMeasures", value: function(t8) { var e2 = this.measures; this.discreteDomains = t8.discreteDomains === 0 ? 0 : 1, e2.paddings.top = 3 * ROW_HEIGHT, e2.paddings.bottom = 0, e2.legendHeight = 2 * ROW_HEIGHT, e2.baseHeight = ROW_HEIGHT * NO_OF_DAYS_IN_WEEK + getExtraHeight(e2); var n = this.data, i = this.discreteDomains ? NO_OF_YEAR_MONTHS : 0; this.independentWidth = (getWeeksBetween(n.start, n.end) + i) * COL_WIDTH + getExtraWidth(e2); } }, { key: "updateWidth", value: function() { var t8 = this.discreteDomains ? NO_OF_YEAR_MONTHS : 0, e2 = this.state.noOfWeeks ? this.state.noOfWeeks : 52; this.baseWidth = (e2 + t8) * COL_WIDTH + getExtraWidth(this.measures); } }, { key: "prepareData", value: function() { var t8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.data; if (t8.start && t8.end && t8.start > t8.end) throw new Error("Start date cannot be greater than end date."); if (t8.start || (t8.start = new Date(), t8.start.setFullYear(t8.start.getFullYear() - 1)), t8.end || (t8.end = new Date()), t8.dataPoints = t8.dataPoints || {}, parseInt(Object.keys(t8.dataPoints)[0]) > 1e5) { var e2 = {}; Object.keys(t8.dataPoints).forEach(function(n) { var i = new Date(n * NO_OF_MILLIS); e2[getYyyyMmDd(i)] = t8.dataPoints[n]; }), t8.dataPoints = e2; } return t8; } }, { key: "calc", value: function() { var t8 = this.state; t8.start = clone(this.data.start), t8.end = clone(this.data.end), t8.firstWeekStart = clone(t8.start), t8.noOfWeeks = getWeeksBetween(t8.start, t8.end), t8.distribution = calcDistribution(Object.values(this.data.dataPoints), HEATMAP_DISTRIBUTION_SIZE), t8.domainConfigs = this.getDomains(); } }, { key: "setupComponents", value: function() { var t8 = this, e2 = this.state, n = this.discreteDomains ? 0 : 1, i = e2.domainConfigs.map(function(i2, a2) { return ["heatDomain", { index: i2.index, colWidth: COL_WIDTH, rowHeight: ROW_HEIGHT, squareSize: HEATMAP_SQUARE_SIZE, radius: t8.rawChartArgs.radius || 0, xTranslate: e2.domainConfigs.filter(function(t9, e3) { return e3 < a2; }).map(function(t9) { return t9.cols.length - n; }).reduce(function(t9, e3) { return t9 + e3; }, 0) * COL_WIDTH }, function() { return e2.domainConfigs[a2]; }.bind(t8)]; }); this.components = new Map(i.map(function(t9, e3) { var n2 = getComponent.apply(void 0, _toConsumableArray$3(t9)); return [t9[0] + "-" + e3, n2]; })); var a = 0; DAY_NAMES_SHORT.forEach(function(e3, n2) { if ([1, 3, 5].includes(n2)) { var i2 = makeText("subdomain-name", -COL_WIDTH / 2, a, e3, { fontSize: HEATMAP_SQUARE_SIZE, dy: 8, textAnchor: "end" }); t8.drawArea.appendChild(i2); } a += ROW_HEIGHT; }); } }, { key: "update", value: function(t8) { t8 || console.error("No data to update."), this.data = this.prepareData(t8), this.draw(), this.bindTooltip(); } }, { key: "bindTooltip", value: function() { var t8 = this; this.container.addEventListener("mousemove", function(e2) { t8.components.forEach(function(n) { var i = n.store, a = e2.target; if (i.includes(a)) { var r = a.getAttribute("data-value"), o = a.getAttribute("data-date").split("-"), s = getMonthName(parseInt(o[1]) - 1, true), l = t8.container.getBoundingClientRect(), u = a.getBoundingClientRect(), c = parseInt(e2.target.getAttribute("width")), h = u.left - l.left + c / 2, d = u.top - l.top, f = r + " " + t8.countLabel, p = " on " + s + " " + o[0] + ", " + o[2]; t8.tip.setValues(h, d, { name: p, value: f, valueFirst: 1 }, []), t8.tip.showTip(); } }); }); } }, { key: "renderLegend", value: function() { var t8 = this; this.legendArea.textContent = ""; var e2 = 0, n = ROW_HEIGHT, i = this.rawChartArgs.radius || 0, a = makeText("subdomain-name", e2, n, "Less", { fontSize: HEATMAP_SQUARE_SIZE + 1, dy: 9 }); e2 = 2 * COL_WIDTH + COL_WIDTH / 2, this.legendArea.appendChild(a), this.colors.slice(0, HEATMAP_DISTRIBUTION_SIZE).map(function(a2, r2) { var o = heatSquare("heatmap-legend-unit", e2 + (COL_WIDTH + 3) * r2, n, HEATMAP_SQUARE_SIZE, i, a2); t8.legendArea.appendChild(o); }); var r = makeText("subdomain-name", e2 + HEATMAP_DISTRIBUTION_SIZE * (COL_WIDTH + 3) + COL_WIDTH / 4, n, "More", { fontSize: HEATMAP_SQUARE_SIZE + 1, dy: 9 }); this.legendArea.appendChild(r); } }, { key: "getDomains", value: function() { for (var t8 = this.state, e2 = [t8.start.getMonth(), t8.start.getFullYear()], n = e2[0], i = e2[1], a = [t8.end.getMonth(), t8.end.getFullYear()], r = a[0] - n + 1 + 12 * (a[1] - i), o = [], s = clone(t8.start), l = 0; l < r; l++) { var u = t8.end; if (!areInSameMonth(s, t8.end)) { var c = [s.getMonth(), s.getFullYear()]; u = getLastDateInMonth(c[0], c[1]); } o.push(this.getDomainConfig(s, u)), addDays(u, 1), s = u; } return o; } }, { key: "getDomainConfig", value: function(t8) { var e2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", n = [t8.getMonth(), t8.getFullYear()], i = n[0], a = n[1], r = setDayToSunday(t8), o = { index: i, cols: [] }; addDays(e2 = clone(e2) || getLastDateInMonth(i, a), 1); for (var s = getWeeksBetween(r, e2), l = [], u = void 0, c = 0; c < s; c++) u = this.getCol(r, i), l.push(u), addDays(r = new Date(u[NO_OF_DAYS_IN_WEEK - 1].yyyyMmDd), 1); return u[NO_OF_DAYS_IN_WEEK - 1].dataValue !== void 0 && (addDays(r, 1), l.push(this.getCol(r, i, true))), o.cols = l, o; } }, { key: "getCol", value: function(t8, e2) { for (var n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], i = this.state, a = clone(t8), r = [], o = 0; o < NO_OF_DAYS_IN_WEEK; o++, addDays(a, 1)) { var s = {}, l = a >= i.start && a <= i.end; n || a.getMonth() !== e2 || !l ? s.yyyyMmDd = getYyyyMmDd(a) : s = this.getSubDomainConfig(a), r.push(s); } return r; } }, { key: "getSubDomainConfig", value: function(t8) { var e2 = getYyyyMmDd(t8), n = this.data.dataPoints[e2]; return { yyyyMmDd: e2, dataValue: n || 0, fill: this.colors[getMaxCheckpoint(n, this.state.distribution)] }; } }]), e; }(BaseChart); var _createClass$7 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var _get$3 = function t4(e, n, i) { e === null && (e = Function.prototype); var a = Object.getOwnPropertyDescriptor(e, n); if (a === void 0) { var r = Object.getPrototypeOf(e); return r === null ? void 0 : t4(r, n, i); } if ("value" in a) return a.value; var o = a.get; if (o !== void 0) return o.call(i); }; var AxisChart = function(t7) { function e(t8, n) { _classCallCheck$8(this, e); var i = _possibleConstructorReturn$4(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t8, n)); return i.barOptions = n.barOptions || {}, i.lineOptions = n.lineOptions || {}, i.type = n.type || "line", i.init = 1, i.setup(), i; } return _inherits$4(e, t7), _createClass$7(e, [{ key: "setMeasures", value: function() { this.data.datasets.length <= 1 && (this.config.showLegend = 0, this.measures.paddings.bottom = 30); } }, { key: "configure", value: function(t8) { _get$3(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "configure", this).call(this, t8), t8.axisOptions = t8.axisOptions || {}, t8.tooltipOptions = t8.tooltipOptions || {}, this.config.xAxisMode = t8.axisOptions.xAxisMode || "span", this.config.yAxisMode = t8.axisOptions.yAxisMode || "span", this.config.xIsSeries = t8.axisOptions.xIsSeries || 0, this.config.shortenYAxisNumbers = t8.axisOptions.shortenYAxisNumbers || 0, this.config.formatTooltipX = t8.tooltipOptions.formatTooltipX, this.config.formatTooltipY = t8.tooltipOptions.formatTooltipY, this.config.valuesOverPoints = t8.valuesOverPoints; } }, { key: "prepareData", value: function() { return dataPrep(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.data, this.type); } }, { key: "prepareFirstData", value: function() { return zeroDataPrep(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.data); } }, { key: "calc", value: function() { var t8 = arguments.length > 0 && arguments[0] !== void 0 && arguments[0]; this.calcXPositions(), t8 || this.calcYAxisParameters(this.getAllYValues(), this.type === "line"), this.makeDataByIndex(); } }, { key: "calcXPositions", value: function() { var t8 = this.state, e2 = this.data.labels; t8.datasetLength = e2.length, t8.unitWidth = this.width / t8.datasetLength, t8.xOffset = t8.unitWidth / 2, t8.xAxis = { labels: e2, positions: e2.map(function(e3, n) { return floatTwo(t8.xOffset + n * t8.unitWidth); }) }; } }, { key: "calcYAxisParameters", value: function(t8) { var e2 = calcChartIntervals(t8, arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "false"), n = this.height / getValueRange(e2), i = getIntervalSize(e2) * n, a = this.height - getZeroIndex(e2) * i; this.state.yAxis = { labels: e2, positions: e2.map(function(t9) { return a - t9 * n; }), scaleMultiplier: n, zeroLine: a }, this.calcDatasetPoints(), this.calcYExtremes(), this.calcYRegions(); } }, { key: "calcDatasetPoints", value: function() { var t8 = this.state, e2 = function(e3) { return e3.map(function(e4) { return scale(e4, t8.yAxis); }); }; t8.datasets = this.data.datasets.map(function(t9, n) { var i = t9.values, a = t9.cumulativeYs || []; return { name: t9.name && t9.name.replace(/<|>|&/g, function(t10) { return t10 == "&" ? "&" : t10 == "<" ? "<" : ">"; }), index: n, chartType: t9.chartType, values: i, yPositions: e2(i), cumulativeYs: a, cumulativeYPos: e2(a) }; }); } }, { key: "calcYExtremes", value: function() { var t8 = this.state; if (this.barOptions.stacked) return void (t8.yExtremes = t8.datasets[t8.datasets.length - 1].cumulativeYPos); t8.yExtremes = new Array(t8.datasetLength).fill(9999), t8.datasets.map(function(e2) { e2.yPositions.map(function(e3, n) { e3 < t8.yExtremes[n] && (t8.yExtremes[n] = e3); }); }); } }, { key: "calcYRegions", value: function() { var t8 = this.state; this.data.yMarkers && (this.state.yMarkers = this.data.yMarkers.map(function(e2) { return e2.position = scale(e2.value, t8.yAxis), e2.options || (e2.options = {}), e2; })), this.data.yRegions && (this.state.yRegions = this.data.yRegions.map(function(e2) { return e2.startPos = scale(e2.start, t8.yAxis), e2.endPos = scale(e2.end, t8.yAxis), e2.options || (e2.options = {}), e2; })); } }, { key: "getAllYValues", value: function() { var t8, e2 = this, n = "values"; if (this.barOptions.stacked) { n = "cumulativeYs"; var i = new Array(this.state.datasetLength).fill(0); this.data.datasets.map(function(t9, a2) { var r = e2.data.datasets[a2].values; t9[n] = i = i.map(function(t10, e3) { return t10 + r[e3]; }); }); } var a = this.data.datasets.map(function(t9) { return t9[n]; }); return this.data.yMarkers && a.push(this.data.yMarkers.map(function(t9) { return t9.value; })), this.data.yRegions && this.data.yRegions.map(function(t9) { a.push([t9.end, t9.start]); }), (t8 = []).concat.apply(t8, _toConsumableArray$5(a)); } }, { key: "setupComponents", value: function() { var t8 = this, e2 = [["yAxis", { mode: this.config.yAxisMode, width: this.width, shortenNumbers: this.config.shortenYAxisNumbers }, function() { return this.state.yAxis; }.bind(this)], ["xAxis", { mode: this.config.xAxisMode, height: this.height }, function() { var t9 = this.state; return t9.xAxis.calcLabels = getShortenedLabels(this.width, t9.xAxis.labels, this.config.xIsSeries), t9.xAxis; }.bind(this)], ["yRegions", { width: this.width, pos: "right" }, function() { return this.state.yRegions; }.bind(this)]], n = this.state.datasets.filter(function(t9) { return t9.chartType === "bar"; }), i = this.state.datasets.filter(function(t9) { return t9.chartType === "line"; }), a = n.map(function(e3) { var i2 = e3.index; return ["barGraph-" + e3.index, { index: i2, color: t8.colors[i2], stacked: t8.barOptions.stacked, valuesOverPoints: t8.config.valuesOverPoints, minHeight: t8.height * MIN_BAR_PERCENT_HEIGHT }, function() { var t9 = this.state, e4 = t9.datasets[i2], a2 = this.barOptions.stacked, r2 = this.barOptions.spaceRatio || BAR_CHART_SPACE_RATIO, o2 = t9.unitWidth * (1 - r2), s2 = o2 / (a2 ? 1 : n.length), l = t9.xAxis.positions.map(function(t10) { return t10 - o2 / 2; }); a2 || (l = l.map(function(t10) { return t10 + s2 * i2; })); var u = new Array(t9.datasetLength).fill(""); this.config.valuesOverPoints && (u = a2 && e4.index === t9.datasets.length - 1 ? e4.cumulativeYs : e4.values); var c = new Array(t9.datasetLength).fill(0); return a2 && (c = e4.yPositions.map(function(t10, n2) { return t10 - e4.cumulativeYPos[n2]; })), { xPositions: l, yPositions: e4.yPositions, offsets: c, labels: u, zeroLine: t9.yAxis.zeroLine, barsWidth: o2, barWidth: s2 }; }.bind(t8)]; }), r = i.map(function(e3) { var n2 = e3.index; return ["lineGraph-" + e3.index, { index: n2, color: t8.colors[n2], svgDefs: t8.svgDefs, heatline: t8.lineOptions.heatline, regionFill: t8.lineOptions.regionFill, spline: t8.lineOptions.spline, hideDots: t8.lineOptions.hideDots, hideLine: t8.lineOptions.hideLine, valuesOverPoints: t8.config.valuesOverPoints }, function() { var t9 = this.state, e4 = t9.datasets[n2], i2 = t9.yAxis.positions[0] < t9.yAxis.zeroLine ? t9.yAxis.positions[0] : t9.yAxis.zeroLine; return { xPositions: t9.xAxis.positions, yPositions: e4.yPositions, values: e4.values, zeroLine: i2, radius: this.lineOptions.dotSize || LINE_CHART_DOT_SIZE }; }.bind(t8)]; }), o = [["yMarkers", { width: this.width, pos: "right" }, function() { return this.state.yMarkers; }.bind(this)]]; e2 = e2.concat(a, r, o); var s = ["yMarkers", "yRegions"]; this.dataUnitComponents = [], this.components = new Map(e2.filter(function(e3) { return !s.includes(e3[0]) || t8.state[e3[0]]; }).map(function(e3) { var n2 = getComponent.apply(void 0, _toConsumableArray$5(e3)); return (e3[0].includes("lineGraph") || e3[0].includes("barGraph")) && t8.dataUnitComponents.push(n2), [e3[0], n2]; })); } }, { key: "makeDataByIndex", value: function() { var t8 = this; this.dataByIndex = {}; var e2 = this.state, n = this.config.formatTooltipX, i = this.config.formatTooltipY; e2.xAxis.labels.map(function(a, r) { var o = t8.state.datasets.map(function(e3, n2) { var a2 = e3.values[r]; return { title: e3.name, value: a2, yPos: e3.yPositions[r], color: t8.colors[n2], formatted: i ? i(a2) : a2 }; }); t8.dataByIndex[r] = { label: a, formattedLabel: n ? n(a) : a, xPos: e2.xAxis.positions[r], values: o, yExtreme: e2.yExtremes[r] }; }); } }, { key: "bindTooltip", value: function() { var t8 = this; this.container.addEventListener("mousemove", function(e2) { var n = t8.measures, i = getOffset(t8.container), a = e2.pageX - i.left - getLeftOffset(n), r = e2.pageY - i.top; r < t8.height + getTopOffset(n) && r > getTopOffset(n) ? t8.mapTooltipXPosition(a) : t8.tip.hideTip(); }); } }, { key: "mapTooltipXPosition", value: function(t8) { var e2 = this.state; if (e2.yExtremes) { var n = getClosestInArray(t8, e2.xAxis.positions, true); if (n >= 0) { var i = this.dataByIndex[n]; this.tip.setValues(i.xPos + this.tip.offset.x, i.yExtreme + this.tip.offset.y, { name: i.formattedLabel, value: "" }, i.values, n), this.tip.showTip(); } } } }, { key: "renderLegend", value: function() { var t8 = this, e2 = this.data; e2.datasets.length > 1 && (this.legendArea.textContent = "", e2.datasets.map(function(e3, n) { var i = AXIS_LEGEND_BAR_SIZE, a = legendBar(i * n, "0", i, t8.colors[n], e3.name, t8.config.truncateLegends); t8.legendArea.appendChild(a); })); } }, { key: "makeOverlay", value: function() { var t8 = this; if (this.init) return void (this.init = 0); this.overlayGuides && this.overlayGuides.forEach(function(t9) { var e2 = t9.overlay; e2.parentNode.removeChild(e2); }), this.overlayGuides = this.dataUnitComponents.map(function(t9) { return { type: t9.unitType, overlay: void 0, units: t9.units }; }), this.state.currentIndex === void 0 && (this.state.currentIndex = this.state.datasetLength - 1), this.overlayGuides.map(function(e2) { var n = e2.units[t8.state.currentIndex]; e2.overlay = makeOverlay[e2.type](n), t8.drawArea.appendChild(e2.overlay); }); } }, { key: "updateOverlayGuides", value: function() { this.overlayGuides && this.overlayGuides.forEach(function(t8) { var e2 = t8.overlay; e2.parentNode.removeChild(e2); }); } }, { key: "bindOverlay", value: function() { var t8 = this; this.parent.addEventListener("data-select", function() { t8.updateOverlay(); }); } }, { key: "bindUnits", value: function() { var t8 = this; this.dataUnitComponents.map(function(e2) { e2.units.map(function(e3) { e3.addEventListener("click", function() { var n = e3.getAttribute("data-point-index"); t8.setCurrentDataPoint(n); }); }); }), this.tip.container.addEventListener("click", function() { var e2 = t8.tip.container.getAttribute("data-point-index"); t8.setCurrentDataPoint(e2); }); } }, { key: "updateOverlay", value: function() { var t8 = this; this.overlayGuides.map(function(e2) { var n = e2.units[t8.state.currentIndex]; updateOverlay[e2.type](n, e2.overlay); }); } }, { key: "onLeftArrow", value: function() { this.setCurrentDataPoint(this.state.currentIndex - 1); } }, { key: "onRightArrow", value: function() { this.setCurrentDataPoint(this.state.currentIndex + 1); } }, { key: "getDataPoint", value: function() { var t8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.state.currentIndex, e2 = this.state; return { index: t8, label: e2.xAxis.labels[t8], values: e2.datasets.map(function(e3) { return e3.values[t8]; }) }; } }, { key: "setCurrentDataPoint", value: function(t8) { var e2 = this.state; (t8 = parseInt(t8)) < 0 && (t8 = 0), t8 >= e2.xAxis.labels.length && (t8 = e2.xAxis.labels.length - 1), t8 !== e2.currentIndex && (e2.currentIndex = t8, fire(this.parent, "data-select", this.getDataPoint())); } }, { key: "addDataPoint", value: function(t8, n) { var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.state.datasetLength; _get$3(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "addDataPoint", this).call(this, t8, n, i), this.data.labels.splice(i, 0, t8), this.data.datasets.map(function(t9, e2) { t9.values.splice(i, 0, n[e2]); }), this.update(this.data); } }, { key: "removeDataPoint", value: function() { var t8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.state.datasetLength - 1; this.data.labels.length <= 1 || (_get$3(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "removeDataPoint", this).call(this, t8), this.data.labels.splice(t8, 1), this.data.datasets.map(function(e2) { e2.values.splice(t8, 1); }), this.update(this.data)); } }, { key: "updateDataset", value: function(t8) { var e2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; this.data.datasets[e2].values = t8, this.update(this.data); } }, { key: "updateDatasets", value: function(t8) { this.data.datasets.map(function(e2, n) { t8[n] && (e2.values = t8[n]); }), this.update(this.data); } }]), e; }(BaseChart); var _createClass$8 = function() { function t7(t8, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(t8, i.key, i); } } return function(e, n, i) { return n && t7(e.prototype, n), i && t7(e, i), e; }; }(); var _get$4 = function t5(e, n, i) { e === null && (e = Function.prototype); var a = Object.getOwnPropertyDescriptor(e, n); if (a === void 0) { var r = Object.getPrototypeOf(e); return r === null ? void 0 : t5(r, n, i); } if ("value" in a) return a.value; var o = a.get; if (o !== void 0) return o.call(i); }; var DonutChart = function(t7) { function e(t8, n) { _classCallCheck$9(this, e); var i = _possibleConstructorReturn$5(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t8, n)); return i.type = "donut", i.initTimeout = 0, i.init = 1, i.setup(), i; } return _inherits$5(e, t7), _createClass$8(e, [{ key: "configure", value: function(t8) { _get$4(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "configure", this).call(this, t8), this.mouseMove = this.mouseMove.bind(this), this.mouseLeave = this.mouseLeave.bind(this), this.hoverRadio = t8.hoverRadio || 0.1, this.config.startAngle = t8.startAngle || 0, this.clockWise = t8.clockWise || false, this.strokeWidth = t8.strokeWidth || 30; } }, { key: "calc", value: function() { var t8 = this; _get$4(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "calc", this).call(this); var n = this.state; this.radius = this.height > this.width ? this.center.x - this.strokeWidth / 2 : this.center.y - this.strokeWidth / 2; var i = this.radius, a = this.clockWise, r = n.slicesProperties || []; n.sliceStrings = [], n.slicesProperties = []; var o = 180 - this.config.startAngle; n.sliceTotals.map(function(e2, s) { var l = o, u = e2 / n.grandTotal * FULL_ANGLE, c = u > 180 ? 1 : 0, h = a ? -u : u, d = o += h, f = getPositionByAngle(l, i), p = getPositionByAngle(d, i), v = t8.init && r[s], g = void 0, y = void 0; t8.init ? (g = v ? v.startPosition : f, y = v ? v.endPosition : f) : (g = f, y = p); var m = u === 360 ? makeStrokeCircleStr(g, y, t8.center, t8.radius, t8.clockWise, c) : makeArcStrokePathStr(g, y, t8.center, t8.radius, t8.clockWise, c); n.sliceStrings.push(m), n.slicesProperties.push({ startPosition: f, endPosition: p, value: e2, total: n.grandTotal, startAngle: l, endAngle: d, angle: h }); }), this.init = 0; } }, { key: "setupComponents", value: function() { var t8 = this.state, e2 = [["donutSlices", {}, function() { return { sliceStrings: t8.sliceStrings, colors: this.colors, strokeWidth: this.strokeWidth }; }.bind(this)]]; this.components = new Map(e2.map(function(t9) { var e3 = getComponent.apply(void 0, _toConsumableArray$7(t9)); return [t9[0], e3]; })); } }, { key: "calTranslateByAngle", value: function(t8) { var e2 = this.radius, n = this.hoverRadio, i = getPositionByAngle(t8.startAngle + t8.angle / 2, e2); return "translate3d(" + i.x * n + "px," + i.y * n + "px,0)"; } }, { key: "hoverSlice", value: function(t8, e2, n, i) { if (t8) { var a = this.colors[e2]; if (n) { transform(t8, this.calTranslateByAngle(this.state.slicesProperties[e2])), t8.style.stroke = lightenDarkenColor(a, 50); var r = getOffset(this.svg), o = i.pageX - r.left + 10, s = i.pageY - r.top - 10, l = (this.formatted_labels && this.formatted_labels.length > 0 ? this.formatted_labels[e2] : this.state.labels[e2]) + ": ", u = (100 * this.state.sliceTotals[e2] / this.state.grandTotal).toFixed(1); this.tip.setValues(o, s, { name: l, value: u + "%" }), this.tip.showTip(); } else transform(t8, "translate3d(0,0,0)"), this.tip.hideTip(), t8.style.stroke = a; } } }, { key: "bindTooltip", value: function() { this.container.addEventListener("mousemove", this.mouseMove), this.container.addEventListener("mouseleave", this.mouseLeave); } }, { key: "mouseMove", value: function(t8) { var e2 = t8.target, n = this.components.get("donutSlices").store, i = this.curActiveSliceIndex, a = this.curActiveSlice; if (n.includes(e2)) { var r = n.indexOf(e2); this.hoverSlice(a, i, false), this.curActiveSlice = e2, this.curActiveSliceIndex = r, this.hoverSlice(e2, r, true, t8); } else this.mouseLeave(); } }, { key: "mouseLeave", value: function() { this.hoverSlice(this.curActiveSlice, this.curActiveSliceIndex, false); } }]), e; }(AggregationChart); var chartTypes = { bar: AxisChart, line: AxisChart, percentage: PercentageChart, heatmap: Heatmap, pie: PieChart, donut: DonutChart }; var Chart = function t6(e, n) { return _classCallCheck(this, t6), getChartByType(n.type, e, n); }; export { AxisChart, Chart, Heatmap, PercentageChart, PieChart }; //# sourceMappingURL=frappe-charts.js.map