{"version":3,"sources":["polyfills.js"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","s","el","this","parentElement","parentNode","nodeType","window","NodeList","forEach","Array","CharacterData","DocumentType","item","hasOwnProperty","Object","defineProperty","configurable","enumerable","writable","value","removeChild","currentNode","parent","i","arguments","length","ownerDocument","createTextNode","insertBefore","previousSibling","replaceChild","includes","searchElement","fromIndex","o","len","x","y","n","k","Math","max","abs","isNaN","from","isCallable","fn","toStr","call","toLength","number","Number","isFinite","floor","toInteger","min","maxSafeInteger","toString","pow","arrayLike","items","TypeError","t","mapFn","kValue","a","mutationObserver","callBack","MutationObserver","undefined","observe","element","interval","setInterval","self","html","innerHTML","oldHtml","apply","disconnect","clearInterval","global","resolve","NativePromise","nativePromiseSupported","r","exports","Promise","Polyfill","define","amd","NOOP","PENDING","SEALED","FULFILLED","REJECTED","isArray","asyncTimer","asyncSetTimer","setImmediate","setTimeout","asyncQueue","asyncFlush","asyncCall","callback","arg","push","invokeCallback","subscriber","owner","settled","state_","data_","promise","then","e","reject","handleThenable","resolved","val","fulfill","reason","publishFulfillment","publishRejection","publish","callbacks","then_","resolver","rejectPromise","invokeResolver","onFulfillment","onRejection","fulfilled","rejected","catch","all","promises","results","remaining","index","race"],"mappings":"AAAA,aAEA,SAASA,QAAQC,GAAwT,OAAtOD,QAArD,mBAAXE,QAAoD,iBAApBA,OAAOC,SAAmC,SAAiBF,GAAO,cAAcA,GAA2B,SAAiBA,GAAO,OAAOA,GAAyB,mBAAXC,QAAyBD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,gBAAkBJ,IAAyBA,GAEnVK,QAAQD,UAAUE,UACrBD,QAAQD,UAAUE,QAAUD,QAAQD,UAAUG,mBAAqBF,QAAQD,UAAUI,uBAGlFH,QAAQD,UAAUK,UACrBJ,QAAQD,UAAUK,QAAU,SAAUC,GACpC,IAAIC,EAAKC,KAET,EAAG,CACD,GAAID,EAAGL,QAAQ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AAWxD,EAAQuD,IAI/B,IAAK,IAAWxB,EAAP1F,EAAI,EAAYA,EAAIiH,EAAS/G,OAAQF,KAC5C0F,EAAUuB,EAASjH,KACoB,mBAAjB0F,EAAQC,KAAqBD,EAAQC,KAAKa,EAASxG,GAAI6F,GAAaqB,EAAQlH,GAAK0F,EAGpGyB,GAAWxD,EAAQuD,MAI5BlD,EAAQqD,KAAO,SAAUJ,GAEvB,IAAKxC,EAAQwC,GAAW,MAAM,IAAI3E,UAAU,6CAC5C,OAAO,IAFK3D,KAEK,SAAUgF,EAASkC,GAClC,IAAK,IAAWH,EAAP1F,EAAI,EAAYA,EAAIiH,EAAS/G,OAAQF,KAC5C0F,EAAUuB,EAASjH,KACoB,mBAAjB0F,EAAQC,KAAqBD,EAAQC,KAAKhC,EAASkC,GAAalC,EAAQ+B,MAKpG1B,EAAQL,QAAU,SAAU/D,GAE1B,OAAIA,GAA4B,WAAnB9B,QAAQ8B,IAAuBA,EAAM1B,cADtCS,KACoEiB,EACzE,IAFKjB,KAEK,SAAUgF,GACzBA,EAAQ/D,MAIZoE,EAAQ6B,OAAS,SAAUK,GAEzB,OAAO,IADKvH,KACK,SAAUgF,EAASkC,GAClCA,EAAOK,MA/Qb,CAkRoB,oBAAVnH,OAAwBA,OAA0B,oBAAV2E,OAAwBA,OAAwB,oBAARP,KAAsBA,UAAO","file":"polyfills.js","sourcesContent":["\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\nif (!Element.prototype.closest) {\n Element.prototype.closest = function (s) {\n var el = this;\n\n do {\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el !== undefined && el.nodeType === 1);\n\n return null;\n };\n}\n\nif (window.NodeList && !NodeList.prototype.forEach) {\n NodeList.prototype.forEach = Array.prototype.forEach;\n}\n\n(function (arr) {\n arr.forEach(function (item) {\n if (!item.hasOwnProperty('remove')) {\n Object.defineProperty(item, 'remove', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: function value() {\n if (this.parentNode === null) {\n return;\n }\n\n this.parentNode.removeChild(this);\n }\n });\n }\n\n if (!item.hasOwnProperty('replaceWith')) {\n Object.defineProperty(item, 'replaceWith', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: function value() {\n var parent = this.parentNode,\n i = arguments.length,\n currentNode;\n if (!parent) return;\n if (!i) // if there are no arguments\n parent.removeChild(this);\n\n while (i--) {\n // i-- decrements i and returns the value of i before the decrement\n currentNode = arguments[i];\n\n if (_typeof(currentNode) !== 'object') {\n currentNode = this.ownerDocument.createTextNode(currentNode);\n } else if (currentNode && currentNode.parentNode) {\n currentNode.parentNode.removeChild(currentNode);\n } // the value of \"i\" below is after the decrement\n\n\n if (!i) // if currentNode is the first argument (currentNode === arguments[0])\n parent.replaceChild(currentNode, this);else // if currentNode isn't the first\n parent.insertBefore(currentNode, this.previousSibling);\n }\n }\n });\n }\n });\n})([Element.prototype, CharacterData.prototype, DocumentType.prototype]); // https://tc39.github.io/ecma262/#sec-array.prototype.includes\n\n\nif (!Array.prototype.includes) {\n Object.defineProperty(Array.prototype, 'includes', {\n value: function value(searchElement, fromIndex) {\n // 1. Let O be ? ToObject(this value).\n var o = Object(this); // 2. Let len be ? ToLength(? Get(O, \"length\")).\n\n var len = o.length >>> 0; // 3. If len is 0, return false.\n\n if (len === 0) {\n return false;\n } // 4. Let n be ? ToInteger(fromIndex).\n // (If fromIndex is undefined, this step produces the value 0.)\n\n\n var n = fromIndex | 0; // 5. If n ≥ 0, then\n // a. Let k be n.\n // 6. Else n < 0,\n // a. Let k be len + n.\n // b. If k < 0, let k be 0.\n\n var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\n\n function sameValueZero(x, y) {\n return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y);\n } // 7. Repeat, while k < len\n\n\n while (k < len) {\n // a. Let elementK be the result of ? Get(O, ! ToString(k)).\n // b. If SameValueZero(searchElement, elementK) is true, return true.\n if (sameValueZero(o[k], searchElement)) {\n return true;\n } // c. Increase k by 1. \n\n\n k++;\n } // 8. Return false\n\n\n return false;\n }\n });\n} // Production steps of ECMA-262, Edition 6, 22.1.2.1\n\n\nif (!Array.from) {\n Array.from = function () {\n var toStr = Object.prototype.toString;\n\n var isCallable = function isCallable(fn) {\n return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n };\n\n var toInteger = function toInteger(value) {\n var number = Number(value);\n\n if (isNaN(number)) {\n return 0;\n }\n\n if (number === 0 || !isFinite(number)) {\n return number;\n }\n\n return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n };\n\n var maxSafeInteger = Math.pow(2, 53) - 1;\n\n var toLength = function toLength(value) {\n var len = toInteger(value);\n return Math.min(Math.max(len, 0), maxSafeInteger);\n }; // The length property of the from method is 1.\n\n\n return function from(arrayLike\n /*, mapFn, thisArg */\n ) {\n // 1. Let C be the this value.\n var C = this; // 2. Let items be ToObject(arrayLike).\n\n var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).\n\n if (arrayLike == null) {\n throw new TypeError('Array.from requires an array-like object - not null or undefined');\n } // 4. If mapfn is undefined, then let mapping be false.\n\n\n var mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n var t;\n\n if (typeof mapFn !== 'undefined') {\n // 5. else\n // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n if (!isCallable(mapFn)) {\n throw new TypeError('Array.from: when provided, the second argument must be a function');\n } // 5. b. If thisArg was supplied, let t be thisArg; else let t be undefined.\n\n\n if (arguments.length > 2) {\n t = arguments[2];\n }\n } // 10. Let lenValue be Get(items, \"length\").\n // 11. Let len be ToLength(lenValue).\n\n\n var len = toLength(items.length); // 13. If IsConstructor(C) is true, then\n // 13. a. Let a be the result of calling the [[Construct]] internal method \n // of C with an argument list containing the single item len.\n // 14. a. Else, Let a be ArrayCreate(len).\n\n var a = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.\n\n var k = 0; // 17. Repeat, while k < len… (also steps a - h)\n\n var kValue;\n\n while (k < len) {\n kValue = items[k];\n\n if (mapFn) {\n a[k] = typeof t === 'undefined' ? mapFn(kValue, k) : mapFn.call(t, kValue, k);\n } else {\n a[k] = kValue;\n }\n\n k += 1;\n } // 18. Let putStatus be Put(a, \"length\", len, true).\n\n\n a.length = len; // 20. Return a.\n\n return a;\n };\n }();\n}\n\n(function () {\n var mutationObserver;\n\n if (window.MutationObserver !== null && window.MutationObserver !== undefined) {\n return;\n }\n\n mutationObserver = function () {\n function mutationObserver(callBack) {\n this.callBack = callBack;\n }\n\n mutationObserver.prototype.observe = function (element) {\n this.element = element;\n return this.interval = setInterval(function (self) {\n return function () {\n var html = self.element.innerHTML;\n\n if (html !== self.oldHtml) {\n self.oldHtml = html;\n return self.callBack.apply(null);\n }\n\n return undefined;\n };\n }(this), 200);\n };\n\n mutationObserver.prototype.disconnect = function () {\n return window.clearInterval(this.interval);\n };\n\n return mutationObserver;\n }();\n\n window.MutationObserver = mutationObserver;\n})(); // Promise Polyfill mit Anpassungen übernommen von https://github.com/lahmatiy/es6-promise-polyfill\n// \n// (The MIT License)\n//\n// Copyright(c) 2014 Roman Dvornov\n//\n// Permission is hereby granted, free of charge, to any person obtaining\n// a copy of this software and associated documentation files(the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and / or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to\n// the following conditions:\n//\n// The above copyright notice and this permission notice shall be\n// included in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n// NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// ReSharper disable all\n\n\n(function (global) {\n //\n // Check for native Promise and it has correct interface\n //\n var NativePromise = global['Promise'];\n\n var nativePromiseSupported = NativePromise && // Some of these methods are missing from\n // Firefox/Chrome experimental implementations\n 'resolve' in NativePromise && 'reject' in NativePromise && 'all' in NativePromise && 'race' in NativePromise && // Older version of the spec had a resolver object\n // as the arg rather than a function\n function () {\n var resolve;\n new NativePromise(function (r) {\n resolve = r;\n });\n return typeof resolve === 'function';\n }(); //\n // export if necessary\n //\n\n\n if (typeof exports !== 'undefined' && exports) {\n // node.js\n exports.Promise = nativePromiseSupported ? NativePromise : Promise;\n exports.Polyfill = Promise;\n } else {\n // AMD\n if (typeof define == 'function' && define.amd) {\n define(function () {\n return nativePromiseSupported ? NativePromise : Promise;\n });\n } else {\n // in browser add to global\n if (!nativePromiseSupported) global['Promise'] = Promise;\n }\n } //\n // Polyfill\n //\n\n\n var PENDING = 'pending';\n var SEALED = 'sealed';\n var FULFILLED = 'fulfilled';\n var REJECTED = 'rejected';\n\n var NOOP = function NOOP() {};\n\n function isArray(value) {\n return Object.prototype.toString.call(value) === '[object Array]';\n } // async calls\n\n\n var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout;\n var asyncQueue = [];\n var asyncTimer;\n\n function asyncFlush() {\n // run promise callbacks\n for (var i = 0; i < asyncQueue.length; i++) {\n asyncQueue[i][0](asyncQueue[i][1]);\n } // reset async asyncQueue\n\n\n asyncQueue = [];\n asyncTimer = false;\n }\n\n function asyncCall(callback, arg) {\n asyncQueue.push([callback, arg]);\n\n if (!asyncTimer) {\n asyncTimer = true;\n asyncSetTimer(asyncFlush, 0);\n }\n }\n\n function invokeResolver(resolver, promise) {\n function resolvePromise(value) {\n resolve(promise, value);\n }\n\n function rejectPromise(reason) {\n reject(promise, reason);\n }\n\n try {\n resolver(resolvePromise, rejectPromise);\n } catch (e) {\n rejectPromise(e);\n }\n }\n\n function invokeCallback(subscriber) {\n var owner = subscriber.owner;\n var settled = owner.state_;\n var value = owner.data_;\n var callback = subscriber[settled];\n var promise = subscriber.then;\n\n if (typeof callback === 'function') {\n settled = FULFILLED;\n\n try {\n value = callback(value);\n } catch (e) {\n reject(promise, e);\n }\n }\n\n if (!handleThenable(promise, value)) {\n if (settled === FULFILLED) resolve(promise, value);\n if (settled === REJECTED) reject(promise, value);\n }\n }\n\n function handleThenable(promise, value) {\n var resolved;\n\n try {\n if (promise === value) throw new TypeError('A promises callback cannot return that same promise.');\n\n if (value && (typeof value === 'function' || _typeof(value) === 'object')) {\n var then = value.then; // then should be retrived only once\n\n if (typeof then === 'function') {\n then.call(value, function (val) {\n if (!resolved) {\n resolved = true;\n if (value !== val) resolve(promise, val);else fulfill(promise, val);\n }\n }, function (reason) {\n if (!resolved) {\n resolved = true;\n reject(promise, reason);\n }\n });\n return true;\n }\n }\n } catch (e) {\n if (!resolved) reject(promise, e);\n return true;\n }\n\n return false;\n }\n\n function resolve(promise, value) {\n if (promise === value || !handleThenable(promise, value)) fulfill(promise, value);\n }\n\n function fulfill(promise, value) {\n if (promise.state_ === PENDING) {\n promise.state_ = SEALED;\n promise.data_ = value;\n asyncCall(publishFulfillment, promise);\n }\n }\n\n function reject(promise, reason) {\n if (promise.state_ === PENDING) {\n promise.state_ = SEALED;\n promise.data_ = reason;\n asyncCall(publishRejection, promise);\n }\n }\n\n function publish(promise) {\n var callbacks = promise.then_;\n promise.then_ = undefined;\n\n for (var i = 0; i < callbacks.length; i++) {\n invokeCallback(callbacks[i]);\n }\n }\n\n function publishFulfillment(promise) {\n promise.state_ = FULFILLED;\n publish(promise);\n }\n\n function publishRejection(promise) {\n promise.state_ = REJECTED;\n publish(promise);\n }\n /**\r\n * @class\r\n */\n\n\n function Promise(resolver) {\n if (typeof resolver !== 'function') throw new TypeError('Promise constructor takes a function argument');\n if (this instanceof Promise === false) throw new TypeError('Failed to construct \\'Promise\\': Please use the \\'new\\' operator, this object constructor cannot be called as a function.');\n this.then_ = [];\n invokeResolver(resolver, this);\n }\n\n Promise.prototype = {\n constructor: Promise,\n state_: PENDING,\n then_: null,\n data_: undefined,\n then: function then(onFulfillment, onRejection) {\n var subscriber = {\n owner: this,\n then: new this.constructor(NOOP),\n fulfilled: onFulfillment,\n rejected: onRejection\n };\n\n if (this.state_ === FULFILLED || this.state_ === REJECTED) {\n // already resolved, call callback async\n asyncCall(invokeCallback, subscriber);\n } else {\n // subscribe\n this.then_.push(subscriber);\n }\n\n return subscriber.then;\n },\n 'catch': function _catch(onRejection) {\n return this.then(null, onRejection);\n }\n };\n\n Promise.all = function (promises) {\n var Class = this;\n if (!isArray(promises)) throw new TypeError('You must pass an array to Promise.all().');\n return new Class(function (resolve, reject) {\n var results = [];\n var remaining = 0;\n\n function resolver(index) {\n remaining++;\n return function (value) {\n results[index] = value;\n if (! --remaining) resolve(results);\n };\n }\n\n for (var i = 0, promise; i < promises.length; i++) {\n promise = promises[i];\n if (promise && typeof promise.then === 'function') promise.then(resolver(i), reject);else results[i] = promise;\n }\n\n if (!remaining) resolve(results);\n });\n };\n\n Promise.race = function (promises) {\n var Class = this;\n if (!isArray(promises)) throw new TypeError('You must pass an array to Promise.race().');\n return new Class(function (resolve, reject) {\n for (var i = 0, promise; i < promises.length; i++) {\n promise = promises[i];\n if (promise && typeof promise.then === 'function') promise.then(resolve, reject);else resolve(promise);\n }\n });\n };\n\n Promise.resolve = function (value) {\n var Class = this;\n if (value && _typeof(value) === 'object' && value.constructor === Class) return value;\n return new Class(function (resolve) {\n resolve(value);\n });\n };\n\n Promise.reject = function (reason) {\n var Class = this;\n return new Class(function (resolve, reject) {\n reject(reason);\n });\n };\n})(typeof window != 'undefined' ? window : typeof global != 'undefined' ? global : typeof self != 'undefined' ? self : void 0); // ReSharper restore all"]}