UNPKG

@absinthe/socket

Version:
1,600 lines (1,324 loc) 177 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.AbsintheSocket = {}))); }(this, (function (exports) { 'use strict'; var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function unwrapExports (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var _global = createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef }); var _core = createCommonjsModule(function (module) { var core = module.exports = { version: '2.6.0' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef }); var _core_1 = _core.version; var _isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var _anObject = function (it) { if (!_isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; var _fails = function (exec) { try { return !!exec(); } catch (e) { return true; } }; // Thank's IE8 for his funny defineProperty var _descriptors = !_fails(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); var document = _global.document; // typeof document.createElement is 'object' in old IE var is = _isObject(document) && _isObject(document.createElement); var _domCreate = function (it) { return is ? document.createElement(it) : {}; }; var _ie8DomDefine = !_descriptors && !_fails(function () { return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; }); // 7.1.1 ToPrimitive(input [, PreferredType]) // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var _toPrimitive = function (it, S) { if (!_isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; var dP = Object.defineProperty; var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { _anObject(O); P = _toPrimitive(P, true); _anObject(Attributes); if (_ie8DomDefine) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var _objectDp = { f: f }; var _propertyDesc = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var _hide = _descriptors ? function (object, key, value) { return _objectDp.f(object, key, _propertyDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var hasOwnProperty = {}.hasOwnProperty; var _has = function (it, key) { return hasOwnProperty.call(it, key); }; var id = 0; var px = Math.random(); var _uid = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; var _redefine = createCommonjsModule(function (module) { var SRC = _uid('src'); var TO_STRING = 'toString'; var $toString = Function[TO_STRING]; var TPL = ('' + $toString).split(TO_STRING); _core.inspectSource = function (it) { return $toString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) _has(val, 'name') || _hide(val, 'name', key); if (O[key] === val) return; if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if (O === _global) { O[key] = val; } else if (!safe) { delete O[key]; _hide(O, key, val); } else if (O[key]) { O[key] = val; } else { _hide(O, key, val); } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || $toString.call(this); }); }); var _aFunction = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; // optional / simple context binding var _ctx = function (fn, that, length) { _aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); var key, own, out, exp; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; // extend global if (target) _redefine(target, key, out, type & $export.U); // export if (exports[key] != out) _hide(exports, key, exp); if (IS_PROTO && expProto[key] != out) expProto[key] = out; } }; _global.core = _core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` var _export = $export; // fast apply, http://jsperf.lnkit.com/fast-apply/5 var _invoke = function (fn, args, that) { var un = that === undefined; switch (args.length) { case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; var arraySlice = [].slice; var factories = {}; var construct = function (F, len, args) { if (!(len in factories)) { for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; // eslint-disable-next-line no-new-func factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); } return factories[len](F, args); }; var _bind = Function.bind || function bind(that /* , ...args */) { var fn = _aFunction(this); var partArgs = arraySlice.call(arguments, 1); var bound = function (/* args... */) { var args = partArgs.concat(arraySlice.call(arguments)); return this instanceof bound ? construct(fn, args.length, args) : _invoke(fn, args, that); }; if (_isObject(fn.prototype)) bound.prototype = fn.prototype; return bound; }; // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) _export(_export.P, 'Function', { bind: _bind }); function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } } var newArrowCheck = _newArrowCheck; function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } var arrayWithoutHoles = _arrayWithoutHoles; function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } var iterableToArray = _iterableToArray; function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } var nonIterableSpread = _nonIterableSpread; function _toConsumableArray(arr) { return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); } var toConsumableArray = _toConsumableArray; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var defineProperty = _defineProperty; function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { defineProperty(target, key, source[key]); }); } return target; } var objectSpread = _objectSpread; function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose; function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } var objectWithoutProperties = _objectWithoutProperties; var _this = undefined; var cancel = function cancel(_ref) { var activeObservers = _ref.activeObservers, canceledObservers = _ref.canceledObservers, rest = objectWithoutProperties(_ref, ["activeObservers", "canceledObservers"]); newArrowCheck(this, _this); return objectSpread({}, rest, { isActive: false, activeObservers: [], canceledObservers: toConsumableArray(activeObservers).concat(toConsumableArray(canceledObservers)) }); }.bind(undefined); var _library = false; var _shared = createCommonjsModule(function (module) { var SHARED = '__core-js_shared__'; var store = _global[SHARED] || (_global[SHARED] = {}); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: _core.version, mode: _library ? 'pure' : 'global', copyright: '© 2018 Denis Pushkarev (zloirock.ru)' }); }); var _wks = createCommonjsModule(function (module) { var store = _shared('wks'); var Symbol = _global.Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); }; $exports.store = store; }); // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = _wks('unscopables'); var ArrayProto = Array.prototype; if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {}); var _addToUnscopables = function (key) { ArrayProto[UNSCOPABLES][key] = true; }; var _iterStep = function (done, value) { return { value: value, done: !!done }; }; var _iterators = {}; var toString = {}.toString; var _cof = function (it) { return toString.call(it).slice(8, -1); }; // fallback for non-array-like ES3 and non-enumerable old V8 strings // eslint-disable-next-line no-prototype-builtins var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return _cof(it) == 'String' ? it.split('') : Object(it); }; // 7.2.1 RequireObjectCoercible(argument) var _defined = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; // to indexed object, toObject with fallback for non-array-like ES3 strings var _toIobject = function (it) { return _iobject(_defined(it)); }; // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; var _toInteger = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; // 7.1.15 ToLength var min = Math.min; var _toLength = function (it) { return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; var max = Math.max; var min$1 = Math.min; var _toAbsoluteIndex = function (index, length) { index = _toInteger(index); return index < 0 ? max(index + length, 0) : min$1(index, length); }; // false -> Array#indexOf // true -> Array#includes var _arrayIncludes = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = _toIobject($this); var length = _toLength(O.length); var index = _toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; var shared = _shared('keys'); var _sharedKey = function (key) { return shared[key] || (shared[key] = _uid(key)); }; var arrayIndexOf = _arrayIncludes(false); var IE_PROTO = _sharedKey('IE_PROTO'); var _objectKeysInternal = function (object, names) { var O = _toIobject(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (_has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } return result; }; // IE 8- don't enum bug keys var _enumBugKeys = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); // 19.1.2.14 / 15.2.3.14 Object.keys(O) var _objectKeys = Object.keys || function keys(O) { return _objectKeysInternal(O, _enumBugKeys); }; var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { _anObject(O); var keys = _objectKeys(Properties); var length = keys.length; var i = 0; var P; while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]); return O; }; var document$1 = _global.document; var _html = document$1 && document$1.documentElement; // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var IE_PROTO$1 = _sharedKey('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE$1 = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = _domCreate('iframe'); var i = _enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; _html.appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]]; return createDict(); }; var _objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE$1] = _anObject(O); result = new Empty(); Empty[PROTOTYPE$1] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else result = createDict(); return Properties === undefined ? result : _objectDps(result, Properties); }; var def = _objectDp.f; var TAG = _wks('toStringTag'); var _setToStringTag = function (it, tag, stat) { if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() _hide(IteratorPrototype, _wks('iterator'), function () { return this; }); var _iterCreate = function (Constructor, NAME, next) { Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) }); _setToStringTag(Constructor, NAME + ' Iterator'); }; // 7.1.13 ToObject(argument) var _toObject = function (it) { return Object(_defined(it)); }; // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var IE_PROTO$2 = _sharedKey('IE_PROTO'); var ObjectProto = Object.prototype; var _objectGpo = Object.getPrototypeOf || function (O) { O = _toObject(O); if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; var ITERATOR = _wks('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function () { return this; }; var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { _iterCreate(Constructor, NAME, next); var getMethod = function (kind) { if (!BUGGY && kind in proto) return proto[kind]; switch (kind) { case KEYS: return function keys() { return new Constructor(this, kind); }; case VALUES: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = $native || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; // Fix native if ($anyNative) { IteratorPrototype = _objectGpo($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators _setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEF_VALUES && $native && $native.name !== VALUES) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } // Define iterator if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { _hide(proto, ITERATOR, $default); } // Plug for library _iterators[NAME] = $default; _iterators[TAG] = returnThis; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) _redefine(proto, key, methods[key]); } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) { this._t = _toIobject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function () { var O = this._t; var kind = this._k; var index = this._i++; if (!O || index >= O.length) { this._t = undefined; return _iterStep(1); } if (kind == 'keys') return _iterStep(0, index); if (kind == 'values') return _iterStep(0, O[index]); return _iterStep(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) _iterators.Arguments = _iterators.Array; _addToUnscopables('keys'); _addToUnscopables('values'); _addToUnscopables('entries'); var ITERATOR$1 = _wks('iterator'); var TO_STRING_TAG = _wks('toStringTag'); var ArrayValues = _iterators.Array; var DOMIterables = { CSSRuleList: true, // TODO: Not spec compliant, should be false. CSSStyleDeclaration: false, CSSValueList: false, ClientRectList: false, DOMRectList: false, DOMStringList: false, DOMTokenList: true, DataTransferItemList: false, FileList: false, HTMLAllCollection: false, HTMLCollection: false, HTMLFormElement: false, HTMLSelectElement: false, MediaList: true, // TODO: Not spec compliant, should be false. MimeTypeArray: false, NamedNodeMap: false, NodeList: true, PaintRequestList: false, Plugin: false, PluginArray: false, SVGLengthList: false, SVGNumberList: false, SVGPathSegList: false, SVGPointList: false, SVGStringList: false, SVGTransformList: false, SourceBufferList: false, StyleSheetList: true, // TODO: Not spec compliant, should be false. TextTrackCueList: false, TextTrackList: false, TouchList: false }; for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) { var NAME = collections[i]; var explicit = DOMIterables[NAME]; var Collection = _global[NAME]; var proto = Collection && Collection.prototype; var key; if (proto) { if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues); if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME); _iterators[NAME] = ArrayValues; if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true); } } // 7.2.2 IsArray(argument) var _isArray = Array.isArray || function isArray(arg) { return _cof(arg) == 'Array'; }; var SPECIES = _wks('species'); var _arraySpeciesConstructor = function (original) { var C; if (_isArray(original)) { C = original.constructor; // cross-realm fallback if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; if (_isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? Array : C; }; // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var _arraySpeciesCreate = function (original, length) { return new (_arraySpeciesConstructor(original))(length); }; // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var _arrayMethods = function (TYPE, $create) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; var create = $create || _arraySpeciesCreate; return function ($this, callbackfn, that) { var O = _toObject($this); var self = _iobject(O); var f = _ctx(callbackfn, that, 3); var length = _toLength(self.length); var index = 0; var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var val, res; for (;length > index; index++) if (NO_HOLES || index in self) { val = self[index]; res = f(val, index, O); if (TYPE) { if (IS_MAP) result[index] = res; // map else if (res) switch (TYPE) { case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if (IS_EVERY) return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; var _strictMethod = function (method, arg) { return !!method && _fails(function () { // eslint-disable-next-line no-useless-call arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); }); }; var $forEach = _arrayMethods(0); var STRICT = _strictMethod([].forEach, true); _export(_export.P + _export.F * !STRICT, 'Array', { // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) forEach: function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments[1]); } }); var dP$1 = _objectDp.f; var FProto = Function.prototype; var nameRE = /^\s*function ([^ (]*)/; var NAME$1 = 'name'; // 19.2.4.2 name NAME$1 in FProto || _descriptors && dP$1(FProto, NAME$1, { configurable: true, get: function () { try { return ('' + this).match(nameRE)[1]; } catch (e) { return ''; } } }); var _this$1 = undefined; var getNotifier = function getNotifier(handlerName, payload) { var _this2 = this; newArrowCheck(this, _this$1); return function (observer) { newArrowCheck(this, _this2); return observer[handlerName] && observer[handlerName](payload); }.bind(this); }.bind(undefined); var getHandlerName = function getHandlerName(_ref) { var name = _ref.name; newArrowCheck(this, _this$1); return "on".concat(name); }.bind(undefined); var notifyAll = function notifyAll(observers, event) { newArrowCheck(this, _this$1); return observers.forEach(getNotifier(getHandlerName(event), event.payload)); }.bind(undefined); var _this$2 = undefined; var notifyCanceled = function notifyCanceled(notifier, event) { newArrowCheck(this, _this$2); notifyAll(notifier.canceledObservers, event); return notifier; }.bind(undefined); var eventNames = { abort: "Abort", cancel: "Cancel", error: "Error", result: "Result", start: "Start" }; var _this$3 = undefined; var createStartEvent = function createStartEvent(payload) { newArrowCheck(this, _this$3); return { payload: payload, name: eventNames.start }; }.bind(undefined); var createResultEvent = function createResultEvent(payload) { newArrowCheck(this, _this$3); return { payload: payload, name: eventNames.result }; }.bind(undefined); var createErrorEvent = function createErrorEvent(payload) { newArrowCheck(this, _this$3); return { payload: payload, name: eventNames.error }; }.bind(undefined); var createCancelEvent = function createCancelEvent() { newArrowCheck(this, _this$3); return { name: eventNames.cancel, payload: undefined }; }.bind(undefined); var createAbortEvent = function createAbortEvent(payload) { newArrowCheck(this, _this$3); return { payload: payload, name: eventNames.abort }; }.bind(undefined); var _this$4 = undefined; var clearCanceled = function clearCanceled(notifier) { newArrowCheck(this, _this$4); return objectSpread({}, notifier, { canceledObservers: [] }); }.bind(undefined); var flushCanceled = function flushCanceled(notifier) { newArrowCheck(this, _this$4); return notifier.canceledObservers.length > 0 ? clearCanceled(notifyCanceled(notifier, createCancelEvent())) : notifier; }.bind(undefined); // 7.1.4 ToInteger var ceil$1 = Math.ceil; var floor$1 = Math.floor; var _toInteger$1 = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor$1 : ceil$1)(it); }; // 7.2.1 RequireObjectCoercible(argument) var _defined$1 = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; // true -> String#at // false -> String#codePointAt var _stringAt = function (TO_STRING) { return function (that, pos) { var s = String(_defined$1(that)); var i = _toInteger$1(pos); var l = s.length; var a, b; if (i < 0 || i >= l) return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; var _library$1 = true; var _global$1 = createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef }); var _core$1 = createCommonjsModule(function (module) { var core = module.exports = { version: '2.5.1' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef }); var _core_1$1 = _core$1.version; var _aFunction$1 = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; // optional / simple context binding var _ctx$1 = function (fn, that, length) { _aFunction$1(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; var _isObject$1 = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var _anObject$1 = function (it) { if (!_isObject$1(it)) throw TypeError(it + ' is not an object!'); return it; }; var _fails$1 = function (exec) { try { return !!exec(); } catch (e) { return true; } }; // Thank's IE8 for his funny defineProperty var _descriptors$1 = !_fails$1(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); var document$2 = _global$1.document; // typeof document.createElement is 'object' in old IE var is$1 = _isObject$1(document$2) && _isObject$1(document$2.createElement); var _domCreate$1 = function (it) { return is$1 ? document$2.createElement(it) : {}; }; var _ie8DomDefine$1 = !_descriptors$1 && !_fails$1(function () { return Object.defineProperty(_domCreate$1('div'), 'a', { get: function () { return 7; } }).a != 7; }); // 7.1.1 ToPrimitive(input [, PreferredType]) // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var _toPrimitive$1 = function (it, S) { if (!_isObject$1(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !_isObject$1(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !_isObject$1(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !_isObject$1(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; var dP$2 = Object.defineProperty; var f$1 = _descriptors$1 ? Object.defineProperty : function defineProperty(O, P, Attributes) { _anObject$1(O); P = _toPrimitive$1(P, true); _anObject$1(Attributes); if (_ie8DomDefine$1) try { return dP$2(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var _objectDp$1 = { f: f$1 }; var _propertyDesc$1 = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var _hide$1 = _descriptors$1 ? function (object, key, value) { return _objectDp$1.f(object, key, _propertyDesc$1(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var PROTOTYPE$2 = 'prototype'; var $export$1 = function (type, name, source) { var IS_FORCED = type & $export$1.F; var IS_GLOBAL = type & $export$1.G; var IS_STATIC = type & $export$1.S; var IS_PROTO = type & $export$1.P; var IS_BIND = type & $export$1.B; var IS_WRAP = type & $export$1.W; var exports = IS_GLOBAL ? _core$1 : _core$1[name] || (_core$1[name] = {}); var expProto = exports[PROTOTYPE$2]; var target = IS_GLOBAL ? _global$1 : IS_STATIC ? _global$1[name] : (_global$1[name] || {})[PROTOTYPE$2]; var key, own, out; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; if (own && key in exports) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] // bind timers to global for call from export context : IS_BIND && own ? _ctx$1(out, _global$1) // wrap global constructors for prevent change them in library : IS_WRAP && target[key] == out ? (function (C) { var F = function (a, b, c) { if (this instanceof C) { switch (arguments.length) { case 0: return new C(); case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); } return C.apply(this, arguments); }; F[PROTOTYPE$2] = C[PROTOTYPE$2]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? _ctx$1(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% if (IS_PROTO) { (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% if (type & $export$1.R && expProto && !expProto[key]) _hide$1(expProto, key, out); } } }; // type bitmap $export$1.F = 1; // forced $export$1.G = 2; // global $export$1.S = 4; // static $export$1.P = 8; // proto $export$1.B = 16; // bind $export$1.W = 32; // wrap $export$1.U = 64; // safe $export$1.R = 128; // real proto method for `library` var _export$1 = $export$1; var _redefine$1 = _hide$1; var hasOwnProperty$1 = {}.hasOwnProperty; var _has$1 = function (it, key) { return hasOwnProperty$1.call(it, key); }; var _iterators$1 = {}; var toString$1 = {}.toString; var _cof$1 = function (it) { return toString$1.call(it).slice(8, -1); }; // fallback for non-array-like ES3 and non-enumerable old V8 strings // eslint-disable-next-line no-prototype-builtins var _iobject$1 = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return _cof$1(it) == 'String' ? it.split('') : Object(it); }; // to indexed object, toObject with fallback for non-array-like ES3 strings var _toIobject$1 = function (it) { return _iobject$1(_defined$1(it)); }; // 7.1.15 ToLength var min$2 = Math.min; var _toLength$1 = function (it) { return it > 0 ? min$2(_toInteger$1(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; var max$1 = Math.max; var min$3 = Math.min; var _toAbsoluteIndex$1 = function (index, length) { index = _toInteger$1(index); return index < 0 ? max$1(index + length, 0) : min$3(index, length); }; // false -> Array#indexOf // true -> Array#includes var _arrayIncludes$1 = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = _toIobject$1($this); var length = _toLength$1(O.length); var index = _toAbsoluteIndex$1(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; var SHARED = '__core-js_shared__'; var store = _global$1[SHARED] || (_global$1[SHARED] = {}); var _shared$1 = function (key) { return store[key] || (store[key] = {}); }; var id$1 = 0; var px$1 = Math.random(); var _uid$1 = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id$1 + px$1).toString(36)); }; var shared$1 = _shared$1('keys'); var _sharedKey$1 = function (key) { return shared$1[key] || (shared$1[key] = _uid$1(key)); }; var arrayIndexOf$1 = _arrayIncludes$1(false); var IE_PROTO$3 = _sharedKey$1('IE_PROTO'); var _objectKeysInternal$1 = function (object, names) { var O = _toIobject$1(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO$3) _has$1(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (_has$1(O, key = names[i++])) { ~arrayIndexOf$1(result, key) || result.push(key); } return result; }; // IE 8- don't enum bug keys var _enumBugKeys$1 = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); // 19.1.2.14 / 15.2.3.14 Object.keys(O) var _objectKeys$1 = Object.keys || function keys(O) { return _objectKeysInternal$1(O, _enumBugKeys$1); }; var _objectDps$1 = _descriptors$1 ? Object.defineProperties : function defineProperties(O, Properties) { _anObject$1(O); var keys = _objectKeys$1(Properties); var length = keys.length; var i = 0; var P; while (length > i) _objectDp$1.f(O, P = keys[i++], Properties[P]); return O; }; var document$3 = _global$1.document; var _html$1 = document$3 && document$3.documentElement; // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var IE_PROTO$4 = _sharedKey$1('IE_PROTO'); var Empty$1 = function () { /* empty */ }; var PROTOTYPE$3 = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict$1 = function () { // Thrash, waste and sodomy: IE GC bug var iframe = _domCreate$1('iframe'); var i = _enumBugKeys$1.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; _html$1.appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict$1 = iframeDocument.F; while (i--) delete createDict$1[PROTOTYPE$3][_enumBugKeys$1[i]]; return createDict$1(); }; var _objectCreate$1 = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty$1[PROTOTYPE$3] = _anObject$1(O); result = new Empty$1(); Empty$1[PROTOTYPE$3] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$4] = O; } else result = createDict$1(); return Properties === undefined ? result : _objectDps$1(result, Properties); }; var _wks$1 = createCommonjsModule(function (module) { var store = _shared$1('wks'); var Symbol = _global$1.Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid$1)('Symbol.' + name)); }; $exports.store = store; }); var def$1 = _objectDp$1.f; var TAG$1 = _wks$1('toStringTag'); var _setToStringTag$1 = function (it, tag, stat) { if (it && !_has$1(it = stat ? it : it.prototype, TAG$1)) def$1(it, TAG$1, { configurable: true, value: tag }); }; var IteratorPrototype$1 = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() _hide$1(IteratorPrototype$1, _wks$1('iterator'), function () { return this; }); var _iterCreate$1 = function (Constructor, NAME, next) { Constructor.prototype = _objectCreate$1(IteratorPrototype$1, { next: _propertyDesc$1(1, next) }); _setToStringTag$1(Constructor, NAME + ' Iterator'); }; // 7.1.13 ToObject(argument) var _toObject$1 = function (it) { return Object(_defined$1(it)); }; // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var IE_PROTO$5 = _sharedKey$1('IE_PROTO'); var ObjectProto$1 = Object.prototype; var _objectGpo$1 = Object.getPrototypeOf || function (O) { O = _toObject$1(O); if (_has$1(O, IE_PROTO$5)) return O[IE_PROTO$5]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto$1 : null; }; var ITERATOR$2 = _wks$1('iterator'); var BUGGY$1 = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR$1 = '@@iterator'; var KEYS$1 = 'keys'; var VALUES$1 = 'values'; var returnThis$1 = function () { return this; }; var _iterDefine$1 = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { _iterCreate$1(Constructor, NAME, next); var getMethod = function (kind) { if (!BUGGY$1 && kind in proto) return proto[kind]; switch (kind) { case KEYS$1: return function keys() { return new Constructor(this, kind); }; case VALUES$1: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES$1; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR$2] || proto[FF_ITERATOR$1] || DEFAULT && proto[DEFAULT]; var $default = $native || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; // Fix native if ($anyNative) { IteratorPrototype = _objectGpo$1($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators _setToStringTag$1(IteratorPrototype, TAG, true); // fix for some old engines if (!_library$1 && !_has$1(IteratorPrototype, ITERATOR$2)) _hide$1(IteratorPrototype, ITERATOR$2, returnThis$1); } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEF_VALUES && $native && $native.name !== VALUES$1) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } // Define iterator if ((!_library$1 || FORCED) && (BUGGY$1 || VALUES_BUG || !proto[ITERATOR$2])) { _hide$1(proto, ITERATOR$2, $default); } // Plug for library _iterators$1[NAME] = $default; _iterators$1[TAG] = returnThis$1; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES$1), keys: IS_SET ? $default : getMethod(KEYS$1), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) _redefine$1(proto, key, methods[key]); } else _export$1(_export$1.P + _export$1.F * (BUGGY$1 || VALUES_BUG), NAME, methods); } return methods; }; var $at = _stringAt(true); // 21.1.3.27 String.prototype[@@iterator]() _iterDefine$1(String, 'String', function (iterated) { this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function () { var O = this._t; var index = this._i; var point; if (index >= O.length) return { value: undefined, done: true }; point = $at(O, index); this._i += point.length; return { value: point, done: false }; }); // call something on iterator step with safe closing on error var _iterCall = function (iterator, fn, value, entries) { try { return entries ? fn(_anObject$1(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch (e) { var ret = iterator['return']; if (ret !== undefined) _anObject$1(ret.call(iterator)); throw e; } }; // check on default Array iterator var ITERATOR$3 = _wks$1('iterator'); var ArrayProto$1 = Array.prototype; var _isArrayIter = function (it) { return it !== undefined && (_iterators$1.Array === it || ArrayProto$1[ITERATOR$3] === it); }; var _createProperty = function (object, index, value) { if (index in object) _objectDp$1.f(object, index, _propertyDesc$1(0, value)); else object[index] = value; }; // getting tag from 19.1.3.6 Object.prototype.toString() var TAG$2 = _wks$1('toStringTag'); // ES3 wrong here var ARG = _cof$1(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (e) { /* empty */ } }; var _classof = function (it) { var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG$2)) == 'string' ? T // builtinTag case : ARG ? _cof$1(O) // ES3 arguments fallback : (B = _cof$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; var ITERATOR$4 = _wks$1('iterator'); var core_getIteratorMethod = _core$1.getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR$4] || it['@@iterator'] || _iterators$1[_classof(it)]; }; var ITERATOR$5 = _wks$1('iterator'); var SAFE_CLOSING = false; try { var riter = [7][ITERATOR$5](); riter['return'] = function () { SAFE_CLOSING = true; }; } catch (e) { /* empty */ } var _iterDetect = function (exec, skipClosing) { if (!skipClosing && !SAFE_CLOSING) return false; var safe = false; try { var arr = [7]; var iter = arr[ITERATOR$5](); iter.next = function () { return { done: safe = true }; }; arr[ITERATOR$5] = function () { return iter; }; exec(arr); } catch (e) { /* empty */ } return safe; }; _export$1(_export$1.S + _export$1.F * !_iterDetect(function (iter) { }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = _toObject$1(arrayLike); var C = typeof this == 'function' ? this : Array; var aLen = arguments.length; var mapfn = aLen > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var index = 0; var iterFn = core_getIteratorMethod(O); var length, result, step, iterator; if (mapping) mapfn = _ctx$1(mapfn, aLen > 2 ? arguments[2] : undefined, 2); // if object isn't iterable or it's array with default iterator - use simple case if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) { for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value); } } else { length = _toLength$1(O.length); for (result = new C(length);