UNPKG

scandit-sdk

Version:

Scandit Barcode Scanner SDK for the Web

1,542 lines (1,395 loc) 729 kB
/*! * @license * * Scandit Barcode Scanner SDK for the Web * v. 5.15.0 * * Copyright © 2022 Scandit AG. All Rights Reserved. * * The use of this software is governed by the Scandit Terms and Conditions. * https://ssl.scandit.com/terms/test.pdf * * The following sets forth attribution notices for third party software that may be contained in portions of the product. * https://docs.scandit.com/stable/web/LICENSE */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ScanditSDK = {})); })(this, (function (exports) { 'use strict'; function ___$insertStyle(css) { if (!css || typeof window === 'undefined') { return; } const style = document.createElement('style'); style.setAttribute('type', 'text/css'); style.innerHTML = css; document.head.appendChild(style); return css; } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; // 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.2.1 RequireObjectCoercible(argument) var _defined = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; var toInteger$2 = _toInteger; var defined$3 = _defined; // true -> String#at // false -> String#codePointAt var _stringAt = function (TO_STRING) { return function (that, pos) { var s = String(defined$3(that)); var i = toInteger$2(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 = true; var _global = {exports: {}}; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global$d = _global.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$d; // eslint-disable-line no-undef var _core = {exports: {}}; var core$7 = _core.exports = { version: '2.6.12' }; if (typeof __e == 'number') __e = core$7; // eslint-disable-line no-undef var _aFunction = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; // optional / simple context binding var aFunction$6 = _aFunction; var _ctx = function (fn, that, length) { aFunction$6(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 _objectDp = {}; var _isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var isObject$c = _isObject; var _anObject = function (it) { if (!isObject$c(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 isObject$b = _isObject; var document$2 = _global.exports.document; // typeof document.createElement is 'object' in old IE var is = isObject$b(document$2) && isObject$b(document$2.createElement); var _domCreate = function (it) { return is ? document$2.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]) var isObject$a = _isObject; // 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$a(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject$a(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject$a(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject$a(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; var anObject$a = _anObject; var IE8_DOM_DEFINE$1 = _ie8DomDefine; var toPrimitive$4 = _toPrimitive$1; var dP$6 = Object.defineProperty; _objectDp.f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject$a(O); P = toPrimitive$4(P, true); anObject$a(Attributes); if (IE8_DOM_DEFINE$1) try { return dP$6(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 _propertyDesc = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var dP$5 = _objectDp; var createDesc$3 = _propertyDesc; var _hide = _descriptors ? function (object, key, value) { return dP$5.f(object, key, createDesc$3(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 global$c = _global.exports; var core$6 = _core.exports; var ctx$7 = _ctx; var hide$4 = _hide; var has$6 = _has; var PROTOTYPE$2 = 'prototype'; var $export$m = function (type, name, source) { var IS_FORCED = type & $export$m.F; var IS_GLOBAL = type & $export$m.G; var IS_STATIC = type & $export$m.S; var IS_PROTO = type & $export$m.P; var IS_BIND = type & $export$m.B; var IS_WRAP = type & $export$m.W; var exports = IS_GLOBAL ? core$6 : core$6[name] || (core$6[name] = {}); var expProto = exports[PROTOTYPE$2]; var target = IS_GLOBAL ? global$c : IS_STATIC ? global$c[name] : (global$c[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 && has$6(exports, key)) 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$7(out, global$c) // 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$7(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$m.R && expProto && !expProto[key]) hide$4(expProto, key, out); } } }; // type bitmap $export$m.F = 1; // forced $export$m.G = 2; // global $export$m.S = 4; // static $export$m.P = 8; // proto $export$m.B = 16; // bind $export$m.W = 32; // wrap $export$m.U = 64; // safe $export$m.R = 128; // real proto method for `library` var _export = $export$m; var _redefine = _hide; var _iterators = {}; var toString$1 = {}.toString; var _cof = function (it) { return toString$1.call(it).slice(8, -1); }; // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof$2 = _cof; // eslint-disable-next-line no-prototype-builtins var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof$2(it) == 'String' ? it.split('') : Object(it); }; // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject$2 = _iobject; var defined$2 = _defined; var _toIobject = function (it) { return IObject$2(defined$2(it)); }; // 7.1.15 ToLength var toInteger$1 = _toInteger; var min$1 = Math.min; var _toLength = function (it) { return it > 0 ? min$1(toInteger$1(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; var toInteger = _toInteger; var max = Math.max; var min = Math.min; var _toAbsoluteIndex = function (index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; // false -> Array#indexOf // true -> Array#includes var toIObject$7 = _toIobject; var toLength$3 = _toLength; var toAbsoluteIndex = _toAbsoluteIndex; var _arrayIncludes = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject$7($this); var length = toLength$3(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 = {exports: {}}; var core$5 = _core.exports; var global$b = _global.exports; var SHARED = '__core-js_shared__'; var store$1 = global$b[SHARED] || (global$b[SHARED] = {}); (_shared.exports = function (key, value) { return store$1[key] || (store$1[key] = value !== undefined ? value : {}); })('versions', []).push({ version: core$5.version, mode: 'pure' , copyright: '© 2020 Denis Pushkarev (zloirock.ru)' }); var id$1 = 0; var px = Math.random(); var _uid = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id$1 + px).toString(36)); }; var shared$1 = _shared.exports('keys'); var uid$2 = _uid; var _sharedKey = function (key) { return shared$1[key] || (shared$1[key] = uid$2(key)); }; var has$5 = _has; var toIObject$6 = _toIobject; var arrayIndexOf = _arrayIncludes(false); var IE_PROTO$2 = _sharedKey('IE_PROTO'); var _objectKeysInternal = function (object, names) { var O = toIObject$6(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO$2) has$5(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has$5(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 $keys$2 = _objectKeysInternal; var enumBugKeys$1 = _enumBugKeys; var _objectKeys = Object.keys || function keys(O) { return $keys$2(O, enumBugKeys$1); }; var dP$4 = _objectDp; var anObject$9 = _anObject; var getKeys$3 = _objectKeys; var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { anObject$9(O); var keys = getKeys$3(Properties); var length = keys.length; var i = 0; var P; while (length > i) dP$4.f(O, P = keys[i++], Properties[P]); return O; }; var document$1 = _global.exports.document; var _html = document$1 && document$1.documentElement; // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject$8 = _anObject; var dPs = _objectDps; var enumBugKeys = _enumBugKeys; 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$8(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 : dPs(result, Properties); }; var _wks = {exports: {}}; var store = _shared.exports('wks'); var uid$1 = _uid; var Symbol$1 = _global.exports.Symbol; var USE_SYMBOL = typeof Symbol$1 == 'function'; var $exports = _wks.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol$1[name] || (USE_SYMBOL ? Symbol$1 : uid$1)('Symbol.' + name)); }; $exports.store = store; var def = _objectDp.f; var has$4 = _has; var TAG$1 = _wks.exports('toStringTag'); var _setToStringTag = function (it, tag, stat) { if (it && !has$4(it = stat ? it : it.prototype, TAG$1)) def(it, TAG$1, { configurable: true, value: tag }); }; var create$4 = _objectCreate; var descriptor = _propertyDesc; var setToStringTag$3 = _setToStringTag; var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() _hide(IteratorPrototype, _wks.exports('iterator'), function () { return this; }); var _iterCreate = function (Constructor, NAME, next) { Constructor.prototype = create$4(IteratorPrototype, { next: descriptor(1, next) }); setToStringTag$3(Constructor, NAME + ' Iterator'); }; // 7.1.13 ToObject(argument) var defined$1 = _defined; var _toObject = function (it) { return Object(defined$1(it)); }; // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has$3 = _has; var toObject$5 = _toObject; var IE_PROTO = _sharedKey('IE_PROTO'); var ObjectProto$1 = Object.prototype; var _objectGpo = Object.getPrototypeOf || function (O) { O = toObject$5(O); if (has$3(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto$1 : null; }; var $export$l = _export; var redefine$1 = _redefine; var hide$3 = _hide; var Iterators$4 = _iterators; var $iterCreate = _iterCreate; var setToStringTag$2 = _setToStringTag; var getPrototypeOf$2 = _objectGpo; var ITERATOR$3 = _wks.exports('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$3] || 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 = getPrototypeOf$2($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators setToStringTag$2(IteratorPrototype, TAG, true); } } // 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 ((FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR$3])) { hide$3(proto, ITERATOR$3, $default); } // Plug for library Iterators$4[NAME] = $default; Iterators$4[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$1(proto, key, methods[key]); } else $export$l($export$l.P + $export$l.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; var $at = _stringAt(true); // 21.1.3.27 String.prototype[@@iterator]() _iterDefine(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 }; }); var _iterStep = function (done, value) { return { value: value, done: !!done }; }; var step$1 = _iterStep; var Iterators$3 = _iterators; var toIObject$5 = _toIobject; // 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]() _iterDefine(Array, 'Array', function (iterated, kind) { this._t = toIObject$5(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 step$1(1); } if (kind == 'keys') return step$1(0, index); if (kind == 'values') return step$1(0, O[index]); return step$1(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators$3.Arguments = Iterators$3.Array; var global$a = _global.exports; var hide$2 = _hide; var Iterators$2 = _iterators; var TO_STRING_TAG = _wks.exports('toStringTag'); var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' + 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' + 'TextTrackList,TouchList').split(','); for (var i = 0; i < DOMIterables.length; i++) { var NAME = DOMIterables[i]; var Collection = global$a[NAME]; var proto = Collection && Collection.prototype; if (proto && !proto[TO_STRING_TAG]) hide$2(proto, TO_STRING_TAG, NAME); Iterators$2[NAME] = Iterators$2.Array; } // getting tag from 19.1.3.6 Object.prototype.toString() var cof$1 = _cof; var TAG = _wks.exports('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)) == 'string' ? T // builtinTag case : ARG ? cof$1(O) // ES3 arguments fallback : (B = cof$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; var _anInstance = function (it, Constructor, name, forbiddenField) { if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { throw TypeError(name + ': incorrect invocation!'); } return it; }; var _forOf = {exports: {}}; // call something on iterator step with safe closing on error var anObject$7 = _anObject; var _iterCall = function (iterator, fn, value, entries) { try { return entries ? fn(anObject$7(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch (e) { var ret = iterator['return']; if (ret !== undefined) anObject$7(ret.call(iterator)); throw e; } }; // check on default Array iterator var Iterators$1 = _iterators; var ITERATOR$2 = _wks.exports('iterator'); var ArrayProto = Array.prototype; var _isArrayIter = function (it) { return it !== undefined && (Iterators$1.Array === it || ArrayProto[ITERATOR$2] === it); }; var classof$2 = _classof; var ITERATOR$1 = _wks.exports('iterator'); var Iterators = _iterators; var core_getIteratorMethod = _core.exports.getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR$1] || it['@@iterator'] || Iterators[classof$2(it)]; }; var ctx$6 = _ctx; var call$1 = _iterCall; var isArrayIter$1 = _isArrayIter; var anObject$6 = _anObject; var toLength$2 = _toLength; var getIterFn$1 = core_getIteratorMethod; var BREAK = {}; var RETURN = {}; var exports$1 = _forOf.exports = function (iterable, entries, fn, that, ITERATOR) { var iterFn = ITERATOR ? function () { return iterable; } : getIterFn$1(iterable); var f = ctx$6(fn, that, entries ? 2 : 1); var index = 0; var length, step, iterator, result; if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); // fast case for arrays with default iterator if (isArrayIter$1(iterFn)) for (length = toLength$2(iterable.length); length > index; index++) { result = entries ? f(anObject$6(step = iterable[index])[0], step[1]) : f(iterable[index]); if (result === BREAK || result === RETURN) return result; } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { result = call$1(iterator, f, step.value, entries); if (result === BREAK || result === RETURN) return result; } }; exports$1.BREAK = BREAK; exports$1.RETURN = RETURN; // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject$5 = _anObject; var aFunction$5 = _aFunction; var SPECIES$2 = _wks.exports('species'); var _speciesConstructor = function (O, D) { var C = anObject$5(O).constructor; var S; return C === undefined || (S = anObject$5(C)[SPECIES$2]) == undefined ? D : aFunction$5(S); }; // 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 ctx$5 = _ctx; var invoke$1 = _invoke; var html = _html; var cel = _domCreate; var global$9 = _global.exports; var process$3 = global$9.process; var setTask = global$9.setImmediate; var clearTask = global$9.clearImmediate; var MessageChannel = global$9.MessageChannel; var Dispatch = global$9.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var defer, channel, port; var run = function () { var id = +this; // eslint-disable-next-line no-prototype-builtins if (queue.hasOwnProperty(id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function (event) { run.call(event.data); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!setTask || !clearTask) { setTask = function setImmediate(fn) { var args = []; var i = 1; while (arguments.length > i) args.push(arguments[i++]); queue[++counter] = function () { // eslint-disable-next-line no-new-func invoke$1(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (_cof(process$3) == 'process') { defer = function (id) { process$3.nextTick(ctx$5(run, id, 1)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(ctx$5(run, id, 1)); }; // Browsers with MessageChannel, includes WebWorkers } else if (MessageChannel) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = ctx$5(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if (global$9.addEventListener && typeof postMessage == 'function' && !global$9.importScripts) { defer = function (id) { global$9.postMessage(id + '', '*'); }; global$9.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in cel('script')) { defer = function (id) { html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run.call(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(ctx$5(run, id, 1), 0); }; } } var _task = { set: setTask, clear: clearTask }; var global$8 = _global.exports; var macrotask = _task.set; var Observer = global$8.MutationObserver || global$8.WebKitMutationObserver; var process$2 = global$8.process; var Promise$1 = global$8.Promise; var isNode$1 = _cof(process$2) == 'process'; var _microtask = function () { var head, last, notify; var flush = function () { var parent, fn; if (isNode$1 && (parent = process$2.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (e) { if (head) notify(); else last = undefined; throw e; } } last = undefined; if (parent) parent.enter(); }; // Node.js if (isNode$1) { notify = function () { process$2.nextTick(flush); }; // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 } else if (Observer && !(global$8.navigator && global$8.navigator.standalone)) { var toggle = true; var node = document.createTextNode(''); new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (Promise$1 && Promise$1.resolve) { // Promise.resolve without an argument throws an error in LG WebOS 2 var promise = Promise$1.resolve(undefined); notify = function () { promise.then(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function () { // strange IE + webpack dev server bug - use .call(global) macrotask.call(global$8, flush); }; } return function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; }; var _newPromiseCapability = {}; // 25.4.1.5 NewPromiseCapability(C) var aFunction$4 = _aFunction; function PromiseCapability(C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction$4(resolve); this.reject = aFunction$4(reject); } _newPromiseCapability.f = function (C) { return new PromiseCapability(C); }; var _perform = function (exec) { try { return { e: false, v: exec() }; } catch (e) { return { e: true, v: e }; } }; var global$7 = _global.exports; var navigator$1 = global$7.navigator; var _userAgent = navigator$1 && navigator$1.userAgent || ''; var anObject$4 = _anObject; var isObject$9 = _isObject; var newPromiseCapability$2 = _newPromiseCapability; var _promiseResolve = function (C, x) { anObject$4(C); if (isObject$9(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability$2.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; var hide$1 = _hide; var _redefineAll = function (target, src, safe) { for (var key in src) { if (safe && target[key]) target[key] = src[key]; else hide$1(target, key, src[key]); } return target; }; var global$6 = _global.exports; var core$4 = _core.exports; var dP$3 = _objectDp; var DESCRIPTORS$5 = _descriptors; var SPECIES$1 = _wks.exports('species'); var _setSpecies = function (KEY) { var C = typeof core$4[KEY] == 'function' ? core$4[KEY] : global$6[KEY]; if (DESCRIPTORS$5 && C && !C[SPECIES$1]) dP$3.f(C, SPECIES$1, { configurable: true, get: function () { return this; } }); }; var ITERATOR = _wks.exports('iterator'); var SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function () { SAFE_CLOSING = true; }; // eslint-disable-next-line no-throw-literal Array.from(riter, function () { throw 2; }); } 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](); iter.next = function () { return { done: safe = true }; }; arr[ITERATOR] = function () { return iter; }; exec(arr); } catch (e) { /* empty */ } return safe; }; var LIBRARY = _library; var global$5 = _global.exports; var ctx$4 = _ctx; var classof$1 = _classof; var $export$k = _export; var isObject$8 = _isObject; var aFunction$3 = _aFunction; var anInstance$2 = _anInstance; var forOf$4 = _forOf.exports; var speciesConstructor$2 = _speciesConstructor; var task = _task.set; var microtask = _microtask(); var newPromiseCapabilityModule = _newPromiseCapability; var perform$1 = _perform; var userAgent = _userAgent; var promiseResolve$1 = _promiseResolve; var PROMISE = 'Promise'; var TypeError$1 = global$5.TypeError; var process$1 = global$5.process; var versions = process$1 && process$1.versions; var v8 = versions && versions.v8 || ''; var $Promise = global$5[PROMISE]; var isNode = classof$1(process$1) == 'process'; var empty = function () { /* empty */ }; var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; var newPromiseCapability$1 = newGenericPromiseCapability = newPromiseCapabilityModule.f; var USE_NATIVE$1 = !!function () { try { // correct subclassing with @@species support var promise = $Promise.resolve(1); var FakePromise = (promise.constructor = {})[_wks.exports('species')] = function (exec) { exec(empty, empty); }; // unhandled rejections tracking support, NodeJS Promise without it fails @@species test return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // we can't detect it synchronously, so just check versions && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1; } catch (e) { /* empty */ } }(); // helpers var isThenable = function (it) { var then; return isObject$8(it) && typeof (then = it.then) == 'function' ? then : false; }; var notify$1 = function (promise, isReject) { if (promise._n) return; promise._n = true; var chain = promise._c; microtask(function () { var value = promise._v; var ok = promise._s == 1; var i = 0; var run = function (reaction) { var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then, exited; try { if (handler) { if (!ok) { if (promise._h == 2) onHandleUnhandled(promise); promise._h = 1; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); // may throw if (domain) { domain.exit(); exited = true; } } if (result === reaction.promise) { reject(TypeError$1('Promise-chain cycle')); } else if (then = isThenable(result)) { then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch (e) { if (domain && !exited) domain.exit(); reject(e); } }; while (chain.length > i) run(chain[i++]); // variable length - can't use forEach promise._c = []; promise._n = false; if (isReject && !promise._h) onUnhandled(promise); }); }; var onUnhandled = function (promise) { task.call(global$5, function () { var value = promise._v; var unhandled = isUnhandled(promise); var result, handler, console; if (unhandled) { result = perform$1(function () { if (isNode) { process$1.emit('unhandledRejection', value, promise); } else if (handler = global$5.onunhandledrejection) { handler({ promise: promise, reason: value }); } else if ((console = global$5.console) && console.error) { console.error('Unhandled promise rejection', value); } }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = undefined; if (unhandled && result.e) throw result.v; }); }; var isUnhandled = function (promise) { return promise._h !== 1 && (promise._a || promise._c).length === 0; }; var onHandleUnhandled = function (promise) { task.call(global$5, function () { var handler; if (isNode) { process$1.emit('rejectionHandled', promise); } else if (handler = global$5.onrejectionhandled) { handler({ promise: promise, reason: promise._v }); } }); }; var $reject = function (value) { var promise = this; if (promise._d) return; promise._d = true; promise = promise._w || promise; // unwrap promise._v = value; promise._s = 2; if (!promise._a) promise._a = promise._c.slice(); notify$1(promise, true); }; var $resolve = function (value) { var promise = this; var then; if (promise._d) return; promise._d = true; promise = promise._w || promise; // unwrap try { if (promise === value) throw TypeError$1("Promise can't be resolved itself"); if (then = isThenable(value)) { microtask(function () { var wrapper = { _w: promise, _d: false }; // wrap try { then.call(value, ctx$4($resolve, wrapper, 1), ctx$4($reject, wrapper, 1)); } catch (e) { $reject.call(wrapper, e); } }); } else { promise._v = value; promise._s = 1; notify$1(promise, false); } } catch (e) { $reject.call({ _w: promise, _d: false }, e); // wrap } }; // constructor polyfill if (!USE_NATIVE$1) { // 25.4.3.1 Promise(executor) $Promise = function Promise(executor) { anInstance$2(this, $Promise, PROMISE, '_h'); aFunction$3(executor); Internal.call(this); try { executor(ctx$4($resolve, this, 1), ctx$4($reject, this, 1)); } catch (err) { $reject.call(this, err); } }; // eslint-disable-next-line no-unused-vars Internal = function Promise(executor) { this._c = []; // <- awaiting reactions this._a = undefined; // <- checked in isUnhandled reactions this._s = 0; // <- state this._d = false; // <- done this._v = undefined; // <- value this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; Internal.prototype = _redefineAll($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected) { var reaction = newPromiseCapability$1(speciesConstructor$2(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = isNode ? process$1.domain : undefined; this._c.push(reaction); if (this._a) this._a.push(reaction); if (this._s) notify$1(this, false); return reaction.promise; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); OwnPromiseCapability = function () { var promise = new Internal(); this.promise = promise; this.resolve = ctx$4($resolve, promise, 1); this.reject = ctx$4($reject, promise, 1); }; newPromiseCapabilityModule.f = newPromiseCapability$1 = function (C) { return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; } $export$k($export$k.G + $export$k.W + $export$k.F * !USE_NATIVE$1, { Promise: $Promise }); _setToStringTag($Promise, PROMISE); _setSpecies(PROMISE); Wrapper = _core.exports[PROMISE]; // statics $export$k($export$k.S + $export$k.F * !USE_NATIVE$1, PROMISE, { // 25.4.4.5 Promise.reject(r) reject: function reject(r) { var capability = newPromiseCapability$1(this); var $$reject = capability.reject; $$reject(r); return capability.promise; } }); $export$k($export$k.S + $export$k.F * (LIBRARY ), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x) { return promiseResolve$1(this === Wrapper ? $Promise : this, x); } }); $export$k($export$k.S + $export$k.F * !(USE_NATIVE$1 && _iterDetect(function (iter) { $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) all: function all(iterable) { var C = this; var capability = newPromiseCapability$1(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform$1(function () { var values = []; var index = 0; var remaining = 1; forOf$4(iterable, false, function (promise) { var $index = index++; var alreadyCalled = false; values.push(undefined); remaining++; C.resolve(promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.e) reject(result.v); return capability.promise; }, // 25.4.4.4 Promise.race(iterable) race: function race(iterable) { var C = this; var capability = newPromiseCapability$1(C); var reject = capability.reject; var result = perform$1(function () { forOf$4(iterable, false, function (promise) { C.resolve(promise).then(capability.resolve, reject); }); }); if (result.e) reject(result.v); return capability.promise; } }); var $export$j = _export; var core$3 = _core.exports; var global$4 = _global.exports; var speciesConstructor$1 = _speciesConstructor; var promiseResolve = _promiseResolve; $export$j($export$j.P + $export$j.R, 'Promise', { 'finally': function (onFinally) { var C = speciesConstructor$1(this, core$3.Promise || global$4.Promise); var isFunction = typeof onFinally == 'function'; return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally ); } }); // https://github.com/tc39/proposal-promise-try var $export$i = _export; var newPromiseCapability = _newPromiseCapability; var perform = _perform; $export$i($export$i.S, 'Promise', { 'try': function (callbackfn) { var promiseCapability = newPromiseCapability.f(this); var result = perform(callbackfn); (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); return promiseCapability.promise; } }); var promise$1 = _core.exports.Promise; var promise = promise$1; function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } var regeneratorRuntime$1 = {exports: {}}; var _typeof$1 = {exports: {}}; var _meta = {exports: {}}; var META$1 = _uid('meta'); var isObject$7 = _isObject; var has$2 = _has; var setDesc = _objectDp.f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var FREEZE = !_fails(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function (it) { setDesc(it, META$1, { value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs } }); }; var fastKey$1 = function (it, create) { // return primitive with prefix if (!isObject$7(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!has$2(it, META$1)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMeta(it); // return object ID } return it[META$1].i; }; var getWeak = function (it, create) { if (!has$2(it, META$1)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMeta(it); // return hash weak collections IDs } return it[META$1].w; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZE && meta$1.NEED && isExtensible(it) && !has$2(it, META$1)) setMeta(it); return it; }; var meta$1 = _meta.exports = { KEY: META$1, NEED: false, fastKey: fastKey$1, getWeak: getWeak, onFreeze: onFreeze }; var _wksExt = {}; _wksExt.f = _wks.exports; var core$2 = _core.exports; var wksExt$1 = _wksExt; var defineProperty$2 = _objectDp.f; var _wksDefine = function (name) { var $Symbol = core$2.Symbol || (core$2.Symbol = {} ); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty$2($Symbol, name, { value: wksExt$1.f(name) }); }; var _objectGops = {}; _objectGops.f = Object.getOwnPropertySymbols; var _objectPie = {}; _objectPie.f = {}.propertyIsEnumerable; // all enumerable object keys, includes symbols var getKeys$2 = _objectKeys; var gOPS$2 = _objectGops; var pIE$2 = _objectPie; var _enumKeys = function (it) { var result = getKeys$2(it); var getSymbols = gOPS$2.f; if (getSymbols) { var symbols = getSymbols(it); var isEnum = pIE$2.f; var i = 0; var key; while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); } return result; }; // 7.2.2 IsArray(argument) var cof = _cof; var _isArray = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; var _objectGopnExt = {}; var _objectGopn = {}; // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys$1 = _objectKeysInternal; var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); _objectGopn.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return $keys$1(O, hiddenKeys); }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject$4 = _toIobject; var gOPN$2 = _objectGopn.f; var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return gOPN$2(it); } catch (e) { return windowNames.slice(); } }; _objectGopnExt.f = function getOwnPropertyNames(it) { return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN$2(toIObject$4(it)); }; var _objectGopd = {}; var pIE$1 = _objectPie; var createDesc$2 = _propertyDesc; var toIObject$3 = _toIobject; var toPrimitive$3 = _toPrimitive$1; var has$1 = _has; var IE8_DOM_DEFINE = _ie8DomDefine; var gOPD$2 = Object.getOwnPropertyDescriptor; _objectGopd.f = _descriptors ? gOPD$2 : function getOwnPropertyDescriptor(O, P) { O = toIObject$3(O); P = toPrimitive$3(P, true); if (IE8_DOM_DEFINE) try { return gOPD$2(O, P); } catch (e) { /* empty */ } if (has$1(O, P)) return createDesc$2(!pIE$1.f.call(O, P), O[P]); }; // ECMAScript 6 symbols shim var global$3 = _global.exports; var has = _has; var DESCRIPTORS$4 = _descriptors; var $export$h = _export; var redefine = _redefine; var META = _meta.exports.KEY; var $fails = _fails; var shared = _shared.exports; var setToStringTag$1 = _setToStringTag; var uid = _uid; var wks = _wks.exports; var wksExt = _wksExt; var wksDefine = _wksDefine; var enumKeys = _enumKeys; var isArray$3 = _isArray; var anObject$3 = _anObject; var isObject$6 = _isObject; var toObject$4 = _toObject; var toIObject$2 = _toIobject; var toPrimitive$2 = _toPrimitive$1; var createDesc$1 = _propertyDesc; var _create = _objectCreate; var gOPNExt = _objectGopnExt; var $GOPD = _objectGopd; var $GOPS = _objectGops; var $DP = _objectDp; var $keys = _objectKeys; var gOPD$1 = $GOPD.f; var dP$2 = $DP.f; var gOPN$1 = gOPNExt.f; var $Symbol = global$3.Symbol; var $JSON$1 = global$3.JSON; var _stringify = $JSON$1 && $JSON$1.stringify; var PROTOTYPE = 'prototype'; var HIDDEN = wks('_hidden'); var TO_PRIMITIVE = wks('toPrimitive'); var isEnum$1 = {}.propertyIsEnumerable; var SymbolRegistry = shared('symbol-registry'); var AllSymbols = shared('symbols'); var OPSymbols = shared('op-symbols'); var ObjectProto = Object[PROTOTYPE]; var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f; var QObject = global$3.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var setter = !