` element reference\r\n */\n\n\n Label.prototype.getHTMLLineElement = function (text) {\n // Create the
element\n var div = document.createElement(\"div\");\n div.innerHTML = text; // Set text alignment\n\n switch (this.textAlign) {\n case \"middle\":\n div.style.textAlign = \"center\";\n break;\n\n case \"end\":\n div.style.textAlign = \"right\";\n break;\n } // Disable or enable wrapping\n\n\n if (this.wrap) {\n div.style.wordWrap = \"break-word\";\n } else {\n div.style.whiteSpace = \"nowrap\";\n } // Don't let labels bleed out of the alotted area\n // Moved to `draw()` because setting \"hidden\" kills all measuring\n\n /*if (this.truncate) {\r\n div.style.overflow = \"hidden\";\r\n }*/\n // Set RTL-related styles\n\n\n if (this.rtl) {\n div.style.direction = \"rtl\"; //div.style.unicodeBidi = \"bidi-override\";\n } // Translate some of the SVG styles into CSS\n\n\n if ($type.hasValue(this.fill)) {\n div.style.color = this.fill.toString();\n }\n\n return div;\n };\n /**\r\n * Applies specific styles to text to make it not selectable, unless it is\r\n * explicitly set as `selectable`.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Set styles via AMElement\r\n */\n\n\n Label.prototype.setStyles = function () {\n var group = this.element;\n\n if (!this.selectable || this.draggable || this.resizable || this.swipeable) {\n group.addStyle({\n \"webkitUserSelect\": \"none\",\n \"msUserSelect\": \"none\"\n });\n } else if (this.selectable) {\n group.removeStyle(\"webkitUserSelect\");\n group.removeStyle(\"msUserSelect\");\n }\n };\n /**\r\n * Hides unused lines\r\n */\n\n\n Label.prototype.hideUnused = function (index) {\n this.initLineCache();\n var lines = this.getCache(\"lineInfo\");\n\n if (lines.length >= index) {\n for (var i = index; i < lines.length; i++) {\n var line = lines[i];\n\n if (line && line.element) {\n line.element.attr({\n \"display\": \"none\"\n });\n }\n }\n }\n };\n\n Object.defineProperty(Label.prototype, \"text\", {\n /**\r\n * @return SVG text\r\n */\n get: function get() {\n return this.getPropertyValue(\"text\");\n },\n\n /**\r\n * An SVG text.\r\n *\r\n * Please note that setting `html` will override this setting if browser\r\n * supports `foreignObject` in SGV, such as most modern browsers excluding\r\n * IEs.\r\n *\r\n * @param value SVG Text\r\n */\n set: function set(value) {\n //this.setPropertyValue(\"html\", undefined);\n this.setPropertyValue(\"text\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"path\", {\n /**\r\n * @return Path\r\n */\n get: function get() {\n return this.getPropertyValue(\"path\");\n },\n\n /**\r\n * An SVG path string to position text along. If set, the text will follow\r\n * the curvature of the path.\r\n *\r\n * Location along the path can be set using `locationOnPath`.\r\n *\r\n * IMPORTANT: Only SVG text can be put on path. If you are using HTML text\r\n * this setting will be ignored.\r\n *\r\n * @since 4.1.2\r\n * @param value Path\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"path\", value, true)) {\n if (this.pathElement) {\n this.pathElement.dispose();\n }\n\n if (this.textPathElement) {\n this.textPathElement.dispose();\n }\n\n this.pathElement = this.paper.add(\"path\");\n this.pathElement.attr({\n \"d\": value\n });\n this.pathElement.attr({\n \"id\": \"text-path-\" + this.uid\n });\n\n this._disposers.push(this.pathElement);\n\n this.textPathElement = this.paper.addGroup(\"textPath\");\n this.textPathElement.attrNS($dom.XLINK, \"xlink:href\", \"#text-path-\" + this.uid); // TODO remove after https://bugzilla.mozilla.org/show_bug.cgi?id=455986 is fixed\n\n this.textPathElement.attr({\n \"path\": value\n });\n\n this._disposers.push(this.textPathElement);\n\n this.hardInvalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"locationOnPath\", {\n /**\r\n * @return Relatvie location on path\r\n */\n get: function get() {\n return this.getPropertyValue(\"locationOnPath\");\n },\n\n /**\r\n * Relative label location on `path`. Value range is from 0 (beginning)\r\n * to 1 (end).\r\n *\r\n * Works only if you set `path` setting to an SVG path.\r\n *\r\n * @since 4.1.2\r\n * @default 0\r\n * @param value Relatvie location on path\r\n */\n set: function set(value) {\n this.setPropertyValue(\"locationOnPath\", value);\n\n if (this.textPathElement) {\n this.textPathElement.attr({\n \"startOffset\": value * 100 + \"%\"\n });\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"baseLineRatio\", {\n /**\r\n * @return Base line ratio\r\n */\n get: function get() {\n return this.getPropertyValue(\"baseLineRatio\");\n },\n\n /**\r\n * A ratio to calculate text baseline. Ralative distance from the bottom of\r\n * the label.\r\n *\r\n * @since 4.4.2\r\n * @default -0.27\r\n * @param value Base line ratio\r\n */\n set: function set(value) {\n this.setPropertyValue(\"baseLineRatio\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"wrap\", {\n /**\r\n * @return Auto-wrap enabled or not\r\n */\n get: function get() {\n return this.getPropertyValue(\"wrap\");\n },\n\n /**\r\n * Enables or disables autowrapping of text.\r\n *\r\n * @param value Auto-wrapping enabled\r\n */\n set: function set(value) {\n this.resetBBox();\n this.setPropertyValue(\"wrap\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"truncate\", {\n /**\r\n * @return Truncate text?\r\n */\n get: function get() {\n return this.getPropertyValue(\"truncate\");\n },\n\n /**\r\n * Indicates if text lines need to be truncated if they do not fit, using\r\n * configurable `ellipsis` string.\r\n *\r\n * `truncate` overrides `wrap` if both are set to `true`.\r\n *\r\n * NOTE: For HTML text, this setting **won't** trigger a parser and actual\r\n * line truncation with ellipsis. It will just hide everything that goes\r\n * outside the label.\r\n *\r\n * @param value trincate text?\r\n */\n set: function set(value) {\n this.resetBBox();\n this.setPropertyValue(\"truncate\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"fullWords\", {\n /**\r\n * @return Truncate on full words?\r\n */\n get: function get() {\n return this.getPropertyValue(\"fullWords\");\n },\n\n /**\r\n * If `truncate` is enabled, should Label try to break only on full words\r\n * (`true`), or whenever needed, including middle of the word. (`false`)\r\n *\r\n * @default true\r\n * @param value Truncate on full words?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"fullWords\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"ellipsis\", {\n /**\r\n * @return Ellipsis string\r\n */\n get: function get() {\n return this.getPropertyValue(\"ellipsis\");\n },\n\n /**\r\n * Ellipsis character to use if `truncate` is enabled.\r\n *\r\n * @param value Ellipsis string\r\n * @default \"...\"\r\n */\n set: function set(value) {\n this.setPropertyValue(\"ellipsis\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"selectable\", {\n /**\r\n * @return Text selectable?\r\n */\n get: function get() {\n return this.getPropertyValue(\"selectable\");\n },\n\n /**\r\n * Forces the text to be selectable. This setting will be ignored if the\r\n * object has some kind of interaction attached to it, such as it is\r\n * `draggable`, `swipeable`, `resizable`.\r\n *\r\n * @param value Text selectable?\r\n * @default false\r\n */\n set: function set(value) {\n this.setPropertyValue(\"selectable\", value, true);\n this.setStyles();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"textAlign\", {\n /**\r\n * @return Alignment\r\n */\n get: function get() {\n return this.getPropertyValue(\"textAlign\");\n },\n\n /**\r\n * Horizontal text alignment.\r\n *\r\n * Available choices:\r\n * * \"start\"\r\n * * \"middle\"\r\n * * \"end\"\r\n *\r\n * @param value Alignment\r\n */\n set: function set(value) {\n this.setPropertyValue(\"textAlign\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"textValign\", {\n /**\r\n * @ignore Exclude from docs (not used)\r\n * @return Alignment\r\n * @deprecated\r\n */\n get: function get() {\n return this.getPropertyValue(\"textValign\");\n },\n\n /**\r\n * Vertical text alignment.\r\n *\r\n * @ignore Exclude from docs (not used)\r\n * @param value Alignment\r\n * @deprecated\r\n */\n set: function set(value) {\n this.setPropertyValue(\"textValign\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"html\", {\n /**\r\n * @return HTML content\r\n */\n get: function get() {\n return this.getPropertyValue(\"html\");\n },\n\n /**\r\n * Raw HTML to be used as text.\r\n *\r\n * NOTE: HTML text is subject to browser support. It relies on browsers\r\n * supporting SVG `foreignObject` nodes. Some browsers (read IEs) do not\r\n * support it. On those browsers, the text will fall back to basic SVG text,\r\n * striping out all HTML markup and styling that goes with it.\r\n *\r\n * For more information about `foreignObject` and its browser compatibility\r\n * refer to [this page](https://developer.mozilla.org/en/docs/Web/SVG/Element/foreignObject#Browser_compatibility).\r\n *\r\n * @param value HTML text\r\n */\n set: function set(value) {\n this.setPropertyValue(\"html\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"hideOversized\", {\n /**\r\n * @return Hide if text does not fit?\r\n */\n get: function get() {\n return this.getPropertyValue(\"hideOversized\");\n },\n\n /**\r\n * Indicates whether the whole text should be hidden if it does not fit into\r\n * its allotted space.\r\n *\r\n * @param value Hide if text does not fit?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"hideOversized\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"ignoreFormatting\", {\n /**\r\n * @return Ignore formatting?\r\n */\n get: function get() {\n return this.getPropertyValue(\"ignoreFormatting\");\n },\n\n /**\r\n * If set to `true` square-bracket formatting blocks will be treated as\r\n * regular text.\r\n *\r\n * @default false\r\n * @param value Ignore formatting?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"ignoreFormatting\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Override `mesaureElement` so it does not get measure again, because\r\n * internal `_bbox` is being updated by measuring routines in Text itself.\r\n */\n\n Label.prototype.measureElement = function () {};\n /**\r\n * Returns information about a line element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param index Line index\r\n * @return Line info object\r\n */\n\n\n Label.prototype.getLineInfo = function (index) {\n this.initLineCache();\n var lines = this.getCache(\"lineInfo\");\n return lines.length > index ? lines[index] : undefined;\n };\n /**\r\n * Adds a line to line info cache.\r\n *\r\n * @ignore Exclude from docs\r\n * @param line Line info object\r\n * @param index Insert at specified index\r\n */\n\n\n Label.prototype.addLineInfo = function (line, index) {\n this.initLineCache();\n this.getCache(\"lineInfo\")[index] = line;\n };\n /**\r\n * Checks if line cache is initialized and initializes it.\r\n */\n\n\n Label.prototype.initLineCache = function () {\n if (!$type.hasValue(this.getCache(\"lineInfo\"))) {\n this.setCache(\"lineInfo\", [], 0);\n }\n };\n /**\r\n * Sets a [[DataItem]] to use for populating dynamic sections of the text.\r\n *\r\n * Check the description for [[Text]] class, for data binding.\r\n *\r\n * @param dataItem Data item\r\n */\n\n\n Label.prototype.setDataItem = function (dataItem) {\n if (this._sourceDataItemEvents) {\n this._sourceDataItemEvents.dispose();\n }\n\n if (dataItem) {\n this._sourceDataItemEvents = new MultiDisposer([dataItem.events.on(\"valuechanged\", this.invalidate, this, false), dataItem.events.on(\"workingvaluechanged\", this.invalidate, this, false), dataItem.events.on(\"calculatedvaluechanged\", this.invalidate, this, false), dataItem.events.on(\"propertychanged\", this.invalidate, this, false)]);\n }\n\n _super.prototype.setDataItem.call(this, dataItem);\n };\n\n Object.defineProperty(Label.prototype, \"availableWidth\", {\n /**\r\n * Returns available horizontal space.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Available width (px)\r\n */\n get: function get() {\n return $type.hasValue(this.maxWidth) ? this.maxWidth : this.pixelWidth;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Label.prototype, \"availableHeight\", {\n /**\r\n * Returns available vertical space.\r\n *\r\n * @return Available height (px)\r\n */\n get: function get() {\n return $type.hasValue(this.maxHeight) ? this.maxHeight : this.pixelHeight;\n },\n enumerable: true,\n configurable: true\n }); // temp, replacing textFormatter method\n\n Label.prototype.getSvgElement = function (text, style, parent) {\n var element = this.paper.add(\"tspan\");\n element.textContent = text;\n\n if (style) {\n if (options.nonce && parent) {\n //element.node.setAttribute(\"nonce\", \"test123\");\n var classid = \"amcharts_element_style_\" + btoa(style).replace(/[^\\w]*/g, \"\");\n element.node.setAttribute(\"class\", classid);\n var defs = document.createElementNS($dom.SVGNS, \"defs\");\n parent.node.appendChild(defs);\n var e = document.createElement(\"style\");\n e.type = \"text/css\";\n e.innerHTML = \".\" + classid + \" { \" + style + \"}\";\n e.setAttribute(\"nonce\", options.nonce);\n defs.appendChild(e);\n } else {\n element.node.setAttribute(\"style\", style);\n }\n }\n\n if (parent) {\n parent.add(element);\n }\n\n return element;\n };\n /**\r\n * Invalidates the whole element, including layout AND all its child\r\n * elements.\r\n */\n\n\n Label.prototype.deepInvalidate = function () {\n _super.prototype.deepInvalidate.call(this);\n\n this.hardInvalidate();\n };\n\n Object.defineProperty(Label.prototype, \"readerTitle\", {\n /**\r\n * @return Title\r\n */\n get: function get() {\n var title = this.getPropertyValue(\"readerTitle\");\n\n if (!title) {\n title = this.populateString($utils.plainText($utils.isNotEmpty(this.html) ? this.html : this.text));\n } else if (this.dataItem) {\n title = this.populateString(title);\n }\n\n return title;\n },\n\n /**\r\n * Screen reader title of the element.\r\n *\r\n * @param value Title\r\n */\n set: function set(value) {\n value = $type.toText(value);\n\n if (this.setPropertyValue(\"readerTitle\", value)) {\n this.applyAccessibility();\n }\n },\n enumerable: true,\n configurable: true\n });\n return Label;\n}(Container);\n\nexport { Label };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Label\"] = Label;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Hide labels added directly to chart, like titles if chart is short.\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.heightXS,\n state: function state(target, stateId) {\n if (target instanceof Label && target.parent && target.parent.isBaseSprite) {\n var state = target.states.create(stateId);\n state.properties.disabled = true;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * Rounded rectangle module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { registry } from \"../Registry\";\nimport * as $math from \"../utils/Math\";\nimport * as $type from \"../utils/Type\";\nimport * as $utils from \"../utils/Utils\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a rectangle with rounded corners.\r\n *\r\n * @see {@link IRoundedRectangleEvents} for a list of available events\r\n * @see {@link IRoundedRectangleAdapters} for a list of available Adapters\r\n */\n\nvar RoundedRectangle =\n/** @class */\nfunction (_super) {\n __extends(RoundedRectangle, _super);\n /**\r\n * Constructor\r\n */\n\n\n function RoundedRectangle() {\n var _this = _super.call(this) || this;\n\n _this.className = \"RoundedRectangle\";\n _this.element = _this.paper.add(\"path\");\n\n _this.cornerRadius(3, 3, 3, 3);\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n RoundedRectangle.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var w = this.innerWidth;\n var h = this.innerHeight;\n\n if ($type.isNumber(w) && $type.isNumber(h)) {\n var minSide = $math.min(w, h) / 2;\n var cornerRadiusTopLeft = $utils.relativeToValue(this.cornerRadiusTopLeft, minSide);\n var cornerRadiusTopRight = $utils.relativeToValue(this.cornerRadiusTopRight, minSide);\n var cornerRadiusBottomRight = $utils.relativeToValue(this.cornerRadiusBottomRight, minSide);\n var cornerRadiusBottomLeft = $utils.relativeToValue(this.cornerRadiusBottomLeft, minSide);\n var maxcr = $math.min(Math.abs(w / 2), Math.abs(h / 2));\n var crtl = $math.fitToRange(cornerRadiusTopLeft, 0, maxcr);\n var crtr = $math.fitToRange(cornerRadiusTopRight, 0, maxcr);\n var crbr = $math.fitToRange(cornerRadiusBottomRight, 0, maxcr);\n var crbl = $math.fitToRange(cornerRadiusBottomLeft, 0, maxcr);\n var lineT = \"M\" + crtl + \",0 L\" + (w - crtr) + \",0\";\n var lineB = \" L\" + crbl + \",\" + h;\n var lineL = \" L0,\" + crtl;\n var lineR = \" L\" + w + \",\" + (h - crbr);\n var arcTR = \" a\" + crtr + \",\" + crtr + \" 0 0 1 \" + crtr + \",\" + crtr;\n var arcBR = \" a\" + crbr + \",\" + crbr + \" 0 0 1 -\" + crbr + \",\" + crbr;\n var arcBL = \" a\" + crbl + \",\" + crbl + \" 0 0 1 -\" + crbl + \",-\" + crbl;\n var arcTL = \" a\" + crtl + \",\" + crtl + \" 0 0 1 \" + crtl + \",-\" + crtl;\n var path = lineT + arcTR + lineR + arcBR + lineB + arcBL + lineL + arcTL + \" Z\";\n this.path = path;\n }\n };\n /**\r\n * Sets radius for all four corners at ones.\r\n *\r\n * All numbers are in pixels.\r\n *\r\n * @param tl Top-left corner\r\n * @param tr Top-right corner\r\n * @param bl Bottom-left corner\r\n * @param br Bottom-right corner\r\n */\n\n\n RoundedRectangle.prototype.cornerRadius = function (tl, tr, bl, br) {\n this.cornerRadiusTopLeft = tl;\n this.cornerRadiusTopRight = tr;\n this.cornerRadiusBottomLeft = bl;\n this.cornerRadiusBottomRight = br;\n };\n\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusTopLeft\", {\n /**\r\n * @return Radius (px or Percent)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cornerRadiusTopLeft\");\n },\n\n /**\r\n * Radius of the top-left corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\n set: function set(value) {\n this.setPercentProperty(\"cornerRadiusTopLeft\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusTopRight\", {\n /**\r\n * @return Radius (px or Percent)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cornerRadiusTopRight\");\n },\n\n /**\r\n * Radius of the top-right corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\n set: function set(value) {\n this.setPercentProperty(\"cornerRadiusTopRight\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusBottomRight\", {\n /**\r\n * @return Radius (px or Percent)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cornerRadiusBottomRight\");\n },\n\n /**\r\n * Radius of the bottom-right corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\n set: function set(value) {\n this.setPercentProperty(\"cornerRadiusBottomRight\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RoundedRectangle.prototype, \"cornerRadiusBottomLeft\", {\n /**\r\n * @return Radius (px or Percent)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cornerRadiusBottomLeft\");\n },\n\n /**\r\n * Radius of the bottom-left corner in pixels.\r\n *\r\n * @default 3\r\n * @param value Radius (px or Percent)\r\n */\n set: function set(value) {\n this.setPercentProperty(\"cornerRadiusBottomLeft\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Measures the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n RoundedRectangle.prototype.measureElement = function () {};\n\n Object.defineProperty(RoundedRectangle.prototype, \"bbox\", {\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n get: function get() {\n if (this.definedBBox) {\n return this.definedBBox;\n }\n\n if (this.isMeasured) {\n return {\n x: 0,\n y: 0,\n width: this.innerWidth,\n height: this.innerHeight\n };\n } else {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n },\n enumerable: true,\n configurable: true\n });\n return RoundedRectangle;\n}(Sprite);\n\nexport { RoundedRectangle };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"RoundedRectangle\"] = RoundedRectangle;","/**\r\n * Functionality for drawing simple buttons.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { Label } from \"./Label\";\nimport { RoundedRectangle } from \"../elements/RoundedRectangle\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { registry } from \"../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Button class is capable of drawing a simple rectangular button with\r\n * optionally rounded corners and an icon in it.\r\n *\r\n * @see {@link IButtonEvents} for a list of available events\r\n * @see {@link IButtonAdapters} for a list of available Adapters\r\n */\n\nvar Button =\n/** @class */\nfunction (_super) {\n __extends(Button, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Button() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"Button\";\n _this.tooltipY = 0; // Set defaults\n\n _this.iconPosition = \"left\";\n _this.layout = \"horizontal\";\n _this.contentAlign = \"center\";\n _this.contentValign = \"middle\";\n\n _this.padding(8, 16, 8, 16);\n\n _this.setStateOnChildren = true;\n var interfaceColors = new InterfaceColorSet(); // Create background\n\n var background = _this.background;\n background.fill = interfaceColors.getFor(\"secondaryButton\");\n background.stroke = interfaceColors.getFor(\"secondaryButtonStroke\");\n background.fillOpacity = 1;\n background.strokeOpacity = 1;\n background.cornerRadius(3, 3, 3, 3); // Create the label element\n\n _this.label = new Label();\n _this.label.fill = interfaceColors.getFor(\"secondaryButtonText\");\n ;\n _this.label.shouldClone = false; // Create default states\n\n var hoverState = background.states.create(\"hover\");\n hoverState.properties.fillOpacity = 1;\n hoverState.properties.fill = interfaceColors.getFor(\"secondaryButtonHover\");\n var downState = background.states.create(\"down\");\n downState.transitionDuration = 100;\n downState.properties.fill = interfaceColors.getFor(\"secondaryButtonDown\");\n downState.properties.fillOpacity = 1; // Set up accessibility\n // A button should be always focusable\n\n _this.role = \"button\";\n _this.focusable = true; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Button.prototype, \"icon\", {\n /**\r\n * @return Icon Sprite\r\n */\n get: function get() {\n return this._icon;\n },\n\n /**\r\n * A [[Sprite]] to be used as an icon on button.\r\n *\r\n * @param icon Icon Sprite\r\n */\n set: function set(icon) {\n var currentIcon = this._icon;\n\n if (currentIcon) {\n //this._icon.dispose();\n //this.removeDispose(currentIcon);\n currentIcon.parent = undefined;\n }\n\n if (icon) {\n this._icon = icon;\n icon.parent = this;\n icon.interactionsEnabled = false;\n icon.shouldClone = false;\n this.iconPosition = this.iconPosition;\n\n this._disposers.push(icon);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Button.prototype, \"iconPosition\", {\n /**\r\n * @return Icon position\r\n */\n get: function get() {\n return this.getPropertyValue(\"iconPosition\");\n },\n\n /**\r\n * Icon position: \"left\" or \"right\".\r\n *\r\n * @default \"left\"\r\n * @param position Icon position\r\n */\n set: function set(position) {\n this.setPropertyValue(\"iconPosition\", position);\n\n if (this.icon) {\n if (position == \"left\") {\n this.icon.toBack();\n } else {\n this.icon.toFront();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Button.prototype, \"label\", {\n /**\r\n * @return Label element\r\n */\n get: function get() {\n return this._label;\n },\n\n /**\r\n * [[Label]] element to be used for text.\r\n *\r\n * @param label element\r\n */\n set: function set(label) {\n if (this._label) {\n //this._label.dispose();\n this.removeDispose(this._label);\n }\n\n this._label = label;\n\n if (label) {\n label.parent = this;\n label.interactionsEnabled = false;\n\n this._disposers.push(this._label);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates a background element for the button.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background element\r\n */\n\n Button.prototype.createBackground = function () {\n return new RoundedRectangle();\n };\n /**\r\n * Copies properties and other attributes.\r\n *\r\n * @param source Source\r\n */\n\n\n Button.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n if (source.label) {\n this.label.copyFrom(source.label);\n }\n\n if (source.icon) {\n this.icon = source.icon.clone();\n }\n };\n\n return Button;\n}(Container);\n\nexport { Button };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Button\"] = Button;","/**\r\n * Functionality for drawing circles.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { percent } from \"../utils/Percent\";\nimport { registry } from \"../Registry\";\nimport * as $utils from \"../utils/Utils\";\nimport * as $math from \"../utils/Math\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to create a circle\r\n * @see {@link ICircleEvents} for a list of available events\r\n * @see {@link ICircleAdapters} for a list of available Adapters\r\n */\n\nvar Circle =\n/** @class */\nfunction (_super) {\n __extends(Circle, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Circle() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Circle\";\n _this.element = _this.paper.add(\"circle\");\n\n _this.setPercentProperty(\"radius\", percent(100));\n\n _this.setPropertyValue(\"horizontalCenter\", \"middle\");\n\n _this.setPropertyValue(\"verticalCenter\", \"middle\");\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the circle.\r\n */\n\n\n Circle.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n this.element.attr({\n \"r\": this.pixelRadius\n });\n };\n\n Object.defineProperty(Circle.prototype, \"radius\", {\n /**\r\n * @return Radius\r\n */\n get: function get() {\n return this.getPropertyValue(\"radius\");\n },\n\n /**\r\n * Radius of the circle.\r\n *\r\n * Can be either absolute (pixels) or relative ([Percent]).\r\n *\r\n * @param value Radius\r\n */\n set: function set(value) {\n this.setPercentProperty(\"radius\", value, true, false, 10, false);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Circle.prototype, \"pixelRadius\", {\n /**\r\n * Radius of the circle in pixels.\r\n *\r\n * This is a read-only property. To set radius in pixels, use `radius`\r\n * property.\r\n *\r\n * @readonly\r\n * @return Radius (px)\r\n */\n get: function get() {\n return $utils.relativeToValue(this.radius, $math.min(this.innerWidth / 2, this.innerHeight / 2));\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates bounding box.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Circle.prototype.measureElement = function () {\n var pixelRadius = this.pixelRadius;\n this._bbox = {\n x: -pixelRadius,\n y: -pixelRadius,\n width: pixelRadius * 2,\n height: pixelRadius * 2\n };\n };\n\n return Circle;\n}(Sprite);\n\nexport { Circle };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Circle\"] = Circle;","/**\r\n * Ellipse module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Circle } from \"./Circle\";\nimport { registry } from \"../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws an ellipse\r\n * @see {@link IEllipseEvents} for a list of available events\r\n * @see {@link IEllipseAdapters} for a list of available Adapters\r\n */\n\nvar Ellipse =\n/** @class */\nfunction (_super) {\n __extends(Ellipse, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Ellipse() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Ellipse\";\n _this.element = _this.paper.add(\"ellipse\");\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the ellipsis.\r\n */\n\n\n Ellipse.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n this.element.attr({\n \"rx\": this.radius\n });\n this.element.attr({\n \"ry\": this.radiusY\n });\n };\n\n Object.defineProperty(Ellipse.prototype, \"radiusY\", {\n /**\r\n * @return Vertical radius\r\n */\n get: function get() {\n return this.innerHeight / 2;\n },\n\n /**\r\n * Vertical radius.\r\n *\r\n * It's a relative size to the `radius`.\r\n *\r\n * E.g. 0.8 will mean the height of the ellipsis will be 80% of it's\r\n * horizontal radius.\r\n *\r\n * @param value Vertical radius\r\n */\n set: function set(value) {\n this.height = value * 2;\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Ellipse.prototype, \"radius\", {\n /**\r\n * @return Horizontal radius\r\n */\n get: function get() {\n return this.innerWidth / 2;\n },\n\n /**\r\n * Horizontal radius.\r\n *\r\n * @param value Horizontal radius\r\n */\n set: function set(value) {\n this.width = value * 2;\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n return Ellipse;\n}(Circle);\n\nexport { Ellipse };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Ellipse\"] = Ellipse;","/**\r\n * Functionality for adding images in SVG tree.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { registry } from \"../Registry\";\nimport * as $dom from \"../utils/DOM\";\nimport * as $type from \"../utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to add `
` elements to SVG.\r\n *\r\n * @see {@link IImageEvents} for a list of available events\r\n * @see {@link IImageAdapters} for a list of available Adapters\r\n */\n\nvar Image =\n/** @class */\nfunction (_super) {\n __extends(Image, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Image() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Image\";\n _this.element = _this.paper.add(\"image\");\n\n _this.applyTheme();\n\n _this.width = 50;\n _this.height = 50;\n return _this;\n }\n /**\r\n * Draws an `` element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Image.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (this.href) {\n var width = this.innerWidth;\n var height = this.innerHeight;\n\n if ($type.isNumber(this.widthRatio)) {\n width = height * this.widthRatio;\n this.width = width;\n }\n\n if ($type.isNumber(this.heightRatio)) {\n height = width * this.heightRatio;\n this.height = height;\n }\n\n this.element.attr({\n \"width\": width,\n \"height\": height\n });\n this.element.attrNS($dom.XLINK, \"xlink:href\", this.href);\n }\n };\n\n Object.defineProperty(Image.prototype, \"href\", {\n /**\r\n * @return Image URI\r\n */\n get: function get() {\n return this.getPropertyValue(\"href\");\n },\n\n /**\r\n * An image URI.\r\n *\r\n * @param value Image URI\r\n */\n set: function set(value) {\n this.setPropertyValue(\"href\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Image.prototype, \"widthRatio\", {\n /**\r\n * @return Ratio\r\n */\n get: function get() {\n return this.getPropertyValue(\"widthRatio\");\n },\n\n /**\r\n * Sets image `width` relatively to its `height`.\r\n *\r\n * If image's `height = 100` and `widthRatio = 0.5` the actual width will be\r\n * `50`.\r\n *\r\n * @param value Ratio\r\n */\n set: function set(value) {\n this.setPropertyValue(\"widthRatio\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Image.prototype, \"heightRatio\", {\n /**\r\n * @return Ratio\r\n */\n get: function get() {\n return this.getPropertyValue(\"heightRatio\");\n },\n\n /**\r\n * Sets image `height` relatively to its `width`.\r\n *\r\n * If image's `width = 100` and `heightRatio = 0.5` the actual height will be\r\n * `50`.\r\n *\r\n * @param value Ratio\r\n */\n set: function set(value) {\n this.setPropertyValue(\"heightRatio\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Image.prototype, \"bbox\", {\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n get: function get() {\n return {\n x: 0,\n y: 0,\n width: this.pixelWidth,\n height: this.pixelHeight\n };\n },\n enumerable: true,\n configurable: true\n });\n return Image;\n}(Sprite);\n\nexport { Image };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Image\"] = Image;","/**\r\n * Line drawing functionality.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { color } from \"../utils/Color\";\nimport { LinearGradient } from \"../rendering/fills/LinearGradient\";\nimport { registry } from \"../Registry\";\nimport * as $type from \"../utils/Type\";\nimport * as $math from \"../utils/Math\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a line.\r\n *\r\n * @see {@link ILineEvents} for a list of available events\r\n * @see {@link ILineAdapters} for a list of available Adapters\r\n */\n\nvar Line =\n/** @class */\nfunction (_super) {\n __extends(Line, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Line() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Line\";\n _this.element = _this.paper.add(\"line\");\n _this.fill = color(); //\"none\";\n\n _this.x1 = 0;\n _this.y1 = 0;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the line.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Line.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (this.x1 == this.x2 || this.y1 == this.y2) {\n this.pixelPerfect = true;\n } else {\n this.pixelPerfect = false;\n }\n\n this.x1 = this.x1;\n this.x2 = this.x2;\n this.y1 = this.y1;\n this.y2 = this.y2;\n };\n\n Object.defineProperty(Line.prototype, \"x1\", {\n /**\r\n * @return X\r\n */\n get: function get() {\n return this.getPropertyValue(\"x1\");\n },\n\n /**\r\n * X coordinate of first end.\r\n *\r\n * @param value X\r\n */\n set: function set(value) {\n if (!$type.isNumber(value)) {\n value = 0;\n }\n\n var delta = 0;\n\n if (this.pixelPerfect && this.stroke instanceof LinearGradient) {\n delta = 0.00001;\n }\n\n this.setPropertyValue(\"x1\", value, true);\n this.element.attr({\n \"x1\": value + delta\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Line.prototype, \"x2\", {\n /**\r\n * @return X\r\n */\n get: function get() {\n var value = this.getPropertyValue(\"x2\");\n\n if (!$type.isNumber(value)) {\n value = this.pixelWidth;\n }\n\n return value;\n },\n\n /**\r\n * X coordinate of second end.\r\n *\r\n * @param value X\r\n */\n set: function set(value) {\n if (!$type.isNumber(value)) {\n value = 0;\n }\n\n this.setPropertyValue(\"x2\", value, true);\n this.element.attr({\n \"x2\": value\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Line.prototype, \"y1\", {\n /**\r\n * @return Y\r\n */\n get: function get() {\n return this.getPropertyValue(\"y1\");\n },\n\n /**\r\n * Y coordinate of first end.\r\n *\r\n * @param value Y\r\n */\n set: function set(value) {\n if (!$type.isNumber(value)) {\n value = 0;\n }\n\n var delta = 0;\n\n if (this.pixelPerfect && this.stroke instanceof LinearGradient) {\n delta = 0.00001;\n }\n\n this.setPropertyValue(\"y1\", value, true);\n this.element.attr({\n \"y1\": value + delta\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Line.prototype, \"y2\", {\n /**\r\n * @return Y\r\n */\n get: function get() {\n var value = this.getPropertyValue(\"y2\");\n\n if (!$type.isNumber(value)) {\n value = this.pixelHeight;\n }\n\n return value;\n },\n\n /**\r\n * Y coordinate of second end.\r\n *\r\n * @param value Y\r\n */\n set: function set(value) {\n if (!$type.isNumber(value)) {\n value = 0;\n }\n\n this.setPropertyValue(\"y2\", value, true);\n this.element.attr({\n \"y2\": value\n });\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\n\n Line.prototype.positionToPoint = function (position) {\n var point1 = {\n x: this.x1,\n y: this.y1\n };\n var point2 = {\n x: this.x2,\n y: this.y2\n };\n var point = $math.getMidPoint(point1, point2, position);\n var angle = $math.getAngle(point1, point2);\n return {\n x: point.x,\n y: point.y,\n angle: angle\n };\n };\n\n return Line;\n}(Sprite);\n\nexport { Line };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Line\"] = Line;","/**\r\n * Pointed shape module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport * as $type from \"../utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a shape with a pointer.\r\n *\r\n * @see {@link IPointedShapeEvents} for a list of available events\r\n * @see {@link IPointedShapeAdapters} for a list of available Adapters\r\n */\n\nvar PointedShape =\n/** @class */\nfunction (_super) {\n __extends(PointedShape, _super);\n /**\r\n * Constructor\r\n */\n\n\n function PointedShape() {\n var _this = _super.call(this) || this;\n\n _this.className = \"PointedShape\";\n _this.pointerBaseWidth = 15;\n _this.pointerLength = 10;\n _this.pointerY = 0;\n _this.pointerX = 0;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n PointedShape.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (!$type.isNumber(this.pointerX)) {\n this.pointerX = this.pixelWidth / 2;\n }\n\n if (!$type.isNumber(this.pointerY)) {\n this.pointerY = this.pixelHeight + 10;\n }\n };\n\n Object.defineProperty(PointedShape.prototype, \"pointerBaseWidth\", {\n /**\r\n * @return Width (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"pointerBaseWidth\");\n },\n\n /**\r\n * A width of the pinter's (stem's) thick end (base) in pixels.\r\n *\r\n * @default 15\r\n * @param value Width (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"pointerBaseWidth\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PointedShape.prototype, \"pointerLength\", {\n /**\r\n * @return Length (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"pointerLength\");\n },\n\n /**\r\n * A length of the pinter (stem) in pixels.\r\n *\r\n * @default 10\r\n * @param value Length (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"pointerLength\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PointedShape.prototype, \"pointerX\", {\n /**\r\n * @return X\r\n */\n get: function get() {\n return this.getPropertyValue(\"pointerX\");\n },\n\n /**\r\n * X coordinate the shape is pointing to.\r\n *\r\n * @param value X\r\n */\n set: function set(value) {\n this.setPropertyValue(\"pointerX\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PointedShape.prototype, \"pointerY\", {\n /**\r\n * @return Y\r\n */\n get: function get() {\n return this.getPropertyValue(\"pointerY\");\n },\n\n /**\r\n * Y coordinate the shape is pointing to.\r\n *\r\n * @param value Y\r\n */\n set: function set(value) {\n this.setPropertyValue(\"pointerY\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return PointedShape;\n}(Sprite);\n\nexport { PointedShape };","/**\r\n * Pointed rectangle module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { PointedShape } from \"./PointedShape\";\nimport * as $math from \"../utils/Math\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a rectangle with a pointer.\r\n *\r\n * @see {@link IPointedRectangleEvents} for a list of available events\r\n * @see {@link IPointedRectangleAdapters} for a list of available Adapters\r\n */\n\nvar PointedRectangle =\n/** @class */\nfunction (_super) {\n __extends(PointedRectangle, _super);\n /**\r\n * Constructor\r\n */\n\n\n function PointedRectangle() {\n var _this = _super.call(this) || this;\n\n _this.className = \"PointedRectangle\";\n _this.element = _this.paper.add(\"path\");\n _this.cornerRadius = 6;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n PointedRectangle.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var cr = this.cornerRadius;\n var w = this.innerWidth;\n var h = this.innerHeight;\n\n if (w > 0 && h > 0) {\n var x = this.pointerX;\n var y = this.pointerY;\n var bwh = this.pointerBaseWidth / 2;\n var maxcr = $math.min(w / 2, h / 2);\n var crtl = $math.fitToRange(cr, 0, maxcr);\n var crtr = $math.fitToRange(cr, 0, maxcr);\n var crbr = $math.fitToRange(cr, 0, maxcr);\n var crbl = $math.fitToRange(cr, 0, maxcr); // corner coordinates\n // top left\n\n var xtl = 0;\n var ytl = 0; // top right\n\n var xtr = w;\n var ytr = 0; // bottom right\n\n var xbr = w;\n var ybr = h; // bottom left\n\n var xbl = 0;\n var ybl = h;\n var lineT = void 0;\n var lineR = void 0;\n var lineB = void 0;\n var lineL = void 0; // find stem base side: http://$math.stackexchange.com/questions/274712/calculate-on-which-side-of-straign-line-is-dot-located\n // d=(x−x1)(y2−y1)−(y−y1)(x2−x1)\n\n var d1 = (x - xtl) * (ybr - ytl) - (y - ytl) * (xbr - xtl);\n var d2 = (x - xbl) * (ytr - ybl) - (y - ybl) * (xtr - xbl); // top\n\n if (d1 > 0 && d2 > 0) {\n var stemX = $math.fitToRange(x, crtl + bwh, w - bwh - crtr);\n y = $math.fitToRange(y, -Infinity, 0);\n lineT = \"M\" + crtl + \",0 L\" + (stemX - bwh) + \",0 L\" + x + \",\" + y + \" L\" + (stemX + bwh) + \",0 L\" + (w - crtr) + \",0\";\n } else {\n lineT = \"M\" + crtl + \",0 L\" + (w - crtr) + \",0\";\n } // bottom\n\n\n if (d1 < 0 && d2 < 0) {\n var stemX = $math.fitToRange(x, crbl + bwh, w - bwh - crbr);\n y = $math.fitToRange(y, h, Infinity);\n lineB = \" L\" + (w - crbr) + \",\" + h + \" L\" + (stemX + bwh) + \",\" + h + \" L\" + x + \",\" + y + \" L\" + (stemX - bwh) + \",\" + h + \" L\" + crbl + \",\" + h;\n } else {\n lineB = \" L\" + crbl + \",\" + h;\n } // left\n\n\n if (d1 < 0 && d2 > 0) {\n var stemY = $math.fitToRange(y, crtl + bwh, h - crbl - bwh);\n x = $math.fitToRange(x, -Infinity, 0);\n lineL = \" L0,\" + (h - crbl) + \" L0,\" + (stemY + bwh) + \" L\" + x + \",\" + y + \" L0,\" + (stemY - bwh) + \" L0,\" + crtl;\n } else {\n lineL = \" L0,\" + crtl;\n } // right\n\n\n if (d1 > 0 && d2 < 0) {\n var stemY = $math.fitToRange(y, crtr + bwh, h - bwh - crbr);\n x = $math.fitToRange(x, w, Infinity);\n lineR = \" L\" + w + \",\" + crtr + \" L\" + w + \",\" + (stemY - bwh) + \" L\" + x + \",\" + y + \" L\" + w + \",\" + (stemY + bwh) + \" L\" + w + \",\" + (h - crbr);\n } else {\n lineR = \" L\" + w + \",\" + (h - crbr);\n }\n\n var arcTR = \" a\" + crtr + \",\" + crtr + \" 0 0 1 \" + crtr + \",\" + crtr;\n var arcBR = \" a\" + crbr + \",\" + crbr + \" 0 0 1 -\" + crbr + \",\" + crbr;\n var arcBL = \" a\" + crbl + \",\" + crbl + \" 0 0 1 -\" + crbl + \",-\" + crbl;\n var arcTL = \" a\" + crtl + \",\" + crtl + \" 0 0 1 \" + crtl + \",-\" + crtl;\n this.path = lineT + arcTR + lineR + arcBR + lineB + arcBL + lineL + arcTL;\n }\n };\n\n Object.defineProperty(PointedRectangle.prototype, \"cornerRadius\", {\n /**\r\n * @return Corner radius (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cornerRadius\");\n },\n\n /**\r\n * Radius of rectangle's border in pixels.\r\n *\r\n * @default 0\r\n * @param value Corner radius (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"cornerRadius\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return PointedRectangle;\n}(PointedShape);\n\nexport { PointedRectangle };","/**\r\n * A collection of functions that deals with path calculations.\r\n */\nimport * as $math from \"../utils/Math\";\nimport * as $type from \"../utils/Type\";\nimport { getGhostPaper } from \"../rendering/Paper\";\nimport { options } from \"../Options\";\n/**\r\n * ============================================================================\r\n * PATH FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Returns an SVG path from a number of points.\r\n *\r\n * @ignore Exclude from docs\r\n * @param points An array of line elbow points\r\n * @return SVG path\r\n */\n\nexport function polyline(points) {\n var path = lineTo(points[0]);\n var prevPoint = {\n x: 0,\n y: 0\n };\n var minStep = options.minPolylineStep;\n\n if (!$type.isNumber(minStep)) {\n minStep = 0.5;\n }\n\n for (var i = 0, len = points.length; i < len; i++) {\n var point = points[i];\n\n if ($math.getDistance(point, prevPoint) > minStep) {\n path += lineTo(point);\n prevPoint = point;\n }\n }\n\n return path;\n}\n/**\r\n * Returns a starting point of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Starting point\r\n * @return SVG path\r\n */\n\nexport function moveTo(point) {\n return \" M\" + $math.round(point.x, 4) + \",\" + $math.round(point.y, 4) + \" \";\n}\n/**\r\n * Returns a line part of SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point SVG path\r\n * @return SVG path\r\n */\n\nexport function lineTo(point) {\n return \" L\" + $math.round(point.x, 4) + \",\" + $math.round(point.y, 4) + \" \";\n}\n/**\r\n * Returns a quadratic curve part of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point End point of the curve\r\n * @param controlPoint Control point\r\n * @return SVG path\r\n */\n\nexport function quadraticCurveTo(point, controlPoint) {\n return \" Q\" + $math.round(controlPoint.x, 4) + \",\" + $math.round(controlPoint.y, 4) + \" \" + $math.round(point.x, 4) + \",\" + $math.round(point.y, 4);\n}\n/**\r\n * Returns a cubic curve part of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point End point of the curve\r\n * @param controlPointA Control point A\r\n * @param controlPointB Control point B\r\n * @return SVG path\r\n */\n\nexport function cubicCurveTo(point, controlPointA, controlPointB) {\n return \" C\" + $math.round(controlPointA.x, 4) + \",\" + $math.round(controlPointA.y, 4) + \" \" + $math.round(controlPointB.x, 4) + \",\" + $math.round(controlPointB.y, 4) + \" \" + $math.round(point.x, 4) + \",\" + $math.round(point.y, 4);\n}\n/**\r\n * Returns a terminator for an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @return SVG path\r\n */\n\nexport function closePath() {\n return \" Z\";\n}\n/**\r\n * Returns an arc part of an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Better parameter descriptions\r\n * @param startAngle Starting angle\r\n * @param arc Arc\r\n * @param radius Radius\r\n * @param radiusY Vertical radius\r\n * @return SVG path\r\n */\n\nexport function arcTo(startAngle, arc, radius, radiusY) {\n if (arc == 0) {\n return \"\";\n }\n\n if (!$type.isNumber(radiusY)) {\n radiusY = radius;\n }\n\n var path = \"\";\n var c = \",\";\n var segments = Math.ceil(Math.abs(arc) / 180);\n var l = 1;\n\n if (arc < 0) {\n l = 0;\n } // previous, as we use a not A\n\n\n var pax = 0;\n var pay = 0; // center\n\n var cx = -$math.cos(startAngle) * radius;\n var cy = -$math.sin(startAngle) * radiusY; // foir very short angles and big radius, solves artefacts\n\n if (arc < 0.5 && radius > 3000) {\n var endAngle = startAngle + arc;\n var ax = $math.round($math.cos(endAngle) * radius, 4);\n var ay = $math.round($math.sin(endAngle) * radiusY, 4);\n return lineTo({\n x: ax,\n y: ay\n });\n }\n\n for (var i = 0; i < segments; i++) {\n var endAngle = startAngle + arc / segments * (i + 1);\n var ax = $math.round($math.cos(endAngle) * radius + cx - pax, 4);\n var ay = $math.round($math.sin(endAngle) * radiusY + cy - pay, 4);\n path += \" a\" + radius + c + radiusY + c + 0 + c + 0 + c + l + c + ax + c + ay;\n pax = ax;\n pay = ay;\n }\n\n return path;\n}\n/**\r\n * Creates an arc path.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startAngle [description]\r\n * @param arc [description]\r\n * @param radius [description]\r\n * @param innerRadius [description]\r\n * @param radiusY [description]\r\n * @param cornerRadius [description]\r\n * @param innerCornerRadius [description]\r\n * @return SVG path\r\n */\n\nexport function arc(startAngle, arc, radius, innerRadius, radiusY, cornerRadius, innerCornerRadius) {\n if (arc == 0) {\n return \"\";\n }\n\n if (!$type.isNumber(innerRadius)) {\n innerRadius = 0;\n }\n\n if (radius == 0 && innerRadius <= 0) {\n return \"\";\n }\n\n if (radius < innerRadius) {\n var temp = radius;\n radius = innerRadius;\n innerRadius = temp;\n\n if ($type.isNumber(radiusY)) {\n radiusY = radiusY / innerRadius * radius;\n }\n }\n\n arc = $math.min(arc, 360);\n\n if (arc == 360) {\n cornerRadius = 0;\n innerCornerRadius = 0;\n }\n\n var endAngle = startAngle + arc;\n var crSin = $math.sin($math.min(arc, 45) / 2);\n radiusY = $type.isNumber(radiusY) ? radiusY : radius;\n cornerRadius = cornerRadius || 0;\n innerCornerRadius = $type.isNumber(innerCornerRadius) ? innerCornerRadius : cornerRadius;\n var innerRadiusY = radiusY / radius * innerRadius;\n var cornerRadiusY = radiusY / radius * cornerRadius;\n var innerCornerRadiusY = radiusY / radius * innerCornerRadius;\n cornerRadius = $math.fitToRange(cornerRadius, 0, (radius - innerRadius) / 2);\n cornerRadiusY = $math.fitToRange(cornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\n innerCornerRadius = $math.fitToRange(innerCornerRadius, 0, (radius - innerRadius) / 2);\n innerCornerRadiusY = $math.fitToRange(innerCornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\n cornerRadius = $math.round($math.fitToRange(cornerRadius, 0, radius * crSin), 4);\n cornerRadiusY = $math.round($math.fitToRange(cornerRadiusY, 0, radiusY * crSin), 4);\n innerCornerRadius = $math.round($math.fitToRange(innerCornerRadius, 0, innerRadius * crSin), 4);\n innerCornerRadiusY = $math.round($math.fitToRange(innerCornerRadiusY, 0, innerRadiusY * crSin), 4);\n var crAngle = Math.asin(cornerRadius / radius / 2) * $math.DEGREES * 2;\n var crAngleY = Math.asin(cornerRadiusY / radiusY / 2) * $math.DEGREES * 2;\n\n if (innerRadius < innerCornerRadius) {\n innerRadius = innerCornerRadius;\n }\n\n if (innerRadiusY < innerCornerRadiusY) {\n innerRadiusY = innerCornerRadiusY;\n }\n\n var crInnerAngle = Math.asin(innerCornerRadius / innerRadius / 2) * $math.DEGREES * 2;\n var crInnerAngleY = Math.asin(innerCornerRadiusY / innerRadiusY / 2) * $math.DEGREES * 2;\n\n if (!$type.isNumber(crInnerAngle)) {\n crInnerAngle = 0;\n }\n\n if (!$type.isNumber(crInnerAngleY)) {\n crInnerAngleY = 0;\n }\n\n var middleAngle = startAngle + arc / 2;\n var mPoint = {\n x: $math.round($math.cos(middleAngle) * innerRadius, 4),\n y: $math.sin(middleAngle) * innerRadiusY\n };\n var a0 = {\n x: $math.cos(startAngle) * (innerRadius + innerCornerRadius),\n y: $math.sin(startAngle) * (innerRadiusY + innerCornerRadiusY)\n };\n var b0 = {\n x: $math.cos(startAngle) * (radius - cornerRadius),\n y: $math.sin(startAngle) * (radiusY - cornerRadiusY)\n };\n var c0 = {\n x: $math.cos(endAngle) * (radius - cornerRadius),\n y: $math.sin(endAngle) * (radiusY - cornerRadiusY)\n };\n var d0 = {\n x: $math.cos(endAngle) * (innerRadius + innerCornerRadius),\n y: $math.sin(endAngle) * (innerRadiusY + innerCornerRadiusY)\n };\n var b1 = {\n x: $math.cos(startAngle + crAngle) * radius,\n y: $math.sin(startAngle + crAngleY) * radiusY\n };\n var d1 = {\n x: $math.cos(endAngle - crInnerAngle) * innerRadius,\n y: $math.sin(endAngle - crInnerAngleY) * innerRadiusY\n }; // some magic math\n\n innerCornerRadius += innerCornerRadius * $math.sin(crInnerAngle / 2);\n innerCornerRadiusY += innerCornerRadiusY * $math.sin(crInnerAngleY / 2);\n\n if (crInnerAngle > (endAngle - startAngle) / 2) {\n d1 = mPoint;\n }\n\n var path = \"\"; // start from b if this is full circle\n\n if (arc == 360) {\n path = moveTo(b0);\n } // otherwise start from a\n else {\n path = moveTo(a0);\n path += lineTo(b0);\n path += arcToPoint(b1, cornerRadius, cornerRadiusY, true);\n } // draw arc\n\n\n path += arcTo(startAngle + crAngle, arc - 2 * crAngle, radius, radiusY); // draw inner arc\n\n if ($type.isNumber(innerRadius) && innerRadius != 0) {\n // move to B if this is full circle\n if (arc == 360 && cornerRadius == 0) {\n path += moveTo(d0);\n } // draw line otherwise\n else {\n path += arcToPoint(c0, cornerRadius, cornerRadiusY, true);\n path += lineTo(d0);\n path += arcToPoint(d1, innerCornerRadius, innerCornerRadiusY, true);\n }\n\n path += arcTo(endAngle - crInnerAngle, -(arc - 2 * crInnerAngle), innerRadius, innerRadiusY);\n\n if (arc < 360 || cornerRadius > 0) {\n path += arcToPoint(a0, innerCornerRadius, innerCornerRadiusY, true);\n }\n\n path += lineTo(a0);\n } else {\n path += arcToPoint(c0, cornerRadius, cornerRadiusY, true);\n\n if (arc < 360) {\n path += lineTo(a0);\n }\n }\n\n return path;\n}\n/**\r\n * Creates a path for an arc to specific coordinate.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param point Reference point\r\n * @param radius Radius\r\n * @param radiusY Vertical radius (for skewed arcs)\r\n * @param sweepFlag [description]\r\n * @param largeArcFlag [description]\r\n * @param xAxisRotation [description]\r\n * @return Arc path\r\n */\n\nexport function arcToPoint(point, radius, radiusY, sweepFlag, largeArcFlag, xAxisRotation) {\n if (radius == 0) {\n return \"\";\n }\n\n xAxisRotation = xAxisRotation || 0;\n largeArcFlag = Boolean(largeArcFlag);\n sweepFlag = Boolean(sweepFlag);\n var c = \",\";\n var sweepFlagValue = +sweepFlag; // converts to 1 or 0\n\n var largeArcFlagValue = +largeArcFlag; // converts to 1 or 0\n\n return \" A\" + radius + c + radiusY + c + xAxisRotation + c + largeArcFlagValue + c + sweepFlagValue + c + $math.round(point.x, 4) + c + $math.round(point.y, 4);\n}\n/**\r\n * Creates a new rectangle.\r\n *\r\n * @ignore Exclude from docs\r\n * @param width Width (px)\r\n * @param height Height (px)\r\n * @param x X position\r\n * @param y Y position\r\n * @return Rectangle\r\n */\n\nexport function rectangle(width, height, x, y) {\n if (!$type.isNumber(x)) {\n x = 0;\n }\n\n if (!$type.isNumber(y)) {\n y = 0;\n }\n\n return moveTo({\n x: x,\n y: y\n }) + lineTo({\n x: x + width,\n y: y\n }) + lineTo({\n x: x + width,\n y: y + height\n }) + lineTo({\n x: x,\n y: y + height\n }) + closePath();\n}\n/**\r\n * Converts a rectangle to an SVG path.\r\n *\r\n * @ignore Exclude from docs\r\n * @param rect Rectangle\r\n * @param ccw Counter-clockwise?\r\n * @return SVG path\r\n */\n\nexport function rectToPath(rect, ccw) {\n var c = \",\";\n var L = \" L\";\n\n if (ccw) {\n return \"M\" + rect.x + c + rect.y + L + rect.x + c + (rect.y + rect.height) + L + (rect.x + rect.width) + c + (rect.y + rect.height) + L + (rect.x + rect.width) + c + rect.y + L + rect.x + c + rect.y;\n } else {\n return \"M\" + rect.x + c + rect.y + L + (rect.x + rect.width) + c + rect.y + L + (rect.x + rect.width) + c + (rect.y + rect.height) + L + rect.x + c + (rect.y + rect.height) + L + rect.x + c + rect.y;\n }\n}\n/**\r\n * Converts SVG path to array of points.\r\n *\r\n * Note, this is experimental feature based on method which is deprecated\r\n * on some browsers and some browsers do not support it at all.\r\n *\r\n * You can save the output of this function, but not rely on it completely.\r\n */\n\nexport function pathToPoints(path, pointCount) {\n var paper = getGhostPaper();\n var svgPath = paper.add(\"path\").node;\n svgPath.setAttribute(\"d\", path);\n\n if (svgPath.getPointAtLength && svgPath.getTotalLength) {\n var length_1 = svgPath.getTotalLength();\n var toPoints = [];\n\n for (var i = 0; i < pointCount; i++) {\n var point = svgPath.getPointAtLength(i / pointCount * length_1);\n toPoints.push({\n x: point.x,\n y: point.y\n });\n }\n\n return toPoints;\n }\n\n svgPath.remove();\n}\nexport function spiralPoints(cx, cy, radius, radiusY, innerRadius, step, radiusStep, startAngle, endAngle) {\n if (!$type.isNumber(startAngle)) {\n startAngle = 0;\n }\n\n if (!$type.isNumber(startAngle)) {\n endAngle = startAngle;\n }\n\n var r = innerRadius + 0.01;\n var angle = startAngle * $math.RADIANS;\n var points = [];\n\n while (r < radius + radiusStep) {\n var stepSize = step;\n\n if (stepSize / 2 > r) {\n stepSize = 2 * r;\n }\n\n angle += 2 * Math.asin(stepSize / 2 / r);\n\n if (angle * $math.DEGREES > endAngle + (radius - innerRadius) / radiusStep * 360) {\n break;\n }\n\n var degrees = angle * $math.DEGREES;\n var point = {\n x: cx + r * Math.cos(angle),\n y: cy + r * radiusY / radius * Math.sin(angle)\n };\n points.push(point);\n r = innerRadius + degrees / 360 * radiusStep;\n }\n\n points.shift();\n return points;\n}\nexport function pointsToPath(points) {\n if (!points || points.length == 0) {\n return \"\";\n }\n\n var path = moveTo(points[0]);\n\n if (points && points.length > 0) {\n for (var i = 1; i < points.length; i++) {\n path += lineTo(points[i]);\n }\n }\n\n return path;\n}","/**\r\n * Polyline module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { color } from \"../utils/Color\";\nimport { registry } from \"../Registry\";\nimport * as $path from \"../rendering/Path\";\nimport * as $math from \"../utils/Math\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a polyline.\r\n *\r\n * @see {@link IPolylineEvents} for a list of available events\r\n * @see {@link IPolylineAdapters} for a list of available Adapters\r\n */\n\nvar Polyline =\n/** @class */\nfunction (_super) {\n __extends(Polyline, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Polyline() {\n var _this = _super.call(this) || this;\n /**\r\n * [_distance description]\r\n *\r\n * @todo Description\r\n */\n\n\n _this._distance = 0;\n _this.className = \"Polyline\";\n _this.element = _this.paper.add(\"path\");\n _this.shapeRendering = \"auto\";\n _this.fill = color();\n _this.strokeOpacity = 1;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Creats and adds an SVG path for the arc.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Polyline.prototype.makePath = function () {\n this._distance = 0;\n var segments = this.segments;\n\n if (segments && segments.length > 0) {\n var path = \"\";\n\n for (var i = 0, len = segments.length; i < len; i++) {\n var points = segments[i];\n\n if (points.length > 0) {\n path += $path.moveTo(points[0]);\n\n for (var p = 1; p < points.length; p++) {\n var point = points[p];\n path += $path.lineTo(point);\n this._distance += $math.getDistance(points[p - 1], point);\n }\n }\n }\n\n this.path = path;\n }\n\n this._realSegments = segments;\n };\n\n Object.defineProperty(Polyline.prototype, \"segments\", {\n /**\r\n * @return Segments\r\n */\n get: function get() {\n return this.getPropertyValue(\"segments\");\n },\n\n /**\r\n * A list of segment coordinates for the multi-part line.\r\n *\r\n * @todo Example\r\n * @param segments Segments\r\n */\n set: function set(segments) {\n this.setPropertyValue(\"segments\", segments);\n this.makePath();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Polyline.prototype, \"distance\", {\n /**\r\n * [distance description]\r\n *\r\n * @todo Description\r\n * @return [description]\r\n */\n get: function get() {\n return this._distance;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\n\n Polyline.prototype.positionToPoint = function (position) {\n var deltaAngle = 0;\n\n if (position < 0) {\n position = Math.abs(position);\n deltaAngle = 180;\n }\n\n var segments = this._realSegments;\n\n if (segments) {\n var totalDistance = this.distance;\n var currentDistance = 0;\n var distanceAB = void 0;\n var positionA = 0;\n var positionB = 0;\n var pointA = void 0;\n var pointB = void 0;\n\n for (var s = 0; s < segments.length; s++) {\n var points = segments[s];\n\n if (points.length > 1) {\n for (var p = 1; p < points.length; p++) {\n pointA = points[p - 1];\n pointB = points[p];\n positionA = currentDistance / totalDistance;\n distanceAB = $math.getDistance(pointA, pointB);\n currentDistance += distanceAB;\n positionB = currentDistance / totalDistance;\n\n if (positionA <= position && positionB > position) {\n s = segments.length;\n break;\n }\n }\n } else if (points.length == 1) {\n pointA = points[0];\n pointB = points[0];\n positionA = 0;\n positionB = 1;\n }\n }\n\n if (pointA && pointB) {\n var positionAB = (position - positionA) / (positionB - positionA);\n var midPoint = $math.getMidPoint(pointA, pointB, positionAB);\n return {\n x: midPoint.x,\n y: midPoint.y,\n angle: deltaAngle + $math.getAngle(pointA, pointB)\n };\n }\n }\n\n return {\n x: 0,\n y: 0,\n angle: 0\n };\n };\n\n Object.defineProperty(Polyline.prototype, \"realSegments\", {\n /**\r\n * @ignore\r\n */\n get: function get() {\n return this._realSegments;\n },\n enumerable: true,\n configurable: true\n });\n return Polyline;\n}(Sprite);\n\nexport { Polyline };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Polyline\"] = Polyline;","/**\r\n * Module for a multi-part arched line.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Polyline } from \"./Polyline\";\nimport { registry } from \"../Registry\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $path from \"../../core/rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a multi-part arched line.\r\n *\r\n * @see {@link IPolyarcEvents} for a list of available events\r\n * @see {@link IPolyarcAdapters} for a list of available Adapters\r\n */\n\nvar Polyarc =\n/** @class */\nfunction (_super) {\n __extends(Polyarc, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Polyarc() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Polyarc\";\n _this.controlPointDistance = 0.5;\n _this.controlPointPosition = 0.5;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Creats and adds an SVG path for the arc.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Polyarc.prototype.makePath = function () {\n this._distance = 0;\n var segments = this.segments;\n\n if (segments && segments.length > 0) {\n var path = \"\";\n this._realSegments = [];\n\n for (var i = 0, len = segments.length; i < len; i++) {\n var points = segments[i];\n var realPoints = [];\n\n this._realSegments.push(realPoints);\n\n if (points.length > 0) {\n path += $path.moveTo(points[0]);\n\n for (var p = 1; p < points.length; p++) {\n var pointA = points[p - 1];\n var pointB = points[p];\n var distanceAB = $math.getDistance(pointB, pointA);\n var cpDistance = distanceAB * this.controlPointDistance;\n var controlPointPosition = this.controlPointPosition;\n var angle = -$math.getAngle(pointA, pointB);\n var cpx = pointA.x + (pointB.x - pointA.x) * controlPointPosition * 0.5 - cpDistance * $math.sin(angle);\n var cpy = pointA.y + (pointB.y - pointA.y) * controlPointPosition * 0.5 - cpDistance * $math.cos(angle);\n var controlPoint1 = {\n x: cpx,\n y: cpy\n };\n var cpx2 = pointA.x + (pointB.x - pointA.x) * controlPointPosition * 1.5 - cpDistance * $math.sin(angle);\n var cpy2 = pointA.y + (pointB.y - pointA.y) * controlPointPosition * 1.5 - cpDistance * $math.cos(angle);\n var controlPoint2 = {\n x: cpx2,\n y: cpy2\n };\n path += $path.cubicCurveTo(pointB, controlPoint1, controlPoint2); // we add a lot of points in order to get the position/angle later\n\n var stepCount = Math.ceil(distanceAB);\n var prevPoint = pointA;\n\n if (stepCount > 0) {\n for (var i_1 = 0; i_1 <= stepCount; i_1++) {\n var point = $math.getPointOnCubicCurve(pointA, pointB, controlPoint1, controlPoint2, i_1 / stepCount);\n realPoints.push(point);\n this._distance += $math.getDistance(prevPoint, point);\n prevPoint = point;\n }\n } else {\n realPoints.push(pointA);\n }\n }\n }\n }\n\n this.path = path;\n }\n };\n\n Object.defineProperty(Polyarc.prototype, \"controlPointPosition\", {\n /**\r\n * @return Position (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"controlPointPosition\");\n },\n\n /**\r\n * Relative position along the line the control point is. (0-1)\r\n *\r\n * @default 0.5\r\n * @param value Position (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"controlPointPosition\", value);\n this.makePath();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Polyarc.prototype, \"controlPointDistance\", {\n /**\r\n * @return Distance (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"controlPointDistance\");\n },\n\n /**\r\n * Relative distance of the control point. (0-1)\r\n *\r\n * Default is half the length of the line. (0.5)\r\n *\r\n * @default 0.5\r\n * @param value Distance (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"controlPointDistance\", value);\n this.makePath();\n },\n enumerable: true,\n configurable: true\n });\n return Polyarc;\n}(Polyline);\n\nexport { Polyarc };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Polyarc\"] = Polyarc;","/**\r\n * Morpher module contains functionality that allows morphing one polygon to\r\n * another.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { BaseObject } from \"../Base\";\nimport { Animation, AnimationDisposer } from \"../utils/Animation\";\nimport * as $math from \"../utils/Math\";\nimport * as $ease from \"../utils/Ease\";\nimport * as $type from \"../utils/Type\";\n/**\r\n * Morpher can be used to morph one polygon to some other polygon.\r\n */\n\nvar Morpher =\n/** @class */\nfunction (_super) {\n __extends(Morpher, _super);\n /**\r\n * Constructor.\r\n *\r\n * @param morphable An object to morph\r\n */\n\n\n function Morpher(morphable) {\n var _this = _super.call(this) || this;\n /**\r\n * A storage for measurements.\r\n */\n\n\n _this._bboxes = [];\n /**\r\n * Duration of the morphing animation in milliseconds.\r\n */\n\n _this.morphDuration = 800;\n /**\r\n * An easing function to use for morphing animation.\r\n *\r\n * @see {@link Ease}\r\n */\n\n _this.morphEasing = $ease.cubicOut;\n /**\r\n * If set to `true`, all separate parts of the multi-part polygon will\r\n * morph into a single circle or polygon when using built-in methods\r\n * `morphToCircle()` or `morphToPolygon()`.\r\n *\r\n * Otherwise each separate part of polygon will morph to individual target\r\n * circle or polgyon.\r\n */\n\n _this.morphToSingle = true;\n /**\r\n * A ratio to scale morphed object in relation to the source object.\r\n */\n\n _this.scaleRatio = 1;\n _this.className = \"Morpher\";\n _this.morphable = morphable;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Morphs a polygon to another polygon.\r\n *\r\n * @param toPoints Corner points of the target shape\r\n * @param duration Duration in milliseconds\r\n * @param easing Easing function\r\n * @return Animation\r\n */\n\n\n Morpher.prototype.morphToPolygon = function (toPoints, duration, easing) {\n var points = this.morphable.currentPoints;\n\n if (points && toPoints) {\n this.sortPoints(points);\n this.sortPoints(toPoints);\n this._morphFromPointsReal = [];\n this._morphToPointsReal = [];\n\n if (!$type.hasValue(duration)) {\n duration = this.morphDuration;\n }\n\n if (!$type.hasValue(easing)) {\n easing = this.morphEasing;\n }\n\n this._morphFromPointsReal = this.normalizePoints(toPoints, points);\n this._morphToPointsReal = this.normalizePoints(points, toPoints);\n this.morphable.currentPoints = this._morphFromPointsReal;\n var animation = new Animation(this, {\n property: \"morphProgress\",\n from: 0,\n to: 1\n }, duration, easing);\n\n this._disposers.push(animation);\n\n animation.start();\n return animation;\n }\n };\n /**\r\n * [normalizePoints description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param pointsA Point A\r\n * @param pointsB Point B\r\n * @return Normalized points\r\n */\n\n\n Morpher.prototype.normalizePoints = function (pointsA, pointsB) {\n for (var i = 0, len = pointsA.length; i < len; i++) {\n var surfaceA = pointsA[i][0];\n var holeA = pointsA[i][1];\n var bboxA = $type.getValue($math.getBBox(surfaceA));\n var middleX = bboxA.x + bboxA.width;\n var middleY = bboxA.y + bboxA.height; // check if we have the same in PointsB\n\n if (!pointsB[i]) {\n pointsB[i] = [];\n } // check if we have surface in pointsB\n\n\n if (surfaceA && !pointsB[i][0]) {\n pointsB[i][0] = [{\n x: middleX,\n y: middleY\n }, {\n x: middleX,\n y: middleY\n }];\n }\n\n if (pointsB[i][0]) {\n pointsB[i][0] = this.addPoints(pointsB[i][0], surfaceA.length);\n var distance = Infinity;\n var splitAt = 0;\n\n for (var a = 0; a < pointsB[i][0].length; a++) {\n var newDistance = $math.getDistance(pointsB[i][0][a], surfaceA[0]);\n\n if (newDistance < distance) {\n splitAt = a;\n distance = newDistance;\n }\n }\n\n var partA = pointsB[i][0].slice(0, splitAt);\n var partB = pointsB[i][0].slice(splitAt);\n pointsB[i][0] = partB.concat(partA);\n }\n\n if (holeA) {\n if (!pointsB[i][1]) {\n pointsB[i][1] = [{\n x: middleX,\n y: middleY\n }, {\n x: middleX,\n y: middleY\n }];\n }\n\n pointsB[i][1] = this.addPoints(pointsB[i][1], holeA.length);\n }\n }\n\n return pointsB;\n };\n /**\r\n * [sortPoints description]\r\n *\r\n * @ignore Exclude from doc\r\n * @todo Description\r\n * @param points [description]\r\n * @return common bbox of points\r\n */\n\n\n Morpher.prototype.sortPoints = function (points) {\n points.sort(function (a, b) {\n var bbox1 = $type.getValue($math.getBBox(a[0]));\n var bbox2 = $type.getValue($math.getBBox(b[0]));\n\n if (bbox1.width * bbox1.height > bbox2.width * bbox2.height) {\n return -1;\n } else {\n return 1;\n }\n });\n var bboxes = [];\n\n for (var i = 0, len = points.length; i < len; i++) {\n var surface = points[i][0];\n\n if (surface) {\n bboxes.push($type.getValue($math.getBBox(surface)));\n }\n }\n\n return $math.getCommonRectangle(bboxes);\n };\n /**\r\n * Morphs polygon to a circle (it is actually a polygon which makes a circle).\r\n *\r\n * @param radius Target circle radius (px)\r\n * @param duration Duration (ms)\r\n * @param easing Easing function\r\n * @return Animation\r\n */\n\n\n Morpher.prototype.morphToCircle = function (radius, duration, easing) {\n var points = this.morphable.points;\n var commonBBox = this.sortPoints(points);\n this._morphFromPointsReal = [];\n this._morphToPointsReal = [];\n\n if (!$type.hasValue(duration)) {\n duration = this.morphDuration;\n }\n\n if (!$type.hasValue(easing)) {\n easing = this.morphEasing;\n } // surface\n\n\n for (var i = 0, len = points.length; i < len; i++) {\n var surface = points[i][0];\n var hole = points[i][1];\n this._morphFromPointsReal[i] = [];\n this._morphToPointsReal[i] = [];\n\n if (surface) {\n var toPoints = surface;\n var fromPoints = surface;\n var bbox = $type.getValue($math.getBBox(fromPoints)); // this._bboxes[i];\n\n if (this.morphToSingle) {\n bbox = $type.getValue(commonBBox);\n }\n\n var middleX = bbox.x + bbox.width / 2;\n var middleY = bbox.y + bbox.height / 2;\n var realRadius = radius;\n\n if (!$type.isNumber(realRadius)) {\n realRadius = Math.min(bbox.width / 2, bbox.height / 2);\n }\n\n toPoints = []; // find angle for the first point\n\n var startAngle = $math.getAngle({\n x: middleX,\n y: middleY\n }, surface[0]);\n var count = 100;\n\n if (surface.length > count) {\n count = surface.length;\n }\n\n fromPoints = this.addPoints(surface, count);\n count = fromPoints.length; // add Points might increase number a bit\n\n var angle = 360 / (count - 1);\n\n for (var a = 0; a < count; a++) {\n var realAngle = angle * a + startAngle;\n var pointOnCircle = {\n x: middleX + realRadius * $math.cos(realAngle),\n y: middleY + realRadius * $math.sin(realAngle)\n };\n toPoints[a] = pointOnCircle;\n }\n\n if (hole && hole.length > 0) {\n for (var i_1 = 0, hlen = hole.length; i_1 < hlen; i_1++) {\n toPoints.push({\n x: middleX,\n y: middleY\n });\n }\n }\n\n this._morphFromPointsReal[i][0] = fromPoints;\n this._morphToPointsReal[i][0] = toPoints;\n }\n }\n\n this.morphable.currentPoints = this._morphFromPointsReal;\n var animation = new Animation(this, {\n property: \"morphProgress\",\n from: 0,\n to: 1\n }, duration, easing);\n\n this._disposers.push(animation);\n\n animation.start();\n return animation;\n };\n /**\r\n * [addPoints description]\r\n *\r\n * @ignore Exclude from doc\r\n * @todo Description\r\n * @param points [description]\r\n * @param mustHaveCount [description]\r\n * @return [description]\r\n */\n\n\n Morpher.prototype.addPoints = function (points, mustHaveCount) {\n var addToSegmentCount = Math.round(mustHaveCount / points.length);\n var newPoints = [];\n\n for (var i = 0, len = points.length; i < len; i++) {\n var point0 = points[i];\n var point1 = void 0;\n\n if (i == points.length - 1) {\n point1 = points[0];\n } else {\n point1 = points[i + 1];\n }\n\n newPoints.push(point0);\n\n for (var p = 1; p < addToSegmentCount; p++) {\n var percent = p / addToSegmentCount;\n var extraPoint = {\n x: point0.x + (point1.x - point0.x) * percent,\n y: point0.y + (point1.y - point0.y) * percent\n };\n newPoints.push(extraPoint);\n } // stop adding in case we already added more than left in original\n\n\n if (newPoints.length + points.length - i == mustHaveCount) {\n addToSegmentCount = 0;\n }\n }\n\n if (newPoints.length < mustHaveCount && points.length > 0) {\n var lastPoint = points[points.length - 1];\n\n for (var p = newPoints.length; p < mustHaveCount; p++) {\n // add same as last\n newPoints.push({\n x: lastPoint.x,\n y: lastPoint.y\n });\n }\n }\n\n return newPoints;\n };\n /**\r\n * Morphs polygon into a rectangular polygon.\r\n *\r\n * @param width Width of the target rectangle (px)\r\n * @param height Height of the target rectangle (px)\r\n * @param duration Duration (ms)\r\n * @param easing Easing function\r\n * @return Animation\r\n */\n\n\n Morpher.prototype.morphToRectangle = function (width, height, duration, easing) {\n var points = this.morphable.points;\n this.sortPoints(points);\n this._morphFromPointsReal = [];\n this._morphToPointsReal = [];\n\n if (!$type.hasValue(duration)) {\n duration = this.morphDuration;\n }\n\n if (!$type.hasValue(easing)) {\n easing = this.morphEasing;\n } //\t\tlet biggestBBox: IRectangle = this._bboxes[this._biggestIndex];\n // surface\n\n\n for (var i = 0, len = points.length; i < len; i++) {\n var surface = points[i][0];\n var hole = points[i][1];\n this._morphFromPointsReal[i] = [];\n this._morphToPointsReal[i] = [];\n\n if (surface) {\n var toPoints = surface;\n var fromPoints = surface;\n var bbox = this._bboxes[i]; // we only work with first area. TODO: maybe we should find the biggest one?\n\n if (this.morphToSingle) {//if (i != this._biggestIndex) {\n //\tbbox = { x: biggestBBox.x + biggestBBox.width / 2, y: biggestBBox.y + biggestBBox.height / 2, width: 0, height: 0 };\n //}\n }\n\n var x = bbox.x;\n var y = bbox.y;\n var realWidth = width;\n var realHeight = height;\n\n if (!$type.isNumber(realWidth)) {\n realWidth = bbox.width;\n }\n\n if (!$type.isNumber(realHeight)) {\n realHeight = bbox.height;\n }\n\n toPoints = [{\n x: x,\n y: y\n }, {\n x: x + realWidth,\n y: y\n }, {\n x: x + realWidth,\n y: y + realHeight\n }, {\n x: x,\n y: y + realHeight\n }];\n toPoints = this.addPoints(toPoints, surface.length); // if polygon has less points then count, add\n\n if (surface.length < 4) {\n for (var i_2 = surface.length; i_2 < 4; i_2++) {\n toPoints.push({\n x: surface[i_2].x,\n y: surface[i_2].y\n });\n }\n }\n\n if (hole && hole.length > 0) {\n var middleX = bbox.x + bbox.width / 2;\n var middleY = bbox.y + bbox.height / 2;\n\n for (var i_3 = 0, hlen = hole.length; i_3 < hlen; i_3++) {\n toPoints.push({\n x: middleX,\n y: middleY\n });\n }\n }\n\n this._morphFromPointsReal[i][0] = fromPoints;\n this._morphToPointsReal[i][0] = toPoints;\n }\n }\n\n this.morphable.currentPoints = this._morphFromPointsReal;\n var animation = new Animation(this, {\n property: \"morphProgress\",\n from: 0,\n to: 1\n }, duration, easing);\n\n this._disposers.push(animation);\n\n animation.start();\n return animation;\n };\n\n Object.defineProperty(Morpher.prototype, \"morphProgress\", {\n /**\r\n * Returns the progress of morph transition.\r\n *\r\n * @return Progress (0-1)\r\n */\n get: function get() {\n return this._morphProgress;\n },\n\n /**\r\n * Progress of the morph transition.\r\n *\r\n * Setting this will also trigger actual transformation.\r\n *\r\n * @param value Progress (0-1)\r\n */\n set: function set(value) {\n this._morphProgress = value;\n var currentPoints = [];\n\n if (value != null) {\n var fromPoints = this._morphFromPointsReal;\n var toPoints = this._morphToPointsReal;\n\n if (fromPoints != null && toPoints != null) {\n for (var i = 0, len = fromPoints.length; i < len; i++) {\n var currentArea = [];\n currentPoints.push(currentArea);\n var surfaceFrom = fromPoints[i][0];\n var holeFrom = fromPoints[i][1];\n var surfaceTo = toPoints[i][0];\n var holeTo = toPoints[i][1];\n\n if (surfaceFrom && surfaceFrom.length > 0 && surfaceTo && surfaceTo.length > 0) {\n var currentSurface = [];\n\n for (var i_4 = 0, slen = surfaceFrom.length; i_4 < slen; i_4++) {\n var point0 = surfaceFrom[i_4];\n var point1 = surfaceTo[i_4];\n var currentPoint = {\n x: point0.x + (point1.x * this.scaleRatio - point0.x) * value,\n y: point0.y + (point1.y * this.scaleRatio - point0.y) * value\n };\n currentSurface.push(currentPoint);\n }\n\n currentArea[0] = currentSurface;\n }\n\n if (holeFrom && holeFrom.length > 0 && holeTo && holeTo.length > 0) {\n var currentHole = [];\n\n for (var i_5 = 0, hlen = holeFrom.length; i_5 < hlen; i_5++) {\n var point0 = holeFrom[i_5];\n var point1 = holeTo[i_5];\n var currentPoint = {\n x: point0.x + (point1.x * this.scaleRatio - point0.x) * value,\n y: point0.y + (point1.y * this.scaleRatio - point0.y) * value\n };\n currentHole.push(currentPoint);\n }\n\n currentArea[1] = currentHole;\n }\n }\n }\n }\n\n this.morphable.currentPoints = currentPoints;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Restores the polygon to its original appearance.\r\n *\r\n * @param duration Duration (ms)\r\n * @param easing Easing function\r\n * @return Animation\r\n */\n\n Morpher.prototype.morphBack = function (duration, easing) {\n this._morphToPointsReal = this._morphFromPointsReal;\n this._morphFromPointsReal = this.morphable.currentPoints;\n\n if (!$type.hasValue(duration)) {\n duration = this.morphDuration;\n }\n\n if (!$type.hasValue(easing)) {\n easing = this.morphEasing;\n }\n\n var animation = new Animation(this, {\n property: \"morphProgress\",\n from: 0,\n to: 1\n }, duration, easing);\n\n this._disposers.push(animation);\n\n animation.start();\n return animation;\n };\n\n Object.defineProperty(Morpher.prototype, \"animations\", {\n /**\r\n * Returns a list of morph animations currently being played.\r\n *\r\n * @return List of animations\r\n */\n get: function get() {\n if (!this._animations) {\n this._animations = [];\n\n this._disposers.push(new AnimationDisposer(this._animations));\n }\n\n return this._animations;\n },\n enumerable: true,\n configurable: true\n });\n return Morpher;\n}(BaseObject);\n\nexport { Morpher };","/**\r\n * Polygon module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { Morpher } from \"../utils/Morpher\";\nimport { registry } from \"../Registry\";\nimport * as $path from \"../rendering/Path\";\nimport * as $type from \"../utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a polygon.\r\n *\r\n * @see {@link IPolygonEvents} for a list of available events\r\n * @see {@link IPolygonAdapters} for a list of available Adapters\r\n */\n\nvar Polygon =\n/** @class */\nfunction (_super) {\n __extends(Polygon, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Polygon() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Polygon\";\n _this.element = _this.paper.add(\"path\");\n _this.shapeRendering = \"auto\";\n _this._currentPoints = [];\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Polygon.prototype, \"points\", {\n /**\r\n * @return Polygon points\r\n */\n get: function get() {\n var points = this.getPropertyValue(\"points\");\n var path = this.path;\n\n if (path && (!points || points.length == 0)) {\n var valueStr = path.slice(1, path.length - 1);\n var segments = valueStr.split(\"ZM\");\n\n for (var s = 0; s < segments.length; s++) {\n var segment = segments[s];\n\n if (segment.length > 0) {\n var areaHole = segment.split(\"M\");\n var areaArr = areaHole[0];\n var holeArr = areaHole[1];\n\n if (areaArr && areaArr.length > 0) {\n var pointsArr = areaArr.split(\"L\");\n\n if (pointsArr.length > 0) {\n var area = [];\n var areaAndHole = [area];\n points.push(areaAndHole);\n\n for (var p = 0; p < pointsArr.length; p++) {\n var coords = pointsArr[p].split(\",\");\n area.push({\n x: +coords[0],\n y: +coords[1]\n });\n }\n\n if (holeArr && holeArr.length > 0) {\n var pointsArr_1 = holeArr.split(\"L\");\n\n if (pointsArr_1.length > 0) {\n var hole = [];\n areaAndHole.push(hole);\n\n for (var p = pointsArr_1.length - 1; p >= 0; p--) {\n var coords = pointsArr_1[p].split(\",\");\n hole.push({\n x: +coords[0],\n y: +coords[1]\n });\n }\n }\n }\n }\n }\n }\n }\n\n this.setPropertyValue(\"points\", points);\n this._currentPoints = points;\n }\n\n return points;\n },\n\n /**\r\n * An array of X/Y coordinates for each elbow of the polygon.\r\n *\r\n * @todo Example\r\n * @param points Polygon points\r\n */\n set: function set(points) {\n this.setPropertyValue(\"points\", points, true);\n this._currentPoints = points;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Polygon.prototype, \"currentPoints\", {\n /**\r\n * @return Polygon points\r\n */\n get: function get() {\n if ((!this._currentPoints || this._currentPoints.length == 0) && this.path) {\n this._currentPoints = this.points;\n }\n\n return this._currentPoints;\n },\n\n /**\r\n * Current points. Used when morphing the element, so that original `points`\r\n * are not overwritten.\r\n *\r\n * @param points Polygon points\r\n */\n set: function set(points) {\n if (this._currentPoints != points) {\n this._currentPoints = points;\n this.draw();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Polygon.prototype.draw = function () {\n var path = \"\";\n var points = this._currentPoints;\n var left;\n var right;\n var top;\n var bottom;\n\n if (points.length > 0) {\n // separate areas\n for (var i = 0, len = points.length; i < len; i++) {\n // surface\n var surface = points[i][0];\n var hole = points[i][1];\n\n if (surface && surface.length > 0) {\n var point = surface[0];\n path += $path.moveTo(point);\n\n for (var s = 0; s < surface.length; s++) {\n point = surface[s];\n path += $path.lineTo(point);\n\n if (!$type.isNumber(right) || right < point.x) {\n right = point.x;\n }\n\n if (!$type.isNumber(left) || left > point.x) {\n left = point.x;\n }\n\n if (!$type.isNumber(top) || top > point.y) {\n top = point.y;\n }\n\n if (!$type.isNumber(bottom) || bottom < point.y) {\n bottom = point.y;\n }\n }\n } // hole\n\n\n if (hole && hole.length > 0) {\n var point = hole[0];\n path += $path.moveTo(point);\n\n for (var h = 0, hlen = hole.length; h < hlen; h++) {\n point = hole[h];\n path += $path.lineTo(point);\n }\n }\n }\n\n if (path) {\n path += $path.closePath();\n }\n\n this.bbox.x = left;\n this.bbox.y = top;\n this.bbox.width = right - left;\n this.bbox.height = bottom - top;\n\n _super.prototype.setPath.call(this, path);\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n Polygon.prototype.setPath = function (value) {\n if (_super.prototype.setPath.call(this, value)) {\n this.points = [];\n this._bbox = this.group.getBBox();\n return true;\n }\n\n return false;\n };\n /**\r\n * Measures element\r\n */\n\n\n Polygon.prototype.measureElement = function () {// Overriding to avoid extra measurement.\n };\n\n Object.defineProperty(Polygon.prototype, \"centerPoint\", {\n /**\r\n * A calculated center point for the shape.\r\n *\r\n * @readonly\r\n * @return Center\r\n */\n get: function get() {\n return {\n x: this.bbox.x + this.bbox.width / 2,\n y: this.bbox.y + this.bbox.height / 2\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Polygon.prototype, \"morpher\", {\n /**\r\n * A [[Morpher]] instance that is used to morph polygon into some other\r\n * shape.\r\n *\r\n * @readonly\r\n * @return Morpher instance\r\n */\n get: function get() {\n if (!this._morpher) {\n this._morpher = new Morpher(this);\n\n this._disposers.push(this._morpher);\n }\n\n return this._morpher;\n },\n enumerable: true,\n configurable: true\n });\n return Polygon;\n}(Sprite);\n\nexport { Polygon };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Polygon\"] = Polygon;","/**\r\n * Polyspline (smoothed line) module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Polyline } from \"./Polyline\";\nimport { registry } from \"../Registry\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $path from \"../../core/rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a polysline. (smoothed multi-sigment line)\r\n *\r\n * @see {@link IPolysplineEvents} for a list of available events\r\n * @see {@link IPolysplineAdapters} for a list of available Adapters\r\n */\n\nvar Polyspline =\n/** @class */\nfunction (_super) {\n __extends(Polyspline, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Polyspline() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Polyspline\";\n _this.tensionX = 0.5;\n _this.tensionY = 0.5;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Creats and adds an SVG path for the arc.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Polyspline.prototype.makePath = function () {\n this._distance = 0;\n var segments = this.segments;\n var tensionX = this.tensionX;\n var tensionY = this.tensionY;\n this.allPoints = [];\n\n if (segments && segments.length > 0) {\n var path = \"\";\n this._realSegments = [];\n\n for (var i = 0, len = segments.length; i < len; i++) {\n var points = segments[i];\n var realPoints = [];\n\n this._realSegments.push(realPoints);\n\n if (points.length > 0) {\n var first = points[0];\n var last = points[points.length - 1];\n var closed_1 = false;\n\n if ($math.round(first.x, 3) == $math.round(last.x) && $math.round(first.y) == $math.round(last.y)) {\n closed_1 = true;\n }\n\n path += $path.moveTo(points[0]);\n\n for (var p = 0; p < points.length - 1; p++) {\n var p0 = points[p - 1];\n var p1 = points[p];\n var p2 = points[p + 1];\n var p3 = points[p + 2];\n\n if (p === 0) {\n p0 = points[p];\n } else if (p == points.length - 2) {\n p3 = points[p + 1];\n }\n\n if (!p3) {\n p3 = p2;\n }\n\n if (p === 0) {\n if (closed_1) {\n p0 = points[points.length - 2];\n } else {\n p0 = points[i];\n }\n } else if (p == points.length - 2) {\n if (closed_1) {\n p3 = points[1];\n } else {\n p3 = points[p + 1];\n }\n }\n\n var controlPointA = $math.getCubicControlPointA(p0, p1, p2, p3, tensionX, tensionY);\n var controlPointB = $math.getCubicControlPointB(p0, p1, p2, p3, tensionX, tensionY);\n path += $path.cubicCurveTo(p2, controlPointA, controlPointB); // now split to small segments so that we could have positionToPoint later\n\n var stepCount = Math.ceil($math.getCubicCurveDistance(p1, p2, controlPointA, controlPointB, 20)) * 1.2;\n var prevPoint = p1;\n\n if (stepCount > 0) {\n // not good for curved charts\n //this.allPoints[0] = { x: points[0].x, y: points[0].y, angle: $math.getAngle(points[0], points[1]) };\n //realPoints.push(this.allPoints[0]);\n for (var s = 0; s <= stepCount; s++) {\n var point = $math.getPointOnCubicCurve(p1, p2, controlPointA, controlPointB, s / stepCount);\n\n if (point.x == prevPoint.x && point.y == prevPoint.y) {\n continue;\n }\n\n realPoints.push(point);\n var angle = $math.round($math.getAngle(prevPoint, point), 5); //this.allPoints.push({ x: point.x, y: point.y, angle: angle });\n\n this._distance += $math.getDistance(prevPoint, point);\n this.allPoints[Math.floor(this._distance)] = {\n x: point.x,\n y: point.y,\n angle: angle\n };\n prevPoint = point;\n }\n } else {\n realPoints.push(p0);\n }\n }\n }\n\n var allPoints = this.allPoints;\n\n if (allPoints.length > 1) {\n for (var i_1 = 0; i_1 < allPoints.length; i_1++) {\n if (!allPoints[i_1]) {\n if (i_1 > 1) {\n allPoints[i_1] = allPoints[i_1 - 1];\n } else {\n for (var k = 1; k < allPoints.length; k++) {\n if (allPoints[k]) {\n allPoints[i_1] = allPoints[k];\n break;\n }\n }\n }\n }\n }\n }\n }\n\n this.path = path;\n }\n };\n /**\r\n * Returns an index of the point that is closest to specified coordinates.\r\n *\r\n * @param point Reference point\r\n * @return Index\r\n */\n\n\n Polyspline.prototype.getClosestPointIndex = function (point) {\n var points = this.allPoints;\n var index;\n var closest = Infinity;\n\n if (points.length > 1) {\n for (var p = 1; p < points.length; p++) {\n var distance = $math.getDistance(point, points[p]);\n\n if (distance < closest) {\n index = p;\n closest = distance;\n }\n }\n }\n\n return index;\n };\n\n Object.defineProperty(Polyspline.prototype, \"tensionX\", {\n /**\r\n * @return Tension\r\n */\n get: function get() {\n return this.getPropertyValue(\"tensionX\");\n },\n\n /**\r\n * Horizontal tension for the spline.\r\n *\r\n * Used by the line smoothing algorithm.\r\n *\r\n * @default 0.5\r\n * @param value Tension\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tensionX\", value);\n this.makePath();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Polyspline.prototype, \"tensionY\", {\n /**\r\n * @return Tension\r\n */\n get: function get() {\n return this.getPropertyValue(\"tensionY\");\n },\n\n /**\r\n * Vertical tension for the spline.\r\n *\r\n * Used by the line smoothing algorithm.\r\n *\r\n * @default 0.5\r\n * @param value Tensions\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tensionY\", value, true);\n this.makePath();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\n\n Polyspline.prototype.positionToPoint = function (position, extend) {\n var deltaAngle = 0;\n var allPoints = this.allPoints;\n var len = allPoints.length;\n\n if (!$type.isNumber(position)) {\n position = 0;\n }\n\n if (len > 1) {\n if (extend && len > 3) {\n if (position < 0) {\n if (position < -0.01) {\n position = -0.01;\n }\n\n var f0 = allPoints[0];\n var f1 = allPoints[1];\n var x = f0.x - (f0.x - f1.x) * len * position;\n var y = f0.y - (f0.y - f1.y) * len * position;\n return {\n x: x,\n y: y,\n angle: $math.getAngle(f0, f1)\n };\n } else if (position > 1) {\n if (position > 1.01) {\n position = 1.01;\n }\n\n var f0 = allPoints[allPoints.length - 2];\n var f1 = allPoints[allPoints.length - 3];\n var x = f0.x + (f0.x - f1.x) * len * (position - 1);\n var y = f0.y + (f0.y - f1.y) * len * (position - 1);\n return {\n x: x,\n y: y,\n angle: $math.getAngle(f0, {\n x: x,\n y: y\n })\n };\n } else if (position == 1) {\n var point_1 = allPoints[allPoints.length - 1];\n return {\n x: point_1.x,\n y: point_1.y,\n angle: point_1.angle\n };\n }\n } else {\n if (position < 0) {\n position = Math.abs(position);\n deltaAngle = 180;\n }\n\n if (position >= 1) {\n position = 0.9999999999999;\n }\n }\n\n var point = allPoints[Math.floor(position * len)];\n return {\n x: point.x,\n y: point.y,\n angle: point.angle + deltaAngle\n };\n } else if (len == 1) {\n var point = allPoints[0];\n return {\n x: point.x,\n y: point.y,\n angle: point.angle\n };\n } else {\n return {\n x: 0,\n y: 0,\n angle: 0\n };\n }\n };\n\n return Polyspline;\n}(Polyline);\n\nexport { Polyspline };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Polyspline\"] = Polyspline;","/**\r\n * Slice module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { Sprite } from \"../Sprite\";\nimport { registry } from \"../Registry\";\nimport * as $math from \"../utils/Math\";\nimport * as $path from \"../rendering/Path\";\nimport * as $type from \"../utils/Type\";\nimport * as $utils from \"../utils/Utils\";\nimport { Percent } from \"../utils/Percent\";\nimport { RadialGradient } from \"../rendering/fills/RadialGradient\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a wedged semi-circle - slice. Usually used for Pie/Donut charts.\r\n *\r\n * @see {@link ISliceEvents} for a list of available events\r\n * @see {@link ISliceAdapters} for a list of available Adapters\r\n */\n\nvar Slice =\n/** @class */\nfunction (_super) {\n __extends(Slice, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Slice() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"Slice\"; // Set defaults\n\n _this.setPropertyValue(\"cornerRadius\", 0);\n\n _this.setPropertyValue(\"startAngle\", 0);\n\n _this.setPercentProperty(\"innerRadius\", 0);\n\n _this.setPercentProperty(\"radius\", 0);\n\n _this.setPropertyValue(\"arc\", 0);\n\n _this.setPropertyValue(\"shiftRadius\", 0);\n\n _this.strokeOpacity = 1;\n\n _this.setPropertyValue(\"layout\", \"none\"); // Create a slice wedge element\n\n\n _this.slice = _this.createChild(Sprite);\n _this.slice.isMeasured = false;\n\n _this._disposers.push(_this.slice); //this.element.attr({ \"stroke-linejoin\": \"round\" });\n //this.element.attr({ \"stroke-linecap\": \"round\" });\n // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Slice.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var radiusY = this.radiusY;\n\n if (this.radius > 0 && radiusY == 0) {\n radiusY = 0.01;\n }\n\n this.slice.path = $path.arc(this.startAngle, this.arc, this.radius, this.pixelInnerRadius, radiusY, this.cornerRadius, this.innerCornerRadius);\n this.slice.invalidate();\n this.shiftRadius = this.shiftRadius;\n\n if (this.realFill instanceof RadialGradient) {\n this.updateGradient(this.realFill);\n }\n\n if (this.realStroke instanceof RadialGradient) {\n this.updateGradient(this.realStroke);\n }\n };\n\n Slice.prototype.updateGradient = function (gradient) {\n gradient.element.attr({\n \"gradientUnits\": \"userSpaceOnUse\"\n });\n gradient.element.attr({\n \"r\": this.radius\n });\n gradient.cx = 0;\n gradient.cy = 0;\n gradient.element.attr({\n radius: this.radius\n });\n };\n\n Object.defineProperty(Slice.prototype, \"bbox\", {\n /**\r\n * Returns bounding box (square) for this element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n get: function get() {\n if (this.definedBBox) {\n return this.definedBBox;\n }\n\n if (this.isMeasured) {\n var innerRect = $math.getArcRect(this.startAngle, this.startAngle + this.arc, this.pixelInnerRadius);\n var outerRect = $math.getArcRect(this.startAngle, this.startAngle + this.arc, this.radius);\n return $math.getCommonRectangle([innerRect, outerRect]);\n } else {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"startAngle\", {\n /**\r\n * @return Angle (0-360)\r\n */\n get: function get() {\n return this.getPropertyValue(\"startAngle\");\n },\n\n /**\r\n * The angle at which left edge of the slice is drawn. (0-360)\r\n *\r\n * 0 is to the right of the center.\r\n *\r\n * @param value Angle (0-360)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"startAngle\", $math.normalizeAngle(value), true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"arc\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this.getPropertyValue(\"arc\");\n },\n\n /**\r\n * [arc description]\r\n *\r\n * @todo Description\r\n * @param value [description]\r\n */\n set: function set(value) {\n if (!$type.isNumber(value)) {\n value = 0;\n }\n\n this.setPropertyValue(\"arc\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"radius\", {\n /**\r\n * @return Radius (px)\r\n */\n get: function get() {\n var radius = this.getPropertyValue(\"radius\");\n\n if (!$type.isNumber(radius)) {\n radius = 0;\n }\n\n return radius;\n },\n\n /**\r\n * Radius of the slice in pixels.\r\n *\r\n * @param value Radius (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"radius\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"radiusY\", {\n /**\r\n * @return Vertical radius (0-1)\r\n */\n get: function get() {\n var value = this.getPropertyValue(\"radiusY\");\n\n if (!$type.isNumber(value)) {\n value = this.radius;\n }\n\n return value;\n },\n\n /**\r\n * Vertical radius for creating skewed slices.\r\n *\r\n * This is relevant to `radius`, e.g. 0.5 will set vertical radius to half\r\n * the `radius`.\r\n *\r\n * @param value Vertical radius (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"radiusY\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"innerRadius\", {\n /**\r\n * @return Radius (px or %)\r\n */\n get: function get() {\n return this.getPropertyValue(\"innerRadius\");\n },\n\n /**\r\n * Inner radius of the slice for creating cut out (donut) slices.\r\n *\r\n * @default 0\r\n * @param value Radius (px or %)\r\n */\n set: function set(value) {\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"pixelInnerRadius\", {\n /**\r\n * @return Radius px\r\n */\n get: function get() {\n return $utils.relativeToValue(this.innerRadius, this.radius);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"cornerRadius\", {\n /**\r\n * @return Radius (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cornerRadius\");\n },\n\n /**\r\n * Radius of slice's outer corners in pixels.\r\n *\r\n * @default 0\r\n * @param value Radius (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"cornerRadius\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"innerCornerRadius\", {\n /**\r\n * @return Radius (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"innerCornerRadius\");\n },\n\n /**\r\n * Radius of slice's inner corners in pixels.\r\n *\r\n * @default 0\r\n * @param value Radius (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"innerCornerRadius\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"shiftRadius\", {\n /**\r\n * @return Radius shift\r\n */\n get: function get() {\n return this.getPropertyValue(\"shiftRadius\");\n },\n\n /**\r\n * Indicates how far (relatively to center) a slice should be moved.\r\n *\r\n * The value is relative to the radius of the slice. Meaning 0 no shift,\r\n * 1 - slice shifted outside by whole of its radius.\r\n *\r\n * @param value Radius shift\r\n */\n set: function set(value) {\n this.setPropertyValue(\"shiftRadius\", value);\n value = this.getPropertyValue(\"shiftRadius\");\n this.dx = value * this.radius * this.ix;\n this.dy = value * this.radiusY * this.iy;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"ix\", {\n /**\r\n * [ix description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\n get: function get() {\n return $math.cos(this.middleAngle);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"iy\", {\n /**\r\n * [iy description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @return [description]\r\n */\n get: function get() {\n return $math.sin(this.middleAngle);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice.prototype, \"middleAngle\", {\n /**\r\n * An angle of the slice's middle.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Angle\r\n */\n get: function get() {\n return this.startAngle + this.arc / 2;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * X coordinate for the slice tooltip.\r\n *\r\n * @return X\r\n */\n\n Slice.prototype.getTooltipX = function () {\n var value = this.getPropertyValue(\"tooltipX\");\n\n if ($type.isNumber(value)) {\n return value;\n }\n\n var p = 0.5;\n\n if (value instanceof Percent) {\n p = value.value;\n }\n\n var innerRadius = $utils.relativeToValue(this.innerRadius, this.radius);\n return this.ix * (innerRadius + (this.radius - innerRadius) * p);\n };\n /**\r\n * Y coordinate for the slice tooltip.\r\n *\r\n * @return Y\r\n */\n\n\n Slice.prototype.getTooltipY = function () {\n var value = this.getPropertyValue(\"tooltipY\");\n\n if ($type.isNumber(value)) {\n return value;\n }\n\n var p = 0.5;\n\n if (value instanceof Percent) {\n p = value.value;\n }\n\n var innerRadius = $utils.relativeToValue(this.innerRadius, this.radius);\n return this.iy * (innerRadius + (this.radius - innerRadius) * p) + this.slice.dy;\n };\n\n return Slice;\n}(Container);\n\nexport { Slice };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Slice\"] = Slice;","/**\r\n * Preloader module.\r\n *\r\n * Preloader is a progress indicator.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { Slice } from \"./Slice\";\nimport { Label } from \"./Label\";\nimport { registry } from \"../Registry\";\nimport { percent } from \"../../core/utils/Percent\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A class used to draw and display progress indicator.\r\n *\r\n * @see {@link IPreloaderEvents} for a list of available events\r\n * @see {@link IPreloaderAdapters} for a list of available Adapters\r\n */\n\nvar Preloader =\n/** @class */\nfunction (_super) {\n __extends(Preloader, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Preloader() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"Preloader\"; // Set dimensions\n\n _this.width = percent(100);\n _this.height = percent(100);\n var interfaceColors = new InterfaceColorSet(); // Create main container\n\n var sliceContainer = _this.createChild(Container);\n\n sliceContainer.shouldClone = false; // Add background (100%) slice\n\n var backgroundSlice = sliceContainer.createChild(Slice);\n backgroundSlice.shouldClone = false;\n backgroundSlice.radius = 53;\n backgroundSlice.arc = 360;\n backgroundSlice.fill = interfaceColors.getFor(\"fill\");\n backgroundSlice.fillOpacity = 0.8;\n backgroundSlice.innerRadius = 42;\n backgroundSlice.isMeasured = false;\n _this.backgroundSlice = backgroundSlice; // Add progress slice\n\n var progressSlice = sliceContainer.createChild(Slice);\n progressSlice.shouldClone = false;\n progressSlice.radius = 50;\n progressSlice.innerRadius = 45;\n progressSlice.fill = interfaceColors.getFor(\"alternativeBackground\");\n progressSlice.fillOpacity = 0.2;\n progressSlice.isMeasured = false;\n _this.progressSlice = progressSlice; // Add text label element\n\n var label = sliceContainer.createChild(Label);\n label.shouldClone = false;\n label.horizontalCenter = \"middle\";\n label.verticalCenter = \"middle\";\n label.isMeasured = false;\n label.fill = interfaceColors.getFor(\"text\");\n label.align = \"center\";\n label.valign = \"middle\";\n label.textAlign = \"middle\";\n label.fillOpacity = 0.4;\n _this.label = label; // Set defaults\n\n _this.background.opacity = 1;\n _this.background.fill = interfaceColors.getFor(\"background\");\n _this.contentAlign = \"center\";\n _this.contentValign = \"middle\";\n _this.delay = 300; // Create hidden state\n\n var hiddenState = _this.states.create(\"hidden\");\n\n hiddenState.properties.opacity = 0; // Hide by default\n\n _this.visible = false;\n\n _this.hide(0);\n\n _this.__disabled = true; // Make it disposable\n // @todo Maybe it's enough to just dispose `sliceContainer`?\n\n _this._disposers.push(_this.backgroundSlice);\n\n _this._disposers.push(_this.progressSlice);\n\n _this._disposers.push(_this.label);\n\n _this._disposers.push(sliceContainer);\n\n return _this;\n }\n\n Object.defineProperty(Preloader.prototype, \"progress\", {\n /**\r\n * @return Progress (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"progress\");\n },\n\n /**\r\n * Current preload progress. (0-1)\r\n *\r\n * * 0 - 0%\r\n * * 0.5 - 50%\r\n * * 1 - 100%\r\n *\r\n * Setting this to a value less than 1, will automatically reveal the\r\n * preloader, while setting it to 1 (100%) will hide it.\r\n *\r\n * @param value Progress (0-1)\r\n */\n set: function set(value) {\n var _this = this;\n\n this.__disabled = false;\n this.validateLayout(); // show not in center without this\n\n this.setPropertyValue(\"progress\", value);\n /*if (!this.visible && value == 1) {\r\n return;\r\n }*/\n\n this.progressSlice.arc = 360 * value;\n\n if (this.label) {\n this.label.text = Math.round(value * 100) + \"%\";\n }\n\n if (value >= 1) {\n // Cancel the timeout\n if (this._started) {\n this._started = undefined;\n } // TODO remove closure ?\n\n\n registry.events.once(\"enterframe\", function () {\n var animation = _this.hide();\n\n if (animation && !animation.isFinished()) {\n animation.events.once(\"animationended\", function () {\n _this.__disabled = true;\n });\n } else {\n _this.__disabled = true;\n }\n });\n this.interactionsEnabled = false;\n this.setPropertyValue(\"progress\", 0);\n } else if (value > 0) {\n if (this.delay) {\n if (!this._started) {\n this._started = new Date().getTime();\n } else if (this._started + this.delay <= new Date().getTime()) {\n this.__disabled = false;\n this.show();\n this.interactionsEnabled = true;\n }\n } else {\n this.__disabled = false;\n this.show();\n this.interactionsEnabled = true;\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Preloader.prototype, \"delay\", {\n /**\r\n * @return Delay (ms)\r\n */\n get: function get() {\n return this.getPropertyValue(\"delay\");\n },\n\n /**\r\n * Delay display of preloader by X milliseconds.\r\n *\r\n * When loading starts (`progress` is set to <1) and finishes (`progress` is\r\n * set to 1) before `delay` ms, the loader is never shown.\r\n *\r\n * This is used to avoid brief flashing of the preload for very quick loads.\r\n *\r\n * @default 1000\r\n * @param value Delay (ms)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"delay\", value);\n },\n enumerable: true,\n configurable: true\n });\n return Preloader;\n}(Container);\n\nexport { Preloader };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Preloader\"] = Preloader;","/**\r\n * Resize button module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Button } from \"./Button\";\nimport { Sprite } from \"../Sprite\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { registry } from \"../Registry\";\nimport * as $path from \"../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a draggable resize/grip button.\r\n *\r\n * @see {@link IResizeButtonEvents} for a list of available events\r\n * @see {@link IResizeButtonAdapters} for a list of available Adapters\r\n */\n\nvar ResizeButton =\n/** @class */\nfunction (_super) {\n __extends(ResizeButton, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ResizeButton() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"ResizeButton\"; // Set defaults\n\n _this.orientation = \"horizontal\";\n _this.layout = \"absolute\";\n _this.horizontalCenter = \"middle\";\n _this.verticalCenter = \"middle\";\n _this.draggable = true;\n\n _this.padding(8, 8, 8, 8);\n\n _this.background.cornerRadius(20, 20, 20, 20); // Create an icon\n\n\n var icon = new Sprite();\n icon.element = _this.paper.add(\"path\");\n var path = $path.moveTo({\n x: -2,\n y: -6\n });\n path += $path.lineTo({\n x: -2,\n y: 6\n });\n path += $path.moveTo({\n x: 2,\n y: -6\n });\n path += $path.lineTo({\n x: 2,\n y: 6\n });\n icon.path = path;\n icon.pixelPerfect = true;\n icon.padding(0, 4, 0, 4);\n icon.stroke = new InterfaceColorSet().getFor(\"alternativeText\");\n icon.strokeOpacity = 0.7; //icon.align = \"center\";\n //icon.valign = \"middle\";\n\n _this.icon = icon;\n\n _this.label.dispose();\n\n _this.label = undefined; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(ResizeButton.prototype, \"orientation\", {\n /**\r\n * Use for setting of direction (orientation) of the resize button.\r\n *\r\n * Available options: \"horizontal\", \"vertical\".\r\n *\r\n * @param value Orientation\r\n */\n set: function set(value) {\n var icon = this.icon;\n\n if (icon) {\n if (value == \"horizontal\") {\n icon.rotation = 0;\n } else {\n icon.rotation = -90;\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n return ResizeButton;\n}(Button);\n\nexport { ResizeButton };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ResizeButton\"] = ResizeButton;","/**\r\n * Zoom out button functionality.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Button } from \"./Button\";\nimport { Sprite } from \"../Sprite\";\nimport { registry } from \"../Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport * as $path from \"../rendering/Path\";\nimport * as $type from \"../../core/utils/Type\";\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a zoom out button.\r\n *\r\n * @see {@link ICloseButtonEvents} for a list of available events\r\n * @see {@link ICloseButtonAdapters} for a list of available Adapters\r\n */\n\nvar CloseButton =\n/** @class */\nfunction (_super) {\n __extends(CloseButton, _super);\n /**\r\n * Constructor\r\n */\n\n\n function CloseButton() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"CloseButton\";\n\n _this.padding(8, 8, 8, 8);\n\n _this.showSystemTooltip = true;\n _this.width = 30;\n _this.height = 30;\n var interfaceColors = new InterfaceColorSet();\n _this.cursorOverStyle = MouseCursorStyle.pointer;\n var background = _this.background;\n background.cornerRadius(20, 20, 20, 20);\n var bgc = interfaceColors.getFor(\"background\");\n background.fill = bgc;\n background.stroke = interfaceColors.getFor(\"primaryButton\");\n background.strokeOpacity = 1;\n background.strokeWidth = 1;\n var downColor = interfaceColors.getFor(\"primaryButtonActive\");\n var bhs = background.states.getKey(\"hover\");\n bhs.properties.strokeWidth = 3;\n bhs.properties.fill = bgc;\n var bds = background.states.getKey(\"down\");\n bds.properties.stroke = downColor;\n bds.properties.fill = bgc; // Create an icon\n\n var icon = new Sprite();\n icon.element = _this.paper.add(\"path\");\n icon.stroke = background.stroke;\n _this.icon = icon; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n CloseButton.prototype.validate = function () {\n _super.prototype.validate.call(this);\n\n var w = this.pixelWidth / 3;\n var h = this.pixelHeight / 3;\n var path = $path.moveTo({\n x: -w / 2,\n y: -h / 2\n });\n path += $path.lineTo({\n x: w / 2,\n y: h / 2\n });\n path += $path.moveTo({\n x: w / 2,\n y: -h / 2\n });\n path += $path.lineTo({\n x: -w / 2,\n y: h / 2\n });\n this.icon.path = path;\n this.invalidateLayout();\n };\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n CloseButton.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this);\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Close\");\n }\n };\n\n return CloseButton;\n}(Button);\n\nexport { CloseButton };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"CloseButton\"] = CloseButton;","/**\r\n * Functionality for drawing simple SwitchButtons.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { Label } from \"./Label\";\nimport { Button } from \"../elements/Button\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { Circle } from \"../../core/elements/Circle\";\nimport { percent } from \"../../core/utils/Percent\";\nimport { registry } from \"../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * SwitchButton class is capable of drawing a simple rectangular SwitchButton with\r\n * optionally rounded corners and an icon in it.\r\n *\r\n * @see {@link ISwitchButtonEvents} for a list of available events\r\n * @see {@link ISwitchButtonAdapters} for a list of available Adapters\r\n */\n\nvar SwitchButton =\n/** @class */\nfunction (_super) {\n __extends(SwitchButton, _super);\n /**\r\n * Constructor\r\n */\n\n\n function SwitchButton() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"SwitchButton\";\n _this.tooltipY = 0; // Set defaults\n\n _this.layout = \"horizontal\";\n _this.contentAlign = \"center\";\n _this.contentValign = \"middle\";\n\n _this.padding(8, 16, 8, 16);\n\n _this.setStateOnChildren = true;\n\n _this.states.create(\"active\");\n\n var interfaceColors = new InterfaceColorSet(); // Create the label element\n\n var leftLabel = new Label();\n leftLabel.fillOpacity = 0.3;\n var llas = leftLabel.states.create(\"active\");\n llas.properties.fillOpacity = 1;\n leftLabel.isActive = true;\n _this.leftLabel = leftLabel;\n var button = new Button();\n var circle = new Circle();\n button.contentValign = \"none\";\n button.padding(0, 0, 0, 0);\n circle.radius = 10;\n button.icon = circle;\n button.icon.valign = \"middle\";\n button.label = undefined;\n var p100 = percent(100);\n button.background.cornerRadius(p100, p100, p100, p100);\n button.width = circle.radius * 3.5;\n button.height = circle.radius * 2.1;\n button.marginLeft = 8;\n button.marginRight = 8;\n button.togglable = true;\n circle.dx = -circle.radius * 0.7;\n circle.fill = interfaceColors.getFor(\"primaryButton\");\n var hs = circle.states.create(\"hover\");\n hs.properties.fill = interfaceColors.getFor(\"primaryButtonHover\");\n var as = circle.states.create(\"active\");\n as.properties.fill = interfaceColors.getFor(\"primaryButtonActive\");\n as.properties.dx = circle.radius * 0.7;\n _this.switchButton = button;\n\n _this.events.on(\"toggled\", function () {\n _this.leftLabel.isActive = !_this.isActive;\n _this.rightLabel.isActive = _this.isActive;\n }); // Create the label element\n\n\n var rightLabel = new Label();\n rightLabel.fillOpacity = 0.3;\n var rlas = rightLabel.states.create(\"active\");\n rlas.properties.fillOpacity = 1;\n _this.rightLabel = rightLabel; // Set up accessibility\n // A Button should be always focusable\n\n _this.role = \"button\";\n _this.focusable = true;\n rightLabel.valign = \"middle\";\n leftLabel.valign = \"middle\";\n button.valign = \"middle\"; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(SwitchButton.prototype, \"leftLabel\", {\n /**\r\n * @return Left label element\r\n */\n get: function get() {\n return this._leftLabel;\n },\n\n /**\r\n * [[Label]] element to be used for left text.\r\n *\r\n * @param left label element\r\n */\n set: function set(label) {\n if (this._leftLabel) {\n this.removeDispose(this._leftLabel);\n }\n\n this._leftLabel = label;\n\n if (label) {\n label.parent = this;\n label.interactionsEnabled = false;\n label.shouldClone = false;\n\n this._disposers.push(this._leftLabel);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SwitchButton.prototype, \"rightLabel\", {\n /**\r\n * @return Rigth label element\r\n */\n get: function get() {\n return this._rightLabel;\n },\n\n /**\r\n * [[Label]] element to be used for left text.\r\n *\r\n * @param rigth label element\r\n */\n set: function set(label) {\n if (this._rightLabel) {\n this.removeDispose(this._rightLabel);\n }\n\n this._rightLabel = label;\n\n if (label) {\n label.parent = this;\n label.interactionsEnabled = false;\n label.shouldClone = false;\n\n this._disposers.push(this._rightLabel);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SwitchButton.prototype, \"switch\", {\n /**\r\n * @ignore\r\n * @deprecated Use `switchButton` instead\r\n */\n get: function get() {\n return this._switchButton;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SwitchButton.prototype, \"switchButton\", {\n /**\r\n * @return Button\r\n */\n get: function get() {\n return this._switchButton;\n },\n\n /**\r\n * A [[Button]] element for switch.\r\n *\r\n * @param Button\r\n */\n set: function set(button) {\n if (this._switchButton) {\n this.removeDispose(this._switchButton);\n }\n\n this._switchButton = button;\n\n if (button) {\n button.parent = this;\n button.shouldClone = false;\n\n this._disposers.push(this._switchButton);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies properties and other attributes.\r\n *\r\n * @param source Source\r\n */\n\n SwitchButton.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n if (source.leftLabel) {\n this.leftLabel.copyFrom(source.leftLabel);\n }\n\n if (source.rightLabel) {\n this.rightLabel.copyFrom(source.rightLabel);\n }\n\n if (source.switchButton) {\n this.switchButton.copyFrom(source.switchButton);\n }\n };\n\n return SwitchButton;\n}(Container);\n\nexport { SwitchButton };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"SwitchButton\"] = SwitchButton;","/**\r\n * Provides functionality used to build scrollbars.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { ResizeButton } from \"../elements/ResizeButton\";\nimport { Button } from \"../elements/Button\";\nimport { getInteraction } from \"../interaction/Interaction\";\nimport { MouseCursorStyle } from \"../interaction/Mouse\";\nimport { RoundedRectangle } from \"../elements/RoundedRectangle\";\nimport { registry } from \"../Registry\";\nimport { keyboard } from \"../utils/Keyboard\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { percent, Percent } from \"../utils/Percent\";\nimport * as $math from \"../utils/Math\";\nimport * as $ease from \"../utils/Ease\";\nimport * as $type from \"../utils/Type\";\nimport * as $utils from \"../utils/Utils\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Scrollbar is a generic control allowing to select a range of values or pan\r\n * the selection.\r\n *\r\n * @see {@link IScrollbarEvents} for a list of available events\r\n * @see {@link IScrollbarAdapters} for a list of available Adapters\r\n */\n\nvar Scrollbar =\n/** @class */\nfunction (_super) {\n __extends(Scrollbar, _super);\n /**\r\n * Construtor\r\n */\n\n\n function Scrollbar() {\n var _this = _super.call(this) || this;\n /**\r\n * Previously selected lower (start) value.\r\n */\n\n\n _this._previousStart = 0;\n /**\r\n * Previously selected upper (end) value.\r\n */\n\n _this._previousEnd = 1;\n /**\r\n * A value of previously selected lower value, used for doubleclick function.\r\n */\n\n _this._prevStart = 0;\n /**\r\n * A value of previously selected upper value, used for doubleclick function.\r\n */\n\n _this._prevEnd = 1;\n /**\r\n * Indicates if the Scrollbar is currently \"busy\" (animating and or\r\n * performing zoom by user interaction).\r\n */\n\n _this._isBusy = false;\n /**\r\n * [_skipRangeEvents description]\r\n *\r\n * @todo Description\r\n */\n\n _this._skipRangeEvents = false;\n /**\r\n * Update the selection when dragging the grips.\r\n *\r\n * If set to `false` selection will be updated only when the grip is\r\n * released.\r\n *\r\n * @default true\r\n */\n\n _this.updateWhileMoving = true;\n _this.className = \"Scrollbar\";\n _this.minHeight = 12;\n _this.minWidth = 12;\n _this.animationDuration = 0;\n _this.animationEasing = $ease.cubicOut;\n\n _this.margin(10, 10, 10, 10);\n\n var interfaceColors = new InterfaceColorSet(); // background is also container as it might contain graphs, grid, etc\n\n var background = _this.background;\n background.cornerRadius(10, 10, 10, 10);\n background.fill = interfaceColors.getFor(\"fill\");\n background.fillOpacity = 0.5; // Make system tooltips appear by default\n\n _this.showSystemTooltip = true;\n _this.startGrip = new ResizeButton();\n _this.endGrip = new ResizeButton(); // Default orientation...\n // ... is set in `applyInternalDefaults()` because it accesses `language`\n // and should only be started to access when parent is set\n // Set events\n\n _this.events.on(\"transformed\", function () {\n _this.updateThumb();\n }, _this, false); // Initial positions\n\n\n _this.start = 0;\n _this.end = 1; // Set roles\n\n _this.role = \"scrollbar\";\n _this.thumb.role = \"slider\";\n _this.thumb.readerLive = \"polite\";\n _this.startGrip.role = \"slider\";\n _this.endGrip.role = \"slider\"; // otherwise range changed won't be registered\n\n _this.events.once(\"inited\", function () {\n _this._previousStart = undefined;\n\n _this.dispatchRangeChange();\n }, undefined, false);\n\n _this.hideGrips = false;\n _this.orientation = \"horizontal\"; // Min/max values for accessibility\n\n _this.setSVGAttribute({\n \"aria-valuemin\": \"0\"\n });\n\n _this.setSVGAttribute({\n \"aria-valuemax\": \"100\"\n });\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n Scrollbar.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this); // Set screen reader tetxt accordingly\n\n\n if (this.orientation === \"horizontal\") {\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Use TAB to select grip buttons or left and right arrows to change selection\");\n }\n\n if (!$type.hasValue(this.thumb.readerDescription)) {\n this.thumb.readerDescription = this.language.translate(\"Use left and right arrows to move selection\");\n }\n\n if (!$type.hasValue(this.startGrip.readerDescription)) {\n this.startGrip.readerDescription = this.language.translate(\"Use left and right arrows to move left selection\");\n }\n\n if (!$type.hasValue(this.endGrip.readerDescription)) {\n this.endGrip.readerDescription = this.language.translate(\"Use left and right arrows to move right selection\");\n }\n\n this.readerOrientation = \"horizontal\";\n } else {\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Use TAB select grip buttons or up and down arrows to change selection\");\n }\n\n if (!$type.hasValue(this.thumb.readerDescription)) {\n this.thumb.readerDescription = this.language.translate(\"Use up and down arrows to move selection\");\n }\n\n if (!$type.hasValue(this.startGrip.readerDescription)) {\n this.startGrip.readerDescription = this.language.translate(\"Use up and down arrows to move upper selection\");\n }\n\n if (!$type.hasValue(this.endGrip.readerDescription)) {\n this.endGrip.readerDescription = this.language.translate(\"Use up and down arrows to move lower selection\");\n }\n\n this.readerOrientation = \"vertical\";\n }\n\n this.readerControls = this.baseSprite.uidAttr();\n };\n /**\r\n * Validates the layout of the scrollbar's elements.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.validateLayout = function () {\n this.updateSize();\n\n _super.prototype.validateLayout.call(this); // when size changes, need to update extremes\n\n\n this.updateExtremes();\n };\n /**\r\n * Update background for the scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.processBackground = function () {\n _super.prototype.processBackground.call(this);\n\n var background = this.background;\n background.clickable = true;\n background.events.on(\"hit\", this.handleBgHit, this, undefined);\n };\n /**\r\n * Zooms to the particular place when clicked/tapped on the scrollbar\r\n * background.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n Scrollbar.prototype.handleBgHit = function (event) {\n this.makeBusy();\n var point = event.spritePoint;\n point = $utils.spritePointToSprite(point, this.background, this);\n var thumb = this.thumb;\n\n if (this.orientation == \"horizontal\") {\n var thumbX = point.x - thumb.pixelWidth / 2;\n thumbX = $math.fitToRange(thumbX, 0, this.innerWidth - thumb.pixelWidth);\n this._thumbAnimation = thumb.animate({\n property: \"x\",\n to: thumbX\n }, this.animationDuration, this.animationEasing);\n } else {\n var thumbY = point.y - thumb.pixelHeight / 2;\n thumbY = $math.fitToRange(thumbY, 0, this.innerHeight - thumb.pixelHeight);\n this._thumbAnimation = thumb.animate({\n property: \"y\",\n to: thumbY\n }, this.animationDuration, this.animationEasing);\n }\n\n if (this.animationDuration > 0) {\n this._thumbAnimation.events.on(\"animationended\", this.makeUnbusy, this, false);\n } else {\n this._thumb.validate();\n\n this.makeUnbusy();\n }\n };\n /**\r\n * Set scrollbar as busy. (currently zooming)\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.makeBusy = function () {\n this._isBusy = true;\n this._skipRangeEvents = false;\n\n if (this._unbusyTimeout) {\n this.removeDispose(this._unbusyTimeout);\n }\n\n this._unbusyTimeout = undefined;\n this.stopAnimations();\n };\n /**\r\n * Stops all animations, currently playing for the scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.stopAnimations = function () {\n if (this._thumbAnimation) {\n this._thumbAnimation.stop(true);\n }\n\n if (this._zoomAnimation) {\n this._zoomAnimation.stop(true);\n }\n };\n /**\r\n * Cancels \"busy\" status of the Scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.makeUnbusy = function () {\n /**\r\n * We cannot make Scrollbar not busy right after release, because then axes\r\n * will take over controll and Scrollbar will start to animate.\r\n * Theorethically, it's not right to set timeout by `animationDuration`,\r\n * however we can not know all the durations of elements we scroll, so we\r\n * assume that animation duration will be the same as\r\n * `interpolationDuration` or `rangeChange` duration.\r\n */\n this._unbusyTimeout = this.setTimeout(this.makeUnbusyReal.bind(this), this.animationDuration * 1.1);\n };\n /**\r\n * [makeUnbusyReal description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.makeUnbusyReal = function () {\n this._usingGrip = undefined;\n this._isBusy = false;\n\n if (!this.updateWhileMoving) {\n this.dispatchRangeChange();\n }\n };\n /**\r\n * Disptatches rangechanged event if it really changed\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.dispatchRangeChange = function () {\n if (this._previousEnd != this.end || this._previousStart != this.start) {\n this._previousStart = this.start;\n this._previousEnd = this.end;\n this.dispatch(\"rangechanged\");\n }\n };\n /**\r\n * Updates the \"thumb\" element. A draggable element between the grips.\r\n * @ignore\r\n */\n\n\n Scrollbar.prototype.updateThumb = function (dispatchEvents) {\n if (dispatchEvents === void 0) {\n dispatchEvents = true;\n }\n\n if (!this.parent) {\n return;\n }\n\n var thumb = this.thumb;\n var start = this.start;\n var end = this.end;\n var startGrip = this.startGrip;\n var endGrip = this.endGrip;\n\n if (this.orientation == \"horizontal\") {\n var innerWidth_1 = this.innerWidth;\n thumb.width = innerWidth_1 * (end - start);\n thumb.maxX = innerWidth_1 - thumb.pixelWidth;\n thumb.x = start * innerWidth_1;\n startGrip.moveTo({\n x: thumb.pixelX,\n y: 0\n }, undefined, undefined, true); // overrides dragging\n\n endGrip.moveTo({\n x: thumb.pixelX + thumb.pixelWidth,\n y: 0\n }, undefined, undefined, true);\n startGrip.readerTitle = this.language.translate(\"From %1\", undefined, this.adapter.apply(\"positionValue\", {\n value: Math.round(start * 100) + \"%\",\n position: start\n }).value);\n startGrip.readerValueNow = \"\" + Math.round(start * 100);\n startGrip.readerValueText = startGrip.readerTitle;\n endGrip.readerTitle = this.language.translate(\"To %1\", undefined, this.adapter.apply(\"positionValue\", {\n value: Math.round(end * 100) + \"%\",\n position: end\n }).value);\n endGrip.readerValueNow = \"\" + Math.round(end * 100);\n endGrip.readerValueText = endGrip.readerTitle;\n } else {\n var innerHeight_1 = this.innerHeight;\n thumb.height = innerHeight_1 * (end - start);\n thumb.maxY = innerHeight_1 - thumb.pixelHeight;\n thumb.y = (1 - end) * innerHeight_1;\n startGrip.moveTo({\n x: 0,\n y: thumb.pixelY + thumb.pixelHeight\n }, undefined, undefined, true);\n endGrip.moveTo({\n x: 0,\n y: thumb.pixelY\n }, undefined, undefined, true);\n startGrip.readerTitle = this.language.translate(\"To %1\", undefined, this.adapter.apply(\"positionValue\", {\n value: Math.round((1 - start) * 100) + \"%\",\n position: 1 - start\n }).value);\n startGrip.readerValueNow = \"\" + Math.round(start * 100);\n startGrip.readerValueText = startGrip.readerTitle;\n endGrip.readerTitle = this.language.translate(\"From %1\", undefined, this.adapter.apply(\"positionValue\", {\n value: Math.round((1 - end) * 100) + \"%\",\n position: 1 - end\n }).value);\n endGrip.readerValueNow = \"\" + Math.round(end * 100);\n endGrip.readerValueText = endGrip.readerTitle;\n } // Add accessibility\n\n\n thumb.readerTitle = this.language.translate(\"From %1 to %2\", undefined, this.adapter.apply(\"positionValue\", {\n value: Math.round(start * 100) + \"%\",\n position: start\n }).value, this.adapter.apply(\"positionValue\", {\n value: Math.round(end * 100) + \"%\",\n position: end\n }).value);\n thumb.readerValueNow = \"\" + Math.round(start * 100);\n thumb.readerValueText = thumb.readerTitle;\n this.readerValueNow = \"\" + Math.round(start * 100);\n this.readerValueText = thumb.readerTitle;\n\n if (!this._skipRangeEvents && this.updateWhileMoving && dispatchEvents) {\n this.dispatchRangeChange();\n }\n };\n /**\r\n * Updates extremes of the scrollbar.\r\n */\n\n\n Scrollbar.prototype.updateExtremes = function () {\n var orientation = this.orientation;\n var minX = 0;\n var minY = 0;\n var maxX = 0;\n var maxY = 0;\n\n if (orientation == \"horizontal\") {\n maxX = this.innerWidth;\n minY = maxY = this.innerHeight / 2;\n } else {\n maxY = this.innerHeight;\n minX = maxX = this.innerWidth / 2;\n }\n\n var startGrip = this.startGrip;\n startGrip.minX = minX;\n startGrip.maxX = maxX;\n startGrip.minY = minY;\n startGrip.maxY = maxY;\n var endGrip = this.endGrip;\n endGrip.minX = minX;\n endGrip.maxX = maxX;\n endGrip.minY = minY;\n endGrip.maxY = maxY;\n var thumb = this.thumb;\n thumb.minX = minX;\n thumb.maxX = maxX;\n thumb.minY = minY;\n thumb.maxY = maxY;\n };\n /**\r\n * Updates size of the scrollbar.\r\n */\n\n\n Scrollbar.prototype.updateSize = function () {\n var orientation = this.orientation;\n var startGrip = this.startGrip;\n\n if (startGrip) {\n startGrip.orientation = orientation;\n }\n\n if (this.endGrip) {\n this.endGrip.orientation = orientation;\n }\n\n var thumb = this.thumb;\n\n if (thumb) {\n if (orientation == \"horizontal\") {\n if (!$type.isNumber(this._pixelWidth)) {\n if (!(this.width instanceof Percent)) {\n this.width = percent(100);\n }\n } // this teorethically might be wrong, if user indeed sets height of a horizontal scrollbar in percent\n // however without this height might be equal to 100% if previous orientation was set to horizontal\n // so this is ok solution, in case user really wants to have scrollbar height set in percent,\n // he should do this after orientation.\n\n\n if ($type.hasValue(this.percentHeight)) {\n this.height = this.minHeight;\n }\n\n thumb.height = this.innerHeight;\n thumb.verticalCenter = \"middle\";\n thumb.horizontalCenter = \"left\";\n } else {\n if (!$type.isNumber(this._pixelHeight)) {\n if (!(this.height instanceof Percent)) {\n this.height = percent(100);\n }\n } // same as above with percentHeight\n\n\n if ($type.hasValue(this.percentWidth)) {\n this.width = this.minWidth;\n }\n\n thumb.width = this.innerWidth;\n thumb.verticalCenter = \"top\";\n thumb.horizontalCenter = \"middle\";\n }\n }\n };\n\n Object.defineProperty(Scrollbar.prototype, \"isBusy\", {\n /**\r\n * Indicates if the Scrollbar is currently \"busy\" (animating and or\r\n * performing zoom by user interaction).\r\n * @return boolean\r\n */\n get: function get() {\n return this._isBusy;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"start\", {\n /**\r\n * @return Position (0-1)\r\n */\n get: function get() {\n return Math.min(this.getPosition(this._start), this.getPosition(this._end));\n },\n\n /**\r\n * ==========================================================================\r\n * POSITIONS\r\n * ==========================================================================\r\n * @hidden\r\n */\n\n /**\r\n * Relative position (0-1) of the start grip.\r\n *\r\n * @param position Position (0-1)\r\n */\n set: function set(position) {\n if (!this._isBusy) {\n this.__start = position;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"__start\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this._start;\n },\n\n /**\r\n * [__start description]\r\n *\r\n * @todo Description\r\n * @param position [description]\r\n */\n set: function set(position) {\n this._start = this.getPosition(position);\n this.updateThumb();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"end\", {\n /**\r\n * @return Position (0-1)\r\n */\n get: function get() {\n return Math.max(this.getPosition(this._start), this.getPosition(this._end));\n },\n\n /**\r\n * Relative position (0-1) of the end grip.\r\n *\r\n * @param position Position (0-1)\r\n */\n set: function set(position) {\n if (!this._isBusy) {\n this.__end = position;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"__end\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this._end;\n },\n\n /**\r\n * [__end description]\r\n *\r\n * @todo Description\r\n * @param position [description]\r\n */\n set: function set(position) {\n this._end = this.getPosition(position);\n this.updateThumb();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"range\", {\n /**\r\n * Current selection range.\r\n *\r\n * @readonly\r\n * @return Range\r\n */\n get: function get() {\n return {\n start: this.start,\n end: this.end,\n priority: this._usingGrip\n };\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Disables range change events.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Scrollbar.prototype.skipRangeEvents = function () {\n if (!this._isBusy) {\n this._skipRangeEvents = true;\n }\n };\n /**\r\n * [fixRange description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n * @param range Range\r\n */\n\n\n Scrollbar.prototype.fixRange = function (range) {\n if (range.start != $math.round(this._start, 2) || range.end != $math.round(this._end, 2)) {\n this._start = range.start;\n this._end = range.end;\n this._skipRangeEvents = true;\n this.updateThumb();\n this._skipRangeEvents = false;\n this.thumb.validate();\n this.thumb.background.validate();\n }\n };\n /**\r\n * [getPosition description]\r\n *\r\n * @todo Description\r\n * @param position [description]\r\n * @return [description]\r\n */\n\n\n Scrollbar.prototype.getPosition = function (position) {\n return $math.fitToRange($math.round(position, 4), 0, 1);\n };\n\n Object.defineProperty(Scrollbar.prototype, \"orientation\", {\n /**\r\n * @return Orientation\r\n */\n get: function get() {\n return this.getPropertyValue(\"orientation\");\n },\n\n /**\r\n * ==========================================================================\r\n * MISC\r\n * ==========================================================================\r\n * @hidden\r\n */\n\n /**\r\n * Orientation of the scrollbar.\r\n *\r\n * Available options: \"horizontal\" (default) and \"vertical\".\r\n *\r\n * @default \"horizontal\"\r\n * @param value Orientation\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"orientation\", value)) {\n // Set mouse cursors and screen reader tetxt accordingly\n if (value === \"horizontal\") {\n // Mouse styles\n this.startGrip.cursorOverStyle = MouseCursorStyle.horizontalResize;\n this.endGrip.cursorOverStyle = MouseCursorStyle.horizontalResize; // Reader text\n\n /*this.readerTitle = this.language.translate(\"Use TAB to select grip buttons or left and right arrows to change selection\");\r\n this.thumb.readerDescription = this.language.translate(\"Use left and right arrows to move selection\");\r\n this.startGrip.readerDescription = this.language.translate(\"Use left and right arrows to move left selection\");\r\n this.endGrip.readerDescription = this.language.translate(\"Use left and right arrows to move right selection\");*/\n } else {\n // Mouse styles\n this.startGrip.cursorOverStyle = MouseCursorStyle.verticalResize;\n this.endGrip.cursorOverStyle = MouseCursorStyle.verticalResize; // Reader text\n\n /*this.readerTitle = this.language.translate(\"Use TAB select grip buttons or up and down arrows to change selection\");\r\n this.thumb.readerDescription = this.language.translate(\"Use up and down arrows to move selection\");\r\n this.startGrip.readerDescription = this.language.translate(\"Use up and down arrows to move upper selection\");\r\n this.endGrip.readerDescription = this.language.translate(\"Use up and down arrows to move lower selection\");*/\n }\n\n this.updateByOrientation();\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n Scrollbar.prototype.updateByOrientation = function () {};\n\n Object.defineProperty(Scrollbar.prototype, \"startGrip\", {\n /**\r\n * @return Grip element\r\n */\n get: function get() {\n return this._startGrip;\n },\n\n /**\r\n * ==========================================================================\r\n * GRIPS\r\n * ==========================================================================\r\n * @hidden\r\n */\n\n /**\r\n * Start grip element. (button)\r\n *\r\n * @param button Grip element\r\n */\n set: function set(button) {\n if (this._startGrip) {\n this.removeDispose(this._startGrip);\n }\n\n this._startGrip = button;\n this.processGrip(button);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"endGrip\", {\n /**\r\n * @return Grip element\r\n */\n get: function get() {\n return this._endGrip;\n },\n\n /**\r\n * End grip element. (button)\r\n *\r\n * @param button Grip element\r\n */\n set: function set(button) {\n if (this._endGrip) {\n this.removeDispose(this._endGrip);\n }\n\n this._endGrip = button;\n this.processGrip(button);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Decorates the grip button with properties and events.\r\n *\r\n * @ignore Exclude from docs\r\n * @param button Grip button\r\n */\n\n Scrollbar.prototype.processGrip = function (button) {\n button.parent = this;\n button.isMeasured = false;\n button.focusable = true;\n button.shouldClone = false; // Set button defaults\n //button.showSystemTooltip = true; // setting this here is not right because we break inheritance\n\n button.zIndex = 100;\n button.events.on(\"drag\", this.handleGripDrag, this, false);\n button.events.on(\"dragstop\", this.makeUnbusy, this, false);\n button.events.on(\"down\", this.makeBusy, this, false);\n button.events.on(\"up\", this.makeUnbusy, this, false);\n\n this._disposers.push(button);\n };\n /**\r\n * Updates positions of related elements after grip element is dragged.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n Scrollbar.prototype.handleGripDrag = function (event) {\n this.makeBusy();\n\n if (event.target === this._startGrip) {\n this._usingGrip = \"start\";\n } else {\n this._usingGrip = \"end\";\n }\n\n if (this.orientation == \"horizontal\") {\n this._start = this.startGrip.pixelX / this.innerWidth;\n this._end = this.endGrip.pixelX / this.innerWidth;\n } else {\n this._start = 1 - this.startGrip.pixelY / this.innerHeight;\n this._end = 1 - this.endGrip.pixelY / this.innerHeight;\n }\n\n this.updateThumb();\n };\n\n Object.defineProperty(Scrollbar.prototype, \"thumb\", {\n /**\r\n * @return Thumb element\r\n */\n get: function get() {\n if (!this._thumb) {\n // Create scrollbar controls (setters will handle adding disposers)\n var thumb = new Button();\n thumb.background.cornerRadius(10, 10, 10, 10);\n thumb.padding(0, 0, 0, 0);\n this.thumb = thumb;\n }\n\n return this._thumb;\n },\n\n /**\r\n * A \"thumb\" element.\r\n *\r\n * It's a draggable square space between the grips, that can be used to\r\n * pan the selection.\r\n *\r\n * @param thumb Thumb element\r\n */\n set: function set(thumb) {\n var _this = this;\n\n if (thumb) {\n if (this._thumb) {\n this.removeDispose(this._thumb);\n }\n\n this._thumb = thumb;\n thumb.parent = this;\n thumb.isMeasured = false;\n thumb.inert = true;\n thumb.draggable = true;\n thumb.clickable = true;\n thumb.hoverable = true;\n thumb.focusable = true;\n thumb.shouldClone = false;\n thumb.zIndex = 0; // TODO remove closures ?\n // Add events\n // Add cursor styles to thumb\n\n thumb.cursorOverStyle = MouseCursorStyle.grab;\n thumb.cursorDownStyle = MouseCursorStyle.grabbing;\n thumb.events.on(\"dragstart\", this.makeBusy, this, false);\n thumb.events.on(\"dragstop\", this.makeUnbusy, this, false);\n thumb.events.on(\"positionchanged\", this.handleThumbPosition, this, false);\n thumb.events.on(\"sizechanged\", this.handleThumbPosition, this, false);\n thumb.events.on(\"doublehit\", this.handleDoubleClick, this, false); // Add event for space and ENTER to toggle full zoom out and back\n // (same as doubleclick)\n\n this._disposers.push(getInteraction().body.events.on(\"keyup\", function (ev) {\n if (keyboard.isKey(ev.event, [\"space\", \"enter\"]) && _this.thumb.isFocused) {\n ev.event.preventDefault();\n\n _this.handleDoubleClick();\n }\n }));\n\n this._disposers.push(this._thumb);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Zooms-in and out the selection on double-click of the thumb.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Scrollbar.prototype.handleDoubleClick = function () {\n this.makeBusy();\n var newStart = 0;\n var newEnd = 1;\n\n if (this.start != 0 || this.end != 1) {\n this._prevStart = this.start;\n this._prevEnd = this.end;\n } else {\n newStart = this._prevStart;\n newEnd = this._prevEnd;\n }\n\n var zoomAnimation = this.animate([{\n property: \"__start\",\n to: newStart\n }, {\n property: \"__end\",\n to: newEnd\n }], this.animationDuration, this.animationEasing);\n\n if (zoomAnimation && !zoomAnimation.isFinished()) {\n zoomAnimation.events.on(\"animationended\", this.makeUnbusy, this, false);\n this._zoomAnimation = zoomAnimation;\n } else {\n this.makeUnbusy();\n }\n };\n /**\r\n * Updates positions of other elements when thumb is moved.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Scrollbar.prototype.handleThumbPosition = function () {\n var thumb = this.thumb;\n\n if (this.orientation == \"horizontal\") {\n var innerWidth_2 = this.innerWidth;\n var w = thumb.innerWidth;\n var x = thumb.pixelX;\n this._start = x / innerWidth_2;\n this._end = (x + w) / innerWidth_2;\n this.updateThumb();\n } else {\n var innerHeight_2 = this.innerHeight;\n var h = thumb.innerHeight;\n var y = thumb.pixelY;\n this._start = 1 - (y + h) / innerHeight_2;\n this._end = 1 - y / innerHeight_2;\n this.updateThumb();\n }\n };\n /**\r\n * Creates a background element for the scrollbar.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background\r\n */\n\n\n Scrollbar.prototype.createBackground = function () {\n return new RoundedRectangle();\n };\n\n Object.defineProperty(Scrollbar.prototype, \"hideGrips\", {\n /**\r\n * @return Show only on hover?\r\n */\n get: function get() {\n return this._hideGrips;\n },\n\n /**\r\n * Use this property to set whether grips should be always visible (`false`),\r\n * or they should just appear on scrollbar hover (`true`).\r\n *\r\n * @param value Show only on hover?\r\n */\n set: function set(value) {\n var _this = this;\n\n this._hideGrips = value;\n\n if (this._overDisposer) {\n this.removeDispose(this._overDisposer);\n }\n\n if (this._outDisposer) {\n this.removeDispose(this._outDisposer);\n }\n\n if (value) {\n this._overDisposer = this.events.on(\"over\", function () {\n _this.startGrip.show();\n\n _this.endGrip.show();\n }, undefined, false);\n this._outDisposer = this.events.on(\"out\", function () {\n _this.startGrip.hide();\n\n _this.endGrip.hide();\n }, undefined, false);\n this.startGrip.hide();\n this.endGrip.hide();\n } else {\n this.startGrip.show();\n this.endGrip.show();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"animationDuration\", {\n /**\r\n * @return Orientation\r\n */\n get: function get() {\n return this.getPropertyValue(\"animationDuration\");\n },\n\n /**\r\n * Duration in milliseconds of scrollbar animation (happens when user clicks on a background of a scrollbar)\r\n * @default 0\r\n * @param value number\r\n */\n set: function set(value) {\n this.setPropertyValue(\"animationDuration\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Scrollbar.prototype, \"animationEasing\", {\n /**\r\n * @return {Function}\r\n */\n get: function get() {\n return this.getPropertyValue(\"animationEasing\");\n },\n\n /**\r\n * Animation easing function.\r\n * @todo: review description and default\r\n * @default $ease.cubicOut\r\n * @param value (value: number) => number\r\n */\n set: function set(value) {\n this.setPropertyValue(\"animationEasing\", value);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Adds easing functions to \"function\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as function?\r\n */\n\n Scrollbar.prototype.asFunction = function (field) {\n return field == \"animationEasing\" || _super.prototype.asIs.call(this, field);\n };\n\n return Scrollbar;\n}(Container);\n\nexport { Scrollbar };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Scrollbar\"] = Scrollbar;","/**\r\n * Slider is a scrollbar with just one selection grip.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Scrollbar } from \"../../core/elements/Scrollbar\";\nimport { registry } from \"../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a slider - a version of scrollbar with just one grip.\r\n *\r\n * @see {@link ISliderEvents} for a list of available events\r\n * @see {@link ISliderAdapters} for a list of available Adapters\r\n */\n\nvar Slider =\n/** @class */\nfunction (_super) {\n __extends(Slider, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Slider() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Slider\";\n _this.thumb.opacity = 0;\n _this.thumb.interactionsEnabled = false;\n _this.endGrip.opacity = 0;\n _this.endGrip.interactionsEnabled = false;\n\n _this.startGrip.events.on(\"drag\", function () {\n _this.endGrip.x = _this.startGrip.x;\n _this.endGrip.y = _this.startGrip.y;\n });\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Slider.prototype, \"__end\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this._start;\n },\n set: function set(value) {},\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slider.prototype, \"end\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this._start;\n },\n\n /**\r\n * Relative position (0-1) of the end grip.\r\n *\r\n * @param position Position (0-1)\r\n */\n set: function set(position) {},\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slider.prototype, \"start\", {\n /**\r\n * @return Position (0-1)\r\n */\n get: function get() {\n return this._start;\n },\n\n /**\r\n * Relative position (0-1) of the start grip.\r\n *\r\n * @param position Position (0-1)\r\n */\n set: function set(position) {\n if (!this._isBusy) {\n this.__start = position;\n }\n },\n enumerable: true,\n configurable: true\n });\n return Slider;\n}(Scrollbar);\n\nexport { Slider };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Slider\"] = Slider;","/**\r\n * A module that defines Text element used to indicate links.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Label } from \"../../core/elements/Label\";\nimport { MouseCursorStyle } from \"../../core/interaction/Mouse\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { registry } from \"../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a text element with a link.\r\n *\r\n * @see {@link ITextLinkEvents} for a list of available events\r\n * @see {@link ITextLinkAdapters} for a list of available Adapters\r\n */\n\nvar TextLink =\n/** @class */\nfunction (_super) {\n __extends(TextLink, _super);\n /**\r\n * Constructor\r\n */\n\n\n function TextLink() {\n var _this = _super.call(this) || this;\n\n _this.className = \"TextLink\";\n _this.selectable = true;\n var interfaceColors = new InterfaceColorSet();\n _this.fill = interfaceColors.getFor(\"primaryButton\").brighten(0.3);\n\n var hoverState = _this.states.create(\"hover\");\n\n hoverState.properties.fill = interfaceColors.getFor(\"primaryButtonHover\").brighten(0.3);\n\n var downState = _this.states.create(\"down\");\n\n downState.properties.fill = interfaceColors.getFor(\"primaryButtonDown\").brighten(0.3);\n _this.cursorOverStyle = MouseCursorStyle.pointer;\n\n _this.applyTheme();\n\n return _this;\n }\n\n return TextLink;\n}(Label);\n\nexport { TextLink };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"TextLink\"] = TextLink;","/**\r\n * This module contains a base class for an SVG filter.\r\n *\r\n * Filters can be used to decorate, change and transform just about any DOM\r\n * element.\r\n *\r\n * A Filter works by applying one or more effects (primitives) to SVG element.\r\n *\r\n * For more information on how SVG filters work, refer to\r\n * [this MDN tutorial](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Filters_Tutorial).\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { BaseObject } from \"../../Base\";\nimport { getGhostPaper } from \"../Paper\";\nimport { Animation, AnimationDisposer } from \"../../utils/Animation\";\nimport { List } from \"../../utils/List\";\nimport * as $object from \"../../utils/Object\";\nimport * as $iter from \"../../utils/Iterator\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Base filter class.\r\n *\r\n * This class while can be instantiated will not do anything. It is just a base\r\n * functionality for any other \"real\" filters to extend.\r\n *\r\n * Filters can be used to decorate, change and transform just about any DOM\r\n * element.\r\n *\r\n * A Filter works by applying one or more effects (primitives) to SVG element.\r\n *\r\n * For more information on how SVG filters work, refer to\r\n * [this MDN tutorial](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Filters_Tutorial).\r\n *\r\n * @todo Example\r\n */\n\nvar Filter =\n/** @class */\nfunction (_super) {\n __extends(Filter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Filter() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * A storage for Filter property/value pairs.\r\n *\r\n * @ignore Exclude from docs\r\n * @see {@link FilterProperties}\r\n */\n\n\n _this.properties = {};\n /**\r\n * Identifies if this object is a \"template\" and should not be treated as\r\n * real object that is drawn or actually used in the chart.\r\n */\n\n _this.isTemplate = false;\n /**\r\n * [_scale description]\r\n *\r\n * @todo Description\r\n */\n\n _this._scale = 1;\n /**\r\n * [_nonScaling description]\r\n *\r\n * @todo Description\r\n */\n\n _this._nonScaling = true;\n _this.className = \"Filter\"; // Create a list to hold primitives (effect elements)\n\n _this.filterPrimitives = new List();\n _this.properties.filterUnits = \"objectBoundingBox\"; // Automatically add added primitives to `_disposers` so they are discarded\n // when Filter object is destroyed (disposed)\n\n _this.filterPrimitives.events.on(\"inserted\", function (ev) {\n _this._disposers.push(ev.newValue);\n }); // Set default dimensions\n\n\n _this.width = 120;\n _this.height = 120; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Appends actual filter elements to the filter group.\r\n *\r\n * @ignore Exclude from docs\r\n * @param filterElement An SVG `` element to add filter element to\r\n */\n\n\n Filter.prototype.appendPrimitives = function (filterElement) {\n $iter.each(this.filterPrimitives.iterator(), function (filterPrimitive) {\n filterElement.add(filterPrimitive);\n });\n };\n /**\r\n * Uses Transitions filter's values from current to target. This is used to\r\n * smoothly appear filter, rather than it pop into effect.\r\n *\r\n * @ignore Exclude from docs\r\n * @param animationOptions Animation options\r\n * @param duration Duration in milliseconds\r\n * @param easing Easing function\r\n * @return Animation instance\r\n */\n\n\n Filter.prototype.animate = function (animationOptions, duration, easing) {\n var animation = new Animation(this, animationOptions, duration, easing).start();\n return animation;\n };\n\n Object.defineProperty(Filter.prototype, \"width\", {\n /**\r\n * @return Width (%)\r\n */\n get: function get() {\n return this.properties[\"width\"];\n },\n\n /**\r\n * Width of the filter element in percent.\r\n *\r\n * If the filter is designed to \"bleed out\" of the original target element,\r\n * like for example a shadow, you need this bigger than 100, or the\r\n * non-fitting parts will be clipped.\r\n *\r\n * @default 120\r\n * @param value Width (px)\r\n */\n set: function set(value) {\n this.properties[\"width\"] = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Filter.prototype, \"height\", {\n /**\r\n * @return Height\r\n */\n get: function get() {\n return this.properties[\"height\"];\n },\n\n /**\r\n * Height of the filter element in percent.\r\n *\r\n * If the filter is designed to \"bleed out\" of the original target element,\r\n * like for example a shadow, you need this bigger than 100, or the\r\n * non-fitting parts will be clipped.\r\n *\r\n * @default 120\r\n * @param value Height (%)\r\n */\n set: function set(value) {\n this.properties[\"height\"] = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies properties from another [[Filter]] object.\r\n *\r\n * @param filter Source [[Filter]] object\r\n */\n\n Filter.prototype.copyFrom = function (filter) {\n var _this = this;\n\n _super.prototype.copyFrom.call(this, filter);\n\n $object.each(filter.properties, function (key, value) {\n _this[key] = value;\n });\n };\n\n Object.defineProperty(Filter.prototype, \"paper\", {\n /**\r\n * @return Paper\r\n */\n get: function get() {\n if (this._paper) {\n return this._paper;\n }\n\n return getGhostPaper();\n },\n\n /**\r\n * Sets [[Paper]] instance to create filter's elements in.\r\n *\r\n * @ignore Exclude from docs\r\n * @param paper Paper\r\n */\n set: function set(paper) {\n if (this._paper != paper) {\n this._paper = paper;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Filter.prototype, \"animations\", {\n /**\r\n * All animations currently in play.\r\n *\r\n * @ignore Exclude from docs\r\n * @return List of animations\r\n */\n get: function get() {\n if (!this._animations) {\n this._animations = [];\n\n this._disposers.push(new AnimationDisposer(this._animations));\n }\n\n return this._animations;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Filter.prototype, \"scale\", {\n /**\r\n * @ignore Exclude from docs\r\n */\n get: function get() {\n return this._scale;\n },\n\n /**\r\n * [[Sprite]] uses this method to inform filter about it's scale.\r\n *\r\n * @ignore Exclude from docs\r\n */\n set: function set(value) {\n this._scale = value;\n this.updateScale();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates filter properties which depend on scale.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Filter.prototype.updateScale = function () {// Dummy method for extending classes to override.\n };\n\n Object.defineProperty(Filter.prototype, \"filterUnits\", {\n /**\r\n * @return Filter units\r\n */\n get: function get() {\n return this.properties.filterUnits;\n },\n\n /**\r\n * Which units are used when drawing filter.\r\n *\r\n * Use `\"userSpaceOnUse\"` when applying filters on a perfectly straight line.\r\n *\r\n * @since 4.9.17\r\n * @default objectBoundingBox\r\n * @param value Filter units\r\n */\n set: function set(value) {\n this.properties.filterUnits = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Filter.prototype, \"nonScaling\", {\n /**\r\n * @return Non scaling?\r\n */\n get: function get() {\n return this._nonScaling;\n },\n\n /**\r\n * If a filter is non scaling, it will look the same even if the sprite is\r\n * scaled, otherwise filter will scale together with a [[Sprite]].\r\n *\r\n * @default false\r\n * @param value Non scaling?\r\n */\n set: function set(value) {\n this._nonScaling = value;\n\n if (!value) {\n this._scale = 1;\n }\n\n this.updateScale();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Filter.prototype, \"sprite\", {\n /**\r\n * A target element this filter is currently attached to.\r\n *\r\n * We need to keep track of it because one filter can be used for just one\r\n * element, so we have to remove it from the old \"parent\" when attaching to\r\n * the new one.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Target element\r\n */\n set: function set(value) {\n this.setSprite(value);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Sets filter's target element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Element filter is being attached to\r\n */\n\n Filter.prototype.setSprite = function (value) {\n if (this._sprite && this._sprite != value) {\n this._sprite.filters.removeValue(this);\n }\n\n this._sprite = value;\n };\n\n return Filter;\n}(BaseObject);\n\nexport { Filter };","/**\r\n * Module for \"Drop Shadow\" filter.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Filter } from \"./Filter\";\nimport { color } from \"../../utils/Color\";\nimport { registry } from \"../../Registry\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creats a \"Drop Shadow\" filter.\r\n */\n\nvar DropShadowFilter =\n/** @class */\nfunction (_super) {\n __extends(DropShadowFilter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function DropShadowFilter() {\n var _this = _super.call(this) || this;\n\n _this.className = \"DropShadowFilter\"; // Create elements\n // NOTE: we do not need to add each individual element to `_disposers`\n // because `filterPrimitives` has an event handler which automatically adds\n // anything added to it to `_disposers`\n\n _this.color = color(\"#000\");\n _this.feGaussianBlur = _this.paper.add(\"feGaussianBlur\");\n\n _this.feGaussianBlur.attr({\n \"result\": \"blurOut\",\n \"in\": \"SourceGraphic\"\n });\n\n _this.filterPrimitives.push(_this.feGaussianBlur);\n\n _this.feOffset = _this.paper.add(\"feOffset\");\n\n _this.feOffset.attr({\n \"result\": \"offsetBlur\"\n });\n\n _this.filterPrimitives.push(_this.feOffset);\n\n _this.feFlood = _this.paper.add(\"feFlood\");\n\n _this.feFlood.attr({\n \"flood-color\": _this.color\n });\n\n _this.filterPrimitives.push(_this.feFlood);\n\n _this.feComposite = _this.paper.add(\"feComposite\");\n\n _this.feComposite.attr({\n \"in2\": \"offsetBlur\",\n operator: \"in\"\n });\n\n _this.filterPrimitives.push(_this.feComposite);\n\n _this.feMerge = _this.paper.addGroup(\"feMerge\");\n\n _this.feMerge.add(_this.paper.add(\"feMergeNode\"));\n\n _this.feMerge.add(_this.paper.add(\"feMergeNode\").attr({\n \"in\": \"SourceGraphic\"\n }));\n\n _this.filterPrimitives.push(_this.feMerge); // Set default properties\n\n\n _this.width = 200;\n _this.height = 200;\n _this.blur = 1.5;\n _this.dx = 3;\n _this.dy = 3;\n _this.opacity = 0.5;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(DropShadowFilter.prototype, \"color\", {\n /**\r\n * @return Color\r\n */\n get: function get() {\n return this.properties.color;\n },\n\n /**\r\n * Shadow color.\r\n *\r\n * @param value Color\r\n */\n set: function set(value) {\n this.properties.color = value;\n\n if (this.feFlood) {\n this.feFlood.attr({\n \"flood-color\": value\n });\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DropShadowFilter.prototype, \"opacity\", {\n /**\r\n * @return Opacity (0-1)\r\n */\n get: function get() {\n return this.properties.opacity;\n },\n\n /**\r\n * Opacity of the shadow. (0-1)\r\n *\r\n * @param value Opacity (0-1)\r\n */\n set: function set(value) {\n this.properties.opacity = value;\n this.feFlood.attr({\n \"flood-opacity\": value\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DropShadowFilter.prototype, \"dx\", {\n /**\r\n * @return Horizontal offset (px)\r\n */\n get: function get() {\n return this.properties.dx;\n },\n\n /**\r\n * Horizontal offset in pixels.\r\n *\r\n * @param value Horizontal offset (px)\r\n */\n set: function set(value) {\n this.properties.dx = value;\n this.feOffset.attr({\n \"dx\": value / this.scale\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DropShadowFilter.prototype, \"dy\", {\n /**\r\n * @return Vertical offset (px)\r\n */\n get: function get() {\n return this.properties.dy;\n },\n\n /**\r\n * Vertical offset in pixels.\r\n *\r\n * @param value Vertical offset (px)\r\n */\n set: function set(value) {\n this.properties.dy = value;\n this.feOffset.attr({\n \"dy\": value / this.scale\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DropShadowFilter.prototype, \"blur\", {\n /**\r\n * @return Blur\r\n */\n get: function get() {\n return this.properties.blur;\n },\n\n /**\r\n * Blur.\r\n *\r\n * @param value Blur\r\n */\n set: function set(value) {\n this.properties.blur = value;\n this.feGaussianBlur.attr({\n \"stdDeviation\": value / this.scale\n });\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * [updateScale description]\r\n *\r\n * @todo Description\r\n */\n\n DropShadowFilter.prototype.updateScale = function () {\n this.dx = this.dx;\n this.dy = this.dy;\n this.blur = this.blur;\n };\n\n return DropShadowFilter;\n}(Filter);\n\nexport { DropShadowFilter };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"DropShadowFilter\"] = DropShadowFilter;","/**\r\n * Provides functionality used to creating and showing tooltips (balloons).\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { registry } from \"../../core/Registry\";\nimport { PointedRectangle } from \"./PointedRectangle\";\nimport { Label } from \"../elements/Label\";\nimport { Animation } from \"../utils/Animation\";\nimport { color } from \"../utils/Color\";\nimport { DropShadowFilter } from \"../rendering/filters/DropShadowFilter\";\nimport * as $math from \"../utils/Math\";\nimport * as $ease from \"../utils/Ease\";\nimport * as $utils from \"../utils/Utils\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Tooltip displays text and/or multimedia information in a balloon over chart\r\n * area.\r\n * @see {@link ITooltipEvents} for a list of available events\r\n * @see {@link ITooltipAdapters} for a list of available Adapters\r\n */\n\nvar Tooltip =\n/** @class */\nfunction (_super) {\n __extends(Tooltip, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Tooltip() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * Holds numeric boundary values. Calculated from the `boundingContainer`.\r\n * @ignore\r\n */\n\n\n _this._boundingRect = {\n x: -40000,\n y: -40000,\n width: 80000,\n height: 80000\n };\n /**\r\n * Coordinates tooltip's pointer (stem) should point to.\r\n */\n\n _this._pointTo = {\n x: 0,\n y: 0\n };\n /**\r\n * If set to `true` the pointer/stem of the Tooltip will not go outside\r\n * Tooltip's width or height depending on pointer's orientation.\r\n *\r\n * @default false\r\n */\n\n _this.fitPointerToBounds = false;\n /**\r\n * If `tooltipOrientation` is vertical, it can be drawn below or above point\r\n * We need to know this when solving overlapping.\r\n */\n\n _this._verticalOrientation = \"up\";\n /**\r\n * @ignore\r\n */\n\n _this.fixDoc = true;\n _this.className = \"Tooltip\";\n _this.isMeasured = false;\n _this.getFillFromObject = true;\n\n _this.margin(5, 5, 5, 5);\n\n _this.defaultState.transitionDuration = 1;\n _this.hiddenState.transitionDuration = 1; // Create chrome/background\n\n var background = _this.background;\n background.interactionsEnabled = false;\n background.fillOpacity = 0.9;\n background.strokeWidth = 1;\n background.strokeOpacity = 1;\n background.stroke = color(\"#ffffff\");\n background.cornerRadius = 3;\n background.pointerLength = 6;\n background.pointerBaseWidth = 10;\n var dropShadow = new DropShadowFilter();\n dropShadow.dy = 1;\n dropShadow.dx = 1;\n dropShadow.opacity = 0.5;\n background.filters.push(dropShadow);\n _this.autoTextColor = true; // Create text element\n\n var label = _this.createChild(Label);\n\n label.shouldClone = false;\n _this.label = label;\n label.padding(7, 12, 4, 12);\n label.interactionsEnabled = false;\n label.horizontalCenter = \"middle\";\n label.fill = color(\"#ffffff\");\n\n _this._disposers.push(label);\n\n _this.label.events.on(\"sizechanged\", _this.drawBackground, _this);\n\n _this.label.zIndex = 1; // @todo remove this line when bg sorting is solved\n // Set defaults\n\n _this.pointerOrientation = \"vertical\";\n _this.animationDuration = 0;\n _this.animationEasing = $ease.cubicOut;\n\n _this.setPropertyValue(\"showInViewport\", false); // Set accessibility options\n\n\n _this.role = \"tooltip\";\n _this.visible = false;\n _this.opacity = 0;\n _this.x = 0;\n _this.y = 0;\n\n _this.events.on(\"visibilitychanged\", _this.handleVisibility, _this); // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n\n Tooltip.prototype.handleVisibility = function () {\n if (this.visible) {\n this.label.invalidate();\n }\n };\n\n Object.defineProperty(Tooltip.prototype, \"getStrokeFromObject\", {\n /**\r\n * Specifies if tooltip background should get stroke color from the sprite it is pointing to.\r\n *\r\n * @return {boolean}\r\n * @default false\r\n */\n get: function get() {\n return this.getPropertyValue(\"getStrokeFromObject\");\n },\n\n /**\r\n * Specifies if tooltip background should get stroke color from the sprite it is pointing to.\r\n *\r\n * @param value boolean\r\n */\n set: function set(value) {\n this.setPropertyValue(\"getStrokeFromObject\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"autoTextColor\", {\n /**\r\n * @return {boolean}\r\n */\n get: function get() {\n return this.getPropertyValue(\"autoTextColor\");\n },\n\n /**\r\n * Specifies if text color should be chosen automatically for a better\r\n * readability.\r\n *\r\n * IMPORTANT: this feature is generally ignored, if `getFillFromObject = false`.\r\n *\r\n * If inheriting of `fill` color from object tooltip is displayed for is\r\n * disabled, this feature will not work. If you are explicitly setting a\r\n * color for tooltip background, you may set a color for its label as well\r\n * using `tooltip.label.fill` property.\r\n *\r\n *\r\n * @param value boolean\r\n */\n set: function set(value) {\n this.setPropertyValue(\"autoTextColor\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"keepTargetHover\", {\n /**\r\n * @return Keep target hovered?\r\n */\n get: function get() {\n return this.getPropertyValue(\"keepTargetHover\");\n },\n\n /**\r\n * If this tooltip is displayed on hover on some other object, keep that\r\n * element hovered if hovering on the tooltip.\r\n *\r\n * @default false\r\n * @since 4.1.13\r\n * @param value Keep target hovered?\r\n */\n set: function set(value) {\n var _this = this;\n\n if (this.setPropertyValue(\"keepTargetHover\", value, true)) {\n if (value) {\n this.hoverable = true;\n this.background.interactionsEnabled = true;\n\n this._disposers.push(this.events.on(\"over\", function (ev) {\n if (_this.targetSprite && _this.targetSprite.hoverable) {\n _this.targetSprite.isHover = true;\n }\n }));\n\n this._disposers.push(this.events.on(\"out\", function (ev) {\n if (_this.targetSprite && _this.targetSprite.hoverable) {\n //this.hideTooltip();\n //this.targetSprite.handleOut();\n _this.targetSprite.isHover = false;\n }\n }));\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"showInViewport\", {\n /**\r\n * @return Force showing tooltip?\r\n */\n get: function get() {\n return this.getPropertyValue(\"showInViewport\");\n },\n\n /**\r\n * Normally, a tooltip will hide itself if it is pointing to a coordinate\r\n * that is outside viewport.\r\n *\r\n * Setting this setting to `true` will override that and make tooltip\r\n * appear next to the viewport edge closest to the target point.\r\n *\r\n * @default false\r\n * @since 4.5.7\r\n * @param value Force showing tooltip?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"showInViewport\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"getFillFromObject\", {\n /**\r\n * Specifies if tooltip background should get fill color from the sprite it is pointing to.\r\n *\r\n * @return {boolean}\r\n * @default true\r\n */\n get: function get() {\n return this.getPropertyValue(\"getFillFromObject\");\n },\n\n /**\r\n * @param value boolean\r\n */\n set: function set(value) {\n this.setPropertyValue(\"getFillFromObject\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates and returns a background element.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background\r\n */\n\n Tooltip.prototype.createBackground = function () {\n return new PointedRectangle();\n };\n\n Object.defineProperty(Tooltip.prototype, \"pointerOrientation\", {\n /**\r\n * @return Orientation\r\n */\n get: function get() {\n return this.getPropertyValue(\"pointerOrientation\");\n },\n\n /**\r\n * Pointer orientation: `\"horizontal\"`, `\"vertical\"`, `\"up\"`, `\"down\"`,\r\n * `\"right\"`, or `\"left\"`.\r\n *\r\n * Options`\"horizontal\"` or `\"vertical\"` are location-aware, meaning they\r\n * will change position of the Tooltip based on the target point's position\r\n * in relation to chart center.\r\n *\r\n * Options `\"up\"`, `\"down\"`, `\"right\"`, `\"left\"` are static and will point\r\n * in the specified direction regardless of the position, even if that means\r\n * going out of chart/screen bounds.\r\n *\r\n * IMPORTANT: in some situations, like having multiple tooltips stacked for\r\n * multiple series, the `\"up\"` and `\"down\"` values might be ignored in order\r\n * to make tooltip overlap algorithm work.\r\n *\r\n * @default \"vertical\"\r\n * @param value Orientation\r\n */\n set: function set(value) {\n this.setPropertyValue(\"pointerOrientation\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"animationDuration\", {\n /**\r\n * @return Orientation\r\n */\n get: function get() {\n return this.getPropertyValue(\"animationDuration\");\n },\n\n /**\r\n * Duration in milliseconds for the animation to take place when the tooltip\r\n * is moving from one place to another.\r\n *\r\n * @default 0\r\n * @param value number\r\n */\n set: function set(value) {\n this.setPropertyValue(\"animationDuration\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"animationEasing\", {\n /**\r\n * @return {Function}\r\n */\n get: function get() {\n return this.getPropertyValue(\"animationEasing\");\n },\n\n /**\r\n * Tooltip animation (moving from one place to another) easing function.\r\n *\r\n * @default $ease.cubicOut\r\n * @param value (value: number) => number\r\n */\n set: function set(value) {\n this.setPropertyValue(\"animationEasing\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"html\", {\n /**\r\n * @return HTML content\r\n */\n get: function get() {\n return this.label.html;\n },\n\n /**\r\n * HTML content for the Tooltip.\r\n *\r\n * Provided value will be used as is, without applying any further\r\n * formatting to it.\r\n *\r\n * @param value HTML content\r\n */\n set: function set(value) {\n if (this.label.html != value) {\n this.label.html = value;\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"text\", {\n /**\r\n * @return SVG text\r\n */\n get: function get() {\n return this.label.text;\n },\n\n /**\r\n * SVG text content for the Tooltip.\r\n *\r\n * Text can have a number of formatting options supported by\r\n * [[TextFormatter]].\r\n *\r\n * @param value SVG text\r\n */\n set: function set(value) {\n if (this.label.text != value) {\n this.label.text = value;\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates the Tooltip.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Tooltip.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var label = this.label;\n\n if (label.invalid) {\n label.validate();\n }\n\n var x = this._pointTo.x;\n var y = this._pointTo.y;\n var boundingRect = this._boundingRect;\n var textW = label.measuredWidth;\n var textH = label.measuredHeight;\n var pointerLength = this.background.pointerLength;\n var textX;\n var textY;\n\n if (this.ignoreBounds) {\n boundingRect = undefined;\n } // try to handle if text is wider than br\n\n\n if (boundingRect && this.fixDoc && textW > boundingRect.width) {\n // TODO maybe this isn't needed ?\n $utils.spritePointToDocument({\n x: boundingRect.x,\n y: boundingRect.y\n }, this.parent);\n var p1 = $utils.spritePointToDocument({\n x: boundingRect.x + boundingRect.width,\n y: boundingRect.y + boundingRect.height\n }, this.parent);\n var documentWidth = document.body.offsetWidth; // TODO maybe this isn't needed ?\n\n $utils.used(document.body.offsetHeight);\n\n if (p1.x > documentWidth / 2) {\n boundingRect.x = boundingRect.width - textW;\n } else {\n boundingRect.width = boundingRect.x + textW;\n }\n }\n\n var pointerOrientation = this.pointerOrientation; // horizontal\n\n if (pointerOrientation == \"horizontal\" || pointerOrientation == \"left\" || pointerOrientation == \"right\") {\n textY = -textH / 2;\n\n if (pointerOrientation == \"horizontal\") {\n if (boundingRect && x > boundingRect.x + boundingRect.width / 2) {\n textX = -textW / 2 - pointerLength;\n } else {\n textX = textW / 2 + pointerLength;\n }\n } else if (pointerOrientation == \"left\") {\n textX = textW / 2 + pointerLength;\n } else {\n textX = -textW / 2 - pointerLength;\n }\n } // vertical pointer\n else {\n if (boundingRect) {\n textX = $math.fitToRange(0, boundingRect.x - x + textW / 2, boundingRect.x - x + boundingRect.width - textW / 2);\n }\n\n if (pointerOrientation == \"vertical\") {\n if (boundingRect && y > boundingRect.y + textH + pointerLength) {\n textY = -textH - pointerLength;\n this._verticalOrientation = \"up\";\n } else {\n textY = pointerLength;\n this._verticalOrientation = \"down\";\n }\n } else if (pointerOrientation == \"down\") {\n textY = -textH - pointerLength;\n this._verticalOrientation = \"up\";\n } else {\n textY = pointerLength;\n this._verticalOrientation = \"down\";\n }\n }\n\n if (boundingRect) {\n textY = $math.fitToRange(textY, boundingRect.y - y, boundingRect.y + boundingRect.height - textH - y);\n }\n\n label.x = textX;\n label.y = textY;\n this.drawBackground();\n };\n /**\r\n * Overrides functionality from the superclass.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Tooltip.prototype.updateBackground = function () {\n this.group.addToBack(this.background.group);\n };\n /**\r\n * Draws Tooltip background (chrome, background and pointer/stem).\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Tooltip.prototype.drawBackground = function () {\n var label = this.label;\n var background = this.background;\n var textWidth = label.measuredWidth;\n var textHeight = label.measuredHeight;\n var boundingRect = this._boundingRect;\n var bgWidth = textWidth;\n var bgX = label.pixelX - textWidth / 2;\n var bgHeight = textHeight;\n var bgY = label.pixelY;\n var x = this._pointTo.x;\n var y = this._pointTo.y;\n var boundX1 = boundingRect.x - x;\n var boundX2 = boundX1 + boundingRect.width;\n var boundY1 = boundingRect.y - y;\n var boundY2 = boundY1 + boundingRect.height;\n background.x = bgX;\n background.y = bgY;\n background.width = bgWidth;\n background.height = bgHeight;\n\n if (this.fitPointerToBounds) {\n background.pointerX = $math.fitToRange(-background.x, boundX1 - background.x, boundX2 - background.x);\n background.pointerY = $math.fitToRange(-background.y, boundY1 - background.y, boundY2 - background.y);\n } else {\n background.pointerX = -background.x;\n background.pointerY = -background.y;\n }\n\n background.validate();\n };\n /**\r\n *\r\n */\n\n\n Tooltip.prototype.delayedPointTo = function (point, instantly) {\n var _this = this;\n\n if (this._pointToDisposer) {\n this._pointToDisposer.dispose();\n }\n\n this._pointToDisposer = registry.events.once(\"exitframe\", function () {\n _this.pointTo(point, instantly);\n });\n this.addDisposer(this._pointToDisposer);\n };\n /**\r\n * Set nes tooltip's anchor point and moves whole tooltip.\r\n *\r\n * @param x X coordinate\r\n * @param y Y coordinate\r\n */\n\n\n Tooltip.prototype.pointTo = function (point, instantly) {\n if (this._pointTo.x != point.x || this._pointTo.y != point.y) {\n this._pointTo = point;\n this.invalidate(); // this helps to avoid strange animation from nowhere on initial show or when balloon was hidden already\n\n if (!this.visible || instantly) {\n this.moveTo(this._pointTo);\n\n if (this._animation) {\n this._animation.kill();\n }\n } else {\n // helps to avoid flicker on top/left corner\n if (this.pixelX == 0 && this.pixelY == 0) {\n this.moveTo(this._pointTo);\n } else {\n if (this._animation) {\n this._animation.kill();\n }\n\n this._animation = new Animation(this, [{\n property: \"x\",\n to: point.x,\n from: this.pixelX\n }, {\n property: \"y\",\n to: point.y,\n from: this.pixelY\n }], this.animationDuration, this.animationEasing).start();\n }\n }\n }\n };\n /**\r\n * Sets numeric boundaries Tooltip needs to obey (so it does not go outside\r\n * specific area).\r\n *\r\n * @ignore Exclude from docs\r\n * @param rectangle Boundary rectangle\r\n */\n\n\n Tooltip.prototype.setBounds = function (rectangle) {\n var oldRect = this._boundingRect;\n\n if (oldRect.x != rectangle.x || oldRect.y != rectangle.y || oldRect.width != rectangle.width || oldRect.height != rectangle.height) {\n this._boundingRect = rectangle;\n this.invalidate();\n }\n };\n\n Object.defineProperty(Tooltip.prototype, \"boundingContainer\", {\n /**\r\n * Sets a [[Container]] instance to be used when calculating numeric\r\n * boundaries for the Tooltip.\r\n *\r\n * @ignore Exclude from docs\r\n * @param container Boundary container\r\n */\n set: function set(container) {\n this._boundingContainer = container; // TODO remove closures ?\n\n container.events.on(\"sizechanged\", this.updateBounds, this);\n container.events.on(\"positionchanged\", this.updateBounds, this);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates numeric boundaries for the Tooltip, based on the\r\n * `boundingCountrainer`.\r\n */\n\n Tooltip.prototype.updateBounds = function () {\n var boundingContainer = this._boundingContainer; // to global\n\n var rect = $utils.spriteRectToSvg({\n x: boundingContainer.pixelX,\n y: boundingContainer.pixelY,\n width: boundingContainer.maxWidth,\n height: boundingContainer.maxHeight\n }, boundingContainer);\n this.setBounds(rect);\n };\n\n Object.defineProperty(Tooltip.prototype, \"ignoreBounds\", {\n /**\r\n * @return Ignore chart bounds?\r\n */\n get: function get() {\n return this.getPropertyValue(\"ignoreBounds\");\n },\n\n /**\r\n * Normally, a tooltip's position will be adjusted so it always fits into\r\n * chart's coundaries.\r\n *\r\n * Setting this to `false` will disable such checks and will allow tooltip\r\n * to \"bleed over\" the edge of the chart.\r\n *\r\n * @default false\r\n * @since 4.10.8\r\n * @param value Ignore chart bounds?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"ignoreBounds\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"verticalOrientation\", {\n /**\r\n * If tooltipOrientation is vertical, it can be drawn below or above point.\r\n * We need to know this when solving overlapping.\r\n *\r\n * @ignore Exclude from docs\r\n * @return \"up\" | \"down\"\r\n */\n get: function get() {\n return this._verticalOrientation;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tooltip.prototype, \"tooltip\", {\n /**\r\n * To avoid stackoverflow\r\n * @ignore\r\n */\n get: function get() {\n return undefined;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies properties and other attributes.\r\n *\r\n * @param source Source\r\n */\n\n Tooltip.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.label.copyFrom(source.label);\n\n if (source._boundingRect) {\n this._boundingRect = source._boundingRect;\n }\n };\n /**\r\n * Adds easing functions to \"function\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as function?\r\n */\n\n\n Tooltip.prototype.asFunction = function (field) {\n return field == \"animationEasing\" || _super.prototype.asIs.call(this, field);\n };\n\n return Tooltip;\n}(Container);\n\nexport { Tooltip };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Tooltip\"] = Tooltip;","/**\r\n * Functionality for drawing a trapezoid.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { percent } from \"../../core/utils/Percent\";\nimport { registry } from \"../Registry\";\nimport * as $utils from \"../utils/Utils\";\nimport * as $type from \"../utils/Type\";\nimport * as $path from \"../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a Trapezoid.\r\n *\r\n * @see {@link ITrapezoidEvents} for a list of available events\r\n * @see {@link ITrapezoidAdapters} for a list of available Adapters\r\n */\n\nvar Trapezoid =\n/** @class */\nfunction (_super) {\n __extends(Trapezoid, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Trapezoid() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Trapezoid\";\n _this.element = _this.paper.add(\"path\");\n _this.topSide = percent(100);\n _this.bottomSide = percent(100);\n _this.leftSide = percent(100);\n _this.rightSide = percent(100);\n _this.isMeasured = false; // todo: add measureElement\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Trapezoid.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var w = this.pixelWidth;\n var h = this.pixelHeight;\n var ts = $utils.relativeToValue(this.topSide, w);\n var bs = $utils.relativeToValue(this.bottomSide, w);\n var ls = $utils.relativeToValue(this.leftSide, h);\n var rs = $utils.relativeToValue(this.rightSide, h); // 1----2\n // | |\n // 4----3\n\n var x0 = (w - ts) / 2;\n var y0 = (h - ls) / 2;\n var x1 = w - (w - ts) / 2;\n var y1 = (h - rs) / 2;\n var x2 = w - (w - bs) / 2;\n var y2 = h - (h - rs) / 2;\n var x3 = (w - bs) / 2;\n var y3 = h - (h - ls) / 2;\n var mt = \"\";\n var mr = \"\";\n var mb = \"\";\n var ml = \"\";\n\n if ($type.hasValue(this.horizontalNeck)) {\n var hn = this.horizontalNeck.value;\n mt = $path.lineTo({\n x: w * hn,\n y: Math.max(y0, y1)\n });\n mb = $path.lineTo({\n x: w * hn,\n y: Math.min(y2, y3)\n });\n }\n\n if ($type.hasValue(this.verticalNeck)) {\n var vn = this.verticalNeck.value;\n mr = $path.lineTo({\n x: Math.min(x1, x2),\n y: h * vn\n });\n ml = $path.lineTo({\n x: Math.max(x0, x3),\n y: h * vn\n });\n }\n\n var path = $path.moveTo({\n x: x0,\n y: y0\n }) + mt + $path.lineTo({\n x: x1,\n y: y1\n }) + mr + $path.lineTo({\n x: x2,\n y: y2\n }) + mb + $path.lineTo({\n x: x3,\n y: y3\n }) + ml;\n this.path = path;\n };\n\n Object.defineProperty(Trapezoid.prototype, \"topSide\", {\n /**\r\n * @return Width\r\n */\n get: function get() {\n return this.getPropertyValue(\"topSide\");\n },\n\n /**\r\n * Wdith of the top side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Width\r\n */\n set: function set(value) {\n this.setPercentProperty(\"topSide\", value, true, false, 10, false);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Trapezoid.prototype, \"bottomSide\", {\n /**\r\n * @return Width\r\n */\n get: function get() {\n return this.getPropertyValue(\"bottomSide\");\n },\n\n /**\r\n * Wdith of the bottom side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Width\r\n */\n set: function set(value) {\n this.setPercentProperty(\"bottomSide\", value, true, false, 10, false);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Trapezoid.prototype, \"leftSide\", {\n /**\r\n * @return Height\r\n */\n get: function get() {\n return this.getPropertyValue(\"leftSide\");\n },\n\n /**\r\n * Height of the left side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Height\r\n */\n set: function set(value) {\n this.setPercentProperty(\"leftSide\", value, true, false, 10, false);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Trapezoid.prototype, \"rightSide\", {\n /**\r\n * @return Height\r\n */\n get: function get() {\n return this.getPropertyValue(\"rightSide\");\n },\n\n /**\r\n * Height of the right side. Absolute (px) or relative ([[Percent]]).\r\n *\r\n * @default Percent(100)\r\n * @param value Height\r\n */\n set: function set(value) {\n this.setPercentProperty(\"rightSide\", value, true, false, 10, false);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Trapezoid.prototype, \"horizontalNeck\", {\n /**\r\n * @return Horizontal neck position\r\n */\n get: function get() {\n return this.getPropertyValue(\"horizontalNeck\");\n },\n\n /**\r\n * A relative vertical position of the \"neck\". If the top and bottom sides\r\n * are of different width, and `horizontalNeck` is set, a choke point\r\n * will be created at that position, creating a funnel shape.\r\n *\r\n * @param value Horizontal neck position\r\n */\n set: function set(value) {\n this.setPropertyValue(\"horizontalNeck\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Trapezoid.prototype, \"verticalNeck\", {\n /**\r\n * @return Vertical neck position\r\n */\n get: function get() {\n return this.getPropertyValue(\"verticalNeck\");\n },\n\n /**\r\n * A relative horizontal position of the \"neck\". If the left and right sides\r\n * are of different height, and `verticalNeck` is set, a choke point\r\n * will be created at that position, creating a funnel shape.\r\n *\r\n * @param value Vertical neck position\r\n */\n set: function set(value) {\n this.setPropertyValue(\"verticalNeck\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return Trapezoid;\n}(Sprite);\n\nexport { Trapezoid };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Trapezoid\"] = Trapezoid;","/**\r\n * Functionality for drawing triangles.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../Sprite\";\nimport { registry } from \"../Registry\";\nimport * as $path from \"../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a triangle.\r\n *\r\n * @see {@link ITriangleEvents} for a list of available events\r\n * @see {@link ITriangleAdapters} for a list of available Adapters\r\n */\n\nvar Triangle =\n/** @class */\nfunction (_super) {\n __extends(Triangle, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Triangle() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Triangle\";\n _this.element = _this.paper.add(\"path\");\n _this.direction = \"top\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Triangle.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var w = this.pixelWidth;\n var h = this.pixelHeight;\n var path;\n\n switch (this.direction) {\n case \"right\":\n path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: w,\n y: h / 2\n }) + $path.lineTo({\n x: 0,\n y: h\n }) + $path.closePath();\n break;\n\n case \"left\":\n path = $path.moveTo({\n x: w,\n y: 0\n }) + $path.lineTo({\n x: 0,\n y: h / 2\n }) + $path.lineTo({\n x: w,\n y: h\n }) + $path.closePath();\n break;\n\n case \"bottom\":\n path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: w,\n y: 0\n }) + $path.lineTo({\n x: w / 2,\n y: h\n }) + $path.closePath();\n break;\n\n case \"top\":\n path = $path.moveTo({\n x: w / 2,\n y: 0\n }) + $path.lineTo({\n x: w,\n y: h\n }) + $path.lineTo({\n x: 0,\n y: h\n }) + $path.closePath();\n break;\n }\n\n this.path = path;\n };\n\n Object.defineProperty(Triangle.prototype, \"direction\", {\n /**\r\n * Returns direction of a triangle\r\n *\r\n * @return value\r\n */\n get: function get() {\n return this.getPropertyValue(\"direction\");\n },\n\n /**\r\n * Sets direction of a triangle\r\n *\r\n * @param value\r\n */\n set: function set(value) {\n this.setPropertyValue(\"direction\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return Triangle;\n}(Sprite);\n\nexport { Triangle };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Triangle\"] = Triangle;","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { registry } from \"../Registry\";\nimport * as $path from \"./Path\";\nimport * as $array from \"../utils/Array\";\nimport * as $utils from \"../utils/Utils\";\nimport * as $math from \"../utils/Math\";\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\nvar Tension =\n/** @class */\nfunction () {\n /**\r\n * Constructor.\r\n *\r\n * @param tensionX [description]\r\n * @param tensionY [description]\r\n */\n function Tension(tensionX, tensionY) {\n this._tensionX = tensionX;\n this._tensionY = tensionY;\n }\n /**\r\n * [smooth description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param points [description]\r\n * @return [description]\r\n */\n\n\n Tension.prototype.smooth = function (points) {\n for (var i = points.length - 1; i > 0; i--) {\n var p0 = points[i];\n var p1 = points[i - 1];\n\n if (Math.abs(p0.x - p1.x) < 0.1 && Math.abs(p0.y - p1.y) < 0.1) {\n points.splice(i - 1, 1);\n }\n }\n\n var tensionX = this._tensionX;\n var tensionY = this._tensionY;\n\n if (points.length < 3 || tensionX >= 1 && tensionY >= 1) {\n return $path.polyline(points);\n }\n\n var first = points[0];\n var last = points[points.length - 1];\n var closed = false;\n\n if ($math.round(first.x, 3) == $math.round(last.x) && $math.round(first.y) == $math.round(last.y)) {\n closed = true;\n } // Can't moveTo here, as it wont be possible to have fill then.\n\n\n var path = \"\";\n\n for (var i = 0, len = points.length - 1; i < len; i++) {\n var p0 = points[i - 1];\n var p1 = points[i];\n var p2 = points[i + 1];\n var p3 = points[i + 2];\n\n if (i === 0) {\n if (closed) {\n p0 = points[points.length - 2];\n } else {\n p0 = points[i];\n }\n } else if (i == points.length - 2) {\n if (closed) {\n p3 = points[1];\n } else {\n p3 = points[i + 1];\n }\n }\n\n var controlPointA = $math.getCubicControlPointA(p0, p1, p2, p3, tensionX, tensionY);\n var controlPointB = $math.getCubicControlPointB(p0, p1, p2, p3, tensionX, tensionY);\n path += $path.cubicCurveTo(p2, controlPointA, controlPointB);\n }\n\n return path;\n };\n\n return Tension;\n}();\n\nexport { Tension };\n/**\r\n * Returns a waved line SVG path between two points.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point1 Starting point\r\n * @param point2 Ending point\r\n * @param waveLength Wave length\r\n * @param waveHeight Wave height\r\n * @param adjustWaveLength Adjust wave length based on the actual line length\r\n * @return SVG path\r\n */\n\nexport function wavedLine(point1, point2, waveLength, waveHeight, tension, adjustWaveLength) {\n var x1 = point1.x;\n var y1 = point1.y;\n var x2 = point2.x;\n var y2 = point2.y;\n var distance = $math.getDistance(point1, point2);\n\n if (adjustWaveLength) {\n waveLength = distance / Math.round(distance / waveLength);\n }\n\n var d = registry.getCache($utils.stringify([\"wavedLine\", point1.x, point2.x, point1.y, point2.y, waveLength, waveHeight]));\n\n if (!d) {\n if (distance > 0) {\n var angle = Math.atan2(y2 - y1, x2 - x1);\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n var waveLengthX = waveLength * cos;\n var waveLengthY = waveLength * sin;\n\n if (waveLength <= 1 || waveHeight <= 1) {\n d = $path.lineTo(point2);\n } else {\n var halfWaveCount = Math.round(2 * distance / waveLength);\n var points = [];\n var sign_1 = 1;\n\n if (x2 < x1) {\n sign_1 *= -1;\n }\n\n if (y2 < y1) {\n sign_1 *= -1;\n }\n\n for (var i = 0; i <= halfWaveCount; i++) {\n sign_1 *= -1;\n var x = x1 + i * waveLengthX / 2 + sign_1 * waveHeight / 2 * sin;\n var y = y1 + i * waveLengthY / 2 - sign_1 * waveHeight / 2 * cos;\n points.push({\n x: x,\n y: y\n });\n }\n\n d = new Tension(tension, tension).smooth(points);\n }\n } else {\n d = \"\";\n }\n\n registry.setCache($utils.stringify([\"wavedLine\", point1.x, point2.x, point1.y, point2.y, waveLength, waveHeight]), d);\n }\n\n return d;\n}\n\nvar Monotone =\n/** @class */\nfunction () {\n function Monotone(reversed, info) {\n this._reversed = reversed;\n this._closed = info.closed;\n } // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n // \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\n\n\n Monotone.prototype._curve = function (x0, x1, y0, y1, t0, t1) {\n var dx = (x1 - x0) / 3;\n\n if (this._reversed) {\n return $path.cubicCurveTo({\n x: y1,\n y: x1\n }, {\n x: y0 + dx * t0,\n y: x0 + dx\n }, {\n x: y1 - dx * t1,\n y: x1 - dx\n });\n } else {\n return $path.cubicCurveTo({\n x: x1,\n y: y1\n }, {\n x: x0 + dx,\n y: y0 + dx * t0\n }, {\n x: x1 - dx,\n y: y1 - dx * t1\n });\n }\n };\n\n Monotone.prototype.smooth = function (points) {\n var _this = this;\n\n var x0 = NaN;\n var x1 = NaN;\n var y0 = NaN;\n var y1 = NaN;\n var t0 = NaN;\n var point = 0;\n var output = \"\";\n $array.each(points, function (_a) {\n var x = _a.x,\n y = _a.y;\n\n if (_this._reversed) {\n var temp = x;\n x = y;\n y = temp;\n }\n\n var t1 = NaN;\n\n if (!(x === x1 && y === y1)) {\n switch (point) {\n case 0:\n point = 1;\n\n if (_this._reversed) {\n output += $path.lineTo({\n x: y,\n y: x\n });\n } else {\n output += $path.lineTo({\n x: x,\n y: y\n });\n }\n\n break;\n\n case 1:\n point = 2;\n break;\n\n case 2:\n point = 3;\n output += _this._curve(x0, x1, y0, y1, slope2(x0, x1, y0, y1, t1 = slope3(x0, x1, y0, y1, x, y)), t1);\n break;\n\n default:\n output += _this._curve(x0, x1, y0, y1, t0, t1 = slope3(x0, x1, y0, y1, x, y));\n break;\n }\n\n x0 = x1;\n x1 = x;\n y0 = y1;\n y1 = y;\n t0 = t1;\n }\n });\n\n switch (point) {\n case 2:\n if (this._reversed) {\n output += $path.lineTo({\n x: y1,\n y: x1\n });\n } else {\n output += $path.lineTo({\n x: x1,\n y: y1\n });\n }\n\n break;\n\n case 3:\n output += this._curve(x0, x1, y0, y1, t0, slope2(x0, x1, y0, y1, t0));\n break;\n }\n\n if (this._closed) {\n output += $path.closePath();\n }\n\n return output;\n };\n\n return Monotone;\n}();\n\nexport { Monotone }; // TODO move this someplace else\n\nfunction sign(x) {\n return x < 0 ? -1 : 1;\n}\n\nfunction slope2(x0, x1, y0, y1, t) {\n var h = x1 - x0;\n return h ? (3 * (y1 - y0) / h - t) / 2 : t;\n}\n\nfunction slope3(x0, x1, y0, y1, x2, y2) {\n var h0 = x1 - x0;\n var h1 = x2 - x1;\n var s0 = (y1 - y0) / (h0 || h1 < 0 && -0);\n var s1 = (y2 - y1) / (h1 || h0 < 0 && -0);\n var p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\nvar MonotoneX =\n/** @class */\nfunction (_super) {\n __extends(MonotoneX, _super);\n\n function MonotoneX(info) {\n return _super.call(this, false, info) || this;\n }\n\n return MonotoneX;\n}(Monotone);\n\nexport { MonotoneX };\n\nvar MonotoneY =\n/** @class */\nfunction (_super) {\n __extends(MonotoneY, _super);\n\n function MonotoneY(info) {\n return _super.call(this, true, info) || this;\n }\n\n return MonotoneY;\n}(Monotone);\n\nexport { MonotoneY };\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\nvar Basis =\n/** @class */\nfunction () {\n /**\r\n * Constructor.\r\n *\r\n * @param info [description]\r\n */\n function Basis(info) {\n this._closed = info.closed;\n }\n /**\r\n * [smooth description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param points [description]\r\n * @return [description]\r\n */\n\n\n Basis.prototype.smooth = function (points) {\n var _this = this;\n\n var x0 = NaN;\n var x1 = NaN;\n var x2 = NaN;\n var x3 = NaN;\n var x4 = NaN;\n var y0 = NaN;\n var y1 = NaN;\n var y2 = NaN;\n var y3 = NaN;\n var y4 = NaN;\n var point = 0;\n var output = \"\";\n\n var pushCurve = function pushCurve(x, y) {\n output += $path.cubicCurveTo({\n x: (x0 + 4 * x1 + x) / 6,\n y: (y0 + 4 * y1 + y) / 6\n }, {\n x: (2 * x0 + x1) / 3,\n y: (2 * y0 + y1) / 3\n }, {\n x: (x0 + 2 * x1) / 3,\n y: (y0 + 2 * y1) / 3\n });\n };\n\n var pushPoint = function pushPoint(_a) {\n var x = _a.x,\n y = _a.y;\n\n switch (point) {\n case 0:\n point = 1;\n\n if (_this._closed) {\n x2 = x;\n y2 = y;\n } else {\n output += $path.lineTo({\n x: x,\n y: y\n });\n }\n\n break;\n\n case 1:\n point = 2;\n\n if (_this._closed) {\n x3 = x;\n y3 = y;\n }\n\n break;\n\n case 2:\n point = 3;\n\n if (_this._closed) {\n x4 = x;\n y4 = y;\n output += $path.moveTo({\n x: (x0 + 4 * x1 + x) / 6,\n y: (y0 + 4 * y1 + y) / 6\n });\n break;\n } else {\n output += $path.lineTo({\n x: (5 * x0 + x1) / 6,\n y: (5 * y0 + y1) / 6\n }); // fall-through\n }\n\n default:\n pushCurve(x, y);\n break;\n }\n\n x0 = x1;\n x1 = x;\n y0 = y1;\n y1 = y;\n };\n\n $array.each(points, pushPoint);\n\n if (this._closed) {\n switch (point) {\n case 1:\n output += $path.moveTo({\n x: x2,\n y: y2\n });\n output += $path.closePath();\n break;\n\n case 2:\n output += $path.moveTo({\n x: (x2 + 2 * x3) / 3,\n y: (y2 + 2 * y3) / 3\n });\n output += $path.lineTo({\n x: (x3 + 2 * x2) / 3,\n y: (y3 + 2 * y2) / 3\n });\n output += $path.closePath();\n break;\n\n case 3:\n pushPoint({\n x: x2,\n y: y2\n });\n pushPoint({\n x: x3,\n y: y3\n });\n pushPoint({\n x: x4,\n y: y4\n });\n break;\n }\n } else {\n switch (point) {\n case 3:\n pushCurve(x1, y1);\n // fall-through\n\n case 2:\n output += $path.lineTo({\n x: x1,\n y: y1\n });\n break;\n }\n\n output += $path.closePath();\n }\n\n return output;\n };\n\n return Basis;\n}();\n\nexport { Basis };","/**\r\n * Functionality for drawing waved circles.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Circle } from \"./Circle\";\nimport { registry } from \"../Registry\";\nimport * as $path from \"../rendering/Path\";\nimport * as $math from \"../utils/Math\";\nimport * as $utils from \"../utils/Utils\";\nimport * as $smoothing from \"../../core/rendering/Smoothing\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a waved circle.\r\n *\r\n * @see {@link IWavedCircleEvents} for a list of available events\r\n * @see {@link IWavedCircleAdapters} for a list of available Adapters\r\n */\n\nvar WavedCircle =\n/** @class */\nfunction (_super) {\n __extends(WavedCircle, _super);\n /**\r\n * Constructor\r\n */\n\n\n function WavedCircle() {\n var _this = _super.call(this) || this;\n\n _this.className = \"WavedCircle\";\n _this.element = _this.paper.add(\"path\");\n _this.waveLength = 16;\n _this.waveHeight = 4;\n _this.fill = undefined;\n _this.fillOpacity = 0;\n _this.tension = 0.8;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the waved line.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n WavedCircle.prototype.draw = function () {\n var path = \"\";\n var radius = this.pixelRadius;\n\n if (radius > 0) {\n var points = this.getPoints(radius);\n path = $path.moveTo(points[0]) + new $smoothing.Tension(this.tension, this.tension).smooth(points);\n }\n\n var innerRadius = this.pixelInnerRadius;\n\n if (innerRadius > 0) {\n var points = this.getPoints(innerRadius);\n points.reverse();\n path += $path.moveTo(points[0]) + new $smoothing.Tension(this.tension, this.tension).smooth(points);\n }\n\n this.path = path;\n };\n /**\r\n * Returns points that circle consists of.\r\n *\r\n * @param radius Radius (px)\r\n * @return Points\r\n */\n\n\n WavedCircle.prototype.getPoints = function (radius) {\n var circleLength = radius * Math.PI * 2;\n var halfWaveHeight = this.waveHeight / 2;\n var waveLength = circleLength / Math.round(circleLength / this.waveLength);\n var halfWaveLength = waveLength / 2;\n var points = [];\n var count = circleLength / waveLength;\n\n for (var i = 0; i <= count; i++) {\n var angle1 = i * waveLength / circleLength * 360;\n var angle2 = (i * waveLength + halfWaveLength) / circleLength * 360;\n points.push({\n x: (radius - halfWaveHeight) * $math.cos(angle1),\n y: (radius - halfWaveHeight) * $math.sin(angle1)\n });\n points.push({\n x: (radius + halfWaveHeight) * $math.cos(angle2),\n y: (radius + halfWaveHeight) * $math.sin(angle2)\n });\n }\n\n points.pop();\n return points;\n };\n\n Object.defineProperty(WavedCircle.prototype, \"innerRadius\", {\n /**\r\n * @return Inner radius\r\n */\n get: function get() {\n return this.getPropertyValue(\"innerRadius\");\n },\n\n /**\r\n * Inner radius of the circle in pixels (absolute) or [[Percent]] (relative).\r\n *\r\n * @param value Inner radius\r\n */\n set: function set(value) {\n this.setPercentProperty(\"innerRadius\", value, true, false, 10, false);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedCircle.prototype, \"pixelInnerRadius\", {\n /**\r\n * Calculated inner radius of the circle in pixels.\r\n *\r\n * @readonly\r\n * @return Inner radius (px)\r\n */\n get: function get() {\n return $utils.relativeToValue(this.innerRadius, $math.min(this.innerWidth / 2, this.innerHeight / 2));\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedCircle.prototype, \"waveLength\", {\n /**\r\n * @return Wave length (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"waveLength\");\n },\n\n /**\r\n * Wave length in pixels.\r\n *\r\n * @default 16\r\n * @param value Wave length (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"waveLength\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedCircle.prototype, \"waveHeight\", {\n /**\r\n * @return Wave height (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"waveHeight\");\n },\n\n /**\r\n * Wave height in pixels.\r\n *\r\n * @default 4\r\n * @param value Wave height (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"waveHeight\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedCircle.prototype, \"tension\", {\n /**\r\n * @return Tension\r\n */\n get: function get() {\n return this.getPropertyValue(\"tension\");\n },\n\n /**\r\n * Tension of the wave.\r\n *\r\n * @default 0.8\r\n * @param value Tension\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tension\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n return WavedCircle;\n}(Circle);\n\nexport { WavedCircle };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"WavedCircle\"] = WavedCircle;","/**\r\n * Functionality for drawing waved lines.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Line } from \"./Line\";\nimport { color } from \"../utils/Color\";\nimport { wavedLine } from \"../rendering/Smoothing\";\nimport * as $path from \"../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a waved line.\r\n *\r\n * @see {@link IWavedLineEvents} for a list of available events\r\n * @see {@link IWavedLineAdapters} for a list of available Adapters\r\n */\n\nvar WavedLine =\n/** @class */\nfunction (_super) {\n __extends(WavedLine, _super);\n /**\r\n * Constructor\r\n */\n\n\n function WavedLine() {\n var _this = _super.call(this) || this;\n\n _this.className = \"WavedLine\";\n _this.element = _this.paper.add(\"path\");\n _this.waveLength = 16;\n _this.waveHeight = 4;\n _this.tension = 0.8;\n _this.pixelPerfect = false;\n _this.fill = color();\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the waved line.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n WavedLine.prototype.draw = function () {\n //super.draw();\n var p1 = {\n x: this.x1,\n y: this.y1\n };\n var p2 = {\n x: this.x2,\n y: this.y2\n };\n this.path = $path.moveTo(p1) + wavedLine(p1, p2, this.waveLength, this.waveHeight, this.tension, true);\n };\n\n Object.defineProperty(WavedLine.prototype, \"waveLength\", {\n /**\r\n * @return Wave length (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"waveLength\");\n },\n\n /**\r\n * Wave length in pixels.\r\n *\r\n * @default 16\r\n * @param value Wave length (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"waveLength\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedLine.prototype, \"waveHeight\", {\n /**\r\n * @return Wave height (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"waveHeight\");\n },\n\n /**\r\n * Wave height in pixels.\r\n *\r\n * @default 4\r\n * @param value Wave height (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"waveHeight\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedLine.prototype, \"tension\", {\n /**\r\n * @return Tension\r\n */\n get: function get() {\n return this.getPropertyValue(\"tension\");\n },\n\n /**\r\n * Tension of the wave.\r\n *\r\n * @default 0.8\r\n * @param value Tension\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tension\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n return WavedLine;\n}(Line);\n\nexport { WavedLine };","/**\r\n * Functionality for drawing rectangles with waved edges.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Rectangle } from \"./Rectangle\";\nimport { wavedLine } from \"../rendering/Smoothing\";\nimport * as $path from \"../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a rectangle with waved edges.\r\n *\r\n * @see {@link IWavedRectangleEvents} for a list of available events\r\n * @see {@link IWavedRectangleAdapters} for a list of available Adapters\r\n */\n\nvar WavedRectangle =\n/** @class */\nfunction (_super) {\n __extends(WavedRectangle, _super);\n /**\r\n * Constructor\r\n */\n\n\n function WavedRectangle() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"WavedRectangle\"; // Add path element\n\n _this.element = _this.paper.add(\"path\"); // Set defaults\n\n _this.waveLength = 16;\n _this.waveHeight = 4;\n _this.tension = 0.8;\n\n _this.setPropertyValue(\"wavedLeft\", true);\n\n _this.setPropertyValue(\"wavedRight\", true);\n\n _this.setPropertyValue(\"wavedTop\", true);\n\n _this.setPropertyValue(\"wavedBottom\", true); // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the waved rectangle.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n WavedRectangle.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var w = this.pixelWidth;\n var h = this.pixelHeight;\n\n if (w > 0 && h > 0) {\n var p1 = {\n x: 0,\n y: 0\n };\n var p2 = {\n x: w,\n y: 0\n };\n var p3 = {\n x: w,\n y: h\n };\n var p4 = {\n x: 0,\n y: h\n };\n var waveLengthH = Math.min(w, this.waveLength);\n var waveHeightH = Math.min(h, this.waveHeight);\n var waveLengthV = Math.min(h, this.waveLength);\n var waveHeightV = Math.min(w, this.waveHeight);\n var td = \"\";\n var rd = \"\";\n var bd = \"\";\n var ld = \"\";\n\n if (this.wavedTop) {\n td = wavedLine(p1, p2, waveLengthH, waveHeightH, this.tension, true);\n }\n\n if (this.wavedRight) {\n rd = wavedLine(p2, p3, waveLengthV, waveHeightV, this.tension, true);\n }\n\n if (this.wavedBottom) {\n bd = wavedLine(p3, p4, waveLengthH, waveHeightH, this.tension, true);\n }\n\n if (this.wavedLeft) {\n ld = wavedLine(p4, p1, waveLengthV, waveHeightV, this.tension, true);\n }\n\n this.path = $path.moveTo(p1) + td + $path.lineTo(p2) + rd + $path.lineTo(p3) + bd + $path.lineTo(p4) + ld + \"z\";\n }\n };\n\n Object.defineProperty(WavedRectangle.prototype, \"waveLength\", {\n /**\r\n * @return Wave length (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"waveLength\");\n },\n\n /**\r\n * Wave length in pixels.\r\n *\r\n * @default 16\r\n * @param value Wave length (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"waveLength\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedRectangle.prototype, \"waveHeight\", {\n /**\r\n * @return Wave height (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"waveHeight\");\n },\n\n /**\r\n * Wave height in pixels.\r\n *\r\n * @default 4\r\n * @param value Wave height (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"waveHeight\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Sets which side should be waved or not. If particular side is set to\r\n * `false`, a straight line will be drawn on that side.\r\n *\r\n * @param top Top waved?\r\n * @param right Right side waved?\r\n * @param bottom Bottom Waved?\r\n * @param left Left side waved?\r\n */\n\n WavedRectangle.prototype.setWavedSides = function (top, right, bottom, left) {\n this.wavedTop = top;\n this.wavedRight = right;\n this.wavedBottom = bottom;\n this.wavedLeft = left;\n };\n\n Object.defineProperty(WavedRectangle.prototype, \"tension\", {\n /**\r\n * @return Tension\r\n */\n get: function get() {\n return this.getPropertyValue(\"tension\");\n },\n\n /**\r\n * Tension of the wave.\r\n *\r\n * @default 0.8\r\n * @param value Tension\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tension\", value);\n this.invalidate();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedRectangle.prototype, \"wavedRight\", {\n /**\r\n * @return Wave right side?\r\n */\n get: function get() {\n return this.getPropertyValue(\"wavedRight\");\n },\n\n /**\r\n * Specifies if right side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"wavedRight\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedRectangle.prototype, \"wavedLeft\", {\n /**\r\n * @return Wave left side?\r\n */\n get: function get() {\n return this.getPropertyValue(\"wavedLeft\");\n },\n\n /**\r\n * Specifies if left side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"wavedLeft\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedRectangle.prototype, \"wavedTop\", {\n /**\r\n * @return Wave top side?\r\n */\n get: function get() {\n return this.getPropertyValue(\"wavedTop\");\n },\n\n /**\r\n * Specifies if top side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"wavedTop\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(WavedRectangle.prototype, \"wavedBottom\", {\n /**\r\n * @return Wave bottom side?\r\n */\n get: function get() {\n return this.getPropertyValue(\"wavedBottom\");\n },\n\n /**\r\n * Specifies if bottom side should be waved.\r\n *\r\n * @default true\r\n * @param value Waved?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"wavedBottom\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return WavedRectangle;\n}(Rectangle);\n\nexport { WavedRectangle };","/**\r\n * Zoom out button functionality.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Button } from \"./Button\";\nimport { Sprite } from \"../Sprite\";\nimport { registry } from \"../Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport * as $path from \"../rendering/Path\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a zoom out button.\r\n *\r\n * @see {@link IZoomOutButtonEvents} for a list of available events\r\n * @see {@link IZoomOutButtonAdapters} for a list of available Adapters\r\n */\n\nvar ZoomOutButton =\n/** @class */\nfunction (_super) {\n __extends(ZoomOutButton, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ZoomOutButton() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"ZoomOutButton\";\n\n _this.padding(9, 9, 9, 9); //this.dx = - 5;\n //this.dy = 5;\n\n\n _this.showSystemTooltip = true;\n var interfaceColors = new InterfaceColorSet();\n var background = _this.background;\n background.cornerRadius(20, 20, 20, 20);\n background.fill = interfaceColors.getFor(\"primaryButton\");\n background.stroke = interfaceColors.getFor(\"primaryButtonStroke\");\n background.strokeOpacity = 0;\n background.states.getKey(\"hover\").properties.fill = interfaceColors.getFor(\"primaryButtonHover\");\n background.states.getKey(\"down\").properties.fill = interfaceColors.getFor(\"primaryButtonActive\"); // Create an icon\n\n var icon = new Sprite();\n icon.element = _this.paper.add(\"path\");\n var path = $path.moveTo({\n x: 0,\n y: 0\n });\n path += $path.lineTo({\n x: 11,\n y: 0\n });\n icon.path = path;\n icon.pixelPerfect = true;\n icon.padding(8, 3, 8, 3);\n icon.stroke = interfaceColors.getFor(\"primaryButtonText\");\n _this.icon = icon; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n ZoomOutButton.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this);\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Zoom Out\");\n }\n };\n\n return ZoomOutButton;\n}(Button);\n\nexport { ZoomOutButton };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ZoomOutButton\"] = ZoomOutButton;","/**\r\n * Play button functionality.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Button } from \"./Button\";\nimport { RoundedRectangle } from \"./RoundedRectangle\";\nimport { registry } from \"../Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { Triangle } from \"./Triangle\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a zoom out button.\r\n *\r\n * @see {@link IPlayButtonEvents} for a list of available events\r\n * @see {@link IPlayButtonAdapters} for a list of available Adapters\r\n */\n\nvar PlayButton =\n/** @class */\nfunction (_super) {\n __extends(PlayButton, _super);\n /**\r\n * Constructor\r\n */\n\n\n function PlayButton() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"PlayButton\";\n\n _this.padding(12, 12, 12, 12);\n\n _this.showSystemTooltip = true;\n var interfaceColors = new InterfaceColorSet();\n var background = _this.background;\n background.cornerRadius(25, 25, 25, 25);\n background.fill = interfaceColors.getFor(\"primaryButton\");\n background.stroke = interfaceColors.getFor(\"primaryButtonStroke\");\n background.strokeOpacity = 0;\n background.states.getKey(\"hover\").properties.fill = interfaceColors.getFor(\"primaryButtonHover\");\n background.states.getKey(\"down\").properties.fill = interfaceColors.getFor(\"primaryButtonActive\"); // Create a play icon\n\n var playIcon = new Triangle();\n playIcon.direction = \"right\";\n playIcon.width = 9;\n playIcon.height = 11;\n playIcon.marginLeft = 1;\n playIcon.marginRight = 1;\n playIcon.horizontalCenter = \"middle\";\n playIcon.verticalCenter = \"middle\";\n playIcon.stroke = interfaceColors.getFor(\"primaryButtonText\");\n playIcon.fill = playIcon.stroke;\n _this.icon = playIcon; // Create a play icon\n\n var stopIcon = new RoundedRectangle();\n stopIcon.width = 11;\n stopIcon.height = 11;\n stopIcon.horizontalCenter = \"middle\";\n stopIcon.verticalCenter = \"middle\";\n stopIcon.cornerRadius(0, 0, 0, 0);\n stopIcon.stroke = interfaceColors.getFor(\"primaryButtonText\");\n stopIcon.fill = playIcon.stroke;\n _this.togglable = true;\n\n var activeState = _this.states.create(\"active\");\n\n activeState.transitionDuration = 0;\n activeState.properties.icon = stopIcon;\n _this.defaultState.transitionDuration = 0; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n PlayButton.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this);\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Play\");\n }\n };\n\n return PlayButton;\n}(Button);\n\nexport { PlayButton };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"PlayButton\"] = PlayButton;","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { BaseObject } from \"../../Base\";\nimport { registry } from \"../../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for color modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\nvar ColorModifier =\n/** @class */\nfunction (_super) {\n __extends(ColorModifier, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ColorModifier() {\n var _this = _super.call(this) || this;\n\n _this.className = \"ColorModifier\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Modifies color value.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Original color\r\n * @return Modified\r\n */\n\n\n ColorModifier.prototype.modify = function (value) {\n return value;\n };\n\n return ColorModifier;\n}(BaseObject);\n\nexport { ColorModifier };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ColorModifier\"] = ColorModifier;","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { ColorModifier } from \"./ColorModifier\";\nimport { registry } from \"../../Registry\";\nimport * as $math from \"../../utils/Math\";\nimport * as $type from \"../../utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This class can be used to modify linear gradient steps, changing visual\r\n * properties like lightness, brightness, opacity of each set.\r\n *\r\n * It can also set offsets for each gradient step.\r\n *\r\n * E.g. if I want to fill a columns in a column series to be a solid fill from\r\n * top to 80% of height, then gradually fades out, I can use the following\r\n * gradient modifier as a `fillModifier`:\r\n *\r\n * ```TypeScript\r\n * let fillModifier = new am4core.GradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JavaScript\r\n * var fillModifier = new am4core.GradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JSON\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"columns\": {\r\n * \"fillModifier\": {\r\n * \"type\": \"GradientModifier\",\r\n * \"opacities\": [1, 1, 0],\r\n * \"offsets\": [0, 0.8, 1]\r\n * }\r\n * }\r\n * }]\r\n * ```\r\n */\n\nvar GradientModifier =\n/** @class */\nfunction (_super) {\n __extends(GradientModifier, _super);\n /**\r\n * Constructor.\r\n */\n\n\n function GradientModifier() {\n var _this = _super.call(this) || this;\n\n _this.lightnesses = [];\n _this.brightnesses = [];\n _this.opacities = [];\n _this.offsets = [];\n _this.className = \"GradientModifier\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(GradientModifier.prototype, \"lightnesses\", {\n /**\r\n * @return Lightness values\r\n */\n get: function get() {\n return this._lightnesses;\n },\n\n /**\r\n * An array of lightness values for each step.\r\n *\r\n * @param value Lightness values\r\n */\n set: function set(value) {\n this._lightnesses = value;\n this._brightnesses = [];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GradientModifier.prototype, \"brightnesses\", {\n /**\r\n * @return Brightness values\r\n */\n get: function get() {\n return this._brightnesses;\n },\n\n /**\r\n * An array of brightness values for each step.\r\n *\r\n * @param value Brightness values\r\n */\n set: function set(value) {\n this._brightnesses = value;\n this._lightnesses = [];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GradientModifier.prototype, \"opacities\", {\n /**\r\n * @return Opacity values\r\n */\n get: function get() {\n return this._opacities;\n },\n\n /**\r\n * An array of opacity values for each step.\r\n *\r\n * @param value Opacity values\r\n */\n set: function set(value) {\n this._opacities = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GradientModifier.prototype, \"offsets\", {\n /**\r\n * @return Offsets\r\n */\n get: function get() {\n return this._offsets;\n },\n\n /**\r\n * An array of relative position (0-1) for each step.\r\n *\r\n * If not set, all steps will be of equal relative length.\r\n *\r\n * @param value Offsets\r\n */\n set: function set(value) {\n this._offsets = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Modifies the color based on step setting.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Source color\r\n * @return A gradient that matches set modification rules\r\n */\n\n GradientModifier.prototype.modify = function (value) {\n // Clear current gradient\n this.gradient.clear(); // Get step count\n\n var count = 0;\n\n if (this.opacities) {\n count = $math.max(count, this.opacities.length);\n }\n\n if (this.lightnesses) {\n count = $math.max(count, this.lightnesses.length);\n }\n\n if (this.brightnesses) {\n count = $math.max(count, this.brightnesses.length);\n } // Init step values\n\n\n var opacity = 1,\n lightness,\n brightness; // Apply steps\n\n for (var i = 0; i < count; i++) {\n // Take base color\n var color = value; // Check if there are any parameters for this step\n\n if (this.opacities && $type.isNumber(this.opacities[i])) {\n opacity = this.opacities[i];\n }\n\n if (this.lightnesses && $type.isNumber(this.lightnesses[i])) {\n lightness = this.lightnesses[i];\n brightness = undefined;\n }\n\n if (this.brightnesses && $type.isNumber(this.brightnesses[i])) {\n brightness = this.brightnesses[i];\n lightness = undefined;\n } // Check if we need to brighten/lighten color\n\n\n if ($type.isNumber(brightness)) {\n color = value.brighten(this.brightnesses[i]);\n } else if ($type.isNumber(lightness)) {\n color = value.lighten(this.lightnesses[i]);\n } // Get offset (it's OK if it's undefined)\n\n\n var offset = this.offsets[i]; // Apply step\n\n this.gradient.addColor(color, opacity, offset);\n }\n\n return this.gradient;\n };\n\n GradientModifier.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this._offsets = source.offsets;\n this._brightnesses = source.brightnesses;\n this._lightnesses = source.lightnesses;\n this._opacities = source.opacities;\n };\n\n return GradientModifier;\n}(ColorModifier);\n\nexport { GradientModifier };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"GradientModifier\"] = GradientModifier;","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { LinearGradient } from \"./LinearGradient\";\nimport { GradientModifier } from \"./GradientModifier\";\nimport { registry } from \"../../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This class can be used to modify linear gradient steps, changing visual\r\n * properties like lightness, brightness, opacity of each set.\r\n *\r\n * It can also set offsets for each gradient step.\r\n *\r\n * E.g. if I want to fill a columns in a column series to be a solid fill from\r\n * top to 80% of height, then gradually fades out, I can use the following\r\n * gradient modifier as a `fillModifier`:\r\n *\r\n * ```TypeScript\r\n * let fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JavaScript\r\n * var fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JSON\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"columns\": {\r\n * \"fillModifier\": {\r\n * \"type\": \"LinearGradientModifier\",\r\n * \"opacities\": [1, 1, 0],\r\n * \"offsets\": [0, 0.8, 1]\r\n * }\r\n * }\r\n * }]\r\n * ```\r\n */\n\nvar LinearGradientModifier =\n/** @class */\nfunction (_super) {\n __extends(LinearGradientModifier, _super);\n /**\r\n * Constructor.\r\n */\n\n\n function LinearGradientModifier() {\n var _this = _super.call(this) || this;\n\n _this.className = \"LinearGradientModifier\";\n _this.gradient = new LinearGradient();\n\n _this.applyTheme();\n\n return _this;\n }\n\n LinearGradientModifier.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.gradient = source.gradient.clone();\n };\n\n return LinearGradientModifier;\n}(GradientModifier);\n\nexport { LinearGradientModifier };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"LinearGradientModifier\"] = LinearGradientModifier;","/**\r\n * Cone module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../Container\";\nimport { Sprite, visualProperties } from \"../../Sprite\";\nimport { Ellipse } from \"../../elements/Ellipse\";\nimport { LinearGradientModifier } from \"../../rendering/fills/LinearGradientModifier\";\nimport { percent } from \"../../utils/Percent\";\nimport * as $object from \"../../utils/Object\";\nimport * as $path from \"../../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Builds a round cone/cylinder.\r\n *\r\n * @see {@link IConeEvents} for a list of available events\r\n * @see {@link IConeAdapters} for a list of available Adapters\r\n */\n\nvar Cone =\n/** @class */\nfunction (_super) {\n __extends(Cone, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Cone() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Cone\";\n _this.angle = 30;\n _this.radius = percent(100);\n _this.topRadius = percent(100);\n _this.top = _this.createChild(Ellipse);\n _this.top.shouldClone = false;\n _this.bottom = _this.createChild(Ellipse);\n _this.bottom.shouldClone = false;\n _this.body = _this.createChild(Sprite);\n _this.body.shouldClone = false;\n\n _this.body.setElement(_this.paper.add(\"path\"));\n\n _this.layout = \"none\";\n _this.bodyFillModifier = new LinearGradientModifier();\n _this.bodyFillModifier.lightnesses = [0, -0.25, 0];\n _this.body.fillModifier = _this.bodyFillModifier;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Cone.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n $object.copyProperties(this, this.top, visualProperties);\n $object.copyProperties(this, this.bottom, visualProperties);\n $object.copyProperties(this, this.body, visualProperties);\n var w = this.innerWidth;\n var h = this.innerHeight;\n var bottom = this.bottom;\n var top = this.top;\n var angle = this.angle;\n var radiusBase;\n var dx;\n var dy;\n\n if (this.orientation == \"horizontal\") {\n radiusBase = h / 2;\n bottom.y = h / 2;\n top.y = h / 2;\n top.x = w;\n dx = (90 - angle) / 90;\n dy = 0;\n this.bodyFillModifier.gradient.rotation = 90;\n } else {\n dx = 0;\n dy = (90 - angle) / 90;\n radiusBase = w / 2;\n bottom.y = h;\n bottom.x = w / 2;\n top.x = w / 2;\n this.bodyFillModifier.gradient.rotation = 0;\n }\n\n var radius = this.radius.value * radiusBase;\n var topRadius = this.topRadius.value * radiusBase;\n bottom.radius = radius - radius * dx;\n bottom.radiusY = radius - radius * dy;\n top.radius = topRadius - topRadius * dx;\n top.radiusY = topRadius - topRadius * dy;\n var path;\n\n if (this.orientation == \"horizontal\") {\n path = $path.moveTo({\n x: 0,\n y: h / 2 - bottom.radiusY\n }) + $path.arcTo(-90, -180, bottom.radius, bottom.radiusY) + $path.lineTo({\n x: w,\n y: h / 2 + top.radiusY\n }) + $path.arcTo(90, 180, top.radius, top.radiusY) + $path.closePath();\n } else {\n path = $path.moveTo({\n x: w / 2 - top.radius,\n y: 0\n }) + $path.arcTo(180, -180, top.radius, top.radiusY) + $path.lineTo({\n x: w / 2 + bottom.radius,\n y: h\n }) + $path.arcTo(0, 180, bottom.radius, bottom.radiusY) + $path.closePath();\n }\n\n this.body.path = path;\n };\n\n Object.defineProperty(Cone.prototype, \"angle\", {\n /**\r\n * @return Angle\r\n */\n get: function get() {\n return this.getPropertyValue(\"angle\");\n },\n\n /**\r\n * Angle of the point of view to the 3D element. (0-360)\r\n *\r\n * @default 30\r\n * @param value Angle\r\n */\n set: function set(value) {\n this.setPropertyValue(\"angle\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Cone.prototype, \"radius\", {\n /**\r\n * @return Bottom radius\r\n */\n get: function get() {\n return this.getPropertyValue(\"radius\");\n },\n\n /**\r\n * A relative radius of the cone's bottom (base).\r\n *\r\n * It is relevant to the inner width or height of the element.\r\n *\r\n * @default Percent(100)\r\n * @param value Bottom radius\r\n */\n set: function set(value) {\n this.setPropertyValue(\"radius\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Cone.prototype, \"topRadius\", {\n /**\r\n * @return Top radius\r\n */\n get: function get() {\n return this.getPropertyValue(\"topRadius\");\n },\n\n /**\r\n * A relative radius of the cone's top (tip).\r\n *\r\n * It is relevant to the inner width or height of the element.\r\n *\r\n * @default Percent(0)\r\n * @param value Top radius\r\n */\n set: function set(value) {\n this.setPropertyValue(\"topRadius\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Cone.prototype, \"orientation\", {\n /**\r\n * Orientation\r\n */\n get: function get() {\n return this.getPropertyValue(\"orientation\");\n },\n\n /**\r\n * Orientation of the cone\r\n *\r\n * @default \"vertical\"\r\n * @param value Orientation\r\n */\n set: function set(value) {\n this.setPropertyValue(\"orientation\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return Cone;\n}(Container);\n\nexport { Cone };","/**\r\n * Module for \"Lighten\" filter.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Filter } from \"./Filter\";\nimport { registry } from \"../../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a \"Lighten\" filter.\r\n */\n\nvar LightenFilter =\n/** @class */\nfunction (_super) {\n __extends(LightenFilter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function LightenFilter() {\n var _this = _super.call(this) || this;\n\n _this.className = \"LightenFilter\"; // Create elements\n // NOTE: we do not need to add each individual element to `_disposers`\n // because `filterPrimitives` has an event handler which automatically adds\n // anything added to it to `_disposers`\n\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\n\n _this.feColorMatrix.attr({\n \"type\": \"matrix\"\n });\n\n _this.filterPrimitives.push(_this.feColorMatrix); // Set default properties\n\n\n _this.lightness = 0;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(LightenFilter.prototype, \"lightness\", {\n /**\r\n * @return Lightness\r\n */\n get: function get() {\n return this.properties[\"lightness\"];\n },\n\n /**\r\n * Lightness of the target colors.\r\n *\r\n * If `lightness` is a positive number, the filter will make all colors\r\n * lighter.\r\n *\r\n * If `lightness` is negative, colors will be darkened.\r\n *\r\n * @param value Lightness\r\n */\n set: function set(value) {\n this.properties[\"lightness\"] = value;\n var v = value + 1;\n this.feColorMatrix.attr({\n \"values\": v + \" 0 0 0 0 0 \" + v + \" 0 0 0 0 0 \" + v + \" 0 0 0 0 0 1 0\"\n });\n },\n enumerable: true,\n configurable: true\n });\n return LightenFilter;\n}(Filter);\n\nexport { LightenFilter };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"LightenFilter\"] = LightenFilter;","/**\r\n * Creates a 3D rectangle.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../Container\";\nimport { Sprite } from \"../../Sprite\";\nimport * as $math from \"../../utils/Math\";\nimport * as $path from \"../../rendering/Path\";\nimport { Color, color, toColor } from \"../../utils/Color\";\nimport { RadialGradient } from \"../../rendering/fills/RadialGradient\";\nimport { LinearGradient } from \"../../rendering/fills/LinearGradient\";\nimport { LightenFilter } from \"../../rendering/filters/LightenFilter\";\nimport * as $type from \"../../utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Builds a 3D rectangle\r\n * @see {@link IRectangle3DEvents} for a list of available events\r\n * @see {@link IRectangle3DAdapters} for a list of available Adapters\r\n */\n\nvar Rectangle3D =\n/** @class */\nfunction (_super) {\n __extends(Rectangle3D, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Rectangle3D() {\n var _this = _super.call(this) || this;\n\n _this.angle = 30;\n _this.depth = 30;\n _this.className = \"Rectangle3D\";\n _this.layout = \"none\";\n\n var sideBack = _this.createChild(Sprite);\n\n sideBack.shouldClone = false;\n sideBack.setElement(_this.paper.add(\"path\"));\n sideBack.isMeasured = false;\n _this.sideBack = sideBack;\n\n _this._disposers.push(_this.sideBack);\n\n var sideBottom = _this.createChild(Sprite);\n\n sideBottom.shouldClone = false;\n sideBottom.setElement(_this.paper.add(\"path\"));\n sideBottom.isMeasured = false;\n _this.sideBottom = sideBottom;\n\n _this._disposers.push(_this.sideBottom);\n\n var sideLeft = _this.createChild(Sprite);\n\n sideLeft.shouldClone = false;\n sideLeft.setElement(_this.paper.add(\"path\"));\n sideLeft.isMeasured = false;\n _this.sideLeft = sideLeft;\n\n _this._disposers.push(_this.sideLeft);\n\n var sideRight = _this.createChild(Sprite);\n\n sideRight.shouldClone = false;\n sideRight.setElement(_this.paper.add(\"path\"));\n sideRight.isMeasured = false;\n _this.sideRight = sideRight;\n\n _this._disposers.push(_this.sideRight);\n\n var sideTop = _this.createChild(Sprite);\n\n sideTop.shouldClone = false;\n sideTop.setElement(_this.paper.add(\"path\"));\n sideTop.isMeasured = false;\n _this.sideTop = sideTop;\n\n _this._disposers.push(_this.sideTop);\n\n var sideFront = _this.createChild(Sprite);\n\n sideFront.shouldClone = false;\n sideFront.setElement(_this.paper.add(\"path\"));\n sideFront.isMeasured = false;\n _this.sideFront = sideFront;\n\n _this._disposers.push(_this.sideFront);\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Rectangle3D.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n var w = this.innerWidth;\n var h = this.innerHeight;\n var depth = this.depth;\n var angle = this.angle;\n var sin = $math.sin(angle);\n var cos = $math.cos(angle);\n var a = {\n x: 0,\n y: 0\n };\n var b = {\n x: w,\n y: 0\n };\n var c = {\n x: w,\n y: h\n };\n var d = {\n x: 0,\n y: h\n };\n var ah = {\n x: depth * cos,\n y: -depth * sin\n };\n var bh = {\n x: depth * cos + w,\n y: -depth * sin\n };\n var ch = {\n x: depth * cos + w,\n y: -depth * sin + h\n };\n var dh = {\n x: depth * cos,\n y: -depth * sin + h\n };\n this.sideFront.path = $path.moveTo(a) + $path.lineTo(b) + $path.lineTo(c) + $path.lineTo(d) + $path.closePath();\n this.sideBack.path = $path.moveTo(ah) + $path.lineTo(bh) + $path.lineTo(ch) + $path.lineTo(dh) + $path.closePath();\n this.sideLeft.path = $path.moveTo(a) + $path.lineTo(ah) + $path.lineTo(dh) + $path.lineTo(d) + $path.closePath();\n this.sideRight.path = $path.moveTo(b) + $path.lineTo(bh) + $path.lineTo(ch) + $path.lineTo(c) + $path.closePath();\n this.sideBottom.path = $path.moveTo(d) + $path.lineTo(dh) + $path.lineTo(ch) + $path.lineTo(c) + $path.closePath();\n this.sideTop.path = $path.moveTo(a) + $path.lineTo(ah) + $path.lineTo(bh) + $path.lineTo(b) + $path.closePath();\n };\n\n Object.defineProperty(Rectangle3D.prototype, \"depth\", {\n /**\r\n * @return Depth (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"depth\");\n },\n\n /**\r\n * Depth (Z dimension) of the 3D rectangle in pixels.\r\n *\r\n * @default 30\r\n * @param value Depth (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"depth\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rectangle3D.prototype, \"angle\", {\n /**\r\n * @return Angle\r\n */\n get: function get() {\n return this.getPropertyValue(\"angle\");\n },\n\n /**\r\n * Angle of the point of view to the 3D element. (0-360)\r\n *\r\n * @default 30\r\n * @param value Angle\r\n */\n set: function set(value) {\n this.setPropertyValue(\"angle\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Sets actual `fill` property on the SVG element, including applicable color\r\n * modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Fill\r\n */\n\n Rectangle3D.prototype.setFill = function (value) {\n _super.prototype.setFill.call(this, value);\n\n if (!$type.isObject(value) || \"r\" in value) {\n value = toColor(value);\n }\n\n var colorStr;\n\n if (value instanceof Color) {\n colorStr = value.hex;\n } else if (value instanceof LinearGradient || value instanceof RadialGradient) {\n colorStr = value.stops.getIndex(0).color.hex;\n } else {\n var filter = new LightenFilter();\n filter.lightness = -0.2;\n this.sideBack.filters.push(filter);\n var filter2 = filter.clone();\n filter2.lightness = -0.4;\n this.sideLeft.filters.push(filter2);\n var filter3 = filter.clone();\n filter3.lightness = -0.2;\n this.sideRight.filters.push(filter3);\n var filter4 = filter.clone();\n filter4.lightness = -0.1;\n this.sideTop.filters.push(filter4);\n var filter5 = filter.clone();\n filter5.lightness = -0.5;\n this.sideBottom.filters.push(filter5);\n }\n\n if (colorStr) {\n this.sideBack.fill = color(colorStr).lighten(-0.2);\n this.sideLeft.fill = color(colorStr).lighten(-0.4);\n this.sideRight.fill = color(colorStr).lighten(-0.2);\n this.sideTop.fill = color(colorStr).lighten(-0.1);\n this.sideBottom.fill = color(colorStr).lighten(-0.5);\n }\n };\n /**\r\n * Copies all properties and related data from a different instance of Rectangle3D.\r\n *\r\n * @param source Source Rectangle3D\r\n */\n\n\n Rectangle3D.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.sideBack.copyFrom(source.sideBack);\n this.sideLeft.copyFrom(source.sideLeft);\n this.sideRight.copyFrom(source.sideRight);\n this.sideTop.copyFrom(source.sideTop);\n this.sideBottom.copyFrom(source.sideBottom);\n };\n\n return Rectangle3D;\n}(Container);\n\nexport { Rectangle3D };","/**\r\n * 3D slice module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Slice } from \"../Slice\";\nimport { Sprite } from \"../../Sprite\";\nimport * as $math from \"../../utils/Math\";\nimport * as $path from \"../../rendering/Path\";\nimport * as $type from \"../../utils/Type\";\nimport { Color, color } from \"../../utils/Color\";\nimport { RadialGradient } from \"../../rendering/fills/RadialGradient\";\nimport { LinearGradient } from \"../../rendering/fills/LinearGradient\";\nimport { LightenFilter } from \"../../rendering/filters/LightenFilter\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a 3D slice of a Pie chart.\r\n *\r\n * @see {@link ISlice3DEvents} for a list of available events\r\n * @see {@link ISlice3DAdapters} for a list of available Adapters\r\n */\n\nvar Slice3D =\n/** @class */\nfunction (_super) {\n __extends(Slice3D, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Slice3D() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"Slice3D\";\n _this.layout = \"none\"; // Create edge container\n\n var edge = _this.createChild(Sprite);\n\n _this.edge = edge;\n edge.shouldClone = false;\n edge.isMeasured = false;\n edge.toBack(); // Set defaults\n\n _this.angle = 30;\n _this.depth = 20; // Create side A element\n\n var sideA = _this.createChild(Sprite);\n\n _this.sideA = sideA;\n sideA.shouldClone = false;\n sideA.isMeasured = false; //sideA.setElement(this.paper.add(\"path\"));\n //sideA.strokeOpacity = 0;\n // Crate side B element\n\n var sideB = _this.createChild(Sprite);\n\n _this.sideB = sideB;\n sideB.shouldClone = false;\n sideB.isMeasured = false; //sideB.setElement(this.paper.add(\"path\"));\n //sideB.strokeOpacity = 0;\n // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Sets actual `fill` property on the SVG element, including applicable color\r\n * modifiers.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Fill\r\n */\n\n\n Slice3D.prototype.setFill = function (value) {\n _super.prototype.setFill.call(this, value);\n\n var colorStr;\n\n if (value instanceof Color) {\n colorStr = value.hex;\n } else if (value instanceof LinearGradient || value instanceof RadialGradient) {\n colorStr = value.stops.getIndex(0).color.hex;\n } else {\n var filter = new LightenFilter();\n filter.lightness = -0.25;\n this.edge.filters.push(filter);\n this.sideA.filters.push(filter.clone());\n this.sideB.filters.push(filter.clone());\n }\n\n if (colorStr) {\n var edgeFill = color(colorStr).lighten(-0.25);\n this.edge.fill = edgeFill;\n this.sideA.fill = edgeFill;\n this.sideB.fill = edgeFill;\n this.edge.stroke = edgeFill;\n this.sideA.stroke = edgeFill;\n this.sideB.stroke = edgeFill;\n }\n };\n /**\r\n * Draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Slice3D.prototype.draw = function () {\n this.cornerRadius = 0;\n this.innerCornerRadius = 0;\n\n _super.prototype.draw.call(this);\n\n if (this.arc !== 0 && this.radius > 0 && this.depth > 0) {\n this.sideB.show(0);\n this.sideA.show(0);\n this.edge.show(0);\n var startAngle = this.startAngle;\n var arc = this.arc;\n var innerRadius = this.pixelInnerRadius || 0;\n var radiusY = this.radiusY || 0; //let cornerRadius = this.cornerRadius || 0;\n //let innerCornerRadius = this.innerCornerRadius;\n\n var radius = this.radius; // this is code duplicate with $path.arc. @todo to think how to avoid it\n\n var endAngle = startAngle + arc; //let crSin = $math.sin($math.min(arc, 45) / 2);\n //innerCornerRadius = innerCornerRadius || cornerRadius;\n\n var innerRadiusY = radiusY / radius * innerRadius; //let cornerRadiusY = (radiusY / radius) * cornerRadius;\n //let innerCornerRadiusY = (radiusY / radius) * innerCornerRadius;\n //cornerRadius = $math.fitToRange(cornerRadius, 0, (radius - innerRadius) / 2);\n //cornerRadiusY = $math.fitToRange(cornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\n //innerCornerRadius = $math.fitToRange(innerCornerRadius, 0, (radius - innerRadius) / 2);\n //innerCornerRadiusY = $math.fitToRange(innerCornerRadiusY, 0, (radiusY - innerRadiusY) / 2);\n //cornerRadius = $math.fitToRange(cornerRadius, 0, radius * crSin);\n //cornerRadiusY = $math.fitToRange(cornerRadiusY, 0, radiusY * crSin);\n //innerCornerRadius = $math.fitToRange(innerCornerRadius, 0, innerRadius * crSin);\n //innerCornerRadiusY = $math.fitToRange(innerCornerRadiusY, 0, innerRadiusY * crSin);\n //let crAngle: number = Math.asin(cornerRadius / radius / 2) * $math.DEGREES * 2;\n //let crAngleY: number = Math.asin(cornerRadiusY / radiusY / 2) * $math.DEGREES * 2;\n //if (innerRadius < innerCornerRadius) {\n //\tinnerRadius = innerCornerRadius;\n //}\n //if (innerRadiusY < innerCornerRadiusY) {\n //\tinnerRadiusY = innerCornerRadiusY;\n //}\n //let crInnerAngle: number = Math.asin(innerCornerRadius / innerRadius / 2) * $math.DEGREES * 2;\n //let crInnerAngleY: number = Math.asin(innerCornerRadiusY / innerRadiusY / 2) * $math.DEGREES * 2;\n //if (!$type.isNumber(crInnerAngle)) {\n //\tcrInnerAngle = 0;\n //}\n //if (!$type.isNumber(crInnerAngleY)) {\n //\tcrInnerAngleY = 0;\n //}\n //let middleAngle = startAngle + arc / 2;\n //let mPoint = { x: $math.round($math.cos(middleAngle) * innerRadius, 4), y: $math.round($math.sin(middleAngle) * innerRadiusY, 4) };\n\n var a0 = {\n x: $math.cos(startAngle) * innerRadius,\n y: $math.sin(startAngle) * innerRadiusY\n };\n var b0 = {\n x: $math.cos(startAngle) * radius,\n y: $math.sin(startAngle) * radiusY\n };\n var c0 = {\n x: $math.cos(endAngle) * radius,\n y: $math.sin(endAngle) * radiusY\n };\n var d0 = {\n x: $math.cos(endAngle) * innerRadius,\n y: $math.sin(endAngle) * innerRadiusY\n }; // end of duplicate\n\n var h = this.depth;\n var ah = {\n x: a0.x,\n y: a0.y - h\n };\n var bh = {\n x: b0.x,\n y: b0.y - h\n };\n var ch = {\n x: c0.x,\n y: c0.y - h\n };\n var dh = {\n x: d0.x,\n y: d0.y - h\n };\n var edgePath = \"\";\n var count = Math.ceil(arc / 5);\n var step = arc / count;\n var mangle = startAngle;\n var prevPoint = bh;\n\n for (var i = 0; i < count; i++) {\n mangle += step;\n\n if (mangle > 0 && mangle < 180) {\n edgePath += $path.moveTo(prevPoint);\n var pp = {\n x: $math.cos(mangle) * radius,\n y: $math.sin(mangle) * radiusY - h\n };\n edgePath += $path.lineTo({\n x: prevPoint.x,\n y: prevPoint.y + h\n });\n edgePath += $path.arcToPoint({\n x: pp.x,\n y: pp.y + h\n }, radius, radiusY, true);\n edgePath += $path.lineTo(pp);\n edgePath += $path.arcToPoint(prevPoint, radius, radiusY);\n edgePath += \"z\";\n prevPoint = pp;\n } else {\n edgePath += $path.moveTo(prevPoint);\n var pp = {\n x: $math.cos(mangle) * radius,\n y: $math.sin(mangle) * radiusY - h\n };\n edgePath += $path.arcToPoint(pp, radius, radiusY, true);\n edgePath += $path.lineTo({\n x: pp.x,\n y: pp.y + h\n });\n edgePath += $path.arcToPoint({\n x: prevPoint.x,\n y: prevPoint.y + h\n }, radius, radiusY);\n edgePath += $path.lineTo(prevPoint);\n edgePath += \"z\";\n prevPoint = pp;\n }\n }\n\n prevPoint = ah;\n mangle = startAngle;\n\n for (var i = 0; i < count; i++) {\n mangle += step;\n\n if (mangle > 0 && mangle < 180) {\n edgePath += $path.moveTo(prevPoint);\n var pp = {\n x: $math.cos(mangle) * innerRadius,\n y: $math.sin(mangle) * innerRadiusY - h\n };\n edgePath += $path.lineTo({\n x: prevPoint.x,\n y: prevPoint.y + h\n });\n edgePath += $path.arcToPoint({\n x: pp.x,\n y: pp.y + h\n }, innerRadius, innerRadiusY, true);\n edgePath += $path.lineTo(pp);\n edgePath += $path.arcToPoint(prevPoint, innerRadius, innerRadiusY);\n edgePath += \"z\";\n prevPoint = pp;\n } else {\n edgePath += $path.moveTo(prevPoint);\n var pp = {\n x: $math.cos(mangle) * innerRadius,\n y: $math.sin(mangle) * innerRadiusY - h\n };\n edgePath += $path.arcToPoint(pp, innerRadius, innerRadiusY, true);\n edgePath += $path.lineTo({\n x: pp.x,\n y: pp.y + h\n });\n edgePath += $path.arcToPoint({\n x: prevPoint.x,\n y: prevPoint.y + h\n }, innerRadius, innerRadiusY);\n edgePath += $path.lineTo(prevPoint);\n edgePath += \"z\";\n prevPoint = pp;\n }\n }\n\n this.edge.path = edgePath;\n /*\r\n a0 = { x: $math.cos(startAngle) * (innerRadius + innerCornerRadius), y: $math.sin(startAngle) * (innerRadiusY + innerCornerRadiusY) };\r\n b0 = { x: $math.cos(startAngle) * (radius - cornerRadius), y: $math.sin(startAngle) * (radiusY - cornerRadiusY) };\r\n c0 = { x: $math.cos(endAngle) * (radius - cornerRadius), y: $math.sin(endAngle) * (radiusY - cornerRadiusY) };\r\n d0 = { x: $math.cos(endAngle) * (innerRadius + innerCornerRadius), y: $math.sin(endAngle) * (innerRadiusY + innerCornerRadiusY) };\r\n // end of duplicate\r\n \r\n ah = { x: a0.x, y: a0.y - h };\r\n bh = { x: b0.x, y: b0.y - h };\r\n ch = { x: c0.x, y: c0.y - h };\r\n dh = { x: d0.x, y: d0.y - h };\r\n */\n\n this.sideA.path = $path.moveTo(a0) + $path.lineTo(b0) + $path.lineTo(bh) + $path.lineTo(ah) + $path.closePath();\n this.sideB.path = $path.moveTo(c0) + $path.lineTo(d0) + $path.lineTo(dh) + $path.lineTo(ch) + $path.closePath();\n\n if (this.startAngle < 90) {\n this.sideA.toBack();\n } else {\n this.sideA.toFront();\n }\n\n if (this.startAngle + this.arc > 90) {\n this.sideB.toBack();\n } else {\n this.sideB.toFront();\n }\n\n this.slice.dy = -h;\n } else {\n this.sideA.hide(0);\n this.sideB.hide(0);\n this.edge.hide(0);\n }\n };\n\n Object.defineProperty(Slice3D.prototype, \"depth\", {\n /**\r\n * @return Depth (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"depth\");\n },\n\n /**\r\n * Depth (height) of the 3D slice in pixels.\r\n *\r\n * @default 20\r\n * @param depth Depth (px)\r\n */\n set: function set(depth) {\n this.setPropertyValue(\"depth\", depth, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice3D.prototype, \"angle\", {\n /**\r\n * @return Angle\r\n */\n get: function get() {\n var angle = this.getPropertyValue(\"angle\");\n\n if (!$type.isNumber(angle)) {\n angle = 0;\n }\n\n return angle;\n },\n\n /**\r\n * Angle of the point of view to the 3D element. (0-360)\r\n *\r\n * @default 30\r\n * @param value Angle\r\n */\n set: function set(value) {\n this.setPropertyValue(\"angle\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Slice3D.prototype, \"radiusY\", {\n /**\r\n * @return Vertical radius (0-1)\r\n */\n get: function get() {\n var radiusY = this.getPropertyValue(\"radiusY\");\n\n if (!$type.isNumber(radiusY)) {\n radiusY = this.radius - this.radius * this.angle / 90;\n }\n\n return radiusY;\n },\n\n /**\r\n * Vertical radius for creating skewed slices.\r\n *\r\n * This is relevant to `radius`, e.g. 0.5 will set vertical radius to half\r\n * the `radius`.\r\n *\r\n * @param value Vertical radius (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"radiusY\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\n\n Slice3D.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.edge.copyFrom(source.edge);\n this.sideA.copyFrom(source.sideA);\n this.sideB.copyFrom(source.sideB);\n };\n\n return Slice3D;\n}(Slice);\n\nexport { Slice3D };","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { RadialGradient } from \"./RadialGradient\";\nimport { GradientModifier } from \"./GradientModifier\";\nimport { registry } from \"../../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This class can be used to modify radial gradient steps, changing visual\r\n * properties like lightness, brightness, opacity of each set.\r\n *\r\n * It can also set offsets for each gradient step.\r\n *\r\n * E.g. if I want to fill a columns in a column series to be a solid fill from\r\n * top to 80% of height, then gradually fades out, I can use the following\r\n * gradient modifier as a `fillModifier`:\r\n *\r\n * ```TypeScript\r\n * let fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JavaScript\r\n * var fillModifier = new am4core.LinearGradientModifier();\r\n * fillModifier.opacities = [1, 1, 0];\r\n * fillModifier.offsets = [0, 0.8, 1];\r\n * columnSeries.columns.template.fillModifier = fillModifier;\r\n * ```\r\n * ```JSON\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"columns\": {\r\n * \"fillModifier\": {\r\n * \"type\": \"LinearGradientModifier\",\r\n * \"opacities\": [1, 1, 0],\r\n * \"offsets\": [0, 0.8, 1]\r\n * }\r\n * }\r\n * }]\r\n * ```\r\n */\n\nvar RadialGradientModifier =\n/** @class */\nfunction (_super) {\n __extends(RadialGradientModifier, _super);\n /**\r\n * Constructor.\r\n */\n\n\n function RadialGradientModifier() {\n var _this = _super.call(this) || this;\n\n _this.className = \"RadialGradientModifier\";\n _this.gradient = new RadialGradient();\n\n _this.applyTheme();\n\n return _this;\n }\n\n RadialGradientModifier.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.gradient = source.gradient.clone();\n };\n\n return RadialGradientModifier;\n}(GradientModifier);\n\nexport { RadialGradientModifier };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"RadialGradientModifier\"] = RadialGradientModifier;","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Pattern } from \"./Pattern\";\nimport { registry } from \"../../Registry\";\nimport * as $path from \"../../rendering/Path\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Line pattern.\r\n */\n\nvar LinePattern =\n/** @class */\nfunction (_super) {\n __extends(LinePattern, _super);\n /**\r\n * Constructor\r\n */\n\n\n function LinePattern() {\n var _this = _super.call(this) || this;\n\n _this.properties[\"gap\"] = 0;\n _this._line = _this.paper.add(\"path\");\n\n _this.addElement(_this._line);\n\n return _this;\n }\n /**\r\n * Draws the pattern.\r\n */\n\n\n LinePattern.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (Math.round(this.rotation / 90) != this.rotation / 90) {\n this.properties[\"shapeRendering\"] = \"auto\";\n }\n\n if (this._line) {\n var w = this.width;\n var h = this.height;\n var path = \"\";\n\n if (!this.gap) {\n if (Math.round(this.rotation / 90) != this.rotation / 90) {\n path = $path.moveTo({\n x: -w,\n y: h / 2\n }) + $path.lineTo({\n x: w * 2,\n y: h / 2\n });\n this.properties[\"rotationX\"] = this.width / 2;\n this.properties[\"rotationY\"] = this.height / 2;\n } else {\n path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: w,\n y: 0\n });\n }\n } else {\n var step = this.gap + this.strokeWidth;\n var count = this.height / step;\n\n for (var i = -count / 2; i < count * 1.5; i++) {\n if (Math.round(this.rotation / 90) != this.rotation / 90) {\n path += $path.moveTo({\n x: -w,\n y: (i + 0.5) * step\n }) + $path.lineTo({\n x: w * 2,\n y: (i + 0.5) * step\n });\n this.properties[\"rotationX\"] = this.width / 2;\n this.properties[\"rotationY\"] = this.height / 2;\n } else {\n path += $path.moveTo({\n x: -w,\n y: i * step\n }) + $path.lineTo({\n x: w * 2,\n y: i * step\n });\n }\n }\n }\n\n this._line.attr({\n \"d\": path\n });\n }\n };\n\n Object.defineProperty(LinePattern.prototype, \"gap\", {\n /**\r\n * @return gap\r\n */\n get: function get() {\n return this.properties[\"gap\"];\n },\n\n /**\r\n * Number of pixels between pattern lines.\r\n *\r\n * The pattern will automatically draw required number of lines to fill\r\n * pattern area maintaining `gap` distance between them.\r\n *\r\n * 0 (zero) means only single line will be drawn.\r\n *\r\n * @default 0\r\n * @since 4.7.7\r\n */\n set: function set(value) {\n this.properties[\"gap\"] = value;\n this.draw();\n },\n enumerable: true,\n configurable: true\n });\n return LinePattern;\n}(Pattern);\n\nexport { LinePattern };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"LinePattern\"] = LinePattern;","/**\r\n * Rectangular pattern module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Pattern } from \"./Pattern\";\nimport { registry } from \"../../Registry\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Circular pattern\r\n */\n\nvar CirclePattern =\n/** @class */\nfunction (_super) {\n __extends(CirclePattern, _super);\n /**\r\n * Constructor\r\n */\n\n\n function CirclePattern() {\n var _this = _super.call(this) || this;\n\n _this.properties[\"radius\"] = 2;\n _this._circle = _this.paper.add(\"circle\");\n\n _this.addElement(_this._circle);\n\n _this.shapeRendering = \"auto\";\n return _this;\n }\n /**\r\n * Draws the circle element.\r\n */\n\n\n CirclePattern.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (this._circle) {\n this._circle.attr({\n \"r\": this.radius,\n \"cx\": this.width / 2,\n \"cy\": this.height / 2\n });\n }\n };\n\n Object.defineProperty(CirclePattern.prototype, \"radius\", {\n /**\r\n * @return Radius (px)\r\n */\n get: function get() {\n return this.properties[\"radius\"];\n },\n\n /**\r\n * Circle radius in pixels.\r\n *\r\n * @param value Radius (px)\r\n */\n set: function set(value) {\n this.properties[\"radius\"] = value;\n this.draw();\n },\n enumerable: true,\n configurable: true\n });\n return CirclePattern;\n}(Pattern);\n\nexport { CirclePattern };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"CirclePattern\"] = CirclePattern;","/**\r\n * Rectangular pattern module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Pattern } from \"./Pattern\";\nimport { registry } from \"../../Registry\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Rectangular pattern\r\n */\n\nvar RectPattern =\n/** @class */\nfunction (_super) {\n __extends(RectPattern, _super);\n /**\r\n * Constructor\r\n */\n\n\n function RectPattern() {\n var _this = _super.call(this) || this;\n\n _this.rectHeight = 1;\n _this.rectWidth = 1;\n _this._rect = _this.paper.add(\"rect\");\n\n _this.addElement(_this._rect);\n\n return _this;\n }\n /**\r\n * Draws the rectangular element.\r\n */\n\n\n RectPattern.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n this.properties[\"rotationX\"] = this.width / 2;\n this.properties[\"rotationY\"] = this.height / 2;\n\n if (this._rect) {\n this._rect.attr({\n \"width\": this.rectWidth,\n \"height\": this.rectHeight,\n \"x\": (this.width - this.rectWidth) / 2,\n \"y\": (this.height - this.rectHeight) / 2\n });\n }\n };\n\n Object.defineProperty(RectPattern.prototype, \"rectWidth\", {\n /**\r\n * @return Width (px)\r\n */\n get: function get() {\n return this.properties[\"rectWidth\"];\n },\n\n /**\r\n * Rectangle width in pixels.\r\n *\r\n * @param value Width (px)\r\n */\n set: function set(value) {\n this.properties[\"rectWidth\"] = value;\n this.draw();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RectPattern.prototype, \"rectHeight\", {\n /**\r\n * @return Height (px)\r\n */\n get: function get() {\n return this.properties[\"rectHeight\"];\n },\n\n /**\r\n * Rectangle height in pixels.\r\n *\r\n * @param value Height (px)\r\n */\n set: function set(value) {\n this.properties[\"rectHeight\"] = value;\n this.draw();\n },\n enumerable: true,\n configurable: true\n });\n return RectPattern;\n}(Pattern);\n\nexport { RectPattern };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"RectPattern\"] = RectPattern;","/**\r\n * Module for \"Colorize\" filter.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Filter } from \"./Filter\";\nimport { registry } from \"../../Registry\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a \"Colorize\" filter.\r\n */\n\nvar ColorizeFilter =\n/** @class */\nfunction (_super) {\n __extends(ColorizeFilter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ColorizeFilter() {\n var _this = _super.call(this) || this;\n\n _this.className = \"ColorizeFilter\"; // Create elements\n // NOTE: we do not need to add each individual element to `_disposers`\n // because `filterPrimitives` has an event handler which automatically adds\n // anything added to it to `_disposers`\n\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\n\n _this.feColorMatrix.attr({\n \"type\": \"matrix\"\n }); //this.feColorMatrix.setAttribute(\"in\", \"SourceAlpha\");\n\n\n _this.filterPrimitives.push(_this.feColorMatrix); // Set default properties\n\n\n _this.intensity = 1;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * (Re)applies colors to the already existing filter by modifying filyer's\r\n * color matrix element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n ColorizeFilter.prototype.applyFilter = function () {\n var i = this.intensity;\n var ii = 1 - i;\n var r;\n var g;\n var b;\n var color = this.color;\n\n if (color && color.rgb) {\n r = color.rgb.r / 255 * i;\n g = color.rgb.g / 255 * i;\n b = color.rgb.b / 255 * i;\n } else {\n r = 0;\n g = 0;\n b = 0;\n }\n\n this.feColorMatrix.attr({\n \"values\": ii + \" 0 0 0 \" + r + \" 0 \" + ii + \" 0 0 \" + g + \" 0 0 \" + ii + \" 0 \" + b + \" 0 0 0 1 0\"\n });\n };\n\n Object.defineProperty(ColorizeFilter.prototype, \"color\", {\n /**\r\n * @return Color\r\n */\n get: function get() {\n return this.properties[\"color\"];\n },\n\n /**\r\n * Target color to apply to the element.\r\n *\r\n * Depending on the `intensity`, all colors of the target element will steer\r\n * towards this color.\r\n *\r\n * E.g. setting to `am4core.color(\"greener\")` will make all colors greener.\r\n *\r\n * @param value Color\r\n */\n set: function set(value) {\n this.properties[\"color\"] = value;\n this.applyFilter();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ColorizeFilter.prototype, \"intensity\", {\n /**\r\n * @return Intensity (0-1)\r\n */\n get: function get() {\n return this.properties.intensity;\n },\n\n /**\r\n * Intensity of the color (0-1).\r\n *\r\n * The bigger the number the more of a `color` target's colors will become.\r\n *\r\n * 0 means the colors will remain as they are.\r\n * 1 means all colors will become the target `color`.\r\n *\r\n * @default 1\r\n * @param value Intensity (0-1)\r\n */\n set: function set(value) {\n this.properties.intensity = value;\n this.applyFilter();\n },\n enumerable: true,\n configurable: true\n });\n return ColorizeFilter;\n}(Filter);\n\nexport { ColorizeFilter };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ColorizeFilter\"] = ColorizeFilter;","/**\r\n * Module for \"Desaturate\" filter.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Filter } from \"./Filter\";\nimport { registry } from \"../../Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creats a \"Desaturate\" filter\r\n */\n\nvar DesaturateFilter =\n/** @class */\nfunction (_super) {\n __extends(DesaturateFilter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function DesaturateFilter() {\n var _this = _super.call(this) || this;\n\n _this.className = \"DesaturateFilter\"; // Create elements\n // NOTE: we do not need to add each individual element to `_disposers`\n // because `filterPrimitives` has an event handler which automatically adds\n // anything added to it to `_disposers`\n\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\n\n _this.feColorMatrix.attr({\n \"type\": \"saturate\"\n });\n\n _this.filterPrimitives.push(_this.feColorMatrix); // Set default properties\n\n\n _this.width = 120;\n _this.height = 120;\n _this.saturation = 0;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(DesaturateFilter.prototype, \"saturation\", {\n /**\r\n * @return Saturation (0-1)\r\n */\n get: function get() {\n return this.properties[\"saturation\"];\n },\n\n /**\r\n * Saturation.\r\n *\r\n * 0 - completely desaturated.\r\n * 1 - fully saturated (gray).\r\n *\r\n * @param value Saturation (0-1)\r\n */\n set: function set(value) {\n this.properties[\"saturation\"] = value;\n this.feColorMatrix.attr({\n \"values\": value.toString()\n });\n },\n enumerable: true,\n configurable: true\n });\n return DesaturateFilter;\n}(Filter);\n\nexport { DesaturateFilter };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"DesaturateFilter\"] = DesaturateFilter;","/**\r\n * Module for \"Blur\" filter.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Filter } from \"./Filter\";\nimport { registry } from \"../../Registry\";\n;\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a \"Blur\" filter.\r\n */\n\nvar BlurFilter =\n/** @class */\nfunction (_super) {\n __extends(BlurFilter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function BlurFilter() {\n var _this = _super.call(this) || this;\n\n _this.className = \"BlurFilter\"; // Create elements\n // NOTE: we do not need to add each individual element to `_disposers`\n // because `filterPrimitives` has an event handler which automatically adds\n // anything added to it to `_disposers`\n\n _this.feGaussianBlur = _this.paper.add(\"feGaussianBlur\");\n\n _this.feGaussianBlur.attr({\n \"result\": \"blurOut\",\n \"in\": \"SourceGraphic\"\n });\n\n _this.filterPrimitives.push(_this.feGaussianBlur); // Set default properties\n\n\n _this.width = 200;\n _this.height = 200;\n _this.blur = 1.5;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(BlurFilter.prototype, \"blur\", {\n /**\r\n * @return Blur\r\n */\n get: function get() {\n return this.properties.blur;\n },\n\n /**\r\n * Blur value.\r\n *\r\n * The bigger the value, the blurrier the target element will become.\r\n *\r\n * @default 1.5\r\n * @param value Blur\r\n */\n set: function set(value) {\n this.properties.blur = value;\n this.feGaussianBlur.attr({\n \"stdDeviation\": value / this.scale\n });\n },\n enumerable: true,\n configurable: true\n });\n return BlurFilter;\n}(Filter);\n\nexport { BlurFilter };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"BlurFilter\"] = BlurFilter;","/**\r\n * Module for \"Focus\" filter.\r\n */\nimport { __extends } from \"tslib\";\nimport { Filter } from \"./Filter\";\nimport { InterfaceColorSet } from \"../../utils/InterfaceColorSet\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a \"Focus\" filter.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/accessibility/} more about accessibility\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/changing-appearance-of-focused-items/} cusomizing focus appearance\r\n */\n\nvar FocusFilter =\n/** @class */\nfunction (_super) {\n __extends(FocusFilter, _super);\n /**\r\n * Constructor\r\n */\n\n\n function FocusFilter() {\n var _this = _super.call(this) || this;\n\n _this.className = \"FocusFilter\"; // Create elements\n // NOTE: we do not need to add each individual element to `_disposers`\n // because `filterPrimitives` has an event handler which automatically adds\n // anything added to it to `_disposers`\n\n _this.feFlood = _this.paper.add(\"feFlood\");\n\n _this.feFlood.attr({\n \"flood-color\": new InterfaceColorSet().getFor(\"primaryButtonHover\"),\n \"result\": \"base\"\n });\n\n _this.filterPrimitives.push(_this.feFlood);\n\n _this.feMorphology = _this.paper.add(\"feMorphology\");\n\n _this.feMorphology.attr({\n \"result\": \"bigger\",\n \"in\": \"SourceGraphic\",\n \"operator\": \"dilate\",\n \"radius\": \"2\"\n });\n\n _this.filterPrimitives.push(_this.feMorphology);\n\n _this.feColorMatrix = _this.paper.add(\"feColorMatrix\");\n\n _this.feColorMatrix.attr({\n \"result\": \"mask\",\n \"in\": \"bigger\",\n \"type\": \"matrix\",\n \"values\": \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0\"\n });\n\n _this.filterPrimitives.push(_this.feColorMatrix);\n\n _this.feComposite = _this.paper.add(\"feComposite\");\n\n _this.feComposite.attr({\n \"result\": \"drop\",\n \"in\": \"base\",\n \"in2\": \"mask\",\n \"operator\": \"in\"\n });\n\n _this.filterPrimitives.push(_this.feComposite);\n\n _this.feBlend = _this.paper.add(\"feBlend\");\n\n _this.feBlend.attr({\n \"in\": \"SourceGraphic\",\n \"in2\": \"drop\",\n \"mode\": \"normal\"\n });\n\n _this.filterPrimitives.push(_this.feBlend); // Set default properties\n\n\n _this.width = 130;\n _this.height = 130;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(FocusFilter.prototype, \"stroke\", {\n /**\r\n * @return Color\r\n */\n get: function get() {\n return this.properties[\"stroke\"];\n },\n\n /**\r\n * Stroke (outline) color.\r\n *\r\n * @param value Color\r\n */\n set: function set(value) {\n this.properties[\"stroke\"] = value;\n this.feFlood.attr({\n \"flood-color\": value\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusFilter.prototype, \"strokeWidth\", {\n /**\r\n * @return Outline thickness (px)\r\n */\n get: function get() {\n return this.properties[\"strokeWidth\"];\n },\n\n /**\r\n * Stroke (outline) thickness in pixels.\r\n *\r\n * @param value Outline thickness (px)\r\n */\n set: function set(value) {\n this.properties[\"strokeWidth\"] = value;\n this.feMorphology.attr({\n \"radius\": value\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FocusFilter.prototype, \"opacity\", {\n /**\r\n * @return Outline opacity (0-1)\r\n */\n get: function get() {\n return this.properties[\"opacity\"];\n },\n\n /**\r\n * Opacity of the outline. (0-1)\r\n *\r\n * @param value Outline opacity (0-1)\r\n */\n set: function set(value) {\n this.properties[\"opacity\"] = value;\n this.feColorMatrix.attr({\n \"values\": \"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \" + value + \" 0\"\n });\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Sets filter's target element.\r\n *\r\n * In addition it also disables built-in focus outline on element this\r\n * filter is applied to.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Element filter is being attached to\r\n */\n\n FocusFilter.prototype.setSprite = function (value) {\n if (this._sprite && this._sprite != value) {\n this._sprite.group.removeStyle(\"outline\");\n }\n\n value.group.addStyle({\n \"outline\": \"none\"\n });\n\n _super.prototype.setSprite.call(this, value);\n };\n\n return FocusFilter;\n}(Filter);\n\nexport { FocusFilter };","/**\r\n * This module contains ColorSet object definition\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { BaseObject } from \"../Base\";\nimport { Color, color } from \"./Color\";\nimport { registry } from \"../Registry\";\nimport * as $colors from \"./Colors\";\nimport * as $type from \"./Type\";\nimport * as $utils from \"./Utils\";\nimport * as $math from \"./Math\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Represents a set of colors. Can also generate colors according to set rules.\r\n *\r\n * @important\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/colors/} for color-related info\r\n */\n\nvar ColorSet =\n/** @class */\nfunction (_super) {\n __extends(ColorSet, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ColorSet() {\n var _this = _super.call(this) || this;\n /**\r\n * Holds the list of the colors in this set. (preset or auto-generated)\r\n */\n\n\n _this._list = [];\n /**\r\n * Current step in a color generator's cycle.\r\n */\n\n _this._currentStep = 0;\n /**\r\n * If set to non-zero value, the ColorSet will start iterating colors from\r\n * that particular index, not the first color in the list.\r\n */\n\n _this._startIndex = 0;\n /**\r\n * Current pass in the color generator's cycle. Normally a generator would\r\n * cycle through all available hue range, then repeat it, alternating other\r\n * color properties, to generate distinctive colors.\r\n */\n\n _this._currentPass = 0;\n /**\r\n * A base color. If there are no colors pre-set in the color list, ColorSet\r\n * will use this color as a base when generating new ones, applying\r\n * `stepOptions` and `passOptions` to this base color.\r\n */\n\n _this.baseColor = new Color({\n r: 103,\n g: 183,\n b: 220\n });\n /**\r\n * Modifications to apply with each new generated color.\r\n */\n\n _this.stepOptions = {};\n /**\r\n * Modifications to apply on top of `stepOptions` for each \"pass\" of the\r\n * color generation.\r\n *\r\n * A \"pass\" is when ColorSet generates `minColors` number of colors.\r\n */\n\n _this.passOptions = {\n brighten: -0.2\n };\n /**\r\n * An index increment to use when iterating through color list.\r\n *\r\n * Default is 1, which means returning each and every color.\r\n *\r\n * Setting it to a bigger number will make ColorSet `next()` iterator skip\r\n * some colors.\r\n *\r\n * E.g. setting to 2, will return every second color in the list.\r\n *\r\n * This is useful, when the color list has colors that are too close each\r\n * other for contrast.\r\n *\r\n * However, having bigger number will mean that `next()` iterator will go\r\n * through the list quicker, and the generator will kick sooner.\r\n */\n\n _this.step = 1;\n /**\r\n * A number of colors to generate in one \"pass\".\r\n *\r\n * This setting can be automatically overridden, if ColorSet has a list of\r\n * pre-set colors. In such case ColorSet will generate exactly the same\r\n * number of colors with each pass as there were colors in original set.\r\n */\n\n _this.minColors = 20;\n /**\r\n * Do not let the \"lightness\" of generated color to fall below this\r\n * threshold.\r\n */\n\n _this.minLightness = 0.2;\n /**\r\n * Do not let the \"lightness\" of generated color to get above this threshold.\r\n */\n\n _this.maxLightness = 0.9;\n /**\r\n * Randomly shuffle generated colors.\r\n */\n\n _this.shuffle = false;\n /**\r\n * When colors are generated, based on `stepOptions`, each generated color\r\n * gets either lighter or darker.\r\n *\r\n * If this is set to `true`, color generator will switch to opposing spectrum\r\n * when reaching `minLightness` or `maxLightness`.\r\n *\r\n * E.g. if we start off with a red color, then gradually generate lighter\r\n * colors through rose shades, then switch back to dark red and gradually\r\n * increase the lightness of it until it reaches the starting red.\r\n *\r\n * If set to `false` it will stop there and cap lightness at whatever level\r\n * we hit `minLightness` or `maxLightness`, which may result in a number of\r\n * the same colors.\r\n */\n\n _this.wrap = true;\n /**\r\n * Re-use same colors in the pre-set list, when ColorSet runs out of colors,\r\n * rather than start generating new ones.\r\n */\n\n _this.reuse = false;\n /**\r\n * Saturation of colors. This will change saturation of all colors of color\r\n * set.\r\n *\r\n * It is recommended to set this in theme, as changing it at run time won't\r\n * make the items to redraw and change color.\r\n */\n\n _this.saturation = 1;\n _this.className = \"ColorSet\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(ColorSet.prototype, \"list\", {\n /**\r\n * Returns current list of colors.\r\n *\r\n * If there are none, a new list of colors is generated, based on various\r\n * ColorSet settings.\r\n *\r\n * @return Color list\r\n */\n get: function get() {\n if (!this._list) {\n this.generate(this.minColors);\n }\n\n return this._list;\n },\n\n /**\r\n * Sets a list of pre-defined colors to use for the iterator.\r\n *\r\n * @param value Color list\r\n */\n set: function set(value) {\n this._list = value;\n this.reset();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Gets reusable color.\r\n *\r\n * @param index Index of color\r\n * @return Color\r\n */\n\n ColorSet.prototype.getReusableColor = function (index) {\n if (this._list.length == 0) {\n this.generate(1);\n return this.list[0];\n } else {\n var tmpstep = index - Math.floor(index / this._list.length) * this.list.length;\n return this.list[tmpstep];\n }\n };\n /**\r\n * Returns next color in the list using internal iterator counter.\r\n *\r\n * If `step` is set to something other than 1, it may return other color than\r\n * exact next one in the list.\r\n *\r\n * @return Color\r\n */\n\n\n ColorSet.prototype.next = function () {\n var color;\n\n if (this.list.length <= this._currentStep) {\n if (this.reuse) {\n color = this.getReusableColor(this._currentStep);\n } else {\n this.generate($math.max(this.minColors, this._currentStep + 1));\n color = this.list[this._currentStep];\n }\n } else {\n color = this.list[this._currentStep];\n }\n\n this._currentStep += this.step;\n return color.saturate(this.saturation);\n };\n /**\r\n * Returns a color at specific index in the list.\r\n *\r\n * @param i Index\r\n * @return Color\r\n */\n\n\n ColorSet.prototype.getIndex = function (i) {\n var color;\n\n if (this.list.length <= i) {\n if (this.reuse) {\n color = this.getReusableColor(i);\n } else {\n this.generate(this.minColors);\n color = this.getIndex(i);\n }\n } else {\n color = this.list[i];\n }\n\n return color.saturate(this.saturation);\n };\n /**\r\n * Resets internal iterator.\r\n *\r\n * Calling `next()` after this will return the very first color in the color\r\n * list, even if it was already returned before.\r\n */\n\n\n ColorSet.prototype.reset = function () {\n this._currentStep = this._startIndex;\n };\n\n Object.defineProperty(ColorSet.prototype, \"currentStep\", {\n /**\r\n * @return Step\r\n */\n get: function get() {\n return this._currentStep;\n },\n\n /**\r\n * Sets current color iteration. You can use this property to skip some\r\n * colors from iteration. E.g. setting it to `10` will skip first ten\r\n * colors.\r\n *\r\n * Please note that the number is zero-based.\r\n *\r\n * @param value Step\r\n */\n set: function set(value) {\n this._currentStep = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ColorSet.prototype, \"startIndex\", {\n /**\r\n * @return Index\r\n */\n get: function get() {\n return this._startIndex;\n },\n\n /**\r\n * If set to non-zero value, the ColorSet will start iterating colors from\r\n * that particular index, not the first color in the list.\r\n *\r\n * @default 0\r\n * @since 4.4.9\r\n * @param value Index\r\n */\n set: function set(value) {\n this._startIndex = value;\n this.reset();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Generates colors based on the various ColorSet settings.\r\n *\r\n * @param count Number of colors to generate\r\n */\n\n ColorSet.prototype.generate = function (count) {\n // Init\n var curColor = this.currentColor;\n var hsl = $colors.rgbToHsl($type.getValue(curColor.rgb));\n var hueStep = $type.hasValue(this.stepOptions.hue) ? this.stepOptions.hue : 1 / count;\n var mods = {\n brighten: 0,\n lighten: 0,\n hue: hsl.h,\n lightness: hsl.l,\n saturation: hsl.s\n }; // Generate list of hues, and shuffle them\n\n var hues = [];\n var startIndex = this.list.length == 0 ? 0 : 1;\n\n if (this.reuse) {\n for (var i = startIndex; i <= count; i++) {\n hues.push($colors.rgbToHsl($type.getValue(this._list[i].rgb)).h);\n }\n } else {\n for (var i = startIndex; i <= count; i++) {\n var h = hsl.h + hueStep * i;\n\n if (this.wrap && h > 1) {\n h -= 1;\n }\n\n hues.push(h);\n }\n } // Shuffle colors randomly\n\n\n if (this.shuffle) {\n hues.sort(function (a, b) {\n return Math.random() - 0.5;\n });\n } // Generate colors by rotating hue\n\n\n for (var i = 0; i < count; i++) {\n // Update hue\n if (this.reuse) {\n hsl = $colors.rgbToHsl($type.getValue(this._list[i].rgb));\n } else {\n hsl.h = hues.shift();\n } // Apply HSL mods\n\n\n this.applyStepOptions(hsl, mods, i, this._currentPass); // Convert back to Color\n\n var c = color($colors.hslToRgb(hsl)); // Apply regular color mods\n\n var brighten = (this.stepOptions.brighten || 0) * i + (this.passOptions.brighten || 0) * this._currentPass;\n\n if (brighten != 0) {\n if (this.wrap) {\n brighten = $utils.fitNumberRelative(brighten, this.minLightness, this.maxLightness);\n } else {\n brighten = $utils.fitNumber(brighten, this.minLightness, this.maxLightness);\n }\n\n c = c.brighten(brighten);\n }\n\n var lighten = (this.stepOptions.lighten || 0) * i + (this.passOptions.lighten || 0) * this._currentPass;\n\n if (lighten != 0) {\n if (this.wrap) {\n lighten = $utils.fitNumberRelative(lighten, this.minLightness, this.maxLightness);\n } else {\n lighten = $utils.fitNumber(lighten, this.minLightness, this.maxLightness);\n }\n\n c = c.lighten(lighten);\n }\n\n this._list.push(c);\n }\n\n this._currentPass++;\n };\n\n Object.defineProperty(ColorSet.prototype, \"currentColor\", {\n /**\r\n * Returns current last color. It's either the last color in the list of\r\n * colors, or `baseColor` if list is empty.\r\n *\r\n * @return Color\r\n */\n get: function get() {\n if (this._list.length == 0) {\n return this.baseColor.saturate(this.saturation);\n } else {\n return this._list[this._list.length - 1].saturate(this.saturation);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Generates modifiers for color, based on what step and pass.\r\n *\r\n * @param hsl Curren HSL value of the color to modify\r\n * @param base The modifiers that were before modification to use as a base\r\n * @param step Current step\r\n * @param pass Current pass\r\n */\n\n ColorSet.prototype.applyStepOptions = function (hsl, base, step, pass) {\n // Process lightness\n hsl.l = base.lightness + (this.stepOptions.lightness || 0) * step + (this.passOptions.lightness || 0) * pass;\n\n if (this.wrap) {\n if (hsl.l > 1) {\n hsl.l = hsl.l - Math.floor(hsl.l);\n } else if (hsl.l < 0) {\n hsl.l = -(hsl.l - Math.floor(hsl.l));\n }\n\n hsl.l = $utils.fitNumberRelative(hsl.l, this.minLightness, this.maxLightness);\n } else {\n if (hsl.l > 1) {\n hsl.l = 1;\n } else if (hsl.l < 0) {\n hsl.l = 0;\n }\n\n hsl.l = $utils.fitNumber(hsl.l, this.minLightness, this.maxLightness);\n }\n };\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n\n ColorSet.prototype.processConfig = function (config) {\n if (config) {\n // Cast colors\n if ($type.hasValue(config.list) && $type.isArray(config.list)) {\n for (var i = 0, len = config.list.length; i < len; i++) {\n if (!(config.list[i] instanceof Color)) {\n config.list[i] = color(config.list[i]);\n }\n }\n }\n\n if ($type.hasValue(config.baseColor) && !(config.baseColor instanceof Color)) {\n config.baseColor = color(config.baseColor);\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n\n return ColorSet;\n}(BaseObject);\n\nexport { ColorSet };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ColorSet\"] = ColorSet;","/**\r\n * This module contains PatternSet object definition\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { BaseObject } from \"../Base\";\nimport { Color } from \"./Color\";\nimport { InterfaceColorSet } from \"./InterfaceColorSet\";\nimport { LinePattern } from \"../rendering/fills/LinePattern\";\nimport { RectPattern } from \"../rendering/fills/RectPattern\";\nimport { CirclePattern } from \"../rendering/fills/CirclePattern\";\nimport { registry } from \"../Registry\";\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines an interable list of distinctive patterns that can be used in\r\n * conjunction to colors to generate various fill patterns.\r\n *\r\n * @important\r\n * @since 4.7.5\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/colors/} for color-related info\r\n */\n\nvar PatternSet =\n/** @class */\nfunction (_super) {\n __extends(PatternSet, _super);\n /**\r\n * Constructor\r\n */\n\n\n function PatternSet() {\n var _this = _super.call(this) || this;\n /**\r\n * Holds the list of the colors in this set. (preset or auto-generated)\r\n */\n\n\n _this._list = [];\n /**\r\n * Current step.\r\n */\n\n _this._currentStep = 0;\n /**\r\n * If set to non-zero value, the PatternSet will start iterating patterns from\r\n * that particular index, not the first pattern in the list.\r\n */\n\n _this._startIndex = 0;\n /**\r\n * Current pass in cycle. Once all patterns in the list are iterated,\r\n * iteration restarts from beginning and currentPass is incremented.\r\n */\n\n _this._currentPass = 0;\n /**\r\n * A base color. If there are no colors pre-set in the color list, ColorSet\r\n * will use this color as a base when generating new ones, applying\r\n * `stepOptions` and `passOptions` to this base color.\r\n */\n\n _this.baseColor = new Color({\n r: 103,\n g: 183,\n b: 220\n });\n _this.className = \"PatternSet\"; // Set base color to be used for pattern elements\n\n var interfaceColors = new InterfaceColorSet(); // Set default patterns\n\n _this.list = [_this.getLinePattern(1000, 45, 1, 6), _this.getRectPattern(10, 0, 4), _this.getLinePattern(1000, -45, 1, 6), _this.getCirclePattern(11, 2, true), _this.getLinePattern(6, 90, 1), _this.getRectPattern(12, 45, 6, true), _this.getLinePattern(6, 0, 1), _this.getRectPattern(7, 0, 4), _this.getLinePattern(1000, 45, 2, 3, \"4,2\"), _this.getCirclePattern(9, 3, false), _this.getLinePattern(1000, -45, 2, 3, \"4,2\"), _this.getRectPattern(10, 45, Math.sqrt(50)), _this.getLinePattern(1000, -45, 2, 1), _this.getRectPattern(10, 0, 9), _this.getLinePattern(1000, 45, 2, 1), _this.getLinePattern(1000, 0, 3, 1), _this.getRectPattern(10, 45, 10), _this.getLinePattern(1000, 90, 3, 1)];\n _this.baseColor = interfaceColors.getFor(\"stroke\");\n\n _this.applyTheme();\n\n return _this;\n }\n\n PatternSet.prototype.getLinePattern = function (size, rotation, thickness, gap, strokeDashArray) {\n var pattern = new LinePattern();\n pattern.width = size;\n pattern.height = size;\n pattern.stroke = this.baseColor;\n pattern.gap = gap;\n pattern.strokeDasharray = strokeDashArray;\n pattern.strokeWidth = thickness;\n pattern.rotation = rotation;\n return pattern;\n };\n\n PatternSet.prototype.getRectPattern = function (size, rotation, thickness, outline) {\n var pattern = new RectPattern();\n pattern.width = size;\n pattern.height = size;\n pattern.rectWidth = thickness;\n pattern.rectHeight = thickness;\n\n if (outline) {\n pattern.stroke = this.baseColor;\n pattern.strokeWidth = 1;\n pattern.fillOpacity = 0;\n } else {\n pattern.fill = this.baseColor;\n pattern.strokeWidth = 0;\n }\n\n if (rotation != 0) {\n pattern.shapeRendering = \"auto\";\n }\n\n pattern.rotation = rotation;\n return pattern;\n };\n\n PatternSet.prototype.getCirclePattern = function (size, radius, outline) {\n var pattern = new CirclePattern();\n pattern.width = size;\n pattern.height = size;\n pattern.shapeRendering = \"auto\";\n pattern.radius = radius;\n\n if (outline) {\n pattern.stroke = this.baseColor;\n pattern.strokeWidth = 1;\n pattern.fillOpacity = 0;\n } else {\n pattern.fill = this.baseColor;\n pattern.strokeWidth = 0;\n }\n\n return pattern;\n };\n\n Object.defineProperty(PatternSet.prototype, \"list\", {\n /**\r\n * @return Pattern list\r\n */\n get: function get() {\n return this._list;\n },\n\n /**\r\n * List of pre-defined patterns to be used in set.\r\n *\r\n * @param value Pattern list\r\n */\n set: function set(value) {\n this._list = value;\n this.reset();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns the next pattern in list.\r\n *\r\n * @return Pattern\r\n */\n\n PatternSet.prototype.next = function () {\n var pattern = this.getIndex(this.currentStep);\n this._currentStep++;\n return pattern;\n };\n /**\r\n * Returns a color at specific index in the list.\r\n *\r\n * @param i Index\r\n * @return Pattern\r\n */\n\n\n PatternSet.prototype.getIndex = function (i) {\n var pattern;\n\n while (this.list.length <= i) {\n this.generatePatterns();\n }\n\n pattern = this.list[i];\n return pattern.clone();\n };\n /**\r\n * Generates a new set of patterns.\r\n */\n\n\n PatternSet.prototype.generatePatterns = function () {\n var count = this.list.length / (this._currentPass + 1);\n this._currentPass++;\n\n for (var i = 0; i < count; i++) {\n this.list.push(this.list[i].clone());\n }\n };\n /**\r\n * Resets internal iterator.\r\n *\r\n * Calling `next()` after this will return the very first color in the color\r\n * list, even if it was already returned before.\r\n */\n\n\n PatternSet.prototype.reset = function () {\n this._currentStep = this._startIndex;\n };\n\n Object.defineProperty(PatternSet.prototype, \"currentStep\", {\n /**\r\n * @return Step\r\n */\n get: function get() {\n return this._currentStep;\n },\n\n /**\r\n * Sets current color iteration. You can use this property to skip some\r\n * colors from iteration. E.g. setting it to `10` will skip first ten\r\n * colors.\r\n *\r\n * Please note that the number is zero-based.\r\n *\r\n * @param value Step\r\n */\n set: function set(value) {\n this._currentStep = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PatternSet.prototype, \"startIndex\", {\n /**\r\n * @return Index\r\n */\n get: function get() {\n return this._startIndex;\n },\n\n /**\r\n * If set to non-zero value, the ColorSet will start iterating colors from\r\n * that particular index, not the first color in the list.\r\n *\r\n * @default 0\r\n * @param value Index\r\n */\n set: function set(value) {\n this._startIndex = value;\n this.reset();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n PatternSet.prototype.processConfig = function (config) {\n // if (config) {\n // \t// Set up axis ranges\n // \tif ($type.hasValue(config.list) && $type.isArray(config.list)) {\n // \t\tfor (let i = 0, len = config.list.length; i < len; i++) {\n // \t\t\tif (!(config.list[i] instanceof Color)) {\n // \t\t\t\tconfig.list[i] = color(config.list[i]);\n // \t\t\t}\n // \t\t}\n // \t}\n // }\n _super.prototype.processConfig.call(this, config);\n };\n\n return PatternSet;\n}(BaseObject);\n\nexport { PatternSet };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"PatternSet\"] = PatternSet;","/**\r\n * A plugin base class.\r\n */\n\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This is a base class that provides core functionality for plugins.\r\n *\r\n * The easiest way to start off with a new plugin is to extend this class.\r\n *\r\n * It will provide all the mandatory functionality, such as disposers.\r\n *\r\n * @since 4.2.2\r\n */\nvar Plugin =\n/** @class */\nfunction () {\n /**\r\n * Constructor\r\n */\n function Plugin() {\n /**\r\n * Is this object disposed?\r\n */\n this._disposed = false;\n /**\r\n * List of IDisposer which will be disposed when the BaseObject is disposed.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n this._disposers = []; // Nothing to do here\n }\n /**\r\n * Decorates series with required events and adapters used to hijack its\r\n * data.\r\n */\n\n\n Plugin.prototype.init = function () {// Does nothing\n // Override it\n };\n /**\r\n * Returns if this element is already disposed.\r\n *\r\n * @return Is disposed?\r\n */\n\n\n Plugin.prototype.isDisposed = function () {\n return this._disposed;\n };\n /**\r\n * Disposes this object and related stuff.\r\n */\n\n\n Plugin.prototype.dispose = function () {\n if (!this._disposed) {\n this._disposed = true;\n var a = this._disposers;\n this._disposers = null;\n\n while (a.length !== 0) {\n var disposer = a.shift();\n disposer.dispose();\n }\n }\n };\n\n return Plugin;\n}();\n\nexport { Plugin };","/**\r\n * AmChartsLogo module.\r\n *\r\n * AmChartsLogo shows amCharts logo for non-commercial users of a library.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../Container\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { Polyspline } from \"./Polyspline\";\nimport { color } from \"../utils/Color\";\nimport { LinearGradient } from \"../rendering/fills/LinearGradient\";\nimport { DesaturateFilter } from \"../rendering/filters/DesaturateFilter\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A class used to draw and display progress indicator.\r\n *\r\n * @see {@link IAmChartsLogoEvents} for a list of available events\r\n * @see {@link IAmChartsLogoAdapters} for a list of available Adapters\r\n * @ignore Exclude from docs\r\n */\n\nvar AmChartsLogo =\n/** @class */\nfunction (_super) {\n __extends(AmChartsLogo, _super);\n /**\r\n * Constructor\r\n */\n\n\n function AmChartsLogo() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"AmChartsLogo\";\n _this.valign = \"bottom\";\n var d = 0.3;\n _this.opacity = 0.3;\n _this.defaultState.properties.opacity = 0.4;\n _this.url = \"https://www.amcharts.com/\";\n _this.urlTarget = \"_blank\";\n _this.showSystemTooltip = true;\n _this.readerTitle = \"Chart created using amCharts library\";\n _this.width = 220 * d;\n _this.height = 70 * d;\n _this.background.opacity = 0;\n var aColor = color(\"#474758\");\n\n if (new InterfaceColorSet().getFor(\"background\").alternative.hex == \"#ffffff\") {\n aColor = color(\"#ffffff\");\n }\n\n var aGradient = new LinearGradient();\n aGradient.addColor(aColor);\n aGradient.addColor(aColor, 1, 0.75);\n aGradient.addColor(color(\"#3cabff\"), 1, 0.755);\n aGradient.rotation = -10;\n var aStroke = aGradient;\n\n var m = _this.createChild(Polyspline);\n\n m.shouldClone = false;\n m.isMeasured = false;\n m.segments = [[{\n x: 50 * d,\n y: 50 * d\n }, {\n x: 90 * d,\n y: 50 * d\n }, {\n x: 120 * d,\n y: 20 * d\n }, {\n x: 135 * d,\n y: 35 * d\n }, {\n x: 150 * d,\n y: 20 * d\n }, {\n x: 180 * d,\n y: 50 * d\n }, {\n x: 200 * d,\n y: 50 * d\n }]];\n m.strokeWidth = 6 * d;\n m.tensionX = 0.8;\n m.tensionY = 1;\n m.stroke = color(\"#3cabff\");\n\n var a = _this.createChild(Polyspline);\n\n a.shouldClone = false;\n a.isMeasured = false;\n a.segments = [[{\n x: 20 * d,\n y: 50 * d\n }, {\n x: 50 * d,\n y: 50 * d\n }, {\n x: 90 * d,\n y: 12 * d\n }, {\n x: 133 * d,\n y: 50 * d\n }, {\n x: 170 * d,\n y: 50 * d\n }, {\n x: 200 * d,\n y: 50 * d\n }]];\n a.strokeWidth = 6 * d;\n a.tensionX = 0.75;\n a.tensionY = 1;\n a.stroke = aStroke;\n\n _this._disposers.push(a);\n\n var desaturateFilter = new DesaturateFilter();\n\n _this.filters.push(desaturateFilter);\n\n var desaturateFilterHover = new DesaturateFilter();\n desaturateFilterHover.saturation = 1;\n\n var hoverState = _this.states.create(\"hover\");\n\n hoverState.properties.opacity = 1;\n hoverState.filters.push(desaturateFilterHover); // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n return AmChartsLogo;\n}(Container);\n\nexport { AmChartsLogo };","import { __read, __spread } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { system } from \"../System\";\nimport { registry } from \"../Registry\";\nimport { Container } from \"../Container\";\nimport { Component } from \"../Component\";\nimport { Paper } from \"../rendering/Paper\";\nimport { SVGContainer, svgContainers } from \"../rendering/SVGContainer\";\nimport { FocusFilter } from \"../rendering/filters/FocusFilter\";\nimport { Preloader } from \"../elements/Preloader\";\nimport { AmChartsLogo } from \"../elements/AmChartsLogo\";\nimport { Tooltip } from \"../elements/Tooltip\";\nimport { Disposer, MultiDisposer } from \"../utils/Disposer\";\nimport { percent } from \"./Percent\";\nimport { options } from \"../Options\";\nimport * as $array from \"./Array\";\nimport * as $type from \"./Type\";\nimport * as $dom from \"./DOM\";\nimport * as $utils from \"./Utils\";\nimport * as $log from \"./Log\";\n/**\r\n * ============================================================================\r\n * INSTANTIATION FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates all HTML and SVG containers needed for the chart instance, as well\r\n * as the new [[Sprite]] (as specified in `classType` parameter).\r\n *\r\n * @param htmlElement A container to creat elements in\r\n * @param classType A class definition of the new element to create\r\n * @return Newly-created Sprite object\r\n */\n\nfunction createChild(htmlElement, classType) {\n var htmlContainer = $dom.getElement(htmlElement); // If there's no container available yet, we create a fake one\n\n var tmpContainer = false;\n\n if (!htmlContainer) {\n htmlContainer = document.createElement(\"div\");\n htmlContainer.style.width = \"200px\";\n htmlContainer.style.height = \"200px\";\n htmlContainer.style.top = \"0\";\n htmlContainer.style.left = \"0\";\n htmlContainer.style.visibility = \"hidden\";\n htmlContainer.style.position = \"absolute\";\n document.body.appendChild(htmlContainer);\n tmpContainer = true;\n }\n\n if (htmlContainer) {\n htmlContainer.innerHTML = \"\"; //htmlContainer.style.overflow = \"hidden\";\n\n var svgDiv_1 = new SVGContainer(htmlContainer);\n var paper = new Paper(svgDiv_1.SVGContainer, \"svg-\" + (svgContainers.length - 1)); // the approach with masks is chosen because overflow:visible is set on SVG element in order tooltips could go outside\n // svg area - this is often needed when working with small charts.\n // main container which holds content container and tooltips container\n\n var container_1 = new Container();\n container_1.htmlContainer = htmlContainer;\n container_1.svgContainer = svgDiv_1;\n container_1.width = percent(100);\n container_1.height = percent(100);\n container_1.background.fillOpacity = 0;\n container_1.paper = paper;\n paper.append(container_1.group); // Set up moving to proper element container if it's not yet ready at call time\n\n if (tmpContainer) {\n $dom.ready(function () {\n container_1.moveHtmlContainer(htmlElement);\n });\n } // this is set from parent container, but this one doesn't have, so do it manually.\n\n\n container_1.relativeWidth = 1;\n container_1.relativeHeight = 1;\n svgDiv_1.container = container_1; // creating classType instance\n\n var sprite_1 = container_1.createChild(classType);\n sprite_1.topParent = container_1;\n var uid = sprite_1.uid;\n registry.invalidSprites[uid] = [];\n registry.invalidDatas[uid] = [];\n registry.invalidPositions[uid] = [];\n registry.invalidLayouts[uid] = [];\n container_1.baseId = uid;\n sprite_1.isBaseSprite = true;\n sprite_1.focusFilter = new FocusFilter();\n registry.baseSprites.push(sprite_1);\n registry.baseSpritesByUid[uid] = sprite_1;\n sprite_1.maskRectangle = {\n x: 0,\n y: 0,\n width: Math.max(svgDiv_1.width || 0, 0),\n height: Math.max(svgDiv_1.height || 0, 0)\n }; // this solves issues with display:none, as all children are measured as 0x0\n\n container_1.events.on(\"maxsizechanged\", function (event) {\n if (event.previousWidth == 0 || event.previousHeight == 0) {\n container_1.deepInvalidate();\n }\n\n if (sprite_1.maskRectangle) {\n sprite_1.maskRectangle = {\n x: 0,\n y: 0,\n width: Math.max(svgDiv_1.width || 0, 0),\n height: Math.max(svgDiv_1.height || 0, 0)\n };\n }\n });\n var loopTimer_1 = null; // Checks to see whether the chart was properly disposed or not\n\n var loop_1 = function loop_1() {\n if (!sprite_1.isDisposed()) {\n if ($dom.getRoot(sprite_1.dom) == null) {\n if (options.autoDispose) {\n container_1.htmlContainer = undefined;\n svgDiv_1.htmlElement = undefined;\n sprite_1.dispose();\n } else {\n $log.warn(\"Chart was not disposed\", sprite_1.uid);\n }\n\n loopTimer_1 = null;\n } else {\n loopTimer_1 = window.setTimeout(loop_1, 1000);\n }\n } else {\n loopTimer_1 = null;\n }\n };\n\n loop_1();\n sprite_1.addDisposer(new Disposer(function () {\n if (loopTimer_1 !== null) {\n clearTimeout(loopTimer_1);\n }\n\n $array.remove(registry.baseSprites, sprite_1);\n registry.baseSpritesByUid[sprite_1.uid] = undefined;\n })); // TODO figure out a better way of doing this\n\n sprite_1.addDisposer(container_1); // tooltip container\n\n var tooltipContainer_1 = container_1.createChild(Container);\n tooltipContainer_1.topParent = container_1;\n tooltipContainer_1.width = percent(100);\n tooltipContainer_1.height = percent(100);\n tooltipContainer_1.isMeasured = false;\n container_1.tooltipContainer = tooltipContainer_1;\n sprite_1.tooltip = new Tooltip();\n sprite_1.tooltip.hide(0);\n sprite_1.tooltip.setBounds({\n x: 0,\n y: 0,\n width: tooltipContainer_1.maxWidth,\n height: tooltipContainer_1.maxHeight\n });\n tooltipContainer_1.events.on(\"maxsizechanged\", function () {\n $type.getValue(sprite_1.tooltip).setBounds({\n x: 0,\n y: 0,\n width: tooltipContainer_1.maxWidth,\n height: tooltipContainer_1.maxHeight\n });\n }, undefined, false); //@todo: maybe we don't need to create one by default but only on request?\n\n var preloader_1 = new Preloader();\n preloader_1.events.on(\"inited\", function () {\n preloader_1.__disabled = true;\n }, undefined, false);\n container_1.preloader = preloader_1; //if (!options.commercialLicense) {\n\n if (sprite_1 instanceof Container && !sprite_1.hasLicense()) {\n var logo_1 = tooltipContainer_1.createChild(AmChartsLogo);\n tooltipContainer_1.events.on(\"maxsizechanged\", function (ev) {\n if (tooltipContainer_1.maxWidth <= 100 || tooltipContainer_1.maxHeight <= 50) {\n logo_1.hide();\n } else if (logo_1.isHidden || logo_1.isHiding) {\n logo_1.show();\n }\n }, undefined, false);\n sprite_1.logo = logo_1;\n logo_1.align = \"left\";\n logo_1.valign = \"bottom\";\n }\n\n $utils.used(sprite_1.numberFormatter); // need to create one.\n // Set this as an autonomouse instance\n // Controls like Preloader, Export will use this.\n\n container_1.isStandaloneInstance = true;\n\n if (options.onlyShowOnViewport) {\n if (!$dom.isElementInViewport(htmlContainer, options.viewportTarget)) {\n sprite_1.__disabled = true;\n sprite_1.tooltipContainer.__disabled = true;\n var disposers = [$dom.addEventListener(window, \"DOMContentLoaded\", function () {\n viewPortHandler(sprite_1);\n }), $dom.addEventListener(window, \"load\", function () {\n viewPortHandler(sprite_1);\n }), $dom.addEventListener(window, \"resize\", function () {\n viewPortHandler(sprite_1);\n }), $dom.addEventListener(window, \"scroll\", function () {\n viewPortHandler(sprite_1);\n })];\n\n if (options.viewportTarget) {\n var targets = $type.isArray(options.viewportTarget) ? options.viewportTarget : options.viewportTarget ? [options.viewportTarget] : [];\n\n for (var i = 0; i < targets.length; i++) {\n var target = targets[i];\n disposers.push($dom.addEventListener(target, \"resize\", function () {\n viewPortHandler(sprite_1);\n }));\n disposers.push($dom.addEventListener(target, \"scroll\", function () {\n viewPortHandler(sprite_1);\n }));\n }\n }\n\n var disposer = new MultiDisposer(disposers);\n sprite_1.addDisposer(disposer);\n sprite_1.vpDisposer = disposer;\n } else if (options.queue) {\n addToQueue(sprite_1);\n }\n } else if (options.queue) {\n addToQueue(sprite_1);\n }\n\n return sprite_1;\n } else {\n system.log(\"html container not found\");\n throw new Error(\"html container not found\");\n }\n}\n/**\r\n * Disposes all of the currently active charts.\r\n */\n\n\nexport function disposeAllCharts() {\n while (registry.baseSprites.length !== 0) {\n registry.baseSprites.pop().dispose();\n }\n}\nexport function addToQueue(sprite) {\n if (registry.queue.indexOf(sprite) == -1) {\n sprite.__disabled = true;\n sprite.tooltipContainer.__disabled = true;\n sprite.events.disableType(\"appeared\");\n\n if (registry.queue.length == 0) {\n registry.events.once(\"exitframe\", function () {\n queueHandler(sprite);\n });\n system.requestFrame();\n }\n\n sprite.addDisposer(new Disposer(function () {\n removeFromQueue(sprite);\n }));\n registry.queue.push(sprite);\n }\n}\nexport function removeFromQueue(sprite) {\n var index = registry.queue.indexOf(sprite);\n\n if (index >= 0) {\n registry.queue.splice(registry.queue.indexOf(sprite), 1);\n var nextSprite = registry.queue[index];\n\n if (nextSprite) {\n queueHandler(nextSprite);\n }\n }\n}\n/**\r\n * Checks whether the chart was not initialized fully due to setting\r\n * of `onlyShowOnViewport`. If it hasn't and is now in the viewport\r\n * the chart will be initialized.\r\n *\r\n * @since 4.9.12\r\n * @param sprite Top-level chart object\r\n */\n\nexport function viewPortHandler(sprite) {\n if (sprite.__disabled && $dom.isElementInViewport(sprite.htmlContainer, options.viewportTarget)) {\n if (sprite.vpDisposer) {\n sprite.vpDisposer.dispose();\n }\n\n addToQueue(sprite);\n }\n}\nexport function queueHandler(sprite) {\n if (sprite && sprite.tooltipContainer) {\n sprite.__disabled = false;\n sprite.tooltipContainer.__disabled = false;\n sprite.events.enableType(\"appeared\");\n sprite.dispatch(\"removedfromqueue\");\n\n if (sprite.showOnInit) {\n sprite.events.on(\"appeared\", function () {\n removeFromQueue(sprite);\n });\n }\n\n if (sprite.vpDisposer) {\n sprite.vpDisposer.dispose();\n }\n\n if (sprite instanceof Container) {\n sprite.invalidateLabels();\n }\n\n if (sprite.tooltipContainer) {\n sprite.tooltipContainer.invalidateLayout();\n }\n\n if (sprite instanceof Component) {\n sprite.invalidateData();\n sprite.reinit();\n sprite.events.once(\"datavalidated\", function () {\n if (sprite.showOnInit) {\n sprite.appear();\n } else {\n removeFromQueue(sprite);\n }\n });\n } else {\n sprite.reinit();\n sprite.events.once(\"inited\", function () {\n removeFromQueue(sprite);\n });\n\n if (sprite.showOnInit) {\n sprite.appear();\n }\n }\n }\n}\n/**\r\n * A shortcut to creating a chart instance.\r\n *\r\n * The first argument is either a reference to or an id of a DOM element to be\r\n * used as a container for the chart.\r\n *\r\n * The second argument is the type reference of the chart type. (for plain\r\n * JavaScript users this can also be a string indicating chart type)\r\n *\r\n * ```TypeScript\r\n * let chart = am4core.create(\"chartdiv\", am4charts.PieChart);\r\n * ```\r\n * ```JavaScript\r\n * // Can pass in chart type reference like this:\r\n * var chart = am4core.create(\"chartdiv\", am4charts.PieChart);\r\n *\r\n * // ... or chart class type as a string:\r\n * var chart = am4core.create(\"chartdiv\", \"PieChart\");\r\n * ```\r\n *\r\n * @param htmlElement Reference or id of the target container element\r\n * @param classType Class type of the target chart type\r\n * @return Chart instance\r\n */\n\nexport function create(htmlElement, classType) {\n // This is a nasty hack for the benefit of vanilla JS users, who do not\n // enjoy benefits of type-check anyway.\n // We're allowing passing in a name of the class rather than type reference\n // itself.\n var classError;\n\n if ($type.isString(classType)) {\n if ($type.hasValue(registry.registeredClasses[classType])) {\n classType = registry.registeredClasses[classType];\n } else {\n classType = registry.registeredClasses[\"Container\"];\n classError = new Error(\"Class [\" + classType + \"] is not loaded.\");\n }\n } // Create the chart\n\n\n var chart = createChild(htmlElement, classType); // Error?\n\n if (classError) {\n chart.raiseCriticalError(classError);\n }\n\n return chart;\n}\n/**\r\n * A shortcut to creating a chart from a config object.\r\n *\r\n * Example:\r\n *\r\n * ```TypeScript\r\n * let chart am4core.createFromConfig({ ... }, \"chartdiv\", am4charts.XYChart );\r\n * ```\r\n * ```JavaScript\r\n * var chart am4core.createFromConfig({ ... }, \"chartdiv\", \"XYChart\" );\r\n * ```\r\n *\r\n * If `chartType` parameter is not supplied it must be set in a config object,\r\n * via reference to chart type, e.g.:\r\n *\r\n * ```TypeScript\r\n * {\r\n * \"type\": am4charts.XYChart,\r\n * // ...\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * {\r\n * \"type\": am4charts.XYChart,\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * Or via string: (if you are using JavaScript)\r\n *\r\n * ```TypeScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * // ...\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * A `container` can either be a reference to an HTML container to put chart\r\n * in, or it's unique id.\r\n *\r\n * If `container` is not specified, it must be included in the config object:\r\n *\r\n * ```TypeScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * \"container\": \"chartdiv\",\r\n * // ...\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * {\r\n * \"type\": \"XYChart\",\r\n * \"container\": \"chartdiv\",\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @param config Config object in property/value pairs\r\n * @param htmlElement Container reference or ID\r\n * @param objectType Chart type\r\n * @return A newly created chart instance\r\n * @todo Throw exception if type is not correct\r\n */\n\nexport function createFromConfig(config, htmlElement, classType) {\n // Extract chart type from config if necessary\n if (!$type.hasValue(classType)) {\n classType = config.type;\n delete config.type;\n } // Extract element from config if necessary\n\n\n if (!$type.hasValue(htmlElement)) {\n htmlElement = config.container;\n delete config.container;\n } // Check if we need to extract actual type reference\n\n\n var finalType;\n var classError;\n\n if ($type.isString(classType) && $type.hasValue(registry.registeredClasses[classType])) {\n finalType = registry.registeredClasses[classType];\n } else if (typeof classType !== \"function\") {\n finalType = Container;\n classError = new Error(\"Class [\" + classType + \"] is not loaded.\");\n } else {\n finalType = classType;\n } // Create the chart\n\n\n var chart = createChild(htmlElement, finalType); // Set config\n\n if (classError) {\n chart.raiseCriticalError(classError);\n } else {\n chart.config = config;\n }\n\n return chart;\n}\n/**\r\n * Useful in creating real queues form mult-chart creation.\r\n *\r\n * Accepts a reference to a function which crates and returns actual chart\r\n * object.\r\n *\r\n * It returns a `Promise` which you can use to catch chart instance once it's\r\n * created.\r\n *\r\n * ```TypeScript\r\n * am4core.createDeferred(function(div) {\r\n * // Create first chart\r\n * let chart = am4core.create(div, am4charts.XYChart);\r\n * // ...\r\n * return chart;\r\n * }, \"chartdiv1\").then(chart) {\r\n * // `chart` variable holds an instance of the chart\r\n * console.log(\"Chart ready\", chart);\r\n * }\r\n *\r\n * am4core.createDeferred(function(div) {\r\n * // Create second chart\r\n * let chart = am4core.create(div, am4charts.PieChart);\r\n * // ...\r\n * return chart;\r\n * }, \"chartdiv2\").then(chart) {\r\n * // `chart` variable holds an instance of the chart\r\n * console.log(\"Chart ready\", chart);\r\n * }\r\n * ```\r\n * ```JavaScript\r\n * am4core.createDeferred(function(div) {\r\n * // Create first chart\r\n * var chart = am4core.create(div, am4charts.XYChart);\r\n * // ...\r\n * return chart;\r\n * }, \"chartdiv1\").then(chart) {\r\n * // `chart` variable holds an instance of the chart\r\n * console.log(\"Chart ready\", chart);\r\n * }\r\n *\r\n * am4core.createDeferred(function(div) {\r\n * // Create second chart\r\n * var chart = am4core.create(div, am4charts.PieChart);\r\n * // ...\r\n * return chart;\r\n * }, \"chartdiv2\").then(chart) {\r\n * // `chart` variable holds an instance of the chart\r\n * console.log(\"Chart ready\", chart);\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/performance/#Deferred_daisy_chained_instantiation} for more information\r\n * @since 4.10.0\r\n * @param callback Callback function that creates chart\r\n * @param scope Scope to call callback in\r\n * @param ...rest Parameters to pass into callback\r\n * @return Promise with chart instance\r\n */\n\nexport function createDeferred(callback, scope) {\n var rest = [];\n\n for (var _i = 2; _i < arguments.length; _i++) {\n rest[_i - 2] = arguments[_i];\n }\n\n return new Promise(function (resolve, reject) {\n registry.deferred.push({\n scope: scope,\n callback: callback,\n args: rest,\n resolve: resolve\n });\n\n if (registry.deferred.length == 1) {\n processNextDeferred();\n }\n });\n}\n\nfunction processNextDeferred() {\n var _a;\n\n var next = registry.deferred[0];\n\n if (next) {\n var sprite_2 = (_a = next.callback).call.apply(_a, __spread([next.scope], next.args));\n\n sprite_2.events.on(\"ready\", function () {\n next.resolve(sprite_2);\n registry.deferred.shift();\n\n if (options.deferredDelay) {\n setTimeout(processNextDeferred, options.deferredDelay);\n } else {\n processNextDeferred();\n }\n });\n }\n}\n/**\r\n * Applies a theme to System, and subsequently all chart instances created\r\n * from that point forward.\r\n *\r\n * amCharts supports multiple themes. Calling `useTheme` multiple times will\r\n * make the System apply multiple themes, rather than overwrite previously\r\n * set one.\r\n *\r\n * This enables combining features from multiple themes on the same chart.\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * am4core.useTheme(am4themes.material);\r\n * am4core.useTheme(am4themes.animated);\r\n * ```\r\n * ```JavaScript\r\n * am4core.useTheme(am4themes.material);\r\n * am4core.useTheme(am4themes.animated);\r\n * ```\r\n *\r\n * The above will apply both the Material color and animation options to all\r\n * charts created.\r\n *\r\n * @param value A reference to a theme\r\n */\n\n\nexport function useTheme(value) {\n if (registry.themes.indexOf(value) === -1) {\n registry.themes.push(value);\n }\n}\n/**\r\n * Removes a theme from \"active themes\" list, so it won't get applied to any\r\n * charts created subsequently.\r\n *\r\n * @param value A reference to a theme\r\n */\n\nexport function unuseTheme(value) {\n $array.remove(registry.themes, value);\n}\n/**\r\n * Removes all \"active\" themes. Any charts created subsequently will not have\r\n * any theme applied to them.\r\n */\n\nexport function unuseAllThemes() {\n registry.themes = [];\n}\n/**\r\n * Adds a license, e.g.:\r\n *\r\n * ```TypeScript\r\n * am4core.addLicense(\"xxxxxxxx\");\r\n * ```\r\n * ```JavaScript\r\n * am4core.addLicense(\"xxxxxxxx\");\r\n * ```\r\n *\r\n * Multiple licenses can be added to cover for multiple products.\r\n *\r\n * @since 4.5.16\r\n * @param license License key\r\n */\n\nexport function addLicense(license) {\n options.licenses.push(license);\n}","/**\r\n * Legend-related functionality.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Component } from \"../core/Component\";\nimport { DataItem } from \"../core/DataItem\";\nimport { ListTemplate, ListDisposer } from \"../core/utils/List\";\nimport { RoundedRectangle } from \"../core/elements/RoundedRectangle\";\nimport { Container } from \"../core/Container\";\nimport { Label } from \"../core/elements/Label\";\nimport { keyboard } from \"../core/utils/Keyboard\";\nimport { registry } from \"../core/Registry\";\nimport { getInteraction } from \"../core/interaction/Interaction\";\nimport { percent, Percent } from \"../core/utils/Percent\";\nimport { InterfaceColorSet } from \"../core/utils/InterfaceColorSet\";\nimport * as $utils from \"../core/utils/Utils\";\nimport * as $type from \"../core/utils/Type\";\nimport * as $math from \"../core/utils/Math\";\nimport { Sprite } from \"../core/Sprite\";\nimport { Disposer } from \"../core/utils/Disposer\";\nimport { MouseCursorStyle } from \"../core/interaction/Mouse\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../core/utils/Responsive\";\nimport { Scrollbar } from \"../core/elements/Scrollbar\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[Legend]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar LegendDataItem =\n/** @class */\nfunction (_super) {\n __extends(LegendDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function LegendDataItem() {\n var _this = _super.call(this) || this;\n /**\r\n * @ignore\r\n */\n\n\n _this.childrenCreated = false;\n _this.className = \"LegendDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(LegendDataItem.prototype, \"label\", {\n /**\r\n * A legend item's [[Label]] element.\r\n *\r\n * @return Label\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._label) {\n var label_1 = this.component.labels.create();\n this._label = label_1;\n this.addSprite(label_1);\n\n this._disposers.push(label_1);\n\n label_1.parent = this.itemContainer;\n\n this._disposers.push(new Disposer(function () {\n if ($type.hasValue(_this.component)) {\n _this.component.labels.removeValue(label_1);\n }\n }));\n }\n\n return this._label;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LegendDataItem.prototype, \"color\", {\n /**\r\n * @return Main color\r\n */\n get: function get() {\n return this.properties.color;\n },\n\n /**\r\n * Main color of legend data item.\r\n *\r\n * This is set by the target element this legend item represents, like\r\n * a Series or a Slice.\r\n *\r\n * It can be used to derive a color in legend's sub-items, like label:\r\n *\r\n * ```TypeScript\r\n * chart.legend.labels.template.text = \"[{color}]{name}[/]\";\r\n * ```\r\n * ```JavaScript\r\n * chart.legend.labels.template.text = \"[{color}]{name}[/]\";\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"legend\": {\r\n * // ...\r\n * \"labels\": {\r\n * \"text\": \"[{color}]{name}[/]\"\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/#Legend_labels} For more information about configuring legend labels.\r\n * @param value Main color\r\n */\n set: function set(value) {\n this.setProperty(\"color\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LegendDataItem.prototype, \"valueLabel\", {\n /**\r\n * A legend item's [[Label]] element for \"value label\".\r\n *\r\n * @return Label\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._valueLabel) {\n var valueLabel_1 = this.component.valueLabels.create();\n this._valueLabel = valueLabel_1;\n this.addSprite(valueLabel_1);\n\n this._disposers.push(valueLabel_1);\n\n valueLabel_1.parent = this.itemContainer;\n\n this._disposers.push(new Disposer(function () {\n if ($type.hasValue(_this.component)) {\n _this.component.valueLabels.removeValue(valueLabel_1);\n }\n }));\n }\n\n return this._valueLabel;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LegendDataItem.prototype, \"itemContainer\", {\n /**\r\n * A reference to the main [[Container]] that holds legend item's elements:\r\n * marker and labels.\r\n *\r\n * @return Item container\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._itemContainer) {\n var component_1 = this.component;\n var itemContainer_1 = component_1.itemContainers.create();\n itemContainer_1.parent = component_1;\n this._itemContainer = itemContainer_1;\n this.addSprite(itemContainer_1);\n\n this._disposers.push(itemContainer_1); // Add click/tap event to toggle item\n\n\n if (itemContainer_1.togglable) {\n itemContainer_1.events.on(\"toggled\", function (ev) {\n component_1.toggleDataItem(ev.target.dataItem);\n }, undefined, false);\n } // Add focus event so that we can track which object is currently in focus\n // for keyboard toggling\n\n\n if (itemContainer_1.focusable) {\n itemContainer_1.events.on(\"hit\", function (ev) {\n // We need this here in order to reset focused item when it is clicked\n // normally so that it is not toggled by ENTER afterwards\n component_1.focusedItem = undefined;\n }, undefined, false);\n itemContainer_1.events.on(\"focus\", function (ev) {\n component_1.focusedItem = ev.target.dataItem;\n }, undefined, false);\n itemContainer_1.events.on(\"blur\", function (ev) {\n component_1.focusedItem = undefined;\n }, undefined, false);\n }\n\n this._disposers.push(new Disposer(function () {\n if ($type.hasValue(_this.component)) {\n _this.component.itemContainers.removeValue(itemContainer_1);\n }\n }));\n\n if (this.dataContext.uidAttr) {\n itemContainer_1.readerControls = this.dataContext.uidAttr();\n itemContainer_1.readerLabelledBy = this.dataContext.uidAttr();\n }\n\n var sprite = this.dataContext;\n\n if ((sprite instanceof DataItem || sprite instanceof Sprite) && !sprite.isDisposed()) {\n var visibilitychanged = function visibilitychanged(ev) {\n itemContainer_1.readerChecked = ev.visible;\n itemContainer_1.events.disableType(\"toggled\");\n itemContainer_1.isActive = !ev.visible;\n itemContainer_1.events.enableType(\"toggled\");\n };\n\n sprite.addDisposer(new Disposer(function () {\n if (_this.component) {\n _this.component.dataItems.remove(_this);\n }\n }));\n\n if (sprite instanceof Sprite) {\n itemContainer_1.addDisposer(sprite.events.on(\"visibilitychanged\", visibilitychanged, undefined, false));\n itemContainer_1.addDisposer(sprite.events.on(\"hidden\", function (ev) {\n itemContainer_1.readerChecked = false;\n itemContainer_1.events.disableType(\"toggled\");\n itemContainer_1.isActive = true;\n itemContainer_1.events.enableType(\"toggled\");\n }, undefined, false));\n itemContainer_1.addDisposer(sprite.events.on(\"shown\", function (ev) {\n itemContainer_1.readerChecked = true;\n itemContainer_1.events.disableType(\"toggled\");\n itemContainer_1.isActive = false;\n itemContainer_1.events.enableType(\"toggled\");\n }, undefined, false));\n } else {\n itemContainer_1.addDisposer(sprite.events.on(\"visibilitychanged\", visibilitychanged, undefined, false));\n }\n }\n }\n\n return this._itemContainer;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LegendDataItem.prototype, \"marker\", {\n /**\r\n * A [[Container]] that holds legend item's marker element.\r\n *\r\n * @return Marker\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._marker) {\n var marker_1 = this.component.markers.create();\n this._marker = marker_1;\n marker_1.parent = this.itemContainer;\n this.addSprite(marker_1);\n\n this._disposers.push(marker_1);\n\n this._disposers.push(new Disposer(function () {\n if ($type.hasValue(_this.component)) {\n _this.component.markers.removeValue(marker_1);\n }\n }));\n }\n\n return this._marker;\n },\n enumerable: true,\n configurable: true\n });\n return LegendDataItem;\n}(DataItem);\n\nexport { LegendDataItem };\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a class that carries legend settings.\r\n *\r\n * A legend might change its settings dynamically. Legend can also be shared\r\n * by several elements, requiring different settings.\r\n *\r\n * Having legend's settings in a separate object is a good way to \"hot swap\"\r\n * a set of settings for the legend.\r\n */\n\nvar LegendSettings =\n/** @class */\nfunction () {\n function LegendSettings() {\n /**\r\n * Should marker be created for each legend item.\r\n */\n this.createMarker = true;\n }\n\n return LegendSettings;\n}();\n\nexport { LegendSettings };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * [[Legend]] class is used to create legend for the chart.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/} for Legend documentation\r\n * @see {@link ILegendEvents} for a list of available events\r\n * @see {@link ILegendAdapters} for a list of available Adapters\r\n */\n\nvar Legend =\n/** @class */\nfunction (_super) {\n __extends(Legend, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Legend() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Legend\"; // Set defaults\n\n _this.layout = \"grid\";\n\n _this.setPropertyValue(\"useDefaultMarker\", false);\n\n _this.setPropertyValue(\"scrollable\", false);\n\n _this.setPropertyValue(\"contentAlign\", \"center\"); // Create a template container and list for legend items\n\n\n var itemContainer = new Container();\n itemContainer.applyOnClones = true;\n itemContainer.padding(8, 0, 8, 0);\n itemContainer.margin(0, 10, 0, 10);\n itemContainer.layout = \"horizontal\";\n itemContainer.clickable = true;\n itemContainer.focusable = true;\n itemContainer.role = \"switch\";\n itemContainer.togglable = true;\n itemContainer.cursorOverStyle = MouseCursorStyle.pointer;\n itemContainer.background.fillOpacity = 0; // creates hit area\n // Create container list using item template we just created\n\n _this.itemContainers = new ListTemplate(itemContainer);\n\n _this._disposers.push(new ListDisposer(_this.itemContainers));\n\n _this._disposers.push(_this.itemContainers.template); // Set up global keyboard events for toggling elements\n\n\n _this._disposers.push(getInteraction().body.events.on(\"keyup\", function (ev) {\n if (keyboard.isKey(ev.event, \"enter\") && _this.focusedItem) {\n var focusedItem = _this.focusedItem;\n var target = focusedItem.itemContainer;\n\n if (target.togglable) {\n _this.toggleDataItem(focusedItem);\n } else if (target.clickable && target.events.isEnabled(\"hit\")) {\n target.dispatchImmediately(\"hit\", {\n event: ev\n }); // We need this here because \"hit\" event resets `this.focusedItem`\n // And we need it here\n\n _this.focusedItem = focusedItem;\n }\n }\n }, _this));\n\n var interfaceColors = new InterfaceColorSet(); // Create a template container and list for the a marker\n\n var marker = new Container();\n marker.width = 23;\n marker.height = 23;\n marker.interactionsEnabled = false;\n marker.applyOnClones = true;\n marker.setStateOnChildren = true;\n marker.background.fillOpacity = 0;\n marker.background.strokeOpacity = 0;\n marker.propertyFields.fill = \"fill\";\n marker.valign = \"middle\";\n var disabledColor = interfaceColors.getFor(\"disabledBackground\");\n marker.events.on(\"childadded\", function (event) {\n var child = event.newValue;\n var activeState = child.states.create(\"active\");\n activeState.properties.stroke = disabledColor;\n activeState.properties.fill = disabledColor;\n });\n _this.markers = new ListTemplate(marker);\n\n _this._disposers.push(new ListDisposer(_this.markers));\n\n _this._disposers.push(_this.markers.template); // Create a legend background element\n\n\n var rectangle = marker.createChild(RoundedRectangle);\n rectangle.width = percent(100);\n rectangle.height = percent(100);\n rectangle.applyOnClones = true;\n rectangle.propertyFields.fill = \"fill\"; //othrwise old edge doesn't like as the same pattern is set both on parent and child https://codepen.io/team/amcharts/pen/72d7a98f3fb811d3118795220ff63182\n\n rectangle.strokeOpacity = 0; // Create a template container and list for item labels\n\n var label = new Label();\n label.text = \"{name}\";\n label.margin(0, 5, 0, 5);\n label.valign = \"middle\";\n label.applyOnClones = true;\n label.states.create(\"active\").properties.fill = interfaceColors.getFor(\"disabledBackground\");\n _this.labels = new ListTemplate(label);\n\n _this._disposers.push(new ListDisposer(_this.labels));\n\n _this._disposers.push(_this.labels.template);\n\n label.interactionsEnabled = false;\n label.truncate = true;\n label.fullWords = false; // Create a template container and list for item value labels\n\n var valueLabel = new Label();\n valueLabel.margin(0, 5, 0, 0);\n valueLabel.valign = \"middle\";\n valueLabel.width = 50; // to avoid rearranging legend entries when value changes.\n\n valueLabel.align = \"right\";\n valueLabel.textAlign = \"end\";\n valueLabel.applyOnClones = true;\n valueLabel.states.create(\"active\").properties.fill = interfaceColors.getFor(\"disabledBackground\");\n valueLabel.interactionsEnabled = false;\n _this.valueLabels = new ListTemplate(valueLabel);\n\n _this._disposers.push(new ListDisposer(_this.valueLabels));\n\n _this._disposers.push(_this.valueLabels.template);\n\n _this.position = \"bottom\"; // don't use setPropertyValue here!\n // Create a state for disabled legend items\n\n itemContainer.states.create(\"active\");\n itemContainer.setStateOnChildren = true; // Apply accessibility settings\n\n _this.role = \"group\";\n\n _this.events.on(\"layoutvalidated\", _this.handleScrollbar, _this, false);\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n Legend.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this);\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Legend\");\n }\n };\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n Legend.prototype.createDataItem = function () {\n return new LegendDataItem();\n };\n /**\r\n * [validateDataElements description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n\n Legend.prototype.validateDataElements = function () {\n if (this.scrollbar) {\n this.scrollbar.start = 0;\n this.scrollbar.end = 1;\n }\n\n _super.prototype.validateDataElements.call(this);\n };\n /**\r\n * [validateDataElement description]\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n * @todo Description\r\n * @todo Figure out how to update appearance of legend item without losing focus\r\n * @todo Update legend marker appearance as apperance of related series changes\r\n */\n\n\n Legend.prototype.validateDataElement = function (dataItem) {\n _super.prototype.validateDataElement.call(this, dataItem); // Get data item (legend item's) container\n\n\n var container = dataItem.itemContainer;\n var marker = dataItem.marker;\n $utils.used(dataItem.label);\n var valueLabel = dataItem.valueLabel; // Set parent and update current state\n\n container.readerChecked = dataItem.dataContext.visible; // Tell series its legend data item\n\n dataItem.dataContext.legendDataItem = dataItem;\n var tempMaxWidth = dataItem.label.maxWidth;\n\n if (!(dataItem.label.width instanceof Percent)) {\n dataItem.label.width = undefined;\n }\n\n if (tempMaxWidth > 0) {\n dataItem.label.maxWidth = tempMaxWidth;\n }\n\n if (valueLabel.align == \"right\") {\n valueLabel.width = undefined;\n }\n\n var legendSettings = dataItem.dataContext.legendSettings; // If we are not using default markers, create a unique legend marker based\n // on the data item type\n\n var dataContext = dataItem.dataContext;\n\n if (dataContext.createLegendMarker && (!this.useDefaultMarker || !(dataContext instanceof Sprite))) {\n if (!dataItem.childrenCreated) {\n dataContext.createLegendMarker(marker);\n dataItem.childrenCreated = true;\n }\n } else {\n this.markers.template.propertyFields.fill = undefined;\n }\n\n if (dataContext.updateLegendValue) {\n dataContext.updateLegendValue(); // this solves issue with external legend, as legend is created after chart updates legend values\n }\n\n if (dataContext.component && dataContext.component.updateLegendValue) {\n dataContext.component.updateLegendValue(dataContext);\n }\n\n if (valueLabel.invalid) {\n valueLabel.validate();\n }\n\n if (valueLabel.text == \"\" || valueLabel.text == undefined) {\n valueLabel.__disabled = true;\n } else {\n valueLabel.__disabled = false;\n }\n\n if (legendSettings && (legendSettings.itemValueText != undefined || legendSettings.valueText != undefined)) {\n valueLabel.__disabled = false;\n }\n\n var visible = dataItem.dataContext.visible;\n\n if (visible === undefined) {\n visible = true;\n }\n\n visible = $type.toBoolean(visible);\n dataItem.dataContext.visible = visible;\n container.events.disableType(\"toggled\");\n container.isActive = !visible;\n\n if (container.isActive) {\n container.setState(\"active\", 0);\n } else {\n container.setState(\"default\", 0);\n }\n\n container.events.enableType(\"toggled\");\n };\n\n Legend.prototype.afterDraw = function () {\n var _this = this;\n\n var maxWidth = this.getPropertyValue(\"maxWidth\");\n var maxLabelWidth = 0;\n this.labels.each(function (label) {\n if (label.invalid) {\n label.maxWidth = undefined;\n label.validate();\n }\n\n if (label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight > maxLabelWidth) {\n maxLabelWidth = label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight;\n }\n });\n var maxValueLabelWidth = 0;\n this.valueLabels.each(function (label) {\n if (label.invalid) {\n label.validate();\n }\n\n if (label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight > maxValueLabelWidth) {\n maxValueLabelWidth = label.measuredWidth + label.pixelMarginLeft + label.pixelMarginRight;\n }\n });\n var maxMarkerWidth = 0;\n this.markers.each(function (marker) {\n if (marker.invalid) {\n marker.validate();\n }\n\n if (marker.measuredWidth + marker.pixelMarginLeft + marker.pixelMarginRight > maxMarkerWidth) {\n maxMarkerWidth = marker.measuredWidth + marker.pixelMarginLeft + marker.pixelMarginRight;\n }\n });\n var itemContainer = this.itemContainers.template;\n var margin = itemContainer.pixelMarginRight + itemContainer.pixelMarginLeft;\n var maxAdjustedLabelWidth;\n var trueMaxWidth = maxLabelWidth + maxValueLabelWidth + maxMarkerWidth;\n\n if (!$type.isNumber(maxWidth)) {\n maxAdjustedLabelWidth = maxLabelWidth;\n } else {\n maxWidth = maxWidth - margin;\n\n if (maxWidth > trueMaxWidth) {\n maxWidth = trueMaxWidth;\n }\n\n maxAdjustedLabelWidth = maxWidth - maxMarkerWidth - maxValueLabelWidth;\n }\n\n this.labels.each(function (label) {\n if (_this.valueLabels.template.align == \"right\" || label.measuredWidth > maxAdjustedLabelWidth) {\n if (!(label.width instanceof Percent)) {\n label.width = Math.min(label.maxWidth, maxAdjustedLabelWidth - label.pixelMarginLeft - label.pixelMarginRight);\n label.maxWidth = label.width;\n }\n }\n });\n\n if (this.valueLabels.template.align == \"right\") {\n this.valueLabels.each(function (valueLabel) {\n valueLabel.width = maxValueLabelWidth - valueLabel.pixelMarginRight - valueLabel.pixelMarginLeft;\n });\n }\n\n _super.prototype.afterDraw.call(this);\n };\n\n Legend.prototype.handleScrollbar = function () {\n var scrollbar = this.scrollbar;\n\n if (this.scrollable && scrollbar) {\n scrollbar.height = this.measuredHeight;\n scrollbar.x = this.measuredWidth - scrollbar.pixelWidth - scrollbar.pixelMarginLeft;\n\n if (this.contentHeight > this.measuredHeight) {\n scrollbar.visible = true;\n scrollbar.thumb.height = scrollbar.height * this.measuredHeight / this.contentHeight;\n this.paddingRight = scrollbar.pixelWidth + scrollbar.pixelMarginLeft + +scrollbar.pixelMarginRight;\n } else {\n scrollbar.visible = false;\n }\n\n this.updateMasks();\n }\n };\n\n Object.defineProperty(Legend.prototype, \"position\", {\n /**\r\n * @return Position\r\n */\n get: function get() {\n return this.getPropertyValue(\"position\");\n },\n\n /**\r\n * Position of the legend.\r\n *\r\n * Options: \"left\", \"right\", \"top\", \"bottom\" (default), or \"absolute\".\r\n *\r\n * IMPORTANT: [[MapChart]] will ignore this setting, as it is using different\r\n * layout structure than other charts.\r\n *\r\n * To position legend in [[MapChart]] set legend's `align` (`\"left\"` or\r\n * `\"right\"`) and `valign` (`\"top\"` or `\"bottom\"`) properties instead.\r\n *\r\n * @default \"bottom\"\r\n * @param value Position\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"position\", value)) {\n if (value == \"left\" || value == \"right\") {\n this.margin(10, 5, 10, 10);\n this.valign = \"middle\";\n this.contentAlign = \"none\";\n this.valueLabels.template.align = \"right\";\n\n if (!$type.isNumber(this.maxColumns)) {\n this.maxColumns = 1;\n }\n\n this.width = undefined;\n this.maxWidth = 220;\n } else {\n this.maxColumns = undefined;\n this.width = percent(100);\n this.valueLabels.template.align = \"left\";\n }\n\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Legend.prototype, \"useDefaultMarker\", {\n /**\r\n * @return Use default marker?\r\n */\n get: function get() {\n return this.getPropertyValue(\"useDefaultMarker\");\n },\n\n /**\r\n * Should legend try to mirror the look of the related item when building\r\n * the marker for legend item?\r\n *\r\n * If set to `false` it will try to make the marker look like its related\r\n * item.\r\n *\r\n * E.g. if an item is for a Line Series, it will display a line of the\r\n * same thickness, color, and will use the same bullets if series have them.\r\n *\r\n * If set to `true`, all markers will be shown as squares, regardless of te\r\n * series type.\r\n *\r\n * @default false\r\n * @param value Use default marker?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"useDefaultMarker\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Legend.prototype, \"scrollable\", {\n /**\r\n * @return Legend Scrollable?\r\n */\n get: function get() {\n return this.getPropertyValue(\"scrollable\");\n },\n\n /**\r\n * If set to `true` the Legend will display a scrollbar if its contents do\r\n * not fit into its `maxHeight`.\r\n *\r\n * Please note that `maxHeight` is automatically set for Legend when its\r\n * `position` is set to `\"left\"` or `\"right\"`.\r\n *\r\n * @default false\r\n * @since 4.8.0\r\n * @param value Legend Scrollable?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"scrollable\", value, true)) {\n if (value) {\n var scrollbar = this.createChild(Scrollbar);\n this.scrollbar = scrollbar;\n scrollbar.isMeasured = false;\n scrollbar.orientation = \"vertical\";\n scrollbar.endGrip.__disabled = true;\n scrollbar.startGrip.__disabled = true;\n scrollbar.visible = false;\n scrollbar.marginLeft = 5;\n this._mouseWheelDisposer = this.events.on(\"wheel\", this.handleWheel, this, false);\n\n this._disposers.push(this._mouseWheelDisposer);\n\n this._disposers.push(scrollbar.events.on(\"rangechanged\", this.updateMasks, this, false));\n } else {\n if (this._mouseWheelDisposer) {\n this._mouseWheelDisposer.dispose();\n\n if (this.scrollbar) {\n this.scrollbar.dispose();\n this.scrollbar = undefined;\n }\n }\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Handles mouse wheel scrolling of legend.\r\n *\r\n * @param event Event\r\n */\n\n Legend.prototype.handleWheel = function (event) {\n var shift = event.shift.y;\n var scrollbar = this.scrollbar;\n\n if (scrollbar) {\n var ds = shift / 1000 * this.measuredHeight / this.contentHeight;\n var delta = scrollbar.end - scrollbar.start;\n\n if (shift > 0) {\n scrollbar.start = $math.max(0, scrollbar.start - ds);\n scrollbar.end = scrollbar.start + delta;\n } else {\n scrollbar.end = $math.min(1, scrollbar.end - ds);\n scrollbar.start = scrollbar.end - delta;\n }\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n Legend.prototype.updateMasks = function () {\n var _this = this;\n\n if (this.scrollbar) {\n this.itemContainers.each(function (itemContainer) {\n itemContainer.dy = -_this.scrollbar.thumb.pixelY * _this.contentHeight / _this.measuredHeight;\n itemContainer.maskRectangle = {\n x: 0,\n y: -itemContainer.dy,\n width: _this.measuredWidth,\n height: _this.measuredHeight\n };\n });\n }\n };\n /**\r\n * Toggles a legend item.\r\n *\r\n * @ignore Exclude from docs\r\n * @param item Legend item\r\n * @todo Maybe do it with togglable instead\r\n */\n\n\n Legend.prototype.toggleDataItem = function (item) {\n var dataContext = item.dataContext;\n\n if (!dataContext.visible || dataContext.isHiding || dataContext instanceof Sprite && dataContext.isHidden) {\n item.color = item.colorOrig;\n dataContext.appeared = true;\n item.itemContainer.isActive = false;\n\n if (dataContext.hidden === true) {\n dataContext.hidden = false;\n }\n\n if (dataContext.show) {\n dataContext.show();\n } else {\n dataContext.visible = true;\n }\n\n this.svgContainer.readerAlert(this.language.translate(\"%1 shown\", this.language.locale, item.label.readerTitle));\n } else {\n item.itemContainer.isActive = true;\n dataContext.appeared = true;\n\n if (dataContext.hide) {\n dataContext.hide();\n } else {\n dataContext.visible = false;\n }\n\n this.svgContainer.readerAlert(this.language.translate(\"%1 hidden\", this.language.locale, item.label.readerTitle));\n item.color = new InterfaceColorSet().getFor(\"disabledBackground\");\n }\n };\n\n Object.defineProperty(Legend.prototype, \"preloader\", {\n /**\r\n * Override preloader method so that legend does not accidentally show its\r\n * own preloader.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Always `undefined`\r\n */\n get: function get() {\n return;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * [handleDataItemPropertyChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Legend.prototype.handleDataItemPropertyChange = function (dataItem, name) {\n dataItem.valueLabel.invalidate();\n dataItem.label.invalidate();\n };\n\n return Legend;\n}(Component);\n\nexport { Legend };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Legend\"] = Legend;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Move legend to below the chart if chart is narrow\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.widthXS,\n state: function state(target, stateId) {\n if (target instanceof Legend && (target.position == \"left\" || target.position == \"right\")) {\n var state = target.states.create(stateId);\n state.properties.position = \"bottom\";\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Move legend to the right if chart is very short\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.heightXS,\n state: function state(target, stateId) {\n if (target instanceof Legend && (target.position == \"top\" || target.position == \"bottom\")) {\n var state = target.states.create(stateId);\n state.properties.position = \"right\";\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Disable legend altogether on small charts\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.isXS,\n state: function state(target, stateId) {\n if (target instanceof Legend) {\n var state = target.states.create(stateId);\n state.properties.disabled = true;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * Axis break module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\nimport { WavedLine } from \"../../core/elements/WavedLine\";\nimport { List } from \"../../core/utils/List\";\nimport { registry } from \"../../core/Registry\";\nimport { color } from \"../../core/utils/Color\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Base class to define \"breaks\" on axes.\r\n *\r\n * @see {@link IAxisBreakEvents} for a list of available events\r\n * @see {@link IAxisBreakAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar AxisBreak =\n/** @class */\nfunction (_super) {\n __extends(AxisBreak, _super);\n /**\r\n * Constructor\r\n */\n\n\n function AxisBreak() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * Reference to parent Axis.\r\n */\n\n\n _this._axis = new MutableValueDisposer();\n /**\r\n * A list of axis data items which fall within this break.\r\n */\n\n _this.dataItems = new List();\n _this.className = \"AxisBreak\"; // Set defaults\n\n _this.breakSize = 0.01;\n _this.marginLeft = -5;\n _this.marginRight = -5;\n _this.marginTop = -5;\n _this.marginBottom = -5;\n var interfaceColors = new InterfaceColorSet(); // Create elements\n // (these won't be used actually, just for setting properties)\n\n var fillShape = new WavedLine();\n fillShape.fill = interfaceColors.getFor(\"background\");\n fillShape.stroke = color();\n fillShape.fillOpacity = 0.9;\n fillShape.zIndex = 0;\n _this._fillShape = fillShape;\n var startLine = new WavedLine();\n startLine.fill = color();\n startLine.stroke = interfaceColors.getFor(\"grid\");\n startLine.strokeOpacity = 0.3;\n startLine.zIndex = 1;\n _this._startLine = startLine;\n var endLine = new WavedLine();\n endLine.fill = color();\n endLine.stroke = color(\"#000000\"); // interfaceColors.getFor(\"grid\");\n\n endLine.strokeOpacity = 0.3;\n endLine.zIndex = 2;\n _this._endLine = endLine;\n\n _this._disposers.push(_this._axis); // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n\n AxisBreak.prototype.dispose = function () {\n _super.prototype.dispose.call(this);\n\n if (this._fillShape) {\n this._fillShape.dispose();\n }\n\n if (this._startLine) {\n this._startLine.dispose();\n }\n\n if (this._endLine) {\n this._endLine.dispose();\n }\n };\n\n Object.defineProperty(AxisBreak.prototype, \"startLine\", {\n /**\r\n * @return Element\r\n */\n get: function get() {\n return this._startLine;\n },\n\n /**\r\n * An element used for the starting line of the break.\r\n *\r\n * @param sprite Element\r\n */\n set: function set(sprite) {\n if (this._startLine) {\n this._startLine.dispose();\n }\n\n this._startLine = sprite;\n this.addBreakSprite(sprite);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"endLine\", {\n /**\r\n * @return Element\r\n */\n get: function get() {\n return this._endLine;\n },\n\n /**\r\n * An element used for the end line of the break.\r\n *\r\n * @param sprite Element\r\n */\n set: function set(sprite) {\n if (this._endLine) {\n this._endLine.dispose();\n }\n\n this._endLine = sprite;\n this.addBreakSprite(sprite);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"fillShape\", {\n /**\r\n * @return Element\r\n */\n get: function get() {\n return this._fillShape;\n },\n\n /**\r\n * An element used for fill of the break.\r\n *\r\n * @param sprite Element\r\n */\n set: function set(sprite) {\n if (this._fillShape) {\n this._fillShape.dispose();\n }\n\n this._fillShape = sprite;\n this.addBreakSprite(sprite);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Adds a break element (e.g. lines, fill) to the break, which is\r\n * [[Container]].\r\n *\r\n * @ignore Exclude from docs\r\n * @param sprite Element to add\r\n */\n\n AxisBreak.prototype.addBreakSprite = function (sprite) {\n sprite.parent = this;\n sprite.isMeasured = false;\n\n this._disposers.push(sprite);\n };\n\n Object.defineProperty(AxisBreak.prototype, \"axis\", {\n /**\r\n * @return Axis\r\n */\n get: function get() {\n return this._axis.get();\n },\n\n /**\r\n * An Axis this Break is associated with.\r\n *\r\n * @param axis Axis\r\n */\n set: function set(axis) {\n if (this._axis.get() !== axis) {\n this._axis.set(axis, axis.renderer.gridContainer.events.on(\"transformed\", this.invalidate, this, false));\n\n axis.renderer.createBreakSprites(this); // this can't go to copyFrom, as axis is set later\n\n var breakTemplate = axis.axisBreaks.template;\n this.startLine.copyFrom(breakTemplate.startLine);\n this.endLine.copyFrom(breakTemplate.endLine);\n this.fillShape.copyFrom(breakTemplate.fillShape);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"breakSize\", {\n /**\r\n * @return Relative axis break\r\n */\n get: function get() {\n return this.getPropertyValue(\"breakSize\");\n },\n\n /**\r\n * A size of the break relative to the actual size of the scope break spans.\r\n *\r\n * For example, if `breakSize = 0.1` and unbroken scope of values it spans\r\n * would be 100 pixels, the break would be 10 pixels wide.\r\n *\r\n * 0 means the break will completely collapse and hide the values.\r\n * 1 means break would be not collapse at all, which would make it\r\n * effectively useless.\r\n *\r\n * @default 0.01\r\n * @param value Relative axis break\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"breakSize\", value)) {\n if (this.axis) {\n this.axis.invalidate();\n this.axis.invalidateSeries();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"startPoint\", {\n /**\r\n * Returns pixel coordinates of axis break's start.\r\n *\r\n * @return Start point\r\n */\n get: function get() {\n var renderer = this.axis.renderer;\n\n if (renderer) {\n return renderer.positionToPoint(this.startPosition);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"endPoint\", {\n /**\r\n * Returns pixel coordinates of axis break's end.\r\n *\r\n * @return End point\r\n */\n get: function get() {\n var renderer = this.axis.renderer;\n\n if (renderer) {\n return renderer.positionToPoint(this.endPosition);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"startPosition\", {\n /**\r\n * Returns a relative position at which axis break starts.\r\n *\r\n * This is a calculated position, meaning it shows relative position of the\r\n * break after break is applied.\r\n *\r\n * @return Start position\r\n */\n get: function get() {\n return;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"endPosition\", {\n /**\r\n * Returns a relative position at which axis break ends.\r\n *\r\n * This is a calculated position, meaning it shows relative position of the\r\n * break after break is applied.\r\n *\r\n * @return End position\r\n */\n get: function get() {\n return;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Draws the axis break.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n AxisBreak.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (this.axis) {\n var renderer = this.axis.renderer;\n renderer.updateBreakElement(this);\n }\n };\n\n Object.defineProperty(AxisBreak.prototype, \"startValue\", {\n /**\r\n * @return Starting value\r\n */\n get: function get() {\n return this.getPropertyValue(\"startValue\");\n },\n\n /**\r\n * A starting value for the break.\r\n *\r\n * @param value Starting value\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"startValue\", value)) {\n if (this.axis) {\n this.axis.invalidate();\n this.axis.invalidateSeries();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisBreak.prototype, \"endValue\", {\n /**\r\n * @return End value\r\n */\n get: function get() {\n return this.getPropertyValue(\"endValue\");\n },\n\n /**\r\n * An end value for the break.\r\n *\r\n * @param value End value\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"endValue\", value)) {\n if (this.axis) {\n this.axis.invalidate();\n this.axis.invalidateSeries();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n return AxisBreak;\n}(Container);\n\nexport { AxisBreak };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisBreak\"] = AxisBreak;","/**\r\n * Base class for all Axis\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Component } from \"../../core/Component\";\nimport { Container } from \"../../core/Container\";\nimport { DataItem } from \"../../core/DataItem\";\nimport { AxisBreak } from \"./AxisBreak\";\nimport { Label } from \"../../core/elements/Label\";\nimport { Tooltip } from \"../../core/elements/Tooltip\";\nimport { SortedListTemplate } from \"../../core/utils/SortedList\";\nimport { List, ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { Disposer, MultiDisposer } from \"../../core/utils/Disposer\";\nimport { registry } from \"../../core/Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $number from \"../../core/utils/Number\";\nimport * as $array from \"../../core/utils/Array\";\nimport * as $type from \"../../core/utils/Type\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[Axis]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar AxisDataItem =\n/** @class */\nfunction (_super) {\n __extends(AxisDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function AxisDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(AxisDataItem.prototype, \"grid\", {\n /**\r\n * @return Grid element\r\n */\n get: function get() {\n if (!this._grid) {\n var component_1 = this.component;\n\n if (component_1) {\n var template = void 0;\n var grid_1;\n\n if (this.isRange) {\n template = component_1.axisRanges.template.grid;\n\n if (template.disabled) {\n return;\n } else {\n grid_1 = template.clone();\n }\n } else {\n template = component_1.renderer.grid.template;\n\n if (template.disabled) {\n return;\n } else {\n grid_1 = component_1.renderer.grid.create();\n\n this._disposers.push(new Disposer(function () {\n component_1.renderer.grid.removeValue(grid_1);\n }));\n }\n }\n\n this.grid = grid_1;\n grid_1.shouldClone = false;\n\n this._disposers.push(grid_1);\n\n grid_1.axis = this.component;\n }\n }\n\n return this._grid;\n },\n\n /**\r\n * A [[Grid]] element associated with this data item.\r\n *\r\n * If there is no grid element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param grid Grid element\r\n */\n set: function set(grid) {\n if (this._grid && this._grid != grid) {\n $array.remove(this.sprites, this._grid);\n this._grid.dataItem = undefined;\n }\n\n if (grid) {\n if (grid.dataItem && grid.dataItem != this) {\n $array.remove(grid.dataItem.sprites, grid);\n grid.dataItem.grid = undefined;\n }\n\n this.addSprite(grid);\n }\n\n this._grid = grid;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"tick\", {\n /**\r\n * @return Tick element\r\n */\n get: function get() {\n if (!this._tick) {\n var component_2 = this.component;\n\n if (component_2) {\n var template = void 0;\n var tick_1;\n\n if (this.isRange) {\n template = component_2.axisRanges.template.tick;\n\n if (template.disabled) {\n return;\n } else {\n tick_1 = template.clone();\n }\n } else {\n template = component_2.renderer.ticks.template;\n\n if (template.disabled) {\n return;\n } else {\n tick_1 = component_2.renderer.ticks.create();\n\n this._disposers.push(new Disposer(function () {\n component_2.renderer.ticks.removeValue(tick_1);\n }));\n }\n }\n\n this.tick = tick_1;\n tick_1.axis = this.component;\n tick_1.shouldClone = false;\n\n this._disposers.push(tick_1);\n }\n }\n\n return this._tick;\n },\n\n /**\r\n * An [[AxisTick]] element associated with this data item.\r\n *\r\n * If there is no tick element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param tick Tick element\r\n */\n set: function set(tick) {\n if (this._tick && this._tick != tick) {\n $array.remove(this.sprites, this._tick);\n this._tick.dataItem = undefined;\n }\n\n if (tick) {\n if (tick.dataItem && tick.dataItem != this) {\n $array.remove(tick.dataItem.sprites, tick);\n tick.dataItem.tick = undefined;\n }\n\n this.addSprite(tick);\n }\n\n this._tick = tick;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"label\", {\n /**\r\n * @return Label element\r\n */\n get: function get() {\n if (!this._label) {\n var component_3 = this.component;\n\n if (component_3) {\n var template = void 0;\n var label_1;\n\n if (this.isRange) {\n template = component_3.axisRanges.template.label;\n\n if (template.disabled) {\n return;\n } else {\n label_1 = template.clone();\n }\n } else {\n template = component_3.renderer.labels.template;\n\n if (template.disabled) {\n return;\n } else {\n label_1 = component_3.renderer.labels.create();\n\n this._disposers.push(new Disposer(function () {\n component_3.renderer.labels.removeValue(label_1);\n }));\n }\n }\n\n this._disposers.push(label_1);\n\n this.label = label_1;\n label_1.shouldClone = false;\n label_1.axis = this.component;\n label_1.virtualParent = component_3;\n }\n }\n\n return this._label;\n },\n\n /**\r\n * An [[AxisLabel]] element associated with this data item.\r\n *\r\n * If there is no label element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param label Label element\r\n */\n set: function set(label) {\n if (this._label && this._label != label) {\n $array.remove(this.sprites, this._label);\n this._label.dataItem = undefined;\n }\n\n if (label) {\n if (label.dataItem && label.dataItem != this) {\n $array.remove(label.dataItem.sprites, label);\n label.dataItem.label = undefined;\n }\n\n this.addSprite(label);\n }\n\n this._label = label;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"axisFill\", {\n /**\r\n * @return Label element\r\n */\n get: function get() {\n if (!this._axisFill) {\n var component_4 = this.component;\n\n if (component_4) {\n var template = void 0;\n var axisFill_1;\n\n if (this.isRange) {\n template = component_4.axisRanges.template.axisFill;\n\n if (!this.isTemplate && template.disabled) {\n return;\n } else {\n axisFill_1 = template.clone();\n }\n } else {\n template = component_4.renderer.axisFills.template;\n\n if (template.disabled) {\n return;\n } else {\n axisFill_1 = component_4.renderer.axisFills.create();\n\n this._disposers.push(new Disposer(function () {\n component_4.renderer.axisFills.removeValue(axisFill_1);\n }));\n }\n }\n\n this.axisFill = axisFill_1;\n axisFill_1.shouldClone = false;\n\n this._disposers.push(axisFill_1);\n }\n }\n\n return this._axisFill;\n },\n\n /**\r\n * An [[AxisFill]] associated element with this data item.\r\n *\r\n * If there is no fill element associated with data item, a new one is\r\n * created and returned.\r\n *\r\n * @param label Label element\r\n */\n set: function set(axisFill) {\n if (this._axisFill && this._axisFill != axisFill) {\n $array.remove(this.sprites, this._axisFill);\n this._axisFill.dataItem = undefined;\n }\n\n if (axisFill) {\n if (axisFill.dataItem && axisFill.dataItem != this) {\n $array.remove(axisFill.dataItem.sprites, axisFill);\n axisFill.dataItem.axisFill = undefined;\n }\n\n axisFill.axis = this.component;\n this.addSprite(axisFill);\n }\n\n this._axisFill = axisFill;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"text\", {\n /**\r\n * @return Text label\r\n */\n get: function get() {\n return this._text;\n },\n\n /**\r\n * Text to be used as data item's label.\r\n *\r\n * @param text Text label\r\n */\n set: function set(text) {\n this._text = text;\n\n if (this._label) {\n // do not use getter, it will create unwanted instances!\n this._label.text = text;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"mask\", {\n /**\r\n * Data item's mask.\r\n *\r\n * @return Mask\r\n */\n get: function get() {\n return this._mask;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"contents\", {\n /**\r\n * Returns a [[Container]] to place all visual elements, related to data item\r\n * in.\r\n *\r\n * If there is no Container, a new one is created.\r\n *\r\n * @return Contents container\r\n */\n get: function get() {\n if (!this._contents) {\n var contents = new Container();\n this.addSprite(contents);\n contents.isMeasured = false;\n this._contents = contents;\n var component = this.component;\n\n if (component) {\n var mask = component.renderer.createFill(this.component);\n mask.disabled = false;\n mask.axis = component;\n this.addSprite(mask);\n this._mask = mask;\n contents.mask = mask;\n }\n }\n\n return this._contents;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisDataItem.prototype, \"axisBreak\", {\n /**\r\n * @return Axis break\r\n */\n get: function get() {\n return this._axisBreak;\n },\n\n /**\r\n * An [[AxisBreak]] this data item falls within.\r\n *\r\n * @param axisBreak Axis break\r\n */\n set: function set(axisBreak) {\n if (this._axisBreak) {\n this._axisBreak.dataItems.removeValue(this);\n }\n\n if (axisBreak) {\n axisBreak.dataItems.push(this);\n }\n\n this._axisBreak = axisBreak;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Re-draws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n AxisDataItem.prototype.validate = function () {\n if (this.component) {\n this.component.validateDataElement(this);\n }\n };\n /**\r\n * Appends data item's elements to the parent [[Container]].\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisDataItem.prototype.appendChildren = function () {\n if (this.component) {\n this.component.appendDataItem(this);\n }\n };\n /**\r\n * Checks if data item has particular property set.\r\n *\r\n * @param prop Property name\r\n * @return Property set?\r\n */\n\n\n AxisDataItem.prototype.hasProperty = function (prop) {\n return prop == \"component\" ? true : _super.prototype.hasProperty.call(this, prop);\n };\n /**\r\n * Copies all parameters from another [[AxisDataItem]].\r\n *\r\n * @param source Source AxisDataItem\r\n */\n\n\n AxisDataItem.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.text = source.text;\n\n if (source.bullet) {\n this.bullet = source.bullet.clone();\n }\n\n this.minPosition = source.minPosition;\n this.maxPosition = source.maxPosition;\n };\n /**\r\n * Sets visibility of the Data Item.\r\n *\r\n * @param value Data Item\r\n */\n\n\n AxisDataItem.prototype.setVisibility = function (value, noChangeValues) {\n _super.prototype.setVisibility.call(this, value, noChangeValues);\n\n if (this._contents) {\n this._contents.visible = value;\n }\n };\n\n Object.defineProperty(AxisDataItem.prototype, \"bullet\", {\n /**\r\n * @return Bullet\r\n */\n get: function get() {\n return this._bullet;\n },\n\n /**\r\n * Set it to an instance of any [[Sprite]]. It will be displayed as an axis\r\n * bullet in the middle of the cell, or specific value.\r\n *\r\n * If you need position bullet relatively to the cell, use [[AxisBullet]]\r\n * instead. It has a `location` property which can be used to indicate\r\n * precise relative location within cell/range.\r\n *\r\n * Also, [[AxisBullet]] is a [[Container]] so you can push any other element\r\n * into it.\r\n *\r\n * NOTE: `location` is relative to the parent axis range's scope, i.e.\r\n * between its `date` and `endDate` for [[DateAxis]], or `value`/`endValue`\r\n * ([[ValueAxis]]), or `category`/`endCategory` ([[categoryAxis]]).\r\n *\r\n * ```TypeScript\r\n * let range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * let flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JavaScript\r\n * var range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * var flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * // ...\r\n * \"axisRanges\": [{\r\n * \"date\": new Date(2018, 0, 5),\r\n * \"bullet: {\r\n * \"type\": \"FlagBullet\",\r\n * \"label\": {\r\n * \"text\": \"Hello\"\r\n * }\r\n * }\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.5.9\r\n * @param value Bullet\r\n */\n set: function set(value) {\n if (this._bullet && this._bullet != value) {\n $array.remove(this.sprites, this._bullet);\n this._bullet.dataItem = undefined;\n }\n\n this._bullet = value;\n\n if (value) {\n this.addSprite(value);\n }\n },\n enumerable: true,\n configurable: true\n });\n return AxisDataItem;\n}(DataItem);\n\nexport { AxisDataItem };\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines named positions for data item's location within [[Axis]].\r\n */\n\nexport var AxisItemLocation;\n\n(function (AxisItemLocation) {\n AxisItemLocation[AxisItemLocation[\"Start\"] = 0] = \"Start\";\n AxisItemLocation[AxisItemLocation[\"Middle\"] = 0.5] = \"Middle\";\n AxisItemLocation[AxisItemLocation[\"End\"] = 1] = \"End\";\n})(AxisItemLocation || (AxisItemLocation = {}));\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for all Axis elements.\r\n *\r\n * @see {@link IAxisEvents} for a list of available Events\r\n * @see {@link IAxisAdapters} for a list of available Adapters\r\n */\n\n\nvar Axis =\n/** @class */\nfunction (_super) {\n __extends(Axis, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Axis() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * Number of Grid elements on the axis.\r\n */\n\n\n _this._gridCount = 10;\n /**\r\n * A list of [[XYSeries]] that are using this Axis.\r\n */\n\n _this._series = new List();\n /**\r\n * Specifies if axis should be automatically disposed when removing from\r\n * chart's axis list.\r\n *\r\n * @default true\r\n */\n\n _this.autoDispose = true;\n /**\r\n * @ignore\r\n */\n\n _this._axisItemCount = 0;\n\n if (_this.constructor === Axis) {\n throw new Error(\"'Axis' cannot be instantiated directly. Please use a specific axis type.\");\n }\n\n _this.hideTooltipWhileZooming = true;\n _this.minWidth = 0.0001;\n _this.minHeight = 0.0001;\n _this.className = \"Axis\";\n _this.shouldClone = false;\n\n _this.setPropertyValue(\"cursorTooltipEnabled\", true);\n\n _this.toggleZoomOutButton = true;\n _this.zoomable = true;\n var interfaceColors = new InterfaceColorSet(); // Create title\n\n _this.title = new Label();\n _this.title.shouldClone = false;\n\n _this._disposers.push(_this.title);\n\n _this.setPropertyValue(\"startLocation\", 0);\n\n _this.setPropertyValue(\"endLocation\", 1); // Data item iterator\n\n\n _this._dataItemsIterator = new $iter.ListIterator(_this.dataItems, function () {\n return _this.dataItems.create();\n });\n _this._dataItemsIterator.createNewItems = true; // Create tooltip\n\n var tooltip = new Tooltip();\n\n _this._disposers.push(tooltip);\n\n tooltip.label.padding(5, 10, 5, 10);\n tooltip.background.pointerLength = 5;\n tooltip.fitPointerToBounds = true;\n tooltip.background.filters.clear(); // Set virtual parentfor the tooltip so that it can properly inheirt\n // formatters from the axis.\n\n tooltip.virtualParent = _this; // Create background element for the tooltip\n\n var background = tooltip.background;\n background.cornerRadius = 0;\n background.fill = interfaceColors.getFor(\"alternativeBackground\");\n background.stroke = background.fill;\n background.strokeWidth = 1;\n background.fillOpacity = 1;\n tooltip.label.fill = interfaceColors.getFor(\"alternativeText\");\n _this.tooltip = tooltip; // Accessibility\n\n _this.readerHidden = true;\n\n _this.events.on(\"rangechangestarted\", function () {\n _this.series.each(function (series) {\n if (series.hideTooltipWhileZooming) {\n series.tooltip.hide();\n series.tooltip.preventShow = true;\n }\n });\n\n if (_this.hideTooltipWhileZooming) {\n _this.tooltip.hide();\n\n _this.tooltip.preventShow = true;\n }\n }, undefined, false);\n\n _this.events.on(\"rangechangeended\", function () {\n _this.series.each(function (series) {\n if (series.hideTooltipWhileZooming) {\n series.tooltip.hide();\n series.tooltip.preventShow = false;\n }\n });\n\n if (_this.hideTooltipWhileZooming) {\n _this.tooltip.hide();\n\n _this.tooltip.preventShow = false;\n }\n }, undefined, false);\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Holds reference to a function that accepts a DataItem and its index as\r\n * parameters.\r\n *\r\n * It can either return a fill opacity for a fill, or manipulate data item\r\n * directly, to create various highlighting scenarios.\r\n *\r\n * For example, you can set it up to highlight only weekends on a\r\n * [[DateAxis]].\r\n */\n\n\n Axis.prototype.fillRule = function (dataItem, index) {\n if (!$type.isNumber(index)) {\n index = dataItem.index;\n }\n\n if (index / 2 == Math.round(index / 2)) {\n dataItem.axisFill.__disabled = true;\n dataItem.axisFill.opacity = 0;\n } else {\n dataItem.axisFill.opacity = 1;\n dataItem.axisFill.__disabled = false;\n }\n };\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n Axis.prototype.createDataItem = function () {\n return new AxisDataItem();\n };\n /**\r\n * Invalidates layout.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.invalidateLayout = function () {\n _super.prototype.invalidateLayout.call(this); // this puts series after axis in invalidation order also makes series update it's data items in case widht/height of a series is not 100%\n\n\n $iter.each(this.series.iterator(), function (series) {\n series.invalidateLayout();\n });\n };\n /**\r\n * Invalidates series of this axis.\r\n */\n\n\n Axis.prototype.invalidateSeries = function () {\n // this puts series after axis in invalidation order also makes series update it's data items in case widht/height of a series is not 100%\n $iter.each(this.series.iterator(), function (series) {\n series.invalidate();\n });\n };\n /**\r\n * Override to cancel super call for data element validation.\r\n * @ignore\r\n */\n\n\n Axis.prototype.validateDataElements = function () {\n this._axisItemCount = 0;\n\n if (this.ghostLabel) {\n this.renderer.updateLabelElement(this.ghostLabel, this.start, this.end);\n this.ghostLabel.validate();\n }\n };\n /**\r\n * Recalculates the number of grid items on the axis.\r\n */\n\n\n Axis.prototype.updateGridCount = function () {\n if (this.renderer) {\n var gridCount = this.axisLength / this.renderer.minGridDistance;\n\n if (gridCount != this._gridCount) {\n this._gridCount = gridCount;\n this.clearCache();\n }\n }\n };\n /**\r\n * Redraws the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.validateLayout = function () {\n this.axisFullLength = this.axisLength / (this.end - this.start);\n\n _super.prototype.validateLayout.call(this);\n\n this.updateGridCount();\n var renderer = this.renderer;\n\n if (renderer) {\n renderer.updateAxisLine();\n renderer.updateTooltip();\n renderer.updateBaseGridElement();\n }\n\n if (this._prevLength != this.axisLength) {\n this.dispatchImmediately(\"lengthchanged\");\n this._prevLength = this.axisLength;\n }\n };\n /**\r\n * Initializes Axis' renderer.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.initRenderer = function () {};\n /**\r\n * Adds a data item to the Axis.\r\n *\r\n * @param dataItem Data item\r\n */\n\n\n Axis.prototype.appendDataItem = function (dataItem) {\n var renderer = this.renderer;\n var tick = dataItem.tick;\n\n if (tick) {\n if (tick.above) {\n tick.parent = renderer.bulletsContainer;\n } else {\n tick.parent = renderer.gridContainer;\n }\n }\n\n if (dataItem.label) {\n dataItem.label.parent = renderer;\n }\n\n var axisFill = dataItem.axisFill;\n\n if (axisFill) {\n if (axisFill.above) {\n axisFill.parent = renderer.bulletsContainer;\n } else {\n axisFill.parent = renderer.gridContainer;\n }\n }\n\n var grid = dataItem.grid;\n\n if (grid) {\n if (grid.above) {\n grid.parent = renderer.bulletsContainer;\n } else {\n grid.parent = renderer.gridContainer;\n }\n }\n\n if (dataItem.bullet) {\n dataItem.bullet.parent = renderer.bulletsContainer;\n }\n };\n /**\r\n * Redraws Axis' related items.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.validate = function () {\n _super.prototype.validate.call(this);\n\n this.validateLayout();\n this.renderer.updateGridContainer();\n };\n /**\r\n * Redars Axis ranges.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.validateAxisRanges = function () {\n var _this = this;\n\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\n _this.appendDataItem(axisRange);\n\n _this.validateDataElement(axisRange);\n\n if (axisRange.grid) {\n axisRange.grid.validate();\n }\n\n if (axisRange.tick) {\n axisRange.tick.validate();\n }\n\n if (axisRange.axisFill) {\n axisRange.axisFill.validate();\n }\n\n if (axisRange.label) {\n axisRange.label.validate();\n }\n });\n };\n /**\r\n * Invalidates all axis breaks, so they are redrawn.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.validateBreaks = function () {\n if (this._axisBreaks) {\n $iter.each(this._axisBreaks.iterator(), function (axisBreak) {\n axisBreak.invalidate();\n });\n }\n };\n /**\r\n * Associates an Axis break with this Axis, after it is inserted into\r\n * `axisBreaks`.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n Axis.prototype.processBreak = function (event) {\n var axisBreak = event.newValue;\n axisBreak.parent = this.renderer.breakContainer;\n axisBreak.axis = this;\n };\n /**\r\n * Registers a [[XYSeries]] element with this Axis.\r\n *\r\n * Returns a [[Disposer]] for all events, added to Series for watching\r\n * changes in Axis, and vice versa.\r\n * @ignore\r\n * @param series Series\r\n * @return Event disposer\r\n */\n\n\n Axis.prototype.registerSeries = function (series) {\n var _this = this;\n\n this.series.moveValue(series);\n return new MultiDisposer([new Disposer(function () {\n _this.series.removeValue(series);\n }), this.events.on(\"lengthchanged\", series.invalidate, series, false), this.events.on(\"lengthchanged\", series.createMask, series, false), this.events.on(\"startchanged\", series.invalidate, series, false), this.events.on(\"endchanged\", series.invalidate, series, false)]);\n };\n\n Object.defineProperty(Axis.prototype, \"renderer\", {\n /**\r\n * @return Renderer\r\n */\n get: function get() {\n return this._renderer;\n },\n\n /**\r\n * An [[AxisRenderer]] to be used to render this Axis.\r\n *\r\n * Please note that most of the settings, related to Axis' appearance are set\r\n * via its renderer. Not directly on the Axis.\r\n *\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * axis.renderer.inside = true;\r\n * axis.renderer.minLabelPosition = 0.1;\r\n * axis.renderer.maxLabelPosition = 0.9;\r\n * ```\r\n * ```JavaScript\r\n * axis.renderer.inside = true;\r\n * axis.renderer.minLabelPosition = 0.1;\r\n * axis.renderer.maxLabelPosition = 0.9;\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/} for more info\r\n * @param renderer Renderer\r\n */\n set: function set(renderer) {\n if (renderer != this._renderer) {\n this._renderer = renderer;\n renderer.chart = this.chart;\n renderer.axis = this;\n renderer.parent = this;\n this.title.parent = this; // we add title to axis and set layout in renderer to avoid one extra container, as otherwise axis container would be used for holding renderer only\n\n this.initRenderer();\n\n this._disposers.push(renderer.gridContainer.events.on(\"maxsizechanged\", this.invalidate, this, false));\n\n var ghostLabel_1 = this.renderer.labels.create();\n\n this._disposers.push(ghostLabel_1);\n\n ghostLabel_1.dataItem = this.dataItems.template.clone(); // just for the adapters not to fail\n\n ghostLabel_1.text = \"L\";\n ghostLabel_1.parent = this.renderer;\n ghostLabel_1.shouldClone = false;\n ghostLabel_1.fillOpacity = 0;\n ghostLabel_1.opacity = 0;\n ghostLabel_1.strokeOpacity = 0;\n ghostLabel_1.interactionsEnabled = false;\n ghostLabel_1.validate();\n this.ghostLabel = ghostLabel_1;\n this.events.on(\"beforedatavalidated\", function () {\n ghostLabel_1.text = \"L\";\n }, undefined, false);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts a relative position to angle. (for circular axes)\r\n *\r\n * @param position Position (0-1)\r\n * @return Angle\r\n */\n\n Axis.prototype.positionToAngle = function (position) {\n return this.renderer.positionToAngle(position);\n };\n /**\r\n * Converts pixel coordinates to a relative position. (0-1)\r\n *\r\n * @param point Coorinates (px)\r\n * @return Position (0-1)\r\n */\n\n\n Axis.prototype.pointToPosition = function (point) {\n return this.renderer.pointToPosition(point);\n };\n /**\r\n * Converts relative position to coordinate.\r\n *\r\n * @since 4.7.15\r\n * @param position (0-1)\r\n * @return coordinate (px)\r\n */\n\n\n Axis.prototype.positionToCoordinate = function (position) {\n return this.renderer.positionToCoordinate(position);\n };\n /**\r\n * [getAnyRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param start [description]\r\n * @param end [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getAnyRangePath = function (start, end) {\n return this.renderer.getPositionRangePath(start, end);\n };\n /**\r\n * Converts any positional parameter to a relative position on axis.\r\n *\r\n * @todo Description (review)\r\n * @param value Pisition\r\n * @return Position (0-1)\r\n */\n\n\n Axis.prototype.anyToPosition = function (value) {\n return 0;\n };\n /**\r\n * Converts any positional parameter to a relative position on axis.\r\n *\r\n * @todo Description (review)\r\n * @param value Pisition\r\n * @return Orientation point\r\n */\n\n\n Axis.prototype.anyToPoint = function (value) {\n return {\n x: 0,\n y: 0,\n angle: 0\n };\n };\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition [description]\r\n * @param endPosition [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getPositionRangePath = function (startPosition, endPosition) {\n if (this.renderer) {\n return this.renderer.getPositionRangePath(startPosition, endPosition);\n }\n\n return \"\";\n };\n\n Object.defineProperty(Axis.prototype, \"axisLength\", {\n /**\r\n * Actual axis length in pixels.\r\n *\r\n * @return Axis length (px)\r\n */\n get: function get() {\n if (this.renderer) {\n return this.renderer.axisLength;\n }\n\n return 0;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"cursorTooltipEnabled\", {\n /**\r\n * @return Display tooltip?\r\n */\n get: function get() {\n return this.getPropertyValue(\"cursorTooltipEnabled\");\n },\n\n /**\r\n * Indicates if axis should display a tooltip for chart's cursor.\r\n *\r\n * @param value Display tooltip?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"cursorTooltipEnabled\", value)) {\n if (value && this.renderer) {\n this.renderer.updateTooltip();\n } else if (this.tooltip) {\n this.tooltip.hide(0);\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"toggleZoomOutButton\", {\n /**\r\n * @return Toggle zoom out button?\r\n */\n get: function get() {\n return this.getPropertyValue(\"toggleZoomOutButton\");\n },\n\n /**\r\n * Normally, when axis is zoomed in, a zoom out button is shown by a chart,\r\n * and vice versa: when axis is zoomed out completely, zoom out button is\r\n * hidden.\r\n *\r\n * Setting this to `false` will disable this behavior. Zooming in our out\r\n * this axis will not reveal or hide zoom out button.\r\n *\r\n * @default true\r\n * @since 4.6.2\r\n * @param value Toggle zoom out button?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"toggleZoomOutButton\", value);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Hides element's [[Tooltip]].\r\n *\r\n * @see {@link Tooltip}\r\n */\n\n Axis.prototype.hideTooltip = function (duration) {\n _super.prototype.hideTooltip.call(this, duration);\n\n this._tooltipPosition = undefined;\n };\n /**\r\n * Shows Axis tooltip at specific relative position within Axis. (0-1)\r\n *\r\n * @param position Position (0-1)\r\n * @param local or global position\r\n */\n\n\n Axis.prototype.showTooltipAtPosition = function (position, local) {\n var tooltip = this._tooltip;\n\n if (!tooltip || this.dataItems.length <= 0) {\n this._tooltipPosition = undefined;\n } else {\n if (!local) {\n position = this.toAxisPosition(position);\n }\n\n if (!$type.isNumber(position) || position < this.start || position > this.end) {\n tooltip.hide(0);\n this._tooltipPosition = undefined;\n return;\n }\n\n var renderer = this.renderer; //@todo: think of how to solve this better\n\n if (!tooltip.parent) {\n tooltip.parent = this.tooltipContainer;\n }\n\n var tooltipLocation = renderer.tooltipLocation;\n var startPosition = this.getCellStartPosition(position);\n var endPosition = this.getCellEndPosition(position);\n\n if (this.tooltipPosition == \"fixed\") {\n position = startPosition + (endPosition - startPosition) * tooltipLocation;\n }\n\n position = $math.fitToRange(position, this.start, this.end);\n\n if (this._tooltipPosition != position) {\n this._tooltipPosition = position;\n var tooltipLocation2 = renderer.tooltipLocation2;\n var startPoint = renderer.positionToPoint(startPosition, tooltipLocation2);\n var endPoint = renderer.positionToPoint(endPosition, tooltipLocation2); // save values so cursor could use them\n\n this.currentItemStartPoint = startPoint;\n this.currentItemEndPoint = endPoint;\n\n if (renderer.fullWidthTooltip) {\n tooltip.width = endPoint.x - startPoint.x;\n tooltip.height = endPoint.y - startPoint.y;\n }\n\n var point = renderer.positionToPoint(position, tooltipLocation2);\n var globalPoint = $utils.spritePointToSvg(point, this.renderer.line);\n tooltip.text = this.getTooltipText(position);\n\n if (tooltip.text) {\n tooltip.delayedPointTo(globalPoint);\n tooltip.show();\n }\n }\n\n if (!this.cursorTooltipEnabled || this.tooltip.disabled) {\n tooltip.hide(0);\n }\n }\n };\n /**\r\n * Converts relative position (0-1) to Axis position with zoom level and\r\n * inversed taken into account.\r\n *\r\n * @param position Global position (0-1)\r\n * @return Position within Axis (0-1)\r\n */\n\n\n Axis.prototype.toAxisPosition = function (position) {\n position = this.renderer.toAxisPosition(position);\n\n if (position == undefined) {\n return;\n }\n\n position = position * (this.end - this.start);\n\n if (this.renderer.inversed) {\n position = this.end - position;\n } else {\n position = this.start + position;\n }\n\n return position;\n };\n /**\r\n * Converts position on the axis with zoom level and\r\n * inversed taken into account to global position.\r\n *\r\n * @param position Axis position (0-1)\r\n * @return Global position (0-1)\r\n */\n\n\n Axis.prototype.toGlobalPosition = function (position) {\n if (this.renderer.inversed) {\n position = this.end - position;\n } else {\n position = position - this.start;\n }\n\n return position / (this.end - this.start);\n };\n /**\r\n * Returns text to be used for cursor's Axis tooltip.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position coordinate (px)\r\n * @return Label text\r\n */\n\n\n Axis.prototype.getTooltipText = function (position) {\n return;\n };\n /**\r\n * Updates Axis' tooltip's position and possibly size, and pointer (stem)\r\n * place.\r\n *\r\n * @ignore Exclude from docs\r\n * @param pointerOrientation Pointer (stem) orientation\r\n * @param boundingRectangle A rectangle for tooltip to fit within\r\n */\n\n\n Axis.prototype.updateTooltip = function (pointerOrientation, boundingRectangle) {\n var tooltip = this._tooltip;\n\n if (tooltip) {\n tooltip.fixDoc = false;\n tooltip.pointerOrientation = pointerOrientation;\n tooltip.setBounds($utils.spriteRectToSvg(boundingRectangle, this.renderer.line));\n }\n };\n /**\r\n * [roundPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param position Relative position\r\n * @param location Location on axis\r\n * @return Rounded position\r\n */\n\n\n Axis.prototype.roundPosition = function (position, location, axisLocation) {\n return position;\n };\n /**\r\n * [getCellStartPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param position [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getCellStartPosition = function (position) {\n return position;\n };\n /**\r\n * [getCellEndPosition description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param position [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getCellEndPosition = function (position) {\n return position;\n };\n\n Object.defineProperty(Axis.prototype, \"axisRanges\", {\n /**\r\n * A list of axis ranges for this Axis.\r\n *\r\n * @return Axis ranges\r\n */\n get: function get() {\n if (!this._axisRanges) {\n var dataItem = this.createDataItem();\n dataItem.isRange = true;\n dataItem.axisFill = this.renderer.axisFills.template.clone();\n dataItem.grid = this.renderer.grid.template.clone();\n dataItem.tick = this.renderer.ticks.template.clone();\n dataItem.label = this.renderer.labels.template.clone();\n dataItem.isTemplate = true;\n dataItem.component = this;\n dataItem.axisFill.disabled = false;\n dataItem.tick.disabled = false;\n dataItem.grid.disabled = false;\n dataItem.label.disabled = false;\n this._axisRanges = new ListTemplate(dataItem);\n\n this._axisRanges.events.on(\"inserted\", this.processAxisRange, this, false);\n\n this._disposers.push(new ListDisposer(this._axisRanges));\n\n this._disposers.push(this._axisRanges.template);\n }\n\n return this._axisRanges;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Decorates an axis range after it has been added to the axis range list.\r\n *\r\n * @param event Event\r\n */\n\n Axis.prototype.processAxisRange = function (event) {\n var axisRange = event.newValue;\n axisRange.component = this;\n axisRange.isRange = true;\n };\n\n Object.defineProperty(Axis.prototype, \"axisBreaks\", {\n /**\r\n * A list of axis breaks on this Axis.\r\n *\r\n * @return Axis breaks.\r\n */\n get: function get() {\n if (!this._axisBreaks) {\n this._axisBreaks = new SortedListTemplate(this.createAxisBreak(), function (a, b) {\n return $number.order(a.adjustedStartValue, b.adjustedStartValue);\n });\n\n this._axisBreaks.events.on(\"inserted\", this.processBreak, this, false);\n\n this._disposers.push(new ListDisposer(this._axisBreaks));\n\n this._disposers.push(this._axisBreaks.template);\n }\n\n return this._axisBreaks;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates a new axis break.\r\n *\r\n * @return Axis break\r\n */\n\n Axis.prototype.createAxisBreak = function () {\n return new AxisBreak();\n };\n\n Object.defineProperty(Axis.prototype, \"series\", {\n /**\r\n * A list of Series currently associated with this Axis.\r\n *\r\n * @return Series\r\n */\n get: function get() {\n if (!this._series) {\n this._series = new List();\n }\n\n return this._series;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Processes Series' data items.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Axis.prototype.processSeriesDataItems = function () {};\n /**\r\n * Processes Series' single data item.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\n\n\n Axis.prototype.processSeriesDataItem = function (dataItem, axisLetter) {};\n /**\r\n * Post-processes Serie's data items.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.postProcessSeriesDataItems = function (series) {};\n /**\r\n * Post-processes Serie's single data item.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\n\n\n Axis.prototype.postProcessSeriesDataItem = function (dataItem) {}; //\n\n /**\r\n * Updates Axis based on all Series that might influence it.\r\n *\r\n * Called by Series after Series data is validated.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.updateAxisBySeries = function () {};\n /**\r\n * Hides unused data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Axis.prototype.hideUnusedDataItems = function () {\n var _this = this; // hide all unused\n\n\n var dataItemsIterator = this._dataItemsIterator;\n dataItemsIterator.createNewItems = false;\n $iter.each(dataItemsIterator.iterator(), function (dataItem) {\n _this.validateDataElement(dataItem); // solves shrinking\n\n\n dataItem.__disabled = true;\n });\n dataItemsIterator.clear();\n dataItemsIterator.createNewItems = true;\n };\n /**\r\n * Returns a Series' data item that corresponds to specific position on Axis.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @param series Series\r\n * @param position Position (0-1)\r\n * @param findNearest Should axis try to find nearest tooltip if there is no data item at exact position\r\n * @return Data item\r\n */\n\n\n Axis.prototype.getSeriesDataItem = function (series, position, findNearest) {\n return;\n };\n /**\r\n * Returns an angle that corresponds to specific position on axis.\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key ???\r\n * @param location Location\r\n * @param stackKey ???\r\n * @return Angle\r\n */\n\n\n Axis.prototype.getAngle = function (dataItem, key, location, stackKey, range) {\n return;\n };\n /**\r\n * [getX description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getX = function (dataItem, key, location, stackKey, range) {\n return;\n };\n /**\r\n * [getX description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getPositionX = function (dataItem, key, location, stackKey, range) {\n return;\n };\n /**\r\n * [getY description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getY = function (dataItem, key, location, stackKey, range) {\n return;\n };\n /**\r\n * [getY description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem [description]\r\n * @param key [description]\r\n * @param location [description]\r\n * @param stackKey [description]\r\n * @return [description]\r\n */\n\n\n Axis.prototype.getPositionY = function (dataItem, key, location, stackKey, range) {\n return;\n };\n\n Object.defineProperty(Axis.prototype, \"basePoint\", {\n /**\r\n * Coordinates of the actual axis start.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Base point coordinates\r\n */\n get: function get() {\n return {\n x: 0,\n y: 0\n };\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n Axis.prototype.dataChangeUpdate = function () {};\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n\n Axis.prototype.seriesDataChangeUpdate = function (series) {};\n /**\r\n * Removes axis breaks that fall between `min` and `max` (???)\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param min Start value\r\n * @param max End value\r\n * @return Spread o\r\n */\n\n\n Axis.prototype.adjustDifference = function (min, max) {\n var difference = max - min;\n\n if ($type.isNumber(difference)) {\n if (this._axisBreaks) {\n $iter.eachContinue(this._axisBreaks.iterator(), function (axisBreak) {\n var startValue = axisBreak.adjustedStartValue;\n var endValue = axisBreak.adjustedEndValue;\n\n if ($type.isNumber(startValue) && $type.isNumber(endValue)) {\n // breaks are sorted, we don't need go further anymore\n if (startValue > max) {\n return false;\n }\n\n if (endValue >= min) {\n if ($type.isNumber(startValue) && $type.isNumber(endValue)) {\n var breakSize = axisBreak.breakSize;\n var intersection = $math.intersection({\n start: startValue,\n end: endValue\n }, {\n start: min,\n end: max\n });\n\n if (intersection) {\n difference -= (intersection.end - intersection.start) * (1 - breakSize);\n }\n }\n }\n\n return true;\n }\n });\n }\n\n return difference;\n }\n };\n /**\r\n * Checks if specific value falls within a break.\r\n *\r\n * Returns [[AxisBreak]] the value falls into.\r\n *\r\n * @param value Value to check\r\n * @return Axis break\r\n */\n\n\n Axis.prototype.isInBreak = function (value) {\n if (this._axisBreaks) {\n return $iter.find(this._axisBreaks.iterator(), function (axisBreak) {\n return value >= axisBreak.adjustedStartValue && value <= axisBreak.adjustedEndValue;\n });\n }\n };\n /**\r\n * [fixAxisBreaks description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n\n Axis.prototype.fixAxisBreaks = function () {\n var _this = this;\n\n if (this._axisBreaks) {\n var axisBreaks = this._axisBreaks;\n\n if (axisBreaks.length > 0) {\n // first make sure that startValue is <= end value\n // This needs to make a copy of axisBreaks because it mutates the list while traversing\n // TODO very inefficient\n $array.each($iter.toArray(axisBreaks.iterator()), function (axisBreak) {\n var startValue = $math.min(axisBreak.startValue, axisBreak.endValue);\n var endValue = $math.max(axisBreak.startValue, axisBreak.endValue);\n axisBreak.adjustedStartValue = startValue;\n axisBreak.adjustedEndValue = endValue;\n\n _this._axisBreaks.update(axisBreak);\n });\n var firstAxisBreak = axisBreaks.first;\n var previousEndValue_1 = Math.min(firstAxisBreak.startValue, firstAxisBreak.endValue); // process breaks\n // TODO does this need to call axisBreaks.update ?\n\n $iter.each(axisBreaks.iterator(), function (axisBreak) {\n var startValue = axisBreak.adjustedStartValue;\n var endValue = axisBreak.adjustedEndValue; // breaks can't overlap\n // if break starts before previous break ends\n\n if (startValue < previousEndValue_1) {\n startValue = previousEndValue_1;\n\n if (endValue < previousEndValue_1) {\n endValue = previousEndValue_1;\n }\n }\n\n axisBreak.adjustedStartValue = startValue;\n axisBreak.adjustedEndValue = endValue;\n });\n }\n }\n };\n\n Object.defineProperty(Axis.prototype, \"startIndex\", {\n /**\r\n * @ignore Exclude from docs\r\n * @return [description]\r\n */\n get: function get() {\n return 0;\n },\n\n /**\r\n * We need start/end indexes of axes to be 0 - `dataItems.length`.\r\n *\r\n * Yes, also for category axis, this helps to avoid jumping of categories\r\n * while scrolling and does not do a lot of extra work as we use\r\n * protected `_startIndex` and `_endIndex` when working with items.\r\n *\r\n * @hidden\r\n */\n\n /**\r\n * [startIndex description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n */\n set: function set(value) {},\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"endIndex\", {\n /**\r\n * @ignore Exclude from docs\r\n * @return [description]\r\n */\n get: function get() {\n return this.dataItems.length;\n },\n\n /**\r\n * [endIndex description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n */\n set: function set(value) {},\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns a formatted label based on position.\r\n *\r\n * Individual axis types should override this method to generate a label\r\n * that is relevant to axis type.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\n\n Axis.prototype.getPositionLabel = function (position) {\n return Math.round(position * 100) + \"%x\";\n };\n\n Object.defineProperty(Axis.prototype, \"chart\", {\n /**\r\n * @return Chart\r\n */\n get: function get() {\n return this._chart;\n },\n\n /**\r\n * A Chart this Axis belongs to.\r\n *\r\n * @param value Chart\r\n */\n set: function set(value) {\n this._chart = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates a data item for a Series range.\r\n *\r\n * @param series Target Series\r\n * @return Range data item\r\n */\n\n Axis.prototype.createSeriesRange = function (series) {\n var range = this.axisRanges.create();\n range.component = this;\n range.axisFill = this.renderer.axisFills.template.clone();\n range.axisFill.disabled = false;\n range.axisFill.fillOpacity = 0;\n range.grid = this.renderer.grid.template.clone();\n range.grid.disabled = true;\n range.tick = this.renderer.ticks.template.clone();\n range.tick.disabled = true;\n range.label = this.renderer.labels.template.clone();\n range.label.disabled = true;\n range.addDisposer(new Disposer(function () {\n series.axisRanges.removeValue(range);\n }));\n series.axisRanges.push(range);\n return range;\n };\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\n\n\n Axis.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n if (this.renderer) {\n this.renderer.copyFrom(source.renderer);\n } else {\n if (source.renderer) {\n this.renderer = source.renderer.clone();\n\n this._disposers.push(this.renderer);\n }\n }\n\n if (source.title) {\n if (!this.title) {\n this.title = source.title.clone();\n this.title.parent = this;\n } else {\n this.title.copyFrom(source.title);\n }\n\n this._disposers.push(this.title);\n }\n };\n /**\r\n * Resets internal iterator.\r\n */\n\n\n Axis.prototype.resetIterators = function () {\n this._dataItemsIterator.reset();\n };\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n\n Axis.prototype.processConfig = function (config) {\n if (config) {\n // Set up axis ranges\n if ($type.hasValue(config.axisRanges) && $type.isArray(config.axisRanges)) {\n for (var i = 0, len = config.axisRanges.length; i < len; i++) {\n var range = config.axisRanges[i]; // If `series` is set, we know it's a series range\n\n if ($type.hasValue(range[\"series\"])) {\n if ($type.isString(range[\"series\"])) {\n if (this.map.hasKey(range[\"series\"])) {\n //range[\"series\"] = this.map.getKey(range[\"series\"]);\n config.axisRanges[i] = this.createSeriesRange(this.map.getKey(range[\"series\"]));\n delete range[\"series\"];\n config.axisRanges[i].config = range;\n }\n }\n }\n }\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n /**\r\n * Ordering function used in JSON setup.\r\n *\r\n * @param a Item A\r\n * @param b Item B\r\n * @return Order\r\n */\n\n\n Axis.prototype.configOrder = function (a, b) {\n if (a == b) {\n return 0;\n } // last\n else if (a == \"title\") {\n return 1;\n } else if (b == \"title\") {\n return -1;\n } // first\n else if (a == \"component\") {\n return -1;\n } else if (b == \"component\") {\n return 1;\n } else {\n return _super.prototype.configOrder.call(this, a, b);\n }\n };\n\n Object.defineProperty(Axis.prototype, \"startLocation\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"startLocation\");\n },\n\n /**\r\n * Axis start location. Works on Date/Category axis, doesn't work on Value axis.\r\n *\r\n * * 0 - Full first cell is shown.\r\n * * 0.5 - Half of first cell is shown.\r\n * * 1 - None of the first cell is visible. (you probably don't want that)\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"startLocation\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"endLocation\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"endLocation\");\n },\n\n /**\r\n * Axis end location. Works on Date/Category axis, doesn't work on Value axis.\r\n *\r\n * * 0 - None of the last cell is shown. (don't do that)\r\n * * 0.5 - Half of the last cell is shown.\r\n * * 1 - Full last cell is shown.\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"endLocation\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n\n Axis.prototype.setDisabled = function (value) {\n var changed = _super.prototype.setDisabled.call(this, value);\n\n if (this.renderer) {\n this.renderer.gridContainer.disabled = value;\n }\n\n return changed;\n };\n\n Object.defineProperty(Axis.prototype, \"title\", {\n /**\r\n * @return Title label\r\n */\n get: function get() {\n return this._title;\n },\n\n /**\r\n * A reference to a [[Label]] element which serves as a title to the axis.\r\n *\r\n * When axis is created it aleready has an element, so you can just modify\r\n * it.\r\n *\r\n * Or you can replace it with your own instance of `Label`.\r\n *\r\n * @param value Title label\r\n */\n set: function set(value) {\n if (this._title && this._title != value) {\n this._title.dispose();\n }\n\n if (value) {\n this._title = value;\n value.parent = this;\n value.shouldClone = false;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"hideTooltipWhileZooming\", {\n /**\r\n * @return Hide tooltip while zooming?\r\n */\n get: function get() {\n return this.getPropertyValue(\"hideTooltipWhileZooming\");\n },\n\n /**\r\n * Indicates if axis' tooltip should be hidden while axis range is animating\r\n * (zooming)\r\n *\r\n * @default true\r\n * @since 4.7.16\r\n * @param value Hide tooltip while zooming?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"hideTooltipWhileZooming\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"zoomable\", {\n /**\r\n * @return Zoomable?\r\n */\n get: function get() {\n return this.getPropertyValue(\"zoomable\");\n },\n\n /**\r\n * Should the axis be zoomed with scrollbar/cursor?\r\n *\r\n * @default true\r\n * @since 4.9.28\r\n * @param value Zoomable?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"zoomable\", value);\n },\n enumerable: true,\n configurable: true\n });\n return Axis;\n}(Component);\n\nexport { Axis };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Axis\"] = Axis;\nregistry.registeredClasses[\"AxisDataItem\"] = AxisDataItem;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Disable axis tooltips.\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.maybeXS,\n state: function state(target, stateId) {\n if (target instanceof Axis && target.tooltip) {\n var state = target.states.create(stateId);\n state.properties.cursorTooltipEnabled = false;\n return state;\n }\n\n return null;\n }\n});","/**\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../../core/Sprite\";\nimport { registry } from \"../../core/Registry\";\nimport { color } from \"../../core/utils/Color\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw Axis line.\r\n *\r\n * @see {@link IAxisLineEvents} for a list of available events\r\n * @see {@link IAxisLineAdapters} for a list of available Adapters\r\n */\n\nvar AxisLine =\n/** @class */\nfunction (_super) {\n __extends(AxisLine, _super);\n /**\r\n * Constructor\r\n */\n\n\n function AxisLine() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisLine\";\n _this.element = _this.paper.add(\"path\");\n var interfaceColors = new InterfaceColorSet();\n _this.stroke = interfaceColors.getFor(\"grid\");\n _this.strokeOpacity = 0.15;\n _this.pixelPerfect = true;\n _this.fill = color();\n\n _this.applyTheme();\n\n _this.interactionsEnabled = false;\n return _this; //this.element.moveTo({ x: 0, y: 0 });\n }\n\n return AxisLine;\n}(Sprite);\n\nexport { AxisLine };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisLine\"] = AxisLine;","import { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../../core/Sprite\";\nimport { registry } from \"../../core/Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * AxisFill is a base class used to defines fill shapes for various\r\n * type-specific Axes.\r\n *\r\n * Axis fills are used to add fills to specific ranges of those axes.\r\n *\r\n * @see {@link IAxisFillEvents} for a list of available events\r\n * @see {@link IAxisFillAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar AxisFill =\n/** @class */\nfunction (_super) {\n __extends(AxisFill, _super);\n /**\r\n * Constructor.\r\n *\r\n * @param axis Axis\r\n */\n\n\n function AxisFill(axis) {\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this.element = _this.paper.add(\"path\");\n _this.className = \"AxisFill\";\n _this.isMeasured = false;\n _this.location = 0;\n _this.above = false;\n var interfaceColors = new InterfaceColorSet();\n _this.fill = interfaceColors.getFor(\"alternativeBackground\");\n _this.fillOpacity = 0;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n AxisFill.prototype.setDisabled = function (value) {\n var changed = _super.prototype.setDisabled.call(this, value);\n\n if (this.axis) {\n this.axis.invalidateDataItems();\n }\n\n return changed;\n };\n /**\r\n * Draws the fill element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisFill.prototype.draw = function () {\n _super.prototype.draw.call(this);\n\n if (this.__disabled || this.disabled) {\n return;\n }\n\n if (this.axis && $type.isNumber(this.startPosition) && $type.isNumber(this.endPosition)) {\n this.fillPath = this.axis.getPositionRangePath(this.startPosition, this.endPosition);\n this.path = this.fillPath;\n\n if (this.isMeasured) {\n this.measure();\n }\n }\n };\n\n Object.defineProperty(AxisFill.prototype, \"startPosition\", {\n /**\r\n * @return Start position\r\n */\n get: function get() {\n return this.getPropertyValue(\"startPosition\");\n },\n\n /**\r\n * An actual starting position of the fill.\r\n *\r\n * @param value Starting position\r\n */\n set: function set(value) {\n this.setPropertyValue(\"startPosition\", value);\n this.invalidate(); // this is needed as relative position might not change when zooming\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisFill.prototype, \"endPosition\", {\n /**\r\n * @return End position\r\n */\n get: function get() {\n return this.getPropertyValue(\"endPosition\");\n },\n\n /**\r\n * An actual end position of the fill.\r\n *\r\n * @param value End position\r\n */\n set: function set(value) {\n this.setPropertyValue(\"endPosition\", value);\n this.invalidate(); // this is needed as relative position might not change when zooming\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisFill.prototype, \"location\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"location\");\n },\n\n /**\r\n * Relative location of the fill. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"location\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n AxisFill.prototype.setPath = function (value) {\n if (this.setPropertyValue(\"path\", value)) {\n this.element.attr({\n \"d\": value\n });\n return true;\n }\n\n return false;\n };\n\n Object.defineProperty(AxisFill.prototype, \"above\", {\n /**\r\n * @return Draw above series?\r\n */\n get: function get() {\n return this.getPropertyValue(\"above\");\n },\n\n /**\r\n * Normally fill goes below series. Set this to `true` to go above.\r\n *\r\n * @default false\r\n * @since 4.5.9\r\n * @param value Draw above series?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"above\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return AxisFill;\n}(Sprite);\n\nexport { AxisFill };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisFill\"] = AxisFill;","/**\r\n * A module defining functionality for axis grid elements.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../../core/Sprite\";\nimport { registry } from \"../../core/Registry\";\nimport { color } from \"../../core/utils/Color\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Displays an axis grid line.\r\n *\r\n * @see {@link IGridEvents} for a list of available events\r\n * @see {@link IGridAdapters} for a list of available Adapters\r\n * @todo Review: container is better, as we'll be able to attach something to the grid, also with 3d charts we might need some additional elements\r\n * @important\r\n */\n\nvar Grid =\n/** @class */\nfunction (_super) {\n __extends(Grid, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Grid() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Grid\";\n _this.element = _this.paper.add(\"path\");\n _this.location = 0.5;\n _this.isMeasured = false;\n _this.above = false;\n var interfaceColors = new InterfaceColorSet();\n _this.stroke = interfaceColors.getFor(\"grid\");\n _this.pixelPerfect = true;\n _this.strokeOpacity = 0.15;\n _this.fill = color(); // \"none\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Grid.prototype, \"location\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"location\");\n },\n\n /**\r\n * Location within axis cell to place grid line on.\r\n *\r\n * * 0 - start\r\n * * 0.5 - middle\r\n * * 1 - end\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"location\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Grid.prototype, \"above\", {\n /**\r\n * @return Draw above series?\r\n */\n get: function get() {\n return this.getPropertyValue(\"above\");\n },\n\n /**\r\n * Normally fill goes below series. Set this to `true` to go above.\r\n *\r\n * @default false\r\n * @since 4.5.9\r\n * @param value Draw above series?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"above\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n Grid.prototype.setDisabled = function (value) {\n var changed = _super.prototype.setDisabled.call(this, value);\n\n if (this.axis) {\n this.axis.invalidateDataItems();\n }\n\n return changed;\n };\n\n return Grid;\n}(Sprite);\n\nexport { Grid };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Grid\"] = Grid;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Disable grid on smaller charts\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.maybeXS,\n state: function state(target, stateId) {\n if (target instanceof Grid) {\n var state = target.states.create(stateId);\n state.properties.disabled = true;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * Axis Label module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Label } from \"../../core/elements/Label\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Use to create labels on Axis.\r\n *\r\n * @see {@link IAxisLabelEvents} for a list of available events\r\n * @see {@link IAxisLabelAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar AxisLabel =\n/** @class */\nfunction (_super) {\n __extends(AxisLabel, _super);\n /**\r\n * Constructor\r\n */\n\n\n function AxisLabel() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisLabel\";\n _this.isMeasured = false;\n\n _this.padding(10, 10, 10, 10);\n\n _this.location = 0.5; //this.nonScaling = true; // not good for perf\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(AxisLabel.prototype, \"location\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"location\");\n },\n\n /**\r\n * Relative location of the label. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"location\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisLabel.prototype, \"inside\", {\n /**\r\n * Returns if label is set to be drawn inside axis.\r\n *\r\n * @return Inside?\r\n */\n get: function get() {\n return this.getPropertyValue(\"inside\");\n },\n\n /**\r\n * Sets if label should be drawn inside axis.\r\n *\r\n * @param value Inside?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"inside\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n AxisLabel.prototype.setDisabled = function (value) {\n var changed = _super.prototype.setDisabled.call(this, value);\n\n if (this.axis) {\n this.axis.invalidateDataItems();\n }\n\n return changed;\n };\n\n return AxisLabel;\n}(Label);\n\nexport { AxisLabel };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisLabel\"] = AxisLabel;","/**\r\n * Tick module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Sprite } from \"../../core/Sprite\";\nimport { registry } from \"../../core/Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A basic Tick class.\r\n *\r\n * A tick is a short dash, mainly connecting an object like axis or slice to\r\n * it's textual label.\r\n *\r\n * @see {@link ITickEvents} for a list of available events\r\n * @see {@link ITickAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar Tick =\n/** @class */\nfunction (_super) {\n __extends(Tick, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Tick() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Tick\";\n var interfaceColors = new InterfaceColorSet();\n _this.fillOpacity = 0;\n _this.length = 6;\n _this.strokeOpacity = 0.2;\n _this.stroke = interfaceColors.getFor(\"grid\");\n _this.isMeasured = false;\n _this.nonScalingStroke = true;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Tick.prototype, \"length\", {\n /**\r\n * @return Length (px)\r\n */\n get: function get() {\n if (this.disabled) {\n return 0;\n }\n\n return this.getPropertyValue(\"length\");\n },\n\n /**\r\n * Length of the tick in pixels.\r\n *\r\n * @param value Length (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"length\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return Tick;\n}(Sprite);\n\nexport { Tick };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Tick\"] = Tick;","/**\r\n * Axis Tick module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Tick } from \"../elements/Tick\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws an axis tick\r\n * @see {@link IAxisTickEvents} for a list of available events\r\n * @see {@link IAxisTickAdapters} for a list of available Adapters\r\n */\n\nvar AxisTick =\n/** @class */\nfunction (_super) {\n __extends(AxisTick, _super);\n\n function AxisTick() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisTick\";\n _this.element = _this.paper.add(\"path\");\n _this.location = 0.5;\n _this.above = false;\n _this.isMeasured = false;\n _this.pixelPerfect = true;\n _this.strokeOpacity = 0;\n _this.length = 5;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(AxisTick.prototype, \"location\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"location\");\n },\n\n /**\r\n * Relative location of the tick. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"location\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisTick.prototype, \"inside\", {\n /**\r\n * Returns if label is set to be drawn inside axis.\r\n *\r\n * @return Inside?\r\n */\n get: function get() {\n return this.getPropertyValue(\"inside\");\n },\n\n /**\r\n * Sets if tick should be drawn inside axis.\r\n *\r\n * @param value Inside?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"inside\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisTick.prototype, \"above\", {\n /**\r\n * @return Draw above series?\r\n */\n get: function get() {\n return this.getPropertyValue(\"above\");\n },\n\n /**\r\n * Normally tick goes below series. Set this to `true` to go above.\r\n *\r\n * @default false\r\n * @since 4.5.9\r\n * @param value Draw above series?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"above\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n AxisTick.prototype.setDisabled = function (value) {\n var changed = _super.prototype.setDisabled.call(this, value);\n\n if (this.axis) {\n this.axis.invalidateDataItems();\n }\n\n return changed;\n };\n\n return AxisTick;\n}(Tick);\n\nexport { AxisTick };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisTick\"] = AxisTick;","/**\r\n * Module, defining base Axis Renderer.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\nimport { AxisDataItem } from \"./Axis\";\nimport { AxisLine } from \"./AxisLine\";\nimport { AxisFill } from \"./AxisFill\";\nimport { Grid } from \"./Grid\";\nimport { AxisLabel } from \"./AxisLabel\";\nimport { AxisTick } from \"./AxisTick\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { registry } from \"../../core/Registry\";\nimport { percent } from \"../../core/utils/Percent\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for all axis renderers.\r\n *\r\n * @see {@link IAxisRendererEvents} for a list of available events\r\n * @see {@link IAxisRendererAdapters} for a list of available Adapters\r\n */\n\nvar AxisRenderer =\n/** @class */\nfunction (_super) {\n __extends(AxisRenderer, _super);\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\n\n\n function AxisRenderer() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * A related chart.\r\n */\n\n\n _this._chart = new MutableValueDisposer();\n _this.className = \"AxisRenderer\"; // Set defaults\n\n _this.minGridDistance = 50;\n _this.inside = false;\n _this.inversed = false;\n _this.tooltipLocation = 0.5;\n _this.fullWidthTooltip = false;\n _this.cellStartLocation = 0;\n _this.cellEndLocation = 1;\n _this.minLabelPosition = 0;\n _this.maxLabelPosition = 1;\n _this.shouldClone = false;\n\n var gridContainer = _this.createChild(Container);\n\n gridContainer.shouldClone = false;\n gridContainer.layout = \"none\"; //\tgridContainer.isMeasured = false;\n\n gridContainer.virtualParent = _this;\n gridContainer.width = percent(100);\n gridContainer.height = percent(100);\n _this.gridContainer = gridContainer; // not good without this\n\n gridContainer.events.on(\"maxsizechanged\", function () {\n if (_this.inited) {\n _this.invalidateAxisItems();\n }\n }, _this, false);\n\n var breakContainer = _this.createChild(Container);\n\n breakContainer.shouldClone = false;\n breakContainer.isMeasured = false;\n breakContainer.layout = \"none\";\n breakContainer.width = percent(100);\n breakContainer.height = percent(100);\n _this.breakContainer = breakContainer;\n\n var bulletsContainer = _this.createChild(Container);\n\n bulletsContainer.shouldClone = false;\n bulletsContainer.isMeasured = false;\n bulletsContainer.layout = \"none\";\n bulletsContainer.width = percent(100);\n bulletsContainer.height = percent(100);\n _this.bulletsContainer = bulletsContainer;\n _this.line = _this.createChild(AxisLine);\n _this.line.shouldClone = false;\n _this.line.strokeOpacity = 0;\n\n var baseGrid = _this.createChild(Grid);\n\n baseGrid.shouldClone = false;\n _this.baseGrid = baseGrid; // Make elements disposable\n\n var disposers = _this._disposers;\n disposers.push(baseGrid);\n disposers.push(_this.line);\n disposers.push(gridContainer);\n disposers.push(breakContainer);\n disposers.push(bulletsContainer);\n disposers.push(_this._chart);\n _this.ticks.template.disabled = true;\n _this.axisFills.template.disabled = true;\n _this.axisFills.template.interactionsEnabled = false; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(AxisRenderer.prototype, \"axis\", {\n /**\r\n * Axis of a renderer\r\n * @return axis Axis\r\n */\n get: function get() {\n return this._axis;\n },\n\n /**\r\n * Axis of a renderer\r\n * @param axis Axis\r\n */\n set: function set(axis) {\n this.setAxis(axis);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n AxisRenderer.prototype.setAxis = function (axis) {\n this._axis = axis;\n this.baseGrid.parent = axis;\n this.line.parent = axis;\n this.gridContainer.bind(\"opacity\", axis);\n };\n /**\r\n * Called when rendered is attached to an Axis, as well as a property of\r\n * Axis that might affect the appearance is updated.\r\n *\r\n * E.g. `axis.opposite`, `axis.inside`, etc.\r\n *\r\n * This method is called **before** draw, so that any related setting\r\n * changed in this method can be changed.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRenderer.prototype.processRenderer = function () {\n this.events.on(\"sizechanged\", this.updateTooltip, this, false);\n this.events.on(\"positionchanged\", this.updateTooltip, this, false);\n this.labels.template.inside = this.inside;\n this.ticks.template.inside = this.inside;\n };\n /**\r\n * Updates Axis' tooltip.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRenderer.prototype.updateTooltip = function () {// This is a placeholder method for extending classes to override.\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"axisLength\", {\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\n get: function get() {\n // This is a placeholder method for extending classes to override.\n return 0;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Re-positions an element to new coordinates.\r\n *\r\n * @ignore Exclude from docs\r\n * @param item A target element\r\n * @param point New coordinates\r\n */\n\n AxisRenderer.prototype.positionItem = function (item, point) {\n if (item) {\n item.moveTo(point);\n }\n };\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Point\r\n */\n\n\n AxisRenderer.prototype.positionToPoint = function (position, position2) {\n // This is a placeholder method for extending classes to override.\n return {\n x: 0,\n y: 0\n };\n };\n /**\r\n * Converts relative position on axis to angle.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review / units)\r\n * @param position Position (0-1)\r\n * @return Angle\r\n */\n\n\n AxisRenderer.prototype.positionToAngle = function (position) {\n // This is a placeholder method for extending classes to override.\n return 0;\n };\n /**\r\n * Converts relative position (0-1) on axis to a pixel coordinate.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinate (px)\r\n */\n\n\n AxisRenderer.prototype.positionToCoordinate = function (position) {\n var coordinate;\n var axis = this.axis;\n var axisFullLength = axis.axisFullLength;\n\n if (axis.renderer.inversed) {\n coordinate = (axis.end - position) * axisFullLength;\n } else {\n coordinate = (position - axis.start) * axisFullLength;\n }\n\n return coordinate;\n };\n\n AxisRenderer.prototype.updateGridContainer = function () {};\n\n AxisRenderer.prototype.getHeight = function () {\n var gridContainer = this.gridContainer;\n\n if (gridContainer.parent) {\n return gridContainer.parent.pixelHeight;\n }\n\n return this.gridContainer.pixelHeight || 0;\n };\n\n AxisRenderer.prototype.getWidth = function () {\n var gridContainer = this.gridContainer;\n\n if (gridContainer.parent) {\n return gridContainer.parent.pixelWidth;\n }\n\n return this.gridContainer.pixelWidth || 0;\n };\n /**\r\n * Converts a coordinate in pixels to a relative position. (0-1)\r\n *\r\n * @param coordinate Coordinate (px)\r\n * @param coordinate2 Coordinate of a second axis, only needed for complex axes systems, like timeline (px)\r\n * @return Position (0-1)\r\n */\n\n\n AxisRenderer.prototype.coordinateToPosition = function (coordinate, coordinate2) {\n var position;\n var axis = this.axis;\n var axisFullLength = axis.axisFullLength;\n\n if (axis.renderer.inversed) {\n position = axis.end - coordinate / axisFullLength;\n } else {\n position = coordinate / axisFullLength + axis.start;\n }\n\n return $math.round(position, 5);\n };\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\n\n\n AxisRenderer.prototype.pointToPosition = function (point) {\n // This is a placeholder method for extending classes to override.\n return 0;\n };\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\n\n\n AxisRenderer.prototype.getPositionRangePath = function (startPosition, endPosition) {\n return \"\";\n };\n /**\r\n * Invalidates all axis data items, effectively causing them re-evaluated.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\n\n\n AxisRenderer.prototype.invalidateAxisItems = function () {\n var axis = this.axis;\n\n if (axis) {\n axis.invalidateDataItems();\n }\n };\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRenderer.prototype.updateGridElement = function (grid, position, endPosition) {// This is a placeholder method for extending classes to override.\n };\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRenderer.prototype.updateTickElement = function (tick, position, endPosition) {// This is a placeholder method for extending classes to override.\n };\n /**\r\n * Updates and positions axis bullet.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRenderer.prototype.updateBullet = function (bullet, position, endPosition) {// This is a placeholder method for extending classes to override.\n };\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\n\n\n AxisRenderer.prototype.updateLabelElement = function (label, position, endPosition, location) {// This is a placeholder method for extending classes to override.\n };\n /**\r\n * Updates and positions the axis fill element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param fill Fill element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\n\n\n AxisRenderer.prototype.updateFillElement = function (fill, position, endPosition) {\n fill.startPosition = position;\n fill.endPosition = endPosition;\n };\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRenderer.prototype.updateAxisLine = function () {// This is a placeholder method for extending classes to override.\n };\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRenderer.prototype.updateBaseGridElement = function () {// This is a placeholder method for extending classes to override.\n };\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\n\n\n AxisRenderer.prototype.updateBreakElement = function (axisBreak) {\n this.positionItem(axisBreak.startLine, axisBreak.startPoint);\n this.toggleVisibility(axisBreak.startLine, axisBreak.startPosition, 0, 1);\n this.positionItem(axisBreak.endLine, axisBreak.endPoint);\n this.toggleVisibility(axisBreak.endLine, axisBreak.endPosition, 0, 1);\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"minGridDistance\", {\n /**\r\n * @return Min distance (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"minGridDistance\");\n },\n\n /**\r\n * Minimum distance in pixels between grid elements.\r\n *\r\n * Use it to control density of the grid/labels on the axis.element.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/#Setting_the_density_of_the_the_grid_labels} for more info\r\n * @param value Min distance (px)\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"minGridDistance\", value)) {\n if (this.axis) {\n this.axis.invalidateDataItems();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"chart\", {\n /**\r\n * @ignore Exclude from docs\r\n * @return Chart\r\n */\n get: function get() {\n return this._chart.get();\n },\n\n /**\r\n * A chart, associated with the Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Chart\r\n */\n set: function set(value) {\n this._chart.set(value, null);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Toggles visibility of an element, based on its current position and\r\n * min/max position settings.\r\n *\r\n * E.g. labels based on `minLabelPosition` and `maxLabelPosition`.\r\n *\r\n * @ignore Exclude from docs\r\n * @param sprite An element to toggle\r\n * @param position Elements current position\r\n * @param minPosition Min position setting\r\n * @param maxPosition Max position setting\r\n */\n\n AxisRenderer.prototype.toggleVisibility = function (sprite, position, minPosition, maxPosition) {\n var axis = this.axis;\n var dataItem = sprite.dataItem;\n\n if (dataItem && dataItem instanceof AxisDataItem) {\n if ($type.isNumber(dataItem.minPosition)) {\n minPosition = dataItem.minPosition;\n }\n\n if ($type.isNumber(dataItem.maxPosition)) {\n maxPosition = dataItem.maxPosition;\n }\n }\n\n var updatedStart = axis.start + (axis.end - axis.start) * (minPosition - 0.0001);\n var updatedEnd = axis.start + (axis.end - axis.start) * (maxPosition + 0.0001);\n\n if (!sprite.disabled) {\n if (position < updatedStart || position > updatedEnd) {\n sprite.__disabled = true;\n } else {\n sprite.__disabled = false;\n }\n }\n };\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\n\n\n AxisRenderer.prototype.createBreakSprites = function (axisBreak) {// This is a placeholder method for extending classes to override.\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"axisFills\", {\n /**\r\n * A list of Axis' Fill elements.\r\n *\r\n * Those are fill elements that cover the space between every second set\r\n * of grid lines, and can be configured to create striped charts.\r\n *\r\n * Please note that these are disabled by default. To enable them, set\r\n * template to true.\r\n *\r\n * ```TypeScript\r\n * categoryAxis.renderer.axisFills.template.disabled = false;\r\n * ```\r\n * ```JavaScript\r\n * categoryAxis.renderer.axisFills.template.disabled = false;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"renderer\": {\r\n * \"axisFills\": {\r\n * \"disabled\": false\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/alternated-axis-fills/} this tutorial for more info.\r\n * @return Fill elements\r\n */\n get: function get() {\n if (!this._axisFills) {\n var fill = this.createFill(this.axis);\n this._axisFills = new ListTemplate(fill);\n fill.applyOnClones = true;\n fill.events.on(\"enabled\", this.invalidateAxisItems, this, false);\n\n this._disposers.push(new ListDisposer(this._axisFills));\n\n this._disposers.push(this._axisFills.template);\n }\n\n return this._axisFills;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns a new fill element, suitable for this Axis Renderer type.\r\n *\r\n * @return Fill element\r\n */\n\n AxisRenderer.prototype.createFill = function (axis) {\n return new AxisFill(axis);\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"grid\", {\n /**\r\n * A list of Axis' Grid elements.\r\n *\r\n * @return Grid elements\r\n */\n get: function get() {\n if (!this._grid) {\n var grid = this.createGrid();\n this._grid = new ListTemplate(grid);\n grid.applyOnClones = true;\n grid.events.on(\"enabled\", this.invalidateAxisItems, this, false);\n\n this._disposers.push(new ListDisposer(this._grid));\n\n this._disposers.push(this._grid.template);\n }\n\n return this._grid;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns a new grid element, suitable for this Axis Renderer type.\r\n *\r\n * @return Grid element\r\n */\n\n AxisRenderer.prototype.createGrid = function () {\n return new Grid();\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"ticks\", {\n /**\r\n * A list of Axis' Tick elements.\r\n *\r\n * Please note that these are disabled by default. To enable ticks, you'll\r\n * need to set `disabled` and `strokeOpacity` properties of the tick template.\r\n *\r\n * ```TypeScript\r\n * categoryAxis.renderer.ticks.template.disabled = false;\r\n * categoryAxis.renderer.ticks.template.strokeOpacity = 0.5;\r\n * ```\r\n * ```JavaScript\r\n * categoryAxis.renderer.ticks.template.disabled = false;\r\n * categoryAxis.renderer.ticks.template.strokeOpacity = 0.5;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"renderer\": {\r\n * \"ticks\": {\r\n * \"disabled\": false,\r\n * \"strokeOpacity\": 0.5\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @return Tick elements\r\n */\n get: function get() {\n if (!this._ticks) {\n var tick = this.createTick();\n tick.applyOnClones = true;\n tick.isMeasured = false;\n tick.events.on(\"enabled\", this.invalidateAxisItems, this, false);\n this._ticks = new ListTemplate(tick);\n\n this._disposers.push(new ListDisposer(this._ticks));\n\n this._disposers.push(this._ticks.template);\n }\n\n return this._ticks;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns a new tick element, suitable for this Axis Renderer type.\r\n *\r\n * @return Tick element\r\n */\n\n AxisRenderer.prototype.createTick = function () {\n return new AxisTick();\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"labels\", {\n /**\r\n * A list of Axis' Label elements.\r\n *\r\n * @return Label elements\r\n */\n get: function get() {\n if (!this._labels) {\n var label = this.createLabel();\n this._labels = new ListTemplate(label);\n label.applyOnClones = true;\n label.events.on(\"enabled\", this.invalidateAxisItems, this, false);\n\n this._disposers.push(new ListDisposer(this._labels));\n\n this._disposers.push(this._labels.template);\n }\n\n return this._labels;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns a new label element, suitable for this Axis Renderer type.\r\n *\r\n * @return Label element\r\n */\n\n AxisRenderer.prototype.createLabel = function () {\n return new AxisLabel();\n };\n\n Object.defineProperty(AxisRenderer.prototype, \"inside\", {\n /**\r\n * @return Labels inside?\r\n */\n get: function get() {\n return this.getPropertyValue(\"inside\");\n },\n\n /**\r\n * Indicates whether Axis' labels and ticks should be drawn inside Plot area.\r\n *\r\n * Does not work with all renderers, like AxisRendererRadial.\r\n *\r\n * @param value Labels inside?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"inside\", value)) {\n if (this.axis) {\n this.axis.invalidate();\n }\n }\n\n if (value) {\n this.width = 0;\n this.height = 0;\n } else {\n this.width = undefined;\n this.height = undefined;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"opposite\", {\n /**\r\n * @return Draw axis on opposite side?\r\n */\n get: function get() {\n return this.getPropertyValue(\"opposite\");\n },\n\n /**\r\n * Indicates whether Axis should be drawn on the opposite side of the plot\r\n * area than it would normally be drawn based on chart's settings.\r\n *\r\n * Does not work with all renderers, like [[AxisRendererRadial]] and\r\n * [[AxisRenderer Circular].\r\n *\r\n * @param value Draw axis on opposite side?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"opposite\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"fullWidthTooltip\", {\n /**\r\n * @return Full width tooltip?\r\n */\n get: function get() {\n return this.getPropertyValue(\"fullWidthTooltip\");\n },\n\n /**\r\n * Indicates if Axis tooltip should take the whole width of the axis cell.\r\n * (between two grid lines)\r\n *\r\n * NOTE: this setting is ignored on circular axis types.\r\n *\r\n * @param value Full width tooltip?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"fullWidthTooltip\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"tooltipLocation\", {\n /**\r\n * @return Tooltip location\r\n */\n get: function get() {\n return this.getPropertyValue(\"tooltipLocation\");\n },\n\n /**\r\n * Location within axis cell to show tooltip on. (0-1)\r\n *\r\n * 0 - show at the start\r\n * 0.5 - show right in the middle\r\n * 1 - show at the end\r\n *\r\n * @param value Tooltip location\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tooltipLocation\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"tooltipLocation2\", {\n /**\r\n * @return Tooltip location\r\n */\n get: function get() {\n return this.getPropertyValue(\"tooltipLocation2\");\n },\n\n /**\r\n * Location within secondary axis cell to show tooltip on. (0-1)\r\n *\r\n * 0 - show at the start\r\n * 0.5 - show right in the middle\r\n * 1 - show at the end\r\n *\r\n * @param value Tooltip location\r\n */\n set: function set(value) {\n this.setPropertyValue(\"tooltipLocation2\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"cellStartLocation\", {\n /**\r\n * @return Cell start (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cellStartLocation\");\n },\n\n /**\r\n * Location for the cell start.\r\n *\r\n * Normally a \"cell\" is the whole available width in a category.\r\n *\r\n * If there are several clustered column-like series available, the whole\r\n * space is divided between each clustered column, or column stacks.\r\n *\r\n * `cellStartLocation` identifies where, within available space, the actual\r\n * cell starts.\r\n *\r\n * This, together with column series' `width` will affect actual width of\r\n * columns, and thus gaps between them.\r\n *\r\n * This will affect category-like axes only, like [[DateAxis]], or\r\n * [[CategoryAxis]].\r\n *\r\n * This is used to limit a space occupied by series like column.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Cell start (0-1)\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"cellStartLocation\", value)) {\n if (this.axis) {\n this.axis.invalidateSeries();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"cellEndLocation\", {\n /**\r\n * @return Cell end (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"cellEndLocation\");\n },\n\n /**\r\n * Location for the cell end.\r\n *\r\n * Normally a \"cell\" is the whole available width in a category.\r\n *\r\n * If there are several clustered column-like series available, the whole\r\n * space is divided between each clustered column, or column stacks.\r\n *\r\n * `cellEndLocation` identifies where, within available space, the actual\r\n * cell ends.\r\n *\r\n * This, together with column series' `width` will affect actual width of\r\n * columns, and thus gaps between them.\r\n *\r\n * This will affect category-like axes only, like [[DateAxis]], or\r\n * [[CategoryAxis]].\r\n *\r\n * This is used to limit a space occupied by series like column.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Cell end (0-1)\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"cellEndLocation\", value)) {\n if (this.axis) {\n this.axis.invalidateSeries();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"inversed\", {\n /**\r\n * @return Flip axis?\r\n */\n get: function get() {\n return this.getPropertyValue(\"inversed\");\n },\n\n /**\r\n * Indicates if the scale of the axis should be flipped.\r\n *\r\n * @param value Flip axis?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"inversed\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"minLabelPosition\", {\n /**\r\n * @return Min label position (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"minLabelPosition\");\n },\n\n /**\r\n * Minimum position along the Axis, for labels.\r\n *\r\n * Labels, which have their position closer to the start of the Axis, will be\r\n * automatically hidden.\r\n *\r\n * E.g., setting this to 0.05 (5% of total axis length) would hide labels,\r\n * that would otherwise be drawn very near start of the Axis.\r\n *\r\n * This is especially usefull with `inside = true`, or if the chart hasn't\r\n * got any extra margins.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Min label position (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"minLabelPosition\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AxisRenderer.prototype, \"maxLabelPosition\", {\n /**\r\n * @return Max label position (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"maxLabelPosition\");\n },\n\n /**\r\n * Maximum position along the Axis, for labels.\r\n *\r\n * Labels, which have their position closer to the and of the Axis, will be\r\n * automatically hidden.\r\n *\r\n * E.g., setting this to 0.95 (95% of total axis length) would hide labels,\r\n * that would otherwise be drawn very near end of the Axis.\r\n *\r\n * This is especially usefull with `inside = true`, or if the chart hasn't\r\n * got any extra margins.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/} for more info.\r\n * @param value Max label position (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"maxLabelPosition\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies all settings and related items from another object of the same\r\n * type.\r\n *\r\n * @param source Source object\r\n */\n\n AxisRenderer.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.grid.template.copyFrom(source.grid.template);\n this.ticks.template.copyFrom(source.ticks.template);\n this.labels.template.copyFrom(source.labels.template);\n this.axisFills.template.copyFrom(source.axisFills.template);\n this.line.copyFrom(source.line);\n this.baseGrid.copyFrom(source.baseGrid);\n };\n /**\r\n * @ignore\r\n */\n\n\n AxisRenderer.prototype.toAxisPosition = function (value) {\n return value;\n };\n /**\r\n * Sets `visibility` property:\r\n *\r\n * * `true` - visible\r\n * * `false` - hidden\r\n *\r\n * @param value true - visible, false - hidden\r\n * @return Current visibility\r\n */\n\n\n AxisRenderer.prototype.setVisibility = function (value) {\n _super.prototype.setVisibility.call(this, value);\n\n this.bulletsContainer.visible = value;\n };\n\n return AxisRenderer;\n}(Container);\n\nexport { AxisRenderer };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisRenderer\"] = AxisRenderer;","/**\r\n * Axis Bullet module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a positioned bullet (element) on an Axis.\r\n *\r\n * ```TypeScript\r\n * let range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * let flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JavaScript\r\n * var range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n *\r\n * var flag = new am4plugins_bullets.FlagBullet();\r\n * flag.label.text = \"Hello\";\r\n *\r\n * range.bullet = flag;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * // ...\r\n * \"axisRanges\": [{\r\n * \"date\": new Date(2018, 0, 5),\r\n * \"bullet: {\r\n * \"type\": \"FlagBullet\",\r\n * \"label\": {\r\n * \"text\": \"Hello\"\r\n * }\r\n * }\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.5.9\r\n * @see {@link IAxisBulletEvents} for a list of available events\r\n * @see {@link IAxisBulletAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar AxisBullet =\n/** @class */\nfunction (_super) {\n __extends(AxisBullet, _super);\n\n function AxisBullet() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisBullet\";\n _this.location = 0.5;\n _this.isMeasured = false;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(AxisBullet.prototype, \"location\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"location\");\n },\n\n /**\r\n * Relative position within cell/range.\r\n *\r\n * Value range is from from `0` (beginning) to `1` (end).\r\n *\r\n * NOTE: `location` is relative to the parent axis range's scope, i.e.\r\n * between its `date` and `endDate` for [[DateAxis]], or `value`/`endValue`\r\n * ([[ValueAxis]]), or `category`/`endCategory` ([[categoryAxis]]).\r\n *\r\n * ```TypeScript\r\n * let range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n * range.endDate = new Date(2018, 0, 6);\r\n *\r\n * let bullet = new am4charts.AxisBullet();\r\n * bullet.location = 1;\r\n *\r\n * let flag = bullet.createChild(am4plugins_bullets.FlagBullet);\r\n * flag.label.text = \"Hello\";\r\n * ```\r\n * ```JavaScript\r\n * var range = dateAxis.axisRanges.create();\r\n * range.date = new Date(2018, 0, 5);\r\n * range.endDate = new Date(2018, 0, 6);\r\n *\r\n * var bullet = new am4charts.AxisBullet();\r\n * bullet.location = 1;\r\n *\r\n * var flag = bullet.createChild(am4plugins_bullets.FlagBullet);\r\n * flag.label.text = \"Hello\";\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"xAxes\": [{\r\n * \"type\": \"DateAxis\",\r\n * // ...\r\n * \"axisRanges\": [{\r\n * \"date\": new Date(2018, 0, 5),\r\n * \"endDate\": new Date(2018, 0, 6),\r\n * \"bullet: {\r\n * \"type\": \"AxisBullet\",\r\n * \"location\": 1,\r\n * \"children\": [{\r\n * \"type\": \"FlagBullet\",\r\n * \"label\": {\r\n * \"text\": \"Hello\"\r\n * }\r\n * }]\r\n * }\r\n * }]\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @default 0.5\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"location\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n AxisBullet.prototype.setDisabled = function (value) {\n var changed = _super.prototype.setDisabled.call(this, value);\n\n if (this.axis) {\n this.axis.invalidateDataItems();\n }\n\n return changed;\n };\n\n return AxisBullet;\n}(Container);\n\nexport { AxisBullet };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisBullet\"] = AxisBullet;","/**\r\n * Module, defining Axis Renderer for vertical axes.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { AxisRenderer } from \"./AxisRenderer\";\nimport { WavedLine } from \"../../core/elements/WavedLine\";\nimport { WavedRectangle } from \"../../core/elements/WavedRectangle\";\nimport { registry } from \"../../core/Registry\";\nimport { percent, Percent } from \"../../core/utils/Percent\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $path from \"../../core/rendering/Path\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $type from \"../../core/utils/Type\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\nimport { AxisBullet } from \"./AxisBullet\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A renderer for vertical axis.\r\n *\r\n * @see {@link IAxisRendererYEvents} for a list of available events\r\n * @see {@link IAxisRendererYAdapters} for a list of available Adapters\r\n */\n\nvar AxisRendererY =\n/** @class */\nfunction (_super) {\n __extends(AxisRendererY, _super);\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\n\n\n function AxisRendererY() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisRendererY\";\n _this.minGridDistance = 40;\n _this.opposite = false;\n _this.height = percent(100);\n _this.labels.template.verticalCenter = \"middle\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n AxisRendererY.prototype.setAxis = function (axis) {\n _super.prototype.setAxis.call(this, axis);\n\n axis.layout = \"horizontal\";\n };\n /**\r\n * @ignore\r\n */\n\n\n AxisRendererY.prototype.updateGridContainer = function () {\n var axis = this.axis;\n\n if (axis) {\n var gridContainer = this.gridContainer;\n gridContainer.y = axis.pixelY;\n gridContainer.height = axis.axisLength;\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n AxisRendererY.prototype.toAxisPosition = function (value) {\n var axis = this.axis;\n\n if (axis) {\n var inversedPosition = 1 - value;\n var relativePositionSprite = axis.relativePositionSprite;\n var y = axis.pixelY;\n\n if (relativePositionSprite) {\n y = $utils.spritePointToSprite({\n x: 0,\n y: this.pixelY\n }, this.parent, relativePositionSprite).y;\n } else {\n relativePositionSprite = axis.parent;\n }\n\n if (relativePositionSprite) {\n var relativeY = y / relativePositionSprite.innerHeight;\n var relativeHeight = axis.axisLength / relativePositionSprite.innerHeight;\n return 1 - (inversedPosition - relativeY) / relativeHeight;\n }\n }\n\n return value;\n };\n /**\r\n * Called when rendered is attached to an Axis, as well as a property of\r\n * Axis that might affect the appearance is updated.\r\n *\r\n * E.g. `axis.opposite`, `axis.inside`, etc.\r\n *\r\n * This method is called **before** draw, so that any related setting\r\n * changed in this method can be changed.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererY.prototype.processRenderer = function () {\n _super.prototype.processRenderer.call(this);\n\n var axis = this.axis;\n\n if (axis) {\n var title = axis.title;\n title.valign = \"middle\";\n\n if (!(axis.height instanceof Percent)) {\n axis.height = percent(100);\n }\n\n if (this.opposite) {\n title.rotation = 90;\n this.line.toBack();\n title.toFront();\n } else {\n title.rotation = -90;\n title.toBack();\n this.line.toFront();\n }\n }\n };\n /**\r\n * Updates some of the Axis tooltip's visual properties, related to\r\n * rendering of the Axis.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererY.prototype.updateTooltip = function () {\n var axis = this.axis;\n\n if (axis) {\n var bigNum = 2000;\n var bbx = 0;\n var bby = 0;\n var bbw = bigNum;\n var bbh = this.axisLength; // right\n\n if (this.opposite) {\n if (this.inside) {\n bbx = -bigNum;\n bbw = bigNum;\n }\n } // left\n else {\n if (!this.inside) {\n bbx = -bigNum;\n bbw = bigNum;\n }\n }\n\n this.axis.updateTooltip(\"horizontal\", {\n x: bbx,\n y: bby,\n width: bbw,\n height: bbh\n });\n }\n };\n\n Object.defineProperty(AxisRendererY.prototype, \"axisLength\", {\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\n get: function get() {\n var axis = this.axis;\n return axis.measuredHeight - axis.pixelPaddingTop - axis.pixelPaddingBottom || 0;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @param position2 Position (0-1) Position on the second axis\r\n * @return Point\r\n */\n\n AxisRendererY.prototype.positionToPoint = function (position, position2) {\n return {\n x: 0,\n y: this.positionToCoordinate(position)\n };\n };\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\n\n\n AxisRendererY.prototype.pointToPosition = function (point) {\n return this.coordinateToPosition(point.y, point.x);\n };\n /**\r\n * Converts a coordinate in pixels to a relative position. (0-1)\r\n *\r\n * @param coordinate Coordinate (px)\r\n * @param coordinate2 Coordinate of a second axis, only needed for complex axes systems, like timeline (px)\r\n * @return Position (0-1)\r\n */\n\n\n AxisRendererY.prototype.coordinateToPosition = function (coordinate, coordinate2) {\n var position;\n var axis = this.axis;\n var axisFullLength = axis.axisFullLength;\n\n if (axis.renderer.inversed) {\n position = 1 - axis.start - coordinate / axisFullLength;\n } else {\n position = coordinate / axisFullLength + (1 - axis.end);\n }\n\n return $math.round(position, 5);\n };\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\n\n\n AxisRendererY.prototype.getPositionRangePath = function (startPosition, endPosition) {\n var y1 = $math.fitToRange(this.positionToCoordinate(startPosition), 0, this.axisLength);\n var y2 = $math.fitToRange(this.positionToCoordinate(endPosition), 0, this.axisLength);\n var h = Math.abs(y2 - y1);\n var w = this.getWidth();\n var y = Math.min(y1, y2);\n var x = 0;\n return $path.rectToPath({\n x: x,\n y: y,\n width: w,\n height: h\n }, true);\n };\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRendererY.prototype.updateGridElement = function (grid, position, endPosition) {\n position = position + (endPosition - position) * grid.location;\n var point = this.positionToPoint(position); //\tpoint.y = $utils.spritePointToSprite({ x: 0, y: point.y }, this, this.gridContainer).y;\n\n grid.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: this.getWidth(),\n y: 0\n });\n this.positionItem(grid, point);\n this.toggleVisibility(grid, position, 0, 1);\n };\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRendererY.prototype.updateTickElement = function (tick, position, endPosition) {\n position = position + (endPosition - position) * tick.location;\n var point = this.positionToPoint(position);\n var tickLength = tick.length;\n\n try {\n $utils.used(this.axis.title.measuredWidth);\n } catch (_a) {// void\n }\n\n point.x = $utils.spritePointToSprite({\n x: this.line.pixelX,\n y: 0\n }, this.line.parent, this.gridContainer).x;\n\n if (!this.opposite) {\n tickLength *= tick.inside ? 1 : -1;\n } else {\n tickLength *= tick.inside ? -1 : 1;\n }\n\n tick.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: tickLength,\n y: 0\n });\n this.positionItem(tick, point);\n this.toggleVisibility(tick, position, 0, 1);\n };\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererY.prototype.updateAxisLine = function () {\n this.line.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: 0,\n y: this.axisLength\n });\n };\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererY.prototype.updateBaseGridElement = function () {\n _super.prototype.updateBaseGridElement.call(this);\n\n var axis = this.axis;\n var w = this.getWidth();\n var h = this.axisLength;\n var y = axis.basePoint.y;\n var baseGrid = this.baseGrid;\n\n if (y < -0.2 || y > h + 0.2) {\n baseGrid.hide(0);\n } else {\n var x = $utils.spritePointToSprite({\n x: 0,\n y: 0\n }, this.gridContainer, baseGrid.parent).x;\n baseGrid.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: w,\n y: 0\n });\n baseGrid.moveTo({\n x: x,\n y: y\n });\n baseGrid.show(0);\n }\n };\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\n\n\n AxisRendererY.prototype.updateLabelElement = function (label, position, endPosition, location) {\n if (!$type.hasValue(location)) {\n location = label.location;\n }\n\n position = position + (endPosition - position) * location;\n label.isMeasured = !label.inside;\n var point = this.positionToPoint(position);\n var horizontalCenter;\n var deltaX = 0;\n var maxWidth = this.gridContainer.maxWidth;\n\n if (this.opposite) {\n if (label.inside) {\n horizontalCenter = \"right\";\n\n if (label.align == \"left\") {\n deltaX = -maxWidth;\n horizontalCenter = \"left\";\n }\n\n if (label.align == \"center\") {\n deltaX = -maxWidth / 2;\n horizontalCenter = \"middle\";\n }\n } else {\n horizontalCenter = \"left\";\n }\n\n point.x = 0 + deltaX;\n } else {\n if (label.inside) {\n horizontalCenter = \"left\";\n\n if (label.align == \"right\") {\n deltaX = maxWidth;\n horizontalCenter = \"right\";\n }\n\n if (label.align == \"center\") {\n deltaX = maxWidth / 2;\n horizontalCenter = \"middle\";\n }\n } else {\n horizontalCenter = \"right\";\n }\n\n point.x = this.measuredWidth + deltaX;\n }\n\n if (label.rotation == 0) {\n // Apply fuzzy logic to verticalCenter only if labels are not rotated\n label.horizontalCenter = horizontalCenter;\n }\n\n this.positionItem(label, point);\n this.toggleVisibility(label, position, this.minLabelPosition, this.maxLabelPosition);\n };\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\n\n\n AxisRendererY.prototype.updateBreakElement = function (axisBreak) {\n _super.prototype.updateBreakElement.call(this, axisBreak);\n\n var startLine = axisBreak.startLine;\n var endLine = axisBreak.endLine;\n var fillShape = axisBreak.fillShape;\n var startPoint = axisBreak.startPoint;\n var endPoint = axisBreak.endPoint;\n var x1 = axisBreak.pixelMarginLeft;\n var x2 = this.getWidth() - axisBreak.pixelMarginLeft - axisBreak.pixelMarginRight;\n startPoint.y = $math.fitToRange(startPoint.y, -1, this.axisLength + 1);\n endPoint.y = $math.fitToRange(endPoint.y, -1, this.axisLength + 1);\n\n if (startPoint.y == endPoint.y && (startPoint.y < 0 || startPoint.y > this.axisLength)) {\n axisBreak.fillShape.__disabled = true;\n } else {\n axisBreak.fillShape.__disabled = false;\n }\n\n var w = Math.abs(x2 - x1);\n startLine.x = x1;\n startLine.height = 0;\n startLine.width = w;\n endLine.x = x1;\n endLine.height = 0;\n endLine.width = w;\n fillShape.width = w;\n fillShape.height = Math.abs(endPoint.y - startPoint.y);\n fillShape.x = x1;\n fillShape.y = endPoint.y;\n };\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\n\n\n AxisRendererY.prototype.createBreakSprites = function (axisBreak) {\n axisBreak.startLine = new WavedLine();\n axisBreak.endLine = new WavedLine();\n var wavedRectangle = new WavedRectangle();\n wavedRectangle.setWavedSides(true, false, true, false);\n axisBreak.fillShape = wavedRectangle;\n };\n /**\r\n * Converts a position on the axis to a coordinate in pixels.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (0-1)\r\n * @return Coordinate (px)\r\n */\n\n\n AxisRendererY.prototype.positionToCoordinate = function (position) {\n var coordinate;\n var axis = this.axis;\n var axisFullLength = axis.axisFullLength;\n\n if (!axis.renderer.inversed) {\n coordinate = (axis.end - position) * axisFullLength;\n } else {\n coordinate = (position - axis.start) * axisFullLength;\n }\n\n return coordinate;\n };\n /**\r\n * Updates and positions axis bullets.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRendererY.prototype.updateBullet = function (bullet, position, endPosition) {\n var location = 0.5;\n\n if (bullet instanceof AxisBullet) {\n location = bullet.location;\n }\n\n position = position + (endPosition - position) * location;\n var point = this.positionToPoint(position);\n point.x = $utils.spritePointToSprite({\n x: this.line.pixelX,\n y: 0\n }, this.line.parent, this.gridContainer).x;\n this.positionItem(bullet, point);\n this.toggleVisibility(bullet, position, 0, 1);\n };\n\n return AxisRendererY;\n}(AxisRenderer);\n\nexport { AxisRendererY };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisRendererY\"] = AxisRendererY;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Put labels inside plot area.\r\n * Disable first and last labels.\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.widthS,\n state: function state(target, stateId) {\n if (target instanceof AxisRendererY) {\n var state = target.states.create(stateId);\n state.properties.inside = true;\n state.properties.maxLabelPosition = 0.9;\n state.properties.minLabelPosition = 0.1;\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Disable labels altogather on very small charts\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.widthXS,\n state: function state(target, stateId) {\n if (target instanceof AxisRendererY) {\n var state = target.states.create(stateId);\n state.properties.disabled = true;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * A module which defines functionality related to Value Axis Break.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { AxisBreak } from \"./AxisBreak\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Base class to define \"breaks\" on value axis.\r\n *\r\n * A \"break\" can be used to \"cut out\" specific ranges of the axis scale, e.g.\r\n * when comparing columns with relatively similar values, it would make sense\r\n * to cut out their mid section, so that their tip differences are more\r\n * prominent.\r\n *\r\n * @see {@link IValueAxisBreakEvents} for a list of available events\r\n * @see {@link IValueAxisBreakAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar ValueAxisBreak =\n/** @class */\nfunction (_super) {\n __extends(ValueAxisBreak, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ValueAxisBreak() {\n var _this = _super.call(this) || this;\n\n _this.className = \"ValueAxisBreak\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(ValueAxisBreak.prototype, \"startPosition\", {\n /**\r\n * Pixel position of the break's start.\r\n *\r\n * @return Position (px)\r\n * @readonly\r\n */\n get: function get() {\n if (this.axis) {\n return this.axis.valueToPosition(this.adjustedStartValue);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxisBreak.prototype, \"endPosition\", {\n /**\r\n * Pixel position of the break's end.\r\n *\r\n * @return Position (px)\r\n * @readonly\r\n */\n get: function get() {\n if (this.axis) {\n return this.axis.valueToPosition(this.adjustedEndValue);\n }\n },\n enumerable: true,\n configurable: true\n });\n return ValueAxisBreak;\n}(AxisBreak);\n\nexport { ValueAxisBreak };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ValueAxisBreak\"] = ValueAxisBreak;","/**\r\n * Value Axis module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Axis, AxisDataItem } from \"./Axis\";\nimport { AxisRendererY } from \"./AxisRendererY\";\nimport { MultiDisposer } from \"../../core/utils/Disposer\";\nimport { registry } from \"../../core/Registry\";\nimport { ValueAxisBreak } from \"./ValueAxisBreak\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $object from \"../../core/utils/Object\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $utils from \"../../core/utils/Utils\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[ValueAxis]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar ValueAxisDataItem =\n/** @class */\nfunction (_super) {\n __extends(ValueAxisDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ValueAxisDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"ValueAxisDataItem\";\n _this.values.value = {};\n _this.values.endValue = {};\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(ValueAxisDataItem.prototype, \"value\", {\n /**\r\n * @return Value\r\n */\n get: function get() {\n return this.values[\"value\"].value;\n },\n\n /**\r\n * A data point's numeric value.\r\n *\r\n * @param value Value\r\n */\n set: function set(value) {\n this.setValue(\"value\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxisDataItem.prototype, \"endValue\", {\n /**\r\n * @return Value\r\n */\n get: function get() {\n return this.values[\"endValue\"].value;\n },\n\n /**\r\n * Data point's numeric end value.\r\n *\r\n * @param value End value\r\n */\n set: function set(value) {\n this.setValue(\"endValue\", value);\n },\n enumerable: true,\n configurable: true\n });\n return ValueAxisDataItem;\n}(AxisDataItem);\n\nexport { ValueAxisDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to create a value axis for the chart.\r\n *\r\n * ```TypeScript\r\n * // Create the axis\r\n * let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Monthly Sales\";\r\n * ```\r\n * ```JavaScript\r\n * // Create the axis\r\n * var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());\r\n *\r\n * // Set settings\r\n * valueAxis.title.text = \"Monthly Sales\";\r\n * ```\r\n * ```JSON\r\n * \"yAxes\": [{\r\n * \"type\": \"ValueAxis\",\r\n * \"title\": {\r\n * \"text\": \"Monthly Sales\"\r\n * }\r\n * }]\r\n * ```\r\n *\r\n * @see {@link IValueAxisEvents} for a list of available Events\r\n * @see {@link IValueAxisAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar ValueAxis =\n/** @class */\nfunction (_super) {\n __extends(ValueAxis, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ValueAxis() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * [_stepDecimalPlaces description]\r\n *\r\n * @todo Description\r\n */\n\n\n _this._stepDecimalPlaces = 0;\n _this._prevStepDecimalPlaces = 0;\n _this._adjustLabelPrecision = true;\n /**\r\n * Base value for the axis.\r\n */\n\n _this._baseValue = 0;\n /**\r\n * Adjusted start in case we have breaks.\r\n *\r\n * @todo Description\r\n */\n\n _this._adjustedStart = 0;\n /**\r\n * Adjusted end in case we have breaks.\r\n *\r\n * @todo Description\r\n */\n\n _this._adjustedEnd = 1;\n _this._extremesChanged = false;\n _this._deltaMinMax = 1;\n _this._dsc = false;\n /**\r\n * As calculating totals is expensive operation and not often needed, we\r\n * don't do it by default.\r\n *\r\n * In case you use `totalPercent` or `total` in your charts, this must be set\r\n * to `true`.\r\n *\r\n * @default false\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/xy-chart/#100_stacks} For using `calculateTotals` for 100% stacked series.\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-strings/#Placeholders_for_numeric_values} For using `calculateTotals` in labels.\r\n */\n\n _this.calculateTotals = false;\n _this.className = \"ValueAxis\"; // Set field name\n\n _this.axisFieldName = \"value\"; // Set defaults\n\n _this.setPropertyValue(\"maxZoomFactor\", 1000);\n\n _this.setPropertyValue(\"extraMin\", 0);\n\n _this.setPropertyValue(\"extraMax\", 0);\n\n _this.setPropertyValue(\"strictMinMax\", false);\n\n _this.setPropertyValue(\"maxPrecision\", Number.MAX_VALUE);\n\n _this.setPropertyValue(\"adjustLabelPrecision\", true);\n\n _this.setPropertyValue(\"extraTooltipPrecision\", 0);\n\n _this.keepSelection = false;\n _this.includeRangesInMinMax = false; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Holds reference to a function that accepts a DataItem as parameter.\r\n *\r\n * It can either return a fill opacity for a fill, or manipulate data item\r\n * directly, to create various highlighting scenarios.\r\n */\n\n\n ValueAxis.prototype.fillRule = function (dataItem) {\n var value = dataItem.value;\n var axis = dataItem.component;\n\n if (!dataItem.axisFill.disabled) {\n // rounding in left to solve floating point number\n if ($math.round(value / axis.step / 2, 5) == Math.round(value / axis.step / 2)) {\n dataItem.axisFill.__disabled = true;\n } else {\n dataItem.axisFill.__disabled = false;\n }\n }\n };\n /**\r\n * Returns a new/empty [[DataItem]] of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n ValueAxis.prototype.createDataItem = function () {\n return new ValueAxisDataItem();\n };\n /**\r\n * Returns a new/empty [[AxisBreak]] of the appropriate type.\r\n *\r\n * @return Axis break\r\n */\n\n\n ValueAxis.prototype.createAxisBreak = function () {\n return new ValueAxisBreak();\n };\n /**\r\n * [dataChangeUpdate description]\r\n *\r\n * This is a placeholder to override for extending classes.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n\n ValueAxis.prototype.dataChangeUpdate = function () {\n this.clearCache();\n\n if (!this.keepSelection) {\n if (this._start != 0 || this._end != 1) {\n this._start = 0;\n this._end = 1;\n this.dispatchImmediately(\"startendchanged\");\n }\n } else {\n if (this._start != 0) {\n this.dispatchImmediately(\"startchanged\");\n }\n\n if (this._end != 1) {\n this.dispatchImmediately(\"endchanged\");\n }\n\n if (this._start != 0 || this._end != 1) {\n this.dispatchImmediately(\"startendchanged\");\n }\n }\n\n this._maxZoomed = this._maxDefined;\n this._minZoomed = this._minDefined;\n this._maxAdjusted = this._maxDefined;\n this._minAdjusted = this._minDefined;\n };\n /**\r\n * Processes data items of the related Series.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n ValueAxis.prototype.processSeriesDataItems = function () {\n // @todo: add some boolean (maybe autodedect) if we need these calculations or not. this place uses a lot of cpu\n if (this.calculateTotals) {\n var series = this.series.getIndex(0);\n var startIndex = series.startIndex;\n\n if (series.dataItems.length > 0) {\n if (startIndex > 0) {\n startIndex--;\n }\n\n var endIndex = series.endIndex;\n\n if (endIndex < series.dataItems.length) {\n endIndex++;\n }\n\n var _loop_1 = function _loop_1(i) {\n // This has to be `var` in order to avoid garbage collection\n var total = {};\n var sum = {};\n this_1.series.each(function (series) {\n if (!series.excludeFromTotal) {\n var dataItem_1 = series.dataItems.getIndex(i);\n\n if (dataItem_1) {\n $object.each(dataItem_1.values, function (key) {\n var value = dataItem_1.values[key].workingValue; // can not use getWorkingValue here!\n\n if ($type.isNumber(value)) {\n if (!$type.isNumber(total[key])) {\n total[key] = Math.abs(value);\n } else {\n total[key] += Math.abs(value);\n }\n\n if (!$type.isNumber(sum[key])) {\n sum[key] = value;\n } else {\n sum[key] += value;\n }\n }\n });\n }\n }\n });\n this_1.series.each(function (series) {\n if (!series.excludeFromTotal) {\n var dataItem_2 = series.dataItems.getIndex(i);\n\n if (dataItem_2) {\n $object.each(dataItem_2.values, function (key) {\n var value = dataItem_2.values[key].workingValue; // can not use getWorkingValue here!\n\n if ($type.isNumber(value)) {\n dataItem_2.setCalculatedValue(key, total[key], \"total\");\n dataItem_2.setCalculatedValue(key, 100 * value / total[key], \"totalPercent\");\n dataItem_2.setCalculatedValue(key, sum[key], \"sum\");\n }\n });\n }\n }\n });\n };\n\n var this_1 = this; // This has to be `var` in order to avoid garbage collection\n\n for (var i = startIndex; i < endIndex; ++i) {\n _loop_1(i);\n }\n }\n }\n };\n /**\r\n * Validates the whole axis. Causes it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n */\n\n\n ValueAxis.prototype.validate = function () {\n if (this.axisLength <= 0) {\n return;\n }\n\n _super.prototype.validate.call(this);\n\n this.getMinMax();\n\n if (!$type.isNumber(this._minAdjusted)) {\n this.dataItems.each(function (dataItem) {\n dataItem.value = null;\n });\n }\n\n this.fixAxisBreaks();\n this.calculateZoom();\n this.validateAxisElements();\n this.validateAxisRanges();\n this.validateBreaks();\n this.hideUnusedDataItems();\n this.renderer.invalidateLayout(); // hide too close\n //this.hideTooCloseDataItems();\n };\n /**\r\n * Calculates all positions, related to axis as per current zoom.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n ValueAxis.prototype.calculateZoom = function () {\n if ($type.isNumber(this.min) && $type.isNumber(this.max)) {\n var min = this.positionToValue(this.start);\n var max = this.positionToValue(this.end);\n var differece = this.adjustDifference(min, max);\n var minMaxStep = this.adjustMinMax(min, max, differece, this._gridCount, true);\n var stepDecimalPlaces = $utils.decimalPlaces(minMaxStep.step);\n this._stepDecimalPlaces = stepDecimalPlaces;\n min = $math.round(min, stepDecimalPlaces);\n max = $math.round(max, stepDecimalPlaces);\n minMaxStep = this.adjustMinMax(min, max, differece, this._gridCount, true);\n var step = minMaxStep.step;\n\n if (this.syncWithAxis) {\n var calculated = this.getCache(min + \"-\" + max);\n\n if ($type.isNumber(calculated)) {\n step = calculated;\n }\n } else {\n min = minMaxStep.min;\n max = minMaxStep.max;\n }\n\n if (this._minZoomed != min || this._maxZoomed != max || this._step != step || this._dsc) {\n this._dsc = false;\n this._minZoomed = min;\n this._maxZoomed = max;\n this._step = step;\n this.dispatchImmediately(\"selectionextremeschanged\");\n }\n }\n };\n\n ValueAxis.prototype.fixSmallStep = function (step) {\n if (1 + step == 1) {\n step *= 2;\n return this.fixSmallStep(step);\n }\n\n return step;\n };\n /**\r\n * Validates Axis elements.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n\n ValueAxis.prototype.validateAxisElements = function () {\n var _this = this;\n\n if ($type.isNumber(this.max) && $type.isNumber(this.min)) {\n // first regular items\n var value_1 = this.minZoomed - this._step * 2;\n\n if (!this.logarithmic) {\n value_1 = Math.floor(value_1 / this._step) * this._step;\n } else {\n var differencePower = Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E;\n\n if (differencePower > 1) {\n value_1 = Math.pow(10, Math.log(this.min) * Math.LOG10E);\n } else {\n value_1 = Math.floor(this.minZoomed / this._step) * this._step;\n\n if (value_1 == 0) {\n value_1 = this.minZoomed;\n }\n }\n }\n\n var maxZoomed = this._maxZoomed + this._step;\n this.resetIterators();\n var dataItemsIterator_1 = this._dataItemsIterator;\n\n if (this._step == 0) {\n return;\n }\n\n this._step = this.fixSmallStep(this._step);\n var i = 0;\n var precisionChanged = this._prevStepDecimalPlaces != this._stepDecimalPlaces;\n this._prevStepDecimalPlaces = this._stepDecimalPlaces;\n\n while (value_1 <= maxZoomed) {\n var axisBreak = this.isInBreak(value_1);\n\n if (!axisBreak) {\n var dataItem = dataItemsIterator_1.find(function (x) {\n return x.value === value_1;\n });\n\n if (dataItem.__disabled) {\n dataItem.__disabled = false;\n } //this.processDataItem(dataItem);\n\n\n this.appendDataItem(dataItem);\n dataItem.axisBreak = undefined;\n\n if (dataItem.value != value_1 || precisionChanged) {\n dataItem.value = value_1;\n dataItem.text = this.formatLabel(value_1);\n\n if (dataItem.label && dataItem.label.invalid) {\n dataItem.label.validate();\n }\n\n if (dataItem.value >= this.min && dataItem.value <= this.max) {\n if (dataItem.label) {\n if (this.axisLetter == \"Y\" && dataItem.label.measuredWidth > this.ghostLabel.measuredWidth || this.axisLetter == \"X\" && dataItem.label.measuredHeight > this.ghostLabel.measuredHeight) {\n this.ghostLabel.text = dataItem.label.currentText;\n this.ghostLabel.validate();\n }\n }\n }\n }\n\n this.validateDataElement(dataItem);\n }\n\n i++;\n var oldValue = value_1;\n\n if (!this.logarithmic) {\n value_1 += this._step;\n } else {\n var differencePower = Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E;\n\n if (differencePower > 1) {\n value_1 = Math.pow(10, Math.log(this.min) * Math.LOG10E + i);\n } else {\n value_1 += this._step;\n }\n }\n\n var stepPower = Math.pow(10, Math.floor(Math.log(Math.abs(this._step)) * Math.LOG10E));\n\n if (stepPower < 1) {\n // exponent is less then 1 too. Count decimals of exponent\n var decCount = Math.round(Math.abs(Math.log(Math.abs(stepPower)) * Math.LOG10E)) + 2;\n decCount = Math.min(13, decCount); // round value to avoid floating point issues\n\n value_1 = $math.round(value_1, decCount); // ceil causes problems: https://codepen.io/team/amcharts/pen/XWMjZwy?editors=1010\n\n if (oldValue == value_1) {\n value_1 = maxZoomed;\n break;\n }\n }\n }\n\n var axisBreaks = this._axisBreaks;\n\n if (axisBreaks) {\n // breaks later\n var renderer_1 = this.renderer;\n $iter.each(axisBreaks.iterator(), function (axisBreak) {\n if (axisBreak.breakSize > 0) {\n // only add grid if gap is bigger then minGridDistance\n if ($math.getDistance(axisBreak.startPoint, axisBreak.endPoint) > renderer_1.minGridDistance) {\n var breakValue_1 = axisBreak.adjustedMin;\n\n while (breakValue_1 <= axisBreak.adjustedMax) {\n if (breakValue_1 >= axisBreak.adjustedStartValue && breakValue_1 <= axisBreak.adjustedEndValue) {\n var dataItem = dataItemsIterator_1.find(function (x) {\n return x.value === breakValue_1;\n });\n\n if (dataItem.__disabled) {\n dataItem.__disabled = false;\n } //this.processDataItem(dataItem);\n\n\n _this.appendDataItem(dataItem);\n\n dataItem.axisBreak = axisBreak;\n\n if (dataItem.value != breakValue_1) {\n dataItem.value = breakValue_1;\n dataItem.text = _this.formatLabel(breakValue_1);\n\n if (dataItem.label && dataItem.label.invalid) {\n dataItem.label.validate();\n }\n }\n\n _this.validateDataElement(dataItem);\n }\n\n breakValue_1 += axisBreak.adjustedStep;\n }\n }\n }\n });\n }\n }\n };\n /**\r\n * Validates axis data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param dataItem Data item\r\n */\n\n\n ValueAxis.prototype.validateDataElement = function (dataItem) {\n _super.prototype.validateDataElement.call(this, dataItem); //dataItem.__disabled = false;\n\n\n dataItem.itemIndex = this._axisItemCount;\n this._axisItemCount++;\n var renderer = this.renderer;\n var value = dataItem.value;\n var endValue = dataItem.endValue;\n var position = this.valueToPosition(value);\n dataItem.position = position;\n var endPosition = position;\n var fillEndPosition = this.valueToPosition(value + this._step);\n\n if ($type.isNumber(endValue)) {\n endPosition = this.valueToPosition(endValue);\n fillEndPosition = endPosition;\n } // this point is needed to calculate distance to satisfy minGridDistance\n\n\n dataItem.point = renderer.positionToPoint(position);\n var tick = dataItem.tick;\n\n if (tick && !tick.disabled) {\n renderer.updateTickElement(tick, position, endPosition);\n }\n\n var grid = dataItem.grid;\n\n if (grid && !grid.disabled) {\n renderer.updateGridElement(grid, position, endPosition);\n }\n\n var label = dataItem.label;\n\n if (label && !label.disabled) {\n renderer.updateLabelElement(label, position, endPosition);\n }\n\n var fill = dataItem.axisFill;\n\n if (fill && !fill.disabled) {\n renderer.updateFillElement(fill, position, fillEndPosition);\n\n if (!dataItem.isRange) {\n this.fillRule(dataItem);\n }\n }\n\n if (dataItem.bullet) {\n renderer.updateBullet(dataItem.bullet, position, endPosition);\n }\n\n var mask = dataItem.mask;\n\n if (mask) {\n renderer.updateFillElement(mask, position, fillEndPosition);\n }\n };\n /**\r\n * Formats the value according to axis' own [[NumberFormatter]].\r\n *\r\n * @param value Source value\r\n * @return Formatted value\r\n */\n\n\n ValueAxis.prototype.formatLabel = function (value) {\n if (this.adjustLabelPrecision && value != 0) {\n return this.numberFormatter.format(value, undefined, this._stepDecimalPlaces);\n } else {\n return this.numberFormatter.format(value);\n }\n };\n\n Object.defineProperty(ValueAxis.prototype, \"basePoint\", {\n /**\r\n * Coordinates of the actual axis start.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Base point\r\n */\n get: function get() {\n var baseValue = this.baseValue;\n var position = this.valueToPosition(baseValue);\n var basePoint = this.renderer.positionToPoint(position);\n return basePoint;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"baseValue\", {\n /**\r\n * @return base value\r\n */\n get: function get() {\n var baseValue = this._baseValue;\n\n if (this.logarithmic) {\n baseValue = this.min;\n }\n\n if (!this._adapterO) {\n return baseValue;\n } else {\n return this._adapterO.apply(\"baseValue\", baseValue);\n }\n },\n\n /**\r\n * A base value.\r\n *\r\n * This is a threshold value that will divide \"positive\" and \"negative\"\r\n * value ranges.\r\n *\r\n * Other scale-related functionality also depend on base value. E.g. stacks,\r\n * value-dependent coloring, etc.\r\n *\r\n * @param value Base value\r\n */\n set: function set(value) {\n this._baseValue = value;\n this.invalidateLayout();\n this.invalidateSeries();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts a numeric value to relative position on axis\r\n *\r\n * An alias to `valueToPosition()`.\r\n *\r\n * @param value Value\r\n * @return Position\r\n */\n\n ValueAxis.prototype.anyToPosition = function (value) {\n return this.valueToPosition(value);\n };\n /**\r\n * Converts a numeric value to orientation point (x, y, angle) on axis\r\n *\r\n * @param value Value\r\n * @return Orientation point\r\n */\n\n\n ValueAxis.prototype.valueToPoint = function (value) {\n var position = this.valueToPosition(value);\n var point = this.renderer.positionToPoint(position);\n var angle = this.renderer.positionToAngle(position);\n return {\n x: point.x,\n y: point.y,\n angle: angle\n };\n };\n /**\r\n * Converts a numeric value to orientation (x, y, angle) point on axis\r\n *\r\n * @param value Value\r\n * @return Orientation point\r\n */\n\n\n ValueAxis.prototype.anyToPoint = function (value) {\n return this.valueToPoint(value);\n };\n /**\r\n * Converts a numeric value to relative position on axis.\r\n *\r\n * @param value Value\r\n * @return relative position\r\n */\n\n\n ValueAxis.prototype.valueToPosition = function (value) {\n if ($type.isNumber(value)) {\n // todo: think if possible to take previous value and do not go through all previous breaks\n var min_1 = this.min;\n var max_1 = this.max;\n\n if ($type.isNumber(min_1) && $type.isNumber(max_1)) {\n var difference = this._difference;\n var axisBreaks = this._axisBreaks;\n\n if (axisBreaks && axisBreaks.length > 0) {\n $iter.eachContinue(axisBreaks.iterator(), function (axisBreak) {\n var startValue = axisBreak.adjustedStartValue;\n var endValue = axisBreak.adjustedEndValue;\n\n if ($type.isNumber(startValue) && $type.isNumber(endValue)) {\n if (value < startValue) {\n return false;\n }\n\n if ($math.intersect({\n start: startValue,\n end: endValue\n }, {\n start: min_1,\n end: max_1\n })) {\n // todo: check this once and set some flag in axisBreak\n startValue = Math.max(startValue, min_1);\n endValue = Math.min(endValue, max_1);\n var breakSize = axisBreak.breakSize; // value to the right of break end\n\n if (value > endValue) {\n min_1 += (endValue - startValue) * (1 - breakSize); // todo: maybe this can be done differently?\n } // value to the left of break start\n else if (value < startValue) {} // value within break\n else {\n value = startValue + (value - startValue) * breakSize;\n }\n }\n }\n\n return true;\n });\n }\n\n var position = void 0;\n\n if (!this.logarithmic) {\n position = (value - min_1) / difference;\n } else {\n var treatZeroAs = this.treatZeroAs;\n\n if ($type.isNumber(treatZeroAs)) {\n if (value <= treatZeroAs) {\n value = treatZeroAs;\n }\n }\n\n position = (Math.log(value) * Math.LOG10E - Math.log(this.min) * Math.LOG10E) / (Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E);\n } //position = $math.round(position, 10);\n\n\n return position;\n }\n }\n\n return 0;\n };\n /**\r\n * When fontSize of fontFamily changes we need to hard-invalidate all Labels of this container to position them properly.\r\n */\n\n\n ValueAxis.prototype.invalidateLabels = function () {\n _super.prototype.invalidateLabels.call(this);\n\n if (this.dataItems) {\n this.dataItems.each(function (dataItem) {\n dataItem.value = undefined;\n });\n this.invalidate();\n }\n };\n /**\r\n * Converts an relative position to a corresponding value within\r\n * axis' scale.\r\n *\r\n * @param position Position (px)\r\n * @return Value\r\n */\n\n\n ValueAxis.prototype.positionToValue = function (position) {\n var min = this.min;\n var max = this.max;\n\n if ($type.isNumber(min) && $type.isNumber(max)) {\n var difference_1 = max - min; //no need to adjust!\n\n var value_2 = null;\n var axisBreaks = this._axisBreaks;\n\n if (axisBreaks) {\n // in case we have some axis breaks\n if (axisBreaks.length > 0) {\n $iter.eachContinue(axisBreaks.iterator(), function (axisBreak) {\n var breakStartPosition = axisBreak.startPosition;\n var breakEndPosition = axisBreak.endPosition;\n var breakStartValue = axisBreak.adjustedStartValue;\n var breakEndValue = axisBreak.adjustedEndValue;\n\n if ($type.isNumber(breakStartValue) && $type.isNumber(breakEndValue)) {\n if (breakStartValue > max) {\n return false;\n }\n\n if ($math.intersect({\n start: breakStartValue,\n end: breakEndValue\n }, {\n start: min,\n end: max\n })) {\n breakStartValue = $math.max(breakStartValue, min);\n breakEndValue = $math.min(breakEndValue, max);\n var breakSize = axisBreak.breakSize;\n difference_1 -= (breakEndValue - breakStartValue) * (1 - breakSize); // position to the right of break end\n\n if (position > breakEndPosition) {\n min += (breakEndValue - breakStartValue) * (1 - breakSize);\n } // position to the left of break start\n else if (position < breakStartPosition) {} // value within break\n else {\n var breakPosition = (position - breakStartPosition) / (breakEndPosition - breakStartPosition);\n value_2 = breakStartValue + breakPosition * (breakEndValue - breakStartValue);\n return false;\n }\n }\n\n return true;\n }\n });\n }\n }\n\n if (!$type.isNumber(value_2)) {\n if (this.logarithmic) {\n value_2 = Math.pow(Math.E, (position * (Math.log(this.max) * Math.LOG10E - Math.log(this.min) * Math.LOG10E) + Math.log(this.min) * Math.LOG10E) / Math.LOG10E);\n } else {\n value_2 = position * difference_1 + min;\n }\n }\n\n return value_2;\n } //}\n\n };\n /**\r\n * Converts an X coordinate to a relative value in axis' scale.\r\n *\r\n * @param x X (px)\r\n * @return Value\r\n */\n\n\n ValueAxis.prototype.xToValue = function (x) {\n return this.positionToValue(this.pointToPosition({\n x: x,\n y: 0\n }));\n };\n /**\r\n * Converts an Y coordinate to a relative value in axis' scale.\r\n *\r\n * @param y Y (px)\r\n * @return Value\r\n */\n\n\n ValueAxis.prototype.yToValue = function (y) {\n return this.positionToValue(this.pointToPosition({\n x: 0,\n y: y\n }));\n };\n /**\r\n * Converts pixel coordinates to a relative position. (0-1)\r\n *\r\n * @param point Coorinates (px)\r\n * @return Position (0-1)\r\n */\n\n\n ValueAxis.prototype.pointToPosition = function (point) {\n if (this.renderer instanceof AxisRendererY) {\n return 1 - this.renderer.pointToPosition(point);\n } else {\n return this.renderer.pointToPosition(point);\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n ValueAxis.prototype.animateMinMax = function (min, max) {\n return this.animate([{\n property: \"_minAdjusted\",\n from: this._minAdjusted,\n to: min\n }, {\n property: \"_maxAdjusted\",\n from: this._maxAdjusted,\n to: max\n }], this.rangeChangeDuration, this.rangeChangeEasing);\n };\n /**\r\n * Calculates smallest and biggest value for the axis scale.\r\n * @ignore\r\n * @todo Description (review)\r\n */\n\n\n ValueAxis.prototype.getMinMax = function () {\n var _this = this;\n\n this.updateGridCount();\n var min = Number.POSITIVE_INFINITY;\n var max = Number.NEGATIVE_INFINITY; // only if min and max are not set from outside, we go through min and max influencers\n\n if (!$type.isNumber(this._minDefined) || !$type.isNumber(this._maxDefined)) {\n this.series.each(function (series) {\n if (!series.ignoreMinMax) {\n // check min\n var seriesMin = series.min(_this);\n\n if ($type.isNumber(seriesMin) && seriesMin < min) {\n min = seriesMin;\n } // check max\n\n\n var seriesMax = series.max(_this);\n\n if ($type.isNumber(seriesMax) && seriesMax > max) {\n max = seriesMax;\n }\n }\n });\n\n if (this.includeRangesInMinMax) {\n this.axisRanges.each(function (range) {\n if (!range.ignoreMinMax) {\n var minValue = $math.min(range.value, range.endValue);\n var maxValue = $math.max(range.value, range.endValue);\n\n if (minValue < min || !$type.isNumber(min)) {\n min = minValue;\n }\n\n if (maxValue > max || !$type.isNumber(max)) {\n max = maxValue;\n }\n }\n });\n }\n }\n\n if (this.logarithmic) {\n var treatZeroAs = this.treatZeroAs;\n\n if ($type.isNumber(treatZeroAs)) {\n if (min <= 0) {\n min = treatZeroAs;\n }\n }\n\n if (min <= 0) {\n this.raiseCriticalError(new Error(\"Logarithmic value axis can not have values <= 0.\"), true);\n }\n }\n\n if (min == 0 && max == 0) {\n max = 0.9;\n min = -0.9;\n } // if defined from outside\n\n\n if ($type.isNumber(this._minDefined)) {\n min = this._minDefined;\n }\n\n if ($type.isNumber(this._maxDefined)) {\n max = this._maxDefined;\n }\n\n if (this._adapterO) {\n min = this._adapterO.apply(\"min\", min);\n }\n\n if (this._adapterO) {\n max = this._adapterO.apply(\"max\", max);\n }\n\n if (!$type.isNumber(min) || !$type.isNumber(max)) {\n return;\n }\n\n this._minReal = min;\n this._maxReal = max;\n\n if (min == Number.POSITIVE_INFINITY) {\n min = undefined;\n }\n\n if (max == Number.NEGATIVE_INFINITY) {\n max = undefined;\n }\n\n var dif = this.adjustDifference(min, max); // previously it was max-min, but not worked well\n\n min = this.fixMin(min);\n max = this.fixMax(max); // this happens if starLocation and endLocation are 0.5 and DateAxis has only one date\n\n if (max - min <= 1 / Math.pow(10, 15)) {\n if (max - min != 0) {\n this._deltaMinMax = (max - min) / 2;\n } else {\n // the number by which we need to raise 10 to get difference\n var exponent = Math.log(Math.abs(max)) * Math.LOG10E; // here we find a number which is power of 10 and has the same count of numbers as difference has\n\n var power = Math.pow(10, Math.floor(exponent)); // reduce this number by 10 times\n\n power = power / 10;\n this._deltaMinMax = power;\n }\n\n min -= this._deltaMinMax;\n max += this._deltaMinMax;\n }\n\n min -= (max - min) * this.extraMin;\n max += (max - min) * this.extraMax;\n var strict = this.strictMinMax;\n\n if ($type.isNumber(this._maxDefined)) {\n strict = true;\n }\n\n var minMaxStep = this.adjustMinMax(min, max, dif, this._gridCount, strict);\n min = minMaxStep.min;\n max = minMaxStep.max;\n dif = max - min; //new\n // do it for the second time (importat!)\n\n minMaxStep = this.adjustMinMax(min, max, max - min, this._gridCount, true);\n min = minMaxStep.min;\n max = minMaxStep.max; // return min max if strict\n\n if (this.strictMinMax) {\n if ($type.isNumber(this._minDefined)) {\n min = this._minDefined;\n } else {\n min = this._minReal;\n }\n\n if ($type.isNumber(this._maxDefined)) {\n max = this._maxDefined;\n } else {\n max = this._maxReal;\n }\n\n if (max - min <= 0.00000001) {\n min -= this._deltaMinMax;\n max += this._deltaMinMax;\n }\n\n min -= (max - min) * this.extraMin;\n max += (max - min) * this.extraMax;\n }\n\n if (this._adapterO) {\n min = this._adapterO.apply(\"min\", min);\n }\n\n if (this._adapterO) {\n max = this._adapterO.apply(\"max\", max);\n }\n\n this._step = minMaxStep.step;\n\n if (!$type.isNumber(min) && !$type.isNumber(max)) {\n this.start = 0;\n this.end = 1;\n this.renderer.labels.each(function (label) {\n label.dataItem.text = \"\";\n });\n } // checking isNumber is good when all series are hidden\n\n\n if ((this._minAdjusted != min || this._maxAdjusted != max) && $type.isNumber(min) && $type.isNumber(max)) {\n var animation = this._minMaxAnimation;\n\n if (this._extremesChanged && $type.isNumber(this._minAdjusted) && $type.isNumber(this._maxAdjusted) && this.inited) {\n if (animation && !animation.isFinished() && this._finalMax == max && this._finalMin == min) {\n return;\n } else {\n this._finalMin = min;\n this._finalMax = max;\n animation = this.animateMinMax(min, max);\n\n if (animation && !animation.isFinished()) {\n animation.events.on(\"animationprogress\", this.validateDataItems, this);\n animation.events.on(\"animationended\", function () {\n //this.validateDataItems();\n _this.series.each(function (series) {\n series.validate();\n });\n\n _this.validateDataItems();\n\n _this.handleSelectionExtremesChange();\n });\n this._minMaxAnimation = animation;\n } else {\n this.series.each(function (series) {\n series.invalidate();\n });\n }\n\n this.validateDataItems();\n this.dispatchImmediately(\"extremeschanged\");\n this.handleSelectionExtremesChange();\n }\n } else {\n if (animation && !animation.isFinished() && this._finalMax == max && this._finalMin == min) {\n return;\n } else {\n this._minAdjusted = min;\n this._maxAdjusted = max;\n this._finalMin = min;\n this._finalMax = max;\n this.invalidateDataItems();\n this.dispatchImmediately(\"extremeschanged\");\n }\n }\n }\n\n this._extremesChanged = false;\n this._difference = this.adjustDifference(min, max);\n };\n /**\r\n * Adjusts the minimum value.\r\n *\r\n * This is a placeholder method for extending classes to override.\r\n *\r\n * For numeric values this does nothing, however for more complex types, like\r\n * dates, it may be necessary to adjust.\r\n *\r\n * @param value Value\r\n * @return Adjusted value\r\n */\n\n\n ValueAxis.prototype.fixMin = function (value) {\n return value;\n };\n /**\r\n * Adjusts the maximum value.\r\n *\r\n * This is a placeholder method for extending classes to override.\r\n *\r\n * For numeric values this does nothing, however for more complex types, like\r\n * dates, it may be necessary to adjust.\r\n *\r\n * @param value Value\r\n * @return Adjusted value\r\n */\n\n\n ValueAxis.prototype.fixMax = function (value) {\n return value;\n };\n /**\r\n * Adjusts actual min and max scale values so that the axis starts and ends\r\n * at \"nice\" values, unless `strictMinMax` is set.\r\n *\r\n * The `difference` can be something else than `max - min`, because of the\r\n * axis breaks.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param min [description]\r\n * @param max [description]\r\n * @param difference [description]\r\n * @param gridCount [description]\r\n * @param strictMode [description]\r\n * @return [description]\r\n */\n\n\n ValueAxis.prototype.adjustMinMax = function (min, max, difference, gridCount, strictMode) {\n // will fail if 0\n if (gridCount <= 1) {\n gridCount = 1;\n }\n\n gridCount = Math.round(gridCount);\n var initialMin = min;\n var initialMax = max; // in case min and max is the same, use max\n\n if (difference === 0) {\n difference = Math.abs(max);\n } // the number by which we need to raise 10 to get difference\n\n\n var exponent = Math.log(Math.abs(difference)) * Math.LOG10E; // here we find a number which is power of 10 and has the same count of numbers as difference has\n\n var power = Math.pow(10, Math.floor(exponent)); // reduce this number by 10 times\n\n power = power / 10;\n var extra = power;\n\n if (strictMode) {\n extra = 0;\n }\n\n if (!this.logarithmic) {\n // round down min\n if (strictMode) {\n min = Math.floor(min / power) * power; // round up max\n\n max = Math.ceil(max / power) * power;\n } else {\n min = Math.ceil(min / power) * power - extra; // round up max\n\n max = Math.floor(max / power) * power + extra;\n } // don't let min go below 0 if real min is >= 0\n\n\n if (min < 0 && initialMin >= 0) {\n min = 0;\n } // don't let max go above 0 if real max is <= 0\n\n\n if (max > 0 && initialMax <= 0) {\n max = 0;\n }\n } else {\n if (min <= 0) {\n //throw Error(\"Logarithmic value axis can not have values <= 0.\");\n min = this.baseValue;\n } // @todo: think of a better way or to restrict zooming when no series are selected\n\n\n if (min == Infinity) {\n min = 1;\n }\n\n if (max == -Infinity) {\n max = 10;\n }\n\n if (this.strictMinMax) {\n if (this._minDefined > 0) {\n min = this._minDefined;\n } else {\n min = min;\n }\n\n if (this._maxDefined > 0) {\n max = max;\n }\n } else {\n min = Math.pow(10, Math.floor(Math.log(Math.abs(min)) * Math.LOG10E));\n max = Math.pow(10, Math.ceil(Math.log(Math.abs(max)) * Math.LOG10E));\n }\n } // repeat diff, exponent and power again with rounded values\n //difference = this.adjustDifference(min, max);\n\n /*\r\n if(min > initialMin){\r\n min = initialMin;\r\n }\r\n if(max < initialMax){\r\n max = initialMax;\r\n }\r\n */\n\n\n exponent = Math.log(Math.abs(difference)) * Math.LOG10E;\n power = Math.pow(10, Math.floor(exponent));\n power = power / 10; // approximate difference between two grid lines\n\n var step = Math.ceil(difference / gridCount / power) * power;\n var stepPower = Math.pow(10, Math.floor(Math.log(Math.abs(step)) * Math.LOG10E)); // TODO: in v3 I had fixStepE here, ommiting it for a while, need to think about other solution\n // the step should divide by 2, 5, and 10.\n\n var stepDivisor = Math.ceil(step / stepPower); // number 0 - 10\n\n if (stepDivisor > 5) {\n stepDivisor = 10;\n } else if (stepDivisor <= 5 && stepDivisor > 2) {\n stepDivisor = 5;\n } // now get real step\n\n\n step = Math.ceil(step / (stepPower * stepDivisor)) * stepPower * stepDivisor;\n\n if (this.maxPrecision < Number.MAX_VALUE && step != $math.ceil(step, this.maxPrecision)) {\n step = $math.ceil(step, this.maxPrecision);\n }\n\n var decCount = 0; // in case numbers are smaller than 1\n\n if (stepPower < 1) {\n // exponent is less then 1 too. Count decimals of exponent\n decCount = Math.round(Math.abs(Math.log(Math.abs(stepPower)) * Math.LOG10E)) + 1; // round step\n\n step = $math.round(step, decCount);\n }\n\n if (!this.logarithmic) {\n // final min and max\n var minCount = Math.floor(min / step);\n min = $math.round(step * minCount, decCount);\n var maxCount = void 0;\n\n if (!strictMode) {\n maxCount = Math.ceil(max / step);\n } else {\n maxCount = Math.floor(max / step);\n }\n\n if (maxCount == minCount) {\n maxCount++;\n }\n\n max = $math.round(step * maxCount, decCount);\n\n if (max < initialMax) {\n max = max + step;\n }\n\n if (min > initialMin) {\n min = min - step;\n }\n }\n\n return {\n min: min,\n max: max,\n step: step\n };\n };\n\n Object.defineProperty(ValueAxis.prototype, \"min\", {\n /**\r\n * @return Min value\r\n */\n get: function get() {\n var min = this._minAdjusted;\n\n if (!$type.isNumber(min)) {\n min = this._minDefined;\n }\n\n return min;\n },\n\n /**\r\n * A minimum value for the axis scale.\r\n *\r\n * This value might be auto-adjusted by the Axis in order to accomodate the\r\n * grid nicely, i.e. plot area is divided by grid in nice equal cells.\r\n *\r\n * The above might be overridden by `strictMinMax` which will force exact\r\n * user-defined min and max values to be used for scale.\r\n *\r\n * @param value Min value\r\n */\n set: function set(value) {\n if (this._minDefined != value) {\n this._minDefined = value;\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"minDefined\", {\n /**\r\n * Min value as defined by user's code, not auto-calculated.\r\n *\r\n * @readonly\r\n * @return Min value\r\n */\n get: function get() {\n return this._minDefined;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"maxDefined\", {\n /**\r\n * Max value as defined by user's code, not auto-calculated.\r\n *\r\n * @readonly\r\n * @return Man value\r\n */\n get: function get() {\n return this._maxDefined;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"extraMin\", {\n /**\r\n * @return {number}\r\n */\n get: function get() {\n return this.getPropertyValue(\"extraMin\");\n },\n\n /**\r\n * Allows relatively adjusting minimum value of the axis' scale.\r\n *\r\n * The value is relative to the actual range of values currently displayed\r\n * on the axis.\r\n *\r\n * E.g.: 0.5 will mean half of the current range. If we have axis displaying\r\n * from 100 to 200, we will now have axis displaying from 50 to 200 because\r\n * we asked to expand minimum value by 50% (0.5).\r\n *\r\n * NOTE: this setting is not compatible with `strictMinMax`.\r\n *\r\n * @param {number}\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"extraMin\", value)) {\n this.invalidateDataItems();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"extraMax\", {\n /**\r\n * @return Min multiplier\r\n */\n get: function get() {\n return this.getPropertyValue(\"extraMax\");\n },\n\n /**\r\n * Allows relatively adjusting maximum value of the axis' scale.\r\n *\r\n * The value is relative to the actual range of values currently displayed\r\n * on the axis.\r\n *\r\n * E.g.: 0.5 will mean half of the current range. If we have axis displaying\r\n * from 100 to 200, we will now have axis displaying from 100 to 250 because\r\n * we asked to expand maximum value by 50% (0.5).\r\n *\r\n * NOTE: this setting is not compatible with `strictMinMax`.\r\n *\r\n * @param {number}\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"extraMax\", value)) {\n this.invalidateDataItems();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"step\", {\n /**\r\n * Current calculated delta in values between two adjacent grid lines (step).\r\n *\r\n * This is a read-only value and cannot be used to set actual step.\r\n *\r\n * @readonly\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/axes/positioning-axis-elements/#Setting_the_density_of_the_the_grid_labels} For more information about modifying density of labels\r\n * @return [description]\r\n */\n get: function get() {\n return this._step;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"max\", {\n /**\r\n * @return Max value\r\n */\n get: function get() {\n var max = this._maxAdjusted;\n\n if (!$type.isNumber(max)) {\n max = this._maxDefined;\n }\n\n return max;\n },\n\n /**\r\n * A maximum value for the axis scale.\r\n *\r\n * This value might be auto-adjusted by the Axis in order to accomodate the\r\n * grid nicely, i.e. plot area is divided by grid in nice equal cells.\r\n *\r\n * The above might be overridden by `strictMinMax` which will force exact\r\n * user-defined min and max values to be used for scale.\r\n *\r\n * @param value Max value\r\n */\n set: function set(value) {\n if (this._maxDefined != value) {\n this._maxDefined = value;\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"adjustLabelPrecision\", {\n /**\r\n * @return Adjust precision\r\n */\n get: function get() {\n return this.getPropertyValue(\"adjustLabelPrecision\");\n },\n\n /**\r\n * By default the axis will adjust precision of all numbers to match number\r\n * of decimals in all its labels, e.g.: `1.0`, `1.5`, `2.0`.\r\n *\r\n * To disable set `adjustLabelPrecision` to `false`, to use whatever other\r\n * precision or number format settings are set.\r\n *\r\n * IMPORTANT: This setting will be ignored if your number format uses\r\n * modifiers, e.g. `\"#a\"`.\r\n *\r\n * @default true\r\n * @since 4.9.14\r\n * @param value Adjust precision\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"adjustLabelPrecision\", value)) {\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Used for the Series to register itself as the user of this Axis.\r\n *\r\n * This will also decorate both the Series and Axis with event handlers, used\r\n * to redraw on Axis position/zoom change.\r\n *\r\n * A disposer for those events is returned, so that they can be disposed\r\n * together with Series.\r\n *\r\n * @ignore Exclude from docs\r\n * @param series Series\r\n * @return Disposer for events\r\n */\n\n ValueAxis.prototype.registerSeries = function (series) {\n return new MultiDisposer([_super.prototype.registerSeries.call(this, series), series.events.on(\"extremeschanged\", this.handleExtremesChange, this, false), series.events.on(\"selectionextremeschanged\", this.handleSelectionExtremesChange, this, false), this.events.on(\"extremeschanged\", series.invalidate, series, false)]);\n };\n /**\r\n * Perform tasks after Axis zoom.\r\n */\n\n\n ValueAxis.prototype.handleSelectionExtremesChange = function () {\n var _this = this;\n\n var selectionMin;\n var selectionMax;\n var allHidden = true;\n $iter.each(this.series.iterator(), function (series) {\n if (!series.ignoreMinMax && !series.isHidden && !series.outOfRange) {\n if (series.visible && !series.isHiding) {\n allHidden = false;\n }\n\n var seriesSelectionMin = series.selectionMin(_this);\n var seriesSelectionMax = series.selectionMax(_this);\n\n if ($type.isNumber(seriesSelectionMin)) {\n if (!$type.isNumber(selectionMin) || seriesSelectionMin < selectionMin) {\n selectionMin = seriesSelectionMin;\n }\n } // check max\n\n\n if ($type.isNumber(seriesSelectionMax)) {\n if (!$type.isNumber(selectionMax) || seriesSelectionMax > selectionMax) {\n selectionMax = seriesSelectionMax;\n }\n }\n }\n });\n\n if (this.includeRangesInMinMax) {\n this.axisRanges.each(function (range) {\n if (!range.ignoreMinMax) {\n var minValue = $math.min(range.value, range.endValue);\n var maxValue = $math.max(range.value, range.endValue);\n\n if (minValue < selectionMin) {\n selectionMin = minValue;\n }\n\n if (maxValue > selectionMax) {\n selectionMax = maxValue;\n }\n }\n });\n } // this is not good, as if date axis is initially zoomed, selection of y axis is reset to 0, 1 at the end of this method\n //$iter.each(this.series.iterator(), (series) => {\n //\tif (!series.appeared) {\n //\t\tallHidden = true;\n //\t}\n //})\n\n\n if ($type.isNumber(this._minDefined)) {\n if (this.strictMinMax) {\n selectionMin = this._minDefined;\n } else {\n selectionMin = this.min;\n }\n } else if (this.strictMinMax) {\n selectionMin = this._minReal;\n }\n\n if ($type.isNumber(this._maxDefined)) {\n if (this.strictMinMax) {\n selectionMax = this._maxDefined;\n } else {\n selectionMax = this.max;\n }\n } else if (this.strictMinMax) {\n selectionMax = this._maxReal;\n }\n\n if (selectionMin == selectionMax) {\n selectionMin -= this._deltaMinMax;\n selectionMax += this._deltaMinMax;\n var minMaxStep2 = this.adjustMinMax(selectionMin, selectionMax, 0, this._gridCount, this.strictMinMax);\n selectionMin = minMaxStep2.min;\n selectionMax = minMaxStep2.max;\n }\n\n var dif = this.adjustDifference(selectionMin, selectionMax);\n var minMaxStep = this.adjustMinMax(selectionMin, selectionMax, dif, this._gridCount);\n selectionMin = minMaxStep.min;\n selectionMax = minMaxStep.max;\n selectionMin -= (selectionMax - selectionMin) * this.extraMin;\n selectionMax += (selectionMax - selectionMin) * this.extraMax;\n selectionMin = $math.fitToRange(selectionMin, this.min, this.max);\n selectionMax = $math.fitToRange(selectionMax, this.min, this.max); // do it for the second time !important\n\n dif = this.adjustDifference(selectionMin, selectionMax);\n minMaxStep = this.adjustMinMax(selectionMin, selectionMax, dif, this._gridCount, true);\n selectionMin = minMaxStep.min;\n selectionMax = minMaxStep.max;\n\n if (this.strictMinMax) {\n selectionMin = $math.max(selectionMin, this._minDefined);\n selectionMax = $math.min(selectionMax, this._maxDefined);\n }\n\n var step = minMaxStep.step;\n\n if (this.syncWithAxis) {\n minMaxStep = this.syncAxes(selectionMin, selectionMax, step);\n selectionMin = minMaxStep.min;\n selectionMax = minMaxStep.max;\n this.invalidate();\n }\n\n step = minMaxStep.step; // needed because of grouping\n\n this._difference = this.adjustDifference(this.min, this.max);\n var start = this.valueToPosition(selectionMin);\n var end = this.valueToPosition(selectionMax); // in case all series are hidden or hiding, full zoomout\n\n if (allHidden && !this.syncWithAxis) {\n start = 0;\n end = 1;\n }\n\n var declination = 0;\n\n if (this.syncWithAxis) {\n declination = 5;\n this.setCache(selectionMin + \"-\" + selectionMax, step);\n } else {\n if (this._step != step || this._minZoomed != selectionMin || this._maxZoomed != selectionMax) {\n this._dsc = true;\n }\n\n this._step = step;\n this._minZoomed = selectionMin;\n this._maxZoomed = selectionMax;\n }\n\n if (!this.keepSelection) {\n this.zoom({\n start: start,\n end: end\n }, false, false, declination);\n }\n };\n\n Object.defineProperty(ValueAxis.prototype, \"strictMinMax\", {\n /**\r\n * @return Use exact values?\r\n */\n get: function get() {\n return this.getPropertyValue(\"strictMinMax\");\n },\n\n /**\r\n * Indicates whether to blindly use exact `min` and `max` values set by user\r\n * when generating Axis scale.\r\n *\r\n * If not set, the Axis might slightly adjust those values to accomodate a\r\n * better looking grid.\r\n *\r\n * NOTE: if `min` and `max` are not set, setting `strictMinMax` to `true`\r\n * will result in fixing the scale of the axis to actual lowest and highest\r\n * values in the series within currently selected scope.\r\n *\r\n * @default false\r\n * @param value Use exact values?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"strictMinMax\", value)) {\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"logarithmic\", {\n /**\r\n * @return Logarithmic scale?\r\n */\n get: function get() {\n return this.getPropertyValue(\"logarithmic\");\n },\n\n /**\r\n * Indicates if this axis should use a logarithmic scale.\r\n *\r\n * Please note that logarithmic axis can **only** accommodate values bigger\r\n * than zero.\r\n *\r\n * Having zero or negative values will result in error and failure of the\r\n * whole chart.\r\n *\r\n * @param value Logarithmic scale?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"logarithmic\", value)) {\n this.invalidate();\n this.series.each(function (series) {\n series.invalidateDataItems();\n });\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"keepSelection\", {\n /**\r\n * @return Preseve zoom after data update?\r\n */\n get: function get() {\n return this.getPropertyValue(\"keepSelection\");\n },\n\n /**\r\n * Indicates if a current selection (zoom) should be kept across data updates.\r\n *\r\n * If your axis is zoomed while chart's data is updated, the axis will try\r\n * to retain the same start and end values.\r\n *\r\n * You can also use this to initially pre-zoom axis:\r\n *\r\n * ```TypeScript\r\n * axis.keepSelection = true;\r\n * axis.start = 0.5;\r\n * axis.end = 0.7;\r\n * ```\r\n * ```JavaScript\r\n * axis.keepSelection = true;\r\n * axis.start = 0.5;\r\n * axis.end = 0.7;\r\n * ```\r\n * ```JSON\r\n * {\r\n * \"xAxes\": [{\r\n * // ...\r\n * \"keepSelection\": true,\r\n * \"start\": 0.5,\r\n * \"end\": 0.7\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * The above will start the chart zoomed from the middle of the actual scope\r\n * to 70%.\r\n *\r\n * @since 4.1.1\r\n * @default false\r\n * @param value Preseve zoom after data update?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"keepSelection\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"includeRangesInMinMax\", {\n /**\r\n * @return Include ranges?\r\n */\n get: function get() {\n return this.getPropertyValue(\"includeRangesInMinMax\");\n },\n\n /**\r\n * If set to `true`, values of axis ranges will be included when calculating\r\n * range of values / scale of the [[ValueAxis]].\r\n *\r\n * @default false\r\n * @since 4.4.9\r\n * @param value Include ranges?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"includeRangesInMinMax\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"maxPrecision\", {\n /**\r\n * @return max precision\r\n */\n get: function get() {\n return this.getPropertyValue(\"maxPrecision\");\n },\n\n /**\r\n * Maximum number of decimals to allow when placing grid lines and labels\r\n * on axis.\r\n *\r\n * Set it to `0` (zero) to force integer-only axis labels.\r\n *\r\n * @param {number}\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"maxPrecision\", value)) {\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"extraTooltipPrecision\", {\n /**\r\n * @return Extra decimals\r\n */\n get: function get() {\n return this.getPropertyValue(\"extraTooltipPrecision\");\n },\n\n /**\r\n * This setting allows using bigger precision for numbers displayed in axis\r\n * tooltip.\r\n *\r\n * Please note that this setting indicates additional decimal places to\r\n * automatically-calculated axis number precision.\r\n *\r\n * So if your axis displays numbers like 0.1, 0.2, etc. (one decimal place),\r\n * and you set `extraTooltipPrecision = 1`, tooltips will display numbers\r\n * like 0.12, 0.25, etc. (two decimal places).\r\n *\r\n * @default 0\r\n * @since 4.8.3\r\n * @param value Extra decimals\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"extraTooltipPrecision\", value)) {\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Invalidates axis data items when series extremes change\r\n */\n\n ValueAxis.prototype.handleExtremesChange = function () {\n var _this = this;\n\n this._extremesChanged = true;\n this.getMinMax();\n\n if (this.ghostLabel) {\n var mw_1 = 0;\n this.dataItems.each(function (dataItem) {\n if (dataItem.label && dataItem.label.pixelWidth > mw_1) {\n _this.ghostLabel.text = dataItem.label.currentText;\n }\n });\n }\n };\n /**\r\n * Returns relative position on axis for series' data item's value.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey ?\r\n * @return X coordinate (px)\r\n */\n\n\n ValueAxis.prototype.getX = function (dataItem, key, location, stackKey, range) {\n return this.renderer.positionToPoint(this.getPositionX(dataItem, key, location, stackKey, range)).x;\n };\n /**\r\n * Returns the X coordinate for series' data item's value.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey ?\r\n * @return Relative position\r\n */\n\n\n ValueAxis.prototype.getPositionX = function (dataItem, key, location, stackKey, range) {\n var value = dataItem.getWorkingValue(key);\n\n if (!$type.hasValue(stackKey)) {\n stackKey = \"valueX\";\n }\n\n var stack = dataItem.getValue(stackKey, \"stack\");\n\n if (!$type.isNumber(value)) {\n value = this.baseValue;\n\n if (this.logarithmic) {\n if (stack > 0) {\n value = 0;\n }\n }\n }\n\n var position = this.valueToPosition(value + stack);\n\n if (range) {\n position = $math.fitToRange(position, range.start, range.end);\n }\n\n return position;\n };\n /**\r\n * Returns the Y coordinate for series' data item's value.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @return Y coordinate (px)\r\n */\n\n\n ValueAxis.prototype.getY = function (dataItem, key, location, stackKey, range) {\n return this.renderer.positionToPoint(this.getPositionY(dataItem, key, location, stackKey, range)).y;\n };\n /**\r\n * Returns relative position on axis for series' data item's value.\r\n *\r\n * @since 4.5.14\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @return Relative position\r\n */\n\n\n ValueAxis.prototype.getPositionY = function (dataItem, key, location, stackKey, range) {\n var value = dataItem.getWorkingValue(key);\n\n if (!$type.hasValue(stackKey)) {\n stackKey = \"valueY\";\n }\n\n var stack = dataItem.getValue(stackKey, \"stack\");\n\n if (!$type.isNumber(value)) {\n value = this.baseValue;\n\n if (this.logarithmic) {\n if (stack > 0) {\n value = 0;\n }\n }\n }\n\n var position = this.valueToPosition(value + stack);\n\n if (range) {\n position = $math.fitToRange(position, range.start, range.end);\n }\n\n return position;\n };\n /**\r\n * Returns an angle for series data item.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description (review)\r\n * @param dataItem Data item\r\n * @param key Data field to get value from\r\n * @param location Location (0-1)\r\n * @param stackKey Stack ID\r\n * @param range Range to fit in\r\n * @return Angle\r\n */\n\n\n ValueAxis.prototype.getAngle = function (dataItem, key, location, stackKey, range) {\n var value = dataItem.getWorkingValue(key);\n var stack = dataItem.getValue(stackKey, \"stack\");\n\n if (!$type.isNumber(value)) {\n value = this.baseValue;\n }\n\n var position = this.valueToPosition(value + stack);\n\n if (range) {\n position = $math.fitToRange(position, range.start, range.end);\n }\n\n return this.positionToAngle(position);\n };\n /**\r\n * [getAnyRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param start [description]\r\n * @param end [description]\r\n * @param location [description]\r\n * @return [description]\r\n */\n\n\n ValueAxis.prototype.getAnyRangePath = function (start, end, location) {\n var startPosition = this.valueToPosition(start);\n var endPosition = this.valueToPosition(end);\n return this.getPositionRangePath(startPosition, endPosition); // Base class (Axis) gets range shape from AxisRenderer\n };\n /**\r\n * Returns text to show in a axis tooltip, based on specific position within\r\n * axis.\r\n *\r\n * The label will be formatted as per [[NumberFormatter]] set for the whole\r\n * chart, or explicitly for this Axis.\r\n *\r\n * @ignore Exclude from docs\r\n * @param position Position (px)\r\n * @return Label (numeric value)\r\n */\n\n\n ValueAxis.prototype.getTooltipText = function (position) {\n var value = $math.round(this.positionToValue(position), this._stepDecimalPlaces + this.extraTooltipPrecision);\n var valueStr = this.tooltip.numberFormatter.format(value);\n\n if (!this._adapterO) {\n return valueStr;\n } else {\n return this._adapterO.apply(\"getTooltipText\", valueStr);\n }\n };\n /**\r\n * Zooms axis to specific values.\r\n *\r\n * @param startValue Start value\r\n * @param endValue End value\r\n * @param skipRangeEvent Do not invoke events\r\n * @param instantly Do not play zoom animations\r\n */\n\n\n ValueAxis.prototype.zoomToValues = function (startValue, endValue, skipRangeEvent, instantly) {\n var start = (startValue - this.min) / (this.max - this.min);\n var end = (endValue - this.min) / (this.max - this.min);\n this.zoom({\n start: start,\n end: end\n }, skipRangeEvent, instantly);\n };\n\n Object.defineProperty(ValueAxis.prototype, \"minZoomed\", {\n /**\r\n * A smallest value in axis scale within current zoom.\r\n *\r\n * @return Min zoom value\r\n */\n get: function get() {\n if (!this.syncWithAxis) {\n return $math.max(this.min, this._minZoomed);\n } else {\n return this._minZoomed;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"maxZoomed\", {\n /**\r\n * A biggest value in axis scale within current zoom.\r\n * @return [description]\r\n */\n get: function get() {\n if (!this.syncWithAxis) {\n return $math.min(this.max, this._maxZoomed);\n } else {\n return this._maxZoomed;\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates positioning of Axis breaks after something changes.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n ValueAxis.prototype.fixAxisBreaks = function () {\n var _this = this;\n\n _super.prototype.fixAxisBreaks.call(this);\n\n var axisBreaks = this._axisBreaks;\n\n if (axisBreaks && axisBreaks.length > 0) {\n // process breaks\n axisBreaks.each(function (axisBreak) {\n var startValue = axisBreak.adjustedStartValue;\n var endValue = axisBreak.adjustedEndValue; // break difference\n\n var axisBreakDif = endValue - startValue;\n\n var axisBreakGridCount = Math.ceil(axisBreakDif * axisBreak.breakSize) * _this._gridCount / (_this.max - _this.min); // calculate min, max and step for axis break\n\n\n var breakMinMaxStep = _this.adjustMinMax(startValue, endValue, axisBreakDif, axisBreakGridCount, true);\n\n axisBreak.adjustedStep = breakMinMaxStep.step;\n axisBreak.adjustedMin = breakMinMaxStep.min;\n axisBreak.adjustedMax = breakMinMaxStep.max;\n });\n }\n\n this._difference = this.adjustDifference(this.min, this.max);\n };\n /**\r\n * Returns value based on position.\r\n *\r\n * Please note that `position` represents position within axis which may be\r\n * zoomed and not correspond to Cursor's `position`.\r\n *\r\n * To convert Cursor's `position` to Axis' `position` use `toAxisPosition()` method.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/tracking-cursors-position-via-api/#Tracking_Cursor_s_position} For more information about cursor tracking.\r\n * @param position Relative position on axis (0-1)\r\n * @return Position label\r\n */\n\n\n ValueAxis.prototype.getPositionLabel = function (position) {\n var value = this.positionToValue(position);\n return this.numberFormatter.format(value);\n };\n /**\r\n * Shows Axis tooltip at specific value\r\n *\r\n * @param value Value\r\n */\n\n\n ValueAxis.prototype.showTooltipAt = function (value) {\n this.showTooltipAtPosition(this.valueToPosition(value));\n };\n /**\r\n * Copies all properties and related data from a different instance of Axis.\r\n *\r\n * @param source Source Axis\r\n */\n\n\n ValueAxis.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.min = source.min;\n this.max = source.max;\n this.calculateTotals = source.calculateTotals;\n this._baseValue = source.baseValue;\n };\n\n Object.defineProperty(ValueAxis.prototype, \"syncWithAxis\", {\n /**\r\n * @return Target axis\r\n */\n get: function get() {\n return this.getPropertyValue(\"syncWithAxis\");\n },\n\n /**\r\n * Enables syncing of grid with another axis.\r\n *\r\n * To enable, set to a reference of the other `ValueAxis`. This axis will try\r\n * to maintain its scale in such way that its grid matches target axis grid.\r\n *\r\n * IMPORTANT #1: At this stage it's an experimental feature. Use it at your\r\n * own risk, as it may not work in 100% of the scenarios.\r\n *\r\n * IMPORTANT #2: `syncWithAxis` is not compatible with `strictMinMax` and\r\n * `sequencedInterpolation` settings.\r\n *\r\n * IMPORTANT #3: `syncWithAxis` is not compatible with scrollbars. Make sure\r\n * you do not add a scrollbar in the same direction as synced axes. For\r\n * example, if you have vertical synced axes, do not add `scrollbarY` on\r\n * your chart. It will create anomalies when used.\r\n *\r\n * IMPORTANT #4: `syncWithAxis` is not compatible with `XYCursor` if it has\r\n * its `behavior` set to either `zoomY` or `zoomXY`.\r\n *\r\n * @since 4.8.1\r\n * @param axis Target axis\r\n */\n set: function set(axis) {\n var _this = this;\n\n if (this.setPropertyValue(\"syncWithAxis\", axis, true)) {\n if (axis) {\n this._disposers.push(axis.events.on(\"extremeschanged\", this.handleSelectionExtremesChange, this, false));\n\n this._disposers.push(axis.events.on(\"selectionextremeschanged\", this.handleSelectionExtremesChange, this, false));\n\n this._disposers.push(axis.events.on(\"startendchanged\", this.handleSelectionExtremesChange, this, false));\n\n this.events.on(\"shown\", this.handleSelectionExtremesChange, this, false);\n this.events.on(\"maxsizechanged\", function () {\n _this.clearCache();\n\n _this._disposers.push(registry.events.once(\"exitframe\", function () {\n _this.handleSelectionExtremesChange();\n }));\n }, this, false);\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueAxis.prototype, \"treatZeroAs\", {\n /**\r\n * @return Zero replacement value\r\n */\n get: function get() {\n return this.getPropertyValue(\"treatZeroAs\");\n },\n\n /**\r\n * If set, zero values will be treated as this value.\r\n *\r\n * It is useful if you need to use data with zero-values on a logarithmic\r\n * axis scale.\r\n *\r\n * @since 4.9.34\r\n * @param value Zero replacement value\r\n */\n set: function set(value) {\n this.setPropertyValue(\"treatZeroAs\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Syncs with a target axis.\r\n *\r\n * @param min Min\r\n * @param max Max\r\n * @param step Step\r\n */\n\n ValueAxis.prototype.syncAxes = function (min, max, step) {\n var axis = this.syncWithAxis;\n\n if (axis) {\n if (!$type.isNumber(min)) {\n min = this.min;\n }\n\n if (!$type.isNumber(max)) {\n max = this.max;\n }\n\n if (!$type.isNumber(step)) {\n step = this._step;\n }\n\n var count = Math.round((axis.maxZoomed - axis.minZoomed) / axis.step);\n var currentCount = Math.round((max - min) / step);\n\n if ($type.isNumber(count) && $type.isNumber(currentCount)) {\n var synced = false;\n var c = 0;\n var diff = (max - min) * 0.01;\n var omin = min;\n var omax = max;\n var ostep = step;\n\n while (synced != true) {\n synced = this.checkSync(omin, omax, ostep, count);\n c++;\n\n if (c > 1000) {\n synced = true;\n }\n\n if (!synced) {\n //omin = min - diff * c;\n if (c / 3 == Math.round(c / 3)) {\n omin = min - diff * c;\n\n if (min >= 0 && omin < 0) {\n omin = 0;\n }\n } else {\n omax = max + diff * c;\n\n if (omax <= 0 && omax > 0) {\n omax = 0;\n }\n }\n\n var minMaxStep = this.adjustMinMax(omin, omax, omax - omin, this._gridCount, true);\n omin = minMaxStep.min;\n omax = minMaxStep.max;\n ostep = minMaxStep.step;\n } else {\n min = omin;\n max = omax;\n step = ostep;\n }\n }\n }\n }\n\n return {\n min: min,\n max: max,\n step: step\n };\n };\n /**\r\n * Returns `true` if axis needs to be resunced with some other axis.\r\n */\n\n\n ValueAxis.prototype.checkSync = function (min, max, step, count) {\n var currentCount = (max - min) / step;\n\n for (var i = 1; i < count; i++) {\n if ($math.round(currentCount / i, 1) == count || currentCount * i == count) {\n return true;\n }\n }\n\n return false;\n };\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n\n ValueAxis.prototype.processConfig = function (config) {\n if (config) {\n // Set up axes\n if ($type.hasValue(config.syncWithAxis) && $type.isString(config.syncWithAxis)) {\n if (this.map.hasKey(config.syncWithAxis)) {\n config.syncWithAxis = this.map.getKey(config.syncWithAxis);\n } else {\n this.processingErrors.push(\"[ValueAxis] No axis with id \\\"\" + config.syncWithAxis + \"\\\" found for `syncWithAxis`\");\n delete config.xAxis;\n }\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n\n return ValueAxis;\n}(Axis);\n\nexport { ValueAxis };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ValueAxis\"] = ValueAxis;\nregistry.registeredClasses[\"ValueAxisDataItem\"] = ValueAxisDataItem;","/**\r\n * Module, defining Axis Renderer for vertical axes.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { AxisRenderer } from \"./AxisRenderer\";\nimport { AxisBullet } from \"./AxisBullet\";\nimport { WavedLine } from \"../../core/elements/WavedLine\";\nimport { WavedRectangle } from \"../../core/elements/WavedRectangle\";\nimport { registry } from \"../../core/Registry\";\nimport { percent, Percent } from \"../../core/utils/Percent\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $path from \"../../core/rendering/Path\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $type from \"../../core/utils/Type\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A renderer for horizontal axis.\r\n *\r\n * @see {@link IAxisRendererEvents} for a list of available events\r\n * @see {@link IAxisRendererAdapters} for a list of available Adapters\r\n */\n\nvar AxisRendererX =\n/** @class */\nfunction (_super) {\n __extends(AxisRendererX, _super);\n /**\r\n * Constructor.\r\n *\r\n * @param axis Related axis\r\n */\n\n\n function AxisRendererX() {\n var _this = _super.call(this) || this;\n\n _this.className = \"AxisRendererX\";\n _this.minGridDistance = 120;\n _this.opposite = false;\n _this.rotation = 0;\n _this.width = percent(100);\n _this.labels.template.horizontalCenter = \"middle\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n AxisRendererX.prototype.setAxis = function (axis) {\n _super.prototype.setAxis.call(this, axis);\n\n axis.layout = \"vertical\";\n };\n /**\r\n * @ignore\r\n */\n\n\n AxisRendererX.prototype.updateGridContainer = function () {\n var axis = this.axis;\n\n if (axis) {\n var gridContainer = this.gridContainer;\n gridContainer.x = axis.pixelX;\n gridContainer.width = axis.axisLength;\n }\n };\n /**\r\n * Called when rendered is attached to an Axis, as well as a property of\r\n * Axis that might affect the appearance is updated.\r\n *\r\n * E.g. `axis.opposite`, `axis.inside`, etc.\r\n *\r\n * This method is called **before** draw, so that any related setting\r\n * changed in this method can be changed.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererX.prototype.processRenderer = function () {\n _super.prototype.processRenderer.call(this); // can not do this in init, as axis is set later\n\n\n var axis = this.axis;\n\n if (axis) {\n if (!(axis.width instanceof Percent)) {\n axis.width = percent(100);\n } // @todo Is thi sneeded?\n\n\n $utils.used(this.line);\n var title = axis.title;\n title.rotation = 0;\n title.align = \"center\";\n\n if (this.opposite) {\n this.line.toFront();\n title.toBack();\n } else {\n title.toFront();\n this.toBack();\n this.line.toBack();\n }\n }\n };\n /**\r\n * Updates some of the Axis tooltip's visual properties, related to\r\n * rendering of the Axis.\r\n *\r\n * @todo Description (review)\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererX.prototype.updateTooltip = function () {\n var axis = this.axis;\n\n if (axis) {\n var bigNum = 1000;\n var bbx = this.line.pixelX;\n var bby = this.line.pixelY;\n var bbw = this.axisLength;\n var bbh = bigNum; // top\n\n if (this.opposite) {\n if (!this.inside) {\n bby = -bigNum;\n bbh = bigNum;\n }\n } // bottom\n else {\n if (this.inside) {\n bby = -bigNum;\n bbh = bigNum;\n }\n }\n\n this.axis.updateTooltip(\"vertical\", {\n x: bbx,\n y: bby,\n width: bbw,\n height: bbh\n });\n }\n };\n /**\r\n * Updates and positions a label element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param label Label element\r\n * @param position Starting position\r\n * @param endPosition Ending position\r\n */\n\n\n AxisRendererX.prototype.updateLabelElement = function (label, position, endPosition, location) {\n if (!$type.hasValue(location)) {\n location = label.location;\n }\n\n position = position + (endPosition - position) * location;\n var point = this.positionToPoint(position);\n label.isMeasured = !label.inside;\n var deltaY = 0;\n var verticalCenter;\n var maxHeight = this.gridContainer.maxHeight;\n\n if (this.opposite) {\n if (label.inside) {\n verticalCenter = \"top\";\n\n if (label.valign == \"bottom\") {\n deltaY = maxHeight;\n verticalCenter = \"bottom\";\n }\n\n if (label.valign == \"middle\") {\n deltaY = maxHeight / 2;\n verticalCenter = \"middle\";\n }\n } else {\n verticalCenter = \"bottom\";\n }\n\n point.y = deltaY;\n } else {\n if (label.inside) {\n verticalCenter = \"bottom\";\n\n if (label.valign == \"top\") {\n deltaY = -maxHeight;\n verticalCenter = \"top\";\n }\n\n if (label.valign == \"middle\") {\n deltaY = -maxHeight / 2;\n verticalCenter = \"middle\";\n }\n } else {\n verticalCenter = \"top\";\n }\n\n point.y += deltaY;\n }\n\n if (label.rotation == 0) {\n // Apply fuzzy logic to verticalCenter only if labels are not rotated\n label.verticalCenter = verticalCenter;\n }\n\n this.positionItem(label, point);\n this.toggleVisibility(label, position, this.minLabelPosition, this.maxLabelPosition);\n };\n\n Object.defineProperty(AxisRendererX.prototype, \"axisLength\", {\n /**\r\n * Returns actual length of the Axis, in pixels.\r\n *\r\n * @return Length (px)\r\n */\n get: function get() {\n var axis = this.axis;\n return axis.measuredWidth - axis.pixelPaddingRight - axis.pixelPaddingLeft || 0;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts relative position on axis to point coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @param position2 Position (0-1) Position on the second axis\r\n * @return Point\r\n */\n\n AxisRendererX.prototype.positionToPoint = function (position, position2) {\n return {\n x: this.positionToCoordinate(position),\n y: 0\n };\n };\n /**\r\n * Converts a point at specific coordinates to a relative position (0-1)\r\n * on the axis.\r\n *\r\n * @param point Point\r\n * @return Position (0-1)\r\n */\n\n\n AxisRendererX.prototype.pointToPosition = function (point) {\n return this.coordinateToPosition(point.x, point.y);\n };\n /**\r\n * [getPositionRangePath description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param startPosition Starting position\r\n * @param endPosition End position\r\n * @return SVG path\r\n */\n\n\n AxisRendererX.prototype.getPositionRangePath = function (startPosition, endPosition) {\n var x1 = $math.fitToRange(this.positionToCoordinate(startPosition), 0, this.axisLength);\n var x2 = $math.fitToRange(this.positionToCoordinate(endPosition), 0, this.axisLength);\n var w = Math.abs(x2 - x1);\n var h = this.getHeight();\n var x = Math.min(x1, x2);\n var y = 0;\n return $path.rectToPath({\n x: x,\n y: y,\n width: w,\n height: h\n }, true);\n };\n /**\r\n * Updates and positions an axis break element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Break element\r\n */\n\n\n AxisRendererX.prototype.updateBreakElement = function (axisBreak) {\n _super.prototype.updateBreakElement.call(this, axisBreak);\n\n var startLine = axisBreak.startLine;\n var endLine = axisBreak.endLine;\n var fillShape = axisBreak.fillShape;\n var startPoint = axisBreak.startPoint;\n var endPoint = axisBreak.endPoint;\n var y1 = axisBreak.pixelMarginLeft;\n var y2 = this.getHeight() - axisBreak.pixelMarginTop - axisBreak.pixelMarginBottom;\n startPoint.x = $math.fitToRange(startPoint.x, -1, this.axisLength + 1);\n endPoint.x = $math.fitToRange(endPoint.x, -1, this.axisLength + 1);\n\n if (startPoint.x == endPoint.x && (startPoint.x < 0 || startPoint.x > this.axisLength)) {\n axisBreak.fillShape.__disabled = true;\n } else {\n axisBreak.fillShape.__disabled = false;\n }\n\n startLine.y = y1;\n startLine.width = 0;\n startLine.height = y2;\n endLine.y = y1;\n endLine.width = 0;\n endLine.height = y2;\n fillShape.height = y2;\n fillShape.width = Math.abs(endPoint.x - startPoint.x);\n fillShape.y = y1;\n fillShape.x = startPoint.x;\n };\n /**\r\n * Updates and positions a grid element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param grid Grid element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRendererX.prototype.updateGridElement = function (grid, position, endPosition) {\n position = position + (endPosition - position) * grid.location;\n var point = this.positionToPoint(position); //point.x = $utils.spritePointToSprite({x:point.x, y:0}, this, this.gridContainer).x;\n\n grid.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: 0,\n y: this.getHeight()\n });\n this.positionItem(grid, point);\n this.toggleVisibility(grid, position, 0, 1);\n };\n /**\r\n * Updates and positions a tick element.\r\n *\r\n * @ignore Exclude from docs\r\n * @param tick Tick element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRendererX.prototype.updateTickElement = function (tick, position, endPosition) {\n position = position + (endPosition - position) * tick.location;\n var point = this.positionToPoint(position);\n var tickLength = tick.length;\n point.y = $utils.spritePointToSprite({\n x: 0,\n y: this.line.pixelY\n }, this.line.parent, this.gridContainer).y;\n\n if (this.opposite) {\n tickLength *= tick.inside ? 1 : -1;\n } else {\n tickLength *= tick.inside ? -1 : 1;\n }\n\n tick.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: 0,\n y: tickLength\n });\n this.positionItem(tick, point);\n this.toggleVisibility(tick, position, 0, 1);\n };\n /**\r\n * Updates and positions the axis line element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererX.prototype.updateAxisLine = function () {\n this.line.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: this.axisLength,\n y: 0\n });\n };\n /**\r\n * Updates and positions the base grid element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n AxisRendererX.prototype.updateBaseGridElement = function () {\n _super.prototype.updateBaseGridElement.call(this);\n\n var axis = this.axis;\n var h = this.getHeight();\n var w = this.axisLength;\n var baseGrid = this.baseGrid;\n var x = axis.basePoint.x;\n\n if (x < -0.2 || x > w + 0.2) {\n baseGrid.hide(0);\n } else {\n var y = $utils.spritePointToSprite({\n x: 0,\n y: 0\n }, this.gridContainer, baseGrid.parent).y;\n baseGrid.path = $path.moveTo({\n x: 0,\n y: 0\n }) + $path.lineTo({\n x: 0,\n y: h\n });\n baseGrid.moveTo({\n x: x,\n y: y\n });\n baseGrid.show(0);\n }\n };\n /**\r\n * Creates visual elements for and axis break.\r\n *\r\n * @ignore Exclude from docs\r\n * @param axisBreak Axis break\r\n */\n\n\n AxisRendererX.prototype.createBreakSprites = function (axisBreak) {\n axisBreak.startLine = new WavedLine();\n axisBreak.endLine = new WavedLine();\n var wavedRectangle = new WavedRectangle();\n wavedRectangle.setWavedSides(false, true, false, true);\n axisBreak.fillShape = wavedRectangle;\n };\n /**\r\n * @ignore\r\n */\n\n\n AxisRendererX.prototype.toAxisPosition = function (value) {\n var inversedPosition = value;\n var axis = this.axis;\n\n if (axis) {\n var relativePositionSprite = axis.relativePositionSprite;\n var x = axis.pixelX;\n\n if (relativePositionSprite) {\n x = $utils.spritePointToSprite({\n x: this.pixelX,\n y: 0\n }, this.parent, relativePositionSprite).x;\n } else {\n relativePositionSprite = axis.parent;\n }\n\n if (relativePositionSprite) {\n var relativeX = x / relativePositionSprite.innerWidth;\n var relativeWidth = axis.axisLength / relativePositionSprite.innerWidth;\n return (inversedPosition - relativeX) / relativeWidth;\n }\n }\n\n return value;\n };\n /**\r\n * Updates and positions axis bullets.\r\n *\r\n * @ignore Exclude from docs\r\n * @param bullet AxisBullet element\r\n * @param position Starting position\r\n * @param endPosition End position\r\n */\n\n\n AxisRendererX.prototype.updateBullet = function (bullet, position, endPosition) {\n var location = 0.5;\n\n if (bullet instanceof AxisBullet) {\n location = bullet.location;\n }\n\n position = position + (endPosition - position) * location;\n var point = this.positionToPoint(position);\n point.y = $utils.spritePointToSprite({\n x: 0,\n y: this.line.pixelY\n }, this.line.parent, this.gridContainer).y;\n this.positionItem(bullet, point);\n this.toggleVisibility(bullet, position, 0, 1);\n };\n\n return AxisRendererX;\n}(AxisRenderer);\n\nexport { AxisRendererX };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AxisRendererX\"] = AxisRendererX;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Put labels inside plot area.\r\n * Disable first and last labels.\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.heightXS,\n state: function state(target, stateId) {\n if (target instanceof AxisRendererX) {\n var state = target.states.create(stateId);\n state.properties.inside = true;\n state.properties.maxLabelPosition = 0.9;\n state.properties.minLabelPosition = 0.1;\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Disable labels altogather on very small charts\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.heightXXS,\n state: function state(target, stateId) {\n if (target instanceof AxisRendererX) {\n var state = target.states.create(stateId);\n state.properties.disabled = true;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * HeatLegend module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { LinearGradient } from \"../../core/rendering/fills/LinearGradient\";\nimport { registry } from \"../../core/Registry\";\nimport { toColor, Color } from \"../../core/utils/Color\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { percent } from \"../../core/utils/Percent\";\nimport { ValueAxis } from \"../../charts/axes/ValueAxis\";\nimport { AxisRendererX } from \"../../charts/axes/AxisRendererX\";\nimport { AxisRendererY } from \"../../charts/axes/AxisRendererY\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $colors from \"../../core/utils/Colors\";\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This class creates a link (waved color-filled line) between two nodes in a\r\n * Sankey Diagram.\r\n *\r\n * @see {@link IHeatLegendEvents} for a list of available events\r\n * @see {@link IHeatLegendAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar HeatLegend =\n/** @class */\nfunction (_super) {\n __extends(HeatLegend, _super);\n /**\r\n * Constructor\r\n */\n\n\n function HeatLegend() {\n var _this = _super.call(this) || this;\n\n _this.className = \"HeatLegend\";\n _this.markerContainer = _this.createChild(Container);\n _this.markerContainer.shouldClone = false;\n _this.markerCount = 1; // Create a template container and list for the a marker\n\n var marker = new RoundedRectangle();\n marker.minHeight = 20;\n marker.minWidth = 20;\n marker.interactionsEnabled = false;\n marker.fillOpacity = 1;\n marker.cornerRadius(0, 0, 0, 0);\n _this.markerContainer.minHeight = 20;\n _this.markerContainer.minWidth = 20;\n _this.orientation = \"horizontal\";\n _this.markers = new ListTemplate(marker);\n\n _this._disposers.push(new ListDisposer(_this.markers));\n\n _this._disposers.push(_this.markers.template);\n\n _this.applyTheme();\n\n return _this;\n }\n\n HeatLegend.prototype.getMinFromRules = function (property) {\n var series = this.series;\n\n if (series) {\n var minValue_1;\n $iter.eachContinue(series.heatRules.iterator(), function (heatRule) {\n if (heatRule.property == property) {\n minValue_1 = heatRule.min;\n return false;\n }\n\n return true;\n });\n return minValue_1;\n }\n };\n\n HeatLegend.prototype.getMaxFromRules = function (property) {\n var series = this.series;\n\n if (series) {\n var maxValue_1;\n $iter.each(series.heatRules.iterator(), function (heatRule) {\n if (heatRule.property == property) {\n maxValue_1 = heatRule.max;\n return false;\n }\n\n return true;\n });\n return maxValue_1;\n }\n };\n /**\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n HeatLegend.prototype.validate = function () {\n _super.prototype.validate.call(this);\n\n this.valueAxis.renderer.inversed = this.reverseOrder;\n var series = this.series;\n var minColor = this.minColor;\n var maxColor = this.maxColor;\n\n if (!$type.hasValue(minColor)) {\n minColor = toColor(this.getMinFromRules(\"fill\"));\n }\n\n if (!$type.hasValue(maxColor)) {\n maxColor = toColor(this.getMaxFromRules(\"fill\"));\n }\n\n if (series) {\n var seriesFill = series.fill;\n\n if (!$type.hasValue(minColor) && seriesFill instanceof Color) {\n minColor = seriesFill;\n }\n\n if (!$type.hasValue(maxColor) && seriesFill instanceof Color) {\n maxColor = seriesFill;\n }\n }\n\n if (!$type.hasValue(maxColor)) {\n maxColor = toColor(this.getMaxFromRules(\"fill\"));\n }\n\n var minOpacity = $type.toNumber(this.getMinFromRules(\"fillOpacity\"));\n\n if (!$type.isNumber(minOpacity)) {\n minOpacity = 1;\n }\n\n var maxOpacity = $type.toNumber(this.getMaxFromRules(\"fillOpacity\"));\n\n if (!$type.isNumber(maxOpacity)) {\n maxOpacity = 1;\n }\n\n var minStrokeOpacity = $type.toNumber(this.getMinFromRules(\"strokeOpacity\"));\n\n if (!$type.isNumber(minStrokeOpacity)) {\n minStrokeOpacity = 1;\n }\n\n var maxStrokeOpacity = $type.toNumber(this.getMaxFromRules(\"strokeOpacity\"));\n\n if (!$type.isNumber(maxStrokeOpacity)) {\n maxStrokeOpacity = 1;\n }\n\n var minStroke = toColor(this.getMinFromRules(\"stroke\"));\n var maxStroke = toColor(this.getMaxFromRules(\"stroke\")); //if (series) {\n\n for (var i = 0; i < this.markerCount; i++) {\n var marker = this.markers.getIndex(i);\n\n if (!marker) {\n marker = this.markers.create();\n marker.parent = this.markerContainer;\n marker.height = percent(100);\n marker.width = percent(100);\n }\n\n if (this.markerCount == 1) {\n var gradient = new LinearGradient();\n\n if (this.reverseOrder) {\n gradient.addColor(maxColor, maxOpacity);\n gradient.addColor(minColor, minOpacity);\n } else {\n gradient.addColor(minColor, minOpacity);\n gradient.addColor(maxColor, maxOpacity);\n }\n\n if (this.orientation == \"vertical\") {\n gradient.rotation = -90;\n }\n\n marker.fill = gradient;\n\n if ($type.hasValue(minStroke) && $type.hasValue(maxStroke)) {\n var strokeGradient = new LinearGradient();\n\n if (this.reverseOrder) {\n strokeGradient.addColor(maxStroke, maxStrokeOpacity);\n strokeGradient.addColor(minStroke, minStrokeOpacity);\n } else {\n strokeGradient.addColor(minStroke, minStrokeOpacity);\n strokeGradient.addColor(maxStroke, maxStrokeOpacity);\n }\n\n if (this.orientation == \"vertical\") {\n strokeGradient.rotation = -90;\n }\n\n marker.stroke = strokeGradient;\n }\n } else {\n var c = i;\n\n if (this.reverseOrder) {\n c = this.markerCount - i - 1;\n }\n\n var color = new Color($colors.interpolate(minColor.rgb, maxColor.rgb, c / this.markerCount));\n marker.fill = color;\n var opacity = minOpacity + (maxOpacity - minOpacity) * c / this.markerCount;\n marker.fillOpacity = opacity;\n\n if ($type.hasValue(minStroke) && $type.hasValue(maxStroke)) {\n var color_1 = new Color($colors.interpolate(minStroke.rgb, maxStroke.rgb, c / this.markerCount));\n marker.stroke = color_1;\n var opacity_1 = minStrokeOpacity + (maxStrokeOpacity - minStrokeOpacity) * c / this.markerCount;\n marker.strokeOpacity = opacity_1;\n }\n }\n }\n\n var renderer = this.valueAxis.renderer;\n\n if (this.markerCount > 1) {\n if (this.orientation == \"horizontal\") {\n renderer.minGridDistance = this.measuredWidth / this.markerCount;\n } else {\n renderer.minGridDistance = this.measuredHeight / this.markerCount;\n }\n }\n\n this.valueAxis.invalidate();\n\n for (var i = this.markerCount, len = this.markers.length; i < len; i++) {\n this.markers.getIndex(i).parent = undefined;\n }\n };\n\n Object.defineProperty(HeatLegend.prototype, \"minColor\", {\n /**\r\n * Returns minColor value\r\n * @return {Color}\r\n */\n get: function get() {\n return this.getPropertyValue(\"minColor\");\n },\n\n /**\r\n * Min color of a heat legend. If a series is set for the legend, minColor is taken from series.\r\n *\r\n * @param {Color}\r\n */\n set: function set(value) {\n if (!(value instanceof Color)) {\n value = toColor(value);\n }\n\n this.setColorProperty(\"minColor\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"maxColor\", {\n /**\r\n * Returns maxColor value\r\n * @return {Color}\r\n */\n get: function get() {\n return this.getPropertyValue(\"maxColor\");\n },\n\n /**\r\n * Max color of a heat legend. If a series is set for the legend, maxColor is taken from series.\r\n *\r\n * @param {Color}\r\n */\n set: function set(value) {\n if (!(value instanceof Color)) {\n value = toColor(value);\n }\n\n this.setColorProperty(\"maxColor\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"markerCount\", {\n /**\r\n * Returns number of color squares (markers).\r\n * @return {number}\r\n */\n get: function get() {\n return this.getPropertyValue(\"markerCount\");\n },\n\n /**\r\n * Number of color squares (markers) in the heat legend. If only 1 marker is used, it will be filled with gradient.\r\n *\r\n * @param {number}\r\n */\n set: function set(value) {\n this.setPropertyValue(\"markerCount\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"minValue\", {\n /**\r\n * Returns minimum value of heat legend.\r\n * @return {number}\r\n */\n get: function get() {\n return this.getPropertyValue(\"minValue\");\n },\n\n /**\r\n * Minimum value of heat legend's value axis. If a series is set for the legend, min is taken from series.\r\n *\r\n * @param {number}\r\n */\n set: function set(value) {\n this.setPropertyValue(\"minValue\", value);\n this.valueAxis.min = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"maxValue\", {\n /**\r\n * Returns maximum value of heat legend.\r\n * @return {number}\r\n */\n get: function get() {\n return this.getPropertyValue(\"maxValue\");\n },\n\n /**\r\n * Maximum value of heat legend's value axis. If a series is set for the legend, max is taken from series.\r\n *\r\n * @param {number}\r\n */\n set: function set(value) {\n this.setPropertyValue(\"maxValue\", value);\n this.valueAxis.max = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"orientation\", {\n /**\r\n * Returns orientation value.\r\n *\r\n * @return {\"horizontal\" | \"vertical\"}\r\n */\n get: function get() {\n return this.getPropertyValue(\"orientation\");\n },\n\n /**\r\n * Heat legend orientation. Note, if you change orientation of a heat legend, you must set value axis renderer properties after that, as with orientation renderer changes.\r\n *\r\n * @param {\"horizontal\" | \"vertical\"}\r\n */\n set: function set(value) {\n this.setPropertyValue(\"orientation\", value, true);\n var markerContainer = this.markerContainer;\n var valueAxis = this.valueAxis; // HORIZONTAL\n\n if (value == \"horizontal\") {\n if (!$type.hasValue(this.width)) {\n this.width = 200;\n }\n\n this.height = undefined;\n valueAxis.width = percent(100);\n valueAxis.height = undefined;\n valueAxis.tooltip.pointerOrientation = \"vertical\";\n this.layout = \"vertical\";\n markerContainer.width = percent(100);\n markerContainer.height = undefined;\n\n if (!(valueAxis.renderer instanceof AxisRendererX)) {\n valueAxis.renderer = new AxisRendererX();\n }\n } // VERTICAL\n else {\n if (!$type.hasValue(this.height)) {\n this.height = 200;\n }\n\n this.width = undefined;\n this.layout = \"horizontal\";\n markerContainer.width = undefined;\n markerContainer.height = percent(100);\n valueAxis.height = percent(100);\n valueAxis.width = undefined;\n valueAxis.tooltip.pointerOrientation = \"horizontal\";\n\n if (!(valueAxis.renderer instanceof AxisRendererY)) {\n valueAxis.renderer = new AxisRendererY();\n }\n\n valueAxis.renderer.inside = true;\n valueAxis.renderer.labels.template.inside = true;\n this.markerContainer.reverseOrder = true;\n }\n\n var renderer = valueAxis.renderer;\n renderer.grid.template.disabled = true;\n renderer.axisFills.template.disabled = true;\n renderer.baseGrid.disabled = true;\n renderer.labels.template.padding(2, 3, 2, 3);\n renderer.minHeight = undefined;\n renderer.minWidth = undefined;\n this.markerContainer.layout = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"valueAxis\", {\n /**\r\n * Returns valueAxis value.\r\n * @return {ValueAxis}\r\n */\n get: function get() {\n if (!this._valueAxis) {\n this.valueAxis = this.createChild(ValueAxis);\n this.valueAxis.shouldClone = false;\n }\n\n return this._valueAxis;\n },\n\n /**\r\n * Sets a value axis of heat legend. Value axis for heat legend is created automatically.\r\n * @param {ValueAxis}\r\n */\n set: function set(valueAxis) {\n this._valueAxis = valueAxis;\n valueAxis.parent = this;\n valueAxis.strictMinMax = true;\n this.orientation = this.orientation;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HeatLegend.prototype, \"series\", {\n /**\r\n * Returns series value.\r\n * @return {Series}\r\n */\n get: function get() {\n return this._series;\n },\n\n /**\r\n * You can set series for heat legend. It will take min, max, minColor and maxColor values from this series.\r\n * @param series\r\n */\n set: function set(series) {\n var _this = this;\n\n this._series = series;\n var dataField = \"value\";\n\n try {\n var dataFieldDefined = series.heatRules.getIndex(0).dataField;\n\n if (dataFieldDefined) {\n dataField = dataFieldDefined;\n }\n } catch (err) {}\n\n this.updateMinMax(series.dataItem.values[dataField].low, series.dataItem.values[dataField].high);\n series.dataItem.events.on(\"calculatedvaluechanged\", function (event) {\n _this.updateMinMax(series.dataItem.values[dataField].low, series.dataItem.values[dataField].high);\n }, undefined, false);\n series.heatRules.events.on(\"inserted\", this.invalidate, this, false);\n series.heatRules.events.on(\"removed\", this.invalidate, this, false);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates min/max of value axis.\r\n * @ignore\r\n */\n\n HeatLegend.prototype.updateMinMax = function (min, max) {\n var valueAxis = this.valueAxis;\n\n if (!$type.isNumber(this.minValue)) {\n valueAxis.min = min;\n valueAxis.invalidate();\n }\n\n if (!$type.isNumber(this.maxValue)) {\n valueAxis.max = max;\n valueAxis.invalidate();\n }\n };\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n\n HeatLegend.prototype.processConfig = function (config) {\n if (config) {\n // Set up series\n if ($type.hasValue(config.series) && $type.isString(config.series)) {\n if ($type.isString(config.series)) {\n if (this.map.hasKey(config.series)) {\n config.series = this.map.getKey(config.series);\n } else {\n var seriesId_1 = config.series;\n var disposer_1 = this.map.events.on(\"insertKey\", function (ev) {\n if (ev.key == seriesId_1) {\n this.series = ev.newValue;\n disposer_1.dispose();\n }\n }, this);\n\n this._disposers.push(disposer_1);\n\n delete config.series;\n }\n }\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n\n return HeatLegend;\n}(Container);\n\nexport { HeatLegend };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"HeatLegend\"] = HeatLegend;","/**\r\n * Grip module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Button } from \"./Button\";\nimport { Sprite } from \"../Sprite\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { registry } from \"../Registry\";\nimport { percent } from \"../utils/Percent\";\nimport * as $path from \"../rendering/Path\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a grip element that can be used for scrolling or other things.\r\n *\r\n * @see {@link IGripEvents} for a list of available events\r\n * @see {@link IGripAdapters} for a list of available Adapters\r\n * @since 4.4.0\r\n */\n\nvar Grip =\n/** @class */\nfunction (_super) {\n __extends(Grip, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Grip() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"Grip\";\n var cs = new InterfaceColorSet(); // Set defaults\n\n _this.layout = \"absolute\";\n\n _this.padding(10, 10, 10, 10);\n\n _this.margin(3, 3, 3, 3);\n\n _this.background.fillOpacity = 0.3;\n\n _this.background.cornerRadius(10, 10, 10, 10); // Create an icon\n\n\n var icon = new Sprite();\n icon.element = _this.paper.add(\"path\");\n var path = $path.moveTo({\n x: -6,\n y: 0\n });\n path += $path.lineTo({\n x: 6,\n y: 0\n });\n path += $path.moveTo({\n x: -8,\n y: -6\n });\n path += $path.lineTo({\n x: 0,\n y: -12\n });\n path += $path.lineTo({\n x: 8,\n y: -6\n });\n path += $path.moveTo({\n x: -8,\n y: 6\n });\n path += $path.lineTo({\n x: 0,\n y: 12\n });\n path += $path.lineTo({\n x: 8,\n y: 6\n });\n icon.path = path;\n icon.strokeWidth = 2;\n icon.fillOpacity = 0;\n icon.pixelPerfect = true;\n icon.padding(0, 4, 0, 4);\n icon.stroke = cs.getFor(\"text\");\n icon.strokeOpacity = 0.7;\n icon.align = \"center\";\n icon.valign = \"middle\";\n _this.icon = icon;\n\n _this.label.dispose();\n\n _this.label = undefined; // Set default position\n\n _this.position = \"right\"; // Set up autohide\n\n _this.autoHideDelay = 3000;\n\n _this.events.on(\"shown\", function (ev) {\n if (_this._autoHideTimeout) {\n _this._autoHideTimeout.dispose();\n }\n\n if (_this.autoHideDelay) {\n _this._autoHideTimeout = _this.setTimeout(function () {\n _this.hide();\n }, _this.autoHideDelay);\n }\n });\n\n _this.events.on(\"down\", function (ev) {\n if (_this._autoHideTimeout) {\n _this._autoHideTimeout.dispose();\n }\n });\n\n _this.events.on(\"out\", function (ev) {\n if (_this.autoHideDelay) {\n _this._autoHideTimeout = _this.setTimeout(function () {\n _this.hide();\n }, _this.autoHideDelay);\n }\n }); // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Grip.prototype, \"position\", {\n /**\r\n * @return Position\r\n */\n get: function get() {\n return this.getPropertyValue(\"position\");\n },\n\n /**\r\n * Sets position of the grip.\r\n *\r\n * Available options: \"left\", \"right\" (default), \"top\", \"bottom\".\r\n *\r\n * @param value Position\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"position\", value)) {\n switch (value) {\n case \"left\":\n this.align = \"left\";\n this.valign = \"middle\";\n this.horizontalCenter = \"left\";\n this.verticalCenter = \"middle\";\n this.icon.rotation = 0;\n this.width = undefined;\n this.height = percent(30);\n break;\n\n case \"right\":\n this.align = \"right\";\n this.valign = \"middle\";\n this.horizontalCenter = \"right\";\n this.verticalCenter = \"middle\";\n this.icon.rotation = 0;\n this.width = undefined;\n this.height = percent(30);\n break;\n\n case \"top\":\n this.align = \"center\";\n this.valign = \"top\";\n this.horizontalCenter = \"middle\";\n this.verticalCenter = \"top\";\n this.icon.rotation = 90;\n this.width = percent(30);\n this.height = undefined;\n break;\n\n case \"bottom\":\n this.align = \"center\";\n this.valign = \"bottom\";\n this.horizontalCenter = \"middle\";\n this.verticalCenter = \"bottom\";\n this.icon.rotation = 90;\n this.width = percent(30);\n this.height = undefined;\n break;\n\n default:\n this.align = \"center\";\n this.valign = \"middle\";\n this.horizontalCenter = \"middle\";\n this.verticalCenter = \"middle\";\n this.icon.rotation = 90;\n this.width = percent(30);\n this.height = undefined;\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Grip.prototype, \"autoHideDelay\", {\n /**\r\n * @return Delay\r\n */\n get: function get() {\n return this.getPropertyValue(\"autoHideDelay\");\n },\n\n /**\r\n * Number of milliseconds to show grip until it is hidden automatically.\r\n *\r\n * @default 3000\r\n * @param value Delay\r\n */\n set: function set(value) {\n this.setPropertyValue(\"autoHideDelay\", value);\n },\n enumerable: true,\n configurable: true\n });\n return Grip;\n}(Button);\n\nexport { Grip };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Grip\"] = Grip;","/**\r\n * [[Chart]] class provides base functionality for all chart types to inherit.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { registry } from \"../core/Registry\";\nimport { Component } from \"../core/Component\";\nimport { MutableValueDisposer, Disposer } from \"../core/utils/Disposer\";\nimport { ListTemplate, ListDisposer } from \"../core/utils/List\";\nimport { Container } from \"../core/Container\";\nimport { Label } from \"../core/elements/Label\";\nimport { Grip } from \"../core/elements/Grip\";\nimport { DataItem } from \"../core/DataItem\";\nimport { percent } from \"../core/utils/Percent\";\nimport * as $iter from \"../core/utils/Iterator\";\nimport * as $type from \"../core/utils/Type\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../core/utils/Responsive\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[Chart]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar ChartDataItem =\n/** @class */\nfunction (_super) {\n __extends(ChartDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ChartDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"ChartDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n return ChartDataItem;\n}(DataItem);\n\nexport { ChartDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for all Charts.\r\n *\r\n * @see {@link IChartEvents} for a list of available Events\r\n * @see {@link IChartAdapters} for a list of available Adapters\r\n */\n\nvar Chart =\n/** @class */\nfunction (_super) {\n __extends(Chart, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Chart() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * A reference to chart's [[Legend]].\r\n * @ignore\r\n */\n\n\n _this._legend = new MutableValueDisposer();\n\n if (_this.constructor === Chart) {\n throw new Error(\"'Chart' cannot be instantiated directly. Please use a specific chart type.\");\n }\n\n _this.className = \"Chart\"; // Create a list of titles\n\n var template = new Label();\n _this.titles = new ListTemplate(template);\n\n _this._disposers.push(new ListDisposer(_this.titles));\n\n _this._disposers.push(template); // Chart component is also a container. it holds _chartAndLegendCont and titles\n\n\n _this.width = percent(100);\n _this.height = percent(100);\n _this.layout = \"vertical\"; // Chart and legend\n\n var chartAndLegendContainer = _this.createChild(Container);\n\n chartAndLegendContainer.shouldClone = false;\n chartAndLegendContainer.layout = \"vertical\";\n chartAndLegendContainer.width = percent(100);\n chartAndLegendContainer.height = percent(100);\n _this.chartAndLegendContainer = chartAndLegendContainer; // Chart container holds all the elements of a chart, extept titles and legend\n\n var chartContainer = chartAndLegendContainer.createChild(Container);\n chartContainer.shouldClone = false;\n chartContainer.width = percent(100);\n chartContainer.height = percent(100);\n _this.chartContainer = chartContainer;\n _this.showOnInit = true;\n\n _this._disposers.push(_this._legend); // Add title list events to apply certain formatting options and to make\n // the chart reference them as accessible screen reader labels\n\n\n _this.titles.events.on(\"inserted\", function (label) {\n _this.processTitle(label);\n\n _this.updateReaderTitleReferences();\n }, _this, false);\n\n _this.titles.events.on(\"removed\", function (label) {\n _this.updateReaderTitleReferences();\n }, _this, false); // Accessibility\n // It seems we can't set focusable on the whole chart because it seems to\n // mess up the whole focus event system - getting a focus on an inside\n // object also trigger focus on parent\n //this.focusable = true;\n\n\n _this.role = \"region\";\n _this.defaultState.transitionDuration = 1; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n Chart.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this);\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Chart\");\n }\n };\n /**\r\n * Initiates drawing of the chart.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Chart.prototype.draw = function () {\n this.fixLayout();\n\n _super.prototype.draw.call(this);\n };\n /**\r\n * Updates legend's hierarchy based on the position.\r\n */\n\n\n Chart.prototype.fixLayout = function () {\n var legend = this.legend;\n\n if (legend) {\n var chartAndLegendContainer = this.chartAndLegendContainer;\n var chartContainer = this.chartContainer;\n chartContainer.x = undefined;\n chartContainer.y = undefined;\n\n if (legend.position != \"absolute\") {\n legend.x = undefined;\n legend.y = undefined;\n }\n\n switch (legend.position) {\n case \"left\":\n chartAndLegendContainer.layout = \"horizontal\";\n legend.toBack();\n break;\n\n case \"right\":\n chartAndLegendContainer.layout = \"horizontal\";\n legend.toFront();\n break;\n\n case \"top\":\n chartAndLegendContainer.layout = \"vertical\";\n legend.toBack();\n break;\n\n case \"bottom\":\n chartAndLegendContainer.layout = \"vertical\";\n legend.toFront();\n break;\n\n case \"absolute\":\n legend.isMeasured = false;\n break;\n }\n }\n };\n /**\r\n * Setups the legend to use the chart's data.\r\n */\n\n\n Chart.prototype.feedLegend = function () {// Nothing here. This method is provided only as a \"placeholder\" for\n // extending classes to override\n };\n /**\r\n * Adds a new title to the chart when it is inserted into chart's titles\r\n * list.\r\n * @param event An event object which is triggered when inserting into titles list\r\n * @return Label object\r\n */\n\n\n Chart.prototype.processTitle = function (event) {\n var title = event.newValue;\n title.parent = this;\n title.toBack();\n title.shouldClone = false;\n title.align = \"center\"; // Need to explicitly apply the `id` attribute so it can be referenced by\n // `aria-labelledby`\n\n title.uidAttr();\n return title;\n };\n /**\r\n * Checks if chart has any title elements. If it does, we will use them in an\r\n * `aria-labelledby` attribute so that screen readers can use them to properly\r\n * describe the chart when it is focused or hovered.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Chart.prototype.updateReaderTitleReferences = function () {\n if (this.titles.length) {\n var titleIds_1 = [];\n $iter.each(this.titles.iterator(), function (title) {\n titleIds_1.push(title.uid);\n });\n this.setSVGAttribute({\n \"aria-labelledby\": titleIds_1.join(\" \")\n });\n } else {\n this.removeSVGAttribute(\"aria-labelledby\");\n }\n };\n\n Object.defineProperty(Chart.prototype, \"legend\", {\n /**\r\n * @return Legend\r\n */\n get: function get() {\n return this._legend.get();\n },\n\n /**\r\n * Holds the instance of chart's [[Leged]].\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/} for more information about legends\r\n * @param Legend\r\n */\n set: function set(legend) {\n this.setLegend(legend);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Prepares the legend instance for use in this chart.\r\n *\r\n * @param legend Legend\r\n */\n\n Chart.prototype.setLegend = function (legend) {\n var _this = this;\n\n if (this._legend.get() !== legend) {\n if (legend) {\n // Set legend options\n legend.parent = this.chartAndLegendContainer;\n\n this._legend.set(legend, legend.events.on(\"propertychanged\", function (event) {\n if (event.property == \"position\") {\n _this.fixLayout();\n }\n }, undefined, false));\n\n legend.addDisposer(new Disposer(function () {\n _this.legend = undefined;\n }));\n } else {\n this._legend.reset();\n }\n\n this.feedLegend();\n }\n };\n /**\r\n * Destroys this object and all related data.\r\n */\n\n\n Chart.prototype.dispose = function () {\n // otherwise there might be some errors when disposing chart which was just inited\n if (this.legend) {\n this.legend.dispose();\n }\n\n _super.prototype.dispose.call(this);\n };\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n\n Chart.prototype.processConfig = function (config) {\n if (config) {\n // Set up legend\n if ($type.hasValue(config.legend) && !$type.hasValue(config.legend.type)) {\n config.legend.type = \"Legend\";\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\n\n\n Chart.prototype.copyFrom = function (source) {\n this.titles.copyFrom(source.titles);\n this.chartContainer.copyFrom(source.chartContainer);\n\n if (source.legend) {\n this.legend = source.legend.clone();\n this.legend.removeChildren();\n }\n\n _super.prototype.copyFrom.call(this, source);\n };\n\n Object.defineProperty(Chart.prototype, \"dragGrip\", {\n /**\r\n * @return Grip\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._dragGrip) {\n var grip_1 = this.tooltipContainer.createChild(Grip);\n grip_1.align = \"right\";\n grip_1.valign = \"middle\";\n grip_1.hide(0);\n grip_1.events.on(\"down\", function (ev) {\n if (ev.touch) {\n _this.interactionsEnabled = false;\n }\n });\n grip_1.events.on(\"up\", function (ev) {\n _this.interactionsEnabled = true;\n });\n this.events.on(\"down\", function (ev) {\n if (ev.touch) {\n grip_1.show();\n }\n });\n this._dragGrip = grip_1;\n }\n\n return this._dragGrip;\n },\n\n /**\r\n * An instance of [[Grip]] which serves as a grip point which appears on\r\n * touch and allows scrolling whole page even if chart is occupying the\r\n * whole of the screen and would otherwise prevent scrolling.\r\n *\r\n * @since 4.4.0\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/touch/} For more information.\r\n * @param value Grip\r\n */\n set: function set(value) {\n this._dragGrip = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Chart.prototype, \"focusable\", {\n get: function get() {\n return this.parent.focusable;\n },\n set: function set(value) {\n this.parent.focusable = value;\n },\n enumerable: true,\n configurable: true\n });\n return Chart;\n}(Component);\n\nexport { Chart };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Chart\"] = Chart;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Reduce horizontal margins\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.widthXS,\n state: function state(target, stateId) {\n if (target instanceof Chart) {\n var state = target.states.create(stateId);\n\n if (target.pixelPaddingLeft > 10) {\n state.properties.paddingLeft = 10;\n }\n\n if (target.pixelPaddingRight > 10) {\n state.properties.paddingRight = 10;\n }\n\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Reduce vertical margins\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.heightXS,\n state: function state(target, stateId) {\n if (target instanceof Chart) {\n var state = target.states.create(stateId);\n\n if (target.pixelPaddingTop > 10) {\n state.properties.paddingTop = 10;\n }\n\n if (target.pixelPaddingBottom > 10) {\n state.properties.paddingBottom = 10;\n }\n\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Remove horizontal padding\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.widthXXS,\n state: function state(target, stateId) {\n if (target instanceof Chart) {\n var state = target.states.create(stateId);\n state.properties.paddingLeft = 0;\n state.properties.paddingRight = 0;\n return state;\n }\n\n return null;\n }\n});\n/**\r\n * Remove vertical padding\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.heightXXS,\n state: function state(target, stateId) {\n if (target instanceof Chart) {\n var state = target.states.create(stateId);\n state.properties.paddingTop = 0;\n state.properties.paddingBottom = 0;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * Module that defines everything related to building bullets.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { registry } from \"../../core/Registry\";\nimport { defaultRules, ResponsiveBreakpoints } from \"../../core/utils/Responsive\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Class used to creates bullets.\r\n *\r\n * @see {@link IBulletEvents} for a list of available events\r\n * @see {@link IBulletAdapters} for a list of available Adapters\r\n * @todo Usage example\r\n * @important\r\n */\n\nvar Bullet =\n/** @class */\nfunction (_super) {\n __extends(Bullet, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Bullet() {\n var _this = _super.call(this) || this;\n\n _this.className = \"Bullet\";\n _this.isMeasured = false;\n _this.tooltipX = 0;\n _this.tooltipY = 0;\n _this.layout = \"none\";\n _this.applyOnClones = true;\n _this.copyToLegendMarker = true;\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(Bullet.prototype, \"locationX\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"locationX\");\n },\n\n /**\r\n * Relative horizontal location within cell. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"locationX\", value)) {\n var dataItem = this.dataItem;\n\n if (dataItem && dataItem.component) {\n dataItem.component.invalidate();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Bullet.prototype, \"locationY\", {\n /**\r\n * @return Location (0-1)\r\n */\n get: function get() {\n return this.getPropertyValue(\"locationY\");\n },\n\n /**\r\n * Relative vertical location within cell. (0-1)\r\n *\r\n * @param value Location (0-1)\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"locationY\", value)) {\n var dataItem = this.dataItem;\n\n if (dataItem && dataItem.component) {\n dataItem.component.invalidate();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Bullet.prototype, \"xField\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this.getPropertyValue(\"xField\");\n },\n\n /**\r\n * [xField description]\r\n *\r\n * @todo Description\r\n * @param value [description]\r\n */\n set: function set(value) {\n this.setPropertyValue(\"xField\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Bullet.prototype, \"yField\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this.getPropertyValue(\"yField\");\n },\n\n /**\r\n * [yField description]\r\n *\r\n * Description\r\n * @param value [description]\r\n */\n set: function set(value) {\n this.setPropertyValue(\"yField\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Bullet.prototype, \"isDynamic\", {\n /**\r\n * @return Redraw on data change?\r\n */\n get: function get() {\n return this.getPropertyValue(\"isDynamic\");\n },\n\n /**\r\n * Indicates if the bullet is \"dynamic\".\r\n *\r\n * In most cases the bullets remain the same, even if the underlying data\r\n * changes.\r\n *\r\n * However, in cases where bullet also displays a label, or its size depends\r\n * on data, it also needs to be redrawn when the underlying data changes.\r\n *\r\n * Only those bullets that have set `isDynamic = true` will be redrawn each\r\n * time data changes. Regular bullets will be reused as they are.\r\n *\r\n * @default false\r\n * @param value Redraw on data change?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"isDynamic\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Bullet.prototype, \"copyToLegendMarker\", {\n /**\r\n * @return Redraw on data change?\r\n */\n get: function get() {\n return this.getPropertyValue(\"copyToLegendMarker\");\n },\n\n /**\r\n * Indicates if the bullet should be copied to legend marker\r\n *\r\n * @default false\r\n * @param value Redraw on data change?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"copyToLegendMarker\", value);\n },\n enumerable: true,\n configurable: true\n });\n return Bullet;\n}(Container);\n\nexport { Bullet };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Bullet\"] = Bullet;\n/**\r\n * Add default responsive rules\r\n */\n\n/**\r\n * Hide bullets\r\n */\n\ndefaultRules.push({\n relevant: ResponsiveBreakpoints.isXS,\n state: function state(target, stateId) {\n if (target instanceof Bullet) {\n var state = target.states.create(stateId);\n state.properties.disabled = true;\n return state;\n }\n\n return null;\n }\n});","/**\r\n * Functionality for any series-based elements, like Line Series (graphs),\r\n * Pie slice lists, etc.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Component } from \"../../core/Component\";\nimport { Sprite } from \"../../core/Sprite\";\nimport { List, ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { Dictionary, DictionaryDisposer } from \"../../core/utils/Dictionary\";\nimport { DataItem } from \"../../core/DataItem\";\nimport { Container } from \"../../core/Container\";\nimport { Tooltip } from \"../../core/elements/Tooltip\";\nimport { Bullet } from \"../elements/Bullet\";\nimport { LegendSettings } from \"../Legend\";\nimport { options } from \"../../core/Options\";\nimport { Color } from \"../../core/utils/Color\";\nimport { registry } from \"../../core/Registry\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $ease from \"../../core/utils/Ease\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $object from \"../../core/utils/Object\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $array from \"../../core/utils/Array\";\nimport * as $colors from \"../../core/utils/Colors\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[Series]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar SeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(SeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function SeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"SeriesDataItem\"; //@todo Should we make `bullets` list disposable?\n //this._disposers.push(new DictionaryDisposer(this.bullets));\n\n _this.values.value = {};\n _this.values.value = {};\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(SeriesDataItem.prototype, \"bullets\", {\n /**\r\n * A dictionary of data items bullets, where key is uid of a bullet template.\r\n */\n get: function get() {\n if (!this._bullets) {\n this._bullets = new Dictionary();\n\n this._disposers.push(new DictionaryDisposer(this._bullets));\n }\n\n return this._bullets;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Destroys this object and all related data.\r\n */\n\n SeriesDataItem.prototype.dispose = function () {\n this.bullets.clear();\n\n _super.prototype.dispose.call(this);\n };\n\n Object.defineProperty(SeriesDataItem.prototype, \"value\", {\n /**\r\n * @return Value\r\n */\n get: function get() {\n return this.values.value.value;\n },\n\n /**\r\n * data items's numeric value.\r\n *\r\n * @param value Value\r\n */\n set: function set(value) {\n this.setValue(\"value\", value);\n },\n enumerable: true,\n configurable: true\n });\n return SeriesDataItem;\n}(DataItem);\n\nexport { SeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines base class for any kind of serial data.\r\n *\r\n * @see {@link ISeriesEvents} for a list of available Events\r\n * @see {@link ISeriesAdapters} for a list of available Adapters\r\n * @todo Separate axis-related stuff to some other class so that MapSeries would not have unrelated stuff\r\n */\n\nvar Series =\n/** @class */\nfunction (_super) {\n __extends(Series, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Series() {\n var _this = _super.call(this) || this;\n /**\r\n * Should this series excluded from the axis scale calculations?\r\n *\r\n * @default false\r\n */\n\n\n _this._ignoreMinMax = false;\n /**\r\n * Should series' bullets?\r\n *\r\n * @default true\r\n */\n\n _this._showBullets = true;\n /**\r\n * Settings for the appearance of the related legend items.\r\n */\n\n _this.legendSettings = new LegendSettings();\n /**\r\n * Lowest overal values by type.\r\n */\n\n _this._tmin = new Dictionary();\n /**\r\n * Highest overal values by type.\r\n */\n\n _this._tmax = new Dictionary();\n /**\r\n * Lowest values in current selection by type.\r\n */\n\n _this._smin = new Dictionary();\n /**\r\n * Highest values in current selection by type.\r\n */\n\n _this._smax = new Dictionary();\n /**\r\n * [dataItemsByAxis description]\r\n *\r\n * Both by category and date.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\n\n _this.dataItemsByAxis = new Dictionary();\n /**\r\n * Normally series items are focusable using keyboard, so that people can\r\n * select them with a TAB key. However, if there are a lot of data points on\r\n * screen it might be long and useless to tab through all o fthem.\r\n *\r\n * This is where `skipFocusThreshold` comes in. If there are more items than\r\n * the value set here, we will not make those focusable and rather let screen\r\n * reader software rely on the series summary, or authors provide alternative\r\n * detailed information display, such as HTML table.\r\n *\r\n * Different series might have different threshold defaults.\r\n */\n\n _this.skipFocusThreshold = 20;\n /**\r\n * Used to indicate if `itemReaderText` was changed \"from the outside\".\r\n */\n\n _this._itemReaderTextChanged = false;\n /**\r\n * Most of the series use absolute values. However sometimes various\r\n * calculated percent values are need, e.g. item's percent representation\r\n * across all values in series, etc.\r\n *\r\n * It's a resource-intensive operation, so it is disabled by default.\r\n *\r\n * If you need percents to be calculated, e.g. for showing them in tooltips,\r\n * or creating 100% stacks, this setting needs to be set to `true`.\r\n *\r\n * NOTE: `PieChart`, which relies on slice percentages, has this\r\n * automatically set to `true`.\r\n *\r\n * @default false\r\n */\n\n _this.calculatePercent = false;\n /**\r\n * When `calculatePercent` is enabled and data item's percent value is\r\n * calculated, last item's real value is used instead of its working value.\r\n *\r\n * This is done for the animations when last item in series (e.g. slice in\r\n * a `PieSeries`) is hidden or shown. (if we would use real value, the\r\n * calculated percent would always be 100%).\r\n *\r\n * Sometimes there is a need (e.g. for drill-down Sunburst) to disable this\r\n * hack by setting `usePercentHack` to `false`.\r\n *\r\n * @since 4.9.13\r\n * @default true\r\n */\n\n _this.usePercentHack = true;\n /**\r\n * Specifies if series should be automatically disposed when removing from\r\n * chart's `series` list.\r\n *\r\n * @default true\r\n */\n\n _this.autoDispose = true;\n /**\r\n * When chart/series' data is processed, all kinds of derivative values are\r\n * calculated. E.g. sum, min, max, change, etc. This is a potentially\r\n * time-consuming operation, especially prominent in data-heavy charts.\r\n *\r\n * If your chart does not need those values, and you have a lot of data,\r\n * setting this to `true` might give a dramatic increase in initial chart\r\n * load speed.\r\n *\r\n * Please note, regular column and line series usage scenarios do not\r\n * require derivative values. Those come into play only when you do advanced\r\n * functionality like coloring segments of charts in different colors\r\n * depending on change between open and close values, have stacked series, or\r\n * display any of the derived values, like percent, in tooltips or bullets.\r\n *\r\n * @default false\r\n */\n\n _this.simplifiedProcessing = false;\n\n if (_this.constructor === Series) {\n throw new Error(\"'Series' cannot be instantiated directly. Please use a specific series type.\");\n }\n\n _this.className = \"Series\";\n _this.isMeasured = false;\n _this.layout = \"none\";\n _this.shouldClone = false;\n\n _this.setPropertyValue(\"hidden\", false);\n\n _this.axisRanges = new List();\n\n _this.axisRanges.events.on(\"inserted\", _this.processAxisRange, _this, false);\n\n _this.minBulletDistance = 0; // otherwise we'll have a lot of cases when people won't see bullets and think it's a bug\n\n _this.mainContainer = _this.createChild(Container);\n _this.mainContainer.shouldClone = false;\n _this.mainContainer.mask = _this.createChild(Sprite);\n\n _this._disposers.push(_this.mainContainer); // all bullets should go on top of lines/fills. So we add a separate container for bullets and later set it's parent to chart.bulletsContainer\n\n\n var bulletsContainer = _this.mainContainer.createChild(Container);\n\n _this._shouldBeReady.push(bulletsContainer);\n\n bulletsContainer.shouldClone = false;\n bulletsContainer.layout = \"none\";\n bulletsContainer.virtualParent = _this;\n\n _this._disposers.push(bulletsContainer);\n\n _this.bulletsContainer = bulletsContainer;\n _this.tooltip = new Tooltip();\n _this.tooltip.virtualParent = _this;\n\n _this._disposers.push(_this.tooltip);\n\n _this.hiddenState.transitionEasing = $ease.cubicIn; // this data item holds sums, averages, etc\n\n _this.dataItem = _this.createDataItem();\n\n _this._disposers.push(_this.dataItem);\n\n _this.dataItem.component = _this; // Apply accessibility\n\n _this.role = \"group\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * We need this here so that class names can be applied to bullets container.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Series.prototype.applyTheme = function () {\n _super.prototype.applyTheme.call(this);\n\n if (options.autoSetClassName && this.bulletsContainer) {\n this.bulletsContainer.className = this.className + \"-bullets\";\n this.bulletsContainer.setClassName();\n }\n };\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n Series.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this);\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Series\");\n }\n };\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n Series.prototype.createDataItem = function () {\n return new SeriesDataItem();\n };\n\n Object.defineProperty(Series.prototype, \"chart\", {\n /**\r\n * @return Chart\r\n */\n get: function get() {\n return this._chart;\n },\n\n /**\r\n * Chart series is used on.\r\n *\r\n * @param value Chart\r\n */\n set: function set(value) {\n this._chart = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Positions bullet.\r\n *\r\n * @param bullet Sprite\r\n */\n\n Series.prototype.positionBullet = function (bullet) {// Placeholder method for extending classes to override.\n };\n /**\r\n * Decorates newly created bullet after it has been instert into the list.\r\n *\r\n * @param event List event\r\n * @todo investigate why itemReaderText is undefined\r\n */\n\n\n Series.prototype.processBullet = function (event) {\n var _this = this;\n\n var bullet = event.newValue;\n bullet.isTemplate = true; // Add accessibility options to bullet\n // If there are relatively few bullets, make them focusable\n\n this.events.once(\"datavalidated\", function (ev) {\n if (_this.itemsFocusable()) {\n bullet.focusable = true;\n }\n });\n this.invalidate();\n };\n /**\r\n * removes bullets\r\n *\r\n * @param event List event\r\n */\n\n\n Series.prototype.removeBullet = function (event) {\n var bullet = event.oldValue;\n this.dataItems.each(function (dataItem) {\n var eachBullet = dataItem.bullets.getKey(bullet.uid);\n\n if (eachBullet) {\n eachBullet.dispose();\n }\n });\n this.invalidate();\n };\n /**\r\n * Validates data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Series.prototype.validateDataItems = function () {\n _super.prototype.validateDataItems.call(this);\n\n this.processValues(false);\n };\n /**\r\n * Returns first value for the specific key in the series.\r\n *\r\n * @param key Key\r\n * @return Value\r\n * @todo Description\r\n * @todo Convert to propert object property iterator\r\n */\n\n\n Series.prototype.getFirstValue = function (key, startIndex) {\n // find first\n\n /*\r\n return $iter.findMap(this.dataItems.iterator(), (dataItem) => {\r\n for (let key in dataItem.values) {\r\n if ($object.hasKey(dataItem.values, key)) {\r\n let value: number = dataItem.values[key].workingValue;\r\n if ($type.isNumber(value)) {\r\n return value;\r\n }\r\n }\r\n }\r\n return null;\r\n });*/\n //if (startIndex > 0 && startIndex < this.dataItems.length - 1) {\n //startIndex++;\n //}\n for (var i = startIndex; i >= 0; i--) {\n var dataItem = this.dataItems.getIndex(i);\n var value = dataItem.getActualWorkingValue(key);\n\n if ($type.isNumber(value)) {\n return value;\n }\n }\n\n return null;\n };\n /**\r\n * Returns first value for the specific key in the series.\r\n *\r\n * @param key Key\r\n * @return Value\r\n * @todo Description\r\n * @todo Convert to propert object property iterator\r\n */\n\n\n Series.prototype.getAbsoluteFirstValue = function (key) {\n for (var i = 0; i < this.dataItems.length; i++) {\n var dataItem = this.dataItems.getIndex(i);\n var value = dataItem.values[key].value;\n\n if ($type.isNumber(value)) {\n return value;\n }\n }\n\n return null;\n };\n /**\r\n * [rangeChangeUpdate description]\r\n *\r\n * @todo Description\r\n */\n\n\n Series.prototype.rangeChangeUpdate = function () {\n _super.prototype.rangeChangeUpdate.call(this);\n\n this.processValues(true);\n };\n /**\r\n * [processValues description]\r\n *\r\n * @todo Description\r\n * @todo Convert to propert object property iterator\r\n * @param dataItems [description]\r\n */\n\n\n Series.prototype.processValues = function (working) {\n var _this = this;\n\n if (!this.simplifiedProcessing) {\n var dataItems = this.dataItems;\n var count_1 = {};\n var sum_1 = {};\n var absoluteSum_1 = {};\n var low_1 = {};\n var high_1 = {};\n var open_1 = {};\n var close_1 = {};\n var previous_1 = {};\n var first_1 = {};\n var absoluteFirst_1 = {}; //let duration: number = 0; // todo: check if series uses selection.change or selection.change.percent and set duration to interpolationduration\n\n var startIndex_1 = $math.max(0, this.startIndex);\n startIndex_1 = $math.min(startIndex_1, this.dataItems.length);\n var endIndex = $math.min(this.endIndex, this.dataItems.length);\n\n if (!$type.isNumber(startIndex_1)) {\n startIndex_1 = 0;\n }\n\n if (!$type.isNumber(endIndex)) {\n endIndex = this.dataItems.length;\n }\n\n if (startIndex_1 > 0) {\n var dataItem_1 = dataItems.getIndex(startIndex_1 - 1);\n $object.each(dataItem_1.values, function (key, values) {\n var value = dataItem_1.getActualWorkingValue(key);\n\n if ($type.isNumber(value)) {\n // save previous\n previous_1[key] = value;\n }\n });\n }\n\n var _loop_1 = function _loop_1(i) {\n var dataItem_2 = dataItems.getIndex(i);\n $object.each(dataItem_2.values, function (key, values) {\n var value = dataItem_2.getActualWorkingValue(key); //if (i >= startIndex && i <= endIndex) { // do not add to count, sum etc if it is not within start/end index\n\n if ($type.isNumber(value)) {\n // count values\n if (!$type.isNumber(count_1[key])) {\n count_1[key] = 0;\n }\n\n count_1[key]++; // sum values\n\n if (!$type.isNumber(sum_1[key])) {\n sum_1[key] = 0;\n }\n\n sum_1[key] += value; // absolute sum values\n\n if (!$type.isNumber(absoluteSum_1[key])) {\n absoluteSum_1[key] = 0;\n }\n\n absoluteSum_1[key] += Math.abs(value); // open\n\n if (!$type.isNumber(open_1[key])) {\n open_1[key] = value;\n } // close\n\n\n close_1[key] = value; // low\n\n if (!$type.isNumber(low_1[key])) {\n low_1[key] = value;\n } else {\n if (low_1[key] > value) {\n low_1[key] = value;\n }\n } // high\n\n\n if (!$type.isNumber(high_1[key])) {\n high_1[key] = value;\n } else {\n if (high_1[key] < value) {\n high_1[key] = value;\n }\n }\n\n if (!$type.isNumber(first_1[key])) {\n first_1[key] = _this.getFirstValue(key, startIndex_1);\n }\n\n if (!$type.isNumber(absoluteFirst_1[key])) {\n absoluteFirst_1[key] = _this.getAbsoluteFirstValue(key);\n } // change\n\n\n dataItem_2.setCalculatedValue(key, value - first_1[key], \"change\"); // change from start percent\n // will fail if first value is 0\n\n dataItem_2.setCalculatedValue(key, (value - first_1[key]) / first_1[key] * 100, \"changePercent\");\n dataItem_2.setCalculatedValue(key, value - absoluteFirst_1[key], \"startChange\");\n dataItem_2.setCalculatedValue(key, (value - absoluteFirst_1[key]) / absoluteFirst_1[key] * 100, \"startChangePercent\"); // previous change\n\n var prevValue = previous_1[key];\n\n if (!$type.isNumber(prevValue)) {\n prevValue = value;\n }\n\n dataItem_2.setCalculatedValue(key, value - prevValue, \"previousChange\"); // previous change percent\n\n dataItem_2.setCalculatedValue(key, (value - prevValue) / prevValue * 100, \"previousChangePercent\"); // save previous\n\n previous_1[key] = value;\n }\n });\n };\n\n for (var i = startIndex_1; i < endIndex; i++) {\n _loop_1(i);\n }\n\n if (this.calculatePercent) {\n var _loop_2 = function _loop_2(i) {\n var dataItem_3 = dataItems.getIndex(i);\n $object.each(dataItem_3.values, function (key) {\n var ksum = absoluteSum_1[key];\n var value = dataItem_3.getActualWorkingValue(key);\n\n if ($type.isNumber(value)) {\n if (ksum > 0) {\n if (_this.usePercentHack) {\n // this hack is made in order to make it possible to animate single slice to 0\n // if there is only one slice left, percent value is always 100%, so it won't animate\n // so we use real value of a slice instead of current value\n if (value == ksum) {\n ksum = dataItem_3.values[key].value;\n }\n }\n\n var percent = value / ksum * 100;\n dataItem_3.setCalculatedValue(key, percent, \"percent\");\n } else {\n dataItem_3.setCalculatedValue(key, 0, \"percent\");\n }\n }\n });\n };\n\n for (var i = startIndex_1; i < endIndex; i++) {\n _loop_2(i);\n }\n } // calculate one before first (cant do that in cycle, as we don't know open yet\n // when drawing line chart we should draw line to the invisible data point to the left, otherwise the line will always look like it starts from the selected point\n // so we do startIndex - 1\n\n\n if (startIndex_1 > 0) {\n var zeroItem_1 = dataItems.getIndex(startIndex_1 - 1);\n $object.each(zeroItem_1.values, function (key) {\n var value = zeroItem_1.values[key].value; // change\n\n zeroItem_1.setCalculatedValue(key, value - open_1[key], \"change\"); // change percent\n\n zeroItem_1.setCalculatedValue(key, (value - open_1[key]) / open_1[key] * 100, \"changePercent\");\n });\n } // we save various data like sum, average to dataPoint of the series\n\n\n var dataItem_4 = this.dataItem;\n $object.each(dataItem_4.values, function (key) {\n dataItem_4.setCalculatedValue(key, sum_1[key], \"sum\");\n dataItem_4.setCalculatedValue(key, absoluteSum_1[key], \"absoluteSum\");\n dataItem_4.setCalculatedValue(key, sum_1[key] / count_1[key], \"average\");\n dataItem_4.setCalculatedValue(key, open_1[key], \"open\");\n dataItem_4.setCalculatedValue(key, close_1[key], \"close\");\n dataItem_4.setCalculatedValue(key, low_1[key], \"low\");\n dataItem_4.setCalculatedValue(key, high_1[key], \"high\");\n dataItem_4.setCalculatedValue(key, count_1[key], \"count\");\n });\n }\n };\n /**\r\n * (Re)validates the whole series, effectively causing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Series.prototype.validate = function () {\n if ($utils.isIE()) {\n this.filters.clear();\n }\n\n $iter.each(this.axisRanges.iterator(), function (axisRange) {\n //axisRange.contents.disposeChildren(); // not good for columns, as they are reused\n //\t\t\taxisRange.appendChildren();\n axisRange.validate();\n });\n\n _super.prototype.validate.call(this);\n\n var bulletsContainer = this.bulletsContainer;\n bulletsContainer.fill = this.fill;\n bulletsContainer.stroke = this.stroke;\n bulletsContainer.x = this.pixelX;\n bulletsContainer.y = this.pixelY;\n\n if (this.bulletsContainer.children.length > 0) {\n if (this._showBullets) {\n for (var i = 0; i < this.startIndex; i++) {\n var dataItem = this.dataItems.getIndex(i);\n\n if (dataItem) {\n dataItem.bullets.each(function (key, bullet) {\n bullet.__disabled = true;\n });\n }\n }\n\n for (var i = this.dataItems.length - 1; i > this.endIndex; i--) {\n var dataItem = this.dataItems.getIndex(i);\n\n if (dataItem) {\n dataItem.bullets.each(function (key, bullet) {\n bullet.__disabled = true;\n });\n }\n }\n } else {\n this.bulletsContainer.children.each(function (bullet) {\n bullet.__disabled = true;\n });\n }\n }\n\n this.updateTooltipBounds();\n };\n /**\r\n * @ignore\r\n */\n\n\n Series.prototype.updateTooltipBounds = function () {\n if (this.topParent) {\n var x = 0;\n var y = 0;\n var w = this.topParent.maxWidth;\n var h = this.topParent.maxHeight;\n var rect = {\n x: x,\n y: y,\n width: w,\n height: h\n };\n this.tooltip.setBounds(rect);\n }\n };\n\n Series.prototype.shouldCreateBullet = function (dataItem, bulletTemplate) {\n return true;\n };\n /**\r\n * Validates data item's element, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\n\n\n Series.prototype.validateDataElement = function (dataItem) {\n var _this = this;\n\n _super.prototype.validateDataElement.call(this, dataItem);\n\n if (this._showBullets) {\n if (!this.isHidden) {\n this.bulletsContainer.visible = true;\n }\n\n this.bullets.each(function (bulletTemplate) {\n // always better to use the same, this helps to avoid redrawing\n var bullet = dataItem.bullets.getKey(bulletTemplate.uid);\n\n if (_this.shouldCreateBullet(dataItem, bulletTemplate)) {\n if (!bullet) {\n var disabledField = bulletTemplate.propertyFields.disabled;\n var dataContext = dataItem.dataContext;\n\n if (disabledField && dataContext && dataContext[disabledField] === false) {\n bulletTemplate.applyOnClones = false;\n bulletTemplate.disabled = false;\n bullet = bulletTemplate.clone();\n bulletTemplate.disabled = true;\n bulletTemplate.applyOnClones = true;\n } else {\n bullet = bulletTemplate.clone();\n }\n\n bullet.shouldClone = false;\n dataItem.addSprite(bullet);\n\n if (!_this.visible || _this.isHiding) {\n bullet.hide(0);\n }\n }\n\n var currentDataItem = bullet.dataItem;\n\n if (currentDataItem != dataItem) {\n // set to undefined in order not to reuse\n if (currentDataItem) {\n currentDataItem.bullets.setKey(bulletTemplate.uid, undefined);\n }\n\n var readerText_1 = _this.itemReaderText;\n\n if (bullet instanceof Bullet) {\n if (!readerText_1) {\n readerText_1 = \"{\" + bullet.xField + \"}: {\" + bullet.yField + \"}\";\n }\n\n if (bullet.isDynamic) {\n dataItem.events.on(\"workingvaluechanged\", bullet.deepInvalidate, bullet, false); //dataItem.events.on(\"calculatedvaluechanged\", bullet.deepInvalidate, bullet, false);\n\n _this.dataItem.events.on(\"workingvaluechanged\", bullet.deepInvalidate, bullet, false);\n }\n\n bullet.deepInvalidate();\n } // Add accessibility to bullet\n\n\n if (bullet.focusable) {\n bullet.events.on(\"focus\", function (ev) {\n bullet.readerTitle = _this.populateString(readerText_1, bullet.dataItem);\n }, undefined, false);\n bullet.events.on(\"blur\", function (ev) {\n bullet.readerTitle = \"\";\n }, undefined, false);\n }\n\n if (bullet.hoverable) {\n bullet.events.on(\"over\", function (ev) {\n bullet.readerTitle = _this.populateString(readerText_1, bullet.dataItem);\n }, undefined, false);\n bullet.events.on(\"out\", function (ev) {\n bullet.readerTitle = \"\";\n }, undefined, false);\n }\n }\n\n bullet.parent = _this.bulletsContainer;\n dataItem.bullets.setKey(bulletTemplate.uid, bullet); // pass max w/h so we'd know if we should show/hide somethings\n\n bullet.maxWidth = dataItem.itemWidth;\n bullet.maxHeight = dataItem.itemHeight;\n bullet.__disabled = false;\n\n _this.positionBullet(bullet);\n } else {\n if (bullet) {\n bullet.__disabled = true;\n }\n }\n });\n } else {\n this.bulletsContainer.visible = false;\n }\n };\n /**\r\n * [handleDataItemWorkingValueChange description]\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Series.prototype.handleDataItemWorkingValueChange = function (dataItem, name) {\n if (!this.dataRangeInvalid) {\n this.invalidateProcessedData();\n }\n };\n\n Object.defineProperty(Series.prototype, \"ignoreMinMax\", {\n /**\r\n * @return Exclude from calculations?\r\n */\n get: function get() {\n return this._ignoreMinMax;\n },\n\n /**\r\n * Should this series excluded from the axis scale calculations?\r\n *\r\n * @default false\r\n * @param value Exclude from calculations?\r\n */\n set: function set(value) {\n this._ignoreMinMax = value;\n this.invalidateDataItems();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Create a mask for the series.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n Series.prototype.createMask = function () {// A placeholder method for extending classes to override.\n };\n /**\r\n * Process axis range after it has been added to the list.\r\n *\r\n * @param event Event\r\n */\n\n\n Series.prototype.processAxisRange = function (event) {\n // create container if not existing\n if (!this.rangesContainer) {\n this.rangesContainer = this.createChild(Container);\n this.rangesContainer.shouldClone = false;\n this.rangesContainer.isMeasured = false;\n }\n\n var axisRange = event.newValue;\n\n if (axisRange) {\n axisRange.contents.parent = this.rangesContainer;\n axisRange.isRange = true;\n axisRange.events.on(\"valuechanged\", this.invalidateDataItems, this, false);\n }\n };\n /**\r\n * [getAxisField description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param axis [description]\r\n * @return [description]\r\n */\n\n\n Series.prototype.getAxisField = function (axis) {\n return;\n };\n /**\r\n * Shows the tooltip at specific position.\r\n *\r\n * @ignore Exclude from docs\r\n * @param xPosition X\r\n * @param yPosition Y\r\n */\n\n\n Series.prototype.showTooltipAtPosition = function (xPosition, yPosition) {// Placeholder method for extending classes to override.\n };\n\n Object.defineProperty(Series.prototype, \"minBulletDistance\", {\n /**\r\n * @return Distance (px)\r\n */\n get: function get() {\n return this.getPropertyValue(\"minBulletDistance\");\n },\n\n /**\r\n * Minimal distance between data points in pixels.\r\n *\r\n * If distance gets smaller than this, bullets are turned off to avoid\r\n * overlapping.\r\n *\r\n * `0` (zero) disables this behavior.\r\n *\r\n * IMPORTANT: This setting will work only when Series' base axis\r\n * is [[CategoryAxis]] or [[DateAxis]]. If base axis is [[ValueAxis]] the\r\n * setting will be ignored, because it would be a huge overhead to measure\r\n * distance between each and every bullet.\r\n *\r\n * @default 0\r\n * @param value Distance (px)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"minBulletDistance\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Series.prototype, \"bullets\", {\n /**\r\n * A list of bullets that will be added to each and every items in the\r\n * series.\r\n *\r\n * You can push any object that is a descendant of a [[Sprite]] here. All\r\n * items added to this list will be copied and used as a bullet on all data\r\n * items, including their properties, events, etc.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/bullets/} for more info about the concept of Bullets\r\n * @return List of bullets.\r\n */\n get: function get() {\n if (!this._bullets) {\n this._bullets = new ListTemplate(new Bullet());\n this._bullets.template.virtualParent = this;\n\n this._bullets.events.on(\"inserted\", this.processBullet, this, false);\n\n this._bullets.events.on(\"removed\", this.removeBullet, this, false);\n\n this._disposers.push(new ListDisposer(this._bullets));\n\n this._disposers.push(this._bullets.template);\n }\n\n return this._bullets;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Binds related legend data item's visual settings to this series' visual\r\n * settings.\r\n *\r\n * @ignore Exclude from docs\r\n * @param marker Legend item container\r\n */\n\n Series.prototype.createLegendMarker = function (marker) {// This is a placeholder method for extending classes to override.\n };\n\n Object.defineProperty(Series.prototype, \"hiddenInLegend\", {\n /**\r\n * @return Hidden in legend?\r\n */\n get: function get() {\n return this.getPropertyValue(\"hiddenInLegend\");\n },\n\n /**\r\n * Should the series be hidden in legend?\r\n *\r\n * @param value Hidden in legend?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"hiddenInLegend\", value)) {\n if (this.chart) {\n this.chart.feedLegend();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Series.prototype, \"name\", {\n /**\r\n * @return Name\r\n */\n get: function get() {\n return this.getPropertyValue(\"name\");\n },\n\n /**\r\n * Series' name.\r\n *\r\n * @param value Name\r\n */\n set: function set(value) {\n this.setPropertyValue(\"name\", value);\n var legendDataItem = this.legendDataItem;\n\n if (legendDataItem) {\n legendDataItem.component.invalidate();\n legendDataItem.component.invalidateRawData();\n }\n\n this.readerTitle = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Series.prototype, \"itemReaderText\", {\n /**\r\n * @return Screen reader text template\r\n */\n get: function get() {\n // Get explicitly set reader text\n var readerText = this._itemReaderText; // Not set? Let's try something else\n\n if (!readerText) {\n // Tooltip text?\n if (this.tooltipText) {\n readerText = $utils.plainText(this.tooltipText);\n } else if (this.tooltipHTML) {\n readerText = $utils.plainText(this.tooltipHTML);\n }\n }\n\n if (!this._adapterO) {\n return readerText;\n } else {\n return this._adapterO.apply(\"itemReaderText\", readerText);\n }\n },\n\n /**\r\n * Screen reader text to be applied to each individual data item, such\r\n * as bullets, columns or slices.\r\n *\r\n * The template can contain field reference meta codes, i.e. `{dateX}`,\r\n * `{valueY}`, etc.\r\n *\r\n * Any text formatting options, e.g. `[bold]` will be ignored.\r\n *\r\n * @param value Screen reader text template\r\n */\n set: function set(value) {\n this._itemReaderText = value;\n this._itemReaderTextChanged = true;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns if number of data items in the series are beyond non-focusable\r\n * count and should not be available for TAB-through.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Items focusable?\r\n */\n\n Series.prototype.itemsFocusable = function () {\n return this.dataItems.length >= this.skipFocusThreshold ? false : true;\n };\n\n Object.defineProperty(Series.prototype, \"legendDataItem\", {\n /**\r\n * @return Data item\r\n */\n get: function get() {\n return this._legendDataItem;\n },\n\n /**\r\n * Legend data item that corresponds to this series.\r\n *\r\n * @param value Data item\r\n */\n set: function set(value) {\n this._legendDataItem = value;\n\n this._legendDataItem.itemContainer.deepInvalidate();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates corresponding legend data item with current values.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\n\n Series.prototype.updateLegendValue = function (dataItem, notRange) {\n // if this series has legend item\n if (this.legendDataItem) {\n var legendSettings = this.legendSettings;\n var legendDataItem = this.legendDataItem;\n var label = legendDataItem.label;\n var valueLabel = legendDataItem.valueLabel; // update legend\n\n if (dataItem && !dataItem.isDisposed() || notRange) {\n if (valueLabel) {\n if (legendSettings.itemValueText) {\n valueLabel.text = legendSettings.itemValueText;\n }\n\n valueLabel.dataItem = dataItem;\n }\n\n if (label) {\n if (legendSettings.itemLabelText) {\n label.text = legendSettings.itemLabelText;\n }\n\n label.dataItem = dataItem;\n }\n } else {\n if (label) {\n // if itemLabelText is set, means we have to reset label even if labelText is not set\n if (legendSettings.labelText || legendSettings.itemLabelText != undefined) {\n label.text = legendSettings.labelText;\n }\n\n label.dataItem = this.dataItem;\n }\n\n if (valueLabel) {\n if (legendSettings.valueText || legendSettings.itemValueText != undefined) {\n valueLabel.text = legendSettings.valueText;\n }\n\n valueLabel.dataItem = this.dataItem;\n }\n }\n }\n };\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\n\n\n Series.prototype.copyFrom = function (source) {\n this.bullets.copyFrom(source.bullets);\n this.bulletsContainer.copyFrom(source.bulletsContainer);\n this.calculatePercent = source.calculatePercent;\n this.usePercentHack = source.usePercentHack;\n this.simplifiedProcessing = source.simplifiedProcessing;\n\n _super.prototype.copyFrom.call(this, source);\n };\n /**\r\n * Displays a modal or console message with error, and halts any further\r\n * processing of this element.\r\n *\r\n * @param e Error\r\n */\n\n\n Series.prototype.raiseCriticalError = function (e) {\n if (this._chart && this._chart.modal) {\n this._chart.modal.content = this._chart.adapter.apply(\"criticalError\", e).message;\n this._chart.modal.closable = false;\n\n if (!options.suppressErrors) {\n this._chart.modal.open();\n }\n\n this._chart.disabled = true;\n }\n\n if (options.verbose) {\n console.log(e);\n }\n };\n /**\r\n * Applies filters to the element.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n Series.prototype.applyFilters = function () {\n var _this = this;\n\n _super.prototype.applyFilters.call(this);\n\n this.bulletsContainer.filters.clear(); // copyFrom of a list copies, does not clone\n\n $iter.each(this.filters.iterator(), function (filter) {\n _this.bulletsContainer.filters.push(filter.clone());\n });\n };\n\n Object.defineProperty(Series.prototype, \"heatRules\", {\n /**\r\n * A list of heat rules to apply to series' elements based on the value\r\n * of the data item.\r\n *\r\n * Heat rules can be any \"numeric\" (including `Color`) property, and can also\r\n * be applied to child objects of series, like columns, bullets, etc.\r\n *\r\n * E.g.:\r\n *\r\n * ```TypeScript\r\n * series.heatRules.push({\r\n * \"target\": series.columns.template,\r\n * \"property\": \"fill\",\r\n * \"min\": am4core.color(\"#F5DBCB\"),\r\n * \"max\": am4core.color(\"#ED7B84\"),\r\n * \"dataField\": \"valueY\"\r\n *});\r\n *```\r\n * ```Javacript\r\n * series.heatRules.push({\r\n * \"target\": series.columns.template,\r\n * \"property\": \"fill\",\r\n * \"min\": am4core.color(\"#F5DBCB\"),\r\n * \"max\": am4core.color(\"#ED7B84\"),\r\n * \"dataField\": \"valueY\"\r\n *});\r\n *```\r\n *```JSON\r\n *{\r\n * // ...\r\n * \"series\": [{\r\n * \"type\": \"ColumnSeries\",\r\n * \"heatRules\": [{\r\n * \"target\": \"columns.template\",\r\n * \"property\": \"fill\",\r\n * \"min\": \"#F5DBCB\",\r\n * \"max\": \"#ED7B84\",\r\n * \"dataField\": \"valueY\"\r\n * }]\r\n * }]\r\n *}\r\n *```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/series/#Heat_maps} for more about heat rules\r\n * @return Heat rules\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._heatRules) {\n this._heatRules = new List();\n\n this._heatRules.events.on(\"inserted\", function (event) {\n var heatRule = event.newValue;\n var target = heatRule.target;\n\n if (target) {\n var dataField_1 = heatRule.dataField;\n\n if (!$type.hasValue(dataField_1)) {\n dataField_1 = \"value\";\n }\n\n var seriesDataItem_1 = _this.dataItem;\n var property_1 = heatRule.property;\n var minValue = $type.toNumber(heatRule.minValue);\n var maxValue = $type.toNumber(heatRule.maxValue);\n\n if (!$type.isNumber(minValue) && !$type.isNumber(maxValue)) {\n _this.dataItem.events.on(\"calculatedvaluechanged\", function (event) {\n if (event.property == dataField_1) {\n $iter.each(_this.dataItems.iterator(), function (dataItem) {\n var foundSprite = false;\n $array.each(dataItem.sprites, function (sprite) {\n if (sprite.clonedFrom == target) {\n var anySprite = sprite;\n anySprite[property_1] = anySprite[property_1];\n foundSprite = true;\n }\n });\n\n if (!foundSprite) {\n $array.each(dataItem.sprites, function (sprite) {\n if (sprite instanceof Container) {\n $iter.each(sprite.children.iterator(), function (child) {\n if (child.className == target.className) {\n var anyChild = child;\n anyChild[property_1] = anyChild[property_1];\n } // giveup here\n else if (child instanceof Container) {\n child.deepInvalidate();\n }\n });\n }\n });\n }\n });\n }\n });\n }\n\n _this.dataItems.template.events.on(\"workingvaluechanged\", function (event) {\n if (event.property == dataField_1) {\n var dataItem = event.target;\n var foundSprite_1 = false;\n $array.each(dataItem.sprites, function (sprite) {\n if (sprite.clonedFrom == target) {\n var anySprite = sprite;\n anySprite[property_1] = anySprite[property_1];\n foundSprite_1 = true;\n }\n });\n\n if (!foundSprite_1) {\n $array.each(dataItem.sprites, function (sprite) {\n if (sprite instanceof Container) {\n $iter.each(sprite.children.iterator(), function (child) {\n if (child.className == target.className) {\n var anyChild = child;\n anyChild[property_1] = anyChild[property_1];\n } // givup here\n else if (child instanceof Container) {\n child.deepInvalidate();\n }\n });\n }\n });\n }\n }\n });\n\n target.adapter.add(property_1, function (value, ruleTarget, property) {\n var minValue = $type.toNumber(heatRule.minValue);\n var maxValue = $type.toNumber(heatRule.maxValue);\n var min = heatRule.min;\n var max = heatRule.max;\n\n if (ruleTarget instanceof Sprite) {\n var anySprite = ruleTarget;\n var propertyField = anySprite.propertyFields[property];\n\n if (propertyField && ruleTarget.dataItem) {\n var dataContext = ruleTarget.dataItem.dataContext;\n\n if (dataContext && $type.hasValue(dataContext[propertyField])) {\n return value;\n }\n }\n }\n\n var dataItem = ruleTarget.dataItem;\n\n if (!$type.isNumber(minValue)) {\n minValue = seriesDataItem_1.values[dataField_1].low;\n }\n\n if (!$type.isNumber(maxValue)) {\n maxValue = seriesDataItem_1.values[dataField_1].high;\n }\n\n if (dataItem) {\n var fieldValues = dataItem.values[dataField_1];\n\n if (fieldValues) {\n var workingValue = dataItem.getActualWorkingValue(dataField_1);\n\n if ($type.hasValue(min) && $type.hasValue(max) && $type.isNumber(minValue) && $type.isNumber(maxValue) && $type.isNumber(workingValue)) {\n var percent = void 0;\n\n if (heatRule.logarithmic) {\n percent = (Math.log(workingValue) * Math.LOG10E - Math.log(minValue) * Math.LOG10E) / (Math.log(maxValue) * Math.LOG10E - Math.log(minValue) * Math.LOG10E);\n } else {\n percent = (workingValue - minValue) / (maxValue - minValue);\n }\n\n if ($type.isNumber(workingValue) && (!$type.isNumber(percent) || Math.abs(percent) == Infinity)) {\n percent = 0.5;\n } // fixes problems if all values are the same\n\n\n if ($type.isNumber(min)) {\n return min + (max - min) * percent;\n } else if (min instanceof Color) {\n return new Color($colors.interpolate(min.rgb, max.rgb, percent));\n }\n }\n }\n }\n\n return value;\n });\n }\n });\n }\n\n return this._heatRules;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n Series.prototype.processConfig = function (config) {\n var heatRules;\n\n if (config) {\n // Set up bullets\n if ($type.hasValue(config.bullets) && $type.isArray(config.bullets)) {\n for (var i = 0, len = config.bullets.length; i < len; i++) {\n var bullets = config.bullets[i];\n\n if (!$type.hasValue(bullets.type)) {\n bullets.type = \"Bullet\";\n }\n }\n } // Let's take heatRules out of the config, so that we can process\n // them later, when bullets are already there\n\n\n if ($type.hasValue(config.heatRules) && $type.isArray(config.heatRules)) {\n heatRules = config.heatRules;\n delete config.heatRules;\n }\n }\n\n _super.prototype.processConfig.call(this, config); // Process heat rules again, when all other elements are ready\n\n\n if (heatRules) {\n for (var i = 0, len = heatRules.length; i < len; i++) {\n var rule = heatRules[i]; // Resolve target\n\n var target = this;\n\n if ($type.hasValue(rule.target) && $type.isString(rule.target)) {\n // Check if we can find this element by id\n if (this.map.hasKey(rule.target)) {\n target = this.map.getKey(rule.target);\n } else {\n var parts = rule.target.split(\".\");\n\n for (var x = 0; x < parts.length; x++) {\n if (target instanceof List) {\n var listitem = target.getIndex($type.toNumber(parts[x]));\n\n if (!listitem) {\n target = target[parts[x]];\n } else {\n target = listitem;\n }\n } else {\n var maybeIndex = parts[x].match(/^(.*)\\[([0-9]+)\\]/);\n\n if (maybeIndex) {\n if (target[maybeIndex[1]] instanceof List) {\n target = target[maybeIndex[1]].getIndex($type.toNumber(maybeIndex[2]));\n } else {\n target = target[maybeIndex[1]][$type.toNumber(maybeIndex[2])];\n }\n } else {\n target = target[parts[x]];\n }\n }\n }\n }\n }\n\n rule.target = target; // Resolve colors and percents\n\n if ($type.hasValue(rule.min)) {\n rule.min = this.maybeColorOrPercent(rule.min);\n }\n\n if ($type.hasValue(rule.max)) {\n rule.max = this.maybeColorOrPercent(rule.max);\n }\n }\n\n _super.prototype.processConfig.call(this, {\n heatRules: heatRules\n });\n }\n };\n /**\r\n * Returns visibility value\r\n * @ignore\r\n */\n\n /*\r\n protected getVisibility(): boolean {\r\n let hidden = this.getPropertyValue(\"hidden\");\r\n if (hidden) {\r\n return false;\r\n }\r\n else {\r\n return super.getVisibility();\r\n }\r\n }*/\n\n /**\r\n * This function is used to sort element's JSON config properties, so that\r\n * some properties that absolutely need to be processed last, can be put at\r\n * the end.\r\n *\r\n * @ignore Exclude from docs\r\n * @param a Element 1\r\n * @param b Element 2\r\n * @return Sorting number\r\n */\n\n\n Series.prototype.configOrder = function (a, b) {\n if (a == b) {\n return 0;\n } // Must come last\n else if (a == \"heatRules\") {\n return 1;\n } else if (b == \"heatRules\") {\n return -1;\n } else {\n return _super.prototype.configOrder.call(this, a, b);\n }\n };\n /**\r\n * Sets `visibility` property:\r\n *\r\n * * `true` - visible\r\n * * `false` - hidden\r\n *\r\n * @param value true - visible, false - hidden\r\n * @return Current visibility\r\n */\n\n\n Series.prototype.setVisibility = function (value) {\n _super.prototype.setVisibility.call(this, value);\n\n this.bulletsContainer.visible = value;\n };\n\n return Series;\n}(Component);\n\nexport { Series };\n/**\r\n * Register class, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Series\"] = Series;\nregistry.registeredClasses[\"SeriesDataItem\"] = SeriesDataItem;","/**\r\n * Serial chart module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Chart, ChartDataItem } from \"../Chart\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { Container } from \"../../core/Container\";\nimport { Series } from \"../series/Series\";\nimport { percent } from \"../../core/utils/Percent\";\nimport { ColorSet } from \"../../core/utils/ColorSet\";\nimport { registry } from \"../../core/Registry\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $array from \"../../core/utils/Array\";\nimport { Disposer } from \"../../core/utils/Disposer\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[SerialChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar SerialChartDataItem =\n/** @class */\nfunction (_super) {\n __extends(SerialChartDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function SerialChartDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"SerialChartDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n return SerialChartDataItem;\n}(ChartDataItem);\n\nexport { SerialChartDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for all series-based charts, like XY, Pie, etc.\r\n *\r\n * Is not useful on its own.\r\n *\r\n * @see {@link ISerialChartEvents} for a list of available Events\r\n * @see {@link ISerialChartAdapters} for a list of available Adapters\r\n */\n\nvar SerialChart =\n/** @class */\nfunction (_super) {\n __extends(SerialChart, _super);\n /**\r\n * Constructor\r\n */\n\n\n function SerialChart() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"SerialChart\";\n _this.colors = new ColorSet();\n _this._usesData = false; // Create a container for series\n\n var seriesContainer = _this.chartContainer.createChild(Container);\n\n seriesContainer.shouldClone = false;\n seriesContainer.width = percent(100);\n seriesContainer.height = percent(100);\n seriesContainer.isMeasured = false;\n seriesContainer.layout = \"none\";\n seriesContainer.zIndex = 2;\n _this.seriesContainer = seriesContainer; // Create a container for bullets\n\n var bulletsContainer = _this.chartContainer.createChild(Container);\n\n bulletsContainer.shouldClone = false;\n bulletsContainer.width = percent(100);\n bulletsContainer.height = percent(100);\n bulletsContainer.isMeasured = false;\n bulletsContainer.zIndex = 3;\n bulletsContainer.layout = \"none\";\n _this.bulletsContainer = bulletsContainer; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n\n SerialChart.prototype.dispose = function () {\n _super.prototype.dispose.call(this);\n\n if (this.colors) {\n this.colors.dispose();\n }\n\n if (this.patterns) {\n this.patterns.dispose();\n }\n };\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor\r\n */\n\n\n SerialChart.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this); // Add a default screen reader title for accessibility\n // This will be overridden in screen reader if there are any `titles` set\n\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Serial chart\");\n }\n };\n\n Object.defineProperty(SerialChart.prototype, \"series\", {\n /**\r\n * A list of chart's series.\r\n *\r\n * @return Chart's series\r\n */\n get: function get() {\n if (!this._series) {\n this._series = new ListTemplate(this.createSeries());\n\n this._series.events.on(\"inserted\", this.handleSeriesAdded, this, false);\n\n this._series.events.on(\"removed\", this.handleSeriesRemoved, this, false);\n\n this._disposers.push(new ListDisposer(this._series, false));\n\n this._disposers.push(this._series.template);\n }\n\n return this._series;\n },\n enumerable: true,\n configurable: true\n });\n\n SerialChart.prototype.handleSeriesRemoved = function (event) {\n var series = event.oldValue;\n this.dataUsers.removeValue(series);\n this.dataUsers.each(function (dataUser) {\n dataUser.invalidateDataItems();\n });\n\n if (series.autoDispose) {\n series.dispose();\n } else {\n series.parent = undefined;\n series.bulletsContainer.parent = undefined;\n } //this.feedLegend();\n\n\n var legend = this.legend;\n\n if (legend) {\n var dataItems = this.legend.dataItems;\n\n for (var i = dataItems.length - 1; i >= 0; i--) {\n var dataItem = dataItems.getIndex(i);\n\n if (dataItem && dataItem.dataContext == series) {\n legend.dataItems.remove(dataItem);\n }\n }\n\n for (var i = legend.data.length - 1; i >= 0; i--) {\n var di = legend.data[i];\n\n if (di && di == series) {\n $array.remove(legend.data, di);\n }\n }\n }\n };\n /**\r\n * Decorates a new [[Series]] object with required parameters when it is\r\n * added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n SerialChart.prototype.handleSeriesAdded = function (event) {\n var _this = this;\n\n var series = event.newValue;\n\n if (series.isDisposed()) {\n return;\n }\n\n series.chart = this;\n series.parent = this.seriesContainer;\n series.bulletsContainer.parent = this.bulletsContainer;\n\n this._dataUsers.moveValue(series);\n\n series.addDisposer(new Disposer(function () {\n _this.dataUsers.removeValue(series);\n }));\n this.handleSeriesAdded2(series);\n this.handleLegendSeriesAdded(series);\n };\n\n SerialChart.prototype.handleLegendSeriesAdded = function (series) {\n if (!series.hiddenInLegend) {\n if (this.legend) {\n this.legend.addData(series);\n }\n }\n };\n\n SerialChart.prototype.handleSeriesAdded2 = function (series) {\n var _this = this;\n\n if (!this.dataInvalid) {\n this._disposers.push( // on exit only as data is usually passed after push\n registry.events.once(\"exitframe\", function () {\n if (!series.data || series.data.length == 0) {\n series.data = _this.data;\n\n if (series.showOnInit) {\n series.reinit();\n series.setPropertyValue(\"showOnInit\", false);\n series.showOnInit = true;\n }\n\n if (!series.isDisposed()) {\n series.events.once(\"datavalidated\", function () {\n if (series.data == _this.data) {\n series._data = [];\n }\n });\n }\n }\n }));\n }\n };\n /**\r\n * Setups the legend to use the chart's data.\r\n * @ignore\r\n */\n\n\n SerialChart.prototype.feedLegend = function () {\n var legend = this.legend;\n\n if (legend) {\n var legendData_1 = [];\n $iter.each(this.series.iterator(), function (series) {\n if (!series.hiddenInLegend) {\n legendData_1.push(series);\n }\n });\n legend.dataFields.name = \"name\";\n legend.data = legendData_1;\n }\n };\n /**\r\n * Creates and returns a new Series, suitable for this chart type.\r\n *\r\n * @return New series\r\n */\n\n\n SerialChart.prototype.createSeries = function () {\n return new Series();\n };\n\n Object.defineProperty(SerialChart.prototype, \"colors\", {\n /**\r\n * @return Color list\r\n */\n get: function get() {\n return this.getPropertyValue(\"colors\");\n },\n\n /**\r\n * Chart's color list.\r\n *\r\n * This list can be used by a number of serial items, like applying a new\r\n * color for each Series added. Or, applying a new color for each slice\r\n * of a Pie chart.\r\n *\r\n * Please see [[ColorSet]] for information on how you can set up to generate\r\n * unique colors.\r\n *\r\n * A theme you are using may override default pre-defined colors.\r\n *\r\n * @param value Color list\r\n */\n set: function set(value) {\n this.setPropertyValue(\"colors\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SerialChart.prototype, \"patterns\", {\n /**\r\n * @return Pattern set\r\n */\n get: function get() {\n return this.getPropertyValue(\"patterns\");\n },\n\n /**\r\n * A [[PatternSet]] to use when creating patterned fills for slices.\r\n *\r\n * @since 4.7.5\r\n * @param value Pattern set\r\n */\n set: function set(value) {\n this.setPropertyValue(\"patterns\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies all parameters from another [[SerialChart]].\r\n *\r\n * @param source Source SerialChart\r\n */\n\n SerialChart.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.series.copyFrom(source.series);\n };\n /**\r\n * Hides the chart instantly and then shows it. If defaultState.transitionDuration > 0, this will result an animation in which properties of hidden state will animate to properties of visible state.\r\n */\n\n\n SerialChart.prototype.appear = function () {\n _super.prototype.appear.call(this);\n\n this.series.each(function (series) {\n if (series.showOnInit && series.inited) {\n series.appear();\n }\n });\n };\n\n return SerialChart;\n}(Chart);\n\nexport { SerialChart };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"SerialChart\"] = SerialChart;","function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423\nexport var Adder = /*#__PURE__*/function () {\n function Adder() {\n _classCallCheck(this, Adder);\n\n this._partials = new Float64Array(32);\n this._n = 0;\n }\n\n _createClass(Adder, [{\n key: \"add\",\n value: function add(x) {\n var p = this._partials;\n var i = 0;\n\n for (var j = 0; j < this._n && j < 32; j++) {\n var y = p[j],\n hi = x + y,\n lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);\n if (lo) p[i++] = lo;\n x = hi;\n }\n\n p[i] = x;\n this._n = i + 1;\n return this;\n }\n }, {\n key: \"valueOf\",\n value: function valueOf() {\n var p = this._partials;\n var n = this._n,\n x,\n y,\n lo,\n hi = 0;\n\n if (n > 0) {\n hi = p[--n];\n\n while (n > 0) {\n x = hi;\n y = p[--n];\n hi = x + y;\n lo = y - (hi - x);\n if (lo) break;\n }\n\n if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) {\n y = lo * 2;\n x = hi + y;\n if (y == x - hi) hi = x;\n }\n }\n\n return hi;\n }\n }]);\n\n return Adder;\n}();\nexport function fsum(values, valueof) {\n var adder = new Adder();\n\n if (valueof === undefined) {\n var _iterator = _createForOfIteratorHelper(values),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var value = _step.value;\n\n if (value = +value) {\n adder.add(value);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n } else {\n var index = -1;\n\n var _iterator2 = _createForOfIteratorHelper(values),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _value = _step2.value;\n\n if (_value = +valueof(_value, ++index, values)) {\n adder.add(_value);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n return +adder;\n}\nexport function fcumsum(values, valueof) {\n var adder = new Adder();\n var index = -1;\n return Float64Array.from(values, valueof === undefined ? function (v) {\n return adder.add(+v || 0);\n } : function (v) {\n return adder.add(+valueof(v, ++index, values) || 0);\n });\n}","export var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var tau = pi * 2;\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\nexport var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var ceil = Math.ceil;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var hypot = Math.hypot;\nexport var log = Math.log;\nexport var pow = Math.pow;\nexport var sin = Math.sin;\nexport var sign = Math.sign || function (x) {\n return x > 0 ? 1 : x < 0 ? -1 : 0;\n};\nexport var sqrt = Math.sqrt;\nexport var tan = Math.tan;\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\nexport function haversin(x) {\n return (x = sin(x / 2)) * x;\n}","export default function noop() {}","function streamGeometry(geometry, stream) {\n if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n streamGeometryType[geometry.type](geometry, stream);\n }\n}\n\nvar streamObjectType = {\n Feature: function Feature(object, stream) {\n streamGeometry(object.geometry, stream);\n },\n FeatureCollection: function FeatureCollection(object, stream) {\n var features = object.features,\n i = -1,\n n = features.length;\n\n while (++i < n) {\n streamGeometry(features[i].geometry, stream);\n }\n }\n};\nvar streamGeometryType = {\n Sphere: function Sphere(object, stream) {\n stream.sphere();\n },\n Point: function Point(object, stream) {\n object = object.coordinates;\n stream.point(object[0], object[1], object[2]);\n },\n MultiPoint: function MultiPoint(object, stream) {\n var coordinates = object.coordinates,\n i = -1,\n n = coordinates.length;\n\n while (++i < n) {\n object = coordinates[i], stream.point(object[0], object[1], object[2]);\n }\n },\n LineString: function LineString(object, stream) {\n streamLine(object.coordinates, stream, 0);\n },\n MultiLineString: function MultiLineString(object, stream) {\n var coordinates = object.coordinates,\n i = -1,\n n = coordinates.length;\n\n while (++i < n) {\n streamLine(coordinates[i], stream, 0);\n }\n },\n Polygon: function Polygon(object, stream) {\n streamPolygon(object.coordinates, stream);\n },\n MultiPolygon: function MultiPolygon(object, stream) {\n var coordinates = object.coordinates,\n i = -1,\n n = coordinates.length;\n\n while (++i < n) {\n streamPolygon(coordinates[i], stream);\n }\n },\n GeometryCollection: function GeometryCollection(object, stream) {\n var geometries = object.geometries,\n i = -1,\n n = geometries.length;\n\n while (++i < n) {\n streamGeometry(geometries[i], stream);\n }\n }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n var i = -1,\n n = coordinates.length - closed,\n coordinate;\n stream.lineStart();\n\n while (++i < n) {\n coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n }\n\n stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n var i = -1,\n n = coordinates.length;\n stream.polygonStart();\n\n while (++i < n) {\n streamLine(coordinates[i], stream, 1);\n }\n\n stream.polygonEnd();\n}\n\nexport default function (object, stream) {\n if (object && streamObjectType.hasOwnProperty(object.type)) {\n streamObjectType[object.type](object, stream);\n } else {\n streamGeometry(object, stream);\n }\n}","import { Adder } from \"d3-array\";\nimport { atan2, cos, quarterPi, radians, sin, tau } from \"./math.js\";\nimport noop from \"./noop.js\";\nimport stream from \"./stream.js\";\nexport var areaRingSum = new Adder(); // hello?\n\nvar areaSum = new Adder(),\n lambda00,\n phi00,\n lambda0,\n cosPhi0,\n sinPhi0;\nexport var areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function polygonStart() {\n areaRingSum = new Adder();\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function polygonEnd() {\n var areaRing = +areaRingSum;\n areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);\n this.lineStart = this.lineEnd = this.point = noop;\n },\n sphere: function sphere() {\n areaSum.add(tau);\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaRingEnd() {\n areaPoint(lambda00, phi00);\n}\n\nfunction areaPointFirst(lambda, phi) {\n areaStream.point = areaPoint;\n lambda00 = lambda, phi00 = phi;\n lambda *= radians, phi *= radians;\n lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);\n}\n\nfunction areaPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n phi = phi / 2 + quarterPi; // half the angular distance from south pole\n // Spherical excess E for a spherical triangle with vertices: south pole,\n // previous point, current point. Uses a formula derived from Cagnoli’s\n // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).\n\n var dLambda = lambda - lambda0,\n sdLambda = dLambda >= 0 ? 1 : -1,\n adLambda = sdLambda * dLambda,\n cosPhi = cos(phi),\n sinPhi = sin(phi),\n k = sinPhi0 * sinPhi,\n u = cosPhi0 * cosPhi + k * cos(adLambda),\n v = k * sdLambda * sin(adLambda);\n areaRingSum.add(atan2(v, u)); // Advance the previous points.\n\n lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;\n}\n\nexport default function (object) {\n areaSum = new Adder();\n stream(object, areaStream);\n return areaSum * 2;\n}","import { Adder } from \"d3-array\";\nimport { areaStream, areaRingSum } from \"./area.js\";\nimport { cartesian, cartesianCross, cartesianNormalizeInPlace, spherical } from \"./cartesian.js\";\nimport { abs, degrees, epsilon, radians } from \"./math.js\";\nimport stream from \"./stream.js\";\nvar lambda0, phi0, lambda1, phi1, // bounds\nlambda2, // previous lambda-coordinate\nlambda00, phi00, // first point\np0, // previous 3D point\ndeltaSum, ranges, range;\nvar boundsStream = {\n point: boundsPoint,\n lineStart: boundsLineStart,\n lineEnd: boundsLineEnd,\n polygonStart: function polygonStart() {\n boundsStream.point = boundsRingPoint;\n boundsStream.lineStart = boundsRingStart;\n boundsStream.lineEnd = boundsRingEnd;\n deltaSum = new Adder();\n areaStream.polygonStart();\n },\n polygonEnd: function polygonEnd() {\n areaStream.polygonEnd();\n boundsStream.point = boundsPoint;\n boundsStream.lineStart = boundsLineStart;\n boundsStream.lineEnd = boundsLineEnd;\n if (areaRingSum < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon) phi1 = 90;else if (deltaSum < -epsilon) phi0 = -90;\n range[0] = lambda0, range[1] = lambda1;\n },\n sphere: function sphere() {\n lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);\n }\n};\n\nfunction boundsPoint(lambda, phi) {\n ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n}\n\nfunction linePoint(lambda, phi) {\n var p = cartesian([lambda * radians, phi * radians]);\n\n if (p0) {\n var normal = cartesianCross(p0, p),\n equatorial = [normal[1], -normal[0], 0],\n inflection = cartesianCross(equatorial, normal);\n cartesianNormalizeInPlace(inflection);\n inflection = spherical(inflection);\n var delta = lambda - lambda2,\n sign = delta > 0 ? 1 : -1,\n lambdai = inflection[0] * degrees * sign,\n phii,\n antimeridian = abs(delta) > 180;\n\n if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {\n phii = inflection[1] * degrees;\n if (phii > phi1) phi1 = phii;\n } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {\n phii = -inflection[1] * degrees;\n if (phii < phi0) phi0 = phii;\n } else {\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n }\n\n if (antimeridian) {\n if (lambda < lambda2) {\n if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;\n }\n } else {\n if (lambda1 >= lambda0) {\n if (lambda < lambda0) lambda0 = lambda;\n if (lambda > lambda1) lambda1 = lambda;\n } else {\n if (lambda > lambda2) {\n if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;\n } else {\n if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;\n }\n }\n }\n } else {\n ranges.push(range = [lambda0 = lambda, lambda1 = lambda]);\n }\n\n if (phi < phi0) phi0 = phi;\n if (phi > phi1) phi1 = phi;\n p0 = p, lambda2 = lambda;\n}\n\nfunction boundsLineStart() {\n boundsStream.point = linePoint;\n}\n\nfunction boundsLineEnd() {\n range[0] = lambda0, range[1] = lambda1;\n boundsStream.point = boundsPoint;\n p0 = null;\n}\n\nfunction boundsRingPoint(lambda, phi) {\n if (p0) {\n var delta = lambda - lambda2;\n deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);\n } else {\n lambda00 = lambda, phi00 = phi;\n }\n\n areaStream.point(lambda, phi);\n linePoint(lambda, phi);\n}\n\nfunction boundsRingStart() {\n areaStream.lineStart();\n}\n\nfunction boundsRingEnd() {\n boundsRingPoint(lambda00, phi00);\n areaStream.lineEnd();\n if (abs(deltaSum) > epsilon) lambda0 = -(lambda1 = 180);\n range[0] = lambda0, range[1] = lambda1;\n p0 = null;\n} // Finds the left-right distance between two longitudes.\n// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want\n// the distance between ±180° to be 360°.\n\n\nfunction angle(lambda0, lambda1) {\n return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;\n}\n\nfunction rangeCompare(a, b) {\n return a[0] - b[0];\n}\n\nfunction rangeContains(range, x) {\n return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;\n}\n\nexport default function (feature) {\n var i, n, a, b, merged, deltaMax, delta;\n phi1 = lambda1 = -(lambda0 = phi0 = Infinity);\n ranges = [];\n stream(feature, boundsStream); // First, sort ranges by their minimum longitudes.\n\n if (n = ranges.length) {\n ranges.sort(rangeCompare); // Then, merge any ranges that overlap.\n\n for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {\n b = ranges[i];\n\n if (rangeContains(a, b[0]) || rangeContains(a, b[1])) {\n if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];\n if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];\n } else {\n merged.push(a = b);\n }\n } // Finally, find the largest gap between the merged ranges.\n // The final bounding box will be the inverse of this gap.\n\n\n for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {\n b = merged[i];\n if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1];\n }\n }\n\n ranges = range = null;\n return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]];\n}","import { asin, atan2, cos, sin, sqrt } from \"./math.js\";\nexport function spherical(cartesian) {\n return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])];\n}\nexport function cartesian(spherical) {\n var lambda = spherical[0],\n phi = spherical[1],\n cosPhi = cos(phi);\n return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];\n}\nexport function cartesianDot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\nexport function cartesianCross(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n} // TODO return a\n\nexport function cartesianAddInPlace(a, b) {\n a[0] += b[0], a[1] += b[1], a[2] += b[2];\n}\nexport function cartesianScale(vector, k) {\n return [vector[0] * k, vector[1] * k, vector[2] * k];\n} // TODO return d\n\nexport function cartesianNormalizeInPlace(d) {\n var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);\n d[0] /= l, d[1] /= l, d[2] /= l;\n}","/**\r\n * Map series module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Series, SeriesDataItem } from \"../series/Series\";\nimport { registry } from \"../../core/Registry\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar MapSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapSeriesDataItem\";\n _this.values.value = {};\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(MapSeriesDataItem.prototype, \"value\", {\n /**\r\n * @return Value\r\n */\n get: function get() {\n return this.values.value.value;\n },\n\n /**\r\n * Numeric value of the data item.\r\n *\r\n * Value may be used in heat-map calculations.\r\n *\r\n * @param value Value\r\n */\n set: function set(value) {\n this.setValue(\"value\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeriesDataItem.prototype, \"zoomLevel\", {\n /**\r\n * @return Zoom level\r\n */\n get: function get() {\n return this.properties[\"zoomLevel\"];\n },\n\n /**\r\n * When `zoomToMapObject()` is called the map will either calculate suitable\r\n * zoom level itself or use object's `zoomLevel` if set.\r\n *\r\n * @param value Zoom level\r\n */\n set: function set(value) {\n this.setProperty(\"zoomLevel\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeriesDataItem.prototype, \"zoomGeoPoint\", {\n /**\r\n * @return Zoom geo point\r\n */\n get: function get() {\n return this.properties[\"zoomGeoPoint\"];\n },\n\n /**\r\n * When `zoomToMapObject()` is called the map will either calculate suitable\r\n * center position itself or use object's `zoomGeoPoint` if set.\r\n *\r\n * @param value Zoom geo point\r\n */\n set: function set(value) {\n this.setProperty(\"zoomGeoPoint\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeriesDataItem.prototype, \"east\", {\n /**\r\n * Longitude of the East-most point of the element.\r\n */\n get: function get() {\n return this._east;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeriesDataItem.prototype, \"west\", {\n /**\r\n * Longitude of the West-most point of the element.\r\n */\n get: function get() {\n return this._west;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeriesDataItem.prototype, \"south\", {\n /**\r\n * Latitude of the South-most point of the element.\r\n */\n get: function get() {\n return this._south;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeriesDataItem.prototype, \"north\", {\n /**\r\n * Latitude of the North-most point of the element.\r\n */\n get: function get() {\n return this._north;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates the item's bounding coordinates: coordinates of the East, West,\r\n * North, and South-most points.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n MapSeriesDataItem.prototype.updateExtremes = function () {\n var geometry = this.getFeature().geometry;\n\n if (geometry) {\n var bounds = d3geo.geoBounds(geometry);\n var west = bounds[0][0];\n var south = bounds[0][1];\n var north = bounds[1][1];\n var east = bounds[1][0];\n var changed = false;\n\n if (north != this.north) {\n this._north = $math.round(north, 6);\n changed = true;\n }\n\n if (south != this.south) {\n this._south = $math.round(south, 6);\n changed = true;\n }\n\n if (east != this.east) {\n this._east = $math.round(east, 6);\n changed = true;\n }\n\n if (west != this.west) {\n this._west = $math.round(west, 6);\n changed = true;\n } // solves single russia prob\n\n\n if (this._east < this._west) {\n this._east = 180;\n this._west = -180;\n }\n\n if (changed) {\n this.component.invalidateDataItems();\n }\n }\n };\n\n MapSeriesDataItem.prototype.getFeature = function () {\n return {};\n };\n\n return MapSeriesDataItem;\n}(SeriesDataItem);\n\nexport { MapSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for series of map objects.\r\n *\r\n * @see {@link IMapSeriesEvents} for a list of available Events\r\n * @see {@link IMapSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar MapSeries =\n/** @class */\nfunction (_super) {\n __extends(MapSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapSeries() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"MapSeries\"; // Set defaults\n\n _this.isMeasured = false;\n _this.nonScalingStroke = true; // Set data fields\n\n _this.dataFields.value = \"value\";\n _this.ignoreBounds = false;\n\n if (_this.tooltip) {\n _this.tooltip.showInViewport = true;\n } // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n MapSeries.prototype.createDataItem = function () {\n return new MapSeriesDataItem();\n };\n /**\r\n * Checks whether object should be included in series.\r\n *\r\n * @param includes A list of explicitly included ids\r\n * @param excludes A list of explicitly excluded ids\r\n * @param id Id of the object\r\n * @return Include?\r\n */\n\n\n MapSeries.prototype.checkInclude = function (includes, excludes, id) {\n if (includes) {\n if (includes.length == 0) {\n return false;\n } else {\n if (includes.indexOf(id) == -1) {\n return false;\n }\n }\n }\n\n if (excludes && excludes.length > 0) {\n if (excludes.indexOf(id) != -1) {\n return false;\n }\n }\n\n return true;\n };\n\n Object.defineProperty(MapSeries.prototype, \"useGeodata\", {\n /**\r\n * @return Use GeoJSON data?\r\n */\n get: function get() {\n return this.getPropertyValue(\"useGeodata\");\n },\n\n /**\r\n * Should the map extract all the data about element from the GeoJSON?\r\n *\r\n * This is especially relevant for [[MapPolygonSeries]]. If not set to `true`\r\n * polygon series will need to contain geographical data in itself in order\r\n * to be drawn.\r\n *\r\n * If this is set to `true`, series will try to extract data for its objects\r\n * from either chart-level `geodata` or from series' `geodata` which holds\r\n * map infor in GeoJSON format.\r\n *\r\n * @default false\r\n * @param value Use GeoJSON data?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"useGeodata\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"include\", {\n /**\r\n * @return Included objects\r\n */\n get: function get() {\n return this.getPropertyValue(\"include\");\n },\n\n /**\r\n * A list of object ids that should be explictly included in the series.\r\n *\r\n * If this is not set, the series will automatically include all of the\r\n * objects, available in the GeoJSON map. (minus the ones listed in\r\n * `exclude`)\r\n *\r\n * If you need to display only specific objects, use `include`. E.g.:\r\n *\r\n * `include = [\"FR\", \"ES\", \"DE\"];`\r\n *\r\n * The above will show only France, Spain, and Germany out of the whole map.\r\n *\r\n * @param value Included objects\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"include\", value)) {\n this.processIncExc();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n MapSeries.prototype.processIncExc = function () {\n //this.data = [];\n this.invalidateData();\n };\n\n Object.defineProperty(MapSeries.prototype, \"ignoreBounds\", {\n /**\r\n * @return Ignore bounds?\r\n */\n get: function get() {\n return this.getPropertyValue(\"ignoreBounds\");\n },\n\n /**\r\n * Should this series be included when calculating bounds of the map?\r\n *\r\n * This affects initial zoom as well as limits for zoom/pan.\r\n *\r\n * By default, `MapPolygonSeries` included (true), while `MapImageSeries` and\r\n * `MapLineSeries` are not (`false`).\r\n *\r\n * @since 4.3.0\r\n * @param value Ignore bounds?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"ignoreBounds\", value)) {\n if (this.chart) {\n this.chart.updateExtremes();\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"exclude\", {\n /**\r\n * @return Excluded ids\r\n */\n get: function get() {\n return this.getPropertyValue(\"exclude\");\n },\n\n /**\r\n * A list of object ids that should be excluded from the series.\r\n *\r\n * E.g. you want to include all of the areas from a GeoJSON map, except\r\n * Antarctica.\r\n *\r\n * You'd leave `include` empty, and set `exclude = [\"AQ\"]`.\r\n *\r\n * @param value Excluded ids\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"exclude\", value)) {\n this.processIncExc();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Decorates a newly added object.\r\n *\r\n * @param event [description]\r\n */\n\n MapSeries.prototype.handleObjectAdded = function (event) {\n var mapObject = event.newValue;\n mapObject.parent = this;\n mapObject.series = this;\n mapObject.strokeWidth = mapObject.strokeWidth;\n };\n\n Object.defineProperty(MapSeries.prototype, \"geodata\", {\n /**\r\n * @return GeoJSON data\r\n */\n get: function get() {\n return this._geodata;\n },\n\n /**\r\n * Map data in GeoJSON format.\r\n *\r\n * The series supports the following GeoJSON objects: `Point`, `LineString`,\r\n * `Polygon`, `MultiPoint`, `MultiLineString`, and `MultiPolygon`.\r\n *\r\n * @see {@link http://geojson.org/} Official GeoJSON format specification\r\n * @param geoJSON GeoJSON data\r\n */\n set: function set(geodata) {\n if (geodata != this._geodata) {\n this._geodata = geodata;\n\n if (this.reverseGeodata) {\n this.chart.processReverseGeodata(this._geodata);\n }\n\n for (var i = this.data.length - 1; i >= 0; i--) {\n if (this.data[i].madeFromGeoData == true) {\n this.data.splice(i, 1);\n }\n }\n\n this.disposeData();\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"reverseGeodata\", {\n /**\r\n * @returns Reverse the order of geodata coordinates?\r\n */\n get: function get() {\n return this.getPropertyValue(\"reverseGeodata\");\n },\n\n /**\r\n * Indicates whether GeoJSON geodata supplied to the chart uses\r\n * ESRI (clockwise) or non-ESRI (counter-clockwise) order of the polygon\r\n * coordinates.\r\n *\r\n * `MapChart` supports only ESRI standard, so if your custom maps appears\r\n * garbled, try setting `reverseGeodata = true`.\r\n *\r\n * @default false\r\n * @since 4.10.11\r\n * @param value Reverse the order of geodata coordinates?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"reverseGeodata\", value) && this._geodata) {\n this.chart.processReverseGeodata(this._geodata);\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"geodataSource\", {\n /**\r\n * Returns a [[DataSource]] specifically for loading Component's data.\r\n *\r\n * @return Data source\r\n */\n get: function get() {\n if (!this._dataSources[\"geodata\"]) {\n this.getDataSource(\"geodata\");\n }\n\n return this._dataSources[\"geodata\"];\n },\n\n /**\r\n * Sets a [[DataSource]] to be used for loading Component's data.\r\n *\r\n * @param value Data source\r\n */\n set: function set(value) {\n var _this = this;\n\n if (this._dataSources[\"geodata\"]) {\n this.removeDispose(this._dataSources[\"geodata\"]);\n }\n\n this._dataSources[\"geodata\"] = value;\n this._dataSources[\"geodata\"].component = this;\n this.events.on(\"inited\", function () {\n _this.loadData(\"geodata\");\n }, undefined, false);\n this.setDataSourceEvents(value, \"geodata\");\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n MapSeries.prototype.getFeatures = function () {\n return;\n };\n /**\r\n * @ignore\r\n */\n\n\n MapSeries.prototype.validateDataItems = function () {\n _super.prototype.validateDataItems.call(this);\n\n this.updateExtremes();\n };\n /**\r\n * @ignore\r\n */\n\n\n MapSeries.prototype.updateExtremes = function () {\n var north;\n var south;\n var east;\n var west;\n this.dataItems.each(function (dataItem) {\n if (dataItem.north > north || !$type.isNumber(north)) {\n north = dataItem.north;\n }\n\n if (dataItem.south < south || !$type.isNumber(south)) {\n south = dataItem.south;\n }\n\n if (dataItem.west < west || !$type.isNumber(west)) {\n west = dataItem.west;\n }\n\n if (dataItem.east > east || !$type.isNumber(east)) {\n east = dataItem.east;\n }\n });\n\n if (this._mapObjects) {\n this._mapObjects.each(function (mapObject) {\n if (mapObject.north > north || !$type.isNumber(north)) {\n north = mapObject.north;\n }\n\n if (mapObject.south < south || !$type.isNumber(south)) {\n south = mapObject.south;\n }\n\n if (mapObject.west < west || !$type.isNumber(west)) {\n west = mapObject.west;\n }\n\n if (mapObject.east > east || !$type.isNumber(east)) {\n east = mapObject.east;\n }\n });\n }\n\n if (this.north != north || this.east != east || this.south != south || this.west != west) {\n this._north = north;\n this._east = east;\n this._west = west;\n this._south = south;\n this.dispatch(\"geoBoundsChanged\");\n\n if (!this.ignoreBounds) {\n this.chart.updateExtremes();\n }\n }\n };\n\n Object.defineProperty(MapSeries.prototype, \"north\", {\n /**\r\n * @return Latitude\r\n */\n get: function get() {\n if ($type.isNumber(this._northDefined)) {\n return this._northDefined;\n }\n\n return this._north;\n },\n\n /**\r\n * North-most latitude of the series.\r\n *\r\n * By default, this holds auto-calculated latitude of the extremity.\r\n *\r\n * It can be overridden manually.\r\n *\r\n * @param value Latitude\r\n */\n set: function set(value) {\n this._northDefined = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"south\", {\n /**\r\n * @return Latitude\r\n */\n get: function get() {\n if ($type.isNumber(this._southDefined)) {\n return this._southDefined;\n }\n\n return this._south;\n },\n\n /**\r\n * South-most latitude of the series.\r\n *\r\n * By default, this holds auto-calculated latitude of the extremity.\r\n *\r\n * It can be overridden manually.\r\n *\r\n * @param value Latitude\r\n */\n set: function set(value) {\n this._southDefined = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"west\", {\n /**\r\n * @return Longitude\r\n */\n get: function get() {\n if ($type.isNumber(this._westDefined)) {\n return this._westDefined;\n }\n\n return this._west;\n },\n\n /**\r\n * West-most longitude of the series.\r\n *\r\n * By default, this holds auto-calculated longitude of the extremity.\r\n *\r\n * It can be overridden manually.\r\n *\r\n * @param value Longitude\r\n */\n set: function set(value) {\n this._westDefined = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapSeries.prototype, \"east\", {\n /**\r\n * @return Longitude\r\n */\n get: function get() {\n if ($type.isNumber(this._eastDefined)) {\n return this._eastDefined;\n }\n\n return this._east;\n },\n\n /**\r\n * East-most longitude of the series.\r\n *\r\n * By default, this holds auto-calculated longitude of the extremity.\r\n *\r\n * It can be overridden manually.\r\n *\r\n * @param value Longitude\r\n */\n set: function set(value) {\n this._eastDefined = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n MapSeries.prototype.processConfig = function (config) {\n if ($type.hasValue(config[\"geodata\"]) && $type.isString(config[\"geodata\"])) {\n var name_1 = config[\"geodata\"]; // Check if there's a map loaded by such name\n\n if ($type.hasValue(window[\"am4geodata_\" + config[\"geodata\"]])) {\n config[\"geodata\"] = window[\"am4geodata_\" + config[\"geodata\"]];\n } // Nope. Let's try maybe we got JSON as string?\n else {\n try {\n config[\"geodata\"] = JSON.parse(config[\"geodata\"]);\n } catch (e) {\n // No go again. Error out.\n throw Error(\"MapChart error: Geodata `\" + name_1 + \"` is not loaded or is incorrect.\");\n }\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n /**\r\n * Adds `projection` to \"as is\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as is?\r\n */\n\n\n MapSeries.prototype.asIs = function (field) {\n return field == \"geodata\" || _super.prototype.asIs.call(this, field);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapSeries.prototype.updateTooltipBounds = function () {\n if (this.tooltip && this.topParent) {\n this.tooltip.setBounds({\n x: 10,\n y: 10,\n width: this.topParent.maxWidth - 20,\n height: this.topParent.maxHeight - 20\n });\n }\n };\n\n return MapSeries;\n}(Series);\n\nexport { MapSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapSeries\"] = MapSeries;\nregistry.registeredClasses[\"MapSeriesDataItem\"] = MapSeriesDataItem;","/**\r\n * Map object module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { registry } from \"../../core/Registry\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as d3geo from \"d3-geo\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A base class for all map objects: lines, images, etc.\r\n *\r\n * @see {@link IMapObjectEvents} for a list of available events\r\n * @see {@link IMapObjectAdapters} for a list of available Adapters\r\n */\n\nvar MapObject =\n/** @class */\nfunction (_super) {\n __extends(MapObject, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapObject() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"MapObject\"; // Set defaults\n\n _this.isMeasured = false;\n _this.layout = \"none\";\n _this.clickable = true; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * (Re)validates this object, forcing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapObject.prototype.validate = function () {\n if (this.series && this.series.itemReaderText) {\n this.readerTitle = this.series.itemReaderText;\n }\n\n _super.prototype.validate.call(this);\n };\n /**\r\n * Updates the item's bounding coordinates: coordinates of the East, West,\r\n * North, and South-most points.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapObject.prototype.updateExtremes = function () {\n var feature = this.getFeature();\n\n if (feature) {\n var geometry = feature.geometry;\n\n if (geometry) {\n var bounds = d3geo.geoBounds(geometry);\n var west = bounds[0][0];\n var south = bounds[0][1];\n var north = bounds[1][1];\n var east = bounds[1][0];\n var changed = false;\n\n if (north != this.north) {\n this._north = $math.round(north, 8);\n changed = true;\n }\n\n if (south != this.south) {\n this._south = $math.round(south);\n changed = true;\n }\n\n if (east != this.east) {\n this._east = $math.round(east);\n changed = true;\n }\n\n if (west != this.west) {\n this._west = $math.round(west);\n changed = true;\n }\n\n if (changed) {\n this.dispatch(\"geoBoundsChanged\");\n\n if (this.series) {\n this.series.invalidateDataItems();\n }\n }\n }\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n MapObject.prototype.getFeature = function () {\n return {};\n };\n\n Object.defineProperty(MapObject.prototype, \"east\", {\n /**\r\n * Longitude of the East-most point of the element.\r\n */\n get: function get() {\n if ($type.isNumber(this._east)) {\n return this._east;\n } else if (this.dataItem) {\n return this.dataItem.east;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapObject.prototype, \"west\", {\n /**\r\n * Longitude of the West-most point of the element.\r\n */\n get: function get() {\n if ($type.isNumber(this._west)) {\n return this._west;\n } else if (this.dataItem) {\n return this.dataItem.west;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapObject.prototype, \"south\", {\n /**\r\n * Latitude of the South-most point of the element.\r\n */\n get: function get() {\n if ($type.isNumber(this._south)) {\n return this._south;\n } else if (this.dataItem) {\n return this.dataItem.south;\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapObject.prototype, \"north\", {\n /**\r\n * Latitude of the North-most point of the element.\r\n */\n get: function get() {\n if ($type.isNumber(this._north)) {\n return this._north;\n } else if (this.dataItem) {\n return this.dataItem.north;\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Shows the element's [[Tooltip]].\r\n *\r\n * A tooltip will be populated using text templates in either `tooltipHTML` or\r\n * `tooltipText` as well as data in `tooltipDataItem`.\r\n *\r\n * @see {@link Tooltip}\r\n * @param optional point (sprite-related) to which tooltip must point.\r\n * @return returns true if the tooltip was shown and false if it wasn't (no text was found)\r\n */\n\n MapObject.prototype.showTooltip = function (point) {\n var res = _super.prototype.showTooltip.call(this, point);\n\n if (res && this.showTooltipOn == \"always\" && !this.series.chart.events.has(\"mappositionchanged\", this.handleTooltipMove, this)) {\n this.addDisposer(this.series.chart.events.on(\"mappositionchanged\", this.handleTooltipMove, this));\n }\n\n return res;\n };\n\n MapObject.prototype.handleTooltipMove = function (ev) {\n if (!this.tooltip.isHidden) {\n this.showTooltip();\n }\n };\n /**\r\n * Sets a [[DataItem]].\r\n * @param dataItem DataItem\r\n */\n\n\n MapObject.prototype.setDataItem = function (dataItem) {\n _super.prototype.setDataItem.call(this, dataItem);\n\n this.applyAccessibility();\n };\n\n return MapObject;\n}(Container);\n\nexport { MapObject };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapObject\"] = MapObject;","/**\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapObject } from \"./MapObject\";\nimport { registry } from \"../../core/Registry\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to place an image on the map.\r\n *\r\n * @see {@link IMapImageEvents} for a list of available events\r\n * @see {@link IMapImageAdapters} for a list of available Adapters\r\n */\n\nvar MapImage =\n/** @class */\nfunction (_super) {\n __extends(MapImage, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapImage() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapImage\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(MapImage.prototype, \"latitude\", {\n /**\r\n * @return Latitude\r\n */\n get: function get() {\n var latitude = this.getPropertyValue(\"latitude\");\n\n if (!$type.isNumber(latitude) && this.dataItem && this.dataItem.geoPoint) {\n latitude = this.dataItem.geoPoint.latitude;\n }\n\n return latitude;\n },\n\n /**\r\n * Latitude image is placed at.\r\n *\r\n * @param value Latitude\r\n */\n set: function set(value) {\n this.setPropertyValue(\"latitude\", value, false, true);\n this.updateExtremes();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapImage.prototype, \"longitude\", {\n /**\r\n * @return Longitude\r\n */\n get: function get() {\n var longitude = this.getPropertyValue(\"longitude\");\n\n if (!$type.isNumber(longitude) && this.dataItem && this.dataItem.geoPoint) {\n longitude = this.dataItem.geoPoint.longitude;\n }\n\n return longitude;\n },\n\n /**\r\n * Longitude image is placed on.\r\n *\r\n * @param value Longitude\r\n */\n set: function set(value) {\n this.setPropertyValue(\"longitude\", value, false, true);\n this.updateExtremes();\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Repositions the image to it's current position.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n MapImage.prototype.validatePosition = function () {\n if ($type.isNumber(this.latitude) && $type.isNumber(this.longitude)) {\n //this.moveTo(this.series.chart.projection.convert({ latitude: this.latitude, longitude: this.longitude }));\n var p = this.series.chart.projection.d3Projection([this.longitude, this.latitude]);\n var visible = this.series.chart.projection.d3Path({\n type: 'Point',\n coordinates: [this.longitude, this.latitude]\n });\n\n if (!visible) {\n this.__disabled = true;\n } else {\n this.__disabled = false;\n }\n\n this.moveTo({\n x: p[0],\n y: p[1]\n });\n }\n\n _super.prototype.validatePosition.call(this);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapImage.prototype.getFeature = function () {\n return {\n \"type\": \"Feature\",\n geometry: {\n type: \"Point\",\n coordinates: [this.longitude, this.latitude]\n }\n };\n };\n\n return MapImage;\n}(MapObject);\n\nexport { MapImage };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapImage\"] = MapImage;","export default function (a, b) {\n function compose(x, y) {\n return x = a(x, y), b(x[0], x[1]);\n }\n\n if (a.invert && b.invert) compose.invert = function (x, y) {\n return x = b.invert(x, y), x && a.invert(x[0], x[1]);\n };\n return compose;\n}","import compose from \"./compose.js\";\nimport { abs, asin, atan2, cos, degrees, pi, radians, sin, tau } from \"./math.js\";\n\nfunction rotationIdentity(lambda, phi) {\n return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];\n}\n\nrotationIdentity.invert = rotationIdentity;\nexport function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {\n return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;\n}\n\nfunction forwardRotationLambda(deltaLambda) {\n return function (lambda, phi) {\n return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];\n };\n}\n\nfunction rotationLambda(deltaLambda) {\n var rotation = forwardRotationLambda(deltaLambda);\n rotation.invert = forwardRotationLambda(-deltaLambda);\n return rotation;\n}\n\nfunction rotationPhiGamma(deltaPhi, deltaGamma) {\n var cosDeltaPhi = cos(deltaPhi),\n sinDeltaPhi = sin(deltaPhi),\n cosDeltaGamma = cos(deltaGamma),\n sinDeltaGamma = sin(deltaGamma);\n\n function rotation(lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaPhi + x * sinDeltaPhi;\n return [atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin(k * cosDeltaGamma + y * sinDeltaGamma)];\n }\n\n rotation.invert = function (lambda, phi) {\n var cosPhi = cos(phi),\n x = cos(lambda) * cosPhi,\n y = sin(lambda) * cosPhi,\n z = sin(phi),\n k = z * cosDeltaGamma - y * sinDeltaGamma;\n return [atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin(k * cosDeltaPhi - x * sinDeltaPhi)];\n };\n\n return rotation;\n}\n\nexport default function (rotate) {\n rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);\n\n function forward(coordinates) {\n coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n }\n\n forward.invert = function (coordinates) {\n coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);\n return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;\n };\n\n return forward;\n}","import { cartesian, cartesianNormalizeInPlace, spherical } from \"./cartesian.js\";\nimport constant from \"./constant.js\";\nimport { acos, cos, degrees, epsilon, radians, sin, tau } from \"./math.js\";\nimport { rotateRadians } from \"./rotation.js\"; // Generates a circle centered at [0°, 0°], with a given radius and precision.\n\nexport function circleStream(stream, radius, delta, direction, t0, t1) {\n if (!delta) return;\n var cosRadius = cos(radius),\n sinRadius = sin(radius),\n step = direction * delta;\n\n if (t0 == null) {\n t0 = radius + direction * tau;\n t1 = radius - step / 2;\n } else {\n t0 = circleRadius(cosRadius, t0);\n t1 = circleRadius(cosRadius, t1);\n if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;\n }\n\n for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {\n point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]);\n stream.point(point[0], point[1]);\n }\n} // Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].\n\nfunction circleRadius(cosRadius, point) {\n point = cartesian(point), point[0] -= cosRadius;\n cartesianNormalizeInPlace(point);\n var radius = acos(-point[1]);\n return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;\n}\n\nexport default function () {\n var center = constant([0, 0]),\n radius = constant(90),\n precision = constant(6),\n ring,\n rotate,\n stream = {\n point: point\n };\n\n function point(x, y) {\n ring.push(x = rotate(x, y));\n x[0] *= degrees, x[1] *= degrees;\n }\n\n function circle() {\n var c = center.apply(this, arguments),\n r = radius.apply(this, arguments) * radians,\n p = precision.apply(this, arguments) * radians;\n ring = [];\n rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert;\n circleStream(stream, r, p, 1);\n c = {\n type: \"Polygon\",\n coordinates: [ring]\n };\n ring = rotate = null;\n return c;\n }\n\n circle.center = function (_) {\n return arguments.length ? (center = typeof _ === \"function\" ? _ : constant([+_[0], +_[1]]), circle) : center;\n };\n\n circle.radius = function (_) {\n return arguments.length ? (radius = typeof _ === \"function\" ? _ : constant(+_), circle) : radius;\n };\n\n circle.precision = function (_) {\n return arguments.length ? (precision = typeof _ === \"function\" ? _ : constant(+_), circle) : precision;\n };\n\n return circle;\n}","/**\r\n * A collection of Map-related utility functions.\r\n */\nimport * as $array from \"../../core/utils/Array\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Converts a multi-part polygon in X/Y coordinates to a geo-multipolygon in\r\n * geo-points (lat/long).\r\n *\r\n * @param multiPolygon Source multi-polygon\r\n * @return Geo-multipolygon\r\n */\n\nexport function multiPolygonToGeo(multiPolygon) {\n return $array.map(multiPolygon, function (polygon) {\n var surface = polygon[0];\n var hole = polygon[1]; //let holePoints: Array = [];\n\n var geoArea = [];\n\n if (surface) {\n geoArea.push(multiPointToGeo(surface));\n }\n\n if (hole) {\n geoArea.push(multiPointToGeo(hole));\n }\n\n return geoArea;\n });\n}\n/**\r\n * Converts a multiline in X/Y coordinates to a geo-multiline in geo-points\r\n * (lat/long).\r\n *\r\n * @param multiLine Source multiline\r\n * @return Geo-multiline\r\n */\n\nexport function multiLineToGeo(multiLine) {\n return $array.map(multiLine, function (multiLine) {\n return multiPointToGeo(multiLine);\n });\n}\n/**\r\n * Converts multiple X/Y points into a lat/long geo-points.\r\n *\r\n * @param points Source points\r\n * @return Geo-points\r\n */\n\nexport function multiPointToGeo(points) {\n return $array.map(points, function (point) {\n return pointToGeo(point);\n });\n}\n/**\r\n * Converts multiple X/Y points into a lat/long geo-points.\r\n *\r\n * @param points Source points\r\n * @return Geo-points\r\n */\n\nexport function multiGeoToPoint(geoPoints) {\n return $array.map(geoPoints, geoToPoint);\n}\n/**\r\n * Converts X/Y point into a lat/long geo-point.\r\n *\r\n * @param point Source point\r\n * @return Geo-point\r\n */\n\nexport function pointToGeo(point) {\n return {\n longitude: point[0],\n latitude: point[1]\n };\n}\n/**\r\n * Converts lat/long geo-point into a X/Y point.\r\n *\r\n * @param point Source geo-point\r\n * @return X/Y point\r\n */\n\nexport function geoToPoint(geoPoint) {\n return [geoPoint.longitude, geoPoint.latitude];\n}\n/**\r\n * Converts geo line (collection of lat/long coordinates) to screen line (x/y).\r\n *\r\n * @param multiGeoLine Source geo line\r\n * @return Screen line\r\n */\n\nexport function multiGeoLineToMultiLine(multiGeoLine) {\n return $array.map(multiGeoLine, function (segment) {\n return $array.map(segment, geoToPoint);\n });\n}\n/**\r\n * Converts a geo polygon (collection of lat/long coordinates) to screen\r\n * polygon (x/y).\r\n *\r\n * @param multiGeoPolygon Source polygon\r\n * @return Screen polygon\r\n */\n\nexport function multiGeoPolygonToMultipolygon(multiGeoPolygon) {\n return $array.map(multiGeoPolygon, function (geoPolygon) {\n var surface = geoPolygon[0];\n var hole = geoPolygon[1];\n var multiPolygon = [];\n\n if (surface) {\n multiPolygon.push(multiGeoToPoint(surface));\n }\n\n if (hole) {\n multiPolygon.push(multiGeoToPoint(hole));\n }\n\n return multiPolygon;\n });\n}\n/**\r\n * Returns a set of geographical coordinates for the circle with a center\r\n * at specific lat/long coordinates and radius (in degrees).\r\n *\r\n * @since 4.3.0\r\n * @param longitude Center longitude\r\n * @param latitude Center latitude\r\n * @param radius Radius (degrees)\r\n * @return Circle coordinates\r\n */\n\nexport function getCircle(longitude, latitude, radius) {\n return [d3geo.geoCircle().center([longitude, latitude]).radius(radius)().coordinates];\n}\n/**\r\n * Returns a set of screen coordinates that represents a \"background\" area\r\n * between provided extremities.\r\n *\r\n * @since 4.3.0\r\n * @param north North latitude\r\n * @param east East longitude\r\n * @param south South latitude\r\n * @param west West longitude\r\n * @return Polygon\r\n */\n\nexport function getBackground(north, east, south, west) {\n var multiPolygon = [];\n\n if (west == -180) {\n west = -179.9999;\n }\n\n if (south == -90) {\n south = -89.9999;\n }\n\n if (north == 90) {\n north = 89.9999;\n }\n\n if (east == 180) {\n east = 179.9999;\n }\n\n var stepLong = Math.min(90, (east - west) / Math.ceil((east - west) / 90));\n var stepLat = (north - south) / Math.ceil((north - south) / 90);\n\n for (var ln = west; ln < east; ln = ln + stepLong) {\n var surface = [];\n multiPolygon.push([surface]);\n\n if (ln + stepLong > east) {\n stepLong = east - ln;\n }\n\n for (var ll = ln; ll <= ln + stepLong; ll = ll + 5) {\n surface.push([ll, north]);\n }\n\n for (var lt = north; lt >= south; lt = lt - stepLat) {\n surface.push([ln + stepLong, lt]);\n }\n\n for (var ll = ln + stepLong; ll >= ln; ll = ll - 5) {\n surface.push([ll, south]);\n }\n\n for (var lt = south; lt <= north; lt = lt + stepLat) {\n surface.push([ln, lt]);\n }\n }\n\n return multiPolygon;\n}","/**\r\n * Map polygon module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapObject } from \"./MapObject\";\nimport { Polygon } from \"../../core/elements/Polygon\";\nimport { registry } from \"../../core/Registry\";\nimport * as $type from \"../../core/utils/Type\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport $polylabel from \"polylabel\";\nimport * as $mapUtils from \"./MapUtils\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a polygon on the map.\r\n *\r\n * @see {@link IMapPolygonEvents} for a list of available events\r\n * @see {@link IMapPolygonAdapters} for a list of available Adapters\r\n */\n\nvar MapPolygon =\n/** @class */\nfunction (_super) {\n __extends(MapPolygon, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapPolygon() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapPolygon\";\n _this.polygon = _this.createChild(Polygon);\n _this.polygon.shouldClone = false;\n _this.polygon.applyOnClones = true;\n\n _this.setPropertyValue(\"precision\", 0.5);\n\n var interfaceColors = new InterfaceColorSet();\n _this.fill = interfaceColors.getFor(\"secondaryButton\");\n _this.stroke = interfaceColors.getFor(\"secondaryButtonStroke\");\n _this.strokeOpacity = 1;\n _this.tooltipPosition = \"pointer\";\n _this.nonScalingStroke = true;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapPolygon.prototype.getFeature = function () {\n if (this.multiPolygon && this.multiPolygon.length > 0) {\n return {\n \"type\": \"Feature\",\n geometry: {\n type: \"MultiPolygon\",\n coordinates: this.multiPolygon\n }\n };\n }\n };\n\n Object.defineProperty(MapPolygon.prototype, \"multiGeoPolygon\", {\n /**\r\n * @return Polygon coordinates\r\n */\n get: function get() {\n var multiGeoPolygon = this.getPropertyValue(\"multiGeoPolygon\");\n\n if (!multiGeoPolygon && this.dataItem) {\n multiGeoPolygon = this.dataItem.multiGeoPolygon;\n }\n\n return multiGeoPolygon;\n },\n\n /**\r\n * Set of coordinates for the polygon.\r\n *\r\n * @param multiGeoPolygon Polygon coordinates\r\n */\n set: function set(multiGeoPolygon) {\n this.setPropertyValue(\"multiGeoPolygon\", multiGeoPolygon, true);\n this.multiPolygon = $mapUtils.multiGeoPolygonToMultipolygon(multiGeoPolygon);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygon.prototype, \"multiPolygon\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n var multiPolygon = this.getPropertyValue(\"multiPolygon\");\n\n if (!multiPolygon && this.dataItem) {\n multiPolygon = this.dataItem.multiPolygon;\n }\n\n return multiPolygon;\n },\n\n /**\r\n * A collection of X/Y coordinates for a multi-part polygon. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * // Part 1\r\n * [\r\n * [\r\n * [ 100, 150 ],\r\n * [ 120, 200 ],\r\n * [ 150, 220 ],\r\n * [ 170, 240 ],\r\n * [ 100, 150 ]\r\n * ]\r\n * ],\r\n *\r\n * // Part 2\r\n * [\r\n * [\r\n * [ 300, 350 ],\r\n * [ 320, 400 ],\r\n * [ 350, 420 ],\r\n * [ 370, 440 ],\r\n * [ 300, 350 ]\r\n * ]\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @param multiPolygon Coordinates\r\n */\n set: function set(multiPolygon) {\n if (this.setPropertyValue(\"multiPolygon\", multiPolygon)) {\n this.updateExtremes();\n this.invalidate();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * (Re)validates the polygon, effectively redrawing it.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n MapPolygon.prototype.validate = function () {\n if (this.series) {\n var projection = this.series.chart.projection;\n var pathGenerator = projection.d3Path;\n\n if (this.multiPolygon) {\n if (this.series) {\n var feature = {\n type: \"MultiPolygon\",\n coordinates: this.multiPolygon\n };\n projection.d3Projection.precision(this.precision);\n this.polygon.path = pathGenerator(feature);\n }\n\n if (this.series.calculateVisualCenter) {\n var biggestArea = 0;\n var biggestPolygon = this.multiPolygon[0];\n\n if (this.multiPolygon.length > 1) {\n for (var i = 0; i < this.multiPolygon.length; i++) {\n var polygon = this.multiPolygon[i];\n var area = d3geo.geoArea({\n type: \"Polygon\",\n coordinates: polygon\n });\n\n if (area > biggestArea) {\n biggestPolygon = polygon;\n biggestArea = area;\n }\n }\n }\n\n var center = $polylabel(biggestPolygon);\n this._visualLongitude = center[0];\n this._visualLatitude = center[1];\n } else {\n this._visualLongitude = this.longitude;\n this._visualLatitude = this.latitude;\n }\n }\n }\n\n _super.prototype.validate.call(this);\n };\n /**\r\n * @ignore Exclude from docs\r\n */\n\n\n MapPolygon.prototype.measureElement = function () {// Overriding, just to avoid extra measure\n };\n\n Object.defineProperty(MapPolygon.prototype, \"latitude\", {\n /**\r\n * Latitude of the geometrical center of the polygon.\r\n *\r\n * @readonly\r\n * @return Center latitude\r\n */\n get: function get() {\n return this.north + (this.south - this.north) / 2;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygon.prototype, \"longitude\", {\n /**\r\n * Longitude of the geometrical center of the polygon.\r\n *\r\n * @readonly\r\n * @return Center longitude\r\n */\n get: function get() {\n return this.east + (this.west - this.east) / 2;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygon.prototype, \"visualLatitude\", {\n /**\r\n * @return Latitude\r\n */\n get: function get() {\n var latitude = this.getPropertyValue(\"visualLatitude\");\n\n if ($type.isNumber(latitude)) {\n return latitude;\n }\n\n if (!this._adapterO) {\n return this._visualLatitude;\n } else {\n return this._adapterO.apply(\"visualLatitude\", this._visualLatitude);\n }\n },\n\n /**\r\n * Latitude of the visual center of the polygon.\r\n *\r\n * It may (and probably won't) coincide with geometrical center.\r\n *\r\n * @since 4.3.0\r\n * @param value Latitude\r\n */\n set: function set(value) {\n this.setPropertyValue(\"visualLatitude\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygon.prototype, \"visualLongitude\", {\n /**\r\n * @return Longitude\r\n */\n get: function get() {\n var longitude = this.getPropertyValue(\"visualLongitude\");\n\n if ($type.isNumber(longitude)) {\n return longitude;\n }\n\n if (!this._adapterO) {\n return this._visualLongitude;\n } else {\n return this._adapterO.apply(\"visualLongitude\", this._visualLongitude);\n }\n },\n\n /**\r\n * Longitude of the visual center of the polygon.\r\n *\r\n * It may (and probably won't) coincide with geometrical center.\r\n *\r\n * @since 4.3.0\r\n * @param value Longitude\r\n */\n set: function set(value) {\n this.setPropertyValue(\"visualLongitude\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygon.prototype, \"pixelWidth\", {\n /**\r\n * Not 100% sure about this, as if we add something to MapPolygon this\r\n * won't be true, but otherwise we will get all 0 and the tooltip won't\r\n * be positioned properly\r\n * @hidden\r\n */\n\n /**\r\n * Element's width in pixels.\r\n *\r\n * @readonly\r\n * @return Width (px)\r\n */\n get: function get() {\n return this.polygon.pixelWidth;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygon.prototype, \"pixelHeight\", {\n /**\r\n * Element's height in pixels.\r\n *\r\n * @readonly\r\n * @return Width (px)\r\n */\n get: function get() {\n return this.polygon.pixelHeight;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies all properties from another instance of [[MapPolygon]].\r\n *\r\n * @param source Source series\r\n */\n\n MapPolygon.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.polygon.copyFrom(source.polygon);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapPolygon.prototype.updateExtremes = function () {\n _super.prototype.updateExtremes.call(this);\n };\n\n Object.defineProperty(MapPolygon.prototype, \"boxArea\", {\n /**\r\n * @ignore\r\n * used to sorth polygons from big to small\r\n */\n get: function get() {\n return (this.north - this.south) * (this.east - this.west);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * X coordinate for the slice tooltip.\r\n *\r\n * @ignore\r\n * @return X\r\n */\n\n MapPolygon.prototype.getTooltipX = function () {\n return this.series.chart.projection.convert({\n longitude: this.visualLongitude,\n latitude: this.visualLatitude\n }).x;\n };\n /**\r\n * Y coordinate for the slice tooltip.\r\n *\r\n * @ignore\r\n * @return Y\r\n */\n\n\n MapPolygon.prototype.getTooltipY = function () {\n return this.series.chart.projection.convert({\n longitude: this.visualLongitude,\n latitude: this.visualLatitude\n }).y;\n };\n\n Object.defineProperty(MapPolygon.prototype, \"precision\", {\n get: function get() {\n return this.getPropertyValue(\"precision\");\n },\n\n /**\r\n * When polygon's sides are plotted, they are bent according to the used\r\n * projection.\r\n *\r\n * `precision` introduces a setting which can control when such bending\r\n * occurs.\r\n *\r\n * If the distance (in degrees) between two points of polygon's side is less\r\n * than `precision`, no bending will take place and the line will be straight.\r\n *\r\n * Set to large number (e.g. 10000) for perfectly straight lines on all\r\n * polygon's sides.\r\n *\r\n * @since 4.9.1\r\n * @default 0.5\r\n * @param value Precision\r\n */\n set: function set(value) {\n this.setPropertyValue(\"precision\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return MapPolygon;\n}(MapObject);\n\nexport { MapPolygon };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapPolygon\"] = MapPolygon;","/**\r\n * Map polygon series module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapSeries, MapSeriesDataItem } from \"./MapSeries\";\nimport { MapPolygon } from \"./MapPolygon\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { registry } from \"../../core/Registry\";\nimport * as $mapUtils from \"./MapUtils\";\nimport * as $array from \"../../core/utils/Array\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport { Disposer } from \"../../core/utils/Disposer\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapPolygonSeries]]\r\n * @see {@link DataItem}\r\n */\n\nvar MapPolygonSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapPolygonSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapPolygonSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapPolygonSeriesDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapPolygonSeriesDataItem.prototype.getFeature = function () {\n if (this.multiPolygon && this.multiPolygon.length > 0) {\n return {\n \"type\": \"Feature\",\n geometry: {\n type: \"MultiPolygon\",\n coordinates: this.multiPolygon\n }\n };\n }\n };\n\n Object.defineProperty(MapPolygonSeriesDataItem.prototype, \"mapPolygon\", {\n /**\r\n * A [[MapPolygon]] element related to this data item.\r\n *\r\n * @readonly\r\n * @return Element\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._mapPolygon) {\n var mapPolygon_1 = this.component.mapPolygons.create();\n this._mapPolygon = mapPolygon_1;\n this.addSprite(mapPolygon_1);\n\n this._disposers.push(new Disposer(function () {\n if (_this.component) {\n _this.component.mapPolygons.removeValue(mapPolygon_1);\n }\n }));\n\n this.mapObject = mapPolygon_1;\n }\n\n return this._mapPolygon;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygonSeriesDataItem.prototype, \"polygon\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._polygon;\n },\n\n /**\r\n * A collection of X/Y coordinates for a single polygon. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * [\r\n * [ 100, 150 ],\r\n * [ 120, 200 ],\r\n * [ 150, 200 ],\r\n * [ 170, 240 ],\r\n * [ 100, 150 ]\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @param polygon Coordinates\r\n */\n set: function set(polygon) {\n this._polygon = polygon;\n this.multiPolygon = [polygon];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygonSeriesDataItem.prototype, \"multiPolygon\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._multiPolygon;\n },\n\n /**\r\n * A collection of X/Y coordinates for a multi-part polygon. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * // Part 1\r\n * [\r\n * [\r\n * [ 100, 150 ],\r\n * [ 120, 200 ],\r\n * [ 150, 220 ],\r\n * [ 170, 240 ],\r\n * [ 100, 150 ]\r\n * ]\r\n * ],\r\n *\r\n * // Part 2\r\n * [\r\n * [\r\n * [ 300, 350 ],\r\n * [ 320, 400 ],\r\n * [ 350, 420 ],\r\n * [ 370, 440 ],\r\n * [ 300, 350 ]\r\n * ]\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @param multiPolygon Coordinates\r\n */\n set: function set(multiPolygon) {\n this._multiPolygon = multiPolygon;\n this.updateExtremes();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygonSeriesDataItem.prototype, \"geoPolygon\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._geoPolygon;\n },\n\n /**\r\n * A collection of lat/long coordinates for a single polygon. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * [\r\n * { latitude: -10.0, longitude: -10.0 },\r\n * { latitude: 10.0, longitude: -10.0 },\r\n * { latitude: 10.0, longitude: 10.0 },\r\n * { latitude: -10.0, longitude: -10.0 }\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @see {@link https://tools.ietf.org/html/rfc7946#section-3.1.6} GeoJSON Polygon reference\r\n * @param geoPolygon Coordinates\r\n */\n set: function set(geoPolygon) {\n this._geoPolygon = geoPolygon;\n this.multiGeoPolygon = [geoPolygon];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygonSeriesDataItem.prototype, \"multiGeoPolygon\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._multiGeoPolygon;\n },\n\n /**\r\n * A collection of lat/long coordinates for a multi-part polygon. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * [\r\n * [\r\n * { longitude: 180.0, latitude: 40.0 },\r\n * { longitude: 180.0, latitude: 50.0 },\r\n * { longitude: 170.0, latitude: 50.0 },\r\n * { longitude: 170.0, latitude: 40.0 },\r\n * { longitude: 180.0, latitude: 40.0 }\r\n * ]\r\n * ],\r\n * [\r\n * [\r\n * { longitude: -170.0, latitude: 40.0 },\r\n * { longitude: -170.0, latitude: 50.0 },\r\n * { longitude: -180.0, latitude: 50.0 },\r\n * { longitude: -180.0, latitude: 40.0 },\r\n * { longitude: -170.0, latitude: 40.0 }\r\n * ]\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @see {@link https://tools.ietf.org/html/rfc7946#section-3.1.7} GeoJSON MultiPolygon reference\r\n * @param multiGeoPolygon Coordinates\r\n */\n set: function set(multiGeoPolygon) {\n this._multiGeoPolygon = multiGeoPolygon;\n this.multiPolygon = $mapUtils.multiGeoPolygonToMultipolygon(multiGeoPolygon);\n },\n enumerable: true,\n configurable: true\n });\n return MapPolygonSeriesDataItem;\n}(MapSeriesDataItem);\n\nexport { MapPolygonSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A series of map polygon elements.\r\n *\r\n * @see {@link IMapPolygonSeriesEvents} for a list of available Events\r\n * @see {@link IMapPolygonSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar MapPolygonSeries =\n/** @class */\nfunction (_super) {\n __extends(MapPolygonSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapPolygonSeries() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * Indicates if series should automatically calculate visual center of the\r\n * polygons (accessible via `visualLongitude` and `visualLatitude` properties\r\n * of the [[MapPolygon]]).\r\n *\r\n * @default false\r\n * @since 4.3.0\r\n */\n\n\n _this.calculateVisualCenter = false;\n _this.className = \"MapPolygonSeries\"; // Set data fields\n\n _this.dataFields.multiPolygon = \"multiPolygon\";\n _this.dataFields.polygon = \"polygon\";\n _this.dataFields.geoPolygon = \"geoPolygon\";\n _this.dataFields.multiGeoPolygon = \"multiGeoPolygon\";\n\n _this.setPropertyValue(\"sortPolygonsBy\", \"area\");\n\n _this.setPropertyValue(\"sortPolygonsReversed\", false); // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n MapPolygonSeries.prototype.createDataItem = function () {\n return new MapPolygonSeriesDataItem();\n };\n /**\r\n * @ignore\r\n */\n\n\n MapPolygonSeries.prototype.processIncExc = function () {\n this.mapPolygons.clear();\n\n _super.prototype.processIncExc.call(this);\n };\n /**\r\n * (Re)validates series data, effectively causing the whole series to be\r\n * redrawn.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapPolygonSeries.prototype.validateData = function () {\n // process geoJSON and created map objects\n if (this.useGeodata || this.geodata) {\n var geoJSON = !this._dataSources[\"geodata\"] ? this.chart.geodata : undefined;\n\n if (this.geodata) {\n geoJSON = this.geodata;\n }\n\n if (geoJSON) {\n var features = void 0;\n\n if (geoJSON.type == \"FeatureCollection\") {\n features = geoJSON.features;\n } else if (geoJSON.type == \"Feature\") {\n features = [geoJSON];\n } else if ([\"Point\", \"LineString\", \"Polygon\", \"MultiPoint\", \"MultiLineString\", \"MultiPolygon\"].indexOf(geoJSON.type) != -1) {\n features = [{\n geometry: geoJSON\n }];\n } else {\n console.log(\"nothing found in geoJSON\");\n }\n\n if (features) {\n var _loop_1 = function _loop_1(i, len) {\n var feature = features[i];\n var geometry = feature.geometry;\n\n if (geometry) {\n var type = geometry.type;\n var id_1 = feature.id;\n\n if (this_1.chart.geodataNames && this_1.chart.geodataNames[id_1]) {\n feature.properties.name = this_1.chart.geodataNames[id_1];\n }\n\n if (type == \"Polygon\" || type == \"MultiPolygon\") {\n if (!this_1.checkInclude(this_1.include, this_1.exclude, id_1)) {\n return \"continue\";\n }\n\n var coordinates = geometry.coordinates;\n\n if (coordinates) {\n // make the same as MultiPolygon\n if (type == \"Polygon\") {\n coordinates = [coordinates];\n }\n } // find data object in user-provided data\n\n\n var dataObject = $array.find(this_1.data, function (value, i) {\n return value.id == id_1;\n }); // create one if not found\n\n if (!dataObject) {\n dataObject = {\n multiPolygon: coordinates,\n id: id_1,\n madeFromGeoData: true\n };\n this_1.data.push(dataObject);\n } // in case found\n else {\n // if user-provided object doesn't have points data provided in any way:\n if (!dataObject.multiPolygon) {\n dataObject.multiPolygon = coordinates;\n }\n } // copy properties data to datacontext\n\n\n $utils.softCopyProperties(feature.properties, dataObject);\n }\n }\n };\n\n var this_1 = this;\n\n for (var i = 0, len = features.length; i < len; i++) {\n _loop_1(i, len);\n }\n }\n }\n }\n\n _super.prototype.validateData.call(this);\n };\n /**\r\n * (Re)validates the series\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapPolygonSeries.prototype.validate = function () {\n _super.prototype.validate.call(this);\n\n this.dataItems.each(function (dataItem) {\n $utils.used(dataItem.mapPolygon);\n });\n\n if (this.sortPolygonsBy != \"none\") {\n var sortBy_1 = this.sortPolygonsBy;\n var reversed_1 = this.sortPolygonsReversed;\n this.mapPolygons.sort(function (a, b) {\n var valA = \"\";\n var valB = \"\";\n var dirA = -1;\n var dirB = 1;\n\n switch (sortBy_1) {\n case \"area\":\n valA = a.boxArea;\n valB = b.boxArea;\n dirA = -1;\n dirB = 1;\n break;\n\n case \"name\":\n valA = a.dataItem.dataContext.name || \"\";\n valB = b.dataItem.dataContext.name || \"\";\n dirA = 1;\n dirB = -1;\n break;\n\n case \"id\":\n valA = a.dataItem.dataContext.id || \"\";\n valB = b.dataItem.dataContext.id || \"\";\n dirA = 1;\n dirB = -1;\n break;\n\n case \"latitude\":\n valA = reversed_1 ? a.south : a.north;\n valB = reversed_1 ? b.south : b.north;\n dirA = -1;\n dirB = 1;\n break;\n\n case \"longitude\":\n valA = reversed_1 ? a.east : a.west;\n valB = reversed_1 ? b.east : b.west;\n dirA = 1;\n dirB = -1;\n break;\n }\n\n if (valA < valB) {\n return reversed_1 ? dirB : dirA;\n }\n\n if (valA > valB) {\n return reversed_1 ? dirA : dirB;\n }\n\n return 0;\n });\n this.mapPolygons.each(function (mapPolygon, index) {\n mapPolygon.validate(); // makes small go first to avoid hover problems with IE\n\n if (!mapPolygon.zIndex && !mapPolygon.propertyFields.zIndex) {\n mapPolygon.zIndex = 1000000 - index;\n }\n });\n }\n };\n\n Object.defineProperty(MapPolygonSeries.prototype, \"mapPolygons\", {\n /**\r\n * List of polygon elements in the series.\r\n *\r\n * @return Polygon list\r\n */\n get: function get() {\n if (!this._mapPolygons) {\n var polygonTemplate = new MapPolygon();\n var mapPolygons = new ListTemplate(polygonTemplate);\n\n this._disposers.push(new ListDisposer(mapPolygons));\n\n this._disposers.push(mapPolygons.template);\n\n mapPolygons.template.focusable = true;\n mapPolygons.events.on(\"inserted\", this.handleObjectAdded, this, false);\n this._mapPolygons = mapPolygons;\n this._mapObjects = mapPolygons;\n }\n\n return this._mapPolygons;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * returns MapPolygon by id in geoJSON file\r\n * @param polygon id\r\n * @return {MapPolygon}\r\n */\n\n MapPolygonSeries.prototype.getPolygonById = function (id) {\n return $iter.find(this.mapPolygons.iterator(), function (mapPolygon) {\n var dataContext = mapPolygon.dataItem.dataContext;\n return dataContext.id == id;\n });\n };\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\n\n\n MapPolygonSeries.prototype.copyFrom = function (source) {\n this.mapPolygons.template.copyFrom(source.mapPolygons.template);\n\n _super.prototype.copyFrom.call(this, source);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapPolygonSeries.prototype.getFeatures = function () {\n var _this = this;\n\n var features = [];\n this.dataItems.each(function (dataItem) {\n var feature = dataItem.getFeature();\n\n if (feature) {\n features.push(feature);\n }\n });\n this.mapPolygons.each(function (mapPolygon) {\n if (_this.dataItems.indexOf(mapPolygon._dataItem) == -1) {\n var feature = mapPolygon.getFeature();\n\n if (feature) {\n features.push(feature);\n }\n }\n });\n return features;\n };\n\n Object.defineProperty(MapPolygonSeries.prototype, \"sortPolygonsBy\", {\n /**\r\n * @return How to sort map polygons\r\n */\n get: function get() {\n return this.getPropertyValue(\"sortPolygonsBy\");\n },\n\n /**\r\n * How to order polygons in actual SVG document. Affects selection order\r\n * using TAB key.\r\n *\r\n * Available options: `\"area\"` (default), `\"name\"`, `\"longitude\"`,\r\n * `\"latitude\"`, `\"id\"`, and `\"none\"`.\r\n *\r\n * @default area\r\n * @since 4.9.36\r\n * @param value How to sort map polygons\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"sortPolygonsBy\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapPolygonSeries.prototype, \"sortPolygonsReversed\", {\n /**\r\n * @return Reverse polygon sort direction\r\n */\n get: function get() {\n return this.getPropertyValue(\"sortPolygonsReversed\");\n },\n\n /**\r\n * If `sortPolygonsBy` is set to something other than `\"none\"`, polygons\r\n * will be sorted by the given parameter, using natural sort direction.\r\n *\r\n * Setting `sortPolygonsReversed = true` will reverse this direction.\r\n *\r\n * @default false\r\n * @since 4.9.36\r\n * @param value Reverse polygon sort direction\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"sortPolygonsReversed\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n return MapPolygonSeries;\n}(MapSeries);\n\nexport { MapPolygonSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapPolygonSeries\"] = MapPolygonSeries;\nregistry.registeredClasses[\"MapPolygonSeriesDataItem\"] = MapPolygonSeriesDataItem;","import noop from \"../noop.js\";\nexport default function () {\n var lines = [],\n line;\n return {\n point: function point(x, y, m) {\n line.push([x, y, m]);\n },\n lineStart: function lineStart() {\n lines.push(line = []);\n },\n lineEnd: noop,\n rejoin: function rejoin() {\n if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n },\n result: function result() {\n var result = lines;\n lines = [];\n line = null;\n return result;\n }\n };\n}","import { abs, epsilon } from \"./math.js\";\nexport default function (a, b) {\n return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n}","import pointEqual from \"../pointEqual.js\";\nimport { epsilon } from \"../math.js\";\n\nfunction Intersection(point, points, other, entry) {\n this.x = point;\n this.z = points;\n this.o = other; // another intersection\n\n this.e = entry; // is an entry?\n\n this.v = false; // visited\n\n this.n = this.p = null; // next & previous\n} // A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\n\n\nexport default function (segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n,\n p0 = segment[0],\n p1 = segment[n],\n x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n\n for (i = 0; i < n; ++i) {\n stream.point((p0 = segment[i])[0], p0[1]);\n }\n\n stream.lineEnd();\n return;\n } // handle degenerate cases by moving the point\n\n\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n\n while (current.v) {\n if ((current = current.n) === start) return;\n }\n\n points = current.z;\n stream.lineStart();\n\n do {\n current.v = current.o.v = true;\n\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) {\n stream.point((point = points[i])[0], point[1]);\n }\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n\n for (i = points.length - 1; i >= 0; --i) {\n stream.point((point = points[i])[0], point[1]);\n }\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n\n current = current.p;\n }\n\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n\n stream.lineEnd();\n }\n}\n\nfunction link(array) {\n if (!(n = array.length)) return;\n var n,\n i = 0,\n a = array[0],\n b;\n\n while (++i < n) {\n a.n = b = array[i];\n b.p = a;\n a = b;\n }\n\n a.n = b = array[0];\n b.p = a;\n}","import { Adder } from \"d3-array\";\nimport { cartesian, cartesianCross, cartesianNormalizeInPlace } from \"./cartesian.js\";\nimport { abs, asin, atan2, cos, epsilon, epsilon2, halfPi, pi, quarterPi, sign, sin, tau } from \"./math.js\";\n\nfunction longitude(point) {\n if (abs(point[0]) <= pi) return point[0];else return sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);\n}\n\nexport default function (polygon, point) {\n var lambda = longitude(point),\n phi = point[1],\n sinPhi = sin(phi),\n normal = [sin(lambda), -cos(lambda), 0],\n angle = 0,\n winding = 0;\n var sum = new Adder();\n if (sinPhi === 1) phi = halfPi + epsilon;else if (sinPhi === -1) phi = -halfPi - epsilon;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n if (!(m = (ring = polygon[i]).length)) continue;\n var ring,\n m,\n point0 = ring[m - 1],\n lambda0 = longitude(point0),\n phi0 = point0[1] / 2 + quarterPi,\n sinPhi0 = sin(phi0),\n cosPhi0 = cos(phi0);\n\n for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {\n var point1 = ring[j],\n lambda1 = longitude(point1),\n phi1 = point1[1] / 2 + quarterPi,\n sinPhi1 = sin(phi1),\n cosPhi1 = cos(phi1),\n delta = lambda1 - lambda0,\n sign = delta >= 0 ? 1 : -1,\n absDelta = sign * delta,\n antimeridian = absDelta > pi,\n k = sinPhi0 * sinPhi1;\n sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta)));\n angle += antimeridian ? delta + sign * tau : delta; // Are the longitudes either side of the point’s meridian (lambda),\n // and are the latitudes smaller than the parallel (phi)?\n\n if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {\n var arc = cartesianCross(cartesian(point0), cartesian(point1));\n cartesianNormalizeInPlace(arc);\n var intersection = cartesianCross(normal, arc);\n cartesianNormalizeInPlace(intersection);\n var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);\n\n if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {\n winding += antimeridian ^ delta >= 0 ? 1 : -1;\n }\n }\n }\n } // First, determine whether the South pole is inside or outside:\n //\n // It is inside if:\n // * the polygon winds around it in a clockwise direction.\n // * the polygon does not (cumulatively) wind around it, but has a negative\n // (counter-clockwise) area.\n //\n // Second, count the (signed) number of times a segment crosses a lambda\n // from the point to the South pole. If it is zero, then the point is the\n // same side as the South pole.\n\n\n return (angle < -epsilon || angle < epsilon && sum < -epsilon2) ^ winding & 1;\n}","import _regeneratorRuntime from \"@babel/runtime/regenerator\";\n\nvar _marked = /*#__PURE__*/_regeneratorRuntime.mark(flatten);\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction flatten(arrays) {\n var _iterator, _step, array;\n\n return _regeneratorRuntime.wrap(function flatten$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _iterator = _createForOfIteratorHelper(arrays);\n _context.prev = 1;\n\n _iterator.s();\n\n case 3:\n if ((_step = _iterator.n()).done) {\n _context.next = 8;\n break;\n }\n\n array = _step.value;\n return _context.delegateYield(array, \"t0\", 6);\n\n case 6:\n _context.next = 3;\n break;\n\n case 8:\n _context.next = 13;\n break;\n\n case 10:\n _context.prev = 10;\n _context.t1 = _context[\"catch\"](1);\n\n _iterator.e(_context.t1);\n\n case 13:\n _context.prev = 13;\n\n _iterator.f();\n\n return _context.finish(13);\n\n case 16:\n case \"end\":\n return _context.stop();\n }\n }\n }, _marked, null, [[1, 10, 13, 16]]);\n}\n\nexport default function merge(arrays) {\n return Array.from(flatten(arrays));\n}","import clipBuffer from \"./buffer.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport { epsilon, halfPi } from \"../math.js\";\nimport polygonContains from \"../polygonContains.js\";\nimport { merge } from \"d3-array\";\nexport default function (pointVisible, clipLine, interpolate, start) {\n return function (sink) {\n var line = clipLine(sink),\n ringBuffer = clipBuffer(),\n ringSink = clipLine(ringBuffer),\n polygonStarted = false,\n polygon,\n segments,\n ring;\n var clip = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function polygonStart() {\n clip.point = pointRing;\n clip.lineStart = ringStart;\n clip.lineEnd = ringEnd;\n segments = [];\n polygon = [];\n },\n polygonEnd: function polygonEnd() {\n clip.point = point;\n clip.lineStart = lineStart;\n clip.lineEnd = lineEnd;\n segments = merge(segments);\n var startInside = polygonContains(polygon, start);\n\n if (segments.length) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n clipRejoin(segments, compareIntersection, startInside, interpolate, sink);\n } else if (startInside) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n }\n\n if (polygonStarted) sink.polygonEnd(), polygonStarted = false;\n segments = polygon = null;\n },\n sphere: function sphere() {\n sink.polygonStart();\n sink.lineStart();\n interpolate(null, null, 1, sink);\n sink.lineEnd();\n sink.polygonEnd();\n }\n };\n\n function point(lambda, phi) {\n if (pointVisible(lambda, phi)) sink.point(lambda, phi);\n }\n\n function pointLine(lambda, phi) {\n line.point(lambda, phi);\n }\n\n function lineStart() {\n clip.point = pointLine;\n line.lineStart();\n }\n\n function lineEnd() {\n clip.point = point;\n line.lineEnd();\n }\n\n function pointRing(lambda, phi) {\n ring.push([lambda, phi]);\n ringSink.point(lambda, phi);\n }\n\n function ringStart() {\n ringSink.lineStart();\n ring = [];\n }\n\n function ringEnd() {\n pointRing(ring[0][0], ring[0][1]);\n ringSink.lineEnd();\n var clean = ringSink.clean(),\n ringSegments = ringBuffer.result(),\n i,\n n = ringSegments.length,\n m,\n segment,\n point;\n ring.pop();\n polygon.push(ring);\n ring = null;\n if (!n) return; // No intersections.\n\n if (clean & 1) {\n segment = ringSegments[0];\n\n if ((m = segment.length - 1) > 0) {\n if (!polygonStarted) sink.polygonStart(), polygonStarted = true;\n sink.lineStart();\n\n for (i = 0; i < m; ++i) {\n sink.point((point = segment[i])[0], point[1]);\n }\n\n sink.lineEnd();\n }\n\n return;\n } // Rejoin connected segments.\n // TODO reuse ringBuffer.rejoin()?\n\n\n if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));\n segments.push(ringSegments.filter(validSegment));\n }\n\n return clip;\n };\n}\n\nfunction validSegment(segment) {\n return segment.length > 1;\n} // Intersections are sorted along the clip edge. For both antimeridian cutting\n// and circle clipping, the same comparison is used.\n\n\nfunction compareIntersection(a, b) {\n return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]);\n}","import clip from \"./index.js\";\nimport { abs, atan, cos, epsilon, halfPi, pi, sin } from \"../math.js\";\nexport default clip(function () {\n return true;\n}, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi, -halfPi]); // Takes a line and cuts into visible segments. Return values: 0 - there were\n// intersections or the line was empty; 1 - no intersections; 2 - there were\n// intersections, and the first and last segments should be rejoined.\n\nfunction clipAntimeridianLine(stream) {\n var lambda0 = NaN,\n phi0 = NaN,\n sign0 = NaN,\n _clean; // no intersections\n\n\n return {\n lineStart: function lineStart() {\n stream.lineStart();\n _clean = 1;\n },\n point: function point(lambda1, phi1) {\n var sign1 = lambda1 > 0 ? pi : -pi,\n delta = abs(lambda1 - lambda0);\n\n if (abs(delta - pi) < epsilon) {\n // line crosses a pole\n stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n stream.point(lambda1, phi0);\n _clean = 0;\n } else if (sign0 !== sign1 && delta >= pi) {\n // line crosses antimeridian\n if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies\n\n if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon;\n phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);\n stream.point(sign0, phi0);\n stream.lineEnd();\n stream.lineStart();\n stream.point(sign1, phi0);\n _clean = 0;\n }\n\n stream.point(lambda0 = lambda1, phi0 = phi1);\n sign0 = sign1;\n },\n lineEnd: function lineEnd() {\n stream.lineEnd();\n lambda0 = phi0 = NaN;\n },\n clean: function clean() {\n return 2 - _clean; // if intersections, rejoin first and last segments\n }\n };\n}\n\nfunction clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {\n var cosPhi0,\n cosPhi1,\n sinLambda0Lambda1 = sin(lambda0 - lambda1);\n return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;\n}\n\nfunction clipAntimeridianInterpolate(from, to, direction, stream) {\n var phi;\n\n if (from == null) {\n phi = direction * halfPi;\n stream.point(-pi, phi);\n stream.point(0, phi);\n stream.point(pi, phi);\n stream.point(pi, 0);\n stream.point(pi, -phi);\n stream.point(0, -phi);\n stream.point(-pi, -phi);\n stream.point(-pi, 0);\n stream.point(-pi, phi);\n } else if (abs(from[0] - to[0]) > epsilon) {\n var lambda = from[0] < to[0] ? pi : -pi;\n phi = direction * lambda / 2;\n stream.point(-lambda, phi);\n stream.point(0, phi);\n stream.point(lambda, phi);\n } else {\n stream.point(to[0], to[1]);\n }\n}","import { cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical } from \"../cartesian.js\";\nimport { circleStream } from \"../circle.js\";\nimport { abs, cos, epsilon, pi, radians, sqrt } from \"../math.js\";\nimport pointEqual from \"../pointEqual.js\";\nimport clip from \"./index.js\";\nexport default function (radius) {\n var cr = cos(radius),\n delta = 6 * radians,\n smallRadius = cr > 0,\n notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case\n\n function interpolate(from, to, direction, stream) {\n circleStream(stream, radius, delta, direction, from, to);\n }\n\n function visible(lambda, phi) {\n return cos(lambda) * cos(phi) > cr;\n } // Takes a line and cuts into visible segments. Return values used for polygon\n // clipping: 0 - there were intersections or the line was empty; 1 - no\n // intersections 2 - there were intersections, and the first and last segments\n // should be rejoined.\n\n\n function clipLine(stream) {\n var point0, // previous point\n c0, // code for previous point\n v0, // visibility of previous point\n v00, // visibility of first point\n _clean; // no intersections\n\n\n return {\n lineStart: function lineStart() {\n v00 = v0 = false;\n _clean = 1;\n },\n point: function point(lambda, phi) {\n var point1 = [lambda, phi],\n point2,\n v = visible(lambda, phi),\n c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;\n if (!point0 && (v00 = v0 = v)) stream.lineStart();\n\n if (v !== v0) {\n point2 = intersect(point0, point1);\n if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) point1[2] = 1;\n }\n\n if (v !== v0) {\n _clean = 0;\n\n if (v) {\n // outside going in\n stream.lineStart();\n point2 = intersect(point1, point0);\n stream.point(point2[0], point2[1]);\n } else {\n // inside going out\n point2 = intersect(point0, point1);\n stream.point(point2[0], point2[1], 2);\n stream.lineEnd();\n }\n\n point0 = point2;\n } else if (notHemisphere && point0 && smallRadius ^ v) {\n var t; // If the codes for two points are different, or are both zero,\n // and there this segment intersects with the small circle.\n\n if (!(c & c0) && (t = intersect(point1, point0, true))) {\n _clean = 0;\n\n if (smallRadius) {\n stream.lineStart();\n stream.point(t[0][0], t[0][1]);\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n } else {\n stream.point(t[1][0], t[1][1]);\n stream.lineEnd();\n stream.lineStart();\n stream.point(t[0][0], t[0][1], 3);\n }\n }\n }\n\n if (v && (!point0 || !pointEqual(point0, point1))) {\n stream.point(point1[0], point1[1]);\n }\n\n point0 = point1, v0 = v, c0 = c;\n },\n lineEnd: function lineEnd() {\n if (v0) stream.lineEnd();\n point0 = null;\n },\n // Rejoin first and last segments if there were intersections and the first\n // and last points were visible.\n clean: function clean() {\n return _clean | (v00 && v0) << 1;\n }\n };\n } // Intersects the great circle between a and b with the clip circle.\n\n\n function intersect(a, b, two) {\n var pa = cartesian(a),\n pb = cartesian(b); // We have two planes, n1.p = d1 and n2.p = d2.\n // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).\n\n var n1 = [1, 0, 0],\n // normal\n n2 = cartesianCross(pa, pb),\n n2n2 = cartesianDot(n2, n2),\n n1n2 = n2[0],\n // cartesianDot(n1, n2),\n determinant = n2n2 - n1n2 * n1n2; // Two polar points.\n\n if (!determinant) return !two && a;\n var c1 = cr * n2n2 / determinant,\n c2 = -cr * n1n2 / determinant,\n n1xn2 = cartesianCross(n1, n2),\n A = cartesianScale(n1, c1),\n B = cartesianScale(n2, c2);\n cartesianAddInPlace(A, B); // Solve |p(t)|^2 = 1.\n\n var u = n1xn2,\n w = cartesianDot(A, u),\n uu = cartesianDot(u, u),\n t2 = w * w - uu * (cartesianDot(A, A) - 1);\n if (t2 < 0) return;\n var t = sqrt(t2),\n q = cartesianScale(u, (-w - t) / uu);\n cartesianAddInPlace(q, A);\n q = spherical(q);\n if (!two) return q; // Two intersection points.\n\n var lambda0 = a[0],\n lambda1 = b[0],\n phi0 = a[1],\n phi1 = b[1],\n z;\n if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;\n var delta = lambda1 - lambda0,\n polar = abs(delta - pi) < epsilon,\n meridian = polar || delta < epsilon;\n if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; // Check that the first point is between a and b.\n\n if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) {\n var q1 = cartesianScale(u, (-w + t) / uu);\n cartesianAddInPlace(q1, A);\n return [q, spherical(q1)];\n }\n } // Generates a 4-bit vector representing the location of a point relative to\n // the small circle's bounding box.\n\n\n function code(lambda, phi) {\n var r = smallRadius ? radius : pi - radius,\n code = 0;\n if (lambda < -r) code |= 1; // left\n else if (lambda > r) code |= 2; // right\n\n if (phi < -r) code |= 4; // below\n else if (phi > r) code |= 8; // above\n\n return code;\n }\n\n return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);\n}","import { abs, epsilon } from \"../math.js\";\nimport clipBuffer from \"./buffer.js\";\nimport clipLine from \"./line.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport { merge } from \"d3-array\";\nvar clipMax = 1e9,\n clipMin = -clipMax; // TODO Use d3-polygon’s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nexport default function clipRectangle(x0, y0, x1, y1) {\n function visible(x, y) {\n return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n }\n\n function interpolate(from, to, direction, stream) {\n var a = 0,\n a1 = 0;\n\n if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {\n do {\n stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n } while ((a = (a + direction + 4) % 4) !== a1);\n } else {\n stream.point(to[0], to[1]);\n }\n }\n\n function corner(p, direction) {\n return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n }\n\n function compareIntersection(a, b) {\n return comparePoint(a.x, b.x);\n }\n\n function comparePoint(a, b) {\n var ca = corner(a, 1),\n cb = corner(b, 1);\n return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];\n }\n\n return function (stream) {\n var activeStream = stream,\n bufferStream = clipBuffer(),\n segments,\n polygon,\n ring,\n x__,\n y__,\n v__,\n // first point\n x_,\n y_,\n v_,\n // previous point\n first,\n clean;\n var clipStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: polygonStart,\n polygonEnd: polygonEnd\n };\n\n function point(x, y) {\n if (visible(x, y)) activeStream.point(x, y);\n }\n\n function polygonInside() {\n var winding = 0;\n\n for (var i = 0, n = polygon.length; i < n; ++i) {\n for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n\n if (a1 <= y1) {\n if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding;\n } else {\n if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding;\n }\n }\n }\n\n return winding;\n } // Buffer geometry within a polygon and then clip it en masse.\n\n\n function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }\n\n function polygonEnd() {\n var startInside = polygonInside(),\n cleanInside = clean && startInside,\n visible = (segments = merge(segments)).length;\n\n if (cleanInside || visible) {\n stream.polygonStart();\n\n if (cleanInside) {\n stream.lineStart();\n interpolate(null, null, 1, stream);\n stream.lineEnd();\n }\n\n if (visible) {\n clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n }\n\n stream.polygonEnd();\n }\n\n activeStream = stream, segments = polygon = ring = null;\n }\n\n function lineStart() {\n clipStream.point = linePoint;\n if (polygon) polygon.push(ring = []);\n first = true;\n v_ = false;\n x_ = y_ = NaN;\n } // TODO rather than special-case polygons, simply handle them separately.\n // Ideally, coincident intersection points should be jittered to avoid\n // clipping issues.\n\n\n function lineEnd() {\n if (segments) {\n linePoint(x__, y__);\n if (v__ && v_) bufferStream.rejoin();\n segments.push(bufferStream.result());\n }\n\n clipStream.point = point;\n if (v_) activeStream.lineEnd();\n }\n\n function linePoint(x, y) {\n var v = visible(x, y);\n if (polygon) ring.push([x, y]);\n\n if (first) {\n x__ = x, y__ = y, v__ = v;\n first = false;\n\n if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n }\n } else {\n if (v && v_) activeStream.point(x, y);else {\n var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n\n if (clipLine(a, b, x0, y0, x1, y1)) {\n if (!v_) {\n activeStream.lineStart();\n activeStream.point(a[0], a[1]);\n }\n\n activeStream.point(b[0], b[1]);\n if (!v) activeStream.lineEnd();\n clean = false;\n } else if (v) {\n activeStream.lineStart();\n activeStream.point(x, y);\n clean = false;\n }\n }\n }\n\n x_ = x, y_ = y, v_ = v;\n }\n\n return clipStream;\n };\n}","export default function (a, b, x0, y0, x1, y1) {\n var ax = a[0],\n ay = a[1],\n bx = b[0],\n by = b[1],\n t0 = 0,\n t1 = 1,\n dx = bx - ax,\n dy = by - ay,\n r;\n r = x0 - ax;\n if (!dx && r > 0) return;\n r /= dx;\n\n if (dx < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dx > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = x1 - ax;\n if (!dx && r < 0) return;\n r /= dx;\n\n if (dx < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dx > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n r = y0 - ay;\n if (!dy && r > 0) return;\n r /= dy;\n\n if (dy < 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n } else if (dy > 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n }\n\n r = y1 - ay;\n if (!dy && r < 0) return;\n r /= dy;\n\n if (dy < 0) {\n if (r > t1) return;\n if (r > t0) t0 = r;\n } else if (dy > 0) {\n if (r < t0) return;\n if (r < t1) t1 = r;\n }\n\n if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n return true;\n}","export default (function (x) {\n return x;\n});","export default function (methods) {\n return {\n stream: transformer(methods)\n };\n}\nexport function transformer(methods) {\n return function (stream) {\n var s = new TransformStream();\n\n for (var key in methods) {\n s[key] = methods[key];\n }\n\n s.stream = stream;\n return s;\n };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n constructor: TransformStream,\n point: function point(x, y) {\n this.stream.point(x, y);\n },\n sphere: function sphere() {\n this.stream.sphere();\n },\n lineStart: function lineStart() {\n this.stream.lineStart();\n },\n lineEnd: function lineEnd() {\n this.stream.lineEnd();\n },\n polygonStart: function polygonStart() {\n this.stream.polygonStart();\n },\n polygonEnd: function polygonEnd() {\n this.stream.polygonEnd();\n }\n};","import noop from \"../noop.js\";\nvar x0 = Infinity,\n y0 = x0,\n x1 = -x0,\n y1 = x1;\nvar boundsStream = {\n point: boundsPoint,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop,\n result: function result() {\n var bounds = [[x0, y0], [x1, y1]];\n x1 = y1 = -(y0 = x0 = Infinity);\n return bounds;\n }\n};\n\nfunction boundsPoint(x, y) {\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n}\n\nexport default boundsStream;","import { default as geoStream } from \"../stream.js\";\nimport boundsStream from \"../path/bounds.js\";\n\nfunction fit(projection, fitBounds, object) {\n var clip = projection.clipExtent && projection.clipExtent();\n projection.scale(150).translate([0, 0]);\n if (clip != null) projection.clipExtent(null);\n geoStream(object, projection.stream(boundsStream));\n fitBounds(boundsStream.result());\n if (clip != null) projection.clipExtent(clip);\n return projection;\n}\n\nexport function fitExtent(projection, extent, object) {\n return fit(projection, function (b) {\n var w = extent[1][0] - extent[0][0],\n h = extent[1][1] - extent[0][1],\n k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\nexport function fitSize(projection, size, object) {\n return fitExtent(projection, [[0, 0], size], object);\n}\nexport function fitWidth(projection, width, object) {\n return fit(projection, function (b) {\n var w = +width,\n k = w / (b[1][0] - b[0][0]),\n x = (w - k * (b[1][0] + b[0][0])) / 2,\n y = -k * b[0][1];\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}\nexport function fitHeight(projection, height, object) {\n return fit(projection, function (b) {\n var h = +height,\n k = h / (b[1][1] - b[0][1]),\n x = -k * b[0][0],\n y = (h - k * (b[1][1] + b[0][1])) / 2;\n projection.scale(150 * k).translate([x, y]);\n }, object);\n}","import { cartesian } from \"../cartesian.js\";\nimport { abs, asin, atan2, cos, epsilon, radians, sqrt } from \"../math.js\";\nimport { transformer } from \"../transform.js\";\nvar maxDepth = 16,\n // maximum depth of subdivision\ncosMinDistance = cos(30 * radians); // cos(minimum angular distance)\n\nexport default function (project, delta2) {\n return +delta2 ? resample(project, delta2) : resampleNone(project);\n}\n\nfunction resampleNone(project) {\n return transformer({\n point: function point(x, y) {\n x = project(x, y);\n this.stream.point(x[0], x[1]);\n }\n });\n}\n\nfunction resample(project, delta2) {\n function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {\n var dx = x1 - x0,\n dy = y1 - y0,\n d2 = dx * dx + dy * dy;\n\n if (d2 > 4 * delta2 && depth--) {\n var a = a0 + a1,\n b = b0 + b1,\n c = c0 + c1,\n m = sqrt(a * a + b * b + c * c),\n phi2 = asin(c /= m),\n lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a),\n p = project(lambda2, phi2),\n x2 = p[0],\n y2 = p[1],\n dx2 = x2 - x0,\n dy2 = y2 - y0,\n dz = dy * dx2 - dx * dy2;\n\n if (dz * dz / d2 > delta2 // perpendicular projected distance\n || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end\n || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {\n // angular distance\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);\n stream.point(x2, y2);\n resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);\n }\n }\n }\n\n return function (stream) {\n var lambda00, x00, y00, a00, b00, c00, // first point\n lambda0, x0, y0, a0, b0, c0; // previous point\n\n var resampleStream = {\n point: point,\n lineStart: lineStart,\n lineEnd: lineEnd,\n polygonStart: function polygonStart() {\n stream.polygonStart();\n resampleStream.lineStart = ringStart;\n },\n polygonEnd: function polygonEnd() {\n stream.polygonEnd();\n resampleStream.lineStart = lineStart;\n }\n };\n\n function point(x, y) {\n x = project(x, y);\n stream.point(x[0], x[1]);\n }\n\n function lineStart() {\n x0 = NaN;\n resampleStream.point = linePoint;\n stream.lineStart();\n }\n\n function linePoint(lambda, phi) {\n var c = cartesian([lambda, phi]),\n p = project(lambda, phi);\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);\n stream.point(x0, y0);\n }\n\n function lineEnd() {\n resampleStream.point = point;\n stream.lineEnd();\n }\n\n function ringStart() {\n lineStart();\n resampleStream.point = ringPoint;\n resampleStream.lineEnd = ringEnd;\n }\n\n function ringPoint(lambda, phi) {\n linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;\n resampleStream.point = linePoint;\n }\n\n function ringEnd() {\n resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);\n resampleStream.lineEnd = lineEnd;\n lineEnd();\n }\n\n return resampleStream;\n };\n}","import clipAntimeridian from \"../clip/antimeridian.js\";\nimport clipCircle from \"../clip/circle.js\";\nimport clipRectangle from \"../clip/rectangle.js\";\nimport compose from \"../compose.js\";\nimport identity from \"../identity.js\";\nimport { cos, degrees, radians, sin, sqrt } from \"../math.js\";\nimport { rotateRadians } from \"../rotation.js\";\nimport { transformer } from \"../transform.js\";\nimport { fitExtent, fitSize, fitWidth, fitHeight } from \"./fit.js\";\nimport resample from \"./resample.js\";\nvar transformRadians = transformer({\n point: function point(x, y) {\n this.stream.point(x * radians, y * radians);\n }\n});\n\nfunction transformRotate(rotate) {\n return transformer({\n point: function point(x, y) {\n var r = rotate(x, y);\n return this.stream.point(r[0], r[1]);\n }\n });\n}\n\nfunction scaleTranslate(k, dx, dy, sx, sy) {\n function transform(x, y) {\n x *= sx;\n y *= sy;\n return [dx + k * x, dy - k * y];\n }\n\n transform.invert = function (x, y) {\n return [(x - dx) / k * sx, (dy - y) / k * sy];\n };\n\n return transform;\n}\n\nfunction scaleTranslateRotate(k, dx, dy, sx, sy, alpha) {\n if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);\n var cosAlpha = cos(alpha),\n sinAlpha = sin(alpha),\n a = cosAlpha * k,\n b = sinAlpha * k,\n ai = cosAlpha / k,\n bi = sinAlpha / k,\n ci = (sinAlpha * dy - cosAlpha * dx) / k,\n fi = (sinAlpha * dx + cosAlpha * dy) / k;\n\n function transform(x, y) {\n x *= sx;\n y *= sy;\n return [a * x - b * y + dx, dy - b * x - a * y];\n }\n\n transform.invert = function (x, y) {\n return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)];\n };\n\n return transform;\n}\n\nexport default function projection(project) {\n return projectionMutator(function () {\n return project;\n })();\n}\nexport function projectionMutator(projectAt) {\n var project,\n k = 150,\n // scale\n x = 480,\n y = 250,\n // translate\n lambda = 0,\n phi = 0,\n // center\n deltaLambda = 0,\n deltaPhi = 0,\n deltaGamma = 0,\n rotate,\n // pre-rotate\n alpha = 0,\n // post-rotate angle\n sx = 1,\n // reflectX\n sy = 1,\n // reflectX\n theta = null,\n preclip = clipAntimeridian,\n // pre-clip angle\n x0 = null,\n y0,\n x1,\n y1,\n postclip = identity,\n // post-clip extent\n delta2 = 0.5,\n // precision\n projectResample,\n projectTransform,\n projectRotateTransform,\n cache,\n cacheStream;\n\n function projection(point) {\n return projectRotateTransform(point[0] * radians, point[1] * radians);\n }\n\n function invert(point) {\n point = projectRotateTransform.invert(point[0], point[1]);\n return point && [point[0] * degrees, point[1] * degrees];\n }\n\n projection.stream = function (stream) {\n return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));\n };\n\n projection.preclip = function (_) {\n return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip;\n };\n\n projection.postclip = function (_) {\n return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n };\n\n projection.clipAngle = function (_) {\n return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;\n };\n\n projection.clipExtent = function (_) {\n return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n projection.scale = function (_) {\n return arguments.length ? (k = +_, recenter()) : k;\n };\n\n projection.translate = function (_) {\n return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];\n };\n\n projection.center = function (_) {\n return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];\n };\n\n projection.rotate = function (_) {\n return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];\n };\n\n projection.angle = function (_) {\n return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;\n };\n\n projection.reflectX = function (_) {\n return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;\n };\n\n projection.reflectY = function (_) {\n return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;\n };\n\n projection.precision = function (_) {\n return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);\n };\n\n projection.fitExtent = function (extent, object) {\n return fitExtent(projection, extent, object);\n };\n\n projection.fitSize = function (size, object) {\n return fitSize(projection, size, object);\n };\n\n projection.fitWidth = function (width, object) {\n return fitWidth(projection, width, object);\n };\n\n projection.fitHeight = function (height, object) {\n return fitHeight(projection, height, object);\n };\n\n function recenter() {\n var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)),\n transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha);\n rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);\n projectTransform = compose(project, transform);\n projectRotateTransform = compose(rotate, projectTransform);\n projectResample = resample(projectTransform, delta2);\n return reset();\n }\n\n function reset() {\n cache = cacheStream = null;\n return projection;\n }\n\n return function () {\n project = projectAt.apply(this, arguments);\n projection.invert = project.invert && invert;\n return recenter();\n };\n}","import projection from \"./index.js\";\nexport function equirectangularRaw(lambda, phi) {\n return [lambda, phi];\n}\nequirectangularRaw.invert = equirectangularRaw;\nexport default function () {\n return projection(equirectangularRaw).scale(152.63);\n}","import { Adder } from \"d3-array\";\nimport { abs } from \"../math.js\";\nimport noop from \"../noop.js\";\nvar areaSum = new Adder(),\n areaRingSum = new Adder(),\n x00,\n y00,\n x0,\n y0;\nvar areaStream = {\n point: noop,\n lineStart: noop,\n lineEnd: noop,\n polygonStart: function polygonStart() {\n areaStream.lineStart = areaRingStart;\n areaStream.lineEnd = areaRingEnd;\n },\n polygonEnd: function polygonEnd() {\n areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;\n areaSum.add(abs(areaRingSum));\n areaRingSum = new Adder();\n },\n result: function result() {\n var area = areaSum / 2;\n areaSum = new Adder();\n return area;\n }\n};\n\nfunction areaRingStart() {\n areaStream.point = areaPointFirst;\n}\n\nfunction areaPointFirst(x, y) {\n areaStream.point = areaPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction areaPoint(x, y) {\n areaRingSum.add(y0 * x - x0 * y);\n x0 = x, y0 = y;\n}\n\nfunction areaRingEnd() {\n areaPoint(x00, y00);\n}\n\nexport default areaStream;","import { sqrt } from \"../math.js\"; // TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0 = 0,\n Y0 = 0,\n Z0 = 0,\n X1 = 0,\n Y1 = 0,\n Z1 = 0,\n X2 = 0,\n Y2 = 0,\n Z2 = 0,\n x00,\n y00,\n x0,\n y0;\nvar centroidStream = {\n point: centroidPoint,\n lineStart: centroidLineStart,\n lineEnd: centroidLineEnd,\n polygonStart: function polygonStart() {\n centroidStream.lineStart = centroidRingStart;\n centroidStream.lineEnd = centroidRingEnd;\n },\n polygonEnd: function polygonEnd() {\n centroidStream.point = centroidPoint;\n centroidStream.lineStart = centroidLineStart;\n centroidStream.lineEnd = centroidLineEnd;\n },\n result: function result() {\n var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];\n X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;\n return centroid;\n }\n};\n\nfunction centroidPoint(x, y) {\n X0 += x;\n Y0 += y;\n ++Z0;\n}\n\nfunction centroidLineStart() {\n centroidStream.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n centroidStream.point = centroidPointLine;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidPointLine(x, y) {\n var dx = x - x0,\n dy = y - y0,\n z = sqrt(dx * dx + dy * dy);\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidLineEnd() {\n centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingStart() {\n centroidStream.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd() {\n centroidPointRing(x00, y00);\n}\n\nfunction centroidPointFirstRing(x, y) {\n centroidStream.point = centroidPointRing;\n centroidPoint(x00 = x0 = x, y00 = y0 = y);\n}\n\nfunction centroidPointRing(x, y) {\n var dx = x - x0,\n dy = y - y0,\n z = sqrt(dx * dx + dy * dy);\n X1 += z * (x0 + x) / 2;\n Y1 += z * (y0 + y) / 2;\n Z1 += z;\n z = y0 * x - x0 * y;\n X2 += z * (x0 + x);\n Y2 += z * (y0 + y);\n Z2 += z * 3;\n centroidPoint(x0 = x, y0 = y);\n}\n\nexport default centroidStream;","import { tau } from \"../math.js\";\nimport noop from \"../noop.js\";\nexport default function PathContext(context) {\n this._context = context;\n}\nPathContext.prototype = {\n _radius: 4.5,\n pointRadius: function pointRadius(_) {\n return this._radius = _, this;\n },\n polygonStart: function polygonStart() {\n this._line = 0;\n },\n polygonEnd: function polygonEnd() {\n this._line = NaN;\n },\n lineStart: function lineStart() {\n this._point = 0;\n },\n lineEnd: function lineEnd() {\n if (this._line === 0) this._context.closePath();\n this._point = NaN;\n },\n point: function point(x, y) {\n switch (this._point) {\n case 0:\n {\n this._context.moveTo(x, y);\n\n this._point = 1;\n break;\n }\n\n case 1:\n {\n this._context.lineTo(x, y);\n\n break;\n }\n\n default:\n {\n this._context.moveTo(x + this._radius, y);\n\n this._context.arc(x, y, this._radius, 0, tau);\n\n break;\n }\n }\n },\n result: noop\n};","import { Adder } from \"d3-array\";\nimport { sqrt } from \"../math.js\";\nimport noop from \"../noop.js\";\nvar lengthSum = new Adder(),\n lengthRing,\n x00,\n y00,\n x0,\n y0;\nvar lengthStream = {\n point: noop,\n lineStart: function lineStart() {\n lengthStream.point = lengthPointFirst;\n },\n lineEnd: function lineEnd() {\n if (lengthRing) lengthPoint(x00, y00);\n lengthStream.point = noop;\n },\n polygonStart: function polygonStart() {\n lengthRing = true;\n },\n polygonEnd: function polygonEnd() {\n lengthRing = null;\n },\n result: function result() {\n var length = +lengthSum;\n lengthSum = new Adder();\n return length;\n }\n};\n\nfunction lengthPointFirst(x, y) {\n lengthStream.point = lengthPoint;\n x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction lengthPoint(x, y) {\n x0 -= x, y0 -= y;\n lengthSum.add(sqrt(x0 * x0 + y0 * y0));\n x0 = x, y0 = y;\n}\n\nexport default lengthStream;","export default function PathString() {\n this._string = [];\n}\nPathString.prototype = {\n _radius: 4.5,\n _circle: circle(4.5),\n pointRadius: function pointRadius(_) {\n if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;\n return this;\n },\n polygonStart: function polygonStart() {\n this._line = 0;\n },\n polygonEnd: function polygonEnd() {\n this._line = NaN;\n },\n lineStart: function lineStart() {\n this._point = 0;\n },\n lineEnd: function lineEnd() {\n if (this._line === 0) this._string.push(\"Z\");\n this._point = NaN;\n },\n point: function point(x, y) {\n switch (this._point) {\n case 0:\n {\n this._string.push(\"M\", x, \",\", y);\n\n this._point = 1;\n break;\n }\n\n case 1:\n {\n this._string.push(\"L\", x, \",\", y);\n\n break;\n }\n\n default:\n {\n if (this._circle == null) this._circle = circle(this._radius);\n\n this._string.push(\"M\", x, \",\", y, this._circle);\n\n break;\n }\n }\n },\n result: function result() {\n if (this._string.length) {\n var result = this._string.join(\"\");\n\n this._string = [];\n return result;\n } else {\n return null;\n }\n }\n};\n\nfunction circle(radius) {\n return \"m0,\" + radius + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + -2 * radius + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + 2 * radius + \"z\";\n}","import identity from \"../identity.js\";\nimport stream from \"../stream.js\";\nimport pathArea from \"./area.js\";\nimport pathBounds from \"./bounds.js\";\nimport pathCentroid from \"./centroid.js\";\nimport PathContext from \"./context.js\";\nimport pathMeasure from \"./measure.js\";\nimport PathString from \"./string.js\";\nexport default function (projection, context) {\n var pointRadius = 4.5,\n projectionStream,\n contextStream;\n\n function path(object) {\n if (object) {\n if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n stream(object, projectionStream(contextStream));\n }\n\n return contextStream.result();\n }\n\n path.area = function (object) {\n stream(object, projectionStream(pathArea));\n return pathArea.result();\n };\n\n path.measure = function (object) {\n stream(object, projectionStream(pathMeasure));\n return pathMeasure.result();\n };\n\n path.bounds = function (object) {\n stream(object, projectionStream(pathBounds));\n return pathBounds.result();\n };\n\n path.centroid = function (object) {\n stream(object, projectionStream(pathCentroid));\n return pathCentroid.result();\n };\n\n path.projection = function (_) {\n return arguments.length ? (projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream, path) : projection;\n };\n\n path.context = function (_) {\n if (!arguments.length) return context;\n contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);\n if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n return path;\n };\n\n path.pointRadius = function (_) {\n if (!arguments.length) return pointRadius;\n pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n return path;\n };\n\n return path.projection(projection).context(context);\n}","import { Adder } from \"d3-array\";\nimport { abs, atan2, cos, radians, sin, sqrt } from \"./math.js\";\nimport noop from \"./noop.js\";\nimport stream from \"./stream.js\";\nvar lengthSum, lambda0, sinPhi0, cosPhi0;\nvar lengthStream = {\n sphere: noop,\n point: noop,\n lineStart: lengthLineStart,\n lineEnd: noop,\n polygonStart: noop,\n polygonEnd: noop\n};\n\nfunction lengthLineStart() {\n lengthStream.point = lengthPointFirst;\n lengthStream.lineEnd = lengthLineEnd;\n}\n\nfunction lengthLineEnd() {\n lengthStream.point = lengthStream.lineEnd = noop;\n}\n\nfunction lengthPointFirst(lambda, phi) {\n lambda *= radians, phi *= radians;\n lambda0 = lambda, sinPhi0 = sin(phi), cosPhi0 = cos(phi);\n lengthStream.point = lengthPoint;\n}\n\nfunction lengthPoint(lambda, phi) {\n lambda *= radians, phi *= radians;\n var sinPhi = sin(phi),\n cosPhi = cos(phi),\n delta = abs(lambda - lambda0),\n cosDelta = cos(delta),\n sinDelta = sin(delta),\n x = cosPhi * sinDelta,\n y = cosPhi0 * sinPhi - sinPhi0 * cosPhi * cosDelta,\n z = sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosDelta;\n lengthSum.add(atan2(sqrt(x * x + y * y), z));\n lambda0 = lambda, sinPhi0 = sinPhi, cosPhi0 = cosPhi;\n}\n\nexport default function (object) {\n lengthSum = new Adder();\n stream(object, lengthStream);\n return +lengthSum;\n}","import length from \"./length.js\";\nvar coordinates = [null, null],\n object = {\n type: \"LineString\",\n coordinates: coordinates\n};\nexport default function (a, b) {\n coordinates[0] = a;\n coordinates[1] = b;\n return length(object);\n}","/**\r\n * This module contains funcitonality related to geographical projections\r\n */\nimport { registry } from \"../../../core/Registry\";\nimport * as $math from \"../../../core/utils/Math\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This is a base class for a geographical projection.\r\n */\n\nvar Projection =\n/** @class */\nfunction () {\n function Projection() {\n this.d3Projection = d3geo.geoEquirectangular();\n }\n\n Object.defineProperty(Projection.prototype, \"d3Projection\", {\n /**\r\n * d3 projection\r\n */\n get: function get() {\n return this._d3Projection;\n },\n\n /**\r\n * d3 projection\r\n */\n set: function set(projection) {\n this._d3Projection = projection;\n projection.precision(0.1);\n this._d3Path = d3geo.geoPath().projection(projection);\n\n if (this.chart) {\n this.chart.invalidateProjection();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Projection.prototype, \"d3Path\", {\n /**\r\n * d3 path generator method\r\n * @ignore\r\n */\n get: function get() {\n return this._d3Path;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Projection.prototype, \"scale\", {\n /**\r\n * @ignore\r\n */\n get: function get() {\n return this.d3Projection.scale() / 100;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Converts a geographical point (lat/long) to a screen point (x/y)\r\n * @param geoPoint Geo point (lat/long)\r\n * @return Screen point (x/y)\r\n */\n\n Projection.prototype.convert = function (geoPoint) {\n /*\r\n geoPoint = $geo.normalizePoint(geoPoint);\r\n geoPoint = this.rotate(geoPoint, this.deltaLongitude, this.deltaLatitude, this.deltaGama);\r\n let pointInRadians: IPoint = this.project(geoPoint.longitude * $math.RADIANS, geoPoint.latitude * $math.RADIANS);\r\n return {\r\n x: $math.round(pointInRadians.x * $math.DEGREES - this.centerPoint.x, 4) * this.scale,\r\n y: $math.round(-pointInRadians.y * $math.DEGREES - this.centerPoint.y, 4) * this.scale\r\n };*/\n var p = this.d3Projection([geoPoint.longitude, geoPoint.latitude]);\n\n if (p) {\n return {\n x: p[0],\n y: p[1]\n };\n }\n };\n /**\r\n * Converts a screen point (x/y) to a geographical point (lat/long)\r\n * @param point Screen point (x/y)\r\n * @return Geo point (lat/long)\r\n */\n\n\n Projection.prototype.invert = function (point) {\n /*\r\n let pointInRadians: IGeoPoint = this.unproject((point.x / this.scale + this.centerPoint.x) * $math.RADIANS, (-point.y / this.scale - this.centerPoint.y) * $math.RADIANS);\r\n let geoPoint = { longitude: pointInRadians.longitude * $math.DEGREES, latitude: pointInRadians.latitude * $math.DEGREES };\r\n geoPoint = this.unrotate(geoPoint, this.deltaLongitude, this.deltaLatitude, this.deltaGama);\r\n */\n var p = this.d3Projection.invert([point.x, point.y]);\n\n if (p) {\n return {\n longitude: p[0],\n latitude: p[1]\n };\n }\n };\n /**\r\n * Returns X/Y coordinates.\r\n * Individual projections will override this method to apply their own\r\n * projection logic.\r\n * @deprecated\r\n * @param lambda [description]\r\n * @param phi [description]\r\n * @return X/Y coordinates\r\n * @todo Needs description\r\n */\n\n\n Projection.prototype.project = function (lambda, phi) {\n return this.convert({\n longitude: lambda * $math.DEGREES,\n latitude: phi * $math.DEGREES\n });\n };\n /**\r\n * Returns geographical coordinates (lat/long).\r\n * Individual projections will override this method to apply their own\r\n * projection logic.\r\n * @deprecated\r\n * @param x X coordinate\r\n * @param y Y coordinate\r\n * @return Geographical point\r\n * @todo Needs description\r\n */\n\n\n Projection.prototype.unproject = function (x, y) {\n return this.invert({\n x: x,\n y: y\n });\n };\n /**\r\n * @ignore\r\n * @deprecated\r\n */\n\n\n Projection.prototype.rotate = function (geoPoint, deltaLongitude, deltaLatitude, deltaGamma) {\n var deltaLambda = deltaLongitude * $math.RADIANS;\n var deltaPhi = deltaLatitude * $math.RADIANS;\n deltaGamma = deltaGamma * $math.RADIANS;\n var lambda = geoPoint.longitude * $math.RADIANS + deltaLambda;\n var phi = geoPoint.latitude * $math.RADIANS;\n var cosDeltaPhi = Math.cos(deltaPhi);\n var sinDeltaPhi = Math.sin(deltaPhi);\n var cosDeltaGamma = Math.cos(deltaGamma);\n var sinDeltaGamma = Math.sin(deltaGamma);\n var cosPhi = Math.cos(phi);\n var x = Math.cos(lambda) * cosPhi;\n var y = Math.sin(lambda) * cosPhi;\n var z = Math.sin(phi);\n var k = z * cosDeltaPhi + x * sinDeltaPhi;\n return {\n longitude: $math.DEGREES * Math.atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),\n latitude: $math.DEGREES * Math.asin(k * cosDeltaGamma + y * sinDeltaGamma)\n };\n };\n /**\r\n * @ignore\r\n * @deprecated\r\n */\n\n\n Projection.prototype.unrotate = function (geoPoint, deltaLongitude, deltaLatitude, deltaGamma) {\n var deltaLambda = deltaLongitude * $math.RADIANS;\n var deltaPhi = deltaLatitude * $math.RADIANS;\n deltaGamma = deltaGamma * $math.RADIANS;\n var lambda = geoPoint.longitude * $math.RADIANS - deltaLambda;\n var phi = geoPoint.latitude * $math.RADIANS;\n var cosDeltaPhi = Math.cos(deltaPhi);\n var sinDeltaPhi = Math.sin(deltaPhi);\n var cosDeltaGamma = Math.cos(deltaGamma);\n var sinDeltaGamma = Math.sin(deltaGamma);\n var cosPhi = Math.cos(phi);\n var x = Math.cos(lambda) * cosPhi;\n var y = Math.sin(lambda) * cosPhi;\n var z = Math.sin(phi);\n var k = z * cosDeltaGamma - y * sinDeltaGamma;\n return {\n longitude: $math.DEGREES * Math.atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),\n latitude: $math.DEGREES * Math.asin(k * cosDeltaPhi - x * sinDeltaPhi)\n };\n }; //@todo: move to some utils?\n //@todo: add credits to: https://www.movable-type.co.uk/scripts/latlong.html\n\n\n Projection.prototype.intermediatePoint = function (pointA, pointB, position) {\n var p = d3geo.geoInterpolate([pointA.longitude, pointA.latitude], [pointB.longitude, pointB.latitude])(position);\n return {\n longitude: p[0],\n latitude: p[1]\n };\n };\n\n ; // returns radians\n\n Projection.prototype.multiDistance = function (multiGeoLine) {\n var distance = 0;\n\n for (var s = 0; s < multiGeoLine.length; s++) {\n var points = multiGeoLine[s];\n\n if (points.length > 1) {\n for (var p = 1; p < points.length; p++) {\n var pointA = points[p - 1];\n var pointB = points[p];\n distance += this.distance(pointA, pointB);\n }\n }\n }\n\n return distance;\n }; // returns radians\n\n\n Projection.prototype.distance = function (pointA, pointB) {\n return d3geo.geoDistance([pointA.longitude, pointA.latitude], [pointB.longitude, pointB.latitude]);\n };\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\n\n\n Projection.prototype.positionToPoint = function (multiGeoLine, position) {\n if (multiGeoLine) {\n var intermediatePoint = this.positionToGeoPoint(multiGeoLine, position);\n var intermediatePointA = this.positionToGeoPoint(multiGeoLine, position - 0.01);\n var intermediatePointB = this.positionToGeoPoint(multiGeoLine, position + 0.01);\n\n if (intermediatePointA && intermediatePointB) {\n var point = this.convert(intermediatePoint);\n var pa = this.convert(intermediatePointA);\n var pb = this.convert(intermediatePointB);\n return {\n x: point.x,\n y: point.y,\n angle: $math.getAngle(pa, pb)\n };\n }\n }\n\n return {\n x: 0,\n y: 0,\n angle: 0\n };\n };\n /**\r\n * Converts relative position along the line (0-1) into pixel coordinates.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\n\n\n Projection.prototype.positionToGeoPoint = function (multiGeoLine, position) {\n if (multiGeoLine) {\n var totalDistance = this.multiDistance(multiGeoLine);\n var currentDistance = 0;\n var distanceAB = void 0;\n var positionA = 0;\n var positionB = 0;\n var pointA = void 0;\n var pointB = void 0;\n\n for (var s = 0; s < multiGeoLine.length; s++) {\n var points = multiGeoLine[s];\n\n if (points.length > 1) {\n for (var p = 1; p < points.length; p++) {\n pointA = points[p - 1];\n pointB = points[p];\n positionA = currentDistance / totalDistance;\n distanceAB = this.distance(pointA, pointB);\n currentDistance += distanceAB;\n positionB = currentDistance / totalDistance;\n\n if (positionA <= position && positionB > position) {\n s = multiGeoLine.length;\n break;\n }\n }\n } else if (points.length == 1) {\n pointA = points[0];\n pointB = points[0];\n positionA = 0;\n positionB = 1;\n }\n }\n\n if (pointA && pointB) {\n var positionAB = (position - positionA) / (positionB - positionA);\n return this.intermediatePoint(pointA, pointB, positionAB);\n }\n }\n\n return {\n longitude: 0,\n latitude: 0\n };\n };\n\n return Projection;\n}();\n\nexport { Projection };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Projection\"] = Projection;","import { asin, atan2, cos, degrees, haversin, radians, sin, sqrt } from \"./math.js\";\nexport default function (a, b) {\n var x0 = a[0] * radians,\n y0 = a[1] * radians,\n x1 = b[0] * radians,\n y1 = b[1] * radians,\n cy0 = cos(y0),\n sy0 = sin(y0),\n cy1 = cos(y1),\n sy1 = sin(y1),\n kx0 = cy0 * cos(x0),\n ky0 = cy0 * sin(x0),\n kx1 = cy1 * cos(x1),\n ky1 = cy1 * sin(x1),\n d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))),\n k = sin(d);\n var interpolate = d ? function (t) {\n var B = sin(t *= d) / k,\n A = sin(d - t) / k,\n x = A * kx0 + B * kx1,\n y = A * ky0 + B * ky1,\n z = A * sy0 + B * sy1;\n return [atan2(y, x) * degrees, atan2(z, sqrt(x * x + y * y)) * degrees];\n } : function () {\n return [x0 * degrees, y0 * degrees];\n };\n interpolate.distance = d;\n return interpolate;\n}","/**\r\n * A module for the mini-map control.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { Rectangle } from \"../../core/elements/Rectangle\";\nimport { List } from \"../../core/utils/List\";\nimport { MutableValueDisposer, MultiDisposer } from \"../../core/utils/Disposer\";\nimport { registry } from \"../../core/Registry\";\nimport { color } from \"../../core/utils/Color\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $type from \"../../core/utils/Type\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a \"bird's eye\" view of the whole map.\r\n *\r\n * This control creates a mini-map with the whole of the map, highlighting\r\n * the area which is in the current viewport of the map map.\r\n *\r\n * @see {@link ISmallMapEvents} for a list of available events\r\n * @see {@link ISmallMapAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar SmallMap =\n/** @class */\nfunction (_super) {\n __extends(SmallMap, _super);\n /**\r\n * Constructor\r\n */\n\n\n function SmallMap() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * A target map.\r\n */\n\n\n _this._chart = new MutableValueDisposer();\n _this.className = \"SmallMap\"; // Set defaults\n\n _this.align = \"left\";\n _this.valign = \"bottom\";\n _this.percentHeight = 20;\n _this.percentWidth = 20;\n\n _this.margin(5, 5, 5, 5);\n\n var interfaceColors = new InterfaceColorSet(); // Set background defailts\n\n _this.background.fillOpacity = 0.9;\n _this.background.fill = interfaceColors.getFor(\"background\"); // Set up events\n\n _this.events.on(\"hit\", _this.moveToPosition, _this, false);\n\n _this.events.on(\"maxsizechanged\", _this.updateMapSize, _this, false); // Create a container\n\n\n _this.seriesContainer = _this.createChild(Container);\n _this.seriesContainer.shouldClone = false; // Create an outline rectangle\n\n var rectangle = _this.createChild(Rectangle);\n\n rectangle.shouldClone = false;\n rectangle.stroke = interfaceColors.getFor(\"alternativeBackground\");\n rectangle.strokeWidth = 1;\n rectangle.strokeOpacity = 0.5;\n rectangle.fill = color(); //\"none\";\n\n rectangle.verticalCenter = \"middle\";\n rectangle.horizontalCenter = \"middle\";\n rectangle.isMeasured = false;\n rectangle.visible = false;\n _this.rectangle = rectangle;\n\n _this._disposers.push(_this._chart); // Apply theme\n\n\n _this.applyTheme();\n\n return _this;\n }\n\n Object.defineProperty(SmallMap.prototype, \"series\", {\n /**\r\n * A list of map series used to draw the mini-map.\r\n *\r\n * @readonly\r\n * @return Series\r\n */\n get: function get() {\n if (!this._series) {\n this._series = new List();\n\n this._series.events.on(\"inserted\", this.handleSeriesAdded, this, false);\n\n this._series.events.on(\"removed\", this.handleSeriesRemoved, this, false);\n }\n\n return this._series;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Decorates a new series when they are pushed into a `series` list.\r\n *\r\n * @param event Event\r\n */\n\n SmallMap.prototype.handleSeriesAdded = function (event) {\n var series = event.newValue;\n\n if (this.chart.series.contains(series)) {\n var newSeries = series.clone();\n\n this._series.removeValue(series);\n\n this._series.push(newSeries);\n\n series = newSeries;\n this.chart.dataUsers.push(newSeries);\n }\n\n series.chart = this.chart;\n series.parent = this.seriesContainer;\n series.interactionsEnabled = false;\n series.events.on(\"inited\", this.updateMapSize, this, false);\n series.hidden = false;\n };\n /**\r\n * Cleans up after series are removed from Scrollbar.\r\n *\r\n * @param event Event\r\n */\n\n\n SmallMap.prototype.handleSeriesRemoved = function (event) {\n //let sourceSeries: MapSeries = event.oldValue;\n this.invalidate();\n };\n /**\r\n * Moves main map pan position after click on the small map.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n SmallMap.prototype.moveToPosition = function (event) {\n var rectPoint = $utils.spritePointToSprite(event.spritePoint, this, this.seriesContainer);\n var geoPoint = this.chart.seriesPointToGeo(rectPoint);\n this.chart.zoomToGeoPoint(geoPoint, this.chart.zoomLevel, true);\n };\n\n Object.defineProperty(SmallMap.prototype, \"chart\", {\n /**\r\n * @return Chart/map\r\n */\n get: function get() {\n return this._chart.get();\n },\n\n /**\r\n * A chart/map that this control is meant for.\r\n *\r\n * @param chart Chart/map\r\n */\n set: function set(chart) {\n if (this.chart != chart) {\n this._chart.set(chart, new MultiDisposer([//chart.events.on(\"zoomlevelchanged\", this.updateRectangle, this, false),\n chart.events.on(\"mappositionchanged\", this.updateRectangle, this, false), chart.events.on(\"scaleratiochanged\", this.updateMapSize, this, false)]));\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates the viewport recangle as per current map zoom/pan position.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n SmallMap.prototype.updateRectangle = function () {\n var chart = this.chart;\n var zoomLevel = chart.zoomLevel;\n var rectangle = this.rectangle;\n rectangle.width = this.pixelWidth / zoomLevel;\n rectangle.height = this.pixelHeight / zoomLevel;\n var scale = Math.min(this.percentWidth, this.percentHeight) / 100;\n var seriesContainer = chart.seriesContainer;\n rectangle.x = Math.ceil(-seriesContainer.pixelX * scale / zoomLevel) + this.seriesContainer.pixelX;\n rectangle.y = Math.ceil(-seriesContainer.pixelY * scale / zoomLevel) + this.seriesContainer.pixelY;\n rectangle.validate();\n };\n /**\r\n * Update map size so that internal elements can redraw themselves after\r\n * the size of the small map changes.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n SmallMap.prototype.updateMapSize = function () {\n if (this.chart) {\n var scale = this.chart.scaleRatio * Math.min(this.percentWidth, this.percentHeight) / 100;\n this.seriesContainer.scale = scale;\n var bbox = {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n };\n\n try {\n // Add exception catching to tame FF\n bbox = this.seriesContainer.group.node.getBBox();\n } catch (err) {}\n\n if (bbox.width > 0) {\n this.rectangle.visible = true;\n }\n\n this.seriesContainer.x = this.pixelWidth / 2 - bbox.x * scale - bbox.width / 2 * scale;\n this.seriesContainer.y = this.pixelHeight / 2 - bbox.y * scale - bbox.height / 2 * scale;\n this.updateRectangle();\n this.afterDraw();\n }\n };\n /**\r\n * Update elements after drawing the small map.\r\n */\n\n\n SmallMap.prototype.afterDraw = function () {\n _super.prototype.afterDraw.call(this); //this.seriesContainer.moveTo({ x: this.pixelWidth / 2, y: this.pixelHeight / 2 });\n\n\n this.rectangle.maskRectangle = {\n x: -1,\n y: -1,\n width: Math.ceil(this.pixelWidth + 2),\n height: Math.ceil(this.pixelHeight + 2)\n };\n };\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n\n SmallMap.prototype.processConfig = function (config) {\n if (config) {\n // Set up series\n if ($type.hasValue(config.series) && $type.isArray(config.series)) {\n for (var i = 0, len = config.series.length; i < len; i++) {\n var series = config.series[i];\n\n if ($type.hasValue(series) && $type.isString(series) && this.map.hasKey(series)) {\n config.series[i] = this.map.getKey(series);\n }\n }\n }\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n\n return SmallMap;\n}(Container);\n\nexport { SmallMap };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"SmallMap\"] = SmallMap;","/**\r\n * A collection of GeoJSON format-related utility functions.\r\n */\nimport * as $math from \"../../core/utils/Math\";\nimport * as $array from \"../../core/utils/Array\";\n/**\r\n * Normalizes a geo-point.\r\n *\r\n * @ignore Exclude from docs\r\n * @param geoPoint Source geo-point\r\n * @return Normalized geo-point\r\n */\n\nexport function normalizePoint(geoPoint) {\n var longitude = wrapAngleTo180(geoPoint.longitude);\n var latitude = Math.asin(Math.sin(geoPoint.latitude * $math.RADIANS)) * $math.DEGREES;\n var latitude180 = wrapAngleTo180(geoPoint.latitude);\n\n if (Math.abs(latitude180) > 90) {\n longitude = wrapAngleTo180(longitude + 180);\n }\n\n geoPoint.longitude = longitude;\n geoPoint.latitude = latitude;\n return geoPoint;\n}\n/**\r\n * Normalizes all points of a geo-line.\r\n *\r\n * @ignore Exclude from docs\r\n * @param multiline Source geo-line\r\n * @return Normalized geo-line\r\n */\n\nexport function normalizeMultiline(multiline) {\n $array.each(multiline, function (segment) {\n $array.each(segment, function (point) {\n normalizePoint(point);\n });\n });\n return multiline;\n}\n/**\r\n * [wrapAngleTo180 description]\r\n *\r\n * @todo Description\r\n * @ignore Exclude from docs\r\n * @param angle Angle\r\n * @return Angle\r\n */\n\nexport function wrapAngleTo180(angle) {\n angle = angle % 360;\n\n if (angle > 180) {\n angle -= 360;\n }\n\n if (angle < -180) {\n angle += 360;\n }\n\n return angle;\n}\n/**\r\n * Converts a geo point to a regular point object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param geoPoint Source geo point\r\n * @return Point\r\n */\n\nexport function geoToPoint(geoPoint) {\n return {\n x: geoPoint.longitude,\n y: geoPoint.latitude\n };\n}","/**\r\n * Map line module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Draws a line on the map.\r\n *\r\n * @see {@link IMapLineObjectEvents} for a list of available events\r\n * @see {@link IMapLineObjectAdapters} for a list of available Adapters\r\n */\n\nvar MapLineObject =\n/** @class */\nfunction (_super) {\n __extends(MapLineObject, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapLineObject() {\n var _this = _super.call(this) || this;\n\n _this.adjustRotation = true;\n _this.className = \"MapLineObject\";\n _this.isMeasured = false;\n _this.layout = \"none\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * (Re)validates element's position.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapLineObject.prototype.validatePosition = function () {\n var mapLine = this.mapLine;\n\n if (mapLine) {\n var point = mapLine.positionToPoint(this.position);\n this.x = point.x;\n this.y = point.y;\n\n if (this.adjustRotation) {\n this.rotation = point.angle;\n }\n\n var dataItem = this.mapLine.dataItem;\n\n if (dataItem) {\n var series = this.mapLine.dataItem.component;\n this.scale = 1 / series.scale;\n } // hide out of bounds\n\n\n if (mapLine.shortestDistance) {\n var projection = this.mapLine.series.chart.projection;\n var geoPoint = projection.positionToGeoPoint(mapLine.multiGeoLine, this.position);\n var visible = projection.d3Path({\n type: 'Point',\n coordinates: [geoPoint.longitude, geoPoint.latitude]\n });\n\n if (!visible) {\n this.__disabled = true;\n } else {\n this.__disabled = false;\n }\n }\n }\n\n _super.prototype.validatePosition.call(this);\n };\n\n Object.defineProperty(MapLineObject.prototype, \"position\", {\n /**\r\n * @return Position within the line\r\n */\n get: function get() {\n return this.getPropertyValue(\"position\");\n },\n\n /**\r\n * Sets object's relative position (0-1) within the line.\r\n *\r\n * `0` will place the object at the beginning of the line. `1` - at the end.\r\n *\r\n * Any intermediate number will place the object at some point within the\r\n * line.\r\n *\r\n * @param value Position within the line (0-1)\r\n */\n set: function set(value) {\n this.setPropertyValue(\"position\", value, false, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLineObject.prototype, \"adjustRotation\", {\n /**\r\n * @return Auto-rotate\r\n */\n get: function get() {\n return this.getPropertyValue(\"adjustRotation\");\n },\n\n /**\r\n * If set to `true`, the object will be automatically rotated to face the\r\n * direction of the line at the specific position.\r\n *\r\n * This allows creating images that has its \"front\" always facing the logical\r\n * direction of the line.\r\n *\r\n * @default false\r\n * @param value Auto-rotate\r\n */\n set: function set(value) {\n this.setPropertyValue(\"adjustRotation\", value, false, true);\n },\n enumerable: true,\n configurable: true\n });\n return MapLineObject;\n}(Container);\n\nexport { MapLineObject };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapLineObject\"] = MapLineObject;","/**\r\n * Map image series module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapSeries, MapSeriesDataItem } from \"./MapSeries\";\nimport { MapImage } from \"./MapImage\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { registry } from \"../../core/Registry\";\nimport * as $array from \"../../core/utils/Array\";\nimport * as $mapUtils from \"./MapUtils\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $type from \"../../core/utils/Type\";\nimport { Disposer } from \"../../core/utils/Disposer\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapImageSeries]]\r\n * @see {@link DataItem}\r\n */\n\nvar MapImageSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapImageSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapImageSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapImageSeriesDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapImageSeriesDataItem.prototype.getFeature = function () {\n return {\n \"type\": \"Feature\",\n geometry: {\n type: \"Point\",\n coordinates: this.point\n }\n };\n };\n\n Object.defineProperty(MapImageSeriesDataItem.prototype, \"mapImage\", {\n /**\r\n * A [[MapImage]] element related to this data item.\r\n *\r\n * @return Element\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._mapImage) {\n var mapImage_1 = this.component.mapImages.create();\n this.addSprite(mapImage_1);\n this._mapImage = mapImage_1;\n\n this._disposers.push(mapImage_1);\n\n this._disposers.push(new Disposer(function () {\n if (_this.component) {\n _this.component.mapImages.removeValue(mapImage_1);\n }\n }));\n\n this.mapObject = mapImage_1;\n }\n\n return this._mapImage;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapImageSeriesDataItem.prototype, \"point\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return this._point;\n },\n\n /**\r\n * [point description]\r\n *\r\n * @todo Description\r\n * @param point [description]\r\n */\n set: function set(point) {\n this._point = point;\n this._geoPoint = $mapUtils.pointToGeo(point);\n this.updateExtremes();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapImageSeriesDataItem.prototype, \"multiPoint\", {\n /**\r\n * @return [description]\r\n */\n get: function get() {\n return [this._point];\n },\n\n /**\r\n * [point description]\r\n *\r\n * @todo Description\r\n * @param point [description]\r\n */\n set: function set(multiPoint) {\n this._point = multiPoint[0];\n this._geoPoint = $mapUtils.pointToGeo(this._point);\n this.updateExtremes();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapImageSeriesDataItem.prototype, \"geoPoint\", {\n /**\r\n * @return Image coordinates\r\n */\n get: function get() {\n return this._geoPoint;\n },\n\n /**\r\n * Geographical coordinates (lat/long) image is placed at.\r\n *\r\n * @param geoPoint Image coordinates\r\n */\n set: function set(geoPoint) {\n this._geoPoint = geoPoint;\n this.point = [geoPoint.longitude, geoPoint.latitude];\n },\n enumerable: true,\n configurable: true\n });\n return MapImageSeriesDataItem;\n}(MapSeriesDataItem);\n\nexport { MapImageSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A series of map image (marker) elements.\r\n *\r\n * @see {@link IMapImageSeriesEvents} for a list of available Events\r\n * @see {@link IMapImageSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar MapImageSeries =\n/** @class */\nfunction (_super) {\n __extends(MapImageSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapImageSeries() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"MapImageSeries\"; // Set data fields\n\n _this.dataFields.multiPoint = \"multiPoint\";\n _this.dataFields.point = \"point\";\n _this.dataFields.geoPoint = \"geoPoint\";\n _this.dataFields.multiGeoPoint = \"multiGeoPoint\";\n _this.ignoreBounds = true; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n MapImageSeries.prototype.createDataItem = function () {\n return new MapImageSeriesDataItem();\n };\n /**\r\n * (Re)validates the data of the sries, effectively forcing it to redraw\r\n * all of its elements.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapImageSeries.prototype.validateData = function () {\n var _this = this;\n\n if (this.data.length > 0 && this._parseDataFrom == 0) {\n this.mapImages.clear();\n } // process geoJSON and created map objects\n\n\n if (this.useGeodata) {\n if (this.useGeodata || this.geodata) {\n var geoJSON = this.chart.geodata;\n var features = void 0;\n\n if (geoJSON.type == \"FeatureCollection\") {\n features = geoJSON.features;\n } else if (geoJSON.type == \"Feature\") {\n features = [geoJSON];\n } else if ([\"Point\", \"LineString\", \"Polygon\", \"MultiPoint\", \"MultiLineString\", \"MultiPolygon\"].indexOf(geoJSON.type) != -1) {\n features = [{\n geometry: geoJSON\n }];\n } else {\n console.log(\"nothing found in geoJSON\");\n }\n\n if (features) {\n var _loop_1 = function _loop_1(i, len) {\n var feature = features[i];\n var geometry = feature.geometry;\n\n if (geometry) {\n var type = geometry.type;\n var id_1 = feature.id;\n\n if (type == \"Point\" || type == \"MultiPoint\") {\n // todo: we don't support multipoints at the moment actually\n if (!this_1.checkInclude(this_1.include, this_1.exclude, id_1)) {\n return \"continue\";\n }\n\n var coordinates = geometry.coordinates; // make the same as MultiPoint\n\n if (type == \"Point\") {\n coordinates = [coordinates];\n }\n\n var dataObject = $array.find(this_1.data, function (value, i) {\n return value.id == id_1;\n });\n\n if (!dataObject) {\n dataObject = {\n multiPoint: coordinates,\n id: id_1,\n madeFromGeoData: true\n };\n this_1.data.push(dataObject);\n } else {\n if (!dataObject.multiPoint) {\n dataObject.multiPoint = coordinates;\n }\n } // copy properties data to datacontext\n\n\n $utils.softCopyProperties(feature.properties, dataObject);\n }\n }\n };\n\n var this_1 = this;\n\n for (var i = 0, len = features.length; i < len; i++) {\n _loop_1(i, len);\n }\n }\n }\n }\n\n _super.prototype.validateData.call(this); // important! this should go after super.validateData\n // if data is parsed in chunks, images list is corrupted, fix it here\n\n\n $iter.each(this.dataItems.iterator(), function (dataItem) {\n var mapImage = dataItem.mapImage;\n\n if (!mapImage.isDisposed()) {\n _this.mapImages.moveValue(mapImage);\n\n if ($type.isNumber(mapImage.latitude) && $type.isNumber(mapImage.latitude)) {\n dataItem.geoPoint = {\n latitude: mapImage.latitude,\n longitude: mapImage.longitude\n };\n }\n }\n });\n };\n\n Object.defineProperty(MapImageSeries.prototype, \"mapImages\", {\n /**\r\n * A list of map images in the series.\r\n *\r\n * @return Map images\r\n */\n get: function get() {\n if (!this._mapImages) {\n var template = new MapImage();\n var mapImages = new ListTemplate(template);\n\n this._disposers.push(new ListDisposer(mapImages));\n\n this._disposers.push(mapImages.template);\n\n mapImages.template.focusable = true;\n mapImages.events.on(\"inserted\", this.handleObjectAdded, this, false);\n this._mapImages = mapImages;\n this._mapObjects = mapImages;\n }\n\n return this._mapImages;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * (Re)validates data element, effectively triggering its redrawal.\r\n *\r\n * @ignore Exclude from docs\r\n * @param dataItem Data item\r\n */\n\n MapImageSeries.prototype.validateDataElement = function (dataItem) {\n _super.prototype.validateDataElement.call(this, dataItem);\n\n dataItem.mapImage.invalidate();\n };\n /**\r\n * (Re)validates the series\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapImageSeries.prototype.validate = function () {\n _super.prototype.validate.call(this);\n\n $iter.each(this.mapImages.iterator(), function (mapImage) {\n mapImage.validatePosition();\n });\n };\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\n\n\n MapImageSeries.prototype.copyFrom = function (source) {\n this.mapImages.template.copyFrom(source.mapImages.template);\n\n _super.prototype.copyFrom.call(this, source);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapImageSeries.prototype.getFeatures = function () {\n var _this = this;\n\n var features = [];\n this.dataItems.each(function (dataItem) {\n var feature = dataItem.getFeature();\n\n if (feature) {\n features.push(feature);\n }\n });\n this.mapImages.each(function (mapImage) {\n if (_this.dataItems.indexOf(mapImage._dataItem) == -1) {\n var feature = mapImage.getFeature();\n\n if (feature) {\n features.push(feature);\n }\n }\n });\n return features;\n };\n /**\r\n * returns MapImage by id\r\n * @param image id\r\n * @return {MapImage}\r\n */\n\n\n MapImageSeries.prototype.getImageById = function (id) {\n return $iter.find(this.mapImages.iterator(), function (mapImage) {\n var dataContext = mapImage.dataItem.dataContext;\n\n if (mapImage.id == id || dataContext && dataContext.id == id) {\n return true;\n }\n });\n };\n\n return MapImageSeries;\n}(MapSeries);\n\nexport { MapImageSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapImageSeries\"] = MapImageSeries;\nregistry.registeredClasses[\"MapImageSeriesDataItem\"] = MapImageSeriesDataItem;","/**\r\n * Map line module\r\n */\nimport { __extends, __values } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapObject } from \"./MapObject\";\nimport { MapLineObject } from \"./MapLineObject\";\nimport { MapImage } from \"./MapImage\";\nimport { MapImageSeries } from \"./MapImageSeries\";\nimport { Triangle } from \"../../core/elements/Triangle\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { Polyline } from \"../../core/elements/Polyline\";\nimport { registry } from \"../../core/Registry\";\nimport { color } from \"../../core/utils/Color\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { percent, Percent } from \"../../core/utils/Percent\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $geo from \"./Geo\";\nimport * as $mapUtils from \"./MapUtils\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a line on the map.\r\n *\r\n * @see {@link IMapLineEvents} for a list of available events\r\n * @see {@link IMapLineAdapters} for a list of available Adapters\r\n */\n\nvar MapLine =\n/** @class */\nfunction (_super) {\n __extends(MapLine, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapLine() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * A list of event disposers for images.\r\n */\n\n\n _this._imageListeners = {};\n _this.className = \"MapLine\";\n\n _this.createLine();\n\n _this.line.stroke = color();\n _this.line.parent = _this;\n _this.strokeOpacity = 1;\n\n _this.setPropertyValue(\"precision\", 0.1);\n\n var interfaceColors = new InterfaceColorSet();\n _this.stroke = interfaceColors.getFor(\"grid\");\n _this.shortestDistance = true; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapLine.prototype.createLine = function () {\n this.line = new Polyline();\n };\n /**\r\n * Converts a position within the line (0-1) to a physical point\r\n * coordinates.\r\n *\r\n * 0 indicates start of the line, 0.5 - middle, while 1 indicates the end.\r\n *\r\n * @param position Position (0-1)\r\n * @return Coordinates\r\n */\n\n\n MapLine.prototype.positionToPoint = function (position) {\n if (this.shortestDistance) {\n return this.series.chart.projection.positionToPoint(this.multiGeoLine, position);\n } else {\n if (this.line) {\n return this.line.positionToPoint(position);\n }\n }\n\n return {\n x: 0,\n y: 0,\n angle: 0\n };\n };\n\n Object.defineProperty(MapLine.prototype, \"multiGeoLine\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n var multiGeoLine = this.getPropertyValue(\"multiGeoLine\");\n\n if (!multiGeoLine && this.dataItem && this.dataItem.multiGeoLine) {\n multiGeoLine = this.dataItem.multiGeoLine;\n }\n\n return multiGeoLine;\n },\n\n /**\r\n * A collection of X/Y coordinates for a multi-segment line. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * // Segment 1\r\n * [\r\n * { longitude: 3.121, latitude: 0.58 },\r\n * { longitude: -5.199, latitude: 21.223 }\r\n * ],\r\n *\r\n * // Segment 2\r\n * [\r\n * { longitude: -5.199, latitude: 21.223 },\r\n * { longitude: -12.9, latitude: 25.85 }\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @see {@link https://tools.ietf.org/html/rfc7946#section-3.1.5} GeoJSON MultiLineString reference\r\n * @param multiGeoLine Coordinates\r\n */\n set: function set(multiGeoLine) {\n if (multiGeoLine && multiGeoLine.length > 0) {\n this.setPropertyValue(\"multiGeoLine\", $geo.normalizeMultiline(multiGeoLine), true);\n var multiLine = $mapUtils.multiGeoLineToMultiLine(multiGeoLine);\n this.setPropertyValue(\"multiLine\", multiLine);\n this.updateExtremes();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLine.prototype, \"multiLine\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n var multiLine = this.getPropertyValue(\"multiLine\");\n\n if (!multiLine && this.dataItem && this.dataItem.multiLine) {\n multiLine = this.dataItem.multiLine;\n }\n\n return multiLine;\n },\n\n /**\r\n * A collection of X/Y coordinates for a multi-segment line. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * // Segment 1\r\n * [\r\n * [ 100, 150 ],\r\n * [ 120, 200 ]\r\n * ],\r\n *\r\n * // Segment 2\r\n * [\r\n * [ 120, 200 ],\r\n * [ 150, 100 ]\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @param multiLine Coordinates\r\n */\n set: function set(multiLine) {\n this.setPropertyValue(\"multiLine\", multiLine);\n this.multiGeoLine = $mapUtils.multiLineToGeo(multiLine);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLine.prototype, \"imagesToConnect\", {\n /**\r\n * @return {MapImages[]}\r\n */\n get: function get() {\n return this.getPropertyValue(\"imagesToConnect\");\n },\n\n /**\r\n * Instead of setting longitudes/latitudes you can set an array of images\r\n * which will be connected by the line.\r\n *\r\n * Parameter is an array that can hold string `id`'s to of the images, or\r\n * references to actual [[MapImage]] objects.\r\n *\r\n * @param images Images\r\n */\n set: function set(images) {\n var _this = this;\n\n this.setPropertyValue(\"imagesToConnect\", images, true);\n this.handleImagesToConnect();\n\n if (this.series) {\n var chart = this.series.chart;\n\n if (chart) {\n chart.series.each(function (series) {\n if (series instanceof MapImageSeries) {\n if (!series.isReady()) {\n _this._disposers.push(series.events.on(\"ready\", _this.handleImagesToConnect, _this, false));\n }\n }\n });\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n\n MapLine.prototype.handleImagesToConnect = function () {\n var e_1, _a;\n\n var _this = this;\n\n if (this.imagesToConnect) {\n var segment = [];\n var multiGeoLine = [segment];\n\n var _loop_1 = function _loop_1(image) {\n if ($type.isString(image)) {\n var chart = this_1.series.chart;\n\n if (chart) {\n chart.series.each(function (series) {\n if (series instanceof MapImageSeries) {\n var img = series.getImageById(image);\n\n if (img) {\n image = img;\n }\n }\n });\n }\n }\n\n if (image instanceof MapImage) {\n segment.push({\n longitude: image.longitude,\n latitude: image.latitude\n });\n\n if (!this_1._imageListeners[image.uid]) {\n var disposer = image.events.on(\"propertychanged\", function (event) {\n if (event.property == \"longitude\" || event.property == \"latitude\") {\n _this.handleImagesToConnect();\n\n _this.invalidate();\n }\n }, this_1, false);\n this_1._imageListeners[image.uid] = disposer;\n\n this_1._disposers.push(disposer);\n }\n }\n };\n\n var this_1 = this;\n\n try {\n for (var _b = __values(this.imagesToConnect), _c = _b.next(); !_c.done; _c = _b.next()) {\n var image = _c.value;\n\n _loop_1(image);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n this.multiGeoLine = multiGeoLine;\n }\n };\n /**\r\n * (Re)validates the line, effectively forcing it to redraw.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapLine.prototype.validate = function () {\n var chart = this.series.chart;\n\n if (this.multiLine) {\n if (!this.shortestDistance) {\n var convertedPoints = [];\n\n for (var i = 0, len = this.multiLine.length; i < len; i++) {\n var segment = this.multiLine[i];\n var convertedSegmentPoints = [];\n\n for (var s = 0, slen = segment.length; s < slen; s++) {\n var geoPoint = segment[s];\n var point = this.series.chart.projection.convert({\n longitude: geoPoint[0],\n latitude: geoPoint[1]\n });\n convertedSegmentPoints.push(point);\n }\n\n convertedPoints.push(convertedSegmentPoints);\n }\n\n this.line.segments = convertedPoints;\n } else {\n chart.projection.d3Projection.precision(this.precision);\n this.line.path = chart.projection.d3Path(this.getFeature());\n }\n\n if (this._arrow) {\n this._arrow.validatePosition();\n }\n\n $iter.each(this.lineObjects.iterator(), function (x) {\n x.validatePosition();\n });\n this.handleGlobalScale();\n } else if (this.imagesToConnect) {\n this.handleImagesToConnect();\n }\n\n _super.prototype.validate.call(this);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapLine.prototype.getFeature = function () {\n if (this.multiLine && this.multiLine.length > 0 && this.multiLine[0] && this.multiLine[0].length > 0) {\n return {\n \"type\": \"Feature\",\n geometry: {\n type: \"MultiLineString\",\n coordinates: this.multiLine\n }\n };\n }\n };\n /**\r\n * @ignore Exclude from docs\r\n */\n\n\n MapLine.prototype.measureElement = function () {// Overriding, just to avoid extra measure\n };\n\n Object.defineProperty(MapLine.prototype, \"shortestDistance\", {\n /**\r\n * @return Real path?\r\n */\n get: function get() {\n return this.getPropertyValue(\"shortestDistance\");\n },\n\n /**\r\n * The line should take the shortest path over the globe.\r\n *\r\n * Enabling this will make the line look differently in different\r\n * projections. Only `MapLine` supports this setting, `MapArc` and\r\n * `MapSplice` don't.\r\n *\r\n * @default true\r\n * @param value Real path?\r\n */\n set: function set(value) {\n this.setPropertyValue(\"shortestDistance\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLine.prototype, \"lineObjects\", {\n /**\r\n * List of separate line objects the line consists of.\r\n *\r\n * @readonly\r\n * @return List of line objects\r\n */\n get: function get() {\n if (!this._lineObjects) {\n this._lineObjects = new ListTemplate(new MapLineObject());\n\n this._lineObjects.events.on(\"inserted\", this.handleLineObjectAdded, this, false);\n\n this._disposers.push(new ListDisposer(this._lineObjects));\n\n this._disposers.push(this._lineObjects.template);\n }\n\n return this._lineObjects;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Decorate a [[LineObject]] when it is added to the line.\r\n *\r\n * @param event Event\r\n */\n\n MapLine.prototype.handleLineObjectAdded = function (event) {\n var mapLineObject = event.newValue;\n mapLineObject.mapLine = this;\n mapLineObject.shouldClone = false;\n mapLineObject.parent = this;\n };\n\n Object.defineProperty(MapLine.prototype, \"arrow\", {\n /**\r\n * @return Arrow element\r\n */\n get: function get() {\n if (!this._arrow) {\n var arrow = this.createChild(MapLineObject);\n arrow.shouldClone = false;\n arrow.width = 8;\n arrow.height = 10;\n arrow.mapLine = this;\n arrow.position = 0.5;\n var triangle = arrow.createChild(Triangle); //triangle.shouldClone = false;\n\n triangle.fillOpacity = 1;\n triangle.width = percent(100);\n triangle.height = percent(100);\n triangle.rotation = 90;\n triangle.horizontalCenter = \"middle\";\n triangle.verticalCenter = \"middle\";\n this._arrow = arrow;\n }\n\n return this._arrow;\n },\n\n /**\r\n * A [[MapLineObject]] to use as an option arrowhead on the line.\r\n *\r\n * Just accessing this property will create a default arrowhead on the line\r\n * automatically.\r\n *\r\n * @param arrow Arrow element\r\n */\n set: function set(arrow) {\n this._arrow = arrow;\n arrow.mapLine = this;\n arrow.parent = this;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Copies line properties and other attributes, like arrow, from another\r\n * instance of [[MapLine]].\r\n *\r\n * @param source Source map line\r\n */\n\n MapLine.prototype.copyFrom = function (source) {\n _super.prototype.copyFrom.call(this, source);\n\n this.line.copyFrom(source.line);\n this.lineObjects.copyFrom(source.lineObjects);\n\n if (source._arrow) {\n this.arrow = source.arrow.clone();\n }\n };\n\n Object.defineProperty(MapLine.prototype, \"latitude\", {\n /**\r\n * Latitude of the line center.\r\n *\r\n * @readonly\r\n * @return Latitude\r\n */\n get: function get() {\n return this.north + (this.south - this.north) / 2;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLine.prototype, \"longitude\", {\n /**\r\n * Longitude of the line center.\r\n *\r\n * @readonly\r\n * @return Latitude\r\n */\n get: function get() {\n return this.east + (this.west - this.east) / 2;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * X coordinate for the slice tooltip.\r\n *\r\n * @ignore\r\n * @return X\r\n */\n\n MapLine.prototype.getTooltipX = function () {\n var x = this.getPropertyValue(\"tooltipX\");\n\n if (!(x instanceof Percent)) {\n x = percent(50);\n }\n\n if (x instanceof Percent) {\n return this.positionToPoint(x.value).x;\n } else {\n return 0;\n }\n };\n /**\r\n * Y coordinate for the slice tooltip.\r\n *\r\n * @ignore\r\n * @return Y\r\n */\n\n\n MapLine.prototype.getTooltipY = function () {\n var y = this.getPropertyValue(\"tooltipY\");\n\n if (!(y instanceof Percent)) {\n y = percent(50);\n }\n\n if (y instanceof Percent) {\n return this.positionToPoint(y.value).y;\n } else {\n return 0;\n }\n };\n\n Object.defineProperty(MapLine.prototype, \"precision\", {\n /**\r\n * @return Precision\r\n */\n get: function get() {\n return this.getPropertyValue(\"precision\");\n },\n\n /**\r\n * When line is plotted, if its `shortestDistance` is set to `true` it is\r\n * bent according to the used projection, to depict the shortest distance how\r\n * it would go on the actual land.\r\n *\r\n * `precision` introduces a setting which can control when such bending\r\n * occurs.\r\n *\r\n * If the distance (in degrees) between line start and end points\r\n * is less than `precision`, no bending will take place and the line will be\r\n * straight.\r\n *\r\n * Set to large number (e.g. 10000) for perfectly straight line.\r\n *\r\n * @since 4.9.1\r\n * @default 0.1\r\n * @param value Precision\r\n */\n set: function set(value) {\n this.setPropertyValue(\"precision\", value, true);\n },\n enumerable: true,\n configurable: true\n });\n return MapLine;\n}(MapObject);\n\nexport { MapLine };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapLine\"] = MapLine;","/**\r\n * Map line series module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapSeries, MapSeriesDataItem } from \"./MapSeries\";\nimport { MapLine } from \"./MapLine\";\nimport { ListTemplate, ListDisposer } from \"../../core/utils/List\";\nimport { registry } from \"../../core/Registry\";\nimport * as $mapUtils from \"./MapUtils\";\nimport * as $array from \"../../core/utils/Array\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport { Disposer } from \"../../core/utils/Disposer\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapLineSeries]]\r\n * @see {@link DataItem}\r\n */\n\nvar MapLineSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapLineSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapLineSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapLineSeriesDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n MapLineSeriesDataItem.prototype.getFeature = function () {\n if (this.multiLine && this.multiLine.length > 0) {\n return {\n \"type\": \"Feature\",\n geometry: {\n type: \"MultiLineString\",\n coordinates: this.multiLine\n }\n };\n }\n };\n\n Object.defineProperty(MapLineSeriesDataItem.prototype, \"mapLine\", {\n /**\r\n * A [[MapLine]] element related to this data item.\r\n *\r\n * @readonly\r\n * @return Element\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._mapLine) {\n var mapLine_1 = this.component.mapLines.create();\n this._mapLine = mapLine_1;\n this.addSprite(mapLine_1);\n\n this._disposers.push(mapLine_1);\n\n this._disposers.push(new Disposer(function () {\n if (_this.component) {\n _this.component.mapLines.removeValue(mapLine_1);\n }\n }));\n\n this.mapObject = mapLine_1;\n }\n\n return this._mapLine;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLineSeriesDataItem.prototype, \"line\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._line;\n },\n\n /**\r\n * A collection of X/Y coordinates for a single-segment line. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * [ 100, 150 ],\r\n * [ 120, 200 ]\r\n * ]\r\n * ```\r\n *\r\n * @param line Coordinates\r\n */\n set: function set(line) {\n this._line = line;\n this.multiLine = [line];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLineSeriesDataItem.prototype, \"multiLine\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._multiLine;\n },\n\n /**\r\n * A collection of X/Y coordinates for a multi-segment line. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * // Segment 1\r\n * [\r\n * [ 100, 150 ],\r\n * [ 120, 200 ]\r\n * ],\r\n *\r\n * // Segment 2\r\n * [\r\n * [ 120, 200 ],\r\n * [ 150, 100 ]\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @param multiLine Coordinates\r\n */\n set: function set(multiLine) {\n this._multiLine = multiLine;\n this._multiGeoLine = $mapUtils.multiLineToGeo(multiLine);\n this.updateExtremes();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLineSeriesDataItem.prototype, \"geoLine\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._geoLine;\n },\n\n /**\r\n * A collection of lat/long coordinates for a single-segment line. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * { longitude: 3.121, latitude: 0.58 },\r\n * { longitude: -5.199, latitude: 21.223 }\r\n * ]\r\n * ```\r\n *\r\n * @see {@link https://tools.ietf.org/html/rfc7946#section-3.1.4} GeoJSON LineString reference\r\n * @param geoLine Coordinates\r\n */\n set: function set(geoLine) {\n this._geoLine = geoLine;\n this.multiLine = $mapUtils.multiGeoLineToMultiLine([geoLine]);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapLineSeriesDataItem.prototype, \"multiGeoLine\", {\n /**\r\n * @return Coordinates\r\n */\n get: function get() {\n return this._multiGeoLine;\n },\n\n /**\r\n * A collection of X/Y coordinates for a multi-segment line. E.g.:\r\n *\r\n * ```JSON\r\n * [\r\n * // Segment 1\r\n * [\r\n * { longitude: 3.121, latitude: 0.58 },\r\n * { longitude: -5.199, latitude: 21.223 }\r\n * ],\r\n *\r\n * // Segment 2\r\n * [\r\n * { longitude: -5.199, latitude: 21.223 },\r\n * { longitude: -12.9, latitude: 25.85 }\r\n * ]\r\n * ]\r\n * ```\r\n *\r\n * @see {@link https://tools.ietf.org/html/rfc7946#section-3.1.5} GeoJSON MultiLineString reference\r\n * @param multiGeoLine Coordinates\r\n */\n set: function set(multiGeoLine) {\n this._multiGeoLine = multiGeoLine;\n this.multiLine = $mapUtils.multiGeoLineToMultiLine(multiGeoLine);\n },\n enumerable: true,\n configurable: true\n });\n return MapLineSeriesDataItem;\n}(MapSeriesDataItem);\n\nexport { MapLineSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A series of map line series.\r\n *\r\n * @see {@link IMapLineSeriesEvents} for a list of available Events\r\n * @see {@link IMapLineSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar MapLineSeries =\n/** @class */\nfunction (_super) {\n __extends(MapLineSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapLineSeries() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"MapLineSeries\"; // Set data fields\n\n _this.dataFields.multiLine = \"multiLine\";\n _this.dataFields.line = \"line\";\n _this.dataFields.geoLine = \"geoLine\";\n _this.dataFields.multiGeoLine = \"multiGeoLine\";\n _this.ignoreBounds = true; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n MapLineSeries.prototype.createDataItem = function () {\n return new MapLineSeriesDataItem();\n };\n /**\r\n * (Re)validates series data, effectively causing the whole series to be\r\n * redrawn.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapLineSeries.prototype.validateData = function () {\n // process geoJSON and created map objects\n if (this.useGeodata || this.geodata) {\n var geoJSON = this.chart.geodata;\n\n if (geoJSON) {\n var features = void 0;\n\n if (geoJSON.type == \"FeatureCollection\") {\n features = geoJSON.features;\n } else if (geoJSON.type == \"Feature\") {\n features = [geoJSON];\n } else if ([\"Point\", \"LineString\", \"Polygon\", \"MultiPoint\", \"MultiLineString\", \"MultiPolygon\"].indexOf(geoJSON.type) != -1) {\n features = [{\n geometry: geoJSON\n }];\n } else {\n console.log(\"nothing found in geoJSON\");\n }\n\n if (features) {\n var _loop_1 = function _loop_1(i, len) {\n var feature = features[i];\n var geometry = feature.geometry;\n\n if (geometry) {\n var type = geometry.type;\n var id_1 = feature.id;\n\n if (type == \"LineString\" || type == \"MultiLineString\") {\n if (!this_1.checkInclude(this_1.include, this_1.exclude, id_1)) {\n return \"continue\";\n }\n\n var coordinates = geometry.coordinates;\n var dataObject = $array.find(this_1.data, function (value, i) {\n return value.id == id_1;\n });\n\n if (type == \"LineString\") {\n coordinates = [coordinates];\n }\n\n if (!dataObject) {\n dataObject = {\n multiLine: coordinates,\n id: id_1,\n madeFromGeoData: true\n };\n this_1.data.push(dataObject);\n } else {\n if (!dataObject.multiLine) {\n dataObject.multiLine = coordinates;\n }\n } // copy properties data to datacontext\n\n\n $utils.softCopyProperties(feature.properties, dataObject);\n }\n }\n };\n\n var this_1 = this;\n\n for (var i = 0, len = features.length; i < len; i++) {\n _loop_1(i, len);\n }\n }\n }\n }\n\n _super.prototype.validateData.call(this);\n };\n\n Object.defineProperty(MapLineSeries.prototype, \"mapLines\", {\n /**\r\n * A list of lines in the series.\r\n *\r\n * @return Lines\r\n */\n get: function get() {\n if (!this._mapLines) {\n var lineTemplate = this.createLine();\n var mapLines = new ListTemplate(lineTemplate);\n\n this._disposers.push(new ListDisposer(mapLines));\n\n this._disposers.push(mapLines.template);\n\n mapLines.events.on(\"inserted\", this.handleObjectAdded, this, false);\n this._mapLines = mapLines;\n this._mapObjects = mapLines;\n }\n\n return this._mapLines;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Returns a new line instance of suitable type.\r\n *\r\n * @return New line\r\n */\n\n MapLineSeries.prototype.createLine = function () {\n return new MapLine();\n };\n /**\r\n * (Re)validates the series\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapLineSeries.prototype.validate = function () {\n this.dataItems.each(function (dataItem) {\n $utils.used(dataItem.mapLine);\n });\n\n _super.prototype.validate.call(this);\n\n this.mapLines.each(function (mapLine) {\n mapLine.validate();\n });\n };\n /**\r\n * Copies all properties from another instance of [[Series]].\r\n *\r\n * @param source Source series\r\n */\n\n\n MapLineSeries.prototype.copyFrom = function (source) {\n this.mapLines.template.copyFrom(source.mapLines.template);\n\n _super.prototype.copyFrom.call(this, source);\n };\n /**\r\n * @ignore\r\n */\n\n\n MapLineSeries.prototype.getFeatures = function () {\n var _this = this;\n\n var features = [];\n this.dataItems.each(function (dataItem) {\n var feature = dataItem.getFeature();\n\n if (feature) {\n features.push(feature);\n }\n });\n this.mapLines.each(function (mapLine) {\n if (_this.dataItems.indexOf(mapLine._dataItem) == -1) {\n var feature = mapLine.getFeature();\n\n if (feature) {\n features.push(feature);\n }\n }\n });\n return features;\n };\n /**\r\n * returns MapLine by id\r\n * @param line id\r\n * @return {MapLine}\r\n */\n\n\n MapLineSeries.prototype.getLineById = function (id) {\n return $iter.find(this.mapLines.iterator(), function (mapLine) {\n var dataContext = mapLine.dataItem.dataContext;\n return dataContext.id == id;\n });\n };\n\n return MapLineSeries;\n}(MapSeries);\n\nexport { MapLineSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapLineSeries\"] = MapLineSeries;\nregistry.registeredClasses[\"MapLineSeriesDataItem\"] = MapLineSeriesDataItem;","/**\r\n * Graticule (map grid line).\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapLine } from \"./MapLine\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Graticule is a map line spanning from the poles or around the globe.\r\n *\r\n * @since 4.3.0\r\n * @see {@link IGraticuleEvents} for a list of available events\r\n * @see {@link IGraticuleAdapters} for a list of available Adapters\r\n */\n\nvar Graticule =\n/** @class */\nfunction (_super) {\n __extends(Graticule, _super);\n /**\r\n * Constructor\r\n */\n\n\n function Graticule() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"Graticule\"; // Apply theme\n\n _this.applyTheme();\n\n _this.shortestDistance = true;\n return _this;\n }\n\n return Graticule;\n}(MapLine);\n\nexport { Graticule };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Graticule\"] = Graticule;","export default function (start, stop, step) {\n start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n var i = -1,\n n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n range = new Array(n);\n\n while (++i < n) {\n range[i] = start + i * step;\n }\n\n return range;\n}","import { range } from \"d3-array\";\nimport { abs, ceil, epsilon } from \"./math.js\";\n\nfunction graticuleX(y0, y1, dy) {\n var y = range(y0, y1 - epsilon, dy).concat(y1);\n return function (x) {\n return y.map(function (y) {\n return [x, y];\n });\n };\n}\n\nfunction graticuleY(x0, x1, dx) {\n var x = range(x0, x1 - epsilon, dx).concat(x1);\n return function (y) {\n return x.map(function (x) {\n return [x, y];\n });\n };\n}\n\nexport default function graticule() {\n var x1,\n x0,\n X1,\n X0,\n y1,\n y0,\n Y1,\n Y0,\n dx = 10,\n dy = dx,\n DX = 90,\n DY = 360,\n x,\n y,\n X,\n Y,\n precision = 2.5;\n\n function graticule() {\n return {\n type: \"MultiLineString\",\n coordinates: lines()\n };\n }\n\n function lines() {\n return range(ceil(X0 / DX) * DX, X1, DX).map(X).concat(range(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(range(ceil(x0 / dx) * dx, x1, dx).filter(function (x) {\n return abs(x % DX) > epsilon;\n }).map(x)).concat(range(ceil(y0 / dy) * dy, y1, dy).filter(function (y) {\n return abs(y % DY) > epsilon;\n }).map(y));\n }\n\n graticule.lines = function () {\n return lines().map(function (coordinates) {\n return {\n type: \"LineString\",\n coordinates: coordinates\n };\n });\n };\n\n graticule.outline = function () {\n return {\n type: \"Polygon\",\n coordinates: [X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1))]\n };\n };\n\n graticule.extent = function (_) {\n if (!arguments.length) return graticule.extentMinor();\n return graticule.extentMajor(_).extentMinor(_);\n };\n\n graticule.extentMajor = function (_) {\n if (!arguments.length) return [[X0, Y0], [X1, Y1]];\n X0 = +_[0][0], X1 = +_[1][0];\n Y0 = +_[0][1], Y1 = +_[1][1];\n if (X0 > X1) _ = X0, X0 = X1, X1 = _;\n if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.extentMinor = function (_) {\n if (!arguments.length) return [[x0, y0], [x1, y1]];\n x0 = +_[0][0], x1 = +_[1][0];\n y0 = +_[0][1], y1 = +_[1][1];\n if (x0 > x1) _ = x0, x0 = x1, x1 = _;\n if (y0 > y1) _ = y0, y0 = y1, y1 = _;\n return graticule.precision(precision);\n };\n\n graticule.step = function (_) {\n if (!arguments.length) return graticule.stepMinor();\n return graticule.stepMajor(_).stepMinor(_);\n };\n\n graticule.stepMajor = function (_) {\n if (!arguments.length) return [DX, DY];\n DX = +_[0], DY = +_[1];\n return graticule;\n };\n\n graticule.stepMinor = function (_) {\n if (!arguments.length) return [dx, dy];\n dx = +_[0], dy = +_[1];\n return graticule;\n };\n\n graticule.precision = function (_) {\n if (!arguments.length) return precision;\n precision = +_;\n x = graticuleX(y0, y1, 90);\n y = graticuleY(x0, x1, precision);\n X = graticuleX(Y0, Y1, 90);\n Y = graticuleY(X0, X1, precision);\n return graticule;\n };\n\n return graticule.extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]).extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]);\n}\nexport function graticule10() {\n return graticule()();\n}","/**\r\n * Graticule (map grid) series functionality.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapLineSeries, MapLineSeriesDataItem } from \"./MapLineSeries\";\nimport { Graticule } from \"./Graticule\";\nimport { registry } from \"../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\nimport * as $array from \"../../core/utils/Array\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[GraticuleSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar GraticuleSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(GraticuleSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function GraticuleSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"GraticuleSeriesDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n return GraticuleSeriesDataItem;\n}(MapLineSeriesDataItem);\n\nexport { GraticuleSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * This class is used to create a set of graticules (map grid).\r\n *\r\n * To enable, create like you would create any regular map series:\r\n *\r\n * ```TypeScript\r\n * let graticule = chart.series.push(new am4maps.GraticuleSeries())\r\n * graticule.mapLines.template.line.stroke = am4core.color(\"#000000\");\r\n * graticule.mapLines.template.line.strokeOpacity = 0.1;\r\n * ```\r\n * ```JavaScript\r\n * var graticule = chart.series.push(new am4maps.GraticuleSeries())\r\n * graticule.mapLines.template.line.stroke = am4core.color(\"#000000\");\r\n * graticule.mapLines.template.line.strokeOpacity = 0.1;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * \"type\": \"GraticuleSeries\",\r\n * \"mapLines\": {\r\n * \"line\": {\r\n * \"stroke\": \"#000000\",\r\n * \"strokeOpacity\": 0.1\r\n * }\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @since 4.3.0\r\n * @see {@link IGraticuleSeriesEvents} for a list of available Events\r\n * @see {@link IGraticuleSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar GraticuleSeries =\n/** @class */\nfunction (_super) {\n __extends(GraticuleSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function GraticuleSeries() {\n var _this = _super.call(this) || this;\n\n _this.className = \"GraticuleSeries\";\n _this.longitudeStep = 10;\n _this.latitudeStep = 10;\n _this.north = 90;\n _this.south = -90;\n _this.east = -180;\n _this.west = 180; //this.majorLatitudeStep = 90;\n //this.majorLongitudeStep = 360;\n\n _this.fitExtent = true;\n _this.singleSprite = true;\n\n _this.events.disableType(\"geoBoundsChanged\");\n\n _this.mapLines.template.line.strokeOpacity = 0.08;\n _this.ignoreBounds = false;\n _this.hiddenInLegend = true;\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n GraticuleSeries.prototype.createDataItem = function () {\n return new GraticuleSeriesDataItem();\n };\n\n GraticuleSeries.prototype.validateData = function () {\n var _this = this;\n\n _super.prototype.validateData.call(this);\n\n this.mapLines.clear();\n var graticule = d3geo.geoGraticule();\n\n if (graticule) {\n graticule.stepMinor([this.longitudeStep, this.latitudeStep]);\n graticule.stepMajor([360, 360]);\n var chart = this.chart;\n\n if (this.fitExtent) {\n graticule.extent([[chart.east, chart.north], [chart.west, chart.south]]);\n } else {\n graticule.extent([[this.east, this.north], [this.west, this.south]]);\n }\n\n if (this.singleSprite) {\n var mapLine = this.mapLines.create();\n mapLine.multiLine = graticule().coordinates;\n } else {\n var lineStrings = graticule.lines();\n $array.each(lineStrings, function (lineString) {\n var mapLine = _this.mapLines.create();\n\n mapLine.multiLine = [lineString.coordinates];\n });\n }\n }\n };\n /**\r\n * Returns a new line instance of suitable type.\r\n *\r\n * @return New line\r\n */\n\n\n GraticuleSeries.prototype.createLine = function () {\n return new Graticule();\n };\n\n Object.defineProperty(GraticuleSeries.prototype, \"latitudeStep\", {\n /**\r\n * @return Step\r\n */\n get: function get() {\n return this.getPropertyValue(\"latitudeStep\");\n },\n\n /**\r\n * Draw a graticule (grid) every X degrees of latitude.\r\n *\r\n * @default 10\r\n * @param value Step\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"latitudeStep\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GraticuleSeries.prototype, \"longitudeStep\", {\n /**\r\n * @return Step\r\n */\n get: function get() {\n return this.getPropertyValue(\"longitudeStep\");\n },\n\n /**\r\n * Draw a graticule (grid) every X degrees of longitude.\r\n *\r\n * @default 10\r\n * @param value Step\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"longitudeStep\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GraticuleSeries.prototype, \"fitExtent\", {\n /**\r\n * @return Fit?\r\n */\n get: function get() {\n return this.getPropertyValue(\"fitExtent\");\n },\n\n /**\r\n * Draw a thicker (major) graticule every X degrees of latitude.\r\n *\r\n * @default 90\r\n * @param value Step\r\n */\n // public set majorLatitudeStep(value: number) {\n // \tif (this.setPropertyValue(\"majorLatitudeStep\", value)) {\n // \t\tthis.invalidateData();\n // \t}\n // }\n\n /**\r\n * @return Step\r\n */\n // public get majorLatitudeStep(): number {\n // \treturn this.getPropertyValue(\"majorLatitudeStep\");\n // }\n\n /**\r\n * Draw a thicker (major) graticule every X degrees of longitude.\r\n *\r\n * @default 360\r\n * @param value Step\r\n */\n // public set majorLongitudeStep(value: number) {\n // \tif (this.setPropertyValue(\"majorLongitudeStep\", value)) {\n // \t\tthis.invalidateData();\n // \t}\n // }\n\n /**\r\n * @return Step\r\n */\n // public get majorLongitudeStep(): number {\n // \treturn this.getPropertyValue(\"majorLongitudeStep\");\n // }\n\n /**\r\n * Whether to cap graticules (grid) to actual span of the map (`true`), e.g.\r\n * where there are polygons, or draw full-world grid (`false`).\r\n *\r\n * For world maps, using `false` makes sense. For smaller maps - not so much.\r\n *\r\n * If set to `false`, the grid will be drawn from this series `east` to\r\n * `west`, and from `south` to `north` (default values: `east = -180`;\r\n * `west = 180`; `south =-90`; `north =90`).\r\n *\r\n * These can be overridden by setting `GraticuleSeries`' respective\r\n * properties.\r\n *\r\n * @default true\r\n * @param value Fit?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"fitExtent\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GraticuleSeries.prototype, \"singleSprite\", {\n /**\r\n * @return Use single sprite?\r\n */\n get: function get() {\n return this.getPropertyValue(\"singleSprite\");\n },\n\n /**\r\n * Whether to draw all the grid as a single element or as separate lines.\r\n *\r\n * Setting `true` (default) will result in better performance, whereas\r\n * `false` allows setting visual properties of each line individually.\r\n *\r\n * @default true\r\n * @param value Use single sprite?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"singleSprite\", value)) {\n this.invalidateData();\n }\n },\n enumerable: true,\n configurable: true\n });\n return GraticuleSeries;\n}(MapLineSeries);\n\nexport { GraticuleSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"GraticuleSeries\"] = GraticuleSeries;\nregistry.registeredClasses[\"GraticuleSeriesDataItem\"] = GraticuleSeriesDataItem;","/**\r\n * Map module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { SerialChart, SerialChartDataItem } from \"./SerialChart\";\nimport { Disposer } from \"../../core/utils/Disposer\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\nimport { MapSeries } from \"../map/MapSeries\";\nimport { MapImage } from \"../map/MapImage\";\nimport { MapPolygon } from \"../map/MapPolygon\";\nimport { MapPolygonSeries } from \"../map/MapPolygonSeries\";\nimport { Projection } from \"../map/projections/Projection\";\nimport { Circle } from \"../../core/elements/Circle\";\nimport { SmallMap } from \"../map/SmallMap\";\nimport * as $mapUtils from \"../map/MapUtils\";\nimport { keyboard } from \"../../core/utils/Keyboard\";\nimport { registry } from \"../../core/Registry\";\nimport { options } from \"../../core/Options\";\nimport * as $math from \"../../core/utils/Math\";\nimport * as $utils from \"../../core/utils/Utils\";\nimport * as $ease from \"../../core/utils/Ease\";\nimport * as $iter from \"../../core/utils/Iterator\";\nimport * as $type from \"../../core/utils/Type\";\nimport * as $geo from \"../map/Geo\";\nimport { GraticuleSeries } from \"../map/GraticuleSeries\";\nimport { getInteraction } from \"../../core/interaction/Interaction\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapChart]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar MapChartDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapChartDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapChartDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapChartDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n return MapChartDataItem;\n}(SerialChartDataItem);\n\nexport { MapChartDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a map.\r\n *\r\n * @see {@link IMapChartEvents} for a list of available Events\r\n * @see {@link IMapChartAdapters} for a list of available Adapters\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/map/} for documentation\r\n */\n\nvar MapChart =\n/** @class */\nfunction (_super) {\n __extends(MapChart, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapChart() {\n var _this = // Init\n _super.call(this) || this;\n /**\r\n * A ratio to be used when scaling the map shapes.\r\n *\r\n * @readonly\r\n */\n\n\n _this.scaleRatio = 1;\n /**\r\n * Default duration of zoom animations (ms).\r\n */\n\n _this.zoomDuration = 1000;\n /**\r\n * Default zooming animation easing function.\r\n */\n\n _this.zoomEasing = $ease.cubicOut;\n /**\r\n * Smallest available zoom level. The map will not allow to zoom out past\r\n * this setting.\r\n *\r\n * NOTE: Should be power of 2.\r\n *\r\n * @default 1\r\n */\n\n _this.minZoomLevel = 1;\n /**\r\n * Biggest available zoom level. The map will not allow to zoom in past\r\n * this setting.\r\n *\r\n * NOTE: Should be power of 2.\r\n *\r\n * @default 32\r\n */\n\n _this.maxZoomLevel = 32;\n /**\r\n * [_prevZoomGeoPoint description]\r\n *\r\n * @todo Description\r\n */\n\n _this._prevZoomGeoPoint = {\n latitude: 0,\n longitude: 0\n };\n _this.className = \"MapChart\"; // Set default projection\n\n _this.projection = new Projection();\n\n _this.setPropertyValue(\"deltaLatitude\", 0);\n\n _this.setPropertyValue(\"deltaLongitude\", 0);\n\n _this.setPropertyValue(\"deltaGamma\", 0);\n\n _this.maxPanOut = 0.7;\n _this.homeZoomLevel = 1;\n _this.zoomStep = 2;\n _this.layout = \"absolute\";\n _this.centerMapOnZoomOut = true; // Set padding\n\n _this.padding(0, 0, 0, 0);\n\n $utils.used(_this.backgroundSeries); // so that the map would render in a hidden div too\n\n _this.minWidth = 10;\n _this.minHeight = 10;\n\n _this.events.once(\"inited\", _this.handleAllInited, _this, false); // Create a container for map series\n\n\n var seriesContainer = _this.seriesContainer;\n seriesContainer.visible = false;\n seriesContainer.inert = true;\n seriesContainer.resizable = true;\n seriesContainer.events.on(\"transformed\", _this.handleMapTransform, _this, false);\n seriesContainer.events.on(\"doublehit\", _this.handleDoubleHit, _this, false);\n seriesContainer.events.on(\"dragged\", _this.handleDrag, _this, false);\n seriesContainer.zIndex = 0;\n seriesContainer.dragWhileResize = true; //seriesContainer.background.fillOpacity = 0;\n\n seriesContainer.adapter.add(\"scale\", function (scale, target) {\n return $math.fitToRange(scale, _this.minZoomLevel, _this.maxZoomLevel);\n }); // Set up events\n //this.events.on(\"validated\", this.updateExtremes, this);\n //this.events.on(\"datavalidated\", this.handleAllValidated, this, false);\n //this.events.on(\"datavalidated\", this.updateExtremes, this, false);\n\n _this.events.on(\"maxsizechanged\", function (event) {\n if (event.previousWidth == 0 || event.previousHeight == 0) {\n _this.updateExtremes();\n\n _this.updateCenterGeoPoint();\n }\n }, undefined, false); // Set up main chart container, e.g. set backgrounds and events to monitor\n // size changes, etc.\n\n\n var chartContainer = _this.chartContainer;\n chartContainer.parent = _this;\n chartContainer.zIndex = -1;\n\n _this._disposers.push(_this.events.on(\"maxsizechanged\", function () {\n if (_this.inited) {\n if (_this._mapAnimation) {\n _this._mapAnimation.stop();\n }\n\n var allInited_1 = true;\n\n _this.series.each(function (series) {\n series.updateTooltipBounds();\n\n if (!series.inited || series.dataInvalid) {\n allInited_1 = false;\n }\n });\n\n if (allInited_1) {\n _this.updateScaleRatio();\n }\n\n _this.zoomToGeoPoint(_this._zoomGeoPointReal, _this.zoomLevel, true, 0);\n }\n }, undefined, false));\n\n var chartContainerBg = chartContainer.background;\n chartContainerBg.fillOpacity = 0;\n chartContainerBg.events.on(\"down\", function (e) {\n _this.seriesContainer.dragStart(e.target.interactions.downPointers.getIndex(0));\n }, _this);\n chartContainerBg.events.on(\"up\", function (e) {\n _this.seriesContainer.dragStop();\n }, _this);\n chartContainerBg.events.on(\"doublehit\", _this.handleDoubleHit, _this);\n chartContainerBg.focusable = true;\n chartContainer.events.on(\"down\", _this.handleMapDown, _this, false);\n\n _this.addDisposer(seriesContainer.events.on(\"down\", function () {\n // Cancel any move inertia if there is one\n var inertia = _this.seriesContainer.interactions.inertias.getKey(\"move\");\n\n if (inertia) {\n inertia.done();\n }\n })); // Add description to background\n\n\n _this.background.fillOpacity = 0; // Add keyboard events for panning\n\n _this._disposers.push(getInteraction().body.events.on(\"keyup\", function (ev) {\n if (_this.topParent.hasFocused) {\n var key = keyboard.getEventKey(ev.event);\n\n if (!_this._zoomControl || !_this._zoomControl.thumb.isFocused) {\n switch (key) {\n case \"up\":\n _this.pan({\n x: 0,\n y: 0.1\n });\n\n break;\n\n case \"down\":\n _this.pan({\n x: 0,\n y: -0.1\n });\n\n break;\n\n case \"left\":\n _this.pan({\n x: 0.1,\n y: 0\n });\n\n break;\n\n case \"right\":\n _this.pan({\n x: -0.1,\n y: 0\n });\n\n break;\n }\n }\n }\n }, _this));\n\n _this.mouseWheelBehavior = \"zoom\";\n var interaction = getInteraction();\n\n _this._disposers.push(interaction.body.events.on(\"down\", _this.handlePanDown, _this));\n\n _this._disposers.push(interaction.body.events.on(\"up\", _this.handlePanUp, _this)); //this._disposers.push(interaction.body.events.on(\"track\", this.handlePanMove, this));\n\n\n var panSprite = _this.seriesContainer.createChild(Circle);\n\n panSprite.radius = 10;\n panSprite.inert = true;\n panSprite.isMeasured = false;\n panSprite.events.on(\"transformed\", _this.handlePanMove, _this, false);\n panSprite.interactionsEnabled = false;\n panSprite.opacity = 0;\n panSprite.x = 0;\n panSprite.y = 0;\n _this.panSprite = panSprite;\n _this.panBehavior = \"move\";\n /*\r\n this.panSprite.inertiaOptions.setKey(\"move\", {\r\n \"time\": 100,\r\n \"duration\": 1000,\r\n \"factor\": 3,\r\n \"easing\": $ease.sinOut\r\n });*/\n // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapChart.prototype.handlePanDown = function (event) {\n var svgPoint = $utils.documentPointToSvg(event.pointer.point, this.htmlContainer);\n\n if (svgPoint.x > 0 && svgPoint.y > 0 && svgPoint.x < this.svgContainer.width && svgPoint.y < this.svgContainer.height) {\n // Get local point\n this._downPointOrig = $utils.documentPointToSprite(event.pointer.point, this.seriesContainer);\n this.panSprite.moveTo(this._downPointOrig);\n this.panSprite.dragStart(event.pointer);\n this._downDeltaLongitude = this.deltaLongitude;\n this._downDeltaLatitude = this.deltaLatitude;\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n MapChart.prototype.handlePanUp = function (event) {\n if (this._downPointOrig) {\n this.panSprite.dragStop(event.pointer, true);\n }\n\n this._downPointOrig = undefined;\n };\n /**\r\n * @ignore\r\n */\n\n\n MapChart.prototype.handlePanMove = function () {\n if (!this.seriesContainer.isResized) {\n if (getInteraction().areTransformed([this.panSprite.interactions, this.seriesContainer.interactions])) {\n return;\n }\n\n var d3Projection = this.projection.d3Projection;\n var panBehavior = this.panBehavior;\n\n if (panBehavior != \"move\" && panBehavior != \"none\" && this._downPointOrig && d3Projection.rotate) {\n var rotation = d3Projection.rotate();\n var dln = rotation[0];\n var dlt = rotation[1];\n var dlg = rotation[2];\n d3Projection.rotate([0, 0, 0]);\n var downGeoLocal = this.projection.invert(this._downPointOrig);\n var local = {\n x: this.panSprite.pixelX,\n y: this.panSprite.pixelY\n };\n var geoLocal = void 0;\n\n if (local) {\n geoLocal = this.projection.invert(local);\n }\n\n d3Projection.rotate([dln, dlt, dlg]);\n\n if (geoLocal) {\n if (panBehavior == \"rotateLat\" || panBehavior == \"rotateLongLat\") {\n this.deltaLatitude = this._downDeltaLatitude + geoLocal.latitude - downGeoLocal.latitude;\n }\n\n if (panBehavior == \"rotateLong\" || panBehavior == \"rotateLongLat\") {\n this.deltaLongitude = this._downDeltaLongitude + geoLocal.longitude - downGeoLocal.longitude;\n }\n }\n }\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n MapChart.prototype.handleAllInited = function () {\n var _this = this;\n\n var inited = true;\n this.seriesContainer.visible = true;\n this.series.each(function (series) {\n if (!series.inited || series.dataInvalid) {\n inited = false;\n }\n });\n\n if (inited) {\n this.updateCenterGeoPoint();\n this.updateScaleRatio();\n this.goHome(0);\n } else {\n // TODO verify that this is correct\n var disposer_1 = registry.events.once(\"exitframe\", function () {\n _this.removeDispose(disposer_1);\n\n _this.handleAllInited();\n }, this, false);\n this.addDisposer(disposer_1);\n }\n };\n /**\r\n * @ignore\r\n */\n\n\n MapChart.prototype.updateZoomGeoPoint = function () {\n var seriesPoint = $utils.svgPointToSprite({\n x: this.innerWidth / 2 + this.pixelPaddingLeft,\n y: this.innerHeight / 2 + this.pixelPaddingTop\n }, this.series.getIndex(0));\n var geoPoint = this.projection.invert(seriesPoint);\n this._zoomGeoPointReal = geoPoint;\n };\n /**\r\n * @ignore\r\n */\n\n\n MapChart.prototype.updateCenterGeoPoint = function () {\n var maxLeft;\n var maxRight;\n var maxTop;\n var maxBottom;\n\n if (this.backgroundSeries) {\n var features = this.backgroundSeries.getFeatures();\n\n if (features.length > 0) {\n var bounds = this.projection.d3Path.bounds(features[0].geometry);\n maxLeft = bounds[0][0];\n maxTop = bounds[0][1];\n maxRight = bounds[1][0];\n maxBottom = bounds[1][1];\n }\n } else {\n this.series.each(function (series) {\n var bbox = series.group.node.getBBox();\n\n if (maxLeft > bbox.x || !$type.isNumber(maxLeft)) {\n maxLeft = bbox.x;\n }\n\n if (maxRight < bbox.x + bbox.width || !$type.isNumber(maxRight)) {\n maxRight = bbox.x + bbox.width;\n }\n\n if (maxTop > bbox.y || !$type.isNumber(maxTop)) {\n maxTop = bbox.y;\n }\n\n if (maxBottom < bbox.y + bbox.height || !$type.isNumber(maxBottom)) {\n maxBottom = bbox.y + bbox.height;\n }\n });\n }\n\n this.seriesMaxLeft = maxLeft;\n this.seriesMaxRight = maxRight;\n this.seriesMaxTop = maxTop;\n this.seriesMaxBottom = maxBottom;\n this.seriesWidth = maxRight - maxLeft;\n this.seriesHeight = maxBottom - maxTop;\n\n if (this.seriesWidth > 0 && this.seriesHeight > 0) {\n this.chartContainer.visible = true;\n this._centerGeoPoint = this.projection.invert({\n x: maxLeft + (maxRight - maxLeft) / 2,\n y: maxTop + (maxBottom - maxTop) / 2\n });\n\n if (!this._zoomGeoPointReal || !$type.isNumber(this._zoomGeoPointReal.latitude)) {\n this._zoomGeoPointReal = this._centerGeoPoint;\n }\n } else {\n this.chartContainer.visible = false;\n }\n };\n /**\r\n * Prevents map to be dragged out of the container area\r\n * @ignore\r\n */\n\n\n MapChart.prototype.handleDrag = function () {\n var d = this.zoomLevel * this.scaleRatio;\n var ww = this.seriesWidth * d;\n var hh = this.seriesHeight * d;\n var seriesContainer = this.seriesContainer;\n var maxLeft = this.seriesMaxLeft * d;\n var maxRight = this.seriesMaxRight * d;\n var maxTop = this.seriesMaxTop * d;\n var maxBottom = this.seriesMaxBottom * d;\n var x = seriesContainer.pixelX;\n var y = seriesContainer.pixelY;\n var maxPanOut = this.maxPanOut;\n var minX = Math.min(this.maxWidth * (1 - maxPanOut) - ww - maxLeft, -maxLeft);\n\n if (x < minX) {\n x = minX;\n }\n\n var maxX = Math.max(this.maxWidth * maxPanOut - maxLeft, this.maxWidth - maxRight);\n\n if (x > maxX) {\n x = maxX;\n }\n\n var minY = Math.min(this.maxHeight * (1 - maxPanOut) - hh - maxTop, -maxTop);\n\n if (y < minY) {\n y = minY;\n }\n\n var maxY = Math.max(this.maxHeight * maxPanOut - maxTop, this.maxHeight - maxBottom);\n\n if (y > maxY) {\n y = maxY;\n }\n\n seriesContainer.moveTo({\n x: x,\n y: y\n }, undefined, undefined, true);\n this._zoomGeoPointReal = this.zoomGeoPoint;\n };\n /**\r\n * Sets defaults that instantiate some objects that rely on parent, so they\r\n * cannot be set in constructor.\r\n */\n\n\n MapChart.prototype.applyInternalDefaults = function () {\n _super.prototype.applyInternalDefaults.call(this); // Add a default screen reader title for accessibility\n // This will be overridden in screen reader if there are any `titles` set\n\n\n if (!$type.hasValue(this.readerTitle)) {\n this.readerTitle = this.language.translate(\"Map\");\n }\n\n if (!$type.hasValue(this.background.readerTitle)) {\n this.background.readerTitle = this.language.translate(\"Use plus and minus keys on your keyboard to zoom in and out\");\n }\n };\n /**\r\n * Handles event when a pointer presses down on the map, e.g. user presses\r\n * down mouse or touches the map on a screen.\r\n *\r\n * Stops all animations currently going on.\r\n */\n\n\n MapChart.prototype.handleMapDown = function () {\n if (this._mapAnimation) {\n this._mapAnimation.stop();\n }\n };\n /**\r\n * Handles the event when user doubleclicks or dooubletaps the map: zooms\r\n * in on the reference point.\r\n *\r\n * @param event Original event\r\n */\n\n\n MapChart.prototype.handleDoubleHit = function (event) {\n var svgPoint = $utils.documentPointToSvg(event.point, this.htmlContainer, this.svgContainer.cssScale);\n var geoPoint = this.svgPointToGeo(svgPoint);\n this.zoomIn(geoPoint);\n };\n /**\r\n * Handles mouse wheel event, e.g. user rotates mouse wheel while over the\r\n * map: zooms in or out depending on the direction of the wheel turn.\r\n *\r\n * @param event Original event\r\n */\n\n\n MapChart.prototype.handleWheel = function (event) {\n // Cancel any move inertia if there is one\n var inertia = this.seriesContainer.interactions.inertias.getKey(\"move\");\n\n if (inertia) {\n inertia.done();\n }\n\n var svgPoint = $utils.documentPointToSvg(event.point, this.htmlContainer, this.svgContainer.cssScale);\n var geoPoint = this.svgPointToGeo(svgPoint);\n\n if (event.shift.y < 0) {\n this.zoomIn(geoPoint, undefined, this.interactions.mouseOptions.sensitivity);\n } else {\n this.zoomOut(geoPoint, undefined, this.interactions.mouseOptions.sensitivity);\n }\n };\n\n Object.defineProperty(MapChart.prototype, \"mouseWheelBehavior\", {\n /**\r\n * @return mouse wheel behavior\r\n */\n get: function get() {\n return this.getPropertyValue(\"mouseWheelBehavior\");\n },\n\n /**\r\n * Specifies what should chart do if when mouse wheel is rotated.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/reference/sprite/#mouseOptions_property} More information about `mouseOptions`\r\n * @param mouse wheel behavior\r\n * @default zoomX\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"mouseWheelBehavior\", value)) {\n if (value != \"none\") {\n this._mouseWheelDisposer = this.chartContainer.events.on(\"wheel\", this.handleWheel, this, false);\n\n this._disposers.push(this._mouseWheelDisposer);\n } else {\n if (this._mouseWheelDisposer) {\n this._mouseWheelDisposer.dispose();\n }\n\n this.chartContainer.wheelable = false;\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"panBehavior\", {\n /**\r\n * @returns Behavior\r\n */\n get: function get() {\n return this.getPropertyValue(\"panBehavior\");\n },\n\n /**\r\n * What \"dragging\" map does.\r\n *\r\n * Available values:\r\n * * `\"move\"` (default): changes position of the map.\r\n * * `\"rotateLat\"`: changes `deltaLatitude` (rotates the globe vertically).\r\n * * `\"rotateLong\"`: changes `deltaLongitude` (rotates the globe horizontally).\r\n * * `\"rotateLongLat\"`: changes both `deltaLongitude` and `deltaLatitude` (rotates the globe in any direction).\r\n *\r\n * @default \"move\"\r\n * @since 4.3.0\r\n * @param value Behavior\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"panBehavior\", value)) {\n var seriesContainer = this.seriesContainer;\n this.panSprite.draggable = false;\n seriesContainer.draggable = false;\n\n switch (value) {\n case \"move\":\n seriesContainer.draggable = true;\n break;\n\n default:\n this.panSprite.draggable = true;\n break;\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"centerMapOnZoomOut\", {\n /**\r\n * @returns If the map should be centered when zooming out.\r\n */\n get: function get() {\n return this.getPropertyValue(\"centerMapOnZoomOut\");\n },\n\n /**\r\n * Specifies if the map should be centered when zooming out\r\n * @default true\r\n * @since 4.7.12\r\n */\n set: function set(value) {\n this.setPropertyValue(\"centerMapOnZoomOut\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"projection\", {\n /**\r\n * @return Projection\r\n */\n get: function get() {\n return this.getPropertyValue(\"projection\");\n },\n\n /**\r\n * Projection to use for the map.\r\n *\r\n * Available projections:\r\n * * Albers\r\n * * AlbersUSA\r\n * * AzimuthalEqualArea\r\n * * Eckert6\r\n * * EqualEarth\r\n * * Mercator\r\n * * Miller\r\n * * NaturalEarth\r\n * * Orthographic\r\n * * Stereographic\r\n *\r\n * ```TypeScript\r\n * map.projection = new am4maps.projections.Mercator();\r\n * ```\r\n * ```JavaScript\r\n * map.projection = new am4maps.projections.Mercator();\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"projection\": \"Mercator\"\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/map/#Setting_projection} More about projections\r\n * @param projection Projection\r\n */\n set: function set(projection) {\n var _this = this;\n\n if (this.setPropertyValue(\"projection\", projection)) {\n this.invalidateProjection();\n projection.chart = this;\n\n if (this._backgroundSeries) {\n this._backgroundSeries.invalidate();\n }\n\n if (this.inited) {\n this.updateExtremes();\n }\n\n this.series.each(function (series) {\n series.events.once(\"validated\", function () {\n _this.updateCenterGeoPoint();\n\n _this.updateScaleRatio();\n\n _this.goHome(0);\n });\n });\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Validates (processes) data items.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n MapChart.prototype.validateDataItems = function () {\n _super.prototype.validateDataItems.call(this);\n\n this.updateExtremes();\n };\n /**\r\n * Calculates the longitudes and latitudes of the most distant points from\r\n * the center in all four directions: West, East, North, and South.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n MapChart.prototype.updateExtremes = function () {\n var east;\n var north;\n var west;\n var south;\n this.series.each(function (series) {\n if (series.ignoreBounds || series instanceof GraticuleSeries && series.fitExtent) {} else {\n if (series.north > north || !$type.isNumber(north)) {\n north = series.north;\n }\n\n if (series.south < south || !$type.isNumber(south)) {\n south = series.south;\n }\n\n if (series.west < west || !$type.isNumber(west)) {\n west = series.west;\n }\n\n if (series.east > east || !$type.isNumber(east)) {\n east = series.east;\n }\n }\n });\n var features = [];\n var foundGraticule = false; // if we gave graticule, get features of these series only for faster fitSize\n\n this.series.each(function (series) {\n if (series instanceof GraticuleSeries && !series.fitExtent) {\n features = series.getFeatures();\n foundGraticule = true;\n }\n });\n\n if (!foundGraticule) {\n this.series.each(function (series) {\n if (series.ignoreBounds || series instanceof GraticuleSeries && series.fitExtent) {} else {\n features = features.concat(series.getFeatures());\n }\n });\n }\n\n var w = $math.max(50, this.innerWidth);\n var h = $math.max(50, this.innerHeight);\n var d3Projection = this.projection.d3Projection;\n\n if (features.length > 0 && d3Projection && (this.east != east || this.west != west || this.north != north || this.south != south)) {\n this.east = east;\n this.west = west;\n this.north = north;\n this.south = south;\n\n if (d3Projection.rotate) {\n var rotation = d3Projection.rotate();\n var deltaLong = rotation[0];\n var deltaLat = rotation[1];\n var deltaGamma = rotation[2];\n this.deltaLongitude = deltaLong;\n this.deltaLatitude = deltaLat;\n this.deltaGamma = deltaGamma;\n }\n\n var geoJSON = {\n \"type\": \"FeatureCollection\",\n features: features\n };\n var initialScale = d3Projection.scale();\n d3Projection.fitSize([w, h], geoJSON);\n\n if (d3Projection.scale() != initialScale) {\n this.invalidateDataUsers();\n }\n\n this.series.each(function (series) {\n if (series instanceof GraticuleSeries) {\n series.invalidateData();\n }\n });\n\n if (this._backgroundSeries) {\n var polygon = this._backgroundSeries.mapPolygons.getIndex(0);\n\n if (polygon) {\n polygon.multiPolygon = $mapUtils.getBackground(this.north, this.east, this.south, this.west);\n }\n }\n\n this._fitWidth = w;\n this._fitHeight = h;\n }\n\n if (!this._zoomGeoPointReal || !$type.isNumber(this._zoomGeoPointReal.latitude)) {\n this.goHome(0);\n }\n };\n /**\r\n * (Re)calculates a ratio which should be used to scale the actual map so\r\n * that it fits perfectly into available space. Helps to avoid redrawing of all the map if container size changes\r\n * @ignore\r\n */\n\n\n MapChart.prototype.updateScaleRatio = function () {\n var scaleRatio;\n this.updateCenterGeoPoint();\n var hScale = this.innerWidth / this.seriesWidth;\n var vScale = this.innerHeight / this.seriesHeight;\n scaleRatio = $math.min(hScale, vScale);\n\n if ($type.isNaN(scaleRatio) || scaleRatio == Infinity) {\n scaleRatio = 1;\n }\n\n if (scaleRatio != this.scaleRatio) {\n this.scaleRatio = scaleRatio;\n $iter.each(this.series.iterator(), function (series) {\n series.scale = scaleRatio;\n series.updateTooltipBounds();\n });\n this.backgroundSeries.scale = scaleRatio;\n this.dispatch(\"scaleratiochanged\");\n }\n };\n /**\r\n * Converts a point within map container to geographical (lat/long)\r\n * coordinates.\r\n *\r\n * @param point Source point\r\n * @return Geo-point\r\n */\n\n\n MapChart.prototype.svgPointToGeo = function (point) {\n var series = this.series.getIndex(0);\n\n if (series) {\n var seriesPoint = $utils.svgPointToSprite(point, series);\n return this.seriesPointToGeo(seriesPoint);\n }\n };\n /**\r\n * Converts geographical (lat/long) coordinates to an X/Y point within map's\r\n * container.\r\n *\r\n * @param point Source geo-point\r\n * @return Point\r\n */\n\n\n MapChart.prototype.geoPointToSVG = function (point) {\n var series = this.series.getIndex(0);\n\n if (series) {\n var seriesPoint = this.geoPointToSeries(point);\n return $utils.spritePointToSvg(seriesPoint, series);\n }\n };\n /**\r\n * Converts a point (X/Y) within actual objects of the map to geographical\r\n * (lat/long) coordinates.\r\n *\r\n * @param point Source point\r\n * @return Geo-point\r\n */\n\n\n MapChart.prototype.seriesPointToGeo = function (point) {\n return this.projection.invert(point);\n };\n /**\r\n * Converts geographical (lat/long) coordinates to an X/Y point within\r\n * actual elements/objects of the maps.\r\n *\r\n * @param point Source geo-point\r\n * @return Point\r\n */\n\n\n MapChart.prototype.geoPointToSeries = function (point) {\n return this.projection.convert(point);\n };\n\n Object.defineProperty(MapChart.prototype, \"geodata\", {\n /**\r\n * @return GeoJSON data\r\n */\n get: function get() {\n return this._geodata;\n },\n\n /**\r\n * Map data in GeoJSON format.\r\n *\r\n * The Map supports the following GeoJSON objects: `Point`, `LineString`,\r\n * `Polygon`, `MultiPoint`, `MultiLineString`, and `MultiPolygon`.\r\n *\r\n * @see {@link http://geojson.org/} Official GeoJSON format specification\r\n * @param geoJSON GeoJSON data\r\n */\n set: function set(geodata) {\n if (geodata != this._geodata) {\n this._geodata = geodata;\n\n if (this.reverseGeodata) {\n this.processReverseGeodata(this._geodata);\n }\n\n this.invalidateData();\n this.dataUsers.each(function (dataUser) {\n for (var i = dataUser.data.length - 1; i >= 0; i--) {\n if (dataUser.data[i].madeFromGeoData == true) {\n dataUser.data.splice(i, 1);\n }\n }\n\n dataUser.disposeData();\n dataUser.invalidateData();\n });\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"reverseGeodata\", {\n /**\r\n * @returns Reverse the order of geodata coordinates?\r\n */\n get: function get() {\n return this.getPropertyValue(\"reverseGeodata\");\n },\n\n /**\r\n * Indicates whether GeoJSON geodata supplied to the chart uses\r\n * ESRI (clockwise) or non-ESRI (counter-clockwise) order of the polygon\r\n * coordinates.\r\n *\r\n * `MapChart` supports only ESRI standard, so if your custom maps appears\r\n * garbled, try setting `reverseGeodata = true`.\r\n *\r\n * @default false\r\n * @since 4.10.11\r\n * @param value Reverse the order of geodata coordinates?\r\n */\n set: function set(value) {\n if (this.setPropertyValue(\"reverseGeodata\", value) && this._geodata) {\n this.processReverseGeodata(this._geodata);\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Reverses the order of polygons on a GeoJSON data.\r\n *\r\n * @since 4.10.11\r\n * @param geodata Source geodata\r\n */\n\n MapChart.prototype.processReverseGeodata = function (geodata) {\n for (var i = 0; i < geodata.features.length; i++) {\n var feature = geodata.features[i];\n\n for (var x = 0; x < feature.geometry.coordinates.length; x++) {\n if (feature.geometry.type == \"MultiPolygon\") {\n for (var y = 0; y < feature.geometry.coordinates[x].length; y++) {\n feature.geometry.coordinates[x][y].reverse();\n }\n } else {\n feature.geometry.coordinates[x].reverse();\n }\n }\n }\n };\n /**\r\n * Zooms the map to particular zoom level and centers on a latitude/longitude\r\n * coordinate.\r\n *\r\n * @param point Center coordinate\r\n * @param zoomLevel Zoom level\r\n * @param center Center on the given coordinate?\r\n * @param duration Duration for zoom animation (ms)\r\n * @return Zoom animation\r\n */\n\n\n MapChart.prototype.zoomToGeoPoint = function (point, zoomLevel, center, duration, mapObject) {\n var _this = this;\n\n if (!point) {\n var hasData_1 = false;\n this.series.each(function (series) {\n if (series.dataItems.length > 0) {\n hasData_1 = true;\n }\n });\n\n if (hasData_1) {\n point = this.zoomGeoPoint;\n } else {\n return;\n }\n }\n\n if (!point || !$type.isNumber(point.longitude) || !$type.isNumber(point.latitude)) {\n return;\n }\n\n this._zoomGeoPointReal = point;\n zoomLevel = $math.fitToRange(zoomLevel, this.minZoomLevel, this.maxZoomLevel);\n var seriesPoint = this.projection.convert(point);\n\n if (seriesPoint) {\n var svgPoint = this.geoPointToSVG(point);\n var mapPoint = $utils.svgPointToSprite(svgPoint, this);\n\n if (center) {\n mapPoint = {\n x: this.innerWidth / 2,\n y: this.innerHeight / 2\n };\n }\n\n if (!$type.isNumber(duration)) {\n duration = this.zoomDuration;\n }\n\n var x = mapPoint.x - seriesPoint.x * zoomLevel * this.scaleRatio;\n var y = mapPoint.y - seriesPoint.y * zoomLevel * this.scaleRatio;\n\n if (!mapObject && zoomLevel < this.zoomLevel && this.centerMapOnZoomOut && zoomLevel < 1.5) {\n x = this.innerWidth / 2 - (this.seriesMaxLeft + (this.seriesMaxRight - this.seriesMaxLeft) / 2) * zoomLevel * this.scaleRatio;\n y = this.innerHeight / 2 - (this.seriesMaxTop + (this.seriesMaxBottom - this.seriesMaxTop) / 2) * zoomLevel * this.scaleRatio;\n }\n\n this._mapAnimation = this.seriesContainer.animate([{\n property: \"scale\",\n to: zoomLevel\n }, {\n property: \"x\",\n from: this.seriesContainer.pixelX,\n to: x\n }, {\n property: \"y\",\n from: this.seriesContainer.pixelY,\n to: y\n }], duration, this.zoomEasing);\n\n this._disposers.push(this._mapAnimation.events.on(\"animationended\", function () {\n _this._zoomGeoPointReal = _this.zoomGeoPoint;\n }));\n\n this.seriesContainer.validatePosition();\n return this._mapAnimation;\n }\n };\n /**\r\n * Zooms the map to a particular map object.\r\n *\r\n * @param mapObject Target map object\r\n * @param zoomLevel Zoom level\r\n * @param center Center on the given coordinate?\r\n * @param duration Duration for zoom animation (ms)\r\n * @return Zoom animation\r\n */\n\n\n MapChart.prototype.zoomToMapObject = function (mapObject, zoomLevel, center, duration) {\n if (center == undefined) {\n center = true;\n }\n\n var inertia = this.seriesContainer.interactions.inertias.getKey(\"move\");\n\n if (inertia) {\n inertia.done();\n }\n\n if (mapObject instanceof MapImage) {\n if ($type.isNaN(zoomLevel)) {\n zoomLevel = 5;\n }\n\n return this.zoomToGeoPoint({\n latitude: mapObject.latitude,\n longitude: mapObject.longitude\n }, zoomLevel, center, duration, true);\n }\n\n var dataItem = mapObject.dataItem;\n\n if (dataItem && $type.isNumber(dataItem.zoomLevel)) {\n zoomLevel = dataItem.zoomLevel;\n }\n\n if (mapObject instanceof MapPolygon) {\n var dataItem_1 = mapObject.dataItem;\n var bbox = mapObject.polygon.bbox;\n\n if (bbox.width == 0 || bbox.height == 0) {\n bbox = mapObject.polygon.group.getBBox();\n }\n\n if (!$type.isNumber(zoomLevel)) {\n zoomLevel = Math.min(this.seriesWidth / bbox.width, this.seriesHeight / bbox.height);\n }\n\n var geoPoint = void 0;\n\n if (dataItem_1 && $type.hasValue(dataItem_1.zoomGeoPoint)) {\n geoPoint = dataItem_1.zoomGeoPoint;\n } else {\n // this is more accurate\n var polygonPoint = {\n x: bbox.x + bbox.width / 2,\n y: bbox.y + bbox.height / 2\n };\n var seriesPoint = $utils.spritePointToSprite(polygonPoint, mapObject.polygon, mapObject.series);\n geoPoint = this.seriesPointToGeo(seriesPoint);\n }\n\n return this.zoomToGeoPoint(geoPoint, zoomLevel, true, duration, true);\n }\n };\n /**\r\n * Zooms the map to a particular viewport.\r\n *\r\n * The `north`, `east`, `south`, and `west` define boundaries of the\r\n * imaginary viewort we want to zoom the map to.\r\n *\r\n * `level` is not actual zoom level. The map will determine the zoom level\r\n * required to accommodated such zoom, and will adjust it by `level` if set.\r\n *\r\n * @param north Latitude of the North-most boundary\r\n * @param east Longitude of the East-most boundary\r\n * @param south Latitude of the South-most boundary\r\n * @param west Longitude of the West-most boundary\r\n * @param level Adjust zoom level\r\n * @param center Center on the given coordinate?\r\n * @param duration Duration for zoom animation (ms)\r\n * @return Zoom animation\r\n */\n\n\n MapChart.prototype.zoomToRectangle = function (north, east, south, west, level, center, duration) {\n if ($type.isNaN(level)) {\n level = 1;\n }\n\n var w = $math.min(west, east);\n var e = $math.max(west, east);\n west = w;\n east = e;\n var splitLongitude = $math.normalizeAngle(180 - this.deltaLongitude);\n\n if (splitLongitude > 180) {\n splitLongitude -= 360;\n }\n\n var newLong = west + (east - west) / 2;\n var d = west - east;\n\n if (west < splitLongitude && east > splitLongitude) {\n newLong += 180;\n d = $math.normalizeAngle(east - west - 360);\n }\n\n var zoomLevel = level * Math.min((this.south - this.north) / (south - north), Math.abs((this.west - this.east) / d));\n return this.zoomToGeoPoint({\n latitude: north + (south - north) / 2,\n longitude: newLong\n }, zoomLevel, center, duration, true);\n };\n /**\r\n * Zooms in the map, optionally centering on particular latitude/longitude\r\n * point.\r\n *\r\n * @param geoPoint Optional center point\r\n * @param duration Duration for zoom animation (ms)\r\n * @return Zoom animation\r\n */\n\n\n MapChart.prototype.zoomIn = function (geoPoint, duration, sensitivity) {\n if (sensitivity === void 0) {\n sensitivity = 1;\n }\n\n var step = 1 + (this.zoomStep - 1) * sensitivity;\n\n if (step < 1) {\n step = 1;\n }\n\n return this.zoomToGeoPoint(geoPoint, this.zoomLevel * step, false, duration);\n };\n /**\r\n * Zooms out the map, optionally centering on particular latitude/longitude\r\n * point.\r\n *\r\n * @param geoPoint Optional center point\r\n * @param duration Duration for zoom animation (ms)\r\n * @return Zoom animation\r\n */\n\n\n MapChart.prototype.zoomOut = function (geoPoint, duration, sensitivity) {\n if (sensitivity === void 0) {\n sensitivity = 1;\n }\n\n var step = 1 + (this.zoomStep - 1) * sensitivity;\n\n if (step < 1) {\n step = 1;\n }\n\n return this.zoomToGeoPoint(geoPoint, this.zoomLevel / step, false, duration);\n };\n /**\r\n * Pans the maps using relative coordinates. E.g.:\r\n *\r\n * ```JSON\r\n * {\r\n * x: 0.1,\r\n * y: -0.1\r\n * }\r\n * ```\r\n *\r\n * The above will move the map by 10% to the right, and by 10% upwards.\r\n *\r\n * @param shift Vertical and horizontal shift\r\n * @param duration Pan animation duration (ms)\r\n */\n\n\n MapChart.prototype.pan = function (shift, duration) {\n var point = this.geoPointToSVG(this.zoomGeoPoint);\n point.x += this.pixelWidth * shift.x;\n point.y += this.pixelHeight * shift.y;\n this.zoomToGeoPoint(this.svgPointToGeo(point), this.zoomLevel, true, duration, true);\n };\n\n Object.defineProperty(MapChart.prototype, \"zoomGeoPoint\", {\n /**\r\n * Current lat/long coordinates for the center of the viewport. (default\r\n * zoom reference point)\r\n *\r\n * @readonly\r\n * @return Coordinates\r\n */\n get: function get() {\n var point = $utils.spritePointToSvg({\n x: this.pixelWidth / 2,\n y: this.pixelHeight / 2\n }, this);\n return this.svgPointToGeo(point);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"zoomLevel\", {\n /**\r\n * @return Zoom level\r\n */\n get: function get() {\n return this.seriesContainer.scale;\n },\n\n /**\r\n * Current zoom level.\r\n *\r\n * @readonly\r\n * @return Zoom level\r\n */\n set: function set(value) {\n this.seriesContainer.scale = value;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Dispatches events after some map transformation, like pan or zoom.\r\n *\r\n * @ignore\r\n */\n\n MapChart.prototype.handleMapTransform = function () {\n if (this.zoomLevel != this._prevZoomLevel) {\n this.dispatch(\"zoomlevelchanged\");\n this._prevZoomLevel = this.zoomLevel;\n this.svgContainer.readerAlert(this.language.translate(\"Zoom level changed to %1\", this.language.locale, $type.castString(this.zoomLevel)));\n }\n\n if (this.zoomGeoPoint && (this._prevZoomGeoPoint.latitude != this.zoomGeoPoint.latitude || this._prevZoomGeoPoint.longitude != this.zoomGeoPoint.longitude)) {\n this.dispatch(\"mappositionchanged\");\n }\n };\n\n Object.defineProperty(MapChart.prototype, \"smallMap\", {\n /**\r\n * @return Small map\r\n */\n get: function get() {\n if (!this._smallMap) {\n var smallMap = new SmallMap();\n this.smallMap = smallMap;\n }\n\n return this._smallMap;\n },\n\n /**\r\n * A [[SmallMap]] to be used on the map.\r\n *\r\n * Please note, that accessing this property will NOT create a small map\r\n * if it has not yet been created. (except in JSON)\r\n *\r\n * ```TypeScript\r\n * // Create a small map\r\n * map.smallMap = new am4maps.SmallMap();\r\n * ```\r\n * ```JavaScript\r\n * // Create a small map\r\n * map.smallMap = new am4maps.SmallMap();\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"smallMap\": {}\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @param smallMap Small map\r\n */\n set: function set(smallMap) {\n if (this._smallMap) {\n this.removeDispose(this._smallMap);\n }\n\n this._smallMap = smallMap;\n this._smallMap.chart = this;\n smallMap.parent = this.chartContainer;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"zoomControl\", {\n /**\r\n * @return Zoom control\r\n */\n get: function get() {\n return this._zoomControl;\n },\n\n /**\r\n * A [[ZoomControl]] to be used on the map.\r\n *\r\n * Please note, that accessing this property will NOT create a zoom control\r\n * if it has not yet been created. (except in JSON)\r\n *\r\n * ```TypeScript\r\n * // Create a zoom control\r\n * map.zoomControl = new am4maps.ZoomControl();\r\n * ```\r\n * ```JavaScript\r\n * // Create a zoom control\r\n * map.zoomControl = new am4maps.ZoomControl();\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"zoomControl\": {}\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @param zoomControl Zoom control\r\n */\n set: function set(zoomControl) {\n if (this._zoomControl) {\n this.removeDispose(this._zoomControl);\n }\n\n this._zoomControl = zoomControl;\n zoomControl.chart = this;\n zoomControl.parent = this.chartContainer;\n zoomControl.plusButton.exportable = false;\n zoomControl.minusButton.exportable = false;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates and returns a map series of appropriate type.\r\n *\r\n * @return Map series\r\n */\n\n MapChart.prototype.createSeries = function () {\n return new MapSeries();\n };\n\n Object.defineProperty(MapChart.prototype, \"deltaLongitude\", {\n /**\r\n * @return Rotation\r\n */\n get: function get() {\n return this.getPropertyValue(\"deltaLongitude\");\n },\n\n /**\r\n * Degrees to rotate the map around vertical axis (Y).\r\n *\r\n * E.g. if set to -160, the longitude 20 will become a new center, creating\r\n * a Pacific-centered map.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/map/#Map_rotation} For more info on map rotation.\r\n * @param value Rotation\r\n */\n set: function set(value) {\n value = $math.round(value, 3);\n\n if (this.setPropertyValue(\"deltaLongitude\", $geo.wrapAngleTo180(value))) {\n this.rotateMap();\n this.updateZoomGeoPoint();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"deltaLatitude\", {\n /**\r\n * @return Rotation\r\n */\n get: function get() {\n return this.getPropertyValue(\"deltaLatitude\");\n },\n\n /**\r\n * Degrees to rotate the map around horizontal axis (X).\r\n *\r\n * E.g. setting this to 90 will put Antarctica directly in the center of\r\n * the map.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/map/#Map_rotation} For more info on map rotation.\r\n * @since 4.3.0\r\n * @param value Rotation\r\n */\n set: function set(value) {\n value = $math.round(value, 3);\n\n if (this.setPropertyValue(\"deltaLatitude\", value)) {\n this.rotateMap();\n this.updateZoomGeoPoint();\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"deltaGamma\", {\n /**\r\n * @return Rotation\r\n */\n get: function get() {\n return this.getPropertyValue(\"deltaGamma\");\n },\n\n /**\r\n * Degrees to rotate the map around \"Z\" axis. This is the axis that pierces\r\n * the globe directly from the viewer's point of view.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/chart-types/map/#Map_rotation} For more info on map rotation.\r\n * @since 4.3.0\r\n * @param value Rotation\r\n */\n set: function set(value) {\n value = $math.round(value, 3);\n\n if (this.setPropertyValue(\"deltaGamma\", value)) {\n this.rotateMap();\n this.updateZoomGeoPoint();\n }\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * @ignore\r\n */\n\n MapChart.prototype.rotateMap = function () {\n if (this.projection.d3Projection) {\n if (this.projection.d3Projection.rotate) {\n this.projection.d3Projection.rotate([this.deltaLongitude, this.deltaLatitude, this.deltaGamma]);\n this.invalidateProjection(); //this.updateExtremes(); // removal fixes #3292\n }\n }\n };\n\n Object.defineProperty(MapChart.prototype, \"maxPanOut\", {\n /**\r\n * @return Max pan out\r\n */\n get: function get() {\n return this.getPropertyValue(\"maxPanOut\");\n },\n\n /**\r\n * Maximum portion of the map's width/height to allow panning \"off screen\".\r\n *\r\n * A value of 0 (zero) will prevent any portion of the the map to be panned\r\n * outside the viewport.\r\n *\r\n * 0.5 will allow half of the map to be outside viewable area.\r\n *\r\n * @default 0.7\r\n * @param value Max pan out\r\n */\n set: function set(value) {\n this.setPropertyValue(\"maxPanOut\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"homeGeoPoint\", {\n /**\r\n * @return Home geo point\r\n */\n get: function get() {\n return this.getPropertyValue(\"homeGeoPoint\");\n },\n\n /**\r\n * The geographical point to center map on when it is first loaded.\r\n *\r\n * The map will also be centered to this point when you call `goHome()`\r\n * method.\r\n *\r\n * @param value Home geo point\r\n */\n set: function set(value) {\n this.setPropertyValue(\"homeGeoPoint\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"homeZoomLevel\", {\n /**\r\n * @return Home zoom level\r\n */\n get: function get() {\n return this.getPropertyValue(\"homeZoomLevel\");\n },\n\n /**\r\n * The zoom level to put the map in when it is first loaded.\r\n *\r\n * The map will also be set to this zoom level when you call `goHome()`\r\n * method.\r\n *\r\n * @param value Home zoom level\r\n */\n set: function set(value) {\n this.setPropertyValue(\"homeZoomLevel\", value);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MapChart.prototype, \"zoomStep\", {\n /**\r\n * @return Zoom factor\r\n */\n get: function get() {\n return this.getPropertyValue(\"zoomStep\");\n },\n\n /**\r\n * When user zooms in or out current zoom level is multiplied or divided\r\n * by value of this setting.\r\n *\r\n * @default 2\r\n * @param value Zoom factor\r\n */\n set: function set(value) {\n this.setPropertyValue(\"zoomStep\", value);\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Invalidates projection, causing all series to be redrawn.\r\n *\r\n * Call this after changing projection or its settings.\r\n */\n\n MapChart.prototype.invalidateProjection = function () {\n this.east = undefined;\n this.invalidateDataUsers();\n this.updateCenterGeoPoint();\n };\n\n Object.defineProperty(MapChart.prototype, \"geodataSource\", {\n /**\r\n * Returns a [[DataSource]] specifically for loading Component's data.\r\n *\r\n * @return Data source\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._dataSources[\"geodata\"]) {\n var dataSource = this.getDataSource(\"geodata\");\n dataSource.events.on(\"parseended\", function () {\n _this.events.once(\"datavalidated\", function () {\n _this.goHome(0);\n });\n });\n }\n\n return this._dataSources[\"geodata\"];\n },\n\n /**\r\n * Sets a [[DataSource]] to be used for loading Component's data.\r\n *\r\n * @param value Data source\r\n */\n set: function set(value) {\n var _this = this;\n\n if (this._dataSources[\"geodata\"]) {\n this.removeDispose(this._dataSources[\"geodata\"]);\n }\n\n this._dataSources[\"geodata\"] = value;\n this._dataSources[\"geodata\"].component = this;\n this.events.on(\"inited\", function () {\n _this.loadData(\"geodata\");\n }, this, false);\n this.setDataSourceEvents(value, \"geodata\");\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Processes JSON-based config before it is applied to the object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param config Config\r\n */\n\n MapChart.prototype.processConfig = function (config) {\n if ($type.hasValue(config[\"geodata\"]) && $type.isString(config[\"geodata\"])) {\n var name_1 = config[\"geodata\"]; // Check if there's a map loaded by such name\n\n if ($type.hasValue(window[\"am4geodata_\" + config[\"geodata\"]])) {\n config[\"geodata\"] = window[\"am4geodata_\" + config[\"geodata\"]];\n } // Nope. Let's try maybe we got JSON as string?\n else {\n try {\n config[\"geodata\"] = JSON.parse(config[\"geodata\"]);\n } catch (e) {\n // No go again. Error out.\n this.raiseCriticalError(Error(\"MapChart error: Geodata `\" + name_1 + \"` is not loaded or is incorrect.\"), true);\n }\n }\n } // Instantiate projection\n\n\n if ($type.hasValue(config[\"projection\"]) && $type.isString(config[\"projection\"])) {\n config[\"projection\"] = this.createClassInstance(config[\"projection\"]);\n } // Set up small map\n\n\n if ($type.hasValue(config.smallMap) && !$type.hasValue(config.smallMap.type)) {\n config.smallMap.type = \"SmallMap\";\n } // Set up zoom control\n\n\n if ($type.hasValue(config.zoomControl) && !$type.hasValue(config.zoomControl.type)) {\n config.zoomControl.type = \"ZoomControl\";\n }\n\n _super.prototype.processConfig.call(this, config);\n };\n /**\r\n * Decorates a new [[Series]] object with required parameters when it is\r\n * added to the chart.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n MapChart.prototype.handleSeriesAdded = function (event) {\n _super.prototype.handleSeriesAdded.call(this, event);\n\n var series = event.newValue;\n series.scale = this.scaleRatio;\n series.events.on(\"validated\", this.updateCenterGeoPoint, this, false);\n };\n /**\r\n * This function is used to sort element's JSON config properties, so that\r\n * some properties that absolutely need to be processed last, can be put at\r\n * the end.\r\n *\r\n * @ignore Exclude from docs\r\n * @param a Element 1\r\n * @param b Element 2\r\n * @return Sorting number\r\n */\n\n\n MapChart.prototype.configOrder = function (a, b) {\n if (a == b) {\n return 0;\n } // Must come last\n else if (a == \"smallMap\") {\n return 1;\n } else if (b == \"smallMap\") {\n return -1;\n } else if (a == \"series\") {\n return 1;\n } else if (b == \"series\") {\n return -1;\n } else {\n return _super.prototype.configOrder.call(this, a, b);\n }\n };\n /**\r\n * Adds `projection` to \"as is\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as is?\r\n */\n\n\n MapChart.prototype.asIs = function (field) {\n return field == \"projection\" || field == \"geodata\" || _super.prototype.asIs.call(this, field);\n };\n\n Object.defineProperty(MapChart.prototype, \"centerGeoPoint\", {\n /**\r\n * Geo point of map center\r\n *\r\n * @readonly\r\n */\n get: function get() {\n return this._centerGeoPoint;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Resets the map to its original position and zoom level.\r\n *\r\n * Use the only parameter to set number of milliseconds for the zoom\r\n * animation to play.\r\n *\r\n * @param duration Duration (ms)\r\n */\n\n MapChart.prototype.goHome = function (duration) {\n var homeGeoPoint = this.homeGeoPoint;\n\n if (!homeGeoPoint) {\n homeGeoPoint = this.centerGeoPoint;\n }\n\n if (homeGeoPoint) {\n this.zoomToGeoPoint(homeGeoPoint, this.homeZoomLevel, true, duration, true);\n }\n };\n /**\r\n * Sets [[Paper]] instance to use to draw elements.\r\n *\r\n * @ignore\r\n * @param paper Paper\r\n * @return true if paper was changed, false, if it's the same\r\n */\n\n\n MapChart.prototype.setPaper = function (paper) {\n if (this.svgContainer) {\n this.svgContainer.hideOverflow = true;\n }\n\n return _super.prototype.setPaper.call(this, paper);\n };\n\n Object.defineProperty(MapChart.prototype, \"backgroundSeries\", {\n /**\r\n * Background series will create polygons that will fill all the map area\r\n * with some color (or other fill).\r\n *\r\n * This might be useful with non-rectangular projections, like Orthographic,\r\n * Albers, etc.\r\n *\r\n * To change background color/opacity access polygon template.\r\n *\r\n * ```TypeScript\r\n * chart.backgroundSeries.mapPolygons.template.polygon.fill = am4core.color(\"#fff\");\r\n * chart.backgroundSeries.mapPolygons.template.polygon.fillOpacity = 0.1;\r\n * ```\r\n * ```JavaScript\r\n * chart.backgroundSeries.mapPolygons.template.polygon.fill = am4core.color(\"#fff\");\r\n * chart.backgroundSeries.mapPolygons.template.polygon.fillOpacity = 0.1;\r\n * ```\r\n * ```JSON\r\n * {\r\n * \"backgroundSeries\": {\r\n * \"mapPolygons\": {\r\n * \"polygon\": {\r\n * \"fill\": \"#fff\",\r\n * \"fillOpacity\": 0.1\r\n * }\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @since 4.3.0\r\n */\n get: function get() {\n var _this = this;\n\n if (!this._backgroundSeries) {\n var backgroundSeries = new MapPolygonSeries();\n backgroundSeries.parent = this.seriesContainer;\n backgroundSeries.chart = this;\n backgroundSeries.hiddenInLegend = true;\n backgroundSeries.mapPolygons.template.focusable = false;\n backgroundSeries.addDisposer(new Disposer(function () {\n _this._backgroundSeries = undefined;\n }));\n\n this._disposers.push(backgroundSeries);\n\n var interfaceColors = new InterfaceColorSet();\n var color = interfaceColors.getFor(\"background\");\n var polygonTemplate = backgroundSeries.mapPolygons.template.polygon;\n polygonTemplate.stroke = color;\n polygonTemplate.fill = color;\n polygonTemplate.fillOpacity = 0;\n polygonTemplate.strokeOpacity = 0; //polygonTemplate.focusable = false;\n\n backgroundSeries.mapPolygons.create();\n this._backgroundSeries = backgroundSeries;\n }\n\n return this._backgroundSeries;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Prepares the legend instance for use in this chart.\r\n *\r\n * @param legend Legend\r\n */\n\n MapChart.prototype.setLegend = function (legend) {\n _super.prototype.setLegend.call(this, legend);\n\n if (legend) {\n legend.parent = this;\n }\n };\n /**\r\n * @param value Tap to activate?\r\n */\n\n\n MapChart.prototype.setTapToActivate = function (value) {\n _super.prototype.setTapToActivate.call(this, value); // setup other containers\n\n\n this.seriesContainer.interactions.isTouchProtected = true;\n this.panSprite.interactions.isTouchProtected = true;\n };\n\n MapChart.prototype.handleTapToActivate = function () {\n _super.prototype.handleTapToActivate.call(this);\n\n this.seriesContainer.interactions.isTouchProtected = false;\n this.panSprite.interactions.isTouchProtected = false;\n };\n\n MapChart.prototype.handleTapToActivateDeactivation = function () {\n _super.prototype.handleTapToActivateDeactivation.call(this);\n\n this.seriesContainer.interactions.isTouchProtected = true;\n this.panSprite.interactions.isTouchProtected = true;\n };\n /**\r\n * Adds easing functions to \"function\" fields.\r\n *\r\n * @param field Field name\r\n * @return Assign as function?\r\n */\n\n\n MapChart.prototype.asFunction = function (field) {\n return field == \"zoomEasing\" || _super.prototype.asIs.call(this, field);\n };\n /**\r\n * @ignore\r\n * @return Has license?\r\n */\n\n\n MapChart.prototype.hasLicense = function () {\n if (options.commercialLicense) {\n return true;\n }\n\n if (!_super.prototype.hasLicense.call(this)) {\n return false;\n }\n\n for (var i = 0; i < options.licenses.length; i++) {\n if (options.licenses[i].match(/^MP.{5,}/i)) {\n return true;\n }\n }\n\n return false;\n };\n\n return MapChart;\n}(SerialChart);\n\nexport { MapChart };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapChart\"] = MapChart;","/**\r\n * Map spline module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapLine } from \"./MapLine\";\nimport { Polyspline } from \"../../core/elements/Polyspline\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw a spline on the map.\r\n *\r\n * @see {@link IMapSplineEvents} for a list of available events\r\n * @see {@link IMapSplineAdapters} for a list of available Adapters\r\n */\n\nvar MapSpline =\n/** @class */\nfunction (_super) {\n __extends(MapSpline, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapSpline() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"MapSpline\"; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapSpline.prototype.createLine = function () {\n this.line = new Polyspline();\n this.line.tensionX = 0.8;\n this.line.tensionY = 0.8;\n };\n\n Object.defineProperty(MapSpline.prototype, \"shortestDistance\", {\n /**\r\n * ShortestDistance = true is not supported by MapSpline, only MapLine does support it\r\n * @default false\r\n * @param value\r\n * @todo: review description\r\n */\n get: function get() {\n return false;\n },\n set: function set(value) {},\n enumerable: true,\n configurable: true\n });\n return MapSpline;\n}(MapLine);\n\nexport { MapSpline };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapSpline\"] = MapSpline;","/**\r\n * Map arched line module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapLine } from \"./MapLine\";\nimport { Polyarc } from \"../../core/elements/Polyarc\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Used to draw an arched line on the map.\r\n *\r\n * @see {@link IMapArcEvents} for a list of available events\r\n * @see {@link IMapArcAdapters} for a list of available Adapters\r\n */\n\nvar MapArc =\n/** @class */\nfunction (_super) {\n __extends(MapArc, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapArc() {\n var _this = // Init\n _super.call(this) || this;\n\n _this.className = \"MapArc\"; // Apply theme\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n MapArc.prototype.createLine = function () {\n this.line = new Polyarc();\n };\n\n Object.defineProperty(MapArc.prototype, \"shortestDistance\", {\n get: function get() {\n return false;\n },\n\n /**\r\n * `shortestDistance = true` is not supported by `MapArc`.\r\n *\r\n * Only [[MapLine]] supports it.\r\n *\r\n * @default false\r\n * @param value\r\n */\n set: function set(value) {},\n enumerable: true,\n configurable: true\n });\n return MapArc;\n}(MapLine);\n\nexport { MapArc };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapArc\"] = MapArc;","/**\r\n * Map spline series module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapLineSeries, MapLineSeriesDataItem } from \"./MapLineSeries\";\nimport { MapSpline } from \"./MapSpline\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapSplineSeries]]\r\n * @see {@link DataItem}\r\n */\n\nvar MapSplineSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapSplineSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapSplineSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapSplineSeriesDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n return MapSplineSeriesDataItem;\n}(MapLineSeriesDataItem);\n\nexport { MapSplineSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A series of map spline elements.\r\n *\r\n * @see {@link IMapSplineSeriesEvents} for a list of available Events\r\n * @see {@link IMapSplineSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar MapSplineSeries =\n/** @class */\nfunction (_super) {\n __extends(MapSplineSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapSplineSeries() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapSplineSeries\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n MapSplineSeries.prototype.createDataItem = function () {\n return new MapSplineSeriesDataItem();\n };\n /**\r\n * Returns a new line instance of suitable type.\r\n *\r\n * @return New line\r\n */\n\n\n MapSplineSeries.prototype.createLine = function () {\n return new MapSpline();\n };\n\n return MapSplineSeries;\n}(MapLineSeries);\n\nexport { MapSplineSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapSplineSeries\"] = MapSplineSeries;\nregistry.registeredClasses[\"MapSplineSeriesDataItem\"] = MapSplineSeriesDataItem;","/**\r\n * Map arc series module.\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { MapLineSeries, MapLineSeriesDataItem } from \"./MapLineSeries\";\nimport { MapArc } from \"./MapArc\";\nimport { registry } from \"../../core/Registry\";\n/**\r\n * ============================================================================\r\n * DATA ITEM\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Defines a [[DataItem]] for [[MapArcSeries]].\r\n *\r\n * @see {@link DataItem}\r\n */\n\nvar MapArcSeriesDataItem =\n/** @class */\nfunction (_super) {\n __extends(MapArcSeriesDataItem, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapArcSeriesDataItem() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapArcSeriesDataItem\";\n\n _this.applyTheme();\n\n return _this;\n }\n\n return MapArcSeriesDataItem;\n}(MapLineSeriesDataItem);\n\nexport { MapArcSeriesDataItem };\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * A series of arc elements. (curved lines)\r\n *\r\n * @see {@link IMapArcSeriesEvents} for a list of available Events\r\n * @see {@link IMapArcSeriesAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar MapArcSeries =\n/** @class */\nfunction (_super) {\n __extends(MapArcSeries, _super);\n /**\r\n * Constructor\r\n */\n\n\n function MapArcSeries() {\n var _this = _super.call(this) || this;\n\n _this.className = \"MapArcSeries\";\n\n _this.applyTheme();\n\n return _this;\n }\n /**\r\n * Returns a new/empty DataItem of the type appropriate for this object.\r\n *\r\n * @see {@link DataItem}\r\n * @return Data Item\r\n */\n\n\n MapArcSeries.prototype.createDataItem = function () {\n return new MapArcSeriesDataItem();\n };\n /**\r\n * Returns a new line instance of suitable type.\r\n *\r\n * @return New line\r\n */\n\n\n MapArcSeries.prototype.createLine = function () {\n return new MapArc();\n };\n\n return MapArcSeries;\n}(MapLineSeries);\n\nexport { MapArcSeries };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"MapArcSeries\"] = MapArcSeries;\nregistry.registeredClasses[\"MapArcSeriesDataItem\"] = MapArcSeriesDataItem;","/**\r\n * Zoom control module\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Container } from \"../../core/Container\";\nimport { Button } from \"../../core/elements/Button\";\nimport { RoundedRectangle } from \"../../core/elements/RoundedRectangle\";\nimport { MutableValueDisposer, MultiDisposer } from \"../../core/utils/Disposer\";\nimport { keyboard } from \"../../core/utils/Keyboard\";\nimport { getInteraction } from \"../../core/interaction/Interaction\";\nimport { percent } from \"../../core/utils/Percent\";\nimport { registry } from \"../../core/Registry\";\nimport { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\n\n/**\r\n * Creates a control for zooming the map.\r\n *\r\n * @see {@link IZoomControlEvents} for a list of available events\r\n * @see {@link IZoomControlAdapters} for a list of available Adapters\r\n * @important\r\n */\n\nvar ZoomControl =\n/** @class */\nfunction (_super) {\n __extends(ZoomControl, _super);\n /**\r\n * Constructor\r\n */\n\n\n function ZoomControl() {\n var _this = _super.call(this) || this;\n /**\r\n * A target map.\r\n */\n\n\n _this._chart = new MutableValueDisposer();\n _this.className = \"ZoomControl\";\n _this.align = \"right\";\n _this.valign = \"bottom\";\n _this.layout = \"vertical\";\n\n _this.padding(5, 5, 5, 5);\n\n var interfaceColors = new InterfaceColorSet();\n\n var plusButton = _this.createChild(Button);\n\n plusButton.shouldClone = false;\n plusButton.label.text = \"+\"; //plusButton.fontFamily = \"Verdana\";\n\n _this.plusButton = plusButton;\n\n var slider = _this.createChild(Container);\n\n slider.shouldClone = false;\n slider.background.fill = interfaceColors.getFor(\"alternativeBackground\");\n slider.background.fillOpacity = 0.05;\n slider.background.events.on(\"hit\", _this.handleBackgroundClick, _this, false);\n slider.events.on(\"sizechanged\", _this.updateThumbSize, _this, false);\n _this.slider = slider;\n var thumb = slider.createChild(Button);\n thumb.shouldClone = false;\n thumb.padding(0, 0, 0, 0);\n thumb.draggable = true;\n thumb.events.on(\"drag\", _this.handleThumbDrag, _this, false);\n _this.thumb = thumb;\n\n var minusButton = _this.createChild(Button);\n\n minusButton.shouldClone = false;\n minusButton.label.text = \"-\"; //minusButton.fontFamily = \"Verdana\";\n\n _this.minusButton = minusButton; // Set roles\n\n _this.thumb.role = \"slider\";\n _this.thumb.readerLive = \"polite\"; // Set reader text\n\n _this.thumb.readerTitle = _this.language.translate(\"Use arrow keys to zoom in and out\");\n _this.minusButton.readerTitle = _this.language.translate(\"Press ENTER to zoom in\");\n _this.plusButton.readerTitle = _this.language.translate(\"Press ENTER to zoom out\");\n\n _this.applyTheme();\n\n _this.events.on(\"propertychanged\", function (event) {\n if (event.property == \"layout\") {\n _this.fixLayout();\n }\n }, undefined, false);\n\n _this._disposers.push(_this._chart);\n\n _this.fixLayout();\n\n return _this;\n }\n /**\r\n * @ignore\r\n */\n\n\n ZoomControl.prototype.fixLayout = function () {\n var plusButton = this.plusButton;\n var minusButton = this.minusButton;\n var thumb = this.thumb;\n var slider = this.slider;\n plusButton.x = undefined;\n plusButton.y = undefined;\n minusButton.x = undefined;\n minusButton.y = undefined;\n thumb.x = undefined;\n thumb.y = undefined;\n slider.x = undefined;\n slider.y = undefined;\n plusButton.padding(6, 10, 6, 10);\n minusButton.padding(6, 10, 6, 10);\n minusButton.label.align = \"center\";\n minusButton.label.valign = \"middle\";\n plusButton.label.align = \"center\";\n plusButton.label.valign = \"middle\";\n\n if (this.layout == \"vertical\") {\n this.width = 40;\n this.height = undefined;\n minusButton.width = percent(100);\n minusButton.height = undefined;\n thumb.width = percent(100);\n thumb.height = undefined;\n plusButton.width = percent(100);\n plusButton.height = undefined;\n slider.width = percent(100);\n minusButton.marginTop = 1;\n plusButton.marginBottom = 2;\n slider.height = 0;\n minusButton.toFront();\n plusButton.toBack();\n thumb.minX = 0;\n thumb.maxX = 0;\n thumb.minY = 0;\n } else if (this.layout == \"horizontal\") {\n this.height = 40;\n this.width = undefined;\n minusButton.height = percent(100);\n minusButton.width = undefined;\n plusButton.height = percent(100);\n plusButton.width = undefined;\n thumb.height = percent(100);\n thumb.width = undefined;\n thumb.minX = 0;\n thumb.minY = 0;\n thumb.maxY = 0;\n slider.height = percent(100);\n slider.width = 0;\n minusButton.toBack();\n plusButton.toFront();\n }\n };\n /**\r\n * Handles zoom operation after clicking on the slider background.\r\n *\r\n * @ignore Exclude from docs\r\n * @param event Event\r\n */\n\n\n ZoomControl.prototype.handleBackgroundClick = function (event) {\n var sprite = event.target;\n var y = event.spritePoint.y;\n var chart = this.chart;\n var maxPower = Math.log(chart.maxZoomLevel) / Math.LN2;\n var minPower = Math.log(chart.minZoomLevel) / Math.LN2;\n var power = (sprite.pixelHeight - y) / sprite.pixelHeight * (minPower + (maxPower - minPower));\n var zoomLevel = Math.pow(2, power);\n chart.zoomToGeoPoint(chart.zoomGeoPoint, zoomLevel);\n };\n\n Object.defineProperty(ZoomControl.prototype, \"chart\", {\n /**\r\n * @return Map/chart\r\n */\n get: function get() {\n return this._chart.get();\n },\n\n /**\r\n * A main chart/map that this zoom control is for.\r\n *\r\n * @param chart Map/chart\r\n */\n set: function set(chart) {\n var _this = this;\n\n this._chart.set(chart, new MultiDisposer([chart.events.on(\"maxsizechanged\", this.updateThumbSize, this, false), chart.events.on(\"zoomlevelchanged\", this.updateThumb, this, false), this.minusButton.events.on(\"hit\", function () {\n chart.zoomOut(chart.zoomGeoPoint);\n }, chart, false), getInteraction().body.events.on(\"keyup\", function (ev) {\n if (_this.topParent.hasFocused) {\n // ENTER is now handled globally\n if (keyboard.isKey(ev.event, \"plus\")) {\n chart.zoomIn();\n } else if (keyboard.isKey(ev.event, \"minus\")) {\n chart.zoomOut();\n }\n }\n }, chart), this.plusButton.events.on(\"hit\", function () {\n chart.zoomIn(chart.zoomGeoPoint);\n }, chart, false)]));\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Updates the slider's thumb size based on the available zoom space.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n ZoomControl.prototype.updateThumbSize = function () {\n var chart = this.chart;\n\n if (chart) {\n var slider = this.slider;\n var thumb = this.thumb;\n\n if (this.layout == \"vertical\") {\n thumb.minHeight = Math.min(this.slider.pixelHeight, 20);\n thumb.height = slider.pixelHeight / this.stepCount;\n thumb.maxY = slider.pixelHeight - thumb.pixelHeight;\n\n if (thumb.pixelHeight <= 1) {\n thumb.visible = false;\n } else {\n thumb.visible = true;\n }\n } else {\n thumb.minWidth = Math.min(this.slider.pixelWidth, 20);\n thumb.width = slider.pixelWidth / this.stepCount;\n thumb.maxX = slider.pixelWidth - thumb.pixelWidth;\n\n if (thumb.pixelWidth <= 1) {\n thumb.visible = false;\n } else {\n thumb.visible = true;\n }\n }\n }\n };\n /**\r\n * Updates thumb according to current zoom position from map.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n ZoomControl.prototype.updateThumb = function () {\n var slider = this.slider;\n var chart = this.chart;\n var thumb = this.thumb;\n\n if (!thumb.isDown) {\n var step = (Math.log(chart.zoomLevel) - Math.log(this.chart.minZoomLevel)) / Math.LN2;\n\n if (this.layout == \"vertical\") {\n thumb.y = slider.pixelHeight - (slider.pixelHeight - thumb.pixelHeight) * step / this.stepCount - thumb.pixelHeight;\n } else {\n thumb.x = slider.pixelWidth * step / this.stepCount;\n }\n }\n };\n /**\r\n * Zooms the actual map when slider position changes.\r\n *\r\n * @ignore Exclude from docs\r\n */\n\n\n ZoomControl.prototype.handleThumbDrag = function () {\n var slider = this.slider;\n var chart = this.chart;\n var thumb = this.thumb;\n var step;\n var minStep = Math.log(this.chart.minZoomLevel) / Math.LN2;\n\n if (this.layout == \"vertical\") {\n step = this.stepCount * (slider.pixelHeight - thumb.pixelY - thumb.pixelHeight) / (slider.pixelHeight - thumb.pixelHeight);\n } else {\n step = this.stepCount * thumb.pixelX / slider.pixelWidth;\n }\n\n step = minStep + step;\n var zoomLevel = Math.pow(2, step);\n chart.zoomToGeoPoint(undefined, zoomLevel, false, 0);\n };\n\n Object.defineProperty(ZoomControl.prototype, \"stepCount\", {\n /**\r\n * Returns the step countfor the slider grid according to map's min and max\r\n * zoom level settings.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Step count\r\n */\n get: function get() {\n return Math.log(this.chart.maxZoomLevel) / Math.LN2 - Math.log(this.chart.minZoomLevel) / Math.LN2;\n },\n enumerable: true,\n configurable: true\n });\n /**\r\n * Creates a background element for slider control.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Background\r\n */\n\n ZoomControl.prototype.createBackground = function () {\n return new RoundedRectangle();\n };\n\n return ZoomControl;\n}(Container);\n\nexport { ZoomControl };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"ZoomControl\"] = ZoomControl;","import { atan, exp, halfPi, log, pi, tan, tau } from \"../math.js\";\nimport rotation from \"../rotation.js\";\nimport projection from \"./index.js\";\nexport function mercatorRaw(lambda, phi) {\n return [lambda, log(tan((halfPi + phi) / 2))];\n}\n\nmercatorRaw.invert = function (x, y) {\n return [x, 2 * atan(exp(y)) - halfPi];\n};\n\nexport default function () {\n return mercatorProjection(mercatorRaw).scale(961 / tau);\n}\nexport function mercatorProjection(project) {\n var m = projection(project),\n center = m.center,\n scale = m.scale,\n translate = m.translate,\n clipExtent = m.clipExtent,\n x0 = null,\n y0,\n x1,\n y1; // clip extent\n\n m.scale = function (_) {\n return arguments.length ? (scale(_), reclip()) : scale();\n };\n\n m.translate = function (_) {\n return arguments.length ? (translate(_), reclip()) : translate();\n };\n\n m.center = function (_) {\n return arguments.length ? (center(_), reclip()) : center();\n };\n\n m.clipExtent = function (_) {\n return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n };\n\n function reclip() {\n var k = pi * scale(),\n t = m(rotation(m.rotate()).invert([0, 0]));\n return clipExtent(x0 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);\n }\n\n return reclip();\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Mercator projection.\r\n */\n\nvar Mercator =\n/** @class */\nfunction (_super) {\n __extends(Mercator, _super);\n\n function Mercator() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoMercator();\n return _this;\n }\n\n return Mercator;\n}(Projection);\n\nexport { Mercator };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Mercator\"] = Mercator;","export var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var ceil = Math.ceil;\nexport var cos = Math.cos;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var log = Math.log;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var pow = Math.pow;\nexport var round = Math.round;\nexport var sign = Math.sign || function (x) {\n return x > 0 ? 1 : x < 0 ? -1 : 0;\n};\nexport var sin = Math.sin;\nexport var tan = Math.tan;\nexport var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var sqrt1_2 = Math.SQRT1_2;\nexport var sqrt2 = sqrt(2);\nexport var sqrtPi = sqrt(pi);\nexport var tau = pi * 2;\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\nexport function sinci(x) {\n return x ? x / Math.sin(x) : 1;\n}\nexport function asin(x) {\n return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\nexport function sqrt(x) {\n return x > 0 ? Math.sqrt(x) : 0;\n}\nexport function tanh(x) {\n x = exp(2 * x);\n return (x - 1) / (x + 1);\n}\nexport function sinh(x) {\n return (exp(x) - exp(-x)) / 2;\n}\nexport function cosh(x) {\n return (exp(x) + exp(-x)) / 2;\n}\nexport function arsinh(x) {\n return log(x + sqrt(x * x + 1));\n}\nexport function arcosh(x) {\n return log(x + sqrt(x * x - 1));\n}","import { geoProjection as projection } from \"d3-geo\";\nimport { atan, exp, log, quarterPi, pi, tan } from \"./math.js\";\nexport function millerRaw(lambda, phi) {\n return [lambda, 1.25 * log(tan(quarterPi + 0.4 * phi))];\n}\n\nmillerRaw.invert = function (x, y) {\n return [x, 2.5 * atan(exp(0.8 * y)) - 0.625 * pi];\n};\n\nexport default function () {\n return projection(millerRaw).scale(108.318);\n}","/**\r\n * Functionality for Miller projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\"; // @ts-ignore\n\nimport * as d3geoprojection from \"d3-geo-projection\";\n/**\r\n * Miller projection.\r\n */\n\nvar Miller =\n/** @class */\nfunction (_super) {\n __extends(Miller, _super);\n\n function Miller() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geoprojection.geoMiller();\n return _this;\n }\n\n return Miller;\n}(Projection);\n\nexport { Miller };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Miller\"] = Miller;","import { geoProjection as projection } from \"d3-geo\";\nimport { abs, asin, cos, epsilon, halfPi, pi, sin, sqrt } from \"./math.js\";\nexport function eckert6Raw(lambda, phi) {\n var k = (1 + halfPi) * sin(phi);\n\n for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; i++) {\n phi -= delta = (phi + sin(phi) - k) / (1 + cos(phi));\n }\n\n k = sqrt(2 + pi);\n return [lambda * (1 + cos(phi)) / k, 2 * phi / k];\n}\n\neckert6Raw.invert = function (x, y) {\n var j = 1 + halfPi,\n k = sqrt(j / 2);\n return [x * 2 * k / (1 + cos(y *= k)), asin((y + sin(y)) / j)];\n};\n\nexport default function () {\n return projection(eckert6Raw).scale(173.044);\n}","/**\r\n * Functionality for Eckert6 projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\"; // @ts-ignore\n\nimport * as d3geoprojection from \"d3-geo-projection\";\n/**\r\n * Eckert6 projection.\r\n */\n\nvar Eckert6 =\n/** @class */\nfunction (_super) {\n __extends(Eckert6, _super);\n\n function Eckert6() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geoprojection.geoEckert6();\n return _this;\n }\n\n return Eckert6;\n}(Projection);\n\nexport { Eckert6 };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Eckert6\"] = Eckert6;","import { asin, atan2, cos, sin, sqrt } from \"../math.js\";\nexport function azimuthalRaw(scale) {\n return function (x, y) {\n var cx = cos(x),\n cy = cos(y),\n k = scale(cx * cy);\n if (k === Infinity) return [2, 0];\n return [k * cy * sin(x), k * sin(y)];\n };\n}\nexport function azimuthalInvert(angle) {\n return function (x, y) {\n var z = sqrt(x * x + y * y),\n c = angle(z),\n sc = sin(c),\n cc = cos(c);\n return [atan2(x * sc, z * cc), asin(z && y * sc / z)];\n };\n}","import { asin, cos, epsilon, sin } from \"../math.js\";\nimport { azimuthalInvert } from \"./azimuthal.js\";\nimport projection from \"./index.js\";\nexport function orthographicRaw(x, y) {\n return [cos(y) * sin(x), sin(y)];\n}\northographicRaw.invert = azimuthalInvert(asin);\nexport default function () {\n return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar Orthographic =\n/** @class */\nfunction (_super) {\n __extends(Orthographic, _super);\n\n function Orthographic() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoOrthographic();\n return _this;\n }\n\n return Orthographic;\n}(Projection);\n\nexport { Orthographic };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Orthographic\"] = Orthographic;","import { atan, cos, sin } from \"../math.js\";\nimport { azimuthalInvert } from \"./azimuthal.js\";\nimport projection from \"./index.js\";\nexport function stereographicRaw(x, y) {\n var cy = cos(y),\n k = 1 + cos(x) * cy;\n return [cy * sin(x) / k, sin(y) / k];\n}\nstereographicRaw.invert = azimuthalInvert(function (z) {\n return 2 * atan(z);\n});\nexport default function () {\n return projection(stereographicRaw).scale(250).clipAngle(142);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar Stereographic =\n/** @class */\nfunction (_super) {\n __extends(Stereographic, _super);\n\n function Stereographic() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoStereographic();\n return _this;\n }\n\n return Stereographic;\n}(Projection);\n\nexport { Stereographic };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Stereographic\"] = Stereographic;","import { abs, asin, atan2, cos, epsilon, pi, sign, sin, sqrt } from \"../math.js\";\nimport { conicProjection } from \"./conic.js\";\nimport { cylindricalEqualAreaRaw } from \"./cylindricalEqualArea.js\";\nexport function conicEqualAreaRaw(y0, y1) {\n var sy0 = sin(y0),\n n = (sy0 + sin(y1)) / 2; // Are the parallels symmetrical around the Equator?\n\n if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0);\n var c = 1 + sy0 * (2 * n - sy0),\n r0 = sqrt(c) / n;\n\n function project(x, y) {\n var r = sqrt(c - 2 * n * sin(y)) / n;\n return [r * sin(x *= n), r0 - r * cos(x)];\n }\n\n project.invert = function (x, y) {\n var r0y = r0 - y,\n l = atan2(x, abs(r0y)) * sign(r0y);\n if (r0y * n < 0) l -= pi * sign(x) * sign(r0y);\n return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))];\n };\n\n return project;\n}\nexport default function () {\n return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]);\n}","import { asin, cos, sin } from \"../math.js\";\nexport function cylindricalEqualAreaRaw(phi0) {\n var cosPhi0 = cos(phi0);\n\n function forward(lambda, phi) {\n return [lambda * cosPhi0, sin(phi) / cosPhi0];\n }\n\n forward.invert = function (x, y) {\n return [x / cosPhi0, asin(y * cosPhi0)];\n };\n\n return forward;\n}","import { degrees, pi, radians } from \"../math.js\";\nimport { projectionMutator } from \"./index.js\";\nexport function conicProjection(projectAt) {\n var phi0 = 0,\n phi1 = pi / 3,\n m = projectionMutator(projectAt),\n p = m(phi0, phi1);\n\n p.parallels = function (_) {\n return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees];\n };\n\n return p;\n}","import conicEqualArea from \"./conicEqualArea.js\";\nexport default function () {\n return conicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar Albers =\n/** @class */\nfunction (_super) {\n __extends(Albers, _super);\n\n function Albers() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoAlbers();\n return _this;\n }\n\n return Albers;\n}(Projection);\n\nexport { Albers };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"Albers\"] = Albers;","import { epsilon } from \"../math.js\";\nimport albers from \"./albers.js\";\nimport conicEqualArea from \"./conicEqualArea.js\";\nimport { fitExtent, fitSize, fitWidth, fitHeight } from \"./fit.js\"; // The projections must have mutually exclusive clip regions on the sphere,\n// as this will avoid emitting interleaving lines and polygons.\n\nfunction multiplex(streams) {\n var n = streams.length;\n return {\n point: function point(x, y) {\n var i = -1;\n\n while (++i < n) {\n streams[i].point(x, y);\n }\n },\n sphere: function sphere() {\n var i = -1;\n\n while (++i < n) {\n streams[i].sphere();\n }\n },\n lineStart: function lineStart() {\n var i = -1;\n\n while (++i < n) {\n streams[i].lineStart();\n }\n },\n lineEnd: function lineEnd() {\n var i = -1;\n\n while (++i < n) {\n streams[i].lineEnd();\n }\n },\n polygonStart: function polygonStart() {\n var i = -1;\n\n while (++i < n) {\n streams[i].polygonStart();\n }\n },\n polygonEnd: function polygonEnd() {\n var i = -1;\n\n while (++i < n) {\n streams[i].polygonEnd();\n }\n }\n };\n} // A composite projection for the United States, configured by default for\n// 960×500. The projection also works quite well at 960×600 if you change the\n// scale to 1285 and adjust the translate accordingly. The set of standard\n// parallels for each region comes from USGS, which is published here:\n// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers\n\n\nexport default function () {\n var cache,\n cacheStream,\n lower48 = albers(),\n lower48Point,\n alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]),\n alaskaPoint,\n // EPSG:3338\n hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]),\n hawaiiPoint,\n // ESRI:102007\n _point,\n pointStream = {\n point: function point(x, y) {\n _point = [x, y];\n }\n };\n\n function albersUsa(coordinates) {\n var x = coordinates[0],\n y = coordinates[1];\n return _point = null, (lower48Point.point(x, y), _point) || (alaskaPoint.point(x, y), _point) || (hawaiiPoint.point(x, y), _point);\n }\n\n albersUsa.invert = function (coordinates) {\n var k = lower48.scale(),\n t = lower48.translate(),\n x = (coordinates[0] - t[0]) / k,\n y = (coordinates[1] - t[1]) / k;\n return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates);\n };\n\n albersUsa.stream = function (stream) {\n return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);\n };\n\n albersUsa.precision = function (_) {\n if (!arguments.length) return lower48.precision();\n lower48.precision(_), alaska.precision(_), hawaii.precision(_);\n return reset();\n };\n\n albersUsa.scale = function (_) {\n if (!arguments.length) return lower48.scale();\n lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);\n return albersUsa.translate(lower48.translate());\n };\n\n albersUsa.translate = function (_) {\n if (!arguments.length) return lower48.translate();\n var k = lower48.scale(),\n x = +_[0],\n y = +_[1];\n lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream);\n alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream);\n hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream);\n return reset();\n };\n\n albersUsa.fitExtent = function (extent, object) {\n return fitExtent(albersUsa, extent, object);\n };\n\n albersUsa.fitSize = function (size, object) {\n return fitSize(albersUsa, size, object);\n };\n\n albersUsa.fitWidth = function (width, object) {\n return fitWidth(albersUsa, width, object);\n };\n\n albersUsa.fitHeight = function (height, object) {\n return fitHeight(albersUsa, height, object);\n };\n\n function reset() {\n cache = cacheStream = null;\n return albersUsa;\n }\n\n return albersUsa.scale(1070);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar AlbersUsa =\n/** @class */\nfunction (_super) {\n __extends(AlbersUsa, _super);\n\n function AlbersUsa() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoAlbersUsa();\n return _this;\n }\n\n return AlbersUsa;\n}(Projection);\n\nexport { AlbersUsa };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AlbersUsa\"] = AlbersUsa;","import projection from \"./index.js\";\nimport { abs, epsilon } from \"../math.js\";\nexport function naturalEarth1Raw(lambda, phi) {\n var phi2 = phi * phi,\n phi4 = phi2 * phi2;\n return [lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))];\n}\n\nnaturalEarth1Raw.invert = function (x, y) {\n var phi = y,\n i = 25,\n delta;\n\n do {\n var phi2 = phi * phi,\n phi4 = phi2 * phi2;\n phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));\n } while (abs(delta) > epsilon && --i > 0);\n\n return [x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), phi];\n};\n\nexport default function () {\n return projection(naturalEarth1Raw).scale(175.295);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar NaturalEarth1 =\n/** @class */\nfunction (_super) {\n __extends(NaturalEarth1, _super);\n\n function NaturalEarth1() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoNaturalEarth1();\n return _this;\n }\n\n return NaturalEarth1;\n}(Projection);\n\nexport { NaturalEarth1 };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"NaturalEarth1\"] = NaturalEarth1;","import { asin, sqrt } from \"../math.js\";\nimport { azimuthalRaw, azimuthalInvert } from \"./azimuthal.js\";\nimport projection from \"./index.js\";\nexport var azimuthalEqualAreaRaw = azimuthalRaw(function (cxcy) {\n return sqrt(2 / (1 + cxcy));\n});\nazimuthalEqualAreaRaw.invert = azimuthalInvert(function (z) {\n return 2 * asin(z / 2);\n});\nexport default function () {\n return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar AzimuthalEqualArea =\n/** @class */\nfunction (_super) {\n __extends(AzimuthalEqualArea, _super);\n\n function AzimuthalEqualArea() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoAzimuthalEqualArea();\n return _this;\n }\n\n return AzimuthalEqualArea;\n}(Projection);\n\nexport { AzimuthalEqualArea };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"AzimuthalEqualArea\"] = AzimuthalEqualArea;","import projection from \"./index.js\";\nimport { abs, asin, cos, epsilon2, sin, sqrt } from \"../math.js\";\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = sqrt(3) / 2,\n iterations = 12;\nexport function equalEarthRaw(lambda, phi) {\n var l = asin(M * sin(phi)),\n l2 = l * l,\n l6 = l2 * l2 * l2;\n return [lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))];\n}\n\nequalEarthRaw.invert = function (x, y) {\n var l = y,\n l2 = l * l,\n l6 = l2 * l2 * l2;\n\n for (var i = 0, delta, fy, fpy; i < iterations; ++i) {\n fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;\n fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);\n l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;\n if (abs(delta) < epsilon2) break;\n }\n\n return [M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l), asin(sin(l) / M)];\n};\n\nexport default function () {\n return projection(equalEarthRaw).scale(177.158);\n}","/**\r\n * Functionality for Mercator projection\r\n *\r\n * The function(s) below are from D3.js library (https://d3js.org/)\r\n *\r\n * ```\r\n * Copyright 2017 Mike Bostock\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its\r\n * contributors may be used to endorse or promote products derived from this\r\n * software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n * ```\r\n */\nimport { __extends } from \"tslib\";\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\n\nimport { Projection } from \"./Projection\";\nimport { registry } from \"../../../core/Registry\";\nimport * as d3geo from \"d3-geo\";\n/**\r\n * Orthographic projection.\r\n */\n\nvar EqualEarth =\n/** @class */\nfunction (_super) {\n __extends(EqualEarth, _super);\n\n function EqualEarth() {\n var _this = _super.call(this) || this;\n\n _this.d3Projection = d3geo.geoEqualEarth();\n return _this;\n }\n\n return EqualEarth;\n}(Projection);\n\nexport { EqualEarth };\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\n\nregistry.registeredClasses[\"EqualEarth\"] = EqualEarth;","var map = {\n \"type\": \"FeatureCollection\",\n \"features\": [{\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-134.6803, 58.1617], [-134.2401, 58.1441], [-134.3069, 58.0344], [-134.2671, 57.8845], [-133.937, 57.5816], [-133.9737, 57.4513], [-133.9253, 57.3368], [-134.1, 57.3001], [-134.2602, 57.1468], [-134.4353, 57.057], [-134.5915, 57.0919], [-134.4868, 57.482], [-134.6599, 57.6381], [-134.8369, 58.3201], [-134.6803, 58.1617]]], [[[-174.6774, 52.035], [-175.1176, 52.047], [-174.3061, 52.2161], [-174.4355, 52.3172], [-174.1689, 52.4202], [-174.0184, 52.3318], [-174.1206, 52.1352], [-174.3435, 52.0778], [-174.6774, 52.035]]], [[[-172.7422, 60.4575], [-172.5261, 60.3918], [-172.6358, 60.3288], [-173.074, 60.4932], [-172.8602, 60.5057], [-172.7422, 60.4575]]], [[[-176.5933, 51.8667], [-176.4373, 51.7543], [-176.7709, 51.6299], [-176.8744, 51.7905], [-176.7364, 51.84], [-176.6984, 51.986], [-176.5499, 51.9441], [-176.5933, 51.8667]]], [[[-165.8416, 54.0707], [-166.0364, 54.0472], [-166.0877, 54.1691], [-165.8928, 54.207], [-165.7042, 54.1199], [-165.8416, 54.0707]]], [[[-171.463, 63.64], [-171.0349, 63.5855], [-170.4304, 63.6988], [-170.1218, 63.6175], [-170.0174, 63.4917], [-169.6242, 63.4305], [-169.4276, 63.3483], [-168.996, 63.3473], [-168.716, 63.3106], [-168.8524, 63.1712], [-169.3647, 63.1711], [-169.6763, 62.9561], [-169.7778, 63.0938], [-170.1896, 63.1963], [-170.2727, 63.2843], [-170.5271, 63.3793], [-170.8484, 63.4444], [-171.0613, 63.4459], [-171.4012, 63.3392], [-171.6318, 63.3512], [-171.791, 63.4247], [-171.7464, 63.7031], [-171.463, 63.64]]], [[[-147.6583, 60.4505], [-147.7321, 60.222], [-147.8714, 60.2297], [-147.7945, 60.4599], [-147.6583, 60.4505]]], [[[-152.4169, 58.3602], [-152.3163, 58.4135], [-151.9825, 58.2443], [-152.1091, 58.1612], [-152.5377, 58.101], [-152.7815, 58.016], [-152.9826, 57.9971], [-153.3813, 58.0872], [-152.9762, 58.2969], [-152.7719, 58.2786], [-152.8411, 58.4164], [-152.6747, 58.4505], [-152.4169, 58.3602]]], [[[-134.9697, 57.3515], [-134.8232, 57.1565], [-134.6207, 56.7183], [-134.6571, 56.5233], [-134.6301, 56.3025], [-134.7503, 56.2408], [-134.9806, 56.5189], [-135.0178, 56.6601], [-135.159, 56.7254], [-135.1631, 56.8241], [-135.3306, 56.8218], [-135.3151, 56.9318], [-135.1996, 57.0273], [-135.3413, 57.0816], [-135.3753, 57.1885], [-135.5019, 57.2438], [-135.6089, 57.0715], [-135.7677, 57.1004], [-135.7871, 57.3172], [-135.5805, 57.39], [-135.4872, 57.5164], [-135.3463, 57.5332], [-134.9697, 57.3515]]], [[[-159.873, 55.1287], [-160.0384, 55.0445], [-160.1721, 55.1231], [-159.8983, 55.2213], [-159.873, 55.1287]]], [[[-141.0022, 69.6508], [-141.0022, 68.7742], [-141.0022, 68.1897], [-141.0022, 67.3132], [-141.0022, 66.1443], [-141.0022, 65.5599], [-141.0022, 64.3911], [-141.0022, 63.2223], [-141.0022, 62.0535], [-141.0022, 61.1768], [-141.0022, 60.3002], [-140.5254, 60.2183], [-140.4529, 60.2998], [-139.9733, 60.1832], [-139.6763, 60.3283], [-139.0793, 60.3436], [-139.1852, 60.0835], [-139.0434, 59.9933], [-138.7054, 59.9013], [-138.6323, 59.7783], [-137.5933, 59.2262], [-137.4386, 58.9032], [-137.2776, 58.9882], [-136.8133, 59.15], [-136.5788, 59.1523], [-136.4667, 59.28], [-136.4664, 59.4591], [-136.2472, 59.533], [-136.3218, 59.6048], [-135.9347, 59.6627], [-135.4759, 59.7932], [-135.051, 59.5786], [-135.0713, 59.4414], [-134.9437, 59.2882], [-134.4407, 59.0854], [-134.2185, 58.8498], [-133.8207, 58.705], [-133.4011, 58.4109], [-133.4226, 58.337], [-133.2753, 58.2229], [-132.5505, 57.4999], [-132.2322, 57.1986], [-132.3379, 57.0794], [-132.0315, 57.0265], [-132.1043, 56.8568], [-131.8662, 56.7929], [-131.8243, 56.5899], [-131.5751, 56.5988], [-131.0829, 56.4048], [-130.7416, 56.3408], [-130.6491, 56.2637], [-130.4771, 56.2306], [-130.4132, 56.1225], [-130.0229, 56.0145], [-130.0251, 55.8883], [-130.1465, 55.6545], [-130.0365, 55.2979], [-130.2141, 55.0259], [-130.4932, 54.8342], [-130.6158, 54.7909], [-130.8496, 54.8076], [-131.0478, 55.1577], [-130.856, 55.3551], [-130.9185, 55.736], [-131.1277, 55.9601], [-131.2876, 56.0121], [-131.7842, 55.8765], [-131.8694, 55.6472], [-131.9834, 55.535], [-132.119, 55.5697], [-132.2234, 55.7211], [-132.0058, 55.9301], [-131.8438, 56.16], [-132.0219, 56.3801], [-132.182, 56.4206], [-132.3577, 56.6258], [-132.476, 56.6497], [-132.4871, 56.7664], [-132.6395, 56.7964], [-132.8022, 56.8951], [-132.8143, 57.0406], [-133.4658, 57.1721], [-133.4367, 57.3368], [-133.539, 57.5542], [-133.6487, 57.6423], [-133.5542, 57.6951], [-133.1171, 57.5662], [-133.6573, 57.841], [-133.7441, 57.8546], [-134.0311, 58.0722], [-134.0633, 58.2111], [-134.2088, 58.2329], [-134.4854, 58.3672], [-134.6636, 58.3847], [-134.7761, 58.4538], [-134.9425, 58.6463], [-134.9648, 58.7422], [-135.1319, 58.8428], [-135.2174, 59.0766], [-135.3303, 59.2391], [-135.5023, 59.2024], [-135.3862, 59.0876], [-135.334, 58.9096], [-135.0497, 58.3068], [-135.1415, 58.2335], [-135.3025, 58.2559], [-135.5718, 58.412], [-135.8735, 58.3942], [-135.8617, 58.5771], [-136.0455, 58.7891], [-136.2258, 58.7655], [-136.4511, 58.8463], [-136.5662, 58.9409], [-136.831, 58.9838], [-136.8791, 58.8815], [-136.5682, 58.7863], [-136.4101, 58.7006], [-136.4838, 58.6177], [-136.2246, 58.6023], [-136.1029, 58.5063], [-136.1296, 58.3504], [-136.4624, 58.3279], [-136.5826, 58.2453], [-137.072, 58.3951], [-137.544, 58.5812], [-137.75, 58.7071], [-138.0269, 58.9414], [-138.3525, 59.0873], [-139.3409, 59.3757], [-139.7991, 59.5463], [-139.6116, 59.6103], [-139.5056, 59.7263], [-139.5822, 59.8484], [-139.5189, 60.0172], [-139.8502, 59.8307], [-140.2167, 59.7266], [-140.4199, 59.7107], [-140.8432, 59.7488], [-141.4083, 59.9028], [-141.2946, 59.98], [-141.3295, 60.0828], [-141.6702, 59.9698], [-142.5486, 60.0861], [-142.9457, 60.097], [-143.5061, 60.055], [-143.805, 60.0129], [-144.1472, 60.0163], [-144.0885, 60.0843], [-144.3326, 60.191], [-144.643, 60.2246], [-144.9013, 60.3351], [-144.8245, 60.5336], [-144.984, 60.537], [-145.2483, 60.3801], [-145.8989, 60.4782], [-145.6749, 60.6511], [-146.1491, 60.6607], [-146.251, 60.7491], [-146.6385, 60.8973], [-146.5828, 61.1278], [-146.874, 61.0048], [-147.255, 60.9782], [-147.321, 60.9255], [-147.5926, 60.9795], [-147.6557, 60.9095], [-147.8911, 60.8899], [-148.0052, 60.9686], [-147.8448, 61.1864], [-148.2086, 61.0299], [-148.3444, 60.8536], [-148.5574, 60.8029], [-148.2679, 60.6997], [-148.2964, 60.532], [-148.0507, 60.5671], [-147.9641, 60.4849], [-148.1817, 60.393], [-148.1976, 60.1678], [-148.3331, 60.122], [-148.4307, 59.9892], [-148.8427, 59.9512], [-149.1216, 60.0335], [-149.4323, 60.0011], [-149.5491, 59.8943], [-149.7948, 59.8559], [-149.7825, 59.7503], [-150.198, 59.5666], [-150.5815, 59.5645], [-150.6775, 59.427], [-150.9608, 59.2439], [-151.3664, 59.2456], [-151.7382, 59.1885], [-151.9641, 59.2852], [-151.8499, 59.4064], [-151.3996, 59.5164], [-151.1894, 59.6377], [-151.7638, 59.7], [-151.8532, 59.7821], [-151.7345, 59.9884], [-151.4515, 60.2027], [-151.3127, 60.4665], [-151.3218, 60.7429], [-150.9538, 60.8413], [-150.4413, 61.0236], [-149.9975, 60.9352], [-149.6325, 60.9519], [-149.1728, 60.8805], [-149.1422, 60.9357], [-149.5925, 60.9939], [-149.9677, 61.1218], [-149.9452, 61.2943], [-150.4718, 61.26], [-150.6123, 61.3012], [-150.9455, 61.1982], [-151.1502, 61.0859], [-151.5935, 60.9796], [-151.734, 60.9108], [-151.7504, 60.7549], [-151.9962, 60.6822], [-152.2707, 60.5281], [-152.2603, 60.4095], [-152.3689, 60.3364], [-152.6539, 60.2385], [-152.6286, 60.0411], [-152.7595, 59.9209], [-153.106, 59.8751], [-153.0482, 59.73], [-153.364, 59.6598], [-153.4144, 59.7402], [-153.8141, 59.4737], [-154.0883, 59.3634], [-154.1783, 59.1556], [-154.1298, 59.1198], [-153.6564, 59.0386], [-153.4183, 58.9599], [-153.3344, 58.8579], [-153.6173, 58.6547], [-153.8619, 58.5878], [-154.0199, 58.4929], [-154.0859, 58.3658], [-154.2081, 58.2887], [-154.247, 58.1594], [-154.5706, 58.118], [-154.5849, 58.0556], [-155.0069, 58.0161], [-155.0993, 57.9133], [-155.3128, 57.8071], [-155.5903, 57.7336], [-155.7779, 57.5683], [-156.0002, 57.545], [-156.0554, 57.4476], [-156.2422, 57.4493], [-156.4784, 57.3279], [-156.3976, 57.2406], [-156.4751, 57.1052], [-156.629, 57.0099], [-156.7799, 57.0057], [-157.2058, 56.812], [-157.3902, 56.8099], [-157.5784, 56.6345], [-157.8691, 56.6452], [-157.9783, 56.5432], [-158.4144, 56.4358], [-158.5374, 56.3354], [-158.3861, 56.3015], [-158.2757, 56.1962], [-158.5233, 56.0724], [-158.6267, 56.1547], [-158.7898, 55.987], [-159.5232, 55.81], [-159.743, 55.8438], [-159.9623, 55.7949], [-160.4627, 55.5578], [-160.8967, 55.5136], [-161.0995, 55.4057], [-161.3819, 55.3713], [-161.4767, 55.465], [-161.3727, 55.5563], [-161.4588, 55.6291], [-161.6836, 55.53], [-161.7416, 55.3912], [-162.074, 55.1393], [-162.3329, 55.0503], [-162.5419, 55.2427], [-162.6441, 55.218], [-162.6143, 55.0714], [-162.6744, 54.9965], [-162.865, 54.9546], [-163.1196, 55.0647], [-163.1311, 54.9166], [-163.2887, 54.8376], [-163.2788, 55.1219], [-163.1145, 55.194], [-162.962, 55.1839], [-162.5133, 55.45], [-162.1571, 55.7195], [-161.6973, 55.9072], [-161.2156, 56.0214], [-160.8513, 55.7718], [-160.7584, 55.8547], [-160.3085, 55.8645], [-160.5391, 56.0063], [-160.302, 56.3142], [-159.7851, 56.5617], [-159.2831, 56.6886], [-158.9904, 56.86], [-158.6752, 56.7949], [-158.6608, 57.0394], [-158.3209, 57.2979], [-158.0457, 57.4095], [-157.8944, 57.5114], [-157.6076, 57.6015], [-157.684, 57.7439], [-157.6109, 58.0508], [-157.4427, 58.1722], [-157.5236, 58.4213], [-157.4609, 58.503], [-157.2288, 58.6409], [-156.9747, 58.7363], [-157.142, 58.8777], [-157.6657, 58.7485], [-158.0219, 58.6402], [-158.3026, 58.6418], [-158.5032, 58.8504], [-158.4256, 58.9993], [-158.5144, 59.0728], [-158.7606, 58.9501], [-158.8614, 58.7187], [-158.7721, 58.5203], [-158.7886, 58.4409], [-158.9507, 58.4046], [-159.0827, 58.4697], [-159.3583, 58.7213], [-159.6702, 58.9111], [-159.9202, 58.8199], [-160.1526, 58.9059], [-160.3631, 59.0511], [-160.8171, 58.8718], [-161.2159, 58.801], [-161.3613, 58.6695], [-161.7555, 58.6121], [-162.1449, 58.6443], [-161.8564, 58.7171], [-161.7244, 58.7943], [-161.7805, 58.8974], [-161.7945, 59.1094], [-161.9811, 59.1461], [-162.0233, 59.284], [-161.9201, 59.3654], [-161.8287, 59.5886], [-162.1382, 59.98], [-162.2425, 60.1783], [-162.4213, 60.284], [-162.1389, 60.6143], [-162.2651, 60.5953], [-162.5996, 60.297], [-162.5005, 60.1266], [-162.5707, 59.9897], [-162.7326, 59.9937], [-162.8779, 59.9228], [-163.2194, 59.8456], [-163.6804, 59.8015], [-163.9069, 59.8068], [-164.1428, 59.8968], [-164.1316, 59.9943], [-164.4705, 60.1493], [-164.6623, 60.3039], [-164.7999, 60.3073], [-165.0611, 60.4125], [-165.0265, 60.5006], [-165.3538, 60.5412], [-165.016, 60.7401], [-164.8051, 60.892], [-164.37, 60.7959], [-164.2656, 60.7247], [-163.8949, 60.7451], [-163.73, 60.5899], [-163.5287, 60.6645], [-163.421, 60.7575], [-163.6554, 60.8775], [-163.749, 60.9697], [-163.9946, 60.8647], [-164.4415, 60.8699], [-164.754, 60.9313], [-165.0657, 60.9207], [-165.1755, 60.9656], [-165.0771, 61.0942], [-165.3921, 61.2123], [-165.3808, 61.1063], [-165.5659, 61.1023], [-165.6914, 61.2999], [-165.9063, 61.4037], [-165.7971, 61.4912], [-166.1005, 61.6451], [-165.8346, 61.6793], [-166.0788, 61.8031], [-165.6128, 61.8693], [-165.7439, 62.0117], [-165.7073, 62.1005], [-165.1946, 62.4735], [-164.7927, 62.6232], [-164.8454, 62.801], [-164.6775, 63.0205], [-164.409, 63.2151], [-164.1076, 63.2617], [-163.7363, 63.1928], [-163.3588, 63.0458], [-163.0622, 63.0797], [-162.6215, 63.2658], [-162.2828, 63.5292], [-162.1125, 63.5342], [-161.974, 63.453], [-161.5054, 63.4682], [-161.0997, 63.5579], [-160.8265, 63.7293], [-160.7786, 63.8189], [-160.9876, 64.2513], [-161.2201, 64.3966], [-161.3857, 64.44], [-160.932, 64.5791], [-160.836, 64.6819], [-160.887, 64.7955], [-161.1869, 64.9241], [-161.4663, 64.7948], [-161.7594, 64.8162], [-161.8684, 64.7427], [-162.1722, 64.6781], [-162.807, 64.3742], [-162.8764, 64.5164], [-163.0517, 64.5197], [-163.1444, 64.4238], [-163.4862, 64.5498], [-163.7131, 64.5883], [-164.3039, 64.5839], [-164.8995, 64.4607], [-166.1428, 64.5828], [-166.3251, 64.6257], [-166.4814, 64.7281], [-166.4152, 64.9265], [-166.5509, 64.953], [-166.8269, 65.0961], [-166.531, 65.1547], [-166.4516, 65.2473], [-166.6654, 65.3383], [-167.404, 65.4221], [-167.9873, 65.5678], [-168.0884, 65.6578], [-167.58, 65.7583], [-167.4053, 65.8593], [-167.0742, 65.8771], [-166.7477, 66.0518], [-166.2146, 66.1703], [-165.7237, 66.1125], [-165.5602, 66.1671], [-165.8403, 66.245], [-165.7762, 66.319], [-165.4494, 66.4099], [-165.0639, 66.4378], [-164.6741, 66.555], [-164.0583, 66.6108], [-163.7755, 66.5311], [-163.9029, 66.3784], [-163.894, 66.2869], [-164.0337, 66.2156], [-163.6954, 66.0839], [-163.1715, 66.0754], [-162.8865, 66.0992], [-162.5868, 66.0509], [-162.2143, 66.071], [-161.8163, 66.0536], [-161.5569, 66.2505], [-161.2011, 66.2193], [-161.1203, 66.3343], [-161.5444, 66.4071], [-161.8281, 66.3709], [-161.8876, 66.4931], [-162.1912, 66.6932], [-162.4675, 66.7357], [-162.6075, 66.8944], [-162.3617, 66.9473], [-162.1314, 66.8014], [-161.9096, 66.5596], [-161.591, 66.4595], [-161.3359, 66.4964], [-161.0481, 66.4742], [-160.6505, 66.3731], [-160.2317, 66.4203], [-160.2625, 66.5724], [-160.6438, 66.605], [-160.864, 66.6709], [-161.398, 66.5519], [-161.8566, 66.7004], [-161.8787, 66.804], [-161.6222, 66.9793], [-161.9655, 67.0495], [-162.3915, 67.0199], [-163.0017, 67.0273], [-163.5318, 67.1025], [-163.7206, 67.1955], [-163.9427, 67.4776], [-164.1252, 67.6067], [-165.386, 68.0456], [-165.9596, 68.1559], [-166.236, 68.278], [-166.5745, 68.3203], [-166.3805, 68.4251], [-166.182, 68.7972], [-166.2091, 68.8853], [-165.5095, 68.8676], [-165.0439, 68.8825], [-164.3024, 68.9365], [-163.868, 69.0367], [-163.5356, 69.1701], [-163.1615, 69.388], [-163.0936, 69.6107], [-162.9521, 69.7581], [-161.881, 70.3318], [-161.639, 70.2346], [-160.9963, 70.3046], [-160.6341, 70.4464], [-160.1172, 70.5912], [-159.9632, 70.5682], [-160.095, 70.3333], [-159.8552, 70.3242], [-159.7463, 70.5305], [-159.9618, 70.6341], [-159.6809, 70.7868], [-159.3145, 70.8785], [-158.9963, 70.8016], [-158.4844, 70.8411], [-157.9985, 70.8453], [-157.6056, 70.9412], [-157.1953, 71.0933], [-156.7833, 71.3189], [-155.8112, 71.1885], [-155.5795, 71.1211], [-155.8043, 70.9955], [-156.1466, 70.9279], [-155.8722, 70.8346], [-155.5794, 70.8943], [-155.1669, 71.0993], [-154.9438, 71.0831], [-154.6737, 70.9871], [-154.7852, 70.8943], [-154.1953, 70.8011], [-153.9182, 70.8773], [-153.2329, 70.9326], [-152.7849, 70.876], [-152.4912, 70.881], [-152.2329, 70.8103], [-152.4705, 70.6536], [-152.1729, 70.5567], [-151.769, 70.5602], [-151.9447, 70.4521], [-151.2248, 70.4188], [-150.6627, 70.5099], [-150.4032, 70.4439], [-150.1525, 70.4437], [-149.8701, 70.5096], [-149.2695, 70.5008], [-148.6884, 70.4163], [-148.4793, 70.3179], [-148.2487, 70.3567], [-147.8695, 70.3033], [-147.7054, 70.2172], [-147.0629, 70.1704], [-146.7449, 70.1917], [-145.8232, 70.16], [-145.1974, 70.0087], [-144.6192, 69.9821], [-144.4169, 70.039], [-143.7465, 70.102], [-143.2183, 70.1162], [-142.7079, 70.0338], [-142.2969, 69.8699], [-141.6992, 69.7704], [-141.4079, 69.6534], [-141.0022, 69.6508]]], [[[-134.3127, 58.2289], [-134.594, 58.2431], [-134.52, 58.3326], [-134.3127, 58.2289]]], [[[-132.8623, 54.8944], [-132.6173, 54.8925], [-132.6469, 54.7562], [-132.8073, 54.7091], [-133.1227, 54.9698], [-133.2511, 55.1751], [-133.418, 55.2107], [-133.2966, 55.3258], [-133.0974, 55.2137], [-132.8623, 54.8944]]], [[[-160.919, 58.5771], [-161.0703, 58.5691], [-161.1315, 58.6681], [-160.9863, 58.7364], [-160.7151, 58.7953], [-160.919, 58.5771]]], [[[-167.9644, 53.345], [-168.2707, 53.2381], [-168.446, 53.0844], [-168.6986, 52.9634], [-169.0659, 52.834], [-168.7959, 53.0449], [-168.7596, 53.175], [-168.639, 53.2558], [-168.4367, 53.2569], [-168.3572, 53.4576], [-168.1931, 53.5333], [-167.9857, 53.5581], [-167.8047, 53.4849], [-167.9644, 53.345]]], [[[-166.1354, 60.3835], [-166.0436, 60.3339], [-165.7297, 60.3142], [-165.7123, 60.0694], [-165.5918, 59.9131], [-165.9467, 59.89], [-166.1876, 59.7738], [-166.343, 59.8345], [-166.6276, 59.8647], [-167.1389, 60.0085], [-167.4364, 60.2067], [-167.2517, 60.2335], [-166.8363, 60.2169], [-166.7844, 60.2965], [-166.4757, 60.3827], [-166.1354, 60.3835]]], [[[-177.1482, 51.7167], [-177.5776, 51.6942], [-177.2098, 51.8414], [-177.1482, 51.7167]]], [[[-146.394, 60.4496], [-146.1283, 60.3926], [-146.6184, 60.2737], [-146.7026, 60.4085], [-146.5603, 60.4805], [-146.394, 60.4496]]], [[[-147.7358, 59.8132], [-147.8143, 59.902], [-147.4658, 60.097], [-147.12, 60.3631], [-146.9867, 60.2544], [-147.3184, 60.0753], [-147.4993, 59.8902], [-147.7358, 59.8132]]], [[[-177.8791, 51.6497], [-178.0589, 51.6726], [-177.9864, 51.7643], [-178.1945, 51.8822], [-177.9538, 51.9184], [-177.7706, 51.7779], [-177.8791, 51.6497]]], [[[-135.7304, 58.2443], [-135.5875, 58.1468], [-135.6133, 57.9919], [-135.3466, 58.124], [-135.0021, 58.0511], [-134.928, 57.9528], [-134.9706, 57.8173], [-135.2312, 57.8158], [-135.2495, 57.7326], [-134.9789, 57.7243], [-134.8731, 57.5893], [-134.9315, 57.4811], [-135.0848, 57.511], [-135.4979, 57.6623], [-135.6086, 57.6507], [-135.6178, 57.4804], [-135.692, 57.4199], [-135.9108, 57.4465], [-136.0766, 57.6745], [-136.4599, 57.8731], [-136.5686, 57.9722], [-136.5123, 58.0959], [-136.1424, 58.1539], [-135.7871, 58.2684], [-135.7304, 58.2443]]], [[[-166.6153, 53.9009], [-166.4975, 53.8835], [-166.3724, 53.999], [-166.2309, 53.9326], [-166.4887, 53.7855], [-166.5492, 53.701], [-166.4442, 53.6518], [-166.7704, 53.476], [-167.1537, 53.4078], [-167.5225, 53.2762], [-167.6695, 53.2599], [-167.8088, 53.3238], [-167.5302, 53.3937], [-167.1361, 53.5265], [-167.0157, 53.6984], [-167.1182, 53.8726], [-166.9781, 53.9629], [-166.6274, 53.9957], [-166.6153, 53.9009]]], [[[-131.3398, 55.0798], [-131.232, 54.9037], [-131.4062, 54.8943], [-131.4314, 54.9965], [-131.5951, 55.0908], [-131.5778, 55.2009], [-131.4046, 55.2133], [-131.3398, 55.0798]]], [[[-152.898, 57.8239], [-152.5115, 57.8514], [-152.4115, 57.6462], [-152.2163, 57.5771], [-152.4122, 57.4547], [-152.7814, 57.4534], [-152.679, 57.3452], [-152.879, 57.3208], [-153.0516, 57.2377], [-153.2744, 57.2263], [-153.5036, 57.138], [-153.6465, 57.0295], [-153.7572, 56.8584], [-153.9727, 56.7742], [-154.0709, 56.8207], [-153.7932, 56.9895], [-153.9994, 57.05], [-154.0653, 57.1336], [-154.3244, 57.1318], [-154.1843, 57.0053], [-154.3389, 56.9209], [-154.4988, 57.0365], [-154.5693, 57.2059], [-154.706, 57.3353], [-154.6732, 57.4461], [-154.5353, 57.5595], [-154.2814, 57.6381], [-154.0298, 57.6307], [-153.8054, 57.3582], [-153.8184, 57.5956], [-153.6931, 57.6634], [-153.9044, 57.8199], [-153.6627, 57.8579], [-153.5245, 57.731], [-153.2003, 57.82], [-153.1605, 57.972], [-152.8504, 57.8968], [-152.898, 57.8239]]], [[[-163.4761, 54.9808], [-163.3581, 54.7356], [-163.583, 54.6256], [-164.0733, 54.621], [-164.2346, 54.5713], [-164.4635, 54.4273], [-164.8234, 54.4191], [-164.8877, 54.6078], [-164.7062, 54.692], [-164.5298, 54.8808], [-164.2737, 54.9], [-163.868, 55.0392], [-163.6075, 55.0508], [-163.4761, 54.9808]]], [[[-133.9896, 56.845], [-133.8309, 56.7813], [-133.7384, 56.6505], [-133.8553, 56.5822], [-133.8846, 56.2921], [-133.9497, 56.1277], [-134.1896, 56.0769], [-134.245, 56.2032], [-134.1955, 56.4134], [-134.0844, 56.4564], [-134.2902, 56.58], [-134.3844, 56.724], [-134.3737, 56.8387], [-134.1433, 56.9323], [-133.9896, 56.845]]], [[[-133.5661, 56.3393], [-133.203, 56.3198], [-133.0818, 56.1942], [-133.0966, 56.09], [-132.7576, 55.9949], [-132.5977, 55.8951], [-132.4302, 55.687], [-132.5916, 55.4644], [-132.4178, 55.4829], [-132.2153, 55.3835], [-132.2066, 55.2244], [-131.9764, 55.2085], [-132.0004, 55.0338], [-131.9809, 54.8048], [-132.1343, 54.7126], [-132.3413, 54.9073], [-132.5494, 54.9525], [-132.5885, 55.0524], [-132.7823, 55.0485], [-133.103, 55.3602], [-132.9589, 55.3956], [-133.0824, 55.504], [-133.0896, 55.6126], [-133.2983, 55.6069], [-133.369, 55.689], [-133.5533, 55.6912], [-133.6802, 55.7851], [-133.4469, 55.7971], [-133.2415, 55.9209], [-133.3712, 56.0359], [-133.6842, 55.9428], [-133.7552, 55.9995], [-133.5308, 56.1456], [-133.5944, 56.2164], [-133.5661, 56.3393]]], [[[-133.3051, 55.5438], [-133.2817, 55.4979], [-133.6502, 55.2693], [-133.6342, 55.5393], [-133.3051, 55.5438]]], [[[-132.7799, 56.2472], [-133.0351, 56.3409], [-132.9021, 56.4537], [-132.7061, 56.4485], [-132.6694, 56.2873], [-132.7799, 56.2472]]], [[[-153.007, 57.1248], [-153.3746, 57.0519], [-153.2852, 57.185], [-153.007, 57.1248]]], [[[-133.3662, 57.0035], [-133.0708, 56.9743], [-132.9541, 56.8803], [-132.954, 56.713], [-133.1442, 56.5669], [-133.2126, 56.4646], [-133.6028, 56.464], [-133.6493, 56.5168], [-133.681, 56.7975], [-133.9794, 57.0096], [-133.866, 57.0687], [-133.3662, 57.0035]]], [[[-130.9791, 55.4892], [-131.0828, 55.2668], [-131.1879, 55.2063], [-131.4207, 55.2759], [-131.4745, 55.3735], [-131.811, 55.2231], [-131.8461, 55.4163], [-131.6476, 55.5855], [-131.625, 55.8316], [-131.2692, 55.9554], [-131.1207, 55.8566], [-130.966, 55.6695], [-130.9791, 55.4892]]], [[[-160.6849, 55.3148], [-160.5832, 55.3077], [-160.4875, 55.1848], [-160.8255, 55.174], [-160.8465, 55.3114], [-160.6849, 55.3148]]], [[[-132.1123, 56.1094], [-132.1329, 55.9432], [-132.2873, 55.9294], [-132.4511, 56.0564], [-132.6599, 56.0782], [-132.6991, 56.1982], [-132.5987, 56.2416], [-132.3798, 56.4987], [-132.3165, 56.4875], [-132.0669, 56.2442], [-132.1123, 56.1094]]], [[[-132.7468, 56.5257], [-132.9308, 56.5245], [-132.8425, 56.7948], [-132.6559, 56.6847], [-132.568, 56.5758], [-132.7468, 56.5257]]]]\n },\n \"properties\": {\n \"name\": \"Alaska\",\n \"id\": \"US-AK\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-AK\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-85.6235, 35.0009], [-85.3859, 33.8507], [-85.2009, 32.9562], [-85.1565, 32.8042], [-85.0151, 32.5261], [-84.986, 32.3609], [-84.9297, 32.2466], [-85.0346, 32.1474], [-85.1241, 31.8804], [-85.1248, 31.7768], [-85.0549, 31.5726], [-85.0926, 31.2957], [-85.0675, 31.1176], [-85.0073, 31.0016], [-85.9769, 31.0009], [-86.6236, 31.0009], [-87.5937, 31.0008], [-87.6011, 30.8605], [-87.4216, 30.6716], [-87.4294, 30.4778], [-87.4896, 30.3777], [-87.6222, 30.2647], [-87.7903, 30.2919], [-87.9243, 30.4496], [-87.9489, 30.627], [-88.0325, 30.6812], [-88.1355, 30.3666], [-88.3996, 30.3709], [-88.4443, 31.1397], [-88.4862, 31.8904], [-88.3397, 32.9988], [-88.1688, 34.292], [-88.0847, 34.9331], [-88.1733, 34.999], [-88.1905, 35.0249], [-86.9071, 35.0129], [-85.6235, 35.0009]]]\n },\n \"properties\": {\n \"name\": \"Alabama\",\n \"id\": \"US-AL\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-AL\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-89.7047, 36.0015], [-89.7037, 35.9069], [-89.7796, 35.8057], [-89.9436, 35.6791], [-89.9674, 35.5033], [-90.066, 35.4141], [-90.0929, 35.2036], [-90.1423, 35.1142], [-90.2938, 35.0012], [-90.3198, 34.8992], [-90.5392, 34.7281], [-90.5841, 34.5037], [-90.718, 34.3917], [-90.8172, 34.2522], [-90.9097, 34.1888], [-90.9431, 34.0297], [-91.0702, 33.9743], [-91.0528, 33.8276], [-91.2076, 33.6756], [-91.2146, 33.5834], [-91.1411, 33.4386], [-91.1633, 33.2944], [-91.1068, 33.2179], [-91.15, 33.0159], [-92.4243, 33.0139], [-93.3227, 33.0128], [-94.0413, 33.012], [-94.0472, 33.5544], [-94.2947, 33.5875], [-94.3778, 33.5661], [-94.4841, 33.6485], [-94.4616, 34.5178], [-94.4391, 35.3872], [-94.6184, 36.5009], [-93.7829, 36.5009], [-92.3904, 36.5009], [-91.5548, 36.5009], [-90.1623, 36.5009], [-90.0744, 36.3719], [-90.0758, 36.2967], [-90.303, 36.0993], [-90.3811, 35.9927], [-89.7047, 36.0015]]]\n },\n \"properties\": {\n \"name\": \"Arkansas\",\n \"id\": \"US-AR\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-AR\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-109.0467, 37.0009], [-109.0468, 36.2918], [-109.0469, 35.5829], [-109.0469, 34.5194], [-109.0472, 33.4558], [-109.0473, 32.3922], [-109.0478, 31.328], [-110.3351, 31.3255], [-111.0421, 31.3243], [-111.9905, 31.6202], [-112.939, 31.9162], [-113.8875, 32.2123], [-114.836, 32.5083], [-114.7248, 32.7154], [-114.5822, 32.7347], [-114.4775, 32.8419], [-114.4908, 32.9836], [-114.6481, 33.0718], [-114.7045, 33.1698], [-114.7017, 33.4179], [-114.6026, 33.47], [-114.4992, 33.6858], [-114.5091, 33.904], [-114.3293, 34.142], [-114.1255, 34.2865], [-114.1589, 34.3552], [-114.371, 34.4885], [-114.398, 34.5897], [-114.5575, 34.7946], [-114.6105, 34.9912], [-114.5909, 35.3528], [-114.6485, 35.4759], [-114.6452, 35.6305], [-114.6871, 35.9173], [-114.7414, 36.0136], [-114.6691, 36.1218], [-114.4061, 36.1484], [-114.1833, 36.0303], [-114.0429, 36.1817], [-114.0402, 37.0042], [-113.104, 37.0035], [-111.8556, 37.0026], [-111.2313, 37.0022], [-109.9829, 37.0014], [-109.0467, 37.0009]]]\n },\n \"properties\": {\n \"name\": \"Arizona\",\n \"id\": \"US-AZ\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-AZ\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-120.0008, 42.0005], [-120.0006, 40.6879], [-120.0001, 39.5627], [-120.0001, 39.0002], [-119.2974, 38.5098], [-118.5948, 38.0193], [-118.1262, 37.6924], [-117.2097, 37.0033], [-116.6596, 36.5899], [-115.8978, 35.9955], [-115.3901, 35.5991], [-114.6105, 34.9912], [-114.5575, 34.7946], [-114.398, 34.5897], [-114.371, 34.4885], [-114.1589, 34.3552], [-114.1255, 34.2865], [-114.3293, 34.142], [-114.5091, 33.904], [-114.4992, 33.6858], [-114.6026, 33.47], [-114.7017, 33.4179], [-114.7045, 33.1698], [-114.6481, 33.0718], [-114.4908, 32.9836], [-114.4775, 32.8419], [-114.5822, 32.7347], [-114.7248, 32.7154], [-115.6975, 32.6404], [-117.1282, 32.5334], [-117.1374, 32.6491], [-117.2436, 32.6641], [-117.2629, 32.9389], [-117.3188, 33.1], [-117.4675, 33.2955], [-117.7885, 33.5385], [-117.9521, 33.6196], [-118.0806, 33.7221], [-118.2644, 33.7586], [-118.4105, 33.7439], [-118.3929, 33.8583], [-118.5062, 34.0175], [-118.832, 34.0245], [-119.1437, 34.112], [-119.2358, 34.1641], [-119.2676, 34.2575], [-119.606, 34.418], [-119.8533, 34.412], [-120.0529, 34.4692], [-120.4812, 34.4716], [-120.6446, 34.58], [-120.6249, 34.812], [-120.663, 34.9494], [-120.6336, 35.0765], [-120.707, 35.1577], [-120.8574, 35.2096], [-120.8603, 35.3654], [-121.0228, 35.4809], [-121.138, 35.6071], [-121.2839, 35.6764], [-121.3438, 35.7923], [-121.6644, 36.154], [-121.8775, 36.331], [-121.9186, 36.5724], [-121.79, 36.7322], [-121.8074, 36.8513], [-121.8806, 36.9389], [-122.1642, 36.991], [-122.3948, 37.2075], [-122.4084, 37.3731], [-122.4993, 37.5426], [-122.5142, 37.772], [-122.3842, 37.7886], [-122.3698, 37.6559], [-122.2287, 37.5639], [-122.2222, 37.7321], [-122.296, 37.7904], [-122.3854, 37.9606], [-122.217, 38.0407], [-121.7168, 38.0341], [-122.0315, 38.1235], [-122.1538, 38.0655], [-122.3933, 38.1447], [-122.4839, 38.1088], [-122.4669, 37.8381], [-122.7604, 37.9456], [-122.9682, 38.097], [-122.9865, 38.2771], [-123.1212, 38.4493], [-123.2897, 38.5359], [-123.4248, 38.6757], [-123.7011, 38.9073], [-123.7195, 39.111], [-123.8202, 39.3684], [-123.7835, 39.6187], [-123.8845, 39.8608], [-124.1085, 40.0945], [-124.324, 40.2519], [-124.3717, 40.4912], [-124.2837, 40.7106], [-124.1331, 40.9697], [-124.14, 41.1558], [-124.0685, 41.3841], [-124.1177, 41.6218], [-124.2446, 41.7879], [-124.2284, 42.0008], [-123.4283, 42.0005], [-122.3737, 42.0005], [-121.0554, 42.0005], [-120.0008, 42.0005]]], [[[-119.8824, 34.0797], [-119.5622, 34.0065], [-119.8095, 33.9677], [-119.8824, 34.0797]]], [[[-120.0436, 33.9188], [-120.1672, 33.9181], [-120.2519, 34.0138], [-120.0719, 34.0265], [-120.0436, 33.9188]]]]\n },\n \"properties\": {\n \"name\": \"California\",\n \"id\": \"US-CA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-CA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-102.0245, 40.0011], [-102.0209, 39.0636], [-102.018, 38.3135], [-102.0128, 37.0009], [-103.0008, 37.0009], [-103.7566, 37.0009], [-104.8901, 37.0009], [-106.0238, 37.0009], [-106.7795, 37.0009], [-107.9131, 37.0009], [-109.0467, 37.0009], [-109.0465, 38.0009], [-109.0465, 39.2509], [-109.0465, 40.0008], [-109.0464, 41.0009], [-108.1044, 41.0009], [-107.1622, 41.0009], [-105.906, 41.0009], [-104.9638, 41.0009], [-104.0217, 41.0009], [-103.273, 41.0007], [-102.025, 41.0006], [-102.0245, 40.0011]]]\n },\n \"properties\": {\n \"name\": \"Colorado\",\n \"id\": \"US-CO\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-CO\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-71.8009, 42.0119], [-71.7958, 41.5199], [-71.8423, 41.3354], [-72.2653, 41.2917], [-72.8471, 41.2659], [-73.1823, 41.1758], [-73.6305, 40.9918], [-73.7231, 41.1045], [-73.4841, 41.2189], [-73.5447, 41.296], [-73.4806, 42.0556], [-72.8078, 42.0341], [-71.8017, 42.0227], [-71.8009, 42.0119]]]\n },\n \"properties\": {\n \"name\": \"Connecticut\",\n \"id\": \"US-CT\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-CT\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-77.0303, 38.8893], [-77.1221, 38.9435], [-77.0421, 39.0118], [-76.9312, 38.8882], [-77.0303, 38.8893]]]\n },\n \"properties\": {\n \"name\": \"District of Columbia\",\n \"id\": \"US-DC\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"Federal District\"\n },\n \"id\": \"US-DC\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-75.4211, 39.8154], [-75.5877, 39.6407], [-75.5738, 39.477], [-75.4127, 39.2813], [-75.3921, 39.0927], [-75.1851, 38.8194], [-75.0887, 38.7776], [-75.1284, 38.6325], [-75.0377, 38.4556], [-75.7071, 38.455], [-75.7847, 39.7223], [-75.6346, 39.8394], [-75.4211, 39.8154]]]\n },\n \"properties\": {\n \"name\": \"Delaware\",\n \"id\": \"US-DE\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-DE\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-81.504, 30.7313], [-81.4572, 30.6407], [-81.3858, 30.2699], [-81.2495, 29.7938], [-81.1045, 29.4569], [-80.8999, 29.0498], [-80.5241, 28.4861], [-80.6229, 28.3203], [-80.7317, 28.4629], [-80.6885, 28.5785], [-80.766, 28.6328], [-80.7487, 28.3809], [-80.6501, 28.1809], [-80.2261, 27.207], [-80.1257, 27.0829], [-80.05, 26.8077], [-80.0413, 26.5686], [-80.1107, 26.1316], [-80.1264, 25.8335], [-80.3008, 25.6186], [-80.3669, 25.3312], [-80.4846, 25.2299], [-80.5577, 25.2325], [-80.7366, 25.1564], [-80.8622, 25.1761], [-81.1104, 25.138], [-81.1675, 25.2285], [-81.0977, 25.3191], [-81.2272, 25.5834], [-81.3452, 25.7319], [-81.3649, 25.831], [-81.5683, 25.8916], [-81.7155, 25.9832], [-81.8114, 26.1461], [-81.8665, 26.435], [-82.0396, 26.5521], [-82.0778, 26.7043], [-82.067, 26.8915], [-82.1807, 26.8401], [-82.2901, 26.8708], [-82.4413, 27.0596], [-82.6204, 27.4011], [-82.6359, 27.5246], [-82.4006, 27.8353], [-82.5206, 27.8778], [-82.6609, 27.7185], [-82.7429, 27.7094], [-82.8435, 27.846], [-82.7485, 28.2368], [-82.6607, 28.4858], [-82.6515, 28.8875], [-82.7693, 29.0515], [-83.2905, 29.4519], [-83.6944, 29.926], [-84.0443, 30.1037], [-84.3098, 30.0648], [-84.3828, 29.9074], [-84.55, 29.8979], [-84.8005, 29.7731], [-85.0292, 29.7212], [-85.3188, 29.6802], [-85.3069, 29.7978], [-85.3537, 29.8757], [-85.6758, 30.1218], [-85.6035, 30.2868], [-85.7408, 30.2444], [-85.7557, 30.167], [-86.1752, 30.3325], [-86.2574, 30.493], [-86.4479, 30.4956], [-86.6796, 30.4028], [-87.2011, 30.3393], [-86.9858, 30.4308], [-87.1705, 30.5388], [-87.1847, 30.4537], [-87.2811, 30.3393], [-87.4758, 30.2942], [-87.4896, 30.3777], [-87.4294, 30.4778], [-87.4216, 30.6716], [-87.6011, 30.8605], [-87.5937, 31.0008], [-86.6236, 31.0009], [-85.9769, 31.0009], [-85.0073, 31.0016], [-84.8839, 30.7209], [-84.1528, 30.6777], [-82.8775, 30.603], [-82.2399, 30.5657], [-82.1942, 30.3935], [-82.0618, 30.4046], [-82.0219, 30.5598], [-82.0382, 30.7319], [-81.9356, 30.8195], [-81.6733, 30.7403], [-81.504, 30.7313]]]\n },\n \"properties\": {\n \"name\": \"Florida\",\n \"id\": \"US-FL\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-FL\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-80.8724, 32.0295], [-80.9234, 31.9449], [-81.1133, 31.8787], [-81.065, 31.8135], [-81.1979, 31.7042], [-81.1754, 31.5313], [-81.295, 31.3712], [-81.2885, 31.2639], [-81.4532, 31.0883], [-81.5204, 30.8746], [-81.504, 30.7313], [-81.6733, 30.7403], [-81.9356, 30.8195], [-82.0382, 30.7319], [-82.0219, 30.5598], [-82.0618, 30.4046], [-82.1942, 30.3935], [-82.2399, 30.5657], [-82.8775, 30.603], [-84.1528, 30.6777], [-84.8839, 30.7209], [-85.0073, 31.0016], [-85.0675, 31.1176], [-85.0926, 31.2957], [-85.0549, 31.5726], [-85.1248, 31.7768], [-85.1241, 31.8804], [-85.0346, 32.1474], [-84.9297, 32.2466], [-84.986, 32.3609], [-85.0151, 32.5261], [-85.1565, 32.8042], [-85.2009, 32.9562], [-85.3859, 33.8507], [-85.6235, 35.0009], [-84.3247, 34.988], [-83.1149, 35.0015], [-83.3167, 34.8057], [-83.3557, 34.7083], [-83.0528, 34.5109], [-82.8478, 34.4369], [-82.8187, 34.3661], [-82.5894, 34.0176], [-82.2566, 33.7493], [-82.2084, 33.6636], [-82.0057, 33.5229], [-81.9329, 33.3899], [-81.6994, 33.1267], [-81.5783, 33.0686], [-81.4897, 32.9356], [-81.377, 32.6075], [-81.2903, 32.5573], [-81.1714, 32.3801], [-81.1351, 32.1818], [-81.0748, 32.1097], [-80.8724, 32.0295]]]\n },\n \"properties\": {\n \"name\": \"Georgia\",\n \"id\": \"US-GA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-GA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-156.4868, 20.9326], [-156.2775, 20.9514], [-156.1484, 20.8855], [-155.9899, 20.7572], [-156.1072, 20.6448], [-156.31, 20.5988], [-156.4383, 20.6179], [-156.4801, 20.8012], [-156.6155, 20.8218], [-156.6897, 20.9014], [-156.6568, 21.0244], [-156.5855, 21.0343], [-156.4868, 20.9326]]], [[[-157.2136, 21.2155], [-156.7423, 21.1635], [-156.8599, 21.0563], [-157.0209, 21.0978], [-157.2903, 21.1126], [-157.2136, 21.2155]]], [[[-156.8496, 20.7727], [-156.9734, 20.7575], [-157.0506, 20.9126], [-156.9418, 20.9301], [-156.8094, 20.8311], [-156.8496, 20.7727]]], [[[-155.5813, 19.012], [-155.6808, 18.9676], [-155.8813, 19.0704], [-155.9056, 19.1258], [-155.8907, 19.3825], [-155.9659, 19.5908], [-156.0487, 19.7499], [-155.8203, 20.0143], [-155.8928, 20.1674], [-155.8316, 20.2758], [-155.6221, 20.1633], [-155.1988, 19.9944], [-155.0861, 19.8756], [-155.0659, 19.7481], [-154.8042, 19.5245], [-154.8503, 19.4541], [-155.0535, 19.3192], [-155.3097, 19.2601], [-155.5352, 19.109], [-155.5813, 19.012]]], [[[-160.1801, 21.841], [-160.2209, 21.8972], [-160.1006, 22.0153], [-160.08, 21.9075], [-160.1801, 21.841]]], [[[-157.7993, 21.4567], [-157.6355, 21.3076], [-157.7988, 21.2687], [-157.9018, 21.3405], [-158.1104, 21.3186], [-158.2391, 21.4893], [-158.2732, 21.5851], [-158.1231, 21.6002], [-157.9625, 21.7014], [-157.7993, 21.4567]]], [[[-159.3728, 21.9323], [-159.4607, 21.8761], [-159.6089, 21.9094], [-159.7892, 22.0419], [-159.7267, 22.1402], [-159.5792, 22.2232], [-159.3521, 22.2196], [-159.3007, 22.1052], [-159.3728, 21.9323]]]]\n },\n \"properties\": {\n \"name\": \"Hawaii\",\n \"id\": \"US-HI\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-HI\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-90.6506, 42.5129], [-90.4848, 42.3833], [-90.3466, 42.2148], [-90.1675, 42.1003], [-90.1524, 41.9816], [-90.2177, 41.813], [-90.4367, 41.5603], [-90.7541, 41.4498], [-90.9387, 41.4255], [-91.0482, 41.369], [-91.0665, 41.2059], [-90.9638, 41.0825], [-91.0001, 40.9047], [-91.1021, 40.7498], [-91.2151, 40.6496], [-91.3391, 40.604], [-91.4419, 40.3794], [-91.682, 40.5519], [-91.7315, 40.6246], [-93.2451, 40.616], [-94.5063, 40.6087], [-95.765, 40.6018], [-95.859, 40.7451], [-95.8341, 40.8895], [-95.8836, 41.2876], [-95.9329, 41.4254], [-96.0586, 41.5458], [-96.0688, 41.7343], [-96.1543, 41.9652], [-96.2954, 42.1329], [-96.3837, 42.4177], [-96.4809, 42.5113], [-96.5388, 42.6587], [-96.6218, 42.7296], [-96.4627, 43.0992], [-96.5555, 43.2317], [-96.5416, 43.3735], [-96.5985, 43.4976], [-96.4536, 43.5012], [-95.478, 43.5013], [-94.5023, 43.5014], [-93.5267, 43.5016], [-92.2258, 43.5018], [-91.2453, 43.5024], [-91.2187, 43.3953], [-91.1172, 43.3311], [-91.1614, 43.1023], [-91.0695, 42.7885], [-90.9599, 42.7204], [-90.7887, 42.6769], [-90.6879, 42.6104], [-90.6506, 42.5129]]]\n },\n \"properties\": {\n \"name\": \"Iowa\",\n \"id\": \"US-IA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-IA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-111.0514, 44.4989], [-111.051, 43.7182], [-111.0508, 43.0938], [-111.0503, 42.0009], [-111.9855, 42.0009], [-112.7333, 42.001], [-114.0426, 42.001], [-115.1578, 42.0009], [-115.9014, 42.0008], [-117.0166, 42.0005], [-117.019, 43.1165], [-117.0205, 43.8132], [-116.9113, 44.1574], [-116.9531, 44.2453], [-117.1398, 44.2903], [-117.2017, 44.4362], [-117.1189, 44.5783], [-116.9489, 44.7701], [-116.8396, 44.9851], [-116.5492, 45.4567], [-116.4771, 45.6411], [-116.6168, 45.7992], [-116.7647, 45.873], [-116.8965, 46.0021], [-116.943, 46.2321], [-117.025, 46.4291], [-117.0317, 47.7115], [-117.039, 48.993], [-116.0485, 48.993], [-116.0491, 48.0047], [-115.7337, 47.7064], [-115.6697, 47.4979], [-115.7024, 47.4377], [-115.3495, 47.2612], [-114.9357, 46.9229], [-114.7537, 46.7345], [-114.6015, 46.6603], [-114.3368, 46.6592], [-114.3459, 46.5506], [-114.4853, 46.1582], [-114.4784, 46.0356], [-114.4051, 45.8742], [-114.5338, 45.7819], [-114.4958, 45.6859], [-114.5292, 45.5757], [-114.2976, 45.4875], [-113.9426, 45.6815], [-113.8023, 45.601], [-113.697, 45.305], [-113.4711, 45.0729], [-113.4693, 44.93], [-113.3389, 44.8081], [-113.1872, 44.7986], [-113.0933, 44.7154], [-112.9998, 44.4803], [-112.8156, 44.406], [-112.7159, 44.498], [-112.3929, 44.468], [-112.2313, 44.5607], [-111.7972, 44.5399], [-111.4998, 44.5448], [-111.4481, 44.7111], [-111.3374, 44.7449], [-111.1976, 44.5906], [-111.0514, 44.4989]]]\n },\n \"properties\": {\n \"name\": \"Idaho\",\n \"id\": \"US-ID\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-ID\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-87.8121, 42.4971], [-87.7975, 42.2114], [-87.6946, 42.0844], [-87.5212, 41.7277], [-87.5254, 40.8615], [-87.5283, 40.2619], [-87.533, 39.3749], [-87.611, 39.2914], [-87.6472, 39.1688], [-87.5304, 38.9089], [-87.5295, 38.7423], [-87.6359, 38.5427], [-87.784, 38.4191], [-87.8271, 38.3356], [-87.9805, 38.2492], [-88.0425, 37.9366], [-88.0953, 37.8756], [-88.042, 37.7888], [-88.1289, 37.6995], [-88.1075, 37.5343], [-88.1906, 37.4646], [-88.4947, 37.3642], [-88.4533, 37.1782], [-88.4717, 37.0883], [-88.8726, 37.1856], [-89.0462, 37.183], [-89.1345, 37.1025], [-89.1543, 36.9921], [-89.2725, 37.08], [-89.414, 37.1023], [-89.503, 37.3005], [-89.462, 37.4342], [-89.5234, 37.6445], [-89.6233, 37.7472], [-89.823, 37.8841], [-90.1737, 38.069], [-90.299, 38.1739], [-90.374, 38.3097], [-90.3165, 38.4578], [-90.1268, 38.8325], [-90.2201, 38.8977], [-90.4781, 38.9481], [-90.5771, 38.9096], [-90.6635, 38.9875], [-90.7372, 39.1818], [-90.9195, 39.3869], [-91.2099, 39.6029], [-91.3787, 39.7493], [-91.4669, 39.9428], [-91.4998, 40.226], [-91.4419, 40.3794], [-91.3391, 40.604], [-91.2151, 40.6496], [-91.1021, 40.7498], [-91.0001, 40.9047], [-90.9638, 41.0825], [-91.0665, 41.2059], [-91.0482, 41.369], [-90.9387, 41.4255], [-90.7541, 41.4498], [-90.4367, 41.5603], [-90.2177, 41.813], [-90.1524, 41.9816], [-90.1675, 42.1003], [-90.3466, 42.2148], [-90.4848, 42.3833], [-90.6506, 42.5129], [-89.2905, 42.5052], [-87.8121, 42.4971]]]\n },\n \"properties\": {\n \"name\": \"Illinois\",\n \"id\": \"US-IL\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-IL\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-84.7961, 41.7014], [-84.803, 41.0506], [-84.8133, 40.0745], [-84.8216, 39.092], [-84.8541, 38.9129], [-84.8007, 38.8194], [-85.1699, 38.6903], [-85.3068, 38.7372], [-85.4447, 38.6831], [-85.4248, 38.5966], [-85.6464, 38.3473], [-85.8549, 38.2151], [-85.9611, 38.0139], [-86.1035, 37.9918], [-86.2838, 38.1298], [-86.4297, 38.1397], [-86.5487, 37.9171], [-86.6731, 37.889], [-86.7703, 37.9598], [-86.9694, 37.938], [-87.1411, 37.8052], [-87.3724, 37.9234], [-87.5995, 37.9465], [-87.7145, 37.8997], [-87.9059, 37.9019], [-87.9125, 37.8177], [-88.042, 37.7888], [-88.0953, 37.8756], [-88.0425, 37.9366], [-87.9805, 38.2492], [-87.8271, 38.3356], [-87.784, 38.4191], [-87.6359, 38.5427], [-87.5295, 38.7423], [-87.5304, 38.9089], [-87.6472, 39.1688], [-87.611, 39.2914], [-87.533, 39.3749], [-87.5283, 40.2619], [-87.5254, 40.8615], [-87.5212, 41.7277], [-87.4124, 41.6564], [-87.2532, 41.6377], [-87.0726, 41.6695], [-86.8627, 41.7607], [-85.4026, 41.76], [-84.7964, 41.7597], [-84.7961, 41.7014]]]\n },\n \"properties\": {\n \"name\": \"Indiana\",\n \"id\": \"US-IN\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-IN\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-94.6181, 37.0009], [-95.5424, 37.0009], [-96.4668, 37.0009], [-97.1601, 37.0009], [-98.0844, 37.0009], [-99.0086, 37.0009], [-99.9329, 37.0009], [-101.0885, 37.0009], [-102.0128, 37.0009], [-102.018, 38.3135], [-102.0209, 39.0636], [-102.0245, 40.0011], [-100.7669, 40.0011], [-99.2997, 40.0011], [-97.8325, 40.0011], [-96.7845, 40.0011], [-95.3466, 40.0015], [-95.1162, 39.8721], [-94.9841, 39.8911], [-94.8933, 39.7818], [-95.0754, 39.5974], [-95.058, 39.509], [-94.9525, 39.4264], [-94.7778, 39.194], [-94.6225, 39.1245], [-94.623, 38.5647], [-94.62, 37.6525], [-94.6181, 37.0009]]]\n },\n \"properties\": {\n \"name\": \"Kansas\",\n \"id\": \"US-KS\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-KS\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-82.6129, 38.4482], [-82.5784, 38.272], [-82.5887, 38.0998], [-82.2802, 37.6872], [-82.1035, 37.5706], [-81.9652, 37.5396], [-82.3431, 37.2969], [-82.6816, 37.1381], [-82.7319, 37.048], [-82.8945, 36.9064], [-83.1502, 36.7624], [-83.6676, 36.605], [-83.7304, 36.5868], [-84.4247, 36.6062], [-85.8133, 36.6453], [-86.5076, 36.6648], [-87.8392, 36.6439], [-88.0964, 36.693], [-88.0591, 36.4997], [-89.4503, 36.5], [-89.3974, 36.5878], [-89.203, 36.6256], [-89.1225, 36.9116], [-89.1543, 36.9921], [-89.1345, 37.1025], [-89.0462, 37.183], [-88.8726, 37.1856], [-88.4717, 37.0883], [-88.4533, 37.1782], [-88.4947, 37.3642], [-88.1906, 37.4646], [-88.1075, 37.5343], [-88.1289, 37.6995], [-88.042, 37.7888], [-87.9125, 37.8177], [-87.9059, 37.9019], [-87.7145, 37.8997], [-87.5995, 37.9465], [-87.3724, 37.9234], [-87.1411, 37.8052], [-86.9694, 37.938], [-86.7703, 37.9598], [-86.6731, 37.889], [-86.5487, 37.9171], [-86.4297, 38.1397], [-86.2838, 38.1298], [-86.1035, 37.9918], [-85.9611, 38.0139], [-85.8549, 38.2151], [-85.6464, 38.3473], [-85.4248, 38.5966], [-85.4447, 38.6831], [-85.3068, 38.7372], [-85.1699, 38.6903], [-84.8007, 38.8194], [-84.8541, 38.9129], [-84.8216, 39.092], [-84.7069, 39.1289], [-84.5946, 39.0858], [-84.43, 39.0909], [-84.2904, 38.9747], [-84.2272, 38.8652], [-84.1133, 38.7984], [-83.9484, 38.7743], [-83.6898, 38.6495], [-83.5384, 38.6998], [-83.357, 38.6274], [-83.2035, 38.6389], [-83.0001, 38.7141], [-82.8805, 38.7102], [-82.7582, 38.5412], [-82.6129, 38.4482]]]\n },\n \"properties\": {\n \"name\": \"Kentucky\",\n \"id\": \"US-KY\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-KY\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-91.7938, 29.5007], [-91.9963, 29.5731], [-91.8754, 29.6409], [-91.7677, 29.5847], [-91.7938, 29.5007]]], [[[-89.521, 30.1926], [-89.5884, 30.166], [-89.9543, 30.2688], [-90.0452, 30.3514], [-90.2252, 30.3794], [-90.332, 30.2776], [-90.4131, 30.1403], [-90.1753, 30.0291], [-89.9942, 30.0593], [-89.8941, 30.1258], [-89.7373, 30.172], [-89.6651, 30.117], [-89.8152, 30.0073], [-89.7438, 29.9299], [-89.5895, 29.9151], [-89.4945, 30.0582], [-89.3578, 29.9211], [-89.3545, 29.8202], [-89.5307, 29.7722], [-89.7209, 29.6193], [-89.6748, 29.5387], [-89.5137, 29.42], [-89.2456, 29.3331], [-89.0158, 29.2028], [-89.1555, 29.0166], [-89.2362, 29.0811], [-89.3535, 29.0702], [-89.4431, 29.1942], [-89.6202, 29.3024], [-89.7923, 29.3331], [-89.8772, 29.458], [-90.0523, 29.4314], [-90.1013, 29.1817], [-90.2129, 29.1049], [-90.3016, 29.2558], [-90.3792, 29.2951], [-90.5863, 29.2715], [-90.6775, 29.1506], [-90.7511, 29.1309], [-91.0027, 29.1935], [-91.2901, 29.289], [-91.1555, 29.3507], [-91.331, 29.5136], [-91.5142, 29.5554], [-91.6724, 29.7461], [-91.8243, 29.7506], [-91.8932, 29.8361], [-92.0173, 29.8003], [-92.1355, 29.6995], [-92.0841, 29.5928], [-92.2608, 29.5569], [-92.6712, 29.5971], [-92.9525, 29.7142], [-93.1757, 29.7789], [-93.6948, 29.7698], [-93.8265, 29.7251], [-93.8839, 29.81], [-93.7731, 29.9141], [-93.794, 29.9772], [-93.7106, 30.1128], [-93.7504, 30.3448], [-93.7202, 30.5583], [-93.5792, 30.8238], [-93.5306, 31.0462], [-93.5577, 31.1804], [-93.6659, 31.3226], [-93.7376, 31.5138], [-93.8206, 31.604], [-93.8269, 31.7503], [-93.905, 31.877], [-94.0434, 31.9992], [-94.0413, 33.012], [-93.3227, 33.0128], [-92.4243, 33.0139], [-91.15, 33.0159], [-91.0961, 32.9376], [-91.1424, 32.6611], [-91.1038, 32.4905], [-90.9447, 32.3307], [-90.9477, 32.2401], [-91.0887, 32.1042], [-91.1566, 31.9707], [-91.2864, 31.884], [-91.3725, 31.7736], [-91.4146, 31.6399], [-91.529, 31.4488], [-91.529, 31.3451], [-91.6307, 31.2176], [-91.5963, 31.1099], [-91.6565, 31.0018], [-91.1769, 31.0012], [-89.7353, 31.0011], [-89.8354, 30.7308], [-89.82, 30.6112], [-89.6858, 30.4627], [-89.5917, 30.223], [-89.521, 30.1926]]]]\n },\n \"properties\": {\n \"name\": \"Louisiana\",\n \"id\": \"US-LA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-LA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-70.5099, 41.3763], [-70.7854, 41.3275], [-70.6737, 41.4486], [-70.5099, 41.3763]]], [[[-70.8062, 42.8767], [-70.8291, 42.8254], [-70.7357, 42.6692], [-71.0462, 42.3311], [-70.7383, 42.2289], [-70.5488, 41.9386], [-70.5147, 41.8033], [-70.2954, 41.729], [-70.0014, 41.8262], [-69.9486, 41.6772], [-70.4047, 41.6268], [-70.657, 41.5343], [-70.7012, 41.7149], [-70.9742, 41.5485], [-71.1885, 41.5164], [-71.2338, 41.7065], [-71.3407, 41.7978], [-71.3871, 42.0169], [-71.8009, 42.0119], [-71.8017, 42.0227], [-72.8078, 42.0341], [-73.4806, 42.0556], [-73.5072, 42.08], [-73.2533, 42.7522], [-72.4669, 42.7303], [-71.3296, 42.7024], [-70.974, 42.8716], [-70.8062, 42.8767]]]]\n },\n \"properties\": {\n \"name\": \"Massachusetts\",\n \"id\": \"US-MA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-75.7847, 39.7223], [-75.7071, 38.455], [-75.0377, 38.4556], [-75.1342, 38.3843], [-75.376, 38.025], [-75.62, 37.9993], [-75.6592, 37.954], [-75.8508, 37.9716], [-75.7953, 38.0866], [-75.928, 38.1693], [-75.864, 38.2613], [-76.0513, 38.2795], [-76.2116, 38.3613], [-76.2948, 38.4947], [-76.2641, 38.6], [-76.0569, 38.6212], [-76.3003, 38.8183], [-76.1682, 38.8527], [-76.2357, 39.1917], [-76.1532, 39.3151], [-75.9547, 39.4596], [-75.959, 39.5851], [-76.0629, 39.5611], [-76.0972, 39.433], [-76.2764, 39.3228], [-76.4056, 39.3038], [-76.4208, 39.225], [-76.5739, 39.2543], [-76.42, 39.0739], [-76.5196, 38.8982], [-76.5368, 38.7426], [-76.5013, 38.5321], [-76.4164, 38.4202], [-76.4388, 38.3615], [-76.3329, 38.1408], [-76.5936, 38.2282], [-76.8896, 38.2921], [-77.0767, 38.4417], [-77.2326, 38.4077], [-77.2416, 38.4948], [-77.0183, 38.7777], [-77.0303, 38.8893], [-76.9312, 38.8882], [-77.0421, 39.0118], [-77.1221, 38.9435], [-77.3012, 39.0533], [-77.4809, 39.113], [-77.4789, 39.2209], [-77.7266, 39.3465], [-77.7981, 39.5172], [-77.8832, 39.6107], [-78.1812, 39.6857], [-78.4068, 39.6279], [-78.4956, 39.5334], [-78.8148, 39.5701], [-78.9714, 39.4537], [-79.0752, 39.4761], [-79.2935, 39.3115], [-79.488, 39.2109], [-79.4776, 39.7227], [-78.0926, 39.7226], [-76.708, 39.7225], [-75.7847, 39.7223]]]\n },\n \"properties\": {\n \"name\": \"Maryland\",\n \"id\": \"US-MD\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MD\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-68.1872, 44.3325], [-68.4118, 44.2944], [-68.2995, 44.4565], [-68.1872, 44.3325]]], [[[-70.7331, 43.07], [-70.829, 43.2391], [-70.9557, 43.3894], [-71.0314, 44.5297], [-71.0846, 45.294], [-70.8369, 45.3106], [-70.7992, 45.4048], [-70.6898, 45.4283], [-70.7023, 45.5514], [-70.421, 45.7383], [-70.2962, 45.9061], [-70.3045, 46.0574], [-70.2483, 46.2509], [-70.0673, 46.4411], [-70.0076, 46.7089], [-69.2429, 47.4629], [-69.0502, 47.4267], [-69.0486, 47.2737], [-68.8286, 47.2033], [-68.4805, 47.2857], [-68.3109, 47.3544], [-68.0968, 47.2749], [-67.8068, 47.0828], [-67.7958, 46.4984], [-67.7846, 45.7017], [-67.5958, 45.6208], [-67.4326, 45.6031], [-67.4936, 45.4741], [-67.4279, 45.378], [-67.4726, 45.2759], [-67.3669, 45.1738], [-67.1249, 45.1694], [-67.0805, 44.9891], [-67.1066, 44.885], [-66.9871, 44.8277], [-67.1912, 44.6756], [-67.364, 44.6969], [-67.556, 44.6448], [-67.6529, 44.5623], [-67.8392, 44.5763], [-67.907, 44.4536], [-68.0566, 44.3842], [-68.1174, 44.4906], [-68.2774, 44.5074], [-68.6121, 44.3105], [-68.7939, 44.3818], [-68.8473, 44.485], [-68.9615, 44.4339], [-68.9562, 44.3482], [-69.0635, 44.1724], [-69.0685, 44.0975], [-69.2261, 43.9864], [-69.3446, 44.001], [-69.4809, 43.9051], [-69.7298, 43.8521], [-69.7916, 43.8053], [-69.9652, 43.8551], [-70.1789, 43.7663], [-70.2692, 43.6719], [-70.2026, 43.6262], [-70.5207, 43.3488], [-70.6423, 43.1344], [-70.7331, 43.07]]]]\n },\n \"properties\": {\n \"name\": \"Maine\",\n \"id\": \"US-ME\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-ME\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-88.9552, 47.926], [-89.1568, 47.8408], [-89.1466, 47.9526], [-88.5883, 48.1585], [-88.6247, 48.042], [-88.9552, 47.926]]], [[[-88.2219, 47.2106], [-88.2368, 47.1589], [-88.4341, 47.1223], [-88.6158, 47.1741], [-88.5619, 47.2722], [-88.3944, 47.3887], [-88.1102, 47.4725], [-88.0155, 47.3208], [-88.2219, 47.2106]]], [[[-84.1329, 46.3622], [-84.2741, 46.4875], [-84.1423, 46.5309], [-84.1329, 46.3622]]], [[[-87.6059, 45.1085], [-87.721, 45.2427], [-87.6964, 45.3829], [-87.8653, 45.3678], [-87.8152, 45.5059], [-87.8091, 45.6861], [-87.9225, 45.76], [-88.1161, 45.8158], [-88.1518, 45.9454], [-88.4931, 46.0135], [-88.8374, 46.0365], [-89.1193, 46.1491], [-90.1185, 46.3416], [-90.2304, 46.5098], [-90.4077, 46.593], [-90.1536, 46.6546], [-89.8605, 46.7928], [-89.6951, 46.8386], [-89.355, 46.8819], [-89.1548, 46.9886], [-88.9482, 47.043], [-88.8297, 47.1459], [-88.6327, 47.167], [-88.5154, 47.0955], [-88.4558, 46.9628], [-88.4761, 46.8367], [-88.2162, 46.9516], [-87.7776, 46.8878], [-87.6374, 46.8265], [-87.3581, 46.5244], [-87.0341, 46.5432], [-86.8515, 46.4703], [-86.6375, 46.453], [-86.531, 46.5244], [-86.2313, 46.6563], [-85.9467, 46.7021], [-85.6161, 46.6906], [-85.0146, 46.7835], [-85.0343, 46.5058], [-84.7789, 46.4683], [-84.6973, 46.4907], [-84.5283, 46.436], [-84.3274, 46.4915], [-84.229, 46.3658], [-84.2036, 46.247], [-84.0409, 46.0881], [-83.9787, 45.9615], [-84.3409, 45.9998], [-84.5212, 45.9946], [-84.6314, 46.0526], [-84.8019, 45.8743], [-85.1007, 46.0461], [-85.3859, 46.1087], [-85.5551, 46.0782], [-85.7079, 45.9876], [-85.9593, 45.9407], [-86.1229, 45.9689], [-86.2717, 45.9367], [-86.3995, 45.8007], [-86.5594, 45.8063], [-86.5634, 45.8824], [-86.7985, 45.8317], [-86.9378, 45.7003], [-87.0848, 45.7298], [-87.2165, 45.6074], [-87.3989, 45.3646], [-87.6022, 45.157], [-87.6059, 45.1085]]], [[[-83.5035, 46.0131], [-83.518, 45.9578], [-83.7307, 45.9429], [-83.8658, 45.9791], [-83.6082, 46.0965], [-83.5035, 46.0131]]], [[[-83.4542, 41.7456], [-83.4643, 41.7394], [-84.7961, 41.7014], [-84.7964, 41.7597], [-85.4026, 41.76], [-86.8627, 41.7607], [-86.6325, 41.9114], [-86.4073, 42.2237], [-86.2995, 42.4176], [-86.2328, 42.65], [-86.2215, 42.9004], [-86.3292, 43.2242], [-86.5421, 43.6373], [-86.4405, 43.7943], [-86.4486, 43.924], [-86.5192, 44.0738], [-86.296, 44.3306], [-86.2422, 44.5514], [-86.237, 44.7202], [-86.1259, 44.7477], [-86.0577, 44.9164], [-85.8579, 44.9615], [-85.6893, 45.1281], [-85.5877, 45.1613], [-85.6472, 44.8376], [-85.4846, 44.8403], [-85.389, 45.0328], [-85.3756, 45.277], [-85.2229, 45.3561], [-84.9671, 45.3926], [-85.0877, 45.5068], [-85.0878, 45.6053], [-84.9515, 45.7753], [-84.772, 45.7948], [-84.4414, 45.6763], [-84.1892, 45.6112], [-84.1278, 45.5325], [-83.4785, 45.3389], [-83.3201, 45.1389], [-83.4482, 45.0246], [-83.3278, 44.8692], [-83.2944, 44.6834], [-83.3306, 44.3752], [-83.5125, 44.2707], [-83.614, 44.0583], [-83.8789, 43.9626], [-83.9395, 43.782], [-83.9157, 43.7005], [-83.7352, 43.6266], [-83.6217, 43.6365], [-83.4689, 43.7308], [-83.3382, 43.929], [-82.9946, 44.0612], [-82.8782, 44.0477], [-82.7161, 43.939], [-82.5968, 43.6344], [-82.4612, 43.081], [-82.4173, 43.0174], [-82.4884, 42.7394], [-82.5453, 42.6247], [-82.8678, 42.3853], [-83.1047, 42.2864], [-83.2619, 41.9463], [-83.3621, 41.8798], [-83.4542, 41.7456]]]]\n },\n \"properties\": {\n \"name\": \"Michigan\",\n \"id\": \"US-MI\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MI\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-93.3778, 48.6165], [-93.0517, 48.6199], [-92.8367, 48.5678], [-92.5005, 48.4354], [-92.4147, 48.2766], [-92.1718, 48.3384], [-92.0052, 48.3018], [-91.8584, 48.1976], [-91.5183, 48.0583], [-91.2207, 48.1046], [-91.0434, 48.1938], [-90.8402, 48.2005], [-90.7444, 48.1046], [-90.3201, 48.0991], [-90.0918, 48.1181], [-89.9936, 48.0152], [-89.6338, 47.9937], [-89.8288, 47.9009], [-90.1972, 47.7864], [-90.5975, 47.6878], [-90.957, 47.5236], [-91.3862, 47.2147], [-91.6451, 47.05], [-92.0644, 46.8188], [-92.107, 46.7623], [-92.2917, 46.6607], [-92.2926, 46.0843], [-92.6938, 45.909], [-92.8747, 45.7061], [-92.8924, 45.5947], [-92.7071, 45.4937], [-92.6857, 45.3806], [-92.7661, 45.2364], [-92.7931, 45.0713], [-92.7634, 44.9342], [-92.7991, 44.79], [-92.6435, 44.6453], [-92.3669, 44.5522], [-92.2404, 44.4621], [-92.0551, 44.3999], [-91.8409, 44.1942], [-91.3827, 43.9908], [-91.2785, 43.7975], [-91.2453, 43.5024], [-92.2258, 43.5018], [-93.5267, 43.5016], [-94.5023, 43.5014], [-95.478, 43.5013], [-96.4536, 43.5012], [-96.4536, 44.1747], [-96.4536, 45.2973], [-96.5298, 45.3715], [-96.696, 45.4317], [-96.8455, 45.5958], [-96.8137, 45.6592], [-96.6146, 45.8], [-96.5563, 45.9428], [-96.5608, 46.1383], [-96.6175, 46.3271], [-96.7309, 46.4727], [-96.7867, 46.6483], [-96.7702, 46.9196], [-96.8183, 46.9742], [-96.8588, 47.5884], [-96.988, 47.8204], [-97.0074, 47.9255], [-97.1259, 48.1735], [-97.1439, 48.5367], [-97.1281, 48.6811], [-97.2257, 48.9932], [-95.8242, 48.9932], [-95.162, 48.9918], [-95.1553, 49.3697], [-94.8543, 49.3046], [-94.8425, 49.1192], [-94.7052, 48.8085], [-94.6208, 48.7425], [-94.0552, 48.659], [-93.8517, 48.6073], [-93.7077, 48.5255], [-93.4636, 48.5612], [-93.3778, 48.6165]]]\n },\n \"properties\": {\n \"name\": \"Minnesota\",\n \"id\": \"US-MN\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MN\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-91.4419, 40.3794], [-91.4998, 40.226], [-91.4669, 39.9428], [-91.3787, 39.7493], [-91.2099, 39.6029], [-90.9195, 39.3869], [-90.7372, 39.1818], [-90.6635, 38.9875], [-90.5771, 38.9096], [-90.4781, 38.9481], [-90.2201, 38.8977], [-90.1268, 38.8325], [-90.3165, 38.4578], [-90.374, 38.3097], [-90.299, 38.1739], [-90.1737, 38.069], [-89.823, 37.8841], [-89.6233, 37.7472], [-89.5234, 37.6445], [-89.462, 37.4342], [-89.503, 37.3005], [-89.414, 37.1023], [-89.2725, 37.08], [-89.1543, 36.9921], [-89.1225, 36.9116], [-89.203, 36.6256], [-89.3974, 36.5878], [-89.4503, 36.5], [-89.4872, 36.5031], [-89.5573, 36.5011], [-89.5946, 36.2594], [-89.6745, 36.2206], [-89.6419, 36.1045], [-89.7047, 36.0015], [-90.3811, 35.9927], [-90.303, 36.0993], [-90.0758, 36.2967], [-90.0744, 36.3719], [-90.1623, 36.5009], [-91.5548, 36.5009], [-92.3904, 36.5009], [-93.7829, 36.5009], [-94.6184, 36.5009], [-94.6181, 37.0009], [-94.62, 37.6525], [-94.623, 38.5647], [-94.6225, 39.1245], [-94.7778, 39.194], [-94.9525, 39.4264], [-95.058, 39.509], [-95.0754, 39.5974], [-94.8933, 39.7818], [-94.9841, 39.8911], [-95.1162, 39.8721], [-95.3466, 40.0015], [-95.4637, 40.1981], [-95.6071, 40.2955], [-95.765, 40.6018], [-94.5063, 40.6087], [-93.2451, 40.616], [-91.7315, 40.6246], [-91.682, 40.5519], [-91.4419, 40.3794]]]\n },\n \"properties\": {\n \"name\": \"Missouri\",\n \"id\": \"US-MO\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MO\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-88.1733, 34.999], [-88.0847, 34.9331], [-88.1688, 34.292], [-88.3397, 32.9988], [-88.4862, 31.8904], [-88.4443, 31.1397], [-88.3996, 30.3709], [-88.6921, 30.3554], [-88.9051, 30.4151], [-89.2237, 30.3323], [-89.3206, 30.3453], [-89.521, 30.1926], [-89.5917, 30.223], [-89.6858, 30.4627], [-89.82, 30.6112], [-89.8354, 30.7308], [-89.7353, 31.0011], [-91.1769, 31.0012], [-91.6565, 31.0018], [-91.5963, 31.1099], [-91.6307, 31.2176], [-91.529, 31.3451], [-91.529, 31.4488], [-91.4146, 31.6399], [-91.3725, 31.7736], [-91.2864, 31.884], [-91.1566, 31.9707], [-91.0887, 32.1042], [-90.9477, 32.2401], [-90.9447, 32.3307], [-91.1038, 32.4905], [-91.1424, 32.6611], [-91.0961, 32.9376], [-91.15, 33.0159], [-91.1068, 33.2179], [-91.1633, 33.2944], [-91.1411, 33.4386], [-91.2146, 33.5834], [-91.2076, 33.6756], [-91.0528, 33.8276], [-91.0702, 33.9743], [-90.9431, 34.0297], [-90.9097, 34.1888], [-90.8172, 34.2522], [-90.718, 34.3917], [-90.5841, 34.5037], [-90.5392, 34.7281], [-90.3198, 34.8992], [-90.2938, 35.0012], [-89.2418, 35], [-88.1733, 34.999]]]\n },\n \"properties\": {\n \"name\": \"Mississippi\",\n \"id\": \"US-MS\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MS\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-104.0111, 45.943], [-104.0055, 45.001], [-104.0372, 45.0011], [-105.133, 45.0011], [-106.0098, 45.001], [-106.8864, 45.001], [-107.9824, 45.001], [-109.0783, 45.001], [-109.7358, 45.001], [-111.0508, 45.001], [-111.0514, 44.4989], [-111.1976, 44.5906], [-111.3374, 44.7449], [-111.4481, 44.7111], [-111.4998, 44.5448], [-111.7972, 44.5399], [-112.2313, 44.5607], [-112.3929, 44.468], [-112.7159, 44.498], [-112.8156, 44.406], [-112.9998, 44.4803], [-113.0933, 44.7154], [-113.1872, 44.7986], [-113.3389, 44.8081], [-113.4693, 44.93], [-113.4711, 45.0729], [-113.697, 45.305], [-113.8023, 45.601], [-113.9426, 45.6815], [-114.2976, 45.4875], [-114.5292, 45.5757], [-114.4958, 45.6859], [-114.5338, 45.7819], [-114.4051, 45.8742], [-114.4784, 46.0356], [-114.4853, 46.1582], [-114.3459, 46.5506], [-114.3368, 46.6592], [-114.6015, 46.6603], [-114.7537, 46.7345], [-114.9357, 46.9229], [-115.3495, 47.2612], [-115.7024, 47.4377], [-115.6697, 47.4979], [-115.7337, 47.7064], [-116.0491, 48.0047], [-116.0485, 48.993], [-115.4379, 48.993], [-114.1587, 48.993], [-113.306, 48.993], [-112.0269, 48.993], [-110.3213, 48.993], [-109.4684, 48.993], [-107.7631, 48.9932], [-106.0575, 48.9932], [-105.2048, 48.9932], [-104.034, 48.9932], [-104.025, 47.8499], [-104.0195, 47.0872], [-104.0111, 45.943]]]\n },\n \"properties\": {\n \"name\": \"Montana\",\n \"id\": \"US-MT\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-MT\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-75.9664, 36.5514], [-75.9927, 36.4738], [-75.8666, 36.2679], [-75.883, 36.1757], [-76.1478, 36.2793], [-76.15, 36.1458], [-76.3837, 36.1336], [-76.4788, 36.0281], [-76.6789, 36.0753], [-76.7262, 35.9576], [-76.3583, 35.9528], [-76.2065, 35.9912], [-76.0698, 35.9704], [-76.0835, 35.6905], [-76.0012, 35.7222], [-75.979, 35.8959], [-75.8538, 35.9601], [-75.7722, 35.8999], [-75.7447, 35.7655], [-75.774, 35.6469], [-76.1739, 35.3542], [-76.4895, 35.3971], [-76.5326, 35.5084], [-76.7414, 35.4315], [-76.513, 35.2704], [-76.628, 35.0733], [-76.7791, 34.9902], [-76.745, 34.9409], [-76.4568, 34.9894], [-76.3621, 34.9365], [-76.5168, 34.7773], [-76.7071, 34.7521], [-76.7332, 34.7069], [-77.1339, 34.7079], [-77.2518, 34.6156], [-77.3583, 34.6203], [-77.3797, 34.5266], [-77.7508, 34.285], [-77.926, 34.0732], [-78.0134, 33.9118], [-78.4058, 33.9175], [-78.5643, 33.8767], [-78.9784, 34.2261], [-79.6535, 34.7968], [-80.7841, 34.8286], [-80.793, 34.9628], [-80.9337, 35.1136], [-81.0451, 35.0657], [-81.0874, 35.1556], [-82.356, 35.2015], [-83.1149, 35.0015], [-84.3247, 34.988], [-84.287, 35.2009], [-84.2324, 35.2605], [-84.0623, 35.286], [-84.0038, 35.4141], [-83.8712, 35.5149], [-83.5112, 35.5841], [-83.1204, 35.7746], [-82.9902, 35.8004], [-82.8878, 35.9517], [-82.8128, 35.9473], [-82.6111, 36.0474], [-82.5211, 35.9812], [-82.3682, 36.0996], [-82.1826, 36.1539], [-82.0513, 36.1229], [-81.9082, 36.3065], [-81.7342, 36.3554], [-81.6589, 36.6106], [-81.6416, 36.5951], [-80.1944, 36.5837], [-79.471, 36.5781], [-78.3855, 36.5697], [-76.9385, 36.5585], [-75.9664, 36.5514]]]\n },\n \"properties\": {\n \"name\": \"North Carolina\",\n \"id\": \"US-NC\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NC\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-96.5563, 45.9428], [-98.1871, 45.9428], [-99.8179, 45.9429], [-100.7496, 45.9429], [-101.9144, 45.9429], [-103.3122, 45.943], [-104.0111, 45.943], [-104.0195, 47.0872], [-104.025, 47.8499], [-104.034, 48.9932], [-103.0728, 48.9932], [-102.22, 48.9932], [-100.5145, 48.9932], [-99.2354, 48.9932], [-97.9562, 48.9932], [-97.2257, 48.9932], [-97.1281, 48.6811], [-97.1439, 48.5367], [-97.1259, 48.1735], [-97.0074, 47.9255], [-96.988, 47.8204], [-96.8588, 47.5884], [-96.8183, 46.9742], [-96.7702, 46.9196], [-96.7867, 46.6483], [-96.7309, 46.4727], [-96.6175, 46.3271], [-96.5608, 46.1383], [-96.5563, 45.9428]]]\n },\n \"properties\": {\n \"name\": \"North Dakota\",\n \"id\": \"US-ND\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-ND\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-96.4809, 42.5113], [-96.3837, 42.4177], [-96.2954, 42.1329], [-96.1543, 41.9652], [-96.0688, 41.7343], [-96.0586, 41.5458], [-95.9329, 41.4254], [-95.8836, 41.2876], [-95.8341, 40.8895], [-95.859, 40.7451], [-95.765, 40.6018], [-95.6071, 40.2955], [-95.4637, 40.1981], [-95.3466, 40.0015], [-96.7845, 40.0011], [-97.8325, 40.0011], [-99.2997, 40.0011], [-100.7669, 40.0011], [-102.0245, 40.0011], [-102.025, 41.0006], [-103.273, 41.0007], [-104.0217, 41.0009], [-104.0252, 42.0012], [-104.0288, 43.0013], [-103.3366, 43.0013], [-101.9522, 43.0013], [-100.9139, 43.0013], [-99.5294, 43.0012], [-98.4417, 43.0011], [-98.1432, 42.8523], [-97.965, 42.8058], [-97.6981, 42.8746], [-97.4166, 42.8811], [-97.2388, 42.8605], [-97.0198, 42.7601], [-96.8045, 42.7015], [-96.6328, 42.5686], [-96.4809, 42.5113]]]\n },\n \"properties\": {\n \"name\": \"Nebraska\",\n \"id\": \"US-NE\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NE\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-70.7331, 43.07], [-70.8062, 42.8767], [-70.974, 42.8716], [-71.3296, 42.7024], [-72.4669, 42.7303], [-72.5499, 42.8867], [-72.4736, 43.0385], [-72.4071, 43.3319], [-72.385, 43.5293], [-72.2967, 43.7149], [-72.1149, 43.9655], [-72.0313, 44.3007], [-71.683, 44.4503], [-71.5685, 44.6076], [-71.6206, 44.7719], [-71.5102, 44.9083], [-71.5175, 45.0076], [-71.419, 45.2004], [-71.3273, 45.2901], [-71.2017, 45.2603], [-71.0846, 45.294], [-71.0314, 44.5297], [-70.9557, 43.3894], [-70.829, 43.2391], [-70.7331, 43.07]]]\n },\n \"properties\": {\n \"name\": \"New Hampshire\",\n \"id\": \"US-NH\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NH\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-73.9101, 40.9922], [-74.0256, 40.7564], [-74.2267, 40.608], [-74.2415, 40.4563], [-74.0498, 40.4299], [-73.9576, 40.3284], [-74.0283, 40.073], [-74.1177, 39.9382], [-74.1761, 39.7266], [-74.3899, 39.4869], [-74.4288, 39.3872], [-74.603, 39.2926], [-74.7944, 39.0019], [-74.9543, 38.9499], [-74.8971, 39.1455], [-75.1361, 39.2078], [-75.3535, 39.3399], [-75.5243, 39.4902], [-75.5235, 39.6019], [-75.4219, 39.7897], [-75.1538, 39.8706], [-75.0741, 39.9834], [-74.7349, 40.1545], [-75.0975, 40.5431], [-75.1889, 40.5958], [-75.1748, 40.7756], [-75.075, 40.8844], [-75.123, 40.9991], [-74.9123, 41.1553], [-74.8414, 41.2687], [-74.699, 41.3572], [-73.9101, 40.9922]]]\n },\n \"properties\": {\n \"name\": \"New Jersey\",\n \"id\": \"US-NJ\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NJ\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-103.0002, 36.5012], [-103.0422, 36.5006], [-103.048, 35.3761], [-103.0539, 34.2517], [-103.0582, 33.4084], [-103.0613, 32.8461], [-103.0656, 32.0027], [-103.9648, 32.0023], [-105.0886, 32.0019], [-105.9879, 32.0015], [-106.6683, 32.001], [-106.5664, 31.8196], [-106.4454, 31.7684], [-107.3326, 31.7747], [-108.2119, 31.7794], [-108.2145, 31.3295], [-109.0478, 31.328], [-109.0473, 32.3922], [-109.0472, 33.4558], [-109.0469, 34.5194], [-109.0469, 35.5829], [-109.0468, 36.2918], [-109.0467, 37.0009], [-107.9131, 37.0009], [-106.7795, 37.0009], [-106.0238, 37.0009], [-104.8901, 37.0009], [-103.7566, 37.0009], [-103.0008, 37.0009], [-103.0002, 36.5012]]]\n },\n \"properties\": {\n \"name\": \"New Mexico\",\n \"id\": \"US-NM\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NM\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-114.0402, 37.0042], [-114.0429, 36.1817], [-114.1833, 36.0303], [-114.4061, 36.1484], [-114.6691, 36.1218], [-114.7414, 36.0136], [-114.6871, 35.9173], [-114.6452, 35.6305], [-114.6485, 35.4759], [-114.5909, 35.3528], [-114.6105, 34.9912], [-115.3901, 35.5991], [-115.8978, 35.9955], [-116.6596, 36.5899], [-117.2097, 37.0033], [-118.1262, 37.6924], [-118.5948, 38.0193], [-119.2974, 38.5098], [-120.0001, 39.0002], [-120.0001, 39.5627], [-120.0006, 40.6879], [-120.0008, 42.0005], [-119.2547, 42.0005], [-118.1357, 42.0005], [-117.0166, 42.0005], [-115.9014, 42.0008], [-115.1578, 42.0009], [-114.0426, 42.001], [-114.042, 40.908], [-114.0418, 40.1273], [-114.0412, 39.1903], [-114.0408, 37.9411], [-114.0402, 37.0042]]]\n },\n \"properties\": {\n \"name\": \"Nevada\",\n \"id\": \"US-NV\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NV\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-72.5098, 40.9861], [-72.2874, 41.024], [-72.339, 40.8942], [-73.1943, 40.6542], [-73.2655, 40.6635], [-73.6209, 40.5999], [-73.7667, 40.5926], [-73.8228, 40.656], [-74.032, 40.6387], [-73.8793, 40.7916], [-73.5739, 40.9195], [-73.3727, 40.9438], [-73.1858, 40.9298], [-73.0338, 40.966], [-72.5098, 40.9861]]], [[[-73.2533, 42.7522], [-73.5072, 42.08], [-73.4806, 42.0556], [-73.5447, 41.296], [-73.4841, 41.2189], [-73.7231, 41.1045], [-73.6305, 40.9918], [-73.8513, 40.8314], [-73.9485, 40.8388], [-73.9101, 40.9922], [-74.699, 41.3572], [-74.7566, 41.4239], [-74.9354, 41.4743], [-75.0227, 41.5529], [-75.0537, 41.765], [-75.1219, 41.8534], [-75.2388, 41.8922], [-75.3513, 41.9984], [-76.4541, 41.999], [-77.9707, 41.9998], [-78.66, 42.0002], [-79.763, 42.0009], [-79.763, 42.2757], [-79.2092, 42.5551], [-78.8778, 42.7991], [-78.9197, 42.9481], [-78.9082, 43.0703], [-79.0661, 43.1061], [-79.0532, 43.285], [-78.6895, 43.3614], [-78.1749, 43.3946], [-77.8381, 43.3572], [-77.529, 43.2674], [-77.2708, 43.2945], [-76.9764, 43.2775], [-76.6929, 43.3609], [-76.4728, 43.5073], [-76.2027, 43.5745], [-76.1984, 43.8745], [-76.0987, 43.967], [-76.2378, 44.1832], [-75.8322, 44.3972], [-75.792, 44.4971], [-75.4012, 44.7723], [-75.1795, 44.8994], [-74.8565, 45.0039], [-73.3522, 45.0054], [-73.372, 44.5973], [-73.3098, 44.4596], [-73.3209, 44.2689], [-73.425, 44.0383], [-73.3757, 43.7622], [-73.4133, 43.6279], [-73.2471, 43.553], [-73.2666, 42.8648], [-73.2533, 42.7522]]]]\n },\n \"properties\": {\n \"name\": \"New York\",\n \"id\": \"US-NY\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-NY\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-80.519, 40.647], [-80.6591, 40.5629], [-80.6018, 40.3639], [-80.6683, 40.1853], [-80.8722, 39.7355], [-80.9633, 39.5711], [-81.3334, 39.3628], [-81.4396, 39.3926], [-81.6571, 39.272], [-81.8026, 39.0861], [-81.7778, 38.9728], [-82.0722, 38.9629], [-82.2034, 38.7682], [-82.18, 38.6376], [-82.387, 38.4339], [-82.6129, 38.4482], [-82.7582, 38.5412], [-82.8805, 38.7102], [-83.0001, 38.7141], [-83.2035, 38.6389], [-83.357, 38.6274], [-83.5384, 38.6998], [-83.6898, 38.6495], [-83.9484, 38.7743], [-84.1133, 38.7984], [-84.2272, 38.8652], [-84.2904, 38.9747], [-84.43, 39.0909], [-84.5946, 39.0858], [-84.7069, 39.1289], [-84.8216, 39.092], [-84.8133, 40.0745], [-84.803, 41.0506], [-84.7961, 41.7014], [-83.4643, 41.7394], [-83.4542, 41.7456], [-82.9108, 41.5382], [-82.8308, 41.5797], [-82.5243, 41.407], [-82.1213, 41.493], [-81.7232, 41.511], [-81.4471, 41.6714], [-81.2286, 41.7704], [-80.8692, 41.8933], [-80.5202, 41.9895], [-80.5202, 41.2769], [-80.519, 40.647]]]\n },\n \"properties\": {\n \"name\": \"Ohio\",\n \"id\": \"US-OH\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-OH\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-94.6184, 36.5009], [-94.4391, 35.3872], [-94.4616, 34.5178], [-94.4841, 33.6485], [-94.7091, 33.6994], [-94.9624, 33.8433], [-95.238, 33.9565], [-95.3739, 33.8743], [-95.6228, 33.9303], [-95.7839, 33.8645], [-95.9416, 33.8828], [-96.2785, 33.7576], [-96.4111, 33.7752], [-96.5917, 33.8492], [-96.7464, 33.8542], [-96.9777, 33.938], [-97.1724, 33.7568], [-97.2149, 33.8971], [-97.4302, 33.8385], [-97.6604, 33.9901], [-97.8424, 33.8757], [-98.0695, 34.0404], [-98.0987, 34.145], [-98.3559, 34.1414], [-98.4938, 34.0888], [-98.6085, 34.1612], [-98.7989, 34.1547], [-98.9688, 34.2086], [-99.1866, 34.2355], [-99.1999, 34.3183], [-99.3603, 34.4561], [-99.405, 34.392], [-99.6321, 34.3885], [-99.867, 34.5434], [-99.9995, 34.5867], [-100.0005, 35.3045], [-100.0023, 36.5009], [-101.314, 36.5011], [-102.0636, 36.5012], [-103.0002, 36.5012], [-103.0008, 37.0009], [-102.0128, 37.0009], [-101.0885, 37.0009], [-99.9329, 37.0009], [-99.0086, 37.0009], [-98.0844, 37.0009], [-97.1601, 37.0009], [-96.4668, 37.0009], [-95.5424, 37.0009], [-94.6181, 37.0009], [-94.6184, 36.5009]]]\n },\n \"properties\": {\n \"name\": \"Oklahoma\",\n \"id\": \"US-OK\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-OK\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-123.2206, 46.1537], [-123.1209, 46.1787], [-122.942, 46.1148], [-122.8434, 45.9781], [-122.7259, 45.6737], [-122.6498, 45.6275], [-122.2026, 45.591], [-122.0851, 45.6026], [-121.882, 45.6895], [-121.6625, 45.7182], [-121.4021, 45.7118], [-121.1843, 45.6437], [-121.0451, 45.639], [-120.3514, 45.7251], [-119.9343, 45.8379], [-119.4292, 45.9343], [-119.1773, 45.9451], [-119.0197, 46.0003], [-118.2062, 46.0013], [-116.8965, 46.0021], [-116.7647, 45.873], [-116.6168, 45.7992], [-116.4771, 45.6411], [-116.5492, 45.4567], [-116.8396, 44.9851], [-116.9489, 44.7701], [-117.1189, 44.5783], [-117.2017, 44.4362], [-117.1398, 44.2903], [-116.9531, 44.2453], [-116.9113, 44.1574], [-117.0205, 43.8132], [-117.019, 43.1165], [-117.0166, 42.0005], [-118.1357, 42.0005], [-119.2547, 42.0005], [-120.0008, 42.0005], [-121.0554, 42.0005], [-122.3737, 42.0005], [-123.4283, 42.0005], [-124.2284, 42.0008], [-124.3553, 42.1228], [-124.4205, 42.381], [-124.4062, 42.5837], [-124.5396, 42.8128], [-124.4544, 43.0123], [-124.3466, 43.3415], [-124.288, 43.4097], [-124.1487, 43.6918], [-124.0991, 44.3338], [-124.0474, 44.4255], [-124.0592, 44.7778], [-123.9486, 45.4008], [-123.9294, 45.5771], [-123.9612, 45.8429], [-123.9471, 46.1406], [-123.9117, 46.1822], [-123.6737, 46.1826], [-123.5217, 46.2226], [-123.4023, 46.155], [-123.2206, 46.1537]]]\n },\n \"properties\": {\n \"name\": \"Oregon\",\n \"id\": \"US-OR\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-OR\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-74.699, 41.3572], [-74.8414, 41.2687], [-74.9123, 41.1553], [-75.123, 40.9991], [-75.075, 40.8844], [-75.1748, 40.7756], [-75.1889, 40.5958], [-75.0975, 40.5431], [-74.7349, 40.1545], [-75.0741, 39.9834], [-75.1729, 39.8948], [-75.4211, 39.8154], [-75.6346, 39.8394], [-75.7847, 39.7223], [-76.708, 39.7225], [-78.0926, 39.7226], [-79.4776, 39.7227], [-80.5194, 39.7226], [-80.519, 40.647], [-80.5202, 41.2769], [-80.5202, 41.9895], [-80.3344, 42.0408], [-79.763, 42.2757], [-79.763, 42.0009], [-78.66, 42.0002], [-77.9707, 41.9998], [-76.4541, 41.999], [-75.3513, 41.9984], [-75.2388, 41.8922], [-75.1219, 41.8534], [-75.0537, 41.765], [-75.0227, 41.5529], [-74.9354, 41.4743], [-74.7566, 41.4239], [-74.699, 41.3572]]]\n },\n \"properties\": {\n \"name\": \"Pennsylvania\",\n \"id\": \"US-PA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-PA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-71.2338, 41.7065], [-71.3306, 41.7622], [-71.4265, 41.6333], [-71.4437, 41.4536], [-71.5229, 41.3789], [-71.8423, 41.3354], [-71.7958, 41.5199], [-71.8009, 42.0119], [-71.3871, 42.0169], [-71.3407, 41.7978], [-71.2338, 41.7065]]]\n },\n \"properties\": {\n \"name\": \"Rhode Island\",\n \"id\": \"US-RI\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-RI\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-78.5643, 33.8767], [-78.8414, 33.724], [-79.1382, 33.4059], [-79.1937, 33.2441], [-79.276, 33.1354], [-79.42, 33.0425], [-79.5871, 33.0009], [-79.615, 32.9093], [-79.8936, 32.7287], [-80.0217, 32.6199], [-80.2297, 32.5765], [-80.4743, 32.4228], [-80.4857, 32.3517], [-80.6083, 32.2928], [-80.6472, 32.3959], [-80.7653, 32.2984], [-80.6942, 32.2157], [-80.8492, 32.114], [-80.8724, 32.0295], [-81.0748, 32.1097], [-81.1351, 32.1818], [-81.1714, 32.3801], [-81.2903, 32.5573], [-81.377, 32.6075], [-81.4897, 32.9356], [-81.5783, 33.0686], [-81.6994, 33.1267], [-81.9329, 33.3899], [-82.0057, 33.5229], [-82.2084, 33.6636], [-82.2566, 33.7493], [-82.5894, 34.0176], [-82.8187, 34.3661], [-82.8478, 34.4369], [-83.0528, 34.5109], [-83.3557, 34.7083], [-83.3167, 34.8057], [-83.1149, 35.0015], [-82.356, 35.2015], [-81.0874, 35.1556], [-81.0451, 35.0657], [-80.9337, 35.1136], [-80.793, 34.9628], [-80.7841, 34.8286], [-79.6535, 34.7968], [-78.9784, 34.2261], [-78.5643, 33.8767]]]\n },\n \"properties\": {\n \"name\": \"South Carolina\",\n \"id\": \"US-SC\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-SC\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-96.5563, 45.9428], [-96.6146, 45.8], [-96.8137, 45.6592], [-96.8455, 45.5958], [-96.696, 45.4317], [-96.5298, 45.3715], [-96.4536, 45.2973], [-96.4536, 44.1747], [-96.4536, 43.5012], [-96.5985, 43.4976], [-96.5416, 43.3735], [-96.5555, 43.2317], [-96.4627, 43.0992], [-96.6218, 42.7296], [-96.5388, 42.6587], [-96.4809, 42.5113], [-96.6328, 42.5686], [-96.8045, 42.7015], [-97.0198, 42.7601], [-97.2388, 42.8605], [-97.4166, 42.8811], [-97.6981, 42.8746], [-97.965, 42.8058], [-98.1432, 42.8523], [-98.4417, 43.0011], [-99.5294, 43.0012], [-100.9139, 43.0013], [-101.9522, 43.0013], [-103.3366, 43.0013], [-104.0288, 43.0013], [-104.031, 43.5013], [-104.0351, 44.5012], [-104.0372, 45.0011], [-104.0055, 45.001], [-104.0111, 45.943], [-103.3122, 45.943], [-101.9144, 45.9429], [-100.7496, 45.9429], [-99.8179, 45.9429], [-98.1871, 45.9428], [-96.5563, 45.9428]]]\n },\n \"properties\": {\n \"name\": \"South Dakota\",\n \"id\": \"US-SD\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-SD\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-83.6676, 36.605], [-82.9558, 36.6021], [-81.9525, 36.598], [-81.6589, 36.6106], [-81.7342, 36.3554], [-81.9082, 36.3065], [-82.0513, 36.1229], [-82.1826, 36.1539], [-82.3682, 36.0996], [-82.5211, 35.9812], [-82.6111, 36.0474], [-82.8128, 35.9473], [-82.8878, 35.9517], [-82.9902, 35.8004], [-83.1204, 35.7746], [-83.5112, 35.5841], [-83.8712, 35.5149], [-84.0038, 35.4141], [-84.0623, 35.286], [-84.2324, 35.2605], [-84.287, 35.2009], [-84.3247, 34.988], [-85.6235, 35.0009], [-86.9071, 35.0129], [-88.1905, 35.0249], [-88.1733, 34.999], [-89.2418, 35], [-90.2938, 35.0012], [-90.1423, 35.1142], [-90.0929, 35.2036], [-90.066, 35.4141], [-89.9674, 35.5033], [-89.9436, 35.6791], [-89.7796, 35.8057], [-89.7037, 35.9069], [-89.7047, 36.0015], [-89.6419, 36.1045], [-89.6745, 36.2206], [-89.5946, 36.2594], [-89.5573, 36.5011], [-89.4872, 36.5031], [-89.4503, 36.5], [-88.0591, 36.4997], [-88.0964, 36.693], [-87.8392, 36.6439], [-86.5076, 36.6648], [-85.8133, 36.6453], [-84.4247, 36.6062], [-83.7304, 36.5868], [-83.6676, 36.605]]]\n },\n \"properties\": {\n \"name\": \"Tennessee\",\n \"id\": \"US-TN\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-TN\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-97.1708, 26.1594], [-97.2673, 26.3299], [-97.4021, 26.8205], [-97.3512, 26.8014], [-97.1708, 26.1594]]], [[[-97.0144, 27.9017], [-96.8992, 28.1174], [-96.8397, 28.0889], [-97.0144, 27.9017]]], [[[-94.4841, 33.6485], [-94.3778, 33.5661], [-94.2947, 33.5875], [-94.0472, 33.5544], [-94.0413, 33.012], [-94.0434, 31.9992], [-93.905, 31.877], [-93.8269, 31.7503], [-93.8206, 31.604], [-93.7376, 31.5138], [-93.6659, 31.3226], [-93.5577, 31.1804], [-93.5306, 31.0462], [-93.5792, 30.8238], [-93.7202, 30.5583], [-93.7504, 30.3448], [-93.7106, 30.1128], [-93.794, 29.9772], [-93.8414, 29.9798], [-93.9462, 29.815], [-93.8905, 29.6894], [-94.0996, 29.6704], [-94.7501, 29.418], [-94.6053, 29.5677], [-94.7782, 29.5478], [-94.7243, 29.6552], [-94.7419, 29.75], [-94.8323, 29.7526], [-94.8899, 29.6769], [-95.0229, 29.7024], [-94.9928, 29.531], [-94.8883, 29.3705], [-95.139, 29.1679], [-95.1522, 29.0792], [-95.2735, 28.9638], [-95.8534, 28.6404], [-96.0204, 28.5869], [-96.2753, 28.6552], [-96.4488, 28.5944], [-96.5756, 28.7156], [-96.6401, 28.7088], [-96.5246, 28.4887], [-96.5618, 28.3671], [-96.6764, 28.3413], [-96.7736, 28.4217], [-96.8068, 28.2202], [-96.8916, 28.1576], [-96.9667, 28.1895], [-97.1565, 28.1444], [-97.0731, 27.9862], [-97.1714, 27.8796], [-97.3741, 27.87], [-97.4316, 27.8372], [-97.2888, 27.6706], [-97.3804, 27.4194], [-97.4391, 27.3282], [-97.5238, 27.314], [-97.6821, 27.3949], [-97.6924, 27.2872], [-97.4852, 27.2373], [-97.4757, 27.1179], [-97.5547, 26.9673], [-97.4658, 26.6917], [-97.4024, 26.3965], [-97.1462, 25.9614], [-97.2818, 25.9417], [-97.3582, 25.8705], [-97.5872, 25.9843], [-97.8015, 26.042], [-98.0828, 26.0645], [-98.275, 26.1113], [-98.4859, 26.2245], [-98.5983, 26.2378], [-98.7652, 26.3404], [-99.0153, 26.399], [-99.1077, 26.4468], [-99.1721, 26.5641], [-99.2299, 26.7619], [-99.3025, 26.8848], [-99.4436, 27.0366], [-99.4403, 27.1701], [-99.5101, 27.3403], [-99.5053, 27.5483], [-99.7543, 27.73], [-99.8896, 27.8673], [-100.0014, 28.0479], [-100.1119, 28.1729], [-100.296, 28.3277], [-100.3317, 28.5026], [-100.5497, 28.8214], [-100.6586, 29.0686], [-100.7546, 29.1825], [-101.0164, 29.4007], [-101.039, 29.4605], [-101.3035, 29.6341], [-101.4405, 29.7768], [-101.9909, 29.7958], [-102.269, 29.8712], [-102.4763, 29.769], [-102.6149, 29.7523], [-102.7342, 29.644], [-102.834, 29.444], [-102.8919, 29.2164], [-103.0227, 29.1322], [-103.0901, 29.0419], [-103.2576, 29.0011], [-103.423, 29.0707], [-103.664, 29.207], [-104.1107, 29.3862], [-104.3122, 29.5425], [-104.4007, 29.5738], [-104.5041, 29.6777], [-104.6223, 29.8543], [-104.6812, 29.9905], [-104.6812, 30.1343], [-104.8359, 30.4476], [-104.9788, 30.6459], [-105.2758, 30.8073], [-105.514, 30.9808], [-105.8126, 31.241], [-106.0241, 31.3978], [-106.148, 31.4508], [-106.2558, 31.5446], [-106.4454, 31.7684], [-106.5664, 31.8196], [-106.6683, 32.001], [-105.9879, 32.0015], [-105.0886, 32.0019], [-103.9648, 32.0023], [-103.0656, 32.0027], [-103.0613, 32.8461], [-103.0582, 33.4084], [-103.0539, 34.2517], [-103.048, 35.3761], [-103.0422, 36.5006], [-103.0002, 36.5012], [-102.0636, 36.5012], [-101.314, 36.5011], [-100.0023, 36.5009], [-100.0005, 35.3045], [-99.9995, 34.5867], [-99.867, 34.5434], [-99.6321, 34.3885], [-99.405, 34.392], [-99.3603, 34.4561], [-99.1999, 34.3183], [-99.1866, 34.2355], [-98.9688, 34.2086], [-98.7989, 34.1547], [-98.6085, 34.1612], [-98.4938, 34.0888], [-98.3559, 34.1414], [-98.0987, 34.145], [-98.0695, 34.0404], [-97.8424, 33.8757], [-97.6604, 33.9901], [-97.4302, 33.8385], [-97.2149, 33.8971], [-97.1724, 33.7568], [-96.9777, 33.938], [-96.7464, 33.8542], [-96.5917, 33.8492], [-96.4111, 33.7752], [-96.2785, 33.7576], [-95.9416, 33.8828], [-95.7839, 33.8645], [-95.6228, 33.9303], [-95.3739, 33.8743], [-95.238, 33.9565], [-94.9624, 33.8433], [-94.7091, 33.6994], [-94.4841, 33.6485]]]]\n },\n \"properties\": {\n \"name\": \"Texas\",\n \"id\": \"US-TX\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-TX\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-111.0503, 42.0009], [-111.05, 41.0009], [-109.7978, 41.0009], [-109.0464, 41.0009], [-109.0465, 40.0008], [-109.0465, 39.2509], [-109.0465, 38.0009], [-109.0467, 37.0009], [-109.9829, 37.0014], [-111.2313, 37.0022], [-111.8556, 37.0026], [-113.104, 37.0035], [-114.0402, 37.0042], [-114.0408, 37.9411], [-114.0412, 39.1903], [-114.0418, 40.1273], [-114.042, 40.908], [-114.0426, 42.001], [-112.7333, 42.001], [-111.9855, 42.0009], [-111.0503, 42.0009]]]\n },\n \"properties\": {\n \"name\": \"Utah\",\n \"id\": \"US-UT\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-UT\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-77.7266, 39.3465], [-77.4789, 39.2209], [-77.4809, 39.113], [-77.3012, 39.0533], [-77.1221, 38.9435], [-77.0303, 38.8893], [-77.0456, 38.7758], [-77.2603, 38.6], [-77.3136, 38.3966], [-77.2319, 38.34], [-77.0468, 38.3566], [-76.9062, 38.197], [-76.5496, 38.0946], [-76.4717, 38.0112], [-76.2642, 37.8935], [-76.3056, 37.7216], [-76.484, 37.6289], [-76.3055, 37.5714], [-76.2635, 37.357], [-76.4009, 37.3862], [-76.4011, 37.2127], [-76.2833, 37.0527], [-76.4008, 36.9913], [-76.6719, 37.173], [-76.6339, 37.0475], [-76.3996, 36.8899], [-76.2442, 36.9526], [-75.9994, 36.9126], [-75.8575, 36.5506], [-75.8891, 36.5504], [-75.9664, 36.5514], [-76.9385, 36.5585], [-78.3855, 36.5697], [-79.471, 36.5781], [-80.1944, 36.5837], [-81.6416, 36.5951], [-81.6589, 36.6106], [-81.9525, 36.598], [-82.9558, 36.6021], [-83.6676, 36.605], [-83.1502, 36.7624], [-82.8945, 36.9064], [-82.7319, 37.048], [-82.6816, 37.1381], [-82.3431, 37.2969], [-81.9652, 37.5396], [-81.913, 37.369], [-81.8293, 37.2986], [-81.5648, 37.2097], [-81.35, 37.3337], [-81.2272, 37.2633], [-80.9437, 37.3018], [-80.8211, 37.4231], [-80.7199, 37.401], [-80.3161, 37.5097], [-80.2459, 37.6208], [-80.2853, 37.677], [-80.1881, 37.8241], [-79.9717, 38.0461], [-79.9028, 38.1807], [-79.7153, 38.404], [-79.6687, 38.5443], [-79.5977, 38.5771], [-79.3958, 38.4545], [-79.2402, 38.4766], [-79.0412, 38.7896], [-78.8687, 38.8179], [-78.5815, 38.999], [-78.4352, 39.1608], [-78.3223, 39.4519], [-77.8358, 39.1452], [-77.7266, 39.3465]]], [[[-75.6592, 37.954], [-75.62, 37.9993], [-75.376, 38.025], [-75.5963, 37.6312], [-75.5871, 37.5587], [-75.812, 37.4251], [-75.9343, 37.152], [-75.9974, 37.2639], [-75.975, 37.3985], [-75.8882, 37.6191], [-75.7193, 37.8214], [-75.6592, 37.954]]]]\n },\n \"properties\": {\n \"name\": \"Virginia\",\n \"id\": \"US-VA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-VA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-72.4669, 42.7303], [-73.2533, 42.7522], [-73.2666, 42.8648], [-73.2471, 43.553], [-73.4133, 43.6279], [-73.3757, 43.7622], [-73.425, 44.0383], [-73.3209, 44.2689], [-73.3098, 44.4596], [-73.372, 44.5973], [-73.3522, 45.0054], [-72.766, 45.0061], [-71.5175, 45.0076], [-71.5102, 44.9083], [-71.6206, 44.7719], [-71.5685, 44.6076], [-71.683, 44.4503], [-72.0313, 44.3007], [-72.1149, 43.9655], [-72.2967, 43.7149], [-72.385, 43.5293], [-72.4071, 43.3319], [-72.4736, 43.0385], [-72.5499, 42.8867], [-72.4669, 42.7303]]]\n },\n \"properties\": {\n \"name\": \"Vermont\",\n \"id\": \"US-VT\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-VT\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-116.8965, 46.0021], [-118.2062, 46.0013], [-119.0197, 46.0003], [-119.1773, 45.9451], [-119.4292, 45.9343], [-119.9343, 45.8379], [-120.3514, 45.7251], [-121.0451, 45.639], [-121.1843, 45.6437], [-121.4021, 45.7118], [-121.6625, 45.7182], [-121.882, 45.6895], [-122.0851, 45.6026], [-122.2026, 45.591], [-122.6498, 45.6275], [-122.7259, 45.6737], [-122.8434, 45.9781], [-122.942, 46.1148], [-123.1209, 46.1787], [-123.2206, 46.1537], [-123.4649, 46.2712], [-123.6884, 46.2998], [-123.8957, 46.2677], [-124.0727, 46.2795], [-124.0502, 46.4906], [-123.9461, 46.4326], [-123.8891, 46.66], [-124.0717, 46.7448], [-124.1126, 46.8627], [-123.8429, 46.9632], [-124.0422, 47.0297], [-124.1635, 47.0153], [-124.1989, 47.2085], [-124.3093, 47.4046], [-124.376, 47.6587], [-124.46, 47.7843], [-124.6211, 47.9042], [-124.7017, 48.1517], [-124.6326, 48.375], [-123.9758, 48.1685], [-123.2944, 48.1196], [-123.1244, 48.151], [-123.0242, 48.0816], [-122.8609, 48.0901], [-122.7398, 48.0133], [-122.6567, 47.8811], [-122.8214, 47.7931], [-122.7571, 47.7005], [-122.5879, 47.8559], [-122.5239, 47.7694], [-122.6184, 47.7129], [-122.5536, 47.4049], [-122.5779, 47.2931], [-122.8125, 47.3289], [-122.9195, 47.2897], [-122.9876, 47.1726], [-122.7019, 47.1109], [-122.5422, 47.2756], [-122.3538, 47.3716], [-122.3684, 47.6039], [-122.4105, 47.6527], [-122.3928, 47.8205], [-122.242, 48.0108], [-122.353, 48.1138], [-122.494, 48.1304], [-122.5203, 48.2291], [-122.4086, 48.2939], [-122.669, 48.4653], [-122.4967, 48.5056], [-122.562, 48.778], [-122.653, 48.7639], [-122.7888, 48.993], [-121.4072, 48.993], [-119.7018, 48.993], [-117.9962, 48.993], [-117.039, 48.993], [-117.0317, 47.7115], [-117.025, 46.4291], [-116.943, 46.2321], [-116.8965, 46.0021]]], [[[-122.5728, 48.1567], [-122.3667, 47.9855], [-122.5575, 47.9925], [-122.5728, 48.1567]]]]\n },\n \"properties\": {\n \"name\": \"Washington\",\n \"id\": \"US-WA\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-WA\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"MultiPolygon\",\n \"coordinates\": [[[[-90.4077, 46.593], [-90.2304, 46.5098], [-90.1185, 46.3416], [-89.1193, 46.1491], [-88.8374, 46.0365], [-88.4931, 46.0135], [-88.1518, 45.9454], [-88.1161, 45.8158], [-87.9225, 45.76], [-87.8091, 45.6861], [-87.8152, 45.5059], [-87.8653, 45.3678], [-87.6964, 45.3829], [-87.721, 45.2427], [-87.6059, 45.1085], [-87.627, 45.0323], [-87.8302, 44.9424], [-88.0282, 44.6179], [-87.929, 44.5595], [-87.741, 44.6921], [-87.6044, 44.8469], [-87.4197, 44.8657], [-87.3374, 44.7758], [-87.4866, 44.5086], [-87.5275, 44.3857], [-87.5349, 44.1743], [-87.6584, 44.059], [-87.7238, 43.9073], [-87.6997, 43.7237], [-87.774, 43.5989], [-87.9017, 43.2449], [-87.8935, 43.0411], [-87.787, 42.8092], [-87.8121, 42.4971], [-89.2905, 42.5052], [-90.6506, 42.5129], [-90.6879, 42.6104], [-90.7887, 42.6769], [-90.9599, 42.7204], [-91.0695, 42.7885], [-91.1614, 43.1023], [-91.1172, 43.3311], [-91.2187, 43.3953], [-91.2453, 43.5024], [-91.2785, 43.7975], [-91.3827, 43.9908], [-91.8409, 44.1942], [-92.0551, 44.3999], [-92.2404, 44.4621], [-92.3669, 44.5522], [-92.6435, 44.6453], [-92.7991, 44.79], [-92.7634, 44.9342], [-92.7931, 45.0713], [-92.7661, 45.2364], [-92.6857, 45.3806], [-92.7071, 45.4937], [-92.8924, 45.5947], [-92.8747, 45.7061], [-92.6938, 45.909], [-92.2926, 46.0843], [-92.2917, 46.6607], [-92.107, 46.7623], [-91.9874, 46.699], [-91.8356, 46.7021], [-91.4991, 46.7662], [-91.2177, 46.8856], [-91.1272, 46.8676], [-90.9461, 46.9538], [-90.7684, 46.908], [-90.923, 46.6031], [-90.7368, 46.6888], [-90.5361, 46.5994], [-90.4077, 46.593]]], [[[-86.9919, 45.241], [-87.0589, 45.1025], [-87.2804, 44.8349], [-87.3965, 44.9541], [-87.2587, 45.138], [-87.122, 45.2245], [-86.9919, 45.241]]]]\n },\n \"properties\": {\n \"name\": \"Wisconsin\",\n \"id\": \"US-WI\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-WI\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-79.4776, 39.7227], [-79.488, 39.2109], [-79.2935, 39.3115], [-79.0752, 39.4761], [-78.9714, 39.4537], [-78.8148, 39.5701], [-78.4956, 39.5334], [-78.4068, 39.6279], [-78.1812, 39.6857], [-77.8832, 39.6107], [-77.7981, 39.5172], [-77.7266, 39.3465], [-77.8358, 39.1452], [-78.3223, 39.4519], [-78.4352, 39.1608], [-78.5815, 38.999], [-78.8687, 38.8179], [-79.0412, 38.7896], [-79.2402, 38.4766], [-79.3958, 38.4545], [-79.5977, 38.5771], [-79.6687, 38.5443], [-79.7153, 38.404], [-79.9028, 38.1807], [-79.9717, 38.0461], [-80.1881, 37.8241], [-80.2853, 37.677], [-80.2459, 37.6208], [-80.3161, 37.5097], [-80.7199, 37.401], [-80.8211, 37.4231], [-80.9437, 37.3018], [-81.2272, 37.2633], [-81.35, 37.3337], [-81.5648, 37.2097], [-81.8293, 37.2986], [-81.913, 37.369], [-81.9652, 37.5396], [-82.1035, 37.5706], [-82.2802, 37.6872], [-82.5887, 38.0998], [-82.5784, 38.272], [-82.6129, 38.4482], [-82.387, 38.4339], [-82.18, 38.6376], [-82.2034, 38.7682], [-82.0722, 38.9629], [-81.7778, 38.9728], [-81.8026, 39.0861], [-81.6571, 39.272], [-81.4396, 39.3926], [-81.3334, 39.3628], [-80.9633, 39.5711], [-80.8722, 39.7355], [-80.6683, 40.1853], [-80.6018, 40.3639], [-80.6591, 40.5629], [-80.519, 40.647], [-80.5194, 39.7226], [-79.4776, 39.7227]]]\n },\n \"properties\": {\n \"name\": \"West Virginia\",\n \"id\": \"US-WV\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-WV\"\n }, {\n \"type\": \"Feature\",\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[[-104.0288, 43.0013], [-104.0252, 42.0012], [-104.0217, 41.0009], [-104.9638, 41.0009], [-105.906, 41.0009], [-107.1622, 41.0009], [-108.1044, 41.0009], [-109.0464, 41.0009], [-109.7978, 41.0009], [-111.05, 41.0009], [-111.0503, 42.0009], [-111.0508, 43.0938], [-111.051, 43.7182], [-111.0514, 44.4989], [-111.0508, 45.001], [-109.7358, 45.001], [-109.0783, 45.001], [-107.9824, 45.001], [-106.8864, 45.001], [-106.0098, 45.001], [-105.133, 45.0011], [-104.0372, 45.0011], [-104.0351, 44.5012], [-104.031, 43.5013], [-104.0288, 43.0013]]]\n },\n \"properties\": {\n \"name\": \"Wyoming\",\n \"id\": \"US-WY\",\n \"CNTRY\": \"United States of America\",\n \"TYPE\": \"State\"\n },\n \"id\": \"US-WY\"\n }]\n};\nexport default map;","import React from 'react';\nimport * as am4core from '@amcharts/amcharts4/core';\nimport * as am4maps from '@amcharts/amcharts4/maps';\nimport am4geodata_usaLow from '@amcharts/amcharts4-geodata/usaLow';\nimport {colorGradient} from '../../../shared/utils';\n\nimport data from '../../data/map_data.json';\n\nexport default class IndustryBreakdown extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.state = {};\n this.mapRef = React.createRef();\n }\n\n colorFor(value) {\n const colors = colorGradient(colorGradient.defaultLightest, colorGradient.defaultDarkest, 6);\n if (value < 25) {\n return colors[0];\n } else if (value < 50) {\n return colors[1];\n } else if (value < 100) {\n return colors[2];\n } else if (value < 200) {\n return colors[3];\n } else if (value < 500) {\n return colors[4];\n } else {\n return colors[5];\n }\n }\n\n componentDidMount() {\n let chart = am4core.create(this.mapRef.current, am4maps.MapChart);\n chart.height = 300;\n\n chart.projection = new am4maps.projections.Miller();\n chart.geodata = am4geodata_usaLow;\n\n chart.zoomLevel = 4;\n\n let polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());\n\n // Make map load polygon (like country names) data from GeoJSON\n polygonSeries.useGeodata = true;\n polygonSeries.exclude = ['US-AK', 'US-HI'];\n polygonSeries.data = data.counts.map((entry) => {\n entry.fill = am4core.color(this.colorFor(entry.value));\n return entry;\n });\n\n // Configure series\n let polygonTemplate = polygonSeries.mapPolygons.template;\n\n polygonTemplate.tooltipText = '{name} ({value})';\n polygonTemplate.propertyFields.fill = 'fill';\n\n // Create hover state and set alternative fill color\n var hs = polygonTemplate.states.create('hover');\n hs.properties.fill = am4core.color('#FD2A33');\n }\n\n render() {\n return (\n \n );\n }\n\n}\n","import _ from 'lodash';\nimport React from 'react';\nimport Select from 'react-select';\nimport { Pie } from 'react-chartjs-2';\nimport data from '../../data/source_data.json';\nimport {colorGradient} from '../../../shared/utils';\n\nexport default class Source extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n timeSelection: { value: '30', label: '30 days' },\n timeInterval: '30',\n statusSelection: { value: 'Engage', label: 'Engage' },\n status: 'Engage',\n source: null\n };\n\n this.mainChartRef = React.createRef();\n }\n\n getMainData() {\n const status = this.state.status === 'All' ? '' : this.state.status;\n return _.get(data, [status, this.state.timeInterval, 'summary']);\n }\n\n getBreakdownData() {\n const status = this.state.status === 'All' ? '' : this.state.status;\n return this.state.source\n ? _.get(data, [status, this.state.timeInterval, 'details', this.state.source])\n : null\n ;\n }\n\n colorPalette(count) {\n return colorGradient(colorGradient.defaultLightest, colorGradient.defaultDarkest, count);\n }\n\n renderMainChart() {\n const mainData = this.getMainData();\n return (\n e.target.style.cursor = el.length ? 'pointer' : 'default',\n pieceLabel: {\n render: args => `${args.label} (${args.percentage}%)`,\n arc: true,\n position: 'border',\n fontSize: 16,\n fontStyle: 'bold',\n fontColor: '#000',\n },\n tooltips: {\n callbacks: {\n label: (tooltipItem, data) => {\n const dataset = data.datasets[tooltipItem.datasetIndex];\n const meta = dataset._meta[Object.keys(dataset._meta)[0]];\n const total = meta.total;\n const currentValue = dataset.data[tooltipItem.index];\n const percentage = parseFloat((currentValue/total*100).toFixed(1));\n return currentValue + ' (' + percentage + '%)';\n },\n title: function(tooltipItem) {\n return mainData.labels[tooltipItem[0].index];\n }\n }\n },\n plugins: {\n datalabels: {\n display: false\n }\n }\n }}\n onElementsClick={targets => {\n if (targets.length === 0) return;\n const target = targets[0];\n if (target) {\n const chartData = target._chart.config.data;\n const idx = target._index;\n\n const label = chartData.labels[idx];\n this.setState({source: label});\n }\n }}\n />\n );\n }\n\n renderBreakdownChart() {\n const breakdownData = this.getBreakdownData();\n return breakdownData\n ? (\n \n ) : (\n {this.props.copy.voyager_sources_prompt}
\n )\n ;\n }\n\n handleStatusChange(selectedStatus) {\n this.setState({\n statusSelection: selectedStatus,\n status: selectedStatus.value,\n loading: true\n }, this.fetchChartData);\n }\n\n statusFilter() {\n return (\n