{"version":3,"sources":["webpack:///./node_modules/@amcharts/amcharts4/.internal/core/data/JSONParser.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/data/DataSource.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/data/DataLoader.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/data/DataParser.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/data/CSVParser.js"],"names":["__webpack_require__","d","__webpack_exports__","JSONParser","tslib__WEBPACK_IMPORTED_MODULE_0__","_DataParser__WEBPACK_IMPORTED_MODULE_1__","_utils_Object__WEBPACK_IMPORTED_MODULE_2__","_utils_Type__WEBPACK_IMPORTED_MODULE_3__","_super","_this","apply","this","arguments","contentType","options","isJSON","data","JSON","parse","e","prototype","res","empty","emptyAs","numbers","parsableNumbers","dates","parsableDates","Array","isArray","_loop_1","i","len","row","key","value","maybeToEmpty","maybeToNumber","maybeToDate","length","DataSource","_DataLoader__WEBPACK_IMPORTED_MODULE_1__","_JSONParser__WEBPACK_IMPORTED_MODULE_2__","_CSVParser__WEBPACK_IMPORTED_MODULE_3__","_Base__WEBPACK_IMPORTED_MODULE_4__","_utils_Adapter__WEBPACK_IMPORTED_MODULE_5__","_utils_Language__WEBPACK_IMPORTED_MODULE_6__","_formatters_DateFormatter__WEBPACK_IMPORTED_MODULE_7__","_Registry__WEBPACK_IMPORTED_MODULE_8__","_utils_Type__WEBPACK_IMPORTED_MODULE_9__","_utils_Object__WEBPACK_IMPORTED_MODULE_10__","url","parser","call","adapter","_requestOptions","_incremental","_incrementalParams","_keepCount","_updateCurrentData","showPreloader","className","getParserByType","processData","dispatchImmediately","getParserByData","dateFields","numberFields","dateFormatter","events","isEnabled","event_2","type","message","language","translate","target","lastLoad","Date","event_1","Object","defineProperty","get","disableCache","timestampUrl","_url","incremental","component","addUrlParams","incrementalParams","set","enumerable","configurable","_parser","_reloadFrequency","_reloadDisposer","on","ev","_reloadTimeout","setTimeout","load","reloadFrequency","dispose","undefined","_language","_dateFormatter","tstamp","getTime","toString","params","clearTimeout","join","match","add","push","encodeURIComponent","processConfig","config","registeredClasses","dataLoader","_CSVParser__WEBPACK_IMPORTED_MODULE_0__","_JSONParser__WEBPACK_IMPORTED_MODULE_1__","_utils_Adapter__WEBPACK_IMPORTED_MODULE_2__","_utils_Net__WEBPACK_IMPORTED_MODULE_3__","_utils_Array__WEBPACK_IMPORTED_MODULE_4__","DataLoader","source","sources","promises","x","requestOptions","Promise","all","then","result","error","code","xhr","status","response","catch","isCSV","DataParser","_formatters_DateFormatter__WEBPACK_IMPORTED_MODULE_0__","_utils_Utils__WEBPACK_IMPORTED_MODULE_1__","_utils_Type__WEBPACK_IMPORTED_MODULE_2__","field","indexOf","dateFormat","inputDateFormat","CSVParser","_utils_Array__WEBPACK_IMPORTED_MODULE_3__","separators","delimiter","reverse","skipRows","skipEmpty","useColumnNames","getDelimiterFromData","separator","lines","split","sep","columns","lineColums","csv","col","CSVToArray","cols","shift","replace","pop","dataPoint","objPattern","RegExp","arrData","arrMatches","exec","strMatchedDelimiter","strMatchedValue"],"mappings":"kHAAAA,EAAAC,EAAAC,EAAA,sBAAAC,IAAA,IAAAC,EAAAJ,EAAA,QAAAK,EAAAL,EAAA,QAAAM,EAAAN,EAAA,QAAAO,EAAAP,EAAA,QAkBAG,EAAA,SAAAK,GAEA,SAAAL,IACA,IAAAM,EAAA,OAAAD,KAAAE,MAAAC,KAAAC,YAAAD,KAWA,OAPAF,EAAAI,YAAA,mBAMAJ,EAAAK,QAAA,GACAL,EAkEA,OA/EIL,EAAA,KAAiBD,EAAAK,GAqBrBL,EAAAY,OAAA,SAAAC,GACA,IAIA,OAFAC,KAAAC,MAAAF,IAEA,EAEA,MAAAG,GACA,WASAhB,EAAAiB,UAAAF,MAAA,SAAAF,GACA,IAEAK,EAFAZ,EAAAE,KAIA,IACgBJ,EAAA,KAAcU,QAC9BI,EAAAJ,KAAAC,MAAAF,IAGA,MAAAG,GACA,OAGA,IAAAG,EAAoBf,EAAA,KAAcI,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EAAAN,GAAA3J,KAAA0B,cAAAiI,EAAAM,EAAAN,KAEA5I,IACAkJ,EAAAN,GAAA3J,KAAA2B,YAAAgI,EAAAM,EAAAN,KAGAjJ,EAAA6F,KAAA0D,IAEA,OAAAvJ,GAYAiI,EAAAlI,UAAAmJ,WAAA,SAAAvJ,EAAAyI,GAGAA,KAAA,IAEA,IAAAoB,EAAA,IAAAC,OAEA,MAAArB,EAAA,iDAIAA,EAAA,mBAGAsB,EAAA,CACA,IAIAC,EAAA,KAGA,SAEA,GADAA,EAAAH,EAAAI,KAAAjK,IACAgK,EACA,MAGA,IAAAE,EAAAF,EAAA,GAKAE,EAAA3I,QACA2I,IAAAzB,GAGAsB,EAAA7D,KAAA,IAKA,IAAAiE,OAAA,EAIAA,EAHAH,EAAA,GAGAA,EAAA,GAAAN,QAAA,IAAAI,OAAA,eAIAE,EAAA,GAIAD,IAAAxI,OAAA,GAAA2E,KAAAiE,GAGA,UAEA7B,EAnNA,CAoNEjJ,EAAA","file":"js/chunk-7992e6f9.42b5a9e7.js","sourcesContent":["/**\r\n * JSON parser.\r\n */\r\nimport * as tslib_1 from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { DataParser } from \"./DataParser\";\r\nimport * as $object from \"../utils/Object\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * A parser for JSON.\r\n *\r\n * @important\r\n */\r\nvar JSONParser = /** @class */ (function (_super) {\r\n tslib_1.__extends(JSONParser, _super);\r\n function JSONParser() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Content-type suitable for JSON format.\r\n */\r\n _this.contentType = \"application/json\";\r\n /**\r\n * Parser options.\r\n *\r\n * @see {@link IJSONOptions} for description of each option\r\n */\r\n _this.options = {};\r\n return _this;\r\n }\r\n /**\r\n * Tests if the data is valid JSON.\r\n *\r\n * @param data Source data\r\n * @return Is it JSON?\r\n */\r\n JSONParser.isJSON = function (data) {\r\n try {\r\n // Try parsing JSON\r\n JSON.parse(data);\r\n // If we got to this point it means it's a valid JSON\r\n return true;\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Parses and returns data.\r\n *\r\n * @param data Unparsed data\r\n * @return Parsed data\r\n */\r\n JSONParser.prototype.parse = function (data) {\r\n var _this = this;\r\n // Init return\r\n var res;\r\n // Try parsing\r\n try {\r\n if ($type.hasValue(JSON)) {\r\n res = JSON.parse(data);\r\n }\r\n }\r\n catch (e) {\r\n return undefined;\r\n }\r\n // Do we need to cast some fields to numbers or dates?\r\n var empty = $type.hasValue(this.options.emptyAs);\r\n var numbers = this.parsableNumbers;\r\n var dates = this.parsableDates;\r\n if (Array.isArray(res) && (numbers || dates || empty)) {\r\n var _loop_1 = function (i, len) {\r\n var row = res[i];\r\n $object.each(row, function (key, value) {\r\n if (empty) {\r\n row[key] = _this.maybeToEmpty(row[key]);\r\n }\r\n if (numbers) {\r\n row[key] = _this.maybeToNumber(key, row[key]);\r\n }\r\n if (dates) {\r\n row[key] = _this.maybeToDate(key, row[key]);\r\n }\r\n });\r\n };\r\n // Iterate through the data and check if it needs to be converted\r\n for (var i = 0, len = res.length; i < len; i++) {\r\n _loop_1(i, len);\r\n }\r\n }\r\n // Convert to array\r\n //return Array.isArray(res) ? res : [res];\r\n return res;\r\n };\r\n return JSONParser;\r\n}(DataParser));\r\nexport { JSONParser };\r\n//# sourceMappingURL=JSONParser.js.map","import * as tslib_1 from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { dataLoader } from \"./DataLoader\";\r\nimport { JSONParser } from \"./JSONParser\";\r\nimport { CSVParser } from \"./CSVParser\";\r\nimport { BaseObjectEvents } from \"../Base\";\r\nimport { Adapter } from \"../utils/Adapter\";\r\nimport { Language } from \"../utils/Language\";\r\nimport { DateFormatter } from \"../formatters/DateFormatter\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $object from \"../utils/Object\";\r\n;\r\n;\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Represents a single data source - external file with all of its settings,\r\n * such as format, data parsing, etc.\r\n *\r\n * ```TypeScript\r\n * chart.dataSource.url = \"http://www.myweb.com/data.json\";\r\n * chart.dataSource.parser = am4core.JSONParser;\r\n * ```\r\n * ```JavaScript\r\n * chart.dataSource.url = \"http://www.myweb.com/data.json\";\r\n * chart.dataSource.parser = am4core.JSONParser;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"dataSource\": {\r\n * \"url\": \"http://www.myweb.com/data.json\",\r\n * \"parser\": \"JSONParser\"\r\n * },\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @see {@link IDataSourceEvents} for a list of available events\r\n * @see {@link IDataSourceAdapters} for a list of available Adapters\r\n */\r\nvar DataSource = /** @class */ (function (_super) {\r\n tslib_1.__extends(DataSource, _super);\r\n /**\r\n * Constructor\r\n */\r\n function DataSource(url, parser) {\r\n var _this = \r\n // Init\r\n _super.call(this) || this;\r\n /**\r\n * Adapter.\r\n */\r\n _this.adapter = new Adapter(_this);\r\n /**\r\n * Custom options for HTTP(S) request.\r\n */\r\n _this._requestOptions = {};\r\n /**\r\n * If set to `true`, any subsequent data loads will be considered incremental\r\n * (containing only new data points that are supposed to be added to existing\r\n * data).\r\n *\r\n * NOTE: this setting works only with element's `data` property. It won't\r\n * work with any other externally-loadable data property.\r\n *\r\n * @default false\r\n */\r\n _this._incremental = false;\r\n /**\r\n * A collection of key/value pairs to attach to a data source URL when making\r\n * an incremental request.\r\n */\r\n _this._incrementalParams = {};\r\n /**\r\n * This setting is used only when `incremental = true`. If set to `true`,\r\n * it will try to retain the same number of data items across each load.\r\n *\r\n * E.g. if incremental load yeilded 5 new records, then 5 items from the\r\n * beginning of data will be removed so that we end up with the same number\r\n * of data items.\r\n *\r\n * @default false\r\n */\r\n _this._keepCount = false;\r\n /**\r\n * If set to `true`, each subsequent load will be treated as an update to\r\n * currently loaded data, meaning that it will try to update values on\r\n * existing data items, not overwrite the whole data.\r\n *\r\n * This will work faster than complete update, and also will animate the\r\n * values to their new positions.\r\n *\r\n * Data sources across loads must contain the same number of data items.\r\n *\r\n * Loader will not truncate the data set if loaded data has fewer data items,\r\n * and if it is longer, the excess data items will be ignored.\r\n *\r\n * @default false\r\n * @since 4.5.5\r\n */\r\n _this._updateCurrentData = false;\r\n /**\r\n * Will show loading indicator when loading files.\r\n */\r\n _this.showPreloader = true;\r\n _this.className = \"DataSource\";\r\n // Set defaults\r\n if (url) {\r\n _this.url = url;\r\n }\r\n // Set parser\r\n if (parser) {\r\n if (typeof parser == \"string\") {\r\n _this.parser = dataLoader.getParserByType(parser);\r\n }\r\n else {\r\n _this.parser = parser;\r\n }\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Processes the loaded data.\r\n *\r\n * @ignore Exclude from docs\r\n * @param data Raw (unparsed) data\r\n * @param contentType Content type of the loaded data (optional)\r\n */\r\n DataSource.prototype.processData = function (data, contentType) {\r\n // Parsing started\r\n this.dispatchImmediately(\"parsestarted\");\r\n // Check if parser is set\r\n if (!this.parser) {\r\n // Try to resolve from data\r\n this.parser = dataLoader.getParserByData(data, contentType);\r\n if (!this.parser) {\r\n // We have a problem - nobody knows what to do with the data\r\n // Raise error\r\n if (this.events.isEnabled(\"parseerror\")) {\r\n var event_1 = {\r\n type: \"parseerror\",\r\n message: this.language.translate(\"No parser available for file: %1\", null, this.url),\r\n target: this\r\n };\r\n this.events.dispatchImmediately(\"parseerror\", event_1);\r\n }\r\n this.dispatchImmediately(\"parseended\");\r\n return;\r\n }\r\n }\r\n // Apply options adapters\r\n this.parser.options = this.adapter.apply(\"parserOptions\", this.parser.options);\r\n this.parser.options.dateFields = this.adapter.apply(\"dateFields\", this.parser.options.dateFields || []);\r\n this.parser.options.numberFields = this.adapter.apply(\"numberFields\", this.parser.options.numberFields || []);\r\n // Check if we need to pass in date formatter\r\n if (this.parser.options.dateFields && !this.parser.options.dateFormatter) {\r\n this.parser.options.dateFormatter = this.dateFormatter;\r\n }\r\n // Parse\r\n this.data = this.adapter.apply(\"parsedData\", this.parser.parse(this.adapter.apply(\"unparsedData\", data)));\r\n // Check for parsing errors\r\n if (!$type.hasValue(this.data) && this.events.isEnabled(\"parseerror\")) {\r\n var event_2 = {\r\n type: \"parseerror\",\r\n message: this.language.translate(\"Error parsing file: %1\", null, this.url),\r\n target: this\r\n };\r\n this.events.dispatchImmediately(\"parseerror\", event_2);\r\n }\r\n // Wrap up\r\n this.dispatchImmediately(\"parseended\");\r\n if ($type.hasValue(this.data)) {\r\n this.dispatchImmediately(\"done\", {\r\n \"data\": this.data\r\n });\r\n }\r\n // The component is responsible for updating its own data vtriggered via\r\n // events.\r\n // Update last data load\r\n this.lastLoad = new Date();\r\n };\r\n Object.defineProperty(DataSource.prototype, \"url\", {\r\n /**\r\n * @return URL\r\n */\r\n get: function () {\r\n // Get URL\r\n var url = this.disableCache\r\n ? this.timestampUrl(this._url)\r\n : this._url;\r\n // Add incremental params\r\n if (this.incremental && this.component.data.length) {\r\n url = this.addUrlParams(url, this.incrementalParams);\r\n }\r\n return this.adapter.apply(\"url\", url);\r\n },\r\n /**\r\n * URL of the data source.\r\n *\r\n * @param value URL\r\n */\r\n set: function (value) {\r\n this._url = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"requestOptions\", {\r\n /**\r\n * @return Options\r\n */\r\n get: function () {\r\n return this.adapter.apply(\"requestOptions\", this._requestOptions);\r\n },\r\n /**\r\n * Custom options for HTTP(S) request.\r\n *\r\n * At this moment the only option supported is: `requestHeaders`, which holds\r\n * an array of objects for custom request headers, e.g.:\r\n *\r\n * ```TypeScript\r\n * chart.dataSource.requestOptions.requestHeaders = [{\r\n * \"key\": \"x-access-token\",\r\n * \"value\": \"123456789\"\r\n * }];\r\n * ``````JavaScript\r\n * chart.dataSource.requestOptions.requestHeaders = [{\r\n * \"key\": \"x-access-token\",\r\n * \"value\": \"123456789\"\r\n * }];\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"dataSource\": {\r\n * // ...\r\n * \"requestOptions\": {\r\n * \"requestHeaders\": [{\r\n * \"key\": \"x-access-token\",\r\n * \"value\": \"123456789\"\r\n * }]\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * NOTE: setting this options on an-already loaded DataSource will not\r\n * trigger a reload.\r\n *\r\n * @param value Options\r\n */\r\n set: function (value) {\r\n this._requestOptions = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"parser\", {\r\n /**\r\n * @return Data parser\r\n */\r\n get: function () {\r\n if (!this._parser) {\r\n this._parser = new JSONParser();\r\n }\r\n return this.adapter.apply(\"parser\", this._parser);\r\n },\r\n /**\r\n * A parser to be used to parse data.\r\n *\r\n * ```TypeScript\r\n * chart.dataSource.url = \"http://www.myweb.com/data.json\";\r\n * chart.dataSource.parser = am4core.JSONParser;\r\n * ```\r\n * ```JavaScript\r\n * chart.dataSource.url = \"http://www.myweb.com/data.json\";\r\n * chart.dataSource.parser = am4core.JSONParser;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"dataSource\": {\r\n * \"url\": \"http://www.myweb.com/data.json\",\r\n * \"parser\": \"JSONParser\"\r\n * },\r\n * // ...\r\n * }\r\n * ```\r\n *\r\n * @default JSONParser\r\n * @param value Data parser\r\n */\r\n set: function (value) {\r\n this._parser = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"reloadFrequency\", {\r\n /**\r\n * @return Reload frequency (ms)\r\n */\r\n get: function () {\r\n return this.adapter.apply(\"reloadTimeout\", this._reloadFrequency);\r\n },\r\n /**\r\n * Data source reload frequency.\r\n *\r\n * If set, it will reload the same URL every X milliseconds.\r\n *\r\n * @param value Reload frequency (ms)\r\n */\r\n set: function (value) {\r\n var _this = this;\r\n if (this._reloadFrequency != value) {\r\n this._reloadFrequency = value;\r\n // Should we schedule a reload?\r\n if (value) {\r\n if (!$type.hasValue(this._reloadDisposer)) {\r\n this._reloadDisposer = this.events.on(\"ended\", function (ev) {\r\n _this._reloadTimeout = setTimeout(function () {\r\n _this.load();\r\n }, _this.reloadFrequency);\r\n });\r\n }\r\n }\r\n else if ($type.hasValue(this._reloadDisposer)) {\r\n this._reloadDisposer.dispose();\r\n this._reloadDisposer = undefined;\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"incremental\", {\r\n /**\r\n * @return Incremental load?\r\n */\r\n get: function () {\r\n return this.adapter.apply(\"incremental\", this._incremental);\r\n },\r\n /**\r\n * Should subsequent reloads be treated as incremental?\r\n *\r\n * Incremental loads will assume that they contain only new data items\r\n * since the last load.\r\n *\r\n * If `incremental = false` the loader will replace all of the target's\r\n * data with each load.\r\n *\r\n * This setting does not have any effect trhe first time data is loaded.\r\n *\r\n * NOTE: this setting works only with element's `data` property. It won't\r\n * work with any other externally-loadable data property.\r\n *\r\n * @default false\r\n * @param Incremental load?\r\n */\r\n set: function (value) {\r\n this._incremental = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"incrementalParams\", {\r\n /**\r\n * @return Incremental request parameters\r\n */\r\n get: function () {\r\n return this.adapter.apply(\"incrementalParams\", this._incrementalParams);\r\n },\r\n /**\r\n * An object consisting of key/value pairs to apply to an URL when data\r\n * source is making an incremental request.\r\n *\r\n * @param value Incremental request parameters\r\n */\r\n set: function (value) {\r\n this._incrementalParams = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"keepCount\", {\r\n /**\r\n * @return keepCount load?\r\n */\r\n get: function () {\r\n return this.adapter.apply(\"keepCount\", this._keepCount);\r\n },\r\n /**\r\n * This setting is used only when `incremental = true`. If set to `true`,\r\n * it will try to retain the same number of data items across each load.\r\n *\r\n * E.g. if incremental load yeilded 5 new records, then 5 items from the\r\n * beginning of data will be removed so that we end up with the same number\r\n * of data items.\r\n *\r\n * @default false\r\n * @param Keep record count?\r\n */\r\n set: function (value) {\r\n this._keepCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"updateCurrentData\", {\r\n /**\r\n * @return Update current data?\r\n */\r\n get: function () {\r\n return this.adapter.apply(\"updateCurrentData\", this._updateCurrentData);\r\n },\r\n /**\r\n * If set to `true`, each subsequent load will be treated as an update to\r\n * currently loaded data, meaning that it will try to update values on\r\n * existing data items, not overwrite the whole data.\r\n *\r\n * This will work faster than complete update, and also will animate the\r\n * values to their new positions.\r\n *\r\n * Data sources across loads must contain the same number of data items.\r\n *\r\n * Loader will not truncate the data set if loaded data has fewer data items,\r\n * and if it is longer, the excess data items will be ignored.\r\n *\r\n * NOTE: this setting is ignored if `incremental = true`.\r\n *\r\n * @default false\r\n * @since 2.5.5\r\n * @param Update current data?\r\n */\r\n set: function (value) {\r\n this._updateCurrentData = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"language\", {\r\n /**\r\n * @return A [[Language]] instance to be used\r\n */\r\n get: function () {\r\n if (this._language) {\r\n return this._language;\r\n }\r\n else if (this.component) {\r\n this._language = this.component.language;\r\n return this._language;\r\n }\r\n this.language = new Language();\r\n return this.language;\r\n },\r\n /**\r\n * Language instance to use.\r\n *\r\n * Will inherit and use chart's language, if not set.\r\n *\r\n * @param value An instance of Language\r\n */\r\n set: function (value) {\r\n this._language = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataSource.prototype, \"dateFormatter\", {\r\n /**\r\n * @return A [[DateFormatter]] instance to be used\r\n */\r\n get: function () {\r\n if (this._dateFormatter) {\r\n return this._dateFormatter;\r\n }\r\n else if (this.component) {\r\n this._dateFormatter = this.component.dateFormatter;\r\n return this._dateFormatter;\r\n }\r\n this.dateFormatter = new DateFormatter();\r\n return this.dateFormatter;\r\n },\r\n /**\r\n * A [[DateFormatter]] to use when parsing dates from string formats.\r\n *\r\n * Will inherit and use chart's DateFormatter if not ser.\r\n *\r\n * @param value An instance of [[DateFormatter]]\r\n */\r\n set: function (value) {\r\n this._dateFormatter = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Adds current timestamp to the URL.\r\n *\r\n * @param url Source URL\r\n * @return Timestamped URL\r\n */\r\n DataSource.prototype.timestampUrl = function (url) {\r\n var tstamp = new Date().getTime().toString();\r\n var params = {};\r\n params[tstamp] = \"\";\r\n return this.addUrlParams(url, params);\r\n };\r\n /**\r\n * Disposes of this object.\r\n */\r\n DataSource.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this._reloadTimeout) {\r\n clearTimeout(this._reloadTimeout);\r\n }\r\n };\r\n /**\r\n * Initiate the load.\r\n *\r\n * All loading in JavaScript is asynchronous. This function will trigger the\r\n * load and will exit immediately.\r\n *\r\n * Use DataSource's events to watch for loaded data and errors.\r\n */\r\n DataSource.prototype.load = function () {\r\n if (this._reloadTimeout) {\r\n clearTimeout(this._reloadTimeout);\r\n }\r\n dataLoader.load(this);\r\n };\r\n /**\r\n * Adds parameters to `url` as query strings. Will take care of proper\r\n * separators.\r\n *\r\n * @param url Source URL\r\n * @param params Parameters\r\n * @return New URL\r\n */\r\n DataSource.prototype.addUrlParams = function (url, params) {\r\n var join = url.match(/\\?/) ? \"&\" : \"?\";\r\n var add = [];\r\n $object.each(params, function (key, value) {\r\n if (value != \"\") {\r\n add.push(key + \"=\" + encodeURIComponent(value));\r\n }\r\n else {\r\n add.push(key);\r\n }\r\n });\r\n if (add.length) {\r\n return url + join + add.join(\"&\");\r\n }\r\n return url;\r\n };\r\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 */\r\n DataSource.prototype.processConfig = function (config) {\r\n registry.registeredClasses[\"json\"] = JSONParser;\r\n registry.registeredClasses[\"JSONParser\"] = JSONParser;\r\n registry.registeredClasses[\"csv\"] = CSVParser;\r\n registry.registeredClasses[\"CSVParser\"] = CSVParser;\r\n _super.prototype.processConfig.call(this, config);\r\n };\r\n return DataSource;\r\n}(BaseObjectEvents));\r\nexport { DataSource };\r\n//# sourceMappingURL=DataSource.js.map","/**\r\n * Data Loader is responsible for loading and parsing external data\r\n */\r\nimport { CSVParser } from \"./CSVParser\";\r\nimport { JSONParser } from \"./JSONParser\";\r\nimport { Adapter } from \"../utils/Adapter\";\r\nimport * as $net from \"../utils/Net\";\r\nimport * as $array from \"../utils/Array\";\r\n;\r\n/**\r\n * Data Loader is responsible for loading and parsing external data.\r\n *\r\n * There is just one instance of DataLoader per system. Unless you have a\r\n * speicific reason, do not instantiate additional instances.\r\n *\r\n * The global instance of Data Loader is accessible via:\r\n *\r\n * ```TypeScript\r\n * am4core.dataLoader;\r\n * ```\r\n * ```JavaScript\r\n * am4core.dataLoader;\r\n * ```\r\n *\r\n * A loading of specific data source is done via [[DataSource]].\r\n *\r\n Please refer to [[DataSource]] for information how to use it.\r\n *\r\n * @see {@link IDataLoaderAdapters} for a list of available Adapters\r\n */\r\nvar DataLoader = /** @class */ (function () {\r\n function DataLoader() {\r\n /**\r\n * Adapter.\r\n */\r\n this.adapter = new Adapter(this);\r\n }\r\n /**\r\n * Loads a supplied [[DataSource]] or an array of data sources, then calls\r\n * their respective `parse` methods.\r\n *\r\n * @param source A single data source or an array of multiple of data sources\r\n */\r\n DataLoader.prototype.load = function (source) {\r\n var sources = Array.isArray(source) ? source : [source];\r\n // Add each Source to the list to be loaded simultaneously\r\n var promises = $array.map(sources, function (x) {\r\n // Dispatch events\r\n x.dispatchImmediately(\"started\");\r\n x.dispatchImmediately(\"loadstarted\");\r\n return $net.load(x.url, x, x.requestOptions);\r\n });\r\n // Run all promises in parallel\r\n Promise.all(promises).then(function (res) {\r\n // Process each loaded source\r\n $array.each(res, function (result) {\r\n // Get Source\r\n var source = result.target;\r\n // Dispatch events\r\n source.dispatchImmediately(\"loadended\");\r\n if (result.error) {\r\n if (source.events.isEnabled(\"error\")) {\r\n source.events.dispatchImmediately(\"error\", {\r\n type: \"error\",\r\n code: result.xhr.status,\r\n message: source.language.translate(\"Unable to load file: %1\", null, source.url),\r\n target: source\r\n });\r\n }\r\n }\r\n else {\r\n // Initiate parsing of the loaded data\r\n source.processData(result.response, result.type);\r\n }\r\n source.dispatchImmediately(\"ended\");\r\n });\r\n }).catch(function (res) {\r\n if (res.target) {\r\n res.target.dispatchImmediately(\"loadended\");\r\n if (res.target.events.isEnabled(\"error\")) {\r\n res.target.events.dispatchImmediately(\"error\", {\r\n type: \"error\",\r\n code: res.xhr.status,\r\n message: res.target.language.translate(\"Unable to load file: %1\", null, res.target.url),\r\n target: res.target\r\n });\r\n }\r\n res.target.dispatchImmediately(\"ended\");\r\n }\r\n });\r\n };\r\n /**\r\n * Instantiates a [[DataParser]] object based on the data type.\r\n * Built-in parser types are as follows:\r\n *\r\n * * \"csv\" or \"text/csv\"\r\n * * \"json\" or \"application/json\"\r\n *\r\n * @param contentType A format type\r\n * @return A parser object\r\n */\r\n DataLoader.prototype.getParserByType = function (contentType) {\r\n // Let some plugin decide\r\n var parser = this.adapter.apply(\"getParserByType\", {\r\n parser: null,\r\n type: contentType\r\n }).parser;\r\n if (parser) {\r\n return parser;\r\n }\r\n if (contentType == \"csv\" || contentType == \"text/csv\" || contentType == \"application/vnd.ms-excel\") {\r\n return new CSVParser();\r\n }\r\n if (contentType == \"json\" || contentType == \"application/json\") {\r\n return new JSONParser();\r\n }\r\n return;\r\n };\r\n /**\r\n * Tries to determine a parser out of content type and/or actual data.\r\n *\r\n * @param data Data\r\n * @param contentType Content-type\r\n * @return Parser instance\r\n */\r\n DataLoader.prototype.getParserByData = function (data, contentType) {\r\n // Let some plugin decide\r\n var parser = this.adapter.apply(\"getParserByData\", {\r\n parser: null,\r\n data: data,\r\n type: contentType\r\n }).parser;\r\n // Check if we have parser from outside code\r\n if (!parser) {\r\n // No, let's try to figure it out\r\n parser = this.getParserByType(contentType);\r\n if (parser) {\r\n // We're able to figure out parser by content-type\r\n return parser;\r\n }\r\n else if (JSONParser.isJSON(data)) {\r\n return this.getParserByType(\"json\");\r\n }\r\n else if (CSVParser.isCSV(data)) {\r\n return this.getParserByType(\"csv\");\r\n }\r\n }\r\n return parser;\r\n };\r\n return DataLoader;\r\n}());\r\nexport { DataLoader };\r\n/**\r\n * Create instance of Data Loader\r\n */\r\nexport var dataLoader = new DataLoader();\r\n//# sourceMappingURL=DataLoader.js.map","/**\r\n * Data parser module.\r\n */\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { DateFormatter } from \"../formatters/DateFormatter\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport * as $type from \"../utils/Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Base class for the data parsers.\r\n */\r\nvar DataParser = /** @class */ (function () {\r\n function DataParser() {\r\n }\r\n /**\r\n * A \"placeholder\" function for real parsers to override.\r\n *\r\n * @ignore Exclude from docs\r\n * @param data Source data\r\n * @return Parsed data (empty)\r\n */\r\n DataParser.prototype.parse = function (data) {\r\n return [];\r\n };\r\n ;\r\n Object.defineProperty(DataParser.prototype, \"parsableNumbers\", {\r\n /**\r\n * Checks if there are any numeric fields that need to be converted to\r\n * numbers.\r\n *\r\n * @return Numeric fields?\r\n */\r\n get: function () {\r\n return this.options.numberFields && (this.options.numberFields.length > 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts a value to 'number' if it is in `numberFields`.\r\n *\r\n * @param field Field name\r\n * @param value Value\r\n * @return Parsed or original value\r\n */\r\n DataParser.prototype.maybeToNumber = function (field, value) {\r\n if (this.options.numberFields.indexOf(field) !== -1) {\r\n return $utils.anyToNumber(value);\r\n }\r\n return value;\r\n };\r\n Object.defineProperty(DataParser.prototype, \"parsableDates\", {\r\n /**\r\n * Checks if there are any date fields that need to be converted to `Date`\r\n * objects.\r\n *\r\n * @return Date fields?\r\n */\r\n get: function () {\r\n return this.options.dateFields && (this.options.dateFields.length > 0);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Converts a value to `Date` if it is in `dateFields`.\r\n *\r\n * @param field Field name\r\n * @param value Value\r\n * @return Parsed or original value\r\n */\r\n DataParser.prototype.maybeToDate = function (field, value) {\r\n if (this.options.dateFields.indexOf(field) !== -1) {\r\n return this.options.dateFormatter.parse(value, this.dateFormat);\r\n }\r\n return value;\r\n };\r\n /**\r\n * Replaces empty value with something else.\r\n *\r\n * @param value Source value\r\n * @return Source value or replacement\r\n */\r\n DataParser.prototype.maybeToEmpty = function (value) {\r\n if ((!$type.hasValue(value) || value == \"\") && $type.hasValue(this.options.emptyAs)) {\r\n return this.options.emptyAs;\r\n }\r\n return value;\r\n };\r\n Object.defineProperty(DataParser.prototype, \"dateFormatter\", {\r\n /**\r\n * [[DateFormatter]] object for date parsing.\r\n *\r\n * If there was not [[DateFormatter]] supplied in parser options, a new one\r\n * is created.\r\n *\r\n * @return Date formatter\r\n * @see {@link DateFormatter}\r\n */\r\n get: function () {\r\n if (!this.options.dateFormatter) {\r\n this.options.dateFormatter = new DateFormatter;\r\n if (this.options.dateFormat) {\r\n this.options.dateFormat = this.options.dateFormat;\r\n }\r\n }\r\n return this.options.dateFormatter;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(DataParser.prototype, \"dateFormat\", {\r\n /**\r\n * A date format to use when parsing dates.\r\n *\r\n * @return Date format\r\n * @see {@link DateFormatter}\r\n */\r\n get: function () {\r\n return this.options.dateFormat || this.dateFormatter.inputDateFormat;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DataParser;\r\n}());\r\nexport { DataParser };\r\n//# sourceMappingURL=DataParser.js.map","/**\r\n * CSV parser.\r\n */\r\nimport * as tslib_1 from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { DataParser } from \"./DataParser\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $array from \"../utils/Array\";\r\n/**\r\n * Define possible separators.\r\n */\r\nvar separators = [\",\", \";\", \"\\t\"];\r\n/**\r\n * A parser for CSV format.\r\n *\r\n * @important\r\n */\r\nvar CSVParser = /** @class */ (function (_super) {\r\n tslib_1.__extends(CSVParser, _super);\r\n function CSVParser() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Content-type suitable for CSV format.\r\n */\r\n _this.contentType = \"text/csv\";\r\n /**\r\n * Parser options.\r\n *\r\n * @see {@link ICSVOptions} for description of each option\r\n */\r\n _this.options = {\r\n delimiter: \"\",\r\n reverse: false,\r\n skipRows: 0,\r\n skipEmpty: true,\r\n useColumnNames: false\r\n };\r\n return _this;\r\n }\r\n /**\r\n * Tests if the format is CSV.\r\n *\r\n * @param data Source data\r\n * @return Is it CSV?\r\n */\r\n CSVParser.isCSV = function (data) {\r\n return CSVParser.getDelimiterFromData(data) ? true : false;\r\n };\r\n /**\r\n * Tries to determine a column separator.\r\n *\r\n * @param data Source data\r\n * @return Separator\r\n */\r\n CSVParser.getDelimiterFromData = function (data) {\r\n // We're going to take first few lines of the CSV with different\r\n // possible separators and check if it results in same number of columns.\r\n // If it does, we're going to assume it's a CSV\r\n var lines = data.split(\"\\n\");\r\n var len = lines.length;\r\n var separator;\r\n $array.each(separators, function (sep) {\r\n var columns = 0, lineColums = 0;\r\n // TODO replace with iterators\r\n for (var i = 0; i < len; ++i) {\r\n // Get number of columns in a line\r\n columns = lines[i].split(sep).length;\r\n if (columns > 1) {\r\n // More than one column - possible candidate\r\n if (lineColums === 0) {\r\n // First line\r\n lineColums = columns;\r\n }\r\n else if (columns != lineColums) {\r\n // Incorrect number of columns, give up on this separator\r\n lineColums = 0;\r\n break;\r\n }\r\n }\r\n else {\r\n // Not this separator\r\n // Not point in continuing\r\n lineColums = 0;\r\n break;\r\n }\r\n }\r\n // Check if we have a winner\r\n if (lineColums) {\r\n separator = sep;\r\n }\r\n });\r\n return separator;\r\n };\r\n /**\r\n * Parses and returns data.\r\n *\r\n * @param data Unparsed data\r\n * @return Parsed data\r\n */\r\n CSVParser.prototype.parse = function (csv) {\r\n // Check if we have delimiter set\r\n if (!this.options.delimiter) {\r\n this.options.delimiter = CSVParser.getDelimiterFromData(csv);\r\n }\r\n // Get CSV data as array\r\n var data = this.CSVToArray(csv, this.options.delimiter);\r\n // Do we need to cast some fields to numbers?\r\n var empty = $type.hasValue(this.options.emptyAs);\r\n var numbers = this.parsableNumbers;\r\n var dates = this.parsableDates;\r\n // Init resuling array\r\n var res = [], cols = [], col, i;\r\n // Skip rows\r\n for (i = 0; i < this.options.skipRows; i++) {\r\n data.shift();\r\n }\r\n // First row holds column names?\r\n if (this.options.useColumnNames) {\r\n cols = data.shift();\r\n // Normalize column names\r\n for (var x = 0; x < cols.length; x++) {\r\n // trim\r\n col = $type.hasValue(cols[x]) ? cols[x].replace(/^\\s+|\\s+$/gm, \"\") : \"\";\r\n // Check for empty\r\n if (\"\" === col) {\r\n col = \"col\" + x;\r\n }\r\n cols[x] = col;\r\n }\r\n }\r\n // Iterate through the result set\r\n var row;\r\n while (true) {\r\n row = this.options.reverse ? data.pop() : data.shift();\r\n if (!row) {\r\n break;\r\n }\r\n if (this.options.skipEmpty && row.length === 1 && row[0] === \"\") {\r\n continue;\r\n }\r\n var dataPoint = {};\r\n for (i = 0; i < row.length; i++) {\r\n col = undefined === cols[i] ? \"col\" + i : cols[i];\r\n dataPoint[col] = row[i] === \"\" ? this.options.emptyAs : row[i];\r\n // Convert\r\n if (empty) {\r\n dataPoint[col] = this.maybeToEmpty(dataPoint[col]);\r\n }\r\n if (numbers) {\r\n dataPoint[col] = this.maybeToNumber(col, dataPoint[col]);\r\n }\r\n if (dates) {\r\n dataPoint[col] = this.maybeToDate(col, dataPoint[col]);\r\n }\r\n }\r\n res.push(dataPoint);\r\n }\r\n return res;\r\n };\r\n /**\r\n * Converts CSV into array.\r\n *\r\n * The functionality of this function is taken from here:\r\n * http://www.bennadel.com/blog/1504-ask-ben-parsing-csv-strings-with-javascript-exec-regular-expression-command.htm\r\n *\r\n * @param data Source data\r\n * @param delimiter Column delimiter\r\n * @return Parsed array\r\n */\r\n CSVParser.prototype.CSVToArray = function (data, delimiter) {\r\n // Check to see if the delimiter is defined. If not,\r\n // then default to comma.\r\n delimiter = (delimiter || ',');\r\n // Create a regular expression to parse the CSV values.\r\n var objPattern = new RegExp((\r\n // Delimiters.\r\n \"(\\\\\" + delimiter + \"|\\\\r?\\\\n|\\\\r|^)\" +\r\n // Quoted fields.\r\n \"(?:\\\"([^\\\"]*(?:\\\"\\\"[^\\\"]*)*)\\\"|\" +\r\n // Standard fields.\r\n \"([^\\\"\\\\\" + delimiter + \"\\\\r\\\\n]*))\"), \"gi\");\r\n // Create an array to hold our data. Give the array\r\n // a default empty first row.\r\n var arrData = [\r\n []\r\n ];\r\n // Create an array to hold our individual pattern\r\n // matching groups.\r\n var arrMatches = null;\r\n // Keep looping over the regular expression matches\r\n // until we can no longer find a match.\r\n while (true) {\r\n arrMatches = objPattern.exec(data);\r\n if (!arrMatches) {\r\n break;\r\n }\r\n // Get the delimiter that was found.\r\n var strMatchedDelimiter = arrMatches[1];\r\n // Check to see if the given delimiter has a length\r\n // (is not the start of string) and if it matches\r\n // field delimiter. If id does not, then we know\r\n // that this delimiter is a row delimiter.\r\n if (strMatchedDelimiter.length &&\r\n (strMatchedDelimiter !== delimiter)) {\r\n // Since we have reached a new row of data,\r\n // add an empty row to our data array.\r\n arrData.push([]);\r\n }\r\n // Now that we have our delimiter out of the way,\r\n // let's check to see which kind of value we\r\n // captured (quoted or unquoted).\r\n var strMatchedValue = void 0;\r\n if (arrMatches[2]) {\r\n // We found a quoted value. When we capture\r\n // this value, unescape any double quotes.\r\n strMatchedValue = arrMatches[2].replace(new RegExp(\"\\\"\\\"\", \"g\"), \"\\\"\");\r\n }\r\n else {\r\n // We found a non-quoted value.\r\n strMatchedValue = arrMatches[3];\r\n }\r\n // Now that we have our value string, let's add\r\n // it to the data array.\r\n arrData[arrData.length - 1].push(strMatchedValue);\r\n }\r\n // Return the parsed data.\r\n return (arrData);\r\n };\r\n return CSVParser;\r\n}(DataParser));\r\nexport { CSVParser };\r\n//# sourceMappingURL=CSVParser.js.map"],"sourceRoot":""}