]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/polyfill/es6.js
Merge remote-tracking branch 'upstream/pull/2167'
[rails.git] / vendor / assets / polyfill / es6.js
1 /* Polyfill service v3.27.1
2  * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
3  * 
4  * Features requested: es6
5  * 
6  * - _ESAbstract.IsCallable, License: CC0 (required by "Array.from", "es6", "Array.prototype.find", "Array.prototype.findIndex", "Map", "Set", "WeakMap", "WeakSet", "_ESAbstract.GetMethod", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map", "Function.prototype.bind", "_ESAbstract.Construct", "Array.of", "Object.getOwnPropertyDescriptor", "Object.assign", "_ESAbstract.OrdinaryToPrimitive", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.fill", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
7  * - Object.defineProperty, License: CC0 (required by "Function.name", "es6", "Map", "Array.from", "Number.Epsilon", "Number.MAX_SAFE_INTEGER", "Number.MIN_SAFE_INTEGER", "Object.setPrototypeOf", "RegExp.prototype.flags", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Symbol", "WeakMap", "WeakSet", "_ESAbstract.CreateMethodProperty", "Array.of", "Array.prototype.copyWithin", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.keys", "Array.prototype.values", "Math.acosh", "Math.asinh", "Math.atanh", "Math.cbrt", "Math.clz32", "Math.cosh", "Math.expm1", "Math.fround", "Math.hypot", "Math.imul", "Math.log10", "Math.log1p", "Math.log2", "Math.sign", "Math.sinh", "Math.tanh", "Math.trunc", "Number.isFinite", "Number.isInteger", "Number.isNaN", "Number.isSafeInteger", "Number.parseFloat", "Number.parseInt", "Object.assign", "Object.is", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ArrayIterator", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "_StringIterator", "_ESAbstract.CreateDataProperty", "_ESAbstract.CreateDataPropertyOrThrow", "_ESAbstract.CreateIterResultObject", "_Iterator", "Object.defineProperties", "Object.create", "_ESAbstract.GetIterator")
8  * - _ESAbstract.CreateMethodProperty, License: CC0 (required by "Array.from", "es6", "Array.of", "Array.prototype.@@iterator", "Array.prototype.copyWithin", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.keys", "Array.prototype.values", "Map", "Math.acosh", "Math.asinh", "Math.atanh", "Math.cbrt", "Math.clz32", "Math.cosh", "Math.expm1", "Math.fround", "Math.hypot", "Math.imul", "Math.log10", "Math.log1p", "Math.log2", "Math.sign", "Math.sinh", "Math.tanh", "Math.trunc", "Number.isFinite", "Number.isInteger", "Number.isNaN", "Number.isSafeInteger", "Number.parseFloat", "Number.parseInt", "Object.assign", "Object.is", "Object.setPrototypeOf", "Set", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "WeakMap", "WeakSet", "Array.isArray", "Object.create", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.GetIterator", "_ArrayIterator", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Object.getOwnPropertyDescriptor", "Array.prototype.forEach", "Object.getPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.filter", "Array.prototype.map", "Object.freeze", "Function.prototype.bind", "Object.defineProperties", "_Iterator", "_StringIterator")
9  * - _ESAbstract.ToObject, License: CC0 (required by "Array.from", "es6", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "Object.assign", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.GetV", "_ESAbstract.GetMethod", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "Object.defineProperties", "Object.create", "_ArrayIterator", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
10  * - _ESAbstract.GetV, License: CC0 (required by "_ESAbstract.GetMethod", "Array.from", "es6", "Map", "Set", "_ESAbstract.GetIterator", "WeakMap", "WeakSet")
11  * - _ESAbstract.GetMethod, License: CC0 (required by "Array.from", "es6", "Map", "Set", "_ESAbstract.IsConstructor", "Array.of", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ESAbstract.IteratorClose", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
12  * - _ESAbstract.ToInteger, License: CC0 (required by "Array.prototype.copyWithin", "es6", "Array.prototype.fill", "Number.isInteger", "Number.isSafeInteger", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ESAbstract.ToLength", "Array.from", "Array.prototype.find", "Array.prototype.findIndex")
13  * - _ESAbstract.ToLength, License: CC0 (required by "Array.from", "es6", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map")
14  * - _ESAbstract.Get, License: CC0 (required by "Array.from", "es6", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Object.assign", "RegExp.prototype.flags", "WeakMap", "WeakSet", "_ESAbstract.IteratorValue", "Map", "Set", "_ESAbstract.IteratorComplete", "_ESAbstract.IteratorStep", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.IsRegExp", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.startsWith", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.GetPrototypeFromConstructor", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "Object.defineProperties", "Object.create", "_ESAbstract.GetIterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_Iterator", "_StringIterator", "_ESAbstract.ArraySpeciesCreate", "_ESAbstract.OrdinaryToPrimitive", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "String.prototype.codePointAt", "String.prototype.repeat")
15  * - _ESAbstract.HasProperty, License: CC0 (required by "Array.prototype.copyWithin", "es6", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map")
16  * - _ESAbstract.Call, License: CC0 (required by "Array.from", "es6", "Array.prototype.find", "Array.prototype.findIndex", "WeakMap", "WeakSet", "_ESAbstract.GetIterator", "Map", "Set", "_ESAbstract.IteratorClose", "_ESAbstract.IteratorNext", "_ESAbstract.IteratorStep", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.of", "Array.prototype.fill", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ESAbstract.OrdinaryToPrimitive")
17  * - _ESAbstract.Type, License: CC0 (required by "Map", "es6", "Array.from", "Number.isFinite", "Number.isInteger", "Number.isNaN", "Number.isSafeInteger", "RegExp.prototype.flags", "WeakMap", "WeakSet", "_ESAbstract.IsConstructor", "Array.of", "_ESAbstract.GetIterator", "Set", "_ESAbstract.IteratorClose", "_ESAbstract.ToString", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ESAbstract.IteratorValue", "_ESAbstract.CreateIterResultObject", "_ESAbstract.IteratorComplete", "_ESAbstract.IteratorStep", "_ESAbstract.IteratorNext", "_ESAbstract.SameValueZero", "Object.create", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "_ESAbstract.SameValue", "Object.is", "_ESAbstract.IsRegExp", "_ESAbstract.ToPrimitive", "_ESAbstract.GetPrototypeFromConstructor", "Object.defineProperties", "_Iterator", "_StringIterator", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.OrdinaryToPrimitive")
18  * - _ESAbstract.OrdinaryToPrimitive, License: CC0 (required by "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.from", "es6", "Array.of", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
19  * - _ESAbstract.ToPrimitive, License: CC0 (required by "_ESAbstract.ToString", "Array.from", "es6", "Array.of", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
20  * - _ESAbstract.ToString, License: CC0 (required by "Array.from", "es6", "Array.of", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map")
21  * - Array.prototype.forEach, License: CC0 (required by "Object.setPrototypeOf", "es6", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
22  * - _ESAbstract.IsArray, License: CC0 (required by "WeakMap", "es6", "WeakSet", "Array.isArray", "Map", "Array.from", "Set", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
23  * - _ESAbstract.ArrayCreate, License: CC0 (required by "Array.from", "es6", "Array.of", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
24  * - _ESAbstract.IsConstructor, License: CC0 (required by "Array.from", "es6", "Array.of", "_ESAbstract.Construct", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
25  * - _ESAbstract.GetPrototypeFromConstructor, License: CC0 (required by "_ESAbstract.OrdinaryCreateFromConstructor", "Map", "es6", "Array.from", "Set", "WeakMap", "WeakSet", "_ESAbstract.Construct", "Array.of")
26  * - Object.keys, License: MIT (required by "Object.assign", "es6", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Object.defineProperties", "Object.create", "Object.setPrototypeOf", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
27  * - Function.prototype.bind, License: MIT (required by "_ESAbstract.Construct", "Array.from", "es6", "Array.of", "Object.getOwnPropertyDescriptor", "Object.assign", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_StringIterator")
28  * - Object.getOwnPropertyDescriptor, License: CC0 (required by "Object.assign", "es6", "Object.setPrototypeOf", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Object.defineProperties", "Object.create", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
29  * - Object.defineProperties, License: CC0 (required by "Object.create", "Map", "es6", "Array.from", "Object.setPrototypeOf", "Set", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
30  * - Object.create, License: CC0 (required by "Map", "es6", "Array.from", "Object.setPrototypeOf", "Set", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_StringIterator")
31  * - Object.getPrototypeOf, License: CC0 (required by "Object.setPrototypeOf", "es6", "_ESAbstract.OrdinaryCreateFromConstructor", "Map", "Array.from", "Set", "WeakMap", "WeakSet", "_ESAbstract.Construct", "Array.of")
32  * - _ESAbstract.OrdinaryCreateFromConstructor, License: CC0 (required by "Map", "es6", "Array.from", "Set", "WeakMap", "WeakSet", "_ESAbstract.Construct", "Array.of")
33  * - _ESAbstract.Construct, License: CC0 (required by "Array.from", "es6", "Array.of", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
34  * - _ESAbstract.ArraySpeciesCreate, License: CC0 (required by "Array.prototype.filter", "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
35  * - _ESAbstract.ToBoolean, License: CC0 (required by "Array.prototype.find", "es6", "Array.prototype.findIndex", "RegExp.prototype.flags", "_ESAbstract.IteratorComplete", "Map", "Array.from", "Set", "_ESAbstract.IteratorStep", "WeakMap", "WeakSet", "_ESAbstract.IsRegExp", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.startsWith", "Array.prototype.filter", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
36  * - _ESAbstract.CreateDataProperty, License: CC0 (required by "_ESAbstract.CreateDataPropertyOrThrow", "Array.from", "es6", "Array.of", "_ESAbstract.CreateIterResultObject", "Map", "Set")
37  * - _ESAbstract.CreateDataPropertyOrThrow, License: CC0 (required by "Array.from", "es6", "Array.of", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
38  * - Array.prototype.filter, License: CC0 (required by "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
39  * - Array.prototype.map, License: CC0 (required by "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
40  * - Object.getOwnPropertyNames, License: CC0 (required by "Object.setPrototypeOf", "es6", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
41  * - Object.freeze, License: CC0 (required by "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
42  * - Symbol, License: MIT (required by "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "WeakMap", "WeakSet", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_StringIterator")
43  * - Symbol.iterator, License: MIT (required by "es6", "Array.from", "Array.prototype.@@iterator", "Map", "Set", "String.prototype.@@iterator", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_StringIterator")
44  * - _ESAbstract.GetIterator, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
45  * - _ESAbstract.IteratorClose, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
46  * - _ESAbstract.IteratorNext, License: CC0 (required by "Map", "es6", "Array.from", "Set", "_ESAbstract.IteratorStep", "WeakMap", "WeakSet")
47  * - _ESAbstract.IteratorComplete, License: CC0 (required by "Map", "es6", "Array.from", "Set", "_ESAbstract.IteratorStep", "WeakMap", "WeakSet")
48  * - _ESAbstract.IteratorStep, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
49  * - _ESAbstract.IteratorValue, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
50  * - _ESAbstract.CreateIterResultObject, License: CC0 (required by "Map", "es6", "Array.from", "Set")
51  * - _ESAbstract.SameValueNonNumber, License: CC0 (required by "_ESAbstract.SameValueZero", "Map", "es6", "Array.from", "Set", "WeakSet", "_ESAbstract.SameValue", "Object.is", "WeakMap")
52  * - _ESAbstract.SameValueZero, License: CC0 (required by "Map", "es6", "Array.from", "Set", "WeakSet")
53  * - Array.isArray, License: CC0 (required by "Map", "es6", "Array.from", "Set", "WeakMap")
54  * - Symbol.species, License: MIT (required by "es6", "Map", "Array.from", "Set")
55  * - Map, License: CC0 (required by "es6", "Array.from")
56  * - Set, License: CC0 (required by "es6", "Array.from")
57  * - Array.from, License: CC0 (required by "es6")
58  * - Array.of, License: CC0 (required by "es6")
59  * - Object.assign, License: CC0 (required by "es6", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
60  * - Symbol.toStringTag, License: MIT (required by "es6", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
61  * - _Iterator, License: MIT (required by "_ArrayIterator", "Array.prototype.entries", "es6", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
62  * - Object.setPrototypeOf, License: MIT (required by "es6", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
63  * - _ESAbstract.RequireObjectCoercible, License: CC0 (required by "String.prototype.@@iterator", "es6", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
64  * - _ESAbstract.IsRegExp, License: CC0 (required by "String.prototype.endsWith", "es6", "String.prototype.includes", "String.prototype.startsWith")
65  * - String.prototype.includes, License: CC0 (required by "es6", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator")
66  * - _ArrayIterator, License: MIT (required by "Array.prototype.entries", "es6", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator")
67  * - Array.prototype.values, License: MIT (required by "es6", "Array.prototype.@@iterator")
68  * - Array.prototype.@@iterator, License: CC0 (required by "es6")
69  * - Array.prototype.copyWithin, License: MIT (required by "es6")
70  * - Array.prototype.entries, License: CC0 (required by "es6")
71  * - Array.prototype.fill, License: CC0 (required by "es6")
72  * - Array.prototype.find, License: CC0 (required by "es6")
73  * - Array.prototype.findIndex, License: CC0 (required by "es6")
74  * - Array.prototype.keys, License: CC0 (required by "es6")
75  * - Function.name, License: MIT (required by "es6")
76  * - Math.acosh, License: CC0 (required by "es6")
77  * - Math.asinh, License: CC0 (required by "es6")
78  * - Math.atanh, License: CC0 (required by "es6")
79  * - Math.cbrt, License: CC0 (required by "es6")
80  * - _ESAbstract.ToUint32, License: CC0 (required by "Math.clz32", "es6", "Math.imul")
81  * - Math.clz32, License: CC0 (required by "es6")
82  * - Math.cosh, License: CC0 (required by "es6")
83  * - Math.expm1, License: CC0 (required by "es6")
84  * - _TypedArray, License: Copyright 2010, Linden Research, Inc. Copyright 2014, Joshua Bell. (required by "Math.fround", "es6")
85  * - Math.fround, License: CC0 (required by "es6")
86  * - Math.hypot, License: CC0 (required by "es6")
87  * - Math.imul, License: CC0 (required by "es6")
88  * - Math.log10, License: CC0 (required by "es6")
89  * - Math.log1p, License: CC0 (required by "es6")
90  * - Math.log2, License: CC0 (required by "es6")
91  * - Math.sign, License: CC0 (required by "es6")
92  * - Math.sinh, License: CC0 (required by "es6")
93  * - Math.tanh, License: CC0 (required by "es6")
94  * - Math.trunc, License: CC0 (required by "es6")
95  * - Number.Epsilon, License: MIT (required by "es6")
96  * - Number.MAX_SAFE_INTEGER, License: MIT (required by "es6")
97  * - Number.MIN_SAFE_INTEGER, License: MIT (required by "es6")
98  * - Number.isFinite, License: MIT (required by "es6")
99  * - Number.isInteger, License: MIT (required by "es6")
100  * - Number.isNaN, License: MIT (required by "es6")
101  * - Number.isSafeInteger, License: MIT (required by "es6")
102  * - Number.parseFloat, License: MIT (required by "es6")
103  * - Number.parseInt, License: MIT (required by "es6")
104  * - _ESAbstract.SameValue, License: CC0 (required by "Object.is", "es6", "WeakMap")
105  * - Object.is, License: CC0 (required by "es6")
106  * - Promise, License: MIT (required by "es6")
107  * - RegExp.prototype.flags, License: MIT (required by "es6")
108  * - _StringIterator, License: MIT (required by "String.prototype.@@iterator", "es6")
109  * - String.prototype.@@iterator, License: CC0 (required by "es6")
110  * - _ESAbstract.UTF16Decode, License: CC0 (required by "String.prototype.codePointAt", "es6")
111  * - String.prototype.codePointAt, License: MIT (required by "es6")
112  * - String.prototype.endsWith, License: CC0 (required by "es6")
113  * - String.prototype.repeat, License: CC0 (required by "es6")
114  * - String.prototype.startsWith, License: CC0 (required by "es6")
115  * - Symbol.hasInstance, License: MIT (required by "es6")
116  * - Symbol.isConcatSpreadable, License: MIT (required by "es6")
117  * - Symbol.match, License: MIT (required by "es6")
118  * - Symbol.replace, License: MIT (required by "es6")
119  * - Symbol.search, License: MIT (required by "es6")
120  * - Symbol.split, License: MIT (required by "es6")
121  * - Symbol.toPrimitive, License: MIT (required by "es6")
122  * - Symbol.unscopables, License: MIT (required by "es6")
123  * - WeakMap, License: CC0 (required by "es6")
124  * - WeakSet, License: CC0 (required by "es6") */
125
126 (function(undefined) {
127
128 // _ESAbstract.IsCallable
129 // 7.2.3. IsCallable ( argument )
130 function IsCallable(argument) { // eslint-disable-line no-unused-vars
131         // 1. If Type(argument) is not Object, return false.
132         // 2. If argument has a [[Call]] internal method, return true.
133         // 3. Return false.
134
135         // Polyfill.io - Only function objects have a [[Call]] internal method. This means we can simplify this function to check that the argument has a type of function.
136         return typeof argument === 'function';
137 }
138 if (!(// In IE8, defineProperty could only act on DOM elements, so full support
139 // for the feature requires the ability to set a property on an arbitrary object
140 'defineProperty' in Object && (function() {
141         try {
142                 var a = {};
143                 Object.defineProperty(a, 'test', {value:42});
144                 return true;
145         } catch(e) {
146                 return false
147         }
148 }()))) {
149
150 // Object.defineProperty
151 (function (nativeDefineProperty) {
152
153         var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
154         var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
155         var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
156
157         // Polyfill.io - This does not use CreateMethodProperty because our CreateMethodProperty function uses Object.defineProperty.
158         Object['defineProperty'] = function defineProperty(object, property, descriptor) {
159
160                 // Where native support exists, assume it
161                 if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
162                         return nativeDefineProperty(object, property, descriptor);
163                 }
164
165                 if (object === null || !(object instanceof Object || typeof object === 'object')) {
166                         throw new TypeError('Object.defineProperty called on non-object');
167                 }
168
169                 if (!(descriptor instanceof Object)) {
170                         throw new TypeError('Property description must be an object');
171                 }
172
173                 var propertyString = String(property);
174                 var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
175                 var getterType = 'get' in descriptor && typeof descriptor.get;
176                 var setterType = 'set' in descriptor && typeof descriptor.set;
177
178                 // handle descriptor.get
179                 if (getterType) {
180                         if (getterType !== 'function') {
181                                 throw new TypeError('Getter must be a function');
182                         }
183                         if (!supportsAccessors) {
184                                 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
185                         }
186                         if (hasValueOrWritable) {
187                                 throw new TypeError(ERR_VALUE_ACCESSORS);
188                         }
189                         Object.__defineGetter__.call(object, propertyString, descriptor.get);
190                 } else {
191                         object[propertyString] = descriptor.value;
192                 }
193
194                 // handle descriptor.set
195                 if (setterType) {
196                         if (setterType !== 'function') {
197                                 throw new TypeError('Setter must be a function');
198                         }
199                         if (!supportsAccessors) {
200                                 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
201                         }
202                         if (hasValueOrWritable) {
203                                 throw new TypeError(ERR_VALUE_ACCESSORS);
204                         }
205                         Object.__defineSetter__.call(object, propertyString, descriptor.set);
206                 }
207
208                 // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
209                 if ('value' in descriptor) {
210                         object[propertyString] = descriptor.value;
211                 }
212
213                 return object;
214         };
215 }(Object.defineProperty));
216
217 }
218
219
220 // _ESAbstract.CreateMethodProperty
221 // 7.3.5. CreateMethodProperty ( O, P, V )
222 function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars
223         // 1. Assert: Type(O) is Object.
224         // 2. Assert: IsPropertyKey(P) is true.
225         // 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}.
226         var newDesc = {
227                 value: V,
228                 writable: true,
229                 enumerable: false,
230                 configurable: true
231         };
232         // 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
233         Object.defineProperty(O, P, newDesc);
234 }
235
236 // _ESAbstract.ToObject
237 // 7.1.13 ToObject ( argument )
238 // The abstract operation ToObject converts argument to a value of type Object according to Table 12:
239 // Table 12: ToObject Conversions
240 /*
241 |----------------------------------------------------------------------------------------------------------------------------------------------------|
242 | Argument Type | Result                                                                                                                             |
243 |----------------------------------------------------------------------------------------------------------------------------------------------------|
244 | Undefined     | Throw a TypeError exception.                                                                                                       |
245 | Null          | Throw a TypeError exception.                                                                                                       |
246 | Boolean       | Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 19.3 for a description of Boolean objects. |
247 | Number        | Return a new Number object whose [[NumberData]] internal slot is set to argument. See 20.1 for a description of Number objects.    |
248 | String        | Return a new String object whose [[StringData]] internal slot is set to argument. See 21.1 for a description of String objects.    |
249 | Symbol        | Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 19.4 for a description of Symbol objects.    |
250 | Object        | Return argument.                                                                                                                   |
251 |----------------------------------------------------------------------------------------------------------------------------------------------------|
252 */
253 function ToObject(argument) { // eslint-disable-line no-unused-vars
254         if (argument === null || argument === undefined) {
255                 throw TypeError();
256         }
257   return Object(argument);
258 }
259
260 // _ESAbstract.GetV
261 /* global ToObject */
262 // 7.3.2 GetV (V, P)
263 function GetV(v, p) { // eslint-disable-line no-unused-vars
264         // 1. Assert: IsPropertyKey(P) is true.
265         // 2. Let O be ? ToObject(V).
266         var o = ToObject(v);
267         // 3. Return ? O.[[Get]](P, V).
268         return o[p];
269 }
270
271 // _ESAbstract.GetMethod
272 /* global GetV, IsCallable */
273 // 7.3.9. GetMethod ( V, P )
274 function GetMethod(V, P) { // eslint-disable-line no-unused-vars
275         // 1. Assert: IsPropertyKey(P) is true.
276         // 2. Let func be ? GetV(V, P).
277         var func = GetV(V, P);
278         // 3. If func is either undefined or null, return undefined.
279         if (func === null || func === undefined) {
280                 return undefined;
281         }
282         // 4. If IsCallable(func) is false, throw a TypeError exception.
283         if (IsCallable(func) === false) {
284                 throw new TypeError('Method not callable: ' + P);
285         }
286         // 5. Return func.
287         return func;
288 }
289
290 // _ESAbstract.ToInteger
291 // 7.1.4. ToInteger ( argument )
292 function ToInteger(argument) { // eslint-disable-line no-unused-vars
293         // 1. Let number be ? ToNumber(argument).
294         var number = Number(argument);
295         // 2. If number is NaN, return +0.
296         if (isNaN(number)) {
297                 return 0;
298         }
299         // 3. If number is +0, -0, +∞, or -∞, return number.
300         if (1/number === Infinity || 1/number === -Infinity || number === Infinity || number === -Infinity) {
301                 return number;
302         }
303         // 4. Return the number value that is the same sign as number and whose magnitude is floor(abs(number)).
304         return ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number));
305 }
306
307 // _ESAbstract.ToLength
308 /* global ToInteger */
309 // 7.1.15. ToLength ( argument )
310 function ToLength(argument) { // eslint-disable-line no-unused-vars
311         // 1. Let len be ? ToInteger(argument).
312         var len = ToInteger(argument);
313         // 2. If len ≤ +0, return +0.
314         if (len <= 0) {
315                 return 0;
316         }
317         // 3. Return min(len, 253-1).
318         return Math.min(len, Math.pow(2, 53) -1);
319 }
320
321 // _ESAbstract.Get
322 // 7.3.1. Get ( O, P )
323 function Get(O, P) { // eslint-disable-line no-unused-vars
324         // 1. Assert: Type(O) is Object.
325         // 2. Assert: IsPropertyKey(P) is true.
326         // 3. Return ? O.[[Get]](P, O).
327         return O[P];
328 }
329
330 // _ESAbstract.HasProperty
331 // 7.3.10. HasProperty ( O, P )
332 function HasProperty(O, P) { // eslint-disable-line no-unused-vars
333         // Assert: Type(O) is Object.
334         // Assert: IsPropertyKey(P) is true.
335         // Return ? O.[[HasProperty]](P).
336         return P in O;
337 }
338
339 // _ESAbstract.Call
340 /* global IsCallable */
341 // 7.3.12. Call ( F, V [ , argumentsList ] )
342 function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-vars
343         // 1. If argumentsList is not present, set argumentsList to a new empty List.
344         var argumentsList = arguments.length > 2 ? arguments[2] : [];
345         // 2. If IsCallable(F) is false, throw a TypeError exception.
346         if (IsCallable(F) === false) {
347                 throw new TypeError(Object.prototype.toString.call(F) + 'is not a function.');
348         }
349         // 3. Return ? F.[[Call]](V, argumentsList).
350         return F.apply(V, argumentsList);
351 }
352
353 // _ESAbstract.Type
354 // "Type(x)" is used as shorthand for "the type of x"...
355 function Type(x) { // eslint-disable-line no-unused-vars
356         switch (typeof x) {
357                 case 'undefined':
358                         return 'undefined';
359                 case 'boolean':
360                         return 'boolean';
361                 case 'number':
362                         return 'number';
363                 case 'string':
364                         return 'string';
365                 case 'symbol':
366                         return 'symbol';
367                 default:
368                         // typeof null is 'object'
369                         if (x === null) return 'null';
370                         // Polyfill.io - This is here because a Symbol polyfill will have a typeof `object`.
371                         if ('Symbol' in this && x instanceof this.Symbol) return 'symbol';
372                         return 'object';
373         }
374 }
375
376 // _ESAbstract.OrdinaryToPrimitive
377 /* global Get, IsCallable, Call, Type */
378 // 7.1.1.1. OrdinaryToPrimitive ( O, hint )
379 function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars
380         // 1. Assert: Type(O) is Object.
381         // 2. Assert: Type(hint) is String and its value is either "string" or "number".
382         // 3. If hint is "string", then
383         if (hint === 'string') {
384                 // a. Let methodNames be « "toString", "valueOf" ».
385                 var methodNames = ['toString', 'valueOf'];
386                 // 4. Else,
387         } else {
388                 // a. Let methodNames be « "valueOf", "toString" ».
389                 methodNames = ['valueOf', 'toString'];
390         }
391         // 5. For each name in methodNames in List order, do
392         for (var i = 0; i < methodNames.length; ++i) {
393                 var name = methodNames[i];
394                 // a. Let method be ? Get(O, name).
395                 var method = Get(O, name);
396                 // b. If IsCallable(method) is true, then
397                 if (IsCallable(method)) {
398                         // i. Let result be ? Call(method, O).
399                         var result = Call(method, O);
400                         // ii. If Type(result) is not Object, return result.
401                         if (Type(result) !== 'object') {
402                                 return result;
403                         }
404                 }
405         }
406         // 6. Throw a TypeError exception.
407         throw new TypeError('Cannot convert to primitive.');
408 }
409
410 // _ESAbstract.ToPrimitive
411 /* global Type, GetMethod, Call, OrdinaryToPrimitive */
412 // 7.1.1. ToPrimitive ( input [ , PreferredType ] )
413 function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no-unused-vars
414         var PreferredType = arguments.length > 1 ? arguments[1] : undefined;
415         // 1. Assert: input is an ECMAScript language value.
416         // 2. If Type(input) is Object, then
417         if (Type(input) === 'object') {
418                 // a. If PreferredType is not present, let hint be "default".
419                 if (arguments.length < 2) {
420                         var hint = 'default';
421                         // b. Else if PreferredType is hint String, let hint be "string".
422                 } else if (PreferredType === String) {
423                         hint = 'string';
424                         // c. Else PreferredType is hint Number, let hint be "number".
425                 } else if (PreferredType === Number) {
426                         hint = 'number';
427                 }
428                 // d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
429                 var exoticToPrim = typeof this.Symbol === 'function' && typeof this.Symbol.toPrimitive === 'symbol' ? GetMethod(input, this.Symbol.toPrimitive) : undefined;
430                 // e. If exoticToPrim is not undefined, then
431                 if (exoticToPrim !== undefined) {
432                         // i. Let result be ? Call(exoticToPrim, input, « hint »).
433                         var result = Call(exoticToPrim, input, [hint]);
434                         // ii. If Type(result) is not Object, return result.
435                         if (Type(result) !== 'object') {
436                                 return result;
437                         }
438                         // iii. Throw a TypeError exception.
439                         throw new TypeError('Cannot convert exotic object to primitive.');
440                 }
441                 // f. If hint is "default", set hint to "number".
442                 if (hint === 'default') {
443                         hint = 'number';
444                 }
445                 // g. Return ? OrdinaryToPrimitive(input, hint).
446                 return OrdinaryToPrimitive(input, hint);
447         }
448         // 3. Return input
449         return input;
450 }
451
452 // _ESAbstract.ToString
453 /* global Type, ToPrimitive */
454 // 7.1.12. ToString ( argument )
455 // The abstract operation ToString converts argument to a value of type String according to Table 11:
456 // Table 11: ToString Conversions
457 /*
458 |---------------|--------------------------------------------------------|
459 | Argument Type | Result                                                 |
460 |---------------|--------------------------------------------------------|
461 | Undefined     | Return "undefined".                                    |
462 |---------------|--------------------------------------------------------|
463 | Null          | Return "null".                                         |
464 |---------------|--------------------------------------------------------|
465 | Boolean       | If argument is true, return "true".                    |
466 |               | If argument is false, return "false".                  |
467 |---------------|--------------------------------------------------------|
468 | Number        | Return NumberToString(argument).                       |
469 |---------------|--------------------------------------------------------|
470 | String        | Return argument.                                       |
471 |---------------|--------------------------------------------------------|
472 | Symbol        | Throw a TypeError exception.                           |
473 |---------------|--------------------------------------------------------|
474 | Object        | Apply the following steps:                             |
475 |               | Let primValue be ? ToPrimitive(argument, hint String). |
476 |               | Return ? ToString(primValue).                          |
477 |---------------|--------------------------------------------------------|
478 */
479 function ToString(argument) { // eslint-disable-line no-unused-vars
480         switch(Type(argument)) {
481                 case 'symbol':
482                         throw new TypeError('Cannot convert a Symbol value to a string');
483                         break;
484                 case 'object':
485                         var primValue = ToPrimitive(argument, 'string');
486                         return ToString(primValue);
487                 default:
488                         return String(argument);
489         }
490 }
491 if (!('forEach' in Array.prototype)) {
492
493 // Array.prototype.forEach
494 /* global Call, CreateMethodProperty, Get, HasProperty, IsCallable, ToLength, ToObject, ToString */
495 // 22.1.3.10. Array.prototype.forEach ( callbackfn [ , thisArg ] )
496 CreateMethodProperty(Array.prototype, 'forEach', function forEach(callbackfn /* [ , thisArg ] */) {
497         // 1. Let O be ? ToObject(this value).
498         var O = ToObject(this);
499         // Polyfill.io - If O is a String object, split it into an array in order to iterate correctly.
500         // We will use arrayLike in place of O when we are iterating through the list.
501         var arraylike = O instanceof String ? O.split('') : O;
502         // 2. Let len be ? ToLength(? Get(O, "length")).
503         var len = ToLength(Get(O, "length"));
504         // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
505         if (IsCallable(callbackfn) === false) {
506                 throw new TypeError(callbackfn + ' is not a function');
507         }
508         // 4. If thisArg is present, let T be thisArg; else let T be undefined.
509         var T = arguments.length > 1 ? arguments[1] : undefined;
510         // 5. Let k be 0.
511         var k = 0;
512         // 6. Repeat, while k < len
513         while (k < len) {
514                 // a. Let Pk be ! ToString(k).
515                 var Pk = ToString(k);
516                 // b. Let kPresent be ? HasProperty(O, Pk).
517                 var kPresent = HasProperty(arraylike, Pk);
518                 // c. If kPresent is true, then
519                 if (kPresent) {
520                         // i. Let kValue be ? Get(O, Pk).
521                         var kValue = Get(arraylike, Pk);
522                         // ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
523                         Call(callbackfn, T, [kValue, k, O]);
524                 }
525                 // d. Increase k by 1.
526                 k = k + 1;
527         }
528         // 7. Return undefined.
529         return undefined;
530 });
531
532 }
533
534
535 // _ESAbstract.IsArray
536 // 7.2.2. IsArray ( argument )
537 function IsArray(argument) { // eslint-disable-line no-unused-vars
538         // 1. If Type(argument) is not Object, return false.
539         // 2. If argument is an Array exotic object, return true.
540         // 3. If argument is a Proxy exotic object, then
541                 // a. If argument.[[ProxyHandler]] is null, throw a TypeError exception.
542                 // b. Let target be argument.[[ProxyTarget]].
543                 // c. Return ? IsArray(target).
544         // 4. Return false.
545
546         // Polyfill.io - We can skip all the above steps and check the string returned from Object.prototype.toString().
547         return Object.prototype.toString.call(argument) === '[object Array]';
548 }
549
550 // _ESAbstract.ArrayCreate
551 // 9.4.2.2. ArrayCreate ( length [ , proto ] )
552 function ArrayCreate(length /* [, proto] */) { // eslint-disable-line no-unused-vars
553         // 1. Assert: length is an integer Number ≥ 0.
554         // 2. If length is -0, set length to +0.
555         if (1 / length === -Infinity) {
556                 length = 0;
557         }
558         // 3. If length>2^32-1, throw a RangeError exception.
559         if (length > (Math.pow(2, 32) - 1)) {
560                 throw new RangeError('Invalid array length');
561         }
562         // 4. If proto is not present, set proto to the intrinsic object %ArrayPrototype%.
563         // 5. Let A be a newly created Array exotic object.
564         var A = [];
565         // 6. Set A's essential internal methods except for [[DefineOwnProperty]] to the default ordinary object definitions specified in 9.1.
566         // 7. Set A.[[DefineOwnProperty]] as specified in 9.4.2.1.
567         // 8. Set A.[[Prototype]] to proto.
568         // 9. Set A.[[Extensible]] to true.
569         // 10. Perform ! OrdinaryDefineOwnProperty(A, "length", PropertyDescriptor{[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).
570         A.length = length;
571         // 11. Return A.
572         return A;
573 }
574
575 // _ESAbstract.IsConstructor
576 /* global Type */
577 // 7.2.4. IsConstructor ( argument )
578 function IsConstructor(argument) { // eslint-disable-line no-unused-vars
579         // 1. If Type(argument) is not Object, return false.
580         if (Type(argument) !== 'object') {
581                 return false;
582         }
583         // 2. If argument has a [[Construct]] internal method, return true.
584         // 3. Return false.
585
586         // Polyfill.io - `new argument` is the only way  to truly test if a function is a constructor.
587         // We choose to not use`new argument` because the argument could have side effects when called.
588         // Instead we check to see if the argument is a function and if it has a prototype.
589         // Arrow functions do not have a [[Construct]] internal method, nor do they have a prototype.
590         return typeof argument === 'function' && !!argument.prototype;
591 }
592
593 // _ESAbstract.GetPrototypeFromConstructor
594 /* global Get, Type */
595 // 9.1.14. GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
596 function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars
597         // 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object. The corresponding object must be an intrinsic that is intended to be used as the [[Prototype]] value of an object.
598         // 2. Assert: IsCallable(constructor) is true.
599         // 3. Let proto be ? Get(constructor, "prototype").
600         var proto = Get(constructor, "prototype");
601         // 4. If Type(proto) is not Object, then
602         if (Type(proto) !== 'object') {
603                 // a. Let realm be ? GetFunctionRealm(constructor).
604                 // b. Set proto to realm's intrinsic object named intrinsicDefaultProto.
605                 proto = intrinsicDefaultProto;
606         }
607         // 5. Return proto.
608         return proto;
609 }
610 if (!('keys' in Object && (function () {
611         // Safari 5.0 bug where Object.keys doesn't work with arguments
612         return (Object.keys(arguments)).length === 2;
613 }(1, 2)) && (function () {
614         try {
615                 // In ES6 Object.keys works on all object except `null` and `undefined`.
616                 Object.keys('');
617                 return true;
618         } catch (e) {
619                 return false;
620         }
621 }()))) {
622
623 // Object.keys
624 Object.keys = (function() {
625         'use strict';
626
627         // modified from https://github.com/es-shims/object-keys
628
629         var has = Object.prototype.hasOwnProperty;
630         var toStr = Object.prototype.toString;
631         var isEnumerable = Object.prototype.propertyIsEnumerable;
632         var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
633         var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
634         var dontEnums = [
635                 'toString',
636                 'toLocaleString',
637                 'valueOf',
638                 'hasOwnProperty',
639                 'isPrototypeOf',
640                 'propertyIsEnumerable',
641                 'constructor'
642         ];
643         var equalsConstructorPrototype = function (o) {
644                 var ctor = o.constructor;
645                 return ctor && ctor.prototype === o;
646         };
647         var excludedKeys = {
648                 $console: true,
649                 $external: true,
650                 $frame: true,
651                 $frameElement: true,
652                 $frames: true,
653                 $innerHeight: true,
654                 $innerWidth: true,
655                 $outerHeight: true,
656                 $outerWidth: true,
657                 $pageXOffset: true,
658                 $pageYOffset: true,
659                 $parent: true,
660                 $scrollLeft: true,
661                 $scrollTop: true,
662                 $scrollX: true,
663                 $scrollY: true,
664                 $self: true,
665                 $webkitIndexedDB: true,
666                 $webkitStorageInfo: true,
667                 $window: true
668         };
669         var hasAutomationEqualityBug = (function () {
670                 /* global window */
671                 if (typeof window === 'undefined') { return false; }
672                 for (var k in window) {
673                         try {
674                                 if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
675                                         try {
676                                                 equalsConstructorPrototype(window[k]);
677                                         } catch (e) {
678                                                 return true;
679                                         }
680                                 }
681                         } catch (e) {
682                                 return true;
683                         }
684                 }
685                 return false;
686         }());
687         var equalsConstructorPrototypeIfNotBuggy = function (o) {
688                 /* global window */
689                 if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
690                         return equalsConstructorPrototype(o);
691                 }
692                 try {
693                         return equalsConstructorPrototype(o);
694                 } catch (e) {
695                         return false;
696                 }
697         };
698
699         function isArgumentsObject(value) {
700                 var str = toStr.call(value);
701                 var isArgs = str === '[object Arguments]';
702                 if (!isArgs) {
703                         isArgs = str !== '[object Array]' &&
704                                 value !== null &&
705                                 typeof value === 'object' &&
706                                 typeof value.length === 'number' &&
707                                 value.length >= 0 &&
708                                 toStr.call(value.callee) === '[object Function]';
709                 }
710                 return isArgs;
711         }
712
713         return function keys(object) {
714                 var isFunction = toStr.call(object) === '[object Function]';
715                 var isArguments = isArgumentsObject(object);
716                 var isString = toStr.call(object) === '[object String]';
717                 var theKeys = [];
718
719                 if (object === undefined || object === null) {
720                         throw new TypeError('Cannot convert undefined or null to object');
721                 }
722
723                 var skipProto = hasProtoEnumBug && isFunction;
724                 if (isString && object.length > 0 && !has.call(object, 0)) {
725                         for (var i = 0; i < object.length; ++i) {
726                                 theKeys.push(String(i));
727                         }
728                 }
729
730                 if (isArguments && object.length > 0) {
731                         for (var j = 0; j < object.length; ++j) {
732                                 theKeys.push(String(j));
733                         }
734                 } else {
735                         for (var name in object) {
736                                 if (!(skipProto && name === 'prototype') && has.call(object, name)) {
737                                         theKeys.push(String(name));
738                                 }
739                         }
740                 }
741
742                 if (hasDontEnumBug) {
743                         var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
744
745                         for (var k = 0; k < dontEnums.length; ++k) {
746                                 if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
747                                         theKeys.push(dontEnums[k]);
748                                 }
749                         }
750                 }
751                 return theKeys;
752         };
753 }());
754
755 }
756
757 if (!('bind' in Function.prototype)) {
758
759 // Function.prototype.bind
760 /* global CreateMethodProperty, IsCallable */
761 // 19.2.3.2. Function.prototype.bind ( thisArg, ...args )
762 // https://github.com/es-shims/es5-shim/blob/d6d7ff1b131c7ba14c798cafc598bb6780d37d3b/es5-shim.js#L182
763 CreateMethodProperty(Function.prototype, 'bind', function bind(that) { // .length is 1
764         // add necessary es5-shim utilities
765         var $Array = Array;
766         var $Object = Object;
767         var ArrayPrototype = $Array.prototype;
768         var Empty = function Empty() { };
769         var array_slice = ArrayPrototype.slice;
770         var array_concat = ArrayPrototype.concat;
771         var array_push = ArrayPrototype.push;
772         var max = Math.max;
773         // /add necessary es5-shim utilities
774
775         // 1. Let Target be the this value.
776         var target = this;
777         // 2. If IsCallable(Target) is false, throw a TypeError exception.
778         if (!IsCallable(target)) {
779                 throw new TypeError('Function.prototype.bind called on incompatible ' + target);
780         }
781         // 3. Let A be a new (possibly empty) internal list of all of the
782         //   argument values provided after thisArg (arg1, arg2 etc), in order.
783         // XXX slicedArgs will stand in for "A" if used
784         var args = array_slice.call(arguments, 1); // for normal call
785         // 4. Let F be a new native ECMAScript object.
786         // 11. Set the [[Prototype]] internal property of F to the standard
787         //   built-in Function prototype object as specified in 15.3.3.1.
788         // 12. Set the [[Call]] internal property of F as described in
789         //   15.3.4.5.1.
790         // 13. Set the [[Construct]] internal property of F as described in
791         //   15.3.4.5.2.
792         // 14. Set the [[HasInstance]] internal property of F as described in
793         //   15.3.4.5.3.
794         var bound;
795         var binder = function () {
796
797                 if (this instanceof bound) {
798                         // 15.3.4.5.2 [[Construct]]
799                         // When the [[Construct]] internal method of a function object,
800                         // F that was created using the bind function is called with a
801                         // list of arguments ExtraArgs, the following steps are taken:
802                         // 1. Let target be the value of F's [[TargetFunction]]
803                         //   internal property.
804                         // 2. If target has no [[Construct]] internal method, a
805                         //   TypeError exception is thrown.
806                         // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
807                         //   property.
808                         // 4. Let args be a new list containing the same values as the
809                         //   list boundArgs in the same order followed by the same
810                         //   values as the list ExtraArgs in the same order.
811                         // 5. Return the result of calling the [[Construct]] internal
812                         //   method of target providing args as the arguments.
813
814                         var result = target.apply(
815                                 this,
816                                 array_concat.call(args, array_slice.call(arguments))
817                         );
818                         if ($Object(result) === result) {
819                                 return result;
820                         }
821                         return this;
822
823                 } else {
824                         // 15.3.4.5.1 [[Call]]
825                         // When the [[Call]] internal method of a function object, F,
826                         // which was created using the bind function is called with a
827                         // this value and a list of arguments ExtraArgs, the following
828                         // steps are taken:
829                         // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
830                         //   property.
831                         // 2. Let boundThis be the value of F's [[BoundThis]] internal
832                         //   property.
833                         // 3. Let target be the value of F's [[TargetFunction]] internal
834                         //   property.
835                         // 4. Let args be a new list containing the same values as the
836                         //   list boundArgs in the same order followed by the same
837                         //   values as the list ExtraArgs in the same order.
838                         // 5. Return the result of calling the [[Call]] internal method
839                         //   of target providing boundThis as the this value and
840                         //   providing args as the arguments.
841
842                         // equiv: target.call(this, ...boundArgs, ...args)
843                         return target.apply(
844                                 that,
845                                 array_concat.call(args, array_slice.call(arguments))
846                         );
847
848                 }
849
850         };
851
852         // 15. If the [[Class]] internal property of Target is "Function", then
853         //     a. Let L be the length property of Target minus the length of A.
854         //     b. Set the length own property of F to either 0 or L, whichever is
855         //       larger.
856         // 16. Else set the length own property of F to 0.
857
858         var boundLength = max(0, target.length - args.length);
859
860         // 17. Set the attributes of the length own property of F to the values
861         //   specified in 15.3.5.1.
862         var boundArgs = [];
863         for (var i = 0; i < boundLength; i++) {
864                 array_push.call(boundArgs, '$' + i);
865         }
866
867         // XXX Build a dynamic function with desired amount of arguments is the only
868         // way to set the length property of a function.
869         // In environments where Content Security Policies enabled (Chrome extensions,
870         // for ex.) all use of eval or Function costructor throws an exception.
871         // However in all of these environments Function.prototype.bind exists
872         // and so this code will never be executed.
873         bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
874
875         if (target.prototype) {
876                 Empty.prototype = target.prototype;
877                 bound.prototype = new Empty();
878                 // Clean up dangling references.
879                 Empty.prototype = null;
880         }
881
882         // TODO
883         // 18. Set the [[Extensible]] internal property of F to true.
884
885         // TODO
886         // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
887         // 20. Call the [[DefineOwnProperty]] internal method of F with
888         //   arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
889         //   thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
890         //   false.
891         // 21. Call the [[DefineOwnProperty]] internal method of F with
892         //   arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
893         //   [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
894         //   and false.
895
896         // TODO
897         // NOTE Function objects created using Function.prototype.bind do not
898         // have a prototype property or the [[Code]], [[FormalParameters]], and
899         // [[Scope]] internal properties.
900         // XXX can't delete prototype in pure-js.
901
902         // 22. Return F.
903         return bound;
904 });
905
906 }
907
908 if (!('getOwnPropertyDescriptor' in Object && typeof Object.getOwnPropertyDescriptor === 'function' && (function() {
909     try {
910         var object = {};
911         object.test = 0;
912         return Object.getOwnPropertyDescriptor(
913             object,
914             "test"
915         ).value === 0;
916     } catch (exception) {
917         return false
918     }
919 }()))) {
920
921 // Object.getOwnPropertyDescriptor
922 /* global CreateMethodProperty */
923 (function () {
924         var call = Function.prototype.call;
925         var prototypeOfObject = Object.prototype;
926         var owns = call.bind(prototypeOfObject.hasOwnProperty);
927
928         var lookupGetter;
929         var lookupSetter;
930         var supportsAccessors;
931         if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
932             lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
933             lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
934         }
935         function doesGetOwnPropertyDescriptorWork(object) {
936             try {
937                 object.sentinel = 0;
938                 return Object.getOwnPropertyDescriptor(
939                     object,
940                     "sentinel"
941                 ).value === 0;
942             } catch (exception) {
943                 // returns falsy
944             }
945         }
946         // check whether getOwnPropertyDescriptor works if it's given. Otherwise,
947         // shim partially.
948         if (Object.defineProperty) {
949             var getOwnPropertyDescriptorWorksOnObject =
950                 doesGetOwnPropertyDescriptorWork({});
951             var getOwnPropertyDescriptorWorksOnDom = typeof document == "undefined" ||
952                 doesGetOwnPropertyDescriptorWork(document.createElement("div"));
953             if (!getOwnPropertyDescriptorWorksOnDom ||
954                 !getOwnPropertyDescriptorWorksOnObject
955             ) {
956                 var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor;
957             }
958         }
959
960         if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
961             var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: ";
962
963             CreateMethodProperty(Object, 'getOwnPropertyDescriptor', function getOwnPropertyDescriptor(object, property) {
964                 if ((typeof object != "object" && typeof object != "function") || object === null) {
965                     throw new TypeError(ERR_NON_OBJECT + object);
966                 }
967
968                 // make a valiant attempt to use the real getOwnPropertyDescriptor
969                 // for I8's DOM elements.
970                 if (getOwnPropertyDescriptorFallback) {
971                     try {
972                         return getOwnPropertyDescriptorFallback.call(Object, object, property);
973                     } catch (exception) {
974                         // try the shim if the real one doesn't work
975                     }
976                 }
977
978                 // If object does not owns property return undefined immediately.
979                 if (!owns(object, property)) {
980                     return;
981                 }
982
983                 // If object has a property then it's for sure both `enumerable` and
984                 // `configurable`.
985                 var descriptor = { enumerable: true, configurable: true };
986
987                 // If JS engine supports accessor properties then property may be a
988                 // getter or setter.
989                 if (supportsAccessors) {
990                     // Unfortunately `__lookupGetter__` will return a getter even
991                     // if object has own non getter property along with a same named
992                     // inherited getter. To avoid misbehavior we temporary remove
993                     // `__proto__` so that `__lookupGetter__` will return getter only
994                     // if it's owned by an object.
995                     var prototype = object.__proto__;
996                     object.__proto__ = prototypeOfObject;
997
998                     var getter = lookupGetter(object, property);
999                     var setter = lookupSetter(object, property);
1000
1001                     // Once we have getter and setter we can put values back.
1002                     object.__proto__ = prototype;
1003
1004                     if (getter || setter) {
1005                         if (getter) {
1006                             descriptor.get = getter;
1007                         }
1008                         if (setter) {
1009                             descriptor.set = setter;
1010                         }
1011                         // If it was accessor property we're done and return here
1012                         // in order to avoid adding `value` to the descriptor.
1013                         return descriptor;
1014                     }
1015                 }
1016
1017                 // If we got this far we know that object has an own property that is
1018                 // not an accessor so we set it as a value and return descriptor.
1019                 descriptor.value = object[property];
1020                         descriptor.writable = true;
1021                 return descriptor;
1022             });
1023         }
1024 }());
1025
1026 }
1027
1028 if (!('defineProperties' in Object)) {
1029
1030 // Object.defineProperties
1031 /* global CreateMethodProperty, Get, ToObject, Type */
1032 // 19.1.2.3. Object.defineProperties ( O, Properties )
1033 CreateMethodProperty(Object, 'defineProperties', function defineProperties(O, Properties) {
1034         // 1. If Type(O) is not Object, throw a TypeError exception.
1035         if (Type(O) !== 'object') {
1036                 throw new TypeError('Object.defineProperties called on non-object');
1037         }
1038         // 2. Let props be ? ToObject(Properties).
1039         var props = ToObject(Properties);
1040         // 3. Let keys be ? props.[[OwnPropertyKeys]]().
1041         /*
1042                 Polyfill.io - This step in our polyfill is not complying with the specification.
1043                 [[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols.
1044                 TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]].
1045         */
1046         var keys = Object.keys(props);
1047         // 4. Let descriptors be a new empty List.
1048         var descriptors = [];
1049         // 5. For each element nextKey of keys in List order, do
1050         for (var i = 0; i < keys.length; i++) {
1051                 var nextKey = keys[i];
1052                 // a. Let propDesc be ? props.[[GetOwnProperty]](nextKey).
1053                 var propDesc = Object.getOwnPropertyDescriptor(props, nextKey);
1054                 // b. If propDesc is not undefined and propDesc.[[Enumerable]] is true, then
1055                 if (propDesc !== undefined && propDesc.enumerable) {
1056                         // i. Let descObj be ? Get(props, nextKey).
1057                         var descObj = Get(props, nextKey);
1058                         // ii. Let desc be ? ToPropertyDescriptor(descObj).
1059                         // Polyfill.io - We skip this step because Object.defineProperty deals with it.
1060                         // TODO: Implement this step?
1061                         var desc = descObj;
1062                         // iii. Append the pair (a two element List) consisting of nextKey and desc to the end of descriptors.
1063                         descriptors.push([nextKey, desc]);
1064                 }
1065         }
1066         // 6. For each pair from descriptors in list order, do
1067         for (var i = 0; i < descriptors.length; i++){
1068                 // a. Let P be the first element of pair.
1069                 var P = descriptors[i][0];
1070                 // b. Let desc be the second element of pair.
1071                 var desc = descriptors[i][1];
1072                 // c. Perform ? DefinePropertyOrThrow(O, P, desc).
1073                 Object.defineProperty(O, P, desc);
1074         }
1075         // 7. Return O.
1076         return O;
1077 });
1078
1079 }
1080
1081 if (!('create' in Object)) {
1082
1083 // Object.create
1084 /* global CreateMethodProperty, Type */
1085 CreateMethodProperty(Object, 'create', function create(O, properties) {
1086         // 1. If Type(O) is neither Object nor Null, throw a TypeError exception.
1087         if (Type(O) !== 'object' && Type(O) !== 'null') {
1088                 throw new TypeError('Object prototype may only be an Object or null');
1089         }
1090         // 2. Let obj be ObjectCreate(O).
1091         var obj = new Function('e', 'function Object() {}Object.prototype=e;return new Object')(O);
1092
1093         obj.constructor.prototype = O;
1094
1095         // 3. If Properties is not undefined, then
1096         if (1 in arguments) {
1097                 // a. Return ? ObjectDefineProperties(obj, Properties).
1098                 return Object.defineProperties(obj, properties);
1099         }
1100
1101         return obj;
1102 });
1103
1104 }
1105
1106 if (!('getPrototypeOf' in Object)) {
1107
1108 // Object.getPrototypeOf
1109 /* global CreateMethodProperty */
1110 // Based on: https://github.com/es-shims/es5-shim/blob/master/es5-sham.js
1111
1112 // https://github.com/es-shims/es5-shim/issues#issue/2
1113 // http://ejohn.org/blog/objectgetprototypeof/
1114 // recommended by fschaefer on github
1115 //
1116 // sure, and webreflection says ^_^
1117 // ... this will nerever possibly return null
1118 // ... Opera Mini breaks here with infinite loops
1119 CreateMethodProperty(Object, 'getPrototypeOf', function getPrototypeOf(object) {
1120         if (object !== Object(object)) {
1121                 throw new TypeError('Object.getPrototypeOf called on non-object');
1122         }
1123         var proto = object.__proto__;
1124         if (proto || proto === null) {
1125                 return proto;
1126         } else if (typeof object.constructor == 'function' && object instanceof object.constructor) {
1127     return object.constructor.prototype;
1128   } else if (object instanceof Object) {
1129                 return Object.prototype;
1130         } else {
1131                 // Correctly return null for Objects created with `Object.create(null)`
1132                 // (shammed or native) or `{ __proto__: null}`.  Also returns null for
1133                 // cross-realm objects on browsers that lack `__proto__` support (like
1134                 // IE <11), but that's the best we can do.
1135                 return null;
1136         }
1137 });
1138
1139 }
1140
1141
1142 // _ESAbstract.OrdinaryCreateFromConstructor
1143 /* global GetPrototypeFromConstructor */
1144 // 9.1.13. OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
1145 function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars
1146         var internalSlotsList = arguments[2] || {};
1147         // 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object.
1148         // The corresponding object must be an intrinsic that is intended to be used as the[[Prototype]] value of an object.
1149
1150         // 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
1151         var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto);
1152
1153         // 3. Return ObjectCreate(proto, internalSlotsList).
1154         // Polyfill.io - We do not pass internalSlotsList to Object.create because Object.create does not use the default ordinary object definitions specified in 9.1.
1155         var obj = Object.create(proto);
1156         for (var name in internalSlotsList) {
1157                 if (Object.prototype.hasOwnProperty.call(internalSlotsList, name)) {
1158                         Object.defineProperty(obj, name, {
1159                                 configurable: true,
1160                                 enumerable: false,
1161                                 writable: true,
1162                                 value: internalSlotsList[name]
1163                         });
1164                 }
1165         }
1166         return obj;
1167 }
1168
1169 // _ESAbstract.Construct
1170 /* global IsConstructor, OrdinaryCreateFromConstructor, Call */
1171 // 7.3.13. Construct ( F [ , argumentsList [ , newTarget ]] )
1172 function Construct(F /* [ , argumentsList [ , newTarget ]] */) { // eslint-disable-line no-unused-vars
1173         // 1. If newTarget is not present, set newTarget to F.
1174         var newTarget = arguments.length > 2 ? arguments[2] : F;
1175
1176         // 2. If argumentsList is not present, set argumentsList to a new empty List.
1177         var argumentsList = arguments.length > 1 ? arguments[1] : [];
1178
1179         // 3. Assert: IsConstructor(F) is true.
1180         if (!IsConstructor(F)) {
1181                 throw new TypeError('F must be a constructor.');
1182         }
1183
1184         // 4. Assert: IsConstructor(newTarget) is true.
1185         if (!IsConstructor(newTarget)) {
1186                 throw new TypeError('newTarget must be a constructor.');
1187         }
1188
1189         // 5. Return ? F.[[Construct]](argumentsList, newTarget).
1190         // Polyfill.io - If newTarget is the same as F, it is equivalent to new F(...argumentsList).
1191         if (newTarget === F) {
1192                 return new (Function.prototype.bind.apply(F, [null].concat(argumentsList)))();
1193         } else {
1194                 // Polyfill.io - This is mimicking section 9.2.2 step 5.a.
1195                 var obj = OrdinaryCreateFromConstructor(newTarget, Object.prototype);
1196                 return Call(F, obj, argumentsList);
1197         }
1198 }
1199
1200 // _ESAbstract.ArraySpeciesCreate
1201 /* global IsArray, ArrayCreate, Get, Type, IsConstructor, Construct */
1202 // 9.4.2.3. ArraySpeciesCreate ( originalArray, length )
1203 function ArraySpeciesCreate(originalArray, length) { // eslint-disable-line no-unused-vars
1204         // 1. Assert: length is an integer Number ≥ 0.
1205         // 2. If length is -0, set length to +0.
1206         if (1/length === -Infinity) {
1207                 length = 0;
1208         }
1209
1210         // 3. Let isArray be ? IsArray(originalArray).
1211         var isArray = IsArray(originalArray);
1212
1213         // 4. If isArray is false, return ? ArrayCreate(length).
1214         if (isArray === false) {
1215                 return ArrayCreate(length);
1216         }
1217
1218         // 5. Let C be ? Get(originalArray, "constructor").
1219         var C = Get(originalArray, 'constructor');
1220
1221         // Polyfill.io - We skip this section as not sure how to make a cross-realm normal Array, a same-realm Array.
1222         // 6. If IsConstructor(C) is true, then
1223         // if (IsConstructor(C)) {
1224                 // a. Let thisRealm be the current Realm Record.
1225                 // b. Let realmC be ? GetFunctionRealm(C).
1226                 // c. If thisRealm and realmC are not the same Realm Record, then
1227                         // i. If SameValue(C, realmC.[[Intrinsics]].[[%Array%]]) is true, set C to undefined.
1228         // }
1229         // 7. If Type(C) is Object, then
1230         if (Type(C) === 'object') {
1231                 // a. Set C to ? Get(C, @@species).
1232                 C = 'Symbol' in this && 'species' in this.Symbol ? Get(C, this.Symbol.species) : undefined;
1233                 // b. If C is null, set C to undefined.
1234                 if (C === null) {
1235                         C = undefined;
1236                 }
1237         }
1238         // 8. If C is undefined, return ? ArrayCreate(length).
1239         if (C === undefined) {
1240                 return ArrayCreate(length);
1241         }
1242         // 9. If IsConstructor(C) is false, throw a TypeError exception.
1243         if (!IsConstructor(C)) {
1244                 throw new TypeError('C must be a constructor');
1245         }
1246         // 10. Return ? Construct(C, « length »).
1247         return Construct(C, [length]);
1248 }
1249
1250 // _ESAbstract.ToBoolean
1251 // 7.1.2. ToBoolean ( argument )
1252 // The abstract operation ToBoolean converts argument to a value of type Boolean according to Table 9:
1253 /*
1254 --------------------------------------------------------------------------------------------------------------
1255 | Argument Type | Result                                                                                     |
1256 --------------------------------------------------------------------------------------------------------------
1257 | Undefined     | Return false.                                                                              |
1258 | Null          | Return false.                                                                              |
1259 | Boolean       | Return argument.                                                                           |
1260 | Number        | If argument is +0, -0, or NaN, return false; otherwise return true.                        |
1261 | String        | If argument is the empty String (its length is zero), return false; otherwise return true. |
1262 | Symbol        | Return true.                                                                               |
1263 | Object        | Return true.                                                                               |
1264 --------------------------------------------------------------------------------------------------------------
1265 */
1266 function ToBoolean(argument) { // eslint-disable-line no-unused-vars
1267         return Boolean(argument);
1268 }
1269
1270 // _ESAbstract.CreateDataProperty
1271 // 7.3.4. CreateDataProperty ( O, P, V )
1272 // NOTE
1273 // This abstract operation creates a property whose attributes are set to the same defaults used for properties created by the ECMAScript language assignment operator.
1274 // Normally, the property will not already exist. If it does exist and is not configurable or if O is not extensible, [[DefineOwnProperty]] will return false.
1275 function CreateDataProperty(O, P, V) { // eslint-disable-line no-unused-vars
1276         // 1. Assert: Type(O) is Object.
1277         // 2. Assert: IsPropertyKey(P) is true.
1278         // 3. Let newDesc be the PropertyDescriptor{ [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }.
1279         var newDesc = {
1280                 value: V,
1281                 writable: true,
1282                 enumerable: true,
1283                 configurable: true
1284         };
1285         // 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
1286         try {
1287                 Object.defineProperty(O, P, newDesc);
1288                 return true;
1289         } catch (e) {
1290                 return false;
1291         }
1292 }
1293
1294 // _ESAbstract.CreateDataPropertyOrThrow
1295 /* global CreateDataProperty */
1296 // 7.3.6. CreateDataPropertyOrThrow ( O, P, V )
1297 function CreateDataPropertyOrThrow(O, P, V) { // eslint-disable-line no-unused-vars
1298         // 1. Assert: Type(O) is Object.
1299         // 2. Assert: IsPropertyKey(P) is true.
1300         // 3. Let success be ? CreateDataProperty(O, P, V).
1301         var success = CreateDataProperty(O, P, V);
1302         // 4. If success is false, throw a TypeError exception.
1303         if (!success) {
1304                 throw new TypeError('Cannot assign value `' + Object.prototype.toString.call(V) + '` to property `' + Object.prototype.toString.call(P) + '` on object `' + Object.prototype.toString.call(O) + '`');
1305         }
1306         // 5. Return success.
1307         return success;
1308 }
1309 if (!('filter' in Array.prototype)) {
1310
1311 // Array.prototype.filter
1312 /* global CreateMethodProperty, ToObject, ToLength, Get, IsCallable, ArraySpeciesCreate, ToString, HasProperty, ToBoolean, Call, CreateDataPropertyOrThrow */
1313 // 22.1.3.7. Array.prototype.filter ( callbackfn [ , thisArg ] )
1314 CreateMethodProperty(Array.prototype, 'filter', function filter(callbackfn /* [ , thisArg ] */) {
1315         // 1. Let O be ? ToObject(this value).
1316         var O = ToObject(this);
1317         // 2. Let len be ? ToLength(? Get(O, "length")).
1318         var len = ToLength(Get(O, "length"));
1319         // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
1320         if (IsCallable(callbackfn) === false) {
1321                 throw new TypeError(callbackfn + ' is not a function');
1322         }
1323         // 4. If thisArg is present, let T be thisArg; else let T be undefined.
1324         var T = arguments.length > 1 ? arguments[1] : undefined;
1325         // 5. Let A be ? ArraySpeciesCreate(O, 0).
1326         var A = ArraySpeciesCreate(O, 0);
1327         // 6. Let k be 0.
1328         var k = 0;
1329         // 7. Let to be 0.
1330         var to = 0;
1331         // 8. Repeat, while k < len
1332         while (k < len) {
1333                 // a. Let Pk be ! ToString(k).
1334                 var Pk = ToString(k);
1335                 // b. Let kPresent be ? HasProperty(O, Pk).
1336                 var kPresent = HasProperty(O, Pk);
1337                 // c. If kPresent is true, then
1338                 if (kPresent) {
1339                         // i. Let kValue be ? Get(O, Pk).
1340                         var kValue = Get(O, Pk);
1341                         // ii. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
1342                         var selected = ToBoolean(Call(callbackfn, T, [kValue, k, O]));
1343                         // iii. If selected is true, then
1344                         if (selected) {
1345                                 // 1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(to), kValue)
1346                                 CreateDataPropertyOrThrow(A, ToString(to), kValue);
1347                                 // 2. Increase to by 1.
1348                                 to = to + 1;
1349                         }
1350
1351                 }
1352                 // d. Increase k by 1.
1353                 k = k + 1;
1354         }
1355         // 9. Return A.
1356         return A;
1357 });
1358
1359 }
1360
1361 if (!('map' in Array.prototype)) {
1362
1363 // Array.prototype.map
1364 /* global ArraySpeciesCreate, Call, CreateDataPropertyOrThrow, CreateMethodProperty, Get, HasProperty, IsCallable, ToLength, ToObject, ToString */
1365 /* global CreateMethodProperty, ToObject, ToLength, Get, ArraySpeciesCreate, ToString, HasProperty, Call, CreateDataPropertyOrThrow */
1366 // 22.1.3.16. Array.prototype.map ( callbackfn [ , thisArg ] )
1367 CreateMethodProperty(Array.prototype, 'map', function map(callbackfn /* [ , thisArg ] */) {
1368         // 1. Let O be ? ToObject(this value).
1369         var O = ToObject(this);
1370         // 2. Let len be ? ToLength(? Get(O, "length")).
1371         var len = ToLength(Get(O, "length"));
1372         // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
1373         if (IsCallable(callbackfn) === false) {
1374                 throw new TypeError(callbackfn + ' is not a function');
1375         }
1376         // 4. If thisArg is present, let T be thisArg; else let T be undefined.
1377         var T = arguments.length > 1 ? arguments[1] : undefined;
1378         // 5. Let A be ? ArraySpeciesCreate(O, len).
1379         var A = ArraySpeciesCreate(O, len);
1380         // 6. Let k be 0.
1381         var k = 0;
1382         // 7. Repeat, while k < len
1383         while (k < len) {
1384                 // a. Let Pk be ! ToString(k).
1385                 var Pk = ToString(k);
1386                 // b. Let kPresent be ? HasProperty(O, Pk).
1387                 var kPresent = HasProperty(O, Pk);
1388                 // c. If kPresent is true, then
1389                 if (kPresent) {
1390                         // i. Let kValue be ? Get(O, Pk).
1391                         var kValue = Get(O, Pk);
1392                         // ii. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
1393                         var mappedValue = Call(callbackfn, T, [kValue, k, O]);
1394                         // iii. Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue).
1395                         CreateDataPropertyOrThrow(A, Pk, mappedValue);
1396                 }
1397                 // d. Increase k by 1.
1398                 k = k + 1;
1399         }
1400         // 8. Return A.
1401         return A;
1402 });
1403
1404 }
1405
1406 if (!('getOwnPropertyNames' in Object)) {
1407
1408 // Object.getOwnPropertyNames
1409 /* global CreateMethodProperty */
1410
1411 var toString = ({}).toString;
1412 var split = ''.split;
1413
1414 CreateMethodProperty(Object, 'getOwnPropertyNames', function getOwnPropertyNames(object) {
1415         var buffer = [];
1416         var key;
1417
1418         // Non-enumerable properties cannot be discovered but can be checked for by name.
1419         // Define those used internally by JS to allow an incomplete solution
1420         var commonProps = ['length', "name", "arguments", "caller", "prototype", "observe", "unobserve"];
1421
1422         if (typeof object === 'undefined' || object === null) {
1423                 throw new TypeError('Cannot convert undefined or null to object');
1424         }
1425
1426         // Polyfill.io fallback for non-array-like strings which exist in some ES3 user-agents (IE 8)
1427         object = toString.call(object) == '[object String]' ? split.call(object, '') : Object(object);
1428
1429         // Enumerable properties only
1430         for (key in object) {
1431                 if (Object.prototype.hasOwnProperty.call(object, key)) {
1432                         buffer.push(key);
1433                 }
1434         }
1435
1436         // Check for and add the common non-enumerable properties
1437         for (var i=0, s=commonProps.length; i<s; i++) {
1438                 if (commonProps[i] in object) buffer.push(commonProps[i]);
1439         }
1440
1441         return buffer;
1442 });
1443
1444 }
1445
1446 if (!('freeze' in Object)) {
1447
1448 // Object.freeze
1449 /* global CreateMethodProperty */
1450 // 19.1.2.6. Object.freeze ( O )
1451 CreateMethodProperty(Object, 'freeze', function freeze(O) {
1452         // This feature cannot be implemented fully as a polyfill.
1453         // We choose to silently fail which allows "securable" code
1454         // to "gracefully" degrade to working but insecure code.
1455         return O;
1456 });
1457
1458 }
1459
1460 if (!('Symbol' in this && this.Symbol.length === 0)) {
1461
1462 // Symbol
1463 // A modification of https://github.com/WebReflection/get-own-property-symbols
1464 // (C) Andrea Giammarchi - MIT Licensed
1465
1466 (function (Object, GOPS, global) {
1467
1468         var     setDescriptor;
1469         var id = 0;
1470         var random = '' + Math.random();
1471         var prefix = '__\x01symbol:';
1472         var prefixLength = prefix.length;
1473         var internalSymbol = '__\x01symbol@@' + random;
1474         var DP = 'defineProperty';
1475         var DPies = 'defineProperties';
1476         var GOPN = 'getOwnPropertyNames';
1477         var GOPD = 'getOwnPropertyDescriptor';
1478         var PIE = 'propertyIsEnumerable';
1479         var ObjectProto = Object.prototype;
1480         var hOP = ObjectProto.hasOwnProperty;
1481         var pIE = ObjectProto[PIE];
1482         var toString = ObjectProto.toString;
1483         var concat = Array.prototype.concat;
1484         var cachedWindowNames = typeof window === 'object' ? Object.getOwnPropertyNames(window) : [];
1485         var nGOPN = Object[GOPN];
1486         var gOPN = function getOwnPropertyNames (obj) {
1487                 if (toString.call(obj) === '[object Window]') {
1488                         try {
1489                                 return nGOPN(obj);
1490                         } catch (e) {
1491                                 // IE bug where layout engine calls userland gOPN for cross-domain `window` objects
1492                                 return concat.call([], cachedWindowNames);
1493                         }
1494                 }
1495                 return nGOPN(obj);
1496         };
1497         var gOPD = Object[GOPD];
1498         var create = Object.create;
1499         var keys = Object.keys;
1500         var freeze = Object.freeze || Object;
1501         var defineProperty = Object[DP];
1502         var $defineProperties = Object[DPies];
1503         var descriptor = gOPD(Object, GOPN);
1504         var addInternalIfNeeded = function (o, uid, enumerable) {
1505                 if (!hOP.call(o, internalSymbol)) {
1506                         try {
1507                                 defineProperty(o, internalSymbol, {
1508                                         enumerable: false,
1509                                         configurable: false,
1510                                         writable: false,
1511                                         value: {}
1512                                 });
1513                         } catch (e) {
1514                                 o[internalSymbol] = {};
1515                         }
1516                 }
1517                 o[internalSymbol]['@@' + uid] = enumerable;
1518         };
1519         var createWithSymbols = function (proto, descriptors) {
1520                 var self = create(proto);
1521                 gOPN(descriptors).forEach(function (key) {
1522                         if (propertyIsEnumerable.call(descriptors, key)) {
1523                                 $defineProperty(self, key, descriptors[key]);
1524                         }
1525                 });
1526                 return self;
1527         };
1528         var copyAsNonEnumerable = function (descriptor) {
1529                 var newDescriptor = create(descriptor);
1530                 newDescriptor.enumerable = false;
1531                 return newDescriptor;
1532         };
1533         var get = function get(){};
1534         var onlyNonSymbols = function (name) {
1535                 return name != internalSymbol &&
1536                         !hOP.call(source, name);
1537         };
1538         var onlySymbols = function (name) {
1539                 return name != internalSymbol &&
1540                         hOP.call(source, name);
1541         };
1542         var propertyIsEnumerable = function propertyIsEnumerable(key) {
1543                 var uid = '' + key;
1544                 return onlySymbols(uid) ? (
1545                         hOP.call(this, uid) &&
1546                         this[internalSymbol]['@@' + uid]
1547                 ) : pIE.call(this, key);
1548         };
1549         var setAndGetSymbol = function (uid) {
1550                 var descriptor = {
1551                         enumerable: false,
1552                         configurable: true,
1553                         get: get,
1554                         set: function (value) {
1555                         setDescriptor(this, uid, {
1556                                 enumerable: false,
1557                                 configurable: true,
1558                                 writable: true,
1559                                 value: value
1560                         });
1561                         addInternalIfNeeded(this, uid, true);
1562                         }
1563                 };
1564                 try {
1565                         defineProperty(ObjectProto, uid, descriptor);
1566                 } catch (e) {
1567                         ObjectProto[uid] = descriptor.value;
1568                 }
1569                 return freeze(source[uid] = defineProperty(
1570                         Object(uid),
1571                         'constructor',
1572                         sourceConstructor
1573                 ));
1574         };
1575         var Symbol = function Symbol() {
1576                 var description = arguments[0];
1577                 if (this instanceof Symbol) {
1578                         throw new TypeError('Symbol is not a constructor');
1579                 }
1580                 return setAndGetSymbol(
1581                         prefix.concat(description || '', random, ++id)
1582                 );
1583                 };
1584         var source = create(null);
1585         var sourceConstructor = {value: Symbol};
1586         var sourceMap = function (uid) {
1587                 return source[uid];
1588                 };
1589         var $defineProperty = function defineProp(o, key, descriptor) {
1590                 var uid = '' + key;
1591                 if (onlySymbols(uid)) {
1592                         setDescriptor(o, uid, descriptor.enumerable ?
1593                                 copyAsNonEnumerable(descriptor) : descriptor);
1594                         addInternalIfNeeded(o, uid, !!descriptor.enumerable);
1595                 } else {
1596                         defineProperty(o, key, descriptor);
1597                 }
1598                 return o;
1599         };
1600
1601         var onlyInternalSymbols = function (obj) {
1602                 return function (name) {
1603                         return hOP.call(obj, internalSymbol) && hOP.call(obj[internalSymbol], '@@' + name);
1604                 };
1605         };
1606         var $getOwnPropertySymbols = function getOwnPropertySymbols(o) {
1607                 return gOPN(o).filter(o === ObjectProto ? onlyInternalSymbols(o) : onlySymbols).map(sourceMap);
1608                 }
1609         ;
1610
1611         descriptor.value = $defineProperty;
1612         defineProperty(Object, DP, descriptor);
1613
1614         descriptor.value = $getOwnPropertySymbols;
1615         defineProperty(Object, GOPS, descriptor);
1616
1617         descriptor.value = function getOwnPropertyNames(o) {
1618                 return gOPN(o).filter(onlyNonSymbols);
1619         };
1620         defineProperty(Object, GOPN, descriptor);
1621
1622         descriptor.value = function defineProperties(o, descriptors) {
1623                 var symbols = $getOwnPropertySymbols(descriptors);
1624                 if (symbols.length) {
1625                 keys(descriptors).concat(symbols).forEach(function (uid) {
1626                         if (propertyIsEnumerable.call(descriptors, uid)) {
1627                         $defineProperty(o, uid, descriptors[uid]);
1628                         }
1629                 });
1630                 } else {
1631                 $defineProperties(o, descriptors);
1632                 }
1633                 return o;
1634         };
1635         defineProperty(Object, DPies, descriptor);
1636
1637         descriptor.value = propertyIsEnumerable;
1638         defineProperty(ObjectProto, PIE, descriptor);
1639
1640         descriptor.value = Symbol;
1641         defineProperty(global, 'Symbol', descriptor);
1642
1643         // defining `Symbol.for(key)`
1644         descriptor.value = function (key) {
1645                 var uid = prefix.concat(prefix, key, random);
1646                 return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid);
1647         };
1648         defineProperty(Symbol, 'for', descriptor);
1649
1650         // defining `Symbol.keyFor(symbol)`
1651         descriptor.value = function (symbol) {
1652                 if (onlyNonSymbols(symbol))
1653                 throw new TypeError(symbol + ' is not a symbol');
1654                 return hOP.call(source, symbol) ?
1655                 symbol.slice(prefixLength * 2, -random.length) :
1656                 void 0
1657                 ;
1658         };
1659         defineProperty(Symbol, 'keyFor', descriptor);
1660
1661         descriptor.value = function getOwnPropertyDescriptor(o, key) {
1662                 var descriptor = gOPD(o, key);
1663                 if (descriptor && onlySymbols(key)) {
1664                 descriptor.enumerable = propertyIsEnumerable.call(o, key);
1665                 }
1666                 return descriptor;
1667         };
1668         defineProperty(Object, GOPD, descriptor);
1669
1670         descriptor.value = function (proto, descriptors) {
1671                 return arguments.length === 1 || typeof descriptors === "undefined" ?
1672                 create(proto) :
1673                 createWithSymbols(proto, descriptors);
1674         };
1675         defineProperty(Object, 'create', descriptor);
1676
1677         descriptor.value = function () {
1678                 var str = toString.call(this);
1679                 return (str === '[object String]' && onlySymbols(this)) ? '[object Symbol]' : str;
1680         };
1681         defineProperty(ObjectProto, 'toString', descriptor);
1682
1683
1684         setDescriptor = function (o, key, descriptor) {
1685                 var protoDescriptor = gOPD(ObjectProto, key);
1686                 delete ObjectProto[key];
1687                 defineProperty(o, key, descriptor);
1688                 if (o !== ObjectProto) {
1689                         defineProperty(ObjectProto, key, protoDescriptor);
1690                 }
1691         };
1692
1693 }(Object, 'getOwnPropertySymbols', this));
1694
1695 }
1696
1697 if (!('Symbol' in this && 'iterator' in this.Symbol)) {
1698
1699 // Symbol.iterator
1700 /* global Symbol */
1701 Object.defineProperty(Symbol, 'iterator', { value: Symbol('iterator') });
1702
1703 }
1704
1705
1706 // _ESAbstract.GetIterator
1707 /* global GetMethod, Symbol, Call, Type, GetV */
1708 // 7.4.1. GetIterator ( obj [ , method ] )
1709 // The abstract operation GetIterator with argument obj and optional argument method performs the following steps:
1710 function GetIterator(obj /*, method */) { // eslint-disable-line no-unused-vars
1711         // 1. If method is not present, then
1712                 // a. Set method to ? GetMethod(obj, @@iterator).
1713         var method = arguments.length > 1 ? arguments[1] : GetMethod(obj, Symbol.iterator);
1714         // 2. Let iterator be ? Call(method, obj).
1715         var iterator = Call(method, obj);
1716         // 3. If Type(iterator) is not Object, throw a TypeError exception.
1717         if (Type(iterator) !== 'object') {
1718                 throw new TypeError('bad iterator');
1719         }
1720         // 4. Let nextMethod be ? GetV(iterator, "next").
1721         var nextMethod = GetV(iterator, "next");
1722         // 5. Let iteratorRecord be Record {[[Iterator]]: iterator, [[NextMethod]]: nextMethod, [[Done]]: false}.
1723         var iteratorRecord = Object.create(null);
1724         iteratorRecord['[[Iterator]]'] = iterator;
1725         iteratorRecord['[[NextMethod]]'] = nextMethod;
1726         iteratorRecord['[[Done]]'] = false;
1727         // 6. Return iteratorRecord.
1728         return iteratorRecord;
1729 }
1730
1731 // _ESAbstract.IteratorClose
1732 /* global GetMethod, Type, Call */
1733 // 7.4.6. IteratorClose ( iteratorRecord, completion )
1734 function IteratorClose(iteratorRecord, completion) { // eslint-disable-line no-unused-vars
1735         // 1. Assert: Type(iteratorRecord.[[Iterator]]) is Object.
1736         if (Type(iteratorRecord['[[Iterator]]']) !== 'object') {
1737                 throw new Error(Object.prototype.toString.call(iteratorRecord['[[Iterator]]']) + 'is not an Object.');
1738         }
1739         // 2. Assert: completion is a Completion Record.
1740         // Polyfill.io - Ignoring this step as there is no way to check if something is a Completion Record in userland JavaScript.
1741
1742         // 3. Let iterator be iteratorRecord.[[Iterator]].
1743         var iterator = iteratorRecord['[[Iterator]]'];
1744         // 4. Let return be ? GetMethod(iterator, "return").
1745         // Polyfill.io - We name it  returnMethod because return is a keyword and can not be used as an identifier (E.G. variable name, function name etc).
1746         var returnMethod = GetMethod(iterator, "return");
1747         // 5. If return is undefined, return Completion(completion).
1748         if (returnMethod === undefined) {
1749                 return completion;
1750         }
1751         // 6. Let innerResult be Call(return, iterator, « »).
1752         try {
1753                 var innerResult = Call(returnMethod, iterator);
1754         } catch (error) {
1755                 var innerException = error;
1756         }
1757         // 7. If completion.[[Type]] is throw, return Completion(completion).
1758         if (completion) {
1759                 return completion;
1760         }
1761         // 8. If innerResult.[[Type]] is throw, return Completion(innerResult).
1762         if (innerException) {
1763                 throw innerException;
1764         }
1765         // 9. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception.
1766         if (Type(innerResult) !== 'object') {
1767                 throw new TypeError("Iterator's return method returned a non-object.");
1768         }
1769         // 10. Return Completion(completion).
1770         return completion;
1771 }
1772
1773 // _ESAbstract.IteratorNext
1774 /* global Call, Type */
1775 // 7.4.2. IteratorNext ( iteratorRecord [ , value ] )
1776 function IteratorNext(iteratorRecord /* [, value] */) { // eslint-disable-line no-unused-vars
1777         // 1. If value is not present, then
1778         if (arguments.length < 2) {
1779                 // a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « »).
1780                 var result = Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]']);
1781         // 2. Else,
1782         } else {
1783                 // a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « value »).
1784                 result = Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]'], [arguments[1]]);
1785         }
1786         // 3. If Type(result) is not Object, throw a TypeError exception.
1787         if (Type(result) !== 'object') {
1788                 throw new TypeError('bad iterator');
1789         }
1790         // 4. Return result.
1791         return result;
1792 }
1793
1794 // _ESAbstract.IteratorComplete
1795 /* global Type, ToBoolean, Get */
1796 // 7.4.3 IteratorComplete ( iterResult )
1797 function IteratorComplete(iterResult) { // eslint-disable-line no-unused-vars
1798         // 1. Assert: Type(iterResult) is Object.
1799         if (Type(iterResult) !== 'object') {
1800                 throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.');
1801         }
1802         // 2. Return ToBoolean(? Get(iterResult, "done")).
1803         return ToBoolean(Get(iterResult, "done"));
1804 }
1805
1806 // _ESAbstract.IteratorStep
1807 /* global IteratorNext, IteratorComplete */
1808 // 7.4.5. IteratorStep ( iteratorRecord )
1809 function IteratorStep(iteratorRecord) { // eslint-disable-line no-unused-vars
1810         // 1. Let result be ? IteratorNext(iteratorRecord).
1811         var result = IteratorNext(iteratorRecord);
1812         // 2. Let done be ? IteratorComplete(result).
1813         var done = IteratorComplete(result);
1814         // 3. If done is true, return false.
1815         if (done === true) {
1816                 return false;
1817         }
1818         // 4. Return result.
1819         return result;
1820 }
1821
1822 // _ESAbstract.IteratorValue
1823 /* global Type, Get */
1824 // 7.4.4 IteratorValue ( iterResult )
1825 function IteratorValue(iterResult) { // eslint-disable-line no-unused-vars
1826         // Assert: Type(iterResult) is Object.
1827         if (Type(iterResult) !== 'object') {
1828                 throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.');
1829         }
1830         // Return ? Get(iterResult, "value").
1831         return Get(iterResult, "value");
1832 }
1833
1834 // _ESAbstract.CreateIterResultObject
1835 /* global Type, CreateDataProperty */
1836 // 7.4.7. CreateIterResultObject ( value, done )
1837 function CreateIterResultObject(value, done) { // eslint-disable-line no-unused-vars
1838         // 1. Assert: Type(done) is Boolean.
1839         if (Type(done) !== 'boolean') {
1840                 throw new Error();
1841         }
1842         // 2. Let obj be ObjectCreate(%ObjectPrototype%).
1843         var obj = {};
1844         // 3. Perform CreateDataProperty(obj, "value", value).
1845         CreateDataProperty(obj, "value", value);
1846         // 4. Perform CreateDataProperty(obj, "done", done).
1847         CreateDataProperty(obj, "done", done);
1848         // 5. Return obj.
1849         return obj;
1850 }
1851
1852 // _ESAbstract.SameValueNonNumber
1853 // 7.2.12. SameValueNonNumber ( x, y )
1854 function SameValueNonNumber(x, y) { // eslint-disable-line no-unused-vars
1855         // 1. Assert: Type(x) is not Number.
1856         // 2. Assert: Type(x) is the same as Type(y).
1857         // 3. If Type(x) is Undefined, return true.
1858         // 4. If Type(x) is Null, return true.
1859         // 5. If Type(x) is String, then
1860                 // a. If x and y are exactly the same sequence of code units (same length and same code units at corresponding indices), return true; otherwise, return false.
1861         // 6. If Type(x) is Boolean, then
1862                 // a. If x and y are both true or both false, return true; otherwise, return false.
1863         // 7. If Type(x) is Symbol, then
1864                 // a. If x and y are both the same Symbol value, return true; otherwise, return false.
1865         // 8. If x and y are the same Object value, return true. Otherwise, return false.
1866
1867         // Polyfill.io - We can skip all above steps because the === operator does it all for us.
1868         return x === y;
1869 }
1870
1871 // _ESAbstract.SameValueZero
1872 /* global Type, SameValueNonNumber */
1873 // 7.2.11. SameValueZero ( x, y )
1874 function SameValueZero (x, y) { // eslint-disable-line no-unused-vars
1875         // 1. If Type(x) is different from Type(y), return false.
1876         if (Type(x) !== Type(y)) {
1877                 return false;
1878         }
1879         // 2. If Type(x) is Number, then
1880         if (Type(x) === 'number') {
1881                 // a. If x is NaN and y is NaN, return true.
1882                 if (isNaN(x) && isNaN(y)) {
1883                         return true;
1884                 }
1885                 // b. If x is +0 and y is -0, return true.
1886                 if (1/x === Infinity && 1/y === -Infinity) {
1887                         return true;
1888                 }
1889                 // c. If x is -0 and y is +0, return true.
1890                 if (1/x === -Infinity && 1/y === Infinity) {
1891                         return true;
1892                 }
1893                 // d. If x is the same Number value as y, return true.
1894                 if (x === y) {
1895                         return true;
1896                 }
1897                 // e. Return false.
1898                 return false;
1899         }
1900         // 3. Return SameValueNonNumber(x, y).
1901         return SameValueNonNumber(x, y);
1902 }
1903 if (!('isArray' in Array)) {
1904
1905 // Array.isArray
1906 /* global CreateMethodProperty, IsArray */
1907 // 22.1.2.2. Array.isArray ( arg )
1908 CreateMethodProperty(Array, 'isArray', function isArray(arg) {
1909         // 1. Return ? IsArray(arg).
1910         return IsArray(arg);
1911 });
1912
1913 }
1914
1915 if (!('Symbol' in this && 'species' in this.Symbol)) {
1916
1917 // Symbol.species
1918 /* global Symbol */
1919 Object.defineProperty(Symbol, 'species', { value: Symbol('species') });
1920
1921 }
1922
1923 if (!('Map' in this && (function() {
1924         try {
1925                 var m = new Map([[1, 1], [2, 2]]);
1926                 if (Map.length === 0) {
1927                         if (m.size === 2) {
1928                                 if ('Symbol' in this && 'iterator' in Symbol && typeof m[Symbol.iterator] === 'function') {
1929                                         return true;
1930                                 }
1931                         }
1932                 }
1933                 return false;
1934         } catch (e) {
1935                 return false;
1936         }
1937 }()))) {
1938
1939 // Map
1940 /* global CreateIterResultObject, CreateMethodProperty, GetIterator, IsCallable, IteratorClose, IteratorStep, IteratorValue, OrdinaryCreateFromConstructor, SameValueZero, Type, Symbol */
1941 (function (global) {
1942         var supportsGetters = (function () {
1943                 try {
1944                         var a = {};
1945                         Object.defineProperty(a, 't', {
1946                                 configurable: true,
1947                                 enumerable: false,
1948                                 get: function () {
1949                                         return true;
1950                                 },
1951                                 set: undefined
1952                         });
1953                         return !!a.t;
1954                 } catch (e) {
1955                         return false;
1956                 }
1957         }());
1958
1959         // Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
1960         var undefMarker = Symbol('undef');
1961         // 23.1.1.1 Map ( [ iterable ] )
1962         var Map = function Map(/* iterable */) {
1963                 // 1. If NewTarget is undefined, throw a TypeError exception.
1964                 if (!(this instanceof Map)) {
1965                         throw new TypeError('Constructor Map requires "new"');
1966                 }
1967                 // 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%", « [[MapData]] »).
1968                 var map = OrdinaryCreateFromConstructor(this, Map.prototype, {
1969                         _keys: [],
1970                         _values: [],
1971                         _size: 0,
1972                         _es6Map: true
1973                 });
1974
1975                 // 3. Set map.[[MapData]] to a new empty List.
1976                 // Polyfill.io - This step was done as part of step two.
1977
1978                 // Some old engines do not support ES5 getters/setters.  Since Map only requires these for the size property, we can fall back to setting the size property statically each time the size of the map changes.
1979                 if (!supportsGetters) {
1980                         Object.defineProperty(map, 'size', {
1981                                 configurable: true,
1982                                 enumerable: false,
1983                                 writable: true,
1984                                 value: 0
1985                         });
1986                 }
1987
1988                 // 4. If iterable is not present, let iterable be undefined.
1989                 var iterable = arguments.length > 0 ? arguments[0] : undefined;
1990
1991                 // 5. If iterable is either undefined or null, return map.
1992                 if (iterable === null || iterable === undefined) {
1993                         return map;
1994                 }
1995
1996                 // 6. Let adder be ? Get(map, "set").
1997                 var adder = map.set;
1998
1999                 // 7. If IsCallable(adder) is false, throw a TypeError exception.
2000                 if (!IsCallable(adder)) {
2001                         throw new TypeError("Map.prototype.set is not a function");
2002                 }
2003
2004                 // 8. Let iteratorRecord be ? GetIterator(iterable).
2005                 try {
2006                         var iteratorRecord = GetIterator(iterable);
2007                         // 9. Repeat,
2008                         while (true) {
2009                                 // a. Let next be ? IteratorStep(iteratorRecord).
2010                                 var next = IteratorStep(iteratorRecord);
2011                                 // b. If next is false, return map.
2012                                 if (next === false) {
2013                                         return map;
2014                                 }
2015                                 // c. Let nextItem be ? IteratorValue(next).
2016                                 var nextItem = IteratorValue(next);
2017                                 // d. If Type(nextItem) is not Object, then
2018                                 if (Type(nextItem) !== 'object') {
2019                                         // i. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}.
2020                                         try {
2021                                                 throw new TypeError('Iterator value ' + nextItem + ' is not an entry object');
2022                                         } catch (error) {
2023                                                 // ii. Return ? IteratorClose(iteratorRecord, error).
2024                                                 return IteratorClose(iteratorRecord, error);
2025                                         }
2026                                 }
2027                                 try {
2028                                         // Polyfill.io - The try catch accounts for steps: f, h, and j.
2029
2030                                         // e. Let k be Get(nextItem, "0").
2031                                         var k = nextItem[0];
2032                                         // f. If k is an abrupt completion, return ? IteratorClose(iteratorRecord, k).
2033                                         // g. Let v be Get(nextItem, "1").
2034                                         var v = nextItem[1];
2035                                         // h. If v is an abrupt completion, return ? IteratorClose(iteratorRecord, v).
2036                                         // i. Let status be Call(adder, map, « k.[[Value]], v.[[Value]] »).
2037                                         adder.call(map, k, v);
2038                                 } catch (e) {
2039                                         // j. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
2040                                         return IteratorClose(iteratorRecord, e);
2041                                 }
2042                         }
2043                 } catch (e) {
2044                         // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
2045                         if (Array.isArray(iterable) ||
2046                                 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
2047                                 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
2048                                 (!!iterable.callee)) {
2049                                 var index;
2050                                 var length = iterable.length;
2051                                 for (index = 0; index < length; index++) {
2052                                         adder.call(map, iterable[index][0], iterable[index][1]);
2053                                 }
2054                         }
2055                 }
2056                 return map;
2057         };
2058
2059         // 23.1.2.1. Map.prototype
2060         // The initial value of Map.prototype is the intrinsic object %MapPrototype%.
2061         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
2062         Object.defineProperty(Map, 'prototype', {
2063                 configurable: false,
2064                 enumerable: false,
2065                 writable: false,
2066                 value: {}
2067         });
2068
2069         // 23.1.2.2 get Map [ @@species ]
2070         if (supportsGetters) {
2071                 Object.defineProperty(Map, Symbol.species, {
2072                         configurable: true,
2073                         enumerable: false,
2074                         get: function () {
2075                                 // 1. Return the this value.
2076                                 return this;
2077                         },
2078                         set: undefined
2079                 });
2080         } else {
2081                 CreateMethodProperty(Map, Symbol.species, Map);
2082         }
2083
2084         // 23.1.3.1 Map.prototype.clear ( )
2085         CreateMethodProperty(Map.prototype, 'clear', function clear() {
2086                         // 1. Let M be the this value.
2087                         var M = this;
2088                         // 2. If Type(M) is not Object, throw a TypeError exception.
2089                         if (Type(M) !== 'object') {
2090                                 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
2091                         }
2092                         // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2093                         if (M._es6Map !== true) {
2094                                 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
2095                         }
2096                         // 4. Let entries be the List that is M.[[MapData]].
2097                         var entries = M._keys;
2098                         // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
2099                         for (var i = 0; i < entries.length; i++) {
2100                                 // 5.a. Set p.[[Key]] to empty.
2101                                 M._keys[i] = undefMarker;
2102                                 // 5.b. Set p.[[Value]] to empty.
2103                                 M._values[i] = undefMarker;
2104                         }
2105                         this._size = 0;
2106                         if (!supportsGetters) {
2107                                 this.size = this._size;
2108                         }
2109                         // 6. Return undefined.
2110                         return undefined;
2111                 }
2112         );
2113
2114         // 23.1.3.2. Map.prototype.constructor
2115         CreateMethodProperty(Map.prototype, 'constructor', Map);
2116
2117         // 23.1.3.3. Map.prototype.delete ( key )
2118         CreateMethodProperty(Map.prototype, 'delete', function (key) {
2119                         // 1. Let M be the this value.
2120                         var M = this;
2121                         // 2. If Type(M) is not Object, throw a TypeError exception.
2122                         if (Type(M) !== 'object') {
2123                                 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
2124                         }
2125                         // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2126                         if (M._es6Map !== true) {
2127                                 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
2128                         }
2129                         // 4. Let entries be the List that is M.[[MapData]].
2130                         var entries = M._keys;
2131                         // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
2132                         for (var i = 0; i < entries.length; i++) {
2133                                 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then
2134                                 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
2135                                         // i. Set p.[[Key]] to empty.
2136                                         this._keys[i] = undefMarker;
2137                                         // ii. Set p.[[Value]] to empty.
2138                                         this._values[i] = undefMarker;
2139                                         this._size = --this._size;
2140                                         if (!supportsGetters) {
2141                                                 this.size = this._size;
2142                                         }
2143                                         // iii. Return true.
2144                                         return true;
2145                                 }
2146                         }
2147                         // 6. Return false.
2148                         return false;
2149                 }
2150         );
2151
2152         // 23.1.3.4. Map.prototype.entries ( )
2153         CreateMethodProperty(Map.prototype, 'entries', function entries () {
2154                         // 1. Let M be the this value.
2155                         var M = this;
2156                         // 2. Return ? CreateMapIterator(M, "key+value").
2157                         return CreateMapIterator(M, 'key+value');
2158                 }
2159         );
2160
2161         // 23.1.3.5. Map.prototype.forEach ( callbackfn [ , thisArg ] )
2162         CreateMethodProperty(Map.prototype, 'forEach', function (callbackFn) {
2163                         // 1. Let M be the this value.
2164                         var M = this;
2165                         // 2. If Type(M) is not Object, throw a TypeError exception.
2166                         if (Type(M) !== 'object') {
2167                                 throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M));
2168                         }
2169                         // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2170                         if (M._es6Map !== true) {
2171                                 throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M));
2172                         }
2173                         // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
2174                         if (!IsCallable(callbackFn)) {
2175                                 throw new TypeError(Object.prototype.toString.call(callbackFn) + ' is not a function.');
2176                         }
2177                         // 5. If thisArg is present, let T be thisArg; else let T be undefined.
2178                         if (arguments[1]) {
2179                                 var T = arguments[1];
2180                         }
2181                         // 6. Let entries be the List that is M.[[MapData]].
2182                         var entries = M._keys;
2183                         // 7. For each Record {[[Key]], [[Value]]} e that is an element of entries, in original key insertion order, do
2184                         for (var i = 0; i < entries.length; i++) {
2185                                 // a. If e.[[Key]] is not empty, then
2186                                 if (M._keys[i] !== undefMarker && M._values[i] !== undefMarker ) {
2187                                         // i. Perform ? Call(callbackfn, T, « e.[[Value]], e.[[Key]], M »).
2188                                         callbackFn.call(T, M._values[i], M._keys[i], M);
2189                                 }
2190                         }
2191                         // 8. Return undefined.
2192                         return undefined;
2193                 }
2194         );
2195
2196         // 23.1.3.6. Map.prototype.get ( key )
2197         CreateMethodProperty(Map.prototype, 'get', function get(key) {
2198                         // 1. Let M be the this value.
2199                         var M = this;
2200                         // 2. If Type(M) is not Object, throw a TypeError exception.
2201                         if (Type(M) !== 'object') {
2202                                 throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
2203                         }
2204                         // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2205                         if (M._es6Map !== true) {
2206                                 throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
2207                         }
2208                         // 4. Let entries be the List that is M.[[MapData]].
2209                         var entries = M._keys;
2210                         // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
2211                         for (var i = 0; i < entries.length; i++) {
2212                                 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return p.[[Value]].
2213                                 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
2214                                         return M._values[i];
2215                                 }
2216                         }
2217                         // 6. Return undefined.
2218                         return undefined;
2219                 });
2220
2221         // 23.1.3.7. Map.prototype.has ( key )
2222         CreateMethodProperty(Map.prototype, 'has', function has (key) {
2223                         // 1. Let M be the this value.
2224                         var M = this;
2225                         // 2. If Type(M) is not Object, throw a TypeError exception.
2226                         if (typeof M !== 'object') {
2227                                 throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
2228                         }
2229                         // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2230                         if (M._es6Map !== true) {
2231                                 throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
2232                         }
2233                         // 4. Let entries be the List that is M.[[MapData]].
2234                         var entries = M._keys;
2235                         // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
2236                         for (var i = 0; i < entries.length; i++) {
2237                                 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return true.
2238                                 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
2239                                         return true;
2240                                 }
2241                         }
2242                         // 6. Return false.
2243                         return false;
2244                 });
2245
2246         // 23.1.3.8. Map.prototype.keys ( )
2247         CreateMethodProperty(Map.prototype, 'keys', function keys () {
2248                         // 1. Let M be the this value.
2249                         var M = this;
2250                         // 2. Return ? CreateMapIterator(M, "key").
2251                         return CreateMapIterator(M, "key");
2252                 });
2253
2254         // 23.1.3.9. Map.prototype.set ( key, value )
2255         CreateMethodProperty(Map.prototype, 'set', function set(key, value) {
2256                         // 1. Let M be the this value.
2257                         var M = this;
2258                         // 2. If Type(M) is not Object, throw a TypeError exception.
2259                         if (Type(M) !== 'object') {
2260                                 throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
2261                         }
2262                         // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2263                         if (M._es6Map !== true) {
2264                                 throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
2265                         }
2266                         // 4. Let entries be the List that is M.[[MapData]].
2267                         var entries = M._keys;
2268                         // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
2269                         for (var i = 0; i < entries.length; i++) {
2270                                 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then
2271                                 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
2272                                         // i. Set p.[[Value]] to value.
2273                                         M._values[i] = value;
2274                                         // Return M.
2275                                         return M;
2276                                 }
2277                         }
2278                         // 6. If key is -0, let key be +0.
2279                         if (1/key === -Infinity) {
2280                                 key = 0;
2281                         }
2282                         // 7. Let p be the Record {[[Key]]: key, [[Value]]: value}.
2283                         var p = {};
2284                         p['[[Key]]'] = key;
2285                         p['[[Value]]'] = value;
2286                         // 8. Append p as the last element of entries.
2287                         M._keys.push(p['[[Key]]']);
2288                         M._values.push(p['[[Value]]']);
2289                         ++M._size;
2290                         if (!supportsGetters) {
2291                                 M.size = M._size;
2292                         }
2293                         // 9. Return M.
2294                         return M;
2295                 });
2296
2297         // 23.1.3.10. get Map.prototype.size
2298         if (supportsGetters) {
2299                 Object.defineProperty(Map.prototype, 'size', {
2300                         configurable: true,
2301                         enumerable: false,
2302                         get: function () {
2303                                 // 1. Let M be the this value.
2304                                 var M = this;
2305                                 // 2. If Type(M) is not Object, throw a TypeError exception.
2306                                 if (Type(M) !== 'object') {
2307                                         throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M));
2308                                 }
2309                                 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
2310                                 if (M._es6Map !== true) {
2311                                         throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M));
2312                                 }
2313                                 // 4. Let entries be the List that is M.[[MapData]].
2314                                 var entries = M._keys;
2315                                 // 5. Let count be 0.
2316                                 var count = 0;
2317                                 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
2318                                 for (var i = 0; i < entries.length; i++) {
2319                                         // a. If p.[[Key]] is not empty, set count to count+1.
2320                                         if (M._keys[i] !== undefMarker) {
2321                                                 count = count + 1;
2322                                         }
2323                                 }
2324                                 // 7. Return count.
2325                                 return count;
2326                         },
2327                         set: undefined
2328                 });
2329         }
2330
2331         // 23.1.3.11. Map.prototype.values ( )
2332         CreateMethodProperty(Map.prototype, 'values', function values () {
2333                         // 1. Let M be the this value.
2334                         var M = this;
2335                         // 2. Return ? CreateMapIterator(M, "value").
2336                         return CreateMapIterator(M, 'value');
2337                 }
2338         );
2339
2340         // 23.1.3.12. Map.prototype [ @@iterator ] ( )
2341         // The initial value of the @@iterator property is the same function object as the initial value of the entries property.
2342         CreateMethodProperty(Map.prototype, Symbol.iterator, Map.prototype.entries);
2343
2344         // 23.1.3.13. Map.prototype [ @@toStringTag ]
2345         // The initial value of the @@toStringTag property is the String value "Map".
2346         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
2347
2348         // Polyfill.io - Safari 8 implements Map.name but as a non-configurable property, which means it would throw an error if we try and configure it here.
2349         if (!('name' in Map)) {
2350                 // 19.2.4.2 name
2351                 Object.defineProperty(Map, 'name', {
2352                         configurable: true,
2353                         enumerable: false,
2354                         writable: false,
2355                         value: 'Map'
2356                 });
2357         }
2358
2359         // 23.1.5.1. CreateMapIterator ( map, kind )
2360         function CreateMapIterator(map, kind) {
2361                 // 1. If Type(map) is not Object, throw a TypeError exception.
2362                 if (Type(map) !== 'object') {
2363                         throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map));
2364                 }
2365                 // 2. If map does not have a [[MapData]] internal slot, throw a TypeError exception.
2366                 if (map._es6Map !== true) {
2367                         throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map));
2368                 }
2369                 // 3. Let iterator be ObjectCreate(%MapIteratorPrototype%, « [[Map]], [[MapNextIndex]], [[MapIterationKind]] »).
2370                 var iterator = Object.create(MapIteratorPrototype);
2371                 // 4. Set iterator.[[Map]] to map.
2372                 Object.defineProperty(iterator, '[[Map]]', {
2373                         configurable: true,
2374                         enumerable: false,
2375                         writable: true,
2376                         value: map
2377                 });
2378                 // 5. Set iterator.[[MapNextIndex]] to 0.
2379                 Object.defineProperty(iterator, '[[MapNextIndex]]', {
2380                         configurable: true,
2381                         enumerable: false,
2382                         writable: true,
2383                         value: 0
2384                 });
2385                 // 6. Set iterator.[[MapIterationKind]] to kind.
2386                 Object.defineProperty(iterator, '[[MapIterationKind]]', {
2387                         configurable: true,
2388                         enumerable: false,
2389                         writable: true,
2390                         value: kind
2391                 });
2392                 // 7. Return iterator.
2393                 return iterator;
2394         }
2395
2396         // 23.1.5.2. The %MapIteratorPrototype% Object
2397         var MapIteratorPrototype = {};
2398         // Polyfill.io - We use this as a quick way to check if an object is a Map Iterator instance.
2399         Object.defineProperty(MapIteratorPrototype, 'isMapIterator', {
2400                 configurable: false,
2401                 enumerable: false,
2402                 writable: false,
2403                 value: true
2404         });
2405
2406         // 23.1.5.2.1. %MapIteratorPrototype%.next ( )
2407         CreateMethodProperty(MapIteratorPrototype, 'next', function next() {
2408                         // 1. Let O be the this value.
2409                         var O = this;
2410                         // 2. If Type(O) is not Object, throw a TypeError exception.
2411                         if (Type(O) !== 'object') {
2412                                 throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
2413                         }
2414                         // 3. If O does not have all of the internal slots of a Map Iterator Instance (23.1.5.3), throw a TypeError exception.
2415                         if (!O.isMapIterator) {
2416                                 throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
2417                         }
2418                         // 4. Let m be O.[[Map]].
2419                         var m = O['[[Map]]'];
2420                         // 5. Let index be O.[[MapNextIndex]].
2421                         var index = O['[[MapNextIndex]]'];
2422                         // 6. Let itemKind be O.[[MapIterationKind]].
2423                         var itemKind = O['[[MapIterationKind]]'];
2424                         // 7. If m is undefined, return CreateIterResultObject(undefined, true).
2425                         if (m === undefined) {
2426                                 return CreateIterResultObject(undefined, true);
2427                         }
2428                         // 8. Assert: m has a [[MapData]] internal slot.
2429                         if (!m._es6Map) {
2430                                 throw new Error(Object.prototype.toString.call(m) + ' has a [[MapData]] internal slot.');
2431                         }
2432                         // 9. Let entries be the List that is m.[[MapData]].
2433                         var entries = m._keys;
2434                         // 10. Let numEntries be the number of elements of entries.
2435                         var numEntries = entries.length;
2436                         // 11. NOTE: numEntries must be redetermined each time this method is evaluated.
2437                         // 12. Repeat, while index is less than numEntries,
2438                         while (index < numEntries) {
2439                                 // a. Let e be the Record {[[Key]], [[Value]]} that is the value of entries[index].
2440                                 var e = Object.create(null);
2441                                 e['[[Key]]'] = m._keys[index];
2442                                 e['[[Value]]'] = m._values[index];
2443                                 // b. Set index to index+1.
2444                                 index = index + 1;
2445                                 // c. Set O.[[MapNextIndex]] to index.
2446                                 O['[[MapNextIndex]]'] = index;
2447                                 // d. If e.[[Key]] is not empty, then
2448                                 if (e['[[Key]]'] !== undefMarker) {
2449                                         // i. If itemKind is "key", let result be e.[[Key]].
2450                                         if (itemKind === 'key') {
2451                                                 var result = e['[[Key]]'];
2452                                                 // ii. Else if itemKind is "value", let result be e.[[Value]].
2453                                         } else if (itemKind === 'value') {
2454                                                 result = e['[[Value]]'];
2455                                                 // iii. Else,
2456                                         } else {
2457                                                 // 1. Assert: itemKind is "key+value".
2458                                                 if (itemKind !== 'key+value') {
2459                                                         throw new Error();
2460                                                 }
2461                                                 // 2. Let result be CreateArrayFromList(« e.[[Key]], e.[[Value]] »).
2462                                                 result = [
2463                                                         e['[[Key]]'],
2464                                                         e['[[Value]]']
2465                                                 ];
2466                                         }
2467                                         // iv. Return CreateIterResultObject(result, false).
2468                                         return CreateIterResultObject(result, false);
2469                                 }
2470                         }
2471                         // 13. Set O.[[Map]] to undefined.
2472                         O['[[Map]]'] = undefined;
2473                         // 14. Return CreateIterResultObject(undefined, true).
2474                         return CreateIterResultObject(undefined, true);
2475                 }
2476         );
2477
2478         // 23.1.5.2.2 %MapIteratorPrototype% [ @@toStringTag ]
2479         // The initial value of the @@toStringTag property is the String value "Map Iterator".
2480         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
2481
2482         CreateMethodProperty(MapIteratorPrototype, Symbol.iterator, function iterator() {
2483                         return this;
2484                 }
2485         );
2486
2487         // Export the object
2488         try {
2489                 CreateMethodProperty(global, 'Map', Map);
2490         } catch (e) {
2491                 // IE8 throws an error here if we set enumerable to false.
2492                 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
2493                 global['Map'] = Map;
2494         }
2495 }(this));
2496
2497 }
2498
2499 if (!('Set' in this && (function() {
2500         try {
2501                 var s = new Set([1, 2]);
2502                 if (Set.length === 0) {
2503                         if (s.size === 2) {
2504                                 if ('Symbol' in this && 'iterator' in Symbol && typeof s[Symbol.iterator] === 'function') {
2505                                         return true;
2506                                 }
2507                         }
2508                 }
2509                 return false;
2510         } catch (e) {
2511                 return false;
2512         }
2513 }()))) {
2514
2515 // Set
2516 /* global CreateIterResultObject, CreateMethodProperty, GetIterator, IsCallable, IteratorClose, IteratorStep, IteratorValue, OrdinaryCreateFromConstructor, SameValueZero, Symbol */
2517 (function (global) {
2518         var supportsGetters = (function () {
2519                 try {
2520                         var a = {};
2521                         Object.defineProperty(a, 't', {
2522                                 configurable: true,
2523                                 enumerable: false,
2524                                 get: function () {
2525                                         return true;
2526                                 },
2527                                 set: undefined
2528                         });
2529                         return !!a.t;
2530                 } catch (e) {
2531                         return false;
2532                 }
2533         }());
2534
2535         // Deleted set items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
2536         var undefMarker = Symbol('undef');
2537         // 23.2.1.1. Set ( [ iterable ] )
2538         var Set = function Set(/* iterable */) {
2539                 // 1. If NewTarget is undefined, throw a TypeError exception.
2540                 if (!(this instanceof Set)) {
2541                         throw new TypeError('Constructor Set requires "new"');
2542                 }
2543                 // 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%SetPrototype%", « [[SetData]] »).
2544                 var set = OrdinaryCreateFromConstructor(this, Set.prototype, {
2545                         _values: [],
2546                         _size: 0,
2547                         _es6Set: true
2548                 });
2549
2550                 // 3. Set set.[[SetData]] to a new empty List.
2551                 // Polyfill.io - This step was done as part of step two.
2552
2553                 // Some old engines do not support ES5 getters/setters.  Since Set only requires these for the size property, we can fall back to setting the size property statically each time the size of the set changes.
2554                 if (!supportsGetters) {
2555                         Object.defineProperty(set, 'size', {
2556                                 configurable: true,
2557                                 enumerable: false,
2558                                 writable: true,
2559                                 value: 0
2560                         });
2561                 }
2562
2563                 // 4. If iterable is not present, let iterable be undefined.
2564                 var iterable = arguments.length > 0 ? arguments[0] : undefined;
2565
2566                 // 5. If iterable is either undefined or null, return set.
2567                 if (iterable === null || iterable === undefined) {
2568                         return set;
2569                 }
2570
2571                 // 6. Let adder be ? Get(set, "add").
2572                 var adder = set.add;
2573                 // 7. If IsCallable(adder) is false, throw a TypeError exception.
2574                 if (!IsCallable(adder)) {
2575                         throw new TypeError("Set.prototype.add is not a function");
2576                 }
2577
2578                 try {
2579                         // 8. Let iteratorRecord be ? GetIterator(iterable).
2580                         var iteratorRecord = GetIterator(iterable);
2581                         // 9. Repeat,
2582                         while (true) {
2583                                 // a. Let next be ? IteratorStep(iteratorRecord).
2584                                 var next = IteratorStep(iteratorRecord);
2585                                 // b. If next is false, return set.
2586                                 if (next === false) {
2587                                         return set;
2588                                 }
2589                                 // c. Let nextValue be ? IteratorValue(next).
2590                                 var nextValue = IteratorValue(next);
2591                                 // d. Let status be Call(adder, set, « nextValue.[[Value]] »).
2592                                 try {
2593                                         adder.call(set, nextValue);
2594                                 } catch (e) {
2595                                         // e. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
2596                                         return IteratorClose(iteratorRecord, e);
2597                                 }
2598                         }
2599                 } catch (e) {
2600                         // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
2601                         if (Array.isArray(iterable) ||
2602                                 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
2603                                 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
2604                                 (!!iterable.callee)) {
2605                                 var index;
2606                                 var length = iterable.length;
2607                                 for (index = 0; index < length; index++) {
2608                                         adder.call(set, iterable[index]);
2609                                 }
2610                         }
2611                 }
2612                 return set;
2613         };
2614
2615         // 23.2.2.1. Set.prototype
2616         // The initial value of Set.prototype is the intrinsic %SetPrototype% object.
2617         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
2618         Object.defineProperty(Set, 'prototype', {
2619                 configurable: false,
2620                 enumerable: false,
2621                 writable: false,
2622                 value: {}
2623         });
2624
2625         // 23.2.2.2 get Set [ @@species ]
2626         if (supportsGetters) {
2627                 Object.defineProperty(Set, Symbol.species, {
2628                         configurable: true,
2629                         enumerable: false,
2630                         get: function () {
2631                                 // 1. Return the this value.
2632                                 return this;
2633                         },
2634                         set: undefined
2635                 });
2636         } else {
2637                 CreateMethodProperty(Set, Symbol.species, Set);
2638         }
2639
2640         // 23.2.3.1. Set.prototype.add ( value )
2641         CreateMethodProperty(Set.prototype, 'add', function add(value) {
2642                         // 1. Let S be the this value.
2643                         var S = this;
2644                         // 2. If Type(S) is not Object, throw a TypeError exception.
2645                         if (typeof S !== 'object') {
2646                                 throw new TypeError('Method Set.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
2647                         }
2648                         // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
2649                         if (S._es6Set !== true) {
2650                                 throw new TypeError('Method Set.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
2651                         }
2652                         // 4. Let entries be the List that is S.[[SetData]].
2653                         var entries = S._values;
2654                         // 5. For each e that is an element of entries, do
2655                         for (var i = 0; i < entries.length; i++) {
2656                                 var e = entries[i];
2657                                 // a. If e is not empty and SameValueZero(e, value) is true, then
2658                                 if (e !== undefMarker && SameValueZero(e, value)) {
2659                                         // i. Return S.
2660                                         return S;
2661                                 }
2662                         }
2663                         // 6. If value is -0, let value be +0.
2664                         if (1/value === -Infinity) {
2665                                 value = 0;
2666                         }
2667                         // 7. Append value as the last element of entries.
2668                         S._values.push(value);
2669
2670                         this._size = ++this._size;
2671                         if (!supportsGetters) {
2672                                 this.size = this._size;
2673                         }
2674                         // 8. Return S.
2675                         return S;
2676                 });
2677
2678         // 23.2.3.2. Set.prototype.clear ( )
2679         CreateMethodProperty(Set.prototype, 'clear', function clear() {
2680                         // 1. Let S be the this value.
2681                         var S = this;
2682                         // 2. If Type(S) is not Object, throw a TypeError exception.
2683                         if (typeof S !== 'object') {
2684                                 throw new TypeError('Method Set.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(S));
2685                         }
2686                         // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
2687                         if (S._es6Set !== true) {
2688                                 throw new TypeError('Method Set.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(S));
2689                         }
2690                         // 4. Let entries be the List that is S.[[SetData]].
2691                         var entries = S._values;
2692                         // 5. For each e that is an element of entries, do
2693                         for (var i = 0; i < entries.length; i++) {
2694                                 // a. Replace the element of entries whose value is e with an element whose value is empty.
2695                                 entries[i] = undefMarker;
2696                         }
2697                         this._size = 0;
2698                         if (!supportsGetters) {
2699                                 this.size = this._size;
2700                         }
2701                         // 6. Return undefined.
2702                         return undefined;
2703                 });
2704
2705         // 23.2.3.3. Set.prototype.constructor
2706         CreateMethodProperty(Set.prototype, 'constructor', Set);
2707
2708         // 23.2.3.4. Set.prototype.delete ( value )
2709         CreateMethodProperty(Set.prototype, 'delete', function (value) {
2710                         // 1. Let S be the this value.
2711                         var S = this;
2712                         // 2. If Type(S) is not Object, throw a TypeError exception.
2713                         if (typeof S !== 'object') {
2714                                 throw new TypeError('Method Set.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
2715                         }
2716                         // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
2717                         if (S._es6Set !== true) {
2718                                 throw new TypeError('Method Set.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
2719                         }
2720                         // 4. Let entries be the List that is S.[[SetData]].
2721                         var entries = S._values;
2722                         // 5. For each e that is an element of entries, do
2723                         for (var i = 0; i < entries.length; i++) {
2724                                 var e = entries[i];
2725                                 // a. If e is not empty and SameValueZero(e, value) is true, then
2726                                 if (e !== undefMarker && SameValueZero(e, value)) {
2727                                         // i. Replace the element of entries whose value is e with an element whose value is empty.
2728                                         entries[i] = undefMarker;
2729
2730                                         this._size = --this._size;
2731                                         if (!supportsGetters) {
2732                                                 this.size = this._size;
2733                                         }
2734                                         // ii. Return true.
2735                                         return true;
2736                                 }
2737                         }
2738                         // 6. Return false.
2739                         return false;
2740                 }
2741         );
2742
2743         // 23.2.3.5. Set.prototype.entries ( )
2744         CreateMethodProperty(Set.prototype, 'entries', function entries() {
2745                         // 1. Let S be the this value.
2746                         var S = this;
2747                         // 2. Return ? CreateSetIterator(S, "key+value").
2748                         return CreateSetIterator(S, 'key+value');
2749                 }
2750         );
2751
2752         // 23.2.3.6. Set.prototype.forEach ( callbackfn [ , thisArg ] )
2753         CreateMethodProperty(Set.prototype, 'forEach', function forEach(callbackFn /*[ , thisArg ]*/) {
2754                         // 1. Let S be the this value.
2755                         var S = this;
2756                         // 2. If Type(S) is not Object, throw a TypeError exception.
2757                         if (typeof S !== 'object') {
2758                                 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
2759                         }
2760                         // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
2761                         if (S._es6Set !== true) {
2762                                 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
2763                         }
2764                         // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
2765                         if (!IsCallable(callbackFn)) {
2766                                 throw new TypeError(Object.prototype.toString.call(callbackFn) + ' is not a function.');
2767                         }
2768                         // 5. If thisArg is present, let T be thisArg; else let T be undefined.
2769                         if (arguments[1]) {
2770                                 var T = arguments[1];
2771                         }
2772                         // 6. Let entries be the List that is S.[[SetData]].
2773                         var entries = S._values;
2774                         // 7. For each e that is an element of entries, in original insertion order, do
2775                         for (var i = 0; i < entries.length; i++) {
2776                                 var e = entries[i];
2777                                 // a. If e is not empty, then
2778                                 if (e !== undefMarker) {
2779                                         // i. Perform ? Call(callbackfn, T, « e, e, S »).
2780                                         callbackFn.call(T, e, e, S);
2781                                 }
2782                         }
2783                         // 8. Return undefined.
2784                         return undefined;
2785                 }
2786         );
2787
2788         // 23.2.3.7. Set.prototype.has ( value )
2789         CreateMethodProperty(Set.prototype, 'has', function has(value) {
2790                         // 1. Let S be the this value.
2791                         var S = this;
2792                         // 2. If Type(S) is not Object, throw a TypeError exception.
2793                         if (typeof S !== 'object') {
2794                                 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
2795                         }
2796                         // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
2797                         if (S._es6Set !== true) {
2798                                 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
2799                         }
2800                         // 4. Let entries be the List that is S.[[SetData]].
2801                         var entries = S._values;
2802                         // 5. For each e that is an element of entries, do
2803                         for (var i = 0; i < entries.length; i++) {
2804                                 var e = entries[i];
2805                                 // a. If e is not empty and SameValueZero(e, value) is true, return true.
2806                                 if (e !== undefMarker && SameValueZero(e, value)) {
2807                                         return true;
2808                                 }
2809                         }
2810                         // 6. Return false.
2811                         return false;
2812                 }
2813         );
2814
2815         // Polyfill.io - We need to define Set.prototype.values before Set.prototype.keys because keys is a reference to values.
2816         // 23.2.3.10. Set.prototype.values()
2817         var values = function values() {
2818                 // 1. Let S be the this value.
2819                 var S = this;
2820                 // 2. Return ? CreateSetIterator(S, "value").
2821                 return CreateSetIterator(S, "value");
2822         };
2823         CreateMethodProperty(Set.prototype, 'values', values);
2824
2825         // 23.2.3.8 Set.prototype.keys ( )
2826         // The initial value of the keys property is the same function object as the initial value of the values property.
2827         CreateMethodProperty(Set.prototype, 'keys', values);
2828
2829         // 23.2.3.9. get Set.prototype.size
2830         if (supportsGetters) {
2831                 Object.defineProperty(Set.prototype, 'size', {
2832                         configurable: true,
2833                         enumerable: false,
2834                         get: function () {
2835                                 // 1. Let S be the this value.
2836                                 var S = this;
2837                                 // 2. If Type(S) is not Object, throw a TypeError exception.
2838                                 if (typeof S !== 'object') {
2839                                         throw new TypeError('Method Set.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(S));
2840                                 }
2841                                 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
2842                                 if (S._es6Set !== true) {
2843                                         throw new TypeError('Method Set.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(S));
2844                                 }
2845                                 // 4. Let entries be the List that is S.[[SetData]].
2846                                 var entries = S._values;
2847                                 // 5. Let count be 0.
2848                                 var count = 0;
2849                                 // 6. For each e that is an element of entries, do
2850                                 for (var i = 0; i < entries.length; i++) {
2851                                         var e = entries[i];
2852                                         // a. If e is not empty, set count to count+1.
2853                                         if (e !== undefMarker) {
2854                                                 count = count + 1;
2855                                         }
2856                                 }
2857                                 // 7. Return count.
2858                                 return count;
2859                         },
2860                         set: undefined
2861                 });
2862         }
2863
2864         // 23.2.3.11. Set.prototype [ @@iterator ] ( )
2865         // The initial value of the @@iterator property is the same function object as the initial value of the values property.
2866         CreateMethodProperty(Set.prototype, Symbol.iterator, values);
2867
2868         // 23.2.3.12. Set.prototype [ @@toStringTag ]
2869         // The initial value of the @@toStringTag property is the String value "Set".
2870         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
2871
2872         // Polyfill.io - Safari 8 implements Set.name but as a non-configurable property, which means it would throw an error if we try and configure it here.
2873         if (!('name' in Set)) {
2874                 // 19.2.4.2 name
2875                 Object.defineProperty(Set, 'name', {
2876                         configurable: true,
2877                         enumerable: false,
2878                         writable: false,
2879                         value: 'Set'
2880                 });
2881         }
2882
2883         // 23.2.5.1. CreateSetIterator ( set, kind )
2884         function CreateSetIterator(set, kind) {
2885                 // 1. If Type(set) is not Object, throw a TypeError exception.
2886                 if (typeof set !== 'object') {
2887                         throw new TypeError('createSetIterator called on incompatible receiver ' + Object.prototype.toString.call(set));
2888                 }
2889                 // 2. If set does not have a [[SetData]] internal slot, throw a TypeError exception.
2890                 if (set._es6Set !== true) {
2891                         throw new TypeError('createSetIterator called on incompatible receiver ' + Object.prototype.toString.call(set));
2892                 }
2893                 // 3. Let iterator be ObjectCreate(%SetIteratorPrototype%, « [[IteratedSet]], [[SetNextIndex]], [[SetIterationKind]] »).
2894                 var iterator = Object.create(SetIteratorPrototype);
2895                 // 4. Set iterator.[[IteratedSet]] to set.
2896                 Object.defineProperty(iterator, '[[IteratedSet]]', {
2897                         configurable: true,
2898                         enumerable: false,
2899                         writable: true,
2900                         value: set
2901                 });
2902                 // 5. Set iterator.[[SetNextIndex]] to 0.
2903                 Object.defineProperty(iterator, '[[SetNextIndex]]', {
2904                         configurable: true,
2905                         enumerable: false,
2906                         writable: true,
2907                         value: 0
2908                 });
2909                 // 6. Set iterator.[[SetIterationKind]] to kind.
2910                 Object.defineProperty(iterator, '[[SetIterationKind]]', {
2911                         configurable: true,
2912                         enumerable: false,
2913                         writable: true,
2914                         value: kind
2915                 });
2916                 // 7. Return iterator.
2917                 return iterator;
2918         }
2919
2920         // 23.2.5.2. The %SetIteratorPrototype% Object
2921         var SetIteratorPrototype = {};
2922         //Polyfill.io - We add this property to help us identify what is a set iterator.
2923         Object.defineProperty(SetIteratorPrototype, 'isSetIterator', {
2924                 configurable: false,
2925                 enumerable: false,
2926                 writable: false,
2927                 value: true
2928         });
2929
2930         // 23.2.5.2.1. %SetIteratorPrototype%.next ( )
2931         CreateMethodProperty(SetIteratorPrototype, 'next', function next() {
2932                 // 1. Let O be the this value.
2933                 var O = this;
2934                 // 2. If Type(O) is not Object, throw a TypeError exception.
2935                 if (typeof O !== 'object') {
2936                         throw new TypeError('Method %SetIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
2937                 }
2938                 // 3. If O does not have all of the internal slots of a Set Iterator Instance (23.2.5.3), throw a TypeError exception.
2939                 if (!O.isSetIterator) {
2940                         throw new TypeError('Method %SetIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
2941                 }
2942                 // 4. Let s be O.[[IteratedSet]].
2943                 var s = O['[[IteratedSet]]'];
2944                 // 5. Let index be O.[[SetNextIndex]].
2945                 var index = O['[[SetNextIndex]]'];
2946                 // 6. Let itemKind be O.[[SetIterationKind]].
2947                 var itemKind = O['[[SetIterationKind]]'];
2948                 // 7. If s is undefined, return CreateIterResultObject(undefined, true).
2949                 if (s === undefined) {
2950                         return CreateIterResultObject(undefined, true);
2951                 }
2952                 // 8. Assert: s has a [[SetData]] internal slot.
2953                 if (!s._es6Set) {
2954                         throw new Error(Object.prototype.toString.call(s) + ' does not have [[SetData]] internal slot.');
2955                 }
2956                 // 9. Let entries be the List that is s.[[SetData]].
2957                 var entries = s._values;
2958                 // 10. Let numEntries be the number of elements of entries.
2959                 var numEntries = entries.length;
2960                 // 11. NOTE: numEntries must be redetermined each time this method is evaluated.
2961                 // 12. Repeat, while index is less than numEntries,
2962                 while (index < numEntries) {
2963                         // a. Let e be entries[index].
2964                         var e = entries[index];
2965                         // b. Set index to index+1.
2966                         index = index + 1;
2967                         // c. Set O.[[SetNextIndex]] to index.
2968                         O['[[SetNextIndex]]'] = index;
2969                         // d. If e is not empty, then
2970                         if (e !== undefMarker) {
2971                                 // i. If itemKind is "key+value", then
2972                                 if (itemKind === 'key+value') {
2973                                         // 1. Return CreateIterResultObject(CreateArrayFromList(« e, e »), false).
2974                                         return CreateIterResultObject([e, e], false);
2975                                 }
2976                                 // ii. Return CreateIterResultObject(e, false).
2977                                 return CreateIterResultObject(e, false);
2978                         }
2979                 }
2980                 // 13. Set O.[[IteratedSet]] to undefined.
2981                 O['[[IteratedSet]]'] = undefined;
2982                 // 14. Return CreateIterResultObject(undefined, true).
2983                 return CreateIterResultObject(undefined, true);
2984         });
2985
2986         // 23.2.5.2.2. %SetIteratorPrototype% [ @@toStringTag ]
2987         // The initial value of the @@toStringTag property is the String value "Set Iterator".
2988         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
2989
2990         CreateMethodProperty(SetIteratorPrototype, Symbol.iterator, function iterator() {
2991                         return this;
2992                 }
2993         );
2994
2995         // Export the object
2996         try {
2997                 CreateMethodProperty(global, 'Set', Set);
2998         } catch (e) {
2999                 // IE8 throws an error here if we set enumerable to false.
3000                 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
3001                 global['Set'] = Set;
3002         }
3003
3004 }(this));
3005
3006 }
3007
3008 if (!('from' in Array && (function () {
3009         try {
3010                 Array.from({ length: -Infinity });
3011
3012                 return true;
3013         } catch (e) {
3014                 return false;
3015         }
3016 }()))) {
3017
3018 // Array.from
3019 /* globals
3020         IsCallable, GetMethod, Symbol, IsConstructor, Construct, ArrayCreate, GetIterator, IteratorClose,
3021         ToString, IteratorStep, IteratorValue, Call, CreateDataPropertyOrThrow, ToObject, ToLength, Get, CreateMethodProperty
3022 */
3023 (function () {
3024         var toString = Object.prototype.toString;
3025         var stringMatch = String.prototype.match;
3026         // A cross-realm friendly way to detect if a value is a String object or literal.
3027         function isString(value) {
3028                 if (typeof value === 'string') { return true; }
3029                 if (typeof value !== 'object') { return false; }
3030                 return toString.call(value) === '[object String]';
3031         }
3032
3033         // 22.1.2.1. Array.from ( items [ , mapfn [ , thisArg ] ] )
3034         CreateMethodProperty(Array, 'from', function from(items /* [ , mapfn [ , thisArg ] ] */) { // eslint-disable-line no-undef
3035                 // 1. Let C be the this value.
3036                 var C = this;
3037                 // 2. If mapfn is undefined, let mapping be false.
3038                 var mapfn = arguments.length > 1 ? arguments[1] : undefined;
3039                 if (mapfn === undefined) {
3040                         var mapping = false;
3041                         // 3. Else,
3042                 } else {
3043                         // a. If IsCallable(mapfn) is false, throw a TypeError exception.
3044                         if (IsCallable(mapfn) === false) {
3045                                 throw new TypeError(Object.prototype.toString.call(mapfn) + ' is not a function.');
3046                         }
3047                         // b. If thisArg is present, let T be thisArg; else let T be undefined.
3048                         var thisArg = arguments.length > 2 ? arguments[2] : undefined;
3049                         if (thisArg !== undefined) {
3050                                 var T = thisArg;
3051                         } else {
3052                                 T = undefined;
3053                         }
3054                         // c. Let mapping be true.
3055                         mapping = true;
3056
3057                 }
3058                 // 4. Let usingIterator be ? GetMethod(items, @@iterator).
3059                 var usingIterator = GetMethod(items, Symbol.iterator);
3060                 // 5. If usingIterator is not undefined, then
3061                 if (usingIterator !== undefined) {
3062                         // a. If IsConstructor(C) is true, then
3063                         if (IsConstructor(C)) {
3064                                 // i. Let A be ? Construct(C).
3065                                 var A = Construct(C);
3066                                 // b. Else,
3067                         } else {
3068                                 // i. Let A be ! ArrayCreate(0).
3069                                 A = ArrayCreate(0);
3070                         }
3071                         // c. Let iteratorRecord be ? GetIterator(items, usingIterator).
3072                         var iteratorRecord = GetIterator(items, usingIterator);
3073                         // d. Let k be 0.
3074                         var k = 0;
3075                         // e. Repeat,
3076                         while (true) {
3077                                 // i. If k ≥ 2^53-1, then
3078                                 if (k >= (Math.pow(2, 53) - 1)) {
3079                                         // 1. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}.
3080                                         var error = new TypeError('Iteration count can not be greater than or equal 9007199254740991.');
3081                                         // 2. Return ? IteratorClose(iteratorRecord, error).
3082                                         return IteratorClose(iteratorRecord, error);
3083                                 }
3084                                 // ii. Let Pk be ! ToString(k).
3085                                 var Pk = ToString(k);
3086                                 // iii. Let next be ? IteratorStep(iteratorRecord).
3087                                 var next = IteratorStep(iteratorRecord);
3088                                 // iv. If next is false, then
3089                                 if (next === false) {
3090                                         // 1. Perform ? Set(A, "length", k, true).
3091                                         A["length"] = k;
3092                                         // 2. Return A.
3093                                         return A;
3094                                 }
3095                                 // v. Let nextValue be ? IteratorValue(next).
3096                                 var nextValue = IteratorValue(next);
3097                                 // vi. If mapping is true, then
3098                                 if (mapping) {
3099                                         try {
3100                                                 // Polyfill.io - The try catch accounts for step 2.
3101                                                 // 1. Let mappedValue be Call(mapfn, T, « nextValue, k »).
3102                                                 var mappedValue = Call(mapfn, T, [nextValue, k]);
3103                                                 // 2. If mappedValue is an abrupt completion, return ? IteratorClose(iteratorRecord, mappedValue).
3104                                                 // 3. Let mappedValue be mappedValue.[[Value]].
3105                                         } catch (e) {
3106                                                 return IteratorClose(iteratorRecord, e);
3107                                         }
3108
3109                                         // vii. Else, let mappedValue be nextValue.
3110                                 } else {
3111                                         mappedValue = nextValue;
3112                                 }
3113                                 try {
3114                                         // Polyfill.io - The try catch accounts for step ix.
3115                                         // viii. Let defineStatus be CreateDataPropertyOrThrow(A, Pk, mappedValue).
3116                                         CreateDataPropertyOrThrow(A, Pk, mappedValue);
3117                                         // ix. If defineStatus is an abrupt completion, return ? IteratorClose(iteratorRecord, defineStatus).
3118                                 } catch (e) {
3119                                         return IteratorClose(iteratorRecord, e);
3120                                 }
3121                                 // x. Increase k by 1.
3122                                 k = k + 1;
3123                         }
3124                 }
3125                 // 6. NOTE: items is not an Iterable so assume it is an array-like object.
3126                 // 7. Let arrayLike be ! ToObject(items).
3127                 // Polyfill.io - For Strings we need to split astral symbols into surrogate pairs.
3128                 if (isString(items)) {
3129                         var arrayLike = stringMatch.call(items, /[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g) || [];
3130                 } else {
3131                         arrayLike = ToObject(items);
3132                 }
3133                 // 8. Let len be ? ToLength(? Get(arrayLike, "length")).
3134                 var len = ToLength(Get(arrayLike, "length"));
3135                 // 9. If IsConstructor(C) is true, then
3136                 if (IsConstructor(C)) {
3137                         // a. Let A be ? Construct(C, « len »).
3138                         A = Construct(C, [len]);
3139                         // 10. Else,
3140                 } else {
3141                         // a. Let A be ? ArrayCreate(len).
3142                         A = ArrayCreate(len);
3143                 }
3144                 // 11. Let k be 0.
3145                 k = 0;
3146                 // 12. Repeat, while k < len
3147                 while (k < len) {
3148                         // a. Let Pk be ! ToString(k).
3149                         Pk = ToString(k);
3150                         // b. Let kValue be ? Get(arrayLike, Pk).
3151                         var kValue = Get(arrayLike, Pk);
3152                         // c. If mapping is true, then
3153                         if (mapping === true) {
3154                                 // i. Let mappedValue be ? Call(mapfn, T, « kValue, k »).
3155                                 mappedValue = Call(mapfn, T, [kValue, k]);
3156                                 // d. Else, let mappedValue be kValue.
3157                         } else {
3158                                 mappedValue = kValue;
3159                         }
3160                         // e. Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue).
3161                         CreateDataPropertyOrThrow(A, Pk, mappedValue);
3162                         // f. Increase k by 1.
3163                         k = k + 1;
3164                 }
3165                 // 13. Perform ? Set(A, "length", len, true).
3166                 A["length"] = len;
3167                 // 14. Return A.
3168                 return A;
3169         });
3170 }());
3171
3172 }
3173
3174 if (!('of' in Array)) {
3175
3176 // Array.of
3177 /* global ArrayCreate, Construct, CreateDataPropertyOrThrow, CreateMethodProperty, IsConstructor, ToString */
3178 // 22.1.2.3. Array.of ( ...items )
3179 CreateMethodProperty(Array, 'of', function of() {
3180         // 1. Let len be the actual number of arguments passed to this function.
3181         var len = arguments.length;
3182         // 2. Let items be the List of arguments passed to this function.
3183         var items = arguments;
3184         // 3. Let C be the this value.
3185         var C = this;
3186         // 4. If IsConstructor(C) is true, then
3187         if (IsConstructor(C)) {
3188                 // a. Let A be ? Construct(C, « len »).
3189                 var A = Construct(C, [len]);
3190                 // 5. Else,
3191         } else {
3192                 // a. Let A be ? ArrayCreate(len).
3193                 var A = ArrayCreate(len);
3194         }
3195         // 6. Let k be 0.
3196         var k = 0;
3197         // 7. Repeat, while k < len
3198         while (k < len) {
3199                 // a. Let kValue be items[k].
3200                 var kValue = items[k];
3201                 // b. Let Pk be ! ToString(k).
3202                 var Pk = ToString(k);
3203                 // c. Perform ? CreateDataPropertyOrThrow(A, Pk, kValue).
3204                 CreateDataPropertyOrThrow(A, Pk, kValue);
3205                 // d. Increase k by 1.
3206                 var k = k + 1;
3207
3208         }
3209         // 8. Perform ? Set(A, "length", len, true)
3210         A["length"] = len;
3211         // 9. Return A.
3212         return A;
3213 });
3214
3215 }
3216
3217 if (!('assign' in Object)) {
3218
3219 // Object.assign
3220 /* global CreateMethodProperty, Get, ToObject */
3221 // 19.1.2.1 Object.assign ( target, ...sources )
3222 CreateMethodProperty(Object, 'assign', function assign(target, source) { // eslint-disable-line no-unused-vars
3223         // 1. Let to be ? ToObject(target).
3224         var to = ToObject(target);
3225
3226         // 2. If only one argument was passed, return to.
3227         if (arguments.length === 1) {
3228                 return to;
3229         }
3230
3231         // 3. Let sources be the List of argument values starting with the second argument
3232         var sources = Array.prototype.slice.call(arguments, 1);
3233
3234         // 4. For each element nextSource of sources, in ascending index order, do
3235         var index1;
3236         var index2;
3237         var keys;
3238         var from;
3239         for (index1 = 0; index1 < sources.length; index1++) {
3240                 var nextSource = sources[index1];
3241                 // a. If nextSource is undefined or null, let keys be a new empty List.
3242                 if (nextSource === undefined || nextSource === null) {
3243                         keys = [];
3244                         // b. Else,
3245                 } else {
3246                         // i. Let from be ! ToObject(nextSource).
3247                         from = ToObject(nextSource);
3248                         // ii. Let keys be ? from.[[OwnPropertyKeys]]().
3249                         /*
3250                                 This step in our polyfill is not complying with the specification.
3251                                 [[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols.
3252                                 TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]].
3253                         */
3254                         keys = Object.keys(from);
3255                 }
3256
3257                 // c. For each element nextKey of keys in List order, do
3258                 for (index2 = 0; index2 < keys.length; index2++) {
3259                         var nextKey = keys[index2];
3260                         // i. Let desc be ? from.[[GetOwnProperty]](nextKey).
3261                         var desc = Object.getOwnPropertyDescriptor(from, nextKey);
3262                         // ii. If desc is not undefined and desc.[[Enumerable]] is true, then
3263                         if (desc !== undefined && desc.enumerable) {
3264                                 // 1. Let propValue be ? Get(from, nextKey).
3265                                 var propValue = Get(from, nextKey);
3266                                 // 2. Perform ? Set(to, nextKey, propValue, true).
3267                                 to[nextKey] = propValue;
3268                         }
3269                 }
3270         }
3271         // 5. Return to.
3272         return to;
3273 });
3274
3275 }
3276
3277 if (!('Symbol' in this && 'toStringTag' in this.Symbol)) {
3278
3279 // Symbol.toStringTag
3280 /* global Symbol */
3281 Object.defineProperty(Symbol, 'toStringTag', {
3282         value: Symbol('toStringTag')
3283 });
3284
3285 }
3286
3287
3288 // _Iterator
3289 /* global Symbol */
3290 // A modification of https://github.com/medikoo/es6-iterator
3291 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
3292
3293 var Iterator = (function () { // eslint-disable-line no-unused-vars
3294         var clear = function () {
3295                 this.length = 0;
3296                 return this;
3297         };
3298         var callable = function (fn) {
3299                 if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
3300                 return fn;
3301         };
3302
3303         var Iterator = function (list, context) {
3304                 if (!(this instanceof Iterator)) {
3305                         return new Iterator(list, context);
3306                 }
3307                 Object.defineProperties(this, {
3308                         __list__: {
3309                                 writable: true,
3310                                 value: list
3311                         },
3312                         __context__: {
3313                                 writable: true,
3314                                 value: context
3315                         },
3316                         __nextIndex__: {
3317                                 writable: true,
3318                                 value: 0
3319                         }
3320                 });
3321                 if (!context) return;
3322                 callable(context.on);
3323                 context.on('_add', this._onAdd.bind(this));
3324                 context.on('_delete', this._onDelete.bind(this));
3325                 context.on('_clear', this._onClear.bind(this));
3326         };
3327
3328         Object.defineProperties(Iterator.prototype, Object.assign({
3329                 constructor: {
3330                         value: Iterator,
3331                         configurable: true,
3332                         enumerable: false,
3333                         writable: true
3334                 },
3335                 _next: {
3336                         value: function () {
3337                                 var i;
3338                                 if (!this.__list__) return;
3339                                 if (this.__redo__) {
3340                                         i = this.__redo__.shift();
3341                                         if (i !== undefined) return i;
3342                                 }
3343                                 if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
3344                                 this._unBind();
3345                         },
3346                         configurable: true,
3347                         enumerable: false,
3348                         writable: true
3349                 },
3350                 next: {
3351                         value: function () {
3352                                 return this._createResult(this._next());
3353                         },
3354                         configurable: true,
3355                         enumerable: false,
3356                         writable: true
3357                 },
3358                 _createResult: {
3359                         value: function (i) {
3360                                 if (i === undefined) return {
3361                                         done: true,
3362                                         value: undefined
3363                                 };
3364                                 return {
3365                                         done: false,
3366                                         value: this._resolve(i)
3367                                 };
3368                         },
3369                         configurable: true,
3370                         enumerable: false,
3371                         writable: true
3372                 },
3373                 _resolve: {
3374                         value: function (i) {
3375                                 return this.__list__[i];
3376                         },
3377                         configurable: true,
3378                         enumerable: false,
3379                         writable: true
3380                 },
3381                 _unBind: {
3382                         value: function () {
3383                                 this.__list__ = null;
3384                                 delete this.__redo__;
3385                                 if (!this.__context__) return;
3386                                 this.__context__.off('_add', this._onAdd.bind(this));
3387                                 this.__context__.off('_delete', this._onDelete.bind(this));
3388                                 this.__context__.off('_clear', this._onClear.bind(this));
3389                                 this.__context__ = null;
3390                         },
3391                         configurable: true,
3392                         enumerable: false,
3393                         writable: true
3394                 },
3395                 toString: {
3396                         value: function () {
3397                                 return '[object Iterator]';
3398                         },
3399                         configurable: true,
3400                         enumerable: false,
3401                         writable: true
3402                 }
3403         }, {
3404                 _onAdd: {
3405                         value: function (index) {
3406                                 if (index >= this.__nextIndex__) return;
3407                                 ++this.__nextIndex__;
3408                                 if (!this.__redo__) {
3409                                         Object.defineProperty(this, '__redo__', {
3410                                                 value: [index],
3411                                                 configurable: true,
3412                                                 enumerable: false,
3413                                                 writable: false
3414                                         });
3415                                         return;
3416                                 }
3417                                 this.__redo__.forEach(function (redo, i) {
3418                                         if (redo >= index) this.__redo__[i] = ++redo;
3419                                 }, this);
3420                                 this.__redo__.push(index);
3421                         },
3422                         configurable: true,
3423                         enumerable: false,
3424                         writable: true
3425                 },
3426                 _onDelete: {
3427                         value: function (index) {
3428                                 var i;
3429                                 if (index >= this.__nextIndex__) return;
3430                                 --this.__nextIndex__;
3431                                 if (!this.__redo__) return;
3432                                 i = this.__redo__.indexOf(index);
3433                                 if (i !== -1) this.__redo__.splice(i, 1);
3434                                 this.__redo__.forEach(function (redo, i) {
3435                                         if (redo > index) this.__redo__[i] = --redo;
3436                                 }, this);
3437                         },
3438                         configurable: true,
3439                         enumerable: false,
3440                         writable: true
3441                 },
3442                 _onClear: {
3443                         value: function () {
3444                                 if (this.__redo__) clear.call(this.__redo__);
3445                                 this.__nextIndex__ = 0;
3446                         },
3447                         configurable: true,
3448                         enumerable: false,
3449                         writable: true
3450                 }
3451         }));
3452
3453         Object.defineProperty(Iterator.prototype, Symbol.iterator, {
3454                 value: function () {
3455                         return this;
3456                 },
3457                 configurable: true,
3458                 enumerable: false,
3459                 writable: true
3460         });
3461         Object.defineProperty(Iterator.prototype, Symbol.toStringTag, {
3462                 value: 'Iterator',
3463                 configurable: false,
3464                 enumerable: false,
3465                 writable: true
3466         });
3467
3468         return Iterator;
3469 }());
3470
3471 // Object.setPrototypeOf
3472 /* global CreateMethodProperty */
3473 // ES6-shim 0.16.0 (c) 2013-2014 Paul Miller (http://paulmillr.com)
3474 // ES6-shim may be freely distributed under the MIT license.
3475 // For more details and documentation:
3476 // https://github.com/paulmillr/es6-shim/
3477
3478  // NOTE:  This versions needs object ownership
3479   //        because every promoted object needs to be reassigned
3480   //        otherwise uncompatible browsers cannot work as expected
3481   //
3482   // NOTE:  This might need es5-shim or polyfills upfront
3483   //        because it's based on ES5 API.
3484   //        (probably just an IE <= 8 problem)
3485   //
3486   // NOTE:  nodejs is fine in version 0.8, 0.10, and future versions.
3487 (function () {
3488         if (Object.setPrototypeOf) { return; }
3489
3490         /*jshint proto: true */
3491         // @author    Andrea Giammarchi - @WebReflection
3492
3493         var getOwnPropertyNames = Object.getOwnPropertyNames;
3494         var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
3495         var create = Object.create;
3496         var defineProperty = Object.defineProperty;
3497         var getPrototypeOf = Object.getPrototypeOf;
3498         var objProto = Object.prototype;
3499
3500         var copyDescriptors = function (target, source) {
3501                 // define into target descriptors from source
3502                 getOwnPropertyNames(source).forEach(function (key) {
3503                         defineProperty(
3504                                 target,
3505                                 key,
3506                                 getOwnPropertyDescriptor(source, key)
3507                         );
3508                 });
3509                 return target;
3510         };
3511         // used as fallback when no promotion is possible
3512         var createAndCopy = function setPrototypeOf(origin, proto) {
3513                 return copyDescriptors(create(proto), origin);
3514         };
3515         var set, sPOf;
3516         try {
3517                 // this might fail for various reasons
3518                 // ignore if Chrome cought it at runtime
3519                 set = getOwnPropertyDescriptor(objProto, '__proto__').set;
3520                 set.call({}, null);
3521                 // setter not poisoned, it can promote
3522                 // Firefox, Chrome
3523                 sPOf = function setPrototypeOf(origin, proto) {
3524                         set.call(origin, proto);
3525                         return origin;
3526                 };
3527         } catch (e) {
3528                 // do one or more feature detections
3529                 set = { __proto__: null };
3530                 // if proto does not work, needs to fallback
3531                 // some Opera, Rhino, ducktape
3532                 if (set instanceof Object) {
3533                         sPOf = createAndCopy;
3534                 } else {
3535                         // verify if null objects are buggy
3536                         /* eslint-disable no-proto */
3537                         set.__proto__ = objProto;
3538                         /* eslint-enable no-proto */
3539                         // if null objects are buggy
3540                         // nodejs 0.8 to 0.10
3541                         if (set instanceof Object) {
3542                                 sPOf = function setPrototypeOf(origin, proto) {
3543                                         // use such bug to promote
3544                                         /* eslint-disable no-proto */
3545                                         origin.__proto__ = proto;
3546                                         /* eslint-enable no-proto */
3547                                         return origin;
3548                                 };
3549                         } else {
3550                                 // try to use proto or fallback
3551                                 // Safari, old Firefox, many others
3552                                 sPOf = function setPrototypeOf(origin, proto) {
3553                                         // if proto is not null
3554                                         if (getPrototypeOf(origin)) {
3555                                                 // use __proto__ to promote
3556                                                 /* eslint-disable no-proto */
3557                                                 origin.__proto__ = proto;
3558                                                 /* eslint-enable no-proto */
3559                                                 return origin;
3560                                         } else {
3561                                                 // otherwise unable to promote: fallback
3562                                                 return createAndCopy(origin, proto);
3563                                         }
3564                                 };
3565                         }
3566                 }
3567         }
3568         CreateMethodProperty(Object, 'setPrototypeOf', sPOf);
3569 }());
3570
3571 // _ESAbstract.RequireObjectCoercible
3572 // 7.2.1. RequireObjectCoercible ( argument )
3573 // The abstract operation ToObject converts argument to a value of type Object according to Table 12:
3574 // Table 12: ToObject Conversions
3575 /*
3576 |----------------------------------------------------------------------------------------------------------------------------------------------------|
3577 | Argument Type | Result                                                                                                                             |
3578 |----------------------------------------------------------------------------------------------------------------------------------------------------|
3579 | Undefined     | Throw a TypeError exception.                                                                                                       |
3580 | Null          | Throw a TypeError exception.                                                                                                       |
3581 | Boolean       | Return argument.                                                                                                                   |
3582 | Number        | Return argument.                                                                                                                   |
3583 | String        | Return argument.                                                                                                                   |
3584 | Symbol        | Return argument.                                                                                                                   |
3585 | Object        | Return argument.                                                                                                                   |
3586 |----------------------------------------------------------------------------------------------------------------------------------------------------|
3587 */
3588 function RequireObjectCoercible(argument) { // eslint-disable-line no-unused-vars
3589         if (argument === null || argument === undefined) {
3590                 throw TypeError();
3591         }
3592   return argument;
3593 }
3594
3595 // _ESAbstract.IsRegExp
3596 /* global Type, Get, ToBoolean */
3597 // 7.2.8. IsRegExp ( argument )
3598 function IsRegExp(argument) { // eslint-disable-line no-unused-vars
3599         // 1. If Type(argument) is not Object, return false.
3600         if (Type(argument) !== 'object') {
3601                 return false;
3602         }
3603         // 2. Let matcher be ? Get(argument, @@match).
3604         var matcher = 'Symbol' in this && 'match' in this.Symbol ? Get(argument, this.Symbol.match) : undefined;
3605         // 3. If matcher is not undefined, return ToBoolean(matcher).
3606         if (matcher !== undefined) {
3607                 return ToBoolean(matcher);
3608         }
3609         // 4. If argument has a [[RegExpMatcher]] internal slot, return true.
3610         try {
3611                 var lastIndex = argument.lastIndex;
3612                 argument.lastIndex = 0;
3613                 RegExp.prototype.exec.call(argument);
3614                 return true;
3615         } catch (e) {} finally {
3616                 argument.lastIndex = lastIndex;
3617         }
3618         // 5. Return false.
3619         return false;
3620 }
3621 if (!('includes' in String.prototype)) {
3622
3623 // String.prototype.includes
3624 /* global CreateMethodProperty, IsRegExp, RequireObjectCoercible, ToInteger, ToString */
3625 // 21.1.3.7. String.prototype.includes ( searchString [ , position ] )
3626 CreateMethodProperty(String.prototype, 'includes', function includes(searchString /* [ , position ] */) {
3627         'use strict';
3628         var position = arguments.length > 1 ? arguments[1] : undefined;
3629         // 1. Let O be ? RequireObjectCoercible(this value).
3630         var O = RequireObjectCoercible(this);
3631         // 2. Let S be ? ToString(O).
3632         var S = ToString(O);
3633         // 3. Let isRegExp be ? IsRegExp(searchString).
3634         var isRegExp = IsRegExp(searchString);
3635         // 4. If isRegExp is true, throw a TypeError exception.
3636         if (isRegExp) {
3637                 throw new TypeError('First argument to String.prototype.includes must not be a regular expression');
3638         }
3639         // 5. Let searchStr be ? ToString(searchString).
3640         var searchStr = ToString(searchString);
3641         // 6. Let pos be ? ToInteger(position). (If position is undefined, this step produces the value 0.)
3642         var pos = ToInteger(position);
3643         // 7. Let len be the length of S.
3644         var len = S.length;
3645         // 8. Let start be min(max(pos, 0), len).
3646         var start = Math.min(Math.max(pos, 0), len);
3647         // 9. Let searchLen be the length of searchStr.
3648         // var searchLength = searchStr.length;
3649         // 10. If there exists any integer k not smaller than start such that k + searchLen is not greater than len, and for all nonnegative integers j less than searchLen, the code unit at index k+j within S is the same as the code unit at index j within searchStr, return true; but if there is no such integer k, return false.
3650         return String.prototype.indexOf.call(S, searchStr, start) !== -1;
3651 });
3652
3653 }
3654
3655
3656 // _ArrayIterator
3657 /* global Iterator */
3658 // A modification of https://github.com/medikoo/es6-iterator
3659 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
3660
3661 var ArrayIterator = (function() { // eslint-disable-line no-unused-vars
3662
3663         var ArrayIterator = function(arr, kind) {
3664                 if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
3665                 Iterator.call(this, arr);
3666                 if (!kind) kind = 'value';
3667                 else if (String.prototype.includes.call(kind, 'key+value')) kind = 'key+value';
3668                 else if (String.prototype.includes.call(kind, 'key')) kind = 'key';
3669                 else kind = 'value';
3670                 Object.defineProperty(this, '__kind__', {
3671                         value: kind,
3672                         configurable: false,
3673                         enumerable: false,
3674                         writable: false
3675                 });
3676         };
3677         if (Object.setPrototypeOf) Object.setPrototypeOf(ArrayIterator, Iterator.prototype);
3678
3679         ArrayIterator.prototype = Object.create(Iterator.prototype, {
3680                 constructor: {
3681                         value: ArrayIterator,
3682                         configurable: true,
3683                         enumerable: false,
3684                         writable: true
3685                 },
3686                 _resolve: {
3687                         value: function(i) {
3688                                 if (this.__kind__ === 'value') return this.__list__[i];
3689                                 if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
3690                                 return i;
3691                         },
3692                         configurable: true,
3693                         enumerable: false,
3694                         writable: true
3695                 },
3696                 toString: {
3697                         value: function() {
3698                                 return '[object Array Iterator]';
3699                         },
3700                         configurable: true,
3701                         enumerable: false,
3702                         writable: true
3703                 }
3704         });
3705
3706         return ArrayIterator;
3707 }());
3708 if (!('values' in Array.prototype)) {
3709
3710 // Array.prototype.values
3711 /* global CreateMethodProperty, Symbol, ToObject */
3712 // 22.1.3.30/ Array.prototype.values ( )
3713 // Polyfill.io - Firefox, Chrome and Opera have Array.prototype[Symbol.iterator], which is the exact same function as Array.prototype.values.
3714 if ('Symbol' in this && 'iterator' in Symbol && typeof Array.prototype[Symbol.iterator] === 'function') {
3715         CreateMethodProperty(Array.prototype, 'values', Array.prototype[Symbol.iterator]);
3716 } else {
3717         CreateMethodProperty(Array.prototype, 'values', function values () {
3718                 // 1. Let O be ? ToObject(this value).
3719                 var O = ToObject(this);
3720                 // 2. Return CreateArrayIterator(O, "value").
3721                 // TODO: Add CreateArrayIterator
3722                 return new ArrayIterator(O, 'value');
3723         });
3724 }
3725
3726 }
3727
3728 if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype[Symbol.iterator])) {
3729
3730 // Array.prototype.@@iterator
3731 /* global Symbol, CreateMethodProperty */
3732 // 22.1.3.31. Array.prototype [ @@iterator ] ( )
3733 // The initial value of the @@iterator property is the same function object as the initial value of the  Array.prototype.values property.
3734 CreateMethodProperty(Array.prototype, Symbol.iterator, Array.prototype.values);
3735
3736 }
3737
3738 if (!('copyWithin' in Array.prototype && (function () {
3739         try {
3740                 var Parent = function Parent() {};
3741                 Parent.prototype[0] = 'foo';
3742                 var sparse = new Parent();
3743                 sparse[1] = 1;
3744                 sparse[2] = 2;
3745                 sparse.length = 3;
3746                 var result = Array.prototype.copyWithin.call(sparse, 1, 0);
3747                 if (result['0'] && !Object.prototype.hasOwnProperty.call(result, '0') && Object.prototype.hasOwnProperty.call(result, '1') && result[0] === 'foo' && result[1] === 'foo' && result[2] === 1 && result.length === 3) {
3748                         return true;
3749                 } else {
3750                         return false;
3751                 }
3752         } catch (err) {
3753                 return false;
3754         }
3755 }()))) {
3756
3757 // Array.prototype.copyWithin
3758 /* global CreateMethodProperty, HasProperty, ToInteger */
3759 // 22.1.3.3 Array.prototype.copyWithin ( target, start [ , end ] )
3760 CreateMethodProperty(Array.prototype, 'copyWithin', function copyWithin(target, start /* [ , end ] */ ) {
3761         'use strict';
3762         var end = arguments[2];
3763
3764         // 22.1.3.3.1 Let O be ? ToObject(this value).
3765         if (this === null || this === undefined) {
3766                 throw new TypeError('Cannot call method on ' + this);
3767         }
3768
3769         var o = Object(this);
3770
3771         // 22.1.3.3.2 Let len be ? ToLength(? Get(O, "length")).
3772         var len = ToInteger(o.length);
3773         if (len <= 0) {
3774                 len = 0;
3775         }
3776         if (len === Infinity) {
3777                 len = Math.pow(2, 53) - 1;
3778         } else {
3779                 len = Math.min(len, Math.pow(2, 53) - 1);
3780         }
3781         len = Math.max(len, 0);
3782
3783         // 22.1.3.3.3 Let relativeTarget be ? ToInteger(target).
3784         var relativeTarget = ToInteger(target);
3785
3786         // 22.1.3.3.4 If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let to be min(relativeTarget, len).
3787         var to;
3788         if (relativeTarget < 0) {
3789                 to = Math.max(len + relativeTarget, 0);
3790         } else {
3791                 to = Math.min(relativeTarget, len);
3792         }
3793
3794         // 22.1.3.3.5 Let relativeStart be ? ToInteger(start).
3795         var relativeStart = ToInteger(start);
3796
3797         // 22.1.3.3.6 If relativeStart < 0, let from be max((len + relativeStart), 0); else let from be min(relativeStart, len).
3798         var from;
3799         if (relativeStart < 0) {
3800                 from = Math.max(len + relativeStart, 0);
3801         } else {
3802                 from = Math.min(relativeStart, len);
3803         }
3804
3805         // 22.1.3.3.7 If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToInteger(end).
3806         var relativeEnd;
3807         if (end === undefined) {
3808                 relativeEnd = len;
3809         } else {
3810                 relativeEnd = ToInteger(end);
3811         }
3812
3813         // 22.1.3.3.8 If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let final be min(relativeEnd, len).
3814         var final;
3815         if (relativeEnd < 0) {
3816                 final = Math.max(len + relativeEnd, 0);
3817         } else {
3818                 final = Math.min(relativeEnd, len);
3819         }
3820
3821         // 22.1.3.3.9 Let count be min(final-from, len-to).
3822         var count = Math.min(final - from, len - to);
3823
3824         // 22.1.3.3.10 If from<to and to<from+count, then
3825         var direction;
3826         if (from < to && to < from + count) {
3827                 // 22.1.3.3.10.a Let direction be -1.
3828                 direction = -1;
3829
3830                 // 22.1.3.3.10.b Let from be from + count - 1.
3831                 from = from + count - 1;
3832
3833                 // 22.1.3.3.10.c Let to be to + count - 1.
3834                 to = to + count - 1;
3835         } else {
3836                 // 22.1.3.3.11 Else,
3837                 // 22.1.3.3.11.a Let direction be 1.
3838                 direction = 1;
3839         }
3840
3841         // 22.1.3.3.12 Repeat, while count > 0
3842         while (count > 0) {
3843                 // 22.1.3.3.12.a Let fromKey be ! ToString(from).
3844                 var fromKey = String(from);
3845                 // 22.1.3.3.12.b Let toKey be ! ToString(to).
3846                 var toKey = String(to);
3847                 // 22.1.3.3.12.c Let fromPresent be ? HasProperty(O, fromKey).
3848                 var fromPresent = HasProperty(o, fromKey);
3849                 // 22.1.3.3.12.d If fromPresent is true, then
3850                 if (fromPresent) {
3851                         // 22.1.3.3.12.d.i Let fromVal be ? Get(O, fromKey).
3852                         var fromVal = o[fromKey];
3853                         // 22.1.3.3.12.d.ii Perform ? Set(O, toKey, fromVal, true).
3854                         o[toKey] = fromVal;
3855                 } else {
3856                         // 22.1.3.3.12.e Else fromPresent is false,
3857                         // 22.1.3.3.12.e.i Perform ? DeletePropertyOrThrow(O, toKey).
3858                         delete o[toKey];
3859                 }
3860                 // 22.1.3.3.12.f Let from be from + direction.
3861                 from = from + direction;
3862                 // 22.1.3.3.12.g Let to be to + direction.
3863                 to = to + direction;
3864                 // 22.1.3.3.12.h Let count be count - 1.
3865                 count = count - 1;
3866         }
3867         // 22.1.3.3.13 Return O.
3868         return o;
3869 });
3870
3871 }
3872
3873 if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype.entries)) {
3874
3875 // Array.prototype.entries
3876 /* global CreateMethodProperty, ToObject */
3877 // 22.1.3.4. Array.prototype.entries ( )
3878 CreateMethodProperty(Array.prototype, 'entries', function entries() {
3879         // 1. Let O be ? ToObject(this value).
3880         var O = ToObject(this);
3881         // 2. Return CreateArrayIterator(O, "key+value").
3882         // TODO: Add CreateArrayIterator
3883         return new ArrayIterator(O, 'key+value');
3884 });
3885
3886 }
3887
3888 if (!('fill' in Array.prototype)) {
3889
3890 // Array.prototype.fill
3891 /* global CreateMethodProperty, Get, ToInteger, ToLength, ToObject, ToString */
3892 // 22.1.3.6. Array.prototype.fill ( value [ , start [ , end ] ] )
3893 CreateMethodProperty(Array.prototype, 'fill', function fill(value /* [ , start [ , end ] ] */) {
3894         var start = arguments[1];
3895         var end = arguments[2];
3896         // 1. Let O be ? ToObject(this value).
3897         var O = ToObject(this);
3898         // 2. Let len be ? ToLength(? Get(O, "length")).
3899         var len = ToLength(Get(O, "length"));
3900         // 3. Let relativeStart be ? ToInteger(start).
3901         var relativeStart = ToInteger(start);
3902         // 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be min(relativeStart, len)
3903         var k = relativeStart < 0 ? Math.max((len + relativeStart), 0) : Math.min(relativeStart, len);
3904         // 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToInteger(end).
3905         var relativeEnd = end === undefined ? len : ToInteger(end);
3906         // 6. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let final be min(relativeEnd, len).
3907         var final = relativeEnd < 0 ? Math.max((len + relativeEnd), 0) : Math.min(relativeEnd, len);
3908         // 7. Repeat, while k < final
3909         while (k < final) {
3910                 // a. Let Pk be ! ToString(k).
3911                 var Pk = ToString(k);
3912                 // b. Perform ? Set(O, Pk, value, true).
3913                 O[Pk] = value;
3914                 // c. Increase k by 1.
3915                 k = k + 1;
3916         }
3917         // 8. Return O.
3918         return O;
3919 });
3920
3921 }
3922
3923 if (!('find' in Array.prototype)) {
3924
3925 // Array.prototype.find
3926 /* global Call, CreateMethodProperty, Get, IsCallable, ToBoolean, ToLength, ToObject, ToString */
3927 // 22.1.3.8 Array.prototype.find ( predicate [ , thisArg ] )
3928 CreateMethodProperty(Array.prototype, 'find', function find( predicate /* [ , thisArg ] */) {
3929         // 1. Let O be ? ToObject(this value).
3930         var O = ToObject(this);
3931         // 2. Let len be ? ToLength(? Get(O, "length")).
3932         var len = ToLength(Get(O, "length"));
3933         // 3. If IsCallable(predicate) is false, throw a TypeError exception.
3934         if (IsCallable(predicate) === false) {
3935                 throw new TypeError(predicate + ' is not a function');
3936         }
3937         // 4. If thisArg is present, let T be thisArg; else let T be undefined.
3938         var T = arguments.length > 1 ? arguments[1] : undefined;
3939         // 5. Let k be 0.
3940         var k = 0;
3941         // 6. Repeat, while k < len
3942         while (k < len) {
3943                 // a. Let Pk be ! ToString(k).
3944                 var Pk = ToString(k);
3945                 // b. Let kValue be ? Get(O, Pk).
3946                 var kValue = Get(O, Pk);
3947                 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
3948                 var testResult = ToBoolean(Call(predicate, T, [kValue, k, O ]));
3949                 // d. If testResult is true, return kValue.
3950                 if (testResult) {
3951                         return kValue;
3952                 }
3953                 // e. Increase k by 1.
3954                 var k = k + 1;
3955         }
3956         // 7. Return undefined.
3957         return undefined;
3958 });
3959
3960 }
3961
3962 if (!('findIndex' in Array.prototype)) {
3963
3964 // Array.prototype.findIndex
3965 /* global Call, CreateMethodProperty, Get, IsCallable, ToBoolean, ToLength, ToObject, ToString */
3966 // 22.1.3.9. Array.prototype.findIndex ( predicate [ , thisArg ] )
3967 CreateMethodProperty(Array.prototype, 'findIndex', function findIndex(predicate /* [ , thisArg ] */) {
3968         // 1. Let O be ? ToObject(this value).
3969         var O = ToObject(this);
3970         // 2. Let len be ? ToLength(? Get(O, "length")).
3971         var len = ToLength(Get(O, "length"));
3972         // 3. If IsCallable(predicate) is false, throw a TypeError exception.
3973         if (IsCallable(predicate) === false) {
3974                 throw new TypeError(predicate + ' is not a function');
3975         }
3976         // 4. If thisArg is present, let T be thisArg; else let T be undefined.
3977         var T = arguments.length > 1 ? arguments[1] : undefined;
3978         // 5. Let k be 0.
3979         var k = 0;
3980         // 6. Repeat, while k < len
3981         while (k < len) {
3982                 // a. Let Pk be ! ToString(k).
3983                 var Pk = ToString(k);
3984                 // b. Let kValue be ? Get(O, Pk).
3985                 var kValue = Get(O, Pk);
3986                 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
3987                 var testResult = ToBoolean(Call(predicate, T, [kValue, k, O]));
3988                 // d. If testResult is true, return k.
3989                 if (testResult) {
3990                         return k;
3991                 }
3992                 // e. Increase k by 1.
3993                 k = k + 1;
3994         }
3995         // 7. Return -1.
3996         return -1;
3997 });
3998
3999 }
4000
4001 if (!('Symbol' in this && 'iterator' in this.Symbol && !!Array.prototype.keys)) {
4002
4003 // Array.prototype.keys
4004 /* global CreateMethodProperty, ToObject */
4005 // 22.1.3.14. Array.prototype.keys ( )
4006 CreateMethodProperty(Array.prototype, 'keys', function keys() {
4007         // 1. Let O be ? ToObject(this value).
4008         var O = ToObject(this);
4009         // 2. Return CreateArrayIterator(O, "key").
4010         // TODO: Add CreateArrayIterator.
4011         return new ArrayIterator(O, 'key');
4012 });
4013
4014 }
4015
4016 if (!('name' in Function.prototype && (function x() {}).name === 'x')) {
4017
4018 // Function.name
4019 (function () {
4020
4021         var
4022         accessorName = 'name',
4023         fnNameMatchRegex = /^\s*function\s+([^\(\s]*)\s*/,
4024         $Function = Function,
4025         FunctionName = 'Function',
4026         FunctionProto = $Function.prototype,
4027         FunctionProtoCtor = FunctionProto.constructor,
4028
4029         getFunctionName = function(fn) {
4030                 var match, name;
4031
4032                 if (fn === $Function || fn === FunctionProtoCtor) {
4033                         name = FunctionName;
4034                 }
4035                 else if (fn !== FunctionProto) {
4036                         match = ('' + fn).match(fnNameMatchRegex);
4037                         name = match && match[1];
4038                 }
4039                 return name || '';
4040         };
4041
4042
4043         Object.defineProperty(FunctionProto, accessorName, {
4044                 get: function Function$name() {
4045                         var
4046                         fn = this,
4047                         fnName = getFunctionName(fn);
4048
4049                         // Since named function definitions have immutable names, also memoize the
4050                         // output by defining the `name` property directly on this Function
4051                         // instance so the accessor function will not need to be invoked again.
4052                         if (fn !== FunctionProto) {
4053                                 Object.defineProperty(fn, accessorName, {
4054                                         value: fnName,
4055                                         configurable: true
4056                                 });
4057                         }
4058
4059                         return fnName;
4060                 },
4061                 configurable: true
4062         });
4063
4064 }());
4065
4066 }
4067
4068 if (!('acosh' in Math)) {
4069
4070 // Math.acosh
4071 /* global CreateMethodProperty */
4072 // 20.2.2.3. Math.acosh ( x )
4073 CreateMethodProperty(Math, 'acosh', function acosh(x) {
4074         // If x is NaN, the result is NaN.
4075         if (isNaN(x)) {
4076                 return NaN;
4077         }
4078         // If x is less than 1, the result is NaN.
4079         if (x < 1) {
4080                 return NaN;
4081         }
4082         // If x is 1, the result is +0.
4083         if (x === 1) {
4084                 return 0;
4085         }
4086         // If x is +∞, the result is +∞.
4087         if (x === Infinity) {
4088                 return Infinity;
4089         }
4090         return Math.log(x + Math.sqrt(x * x - 1));
4091 });
4092
4093 }
4094
4095 if (!('asinh' in Math)) {
4096
4097 // Math.asinh
4098 /* global CreateMethodProperty */
4099 // 20.2.2.5. Math.asinh ( x )
4100 CreateMethodProperty(Math, 'asinh', function asinh(x) {
4101         // If x is NaN, the result is NaN.
4102         if (isNaN(x)) {
4103                 return NaN;
4104         }
4105         // If x is +0, the result is +0.
4106         if (x === 0 && 1/x === Infinity) {
4107                 return 0;
4108         }
4109         // If x is -0, the result is -0.
4110         if (x === 0 && 1/x === -Infinity) {
4111                 return -0;
4112         }
4113         // If x is +∞, the result is +∞.
4114         if (x === Infinity) {
4115                 return Infinity;
4116         }
4117         // If x is -∞, the result is -∞.
4118         if (x === -Infinity) {
4119                 return -Infinity;
4120         }
4121         return Math.log(x + Math.sqrt(x * x + 1));
4122 });
4123
4124 }
4125
4126 if (!('atanh' in Math)) {
4127
4128 // Math.atanh
4129 /* global CreateMethodProperty */
4130 // 20.2.2.7. Math.atanh ( x )
4131 CreateMethodProperty(Math, 'atanh', function atanh(x) {
4132         // If x is NaN, the result is NaN.
4133         if (isNaN(x)) {
4134                 return NaN;
4135         }
4136         // If x is less than -1, the result is NaN.
4137         if (x < -1) {
4138                 return NaN;
4139         }
4140         // If x is greater than 1, the result is NaN.
4141         if (x > 1) {
4142                 return NaN;
4143         }
4144         // If x is -1, the result is -∞.
4145         if (x === -1) {
4146                 return -Infinity;
4147         }
4148         // If x is +1, the result is +∞.
4149         if (x === 1) {
4150                 return Infinity;
4151         }
4152         // If x is +0, the result is +0.
4153         if (x === 0 && 1/x === Infinity) {
4154                 return 0;
4155         }
4156         // If x is -0, the result is -0.
4157         if (x === 0 && 1/x === -Infinity) {
4158                 return -0;
4159         }
4160         return Math.log((1 + x) / (1 - x)) / 2;
4161 });
4162
4163 }
4164
4165 if (!('cbrt' in Math)) {
4166
4167 // Math.cbrt
4168 /* global CreateMethodProperty */
4169 // 20.2.2.9. Math.cbrt ( x )
4170 CreateMethodProperty(Math, 'cbrt', function cbrt(x) {
4171         // If x is NaN, the result is NaN.
4172         if (isNaN(x)) {
4173                 return NaN;
4174         }
4175         // If x is +0, the result is +0.
4176         if (x === 0 && 1/x === Infinity) {
4177                 return 0;
4178         }
4179         // If x is -0, the result is -0.
4180         if (x === 0 && 1/x === -Infinity) {
4181                 return -0;
4182         }
4183         // If x is +∞, the result is +∞.
4184         if (x === Infinity) {
4185                 return Infinity;
4186         }
4187         // If x is -∞, the result is -∞.
4188         if (x === -Infinity) {
4189                 return -Infinity;
4190         }
4191         var y = Math.pow(Math.abs(x), 1 / 3);
4192         return x < 0 ? -y : y;
4193 });
4194
4195 }
4196
4197
4198 // _ESAbstract.ToUint32
4199 // 7.1.6. ToUint32 ( argument )
4200 function ToUint32(argument) { // eslint-disable-line no-unused-vars
4201         // 1. Let number be ? ToNumber(argument).
4202         var number = Number(argument);
4203         // 2. If number is NaN, +0, -0, +∞, or -∞, return +0.
4204         if (isNaN(number) || 1/number === Infinity || 1/number === -Infinity || number === Infinity || number === -Infinity) {
4205                 return 0;
4206         }
4207         // 3. Let int be the mathematical value that is the same sign as number and whose magnitude is floor(abs(number)).
4208         var int = ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number));
4209         // 4. Let int32bit be int modulo 2^32.
4210         var int32bit = int >>> 0;
4211         // 5. Return int32bit.
4212         return int32bit;
4213 }
4214 if (!('clz32' in Math)) {
4215
4216 // Math.clz32
4217 /* global CreateMethodProperty, ToUint32 */
4218 // 20.2.2.11. Math.clz32 ( x )
4219 CreateMethodProperty(Math, 'clz32', function clz32(x) {
4220         // 1. Let n be ToUint32(x).
4221         var n = ToUint32(x);
4222         // 2. Let p be the number of leading zero bits in the 32-bit binary representation of n.
4223         var p = n ? 32 - n.toString(2).length : 32;
4224         // 3. Return p.
4225         return p;
4226 });
4227
4228 }
4229
4230 if (!('cosh' in Math)) {
4231
4232 // Math.cosh
4233 /* global CreateMethodProperty */
4234 // 20.2.2.1. 3Math.cosh ( x )
4235 CreateMethodProperty(Math, 'cosh', function cosh(x) {
4236         // If x is NaN, the result is NaN.
4237         if (isNaN(x)) {
4238                 return NaN;
4239         }
4240         // If x is +0, the result is 1.
4241         if (x === 0 && 1/x === Infinity) {
4242                 return 1;
4243         }
4244         // If x is -0, the result is 1.
4245         if (x === 0 && 1/x === -Infinity) {
4246                 return 1;
4247         }
4248         // If x is +∞, the result is +∞.
4249         if (x === Infinity) {
4250                 return Infinity;
4251         }
4252         // If x is -∞, the result is +∞.
4253         if (x === -Infinity) {
4254                 return Infinity;
4255         }
4256         x = Math.abs(x);
4257         if (x > 709) {
4258                 var y = Math.exp(0.5 * x);
4259                 return y / 2 * y;
4260         }
4261         var y = Math.exp(x);
4262         return (y + 1 / y) / 2;
4263 });
4264
4265 }
4266
4267 if (!('expm1' in Math)) {
4268
4269 // Math.expm1
4270 /* global CreateMethodProperty */
4271 // 20.2.2.15. Math.expm1 ( x )
4272 CreateMethodProperty(Math, 'expm1', function expm1(x) {
4273         // If x is NaN, the result is NaN.
4274         if (isNaN(x)) {
4275                 return NaN;
4276         }
4277         // If x is +0, the result is +0.
4278         if (x === 0 && 1/x === Infinity) {
4279                 return 0;
4280         }
4281         // If x is -0, the result is -0.
4282         if (x === 0 && 1/x === -Infinity) {
4283                 return -0;
4284         }
4285         // If x is +∞, the result is +∞.
4286         if (x === Infinity) {
4287                 return Infinity;
4288         }
4289         // If x is -∞, the result is -1.
4290         if (x === -Infinity) {
4291                 return -1;
4292         }
4293
4294         if (x > -1e-6 && x < 1e-6) {
4295                 return x + x * x / 2;
4296         } else {
4297                 return Math.exp(x) - 1;
4298         }
4299 });
4300
4301 }
4302
4303
4304 // _TypedArray
4305 /*
4306  Copyright (c) 2010, Linden Research, Inc.
4307  Copyright (c) 2014, Joshua Bell
4308
4309  Permission is hereby granted, free of charge, to any person obtaining a copy
4310  of this software and associated documentation files (the "Software"), to deal
4311  in the Software without restriction, including without limitation the rights
4312  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4313  copies of the Software, and to permit persons to whom the Software is
4314  furnished to do so, subject to the following conditions:
4315
4316  The above copyright notice and this permission notice shall be included in
4317  all copies or substantial portions of the Software.
4318
4319  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4320  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4321  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4322  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4323  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4324  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4325  THE SOFTWARE.
4326  $/LicenseInfo$
4327  */
4328
4329 // Original can be found at:
4330 //   https://bitbucket.org/lindenlab/llsd
4331 // Modifications by Joshua Bell inexorabletash@gmail.com
4332 //   https://github.com/inexorabletash/polyfill
4333
4334 // ES3/ES5 implementation of the Krhonos Typed Array Specification
4335 //   Ref: http://www.khronos.org/registry/typedarray/specs/latest/
4336 //   Date: 2011-02-01
4337 //
4338 // Variations:
4339 //  * Allows typed_array.get/set() as alias for subscripts (typed_array[])
4340 //  * Gradually migrating structure from Khronos spec to ES2015 spec
4341 //
4342 // Caveats:
4343 //  * Beyond 10000 or so entries, polyfilled array accessors (ta[0],
4344 //    etc) become memory-prohibitive, so array creation will fail. Set
4345 //    self.TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS=true to disable
4346 //    creation of accessors. Your code will need to use the
4347 //    non-standard get()/set() instead, and will need to add those to
4348 //    native arrays for interop.
4349 (function(global) {
4350   'use strict';
4351   var undefined = (void 0); // Paranoia
4352
4353   // Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to
4354   // create, and consume so much memory, that the browser appears frozen.
4355   var MAX_ARRAY_LENGTH = 1e5;
4356
4357   // Approximations of internal ECMAScript conversion functions
4358   function Type(v) {
4359     switch(typeof v) {
4360     case 'undefined': return 'undefined';
4361     case 'boolean': return 'boolean';
4362     case 'number': return 'number';
4363     case 'string': return 'string';
4364     default: return v === null ? 'null' : 'object';
4365     }
4366   }
4367
4368   // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues:
4369   function Class(v) { return Object.prototype.toString.call(v).replace(/^\[object *|\]$/g, ''); }
4370   function IsCallable(o) { return typeof o === 'function'; }
4371   function ToObject(v) {
4372     if (v === null || v === undefined) throw TypeError();
4373     return Object(v);
4374   }
4375   function ToInt32(v) { return v >> 0; }
4376   function ToUint32(v) { return v >>> 0; }
4377
4378   // Snapshot intrinsics
4379   var LN2 = Math.LN2,
4380       abs = Math.abs,
4381       floor = Math.floor,
4382       log = Math.log,
4383       max = Math.max,
4384       min = Math.min,
4385       pow = Math.pow,
4386       round = Math.round;
4387
4388   // emulate ES5 getter/setter API using legacy APIs
4389   // http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx
4390   // (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but
4391   // note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless)
4392
4393   (function() {
4394     var orig = Object.defineProperty;
4395     var dom_only = !(function(){try{return Object.defineProperty({},'x',{});}catch(_){return false;}}());
4396
4397     if (!orig || dom_only) {
4398       Object.defineProperty = function (o, prop, desc) {
4399         // In IE8 try built-in implementation for defining properties on DOM prototypes.
4400         if (orig)
4401           try { return orig(o, prop, desc); } catch (_) {}
4402         if (o !== Object(o))
4403           throw TypeError('Object.defineProperty called on non-object');
4404         if (Object.prototype.__defineGetter__ && ('get' in desc))
4405           Object.prototype.__defineGetter__.call(o, prop, desc.get);
4406         if (Object.prototype.__defineSetter__ && ('set' in desc))
4407           Object.prototype.__defineSetter__.call(o, prop, desc.set);
4408         if ('value' in desc)
4409           o[prop] = desc.value;
4410         return o;
4411       };
4412     }
4413   }());
4414
4415   // ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value)
4416   // for index in 0 ... obj.length
4417   function makeArrayAccessors(obj) {
4418     if ('TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS' in global)
4419       return;
4420
4421     if (obj.length > MAX_ARRAY_LENGTH) throw RangeError('Array too large for polyfill');
4422
4423     function makeArrayAccessor(index) {
4424       Object.defineProperty(obj, index, {
4425         'get': function() { return obj._getter(index); },
4426         'set': function(v) { obj._setter(index, v); },
4427         enumerable: true,
4428         configurable: false
4429       });
4430     }
4431
4432     var i;
4433     for (i = 0; i < obj.length; i += 1) {
4434       makeArrayAccessor(i);
4435     }
4436   }
4437
4438   // Internal conversion functions:
4439   //    pack<Type>()   - take a number (interpreted as Type), output a byte array
4440   //    unpack<Type>() - take a byte array, output a Type-like number
4441
4442   function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; }
4443   function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; }
4444
4445   function packI8(n) { return [n & 0xff]; }
4446   function unpackI8(bytes) { return as_signed(bytes[0], 8); }
4447
4448   function packU8(n) { return [n & 0xff]; }
4449   function unpackU8(bytes) { return as_unsigned(bytes[0], 8); }
4450
4451   function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; }
4452
4453   function packI16(n) { return [n & 0xff, (n >> 8) & 0xff]; }
4454   function unpackI16(bytes) { return as_signed(bytes[1] << 8 | bytes[0], 16); }
4455
4456   function packU16(n) { return [n & 0xff, (n >> 8) & 0xff]; }
4457   function unpackU16(bytes) { return as_unsigned(bytes[1] << 8 | bytes[0], 16); }
4458
4459   function packI32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; }
4460   function unpackI32(bytes) { return as_signed(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); }
4461
4462   function packU32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; }
4463   function unpackU32(bytes) { return as_unsigned(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); }
4464
4465   function packIEEE754(v, ebits, fbits) {
4466
4467     var bias = (1 << (ebits - 1)) - 1;
4468
4469     function roundToEven(n) {
4470       var w = floor(n), f = n - w;
4471       if (f < 0.5)
4472         return w;
4473       if (f > 0.5)
4474         return w + 1;
4475       return w % 2 ? w + 1 : w;
4476     }
4477
4478     // Compute sign, exponent, fraction
4479     var s, e, f;
4480     if (v !== v) {
4481       // NaN
4482       // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping
4483       e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0;
4484     } else if (v === Infinity || v === -Infinity) {
4485       e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0;
4486     } else if (v === 0) {
4487       e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;
4488     } else {
4489       s = v < 0;
4490       v = abs(v);
4491
4492       if (v >= pow(2, 1 - bias)) {
4493         // Normalized
4494         e = min(floor(log(v) / LN2), 1023);
4495         var significand = v / pow(2, e);
4496         if (significand < 1) {
4497           e -= 1;
4498           significand *= 2;
4499         }
4500         if (significand >= 2) {
4501           e += 1;
4502           significand /= 2;
4503         }
4504         var d = pow(2, fbits);
4505         f = roundToEven(significand * d) - d;
4506         e += bias;
4507         if (f / d >= 1) {
4508           e += 1;
4509           f = 0;
4510         }
4511         if (e > 2 * bias) {
4512           // Overflow
4513           e = (1 << ebits) - 1;
4514           f = 0;
4515         }
4516       } else {
4517         // Denormalized
4518         e = 0;
4519         f = roundToEven(v / pow(2, 1 - bias - fbits));
4520       }
4521     }
4522
4523     // Pack sign, exponent, fraction
4524     var bits = [], i;
4525     for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); }
4526     for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); }
4527     bits.push(s ? 1 : 0);
4528     bits.reverse();
4529     var str = bits.join('');
4530
4531     // Bits to bytes
4532     var bytes = [];
4533     while (str.length) {
4534       bytes.unshift(parseInt(str.substring(0, 8), 2));
4535       str = str.substring(8);
4536     }
4537     return bytes;
4538   }
4539
4540   function unpackIEEE754(bytes, ebits, fbits) {
4541     // Bytes to bits
4542     var bits = [], i, j, b, str,
4543         bias, s, e, f;
4544
4545     for (i = 0; i < bytes.length; ++i) {
4546       b = bytes[i];
4547       for (j = 8; j; j -= 1) {
4548         bits.push(b % 2 ? 1 : 0); b = b >> 1;
4549       }
4550     }
4551     bits.reverse();
4552     str = bits.join('');
4553
4554     // Unpack sign, exponent, fraction
4555     bias = (1 << (ebits - 1)) - 1;
4556     s = parseInt(str.substring(0, 1), 2) ? -1 : 1;
4557     e = parseInt(str.substring(1, 1 + ebits), 2);
4558     f = parseInt(str.substring(1 + ebits), 2);
4559
4560     // Produce number
4561     if (e === (1 << ebits) - 1) {
4562       return f !== 0 ? NaN : s * Infinity;
4563     } else if (e > 0) {
4564       // Normalized
4565       return s * pow(2, e - bias) * (1 + f / pow(2, fbits));
4566     } else if (f !== 0) {
4567       // Denormalized
4568       return s * pow(2, -(bias - 1)) * (f / pow(2, fbits));
4569     } else {
4570       return s < 0 ? -0 : 0;
4571     }
4572   }
4573
4574   function unpackF64(b) { return unpackIEEE754(b, 11, 52); }
4575   function packF64(v) { return packIEEE754(v, 11, 52); }
4576   function unpackF32(b) { return unpackIEEE754(b, 8, 23); }
4577   function packF32(v) { return packIEEE754(v, 8, 23); }
4578
4579   //
4580   // 3 The ArrayBuffer Type
4581   //
4582
4583   (function() {
4584
4585     function ArrayBuffer(length) {
4586       length = ToInt32(length);
4587       if (length < 0) throw RangeError('ArrayBuffer size is not a small enough positive integer.');
4588       Object.defineProperty(this, 'byteLength', {value: length});
4589       Object.defineProperty(this, '_bytes', {value: Array(length)});
4590
4591       for (var i = 0; i < length; i += 1)
4592         this._bytes[i] = 0;
4593     }
4594
4595     global.ArrayBuffer = global.ArrayBuffer || ArrayBuffer;
4596
4597     //
4598     // 5 The Typed Array View Types
4599     //
4600
4601     function $TypedArray$() {
4602
4603       // %TypedArray% ( length )
4604       if (!arguments.length || typeof arguments[0] !== 'object') {
4605         return (function(length) {
4606           length = ToInt32(length);
4607           if (length < 0) throw RangeError('length is not a small enough positive integer.');
4608           Object.defineProperty(this, 'length', {value: length});
4609           Object.defineProperty(this, 'byteLength', {value: length * this.BYTES_PER_ELEMENT});
4610           Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(this.byteLength)});
4611           Object.defineProperty(this, 'byteOffset', {value: 0});
4612
4613          }).apply(this, arguments);
4614       }
4615
4616       // %TypedArray% ( typedArray )
4617       if (arguments.length >= 1 &&
4618           Type(arguments[0]) === 'object' &&
4619           arguments[0] instanceof $TypedArray$) {
4620         return (function(typedArray){
4621           if (this.constructor !== typedArray.constructor) throw TypeError();
4622
4623           var byteLength = typedArray.length * this.BYTES_PER_ELEMENT;
4624           Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)});
4625           Object.defineProperty(this, 'byteLength', {value: byteLength});
4626           Object.defineProperty(this, 'byteOffset', {value: 0});
4627           Object.defineProperty(this, 'length', {value: typedArray.length});
4628
4629           for (var i = 0; i < this.length; i += 1)
4630             this._setter(i, typedArray._getter(i));
4631
4632         }).apply(this, arguments);
4633       }
4634
4635       // %TypedArray% ( array )
4636       if (arguments.length >= 1 &&
4637           Type(arguments[0]) === 'object' &&
4638           !(arguments[0] instanceof $TypedArray$) &&
4639           !(arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) {
4640         return (function(array) {
4641
4642           var byteLength = array.length * this.BYTES_PER_ELEMENT;
4643           Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)});
4644           Object.defineProperty(this, 'byteLength', {value: byteLength});
4645           Object.defineProperty(this, 'byteOffset', {value: 0});
4646           Object.defineProperty(this, 'length', {value: array.length});
4647
4648           for (var i = 0; i < this.length; i += 1) {
4649             var s = array[i];
4650             this._setter(i, Number(s));
4651           }
4652         }).apply(this, arguments);
4653       }
4654
4655       // %TypedArray% ( buffer, byteOffset=0, length=undefined )
4656       if (arguments.length >= 1 &&
4657           Type(arguments[0]) === 'object' &&
4658           (arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) {
4659         return (function(buffer, byteOffset, length) {
4660
4661           byteOffset = ToUint32(byteOffset);
4662           if (byteOffset > buffer.byteLength)
4663             throw RangeError('byteOffset out of range');
4664
4665           // The given byteOffset must be a multiple of the element
4666           // size of the specific type, otherwise an exception is raised.
4667           if (byteOffset % this.BYTES_PER_ELEMENT)
4668             throw RangeError('buffer length minus the byteOffset is not a multiple of the element size.');
4669
4670           if (length === undefined) {
4671             var byteLength = buffer.byteLength - byteOffset;
4672             if (byteLength % this.BYTES_PER_ELEMENT)
4673               throw RangeError('length of buffer minus byteOffset not a multiple of the element size');
4674             length = byteLength / this.BYTES_PER_ELEMENT;
4675
4676           } else {
4677             length = ToUint32(length);
4678             byteLength = length * this.BYTES_PER_ELEMENT;
4679           }
4680
4681           if ((byteOffset + byteLength) > buffer.byteLength)
4682             throw RangeError('byteOffset and length reference an area beyond the end of the buffer');
4683
4684           Object.defineProperty(this, 'buffer', {value: buffer});
4685           Object.defineProperty(this, 'byteLength', {value: byteLength});
4686           Object.defineProperty(this, 'byteOffset', {value: byteOffset});
4687           Object.defineProperty(this, 'length', {value: length});
4688
4689         }).apply(this, arguments);
4690       }
4691
4692       // %TypedArray% ( all other argument combinations )
4693       throw TypeError();
4694     }
4695
4696     // Properties of the %TypedArray Instrinsic Object
4697
4698     // %TypedArray%.from ( source , mapfn=undefined, thisArg=undefined )
4699     Object.defineProperty($TypedArray$, 'from', {value: function(iterable) {
4700       return new this(iterable);
4701     }});
4702
4703     // %TypedArray%.of ( ...items )
4704     Object.defineProperty($TypedArray$, 'of', {value: function(/*...items*/) {
4705       return new this(arguments);
4706     }});
4707
4708     // %TypedArray%.prototype
4709     var $TypedArrayPrototype$ = {};
4710     $TypedArray$.prototype = $TypedArrayPrototype$;
4711
4712     // WebIDL: getter type (unsigned long index);
4713     Object.defineProperty($TypedArray$.prototype, '_getter', {value: function(index) {
4714       if (arguments.length < 1) throw SyntaxError('Not enough arguments');
4715
4716       index = ToUint32(index);
4717       if (index >= this.length)
4718         return undefined;
4719
4720       var bytes = [], i, o;
4721       for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;
4722            i < this.BYTES_PER_ELEMENT;
4723            i += 1, o += 1) {
4724         bytes.push(this.buffer._bytes[o]);
4725       }
4726       return this._unpack(bytes);
4727     }});
4728
4729     // NONSTANDARD: convenience alias for getter: type get(unsigned long index);
4730     Object.defineProperty($TypedArray$.prototype, 'get', {value: $TypedArray$.prototype._getter});
4731
4732     // WebIDL: setter void (unsigned long index, type value);
4733     Object.defineProperty($TypedArray$.prototype, '_setter', {value: function(index, value) {
4734       if (arguments.length < 2) throw SyntaxError('Not enough arguments');
4735
4736       index = ToUint32(index);
4737       if (index >= this.length)
4738         return;
4739
4740       var bytes = this._pack(value), i, o;
4741       for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;
4742            i < this.BYTES_PER_ELEMENT;
4743            i += 1, o += 1) {
4744         this.buffer._bytes[o] = bytes[i];
4745       }
4746     }});
4747
4748     // get %TypedArray%.prototype.buffer
4749     // get %TypedArray%.prototype.byteLength
4750     // get %TypedArray%.prototype.byteOffset
4751     // -- applied directly to the object in the constructor
4752
4753     // %TypedArray%.prototype.constructor
4754     Object.defineProperty($TypedArray$.prototype, 'constructor', {value: $TypedArray$});
4755
4756     // %TypedArray%.prototype.copyWithin (target, start, end = this.length )
4757     Object.defineProperty($TypedArray$.prototype, 'copyWithin', {value: function(target, start) {
4758       var end = arguments[2];
4759
4760       var o = ToObject(this);
4761       var lenVal = o.length;
4762       var len = ToUint32(lenVal);
4763       len = max(len, 0);
4764       var relativeTarget = ToInt32(target);
4765       var to;
4766       if (relativeTarget < 0)
4767         to = max(len + relativeTarget, 0);
4768       else
4769         to = min(relativeTarget, len);
4770       var relativeStart = ToInt32(start);
4771       var from;
4772       if (relativeStart < 0)
4773         from = max(len + relativeStart, 0);
4774       else
4775         from = min(relativeStart, len);
4776       var relativeEnd;
4777       if (end === undefined)
4778         relativeEnd = len;
4779       else
4780         relativeEnd = ToInt32(end);
4781       var final;
4782       if (relativeEnd < 0)
4783         final = max(len + relativeEnd, 0);
4784       else
4785         final = min(relativeEnd, len);
4786       var count = min(final - from, len - to);
4787       var direction;
4788       if (from < to && to < from + count) {
4789         direction = -1;
4790         from = from + count - 1;
4791         to = to + count - 1;
4792       } else {
4793         direction = 1;
4794       }
4795       while (count > 0) {
4796         o._setter(to, o._getter(from));
4797         from = from + direction;
4798         to = to + direction;
4799         count = count - 1;
4800       }
4801       return o;
4802     }});
4803
4804     // %TypedArray%.prototype.entries ( )
4805     // -- defined in es6.js to shim browsers w/ native TypedArrays
4806
4807     // %TypedArray%.prototype.every ( callbackfn, thisArg = undefined )
4808     Object.defineProperty($TypedArray$.prototype, 'every', {value: function(callbackfn) {
4809       if (this === undefined || this === null) throw TypeError();
4810       var t = Object(this);
4811       var len = ToUint32(t.length);
4812       if (!IsCallable(callbackfn)) throw TypeError();
4813       var thisArg = arguments[1];
4814       for (var i = 0; i < len; i++) {
4815         if (!callbackfn.call(thisArg, t._getter(i), i, t))
4816           return false;
4817       }
4818       return true;
4819     }});
4820
4821     // %TypedArray%.prototype.fill (value, start = 0, end = this.length )
4822     Object.defineProperty($TypedArray$.prototype, 'fill', {value: function(value) {
4823       var start = arguments[1],
4824           end = arguments[2];
4825
4826       var o = ToObject(this);
4827       var lenVal = o.length;
4828       var len = ToUint32(lenVal);
4829       len = max(len, 0);
4830       var relativeStart = ToInt32(start);
4831       var k;
4832       if (relativeStart < 0)
4833         k = max((len + relativeStart), 0);
4834       else
4835         k = min(relativeStart, len);
4836       var relativeEnd;
4837       if (end === undefined)
4838         relativeEnd = len;
4839       else
4840         relativeEnd = ToInt32(end);
4841       var final;
4842       if (relativeEnd < 0)
4843         final = max((len + relativeEnd), 0);
4844       else
4845         final = min(relativeEnd, len);
4846       while (k < final) {
4847         o._setter(k, value);
4848         k += 1;
4849       }
4850       return o;
4851     }});
4852
4853     // %TypedArray%.prototype.filter ( callbackfn, thisArg = undefined )
4854     Object.defineProperty($TypedArray$.prototype, 'filter', {value: function(callbackfn) {
4855       if (this === undefined || this === null) throw TypeError();
4856       var t = Object(this);
4857       var len = ToUint32(t.length);
4858       if (!IsCallable(callbackfn)) throw TypeError();
4859       var res = [];
4860       var thisp = arguments[1];
4861       for (var i = 0; i < len; i++) {
4862         var val = t._getter(i); // in case fun mutates this
4863         if (callbackfn.call(thisp, val, i, t))
4864           res.push(val);
4865       }
4866       return new this.constructor(res);
4867     }});
4868
4869     // %TypedArray%.prototype.find (predicate, thisArg = undefined)
4870     Object.defineProperty($TypedArray$.prototype, 'find', {value: function(predicate) {
4871       var o = ToObject(this);
4872       var lenValue = o.length;
4873       var len = ToUint32(lenValue);
4874       if (!IsCallable(predicate)) throw TypeError();
4875       var t = arguments.length > 1 ? arguments[1] : undefined;
4876       var k = 0;
4877       while (k < len) {
4878         var kValue = o._getter(k);
4879         var testResult = predicate.call(t, kValue, k, o);
4880         if (Boolean(testResult))
4881           return kValue;
4882         ++k;
4883       }
4884       return undefined;
4885     }});
4886
4887     // %TypedArray%.prototype.findIndex ( predicate, thisArg = undefined )
4888     Object.defineProperty($TypedArray$.prototype, 'findIndex', {value: function(predicate) {
4889       var o = ToObject(this);
4890       var lenValue = o.length;
4891       var len = ToUint32(lenValue);
4892       if (!IsCallable(predicate)) throw TypeError();
4893       var t = arguments.length > 1 ? arguments[1] : undefined;
4894       var k = 0;
4895       while (k < len) {
4896         var kValue = o._getter(k);
4897         var testResult = predicate.call(t, kValue, k, o);
4898         if (Boolean(testResult))
4899           return k;
4900         ++k;
4901       }
4902       return -1;
4903     }});
4904
4905     // %TypedArray%.prototype.forEach ( callbackfn, thisArg = undefined )
4906     Object.defineProperty($TypedArray$.prototype, 'forEach', {value: function(callbackfn) {
4907       if (this === undefined || this === null) throw TypeError();
4908       var t = Object(this);
4909       var len = ToUint32(t.length);
4910       if (!IsCallable(callbackfn)) throw TypeError();
4911       var thisp = arguments[1];
4912       for (var i = 0; i < len; i++)
4913         callbackfn.call(thisp, t._getter(i), i, t);
4914     }});
4915
4916     // %TypedArray%.prototype.indexOf (searchElement, fromIndex = 0 )
4917     Object.defineProperty($TypedArray$.prototype, 'indexOf', {value: function(searchElement) {
4918       if (this === undefined || this === null) throw TypeError();
4919       var t = Object(this);
4920       var len = ToUint32(t.length);
4921       if (len === 0) return -1;
4922       var n = 0;
4923       if (arguments.length > 0) {
4924         n = Number(arguments[1]);
4925         if (n !== n) {
4926           n = 0;
4927         } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
4928           n = (n > 0 || -1) * floor(abs(n));
4929         }
4930       }
4931       if (n >= len) return -1;
4932       var k = n >= 0 ? n : max(len - abs(n), 0);
4933       for (; k < len; k++) {
4934         if (t._getter(k) === searchElement) {
4935           return k;
4936         }
4937       }
4938       return -1;
4939     }});
4940
4941     // %TypedArray%.prototype.join ( separator )
4942     Object.defineProperty($TypedArray$.prototype, 'join', {value: function(separator) {
4943       if (this === undefined || this === null) throw TypeError();
4944       var t = Object(this);
4945       var len = ToUint32(t.length);
4946       var tmp = Array(len);
4947       for (var i = 0; i < len; ++i)
4948         tmp[i] = t._getter(i);
4949       return tmp.join(separator === undefined ? ',' : separator); // Hack for IE7
4950     }});
4951
4952     // %TypedArray%.prototype.keys ( )
4953     // -- defined in es6.js to shim browsers w/ native TypedArrays
4954
4955     // %TypedArray%.prototype.lastIndexOf ( searchElement, fromIndex = this.length-1 )
4956     Object.defineProperty($TypedArray$.prototype, 'lastIndexOf', {value: function(searchElement) {
4957       if (this === undefined || this === null) throw TypeError();
4958       var t = Object(this);
4959       var len = ToUint32(t.length);
4960       if (len === 0) return -1;
4961       var n = len;
4962       if (arguments.length > 1) {
4963         n = Number(arguments[1]);
4964         if (n !== n) {
4965           n = 0;
4966         } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
4967           n = (n > 0 || -1) * floor(abs(n));
4968         }
4969       }
4970       var k = n >= 0 ? min(n, len - 1) : len - abs(n);
4971       for (; k >= 0; k--) {
4972         if (t._getter(k) === searchElement)
4973           return k;
4974       }
4975       return -1;
4976     }});
4977
4978     // get %TypedArray%.prototype.length
4979     // -- applied directly to the object in the constructor
4980
4981     // %TypedArray%.prototype.map ( callbackfn, thisArg = undefined )
4982     Object.defineProperty($TypedArray$.prototype, 'map', {value: function(callbackfn) {
4983       if (this === undefined || this === null) throw TypeError();
4984       var t = Object(this);
4985       var len = ToUint32(t.length);
4986       if (!IsCallable(callbackfn)) throw TypeError();
4987       var res = []; res.length = len;
4988       var thisp = arguments[1];
4989       for (var i = 0; i < len; i++)
4990         res[i] = callbackfn.call(thisp, t._getter(i), i, t);
4991       return new this.constructor(res);
4992     }});
4993
4994     // %TypedArray%.prototype.reduce ( callbackfn [, initialValue] )
4995     Object.defineProperty($TypedArray$.prototype, 'reduce', {value: function(callbackfn) {
4996       if (this === undefined || this === null) throw TypeError();
4997       var t = Object(this);
4998       var len = ToUint32(t.length);
4999       if (!IsCallable(callbackfn)) throw TypeError();
5000       // no value to return if no initial value and an empty array
5001       if (len === 0 && arguments.length === 1) throw TypeError();
5002       var k = 0;
5003       var accumulator;
5004       if (arguments.length >= 2) {
5005         accumulator = arguments[1];
5006       } else {
5007         accumulator = t._getter(k++);
5008       }
5009       while (k < len) {
5010         accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t);
5011         k++;
5012       }
5013       return accumulator;
5014     }});
5015
5016     // %TypedArray%.prototype.reduceRight ( callbackfn [, initialValue] )
5017     Object.defineProperty($TypedArray$.prototype, 'reduceRight', {value: function(callbackfn) {
5018       if (this === undefined || this === null) throw TypeError();
5019       var t = Object(this);
5020       var len = ToUint32(t.length);
5021       if (!IsCallable(callbackfn)) throw TypeError();
5022       // no value to return if no initial value, empty array
5023       if (len === 0 && arguments.length === 1) throw TypeError();
5024       var k = len - 1;
5025       var accumulator;
5026       if (arguments.length >= 2) {
5027         accumulator = arguments[1];
5028       } else {
5029         accumulator = t._getter(k--);
5030       }
5031       while (k >= 0) {
5032         accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t);
5033         k--;
5034       }
5035       return accumulator;
5036     }});
5037
5038     // %TypedArray%.prototype.reverse ( )
5039     Object.defineProperty($TypedArray$.prototype, 'reverse', {value: function() {
5040       if (this === undefined || this === null) throw TypeError();
5041       var t = Object(this);
5042       var len = ToUint32(t.length);
5043       var half = floor(len / 2);
5044       for (var i = 0, j = len - 1; i < half; ++i, --j) {
5045         var tmp = t._getter(i);
5046         t._setter(i, t._getter(j));
5047         t._setter(j, tmp);
5048       }
5049       return t;
5050     }});
5051
5052     // %TypedArray%.prototype.set(array, offset = 0 )
5053     // %TypedArray%.prototype.set(typedArray, offset = 0 )
5054     // WebIDL: void set(TypedArray array, optional unsigned long offset);
5055     // WebIDL: void set(sequence<type> array, optional unsigned long offset);
5056     Object.defineProperty($TypedArray$.prototype, 'set', {value: function(index, value) {
5057       if (arguments.length < 1) throw SyntaxError('Not enough arguments');
5058       var array, sequence, offset, len,
5059           i, s, d,
5060           byteOffset, byteLength, tmp;
5061
5062       if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) {
5063         // void set(TypedArray array, optional unsigned long offset);
5064         array = arguments[0];
5065         offset = ToUint32(arguments[1]);
5066
5067         if (offset + array.length > this.length) {
5068           throw RangeError('Offset plus length of array is out of range');
5069         }
5070
5071         byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT;
5072         byteLength = array.length * this.BYTES_PER_ELEMENT;
5073
5074         if (array.buffer === this.buffer) {
5075           tmp = [];
5076           for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) {
5077             tmp[i] = array.buffer._bytes[s];
5078           }
5079           for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) {
5080             this.buffer._bytes[d] = tmp[i];
5081           }
5082         } else {
5083           for (i = 0, s = array.byteOffset, d = byteOffset;
5084                i < byteLength; i += 1, s += 1, d += 1) {
5085             this.buffer._bytes[d] = array.buffer._bytes[s];
5086           }
5087         }
5088       } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') {
5089         // void set(sequence<type> array, optional unsigned long offset);
5090         sequence = arguments[0];
5091         len = ToUint32(sequence.length);
5092         offset = ToUint32(arguments[1]);
5093
5094         if (offset + len > this.length) {
5095           throw RangeError('Offset plus length of array is out of range');
5096         }
5097
5098         for (i = 0; i < len; i += 1) {
5099           s = sequence[i];
5100           this._setter(offset + i, Number(s));
5101         }
5102       } else {
5103         throw TypeError('Unexpected argument type(s)');
5104       }
5105     }});
5106
5107     // %TypedArray%.prototype.slice ( start, end )
5108     Object.defineProperty($TypedArray$.prototype, 'slice', {value: function(start, end) {
5109       var o = ToObject(this);
5110       var lenVal = o.length;
5111       var len = ToUint32(lenVal);
5112       var relativeStart = ToInt32(start);
5113       var k = (relativeStart < 0) ? max(len + relativeStart, 0) : min(relativeStart, len);
5114       var relativeEnd = (end === undefined) ? len : ToInt32(end);
5115       var final = (relativeEnd < 0) ? max(len + relativeEnd, 0) : min(relativeEnd, len);
5116       var count = final - k;
5117       var c = o.constructor;
5118       var a = new c(count);
5119       var n = 0;
5120       while (k < final) {
5121         var kValue = o._getter(k);
5122         a._setter(n, kValue);
5123         ++k;
5124         ++n;
5125       }
5126       return a;
5127     }});
5128
5129     // %TypedArray%.prototype.some ( callbackfn, thisArg = undefined )
5130     Object.defineProperty($TypedArray$.prototype, 'some', {value: function(callbackfn) {
5131       if (this === undefined || this === null) throw TypeError();
5132       var t = Object(this);
5133       var len = ToUint32(t.length);
5134       if (!IsCallable(callbackfn)) throw TypeError();
5135       var thisp = arguments[1];
5136       for (var i = 0; i < len; i++) {
5137         if (callbackfn.call(thisp, t._getter(i), i, t)) {
5138           return true;
5139         }
5140       }
5141       return false;
5142     }});
5143
5144     // %TypedArray%.prototype.sort ( comparefn )
5145     Object.defineProperty($TypedArray$.prototype, 'sort', {value: function(comparefn) {
5146       if (this === undefined || this === null) throw TypeError();
5147       var t = Object(this);
5148       var len = ToUint32(t.length);
5149       var tmp = Array(len);
5150       for (var i = 0; i < len; ++i)
5151         tmp[i] = t._getter(i);
5152       function sortCompare(x, y) {
5153         if (x !== x && y !== y) return +0;
5154         if (x !== x) return 1;
5155         if (y !== y) return -1;
5156         if (comparefn !== undefined) {
5157           return comparefn(x, y);
5158         }
5159         if (x < y) return -1;
5160         if (x > y) return 1;
5161         return +0;
5162       }
5163       tmp.sort(sortCompare);
5164       for (i = 0; i < len; ++i)
5165         t._setter(i, tmp[i]);
5166       return t;
5167     }});
5168
5169     // %TypedArray%.prototype.subarray(begin = 0, end = this.length )
5170     // WebIDL: TypedArray subarray(long begin, optional long end);
5171     Object.defineProperty($TypedArray$.prototype, 'subarray', {value: function(start, end) {
5172       function clamp(v, min, max) { return v < min ? min : v > max ? max : v; }
5173
5174       start = ToInt32(start);
5175       end = ToInt32(end);
5176
5177       if (arguments.length < 1) { start = 0; }
5178       if (arguments.length < 2) { end = this.length; }
5179
5180       if (start < 0) { start = this.length + start; }
5181       if (end < 0) { end = this.length + end; }
5182
5183       start = clamp(start, 0, this.length);
5184       end = clamp(end, 0, this.length);
5185
5186       var len = end - start;
5187       if (len < 0) {
5188         len = 0;
5189       }
5190
5191       return new this.constructor(
5192         this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len);
5193     }});
5194
5195     // %TypedArray%.prototype.toLocaleString ( )
5196     // %TypedArray%.prototype.toString ( )
5197     // %TypedArray%.prototype.values ( )
5198     // %TypedArray%.prototype [ @@iterator ] ( )
5199     // get %TypedArray%.prototype [ @@toStringTag ]
5200     // -- defined in es6.js to shim browsers w/ native TypedArrays
5201
5202     function makeTypedArray(elementSize, pack, unpack) {
5203       // Each TypedArray type requires a distinct constructor instance with
5204       // identical logic, which this produces.
5205       var TypedArray = function() {
5206         Object.defineProperty(this, 'constructor', {value: TypedArray});
5207         $TypedArray$.apply(this, arguments);
5208         makeArrayAccessors(this);
5209       };
5210       if ('__proto__' in TypedArray) {
5211         TypedArray.__proto__ = $TypedArray$;
5212       } else {
5213         TypedArray.from = $TypedArray$.from;
5214         TypedArray.of = $TypedArray$.of;
5215       }
5216
5217       TypedArray.BYTES_PER_ELEMENT = elementSize;
5218
5219       var TypedArrayPrototype = function() {};
5220       TypedArrayPrototype.prototype = $TypedArrayPrototype$;
5221
5222       TypedArray.prototype = new TypedArrayPrototype();
5223
5224       Object.defineProperty(TypedArray.prototype, 'BYTES_PER_ELEMENT', {value: elementSize});
5225       Object.defineProperty(TypedArray.prototype, '_pack', {value: pack});
5226       Object.defineProperty(TypedArray.prototype, '_unpack', {value: unpack});
5227
5228       return TypedArray;
5229     }
5230
5231     var Int8Array = makeTypedArray(1, packI8, unpackI8);
5232     var Uint8Array = makeTypedArray(1, packU8, unpackU8);
5233     var Uint8ClampedArray = makeTypedArray(1, packU8Clamped, unpackU8);
5234     var Int16Array = makeTypedArray(2, packI16, unpackI16);
5235     var Uint16Array = makeTypedArray(2, packU16, unpackU16);
5236     var Int32Array = makeTypedArray(4, packI32, unpackI32);
5237     var Uint32Array = makeTypedArray(4, packU32, unpackU32);
5238     var Float32Array = makeTypedArray(4, packF32, unpackF32);
5239     var Float64Array = makeTypedArray(8, packF64, unpackF64);
5240
5241     global.Int8Array = global.Int8Array || Int8Array;
5242     global.Uint8Array = global.Uint8Array || Uint8Array;
5243     global.Uint8ClampedArray = global.Uint8ClampedArray || Uint8ClampedArray;
5244     global.Int16Array = global.Int16Array || Int16Array;
5245     global.Uint16Array = global.Uint16Array || Uint16Array;
5246     global.Int32Array = global.Int32Array || Int32Array;
5247     global.Uint32Array = global.Uint32Array || Uint32Array;
5248     global.Float32Array = global.Float32Array || Float32Array;
5249     global.Float64Array = global.Float64Array || Float64Array;
5250   }());
5251
5252   //
5253   // 6 The DataView View Type
5254   //
5255
5256   (function() {
5257     function r(array, index) {
5258       return IsCallable(array.get) ? array.get(index) : array[index];
5259     }
5260
5261     var IS_BIG_ENDIAN = (function() {
5262       var u16array = new Uint16Array([0x1234]),
5263           u8array = new Uint8Array(u16array.buffer);
5264       return r(u8array, 0) === 0x12;
5265     }());
5266
5267     // DataView(buffer, byteOffset=0, byteLength=undefined)
5268     // WebIDL: Constructor(ArrayBuffer buffer,
5269     //                     optional unsigned long byteOffset,
5270     //                     optional unsigned long byteLength)
5271     function DataView(buffer, byteOffset, byteLength) {
5272       if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError();
5273
5274       byteOffset = ToUint32(byteOffset);
5275       if (byteOffset > buffer.byteLength)
5276         throw RangeError('byteOffset out of range');
5277
5278       if (byteLength === undefined)
5279         byteLength = buffer.byteLength - byteOffset;
5280       else
5281         byteLength = ToUint32(byteLength);
5282
5283       if ((byteOffset + byteLength) > buffer.byteLength)
5284         throw RangeError('byteOffset and length reference an area beyond the end of the buffer');
5285
5286       Object.defineProperty(this, 'buffer', {value: buffer});
5287       Object.defineProperty(this, 'byteLength', {value: byteLength});
5288       Object.defineProperty(this, 'byteOffset', {value: byteOffset});
5289     };
5290
5291     // get DataView.prototype.buffer
5292     // get DataView.prototype.byteLength
5293     // get DataView.prototype.byteOffset
5294     // -- applied directly to instances by the constructor
5295
5296     function makeGetter(arrayType) {
5297       return function GetViewValue(byteOffset, littleEndian) {
5298         byteOffset = ToUint32(byteOffset);
5299
5300         if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength)
5301           throw RangeError('Array index out of range');
5302
5303         byteOffset += this.byteOffset;
5304
5305         var uint8Array = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT),
5306             bytes = [];
5307         for (var i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1)
5308           bytes.push(r(uint8Array, i));
5309
5310         if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN))
5311           bytes.reverse();
5312
5313         return r(new arrayType(new Uint8Array(bytes).buffer), 0);
5314       };
5315     }
5316
5317     Object.defineProperty(DataView.prototype, 'getUint8', {value: makeGetter(Uint8Array)});
5318     Object.defineProperty(DataView.prototype, 'getInt8', {value: makeGetter(Int8Array)});
5319     Object.defineProperty(DataView.prototype, 'getUint16', {value: makeGetter(Uint16Array)});
5320     Object.defineProperty(DataView.prototype, 'getInt16', {value: makeGetter(Int16Array)});
5321     Object.defineProperty(DataView.prototype, 'getUint32', {value: makeGetter(Uint32Array)});
5322     Object.defineProperty(DataView.prototype, 'getInt32', {value: makeGetter(Int32Array)});
5323     Object.defineProperty(DataView.prototype, 'getFloat32', {value: makeGetter(Float32Array)});
5324     Object.defineProperty(DataView.prototype, 'getFloat64', {value: makeGetter(Float64Array)});
5325
5326     function makeSetter(arrayType) {
5327       return function SetViewValue(byteOffset, value, littleEndian) {
5328         byteOffset = ToUint32(byteOffset);
5329         if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength)
5330           throw RangeError('Array index out of range');
5331
5332         // Get bytes
5333         var typeArray = new arrayType([value]),
5334             byteArray = new Uint8Array(typeArray.buffer),
5335             bytes = [], i, byteView;
5336
5337         for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1)
5338           bytes.push(r(byteArray, i));
5339
5340         // Flip if necessary
5341         if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN))
5342           bytes.reverse();
5343
5344         // Write them
5345         byteView = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT);
5346         byteView.set(bytes);
5347       };
5348     }
5349
5350     Object.defineProperty(DataView.prototype, 'setUint8', {value: makeSetter(Uint8Array)});
5351     Object.defineProperty(DataView.prototype, 'setInt8', {value: makeSetter(Int8Array)});
5352     Object.defineProperty(DataView.prototype, 'setUint16', {value: makeSetter(Uint16Array)});
5353     Object.defineProperty(DataView.prototype, 'setInt16', {value: makeSetter(Int16Array)});
5354     Object.defineProperty(DataView.prototype, 'setUint32', {value: makeSetter(Uint32Array)});
5355     Object.defineProperty(DataView.prototype, 'setInt32', {value: makeSetter(Int32Array)});
5356     Object.defineProperty(DataView.prototype, 'setFloat32', {value: makeSetter(Float32Array)});
5357     Object.defineProperty(DataView.prototype, 'setFloat64', {value: makeSetter(Float64Array)});
5358
5359     global.DataView = global.DataView || DataView;
5360
5361   }());
5362
5363 }(self));
5364 if (!('fround' in Math)) {
5365
5366 // Math.fround
5367 /* global Float32Array */
5368 // 20.2.2.17 Math.fround ( x )
5369 CreateMethodProperty(Math, 'fround', function (x) {
5370         // 1. If x is NaN, return NaN.
5371         if (isNaN(x)) {
5372                 return NaN;
5373         }
5374         // 2. If x is one of +0, -0, +∞, -∞, return x.
5375         if (1 / x === +Infinity || 1 / x === -Infinity || x === +Infinity || x === -Infinity) {
5376                 return x;
5377         }
5378         // 3. Let x32 be the result of converting x to a value in IEEE 754-2008 binary32 format using roundTiesToEven.
5379         // 4. Let x64 be the result of converting x32 to a value in IEEE 754-2008 binary64 format.
5380         // 5. Return the ECMAScript Number value corresponding to x64.
5381         return (new Float32Array([x]))[0];
5382 });
5383
5384 }
5385
5386 if (!('hypot' in Math)) {
5387
5388 // Math.hypot
5389 /* global CreateMethodProperty */
5390 // 20.2.2.18. Math.hypot ( value1, value2, ...values )
5391 CreateMethodProperty(Math, 'hypot', function hypot(value1, value2) { // eslint-disable-line no-unused-vars
5392         // If no arguments are passed, the result is +0.
5393         if (arguments.length === 0) {
5394                 return 0;
5395         }
5396         var y = 0;
5397         var max = 0;
5398         for (var i = 0; i < arguments.length; ++i) {
5399                 // If any argument is +∞, the result is +∞.
5400                 if (arguments[i] === Infinity) {
5401                         return Infinity;
5402                 }
5403
5404                 // If any argument is -∞, the result is +∞.
5405                 if (arguments[i] === -Infinity) {
5406                         return Infinity;
5407                 }
5408
5409                 // If no argument is +∞ or -∞, and any argument is NaN, the result is NaN.
5410                 // If all arguments are either +0 or -0, the result is +0.
5411                 // Polyfill.io - The two conditions above are handled in the math.
5412
5413                 var arg = Math.abs(Number(arguments[i]));
5414                 if (arg > max) {
5415                         y = y * Math.pow(max / arg, 2);
5416                         max = arg;
5417                 }
5418                 if (arg !== 0 || max !== 0) {
5419                         y = y + Math.pow(arg / max, 2);
5420                 }
5421         }
5422
5423   return max * Math.sqrt(y);
5424 });
5425
5426 }
5427
5428 if (!('imul' in Math)) {
5429
5430 // Math.imul
5431 /* global CreateMethodProperty, ToUint32 */
5432 // 20.2.2.19. Math.imul ( x, y )
5433 CreateMethodProperty(Math, 'imul', function imul(x, y) {
5434         // 1. Let a be ToUint32(x).
5435         var a = ToUint32(x);
5436         // 2. Let b be ToUint32(y).
5437         var b = ToUint32(y);
5438         // 3. Let product be (a × b) modulo 2^32.
5439         var product = (a * b) % Math.pow(2, 32);
5440         // 4. If product ≥ 2^31, return product - 2^32; otherwise return product.
5441         return (product >= Math.pow(2, 31)) ? product - Math.pow(2, 32) : product;
5442 });
5443
5444 }
5445
5446 if (!('log10' in Math)) {
5447
5448 // Math.log10
5449 /* global CreateMethodProperty */
5450 // 20.2.2.22. Math.log10 ( x )
5451 CreateMethodProperty(Math, 'log10', function log10(x) {
5452         return Math.log(x) / Math.LN10;
5453 });
5454
5455 }
5456
5457 if (!('log1p' in Math)) {
5458
5459 // Math.log1p
5460 /* global CreateMethodProperty */
5461 // 20.2.2.21. Math.log1p ( x )
5462 CreateMethodProperty(Math, 'log1p', function log1p(x) {
5463         return Math.log(1 + x);
5464 });
5465
5466 }
5467
5468 if (!('log2' in Math)) {
5469
5470 // Math.log2
5471 /* global CreateMethodProperty */
5472 // 20.2.2.23. Math.log2 ( x )
5473 CreateMethodProperty(Math, 'log2', function log2(x) {
5474         return Math.log(x) / Math.LN2;
5475 });
5476
5477 }
5478
5479 if (!('sign' in Math)) {
5480
5481 // Math.sign
5482 /* global CreateMethodProperty */
5483 // 20.2.2.29. Math.sign ( x )
5484 CreateMethodProperty(Math, 'sign', function sign(x) {
5485         var x = Number(x);
5486         // If x is NaN, the result is NaN.
5487         if (isNaN(x)) {
5488                 return NaN;
5489         }
5490         // If x is -0, the result is -0.
5491         if (1 / x === -Infinity) {
5492                 return -0;
5493         }
5494         // If x is +0, the result is +0.
5495         if (1 / x === Infinity) {
5496                 return 0;
5497         }
5498         // If x is negative and not -0, the result is -1.
5499         if (x < 0) {
5500                 return -1;
5501         }
5502         // If x is positive and not +0, the result is +1.
5503         if (x > 0) {
5504                 return 1;
5505         }
5506 });
5507
5508 }
5509
5510 if (!('sinh' in Math)) {
5511
5512 // Math.sinh
5513 /* global CreateMethodProperty */
5514 // 20.2.2.31. Math.sinh ( x )
5515 CreateMethodProperty(Math, 'sinh', function sinh(x) {
5516         var s = (x < 0) ? -1 : 1;
5517         var absx = Math.abs(x);
5518         if (absx < 22) {
5519                 if (absx < Math.pow(2, -28)) {
5520                         return x;
5521                 }
5522                 var t = Math.exp(absx) - 1;
5523                 if (absx < 1) {
5524                         return (s * (2 * t - t * t / (t + 1)))/2;
5525                 }
5526                 return (s * (t + t / (t + 1)))/2;
5527         }
5528         if (absx < 709.7822265625) {
5529                 return (s * Math.exp(absx))/2;
5530         }
5531         var w = Math.exp(0.5 * absx);
5532         var t = (s * w)/2;
5533         return t * w;
5534 });
5535
5536 }
5537
5538 if (!('tanh' in Math)) {
5539
5540 // Math.tanh
5541 /* global CreateMethodProperty */
5542 // 20.2.2.34. Math.tanh ( x )
5543 CreateMethodProperty(Math, 'tanh', function tanh(x) {
5544         var y;
5545
5546         return x === Infinity ? 1 : x === -Infinity ? -1 : (y = Math.exp(2 * x), (y - 1) / (y + 1));
5547 });
5548
5549 }
5550
5551 if (!('trunc' in Math)) {
5552
5553 // Math.trunc
5554 /* global CreateMethodProperty */
5555 CreateMethodProperty(Math, 'trunc', function trunc(x) {
5556         return x < 0 ? Math.ceil(x) : Math.floor(x);
5557 });
5558
5559 }
5560
5561 if (!('EPSILON' in Number)) {
5562
5563 // Number.Epsilon
5564 // 20.1.2.1. Number.EPSILON
5565 // The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately 2.2204460492503130808472633361816 x 10-16.
5566 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
5567 Object.defineProperty(Number, 'EPSILON', {
5568         enumerable: false,
5569         configurable: false,
5570         writable: false,
5571         value: Math.pow(2, -52)
5572 });
5573
5574 }
5575
5576 if (!('MAX_SAFE_INTEGER' in Number)) {
5577
5578 // Number.MAX_SAFE_INTEGER
5579 // 20.1.2.6. Number.MAX_SAFE_INTEGER
5580 // The value of Number.MAX_SAFE_INTEGER is 9007199254740991 (2^53-1).
5581 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
5582 Object.defineProperty(Number, 'MAX_SAFE_INTEGER', {
5583         enumerable: false,
5584         configurable: false,
5585         writable: false,
5586         value: Math.pow(2, 53) - 1
5587 });
5588
5589 }
5590
5591 if (!('MIN_SAFE_INTEGER' in Number)) {
5592
5593 // Number.MIN_SAFE_INTEGER
5594 // 20.1.2.8. Number.MIN_SAFE_INTEGER
5595 // The value of Number.MIN_SAFE_INTEGER is -9007199254740991 (-(253-1)).
5596 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
5597 Object.defineProperty(Number, 'MIN_SAFE_INTEGER', {
5598         enumerable: false,
5599         configurable: false,
5600         writable: false,
5601         value: -(Math.pow(2, 53) - 1)
5602 });
5603
5604 }
5605
5606 if (!('isFinite' in Number)) {
5607
5608 // Number.isFinite
5609 /* global CreateMethodProperty, Type */
5610 (function () {
5611         var that = this;
5612         // 20.1.2.2. Number.isFinite ( number )
5613         CreateMethodProperty(Number, 'isFinite', function isFinite(number) {
5614                 // 1. If Type(number) is not Number, return false.
5615                 if (Type(number) !== 'number') {
5616                         return false;
5617                 }
5618                 // 2. If number is NaN, +∞, or -∞, return false.
5619                 // 3. Otherwise, return true.
5620                 // Polyfill.io - We use isFinite as it implements steps 2 and 3.
5621                 return that.isFinite(number);
5622         });
5623 }());
5624
5625 }
5626
5627 if (!('isInteger' in Number)) {
5628
5629 // Number.isInteger
5630 /* global CreateMethodProperty, ToInteger, Type */
5631 // 20.1.2.3. Number.isInteger ( number )
5632 CreateMethodProperty(Number, 'isInteger', function isInteger(number) {
5633         // 1. If Type(number) is not Number, return false.
5634         if (Type(number) !== 'number') {
5635                 return false;
5636         }
5637         // 2. If number is NaN, +∞, or -∞, return false.
5638         if (isNaN(number) || number === Infinity || number === -Infinity) {
5639                 return false;
5640         }
5641         // 3. Let integer be ToInteger(number).
5642         var integer = ToInteger(number);
5643         // 4. If integer is not equal to number, return false.
5644         if (integer !== number) {
5645                 return false;
5646         }
5647         // 5. Otherwise, return true.
5648         return true;
5649 });
5650
5651 }
5652
5653 if (!('isNaN' in Number)) {
5654
5655 // Number.isNaN
5656 /* global CreateMethodProperty, Type */
5657 (function () {
5658         var that = this;
5659         // 20.1.2.4. Number.isNaN ( number )
5660         CreateMethodProperty(Number, 'isNaN', function isNaN(number) {
5661                 // 1. If Type(number) is not Number, return false.
5662                 if (Type(number) !== 'number') {
5663                         return false;
5664                 }
5665                 // 2. If number is NaN, return true.
5666                 if (that.isNaN(number)) {
5667                         return true;
5668                 }
5669                 // 3. Otherwise, return false.
5670                 return false;
5671         });
5672 }());
5673
5674 }
5675
5676 if (!('isSafeInteger' in Number)) {
5677
5678 // Number.isSafeInteger
5679 /* global CreateMethodProperty, Type, ToInteger */
5680 // 20.1.2.5. Number.isSafeInteger ( number )
5681 CreateMethodProperty(Number, 'isSafeInteger', function isSafeInteger(number) {
5682         // 1. If Type(number) is not Number, return false.
5683         if (Type(number) !== 'number') {
5684                 return false;
5685         }
5686         // 2. If number is NaN, +∞, or -∞, return false.
5687         if (isNaN(number) || number === Infinity || number === -Infinity) {
5688                 return false;
5689         }
5690         // 3. Let integer be ToInteger(number).
5691         var integer = ToInteger(number);
5692         // 4. If integer is not equal to number, return false.
5693         if (integer !== number) {
5694                 return false;
5695         }
5696         // 5. If abs(integer) ≤ 2^53-1, return true.
5697         if (Math.abs(integer) <= (Math.pow(2, 53) - 1)) {
5698                 return true;
5699         }
5700         // 6. Otherwise, return false.
5701         return false;
5702 });
5703
5704 }
5705
5706 if (!('parseFloat' in Number)) {
5707
5708 // Number.parseFloat
5709 /* global CreateMethodProperty */
5710 // 20.1.2.12. Number.parseFloat ( string )
5711 // The value of the Number.parseFloat data property is the same built-in function object that is the value of the  parseFloat property of the global object defined in 18.2.4.
5712 CreateMethodProperty(Number, 'parseFloat', parseFloat);
5713
5714 }
5715
5716 if (!('parseInt' in Number)) {
5717
5718 // Number.parseInt
5719 /* global CreateMethodProperty */
5720 // 20.1.2.13. Number.parseInt ( string, radix )
5721 // The value of the Number.parseInt data property is the same built-in function object that is the value of the  parseInt property of the global object defined in 18.2.5.
5722 CreateMethodProperty(Number, 'parseInt', parseInt);
5723
5724 }
5725
5726
5727 // _ESAbstract.SameValue
5728 /* global Type, SameValueNonNumber */
5729 // 7.2.10. SameValue ( x, y )
5730 function SameValue(x, y) { // eslint-disable-line no-unused-vars
5731         // 1. If Type(x) is different from Type(y), return false.
5732         if (Type(x) !== Type(y)) {
5733                 return false;
5734         }
5735         // 2. If Type(x) is Number, then
5736         if (Type(x) === 'number') {
5737                 // a. If x is NaN and y is NaN, return true.
5738                 if (isNaN(x) && isNaN(y)) {
5739                         return true;
5740                 }
5741                 // Polyfill.io - 0 === -0 is true, but they are not the same value.
5742                 // b. If x is +0 and y is -0, return false.
5743                 // c. If x is -0 and y is +0, return false.
5744                 if (x === 0 && y === 0 && 1/x !== 1/y) {
5745                         return false;
5746                 }
5747                 // d. If x is the same Number value as y, return true.
5748                 if (x === y) {
5749                         return true;
5750                 }
5751                 // e. Return false.
5752                 return false;
5753         }
5754         // 3. Return SameValueNonNumber(x, y).
5755         return SameValueNonNumber(x, y);
5756 }
5757 if (!('is' in Object)) {
5758
5759 // Object.is
5760 /* global CreateMethodProperty, SameValue */
5761 // 19.1.2.12. Object.is ( value1, value2 )
5762 CreateMethodProperty(Object, 'is', function is(value1, value2) {
5763         // 1. Return SameValue(value1, value2).
5764         return SameValue(value1, value2);
5765 });
5766
5767 }
5768
5769 if (!('Promise' in this)) {
5770
5771 // Promise
5772 !function(n){function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e={};t.m=n,t.c=e,t.i=function(n){return n},t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var e=n&&n.__esModule?function(){return n["default"]}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=100)}({100:/*!***********************!*\
5773   !*** ./src/global.js ***!
5774   \***********************/
5775 function(n,t,e){(function(n){var t=e(/*! ./yaku */5);try{n.Promise=t,window.Promise=t}catch(r){}}).call(t,e(/*! ./../~/webpack/buildin/global.js */2))},2:/*!***********************************!*\
5776   !*** (webpack)/buildin/global.js ***!
5777   \***********************************/
5778 function(n,t){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(r){"object"==typeof window&&(e=window)}n.exports=e},5:/*!*********************!*\
5779   !*** ./src/yaku.js ***!
5780   \*********************/
5781 function(n,t,e){(function(t){!function(){"use strict";function e(){return rn[q][B]||D}function r(n){return n&&"object"==typeof n}function o(n){return"function"==typeof n}function i(n,t){return n instanceof t}function u(n){return i(n,M)}function c(n,t,e){if(!t(n))throw h(e)}function f(){try{return R.apply(S,arguments)}catch(n){return nn.e=n,nn}}function s(n,t){return R=n,S=t,f}function a(n,t){function e(){for(var e=0;e<o;)t(r[e],r[e+1]),r[e++]=P,r[e++]=P;o=0,r.length>n&&(r.length=n)}var r=A(n),o=0;return function(n,t){r[o++]=n,r[o++]=t,2===o&&rn.nextTick(e)}}function l(n,t){var e,r,u,c,f=0;if(!n)throw h(Q);var a=n[rn[q][z]];if(o(a))r=a.call(n);else{if(!o(n.next)){if(i(n,A)){for(e=n.length;f<e;)t(n[f],f++);return f}throw h(Q)}r=n}for(;!(u=r.next()).done;)if((c=s(t)(u.value,f++))===nn)throw o(r[G])&&r[G](),c.e;return f}function h(n){return new TypeError(n)}function v(n){return(n?"":V)+(new M).stack}function _(n,t){var e="on"+n.toLowerCase(),r=O[e];H&&H.listeners(n).length?n===Z?H.emit(n,t._v,t):H.emit(n,t):r?r({reason:t._v,promise:t}):rn[n](t._v,t)}function p(n){return n&&n._s}function d(n){if(p(n))return new n(tn);var t,e,r;return t=new n(function(n,o){if(t)throw h();e=n,r=o}),c(e,o),c(r,o),t}function w(n,t){var e=!1;return function(r){e||(e=!0,L&&(n[N]=v(!0)),t===Y?k(n,r):x(n,t,r))}}function y(n,t,e,r){return o(e)&&(t._onFulfilled=e),o(r)&&(n[J]&&_(X,n),t._onRejected=r),L&&(t._p=n),n[n._c++]=t,n._s!==$&&on(n,t),t}function m(n){if(n._umark)return!0;n._umark=!0;for(var t,e=0,r=n._c;e<r;)if(t=n[e++],t._onRejected||m(t))return!0}function j(n,t){function e(n){return r.push(n.replace(/^\s+|\s+$/g,""))}var r=[];return L&&(t[N]&&e(t[N]),function o(n){n&&K in n&&(o(n._next),e(n[K]+""),o(n._p))}(t)),(n&&n.stack?n.stack:n)+("\n"+r.join("\n")).replace(en,"")}function g(n,t){return n(t)}function x(n,t,e){var r=0,o=n._c;if(n._s===$)for(n._s=t,n._v=e,t===U&&(L&&u(e)&&(e.longStack=j(e,n)),un(n));r<o;)on(n,n[r++]);return n}function k(n,t){if(t===n&&t)return x(n,U,h(W)),n;if(t!==C&&(o(t)||r(t))){var e=s(b)(t);if(e===nn)return x(n,U,e.e),n;o(e)?(L&&p(t)&&(n._next=t),p(t)?T(n,t,e):rn.nextTick(function(){T(n,t,e)})):x(n,Y,t)}else x(n,Y,t);return n}function b(n){return n.then}function T(n,t,e){var r=s(e,t)(function(e){t&&(t=C,k(n,e))},function(e){t&&(t=C,x(n,U,e))});r===nn&&t&&(x(n,U,r.e),t=C)}var P,R,S,C=null,F="object"==typeof self,O=F?self:t,E=O.Promise,H=O.process,I=O.console,L=!1,A=Array,M=Error,U=1,Y=2,$=3,q="Symbol",z="iterator",B="species",D=q+"("+B+")",G="return",J="_uh",K="_pt",N="_st",Q="Invalid argument",V="\nFrom previous ",W="Chaining cycle detected for promise",X="rejectionHandled",Z="unhandledRejection",nn={e:C},tn=function(){},en=/^.+\/node_modules\/yaku\/.+\n?/gm,rn=function(n){var t,e=this;if(!r(e)||e._s!==P)throw h("Invalid this");if(e._s=$,L&&(e[K]=v()),n!==tn){if(!o(n))throw h(Q);t=s(n)(w(e,Y),w(e,U)),t===nn&&x(e,U,t.e)}};rn["default"]=rn,function(n,t){for(var e in t)n[e]=t[e]}(rn.prototype,{then:function(n,t){if(this._s===undefined)throw h();return y(this,d(rn.speciesConstructor(this,rn)),n,t)},"catch":function(n){return this.then(P,n)},"finally":function(n){return this.then(function(t){return rn.resolve(n()).then(function(){return t})},function(t){return rn.resolve(n()).then(function(){throw t})})},_c:0,_p:C}),rn.resolve=function(n){return p(n)?n:k(d(this),n)},rn.reject=function(n){return x(d(this),U,n)},rn.race=function(n){var t=this,e=d(t),r=function(n){x(e,Y,n)},o=function(n){x(e,U,n)},i=s(l)(n,function(n){t.resolve(n).then(r,o)});return i===nn?t.reject(i.e):e},rn.all=function(n){function t(n){x(o,U,n)}var e,r=this,o=d(r),i=[];return(e=s(l)(n,function(n,u){r.resolve(n).then(function(n){i[u]=n,--e||x(o,Y,i)},t)}))===nn?r.reject(e.e):(e||x(o,Y,[]),o)},rn.Symbol=O[q]||{},s(function(){Object.defineProperty(rn,e(),{get:function(){return this}})})(),rn.speciesConstructor=function(n,t){var r=n.constructor;return r?r[e()]||t:t},rn.unhandledRejection=function(n,t){I&&I.error("Uncaught (in promise)",L?t.longStack:j(n,t))},rn.rejectionHandled=tn,rn.enableLongStackTrace=function(){L=!0},rn.nextTick=F?function(n){E?new E(function(n){n()}).then(n):setTimeout(n)}:H.nextTick,rn._s=1;var on=a(999,function(n,t){var e,r;return(r=n._s!==U?t._onFulfilled:t._onRejected)===P?void x(t,n._s,n._v):(e=s(g)(r,n._v))===nn?void x(t,U,e.e):void k(t,e)}),un=a(9,function(n){m(n)||(n[J]=1,_(Z,n))});try{n.exports=rn}catch(cn){O.Yaku=rn}}()}).call(t,e(/*! ./../~/webpack/buildin/global.js */2))}});
5782 }
5783
5784 if (!('flags' in RegExp.prototype)) {
5785
5786 // RegExp.prototype.flags
5787 /* global Get, ToBoolean, Type */
5788 Object.defineProperty(RegExp.prototype, 'flags', {
5789         configurable: true,
5790         enumerable: false,
5791         get: function () {
5792                 // 21.2.5.3.1 Let R be the this value.
5793                 var R = this;
5794
5795                 // 21.2.5.3.2 If Type(R) is not Object, throw a TypeError exception.
5796                 if (Type(R) !== 'object') {
5797                         throw new TypeError('Method called on incompatible type: must be an object.');
5798                 }
5799                 // 21.2.5.3.3 Let result be the empty String.
5800                 var result = '';
5801
5802                 // 21.2.5.3.4 Let global be ToBoolean(? Get(R, "global")).
5803                 var global = ToBoolean(Get(R, 'global'));
5804
5805                 // 21.2.5.3.5 If global is true, append the code unit 0x0067 (LATIN SMALL LETTER G) as the last code unit of result.
5806                 if (global) {
5807                         result += 'g';
5808                 }
5809
5810                 // 21.2.5.3.6 Let ignoreCase be ToBoolean(? Get(R, "ignoreCase")).
5811                 var ignoreCase = ToBoolean(Get(R, 'ignoreCase'));
5812
5813                 // 21.2.5.3.7 If ignoreCase is true, append the code unit 0x0069 (LATIN SMALL LETTER I) as the last code unit of result.
5814                 if (ignoreCase) {
5815                         result += 'i';
5816                 }
5817
5818                 // 21.2.5.3.8 Let multiline be ToBoolean(? Get(R, "multiline")).
5819                 var multiline = ToBoolean(Get(R, 'multiline'));
5820
5821                 // 21.2.5.3.9 If multiline is true, append the code unit 0x006D (LATIN SMALL LETTER M) as the last code unit of result.
5822                 if (multiline) {
5823                         result += 'm';
5824                 }
5825
5826                 // 21.2.5.3.10 Let unicode be ToBoolean(? Get(R, "unicode")).
5827                 var unicode = ToBoolean(Get(R, 'unicode'));
5828
5829                 // 21.2.5.3.11 If unicode is true, append the code unit 0x0075 (LATIN SMALL LETTER U) as the last code unit of result.
5830                 if (unicode) {
5831                         result += 'u';
5832                 }
5833
5834                 // 21.2.5.3.12 Let sticky be ToBoolean(? Get(R, "sticky")).
5835                 var sticky = ToBoolean(Get(R, 'sticky'));
5836
5837                 // 21.2.5.3.13 If sticky is true, append the code unit 0x0079 (LATIN SMALL LETTER Y) as the last code unit of result.
5838                 if (sticky) {
5839                         result += 'y';
5840                 }
5841
5842                 // 21.2.5.3.14 Return result.
5843                 return result;
5844         }
5845 });
5846
5847 }
5848
5849
5850 // _StringIterator
5851 // A modification of https://github.com/medikoo/es6-iterator
5852 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
5853
5854 /* global Iterator */
5855
5856 var StringIterator = (function() { // eslint-disable-line no-unused-vars
5857
5858         var StringIterator = function (str) {
5859                 if (!(this instanceof StringIterator)) return new StringIterator(str);
5860                 str = String(str);
5861                 Iterator.call(this, str);
5862                 Object.defineProperty(this, '__length__', {
5863                         value: str.length,
5864                         configurable: false,
5865                         enumerable: false,
5866                         writable: false
5867                 });
5868         };
5869         if (Object.setPrototypeOf) Object.setPrototypeOf(StringIterator, Iterator);
5870
5871         StringIterator.prototype = Object.create(Iterator.prototype, {
5872                 constructor: {
5873                         value: StringIterator,
5874                         configurable: true,
5875                         enumerable: false,
5876                         writable: true
5877                 },
5878                 _next: {
5879                         value: function() {
5880                                 if (!this.__list__) return;
5881                                 if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
5882                                 this._unBind();
5883                         },
5884                         configurable: true,
5885                         enumerable: false,
5886                         writable: true
5887                 },
5888                 _resolve: {
5889                         value: function (i) {
5890                                 var char = this.__list__[i], code;
5891                                 if (this.__nextIndex__ === this.__length__) return char;
5892                                 code = char.charCodeAt(0);
5893                                 if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
5894                                 return char;
5895                         },
5896                         configurable: true,
5897                         enumerable: false,
5898                         writable: true
5899                 },
5900                 toString: {
5901                         value: function() {
5902                                 return '[object String Iterator]';
5903                         },
5904                         configurable: true,
5905                         enumerable: false,
5906                         writable: true
5907                 }
5908         });
5909
5910         return StringIterator;
5911 }());
5912 if (!('Symbol' in this && 'iterator' in this.Symbol && !!String.prototype[Symbol.iterator])) {
5913
5914 // String.prototype.@@iterator
5915 /* global CreateMethodProperty, RequireObjectCoercible, ToString, StringIterator, Symbol */
5916 // 21.1.3.29. String.prototype [ @@iterator ] ( )
5917 CreateMethodProperty(String.prototype, Symbol.iterator, function () {
5918         // 1. Let O be ? RequireObjectCoercible(this value).
5919         var O = RequireObjectCoercible(this);
5920         // 2. Let S be ? ToString(O).
5921         var S = ToString(O);
5922         // 3. Return CreateStringIterator(S).
5923         // TODO: Add CreateStringIterator.
5924         return new StringIterator(S);
5925 });
5926
5927 }
5928
5929
5930 // _ESAbstract.UTF16Decode
5931 // 10.1.2. Static Semantics: UTF16Decode( lead, trail )
5932 function UTF16Decode(lead, trail) { // eslint-disable-line no-unused-vars
5933         // 1. Assert: 0xD800 ≤ lead ≤ 0xDBFF and 0xDC00 ≤ trail ≤ 0xDFFF.
5934         // 2. Let cp be (lead - 0xD800) × 0x400 + (trail - 0xDC00) + 0x10000.
5935         var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
5936         // 3. Return the code point cp.
5937         return cp;
5938 }
5939 if (!('codePointAt' in String.prototype)) {
5940
5941 // String.prototype.codePointAt
5942 /* global CreateMethodProperty, RequireObjectCoercible, ToInteger, ToString, UTF16Decode */
5943 // 21.1.3.3. String.prototype.codePointAt ( pos )
5944 CreateMethodProperty(String.prototype, 'codePointAt', function codePointAt(pos) {
5945         // 1. Let O be ? RequireObjectCoercible(this value).
5946         var O = RequireObjectCoercible(this);
5947         // 2. Let S be ? ToString(O).
5948         var S = ToString(O);
5949         // 3. Let position be ? ToInteger(pos).
5950         var position = ToInteger(pos);
5951         // 4. Let size be the length of S.
5952         var size = S.length;
5953         // 5. If position < 0 or position ≥ size, return undefined.
5954         if (position < 0 || position >= size) {
5955                 return undefined;
5956         }
5957         // 6. Let first be the numeric value of the code unit at index position within the String S.
5958         var first = String.prototype.charCodeAt.call(S, position);
5959         // 7. If first < 0xD800 or first > 0xDBFF or position+1 = size, return first.
5960         if (first < 0xD800 || first > 0xDBFF || position + 1 === size) {
5961                 return first;
5962         }
5963         // 8. Let second be the numeric value of the code unit at index position+1 within the String S.
5964         var second = String.prototype.charCodeAt.call(S, position + 1);
5965         // 9. If second < 0xDC00 or second > 0xDFFF, return first.
5966         if (second < 0xDC00 || second > 0xDFFF) {
5967                 return first;
5968         }
5969         // 10. Return UTF16Decode(first, second).
5970         // 21.1.3.3.10 Return UTF16Decode(first, second).
5971         return UTF16Decode(first, second);
5972 });
5973
5974 }
5975
5976 if (!('endsWith' in String.prototype)) {
5977
5978 // String.prototype.endsWith
5979 /* global CreateMethodProperty, IsRegExp, RequireObjectCoercible, ToInteger, ToString */
5980 // 21.1.3.6. String.prototype.endsWith ( searchString [ , endPosition ] )
5981 CreateMethodProperty(String.prototype, 'endsWith', function endsWith(searchString /* [ , endPosition ] */) {
5982         'use strict';
5983         var endPosition = arguments.length > 1 ? arguments[1] : undefined;
5984         // 1. Let O be ? RequireObjectCoercible(this value).
5985         var O = RequireObjectCoercible(this);
5986         // 2. Let S be ? ToString(O).
5987         var S = ToString(O);
5988         // 3. Let isRegExp be ? IsRegExp(searchString).
5989         var isRegExp = IsRegExp(searchString);
5990         // 4. If isRegExp is true, throw a TypeError exception.
5991         if (isRegExp) {
5992                 throw new TypeError('First argument to String.prototype.endsWith must not be a regular expression');
5993         }
5994         // 5. Let searchStr be ? ToString(searchString).
5995         var searchStr = ToString(searchString);
5996         // 6. Let len be the length of S.
5997         var len = S.length;
5998         // 7. If endPosition is undefined, let pos be len, else let pos be ? ToInteger(endPosition).
5999         var pos = endPosition === undefined ? len : ToInteger(endPosition);
6000         // 8. Let end be min(max(pos, 0), len).
6001         var end = Math.min(Math.max(pos, 0), len);
6002         // 9. Let searchLength be the length of searchStr.
6003         var searchLength = searchStr.length;
6004         // 10. Let start be end - searchLength.
6005         var start = end - searchLength;
6006         // 11. If start is less than 0, return false.
6007         if (start < 0) {
6008                 return false;
6009         }
6010         // 12. If the sequence of elements of S starting at start of length searchLength is the same as the full element sequence of searchStr, return true.
6011         if (S.substr(start, searchLength) === searchStr) {
6012                 return true;
6013          }
6014         // 13. Otherwise, return false.
6015         return false;
6016 });
6017
6018 }
6019
6020 if (!('repeat' in String.prototype)) {
6021
6022 // String.prototype.repeat
6023 /* global CreateMethodProperty, RequireObjectCoercible, ToInteger, ToString */
6024 // 21.1.3.15String.prototype.repeat ( count )
6025 CreateMethodProperty(String.prototype, 'repeat', function repeat(count) {
6026         'use strict';
6027         // 1. Let O be ? RequireObjectCoercible(this value).
6028         var O = RequireObjectCoercible(this);
6029         // 2. Let S be ? ToString(O).
6030         var S = ToString(O);
6031         // 3. Let n be ? ToInteger(count).
6032         var n = ToInteger(count);
6033         // 4. If n < 0, throw a RangeError exception.
6034         if (n < 0) {
6035                 throw new RangeError('Invalid count value');
6036         }
6037         // 5. If n is +∞, throw a RangeError exception.
6038         if (n === Infinity) {
6039                 throw new RangeError('Invalid count value');
6040         }
6041         // 6. Let T be the String value that is made from n copies of S appended together. If n is 0, T is the empty String.
6042         var T = n === 0 ? '' : new Array(n + 1).join(S);
6043         // 7. Return T.
6044         return T;
6045 });
6046
6047 }
6048
6049 if (!('startsWith' in String.prototype)) {
6050
6051 // String.prototype.startsWith
6052 /* global CreateMethodProperty, IsRegExp, RequireObjectCoercible, ToInteger, ToString */
6053 // 21.1.3.20. String.prototype.startsWith ( searchString [ , position ] )
6054 CreateMethodProperty(String.prototype, 'startsWith', function startsWith(searchString /* [ , position ] */) {
6055         'use strict';
6056         var position = arguments.length > 1 ? arguments[1] : undefined;
6057         // 1. Let O be ? RequireObjectCoercible(this value).
6058         var O = RequireObjectCoercible(this);
6059         // 2. Let S be ? ToString(O).
6060         var S = ToString(O);
6061         // 3. Let isRegExp be ? IsRegExp(searchString).
6062         var isRegExp = IsRegExp(searchString);
6063         // 4. If isRegExp is true, throw a TypeError exception.
6064         if (isRegExp) {
6065                 throw new TypeError('First argument to String.prototype.startsWith must not be a regular expression');
6066         }
6067         // 5. Let searchStr be ? ToString(searchString).
6068         var searchStr = ToString(searchString);
6069         // 6. Let pos be ? ToInteger(position). (If position is undefined, this step produces the value 0.)
6070         var pos = ToInteger(position);
6071         // 7. Let len be the length of S.
6072         var len = S.length;
6073         // 8. Let start be min(max(pos, 0), len).
6074         var start = Math.min(Math.max(pos, 0), len);
6075         // 9. Let searchLength be the length of searchStr.
6076         var searchLength = searchStr.length;
6077         // 10. If searchLength+start is greater than len, return false.
6078         if (searchLength + start > len) {
6079                 return false;
6080         }
6081         // 11. If the sequence of elements of S starting at start of length searchLength is the same as the full element sequence of searchStr, return true.
6082         if (S.substr(start).indexOf(searchString) === 0) {
6083                 return true;
6084         }
6085         // 12. Otherwise, return false.
6086         return false;
6087 });
6088
6089 }
6090
6091 if (!('Symbol' in this && 'hasInstance' in this.Symbol)) {
6092
6093 // Symbol.hasInstance
6094 /* global Symbol */
6095 Object.defineProperty(Symbol, 'hasInstance', { value: Symbol('hasInstance') });
6096
6097 }
6098
6099 if (!('Symbol' in this && 'isConcatSpreadable' in this.Symbol)) {
6100
6101 // Symbol.isConcatSpreadable
6102 /* global Symbol */
6103 Object.defineProperty(Symbol, 'isConcatSpreadable', { value: Symbol('isConcatSpreadable') });
6104
6105 }
6106
6107 if (!('Symbol' in this && 'match' in this.Symbol)) {
6108
6109 // Symbol.match
6110 /* global Symbol */
6111 Object.defineProperty(Symbol, 'match', { value: Symbol('match') });
6112
6113 }
6114
6115 if (!('Symbol' in this && 'replace' in this.Symbol)) {
6116
6117 // Symbol.replace
6118 /* global Symbol */
6119 Object.defineProperty(Symbol, 'replace', { value: Symbol('replace') });
6120
6121 }
6122
6123 if (!('Symbol' in this && 'search' in this.Symbol)) {
6124
6125 // Symbol.search
6126 /* global Symbol */
6127 Object.defineProperty(Symbol, 'search', { value: Symbol('search') });
6128
6129 }
6130
6131 if (!('Symbol' in this && 'split' in this.Symbol)) {
6132
6133 // Symbol.split
6134 /* global Symbol */
6135 Object.defineProperty(Symbol, 'split', { value: Symbol('split') });
6136
6137 }
6138
6139 if (!('Symbol' in this && 'toPrimitive' in this.Symbol)) {
6140
6141 // Symbol.toPrimitive
6142 /* global Symbol */
6143 Object.defineProperty(Symbol, 'toPrimitive', { value: Symbol('toPrimitive') });
6144
6145 }
6146
6147 if (!('Symbol' in this && 'unscopables' in this.Symbol)) {
6148
6149 // Symbol.unscopables
6150 /* global Symbol */
6151 Object.defineProperty(Symbol, 'unscopables', { value: Symbol('unscopables') });
6152
6153 }
6154
6155 if (!((function(global) {
6156         try {
6157                 if ("WeakMap" in global && WeakMap.length === 0) {
6158                         var o = {};
6159                         var wm = new WeakMap([[o, 'test']]);
6160                         return (wm.get(o) === 'test' && wm["delete"](0) === false);
6161                 } else {
6162                         return false;
6163                 }
6164         } catch (err) {
6165                 return false;
6166         }
6167 }(this)))) {
6168
6169 // WeakMap
6170 /* globals Symbol, OrdinaryCreateFromConstructor, IsCallable, GetIterator, IteratorStep, IteratorValue, IteratorClose, Get, Call, CreateMethodProperty, Type, SameValue */
6171 (function (global) {
6172         // Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
6173         var undefMarker = Symbol('undef');
6174         // 23.3.1.1 WeakMap ( [ iterable ] )
6175         var WeakMap = function WeakMap(/* iterable */) {
6176                 // 1. If NewTarget is undefined, throw a TypeError exception.
6177                 if (!(this instanceof WeakMap)) {
6178                         throw new TypeError('Constructor WeakMap requires "new"');
6179                 }
6180                 // 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakMapPrototype%", « [[WeakMapData]] »).
6181                 var map = OrdinaryCreateFromConstructor(this, WeakMap.prototype, {
6182                         _keys: [],
6183                         _values: [],
6184                         _es6WeakMap: true
6185                 });
6186
6187                 // 3. Set map.[[WeakMapData]] to a new empty List.
6188                 // Polyfill.io - This step was done as part of step two.
6189
6190                 // 4. If iterable is not present, let iterable be undefined.
6191                 var iterable = arguments.length > 0 ? arguments[0] : undefined;
6192
6193                 // 5. If iterable is either undefined or null, return map.
6194                 if (iterable === null || iterable === undefined) {
6195                         return map;
6196                 }
6197
6198                 // 6. Let adder be ? Get(map, "set").
6199                 var adder = Get(map, "set");
6200
6201                 // 7. If IsCallable(adder) is false, throw a TypeError exception.
6202                 if (!IsCallable(adder)) {
6203                         throw new TypeError("WeakMap.prototype.set is not a function");
6204                 }
6205
6206                 // 8. Let iteratorRecord be ? GetIterator(iterable).
6207                 try {
6208                         var iteratorRecord = GetIterator(iterable);
6209                         // 9. Repeat,
6210                         while (true) {
6211                                 // a. Let next be ? IteratorStep(iteratorRecord).
6212                                 var next = IteratorStep(iteratorRecord);
6213                                 // b. If next is false, return map.
6214                                 if (next === false) {
6215                                         return map;
6216                                 }
6217                                 // c. Let nextItem be ? IteratorValue(next).
6218                                 var nextItem = IteratorValue(next);
6219                                 // d. If Type(nextItem) is not Object, then
6220                                 if (Type(nextItem) !== 'object') {
6221                                         // i. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}.
6222                                         try {
6223                                                 throw new TypeError('Iterator value ' + nextItem + ' is not an entry object');
6224                                         } catch (error) {
6225                                                 // ii. Return ? IteratorClose(iteratorRecord, error).
6226                                                 return IteratorClose(iteratorRecord, error);
6227                                         }
6228                                 }
6229                                 try {
6230                                         // Polyfill.io - The try catch accounts for steps: f, h, and j.
6231
6232                                         // e. Let k be Get(nextItem, "0").
6233                                         var k = Get(nextItem, "0");
6234                                         // f. If k is an abrupt completion, return ? IteratorClose(iteratorRecord, k).
6235                                         // g. Let v be Get(nextItem, "1").
6236                                         var v = Get(nextItem, "1");
6237                                         // h. If v is an abrupt completion, return ? IteratorClose(iteratorRecord, v).
6238                                         // i. Let status be Call(adder, map, « k.[[Value]], v.[[Value]] »).
6239                                         Call(adder, map, [k, v]);
6240                                 } catch (e) {
6241                                         // j. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
6242                                         return IteratorClose(iteratorRecord, e);
6243                                 }
6244                         }
6245                 } catch (e) {
6246                         // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
6247                         if (Array.isArray(iterable) ||
6248                                 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
6249                                 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
6250                                 (!!iterable.callee)) {
6251                                 var index;
6252                                 var length = iterable.length;
6253                                 for (index = 0; index < length; index++) {
6254                                         var k = iterable[index][0];
6255                                         var v = iterable[index][1];
6256                                         Call(adder, map, [k, v]);
6257                                 }
6258                         }
6259                 }
6260                 return map;
6261         };
6262
6263         // 23.3.2.1 WeakMap.prototype
6264         // The initial value of WeakMap.prototype is the intrinsic object %WeakMapPrototype%.
6265         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
6266         Object.defineProperty(WeakMap, 'prototype', {
6267                 configurable: false,
6268                 enumerable: false,
6269                 writable: false,
6270                 value: {}
6271         });
6272
6273         // 23.3.3.1 WeakMap.prototype.constructor
6274         CreateMethodProperty(WeakMap.prototype, 'constructor', WeakMap);
6275
6276         // 23.3.3.2 WeakMap.prototype.delete ( key )
6277         CreateMethodProperty(WeakMap.prototype, 'delete', function (key) {
6278                 // 1. Let M be the this value.
6279                 var M = this;
6280                 // 2. If Type(M) is not Object, throw a TypeError exception.
6281                 if (Type(M) !== 'object') {
6282                         throw new TypeError('Method WeakMap.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
6283                 }
6284                 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6285                 if (M._es6WeakMap !== true) {
6286                         throw new TypeError('Method WeakMap.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
6287                 }
6288                 // 4. Let entries be the List that is M.[[WeakMapData]].
6289                 var entries = M._keys;
6290                 // 5. If Type(key) is not Object, return false.
6291                 if (Type(key) !== 'object') {
6292                         return false;
6293                 }
6294                 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6295                 for (var i = 0; i < entries.length; i++) {
6296                         // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then
6297                         if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6298                                 // i. Set p.[[Key]] to empty.
6299                                 this._keys[i] = undefMarker;
6300                                 // ii. Set p.[[Value]] to empty.
6301                                 this._values[i] = undefMarker;
6302                                 this._size = --this._size;
6303                                 // iii. Return true.
6304                                 return true;
6305                         }
6306                 }
6307                 // 7. Return false.
6308                 return false;
6309         });
6310
6311         // 23.3.3.3 WeakMap.prototype.get ( key )
6312         CreateMethodProperty(WeakMap.prototype, 'get', function get(key) {
6313                 // 1. Let M be the this value.
6314                 var M = this;
6315                 // 2. If Type(M) is not Object, throw a TypeError exception.
6316                 if (Type(M) !== 'object') {
6317                         throw new TypeError('Method WeakMap.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
6318                 }
6319                 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6320                 if (M._es6WeakMap !== true) {
6321                         throw new TypeError('Method WeakMap.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
6322                 }
6323                 // 4. Let entries be the List that is M.[[WeakMapData]].
6324                 var entries = M._keys;
6325                 // 5. If Type(key) is not Object, return undefined.
6326                 if (Type(key) !== 'object') {
6327                         return undefined;
6328                 }
6329                 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6330                 for (var i = 0; i < entries.length; i++) {
6331                         // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return p.[[Value]].
6332                         if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6333                                 return M._values[i];
6334                         }
6335                 }
6336                 // 7. Return undefined.
6337                 return undefined;
6338         });
6339
6340         // 23.3.3.4 WeakMap.prototype.has ( key )
6341         CreateMethodProperty(WeakMap.prototype, 'has', function has(key) {
6342                 // 1. Let M be the this value.
6343                 var M = this;
6344                 // 2. If Type(M) is not Object, throw a TypeError exception.
6345                 if (typeof M !== 'object') {
6346                         throw new TypeError('Method WeakMap.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
6347                 }
6348                 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6349                 if (M._es6WeakMap !== true) {
6350                         throw new TypeError('Method WeakMap.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
6351                 }
6352                 // 4. Let entries be the List that is M.[[WeakMapData]].
6353                 var entries = M._keys;
6354                 // 5. If Type(key) is not Object, return false.
6355                 if (Type(key) !== 'object') {
6356                         return false;
6357                 }
6358                 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6359                 for (var i = 0; i < entries.length; i++) {
6360                         // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return true.
6361                         if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6362                                 return true;
6363                         }
6364                 }
6365                 // 7. Return false.
6366                 return false;
6367         });
6368
6369         // 23.3.3.5 WeakMap.prototype.set ( key, value )
6370         CreateMethodProperty(WeakMap.prototype, 'set', function set(key, value) {
6371                 // 1. Let M be the this value.
6372                 var M = this;
6373                 // 2. If Type(M) is not Object, throw a TypeError exception.
6374                 if (Type(M) !== 'object') {
6375                         throw new TypeError('Method WeakMap.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
6376                 }
6377                 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6378                 if (M._es6WeakMap !== true) {
6379                         throw new TypeError('Method WeakMap.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
6380                 }
6381                 // 4. Let entries be the List that is M.[[WeakMapData]].
6382                 var entries = M._keys;
6383                 // 5. If Type(key) is not Object, throw a TypeError exception.
6384                 if (Type(key) !== 'object') {
6385                         throw new TypeError("Invalid value used as weak map key");
6386                 }
6387                 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6388                 for (var i = 0; i < entries.length; i++) {
6389                         // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then
6390                         if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6391                                 // i. Set p.[[Value]] to value.
6392                                 M._values[i] = value;
6393                                 // ii. Return M.
6394                                 return M;
6395                         }
6396                 }
6397                 // 7. Let p be the Record {[[Key]]: key, [[Value]]: value}.
6398                 var p = {
6399                         '[[Key]]': key,
6400                         '[[Value]]': value
6401                 };
6402                 // 8. Append p as the last element of entries.
6403                 M._keys.push(p['[[Key]]']);
6404                 M._values.push(p['[[Value]]']);
6405                 // 9. Return M.
6406                 return M;
6407         });
6408
6409         // 23.3.3.6 WeakMap.prototype [ @@toStringTag ]
6410         // The initial value of the @@toStringTag property is the String value "WeakMap".
6411         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
6412
6413         // Polyfill.io - Safari 8 implements WeakMap.name but as a non-writable property, which means it would throw an error if we try and write to it here.
6414         if (!('name' in WeakMap)) {
6415                 // 19.2.4.2 name
6416                 Object.defineProperty(WeakMap, 'name', {
6417                         configurable: true,
6418                         enumerable: false,
6419                         writable: false,
6420                         value: 'WeakMap'
6421                 });
6422         }
6423
6424         // Export the object
6425         try {
6426                 CreateMethodProperty(global, 'WeakMap', WeakMap);
6427         } catch (e) {
6428                 // IE8 throws an error here if we set enumerable to false.
6429                 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
6430                 global['WeakMap'] = WeakMap;
6431         }
6432 }(this));
6433
6434 }
6435
6436 if (!((function(global) {
6437         try {
6438                 if ("WeakSet" in global && WeakSet.length === 0) {
6439                         var o = {};
6440                         var ws = new WeakSet([o]);
6441                         return (ws.has(o) && ws["delete"](0) === false);
6442                 } else {
6443                         return false;
6444                 }
6445         } catch (err) {
6446                 return false;
6447         }
6448 }(this)))) {
6449
6450 // WeakSet
6451 /* global Call, CreateMethodProperty, Get, GetIterator, IsArray, IsCallable, IteratorClose, IteratorStep, IteratorValue, OrdinaryCreateFromConstructor, SameValueZero, Type, Symbol */
6452 (function (global) {
6453         // Deleted set items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
6454         var undefMarker = Symbol('undef');
6455         // 23.4.1.1. WeakSet ( [ iterable ] )
6456         var WeakSet = function WeakSet() {
6457                 // 1. If NewTarget is undefined, throw a TypeError exception.
6458                 if (!(this instanceof WeakSet)) {
6459                         throw new TypeError('Constructor WeakSet requires "new"');
6460                 }
6461                 // 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakSetPrototype%", « [[WeakSetData]] »).
6462                 var set = OrdinaryCreateFromConstructor(this, WeakSet.prototype, {
6463                         _values: [],
6464                         _size: 0,
6465                         _es6WeakSet: true
6466                 });
6467
6468                 // 3. Set set.[[WeakSetData]] to a new empty List.
6469                 // Polyfill.io - This step was done as part of step two.
6470
6471                 // 4. If iterable is not present, let iterable be undefined.
6472                 var iterable = arguments.length > 0 ? arguments[0] : undefined;
6473                 // 5. If iterable is either undefined or null, return set.
6474                 if (iterable === null || iterable === undefined) {
6475                         return set;
6476                 }
6477                 // 6. Let adder be ? Get(set, "add").
6478                 var adder = Get(set, 'add');
6479                 // 7. If IsCallable(adder) is false, throw a TypeError exception.
6480                 if (!IsCallable(adder)) {
6481                         throw new TypeError("WeakSet.prototype.add is not a function");
6482                 }
6483                 try {
6484                         // 8. Let iteratorRecord be ? GetIterator(iterable).
6485                         var iteratorRecord = GetIterator(iterable);
6486                         // 9. Repeat,
6487                         while (true) {
6488                                 // a. Let next be ? IteratorStep(iteratorRecord).
6489                                 var next = IteratorStep(iteratorRecord);
6490                                 // b. If next is false, return set.
6491                                 if (next === false) {
6492                                         return set;
6493                                 }
6494                                 // c. Let nextValue be ? IteratorValue(next).
6495                                 var nextValue = IteratorValue(next);
6496                                 // d. Let status be Call(adder, set, « nextValue »).
6497                                 try {
6498                                         Call(adder, set, [nextValue]);
6499                                 } catch (e) {
6500                                         // e. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
6501                                         return IteratorClose(iteratorRecord, e);
6502                                 }
6503                         }
6504                 } catch (e) {
6505                         // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
6506                         if (IsArray(iterable) ||
6507                                 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
6508                                 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
6509                                 (!!iterable.callee)) {
6510                                 var index;
6511                                 var length = iterable.length;
6512                                 for (index = 0; index < length; index++) {
6513                                         Call(adder, set, [iterable[index]]);
6514                                 }
6515                         }
6516                 }
6517                 return set;
6518         };
6519
6520         // 23.4.2.1. WeakSet.prototype
6521         // The initial value of WeakSet.prototype is the intrinsic %WeakSetPrototype% object.
6522         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
6523         Object.defineProperty(WeakSet, 'prototype', {
6524                 configurable: false,
6525                 enumerable: false,
6526                 writable: false,
6527                 value: {}
6528         });
6529
6530         // 23.4.3.1. WeakSet.prototype.add ( value )
6531         CreateMethodProperty(WeakSet.prototype, 'add', function add(value) {
6532                 // 1. Let S be the this value.
6533                 var S = this;
6534                 // 2. If Type(S) is not Object, throw a TypeError exception.
6535                 if (Type(S) !== 'object') {
6536                         throw new TypeError('Method WeakSet.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
6537                 }
6538                 // 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError exception.
6539                 if (S._es6WeakSet !== true) {
6540                         throw new TypeError('Method WeakSet.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
6541                 }
6542                 // 4. If Type(value) is not Object, throw a TypeError exception.
6543                 if (Type(value) !== 'object') {
6544                         throw new TypeError('Invalid value used in weak set');
6545                 }
6546                 // 5. Let entries be the List that is S.[[WeakSetData]].
6547                 var entries = S._values;
6548                 // 6. For each e that is an element of entries, do
6549                 for (var i = 0; i < entries.length; i++) {
6550                         var e = entries[i];
6551                         // a. If e is not empty and SameValue(e, value) is true, then
6552                         if (e !== undefMarker && SameValueZero(e, value)) {
6553                                 // i. Return S.
6554                                 return S;
6555                         }
6556                 }
6557                 // 7. Append value as the last element of entries.
6558                 S._values.push(value);
6559                 // 8. Return S.
6560                 return S;
6561         });
6562
6563         // 23.4.3.2. WeakSet.prototype.constructor
6564         CreateMethodProperty(WeakSet.prototype, 'constructor', WeakSet);
6565
6566         // 23.4.3.3. WeakSet.prototype.delete ( value )
6567         CreateMethodProperty(WeakSet.prototype, 'delete', function (value) {
6568                 // 1. Let S be the this value.
6569                 var S = this;
6570                 // 2. If Type(S) is not Object, throw a TypeError exception.
6571                 if (Type(S) !== 'object') {
6572                         throw new TypeError('Method WeakSet.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
6573                 }
6574                 // 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError exception.
6575                 if (S._es6WeakSet !== true) {
6576                         throw new TypeError('Method WeakSet.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
6577                 }
6578                 // 4. If Type(value) is not Object, return false.
6579                 if (Type(value) !== 'object') {
6580                         return false;
6581                 }
6582                 // 5. Let entries be the List that is S.[[WeakSetData]].
6583                 var entries = S._values;
6584                 // 6. For each e that is an element of entries, do
6585                 for (var i = 0; i < entries.length; i++) {
6586                         var e = entries[i];
6587                         // a. If e is not empty and SameValue(e, value) is true, then
6588                         if (e !== undefMarker && SameValueZero(e, value)) {
6589                                 // i. Replace the element of entries whose value is e with an element whose value is empty.
6590                                 entries[i] = undefMarker;
6591                                 // ii. Return true.
6592                                 return true;
6593                         }
6594                 }
6595                 // 7. Return false.
6596                 return false;
6597         });
6598
6599         // 23.4.3.4. WeakSet.prototype.has ( value )
6600         CreateMethodProperty(WeakSet.prototype, 'has', function has(value) {
6601                 // 1. Let S be the this value.
6602                 var S = this;
6603                 // 2. If Type(S) is not Object, throw a TypeError exception.
6604                 if (Type(S) !== 'object') {
6605                         throw new TypeError('Method WeakSet.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(S));
6606                 }
6607                 // 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError exception.
6608                 if (S._es6WeakSet !== true) {
6609                         throw new TypeError('Method WeakSet.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(S));
6610                 }
6611                 // 4. Let entries be the List that is S.[[WeakSetData]].
6612                 var entries = S._values;
6613                 // 5. If Type(value) is not Object, return false.
6614                 if (Type(value) !== 'object') {
6615                         return false;
6616                 }
6617                 // 6. For each e that is an element of entries, do
6618                 for (var i = 0; i < entries.length; i++) {
6619                         var e = entries[i];
6620                         // a. If e is not empty and SameValue(e, value) is true, return true.
6621                         if (e !== undefMarker && SameValueZero(e, value)) {
6622                                 return true;
6623                         }
6624                 }
6625                 // 7. Return false.
6626                 return false;
6627         });
6628
6629         // 23.4.3.5. WeakSet.prototype [ @@toStringTag ]
6630         // The initial value of the @@toStringTag property is the String value "WeakSet".
6631         // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
6632
6633         // Polyfill.io - Safari 8 implements Set.name but as a non-configurable property, which means it would throw an error if we try and configure it here.
6634         if (!('name' in WeakSet)) {
6635                 // 19.2.4.2 name
6636                 Object.defineProperty(WeakSet, 'name', {
6637                         configurable: true,
6638                         enumerable: false,
6639                         writable: false,
6640                         value: 'WeakSet'
6641                 });
6642         }
6643
6644         // Export the object
6645         try {
6646                 CreateMethodProperty(global, 'WeakSet', WeakSet);
6647         } catch (e) {
6648                 // IE8 throws an error here if we set enumerable to false.
6649                 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
6650                 global['WeakSet'] = WeakSet;
6651         }
6652
6653 }(this));
6654
6655 }
6656
6657 })
6658 .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});