{"version":3,"sources":["webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Iterator.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Disposer.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Cache.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Dictionary.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Percent.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/String.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Array.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/AsyncPending.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/Registry.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Type.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Object.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Math.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/EventDispatcher.js","webpack:///./node_modules/@amcharts/amcharts4/.internal/core/utils/Ease.js"],"names":["fromArray","array","push","length","i","iter","sum","_","toArray","output","value","eachContinue","fn","each","sort","map","concat","args","_i","arguments","go","push2","flatten","indexed","index","find","matches","contains","ListIterator","list","create","this","createNewItems","_create","reset","prototype","_listCopy","iterator","clear","getFirst","returnItem","getLast","item","removeItem","Disposer","dispose","_disposed","_dispose","isDisposed","MultiDisposer","_super","disposers","call","x","MutableValueDisposer","_this","_disposer","undefined","get","_value","set","disposer","CounterDisposer","apply","_counter","increment","Cache","_storage","ttl","owner","key","ownerStorage","insertKeyIfEmpty","Date","getTime","setKey","hasKey","getKey","cacheItem","touched","expired","removeKey","cache","DictionaryDisposer","dict","events","on","oldValue","a","v","Dictionary","_dictionary","insertKey","Error","isEnabled","dispatchImmediately","type","target","newValue","updateKey","ifEmpty","copyFrom","source","Symbol","_a","_b","_c","label","sent","f","sortedIterator","y","DictionaryTemplate","t","template","Object","defineProperty","_template","isTemplate","enumerable","configurable","clone","Percent","percent","toString","isPercent","order","b","repeat","string","amount","Array","join","random","chars","res","choice","charAt","Math","floor","indexOf","any","test","eachReverse","shiftLeft","pushAll","input","remove","element","found","splice","length_1","move","toIndex","removeIndex","insertIndex","add","unshift","replace","ind","isArray","copy","getSortedIndex","ordering","start","end","pivot","findIndex","keepIf","keep","pendingFrame","nextQueue","readQueue","writeQueue","idleQueue","fps","raf","requestAnimationFrame","setTimeout","frameLoop","now","pendFrame","nextFrame","readFrame","writeFrame","whenIdle","triggerIdle","shift","Registry","themes","loadedThemes","_uidCount","registeredClasses","_placeholders","invalidSprites","invalidDatas","invalidRawDatas","invalidDataItems","invalidDataRange","invalidPositions","invalidLayouts","baseSprites","baseSpritesByUid","queue","deferred","uid","getUniqueId","noBase","addEventListener","sprite","svg","paper","setAttribute","clientWidth","clientHeight","removeAttribute","_map","setCache","getCache","dispatch","eventType","data","getPlaceholder","addToInvalidComponents","component","baseId","removeFromInvalidComponents","addToInvalidSprites","removeFromInvalidSprites","addToInvalidPositions","removeFromInvalidPositions","addToInvalidLayouts","removeFromInvalidLayouts","registry","is","object","name","isNaN","Number","getType","castString","toBoolean","toNumber","hasValue","isNumber","converted","isString","toText","isObject","toNumberOrPercent","getValue","getValueDefault","defaultValue","isDate","entries","keys","keysOrdered","hasOwnProperty","eachOrdered","ord","merge","object1","object2","assign","JSON","parse","stringify","copyProperties","forceCopyProperties","copyAllProperties","from","to","PI","HALFPI","RADIANS","DEGREES","toNumberRange","min","max","fitToRange","round","precision","rounded","d","pow","ceil","stretch","minValue","maxValue","temp","sin","tan","cos","left","right","closest","values","referenceValue","reduce","prev","curr","abs","intersect","range1","range2","start1","start2","end1","end2","invertRange","range","intersection","startMax","endMin","getDistance","point1","point2","sqrt","getHorizontalDistance","getVerticalDistance","getCubicCurveDistance","controlPointA","controlPointB","stepCount","distance","prevPoint","s","point","getPointOnCubicCurve","getScale","startPoint1","startPoint2","initialDistance","currentDistance","getMidPoint","position","getRotation","startAngle","getAngle","angle","diff","diffX","diffY","atan2","normalizeAngle","getCenterShift","center","getBBox","points","top_1","bottom","width","height","getCommonRectangle","rectangles","minX","minY","maxX","maxY","rectangle","getPointOnQuadraticCurve","pointA","pointB","controlPoint","mt1","mt2","mt3","getCubicControlPointA","p0","p1","p2","p3","tensionX","tensionY","adjustTension","getCubicControlPointB","tension","fitAngleToRange","endAngle","count","maxEnd","maxStart","getArcRect","radius","MAX_VALUE","bpoints","getArcPoint","fromAngle","toAngle","pt","arc","isInRectangle","getLineIntersection","pointA1","pointA2","pointB1","pointB2","EventDispatcher","_listeners","_killed","_disabled","_iterating","_enabled","hasListeners","hasListenersByType","killed","enable","disable","enableType","disableType","Infinity","_removeListener","listener","_removeExistingListener","once","callback","context","_eachListener","info","has","_shouldDispatch","event","_on","shouldClone","onAll","off","TargetedEventDispatcher","linear","quadIn","quadOut","quadInOut","polyIn","e","polyOut","polyInOut","polyIn3","polyOut3","polyInOut3","expIn","expOut","expInOut","sinIn","sinOut","sinInOut","cubicIn","cubicOut","cubicInOut","circleIn","circleOut","circleInOut","b1","b2","b3","b4","b5","b6","b7","b8","b9","b0","bounceIn","bounceOut","bounceInOut","tau","amplitude","period","asin","elasticIn","elasticOut","elasticInOut"],"mappings":"kHAAA,0cAKO,SAASA,EAAUC,GACtB,OAAO,SAAUC,GAEb,IADA,IAAIC,EAASF,EAAME,OACVC,EAAI,EAAGA,EAAID,IAAUC,EAC1B,IAAKF,EAAKD,EAAMG,IACZ,OAST,SAASD,EAAOE,GACnB,IAAIC,EAAM,EAKV,OAJAD,GAAK,SAAUE,GAEX,QADED,GACK,KAEJA,EAMJ,SAASE,EAAQH,GACpB,IAAII,EAAS,GAKb,OAJAJ,GAAK,SAAUK,GAEX,OADAD,EAAOP,KAAKQ,IACL,KAEJD,EAQJ,SAASE,EAAaN,EAAMO,GAC/BP,EAAKO,GAQF,SAASC,EAAKR,EAAMO,GACvBP,GAAK,SAAUK,GAEX,OADAE,EAAGF,IACI,KASR,SAASI,EAAKT,EAA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KAAKoC,EAAIrN,GAAKgW,GAU3D,SAASG,EAAWnW,GACvB,OAAO,EAAI+V,EAAYtU,KAAKkJ,IAAI,GAAI,IAAM3K,GAAKA,IAAMyB,KAAKwJ,KAAKjL,EAAIqN,GAAK2I,GAUrE,SAASI,EAAapW,GAEzB,OADAA,EAAQ,EAAJA,EAAQ,GACJA,EAAI,EACN+V,EAAYtU,KAAKkJ,IAAI,EAAG,GAAK3K,GAAKyB,KAAKwJ,KAAKoC,EAAIrN,GAAKgW,GACrD,EAAID,EAAYtU,KAAKkJ,IAAI,GAAI,GAAK3K,GAAKyB,KAAKwJ,KAAKoC,EAAIrN,GAAKgW,IAAW,EAvB/E,OAASjR,kBAAkB,kBAAoBmR,EAW/C,OAASnR,kBAAkB,mBAAqBoR,EAchD,OAASpR,kBAAkB,qBAAuBqR","file":"js/chunk-4580bc55.063bc499.js","sourcesContent":["import * as $array from \"./Array\";\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function fromArray(array) {\r\n return function (push) {\r\n var length = array.length;\r\n for (var i = 0; i < length; ++i) {\r\n if (!push(array[i])) {\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function length(iter) {\r\n var sum = 0;\r\n iter(function (_) {\r\n ++sum;\r\n return true;\r\n });\r\n return sum;\r\n}\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function toArray(iter) {\r\n var output = [];\r\n iter(function (value) {\r\n output.push(value);\r\n return true;\r\n });\r\n return output;\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function eachContinue(iter, fn) {\r\n iter(fn);\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function each(iter, fn) {\r\n iter(function (value) {\r\n fn(value);\r\n return true;\r\n });\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function sort(iter, fn) {\r\n return fromArray(toArray(iter).sort(fn));\r\n}\r\n/**\r\n * [A description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function map(iter, fn) {\r\n return function (push) { return iter(function (value) { return push(fn(value)); }); };\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function filter(iter, fn) {\r\n return function (push) { return iter(function (value) {\r\n if (fn(value)) {\r\n return push(value);\r\n }\r\n else {\r\n return true;\r\n }\r\n }); };\r\n}\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function concat() {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return function (push) {\r\n var go = true;\r\n var push2 = function (value) { return (go = push(value)); };\r\n var length = args.length;\r\n for (var i = 0; i < length; ++i) {\r\n args[i](push2);\r\n if (!go) {\r\n break;\r\n }\r\n }\r\n };\r\n}\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function flatten(iter) {\r\n return function (push) {\r\n var go = true;\r\n var push2 = function (value) { return (go = push(value)); };\r\n iter(function (value) {\r\n value(push2);\r\n return go;\r\n });\r\n };\r\n}\r\n/**\r\n * [number description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function indexed(iter) {\r\n return function (push) {\r\n var index = 0;\r\n iter(function (value) { return push([index++, value]); });\r\n };\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function findIndex(iter, matches) {\r\n var found = false;\r\n var i = 0;\r\n iter(function (value) {\r\n if (matches(value)) {\r\n found = true;\r\n return false;\r\n }\r\n else {\r\n ++i;\r\n return true;\r\n }\r\n });\r\n return (found ? i : -1);\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function find(iter, matches) {\r\n var output;\r\n iter(function (value) {\r\n if (matches(value)) {\r\n output = value;\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n });\r\n return output;\r\n}\r\n/**\r\n * [A description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function findMap(iter, matches) {\r\n var output;\r\n iter(function (value) {\r\n var v = matches(value);\r\n if (v !== null) {\r\n output = v;\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n });\r\n return output;\r\n}\r\n/**\r\n * [iter description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function contains(iter, matches) {\r\n var output = false;\r\n iter(function (value) {\r\n if (matches(value)) {\r\n output = true;\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n });\r\n return output;\r\n}\r\n/**\r\n * [A description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport function foldl(iter, init, fn) {\r\n iter(function (value) {\r\n init = fn(init, value);\r\n return true;\r\n });\r\n return init;\r\n}\r\n/**\r\n * [min2 description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param left [description]\r\n * @param right [description]\r\n * @return [description]\r\n */\r\nfunction min2(left, right) {\r\n if (left == null || right < left) {\r\n return right;\r\n }\r\n else {\r\n return left;\r\n }\r\n}\r\n/**\r\n * [min description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Verify that this works correctly\r\n * @todo Description\r\n * @param a [description]\r\n * @return [description]\r\n */\r\nexport function min(a) {\r\n return foldl(a, null, min2);\r\n}\r\n/**\r\n * [max2 description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param left [description]\r\n * @param right [description]\r\n * @return [description]\r\n */\r\nfunction max2(left, right) {\r\n if (left == null || right > left) {\r\n return right;\r\n }\r\n else {\r\n return left;\r\n }\r\n}\r\n/**\r\n * [max description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Verify that this works correctly\r\n * @todo Description\r\n * @param a [description]\r\n * @return [description]\r\n */\r\nexport function max(a) {\r\n return foldl(a, null, max2);\r\n}\r\n/**\r\n * [join description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param iter [description]\r\n * @param separator [description]\r\n * @return [description]\r\n */\r\nexport function join(iter, separator) {\r\n if (separator === void 0) { separator = \"\"; }\r\n var first = true;\r\n var init = \"\";\r\n iter(function (value) {\r\n if (first) {\r\n first = false;\r\n }\r\n else {\r\n init += separator;\r\n }\r\n init += value;\r\n return true;\r\n });\r\n return init;\r\n}\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nvar ListIterator = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n *\r\n * @param list [description]\r\n * @param create [description]\r\n */\r\n function ListIterator(list, create) {\r\n // flag specifies if iterator should create new list item if it is reqested for a nextItem but there is no more left in the list\r\n this.createNewItems = false;\r\n this.list = list;\r\n this._create = create;\r\n this.reset();\r\n }\r\n ListIterator.prototype.reset = function () {\r\n this._listCopy = toArray(this.list.iterator());\r\n };\r\n ListIterator.prototype.clear = function () {\r\n this._listCopy.length = 0;\r\n };\r\n ListIterator.prototype.getFirst = function () {\r\n return this.returnItem(0);\r\n };\r\n ListIterator.prototype.getLast = function () {\r\n return this.returnItem(this._listCopy.length - 1);\r\n };\r\n ListIterator.prototype.find = function (fn) {\r\n var index = $array.findIndex(this._listCopy, fn);\r\n if (index !== -1) {\r\n var item = this._listCopy[index];\r\n // TODO use removeIndex instead ?\r\n $array.remove(this._listCopy, item);\r\n return item;\r\n }\r\n else {\r\n return this.getLast();\r\n }\r\n };\r\n ListIterator.prototype.removeItem = function (item) {\r\n return $array.remove(this._listCopy, item);\r\n };\r\n ListIterator.prototype.returnItem = function (index) {\r\n if (index >= 0 && index < this._listCopy.length) {\r\n var item = this._listCopy[index];\r\n // TODO use removeIndex instead ?\r\n $array.remove(this._listCopy, item);\r\n return item;\r\n }\r\n else if (this.createNewItems) {\r\n return this._create();\r\n }\r\n };\r\n ListIterator.prototype.iterator = function () {\r\n return fromArray(this._listCopy);\r\n };\r\n return ListIterator;\r\n}());\r\nexport { ListIterator };\r\n//# sourceMappingURL=Iterator.js.map","import { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport * as $array from \"./Array\";\r\nimport * as $type from \"./Type\";\r\n/**\r\n * A base class for disposable objects.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\nvar Disposer = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n *\r\n * @param dispose Function that disposes object\r\n */\r\n function Disposer(dispose) {\r\n this._disposed = false;\r\n this._dispose = dispose;\r\n }\r\n /**\r\n * Checks if object is disposed.\r\n *\r\n * @return Disposed?\r\n */\r\n Disposer.prototype.isDisposed = function () {\r\n return this._disposed;\r\n };\r\n /**\r\n * Disposes the object.\r\n */\r\n Disposer.prototype.dispose = function () {\r\n if (!this._disposed) {\r\n this._disposed = true;\r\n this._dispose();\r\n }\r\n };\r\n return Disposer;\r\n}());\r\nexport { Disposer };\r\n/**\r\n * A collection of related disposers that can be disposed in one go.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\nvar MultiDisposer = /** @class */ (function (_super) {\r\n __extends(MultiDisposer, _super);\r\n function MultiDisposer(disposers) {\r\n return _super.call(this, function () {\r\n $array.each(disposers, function (x) {\r\n x.dispose();\r\n });\r\n }) || this;\r\n }\r\n return MultiDisposer;\r\n}(Disposer));\r\nexport { MultiDisposer };\r\n/**\r\n * A special kind of Disposer that has attached value set.\r\n *\r\n * If a new value is set using `set()` method, the old disposer value is\r\n * disposed.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nvar MutableValueDisposer = /** @class */ (function (_super) {\r\n __extends(MutableValueDisposer, _super);\r\n /**\r\n * Constructor.\r\n */\r\n function MutableValueDisposer() {\r\n var _this = _super.call(this, function () {\r\n if ($type.hasValue(_this._disposer)) {\r\n _this._disposer.dispose();\r\n _this._disposer = undefined;\r\n }\r\n }) || this;\r\n return _this;\r\n }\r\n /**\r\n * Returns current value.\r\n *\r\n * @return Value\r\n */\r\n MutableValueDisposer.prototype.get = function () {\r\n return this._value;\r\n };\r\n /**\r\n * Sets value and disposes previous disposer if it was set.\r\n *\r\n * @param value New value\r\n * @param disposer Disposer\r\n */\r\n MutableValueDisposer.prototype.set = function (value, disposer) {\r\n if ($type.hasValue(this._disposer)) {\r\n this._disposer.dispose();\r\n }\r\n this._disposer = disposer;\r\n this._value = value;\r\n };\r\n /**\r\n * Resets the disposer value.\r\n */\r\n MutableValueDisposer.prototype.reset = function () {\r\n this.set(undefined, undefined);\r\n };\r\n return MutableValueDisposer;\r\n}(Disposer));\r\nexport { MutableValueDisposer };\r\n/**\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nvar CounterDisposer = /** @class */ (function (_super) {\r\n __extends(CounterDisposer, _super);\r\n function CounterDisposer() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * [_counter description]\r\n *\r\n * @todo Description\r\n */\r\n _this._counter = 0;\r\n return _this;\r\n }\r\n /**\r\n * [increment description]\r\n *\r\n * @todo Description\r\n */\r\n CounterDisposer.prototype.increment = function () {\r\n var _this = this;\r\n // TODO throw an error if it is disposed\r\n ++this._counter;\r\n // TODO make this more efficient\r\n return new Disposer(function () {\r\n --_this._counter;\r\n if (_this._counter === 0) {\r\n _this.dispose();\r\n }\r\n });\r\n };\r\n return CounterDisposer;\r\n}(Disposer));\r\nexport { CounterDisposer };\r\n//# sourceMappingURL=Disposer.js.map","/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Dictionary } from \"./Dictionary\";\r\nimport * as $type from \"./Type\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Represents object cache.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Better storage\r\n * @todo TTL logging\r\n * @todo Garbage collector\r\n */\r\nvar Cache = /** @class */ (function () {\r\n function Cache() {\r\n /**\r\n * Storage for cache items.\r\n */\r\n this._storage = new Dictionary();\r\n /**\r\n * Default TTL in milliseconds.\r\n */\r\n this.ttl = 1000;\r\n }\r\n /**\r\n * Caches or updates cached value, resets TTL.\r\n *\r\n * If `ttl` is set to zero, item will never expire.\r\n *\r\n * @param owner An id of the object that owns this cache\r\n * @param key Index key\r\n * @param value Value\r\n * @param ttl TTL of the cache to live in milliseconds\r\n */\r\n Cache.prototype.set = function (owner, key, value, ttl) {\r\n // Create if storage does not exist for this owner\r\n var ownerStorage = this._storage.insertKeyIfEmpty(owner, function () { return new Dictionary(); });\r\n // Create cache item\r\n var item = {\r\n \"touched\": new Date().getTime(),\r\n \"ttl\": $type.isNumber(ttl) ? ttl : this.ttl,\r\n \"value\": value\r\n };\r\n // Set\r\n ownerStorage.setKey(key, item);\r\n };\r\n /**\r\n * Rerturns cached item, respecting TTL.\r\n *\r\n * @param owner An id of the object that owns this cache\r\n * @param key Index key\r\n * @param value Value to return if cache not available\r\n * @return Value, or `undefined` if not set\r\n */\r\n Cache.prototype.get = function (owner, key, value) {\r\n if (value === void 0) { value = undefined; }\r\n // \t\t || ypeof this._storage[owner][key] === \"undefined\" || this._storage[owner][key].expired === true) {\r\n if (this._storage.hasKey(owner)) {\r\n var ownerStorage = this._storage.getKey(owner);\r\n if (ownerStorage.hasKey(key)) {\r\n var cacheItem = ownerStorage.getKey(key);\r\n if (cacheItem.ttl && ((cacheItem.touched + cacheItem.ttl) < new Date().getTime())) {\r\n cacheItem.expired = true;\r\n }\r\n if (cacheItem.expired) {\r\n ownerStorage.removeKey(key);\r\n return value;\r\n }\r\n return cacheItem.value;\r\n }\r\n else {\r\n return value;\r\n }\r\n }\r\n else {\r\n return value;\r\n }\r\n };\r\n /**\r\n * Clears cache for specific owner or everything.\r\n *\r\n * @param owner Owner to clear cache for\r\n */\r\n Cache.prototype.clear = function (owner) {\r\n if (owner) {\r\n this._storage.removeKey(owner);\r\n }\r\n else {\r\n this._storage.clear();\r\n }\r\n };\r\n return Cache;\r\n}());\r\nexport { Cache };\r\n/**\r\n * ============================================================================\r\n * GLOBAL INSTANCE\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * A global instance of cache. Use this instance to cache any values.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\nexport var cache = new Cache();\r\n//# sourceMappingURL=Cache.js.map","import { __extends, __generator, __read } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Disposer } from \"./Disposer\";\r\nimport { EventDispatcher } from \"./EventDispatcher\";\r\nimport * as $object from \"./Object\";\r\nimport * as $iter from \"./Iterator\";\r\nimport * as $string from \"./String\";\r\n/**\r\n * A disposable dictionary, which when disposed itself will call `dispose()`\r\n * method on all its items.\r\n */\r\nvar DictionaryDisposer = /** @class */ (function (_super) {\r\n __extends(DictionaryDisposer, _super);\r\n function DictionaryDisposer(dict) {\r\n var _this = this;\r\n var disposer = dict.events.on(\"removed\", function (x) {\r\n x.oldValue.dispose();\r\n }, undefined, false);\r\n _this = _super.call(this, function () {\r\n disposer.dispose();\r\n // TODO clear the dictionary ?\r\n $iter.each(dict.iterator(), function (a) {\r\n var v = a[1];\r\n v.dispose();\r\n });\r\n }) || this;\r\n return _this;\r\n }\r\n return DictionaryDisposer;\r\n}(Disposer));\r\nexport { DictionaryDisposer };\r\n/**\r\n * A Dictionary is collection where values of some type can be mapped to\r\n * string keys.\r\n *\r\n * You might call it an \"associative list\" or \"associative array\".\r\n */\r\nvar Dictionary = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n */\r\n function Dictionary() {\r\n /**\r\n * Event dispatcher.\r\n */\r\n this.events = new EventDispatcher();\r\n this._dictionary = {};\r\n }\r\n /**\r\n * Returns `true` if key exists in Dictionary.\r\n *\r\n * @param key The key to search for\r\n * @return `true` if key exists, `false` if it doesn't\r\n */\r\n Dictionary.prototype.hasKey = function (key) {\r\n return $object.hasKey(this._dictionary, key);\r\n };\r\n /**\r\n * Returns the value for a specific key.\r\n *\r\n * @param key The key to search for\r\n * @return Value for the key, or `undefined` if it doesn't exist\r\n */\r\n Dictionary.prototype.getKey = function (key) {\r\n return this._dictionary[key];\r\n };\r\n /**\r\n * Inserts value at specific key.\r\n *\r\n * Will thrown an exception if the key already exists in the dictionary.\r\n *\r\n * @param key Key\r\n * @param value Value\r\n */\r\n Dictionary.prototype.insertKey = function (key, value) {\r\n if ($object.hasKey(this._dictionary, key)) {\r\n throw new Error(\"Key \" + key + \" already exists in dictionary\");\r\n }\r\n else {\r\n this._dictionary[key] = value;\r\n if (this.events.isEnabled(\"insertKey\")) {\r\n this.events.dispatchImmediately(\"insertKey\", {\r\n type: \"insertKey\",\r\n target: this,\r\n key: key,\r\n newValue: value\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * Adds or updates key/value into dictionary.\r\n *\r\n * If the key already exists, the old value will be overwritten.\r\n *\r\n * If the new value is exactly the same as the old value (using ===), it won't do anything.\r\n *\r\n * @param key Key\r\n * @param value Value\r\n */\r\n Dictionary.prototype.setKey = function (key, value) {\r\n if ($object.hasKey(this._dictionary, key)) {\r\n var oldValue = this._dictionary[key];\r\n if (oldValue !== value) {\r\n this._dictionary[key] = value;\r\n if (this.events.isEnabled(\"setKey\")) {\r\n this.events.dispatchImmediately(\"setKey\", {\r\n type: \"setKey\",\r\n target: this,\r\n key: key,\r\n oldValue: oldValue,\r\n newValue: value\r\n });\r\n }\r\n if (this.events.isEnabled(\"removed\")) {\r\n this.events.dispatchImmediately(\"removed\", {\r\n type: \"removed\",\r\n target: this,\r\n oldValue: oldValue\r\n });\r\n }\r\n }\r\n }\r\n else {\r\n this._dictionary[key] = value;\r\n if (this.events.isEnabled(\"insertKey\")) {\r\n this.events.dispatchImmediately(\"insertKey\", {\r\n type: \"insertKey\",\r\n target: this,\r\n key: key,\r\n newValue: value\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * Updates the value at specific `key` using custom function.\r\n *\r\n * Passes in current value into the function, and uses its output as a new\r\n * value.\r\n *\r\n * If the new value is exactly the same as the old value (using ===), it won't do anything.\r\n *\r\n * @ignore Exclude from docs\r\n * @param key Key\r\n * @param fn Function to transform the value\r\n */\r\n Dictionary.prototype.updateKey = function (key, fn) {\r\n if ($object.hasKey(this._dictionary, key)) {\r\n var oldValue = this._dictionary[key];\r\n var newValue = fn(oldValue);\r\n if (oldValue !== newValue) {\r\n this._dictionary[key] = newValue;\r\n if (this.events.isEnabled(\"setKey\")) {\r\n this.events.dispatchImmediately(\"setKey\", {\r\n type: \"setKey\",\r\n target: this,\r\n key: key,\r\n oldValue: oldValue,\r\n newValue: newValue\r\n });\r\n }\r\n if (this.events.isEnabled(\"removed\")) {\r\n this.events.dispatchImmediately(\"removed\", {\r\n type: \"removed\",\r\n target: this,\r\n oldValue: oldValue\r\n });\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"Key \" + key + \" doesn't exist in dictionary\");\r\n }\r\n };\r\n /**\r\n * Removes value at specific `key` from dictionary.\r\n *\r\n * @param key Key to remove\r\n */\r\n Dictionary.prototype.removeKey = function (key) {\r\n if ($object.hasKey(this._dictionary, key)) {\r\n var oldValue = this._dictionary[key];\r\n delete this._dictionary[key];\r\n if (this.events.isEnabled(\"removeKey\")) {\r\n this.events.dispatchImmediately(\"removeKey\", {\r\n type: \"removeKey\",\r\n target: this,\r\n key: key,\r\n oldValue: oldValue\r\n });\r\n }\r\n if (this.events.isEnabled(\"removed\")) {\r\n this.events.dispatchImmediately(\"removed\", {\r\n type: \"removed\",\r\n target: this,\r\n oldValue: oldValue\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * [insertKeyIfEmpty description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo description\r\n * @param key [description]\r\n * @param ifEmpty [description]\r\n * @return [description]\r\n */\r\n Dictionary.prototype.insertKeyIfEmpty = function (key, ifEmpty) {\r\n if (!this.hasKey(key)) {\r\n this.insertKey(key, ifEmpty());\r\n }\r\n return this.getKey(key);\r\n };\r\n /**\r\n * Removes all items from the dictionary.\r\n */\r\n Dictionary.prototype.clear = function () {\r\n var _this = this;\r\n // TODO dispatch this after clear\r\n if (this.events.isEnabled(\"removed\")) {\r\n $object.each(this._dictionary, function (key, value) {\r\n _this.events.dispatchImmediately(\"removed\", {\r\n type: \"removed\",\r\n target: _this,\r\n oldValue: value\r\n });\r\n });\r\n }\r\n this._dictionary = {};\r\n if (this.events.isEnabled(\"cleared\")) {\r\n this.events.dispatchImmediately(\"cleared\", {\r\n type: \"cleared\",\r\n target: this\r\n });\r\n }\r\n };\r\n /**\r\n * Copies items from another Dictionary.\r\n *\r\n * @param source A Dictionary to copy items from\r\n */\r\n Dictionary.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n $iter.each(source.iterator(), function (a) {\r\n // TODO fix this type cast\r\n _this.setKey(a[0], a[1]);\r\n });\r\n };\r\n /**\r\n * Returns an interator that can be used to iterate through all items in\r\n * the dictionary.\r\n *\r\n * @return Iterator\r\n */\r\n Dictionary.prototype.iterator = function () {\r\n // @todo fix this type after the Iterator bug is fixed\r\n // https://github.com/Microsoft/TypeScript/issues/16730\r\n return $object.entries(this._dictionary);\r\n };\r\n /**\r\n * Returns an ES6 iterator for the keys/values of the dictionary.\r\n */\r\n Dictionary.prototype[Symbol.iterator] = function () {\r\n var _a, _b, _i, key;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n _a = [];\r\n for (_b in this._dictionary)\r\n _a.push(_b);\r\n _i = 0;\r\n _c.label = 1;\r\n case 1:\r\n if (!(_i < _a.length)) return [3 /*break*/, 4];\r\n key = _a[_i];\r\n if (!$object.hasKey(this._dictionary, key)) return [3 /*break*/, 3];\r\n return [4 /*yield*/, [key, this._dictionary[key]]];\r\n case 2:\r\n _c.sent();\r\n _c.label = 3;\r\n case 3:\r\n _i++;\r\n return [3 /*break*/, 1];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n };\r\n /**\r\n * Calls `f` for each key/value in the dictionary.\r\n */\r\n Dictionary.prototype.each = function (f) {\r\n $iter.each(this.iterator(), function (_a) {\r\n var _b = __read(_a, 2), key = _b[0], value = _b[1];\r\n return f(key, value);\r\n });\r\n };\r\n /**\r\n * Returns an iterator that can be used to iterate through all items in\r\n * the dictionary, ordered by key.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Iterator\r\n */\r\n Dictionary.prototype.sortedIterator = function () {\r\n return $iter.sort(this.iterator(), function (x, y) { return $string.order(x[0], y[0]); });\r\n };\r\n return Dictionary;\r\n}());\r\nexport { Dictionary };\r\n/**\r\n * A version of a [[Dictionary]] that has a \"template\".\r\n *\r\n * A template is an instance of an object, that can be used to create new\r\n * elements in the list without actually needing to create instances for those.\r\n *\r\n * When new element is created in the list, e.g. by calling its `create()`\r\n * method, an exact copy of the element is created (including properties and\r\n * other attributes), inserted into the list and returned.\r\n */\r\nvar DictionaryTemplate = /** @class */ (function (_super) {\r\n __extends(DictionaryTemplate, _super);\r\n /**\r\n * Constructor\r\n *\r\n * @param t Template object\r\n */\r\n function DictionaryTemplate(t) {\r\n var _this = _super.call(this) || this;\r\n _this.template = t;\r\n return _this;\r\n }\r\n Object.defineProperty(DictionaryTemplate.prototype, \"template\", {\r\n /**\r\n * @return Template object\r\n */\r\n get: function () {\r\n return this._template;\r\n },\r\n /**\r\n * A \"template\" object to copy all properties from when creating new list\r\n * items.\r\n *\r\n * @param v Template object\r\n */\r\n set: function (v) {\r\n v.isTemplate = true;\r\n this._template = v;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Copies all elements from other dictionary.\r\n *\r\n * @param source Source dictionary\r\n */\r\n DictionaryTemplate.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n $iter.each(source.iterator(), function (a) {\r\n // TODO fix this type cast\r\n // TODO why does this need to clone ?\r\n _this.setKey(a[0], a[1].clone());\r\n });\r\n };\r\n /**\r\n * Instantiates a new object of the specified type, adds it to specified\r\n * `key` in the dictionary, and returns it.\r\n *\r\n * @param make Item type to use. Will use the default type for the dictionary if not specified.\r\n * @return Newly created item\r\n */\r\n DictionaryTemplate.prototype.create = function (key) {\r\n var _this = this;\r\n return this.insertKeyIfEmpty(key, function () { return _this.template.clone(); });\r\n };\r\n return DictionaryTemplate;\r\n}(Dictionary));\r\nexport { DictionaryTemplate };\r\n//# sourceMappingURL=Dictionary.js.map","/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Represents a relative value (percent).\r\n *\r\n * The Percent object, can be instantiated using two ways:\r\n *\r\n * * Via `new Percent(X)`.\r\n * * Via `am4core.percent(X)`.\r\n *\r\n * `Percent` type objects can be used in a number of dual-measuring or\r\n * positioning properties, like `width`. E.g.:\r\n *\r\n * ```TypeScript\r\n * chart.paddingRight = new Percent(10);\r\n * // or\r\n * chart.paddingRight = am4core.percent(10);\r\n * ```\r\n * ```JavaScript\r\n * chart.paddingRight = new Percent(10);\r\n * // or\r\n * chart.paddingRight = am4core.percent(10);\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"paddingRight\": \"10%\"\r\n * }\r\n * ```\r\n */\r\nvar Percent = /** @class */ (function () {\r\n /**\r\n * Constructor.\r\n *\r\n * @param percent Percent value\r\n */\r\n function Percent(percent) {\r\n this._value = percent;\r\n }\r\n Object.defineProperty(Percent.prototype, \"value\", {\r\n /**\r\n * Relative value.\r\n *\r\n * E.g. 100% is 1, 50% is 0.5, etc.\r\n *\r\n * This is useful to apply transformations to other values. E.g.:\r\n *\r\n * ```TypeScript\r\n * let value = 256;\r\n * let percent = new am4core.Percent(50);\r\n * console.log(value * percent.value); // outputs 128\r\n * ```\r\n * ```JavaScript\r\n * var value = 256;\r\n * var percent = new am4core.Percent(50);\r\n * console.log(value * percent.value); // outputs 128\r\n * ```\r\n *\r\n * Alternatively, you can use `am4core.percent()` helper function:\r\n *\r\n * ```TypeScript\r\n * let value = 256;\r\n * let percent = am4core.percent(50);\r\n * console.log(value * percent.value); // outputs 128\r\n * ```\r\n * ```JavaScript\r\n * var value = 256;\r\n * var percent = am4core.percent(50);\r\n * console.log(value * percent.value); // outputs 128\r\n * ```\r\n *\r\n * @readonly\r\n * @return Relative value\r\n */\r\n get: function () {\r\n return this._value / 100;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Percent.prototype, \"percent\", {\r\n /**\r\n * Value in percent.\r\n *\r\n * @return Percent\r\n */\r\n get: function () {\r\n return this._value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Percent.prototype.toString = function () {\r\n return \"\" + this._value + \"%\";\r\n };\r\n return Percent;\r\n}());\r\nexport { Percent };\r\n/**\r\n * Converts numeric percent value to a proper [[Percent]] object.\r\n *\r\n * ```TypeScript\r\n * pieSeries.radius = am4core.percent(80);\r\n * ```\r\n * ```JavaScript\r\n * pieSeries.radius = am4core.percent(80);\r\n * ```\r\n *\r\n * @param value Percent\r\n * @return Percent object\r\n */\r\nexport function percent(value) {\r\n return new Percent(value);\r\n}\r\n/**\r\n * Checks if value is a [[Percent]] object.\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Input value\r\n * @return Is percent?\r\n */\r\nexport function isPercent(value) {\r\n return value instanceof Percent;\r\n}\r\n//# sourceMappingURL=Percent.js.map","/**\r\n * ============================================================================\r\n * COMPARING FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Comparing function used for ordering.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Use localeCompare\r\n * @param a Item 1\r\n * @param b Item 2\r\n * @return Result\r\n */\r\nexport function order(a, b) {\r\n if (a === b) {\r\n return 0;\r\n }\r\n else if (a < b) {\r\n return -1;\r\n }\r\n else {\r\n return 1;\r\n }\r\n}\r\n/**\r\n * ============================================================================\r\n * OTHER FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Repeats a `string` number of times as set in `amount`.\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Make this faster\r\n * @param string Source string\r\n * @param amount Number of times to repeat string\r\n * @return New string\r\n */\r\nexport function repeat(string, amount) {\r\n return new Array(amount + 1).join(string);\r\n}\r\n/**\r\n * Generates a random string `characters` length.\r\n *\r\n * @param chars Number of characters\r\n * @return Random string\r\n */\r\nexport function random(chars) {\r\n var res = \"\";\r\n var choice = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n for (var i = 0; i < chars; i++) {\r\n res += choice.charAt(Math.floor(Math.random() * choice.length));\r\n }\r\n return res;\r\n}\r\n//# sourceMappingURL=String.js.map","import * as $math from \"./Math\";\r\nimport * as $type from \"./Type\";\r\n/**\r\n * ============================================================================\r\n * UTILITY FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Searches `array` for `value`.\r\n *\r\n * Returns -1 if not found.\r\n *\r\n * @param array Source array\r\n * @param value Value to search\r\n * @returns Index\r\n */\r\nexport function indexOf(array, value) {\r\n var length = array.length;\r\n for (var i = 0; i < length; ++i) {\r\n // TODO handle NaN\r\n if (array[i] === value) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Calls `test` for each element in `array`.\r\n *\r\n * If `test` returns `true` then it immediately returns `true`.\r\n *\r\n * If `test` returns `false` for all of the elements in `array` then it returns `false`.\r\n *\r\n * @param array Source array\r\n * @param test Function which is called on each element\r\n * @returns Whether `test` returned true or not\r\n */\r\nexport function any(array, test) {\r\n var length = array.length;\r\n for (var i = 0; i < length; ++i) {\r\n if (test(array[i])) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Calls `fn` function for every member of array and returns a new array out\r\n * of all outputs.\r\n *\r\n * @param array Source array\r\n * @param fn Callback function\r\n * @returns New array\r\n */\r\nexport function map(array, fn) {\r\n var length = array.length;\r\n var output = new Array(length);\r\n for (var i = 0; i < length; ++i) {\r\n output[i] = fn(array[i], i);\r\n }\r\n return output;\r\n}\r\n/**\r\n * Iterates through all items in array and calls `fn` function for each of\r\n * them.\r\n *\r\n * @param array Source array\r\n * @param fn Callback function\r\n */\r\nexport function each(array, fn) {\r\n var length = array.length;\r\n for (var i = 0; i < length; ++i) {\r\n fn(array[i], i);\r\n }\r\n}\r\n/**\r\n * Iterates through all items in array in reverse order and calls `fn` function for each of\r\n * them.\r\n *\r\n * @param array Source array\r\n * @param fn Callback function\r\n */\r\nexport function eachReverse(array, fn) {\r\n var i = array.length;\r\n while (i--) {\r\n fn(array[i], i);\r\n }\r\n}\r\n/**\r\n * Iterates through all items in array and calls `fn` function for each of\r\n * them.\r\n *\r\n * If `fn` call evaluates to `false`, further iteration is cancelled.\r\n *\r\n * @param array Source array\r\n * @param fn Callback function\r\n */\r\nexport function eachContinue(array, fn) {\r\n var length = array.length;\r\n for (var i = 0; i < length; ++i) {\r\n if (!fn(array[i], i)) {\r\n break;\r\n }\r\n }\r\n}\r\n/**\r\n * Shifts an item at `index` towards beginning of the array.\r\n *\r\n * @param array Source array\r\n * @param index Target element index\r\n */\r\nexport function shiftLeft(array, index) {\r\n var length = array.length;\r\n for (var i = index; i < length; ++i) {\r\n array[i - index] = array[i];\r\n }\r\n array.length = length - index;\r\n}\r\n/**\r\n * Returns the last item of the array.\r\n *\r\n * @param array Source array\r\n * @returns Last item\r\n */\r\nexport function last(array) {\r\n var length = array.length;\r\n return length ? array[length - 1] : undefined;\r\n}\r\n/**\r\n * Returns the first item of the array.\r\n *\r\n * @param array Source array\r\n * @returns Last item\r\n */\r\nexport function first(array) {\r\n return array[0];\r\n}\r\n/**\r\n * Inserts `element` into `array` at `index`.\r\n *\r\n * Caps `index` to be between `0` and `array.length`\r\n *\r\n * @param array Source array\r\n * @param element Item to insert\r\n * @param array Index to insert item at\r\n */\r\nexport function insert(array, element, index) {\r\n //if (array) {\r\n index = $math.fitToRange(index, 0, array.length);\r\n array.splice(index, 0, element);\r\n //}\r\n}\r\n/**\r\n * Removes all copies of `element` from `array` (if they exist) and then\r\n * inserts `element` at `index`.\r\n *\r\n * @param array Source array\r\n * @param element Item\r\n * @param array Index to move item to\r\n */\r\nexport function setIndex(array, element, index) {\r\n remove(array, element);\r\n insert(array, element, index);\r\n}\r\n/**\r\n * Pushes all of the elements from `input` into `array`.\r\n *\r\n * @param array Output array\r\n * @param input Input array\r\n */\r\nexport function pushAll(array, input) {\r\n var length = input.length;\r\n for (var i = 0; i < length; ++i) {\r\n array.push(input[i]);\r\n }\r\n}\r\n/**\r\n * Removes `element` from `array`.\r\n *\r\n * If there are multiple copies of `element`, they are all removed.\r\n *\r\n * @param array Source array\r\n * @param element Item to remove\r\n */\r\nexport function remove(array, element) {\r\n var found = false;\r\n var index = array.indexOf(element);\r\n if (index !== -1) {\r\n found = true;\r\n array.splice(index, 1);\r\n var length_1 = array.length;\r\n while (index < length_1) {\r\n // TODO handle NaN\r\n if (array[index] === element) {\r\n array.splice(index, 1);\r\n --length_1;\r\n }\r\n else {\r\n ++index;\r\n }\r\n }\r\n }\r\n return found;\r\n}\r\n/**\r\n * Adds an `element` to `array`.\r\n *\r\n * If array already contains and item like this, it is removed before adding\r\n * it again.\r\n *\r\n * Optionally `toIndex` can be specified to add element at specific index.\r\n *\r\n * @param array Source array\r\n * @param element Item to add\r\n * @param array Index to move item to\r\n */\r\nexport function move(array, element, toIndex) {\r\n // @todo this implementation must be the same as the List.moveValue method\r\n // @todo don't do anything if the desired index is the same as the current index\r\n var index = indexOf(array, element);\r\n // @todo remove all old values rather than only the first ?\r\n if (index !== -1) {\r\n removeIndex(array, index);\r\n }\r\n if (toIndex == null) {\r\n array.push(element);\r\n }\r\n else {\r\n insertIndex(array, toIndex, element);\r\n }\r\n}\r\n/**\r\n * Inserts `element` into `array` at `index`.\r\n *\r\n * If `index` is not provided, it will insert `element` at the end of `array`.\r\n *\r\n * @param array Source array\r\n * @param element Item to add\r\n * @param array Index to add item at\r\n */\r\nexport function add(array, element, index) {\r\n // Append to the end if index is not set\r\n if (!$type.isNumber(index)) {\r\n array.push(element);\r\n }\r\n // Add to the beginning of array if index is 0\r\n else if (index === 0) {\r\n array.unshift(element);\r\n }\r\n // Add to indicated place if index is set\r\n else {\r\n array.splice(index, 0, element);\r\n }\r\n}\r\n/**\r\n * Removes `element` from `array` (if it exists) and then inserts `element` at\r\n * `index`.\r\n *\r\n * If `index` is not provided, it will insert `element` at the end of `array`.\r\n *\r\n * @param array Source array\r\n * @param element Item to remove\r\n * @param array Index to move item to\r\n */\r\nexport function replace(array, element, index) {\r\n // check if exists\r\n var ind = array.indexOf(element);\r\n // remove if exists\r\n if (ind !== -1) {\r\n array.splice(ind, 1);\r\n }\r\n // add to end if index is not set\r\n if (!$type.isNumber(index)) {\r\n array.push(element);\r\n }\r\n // add to indicated place if index is set\r\n else {\r\n array.splice(index, 0, element);\r\n }\r\n}\r\n/**\r\n * Wraps `input` in an array, if it isn't already an array.\r\n *\r\n * @param input Source value\r\n * @return An array\r\n */\r\nexport function toArray(input) {\r\n if (Array.isArray(input)) {\r\n return input;\r\n }\r\n else {\r\n return [input];\r\n }\r\n}\r\n/**\r\n * Returns `true` if `element` exists in `array`.\r\n *\r\n * @param array Source array\r\n * @param element Item to search for\r\n * @returns Item in array?\r\n */\r\nexport function has(array, element) {\r\n return indexOf(array, element) !== -1;\r\n}\r\n/**\r\n * Returns a shallow copy of `array`.\r\n *\r\n * @param array Source array\r\n * @returns Copy of the array\r\n */\r\nexport function copy(array) {\r\n var length = array.length;\r\n // It's faster to create the array with a pre-defined length\r\n var output = new Array(length);\r\n for (var i = 0; i < length; ++i) {\r\n // Because the array has a pre-defined length, we have to assign rather than push\r\n // This is also faster than pushing\r\n output[i] = array[i];\r\n }\r\n return output;\r\n}\r\n/**\r\n * Returns a copy of `array` which contains all the elements between `start`\r\n * and `end`. (including `start` and excluding `end`)\r\n *\r\n * If `end` is not provided, it defaults to `array.length`.\r\n *\r\n * @param array Source array\r\n * @param start Start index\r\n * @param end End index\r\n * @returns Part of the array\r\n */\r\nexport function slice(array, start, end) {\r\n if (end === void 0) { end = array.length; }\r\n var output = new Array(end - start);\r\n for (var i = start; i < end; ++i) {\r\n output[i - start] = array[i];\r\n }\r\n return output;\r\n}\r\n/**\r\n * Inserts a value into array at specific index.\r\n *\r\n * @param array Source array\r\n * @param index Index\r\n * @param value Value to insert\r\n */\r\nexport function insertIndex(array, index, value) {\r\n array.splice(index, 0, value);\r\n}\r\n/**\r\n * Removes a value from array at specific index.\r\n *\r\n * @param array Source array\r\n * @param index Index\r\n */\r\nexport function removeIndex(array, index) {\r\n array.splice(index, 1);\r\n}\r\n/**\r\n * Orders an array using specific `ordering` function and returns index of\r\n * the `value`.\r\n *\r\n * @ignore Exclude from docs\r\n * @param array Source array\r\n * @param ordering An ordering function\r\n * @param value Value to search for\r\n * @returns Result of the search\r\n */\r\nexport function getSortedIndex(array, ordering, value) {\r\n var start = 0;\r\n var end = array.length;\r\n var found = false;\r\n while (start < end) {\r\n // TODO is this faster/slower than using Math.floor ?\r\n var pivot = (start + end) >> 1;\r\n var order = ordering(value, array[pivot]);\r\n // less\r\n if (order < 0) {\r\n end = pivot;\r\n // equal\r\n }\r\n else if (order === 0) {\r\n found = true;\r\n start = pivot + 1;\r\n // more\r\n }\r\n else {\r\n start = pivot + 1;\r\n }\r\n }\r\n return {\r\n found: found,\r\n index: (found ? start - 1 : start)\r\n };\r\n}\r\n/**\r\n * Searches the array using custom function and returns index of the item if\r\n * found.\r\n *\r\n * Will call `matches` function on all items of the array. If return value\r\n * evaluates to `true`, index is returned.\r\n *\r\n * Otherwise returns -1.\r\n *\r\n * @param array Source array\r\n * @param matches Search function\r\n * @returns Index of the item if found\r\n */\r\nexport function findIndex(array, matches) {\r\n var length = array.length;\r\n for (var i = 0; i < length; ++i) {\r\n if (matches(array[i], i)) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Searches the array using custom function and returns item if found.\r\n *\r\n * Will call `matches` function on all items of the array. If return value\r\n * evaluates to `true`, index is returned.\r\n *\r\n * Otherwise returns `undefined`.\r\n *\r\n * @param array Source array\r\n * @param matches Search function\r\n * @returns Item if found\r\n */\r\nexport function find(array, matches) {\r\n var index = findIndex(array, matches);\r\n if (index !== -1) {\r\n return array[index];\r\n }\r\n}\r\n/**\r\n * Iterates through all items in array and calls `fn` function for each of\r\n * them.\r\n *\r\n * @param array Source array\r\n * @param fn Callback function\r\n */\r\nexport function shuffle(array) {\r\n // https://stackoverflow.com/a/2450976/449477\r\n var currentIndex = array.length, temporaryValue, randomIndex;\r\n // While there remain elements to shuffle...\r\n while (0 !== currentIndex) {\r\n // Pick a remaining element...\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex -= 1;\r\n // And swap it with the current element.\r\n temporaryValue = array[currentIndex];\r\n array[currentIndex] = array[randomIndex];\r\n array[randomIndex] = temporaryValue;\r\n }\r\n}\r\nexport function keepIf(array, keep) {\r\n var length = array.length;\r\n var i = 0;\r\n while (i < length) {\r\n if (keep(array[i])) {\r\n ++i;\r\n }\r\n else {\r\n array.splice(i, 1);\r\n --length;\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=Array.js.map","/**\r\n * A collection of low-level async operation stuff.\r\n */\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport * as $array from \"./Array\";\r\nvar pendingFrame = false;\r\nvar nextQueue = [];\r\nvar readQueue = [];\r\nvar writeQueue = [];\r\nvar idleQueue = [];\r\nvar fps = 1000 / 60;\r\n/**\r\n * [raf description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nexport var raf = (typeof requestAnimationFrame === \"function\"\r\n ? function (fn) {\r\n requestAnimationFrame(fn);\r\n }\r\n : function (fn) {\r\n setTimeout(fn, fps);\r\n });\r\n/**\r\n * [frameLoop description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nfunction frameLoop() {\r\n var now = Date.now();\r\n var length = nextQueue.length;\r\n for (var i = 0; i < length; ++i) {\r\n nextQueue[i](now);\r\n }\r\n $array.shiftLeft(nextQueue, length);\r\n for (var i = 0; i < readQueue.length; ++i) {\r\n readQueue[i](now);\r\n }\r\n readQueue.length = 0;\r\n for (var i = 0; i < writeQueue.length; ++i) {\r\n writeQueue[i](now);\r\n }\r\n writeQueue.length = 0;\r\n if (nextQueue.length === 0 && readQueue.length === 0) {\r\n pendingFrame = false;\r\n }\r\n else {\r\n raf(frameLoop);\r\n }\r\n}\r\n/**\r\n * [pendFrame description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n */\r\nfunction pendFrame() {\r\n if (!pendingFrame) {\r\n pendingFrame = true;\r\n raf(frameLoop);\r\n }\r\n}\r\n/**\r\n * [nextFrame description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param fn [description]\r\n */\r\nexport function nextFrame(fn) {\r\n nextQueue.push(fn);\r\n pendFrame();\r\n}\r\n/**\r\n * [readFrame description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param fn [description]\r\n */\r\nexport function readFrame(fn) {\r\n readQueue.push(fn);\r\n pendFrame();\r\n}\r\n/**\r\n * [writeFrame description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param fn [description]\r\n */\r\nexport function writeFrame(fn) {\r\n writeQueue.push(fn);\r\n pendFrame();\r\n}\r\n/**\r\n * [whenIdle description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param fn [description]\r\n */\r\nexport function whenIdle(fn) {\r\n idleQueue.push(fn);\r\n}\r\n/**\r\n * [triggerIdle description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @todo Maybe don't trigger a callback which was added while in the middle of triggering?\r\n */\r\nexport function triggerIdle() {\r\n var now = Date.now();\r\n var length = idleQueue.length;\r\n for (var i = 0; i < length; ++i) {\r\n idleQueue.shift()(now);\r\n }\r\n}\r\n//# sourceMappingURL=AsyncPending.js.map","import { EventDispatcher } from \"./utils/EventDispatcher\";\r\nimport { Dictionary } from \"./utils/Dictionary\";\r\nimport { cache } from \"./utils/Cache\";\r\nimport * as $type from \"./utils/Type\";\r\nimport * as $string from \"./utils/String\";\r\nimport * as $array from \"./utils/Array\";\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Registry is used to store miscellaneous system-wide information, like ids,\r\n * maps, themes, and registered classes.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\nvar Registry = /** @class */ (function () {\r\n function Registry() {\r\n var _this = this;\r\n /**\r\n * Event dispacther.\r\n */\r\n this.events = new EventDispatcher();\r\n /**\r\n * All currently applied themes. All new chart instances created will\r\n * automatically inherit and retain System's themes.\r\n */\r\n this.themes = [];\r\n /**\r\n * List of all loaded available themes.\r\n *\r\n * Whenever a theme loads, it registers itself in System's `loadedThemes`\r\n * collection.\r\n */\r\n this.loadedThemes = {};\r\n /**\r\n * An indeternal counter used to generate unique IDs.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this._uidCount = 0;\r\n /**\r\n * Keeps register of class references so that they can be instnatiated using\r\n * string key.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.registeredClasses = {};\r\n /**\r\n * Holds all generated placeholders.\r\n */\r\n this._placeholders = {};\r\n /**\r\n * A list of invalid(ated) [[Sprite]] objects that need to be re-validated\r\n * during next cycle.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidSprites = {};\r\n /**\r\n * Components are added to this list when their data provider changes to\r\n * a new one or data is added/removed from their data provider.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidDatas = {};\r\n /**\r\n * Components are added to this list when values of their raw data change.\r\n * Used when we want a smooth animation from one set of values to another.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidRawDatas = [];\r\n /**\r\n * Components are added to this list when values of their data changes\r\n * (but not data provider itself).\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidDataItems = [];\r\n /**\r\n * Components are added to this list when their data range (selection) is\r\n * changed, e.g. zoomed.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidDataRange = [];\r\n /**\r\n * A list of [[Sprite]] objects that have invalid(ated) positions, that need\r\n * to be recalculated.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidPositions = {};\r\n /**\r\n * A list of [[Container]] objects with invalid(ated) layouts.\r\n *\r\n * @ignore Exclude from docs\r\n */\r\n this.invalidLayouts = {};\r\n /**\r\n * An array holding all active (non-disposed) top level elemens.\r\n *\r\n * When, for example, a new chart is created, its instance will be added to\r\n * this array, and will be removed when the chart is disposed.\r\n */\r\n this.baseSprites = [];\r\n /**\r\n * An UID-based map of base sprites (top-level charts).\r\n */\r\n this.baseSpritesByUid = {};\r\n /**\r\n * Queued charts (waiting for their turn) to initialize.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/performance/#Daisy_chaining_multiple_charts} for more information\r\n */\r\n this.queue = [];\r\n /**\r\n * An array of deferred charts that haven't been created yet.\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 */\r\n this.deferred = [];\r\n this.uid = this.getUniqueId();\r\n this.invalidSprites.noBase = [];\r\n this.invalidDatas.noBase = [];\r\n this.invalidLayouts.noBase = [];\r\n this.invalidPositions.noBase = [];\r\n // This is needed for Angular Universal SSR\r\n if (typeof addEventListener !== \"undefined\") {\r\n // This is needed to prevent charts from being cut off when printing\r\n addEventListener(\"beforeprint\", function () {\r\n $array.each(_this.baseSprites, function (sprite) {\r\n var svg = sprite.paper.svg;\r\n svg.setAttribute(\"viewBox\", \"0 0 \" + svg.clientWidth + \" \" + svg.clientHeight);\r\n });\r\n });\r\n addEventListener(\"afterprint\", function () {\r\n $array.each(_this.baseSprites, function (sprite) {\r\n var svg = sprite.paper.svg;\r\n svg.removeAttribute(\"viewBox\");\r\n });\r\n });\r\n }\r\n }\r\n /**\r\n * Generates a unique chart system-wide ID.\r\n *\r\n * @return Generated ID\r\n */\r\n Registry.prototype.getUniqueId = function () {\r\n var uid = this._uidCount;\r\n this._uidCount += 1;\r\n return \"id-\" + uid;\r\n };\r\n Object.defineProperty(Registry.prototype, \"map\", {\r\n /**\r\n * Returns a universal collection for mapping ids with objects.\r\n *\r\n * @ignore Exclude from docs\r\n * @return Map collection\r\n */\r\n get: function () {\r\n if (!this._map) {\r\n this._map = new Dictionary();\r\n }\r\n return this._map;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Caches value in object's cache.\r\n *\r\n * @ignore Exclude from docs\r\n * @param key Key\r\n * @param value Value\r\n * @param ttl TTL in seconds\r\n */\r\n Registry.prototype.setCache = function (key, value, ttl) {\r\n cache.set(this.uid, key, value, ttl);\r\n };\r\n /**\r\n * Retrieves cached value.\r\n *\r\n * @ignore Exclude from docs\r\n * @param key Key\r\n * @param value Value to return if cache is not available\r\n * @return Value\r\n */\r\n Registry.prototype.getCache = function (key, value) {\r\n if (value === void 0) { value = undefined; }\r\n return cache.get(this.uid, key, value);\r\n };\r\n /**\r\n * Dispatches an event using own event dispatcher. Will automatically\r\n * populate event data object with event type and target (this element).\r\n * It also checks if there are any handlers registered for this sepecific\r\n * event.\r\n *\r\n * @param eventType Event type (name)\r\n * @param data Data to pass into event handler(s)\r\n */\r\n Registry.prototype.dispatch = function (eventType, data) {\r\n // @todo Implement proper type check\r\n if (this.events.isEnabled(eventType)) {\r\n if (data) {\r\n data.type = eventType;\r\n data.target = data.target || this;\r\n this.events.dispatch(eventType, {\r\n type: eventType,\r\n target: this\r\n });\r\n }\r\n else {\r\n this.events.dispatch(eventType, {\r\n type: eventType,\r\n target: this\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * Works like `dispatch`, except event is triggered immediately, without\r\n * waiting for the next frame cycle.\r\n *\r\n * @param eventType Event type (name)\r\n * @param data Data to pass into event handler(s)\r\n */\r\n Registry.prototype.dispatchImmediately = function (eventType, data) {\r\n // @todo Implement proper type check\r\n if (this.events.isEnabled(eventType)) {\r\n if (data) {\r\n data.type = eventType;\r\n data.target = data.target || this;\r\n this.events.dispatchImmediately(eventType, data);\r\n }\r\n else {\r\n this.events.dispatchImmediately(eventType, {\r\n type: eventType,\r\n target: this\r\n });\r\n }\r\n }\r\n };\r\n /**\r\n * Returns a unique placeholder suitable for the key.\r\n *\r\n * @param key Key\r\n * @return Random string to be used as placeholder\r\n */\r\n Registry.prototype.getPlaceholder = function (key) {\r\n if ($type.hasValue(this._placeholders[key])) {\r\n return this._placeholders[key];\r\n }\r\n this._placeholders[key] = \"__amcharts_\" + key + \"_\" + $string.random(8) + \"__\";\r\n return this._placeholders[key];\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.addToInvalidComponents = function (component) {\r\n if (component.baseId) {\r\n $array.move(this.invalidDatas[component.baseId], component);\r\n }\r\n else {\r\n $array.move(this.invalidDatas[\"noBase\"], component);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.removeFromInvalidComponents = function (component) {\r\n if (component.baseId) {\r\n $array.remove(this.invalidDatas[component.baseId], component);\r\n }\r\n $array.remove(this.invalidDatas[\"noBase\"], component);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.addToInvalidSprites = function (sprite) {\r\n if (sprite.baseId) {\r\n $array.add(this.invalidSprites[sprite.baseId], sprite);\r\n }\r\n else {\r\n $array.add(this.invalidSprites[\"noBase\"], sprite);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.removeFromInvalidSprites = function (sprite) {\r\n if (sprite.baseId) {\r\n $array.remove(this.invalidSprites[sprite.baseId], sprite);\r\n }\r\n $array.remove(this.invalidSprites[\"noBase\"], sprite);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.addToInvalidPositions = function (sprite) {\r\n if (sprite.baseId) {\r\n $array.add(this.invalidPositions[sprite.baseId], sprite);\r\n }\r\n else {\r\n $array.add(this.invalidPositions[\"noBase\"], sprite);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.removeFromInvalidPositions = function (sprite) {\r\n if (sprite.baseId) {\r\n $array.remove(this.invalidPositions[sprite.baseId], sprite);\r\n }\r\n $array.remove(this.invalidPositions[\"noBase\"], sprite);\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.addToInvalidLayouts = function (sprite) {\r\n if (sprite.baseId) {\r\n $array.add(this.invalidLayouts[sprite.baseId], sprite);\r\n }\r\n else {\r\n $array.add(this.invalidLayouts[\"noBase\"], sprite);\r\n }\r\n };\r\n /**\r\n * @ignore\r\n */\r\n Registry.prototype.removeFromInvalidLayouts = function (sprite) {\r\n if (sprite.baseId) {\r\n $array.remove(this.invalidLayouts[sprite.baseId], sprite);\r\n }\r\n $array.remove(this.invalidLayouts[\"noBase\"], sprite);\r\n };\r\n return Registry;\r\n}());\r\nexport { Registry };\r\n/**\r\n * A singleton global instance of [[Registry]].\r\n *\r\n * @ignore Exclude from docs\r\n */\r\nexport var registry = new Registry();\r\n/**\r\n * Returns `true` if object is an instance of the class. It's the same as `instanceof` except it doesn't need to import the class.\r\n *\r\n * @param object Object\r\n * @param name Class name\r\n * @return Is instance of class\r\n */\r\nexport function is(object, name) {\r\n var x = registry.registeredClasses[name];\r\n return x != null && object instanceof x;\r\n}\r\n//# sourceMappingURL=Registry.js.map","/**\r\n * A collection of utility functions for various type checks and conversion\r\n * @todo Review unused functions for removal\r\n * @hidden\r\n */\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { percent, isPercent } from \"./Percent\";\r\n/**\r\n * ============================================================================\r\n * TYPE CHECK\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Returns `true` if value is not a number (NaN).\r\n *\r\n * @param value Input value\r\n * @return Is NaN?\r\n * @deprecated Is not used anywhere. JS built-in isNaN is used everywhere. Maybe we don't need this, or if we do, then we should use it everywhere\r\n */\r\nexport function isNaN(value) {\r\n return Number(value) !== value;\r\n}\r\n/**\r\n * Returns a type of the value.\r\n *\r\n * @param value Input value\r\n * @return Type of the value\r\n */\r\nexport function getType(value) {\r\n return ({}).toString.call(value);\r\n}\r\n/**\r\n * Returns a default value if the passed in value is empty.\r\n *\r\n * @param value Input value\r\n * @param optional Default value\r\n * @return Value or default value whichever is available\r\n * @deprecated Not used anywhere\r\n */\r\nexport function getDefault(value, optional) {\r\n return value || optional;\r\n}\r\n/**\r\n * Checks if the passed in value is a string.\r\n *\r\n * @param value Value\r\n * @return Is string?\r\n * @throws {Error}\r\n * @deprecated Not used anywhere\r\n */\r\nexport function checkString(value) {\r\n if (typeof value === \"string\") {\r\n return true;\r\n }\r\n else {\r\n throw new Error(\"Expected a string but got \" + getType(value));\r\n }\r\n}\r\n/**\r\n * Checks if the passed in value is a boolean.\r\n *\r\n * @param value Value\r\n * @return Is boolean?\r\n * @throws {Error}\r\n * @deprecated Not used anywhere\r\n */\r\nexport function checkBoolean(value) {\r\n if (typeof value === \"boolean\") {\r\n return true;\r\n }\r\n else {\r\n throw new Error(\"Expected a boolean but got \" + getType(value));\r\n }\r\n}\r\n/**\r\n * Checks if the passed in value is a number.\r\n *\r\n * @param value Value\r\n * @return Is number?\r\n * @throws {Error}\r\n */\r\nexport function checkNumber(value) {\r\n if (typeof value === \"number\") {\r\n if (isNaN(value)) {\r\n throw new Error(\"Expected a number but got NaN\");\r\n }\r\n }\r\n else {\r\n throw new Error(\"Expected a number but got \" + getType(value));\r\n }\r\n return true;\r\n}\r\n/**\r\n * Checks if the passed in value is an object.\r\n *\r\n * @param value Value\r\n * @return Is object?\r\n * @throws {Error}\r\n * @todo Is the input type correct?\r\n * @deprecated Not used anywhere\r\n */\r\nexport function checkObject(value) {\r\n var t = getType(value);\r\n if (t === \"[object Object]\") {\r\n return true;\r\n }\r\n else {\r\n throw new Error(\"Expected an object but got \" + t);\r\n }\r\n}\r\n/**\r\n * Checks if the passed in value is an array.\r\n *\r\n * @param value Value\r\n * @return Is array?\r\n * @throws {Error}\r\n * @deprecated Not used anywhere\r\n */\r\nexport function checkArray(value) {\r\n if (Array.isArray(value)) {\r\n return true;\r\n }\r\n else {\r\n throw new Error(\"Expected an array but got \" + getType(value));\r\n }\r\n}\r\n/**\r\n * Checks if the passed in value is a Date object.\r\n *\r\n * @param value Value\r\n * @return Is Date object?\r\n * @throws {Error}\r\n * @deprecated Not used anywhere\r\n */\r\nexport function checkDate(value) {\r\n var t = getType(value);\r\n if (t === \"[object Date]\") {\r\n return true;\r\n }\r\n else {\r\n throw new Error(\"Expected a date but got \" + t);\r\n }\r\n}\r\n/**\r\n * ============================================================================\r\n * TYPE CASTING\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Casts string or a number into string.\r\n *\r\n * @param value Input\r\n * @return String value\r\n * @deprecated Not used anywhere\r\n */\r\nexport function castString(value) {\r\n if (typeof value === \"string\") {\r\n return value;\r\n }\r\n else if (typeof value === \"number\") {\r\n return \"\" + value;\r\n }\r\n else {\r\n throw new Error(\"Expected a string or number but got \" + getType(value));\r\n }\r\n}\r\n/**\r\n * Casts string or a number into a number.\r\n *\r\n * @param value Input value\r\n * @return Number value\r\n * @throws {Error}\r\n */\r\nexport function castNumber(value) {\r\n if (typeof value === \"string\") {\r\n var number = +value;\r\n if (isNaN(number)) {\r\n throw new Error(\"Cannot cast string \" + JSON.stringify(value) + \" to a number\");\r\n }\r\n else {\r\n return number;\r\n }\r\n }\r\n else if (typeof value === \"number\") {\r\n if (isNaN(value)) {\r\n throw new Error(\"Expected a number but got NaN\");\r\n }\r\n else {\r\n return value;\r\n }\r\n }\r\n else {\r\n var t = getType(value);\r\n if (t === \"[object Date]\") {\r\n return value.getTime();\r\n }\r\n else {\r\n throw new Error(\"Expected a string, number, or date but got \" + t);\r\n }\r\n }\r\n}\r\n/**\r\n * Casts number, string or Date into a Date object.\r\n *\r\n * @param value Input value\r\n * @return Date object\r\n * @deprecated Not used anywhere\r\n * @throws {Error}\r\n * @hidden\r\n * @deprecated\r\n */\r\n/*export function castDate(value: string | number | Date, formatter?: DateFormatter): Date {\r\n if (typeof value === \"string\") {\r\n if (formatter) {\r\n return formatter.parse(value);\r\n }\r\n return new Date(value);\r\n\r\n } else if (typeof value === \"number\") {\r\n return new Date(value);\r\n\r\n } else {\r\n const t = getType(value);\r\n\r\n if (t === \"[object Date]\") {\r\n return value;\r\n\r\n } else {\r\n throw new Error(\"Expected a string, number, or date but got \" + t);\r\n }\r\n }\r\n}*/\r\n/**\r\n * ============================================================================\r\n * QUICK CONVERSION\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Converts any value into `boolean`.\r\n *\r\n * @param value Source value\r\n * @return `true` or `false`\r\n */\r\nexport function toBoolean(value) {\r\n return value ? true : false;\r\n}\r\n/**\r\n * Converts any value into a `number`.\r\n *\r\n * @param value Source value\r\n * @return Number representation of value\r\n */\r\nexport function toNumber(value) {\r\n if (hasValue(value) && !isNumber(value)) {\r\n var converted = Number(value);\r\n if (isNaN(converted) && isString(value) && value != \"\") {\r\n return toNumber(value.replace(/[^0-9.\\-]+/g, ''));\r\n }\r\n return converted;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Converts any value into a string (text).\r\n *\r\n * @param value Source value\r\n * @return String representation of the input\r\n */\r\nexport function toText(value) {\r\n if (hasValue(value) && !isString(value)) {\r\n if (isNumber(value)) {\r\n return castString(value);\r\n }\r\n else if (isObject(value)) {\r\n return value.toString();\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * Converts any value to a number or [[Percent]].\r\n *\r\n * If the parameter is a string and contains \"%\", it will\r\n * convert it into a [[Percent]].\r\n *\r\n * Otherwise, it will convert into a number.\r\n *\r\n * @param value Number or percent\r\n * @return Percent object\r\n */\r\nexport function toNumberOrPercent(value) {\r\n if (!hasValue(value) || isNumber(value) || isPercent(value)) {\r\n return value;\r\n }\r\n if (isString(value) && value.indexOf(\"%\") != -1) {\r\n return percent(toNumber(value));\r\n }\r\n return toNumber(value);\r\n}\r\n/**\r\n * Checks if a variable has a value.\r\n *\r\n * @param a Input value\r\n * @returns Has value?\r\n */\r\nexport function hasValue(a) {\r\n return a != null;\r\n}\r\n/**\r\n * Returns a value or throws an {Error} exception if the variable has not\r\n * value.\r\n *\r\n * @param a Input value\r\n * @returns Value\r\n */\r\nexport function getValue(a) {\r\n if (hasValue(a)) {\r\n return a;\r\n }\r\n else {\r\n throw new Error(\"Value doesn't exist\");\r\n }\r\n}\r\n/**\r\n * Returns a value, or returns the default value if it doesn't have a value.\r\n *\r\n * @param a Input value\r\n * @returns Value\r\n */\r\nexport function getValueDefault(a, defaultValue) {\r\n if (hasValue(a)) {\r\n return a;\r\n }\r\n else {\r\n return defaultValue;\r\n }\r\n}\r\n/**\r\n * ============================================================================\r\n * TYPE CHECK\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Checks if parameter is `Date`.\r\n *\r\n * @param value Input value\r\n * @return Is Date?\r\n */\r\nexport function isDate(value) {\r\n return getType(value) === \"[object Date]\";\r\n}\r\n/**\r\n * Checks if parameter is `string`.\r\n *\r\n * @param value Input value\r\n * @return Is string?\r\n */\r\nexport function isString(value) {\r\n return typeof value === \"string\";\r\n}\r\n/**\r\n * Checks if parameter is `number`.\r\n *\r\n * @param value Input value\r\n * @return Is number?\r\n */\r\nexport function isNumber(value) {\r\n return typeof value === \"number\" && Number(value) == value;\r\n}\r\n/**\r\n * Checks if parameter is `object`.\r\n *\r\n * @param value Input value\r\n * @return Is object?\r\n */\r\nexport function isObject(value) {\r\n return typeof value === \"object\" && value != null;\r\n}\r\n/**\r\n * Checks if parameter is `Array`.\r\n *\r\n * @param value Input value\r\n * @return Is Array?\r\n */\r\nexport function isArray(value) {\r\n return Array.isArray(value);\r\n}\r\n//# sourceMappingURL=Type.js.map","/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport * as $array from \"./Array\";\r\nimport * as $type from \"./Type\";\r\n/**\r\n * ============================================================================\r\n * UTILITY FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Returns an iterator for all entries in object.\r\n *\r\n * Can be used to safely iterate through all properties of the object.\r\n *\r\n * @param object Source object\r\n * @returns Iterator\r\n */\r\nexport function entries(object) {\r\n return function (push) {\r\n // TODO make this more efficient ?\r\n for (var key in object) {\r\n if (hasKey(object, key)) {\r\n if (!push([key, object[key]])) {\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n}\r\n/**\r\n * Returns an array of object's property names.\r\n *\r\n * @param object Source object\r\n * @returns Object property names\r\n */\r\nexport function keys(object) {\r\n var output = [];\r\n for (var key in object) {\r\n if (hasKey(object, key)) {\r\n output.push(key);\r\n }\r\n }\r\n return output;\r\n}\r\n/**\r\n * Returns an array of object's property names ordered using specific ordering\r\n * function.\r\n *\r\n * @param object Source object\r\n * @param order Ordering function\r\n * @returns Object property names\r\n */\r\nexport function keysOrdered(object, order) {\r\n return keys(object).sort(order);\r\n}\r\n/**\r\n * Checks if `object` has a specific `key`.\r\n *\r\n * @param object Source object\r\n * @param key Property name\r\n * @returns Has key?\r\n */\r\nexport function hasKey(object, key) {\r\n return {}.hasOwnProperty.call(object, key);\r\n}\r\n/**\r\n * Returns value of the specific `key`.\r\n *\r\n * @param object Source object\r\n * @param key Property name\r\n * @returns Key value\r\n */\r\nexport function getKey(object, key) {\r\n return object[key];\r\n}\r\n/**\r\n * Iterates through all properties of the object calling `fn` for each of them.\r\n *\r\n * If return value of the function evaluates to `false` further iteration is\r\n * cancelled.\r\n *\r\n * @param object Source object\r\n * @param fn Callback function\r\n */\r\nexport function eachContinue(object, fn) {\r\n for (var key in object) {\r\n if (hasKey(object, key)) {\r\n if (!fn(key, object[key])) {\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * Iterates through all properties of the object calling `fn` for each of them.\r\n *\r\n * @param object Source object\r\n * @param fn Callback function\r\n */\r\nexport function each(object, fn) {\r\n eachContinue(object, function (key, value) {\r\n fn(key, value);\r\n return true;\r\n });\r\n}\r\n/**\r\n * Orders object properties using custom `ord` function and iterates through\r\n * them calling `fn` for each of them.\r\n *\r\n * @param object Source object\r\n * @param fn Callback function\r\n * @param order Ordering function\r\n */\r\nexport function eachOrdered(object, fn, ord) {\r\n $array.each(keysOrdered(object, ord), function (key) {\r\n fn(key, object[key]);\r\n });\r\n}\r\n/**\r\n * Returns a copy of the object.\r\n *\r\n * @param object Source object\r\n * @returns Copy of the object\r\n */\r\nexport function copy(object) {\r\n return Object.assign({}, object);\r\n}\r\n/**\r\n * Merges two objects and returns a new object that contains properties from\r\n * both source objects.\r\n *\r\n * @param object1 Source object #1\r\n * @param object2 Source object #2\r\n * @returns Combined object\r\n */\r\nexport function merge(object1, object2) {\r\n return Object.assign({}, object1, object2);\r\n}\r\n/**\r\n * Returns object clone.\r\n *\r\n * @param object Source object\r\n * @returns Clone\r\n */\r\nexport function clone(object) {\r\n return JSON.parse(JSON.stringify(object));\r\n}\r\n/**\r\n * Copies a list of properties from one object to another.\r\n *\r\n * Will not copy empty properties.\r\n *\r\n * @param source Source object\r\n * @param target Target object\r\n * @param keys List of keys to copy\r\n */\r\nexport function copyProperties(source, target, keys) {\r\n $array.each(keys, function (key) {\r\n if ($type.hasValue(source[key])) {\r\n target[key] = source[key];\r\n }\r\n });\r\n}\r\n/**\r\n * Copies a list of properties from one object to another only if target does't have value of the property set.\r\n *\r\n * Will not copy empty properties.\r\n *\r\n * @param source Source object\r\n * @param target Target object\r\n * @param keys List of keys to copy\r\n */\r\nexport function softCopyProperties(source, target, keys) {\r\n $array.each(keys, function (key) {\r\n if ($type.hasValue(source[key]) && !($type.hasValue(target[key]))) {\r\n target[key] = source[key];\r\n }\r\n });\r\n}\r\n/**\r\n * Copies a list of properties from one object to another.\r\n *\r\n * Will copy empty properties.\r\n *\r\n * @param source Source object\r\n * @param target Target object\r\n * @param keys List of keys to copy\r\n */\r\nexport function forceCopyProperties(source, target, keys) {\r\n $array.each(keys, function (key) {\r\n target[key] = source[key];\r\n });\r\n}\r\n/**\r\n * Copies all properties from one object to another.\r\n *\r\n * @param from Source object\r\n * @param to Target object\r\n */\r\nexport function copyAllProperties(from, to) {\r\n copyProperties(from, to, keys(from));\r\n}\r\n//# sourceMappingURL=Object.js.map","/**\r\n * A collection of Math-related functions\r\n *\r\n * @todo Comment trigonometric functions?\r\n */\r\nimport * as $type from \"./Type\";\r\n/**\r\n * ============================================================================\r\n * CONSTANTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nexport var PI = Math.PI;\r\nexport var HALFPI = PI / 2;\r\nexport var RADIANS = PI / 180;\r\nexport var DEGREES = 180 / PI;\r\n/**\r\n * Converts any value and fits it into a specific value range.\r\n *\r\n * @param value Source value\r\n * @param min Minimum allowable value\r\n * @param max Maximum allowable value\r\n * @return Number\r\n */\r\nexport function toNumberRange(value, min, max) {\r\n if ($type.hasValue(value)) {\r\n value = $type.toNumber(value);\r\n return fitToRange(value, min, max);\r\n }\r\n return value;\r\n}\r\n/**\r\n * Rounds the numeric value to whole number or specific precision of set.\r\n *\r\n * @param value Value\r\n * @param precision Precision (number of decimal points)\r\n * @param floor In case value ends with 0.5 and precision is 0, we might need to floor the value instead of ceiling it.\r\n * @return Rounded value\r\n */\r\nexport function round(value, precision, floor) {\r\n if (!$type.isNumber(precision) || precision <= 0) {\r\n var rounded = Math.round(value);\r\n if (floor) {\r\n if (rounded - value == 0.5) {\r\n rounded--;\r\n }\r\n }\r\n return rounded;\r\n }\r\n else {\r\n var d = Math.pow(10, precision);\r\n return Math.round(value * d) / d;\r\n }\r\n}\r\n/**\r\n * Ceils the numeric value to whole number or specific precision of set.\r\n *\r\n * @param value Value\r\n * @param precision Precision (number of decimal points)\r\n * @return Rounded value\r\n */\r\nexport function ceil(value, precision) {\r\n if (!$type.isNumber(precision) || precision <= 0) {\r\n return Math.ceil(value);\r\n }\r\n else {\r\n var d = Math.pow(10, precision);\r\n return Math.ceil(value * d) / d;\r\n }\r\n}\r\n/**\r\n * Stretches `t` so that it will always be between `from` and `to`.\r\n *\r\n * @param t Number from 0 to 1\r\n * @param from Lowest possible value\r\n * @param to Highest possible value\r\n * @return Adjusted value\r\n */\r\nexport function stretch(t, from, to) {\r\n return (t * (to - from)) + from;\r\n}\r\n/**\r\n * Adjust numeric value so it fits to specific value range.\r\n *\r\n * @param value Value\r\n * @param minValue Lowest possible value\r\n * @param maxValue Highest possible value\r\n * @return Adjusted value\r\n */\r\nexport function fitToRange(value, minValue, maxValue) {\r\n if ($type.isNumber(minValue)) {\r\n if ($type.isNumber(maxValue) && maxValue < minValue) {\r\n var temp = maxValue;\r\n maxValue = minValue;\r\n minValue = temp;\r\n }\r\n if (value < minValue) {\r\n value = minValue;\r\n }\r\n }\r\n if ($type.isNumber(maxValue)) {\r\n if (value > maxValue) {\r\n value = maxValue;\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * Returns sine of a number.\r\n *\r\n * @param value Value\r\n * @return Sine\r\n */\r\nexport function sin(value) {\r\n return round(Math.sin(RADIANS * value), 10);\r\n}\r\n/**\r\n * Returns tan of a number.\r\n *\r\n * @param value Value\r\n * @return Sine\r\n */\r\nexport function tan(value) {\r\n return round(Math.tan(RADIANS * value), 10);\r\n}\r\n/**\r\n * Returns cosine of a number.\r\n *\r\n * @param value Value\r\n * @return Cosine\r\n */\r\nexport function cos(value) {\r\n return round(Math.cos(RADIANS * value), 10);\r\n}\r\nexport function max(left, right) {\r\n if ($type.isNumber(left)) {\r\n if ($type.isNumber(right)) {\r\n if (right > left) {\r\n return right;\r\n }\r\n else {\r\n return left;\r\n }\r\n }\r\n else {\r\n return left;\r\n }\r\n }\r\n else if ($type.isNumber(right)) {\r\n return right;\r\n }\r\n else {\r\n return null;\r\n }\r\n}\r\nexport function min(left, right) {\r\n if ($type.isNumber(left)) {\r\n if ($type.isNumber(right)) {\r\n if (right < left) {\r\n return right;\r\n }\r\n else {\r\n return left;\r\n }\r\n }\r\n else {\r\n return left;\r\n }\r\n }\r\n else if ($type.isNumber(right)) {\r\n return right;\r\n }\r\n else {\r\n return null;\r\n }\r\n}\r\n/**\r\n * Returns the closest value from the array of values to the reference value.\r\n *\r\n * @param values Array of values\r\n * @param value Reference value\r\n * @return Closes value from the array\r\n */\r\nexport function closest(values, referenceValue) {\r\n return values.reduce(function (prev, curr) {\r\n return (Math.abs(curr - referenceValue) < Math.abs(prev - referenceValue) ? curr : prev);\r\n });\r\n}\r\n/**\r\n * Checks whether two ranges of values intersect.\r\n *\r\n * @param range1 Range 1\r\n * @param range2 Range 2\r\n * @return Any intersecting numbers?\r\n */\r\nexport function intersect(range1, range2) {\r\n var start1 = $type.getValue(range1.start);\r\n var start2 = $type.getValue(range2.start);\r\n var end1 = $type.getValue(range1.end);\r\n var end2 = $type.getValue(range2.end);\r\n return Math.max(start1, start2) <= Math.min(end1, end2);\r\n}\r\n/**\r\n * Inverts the range of values.\r\n *\r\n * @param range Range\r\n */\r\nexport function invertRange(range) {\r\n var start = $type.getValue(range.start);\r\n var end = $type.getValue(range.end);\r\n return { start: 1 - end, end: 1 - start };\r\n}\r\n/**\r\n * Returns an intersection range between two ranges of values.\r\n *\r\n * @param range1 Range 1\r\n * @param range2 Range 2\r\n * @return Intersecting value range\r\n */\r\nexport function intersection(range1, range2) {\r\n var start1 = $type.getValue(range1.start);\r\n var start2 = $type.getValue(range2.start);\r\n var end1 = $type.getValue(range1.end);\r\n var end2 = $type.getValue(range2.end);\r\n var startMax = Math.max(start1, start2);\r\n var endMin = Math.min(end1, end2);\r\n if (endMin < startMax) {\r\n return undefined;\r\n }\r\n else {\r\n return { start: startMax, end: endMin };\r\n }\r\n}\r\n/**\r\n * Returns pixel \"distance\" between two points.\r\n *\r\n * If second point is not specified, distance from {x:0, y:0} point is\r\n * calculated.\r\n *\r\n * @param point1 Point 1\r\n * @param point2 Point 2\r\n * @return Distance in relative pixels\r\n */\r\nexport function getDistance(point1, point2) {\r\n if (!point1) {\r\n return 0;\r\n }\r\n if (!point2) {\r\n point2 = { x: 0, y: 0 };\r\n }\r\n return Math.sqrt(Math.pow(Math.abs(point1.x - point2.x), 2) + Math.pow(Math.abs(point1.y - point2.y), 2));\r\n}\r\n/**\r\n * Returns pixel \"horizontal distance\" between two points.\r\n *\r\n * If second point is not specified, distance from {x:0, y:0} point is\r\n * calculated.\r\n *\r\n * @param point1 Point 1\r\n * @param point2 Point 2\r\n * @return Distance in relative pixels\r\n */\r\nexport function getHorizontalDistance(point1, point2) {\r\n if (!point1) {\r\n return 0;\r\n }\r\n if (!point2) {\r\n point2 = { x: 0, y: 0 };\r\n }\r\n return Math.abs(point1.x - point2.x);\r\n}\r\n/**\r\n * Returns pixel \"vertical distance\" between two points.\r\n *\r\n * If second point is not specified, distance from {x:0, y:0} point is\r\n * calculated.\r\n *\r\n * @param point1 Point 1\r\n * @param point2 Point 2\r\n * @return Distance in relative pixels\r\n */\r\nexport function getVerticalDistance(point1, point2) {\r\n if (!point1) {\r\n return 0;\r\n }\r\n if (!point2) {\r\n point2 = { x: 0, y: 0 };\r\n }\r\n return Math.abs(point1.y - point2.y);\r\n}\r\n/**\r\n * Returns approximate pixel \"distance\" between two points of cubic curve\r\n *\r\n * If second point is not specified, distance from {x:0, y:0} point is\r\n * calculated.\r\n *\r\n * @param point1 Point 1\r\n * @param point2 Point 2\r\n * @param controlPointA Control Point 1\r\n * @param controlPointB Control Point 2\r\n * @param stepCount number of steps (the more, the more accurate result)\r\n * @return Distance in relative pixels\r\n */\r\nexport function getCubicCurveDistance(point1, point2, controlPointA, controlPointB, stepCount) {\r\n if (!point1) {\r\n return 0;\r\n }\r\n if (!point2) {\r\n point2 = { x: 0, y: 0 };\r\n }\r\n var distance = 0;\r\n var prevPoint = point1;\r\n if (stepCount > 0) {\r\n for (var s = 0; s <= stepCount; s++) {\r\n var point = getPointOnCubicCurve(point1, point2, controlPointA, controlPointB, s / stepCount);\r\n distance += getDistance(prevPoint, point);\r\n prevPoint = point;\r\n }\r\n }\r\n return distance;\r\n}\r\n/**\r\n * Returns scale based on original and end position of the two points.\r\n *\r\n * @param point1 Current position of point 1\r\n * @param startPoint1 Start position of point 1\r\n * @param point2 Current position of point 1\r\n * @param startPoint2 Start position of point 2\r\n * @return Scale Calculated scale\r\n */\r\nexport function getScale(point1, startPoint1, point2, startPoint2) {\r\n var initialDistance = getDistance(startPoint1, startPoint2);\r\n var currentDistance = getDistance(point1, point2);\r\n return Math.abs(currentDistance / initialDistance);\r\n}\r\n/**\r\n * Returns an exact mid point between two points.\r\n *\r\n * @param point1 Position of point 1\r\n * @param point2 Position of point 2\r\n * @return Mid point Position of mid-point\r\n */\r\nexport function getMidPoint(point1, point2, position) {\r\n if (!$type.isNumber(position)) {\r\n position = 0.5;\r\n }\r\n return {\r\n \"x\": (point1.x + (point2.x - point1.x) * position),\r\n \"y\": (point1.y + (point2.y - point1.y) * position)\r\n };\r\n}\r\n/**\r\n * Returns difference in angles between starting and ending position of two\r\n * vectors.\r\n *\r\n * @param point1 Current position of point 1\r\n * @param startPoint1 Start position of point 1\r\n * @param point2 Current position of point 1\r\n * @param startPoint2 Start position of point 2\r\n * @return Angle difference in degrees\r\n */\r\nexport function getRotation(point1, startPoint1, point2, startPoint2) {\r\n // Get start and end angles\r\n var startAngle = getAngle(startPoint1, startPoint2);\r\n var angle = getAngle(point1, point2);\r\n // Calculate angle\r\n var diff = startAngle - angle;\r\n if (diff < 0) {\r\n diff += 360;\r\n }\r\n return diff;\r\n}\r\n/**\r\n * Calculates angle of the vector based on two or one point.\r\n *\r\n * @param point1 Point 1\r\n * @param point2 Point 2\r\n * @return Angle in degrees\r\n */\r\nexport function getAngle(point1, point2) {\r\n if (!point2) {\r\n point2 = { x: point1.x * 2, y: point1.y * 2 };\r\n }\r\n var diffX = point2.x - point1.x;\r\n var diffY = point2.y - point1.y;\r\n var angle = Math.atan2(diffY, diffX) * DEGREES;\r\n if (angle < 0) {\r\n angle += 360;\r\n }\r\n return normalizeAngle(angle);\r\n}\r\n/**\r\n * Returns the shift in coordinates of the center when item is rotated, moved\r\n * and scaled at the same time.\r\n *\r\n * @param center Current center\r\n * @param point1 Frst reference point\r\n * @param startPoint1 Original position of the first reference point\r\n * @param point2 Second reference point\r\n * @param startPoint2 Original position of the first reference point\r\n * @return Shift in center point coordinates\r\n */\r\nexport function getCenterShift(center, point1, startPoint1, point2, startPoint2) {\r\n // Get angle\r\n var angle = getRotation(point1, startPoint1, point2, startPoint2) - 90;\r\n if (angle < 0) {\r\n angle += 360;\r\n }\r\n // Get distance between new position\r\n var distance = getDistance(point1, point2);\r\n // Calculate new X\r\n var x = Math.cos(angle) / distance + point1.x;\r\n var y = Math.cos(angle) / distance + point1.y;\r\n var shift = {\r\n \"x\": x - center.x,\r\n \"y\": y - center.y\r\n };\r\n return shift;\r\n}\r\n/**\r\n * Converts an array of points into a bounding box rectangle.\r\n *\r\n * Array can contain any number of points.\r\n *\r\n * @param points Points\r\n * @return Bounding box rectangle\r\n */\r\nexport function getBBox(points) {\r\n if (points) {\r\n var length_1 = points.length;\r\n if (length_1 !== 0) {\r\n var left = void 0;\r\n var right = void 0;\r\n var top_1;\r\n var bottom = void 0;\r\n for (var i = 0; i < length_1; i++) {\r\n var point = points[i];\r\n if (!$type.isNumber(right) || (point.x > right)) {\r\n right = point.x;\r\n }\r\n if (!$type.isNumber(left) || (point.x < left)) {\r\n left = point.x;\r\n }\r\n if (!$type.isNumber(top_1) || (point.y < top_1)) {\r\n top_1 = point.y;\r\n }\r\n if (!$type.isNumber(bottom) || (point.y > bottom)) {\r\n bottom = point.y;\r\n }\r\n }\r\n return { x: left, y: top_1, width: right - left, height: bottom - top_1 };\r\n }\r\n }\r\n return { x: 0, y: 0, width: 0, height: 0 };\r\n}\r\n/**\r\n * Returns a [[IRectangle]] object representing a common rectangle that fits\r\n * all passed in rectangles in it.\r\n *\r\n * @param rectangles An array of rectangles\r\n * @return Common rectangle\r\n */\r\nexport function getCommonRectangle(rectangles) {\r\n var length = rectangles.length;\r\n if (length !== 0) {\r\n var minX = void 0;\r\n var minY = void 0;\r\n var maxX = void 0;\r\n var maxY = void 0;\r\n for (var i = 0; i < length; i++) {\r\n var rectangle = rectangles[i];\r\n minX = min(rectangle.x, minX);\r\n minY = min(rectangle.y, minY);\r\n maxX = max(rectangle.x + rectangle.width, maxX);\r\n maxY = max(rectangle.y + rectangle.height, maxY);\r\n }\r\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\r\n }\r\n}\r\n/**\r\n * [getPointOnQuadraticCurve description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param pointA [description]\r\n * @param pointB [description]\r\n * @param controlPoint [description]\r\n * @param position [description]\r\n * @return [description]\r\n */\r\nexport function getPointOnQuadraticCurve(pointA, pointB, controlPoint, position) {\r\n var x = (1 - position) * (1 - position) * pointA.x + 2 * (1 - position) * position * controlPoint.x + position * position * pointB.x;\r\n var y = (1 - position) * (1 - position) * pointA.y + 2 * (1 - position) * position * controlPoint.y + position * position * pointB.y;\r\n return { x: x, y: y };\r\n}\r\n/**\r\n * [getPointOnCubicCurve description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param pointA [description]\r\n * @param pointB [description]\r\n * @param controlPointA [description]\r\n * @param controlPointB [description]\r\n * @param position [description]\r\n * @return [description]\r\n */\r\nexport function getPointOnCubicCurve(pointA, pointB, controlPointA, controlPointB, position) {\r\n var point = { x: 0, y: 0 };\r\n var mt1 = 1 - position;\r\n var mt2 = mt1 * mt1;\r\n var mt3 = mt2 * mt1;\r\n point.x = pointA.x * mt3 + controlPointA.x * 3 * mt2 * position + controlPointB.x * 3 * mt1 * position * position + pointB.x * position * position * position;\r\n point.y = pointA.y * mt3 + controlPointA.y * 3 * mt2 * position + controlPointB.y * 3 * mt1 * position * position + pointB.y * position * position * position;\r\n return point;\r\n}\r\n/**\r\n * [getCubicControlPointA description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param p0 [description]\r\n * @param p1 [description]\r\n * @param p2 [description]\r\n * @param p3 [description]\r\n * @param tensionX [description]\r\n * @param tensionY [description]\r\n * @return [description]\r\n */\r\nexport function getCubicControlPointA(p0, p1, p2, p3, tensionX, tensionY) {\r\n tensionX = adjustTension(tensionX);\r\n tensionY = adjustTension(tensionY);\r\n return { x: ((-p0.x + p1.x / tensionX + p2.x) * tensionX), y: ((-p0.y + p1.y / tensionY + p2.y) * tensionY) };\r\n}\r\n/**\r\n * [getCubicControlPointB description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param p0 [description]\r\n * @param p1 [description]\r\n * @param p2 [description]\r\n * @param p3 [description]\r\n * @param tensionX [description]\r\n * @param tensionY [description]\r\n * @return [description]\r\n */\r\nexport function getCubicControlPointB(p0, p1, p2, p3, tensionX, tensionY) {\r\n tensionX = adjustTension(tensionX);\r\n tensionY = adjustTension(tensionY);\r\n return { x: ((p1.x + p2.x / tensionX - p3.x) * tensionX), y: ((p1.y + p2.y / tensionY - p3.y) * tensionY) };\r\n}\r\n/**\r\n * [adjustTension description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param tension [description]\r\n * @return [description]\r\n */\r\nexport function adjustTension(tension) {\r\n return 1 - tension + 0.00001;\r\n}\r\n/**\r\n * [normalizeAngle description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @param value [description]\r\n * @return [description]\r\n */\r\nexport function normalizeAngle(value) {\r\n if (value == 360) {\r\n return 360;\r\n }\r\n return value % 360;\r\n}\r\n/**\r\n * [normalizeAngleToRange description]\r\n *\r\n * @ignore Exclude from docs\r\n * @todo Description\r\n * @todo review this with various angles, can be tested on radar chart with custom start/end angles\r\n * @param value [description]\r\n * @param startAngle [description]\r\n * @param endAngle [description]\r\n * @return [description]\r\n */\r\nexport function fitAngleToRange(value, startAngle, endAngle) {\r\n if (startAngle > endAngle) {\r\n var temp = startAngle;\r\n startAngle = endAngle;\r\n endAngle = temp;\r\n }\r\n value = normalizeAngle(value);\r\n var count = (startAngle - normalizeAngle(startAngle)) / 360;\r\n if (value < startAngle) {\r\n value += 360 * (count + 1);\r\n }\r\n var maxEnd = startAngle + (endAngle - startAngle) / 2 + 180;\r\n var maxStart = startAngle + (endAngle - startAngle) / 2 - 180;\r\n if (value > endAngle) {\r\n if (value - 360 > startAngle) {\r\n value -= 360;\r\n }\r\n else {\r\n if (value < maxEnd) {\r\n value = endAngle;\r\n }\r\n else {\r\n value = startAngle;\r\n }\r\n }\r\n }\r\n if (value < startAngle) {\r\n if (value > maxStart) {\r\n value = startAngle;\r\n }\r\n else {\r\n value = endAngle;\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * Returns [[IRectangle]] of an arc in relative values, assuming that the\r\n * center is at the circle center.\r\n *\r\n * Used to find out max radius of an arc.\r\n *\r\n * @ignore Exclude from docs\r\n * @param startAngle Start angle\r\n * @param endAngle End angle\r\n * @param radius \t Relative radius\r\n * @return Rectangle\r\n */\r\nexport function getArcRect(startAngle, endAngle, radius) {\r\n var minX = Number.MAX_VALUE;\r\n var minY = Number.MAX_VALUE;\r\n var maxX = -Number.MAX_VALUE;\r\n var maxY = -Number.MAX_VALUE;\r\n var bpoints = [];\r\n if (!$type.isNumber(radius)) {\r\n radius = 1;\r\n }\r\n bpoints.push(getArcPoint(radius, startAngle));\r\n bpoints.push(getArcPoint(radius, endAngle));\r\n var fromAngle = Math.min(Math.floor(startAngle / 90) * 90, Math.floor(endAngle / 90) * 90);\r\n var toAngle = Math.max(Math.ceil(startAngle / 90) * 90, Math.ceil(endAngle / 90) * 90);\r\n for (var angle = fromAngle; angle <= toAngle; angle += 90) {\r\n if (angle >= startAngle && angle <= endAngle) {\r\n bpoints.push(getArcPoint(radius, angle));\r\n }\r\n }\r\n for (var i = 0; i < bpoints.length; i++) {\r\n var pt = bpoints[i];\r\n if (pt.x < minX) {\r\n minX = pt.x;\r\n }\r\n if (pt.y < minY) {\r\n minY = pt.y;\r\n }\r\n if (pt.x > maxX) {\r\n maxX = pt.x;\r\n }\r\n if (pt.y > maxY) {\r\n maxY = pt.y;\r\n }\r\n }\r\n return ({ x: minX, y: minY, width: maxX - minX, height: maxY - minY });\r\n}\r\n/**\r\n * Returns point on arc\r\n *\r\n * @param center point\r\n * @param radius\r\n * @param arc\r\n * @return {boolean}\r\n */\r\nexport function getArcPoint(radius, arc) {\r\n return ({ x: radius * cos(arc), y: radius * sin(arc) });\r\n}\r\n/**\r\n * Returns true if a point is within rectangle\r\n *\r\n * @param point\r\n * @param rectangle\r\n * @return {boolean}\r\n */\r\nexport function isInRectangle(point, rectangle) {\r\n if (point.x >= rectangle.x && point.x <= rectangle.x + rectangle.width && point.y >= rectangle.y && point.y <= rectangle.y + rectangle.height) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nexport function getLineIntersection(pointA1, pointA2, pointB1, pointB2) {\r\n var x = ((pointA1.x * pointA2.y - pointA2.x * pointA1.y) * (pointB1.x - pointB2.x) - (pointA1.x - pointA2.x) * (pointB1.x * pointB2.y - pointB1.y * pointB2.x)) / ((pointA1.x - pointA2.x) * (pointB1.y - pointB2.y) - (pointA1.y - pointA2.y) * (pointB1.x - pointB2.x));\r\n var y = ((pointA1.x * pointA2.y - pointA2.x * pointA1.y) * (pointB1.y - pointB2.y) - (pointA1.y - pointA2.y) * (pointB1.x * pointB2.y - pointB1.y * pointB2.x)) / ((pointA1.x - pointA2.x) * (pointB1.y - pointB2.y) - (pointA1.y - pointA2.y) * (pointB1.x - pointB2.x));\r\n return { x: x, y: y };\r\n}\r\n//# sourceMappingURL=Math.js.map","/**\r\n * Event Dispatcher module is used for registering listeners and dispatching\r\n * events across amCharts system.\r\n */\r\nimport { __extends } from \"tslib\";\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Disposer } from \"./Disposer\";\r\nimport * as $array from \"./Array\";\r\nimport * as $async from \"./AsyncPending\";\r\nimport * as $type from \"./Type\";\r\n/*export interface IEventDispatcher {\r\n isDisposed(): boolean;\r\n dispose(): void;\r\n hasListeners(): boolean;\r\n enable(): void;\r\n disable(): void;\r\n enableType(type: Key): void;\r\n disableType(type: Key, amount?: number): void;\r\n isEnabled(type: Key): boolean;\r\n has(type: Key, callback?: (this: C, event: T[Key]) => void, context?: C): boolean;\r\n dispatchImmediately(type: Key, event: T[Key]): void;\r\n dispatch(type: Key, event: T[Key]): void;\r\n onAll(callback: (this: C, type: Key, event: T[Key]) => void, context?: C): IDisposer;\r\n on(type: Key, callback: (this: C, event: T[Key]) => void, context?: C): IDisposer;\r\n once(type: Key, callback: (this: C, event: T[Key]) => void, context?: C): IDisposer;\r\n off(type: Key, callback: (this: C, event: T[Key]) => void, context?: C): void;\r\n off(type: Key, callback: (this: C, event: T[Key]) => void, context?: C): void;\r\n copyFrom(source: this): void;\r\n}*/\r\n/**\r\n * Universal Event Dispatcher.\r\n *\r\n * @important\r\n */\r\nvar EventDispatcher = /** @class */ (function () {\r\n /**\r\n * Constructor\r\n */\r\n function EventDispatcher() {\r\n this._listeners = [];\r\n this._killed = [];\r\n this._disabled = {};\r\n this._iterating = 0;\r\n this._enabled = true;\r\n this._disposed = false;\r\n }\r\n /**\r\n * Returns if this object has been already disposed.\r\n *\r\n * @return Disposed?\r\n */\r\n EventDispatcher.prototype.isDisposed = function () {\r\n return this._disposed;\r\n };\r\n /**\r\n * Dispose (destroy) this object.\r\n */\r\n EventDispatcher.prototype.dispose = function () {\r\n if (!this._disposed) {\r\n this._disposed = true;\r\n var a = this._listeners;\r\n this._iterating = 1;\r\n this._listeners = null;\r\n this._disabled = null;\r\n try {\r\n $array.each(a, function (x) {\r\n x.disposer.dispose();\r\n });\r\n }\r\n finally {\r\n this._killed = null;\r\n this._iterating = null;\r\n }\r\n }\r\n };\r\n /**\r\n * Checks if this particular event dispatcher has any listeners set.\r\n *\r\n * @return Has listeners?\r\n */\r\n EventDispatcher.prototype.hasListeners = function () {\r\n return this._listeners.length !== 0;\r\n };\r\n /**\r\n * Checks if this particular event dispatcher has any particular listeners set.\r\n *\r\n * @return Has particular event listeners?\r\n */\r\n EventDispatcher.prototype.hasListenersByType = function (type) {\r\n return $array.any(this._listeners, function (x) { return (x.type === null || x.type === type) && !x.killed; });\r\n };\r\n /**\r\n * Enable dispatching of events if they were previously disabled by\r\n * `disable()`.\r\n */\r\n EventDispatcher.prototype.enable = function () {\r\n this._enabled = true;\r\n };\r\n /**\r\n * Disable dispatching of events until re-enabled by `enable()`.\r\n */\r\n EventDispatcher.prototype.disable = function () {\r\n this._enabled = false;\r\n };\r\n /**\r\n * Enable dispatching particular event, if it was disabled before by\r\n * `disableType()`.\r\n *\r\n * @param type Event type\r\n */\r\n EventDispatcher.prototype.enableType = function (type) {\r\n delete this._disabled[type];\r\n };\r\n /**\r\n * Disable dispatching of events for a certain event type.\r\n *\r\n * Optionally, can set how many dispatches to skip before automatically\r\n * re-enabling the dispatching.\r\n *\r\n * @param type Event type\r\n * @param amount Number of event dispatches to skip\r\n */\r\n EventDispatcher.prototype.disableType = function (type, amount) {\r\n if (amount === void 0) { amount = Infinity; }\r\n this._disabled[type] = amount;\r\n };\r\n /**\r\n * Removes listener from dispatcher.\r\n *\r\n * Will throw an exception if such listener does not exists.\r\n *\r\n * @param listener Listener to remove\r\n */\r\n EventDispatcher.prototype._removeListener = function (listener) {\r\n if (this._iterating === 0) {\r\n var index = this._listeners.indexOf(listener);\r\n if (index === -1) {\r\n throw new Error(\"Invalid state: could not remove listener\");\r\n }\r\n this._listeners.splice(index, 1);\r\n }\r\n else {\r\n this._killed.push(listener);\r\n }\r\n };\r\n /**\r\n * Removes existing listener by certain parameters.\r\n *\r\n * @param once Listener's once setting\r\n * @param type Listener's type\r\n * @param callback Callback function\r\n * @param context Callback context\r\n */\r\n EventDispatcher.prototype._removeExistingListener = function (once, type, callback, context) {\r\n if (this._disposed) {\r\n throw new Error(\"EventDispatcher is disposed\");\r\n }\r\n this._eachListener(function (info) {\r\n if (info.once === once && // TODO is this correct ?\r\n info.type === type &&\r\n (callback == null || info.callback === callback) &&\r\n info.context === context) {\r\n info.disposer.dispose();\r\n }\r\n });\r\n };\r\n /**\r\n * Checks if dispatching for particular event type is enabled.\r\n *\r\n * @param type Event type\r\n * @return Enabled?\r\n */\r\n EventDispatcher.prototype.isEnabled = function (type) {\r\n if (this._disposed) {\r\n throw new Error(\"EventDispatcher is disposed\");\r\n }\r\n // TODO is this check correct ?\r\n return this._enabled && this._listeners.length > 0 && this.hasListenersByType(type) && this._disabled[type] == null;\r\n };\r\n /**\r\n * Checks if there's already a listener with specific parameters.\r\n *\r\n * @param type Listener's type\r\n * @param callback Callback function\r\n * @param context Callback context\r\n * @return Has listener?\r\n */\r\n EventDispatcher.prototype.has = function (type, callback, context) {\r\n var index = $array.findIndex(this._listeners, function (info) {\r\n return info.once !== true && // Ignoring \"once\" listeners\r\n info.type === type &&\r\n (callback == null || info.callback === callback) &&\r\n info.context === context;\r\n });\r\n return index !== -1;\r\n };\r\n /**\r\n * Checks whether event of the particular type should be dispatched.\r\n *\r\n * @param type Event type\r\n * @return Dispatch?\r\n */\r\n EventDispatcher.prototype._shouldDispatch = function (type) {\r\n if (this._disposed) {\r\n throw new Error(\"EventDispatcher is disposed\");\r\n }\r\n var count = this._disabled[type];\r\n if (!$type.isNumber(count)) {\r\n return this._enabled;\r\n }\r\n else {\r\n if (count <= 1) {\r\n delete this._disabled[type];\r\n }\r\n else {\r\n --this._disabled[type];\r\n }\r\n return false;\r\n }\r\n };\r\n /**\r\n * [_eachListener description]\r\n *\r\n * All of this extra code is needed when a listener is removed while iterating\r\n *\r\n * @todo Description\r\n * @param fn [description]\r\n */\r\n EventDispatcher.prototype._eachListener = function (fn) {\r\n var _this = this;\r\n ++this._iterating;\r\n try {\r\n $array.each(this._listeners, fn);\r\n }\r\n finally {\r\n --this._iterating;\r\n // TODO should this be inside or outside the finally ?\r\n if (this._iterating === 0 && this._killed.length !== 0) {\r\n // Remove killed listeners\r\n $array.each(this._killed, function (killed) {\r\n _this._removeListener(killed);\r\n });\r\n this._killed.length = 0;\r\n }\r\n }\r\n };\r\n /**\r\n * Dispatches an event immediately without waiting for next cycle.\r\n *\r\n * @param type Event type\r\n * @param event Event object\r\n * @todo automatically add in type and target properties if they are missing\r\n */\r\n EventDispatcher.prototype.dispatchImmediately = function (type, event) {\r\n if (this._shouldDispatch(type)) {\r\n // TODO check if it's faster to use an object of listeners rather than a single big array\r\n // TODO if the function throws, maybe it should keep going ?\r\n this._eachListener(function (listener) {\r\n if (!listener.killed && (listener.type === null || listener.type === type)) {\r\n listener.dispatch(type, event);\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Shelves the event to be dispatched within next update cycle.\r\n *\r\n * @param type Event type\r\n * @param event Event object\r\n * @todo automatically add in type and target properties if they are missing\r\n */\r\n EventDispatcher.prototype.dispatch = function (type, event) {\r\n if (this._shouldDispatch(type)) {\r\n this._eachListener(function (listener) {\r\n // TODO check if it's faster to use an object of listeners rather than a single big array\r\n if (!listener.killed && (listener.type === null || listener.type === type)) {\r\n // TODO if the function throws, maybe it should keep going ?\r\n // TODO dispatch during the update cycle, rather than using whenIdle\r\n $async.whenIdle(function () {\r\n if (!listener.killed) {\r\n listener.dispatch(type, event);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n };\r\n /**\r\n * Creates, catalogs and returns an [[EventListener]].\r\n *\r\n * Event listener can be disposed.\r\n *\r\n * @param once Listener's once setting\r\n * @param type Listener's type\r\n * @param callback Callback function\r\n * @param context Callback context\r\n * @param shouldClone Whether the listener should be copied when the EventDispatcher is copied\r\n * @param dispatch\r\n * @returns An event listener\r\n */\r\n EventDispatcher.prototype._on = function (once, type, callback, context, shouldClone, dispatch) {\r\n var _this = this;\r\n if (this._disposed) {\r\n throw new Error(\"EventDispatcher is disposed\");\r\n }\r\n this._removeExistingListener(once, type, callback, context);\r\n var info = {\r\n type: type,\r\n callback: callback,\r\n context: context,\r\n shouldClone: shouldClone,\r\n dispatch: dispatch,\r\n killed: false,\r\n once: once,\r\n disposer: new Disposer(function () {\r\n info.killed = true;\r\n _this._removeListener(info);\r\n })\r\n };\r\n this._listeners.push(info);\r\n return info;\r\n };\r\n /**\r\n * Creates an event listener to be invoked on **any** event.\r\n *\r\n * @param callback Callback function\r\n * @param context Callback context\r\n * @param shouldClone Whether the listener should be copied when the EventDispatcher is copied\r\n * @returns A disposable event listener\r\n * @todo what if `listen` is called on the same function twice ?\r\n */\r\n EventDispatcher.prototype.onAll = function (callback, context, shouldClone) {\r\n if (shouldClone === void 0) { shouldClone = true; }\r\n return this._on(false, null, callback, context, shouldClone, function (type, event) { return callback.call(context, type, event); }).disposer;\r\n };\r\n /**\r\n * Creates an event listener to be invoked on a specific event type.\r\n *\r\n * ```TypeScript\r\n * series.events.on(\"hidden\", (ev) => {\r\n * console.log(\"Series hidden: \" + ev.target.name);\r\n * }, this);\r\n * ```\r\n * ```JavaScript\r\n * series.events.on(\"hidden\", function(ev) {\r\n * console.log(\"Series hidden: \" + ev.target.name);\r\n * }, this);\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"events\": {\r\n * \t\"hidden\": function(ev) {\r\n * \t console.log(\"Series hidden: \" + ev.target.name);\r\n * \t}\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * The above will invoke our custom event handler whenever series we put\r\n * event on is hidden.\r\n *\r\n * @param type Listener's type\r\n * @param callback Callback function\r\n * @param context Callback context\r\n * @param shouldClone Whether the listener should be copied when the EventDispatcher is copied\r\n * @returns A disposable event listener\r\n * @todo what if `listen` is called on the same function twice ?\r\n */\r\n EventDispatcher.prototype.on = function (type, callback, context, shouldClone) {\r\n if (shouldClone === void 0) { shouldClone = true; }\r\n return this._on(false, type, callback, context, shouldClone, function (type, event) { return callback.call(context, event); }).disposer;\r\n };\r\n /**\r\n * Creates an event listener to be invoked on a specific event type once.\r\n *\r\n * Once the event listener is invoked, it is automatically disposed.\r\n *\r\n * ```TypeScript\r\n * series.events.on(\"hidden\", (ev) => {\r\n * console.log(\"Series hidden: \" + ev.target.name);\r\n * }, this);\r\n * ```\r\n * ```JavaScript\r\n * series.events.on(\"hidden\", function(ev) {\r\n * console.log(\"Series hidden: \" + ev.target.name);\r\n * }, this);\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"series\": [{\r\n * // ...\r\n * \"events\": {\r\n * \t\"hidden\": function(ev) {\r\n * \t console.log(\"Series hidden: \" + ev.target.name);\r\n * \t}\r\n * }\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * The above will invoke our custom event handler the first time series we\r\n * put event on is hidden.\r\n *\r\n * @param type Listener's type\r\n * @param callback Callback function\r\n * @param context Callback context\r\n * @param shouldClone Whether the listener should be copied when the EventDispatcher is copied\r\n * @returns A disposable event listener\r\n * @todo what if `listen` is called on the same function twice ?\r\n */\r\n EventDispatcher.prototype.once = function (type, callback, context, shouldClone) {\r\n if (shouldClone === void 0) { shouldClone = true; }\r\n var x = this._on(true, type, callback, context, shouldClone, function (type, event) {\r\n x.disposer.dispose();\r\n callback.call(context, event);\r\n });\r\n // TODO maybe this should return a different Disposer ?\r\n return x.disposer;\r\n };\r\n /**\r\n * Removes the event listener with specific parameters.\r\n *\r\n * @param type Listener's type\r\n * @param callback Callback function\r\n * @param context Callback context\r\n */\r\n EventDispatcher.prototype.off = function (type, callback, context) {\r\n this._removeExistingListener(false, type, callback, context);\r\n };\r\n /**\r\n * Copies all dispatcher parameters, including listeners, from another event\r\n * dispatcher.\r\n *\r\n * @param source Source event dispatcher\r\n */\r\n EventDispatcher.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n if (this._disposed) {\r\n throw new Error(\"EventDispatcher is disposed\");\r\n }\r\n if (source === this) {\r\n throw new Error(\"Cannot copyFrom the same TargetedEventDispatcher\");\r\n }\r\n $array.each(source._listeners, function (x) {\r\n // TODO is this correct ?\r\n if (!x.killed && x.shouldClone) {\r\n if (x.type === null) {\r\n _this.onAll(x.callback, x.context);\r\n }\r\n else if (x.once) {\r\n _this.once(x.type, x.callback, x.context);\r\n }\r\n else {\r\n _this.on(x.type, x.callback, x.context);\r\n }\r\n }\r\n });\r\n };\r\n return EventDispatcher;\r\n}());\r\nexport { EventDispatcher };\r\n/**\r\n * A version of the [[EventDispatcher]] that dispatches events for a specific\r\n * target object.\r\n *\r\n * @important\r\n */\r\nvar TargetedEventDispatcher = /** @class */ (function (_super) {\r\n __extends(TargetedEventDispatcher, _super);\r\n /**\r\n * Constructor\r\n *\r\n * @param target Event dispatcher target\r\n */\r\n function TargetedEventDispatcher(target) {\r\n var _this = _super.call(this) || this;\r\n _this.target = target;\r\n return _this;\r\n }\r\n /**\r\n * Copies all dispatcher parameters, including listeners, from another event\r\n * dispatcher.\r\n *\r\n * @param source Source event dispatcher\r\n */\r\n TargetedEventDispatcher.prototype.copyFrom = function (source) {\r\n var _this = this;\r\n if (this._disposed) {\r\n throw new Error(\"EventDispatcher is disposed\");\r\n }\r\n if (source === this) {\r\n throw new Error(\"Cannot copyFrom the same TargetedEventDispatcher\");\r\n }\r\n $array.each(source._listeners, function (x) {\r\n // TODO very hacky\r\n if (x.context === source.target) {\r\n return;\r\n }\r\n // TODO is this correct ?\r\n if (!x.killed && x.shouldClone) {\r\n if (x.type === null) {\r\n _this.onAll(x.callback, x.context);\r\n }\r\n else if (x.once) {\r\n _this.once(x.type, x.callback, x.context);\r\n }\r\n else {\r\n _this.on(x.type, x.callback, x.context);\r\n }\r\n }\r\n });\r\n };\r\n return TargetedEventDispatcher;\r\n}(EventDispatcher));\r\nexport { TargetedEventDispatcher };\r\n//# sourceMappingURL=EventDispatcher.js.map","/**\r\n * A collection of easing functions\r\n *\r\n * Parts of this collection are taken from D3.js library (https://d3js.org/)\r\n */\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport * as $math from \"../utils/Math\";\r\nimport { registry } from \"../Registry\";\r\n/**\r\n * The functions 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 * @hidden\r\n */\r\n/**\r\n * ============================================================================\r\n * LINEAR FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Easing function: \"linear\".\r\n */\r\nexport function linear(t) {\r\n return +t;\r\n}\r\nregistry.registeredClasses[\"ease.linear\"] = linear;\r\n/**\r\n * Easing function: \"quadIn\".\r\n */\r\nexport function quadIn(t) {\r\n return t * t;\r\n}\r\nregistry.registeredClasses[\"ease.quadIn\"] = quadIn;\r\n/**\r\n * Easing function: \"quadOut\".\r\n */\r\nexport function quadOut(t) {\r\n return t * (2 - t);\r\n}\r\nregistry.registeredClasses[\"ease.quadOut\"] = quadOut;\r\n/**\r\n * Easing function: \"quadInOut\".\r\n */\r\nexport function quadInOut(t) {\r\n t *= 2;\r\n return (t <= 1 ? t * t : --t * (2 - t) + 1) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.quadInOut\"] = quadInOut;\r\n/**\r\n * Easing function: \"polyIn\".\r\n */\r\nexport function polyIn(t, e) {\r\n return Math.pow(t, e);\r\n}\r\nregistry.registeredClasses[\"ease.polyIn\"] = polyIn;\r\n/**\r\n * Easing function: \"polyOut\".\r\n */\r\nexport function polyOut(t, e) {\r\n return 1 - Math.pow(1 - t, e);\r\n}\r\nregistry.registeredClasses[\"ease.polyOut\"] = polyOut;\r\n/**\r\n * Easing function: \"polyInOut\".\r\n */\r\nexport function polyInOut(t, e) {\r\n t *= 2;\r\n return (t <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.polyInOut\"] = polyInOut;\r\n/**\r\n * Easing function: \"polyIn3\".\r\n */\r\nexport function polyIn3(t) {\r\n return polyIn(t, 3);\r\n}\r\nregistry.registeredClasses[\"ease.polyIn3\"] = polyIn3;\r\n/**\r\n * Easing function: \"polyOut3\".\r\n */\r\nexport function polyOut3(t) {\r\n return polyOut(t, 3);\r\n}\r\nregistry.registeredClasses[\"ease.polyOut3\"] = polyOut3;\r\n/**\r\n * Easing function: \"polyInOut3\".\r\n */\r\nexport function polyInOut3(t) {\r\n return polyInOut(t, 3);\r\n}\r\nregistry.registeredClasses[\"ease.polyInOut3\"] = polyInOut3;\r\n/**\r\n * ============================================================================\r\n * EXPONENTIAL FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Easing function: \"expIn\".\r\n */\r\nexport function expIn(t) {\r\n return Math.pow(2, 10 * t - 10);\r\n}\r\nregistry.registeredClasses[\"ease.expIn\"] = expIn;\r\n/**\r\n * Easing function: \"expOut\".\r\n */\r\nexport function expOut(t) {\r\n return 1 - Math.pow(2, -10 * t);\r\n}\r\nregistry.registeredClasses[\"ease.expOut\"] = expOut;\r\n/**\r\n * Easing function: \"expInOut\".\r\n */\r\nexport function expInOut(t) {\r\n t *= 2;\r\n return (t <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.expInOut\"] = expInOut;\r\n/**\r\n * ============================================================================\r\n * SINE FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Easing function: \"sinIn\".\r\n */\r\nexport function sinIn(t) {\r\n return 1 - Math.cos(t * $math.HALFPI);\r\n}\r\nregistry.registeredClasses[\"ease.sinIn\"] = sinIn;\r\n/**\r\n * Easing function: \"sinOut\".\r\n */\r\nexport function sinOut(t) {\r\n return Math.sin(t * $math.HALFPI);\r\n}\r\nregistry.registeredClasses[\"ease.sinOut\"] = sinOut;\r\n/**\r\n * Easing function: \"sinInOut\".\r\n */\r\nexport function sinInOut(t) {\r\n return (1 - Math.cos($math.PI * t)) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.sinInOut\"] = sinInOut;\r\n/**\r\n * ============================================================================\r\n * CUBIC FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Easing function: \"cubicIn\".\r\n */\r\nexport function cubicIn(t) {\r\n return t * t * t;\r\n}\r\nregistry.registeredClasses[\"ease.cubicIn\"] = cubicIn;\r\n/**\r\n * Easing function: \"cubicOut\".\r\n */\r\nexport function cubicOut(t) {\r\n return --t * t * t + 1;\r\n}\r\nregistry.registeredClasses[\"ease.cubicOut\"] = cubicOut;\r\n/**\r\n * Easing function: \"cubicInOut\".\r\n */\r\nexport function cubicInOut(t) {\r\n t *= 2;\r\n return (t <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.cubicInOut\"] = cubicInOut;\r\n/**\r\n * ============================================================================\r\n * CIRCLE FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n/**\r\n * Easing function: \"circleIn\".\r\n */\r\nexport function circleIn(t) {\r\n return 1 - Math.sqrt(1 - t * t);\r\n}\r\nregistry.registeredClasses[\"ease.circleIn\"] = circleIn;\r\n/**\r\n * Easing function: \"circleOut\".\r\n */\r\nexport function circleOut(t) {\r\n return Math.sqrt(1 - --t * t);\r\n}\r\nregistry.registeredClasses[\"ease.circleOut\"] = circleOut;\r\n/**\r\n * Easing function: \"circleInOut\".\r\n */\r\nexport function circleInOut(t) {\r\n t *= 2;\r\n return (t <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.circleInOut\"] = circleInOut;\r\n/**\r\n * ============================================================================\r\n * BOUNCE FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nvar b1 = 4 / 11, b2 = 6 / 11, b3 = 8 / 11, b4 = 3 / 4, b5 = 9 / 11, b6 = 10 / 11, b7 = 15 / 16, b8 = 21 / 22, b9 = 63 / 64, b0 = 1 / b1 / b1;\r\n/**\r\n * Easing function: \"bounceIn\".\r\n */\r\nexport function bounceIn(t) {\r\n return 1 - bounceOut(1 - t);\r\n}\r\nregistry.registeredClasses[\"ease.bounceIn\"] = bounceIn;\r\n/**\r\n * Easing function: \"bounceOut\".\r\n */\r\nexport function bounceOut(t) {\r\n t = +t;\r\n return t < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;\r\n}\r\nregistry.registeredClasses[\"ease.bounceOut\"] = bounceOut;\r\n/**\r\n * Easing function: \"bounceInOut\".\r\n */\r\nexport function bounceInOut(t) {\r\n t *= 2;\r\n return (t <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.bounceInOut\"] = bounceInOut;\r\n/**\r\n * ============================================================================\r\n * ELASTIC FUNCTIONS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nvar tau = 2 * Math.PI;\r\nvar amplitude = 1;\r\nvar period = 0.3 / tau;\r\nvar s = Math.asin(1 / amplitude) * period;\r\n/**\r\n * Easing function: \"elasticIn\".\r\n *\r\n * @function elasticIn\r\n * @param a Amplitude\r\n * @param p period\r\n */\r\nexport function elasticIn(t) {\r\n return amplitude * Math.pow(2, 10 * --t) * Math.sin((s - t) / period);\r\n}\r\nregistry.registeredClasses[\"ease.elasticIn\"] = elasticIn;\r\n/**\r\n * Easing function: \"elasticOut\".\r\n *\r\n * @function elasticOut\r\n * @param a Amplitude\r\n * @param p period\r\n */\r\nexport function elasticOut(t) {\r\n return 1 - amplitude * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / period);\r\n}\r\nregistry.registeredClasses[\"ease.elasticOut\"] = elasticOut;\r\n/**\r\n * Easing function: \"elasticInOut\".\r\n *\r\n * @function elasticInOut\r\n * @param a Amplitude\r\n * @param p period\r\n */\r\nexport function elasticInOut(t) {\r\n t = t * 2 - 1;\r\n return (t < 0\r\n ? amplitude * Math.pow(2, 10 * t) * Math.sin((s - t) / period)\r\n : 2 - amplitude * Math.pow(2, -10 * t) * Math.sin((s + t) / period)) / 2;\r\n}\r\nregistry.registeredClasses[\"ease.elasticInOut\"] = elasticInOut;\r\n//# sourceMappingURL=Ease.js.map"],"sourceRoot":""}