[
  {
    "path": ".gitignore",
    "content": "node_modules\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n    \"es6-css-minify.hideButton\": \"auto\",\n    \"es6-css-minify.js.mangle\": true,\n    \"es6-css-minify.js.compress\": true\n}"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2020 Siderite\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "LInQer.Enumerable.ts",
    "content": "/// <reference path=\"./LInQer.Slim.ts\" />\n\nnamespace Linqer {\n\n\texport interface Enumerable extends Iterable<any> {\n\t\t/**\n\t\t * Applies an accumulator function over a sequence.\n\t\t * The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.\n\t\t *\n\t\t * @param {*} accumulator\n\t\t * @param {(acc: any, item: any) => any} aggregator\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\taggregate(accumulator: any, aggregator: (acc: any, item: any) => any): any;\n\t\t/**\n\t\t * Determines whether all elements of a sequence satisfy a condition.\n\t\t * @param condition \n\t\t * @returns true if all \n\t\t */\n\t\tall(condition: IFilter): boolean;\n\t\t/**\n\t\t * Determines whether any element of a sequence exists or satisfies a condition.\n\t\t *\n\t\t * @param {IFilter} condition\n\t\t * @returns {boolean}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tany(condition: IFilter): boolean;\n\t\t/**\n\t\t * Appends a value to the end of the sequence.\n\t\t *\n\t\t * @param {*} item\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tappend(item: any): Enumerable;\n\t\t/**\n\t\t * Computes the average of a sequence of numeric values.\n\t\t *\n\t\t * @returns {(number | undefined)}\n\t\t * @memberof Enumerable\n\t\t */\n\t\taverage(): number | undefined;\n\t\t/**\n\t\t * Returns itself\n\t\t *\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tasEnumerable(): Enumerable;\n\t\t/**\n \t\t * Checks the elements of a sequence based on their type\n\t\t *  If type is a string, it will check based on typeof, else it will use instanceof.\n\t\t *  Throws if types are different.\n\t\t * @param {(string | Function)} type\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tcast(type: string | Function): Enumerable;\n\t\t/**\n\t\t * Determines whether a sequence contains a specified element.\n\t\t * A custom function can be used to determine equality between elements.\n\t\t *\n\t\t * @param {*} item\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {boolean}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tcontains(item: any, equalityComparer: IEqualityComparer): boolean;\n\n\t\tdefaultIfEmpty(): never;\n\n\t\t/**\n\t\t * Produces the set difference of two sequences\n\t\t * WARNING: using the comparer is slower\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\texcept(iterable: IterableType, equalityComparer: IEqualityComparer): Enumerable;\n\t\t/**\n\t\t * Produces the set intersection of two sequences.\n\t\t * WARNING: using a comparer is slower\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tintersect(iterable: IterableType, equalityComparer: IEqualityComparer): Enumerable;\n\t\t/**\n\t\t * Same as count\n\t\t *\n\t\t * @returns {number}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tlongCount(): number;\n\t\t/**\n\t\t * Filters the elements of a sequence based on their type\n\t\t * If type is a string, it will filter based on typeof, else it will use instanceof\n\t\t *\n\t\t * @param {(string | Function)} type\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tofType(type: string | Function): Enumerable;\n\t\t/**\n\t\t * Adds a value to the beginning of the sequence.\n\t\t *\n\t\t * @param {*} item\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tprepend(item: any): Enumerable;\n\t\t/**\n\t\t * Inverts the order of the elements in a sequence.\n\t\t *\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\treverse(): Enumerable;\n\t\t/**\n\t\t * Projects each element of a sequence to an iterable and flattens the resulting sequences into one sequence.\n\t\t *\n\t\t * @param {ISelector<IterableType>} selector\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tselectMany(selector: ISelector<IterableType>): Enumerable;\n\t\t/**\n\t\t * Determines whether two sequences are equal and in the same order according to an optional equality comparer.\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {boolean}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tsequenceEqual(iterable: IterableType, equalityComparer: IEqualityComparer): boolean;\n\t\t/**\n\t\t * Returns the single element of a sequence and throws if it doesn't have exactly one\n\t\t *\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tsingle(): any;\n\t\t/**\n\t\t * Returns the single element of a sequence or undefined if none found. It throws if the sequence contains multiple items.\n\t\t *\n\t\t * @returns {(any | undefined)}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tsingleOrDefault(): any | undefined;\n\t\t/**\n\t\t * Returns a new enumerable collection that contains the elements from source with the last nr elements of the source collection omitted.\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tskipLast(nr: number): Enumerable;\n\t\t/**\n\t\t * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.\n\t\t *\n\t\t * @param {IFilter} condition\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tskipWhile(condition: IFilter): Enumerable;\n\n\t\t/**\n\t\t * Selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.\n\t\t * @param start \n\t\t * @param end \n\t\t * @returns slice \n\t\t */\n\t\tslice(start: number | undefined, end: number | undefined) : Enumerable;\n\n\t\t/**\n\t\t * Returns a new enumerable collection that contains the last nr elements from source.\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttakeLast(nr: number): Enumerable;\n\t\t/**\n\t\t * Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.\n\t\t *\n\t\t * @param {IFilter} condition\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttakeWhile(condition: IFilter): Enumerable;\n\t\ttoDictionary(): never;\n\t\t/**\n\t\t * creates a Map from an Enumerable\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @param {ISelector} valueSelector\n\t\t * @returns {Map<any, any>}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttoMap(keySelector: ISelector, valueSelector: ISelector): Map<any, any>;\n\t\t/**\n\t\t * creates an object from an Enumerable\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @param {ISelector} valueSelector\n\t\t * @returns {{ [key: string]: any }}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttoObject(keySelector: ISelector, valueSelector: ISelector): { [key: string]: any };\n\t\ttoHashSet(): never;\n\t\t/**\n\t\t * creates a Set from an enumerable\n\t\t *\n\t\t * @returns {Set<any>}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttoSet(): Set<any>;\n\t\t/**\n\t\t * Produces the set union of two sequences.\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tunion(iterable: IterableType, equalityComparer: IEqualityComparer): Enumerable;\n\t\t/**\n\t\t * Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {(item1: any, item2: any, index: number) => any} zipper\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tzip(iterable: IterableType, zipper: (item1: any, item2: any, index: number) => any): any;\n\n\t}\n\n\t/// Applies an accumulator function over a sequence.\n\t/// The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.\n\tEnumerable.prototype.aggregate = function (accumulator: any, aggregator: (acc: any, item: any) => any): any {\n\t\t_ensureFunction(aggregator);\n\t\tfor (const item of this) {\n\t\t\taccumulator = aggregator(accumulator, item);\n\t\t}\n\t\treturn accumulator;\n\t}\n\n\t/// Determines whether all elements of a sequence satisfy a condition.\n\tEnumerable.prototype.all = function (condition: IFilter): boolean {\n\t\t_ensureFunction(condition);\n\t\treturn !this.any(x => !condition(x));\n\t}\n\n\t/// Determines whether any element of a sequence exists or satisfies a condition.\n\tEnumerable.prototype.any = function (condition: IFilter): boolean {\n\t\t_ensureFunction(condition);\n\t\tlet index = 0;\n\t\tfor (const item of this) {\n\t\t\tif (condition(item, index)) return true;\n\t\t\tindex++;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/// Appends a value to the end of the sequence.\n\tEnumerable.prototype.append = function (item: any): Enumerable {\n\t\treturn this.concat([item]);\n\t}\n\n\t/// Computes the average of a sequence of numeric values.\n\tEnumerable.prototype.average = function (): number | undefined {\n\t\tconst stats = this.sumAndCount();\n\t\treturn stats.count === 0\n\t\t\t? undefined\n\t\t\t: stats.sum / stats.count;\n\t}\n\n\t/// Returns the same enumerable\n\tEnumerable.prototype.asEnumerable = function (): Enumerable {\n\t\treturn this;\n\t}\n\n\t/// Checks the elements of a sequence based on their type\n\t/// If type is a string, it will check based on typeof, else it will use instanceof.\n\t/// Throws if types are different.\n\tEnumerable.prototype.cast = function (type: string | Function): Enumerable {\n\t\tconst f: ((x: any) => boolean) = typeof type === 'string'\n\t\t\t? x => typeof x === type\n\t\t\t: x => x instanceof type;\n\t\treturn this.select(item => {\n\t\t\tif (!f(item)) throw new Error(item + ' not of type ' + type);\n\t\t\treturn item;\n\t\t});\n\t}\n\n\t/// Determines whether a sequence contains a specified element.\n\t/// A custom function can be used to determine equality between elements.\n\tEnumerable.prototype.contains = function (item: any, equalityComparer: IEqualityComparer = EqualityComparer.default): boolean {\n\t\t_ensureFunction(equalityComparer);\n\t\treturn this.any(x => equalityComparer(x, item));\n\t}\n\n\tEnumerable.prototype.defaultIfEmpty = function (): never {\n\t\tthrow new Error('defaultIfEmpty not implemented for Javascript');\n\t}\n\n\t/// Produces the set difference of two sequences WARNING: using the comparer is slower\n\tEnumerable.prototype.except = function (iterable: IterableType, equalityComparer: IEqualityComparer = EqualityComparer.default): Enumerable {\n\t\t_ensureIterable(iterable);\n\t\tconst self: Enumerable = this;\n\t\t// use a Set for performance if the comparer is not set\n\t\tconst gen = equalityComparer === EqualityComparer.default\n\t\t\t? function* () {\n\t\t\t\tconst distinctValues = Enumerable.from(iterable).toSet();\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tif (!distinctValues.has(item)) yield item;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// use exceptByHash from Linqer.extra for better performance\n\t\t\t: function* () {\n\t\t\t\tconst values = _toArray(iterable);\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tlet unique = true;\n\t\t\t\t\tfor (let i=0; i<values.length; i++) {\n\t\t\t\t\t\tif (equalityComparer(item, values[i])) {\n\t\t\t\t\t\t\tunique = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (unique) yield item;\n\t\t\t\t}\n\t\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\t/// Produces the set intersection of two sequences. WARNING: using a comparer is slower\n\tEnumerable.prototype.intersect = function (iterable: IterableType, equalityComparer: IEqualityComparer = EqualityComparer.default): Enumerable {\n\t\t_ensureIterable(iterable);\n\t\tconst self: Enumerable = this;\n\t\t// use a Set for performance if the comparer is not set\n\t\tconst gen = equalityComparer === EqualityComparer.default\n\t\t\t? function* () {\n\t\t\t\tconst distinctValues = new Set(Enumerable.from(iterable));\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tif (distinctValues.has(item)) yield item;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// use intersectByHash from Linqer.extra for better performance\n\t\t\t: function* () {\n\t\t\t\tconst values = _toArray(iterable);\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tlet unique = true;\n\t\t\t\t\tfor (let i=0; i<values.length; i++) {\n\t\t\t\t\t\tif (equalityComparer(item, values[i])) {\n\t\t\t\t\t\t\tunique = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!unique) yield item;\n\t\t\t\t}\n\t\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\t/// same as count\n\tEnumerable.prototype.longCount = function (): number {\n\t\treturn this.count();\n\t}\n\n\t/// Filters the elements of a sequence based on their type\n\t/// If type is a string, it will filter based on typeof, else it will use instanceof\n\tEnumerable.prototype.ofType = function (type: string | Function): Enumerable {\n\t\tconst condition: IFilter =\n\t\t\ttypeof type === 'string'\n\t\t\t\t? x => typeof x === type\n\t\t\t\t: x => x instanceof type;\n\t\treturn this.where(condition);\n\t}\n\n\t/// Adds a value to the beginning of the sequence.\n\tEnumerable.prototype.prepend = function (item: any): Enumerable {\n\t\treturn new Enumerable([item]).concat(this);\n\t}\n\n\t/// Inverts the order of the elements in a sequence.\n\tEnumerable.prototype.reverse = function (): Enumerable {\n\t\t_ensureInternalTryGetAt(this);\n\t\tconst self: Enumerable = this;\n\t\t// if it can seek, just read the enumerable backwards\n\t\tconst gen = this._canSeek\n\t\t\t? function* () {\n\t\t\t\tconst length = self.count();\n\t\t\t\tfor (let index = length - 1; index >= 0; index--) {\n\t\t\t\t\tyield self.elementAt(index);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// else enumerate it all into an array, then read it backwards\n\t\t\t: function* () {\n\t\t\t\tconst arr = self.toArray();\n\t\t\t\tfor (let index = arr.length - 1; index >= 0; index--) {\n\t\t\t\t\tyield arr[index];\n\t\t\t\t}\n\t\t\t};\n\t\t// the count is the same when reversed\n\t\tconst result = new Enumerable(gen);\n\t\t_ensureInternalCount(this);\n\t\tresult._count = this._count;\n\t\t_ensureInternalTryGetAt(this);\n\t\t// have a custom indexer only if the original enumerable could seek\n\t\tif (this._canSeek) {\n\t\t\tconst self = this;\n\t\t\tresult._canSeek = true;\n\t\t\tresult._tryGetAt = index => self._tryGetAt!(self.count() - index - 1);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/// Projects each element of a sequence to an iterable and flattens the resulting sequences into one sequence.\n\tEnumerable.prototype.selectMany = function (selector: ISelector<IterableType>): Enumerable {\n\t\tif (typeof selector !== 'undefined') {\n\t\t\t_ensureFunction(selector);\n\t\t} else {\n\t\t\tselector = x => x;\n\t\t}\n\t\tconst self: Enumerable = this;\n\t\tconst gen = function* () {\n\t\t\tlet index = 0;\n\t\t\tfor (const item of self) {\n\t\t\t\tconst iter = selector(item, index);\n\t\t\t\t_ensureIterable(iter);\n\t\t\t\tfor (const child of iter) {\n\t\t\t\t\tyield child;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\t/// Determines whether two sequences are equal and in the same order according to an equality comparer.\n\tEnumerable.prototype.sequenceEqual = function (iterable: IterableType, equalityComparer: IEqualityComparer = EqualityComparer.default): boolean {\n\t\t_ensureIterable(iterable);\n\t\t_ensureFunction(equalityComparer);\n\t\tconst iterator1 = this[Symbol.iterator]();\n\t\tconst iterator2 = Enumerable.from(iterable)[Symbol.iterator]();\n\t\tlet done = false;\n\t\tdo {\n\t\t\tconst val1 = iterator1.next();\n\t\t\tconst val2 = iterator2.next();\n\t\t\tconst equal = (val1.done && val2.done) || (!val1.done && !val2.done && equalityComparer(val1.value, val2.value));\n\t\t\tif (!equal) return false;\n\t\t\tdone = !!val1.done;\n\t\t} while (!done);\n\t\treturn true;\n\t}\n\n\t/// Returns the single element of a sequence and throws if it doesn't have exactly one\n\tEnumerable.prototype.single = function (): any {\n\t\tconst iterator = this[Symbol.iterator]();\n\t\tlet val = iterator.next();\n\t\tif (val.done) throw new Error('Sequence contains no elements');\n\t\tconst result = val.value;\n\t\tval = iterator.next();\n\t\tif (!val.done) throw new Error('Sequence contains more than one element');\n\t\treturn result;\n\t}\n\n\t/// Returns the single element of a sequence or undefined if none found. It throws if the sequence contains multiple items.\n\tEnumerable.prototype.singleOrDefault = function (): any | undefined {\n\t\tconst iterator = this[Symbol.iterator]();\n\t\tlet val = iterator.next();\n\t\tif (val.done) return undefined;\n\t\tconst result = val.value;\n\t\tval = iterator.next();\n\t\tif (!val.done) throw new Error('Sequence contains more than one element');\n\t\treturn result;\n\t}\n\n\t/// Selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.\n\tEnumerable.prototype.slice = function (start: number = 0, end: number | undefined): Enumerable {\n\t\tlet enumerable: Enumerable = this;\n\t\t// when the end is defined and positive and start is negative,\n\t\t// the only way to compute the last index is to know the count\n\t\tif (end !== undefined && end >= 0 && (start || 0) < 0) {\n\t\t\tenumerable = enumerable.toList();\n\t\t\tstart = enumerable.count() + start;\n\t\t}\n\t\tif (start !== 0) {\n\t\t\tif (start > 0) {\n\t\t\t\tenumerable = enumerable.skip(start);\n\t\t\t} else {\n\t\t\t\tenumerable = enumerable.takeLast(-start);\n\t\t\t}\n\t\t}\n\t\tif (end !== undefined) {\n\t\t\tif (end >= 0) {\n\t\t\t\tenumerable = enumerable.take(end - start);\n\t\t\t} else {\n\t\t\t\tenumerable = enumerable.skipLast(-end);\n\t\t\t}\n\t\t}\n\t\treturn enumerable;\n\t}\n\n\t/// Returns a new enumerable collection that contains the elements from source with the last nr elements of the source collection omitted.\n\tEnumerable.prototype.skipLast = function (nr: number): Enumerable {\n\t\tconst self: Enumerable = this;\n\t\t// the generator is using a buffer to cache nr values \n\t\t// and only yields the values that overflow from it\n\t\tconst gen = function* () {\n\t\t\tlet nrLeft = nr;\n\t\t\tconst buffer = Array(nrLeft);\n\t\t\tlet index = 0;\n\t\t\tlet offset = 0;\n\t\t\tfor (const item of self) {\n\t\t\t\tconst value = buffer[index - offset];\n\t\t\t\tbuffer[index - offset] = item;\n\t\t\t\tindex++;\n\t\t\t\tif (index - offset >= nrLeft) {\n\t\t\t\t\toffset += nrLeft;\n\t\t\t\t}\n\t\t\t\tif (index > nrLeft) {\n\t\t\t\t\tyield value;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer.length = 0;\n\t\t};\n\t\tconst result = new Enumerable(gen);\n\n\t\t// the count is the original count minus the skipped items and at least 0  \n\t\tresult._count = () => Math.max(0, self.count() - nr);\n\t\t_ensureInternalTryGetAt(this);\n\t\tresult._canSeek = this._canSeek;\n\t\t// it has an indexer only if the original enumerable can seek\n\t\tif (this._canSeek) {\n\t\t\tresult._tryGetAt = index => {\n\t\t\t\tif (index >= result.count()) return null;\n\t\t\t\treturn self._tryGetAt!(index);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\n\t/// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.\n\tEnumerable.prototype.skipWhile = function (condition: IFilter): Enumerable {\n\t\t_ensureFunction(condition);\n\t\tconst self: Enumerable = this;\n\t\tlet skip = true;\n\t\tconst gen = function* () {\n\t\t\tlet index = 0;\n\t\t\tfor (const item of self) {\n\t\t\t\tif (skip && !condition(item, index)) {\n\t\t\t\t\tskip = false;\n\t\t\t\t}\n\t\t\t\tif (!skip) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\t/// Returns a new enumerable collection that contains the last nr elements from source.\n\tEnumerable.prototype.takeLast = function (nr: number): Enumerable {\n\t\t_ensureInternalTryGetAt(this);\n\t\tconst self: Enumerable = this;\n\t\tconst gen = this._canSeek\n\t\t\t// taking the last items is easy if the enumerable can seek\n\t\t\t? function* () {\n\t\t\t\tlet nrLeft = nr;\n\t\t\t\tconst length = self.count();\n\t\t\t\tfor (let index = length - nrLeft; index < length; index++) {\n\t\t\t\t\tyield self.elementAt(index);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// else the generator uses a buffer to fill with values\n\t\t\t// and yields them after the entire thing has been iterated\n\t\t\t: function* () {\n\t\t\t\tlet nrLeft = nr;\n\t\t\t\tlet index = 0;\n\t\t\t\tconst buffer = Array(nrLeft);\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tbuffer[index % nrLeft] = item;\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < nrLeft && i < index; i++) {\n\t\t\t\t\tyield buffer[(index + i) % nrLeft];\n\t\t\t\t}\n\t\t\t};\n\t\tconst result = new Enumerable(gen);\n\n\t\t// the count is the minimum between nr and the enumerable count\n\t\tresult._count = () => Math.min(nr, self.count());\n\t\tresult._canSeek = self._canSeek;\n\t\t// this can seek only if the original enumerable could seek\n\t\tif (self._canSeek) {\n\t\t\tresult._tryGetAt = index => {\n\t\t\t\tif (index < 0 || index >= result.count()) return null;\n\t\t\t\treturn self._tryGetAt!(self.count() - nr + index);\n\t\t\t};\n\t\t}\n\t\treturn result;\n\t}\n\n\t/// Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.\n\tEnumerable.prototype.takeWhile = function (condition: IFilter): Enumerable {\n\t\t_ensureFunction(condition);\n\t\tconst self: Enumerable = this;\n\t\tconst gen = function* () {\n\t\t\tlet index = 0;\n\t\t\tfor (const item of self) {\n\t\t\t\tif (condition(item, index)) {\n\t\t\t\t\tyield item;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\tEnumerable.prototype.toDictionary = function (): never {\n\t\tthrow new Error('use toMap or toObject instead of toDictionary');\n\t}\n\n\t/// creates a map from an Enumerable\n\tEnumerable.prototype.toMap = function (keySelector: ISelector, valueSelector: ISelector = x => x): Map<any, any> {\n\t\t_ensureFunction(keySelector);\n\t\t_ensureFunction(valueSelector);\n\t\tconst result = new Map<any, any>();\n\t\tlet index = 0;\n\t\tfor (const item of this) {\n\t\t\tresult.set(keySelector(item, index), valueSelector(item, index));\n\t\t\tindex++;\n\t\t}\n\t\treturn result;\n\t}\n\n\t/// creates an object from an enumerable\n\tEnumerable.prototype.toObject = function (keySelector: ISelector, valueSelector: ISelector = x => x): { [key: string]: any } {\n\t\t_ensureFunction(keySelector);\n\t\t_ensureFunction(valueSelector);\n\t\tconst result: { [key: string]: any } = {};\n\t\tlet index = 0;\n\t\tfor (const item of this) {\n\t\t\tresult[keySelector(item, index)] = valueSelector(item);\n\t\t\tindex++;\n\t\t}\n\t\treturn result;\n\t}\n\n\tEnumerable.prototype.toHashSet = function (): never {\n\t\tthrow new Error('use toSet instead of toHashSet');\n\t}\n\n\t/// creates a set from an enumerable\n\tEnumerable.prototype.toSet = function (): Set<any> {\n\t\tconst result = new Set<any>();\n\t\tfor (const item of this) {\n\t\t\tresult.add(item);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/// Produces the set union of two sequences.\n\tEnumerable.prototype.union = function (iterable: IterableType, equalityComparer: IEqualityComparer = EqualityComparer.default): Enumerable {\n\t\t_ensureIterable(iterable);\n\t\treturn this.concat(iterable).distinct(equalityComparer);\n\t}\n\n\t/// Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.\n\tEnumerable.prototype.zip = function (iterable: IterableType, zipper: (item1: any, item2: any, index: number) => any): any {\n\t\t_ensureIterable(iterable);\n\t\tif (!zipper) {\n\t\t\tzipper = (i1,i2)=>[i1,i2];\n\t\t} else {\n\t\t\t_ensureFunction(zipper);\n\t\t}\n\t\tconst self: Enumerable = this;\n\t\tconst gen = function* () {\n\t\t\tlet index = 0;\n\t\t\tconst iterator1 = self[Symbol.iterator]();\n\t\t\tconst iterator2 = Enumerable.from(iterable)[Symbol.iterator]();\n\t\t\tlet done = false;\n\t\t\tdo {\n\t\t\t\tconst val1 = iterator1.next();\n\t\t\t\tconst val2 = iterator2.next();\n\t\t\t\tdone = !!(val1.done || val2.done);\n\t\t\t\tif (!done) {\n\t\t\t\t\tyield zipper(val1.value, val2.value, index);\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t} while (!done);\n\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n}"
  },
  {
    "path": "LInQer.GroupEnumerable.ts",
    "content": "/// <reference path=\"./LInQer.Slim.ts\" />\n\nnamespace Linqer {\n\n\texport interface Enumerable extends Iterable<any> {\n\t\t/**\n\t\t * Groups the elements of a sequence.\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tgroupBy(keySelector: ISelector): Enumerable;\n\t\t/**\n\t\t * Correlates the elements of two sequences based on key equality and groups the results. A specified equalityComparer is used to compare keys.\n\t\t * WARNING: using the equality comparer will be slower\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {ISelector} innerKeySelector\n\t\t * @param {ISelector} outerKeySelector\n\t\t * @param {(item1: any, item2: any) => any} resultSelector\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tgroupJoin(iterable: IterableType,\n\t\t\tinnerKeySelector: ISelector,\n\t\t\touterKeySelector: ISelector,\n\t\t\tresultSelector: (item1: any, item2: any) => any,\n\t\t\tequalityComparer: IEqualityComparer): Enumerable;\n\t\t/**\n\t\t * Correlates the elements of two sequences based on matching keys.\n\t\t * WARNING: using the equality comparer will be slower\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @param {ISelector} innerKeySelector\n\t\t * @param {ISelector} outerKeySelector\n\t\t * @param {(item1: any, item2: any) => any} resultSelector\n\t\t * @param {IEqualityComparer} equalityComparer\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tjoin(iterable: IterableType,\n\t\t\tinnerKeySelector: ISelector,\n\t\t\touterKeySelector: ISelector,\n\t\t\tresultSelector: (item1: any, item2: any) => any,\n\t\t\tequalityComparer: IEqualityComparer): Enumerable;\n\t\ttoLookup(): never;\n\t}\n\n\n\t/// Groups the elements of a sequence.\n\tEnumerable.prototype.groupBy = function (keySelector: ISelector): Enumerable {\n\t\t_ensureFunction(keySelector);\n\t\tconst self: Enumerable = this;\n\t\tconst gen = function* () {\n\t\t\tconst groupMap = new Map<any, any>();\n\t\t\tlet index = 0;\n\t\t\t// iterate all items and group them in a Map\n\t\t\tfor (const item of self) {\n\t\t\t\tconst key = keySelector(item, index);\n\t\t\t\tconst group = groupMap.get(key);\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.push(item);\n\t\t\t\t} else {\n\t\t\t\t\tgroupMap.set(key, [item]);\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\t// then yield a GroupEnumerable for each group\n\t\t\tfor (const [key, items] of groupMap) {\n\t\t\t\tconst group = new GroupEnumerable(items, key);\n\t\t\t\tyield group;\n\t\t\t}\n\t\t};\n\t\tconst result = new Enumerable(gen);\n\t\treturn result;\n\t}\n\n\t/// Correlates the elements of two sequences based on key equality and groups the results. A specified equalityComparer is used to compare keys.\n\t/// WARNING: using the equality comparer will be slower\n\tEnumerable.prototype.groupJoin = function (iterable: IterableType,\n\t\tinnerKeySelector: ISelector,\n\t\touterKeySelector: ISelector,\n\t\tresultSelector: (item1: any, item2: any) => any,\n\t\tequalityComparer: IEqualityComparer = EqualityComparer.default): Enumerable {\n\n\t\tconst self: Enumerable = this;\n\t\tconst gen = equalityComparer === EqualityComparer.default\n\t\t\t? function* () {\n\t\t\t\tconst lookup = new Enumerable(iterable)\n\t\t\t\t\t.groupBy(outerKeySelector)\n\t\t\t\t\t.toMap(g => g.key, g => g);\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (const innerItem of self) {\n\t\t\t\t\tconst arr = _toArray(lookup.get(innerKeySelector(innerItem, index)));\n\t\t\t\t\tyield resultSelector(innerItem, arr);\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t: function* () {\n\t\t\t\tlet innerIndex = 0;\n\t\t\t\tfor (const innerItem of self) {\n\t\t\t\t\tconst arr = [];\n\t\t\t\t\tlet outerIndex = 0;\n\t\t\t\t\tfor (const outerItem of Enumerable.from(iterable)) {\n\t\t\t\t\t\tif (equalityComparer(innerKeySelector(innerItem, innerIndex), outerKeySelector(outerItem, outerIndex))) {\n\t\t\t\t\t\t\tarr.push(outerItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t\touterIndex++;\n\t\t\t\t\t}\n\t\t\t\t\tyield resultSelector(innerItem, arr);\n\t\t\t\t\tinnerIndex++;\n\t\t\t\t}\n\t\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\t/// Correlates the elements of two sequences based on matching keys.\n\t/// WARNING: using the equality comparer will be slower\n\tEnumerable.prototype.join = function (iterable: IterableType,\n\t\tinnerKeySelector: ISelector,\n\t\touterKeySelector: ISelector,\n\t\tresultSelector: (item1: any, item2: any) => any,\n\t\tequalityComparer: IEqualityComparer = EqualityComparer.default): Enumerable {\n\t\tconst self: Enumerable = this;\n\t\tconst gen = equalityComparer === EqualityComparer.default\n\t\t\t? function* () {\n\t\t\t\tconst lookup = new Enumerable(iterable)\n\t\t\t\t\t.groupBy(outerKeySelector)\n\t\t\t\t\t.toMap(g => g.key, g => g);\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (const innerItem of self) {\n\t\t\t\t\tconst group = lookup.get(innerKeySelector(innerItem, index));\n\t\t\t\t\tif (group) {\n\t\t\t\t\t\tfor (const outerItem of group) {\n\t\t\t\t\t\t\tyield resultSelector(innerItem, outerItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t: function* () {\n\t\t\t\tlet innerIndex = 0;\n\t\t\t\tfor (const innerItem of self) {\n\t\t\t\t\tlet outerIndex = 0;\n\t\t\t\t\tfor (const outerItem of Enumerable.from(iterable)) {\n\t\t\t\t\t\tif (equalityComparer(innerKeySelector(innerItem, innerIndex), outerKeySelector(outerItem, outerIndex))) {\n\t\t\t\t\t\t\tyield resultSelector(innerItem, outerItem);\n\t\t\t\t\t\t}\n\t\t\t\t\t\touterIndex++;\n\t\t\t\t\t}\n\t\t\t\t\tinnerIndex++;\n\t\t\t\t}\n\t\t\t};\n\t\treturn new Enumerable(gen);\n\t}\n\n\n\tEnumerable.prototype.toLookup = function (): never {\n\t\tthrow new Error('use groupBy instead of toLookup');\n\t}\n\n\t/**\n\t * An Enumerable that also exposes a group key\n\t *\n\t * @export\n\t * @class GroupEnumerable\n\t * @extends {Enumerable}\n\t */\n\texport class GroupEnumerable extends Enumerable {\n\t\tkey: string;\n\t\tconstructor(iterable: IterableType, key: string) {\n\t\t\tsuper(iterable);\n\t\t\tthis.key = key;\n\t\t}\n\t}\n}"
  },
  {
    "path": "LInQer.OrderedEnumerable.ts",
    "content": "/// <reference path=\"./LInQer.Slim.ts\" />\nnamespace Linqer {\n\n\texport interface Enumerable extends Iterable<any> {\n\t\t/**\n\t\t * Sorts the elements of a sequence in ascending order.\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\torderBy(keySelector: ISelector): OrderedEnumerable;\n\t\t/**\n\t\t * Sorts the elements of a sequence in descending order.\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\torderByDescending(keySelector: ISelector): OrderedEnumerable;\n\t\t/**\n\t\t * use QuickSort for ordering (default). Recommended when take, skip, takeLast, skipLast are used after orderBy\n\t\t *\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tuseQuickSort(): Enumerable;\n\t\t/**\n\t\t * use the default browser sort implementation for ordering at all times\n\t\t *\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tuseBrowserSort(): Enumerable;\n\t}\n\n\n\t/// Sorts the elements of a sequence in ascending order.\n\tEnumerable.prototype.orderBy = function (keySelector: ISelector): OrderedEnumerable {\n\t\tif (keySelector) {\n\t\t\t_ensureFunction(keySelector);\n\t\t} else {\n\t\t\tkeySelector = item => item;\n\t\t}\n\t\treturn new OrderedEnumerable(this, keySelector, true);\n\t};\n\n\t/// Sorts the elements of a sequence in descending order.\n\tEnumerable.prototype.orderByDescending = function (keySelector: ISelector): OrderedEnumerable {\n\t\tif (keySelector) {\n\t\t\t_ensureFunction(keySelector);\n\t\t} else {\n\t\t\tkeySelector = item => item;\n\t\t}\n\t\treturn new OrderedEnumerable(this, keySelector, false);\n\t};\n\n\t/// use QuickSort for ordering (default). Recommended when take, skip, takeLast, skipLast are used after orderBy\n\tEnumerable.prototype.useQuickSort = function (): Enumerable {\n\t\tthis._useQuickSort = true;\n\t\treturn this;\n\t};\n\n\t/// use the default browser sort implementation for ordering at all times\n\tEnumerable.prototype.useBrowserSort = function (): Enumerable {\n\t\tthis._useQuickSort = false;\n\t\treturn this;\n\t};\n\n\n\t//static sort: (arr: any[], comparer?: IComparer) => void;\n\tEnumerable.sort = function (arr: any[], comparer: IComparer = _defaultComparer): any[] {\n\t\t_quickSort(arr, 0, arr.length - 1, comparer, 0, Number.MAX_SAFE_INTEGER);\n\t\treturn arr;\n\t}\n\n\tenum RestrictionType {\n\t\tskip,\n\t\tskipLast,\n\t\ttake,\n\t\ttakeLast\n\t}\n\n\t/**\n\t * An Enumerable yielding ordered items\n\t *\n\t * @export\n\t * @class OrderedEnumerable\n\t * @extends {Enumerable}\n\t */\n\texport class OrderedEnumerable extends Enumerable {\n\t\t_keySelectors: { keySelector: ISelector, ascending: boolean }[];\n\t\t_restrictions: { type: RestrictionType, nr: number }[];\n\n\t\t/**\n\t\t *Creates an instance of OrderedEnumerable.\n\t\t * @param {IterableType} src\n\t\t * @param {ISelector} [keySelector]\n\t\t * @param {boolean} [ascending=true]\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\tconstructor(src: IterableType,\n\t\t\tkeySelector?: ISelector,\n\t\t\tascending: boolean = true) {\n\t\t\tsuper(src);\n\t\t\tthis._keySelectors = [];\n\t\t\tthis._restrictions = [];\n\t\t\tif (keySelector) {\n\t\t\t\tthis._keySelectors.push({ keySelector: keySelector, ascending: ascending });\n\t\t\t}\n\t\t\tconst self: OrderedEnumerable = this;\n\t\t\t// generator gets an array of the original, \n\t\t\t// sorted inside the interval determined by functions such as skip, take, skipLast, takeLast\n\t\t\tthis._generator = function* () {\n\t\t\t\tlet { startIndex, endIndex, arr } = this.getSortedArray();\n\t\t\t\tif (arr) {\n\t\t\t\t\tfor (let index = startIndex; index < endIndex; index++) {\n\t\t\t\t\t\tyield arr[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// the count is the difference between the end and start indexes\n\t\t\t// if no skip/take functions were used, this will be the original count\n\t\t\tthis._count = () => {\n\t\t\t\tconst totalCount = Enumerable.from(self._src).count();\n\t\t\t\tconst { startIndex, endIndex } = this.getStartAndEndIndexes(self._restrictions, totalCount);\n\t\t\t\treturn endIndex - startIndex;\n\t\t\t};\n\t\t\t// an ordered enumerable cannot seek\n\t\t\tthis._canSeek=false;\n\t\t\tthis._tryGetAt = ()=>{ throw new Error('Ordered enumerables cannot seek'); };\n\t\t}\n\n\t\tprivate getSortedArray() {\n\t\t\tconst self = this;\n\t\t\tlet startIndex: number;\n\t\t\tlet endIndex: number;\n\t\t\tlet arr: any[] | null = null;\n\t\t\tconst innerEnumerable = self._src as Enumerable;\n\t\t\t_ensureInternalTryGetAt(innerEnumerable);\n\t\t\t// try to avoid enumerating the entire original into an array\n\t\t\tif (innerEnumerable._canSeek) {\n\t\t\t\t({ startIndex, endIndex } = self.getStartAndEndIndexes(self._restrictions, innerEnumerable.count()));\n\t\t\t} else {\n\t\t\t\tarr = Array.from(self._src);\n\t\t\t\t({ startIndex, endIndex } = self.getStartAndEndIndexes(self._restrictions, arr.length));\n\t\t\t}\n\t\t\tif (startIndex < endIndex) {\n\t\t\t\tif (!arr) {\n\t\t\t\t\tarr = Array.from(self._src);\n\t\t\t\t}\n\t\t\t\t// only quicksort supports partial ordering inside an interval\n\t\t\t\tconst sort: (item1: any, item2: any) => void = self._useQuickSort\n\t\t\t\t\t? (a, c) => _quickSort(a, 0, a.length - 1, c, startIndex, endIndex)\n\t\t\t\t\t: (a, c) => a.sort(c);\n\t\t\t\tconst sortFunc = self.generateSortFunc(self._keySelectors);\n\t\t\t\tsort(arr, sortFunc);\n\t\t\t\treturn {\n\t\t\t\t\tstartIndex,\n\t\t\t\t\tendIndex,\n\t\t\t\t\tarr\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tstartIndex,\n\t\t\t\t\tendIndex,\n\t\t\t\t\tarr: null\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tprivate generateSortFunc(selectors: { keySelector: ISelector, ascending: boolean }[]): (i1: any, i2: any) => number {\n\t\t\t// simplify the selectors into an array of comparers\n\t\t\tconst comparers = selectors.map(s => {\n\t\t\t\tconst f = s.keySelector;\n\t\t\t\tconst comparer = (i1: any, i2: any) => {\n\t\t\t\t\tconst k1 = f(i1);\n\t\t\t\t\tconst k2 = f(i2);\n\t\t\t\t\tif (k1 > k2) return 1;\n\t\t\t\t\tif (k1 < k2) return -1;\n\t\t\t\t\treturn 0;\n\t\t\t\t};\n\t\t\t\treturn s.ascending\n\t\t\t\t\t? comparer\n\t\t\t\t\t: (i1: any, i2: any) => -comparer(i1, i2);\n\t\t\t});\n\t\t\t// optimize the resulting sort function in the most common case\n\t\t\t// (ordered by a single criterion)\n\t\t\treturn comparers.length == 1\n\t\t\t\t? comparers[0]\n\t\t\t\t: (i1: any, i2: any) => {\n\t\t\t\t\tfor (let i = 0; i < comparers.length; i++) {\n\t\t\t\t\t\tconst v = comparers[i](i1, i2);\n\t\t\t\t\t\tif (v) return v;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t};\n\t\t}\n\n\t\t/// calculate the interval in which an array needs to have ordered items for this ordered enumerable\n\t\tprivate getStartAndEndIndexes(restrictions: { type: RestrictionType, nr: number }[], arrLength: number) {\n\t\t\tlet startIndex = 0;\n\t\t\tlet endIndex = arrLength;\n\t\t\tfor (const restriction of restrictions) {\n\t\t\t\tswitch (restriction.type) {\n\t\t\t\t\tcase RestrictionType.take:\n\t\t\t\t\t\tendIndex = Math.min(endIndex, startIndex + restriction.nr);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase RestrictionType.skip:\n\t\t\t\t\t\tstartIndex = Math.min(endIndex, startIndex + restriction.nr);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase RestrictionType.takeLast:\n\t\t\t\t\t\tstartIndex = Math.max(startIndex, endIndex - restriction.nr);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase RestrictionType.skipLast:\n\t\t\t\t\t\tendIndex = Math.max(startIndex, endIndex - restriction.nr);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { startIndex, endIndex };\n\t\t}\n\n\n\t\t/**\n\t\t * Performs a subsequent ordering of the elements in a sequence in ascending order.\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\tthenBy(keySelector: ISelector): OrderedEnumerable {\n\t\t\tthis._keySelectors.push({ keySelector: keySelector, ascending: true });\n\t\t\treturn this;\n\t\t}\n\t\t/**\n\t\t * Performs a subsequent ordering of the elements in a sequence in descending order.\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\tthenByDescending(keySelector: ISelector): OrderedEnumerable {\n\t\t\tthis._keySelectors.push({ keySelector: keySelector, ascending: false });\n\t\t\treturn this;\n\t\t}\n\n\t\t/**\n\t\t * Deferred and optimized implementation of take\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\ttake(nr: number): OrderedEnumerable {\n\t\t\tthis._restrictions.push({ type: RestrictionType.take, nr: nr });\n\t\t\treturn this;\n\t\t}\n\n\t\t/**\n\t\t * Deferred and optimized implementation of takeLast\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\ttakeLast(nr: number): OrderedEnumerable {\n\t\t\tthis._restrictions.push({ type: RestrictionType.takeLast, nr: nr });\n\t\t\treturn this;\n\t\t}\n\n\t\t/**\n\t\t * Deferred and optimized implementation of skip\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\tskip(nr: number): OrderedEnumerable {\n\t\t\tthis._restrictions.push({ type: RestrictionType.skip, nr: nr });\n\t\t\treturn this;\n\t\t}\n\n\t\t/**\n\t\t * Deferred and optimized implementation of skipLast\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {OrderedEnumerable}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\tskipLast(nr: number): OrderedEnumerable {\n\t\t\tthis._restrictions.push({ type: RestrictionType.skipLast, nr: nr });\n\t\t\treturn this;\n\t\t}\n\n\n\t\t/**\n\t\t * An optimized implementation of toArray\n\t\t *\n\t\t * @returns {any[]}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\ttoArray(): any[] {\n\t\t\tconst { startIndex, endIndex, arr } = this.getSortedArray();\n\t\t\treturn arr\n\t\t\t\t? arr.slice(startIndex, endIndex)\n\t\t\t\t: [];\n\t\t}\n\n\n\t\t/**\n\t\t * An optimized implementation of toMap\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @param {ISelector} [valueSelector=x => x]\n\t\t * @returns {Map<any, any>}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\ttoMap(keySelector: ISelector, valueSelector: ISelector = x => x): Map<any, any> {\n\t\t\t_ensureFunction(keySelector);\n\t\t\t_ensureFunction(valueSelector);\n\t\t\tconst result = new Map<any, any>();\n\t\t\tconst arr = this.toArray();\n\t\t\tfor (let i = 0; i < arr.length; i++) {\n\t\t\t\tresult.set(keySelector(arr[i], i), valueSelector(arr[i], i));\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\n\t\t/**\n\t\t * An optimized implementation of toObject\n\t\t *\n\t\t * @param {ISelector} keySelector\n\t\t * @param {ISelector} [valueSelector=x => x]\n\t\t * @returns {{ [key: string]: any }}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\ttoObject(keySelector: ISelector, valueSelector: ISelector = x => x): { [key: string]: any } {\n\t\t\t_ensureFunction(keySelector);\n\t\t\t_ensureFunction(valueSelector);\n\t\t\tconst result: { [key: string]: any } = {};\n\t\t\tconst arr = this.toArray();\n\t\t\tfor (let i = 0; i < arr.length; i++) {\n\t\t\t\tresult[keySelector(arr[i], i)] = valueSelector(arr[i], i);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\n\t\t/**\n\t\t * An optimized implementation of to Set\n\t\t *\n\t\t * @returns {Set<any>}\n\t\t * @memberof OrderedEnumerable\n\t\t */\n\t\ttoSet(): Set<any> {\n\t\t\tconst result = new Set<any>();\n\t\t\tconst arr = this.toArray();\n\t\t\tfor (let i = 0; i < arr.length; i++) {\n\t\t\t\tresult.add(arr[i]);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t}\n\n\n\tconst _insertionSortThreshold = 64;\n\t/// insertion sort is used for small intervals\n\tfunction _insertionsort(arr: any[], leftIndex: number, rightIndex: number, comparer: IComparer) {\n\t\tfor (let j = leftIndex; j <= rightIndex; j++) {\n\t\t\tconst key = arr[j];\n\t\t\tlet i = j - 1;\n\t\t\twhile (i >= leftIndex && comparer(arr[i], key) > 0) {\n\t\t\t\tarr[i + 1] = arr[i];\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tarr[i + 1] = key;\n\t\t}\n\t}\n\n\t/// swap two items in an array by index\n\tfunction _swapArrayItems(array: any[], leftIndex: number, rightIndex: number): void {\n\t\tconst temp = array[leftIndex];\n\t\tarray[leftIndex] = array[rightIndex];\n\t\tarray[rightIndex] = temp;\n\t}\n\t// Quicksort partition by center value coming from both sides\n\tfunction _partition(items: any[], left: number, right: number, comparer: IComparer) {\n\t\tconst pivot = items[(right + left) >> 1];\n\t\twhile (left <= right) {\n\t\t\twhile (comparer(items[left], pivot) < 0) {\n\t\t\t\tleft++;\n\t\t\t}\n\t\t\twhile (comparer(items[right], pivot) > 0) {\n\t\t\t\tright--;\n\t\t\t}\n\t\t\tif (left < right) {\n\t\t\t\t_swapArrayItems(items, left, right);\n\t\t\t\tleft++;\n\t\t\t\tright--;\n\t\t\t} else {\n\t\t\t\tif (left === right) return left + 1;\n\t\t\t}\n\t\t}\n\t\treturn left;\n\t}\n\n\t/// optimized Quicksort algorithm\n\tfunction _quickSort(items: any[], left: number, right: number, comparer: IComparer = _defaultComparer, minIndex: number = 0, maxIndex: number = Number.MAX_SAFE_INTEGER) {\n\t\tif (!items.length) return items;\n\n\t\t// store partition indexes to be processed in here\n\t\tconst partitions: { left: number, right: number }[] = [];\n\t\tpartitions.push({ left, right });\n\t\tlet size = 1;\n\t\t// the actual size of the partitions array never decreases\n\t\t// but we keep score of the number of partitions in 'size'\n\t\t// and we reuse slots whenever possible\n\t\twhile (size) {\n\t\t\tconst partition = { left, right } = partitions[size-1];\n\t\t\tif (right - left < _insertionSortThreshold) {\n\t\t\t\t_insertionsort(items, left, right, comparer);\n\t\t\t\tsize--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst index = _partition(items, left, right, comparer);\n\t\t\tif (left < index - 1 && index - 1 >= minIndex) {\n\t\t\t\tpartition.right = index - 1;\n\t\t\t\tif (index < right && index < maxIndex) { \n\t\t\t\t\tpartitions[size]={ left: index, right };\n\t\t\t\t\tsize++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (index < right && index < maxIndex) { \n\t\t\t\t\tpartition.left = index;\n\t\t\t\t} else {\n\t\t\t\t\tsize--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn items;\n\t}\n}"
  },
  {
    "path": "LInQer.Slim.ts",
    "content": "namespace Linqer {\n\n\t/**\n\t * wrapper class over iterable instances that exposes the methods usually found in .NET LINQ\n\t *\n\t * @export\n\t * @class Enumerable\n\t * @implements {Iterable<any>}\n\t * @implements {IUsesQuickSort}\n\t */\n\texport class Enumerable implements Iterable<any>, IUsesQuickSort {\n\t\t_src: IterableType;\n\t\t_generator: () => Iterator<any>;\n\t\t_useQuickSort: boolean;\n\t\t// indicates that count and elementAt functions will not cause iterating the enumerable\n\t\t_canSeek: boolean;\n\t\t_count: null | (() => number);\n\t\t_tryGetAt: null | ((index: number) => { value: any } | null);\n\t\t// true if the enumerable was iterated at least once\n\t\t_wasIterated: boolean;\n\n\t\t/**\n\t\t * sort an array in place using the Enumerable sort algorithm (Quicksort)\n\t\t *\n\t\t * @static\n\t\t * @memberof Enumerable\n\t\t */\n\t\tstatic sort: (arr: any[], comparer?: IComparer) => any[];\n\t\t\n\t\t/**\n\t\t * You should never use this. Instead use Enumerable.from\n\t\t * @param {IterableType} src\n\t\t * @memberof Enumerable\n\t\t */\n\t\tconstructor(src: IterableType) {\n\t\t\t_ensureIterable(src);\n\t\t\tthis._src = src;\n\t\t\tconst iteratorFunction: (() => Iterator<any>) = (src as Iterable<any>)[Symbol.iterator];\n\t\t\t// the generator is either the iterator of the source enumerable\n\t\t\t// or the generator function that was provided as the source itself\n\t\t\tif (iteratorFunction) {\n\t\t\t\tthis._generator = iteratorFunction.bind(src);\n\t\t\t} else {\n\t\t\t\tthis._generator = src as (() => Iterator<any>);\n\t\t\t}\n\t\t\t// set sorting method on an enumerable and all the derived ones should inherit it\n\t\t\t// TODO: a better method of doing this\n\t\t\tthis._useQuickSort = (src as IUsesQuickSort)._useQuickSort !== undefined\n\t\t\t\t? (src as IUsesQuickSort)._useQuickSort\n\t\t\t\t: true;\n\t\t\tthis._canSeek = false;\n\t\t\tthis._count = null;\n\t\t\tthis._tryGetAt = null;\n\t\t\tthis._wasIterated = false;\n\t\t}\n\n\t\t/**\n\t\t * Wraps an iterable item into an Enumerable if it's not already one\n\t\t *\n\t\t * @static\n\t\t * @param {IterableType} iterable\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tstatic from(iterable: IterableType): Enumerable {\n\t\t\tif (iterable instanceof Enumerable) return iterable;\n\t\t\treturn new Enumerable(iterable);\n\t\t}\n\t\t\n\t\t/**\n\t\t * the Enumerable instance exposes the same iterator as the wrapped iterable or generator function \n\t\t *\n\t\t * @returns {Iterator<any>}\n\t\t * @memberof Enumerable\n\t\t */\n\t\t[Symbol.iterator](): Iterator<any> {\n\t\t\tthis._wasIterated = true;\n\t\t\treturn this._generator();\n\t\t}\n\n\t\t/**\n\t\t * returns an empty Enumerable\n\t\t *\n\t\t * @static\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tstatic empty(): Enumerable {\n\t\t\tconst result = new Enumerable([]);\n\t\t\tresult._count = () => 0;\n\t\t\tresult._tryGetAt = (index: number) => null;\n\t\t\tresult._canSeek = true;\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n\t\t * generates a sequence of integer numbers within a specified range.\n\t\t *\n\t\t * @static\n\t\t * @param {number} start\n\t\t * @param {number} count\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tstatic range(start: number, count: number): Enumerable {\n\t\t\tconst gen = function* () {\n\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\tyield start + i;\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst result = new Enumerable(gen);\n\t\t\tresult._count = () => count;\n\t\t\tresult._tryGetAt = index => {\n\t\t\t\tif (index >= 0 && index < count) return { value: start + index };\n\t\t\t\treturn null;\n\t\t\t};\n\t\t\tresult._canSeek = true;\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n\t\t *  Generates a sequence that contains one repeated value.\n\t\t *\n\t\t * @static\n\t\t * @param {*} item\n\t\t * @param {number} count\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tstatic repeat(item: any, count: number): Enumerable {\n\t\t\tconst gen = function* () {\n\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst result = new Enumerable(gen);\n\t\t\tresult._count = () => count;\n\t\t\tresult._tryGetAt = index => {\n\t\t\t\tif (index >= 0 && index < count) return { value: item };\n\t\t\t\treturn null;\n\t\t\t};\n\t\t\tresult._canSeek = true;\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n\t\t * Same value as count(), but will throw an Error if enumerable is not seekable and has to be iterated to get the length\n\t\t */\n\t\tget length():number {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tif (!this._canSeek) throw new Error('Calling length on this enumerable will iterate it. Use count()');\n\t\t\treturn this.count();\n\t\t}\n\t\t\n\t\t/**\n\t\t * Concatenates two sequences by appending iterable to the existing one.\n\t\t *\n\t\t * @param {IterableType} iterable\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tconcat(iterable: IterableType): Enumerable {\n\t\t\t_ensureIterable(iterable);\n\t\t\tconst self: Enumerable = this;\n\t\t\t// the generator will iterate the enumerable first, then the iterable that was given as a parameter\n\t\t\t// this will be able to seek if both the original and the iterable derived enumerable can seek\n\t\t\t// the indexing function will get items from the first and then second enumerable without iteration\n\t\t\tconst gen = function* () {\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t\tfor (const item of Enumerable.from(iterable)) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst result = new Enumerable(gen);\n\t\t\tconst other = Enumerable.from(iterable);\n\t\t\tresult._count = () => self.count() + other.count();\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\t_ensureInternalTryGetAt(other);\n\t\t\tresult._canSeek = self._canSeek && other._canSeek;\n\t\t\tif (self._canSeek) {\n\t\t\t\tresult._tryGetAt = index => {\n\t\t\t\t\treturn self._tryGetAt!(index) || other._tryGetAt!(index - self.count());\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the number of elements in a sequence.\n\t\t *\n\t\t * @returns {number}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tcount(): number {\n\t\t\t_ensureInternalCount(this);\n\t\t\treturn this._count!();\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns distinct elements from a sequence.\n\t\t * WARNING: using a comparer makes this slower. Not specifying it uses a Set to determine distinctiveness.\n\t\t *\n\t\t * @param {IEqualityComparer} [equalityComparer=EqualityComparer.default]\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tdistinct(equalityComparer: IEqualityComparer = EqualityComparer.default): Enumerable {\n\t\t\tconst self: Enumerable = this;\n\t\t\t// if the comparer function is not provided, a Set will be used to quickly determine distinctiveness\n\t\t\tconst gen = equalityComparer === EqualityComparer.default\n\t\t\t\t? function* () {\n\t\t\t\t\tconst distinctValues = new Set();\n\t\t\t\t\tfor (const item of self) {\n\t\t\t\t\t\tconst size = distinctValues.size;\n\t\t\t\t\t\tdistinctValues.add(item);\n\t\t\t\t\t\tif (size < distinctValues.size) {\n\t\t\t\t\t\t\tyield item;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// otherwise values will be compared with previous values ( O(n^2) )\n\t\t\t\t// use distinctByHash in Linqer.extra to use a hashing function ( O(n log n) )\n\t\t\t\t: function* () {\n\t\t\t\t\tconst values = [];\n\t\t\t\t\tfor (const item of self) {\n\t\t\t\t\t\tlet unique = true;\n\t\t\t\t\t\tfor (let i=0; i<values.length; i++) {\n\t\t\t\t\t\t\tif (equalityComparer(item, values[i])) {\n\t\t\t\t\t\t\t\tunique = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (unique) yield item;\n\t\t\t\t\t\tvalues.push(item);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\treturn new Enumerable(gen);\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the element at a specified index in a sequence.\n\t\t *\n\t\t * @param {number} index\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\telementAt(index: number): any {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tconst result = this._tryGetAt!(index);\n\t\t\tif (!result) throw new Error('Index out of range');\n\t\t\treturn result.value;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the element at a specified index in a sequence or undefined if the index is out of range.\n\t\t *\n\t\t * @param {number} index\n\t\t * @returns {(any | undefined)}\n\t\t * @memberof Enumerable\n\t\t */\n\t\telementAtOrDefault(index: number): any | undefined {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tconst result = this._tryGetAt!(index);\n\t\t\tif (!result) return undefined;\n\t\t\treturn result.value;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the first element of a sequence.\n\t\t *\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tfirst(): any {\n\t\t\treturn this.elementAt(0);\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the first element of a sequence, or a default value if no element is found.\n\t\t *\n\t\t * @returns {(any | undefined)}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tfirstOrDefault(): any | undefined {\n\t\t\treturn this.elementAtOrDefault(0);\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the last element of a sequence.\n\t\t *\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tlast(): any {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\t// if this cannot seek, getting the last element requires iterating the whole thing\n\t\t\tif (!this._canSeek) {\n\t\t\t\tlet result = null;\n\t\t\t\tlet found = false;\n\t\t\t\tfor (const item of this) {\n\t\t\t\t\tresult = item;\n\t\t\t\t\tfound = true;\n\t\t\t\t}\n\t\t\t\tif (found) return result;\n\t\t\t\tthrow new Error('The enumeration is empty');\n\t\t\t}\n\t\t\t// if this can seek, then just go directly at the last element\n\t\t\tconst count = this.count();\n\t\t\treturn this.elementAt(count - 1);\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns the last element of a sequence, or undefined if no element is found.\n\t\t *\n\t\t * @returns {(any | undefined)}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tlastOrDefault(): any | undefined {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tif (!this._canSeek) {\n\t\t\t\tlet result = undefined;\n\t\t\t\tfor (const item of this) {\n\t\t\t\t\tresult = item;\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tconst count = this.count();\n\t\t\treturn this.elementAtOrDefault(count - 1);\n\t\t}\n\n\t\t/**\n\t\t * Returns the count, minimum and maximum value in a sequence of values.\n\t\t * A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n\t\t *\n\t\t * @param {IComparer} [comparer]\n\t\t * @returns {{ count: number, min: any, max: any }}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tstats(comparer?: IComparer): { count: number, min: any, max: any } {\n\t\t\tif (comparer) {\n\t\t\t\t_ensureFunction(comparer);\n\t\t\t} else {\n\t\t\t\tcomparer = _defaultComparer;\n\t\t\t}\n\t\t\tconst agg = {\n\t\t\t\tcount: 0,\n\t\t\t\tmin: undefined,\n\t\t\t\tmax: undefined\n\t\t\t};\n\t\t\tfor (const item of this) {\n\t\t\t\tif (typeof agg.min === 'undefined' || comparer(item, agg.min) < 0) agg.min = item;\n\t\t\t\tif (typeof agg.max === 'undefined' || comparer(item, agg.max) > 0) agg.max = item;\n\t\t\t\tagg.count++;\n\t\t\t}\n\t\t\treturn agg;\n\t\t}\n\n\t\t/**\n\t\t *  Returns the minimum value in a sequence of values.\n\t\t *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\t\t\n\t\t *\n\t\t * @param {IComparer} [comparer]\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tmin(comparer?: IComparer): any {\n\t\t\tconst stats = this.stats(comparer);\n\t\t\treturn stats.count === 0\n\t\t\t\t? undefined\n\t\t\t\t: stats.min;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t *  Returns the maximum value in a sequence of values.\n\t\t *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n\t\t *\n\t\t * @param {IComparer} [comparer]\n\t\t * @returns {*}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tmax(comparer?: IComparer): any {\n\t\t\tconst stats = this.stats(comparer);\n\t\t\treturn stats.count === 0\n\t\t\t\t? undefined\n\t\t\t\t: stats.max;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Projects each element of a sequence into a new form.\n\t\t *\n\t\t * @param {ISelector} selector\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tselect(selector: ISelector): Enumerable {\n\t\t\t_ensureFunction(selector);\n\t\t\tconst self: Enumerable = this;\n\t\t\t// the generator is applying the selector on all the items of the enumerable\n\t\t\t// the count of the resulting enumerable is the same as the original's\n\t\t\t// the indexer is the same as that of the original, with the selector applied on the value\n\t\t\tconst gen = function* () {\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tyield selector(item, index);\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst result = new Enumerable(gen);\n\t\t\t_ensureInternalCount(this);\n\t\t\tresult._count = this._count;\n\t\t\t_ensureInternalTryGetAt(self);\n\t\t\tresult._canSeek = self._canSeek;\n\t\t\tresult._tryGetAt = index => {\n\t\t\t\tconst res = self._tryGetAt!(index);\n\t\t\t\tif (!res) return res;\n\t\t\t\treturn { value: selector(res.value) };\n\t\t\t};\n\t\t\treturn result;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Bypasses a specified number of elements in a sequence and then returns the remaining elements.\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tskip(nr: number): Enumerable {\n\t\t\tconst self: Enumerable = this;\n\t\t\t// the generator just enumerates the first nr numbers then starts yielding values\n\t\t\t// the count is the same as the original enumerable, minus the skipped items and at least 0\n\t\t\t// the indexer is the same as for the original, with an offset\n\t\t\tconst gen = function* () {\n\t\t\t\tlet nrLeft = nr;\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tif (nrLeft > 0) {\n\t\t\t\t\t\tnrLeft--;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tyield item;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst result = new Enumerable(gen);\n\n\t\t\tresult._count = () => Math.max(0, self.count() - nr);\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tresult._canSeek = this._canSeek;\n\t\t\tresult._tryGetAt = index => self._tryGetAt!(index + nr);\n\t\t\treturn result;\n\t\t}\n\t\t\n\t\t\n\t\t/**\n\t\t * Takes start elements, ignores howmany elements, continues with the new items and continues with the original enumerable\n\t\t * Equivalent to the value of an array after performing splice on it with the same parameters\n\t\t * @param start \n\t\t * @param howmany \n\t\t * @param items \n\t\t * @returns splice \n\t\t */\n\t\tsplice(start: number, howmany: number, ...newItems:any[]) : Enumerable {\n\t\t\t// tried to define length and splice so that this is seen as an Array-like object, \n\t\t\t// but it doesn't work on properties. length needs to be a field.\n\t\t\treturn this.take(start).concat(newItems).concat(this.skip(start+howmany));\n\t\t}\n\n\t\t/**\n\t\t * Computes the sum of a sequence of numeric values.\n\t\t *\n\t\t * @returns {(number | undefined)}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tsum(): number | undefined {\n\t\t\tconst stats = this.sumAndCount();\n\t\t\treturn stats.count === 0\n\t\t\t\t? undefined\n\t\t\t\t: stats.sum;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Computes the sum and count of a sequence of numeric values.\n\t\t *\n\t\t * @returns {{ sum: number, count: number }}\n\t\t * @memberof Enumerable\n\t\t */\n\t\tsumAndCount(): { sum: number, count: number } {\n\t\t\tconst agg = {\n\t\t\t\tcount: 0,\n\t\t\t\tsum: 0\n\t\t\t};\n\t\t\tfor (const item of this) {\n\t\t\t\tagg.sum = agg.count === 0\n\t\t\t\t\t? _toNumber(item)\n\t\t\t\t\t: agg.sum + _toNumber(item);\n\t\t\t\tagg.count++;\n\t\t\t}\n\t\t\treturn agg;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * Returns a specified number of contiguous elements from the start of a sequence.\n\t\t *\n\t\t * @param {number} nr\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttake(nr: number): Enumerable {\n\t\t\tconst self: Enumerable = this;\n\t\t\t// the generator will stop after nr items yielded\n\t\t\t// the count is the maximum between the total count and nr\n\t\t\t// the indexer is the same, as long as it's not higher than nr\n\t\t\tconst gen = function* () {\n\t\t\t\tlet nrLeft = nr;\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tif (nrLeft > 0) {\n\t\t\t\t\t\tyield item;\n\t\t\t\t\t\tnrLeft--;\n\t\t\t\t\t}\n\t\t\t\t\tif (nrLeft <= 0) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst result = new Enumerable(gen);\n\n\t\t\tresult._count = () => Math.min(nr, self.count());\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tresult._canSeek = self._canSeek;\n\t\t\tif (self._canSeek) {\n\t\t\t\tresult._tryGetAt = index => {\n\t\t\t\t\tif (index >= nr) return null;\n\t\t\t\t\treturn self._tryGetAt!(index);\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * creates an array from an Enumerable\n\t\t *\n\t\t * @returns {any[]}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttoArray(): any[] {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\t// this should be faster than Array.from(this)\n\t\t\tif (this._canSeek) {\n\t\t\t\tconst arr = new Array(this.count());\n\t\t\t\tfor (let i = 0; i < arr.length; i++) {\n\t\t\t\t\tarr[i] = this._tryGetAt!(i)?.value;\n\t\t\t\t}\n\t\t\t\treturn arr;\n\t\t\t}\n\t\t\t// try to optimize the array growth by increasing it \n\t\t\t// by 64 every time it is needed \n\t\t\tconst minIncrease = 64;\n\t\t\tlet size = 0;\n\t\t\tconst arr = [];\n\t\t\tfor (const item of this) {\n\t\t\t\tif (size === arr.length) {\n\t\t\t\t\tarr.length += minIncrease;\n\t\t\t\t}\n\t\t\t\tarr[size] = item;\n\t\t\t\tsize++;\n\t\t\t}\n\t\t\tarr.length = size;\n\t\t\treturn arr;\n\t\t}\n\n\t\t\n\t\t/**\n\t\t * similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do count and elementAt without iterating\n\t\t *\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\ttoList(): Enumerable {\n\t\t\t_ensureInternalTryGetAt(this);\n\t\t\tif (this._canSeek) return this;\n\t\t\treturn Enumerable.from(this.toArray());\n\t\t}\n\t\t\n\t\t/**\n\t\t * Filters a sequence of values based on a predicate.\n\t\t *\n\t\t * @param {IFilter} condition\n\t\t * @returns {Enumerable}\n\t\t * @memberof Enumerable\n\t\t */\n\t\twhere(condition: IFilter): Enumerable {\n\t\t\t_ensureFunction(condition);\n\t\t\tconst self: Enumerable = this;\n\t\t\t// cannot imply the count or indexer from the condition\n\t\t\t// where will have to iterate through the whole thing\n\t\t\tconst gen = function* () {\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (const item of self) {\n\t\t\t\t\tif (condition(item, index)) {\n\t\t\t\t\t\tyield item;\n\t\t\t\t\t}\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn new Enumerable(gen);\n\t\t}\n\t}\n\n\t// throw if src is not a generator function or an iteratable\n\texport function _ensureIterable(src: IterableType): void {\n\t\tif (src) {\n\t\t\tif ((src as Iterable<any>)[Symbol.iterator]) return;\n\t\t\tif (typeof src === 'function' && (src as Function).constructor.name === 'GeneratorFunction') return;\n\t\t}\n\t\tthrow new Error('the argument must be iterable!');\n\t}\n\t// throw if f is not a function\n\texport function _ensureFunction(f: Function): void {\n\t\tif (!f || typeof f !== 'function') throw new Error('the argument needs to be a function!');\n\t}\n\t// return Nan if this is not a number\n\t// different from Number(obj), which would cast strings to numbers\n\tfunction _toNumber(obj: any): number {\n\t\treturn typeof obj === 'number'\n\t\t\t? obj\n\t\t\t: Number.NaN;\n\t}\n\t// return the iterable if already an array or use Array.from to create one\n\texport function _toArray(iterable: IterableType) {\n\t\tif (!iterable) return [];\n\t\tif (Array.isArray(iterable)) return iterable;\n\t\treturn Array.from(iterable);\n\t}\n\t// if the internal count function is not defined, set it to the most appropriate one\n\texport function _ensureInternalCount(enumerable: Enumerable) {\n\t\tif (enumerable._count) return;\n\t\tif (enumerable._src instanceof Enumerable) {\n\t\t\t// the count is the same as the underlying enumerable\n\t\t\tconst innerEnumerable = enumerable._src as Enumerable;\n\t\t\t_ensureInternalCount(innerEnumerable);\n\t\t\tenumerable._count = () => innerEnumerable._count!();\n\t\t\treturn;\n\t\t}\n\t\tconst src = enumerable._src as any;\n\t\t// this could cause false positives, but if it has a numeric length or size, use it\n\t\tif (typeof src !== 'function' && typeof src.length === 'number') {\n\t\t\tenumerable._count = () => src.length;\n\t\t\treturn;\n\t\t}\n\t\tif (typeof src.size === 'number') {\n\t\t\tenumerable._count = () => src.size;\n\t\t\treturn;\n\t\t}\n\t\t// otherwise iterate the whole thing and count all items\n\t\tenumerable._count = () => {\n\t\t\tlet x = 0;\n\t\t\tfor (const item of enumerable) x++;\n\t\t\treturn x;\n\t\t};\n\t}\n\t// ensure there is an internal indexer function adequate for this enumerable\n\t// this also determines if the enumerable can seek\n\texport function _ensureInternalTryGetAt(enumerable: Enumerable) {\n\t\tif (enumerable._tryGetAt) return;\n\t\tenumerable._canSeek = true;\n\t\tif (enumerable._src instanceof Enumerable) {\n\t\t\t// indexer and seekability is the same as for the underlying enumerable\n\t\t\tconst innerEnumerable = enumerable._src as Enumerable;\n\t\t\t_ensureInternalTryGetAt(innerEnumerable);\n\t\t\tenumerable._tryGetAt = index => innerEnumerable._tryGetAt!(index);\n\t\t\tenumerable._canSeek = innerEnumerable._canSeek;\n\t\t\treturn;\n\t\t}\n\t\tif (typeof enumerable._src === 'string') {\n\t\t\t// a string can be accessed by index\n\t\t\tenumerable._tryGetAt = index => {\n\t\t\t\tif (index < (enumerable._src as string).length) {\n\t\t\t\t\treturn { value: (enumerable._src as string).charAt(index) };\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\t\tif (Array.isArray(enumerable._src)) {\n\t\t\t// an array can be accessed by index\n\t\t\tenumerable._tryGetAt = index => {\n\t\t\t\tif (index >= 0 && index < (enumerable._src as any[]).length) {\n\t\t\t\t\treturn { value: (enumerable._src as any[])[index] };\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\t\tconst src = enumerable._src as any;\n\t\tif (typeof enumerable._src !== 'function' && typeof src.length === 'number') {\n\t\t\t// try to access an object with a defined numeric length by indexing it\n\t\t\t// might cause false positives\n\t\t\tenumerable._tryGetAt = index => {\n\t\t\t\tif (index < src.length && typeof src[index] !== 'undefined') {\n\t\t\t\t\treturn { value: src[index] };\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\t\tenumerable._canSeek = false;\n\t\t// TODO other specialized types? objects, maps, sets?\n\t\tenumerable._tryGetAt = index => {\n\t\t\tlet x = 0;\n\t\t\tfor (const item of enumerable) {\n\t\t\t\tif (index === x) return { value: item };\n\t\t\t\tx++;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * an extended iterable type that also supports generator functions\n\t */\n\texport type IterableType = Iterable<any> | (() => Iterator<any>) | Enumerable;\n\n\t/**\n\t * A comparer function to be used in sorting\n\t */\n\texport type IComparer = (item1: any, item2: any) => -1 | 0 | 1;\n\t/**\n\t * A selector function to be used in mapping\n\t */\n\texport type ISelector<T = any> = (item: any, index?: number) => T;\n\t/**\n\t * A filter function\n\t */\n\texport type IFilter = ISelector<boolean>;\n\n\t/**\n\t * The default comparer function between two items\n\t * @param item1 \n\t * @param item2 \n\t */\n\texport const _defaultComparer: IComparer = (item1, item2) => {\n\t\tif (item1 > item2) return 1;\n\t\tif (item1 < item2) return -1;\n\t\treturn 0;\n\t};\n\n\t/**\n\t * Interface for an equality comparer\n\t */\n\texport type IEqualityComparer = (item1: any, item2: any) => boolean;\n\n\t/**\n\t * Predefined equality comparers\n\t * default is the equivalent of ==\n\t * exact is the equivalent of ===\n\t */\n\texport const EqualityComparer = {\n\t\tdefault: (item1: any, item2: any) => item1 == item2,\n\t\texact: (item1: any, item2: any) => item1 === item2,\n\t};\n\n\t// used to access the variable determining if \n\t// an enumerable should be ordered using Quicksort or not\n\tinterface IUsesQuickSort {\n\t\t_useQuickSort: boolean;\n\t}\n}"
  },
  {
    "path": "LInQer.all.d.ts",
    "content": "declare namespace Linqer {\n    /**\n     * wrapper class over iterable instances that exposes the methods usually found in .NET LINQ\n     *\n     * @export\n     * @class Enumerable\n     * @implements {Iterable<any>}\n     * @implements {IUsesQuickSort}\n     */\n    export class Enumerable implements Iterable<any>, IUsesQuickSort {\n        _src: IterableType;\n        _generator: () => Iterator<any>;\n        _useQuickSort: boolean;\n        _canSeek: boolean;\n        _count: null | (() => number);\n        _tryGetAt: null | ((index: number) => {\n            value: any;\n        } | null);\n        _wasIterated: boolean;\n        /**\n         * sort an array in place using the Enumerable sort algorithm (Quicksort)\n         *\n         * @static\n         * @memberof Enumerable\n         */\n        static sort: (arr: any[], comparer?: IComparer) => any[];\n        /**\n         * You should never use this. Instead use Enumerable.from\n         * @param {IterableType} src\n         * @memberof Enumerable\n         */\n        constructor(src: IterableType);\n        /**\n         * Wraps an iterable item into an Enumerable if it's not already one\n         *\n         * @static\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static from(iterable: IterableType): Enumerable;\n        /**\n         * the Enumerable instance exposes the same iterator as the wrapped iterable or generator function\n         *\n         * @returns {Iterator<any>}\n         * @memberof Enumerable\n         */\n        [Symbol.iterator](): Iterator<any>;\n        /**\n         * returns an empty Enumerable\n         *\n         * @static\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static empty(): Enumerable;\n        /**\n         * generates a sequence of integer numbers within a specified range.\n         *\n         * @static\n         * @param {number} start\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static range(start: number, count: number): Enumerable;\n        /**\n         *  Generates a sequence that contains one repeated value.\n         *\n         * @static\n         * @param {*} item\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static repeat(item: any, count: number): Enumerable;\n        /**\n         * Same value as count(), but will throw an Error if enumerable is not seekable and has to be iterated to get the length\n         */\n        get length(): number;\n        /**\n         * Concatenates two sequences by appending iterable to the existing one.\n         *\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        concat(iterable: IterableType): Enumerable;\n        /**\n         * Returns distinct elements from a sequence.\n         * WARNING: using a comparer makes this slower. Not specifying it uses a Set to determine distinctiveness.\n         *\n         * @param {IEqualityComparer} [equalityComparer=EqualityComparer.default]\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        distinct(equalityComparer?: IEqualityComparer): Enumerable;\n        /**\n         * Returns the element at a specified index in a sequence.\n         *\n         * @param {number} index\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        elementAt(index: number): any;\n        /**\n         * Returns the element at a specified index in a sequence or undefined if the index is out of range.\n         *\n         * @param {number} index\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        elementAtOrDefault(index: number): any | undefined;\n        /**\n         * Returns the first element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        first(): any;\n        /**\n         * Returns the first element of a sequence, or a default value if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        firstOrDefault(): any | undefined;\n        /**\n         * Returns the last element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        last(): any;\n        /**\n         * Returns the last element of a sequence, or undefined if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        lastOrDefault(): any | undefined;\n        /**\n         * Returns the count, minimum and maximum value in a sequence of values.\n         * A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {{ count: number, min: any, max: any }}\n         * @memberof Enumerable\n         */\n        stats(comparer?: IComparer): {\n            count: number;\n            min: any;\n            max: any;\n        };\n        /**\n         *  Returns the minimum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        min(comparer?: IComparer): any;\n        /**\n         *  Returns the maximum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        max(comparer?: IComparer): any;\n        /**\n         * Projects each element of a sequence into a new form.\n         *\n         * @param {ISelector} selector\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        select(selector: ISelector): Enumerable;\n        /**\n         * Bypasses a specified number of elements in a sequence and then returns the remaining elements.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        skip(nr: number): Enumerable;\n        /**\n         * Takes start elements, ignores howmany elements, continues with the new items and continues with the original enumerable\n         * Equivalent to the value of an array after performing splice on it with the same parameters\n         * @param start\n         * @param howmany\n         * @param items\n         * @returns splice\n         */\n        splice(start: number, howmany: number, ...newItems: any[]): Enumerable;\n        /**\n         * Computes the sum of a sequence of numeric values.\n         *\n         * @returns {(number | undefined)}\n         * @memberof Enumerable\n         */\n        sum(): number | undefined;\n        /**\n         * Computes the sum and count of a sequence of numeric values.\n         *\n         * @returns {{ sum: number, count: number }}\n         * @memberof Enumerable\n         */\n        sumAndCount(): {\n            sum: number;\n            count: number;\n        };\n        /**\n         * Returns a specified number of contiguous elements from the start of a sequence.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        take(nr: number): Enumerable;\n        /**\n         * creates an array from an Enumerable\n         *\n         * @returns {any[]}\n         * @memberof Enumerable\n         */\n        toArray(): any[];\n        /**\n         * similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do count and elementAt without iterating\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        toList(): Enumerable;\n        /**\n         * Filters a sequence of values based on a predicate.\n         *\n         * @param {IFilter} condition\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        where(condition: IFilter): Enumerable;\n    }\n    export function _ensureIterable(src: IterableType): void;\n    export function _ensureFunction(f: Function): void;\n    export function _toArray(iterable: IterableType): any[];\n    export function _ensureInternalCount(enumerable: Enumerable): void;\n    export function _ensureInternalTryGetAt(enumerable: Enumerable): void;\n    /**\n     * an extended iterable type that also supports generator functions\n     */\n    export type IterableType = Iterable<any> | (() => Iterator<any>) | Enumerable;\n    /**\n     * A comparer function to be used in sorting\n     */\n    export type IComparer = (item1: any, item2: any) => -1 | 0 | 1;\n    /**\n     * A selector function to be used in mapping\n     */\n    export type ISelector<T = any> = (item: any, index?: number) => T;\n    /**\n     * A filter function\n     */\n    export type IFilter = ISelector<boolean>;\n    /**\n     * The default comparer function between two items\n     * @param item1\n     * @param item2\n     */\n    export const _defaultComparer: IComparer;\n    /**\n     * Interface for an equality comparer\n     */\n    export type IEqualityComparer = (item1: any, item2: any) => boolean;\n    /**\n     * Predefined equality comparers\n     * default is the equivalent of ==\n     * exact is the equivalent of ===\n     */\n    export const EqualityComparer: {\n        default: (item1: any, item2: any) => boolean;\n        exact: (item1: any, item2: any) => boolean;\n    };\n    interface IUsesQuickSort {\n        _useQuickSort: boolean;\n    }\n    export {};\n}\ndeclare namespace Linqer {\n    interface Enumerable extends Iterable<any> {\n        /**\n         * Applies an accumulator function over a sequence.\n         * The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.\n         *\n         * @param {*} accumulator\n         * @param {(acc: any, item: any) => any} aggregator\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        aggregate(accumulator: any, aggregator: (acc: any, item: any) => any): any;\n        /**\n         * Determines whether all elements of a sequence satisfy a condition.\n         * @param condition\n         * @returns true if all\n         */\n        all(condition: IFilter): boolean;\n        /**\n         * Determines whether any element of a sequence exists or satisfies a condition.\n         *\n         * @param {IFilter} condition\n         * @returns {boolean}\n         * @memberof Enumerable\n         */\n        any(condition: IFilter): boolean;\n        /**\n         * Appends a value to the end of the sequence.\n         *\n         * @param {*} item\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        append(item: any): Enumerable;\n        /**\n         * Computes the average of a sequence of numeric values.\n         *\n         * @returns {(number | undefined)}\n         * @memberof Enumerable\n         */\n        average(): number | undefined;\n        /**\n         * Returns itself\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        asEnumerable(): Enumerable;\n        /**\n         * Checks the elements of a sequence based on their type\n         *  If type is a string, it will check based on typeof, else it will use instanceof.\n         *  Throws if types are different.\n         * @param {(string | Function)} type\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        cast(type: string | Function): Enumerable;\n        /**\n         * Determines whether a sequence contains a specified element.\n         * A custom function can be used to determine equality between elements.\n         *\n         * @param {*} item\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {boolean}\n         * @memberof Enumerable\n         */\n        contains(item: any, equalityComparer: IEqualityComparer): boolean;\n        defaultIfEmpty(): never;\n        /**\n         * Produces the set difference of two sequences\n         * WARNING: using the comparer is slower\n         *\n         * @param {IterableType} iterable\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        except(iterable: IterableType, equalityComparer: IEqualityComparer): Enumerable;\n        /**\n         * Produces the set intersection of two sequences.\n         * WARNING: using a comparer is slower\n         *\n         * @param {IterableType} iterable\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        intersect(iterable: IterableType, equalityComparer: IEqualityComparer): Enumerable;\n        /**\n         * Same as count\n         *\n         * @returns {number}\n         * @memberof Enumerable\n         */\n        longCount(): number;\n        /**\n         * Filters the elements of a sequence based on their type\n         * If type is a string, it will filter based on typeof, else it will use instanceof\n         *\n         * @param {(string | Function)} type\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        ofType(type: string | Function): Enumerable;\n        /**\n         * Adds a value to the beginning of the sequence.\n         *\n         * @param {*} item\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        prepend(item: any): Enumerable;\n        /**\n         * Inverts the order of the elements in a sequence.\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        reverse(): Enumerable;\n        /**\n         * Projects each element of a sequence to an iterable and flattens the resulting sequences into one sequence.\n         *\n         * @param {ISelector<IterableType>} selector\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        selectMany(selector: ISelector<IterableType>): Enumerable;\n        /**\n         * Determines whether two sequences are equal and in the same order according to an optional equality comparer.\n         *\n         * @param {IterableType} iterable\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {boolean}\n         * @memberof Enumerable\n         */\n        sequenceEqual(iterable: IterableType, equalityComparer: IEqualityComparer): boolean;\n        /**\n         * Returns the single element of a sequence and throws if it doesn't have exactly one\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        single(): any;\n        /**\n         * Returns the single element of a sequence or undefined if none found. It throws if the sequence contains multiple items.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        singleOrDefault(): any | undefined;\n        /**\n         * Returns a new enumerable collection that contains the elements from source with the last nr elements of the source collection omitted.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        skipLast(nr: number): Enumerable;\n        /**\n         * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.\n         *\n         * @param {IFilter} condition\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        skipWhile(condition: IFilter): Enumerable;\n        /**\n         * Selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.\n         * @param start\n         * @param end\n         * @returns slice\n         */\n        slice(start: number | undefined, end: number | undefined): Enumerable;\n        /**\n         * Returns a new enumerable collection that contains the last nr elements from source.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        takeLast(nr: number): Enumerable;\n        /**\n         * Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.\n         *\n         * @param {IFilter} condition\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        takeWhile(condition: IFilter): Enumerable;\n        toDictionary(): never;\n        /**\n         * creates a Map from an Enumerable\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} valueSelector\n         * @returns {Map<any, any>}\n         * @memberof Enumerable\n         */\n        toMap(keySelector: ISelector, valueSelector: ISelector): Map<any, any>;\n        /**\n         * creates an object from an Enumerable\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} valueSelector\n         * @returns {{ [key: string]: any }}\n         * @memberof Enumerable\n         */\n        toObject(keySelector: ISelector, valueSelector: ISelector): {\n            [key: string]: any;\n        };\n        toHashSet(): never;\n        /**\n         * creates a Set from an enumerable\n         *\n         * @returns {Set<any>}\n         * @memberof Enumerable\n         */\n        toSet(): Set<any>;\n        /**\n         * Produces the set union of two sequences.\n         *\n         * @param {IterableType} iterable\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        union(iterable: IterableType, equalityComparer: IEqualityComparer): Enumerable;\n        /**\n         * Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.\n         *\n         * @param {IterableType} iterable\n         * @param {(item1: any, item2: any, index: number) => any} zipper\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        zip(iterable: IterableType, zipper: (item1: any, item2: any, index: number) => any): any;\n    }\n}\ndeclare namespace Linqer {\n    interface Enumerable extends Iterable<any> {\n        /**\n         * Groups the elements of a sequence.\n         *\n         * @param {ISelector} keySelector\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        groupBy(keySelector: ISelector): Enumerable;\n        /**\n         * Correlates the elements of two sequences based on key equality and groups the results. A specified equalityComparer is used to compare keys.\n         * WARNING: using the equality comparer will be slower\n         *\n         * @param {IterableType} iterable\n         * @param {ISelector} innerKeySelector\n         * @param {ISelector} outerKeySelector\n         * @param {(item1: any, item2: any) => any} resultSelector\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        groupJoin(iterable: IterableType, innerKeySelector: ISelector, outerKeySelector: ISelector, resultSelector: (item1: any, item2: any) => any, equalityComparer: IEqualityComparer): Enumerable;\n        /**\n         * Correlates the elements of two sequences based on matching keys.\n         * WARNING: using the equality comparer will be slower\n         *\n         * @param {IterableType} iterable\n         * @param {ISelector} innerKeySelector\n         * @param {ISelector} outerKeySelector\n         * @param {(item1: any, item2: any) => any} resultSelector\n         * @param {IEqualityComparer} equalityComparer\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        join(iterable: IterableType, innerKeySelector: ISelector, outerKeySelector: ISelector, resultSelector: (item1: any, item2: any) => any, equalityComparer: IEqualityComparer): Enumerable;\n        toLookup(): never;\n    }\n    /**\n     * An Enumerable that also exposes a group key\n     *\n     * @export\n     * @class GroupEnumerable\n     * @extends {Enumerable}\n     */\n    class GroupEnumerable extends Enumerable {\n        key: string;\n        constructor(iterable: IterableType, key: string);\n    }\n}\ndeclare namespace Linqer {\n    export interface Enumerable extends Iterable<any> {\n        /**\n         * Sorts the elements of a sequence in ascending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof Enumerable\n         */\n        orderBy(keySelector: ISelector): OrderedEnumerable;\n        /**\n         * Sorts the elements of a sequence in descending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof Enumerable\n         */\n        orderByDescending(keySelector: ISelector): OrderedEnumerable;\n        /**\n         * use QuickSort for ordering (default). Recommended when take, skip, takeLast, skipLast are used after orderBy\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        useQuickSort(): Enumerable;\n        /**\n         * use the default browser sort implementation for ordering at all times\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        useBrowserSort(): Enumerable;\n    }\n    enum RestrictionType {\n        skip = 0,\n        skipLast = 1,\n        take = 2,\n        takeLast = 3\n    }\n    /**\n     * An Enumerable yielding ordered items\n     *\n     * @export\n     * @class OrderedEnumerable\n     * @extends {Enumerable}\n     */\n    export class OrderedEnumerable extends Enumerable {\n        _keySelectors: {\n            keySelector: ISelector;\n            ascending: boolean;\n        }[];\n        _restrictions: {\n            type: RestrictionType;\n            nr: number;\n        }[];\n        /**\n         *Creates an instance of OrderedEnumerable.\n         * @param {IterableType} src\n         * @param {ISelector} [keySelector]\n         * @param {boolean} [ascending=true]\n         * @memberof OrderedEnumerable\n         */\n        constructor(src: IterableType, keySelector?: ISelector, ascending?: boolean);\n        private getSortedArray;\n        private generateSortFunc;\n        private getStartAndEndIndexes;\n        /**\n         * Performs a subsequent ordering of the elements in a sequence in ascending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        thenBy(keySelector: ISelector): OrderedEnumerable;\n        /**\n         * Performs a subsequent ordering of the elements in a sequence in descending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        thenByDescending(keySelector: ISelector): OrderedEnumerable;\n        /**\n         * Deferred and optimized implementation of take\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        take(nr: number): OrderedEnumerable;\n        /**\n         * Deferred and optimized implementation of takeLast\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        takeLast(nr: number): OrderedEnumerable;\n        /**\n         * Deferred and optimized implementation of skip\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        skip(nr: number): OrderedEnumerable;\n        /**\n         * Deferred and optimized implementation of skipLast\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        skipLast(nr: number): OrderedEnumerable;\n        /**\n         * An optimized implementation of toArray\n         *\n         * @returns {any[]}\n         * @memberof OrderedEnumerable\n         */\n        toArray(): any[];\n        /**\n         * An optimized implementation of toMap\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} [valueSelector=x => x]\n         * @returns {Map<any, any>}\n         * @memberof OrderedEnumerable\n         */\n        toMap(keySelector: ISelector, valueSelector?: ISelector): Map<any, any>;\n        /**\n         * An optimized implementation of toObject\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} [valueSelector=x => x]\n         * @returns {{ [key: string]: any }}\n         * @memberof OrderedEnumerable\n         */\n        toObject(keySelector: ISelector, valueSelector?: ISelector): {\n            [key: string]: any;\n        };\n        /**\n         * An optimized implementation of to Set\n         *\n         * @returns {Set<any>}\n         * @memberof OrderedEnumerable\n         */\n        toSet(): Set<any>;\n    }\n    export {};\n}\ndeclare namespace Linqer {\n    interface Enumerable extends Iterable<any> {\n        /**\n         * Returns a randomized sequence of items from an initial source\n         * @returns shuffle\n         */\n        shuffle(): Enumerable;\n        /**\n         * implements random reservoir sampling of k items, with the option to specify a maximum limit for the items\n         * @param k\n         * @param limit\n         * @returns sample\n         */\n        randomSample(k: number, limit: number): Enumerable;\n        /**\n         * Returns the count of the items in a sequence. Depending on the sequence type this iterates through it or not.\n         * @returns count\n         */\n        count(): number;\n        /**\n         * returns the distinct values based on a hashing function\n         *\n         * @param {ISelector} hashFunc\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        distinctByHash(hashFunc: ISelector): Enumerable;\n        /**\n         * returns the values that have different hashes from the items of the iterable provided\n         *\n         * @param {IterableType} iterable\n         * @param {ISelector} hashFunc\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        exceptByHash(iterable: IterableType, hashFunc: ISelector): Enumerable;\n        /**\n         * returns the values that have the same hashes as items of the iterable provided\n         *\n         * @param {IterableType} iterable\n         * @param {ISelector} hashFunc\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        intersectByHash(iterable: IterableType, hashFunc: ISelector): Enumerable;\n        /**\n         * returns the index of a value in an ordered enumerable or false if not found\n         * WARNING: use the same comparer as the one used to order the enumerable. The algorithm assumes the enumerable is already sorted.\n         *\n         * @param {*} value\n         * @param {IComparer} comparer\n         * @returns {(number | boolean)}\n         * @memberof Enumerable\n         */\n        binarySearch(value: any, comparer: IComparer): number | boolean;\n        /**\n         * joins each item of the enumerable with previous items from the same enumerable\n         * @param offset\n         * @param zipper\n         * @returns lag\n         */\n        lag(offset: number, zipper: (item1: any, item2: any) => any): Enumerable;\n        /**\n         * joins each item of the enumerable with next items from the same enumerable\n         *\n         * @param {number} offset\n         * @param {(item1: any, item2: any) => any} zipper\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        lead(offset: number, zipper: (item1: any, item2: any) => any): Enumerable;\n        /**\n         * returns an enumerable of at least minLength, padding the end with a value or the result of a function\n         *\n         * @param {number} minLength\n         * @param {(any | ((index: number) => any))} filler\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        padEnd(minLength: number, filler: any | ((index: number) => any)): Enumerable;\n        /**\n         * returns an enumerable of at least minLength, padding the start with a value or the result of a function\n         * if the enumerable cannot seek, then it will be iterated minLength time\n         *\n         * @param {number} minLength\n         * @param {(any | ((index: number) => any))} filler\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        padStart(minLength: number, filler: any | ((index: number) => any)): Enumerable;\n    }\n}\nexport = Linqer; \n"
  },
  {
    "path": "LInQer.all.js",
    "content": "\"use strict\";\nvar Linqer;\n(function (Linqer) {\n    /**\n     * wrapper class over iterable instances that exposes the methods usually found in .NET LINQ\n     *\n     * @export\n     * @class Enumerable\n     * @implements {Iterable<any>}\n     * @implements {IUsesQuickSort}\n     */\n    class Enumerable {\n        /**\n         * You should never use this. Instead use Enumerable.from\n         * @param {IterableType} src\n         * @memberof Enumerable\n         */\n        constructor(src) {\n            _ensureIterable(src);\n            this._src = src;\n            const iteratorFunction = src[Symbol.iterator];\n            // the generator is either the iterator of the source enumerable\n            // or the generator function that was provided as the source itself\n            if (iteratorFunction) {\n                this._generator = iteratorFunction.bind(src);\n            }\n            else {\n                this._generator = src;\n            }\n            // set sorting method on an enumerable and all the derived ones should inherit it\n            // TODO: a better method of doing this\n            this._useQuickSort = src._useQuickSort !== undefined\n                ? src._useQuickSort\n                : true;\n            this._canSeek = false;\n            this._count = null;\n            this._tryGetAt = null;\n            this._wasIterated = false;\n        }\n        /**\n         * Wraps an iterable item into an Enumerable if it's not already one\n         *\n         * @static\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static from(iterable) {\n            if (iterable instanceof Enumerable)\n                return iterable;\n            return new Enumerable(iterable);\n        }\n        /**\n         * the Enumerable instance exposes the same iterator as the wrapped iterable or generator function\n         *\n         * @returns {Iterator<any>}\n         * @memberof Enumerable\n         */\n        [Symbol.iterator]() {\n            this._wasIterated = true;\n            return this._generator();\n        }\n        /**\n         * returns an empty Enumerable\n         *\n         * @static\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static empty() {\n            const result = new Enumerable([]);\n            result._count = () => 0;\n            result._tryGetAt = (index) => null;\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         * generates a sequence of integer numbers within a specified range.\n         *\n         * @static\n         * @param {number} start\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static range(start, count) {\n            const gen = function* () {\n                for (let i = 0; i < count; i++) {\n                    yield start + i;\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => count;\n            result._tryGetAt = index => {\n                if (index >= 0 && index < count)\n                    return { value: start + index };\n                return null;\n            };\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         *  Generates a sequence that contains one repeated value.\n         *\n         * @static\n         * @param {*} item\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static repeat(item, count) {\n            const gen = function* () {\n                for (let i = 0; i < count; i++) {\n                    yield item;\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => count;\n            result._tryGetAt = index => {\n                if (index >= 0 && index < count)\n                    return { value: item };\n                return null;\n            };\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         * Same value as count(), but will throw an Error if enumerable is not seekable and has to be iterated to get the length\n         */\n        get length() {\n            _ensureInternalTryGetAt(this);\n            if (!this._canSeek)\n                throw new Error('Calling length on this enumerable will iterate it. Use count()');\n            return this.count();\n        }\n        /**\n         * Concatenates two sequences by appending iterable to the existing one.\n         *\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        concat(iterable) {\n            _ensureIterable(iterable);\n            const self = this;\n            // the generator will iterate the enumerable first, then the iterable that was given as a parameter\n            // this will be able to seek if both the original and the iterable derived enumerable can seek\n            // the indexing function will get items from the first and then second enumerable without iteration\n            const gen = function* () {\n                for (const item of self) {\n                    yield item;\n                }\n                for (const item of Enumerable.from(iterable)) {\n                    yield item;\n                }\n            };\n            const result = new Enumerable(gen);\n            const other = Enumerable.from(iterable);\n            result._count = () => self.count() + other.count();\n            _ensureInternalTryGetAt(this);\n            _ensureInternalTryGetAt(other);\n            result._canSeek = self._canSeek && other._canSeek;\n            if (self._canSeek) {\n                result._tryGetAt = index => {\n                    return self._tryGetAt(index) || other._tryGetAt(index - self.count());\n                };\n            }\n            return result;\n        }\n        /**\n         * Returns the number of elements in a sequence.\n         *\n         * @returns {number}\n         * @memberof Enumerable\n         */\n        count() {\n            _ensureInternalCount(this);\n            return this._count();\n        }\n        /**\n         * Returns distinct elements from a sequence.\n         * WARNING: using a comparer makes this slower. Not specifying it uses a Set to determine distinctiveness.\n         *\n         * @param {IEqualityComparer} [equalityComparer=EqualityComparer.default]\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        distinct(equalityComparer = Linqer.EqualityComparer.default) {\n            const self = this;\n            // if the comparer function is not provided, a Set will be used to quickly determine distinctiveness\n            const gen = equalityComparer === Linqer.EqualityComparer.default\n                ? function* () {\n                    const distinctValues = new Set();\n                    for (const item of self) {\n                        const size = distinctValues.size;\n                        distinctValues.add(item);\n                        if (size < distinctValues.size) {\n                            yield item;\n                        }\n                    }\n                }\n                // otherwise values will be compared with previous values ( O(n^2) )\n                // use distinctByHash in Linqer.extra to use a hashing function ( O(n log n) )\n                : function* () {\n                    const values = [];\n                    for (const item of self) {\n                        let unique = true;\n                        for (let i = 0; i < values.length; i++) {\n                            if (equalityComparer(item, values[i])) {\n                                unique = false;\n                                break;\n                            }\n                        }\n                        if (unique)\n                            yield item;\n                        values.push(item);\n                    }\n                };\n            return new Enumerable(gen);\n        }\n        /**\n         * Returns the element at a specified index in a sequence.\n         *\n         * @param {number} index\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        elementAt(index) {\n            _ensureInternalTryGetAt(this);\n            const result = this._tryGetAt(index);\n            if (!result)\n                throw new Error('Index out of range');\n            return result.value;\n        }\n        /**\n         * Returns the element at a specified index in a sequence or undefined if the index is out of range.\n         *\n         * @param {number} index\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        elementAtOrDefault(index) {\n            _ensureInternalTryGetAt(this);\n            const result = this._tryGetAt(index);\n            if (!result)\n                return undefined;\n            return result.value;\n        }\n        /**\n         * Returns the first element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        first() {\n            return this.elementAt(0);\n        }\n        /**\n         * Returns the first element of a sequence, or a default value if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        firstOrDefault() {\n            return this.elementAtOrDefault(0);\n        }\n        /**\n         * Returns the last element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        last() {\n            _ensureInternalTryGetAt(this);\n            // if this cannot seek, getting the last element requires iterating the whole thing\n            if (!this._canSeek) {\n                let result = null;\n                let found = false;\n                for (const item of this) {\n                    result = item;\n                    found = true;\n                }\n                if (found)\n                    return result;\n                throw new Error('The enumeration is empty');\n            }\n            // if this can seek, then just go directly at the last element\n            const count = this.count();\n            return this.elementAt(count - 1);\n        }\n        /**\n         * Returns the last element of a sequence, or undefined if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        lastOrDefault() {\n            _ensureInternalTryGetAt(this);\n            if (!this._canSeek) {\n                let result = undefined;\n                for (const item of this) {\n                    result = item;\n                }\n                return result;\n            }\n            const count = this.count();\n            return this.elementAtOrDefault(count - 1);\n        }\n        /**\n         * Returns the count, minimum and maximum value in a sequence of values.\n         * A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {{ count: number, min: any, max: any }}\n         * @memberof Enumerable\n         */\n        stats(comparer) {\n            if (comparer) {\n                _ensureFunction(comparer);\n            }\n            else {\n                comparer = Linqer._defaultComparer;\n            }\n            const agg = {\n                count: 0,\n                min: undefined,\n                max: undefined\n            };\n            for (const item of this) {\n                if (typeof agg.min === 'undefined' || comparer(item, agg.min) < 0)\n                    agg.min = item;\n                if (typeof agg.max === 'undefined' || comparer(item, agg.max) > 0)\n                    agg.max = item;\n                agg.count++;\n            }\n            return agg;\n        }\n        /**\n         *  Returns the minimum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        min(comparer) {\n            const stats = this.stats(comparer);\n            return stats.count === 0\n                ? undefined\n                : stats.min;\n        }\n        /**\n         *  Returns the maximum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        max(comparer) {\n            const stats = this.stats(comparer);\n            return stats.count === 0\n                ? undefined\n                : stats.max;\n        }\n        /**\n         * Projects each element of a sequence into a new form.\n         *\n         * @param {ISelector} selector\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        select(selector) {\n            _ensureFunction(selector);\n            const self = this;\n            // the generator is applying the selector on all the items of the enumerable\n            // the count of the resulting enumerable is the same as the original's\n            // the indexer is the same as that of the original, with the selector applied on the value\n            const gen = function* () {\n                let index = 0;\n                for (const item of self) {\n                    yield selector(item, index);\n                    index++;\n                }\n            };\n            const result = new Enumerable(gen);\n            _ensureInternalCount(this);\n            result._count = this._count;\n            _ensureInternalTryGetAt(self);\n            result._canSeek = self._canSeek;\n            result._tryGetAt = index => {\n                const res = self._tryGetAt(index);\n                if (!res)\n                    return res;\n                return { value: selector(res.value) };\n            };\n            return result;\n        }\n        /**\n         * Bypasses a specified number of elements in a sequence and then returns the remaining elements.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        skip(nr) {\n            const self = this;\n            // the generator just enumerates the first nr numbers then starts yielding values\n            // the count is the same as the original enumerable, minus the skipped items and at least 0\n            // the indexer is the same as for the original, with an offset\n            const gen = function* () {\n                let nrLeft = nr;\n                for (const item of self) {\n                    if (nrLeft > 0) {\n                        nrLeft--;\n                    }\n                    else {\n                        yield item;\n                    }\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => Math.max(0, self.count() - nr);\n            _ensureInternalTryGetAt(this);\n            result._canSeek = this._canSeek;\n            result._tryGetAt = index => self._tryGetAt(index + nr);\n            return result;\n        }\n        /**\n         * Takes start elements, ignores howmany elements, continues with the new items and continues with the original enumerable\n         * Equivalent to the value of an array after performing splice on it with the same parameters\n         * @param start\n         * @param howmany\n         * @param items\n         * @returns splice\n         */\n        splice(start, howmany, ...newItems) {\n            // tried to define length and splice so that this is seen as an Array-like object, \n            // but it doesn't work on properties. length needs to be a field.\n            return this.take(start).concat(newItems).concat(this.skip(start + howmany));\n        }\n        /**\n         * Computes the sum of a sequence of numeric values.\n         *\n         * @returns {(number | undefined)}\n         * @memberof Enumerable\n         */\n        sum() {\n            const stats = this.sumAndCount();\n            return stats.count === 0\n                ? undefined\n                : stats.sum;\n        }\n        /**\n         * Computes the sum and count of a sequence of numeric values.\n         *\n         * @returns {{ sum: number, count: number }}\n         * @memberof Enumerable\n         */\n        sumAndCount() {\n            const agg = {\n                count: 0,\n                sum: 0\n            };\n            for (const item of this) {\n                agg.sum = agg.count === 0\n                    ? _toNumber(item)\n                    : agg.sum + _toNumber(item);\n                agg.count++;\n            }\n            return agg;\n        }\n        /**\n         * Returns a specified number of contiguous elements from the start of a sequence.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        take(nr) {\n            const self = this;\n            // the generator will stop after nr items yielded\n            // the count is the maximum between the total count and nr\n            // the indexer is the same, as long as it's not higher than nr\n            const gen = function* () {\n                let nrLeft = nr;\n                for (const item of self) {\n                    if (nrLeft > 0) {\n                        yield item;\n                        nrLeft--;\n                    }\n                    if (nrLeft <= 0) {\n                        break;\n                    }\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => Math.min(nr, self.count());\n            _ensureInternalTryGetAt(this);\n            result._canSeek = self._canSeek;\n            if (self._canSeek) {\n                result._tryGetAt = index => {\n                    if (index >= nr)\n                        return null;\n                    return self._tryGetAt(index);\n                };\n            }\n            return result;\n        }\n        /**\n         * creates an array from an Enumerable\n         *\n         * @returns {any[]}\n         * @memberof Enumerable\n         */\n        toArray() {\n            var _a;\n            _ensureInternalTryGetAt(this);\n            // this should be faster than Array.from(this)\n            if (this._canSeek) {\n                const arr = new Array(this.count());\n                for (let i = 0; i < arr.length; i++) {\n                    arr[i] = (_a = this._tryGetAt(i)) === null || _a === void 0 ? void 0 : _a.value;\n                }\n                return arr;\n            }\n            // try to optimize the array growth by increasing it \n            // by 64 every time it is needed \n            const minIncrease = 64;\n            let size = 0;\n            const arr = [];\n            for (const item of this) {\n                if (size === arr.length) {\n                    arr.length += minIncrease;\n                }\n                arr[size] = item;\n                size++;\n            }\n            arr.length = size;\n            return arr;\n        }\n        /**\n         * similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do count and elementAt without iterating\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        toList() {\n            _ensureInternalTryGetAt(this);\n            if (this._canSeek)\n                return this;\n            return Enumerable.from(this.toArray());\n        }\n        /**\n         * Filters a sequence of values based on a predicate.\n         *\n         * @param {IFilter} condition\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        where(condition) {\n            _ensureFunction(condition);\n            const self = this;\n            // cannot imply the count or indexer from the condition\n            // where will have to iterate through the whole thing\n            const gen = function* () {\n                let index = 0;\n                for (const item of self) {\n                    if (condition(item, index)) {\n                        yield item;\n                    }\n                    index++;\n                }\n            };\n            return new Enumerable(gen);\n        }\n    }\n    Linqer.Enumerable = Enumerable;\n    // throw if src is not a generator function or an iteratable\n    function _ensureIterable(src) {\n        if (src) {\n            if (src[Symbol.iterator])\n                return;\n            if (typeof src === 'function' && src.constructor.name === 'GeneratorFunction')\n                return;\n        }\n        throw new Error('the argument must be iterable!');\n    }\n    Linqer._ensureIterable = _ensureIterable;\n    // throw if f is not a function\n    function _ensureFunction(f) {\n        if (!f || typeof f !== 'function')\n            throw new Error('the argument needs to be a function!');\n    }\n    Linqer._ensureFunction = _ensureFunction;\n    // return Nan if this is not a number\n    // different from Number(obj), which would cast strings to numbers\n    function _toNumber(obj) {\n        return typeof obj === 'number'\n            ? obj\n            : Number.NaN;\n    }\n    // return the iterable if already an array or use Array.from to create one\n    function _toArray(iterable) {\n        if (!iterable)\n            return [];\n        if (Array.isArray(iterable))\n            return iterable;\n        return Array.from(iterable);\n    }\n    Linqer._toArray = _toArray;\n    // if the internal count function is not defined, set it to the most appropriate one\n    function _ensureInternalCount(enumerable) {\n        if (enumerable._count)\n            return;\n        if (enumerable._src instanceof Enumerable) {\n            // the count is the same as the underlying enumerable\n            const innerEnumerable = enumerable._src;\n            _ensureInternalCount(innerEnumerable);\n            enumerable._count = () => innerEnumerable._count();\n            return;\n        }\n        const src = enumerable._src;\n        // this could cause false positives, but if it has a numeric length or size, use it\n        if (typeof src !== 'function' && typeof src.length === 'number') {\n            enumerable._count = () => src.length;\n            return;\n        }\n        if (typeof src.size === 'number') {\n            enumerable._count = () => src.size;\n            return;\n        }\n        // otherwise iterate the whole thing and count all items\n        enumerable._count = () => {\n            let x = 0;\n            for (const item of enumerable)\n                x++;\n            return x;\n        };\n    }\n    Linqer._ensureInternalCount = _ensureInternalCount;\n    // ensure there is an internal indexer function adequate for this enumerable\n    // this also determines if the enumerable can seek\n    function _ensureInternalTryGetAt(enumerable) {\n        if (enumerable._tryGetAt)\n            return;\n        enumerable._canSeek = true;\n        if (enumerable._src instanceof Enumerable) {\n            // indexer and seekability is the same as for the underlying enumerable\n            const innerEnumerable = enumerable._src;\n            _ensureInternalTryGetAt(innerEnumerable);\n            enumerable._tryGetAt = index => innerEnumerable._tryGetAt(index);\n            enumerable._canSeek = innerEnumerable._canSeek;\n            return;\n        }\n        if (typeof enumerable._src === 'string') {\n            // a string can be accessed by index\n            enumerable._tryGetAt = index => {\n                if (index < enumerable._src.length) {\n                    return { value: enumerable._src.charAt(index) };\n                }\n                return null;\n            };\n            return;\n        }\n        if (Array.isArray(enumerable._src)) {\n            // an array can be accessed by index\n            enumerable._tryGetAt = index => {\n                if (index >= 0 && index < enumerable._src.length) {\n                    return { value: enumerable._src[index] };\n                }\n                return null;\n            };\n            return;\n        }\n        const src = enumerable._src;\n        if (typeof enumerable._src !== 'function' && typeof src.length === 'number') {\n            // try to access an object with a defined numeric length by indexing it\n            // might cause false positives\n            enumerable._tryGetAt = index => {\n                if (index < src.length && typeof src[index] !== 'undefined') {\n                    return { value: src[index] };\n                }\n                return null;\n            };\n            return;\n        }\n        enumerable._canSeek = false;\n        // TODO other specialized types? objects, maps, sets?\n        enumerable._tryGetAt = index => {\n            let x = 0;\n            for (const item of enumerable) {\n                if (index === x)\n                    return { value: item };\n                x++;\n            }\n            return null;\n        };\n    }\n    Linqer._ensureInternalTryGetAt = _ensureInternalTryGetAt;\n    /**\n     * The default comparer function between two items\n     * @param item1\n     * @param item2\n     */\n    Linqer._defaultComparer = (item1, item2) => {\n        if (item1 > item2)\n            return 1;\n        if (item1 < item2)\n            return -1;\n        return 0;\n    };\n    /**\n     * Predefined equality comparers\n     * default is the equivalent of ==\n     * exact is the equivalent of ===\n     */\n    Linqer.EqualityComparer = {\n        default: (item1, item2) => item1 == item2,\n        exact: (item1, item2) => item1 === item2,\n    };\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n(function (Linqer) {\n    /// Applies an accumulator function over a sequence.\n    /// The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.\n    Linqer.Enumerable.prototype.aggregate = function (accumulator, aggregator) {\n        Linqer._ensureFunction(aggregator);\n        for (const item of this) {\n            accumulator = aggregator(accumulator, item);\n        }\n        return accumulator;\n    };\n    /// Determines whether all elements of a sequence satisfy a condition.\n    Linqer.Enumerable.prototype.all = function (condition) {\n        Linqer._ensureFunction(condition);\n        return !this.any(x => !condition(x));\n    };\n    /// Determines whether any element of a sequence exists or satisfies a condition.\n    Linqer.Enumerable.prototype.any = function (condition) {\n        Linqer._ensureFunction(condition);\n        let index = 0;\n        for (const item of this) {\n            if (condition(item, index))\n                return true;\n            index++;\n        }\n        return false;\n    };\n    /// Appends a value to the end of the sequence.\n    Linqer.Enumerable.prototype.append = function (item) {\n        return this.concat([item]);\n    };\n    /// Computes the average of a sequence of numeric values.\n    Linqer.Enumerable.prototype.average = function () {\n        const stats = this.sumAndCount();\n        return stats.count === 0\n            ? undefined\n            : stats.sum / stats.count;\n    };\n    /// Returns the same enumerable\n    Linqer.Enumerable.prototype.asEnumerable = function () {\n        return this;\n    };\n    /// Checks the elements of a sequence based on their type\n    /// If type is a string, it will check based on typeof, else it will use instanceof.\n    /// Throws if types are different.\n    Linqer.Enumerable.prototype.cast = function (type) {\n        const f = typeof type === 'string'\n            ? x => typeof x === type\n            : x => x instanceof type;\n        return this.select(item => {\n            if (!f(item))\n                throw new Error(item + ' not of type ' + type);\n            return item;\n        });\n    };\n    /// Determines whether a sequence contains a specified element.\n    /// A custom function can be used to determine equality between elements.\n    Linqer.Enumerable.prototype.contains = function (item, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureFunction(equalityComparer);\n        return this.any(x => equalityComparer(x, item));\n    };\n    Linqer.Enumerable.prototype.defaultIfEmpty = function () {\n        throw new Error('defaultIfEmpty not implemented for Javascript');\n    };\n    /// Produces the set difference of two sequences WARNING: using the comparer is slower\n    Linqer.Enumerable.prototype.except = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        // use a Set for performance if the comparer is not set\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const distinctValues = Linqer.Enumerable.from(iterable).toSet();\n                for (const item of self) {\n                    if (!distinctValues.has(item))\n                        yield item;\n                }\n            }\n            // use exceptByHash from Linqer.extra for better performance\n            : function* () {\n                const values = Linqer._toArray(iterable);\n                for (const item of self) {\n                    let unique = true;\n                    for (let i = 0; i < values.length; i++) {\n                        if (equalityComparer(item, values[i])) {\n                            unique = false;\n                            break;\n                        }\n                    }\n                    if (unique)\n                        yield item;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Produces the set intersection of two sequences. WARNING: using a comparer is slower\n    Linqer.Enumerable.prototype.intersect = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        // use a Set for performance if the comparer is not set\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const distinctValues = new Set(Linqer.Enumerable.from(iterable));\n                for (const item of self) {\n                    if (distinctValues.has(item))\n                        yield item;\n                }\n            }\n            // use intersectByHash from Linqer.extra for better performance\n            : function* () {\n                const values = Linqer._toArray(iterable);\n                for (const item of self) {\n                    let unique = true;\n                    for (let i = 0; i < values.length; i++) {\n                        if (equalityComparer(item, values[i])) {\n                            unique = false;\n                            break;\n                        }\n                    }\n                    if (!unique)\n                        yield item;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    /// same as count\n    Linqer.Enumerable.prototype.longCount = function () {\n        return this.count();\n    };\n    /// Filters the elements of a sequence based on their type\n    /// If type is a string, it will filter based on typeof, else it will use instanceof\n    Linqer.Enumerable.prototype.ofType = function (type) {\n        const condition = typeof type === 'string'\n            ? x => typeof x === type\n            : x => x instanceof type;\n        return this.where(condition);\n    };\n    /// Adds a value to the beginning of the sequence.\n    Linqer.Enumerable.prototype.prepend = function (item) {\n        return new Linqer.Enumerable([item]).concat(this);\n    };\n    /// Inverts the order of the elements in a sequence.\n    Linqer.Enumerable.prototype.reverse = function () {\n        Linqer._ensureInternalTryGetAt(this);\n        const self = this;\n        // if it can seek, just read the enumerable backwards\n        const gen = this._canSeek\n            ? function* () {\n                const length = self.count();\n                for (let index = length - 1; index >= 0; index--) {\n                    yield self.elementAt(index);\n                }\n            }\n            // else enumerate it all into an array, then read it backwards\n            : function* () {\n                const arr = self.toArray();\n                for (let index = arr.length - 1; index >= 0; index--) {\n                    yield arr[index];\n                }\n            };\n        // the count is the same when reversed\n        const result = new Linqer.Enumerable(gen);\n        Linqer._ensureInternalCount(this);\n        result._count = this._count;\n        Linqer._ensureInternalTryGetAt(this);\n        // have a custom indexer only if the original enumerable could seek\n        if (this._canSeek) {\n            const self = this;\n            result._canSeek = true;\n            result._tryGetAt = index => self._tryGetAt(self.count() - index - 1);\n        }\n        return result;\n    };\n    /// Projects each element of a sequence to an iterable and flattens the resulting sequences into one sequence.\n    Linqer.Enumerable.prototype.selectMany = function (selector) {\n        if (typeof selector !== 'undefined') {\n            Linqer._ensureFunction(selector);\n        }\n        else {\n            selector = x => x;\n        }\n        const self = this;\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                const iter = selector(item, index);\n                Linqer._ensureIterable(iter);\n                for (const child of iter) {\n                    yield child;\n                }\n                index++;\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Determines whether two sequences are equal and in the same order according to an equality comparer.\n    Linqer.Enumerable.prototype.sequenceEqual = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        Linqer._ensureFunction(equalityComparer);\n        const iterator1 = this[Symbol.iterator]();\n        const iterator2 = Linqer.Enumerable.from(iterable)[Symbol.iterator]();\n        let done = false;\n        do {\n            const val1 = iterator1.next();\n            const val2 = iterator2.next();\n            const equal = (val1.done && val2.done) || (!val1.done && !val2.done && equalityComparer(val1.value, val2.value));\n            if (!equal)\n                return false;\n            done = !!val1.done;\n        } while (!done);\n        return true;\n    };\n    /// Returns the single element of a sequence and throws if it doesn't have exactly one\n    Linqer.Enumerable.prototype.single = function () {\n        const iterator = this[Symbol.iterator]();\n        let val = iterator.next();\n        if (val.done)\n            throw new Error('Sequence contains no elements');\n        const result = val.value;\n        val = iterator.next();\n        if (!val.done)\n            throw new Error('Sequence contains more than one element');\n        return result;\n    };\n    /// Returns the single element of a sequence or undefined if none found. It throws if the sequence contains multiple items.\n    Linqer.Enumerable.prototype.singleOrDefault = function () {\n        const iterator = this[Symbol.iterator]();\n        let val = iterator.next();\n        if (val.done)\n            return undefined;\n        const result = val.value;\n        val = iterator.next();\n        if (!val.done)\n            throw new Error('Sequence contains more than one element');\n        return result;\n    };\n    /// Selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.\n    Linqer.Enumerable.prototype.slice = function (start = 0, end) {\n        let enumerable = this;\n        // when the end is defined and positive and start is negative,\n        // the only way to compute the last index is to know the count\n        if (end !== undefined && end >= 0 && (start || 0) < 0) {\n            enumerable = enumerable.toList();\n            start = enumerable.count() + start;\n        }\n        if (start !== 0) {\n            if (start > 0) {\n                enumerable = enumerable.skip(start);\n            }\n            else {\n                enumerable = enumerable.takeLast(-start);\n            }\n        }\n        if (end !== undefined) {\n            if (end >= 0) {\n                enumerable = enumerable.take(end - start);\n            }\n            else {\n                enumerable = enumerable.skipLast(-end);\n            }\n        }\n        return enumerable;\n    };\n    /// Returns a new enumerable collection that contains the elements from source with the last nr elements of the source collection omitted.\n    Linqer.Enumerable.prototype.skipLast = function (nr) {\n        const self = this;\n        // the generator is using a buffer to cache nr values \n        // and only yields the values that overflow from it\n        const gen = function* () {\n            let nrLeft = nr;\n            const buffer = Array(nrLeft);\n            let index = 0;\n            let offset = 0;\n            for (const item of self) {\n                const value = buffer[index - offset];\n                buffer[index - offset] = item;\n                index++;\n                if (index - offset >= nrLeft) {\n                    offset += nrLeft;\n                }\n                if (index > nrLeft) {\n                    yield value;\n                }\n            }\n            buffer.length = 0;\n        };\n        const result = new Linqer.Enumerable(gen);\n        // the count is the original count minus the skipped items and at least 0  \n        result._count = () => Math.max(0, self.count() - nr);\n        Linqer._ensureInternalTryGetAt(this);\n        result._canSeek = this._canSeek;\n        // it has an indexer only if the original enumerable can seek\n        if (this._canSeek) {\n            result._tryGetAt = index => {\n                if (index >= result.count())\n                    return null;\n                return self._tryGetAt(index);\n            };\n        }\n        return result;\n    };\n    /// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.\n    Linqer.Enumerable.prototype.skipWhile = function (condition) {\n        Linqer._ensureFunction(condition);\n        const self = this;\n        let skip = true;\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                if (skip && !condition(item, index)) {\n                    skip = false;\n                }\n                if (!skip) {\n                    yield item;\n                }\n                index++;\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Returns a new enumerable collection that contains the last nr elements from source.\n    Linqer.Enumerable.prototype.takeLast = function (nr) {\n        Linqer._ensureInternalTryGetAt(this);\n        const self = this;\n        const gen = this._canSeek\n            // taking the last items is easy if the enumerable can seek\n            ? function* () {\n                let nrLeft = nr;\n                const length = self.count();\n                for (let index = length - nrLeft; index < length; index++) {\n                    yield self.elementAt(index);\n                }\n            }\n            // else the generator uses a buffer to fill with values\n            // and yields them after the entire thing has been iterated\n            : function* () {\n                let nrLeft = nr;\n                let index = 0;\n                const buffer = Array(nrLeft);\n                for (const item of self) {\n                    buffer[index % nrLeft] = item;\n                    index++;\n                }\n                for (let i = 0; i < nrLeft && i < index; i++) {\n                    yield buffer[(index + i) % nrLeft];\n                }\n            };\n        const result = new Linqer.Enumerable(gen);\n        // the count is the minimum between nr and the enumerable count\n        result._count = () => Math.min(nr, self.count());\n        result._canSeek = self._canSeek;\n        // this can seek only if the original enumerable could seek\n        if (self._canSeek) {\n            result._tryGetAt = index => {\n                if (index < 0 || index >= result.count())\n                    return null;\n                return self._tryGetAt(self.count() - nr + index);\n            };\n        }\n        return result;\n    };\n    /// Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.\n    Linqer.Enumerable.prototype.takeWhile = function (condition) {\n        Linqer._ensureFunction(condition);\n        const self = this;\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                if (condition(item, index)) {\n                    yield item;\n                }\n                else {\n                    break;\n                }\n                index++;\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    Linqer.Enumerable.prototype.toDictionary = function () {\n        throw new Error('use toMap or toObject instead of toDictionary');\n    };\n    /// creates a map from an Enumerable\n    Linqer.Enumerable.prototype.toMap = function (keySelector, valueSelector = x => x) {\n        Linqer._ensureFunction(keySelector);\n        Linqer._ensureFunction(valueSelector);\n        const result = new Map();\n        let index = 0;\n        for (const item of this) {\n            result.set(keySelector(item, index), valueSelector(item, index));\n            index++;\n        }\n        return result;\n    };\n    /// creates an object from an enumerable\n    Linqer.Enumerable.prototype.toObject = function (keySelector, valueSelector = x => x) {\n        Linqer._ensureFunction(keySelector);\n        Linqer._ensureFunction(valueSelector);\n        const result = {};\n        let index = 0;\n        for (const item of this) {\n            result[keySelector(item, index)] = valueSelector(item);\n            index++;\n        }\n        return result;\n    };\n    Linqer.Enumerable.prototype.toHashSet = function () {\n        throw new Error('use toSet instead of toHashSet');\n    };\n    /// creates a set from an enumerable\n    Linqer.Enumerable.prototype.toSet = function () {\n        const result = new Set();\n        for (const item of this) {\n            result.add(item);\n        }\n        return result;\n    };\n    /// Produces the set union of two sequences.\n    Linqer.Enumerable.prototype.union = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        return this.concat(iterable).distinct(equalityComparer);\n    };\n    /// Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.\n    Linqer.Enumerable.prototype.zip = function (iterable, zipper) {\n        Linqer._ensureIterable(iterable);\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        }\n        else {\n            Linqer._ensureFunction(zipper);\n        }\n        const self = this;\n        const gen = function* () {\n            let index = 0;\n            const iterator1 = self[Symbol.iterator]();\n            const iterator2 = Linqer.Enumerable.from(iterable)[Symbol.iterator]();\n            let done = false;\n            do {\n                const val1 = iterator1.next();\n                const val2 = iterator2.next();\n                done = !!(val1.done || val2.done);\n                if (!done) {\n                    yield zipper(val1.value, val2.value, index);\n                }\n                index++;\n            } while (!done);\n        };\n        return new Linqer.Enumerable(gen);\n    };\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n(function (Linqer) {\n    /// Groups the elements of a sequence.\n    Linqer.Enumerable.prototype.groupBy = function (keySelector) {\n        Linqer._ensureFunction(keySelector);\n        const self = this;\n        const gen = function* () {\n            const groupMap = new Map();\n            let index = 0;\n            // iterate all items and group them in a Map\n            for (const item of self) {\n                const key = keySelector(item, index);\n                const group = groupMap.get(key);\n                if (group) {\n                    group.push(item);\n                }\n                else {\n                    groupMap.set(key, [item]);\n                }\n                index++;\n            }\n            // then yield a GroupEnumerable for each group\n            for (const [key, items] of groupMap) {\n                const group = new GroupEnumerable(items, key);\n                yield group;\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        return result;\n    };\n    /// Correlates the elements of two sequences based on key equality and groups the results. A specified equalityComparer is used to compare keys.\n    /// WARNING: using the equality comparer will be slower\n    Linqer.Enumerable.prototype.groupJoin = function (iterable, innerKeySelector, outerKeySelector, resultSelector, equalityComparer = Linqer.EqualityComparer.default) {\n        const self = this;\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const lookup = new Linqer.Enumerable(iterable)\n                    .groupBy(outerKeySelector)\n                    .toMap(g => g.key, g => g);\n                let index = 0;\n                for (const innerItem of self) {\n                    const arr = Linqer._toArray(lookup.get(innerKeySelector(innerItem, index)));\n                    yield resultSelector(innerItem, arr);\n                    index++;\n                }\n            }\n            : function* () {\n                let innerIndex = 0;\n                for (const innerItem of self) {\n                    const arr = [];\n                    let outerIndex = 0;\n                    for (const outerItem of Linqer.Enumerable.from(iterable)) {\n                        if (equalityComparer(innerKeySelector(innerItem, innerIndex), outerKeySelector(outerItem, outerIndex))) {\n                            arr.push(outerItem);\n                        }\n                        outerIndex++;\n                    }\n                    yield resultSelector(innerItem, arr);\n                    innerIndex++;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Correlates the elements of two sequences based on matching keys.\n    /// WARNING: using the equality comparer will be slower\n    Linqer.Enumerable.prototype.join = function (iterable, innerKeySelector, outerKeySelector, resultSelector, equalityComparer = Linqer.EqualityComparer.default) {\n        const self = this;\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const lookup = new Linqer.Enumerable(iterable)\n                    .groupBy(outerKeySelector)\n                    .toMap(g => g.key, g => g);\n                let index = 0;\n                for (const innerItem of self) {\n                    const group = lookup.get(innerKeySelector(innerItem, index));\n                    if (group) {\n                        for (const outerItem of group) {\n                            yield resultSelector(innerItem, outerItem);\n                        }\n                    }\n                    index++;\n                }\n            }\n            : function* () {\n                let innerIndex = 0;\n                for (const innerItem of self) {\n                    let outerIndex = 0;\n                    for (const outerItem of Linqer.Enumerable.from(iterable)) {\n                        if (equalityComparer(innerKeySelector(innerItem, innerIndex), outerKeySelector(outerItem, outerIndex))) {\n                            yield resultSelector(innerItem, outerItem);\n                        }\n                        outerIndex++;\n                    }\n                    innerIndex++;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    Linqer.Enumerable.prototype.toLookup = function () {\n        throw new Error('use groupBy instead of toLookup');\n    };\n    /**\n     * An Enumerable that also exposes a group key\n     *\n     * @export\n     * @class GroupEnumerable\n     * @extends {Enumerable}\n     */\n    class GroupEnumerable extends Linqer.Enumerable {\n        constructor(iterable, key) {\n            super(iterable);\n            this.key = key;\n        }\n    }\n    Linqer.GroupEnumerable = GroupEnumerable;\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n(function (Linqer) {\n    /// Sorts the elements of a sequence in ascending order.\n    Linqer.Enumerable.prototype.orderBy = function (keySelector) {\n        if (keySelector) {\n            Linqer._ensureFunction(keySelector);\n        }\n        else {\n            keySelector = item => item;\n        }\n        return new OrderedEnumerable(this, keySelector, true);\n    };\n    /// Sorts the elements of a sequence in descending order.\n    Linqer.Enumerable.prototype.orderByDescending = function (keySelector) {\n        if (keySelector) {\n            Linqer._ensureFunction(keySelector);\n        }\n        else {\n            keySelector = item => item;\n        }\n        return new OrderedEnumerable(this, keySelector, false);\n    };\n    /// use QuickSort for ordering (default). Recommended when take, skip, takeLast, skipLast are used after orderBy\n    Linqer.Enumerable.prototype.useQuickSort = function () {\n        this._useQuickSort = true;\n        return this;\n    };\n    /// use the default browser sort implementation for ordering at all times\n    Linqer.Enumerable.prototype.useBrowserSort = function () {\n        this._useQuickSort = false;\n        return this;\n    };\n    //static sort: (arr: any[], comparer?: IComparer) => void;\n    Linqer.Enumerable.sort = function (arr, comparer = Linqer._defaultComparer) {\n        _quickSort(arr, 0, arr.length - 1, comparer, 0, Number.MAX_SAFE_INTEGER);\n        return arr;\n    };\n    let RestrictionType;\n    (function (RestrictionType) {\n        RestrictionType[RestrictionType[\"skip\"] = 0] = \"skip\";\n        RestrictionType[RestrictionType[\"skipLast\"] = 1] = \"skipLast\";\n        RestrictionType[RestrictionType[\"take\"] = 2] = \"take\";\n        RestrictionType[RestrictionType[\"takeLast\"] = 3] = \"takeLast\";\n    })(RestrictionType || (RestrictionType = {}));\n    /**\n     * An Enumerable yielding ordered items\n     *\n     * @export\n     * @class OrderedEnumerable\n     * @extends {Enumerable}\n     */\n    class OrderedEnumerable extends Linqer.Enumerable {\n        /**\n         *Creates an instance of OrderedEnumerable.\n         * @param {IterableType} src\n         * @param {ISelector} [keySelector]\n         * @param {boolean} [ascending=true]\n         * @memberof OrderedEnumerable\n         */\n        constructor(src, keySelector, ascending = true) {\n            super(src);\n            this._keySelectors = [];\n            this._restrictions = [];\n            if (keySelector) {\n                this._keySelectors.push({ keySelector: keySelector, ascending: ascending });\n            }\n            const self = this;\n            // generator gets an array of the original, \n            // sorted inside the interval determined by functions such as skip, take, skipLast, takeLast\n            this._generator = function* () {\n                let { startIndex, endIndex, arr } = this.getSortedArray();\n                if (arr) {\n                    for (let index = startIndex; index < endIndex; index++) {\n                        yield arr[index];\n                    }\n                }\n            };\n            // the count is the difference between the end and start indexes\n            // if no skip/take functions were used, this will be the original count\n            this._count = () => {\n                const totalCount = Linqer.Enumerable.from(self._src).count();\n                const { startIndex, endIndex } = this.getStartAndEndIndexes(self._restrictions, totalCount);\n                return endIndex - startIndex;\n            };\n            // an ordered enumerable cannot seek\n            this._canSeek = false;\n            this._tryGetAt = () => { throw new Error('Ordered enumerables cannot seek'); };\n        }\n        getSortedArray() {\n            const self = this;\n            let startIndex;\n            let endIndex;\n            let arr = null;\n            const innerEnumerable = self._src;\n            Linqer._ensureInternalTryGetAt(innerEnumerable);\n            // try to avoid enumerating the entire original into an array\n            if (innerEnumerable._canSeek) {\n                ({ startIndex, endIndex } = self.getStartAndEndIndexes(self._restrictions, innerEnumerable.count()));\n            }\n            else {\n                arr = Array.from(self._src);\n                ({ startIndex, endIndex } = self.getStartAndEndIndexes(self._restrictions, arr.length));\n            }\n            if (startIndex < endIndex) {\n                if (!arr) {\n                    arr = Array.from(self._src);\n                }\n                // only quicksort supports partial ordering inside an interval\n                const sort = self._useQuickSort\n                    ? (a, c) => _quickSort(a, 0, a.length - 1, c, startIndex, endIndex)\n                    : (a, c) => a.sort(c);\n                const sortFunc = self.generateSortFunc(self._keySelectors);\n                sort(arr, sortFunc);\n                return {\n                    startIndex,\n                    endIndex,\n                    arr\n                };\n            }\n            else {\n                return {\n                    startIndex,\n                    endIndex,\n                    arr: null\n                };\n            }\n        }\n        generateSortFunc(selectors) {\n            // simplify the selectors into an array of comparers\n            const comparers = selectors.map(s => {\n                const f = s.keySelector;\n                const comparer = (i1, i2) => {\n                    const k1 = f(i1);\n                    const k2 = f(i2);\n                    if (k1 > k2)\n                        return 1;\n                    if (k1 < k2)\n                        return -1;\n                    return 0;\n                };\n                return s.ascending\n                    ? comparer\n                    : (i1, i2) => -comparer(i1, i2);\n            });\n            // optimize the resulting sort function in the most common case\n            // (ordered by a single criterion)\n            return comparers.length == 1\n                ? comparers[0]\n                : (i1, i2) => {\n                    for (let i = 0; i < comparers.length; i++) {\n                        const v = comparers[i](i1, i2);\n                        if (v)\n                            return v;\n                    }\n                    return 0;\n                };\n        }\n        /// calculate the interval in which an array needs to have ordered items for this ordered enumerable\n        getStartAndEndIndexes(restrictions, arrLength) {\n            let startIndex = 0;\n            let endIndex = arrLength;\n            for (const restriction of restrictions) {\n                switch (restriction.type) {\n                    case RestrictionType.take:\n                        endIndex = Math.min(endIndex, startIndex + restriction.nr);\n                        break;\n                    case RestrictionType.skip:\n                        startIndex = Math.min(endIndex, startIndex + restriction.nr);\n                        break;\n                    case RestrictionType.takeLast:\n                        startIndex = Math.max(startIndex, endIndex - restriction.nr);\n                        break;\n                    case RestrictionType.skipLast:\n                        endIndex = Math.max(startIndex, endIndex - restriction.nr);\n                        break;\n                }\n            }\n            return { startIndex, endIndex };\n        }\n        /**\n         * Performs a subsequent ordering of the elements in a sequence in ascending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        thenBy(keySelector) {\n            this._keySelectors.push({ keySelector: keySelector, ascending: true });\n            return this;\n        }\n        /**\n         * Performs a subsequent ordering of the elements in a sequence in descending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        thenByDescending(keySelector) {\n            this._keySelectors.push({ keySelector: keySelector, ascending: false });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of take\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        take(nr) {\n            this._restrictions.push({ type: RestrictionType.take, nr: nr });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of takeLast\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        takeLast(nr) {\n            this._restrictions.push({ type: RestrictionType.takeLast, nr: nr });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of skip\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        skip(nr) {\n            this._restrictions.push({ type: RestrictionType.skip, nr: nr });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of skipLast\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        skipLast(nr) {\n            this._restrictions.push({ type: RestrictionType.skipLast, nr: nr });\n            return this;\n        }\n        /**\n         * An optimized implementation of toArray\n         *\n         * @returns {any[]}\n         * @memberof OrderedEnumerable\n         */\n        toArray() {\n            const { startIndex, endIndex, arr } = this.getSortedArray();\n            return arr\n                ? arr.slice(startIndex, endIndex)\n                : [];\n        }\n        /**\n         * An optimized implementation of toMap\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} [valueSelector=x => x]\n         * @returns {Map<any, any>}\n         * @memberof OrderedEnumerable\n         */\n        toMap(keySelector, valueSelector = x => x) {\n            Linqer._ensureFunction(keySelector);\n            Linqer._ensureFunction(valueSelector);\n            const result = new Map();\n            const arr = this.toArray();\n            for (let i = 0; i < arr.length; i++) {\n                result.set(keySelector(arr[i], i), valueSelector(arr[i], i));\n            }\n            return result;\n        }\n        /**\n         * An optimized implementation of toObject\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} [valueSelector=x => x]\n         * @returns {{ [key: string]: any }}\n         * @memberof OrderedEnumerable\n         */\n        toObject(keySelector, valueSelector = x => x) {\n            Linqer._ensureFunction(keySelector);\n            Linqer._ensureFunction(valueSelector);\n            const result = {};\n            const arr = this.toArray();\n            for (let i = 0; i < arr.length; i++) {\n                result[keySelector(arr[i], i)] = valueSelector(arr[i], i);\n            }\n            return result;\n        }\n        /**\n         * An optimized implementation of to Set\n         *\n         * @returns {Set<any>}\n         * @memberof OrderedEnumerable\n         */\n        toSet() {\n            const result = new Set();\n            const arr = this.toArray();\n            for (let i = 0; i < arr.length; i++) {\n                result.add(arr[i]);\n            }\n            return result;\n        }\n    }\n    Linqer.OrderedEnumerable = OrderedEnumerable;\n    const _insertionSortThreshold = 64;\n    /// insertion sort is used for small intervals\n    function _insertionsort(arr, leftIndex, rightIndex, comparer) {\n        for (let j = leftIndex; j <= rightIndex; j++) {\n            const key = arr[j];\n            let i = j - 1;\n            while (i >= leftIndex && comparer(arr[i], key) > 0) {\n                arr[i + 1] = arr[i];\n                i--;\n            }\n            arr[i + 1] = key;\n        }\n    }\n    /// swap two items in an array by index\n    function _swapArrayItems(array, leftIndex, rightIndex) {\n        const temp = array[leftIndex];\n        array[leftIndex] = array[rightIndex];\n        array[rightIndex] = temp;\n    }\n    // Quicksort partition by center value coming from both sides\n    function _partition(items, left, right, comparer) {\n        const pivot = items[(right + left) >> 1];\n        while (left <= right) {\n            while (comparer(items[left], pivot) < 0) {\n                left++;\n            }\n            while (comparer(items[right], pivot) > 0) {\n                right--;\n            }\n            if (left < right) {\n                _swapArrayItems(items, left, right);\n                left++;\n                right--;\n            }\n            else {\n                if (left === right)\n                    return left + 1;\n            }\n        }\n        return left;\n    }\n    /// optimized Quicksort algorithm\n    function _quickSort(items, left, right, comparer = Linqer._defaultComparer, minIndex = 0, maxIndex = Number.MAX_SAFE_INTEGER) {\n        if (!items.length)\n            return items;\n        // store partition indexes to be processed in here\n        const partitions = [];\n        partitions.push({ left, right });\n        let size = 1;\n        // the actual size of the partitions array never decreases\n        // but we keep score of the number of partitions in 'size'\n        // and we reuse slots whenever possible\n        while (size) {\n            const partition = { left, right } = partitions[size - 1];\n            if (right - left < _insertionSortThreshold) {\n                _insertionsort(items, left, right, comparer);\n                size--;\n                continue;\n            }\n            const index = _partition(items, left, right, comparer);\n            if (left < index - 1 && index - 1 >= minIndex) {\n                partition.right = index - 1;\n                if (index < right && index < maxIndex) {\n                    partitions[size] = { left: index, right };\n                    size++;\n                }\n            }\n            else {\n                if (index < right && index < maxIndex) {\n                    partition.left = index;\n                }\n                else {\n                    size--;\n                }\n            }\n        }\n        return items;\n    }\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\n/// <reference path=\"./LInQer.Enumerable.ts\" />\n/// <reference path=\"./LInQer.OrderedEnumerable.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n/// <reference path=\"./LInQer.Enumerable.ts\" />\n/// <reference path=\"./LInQer.OrderedEnumerable.ts\" />\n(function (Linqer) {\n    /// randomizes the enumerable (partial Fisher-Yates)\n    Linqer.Enumerable.prototype.shuffle = function () {\n        const self = this;\n        function* gen() {\n            const arr = self.toArray();\n            const len = arr.length;\n            let n = 0;\n            while (n < len) {\n                let k = n + Math.floor(Math.random() * (len - n));\n                const value = arr[k];\n                arr[k] = arr[n];\n                arr[n] = value;\n                n++;\n                yield value;\n            }\n        }\n        const result = Linqer.Enumerable.from(gen);\n        result._count = () => self.count();\n        return result;\n    };\n    /// implements random reservoir sampling of k items, with the option to specify a maximum limit for the items\n    Linqer.Enumerable.prototype.randomSample = function (k, limit = Number.MAX_SAFE_INTEGER) {\n        let index = 0;\n        const sample = [];\n        Linqer._ensureInternalTryGetAt(this);\n        if (this._canSeek) { // L algorithm\n            const length = this.count();\n            let index = 0;\n            for (index = 0; index < k && index < limit && index < length; index++) {\n                sample.push(this.elementAt(index));\n            }\n            let W = Math.exp(Math.log(Math.random()) / k);\n            while (index < length && index < limit) {\n                index += Math.floor(Math.log(Math.random()) / Math.log(1 - W)) + 1;\n                if (index < length && index < limit) {\n                    sample[Math.floor(Math.random() * k)] = this.elementAt(index);\n                    W *= Math.exp(Math.log(Math.random()) / k);\n                }\n            }\n        }\n        else { // R algorithm\n            for (const item of this) {\n                if (index < k) {\n                    sample.push(item);\n                }\n                else {\n                    const j = Math.floor(Math.random() * index);\n                    if (j < k) {\n                        sample[j] = item;\n                    }\n                }\n                index++;\n                if (index >= limit)\n                    break;\n            }\n        }\n        return Linqer.Enumerable.from(sample);\n    };\n    /// returns the distinct values based on a hashing function\n    Linqer.Enumerable.prototype.distinctByHash = function (hashFunc) {\n        // this is much more performant than distinct with a custom comparer\n        const self = this;\n        const gen = function* () {\n            const distinctValues = new Set();\n            for (const item of self) {\n                const size = distinctValues.size;\n                distinctValues.add(hashFunc(item));\n                if (size < distinctValues.size) {\n                    yield item;\n                }\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// returns the values that have different hashes from the items of the iterable provided\n    Linqer.Enumerable.prototype.exceptByHash = function (iterable, hashFunc) {\n        // this is much more performant than except with a custom comparer\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        const gen = function* () {\n            const distinctValues = Linqer.Enumerable.from(iterable).select(hashFunc).toSet();\n            for (const item of self) {\n                if (!distinctValues.has(hashFunc(item))) {\n                    yield item;\n                }\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// returns the values that have the same hashes as items of the iterable provided\n    Linqer.Enumerable.prototype.intersectByHash = function (iterable, hashFunc) {\n        // this is much more performant than intersect with a custom comparer\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        const gen = function* () {\n            const distinctValues = Linqer.Enumerable.from(iterable).select(hashFunc).toSet();\n            for (const item of self) {\n                if (distinctValues.has(hashFunc(item))) {\n                    yield item;\n                }\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// returns the index of a value in an ordered enumerable or false if not found\n    /// WARNING: use the same comparer as the one used in the ordered enumerable. The algorithm assumes the enumerable is already sorted.\n    Linqer.Enumerable.prototype.binarySearch = function (value, comparer = Linqer._defaultComparer) {\n        let enumerable = this.toList();\n        let start = 0;\n        let end = enumerable.count() - 1;\n        while (start <= end) {\n            const mid = (start + end) >> 1;\n            const comp = comparer(enumerable.elementAt(mid), value);\n            if (comp == 0)\n                return mid;\n            if (comp < 0) {\n                start = mid + 1;\n            }\n            else {\n                end = mid - 1;\n            }\n        }\n        return false;\n    };\n    /// joins each item of the enumerable with previous items from the same enumerable\n    Linqer.Enumerable.prototype.lag = function (offset, zipper) {\n        if (!offset) {\n            throw new Error('offset has to be positive');\n        }\n        if (offset < 0) {\n            throw new Error('offset has to be positive. Use .lead if you want to join with next items');\n        }\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        }\n        else {\n            Linqer._ensureFunction(zipper);\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(this);\n        // generator uses a buffer to hold all the items within the offset interval\n        const gen = function* () {\n            const buffer = Array(offset);\n            let index = 0;\n            for (const item of self) {\n                const index2 = index - offset;\n                const item2 = index2 < 0\n                    ? undefined\n                    : buffer[index2 % offset];\n                yield zipper(item, item2);\n                buffer[index % offset] = item;\n                index++;\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the same as of the original enumerable\n        result._count = () => {\n            const count = self.count();\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const val1 = self._tryGetAt(index);\n                const val2 = self._tryGetAt(index - offset);\n                if (val1) {\n                    return {\n                        value: zipper(val1.value, val2 ? val2.value : undefined)\n                    };\n                }\n                return null;\n            };\n        }\n        return result;\n    };\n    /// joins each item of the enumerable with next items from the same enumerable\n    Linqer.Enumerable.prototype.lead = function (offset, zipper) {\n        if (!offset) {\n            throw new Error('offset has to be positive');\n        }\n        if (offset < 0) {\n            throw new Error('offset has to be positive. Use .lag if you want to join with previous items');\n        }\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        }\n        else {\n            Linqer._ensureFunction(zipper);\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(this);\n        // generator uses a buffer to hold all the items within the offset interval\n        const gen = function* () {\n            const buffer = Array(offset);\n            let index = 0;\n            for (const item of self) {\n                const index2 = index - offset;\n                if (index2 >= 0) {\n                    const item2 = buffer[index2 % offset];\n                    yield zipper(item2, item);\n                }\n                buffer[index % offset] = item;\n                index++;\n            }\n            for (let i = 0; i < offset; i++) {\n                const item = buffer[(index + i) % offset];\n                yield zipper(item, undefined);\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the same as of the original enumerable\n        result._count = () => {\n            const count = self.count();\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const val1 = self._tryGetAt(index);\n                const val2 = self._tryGetAt(index + offset);\n                if (val1) {\n                    return {\n                        value: zipper(val1.value, val2 ? val2.value : undefined)\n                    };\n                }\n                return null;\n            };\n        }\n        return result;\n    };\n    /// returns an enumerable of at least minLength, padding the end with a value or the result of a function\n    Linqer.Enumerable.prototype.padEnd = function (minLength, filler) {\n        if (minLength <= 0) {\n            throw new Error('minLength has to be positive.');\n        }\n        let fillerFunc;\n        if (typeof filler !== 'function') {\n            fillerFunc = (index) => filler;\n        }\n        else {\n            fillerFunc = filler;\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(this);\n        // generator iterates all elements, \n        // then yields the result of the filler function until minLength items\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                yield item;\n                index++;\n            }\n            for (; index < minLength; index++) {\n                yield fillerFunc(index);\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the maximum between minLength and the original count\n        result._count = () => {\n            const count = Math.max(minLength, self.count());\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const val = self._tryGetAt(index);\n                if (val)\n                    return val;\n                if (index < minLength) {\n                    return { value: fillerFunc(index) };\n                }\n                return null;\n            };\n        }\n        return result;\n    };\n    /// returns an enumerable of at least minLength, padding the start with a value or the result of a function\n    /// if the enumerable cannot seek, then it will be iterated minLength time\n    Linqer.Enumerable.prototype.padStart = function (minLength, filler) {\n        if (minLength <= 0) {\n            throw new Error('minLength has to be positive.');\n        }\n        let fillerFunc;\n        if (typeof filler !== 'function') {\n            fillerFunc = (index) => filler;\n        }\n        else {\n            fillerFunc = filler;\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(self);\n        // generator needs a buffer to hold offset values\n        // it yields values from the buffer when it overflows\n        // or filler function results if the buffer is not full \n        // after iterating the entire original enumerable\n        const gen = function* () {\n            const buffer = Array(minLength);\n            let index = 0;\n            const iterator = self[Symbol.iterator]();\n            let flushed = false;\n            let done = false;\n            do {\n                const val = iterator.next();\n                done = !!val.done;\n                if (!done) {\n                    buffer[index] = val.value;\n                    index++;\n                }\n                if (flushed && !done) {\n                    yield val.value;\n                }\n                else {\n                    if (done || index === minLength) {\n                        for (let i = 0; i < minLength - index; i++) {\n                            yield fillerFunc(i);\n                        }\n                        for (let i = 0; i < index; i++) {\n                            yield buffer[i];\n                        }\n                        flushed = true;\n                    }\n                }\n            } while (!done);\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the max of minLength and the original count\n        result._count = () => {\n            const count = Math.max(minLength, self.count());\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const count = self.count();\n                const delta = minLength - count;\n                if (delta <= 0) {\n                    return self._tryGetAt(index);\n                }\n                if (index < delta) {\n                    return { value: fillerFunc(index) };\n                }\n                return self._tryGetAt(index - delta);\n            };\n        }\n        return result;\n    };\n})(Linqer || (Linqer = {}));\n// export to NPM\nif (typeof (module) !== 'undefined') {\n    module.exports = Linqer;\n}\n//# sourceMappingURL=LInQer.all.js.map"
  },
  {
    "path": "LInQer.extra.js",
    "content": "\"use strict\";\n/// <reference path=\"./LInQer.Slim.ts\" />\n/// <reference path=\"./LInQer.Enumerable.ts\" />\n/// <reference path=\"./LInQer.OrderedEnumerable.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n/// <reference path=\"./LInQer.Enumerable.ts\" />\n/// <reference path=\"./LInQer.OrderedEnumerable.ts\" />\n(function (Linqer) {\n    /// randomizes the enumerable (partial Fisher-Yates)\n    Linqer.Enumerable.prototype.shuffle = function () {\n        const self = this;\n        function* gen() {\n            const arr = self.toArray();\n            const len = arr.length;\n            let n = 0;\n            while (n < len) {\n                let k = n + Math.floor(Math.random() * (len - n));\n                const value = arr[k];\n                arr[k] = arr[n];\n                arr[n] = value;\n                n++;\n                yield value;\n            }\n        }\n        const result = Linqer.Enumerable.from(gen);\n        result._count = () => self.count();\n        return result;\n    };\n    /// implements random reservoir sampling of k items, with the option to specify a maximum limit for the items\n    Linqer.Enumerable.prototype.randomSample = function (k, limit = Number.MAX_SAFE_INTEGER) {\n        let index = 0;\n        const sample = [];\n        Linqer._ensureInternalTryGetAt(this);\n        if (this._canSeek) { // L algorithm\n            const length = this.count();\n            let index = 0;\n            for (index = 0; index < k && index < limit && index < length; index++) {\n                sample.push(this.elementAt(index));\n            }\n            let W = Math.exp(Math.log(Math.random()) / k);\n            while (index < length && index < limit) {\n                index += Math.floor(Math.log(Math.random()) / Math.log(1 - W)) + 1;\n                if (index < length && index < limit) {\n                    sample[Math.floor(Math.random() * k)] = this.elementAt(index);\n                    W *= Math.exp(Math.log(Math.random()) / k);\n                }\n            }\n        }\n        else { // R algorithm\n            for (const item of this) {\n                if (index < k) {\n                    sample.push(item);\n                }\n                else {\n                    const j = Math.floor(Math.random() * index);\n                    if (j < k) {\n                        sample[j] = item;\n                    }\n                }\n                index++;\n                if (index >= limit)\n                    break;\n            }\n        }\n        return Linqer.Enumerable.from(sample);\n    };\n    /// returns the distinct values based on a hashing function\n    Linqer.Enumerable.prototype.distinctByHash = function (hashFunc) {\n        // this is much more performant than distinct with a custom comparer\n        const self = this;\n        const gen = function* () {\n            const distinctValues = new Set();\n            for (const item of self) {\n                const size = distinctValues.size;\n                distinctValues.add(hashFunc(item));\n                if (size < distinctValues.size) {\n                    yield item;\n                }\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// returns the values that have different hashes from the items of the iterable provided\n    Linqer.Enumerable.prototype.exceptByHash = function (iterable, hashFunc) {\n        // this is much more performant than except with a custom comparer\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        const gen = function* () {\n            const distinctValues = Linqer.Enumerable.from(iterable).select(hashFunc).toSet();\n            for (const item of self) {\n                if (!distinctValues.has(hashFunc(item))) {\n                    yield item;\n                }\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// returns the values that have the same hashes as items of the iterable provided\n    Linqer.Enumerable.prototype.intersectByHash = function (iterable, hashFunc) {\n        // this is much more performant than intersect with a custom comparer\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        const gen = function* () {\n            const distinctValues = Linqer.Enumerable.from(iterable).select(hashFunc).toSet();\n            for (const item of self) {\n                if (distinctValues.has(hashFunc(item))) {\n                    yield item;\n                }\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// returns the index of a value in an ordered enumerable or false if not found\n    /// WARNING: use the same comparer as the one used in the ordered enumerable. The algorithm assumes the enumerable is already sorted.\n    Linqer.Enumerable.prototype.binarySearch = function (value, comparer = Linqer._defaultComparer) {\n        let enumerable = this.toList();\n        let start = 0;\n        let end = enumerable.count() - 1;\n        while (start <= end) {\n            const mid = (start + end) >> 1;\n            const comp = comparer(enumerable.elementAt(mid), value);\n            if (comp == 0)\n                return mid;\n            if (comp < 0) {\n                start = mid + 1;\n            }\n            else {\n                end = mid - 1;\n            }\n        }\n        return false;\n    };\n    /// joins each item of the enumerable with previous items from the same enumerable\n    Linqer.Enumerable.prototype.lag = function (offset, zipper) {\n        if (!offset) {\n            throw new Error('offset has to be positive');\n        }\n        if (offset < 0) {\n            throw new Error('offset has to be positive. Use .lead if you want to join with next items');\n        }\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        }\n        else {\n            Linqer._ensureFunction(zipper);\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(this);\n        // generator uses a buffer to hold all the items within the offset interval\n        const gen = function* () {\n            const buffer = Array(offset);\n            let index = 0;\n            for (const item of self) {\n                const index2 = index - offset;\n                const item2 = index2 < 0\n                    ? undefined\n                    : buffer[index2 % offset];\n                yield zipper(item, item2);\n                buffer[index % offset] = item;\n                index++;\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the same as of the original enumerable\n        result._count = () => {\n            const count = self.count();\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const val1 = self._tryGetAt(index);\n                const val2 = self._tryGetAt(index - offset);\n                if (val1) {\n                    return {\n                        value: zipper(val1.value, val2 ? val2.value : undefined)\n                    };\n                }\n                return null;\n            };\n        }\n        return result;\n    };\n    /// joins each item of the enumerable with next items from the same enumerable\n    Linqer.Enumerable.prototype.lead = function (offset, zipper) {\n        if (!offset) {\n            throw new Error('offset has to be positive');\n        }\n        if (offset < 0) {\n            throw new Error('offset has to be positive. Use .lag if you want to join with previous items');\n        }\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        }\n        else {\n            Linqer._ensureFunction(zipper);\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(this);\n        // generator uses a buffer to hold all the items within the offset interval\n        const gen = function* () {\n            const buffer = Array(offset);\n            let index = 0;\n            for (const item of self) {\n                const index2 = index - offset;\n                if (index2 >= 0) {\n                    const item2 = buffer[index2 % offset];\n                    yield zipper(item2, item);\n                }\n                buffer[index % offset] = item;\n                index++;\n            }\n            for (let i = 0; i < offset; i++) {\n                const item = buffer[(index + i) % offset];\n                yield zipper(item, undefined);\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the same as of the original enumerable\n        result._count = () => {\n            const count = self.count();\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const val1 = self._tryGetAt(index);\n                const val2 = self._tryGetAt(index + offset);\n                if (val1) {\n                    return {\n                        value: zipper(val1.value, val2 ? val2.value : undefined)\n                    };\n                }\n                return null;\n            };\n        }\n        return result;\n    };\n    /// returns an enumerable of at least minLength, padding the end with a value or the result of a function\n    Linqer.Enumerable.prototype.padEnd = function (minLength, filler) {\n        if (minLength <= 0) {\n            throw new Error('minLength has to be positive.');\n        }\n        let fillerFunc;\n        if (typeof filler !== 'function') {\n            fillerFunc = (index) => filler;\n        }\n        else {\n            fillerFunc = filler;\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(this);\n        // generator iterates all elements, \n        // then yields the result of the filler function until minLength items\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                yield item;\n                index++;\n            }\n            for (; index < minLength; index++) {\n                yield fillerFunc(index);\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the maximum between minLength and the original count\n        result._count = () => {\n            const count = Math.max(minLength, self.count());\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const val = self._tryGetAt(index);\n                if (val)\n                    return val;\n                if (index < minLength) {\n                    return { value: fillerFunc(index) };\n                }\n                return null;\n            };\n        }\n        return result;\n    };\n    /// returns an enumerable of at least minLength, padding the start with a value or the result of a function\n    /// if the enumerable cannot seek, then it will be iterated minLength time\n    Linqer.Enumerable.prototype.padStart = function (minLength, filler) {\n        if (minLength <= 0) {\n            throw new Error('minLength has to be positive.');\n        }\n        let fillerFunc;\n        if (typeof filler !== 'function') {\n            fillerFunc = (index) => filler;\n        }\n        else {\n            fillerFunc = filler;\n        }\n        const self = this;\n        Linqer._ensureInternalTryGetAt(self);\n        // generator needs a buffer to hold offset values\n        // it yields values from the buffer when it overflows\n        // or filler function results if the buffer is not full \n        // after iterating the entire original enumerable\n        const gen = function* () {\n            const buffer = Array(minLength);\n            let index = 0;\n            const iterator = self[Symbol.iterator]();\n            let flushed = false;\n            let done = false;\n            do {\n                const val = iterator.next();\n                done = !!val.done;\n                if (!done) {\n                    buffer[index] = val.value;\n                    index++;\n                }\n                if (flushed && !done) {\n                    yield val.value;\n                }\n                else {\n                    if (done || index === minLength) {\n                        for (let i = 0; i < minLength - index; i++) {\n                            yield fillerFunc(i);\n                        }\n                        for (let i = 0; i < index; i++) {\n                            yield buffer[i];\n                        }\n                        flushed = true;\n                    }\n                }\n            } while (!done);\n        };\n        const result = new Linqer.Enumerable(gen);\n        // count is the max of minLength and the original count\n        result._count = () => {\n            const count = Math.max(minLength, self.count());\n            if (!result._wasIterated)\n                result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index) => {\n                const count = self.count();\n                const delta = minLength - count;\n                if (delta <= 0) {\n                    return self._tryGetAt(index);\n                }\n                if (index < delta) {\n                    return { value: fillerFunc(index) };\n                }\n                return self._tryGetAt(index - delta);\n            };\n        }\n        return result;\n    };\n})(Linqer || (Linqer = {}));\n//# sourceMappingURL=LInQer.extra.js.map"
  },
  {
    "path": "LInQer.extra.ts",
    "content": "/// <reference path=\"./LInQer.Slim.ts\" />\n/// <reference path=\"./LInQer.Enumerable.ts\" />\n/// <reference path=\"./LInQer.OrderedEnumerable.ts\" />\n\nnamespace Linqer {\n\n    export interface Enumerable extends Iterable<any> {\n        /**\n         * Returns a randomized sequence of items from an initial source\n         * @returns shuffle \n         */\n        shuffle(): Enumerable;\n        /**\n         * implements random reservoir sampling of k items, with the option to specify a maximum limit for the items\n         * @param k \n         * @param limit \n         * @returns sample \n         */\n        randomSample(k: number, limit: number): Enumerable;\n        /**\n         * Returns the count of the items in a sequence. Depending on the sequence type this iterates through it or not.\n         * @returns count \n         */\n        count(): number;\n        /**\n         * returns the distinct values based on a hashing function\n         *\n         * @param {ISelector} hashFunc\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        distinctByHash(hashFunc: ISelector): Enumerable;\n        /**\n         * returns the values that have different hashes from the items of the iterable provided\n         *\n         * @param {IterableType} iterable\n         * @param {ISelector} hashFunc\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        exceptByHash(iterable: IterableType, hashFunc: ISelector): Enumerable;\n        /**\n         * returns the values that have the same hashes as items of the iterable provided\n         *\n         * @param {IterableType} iterable\n         * @param {ISelector} hashFunc\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        intersectByHash(iterable: IterableType, hashFunc: ISelector): Enumerable;\n        /**\n         * returns the index of a value in an ordered enumerable or false if not found\n         * WARNING: use the same comparer as the one used to order the enumerable. The algorithm assumes the enumerable is already sorted.\n         *\n         * @param {*} value\n         * @param {IComparer} comparer\n         * @returns {(number | boolean)}\n         * @memberof Enumerable\n         */\n        binarySearch(value: any, comparer: IComparer): number | boolean;\n        /**\n         * joins each item of the enumerable with previous items from the same enumerable\n         * @param offset \n         * @param zipper \n         * @returns lag \n         */\n        lag(offset: number, zipper: (item1: any, item2: any) => any): Enumerable;\n        /**\n         * joins each item of the enumerable with next items from the same enumerable\n         *\n         * @param {number} offset\n         * @param {(item1: any, item2: any) => any} zipper\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        lead(offset: number, zipper: (item1: any, item2: any) => any): Enumerable;\n        /**\n         * returns an enumerable of at least minLength, padding the end with a value or the result of a function\n         *\n         * @param {number} minLength\n         * @param {(any | ((index: number) => any))} filler\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        padEnd(minLength: number, filler: any | ((index: number) => any)): Enumerable;\n        /**\n         * returns an enumerable of at least minLength, padding the start with a value or the result of a function\n         * if the enumerable cannot seek, then it will be iterated minLength time\n         *\n         * @param {number} minLength\n         * @param {(any | ((index: number) => any))} filler\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        padStart(minLength: number, filler: any | ((index: number) => any)): Enumerable;\n    }\n\n    /// randomizes the enumerable (partial Fisher-Yates)\n    Enumerable.prototype.shuffle = function (): Enumerable {\n        const self = this;\n        function* gen() {\n            const arr = self.toArray();\n            const len = arr.length;\n            let n = 0;\n            while (n < len) {\n                let k = n + Math.floor(Math.random() * (len - n));\n                const value = arr[k];\n                arr[k] = arr[n];\n                arr[n] = value;\n                n++;\n                yield value;\n            }\n        }\n        const result = Enumerable.from(gen);\n        result._count = () => self.count();\n        return result;\n    };\n\n    /// implements random reservoir sampling of k items, with the option to specify a maximum limit for the items\n    Enumerable.prototype.randomSample = function (k: number, limit: number = Number.MAX_SAFE_INTEGER): Enumerable {\n        let index = 0;\n        const sample = [];\n        _ensureInternalTryGetAt(this);\n        if (this._canSeek) { // L algorithm\n            const length = this.count();\n            let index = 0;\n            for (index = 0; index < k && index < limit && index < length; index++) {\n                sample.push(this.elementAt(index));\n            }\n            let W = Math.exp(Math.log(Math.random()) / k);\n            while (index < length && index < limit) {\n                index += Math.floor(Math.log(Math.random()) / Math.log(1 - W)) + 1;\n                if (index < length && index < limit) {\n                    sample[Math.floor(Math.random() * k)] = this.elementAt(index);\n                    W *= Math.exp(Math.log(Math.random()) / k);\n                }\n            }\n        } else { // R algorithm\n            for (const item of this) {\n                if (index < k) {\n                    sample.push(item);\n                } else {\n                    const j = Math.floor(Math.random() * index);\n                    if (j < k) {\n                        sample[j] = item;\n                    }\n                }\n                index++;\n                if (index >= limit) break;\n            }\n        }\n        return Enumerable.from(sample);\n    }\n\n    /// returns the distinct values based on a hashing function\n    Enumerable.prototype.distinctByHash = function (hashFunc: ISelector): Enumerable {\n        // this is much more performant than distinct with a custom comparer\n        const self = this;\n        const gen = function* () {\n            const distinctValues = new Set();\n            for (const item of self) {\n                const size = distinctValues.size;\n                distinctValues.add(hashFunc(item));\n                if (size < distinctValues.size) {\n                    yield item;\n                }\n            }\n        };\n        return new Enumerable(gen);\n    };\n\n    /// returns the values that have different hashes from the items of the iterable provided\n    Enumerable.prototype.exceptByHash = function (iterable: IterableType, hashFunc: ISelector): Enumerable {\n        // this is much more performant than except with a custom comparer\n        _ensureIterable(iterable);\n        const self = this;\n        const gen = function* () {\n            const distinctValues = Enumerable.from(iterable).select(hashFunc).toSet();\n            for (const item of self) {\n                if (!distinctValues.has(hashFunc(item))) {\n                    yield item;\n                }\n            }\n        };\n        return new Enumerable(gen);\n    };\n\n    /// returns the values that have the same hashes as items of the iterable provided\n    Enumerable.prototype.intersectByHash = function (iterable: IterableType, hashFunc: ISelector): Enumerable {\n        // this is much more performant than intersect with a custom comparer\n        _ensureIterable(iterable);\n        const self = this;\n        const gen = function* () {\n            const distinctValues = Enumerable.from(iterable).select(hashFunc).toSet();\n            for (const item of self) {\n                if (distinctValues.has(hashFunc(item))) {\n                    yield item;\n                }\n            }\n        };\n        return new Enumerable(gen);\n    };\n\n    /// returns the index of a value in an ordered enumerable or false if not found\n    /// WARNING: use the same comparer as the one used in the ordered enumerable. The algorithm assumes the enumerable is already sorted.\n    Enumerable.prototype.binarySearch = function (value: any, comparer: IComparer = _defaultComparer): number | boolean {\n        let enumerable: Enumerable = this.toList();\n        let start = 0;\n        let end = enumerable.count() - 1;\n\n        while (start <= end) {\n            const mid = (start + end) >> 1;\n            const comp = comparer(enumerable.elementAt(mid), value);\n            if (comp == 0) return mid;\n            if (comp < 0) {\n                start = mid + 1;\n            } else {\n                end = mid - 1;\n            }\n        }\n\n        return false;\n    };\n\n    /// joins each item of the enumerable with previous items from the same enumerable\n    Enumerable.prototype.lag = function (offset: number, zipper: (item1: any, item2: any) => any): Enumerable {\n        if (!offset) {\n            throw new Error('offset has to be positive');\n        }\n        if (offset < 0) {\n            throw new Error('offset has to be positive. Use .lead if you want to join with next items');\n        }\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        } else {\n            _ensureFunction(zipper);\n        }\n        const self = this;\n        _ensureInternalTryGetAt(this);\n        // generator uses a buffer to hold all the items within the offset interval\n        const gen = function* () {\n            const buffer = Array(offset);\n            let index = 0;\n            for (const item of self) {\n                const index2 = index - offset;\n                const item2 = index2 < 0\n                    ? undefined\n                    : buffer[index2 % offset];\n                yield zipper(item, item2);\n                buffer[index % offset] = item;\n                index++;\n            }\n        };\n        const result = new Enumerable(gen);\n        // count is the same as of the original enumerable\n        result._count = () => {\n            const count = self.count();\n            if (!result._wasIterated) result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index: number) => {\n                const val1 = self._tryGetAt!(index);\n                const val2 = self._tryGetAt!(index - offset);\n                if (val1) {\n                    return {\n                        value: zipper(\n                            val1.value,\n                            val2 ? val2.value : undefined\n                        )\n                    };\n                }\n                return null;\n            };\n        }\n        return result;\n    }\n\n\n    /// joins each item of the enumerable with next items from the same enumerable\n    Enumerable.prototype.lead = function (offset: number, zipper: (item1: any, item2: any) => any): Enumerable {\n        if (!offset) {\n            throw new Error('offset has to be positive');\n        }\n        if (offset < 0) {\n            throw new Error('offset has to be positive. Use .lag if you want to join with previous items');\n        }\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        } else {\n            _ensureFunction(zipper);\n        }\n        const self = this;\n        _ensureInternalTryGetAt(this);\n        // generator uses a buffer to hold all the items within the offset interval\n        const gen = function* () {\n            const buffer = Array(offset);\n            let index = 0;\n            for (const item of self) {\n                const index2 = index - offset;\n                if (index2 >= 0) {\n                    const item2 = buffer[index2 % offset];\n                    yield zipper(item2, item);\n                }\n                buffer[index % offset] = item;\n                index++;\n            }\n            for (let i = 0; i < offset; i++) {\n                const item = buffer[(index + i) % offset];\n                yield zipper(item, undefined);\n            }\n        };\n        const result = new Enumerable(gen);\n        // count is the same as of the original enumerable\n        result._count = () => {\n            const count = self.count();\n            if (!result._wasIterated) result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index: number) => {\n                const val1 = self._tryGetAt!(index);\n                const val2 = self._tryGetAt!(index + offset);\n                if (val1) {\n                    return {\n                        value: zipper(\n                            val1.value,\n                            val2 ? val2.value : undefined\n                        )\n                    };\n                }\n                return null;\n            };\n        }\n        return result;\n    }\n\n    /// returns an enumerable of at least minLength, padding the end with a value or the result of a function\n    Enumerable.prototype.padEnd = function (minLength: number, filler: any | ((index: number) => any)): Enumerable {\n        if (minLength <= 0) {\n            throw new Error('minLength has to be positive.');\n        }\n        let fillerFunc: (index: number) => any;\n        if (typeof filler !== 'function') {\n            fillerFunc = (index: number) => filler;\n        } else {\n            fillerFunc = filler;\n        }\n        const self = this;\n        _ensureInternalTryGetAt(this);\n        // generator iterates all elements, \n        // then yields the result of the filler function until minLength items\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                yield item;\n                index++;\n            }\n            for (; index < minLength; index++) {\n                yield fillerFunc(index);\n            }\n        };\n        const result = new Enumerable(gen);\n        // count is the maximum between minLength and the original count\n        result._count = () => {\n            const count = Math.max(minLength, self.count());\n            if (!result._wasIterated) result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index: number) => {\n                const val = self._tryGetAt!(index);\n                if (val) return val;\n                if (index < minLength) {\n                    return { value: fillerFunc(index) };\n                }\n                return null;\n            };\n        }\n        return result;\n    }\n\n\n    /// returns an enumerable of at least minLength, padding the start with a value or the result of a function\n    /// if the enumerable cannot seek, then it will be iterated minLength time\n    Enumerable.prototype.padStart = function (minLength: number, filler: any | ((index: number) => any)): Enumerable {\n        if (minLength <= 0) {\n            throw new Error('minLength has to be positive.');\n        }\n        let fillerFunc: (index: number) => any;\n        if (typeof filler !== 'function') {\n            fillerFunc = (index: number) => filler;\n        } else {\n            fillerFunc = filler;\n        }\n        const self = this;\n        _ensureInternalTryGetAt(self);\n        // generator needs a buffer to hold offset values\n        // it yields values from the buffer when it overflows\n        // or filler function results if the buffer is not full \n        // after iterating the entire original enumerable\n        const gen = function* () {\n            const buffer = Array(minLength);\n            let index = 0;\n            const iterator = self[Symbol.iterator]();\n            let flushed = false;\n            let done = false;\n            do {\n                const val = iterator.next();\n                done = !!val.done;\n                if (!done) {\n                    buffer[index] = val.value;\n                    index++;\n                }\n                if (flushed && !done) {\n                    yield val.value;\n                } else {\n                    if (done || index === minLength) {\n                        for (let i = 0; i < minLength - index; i++) {\n                            yield fillerFunc(i);\n                        }\n                        for (let i = 0; i < index; i++) {\n                            yield buffer[i];\n                        }\n                        flushed = true;\n                    }\n                }\n            } while (!done);\n        };\n        const result = new Enumerable(gen);\n        // count is the max of minLength and the original count\n        result._count = () => {\n            const count = Math.max(minLength, self.count());\n            if (!result._wasIterated) result._wasIterated = self._wasIterated;\n            return count;\n        };\n        // seeking is possible only if the original was seekable\n        if (self._canSeek) {\n            result._canSeek = true;\n            result._tryGetAt = (index: number) => {\n                const count = self.count();\n                const delta = minLength-count;\n                if (delta<=0) {\n                    return self._tryGetAt!(index);\n                }\n                if (index<delta) {\n                    return { value: fillerFunc(index) };\n                }\n                return self._tryGetAt!(index-delta);\n            };\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "LInQer.js",
    "content": "\"use strict\";\nvar Linqer;\n(function (Linqer) {\n    /**\n     * wrapper class over iterable instances that exposes the methods usually found in .NET LINQ\n     *\n     * @export\n     * @class Enumerable\n     * @implements {Iterable<any>}\n     * @implements {IUsesQuickSort}\n     */\n    class Enumerable {\n        /**\n         * You should never use this. Instead use Enumerable.from\n         * @param {IterableType} src\n         * @memberof Enumerable\n         */\n        constructor(src) {\n            _ensureIterable(src);\n            this._src = src;\n            const iteratorFunction = src[Symbol.iterator];\n            // the generator is either the iterator of the source enumerable\n            // or the generator function that was provided as the source itself\n            if (iteratorFunction) {\n                this._generator = iteratorFunction.bind(src);\n            }\n            else {\n                this._generator = src;\n            }\n            // set sorting method on an enumerable and all the derived ones should inherit it\n            // TODO: a better method of doing this\n            this._useQuickSort = src._useQuickSort !== undefined\n                ? src._useQuickSort\n                : true;\n            this._canSeek = false;\n            this._count = null;\n            this._tryGetAt = null;\n            this._wasIterated = false;\n        }\n        /**\n         * Wraps an iterable item into an Enumerable if it's not already one\n         *\n         * @static\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static from(iterable) {\n            if (iterable instanceof Enumerable)\n                return iterable;\n            return new Enumerable(iterable);\n        }\n        /**\n         * the Enumerable instance exposes the same iterator as the wrapped iterable or generator function\n         *\n         * @returns {Iterator<any>}\n         * @memberof Enumerable\n         */\n        [Symbol.iterator]() {\n            this._wasIterated = true;\n            return this._generator();\n        }\n        /**\n         * returns an empty Enumerable\n         *\n         * @static\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static empty() {\n            const result = new Enumerable([]);\n            result._count = () => 0;\n            result._tryGetAt = (index) => null;\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         * generates a sequence of integer numbers within a specified range.\n         *\n         * @static\n         * @param {number} start\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static range(start, count) {\n            const gen = function* () {\n                for (let i = 0; i < count; i++) {\n                    yield start + i;\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => count;\n            result._tryGetAt = index => {\n                if (index >= 0 && index < count)\n                    return { value: start + index };\n                return null;\n            };\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         *  Generates a sequence that contains one repeated value.\n         *\n         * @static\n         * @param {*} item\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static repeat(item, count) {\n            const gen = function* () {\n                for (let i = 0; i < count; i++) {\n                    yield item;\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => count;\n            result._tryGetAt = index => {\n                if (index >= 0 && index < count)\n                    return { value: item };\n                return null;\n            };\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         * Same value as count(), but will throw an Error if enumerable is not seekable and has to be iterated to get the length\n         */\n        get length() {\n            _ensureInternalTryGetAt(this);\n            if (!this._canSeek)\n                throw new Error('Calling length on this enumerable will iterate it. Use count()');\n            return this.count();\n        }\n        /**\n         * Concatenates two sequences by appending iterable to the existing one.\n         *\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        concat(iterable) {\n            _ensureIterable(iterable);\n            const self = this;\n            // the generator will iterate the enumerable first, then the iterable that was given as a parameter\n            // this will be able to seek if both the original and the iterable derived enumerable can seek\n            // the indexing function will get items from the first and then second enumerable without iteration\n            const gen = function* () {\n                for (const item of self) {\n                    yield item;\n                }\n                for (const item of Enumerable.from(iterable)) {\n                    yield item;\n                }\n            };\n            const result = new Enumerable(gen);\n            const other = Enumerable.from(iterable);\n            result._count = () => self.count() + other.count();\n            _ensureInternalTryGetAt(this);\n            _ensureInternalTryGetAt(other);\n            result._canSeek = self._canSeek && other._canSeek;\n            if (self._canSeek) {\n                result._tryGetAt = index => {\n                    return self._tryGetAt(index) || other._tryGetAt(index - self.count());\n                };\n            }\n            return result;\n        }\n        /**\n         * Returns the number of elements in a sequence.\n         *\n         * @returns {number}\n         * @memberof Enumerable\n         */\n        count() {\n            _ensureInternalCount(this);\n            return this._count();\n        }\n        /**\n         * Returns distinct elements from a sequence.\n         * WARNING: using a comparer makes this slower. Not specifying it uses a Set to determine distinctiveness.\n         *\n         * @param {IEqualityComparer} [equalityComparer=EqualityComparer.default]\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        distinct(equalityComparer = Linqer.EqualityComparer.default) {\n            const self = this;\n            // if the comparer function is not provided, a Set will be used to quickly determine distinctiveness\n            const gen = equalityComparer === Linqer.EqualityComparer.default\n                ? function* () {\n                    const distinctValues = new Set();\n                    for (const item of self) {\n                        const size = distinctValues.size;\n                        distinctValues.add(item);\n                        if (size < distinctValues.size) {\n                            yield item;\n                        }\n                    }\n                }\n                // otherwise values will be compared with previous values ( O(n^2) )\n                // use distinctByHash in Linqer.extra to use a hashing function ( O(n log n) )\n                : function* () {\n                    const values = [];\n                    for (const item of self) {\n                        let unique = true;\n                        for (let i = 0; i < values.length; i++) {\n                            if (equalityComparer(item, values[i])) {\n                                unique = false;\n                                break;\n                            }\n                        }\n                        if (unique)\n                            yield item;\n                        values.push(item);\n                    }\n                };\n            return new Enumerable(gen);\n        }\n        /**\n         * Returns the element at a specified index in a sequence.\n         *\n         * @param {number} index\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        elementAt(index) {\n            _ensureInternalTryGetAt(this);\n            const result = this._tryGetAt(index);\n            if (!result)\n                throw new Error('Index out of range');\n            return result.value;\n        }\n        /**\n         * Returns the element at a specified index in a sequence or undefined if the index is out of range.\n         *\n         * @param {number} index\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        elementAtOrDefault(index) {\n            _ensureInternalTryGetAt(this);\n            const result = this._tryGetAt(index);\n            if (!result)\n                return undefined;\n            return result.value;\n        }\n        /**\n         * Returns the first element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        first() {\n            return this.elementAt(0);\n        }\n        /**\n         * Returns the first element of a sequence, or a default value if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        firstOrDefault() {\n            return this.elementAtOrDefault(0);\n        }\n        /**\n         * Returns the last element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        last() {\n            _ensureInternalTryGetAt(this);\n            // if this cannot seek, getting the last element requires iterating the whole thing\n            if (!this._canSeek) {\n                let result = null;\n                let found = false;\n                for (const item of this) {\n                    result = item;\n                    found = true;\n                }\n                if (found)\n                    return result;\n                throw new Error('The enumeration is empty');\n            }\n            // if this can seek, then just go directly at the last element\n            const count = this.count();\n            return this.elementAt(count - 1);\n        }\n        /**\n         * Returns the last element of a sequence, or undefined if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        lastOrDefault() {\n            _ensureInternalTryGetAt(this);\n            if (!this._canSeek) {\n                let result = undefined;\n                for (const item of this) {\n                    result = item;\n                }\n                return result;\n            }\n            const count = this.count();\n            return this.elementAtOrDefault(count - 1);\n        }\n        /**\n         * Returns the count, minimum and maximum value in a sequence of values.\n         * A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {{ count: number, min: any, max: any }}\n         * @memberof Enumerable\n         */\n        stats(comparer) {\n            if (comparer) {\n                _ensureFunction(comparer);\n            }\n            else {\n                comparer = Linqer._defaultComparer;\n            }\n            const agg = {\n                count: 0,\n                min: undefined,\n                max: undefined\n            };\n            for (const item of this) {\n                if (typeof agg.min === 'undefined' || comparer(item, agg.min) < 0)\n                    agg.min = item;\n                if (typeof agg.max === 'undefined' || comparer(item, agg.max) > 0)\n                    agg.max = item;\n                agg.count++;\n            }\n            return agg;\n        }\n        /**\n         *  Returns the minimum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        min(comparer) {\n            const stats = this.stats(comparer);\n            return stats.count === 0\n                ? undefined\n                : stats.min;\n        }\n        /**\n         *  Returns the maximum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        max(comparer) {\n            const stats = this.stats(comparer);\n            return stats.count === 0\n                ? undefined\n                : stats.max;\n        }\n        /**\n         * Projects each element of a sequence into a new form.\n         *\n         * @param {ISelector} selector\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        select(selector) {\n            _ensureFunction(selector);\n            const self = this;\n            // the generator is applying the selector on all the items of the enumerable\n            // the count of the resulting enumerable is the same as the original's\n            // the indexer is the same as that of the original, with the selector applied on the value\n            const gen = function* () {\n                let index = 0;\n                for (const item of self) {\n                    yield selector(item, index);\n                    index++;\n                }\n            };\n            const result = new Enumerable(gen);\n            _ensureInternalCount(this);\n            result._count = this._count;\n            _ensureInternalTryGetAt(self);\n            result._canSeek = self._canSeek;\n            result._tryGetAt = index => {\n                const res = self._tryGetAt(index);\n                if (!res)\n                    return res;\n                return { value: selector(res.value) };\n            };\n            return result;\n        }\n        /**\n         * Bypasses a specified number of elements in a sequence and then returns the remaining elements.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        skip(nr) {\n            const self = this;\n            // the generator just enumerates the first nr numbers then starts yielding values\n            // the count is the same as the original enumerable, minus the skipped items and at least 0\n            // the indexer is the same as for the original, with an offset\n            const gen = function* () {\n                let nrLeft = nr;\n                for (const item of self) {\n                    if (nrLeft > 0) {\n                        nrLeft--;\n                    }\n                    else {\n                        yield item;\n                    }\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => Math.max(0, self.count() - nr);\n            _ensureInternalTryGetAt(this);\n            result._canSeek = this._canSeek;\n            result._tryGetAt = index => self._tryGetAt(index + nr);\n            return result;\n        }\n        /**\n         * Takes start elements, ignores howmany elements, continues with the new items and continues with the original enumerable\n         * Equivalent to the value of an array after performing splice on it with the same parameters\n         * @param start\n         * @param howmany\n         * @param items\n         * @returns splice\n         */\n        splice(start, howmany, ...newItems) {\n            // tried to define length and splice so that this is seen as an Array-like object, \n            // but it doesn't work on properties. length needs to be a field.\n            return this.take(start).concat(newItems).concat(this.skip(start + howmany));\n        }\n        /**\n         * Computes the sum of a sequence of numeric values.\n         *\n         * @returns {(number | undefined)}\n         * @memberof Enumerable\n         */\n        sum() {\n            const stats = this.sumAndCount();\n            return stats.count === 0\n                ? undefined\n                : stats.sum;\n        }\n        /**\n         * Computes the sum and count of a sequence of numeric values.\n         *\n         * @returns {{ sum: number, count: number }}\n         * @memberof Enumerable\n         */\n        sumAndCount() {\n            const agg = {\n                count: 0,\n                sum: 0\n            };\n            for (const item of this) {\n                agg.sum = agg.count === 0\n                    ? _toNumber(item)\n                    : agg.sum + _toNumber(item);\n                agg.count++;\n            }\n            return agg;\n        }\n        /**\n         * Returns a specified number of contiguous elements from the start of a sequence.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        take(nr) {\n            const self = this;\n            // the generator will stop after nr items yielded\n            // the count is the maximum between the total count and nr\n            // the indexer is the same, as long as it's not higher than nr\n            const gen = function* () {\n                let nrLeft = nr;\n                for (const item of self) {\n                    if (nrLeft > 0) {\n                        yield item;\n                        nrLeft--;\n                    }\n                    if (nrLeft <= 0) {\n                        break;\n                    }\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => Math.min(nr, self.count());\n            _ensureInternalTryGetAt(this);\n            result._canSeek = self._canSeek;\n            if (self._canSeek) {\n                result._tryGetAt = index => {\n                    if (index >= nr)\n                        return null;\n                    return self._tryGetAt(index);\n                };\n            }\n            return result;\n        }\n        /**\n         * creates an array from an Enumerable\n         *\n         * @returns {any[]}\n         * @memberof Enumerable\n         */\n        toArray() {\n            var _a;\n            _ensureInternalTryGetAt(this);\n            // this should be faster than Array.from(this)\n            if (this._canSeek) {\n                const arr = new Array(this.count());\n                for (let i = 0; i < arr.length; i++) {\n                    arr[i] = (_a = this._tryGetAt(i)) === null || _a === void 0 ? void 0 : _a.value;\n                }\n                return arr;\n            }\n            // try to optimize the array growth by increasing it \n            // by 64 every time it is needed \n            const minIncrease = 64;\n            let size = 0;\n            const arr = [];\n            for (const item of this) {\n                if (size === arr.length) {\n                    arr.length += minIncrease;\n                }\n                arr[size] = item;\n                size++;\n            }\n            arr.length = size;\n            return arr;\n        }\n        /**\n         * similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do count and elementAt without iterating\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        toList() {\n            _ensureInternalTryGetAt(this);\n            if (this._canSeek)\n                return this;\n            return Enumerable.from(this.toArray());\n        }\n        /**\n         * Filters a sequence of values based on a predicate.\n         *\n         * @param {IFilter} condition\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        where(condition) {\n            _ensureFunction(condition);\n            const self = this;\n            // cannot imply the count or indexer from the condition\n            // where will have to iterate through the whole thing\n            const gen = function* () {\n                let index = 0;\n                for (const item of self) {\n                    if (condition(item, index)) {\n                        yield item;\n                    }\n                    index++;\n                }\n            };\n            return new Enumerable(gen);\n        }\n    }\n    Linqer.Enumerable = Enumerable;\n    // throw if src is not a generator function or an iteratable\n    function _ensureIterable(src) {\n        if (src) {\n            if (src[Symbol.iterator])\n                return;\n            if (typeof src === 'function' && src.constructor.name === 'GeneratorFunction')\n                return;\n        }\n        throw new Error('the argument must be iterable!');\n    }\n    Linqer._ensureIterable = _ensureIterable;\n    // throw if f is not a function\n    function _ensureFunction(f) {\n        if (!f || typeof f !== 'function')\n            throw new Error('the argument needs to be a function!');\n    }\n    Linqer._ensureFunction = _ensureFunction;\n    // return Nan if this is not a number\n    // different from Number(obj), which would cast strings to numbers\n    function _toNumber(obj) {\n        return typeof obj === 'number'\n            ? obj\n            : Number.NaN;\n    }\n    // return the iterable if already an array or use Array.from to create one\n    function _toArray(iterable) {\n        if (!iterable)\n            return [];\n        if (Array.isArray(iterable))\n            return iterable;\n        return Array.from(iterable);\n    }\n    Linqer._toArray = _toArray;\n    // if the internal count function is not defined, set it to the most appropriate one\n    function _ensureInternalCount(enumerable) {\n        if (enumerable._count)\n            return;\n        if (enumerable._src instanceof Enumerable) {\n            // the count is the same as the underlying enumerable\n            const innerEnumerable = enumerable._src;\n            _ensureInternalCount(innerEnumerable);\n            enumerable._count = () => innerEnumerable._count();\n            return;\n        }\n        const src = enumerable._src;\n        // this could cause false positives, but if it has a numeric length or size, use it\n        if (typeof src !== 'function' && typeof src.length === 'number') {\n            enumerable._count = () => src.length;\n            return;\n        }\n        if (typeof src.size === 'number') {\n            enumerable._count = () => src.size;\n            return;\n        }\n        // otherwise iterate the whole thing and count all items\n        enumerable._count = () => {\n            let x = 0;\n            for (const item of enumerable)\n                x++;\n            return x;\n        };\n    }\n    Linqer._ensureInternalCount = _ensureInternalCount;\n    // ensure there is an internal indexer function adequate for this enumerable\n    // this also determines if the enumerable can seek\n    function _ensureInternalTryGetAt(enumerable) {\n        if (enumerable._tryGetAt)\n            return;\n        enumerable._canSeek = true;\n        if (enumerable._src instanceof Enumerable) {\n            // indexer and seekability is the same as for the underlying enumerable\n            const innerEnumerable = enumerable._src;\n            _ensureInternalTryGetAt(innerEnumerable);\n            enumerable._tryGetAt = index => innerEnumerable._tryGetAt(index);\n            enumerable._canSeek = innerEnumerable._canSeek;\n            return;\n        }\n        if (typeof enumerable._src === 'string') {\n            // a string can be accessed by index\n            enumerable._tryGetAt = index => {\n                if (index < enumerable._src.length) {\n                    return { value: enumerable._src.charAt(index) };\n                }\n                return null;\n            };\n            return;\n        }\n        if (Array.isArray(enumerable._src)) {\n            // an array can be accessed by index\n            enumerable._tryGetAt = index => {\n                if (index >= 0 && index < enumerable._src.length) {\n                    return { value: enumerable._src[index] };\n                }\n                return null;\n            };\n            return;\n        }\n        const src = enumerable._src;\n        if (typeof enumerable._src !== 'function' && typeof src.length === 'number') {\n            // try to access an object with a defined numeric length by indexing it\n            // might cause false positives\n            enumerable._tryGetAt = index => {\n                if (index < src.length && typeof src[index] !== 'undefined') {\n                    return { value: src[index] };\n                }\n                return null;\n            };\n            return;\n        }\n        enumerable._canSeek = false;\n        // TODO other specialized types? objects, maps, sets?\n        enumerable._tryGetAt = index => {\n            let x = 0;\n            for (const item of enumerable) {\n                if (index === x)\n                    return { value: item };\n                x++;\n            }\n            return null;\n        };\n    }\n    Linqer._ensureInternalTryGetAt = _ensureInternalTryGetAt;\n    /**\n     * The default comparer function between two items\n     * @param item1\n     * @param item2\n     */\n    Linqer._defaultComparer = (item1, item2) => {\n        if (item1 > item2)\n            return 1;\n        if (item1 < item2)\n            return -1;\n        return 0;\n    };\n    /**\n     * Predefined equality comparers\n     * default is the equivalent of ==\n     * exact is the equivalent of ===\n     */\n    Linqer.EqualityComparer = {\n        default: (item1, item2) => item1 == item2,\n        exact: (item1, item2) => item1 === item2,\n    };\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n(function (Linqer) {\n    /// Applies an accumulator function over a sequence.\n    /// The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.\n    Linqer.Enumerable.prototype.aggregate = function (accumulator, aggregator) {\n        Linqer._ensureFunction(aggregator);\n        for (const item of this) {\n            accumulator = aggregator(accumulator, item);\n        }\n        return accumulator;\n    };\n    /// Determines whether all elements of a sequence satisfy a condition.\n    Linqer.Enumerable.prototype.all = function (condition) {\n        Linqer._ensureFunction(condition);\n        return !this.any(x => !condition(x));\n    };\n    /// Determines whether any element of a sequence exists or satisfies a condition.\n    Linqer.Enumerable.prototype.any = function (condition) {\n        Linqer._ensureFunction(condition);\n        let index = 0;\n        for (const item of this) {\n            if (condition(item, index))\n                return true;\n            index++;\n        }\n        return false;\n    };\n    /// Appends a value to the end of the sequence.\n    Linqer.Enumerable.prototype.append = function (item) {\n        return this.concat([item]);\n    };\n    /// Computes the average of a sequence of numeric values.\n    Linqer.Enumerable.prototype.average = function () {\n        const stats = this.sumAndCount();\n        return stats.count === 0\n            ? undefined\n            : stats.sum / stats.count;\n    };\n    /// Returns the same enumerable\n    Linqer.Enumerable.prototype.asEnumerable = function () {\n        return this;\n    };\n    /// Checks the elements of a sequence based on their type\n    /// If type is a string, it will check based on typeof, else it will use instanceof.\n    /// Throws if types are different.\n    Linqer.Enumerable.prototype.cast = function (type) {\n        const f = typeof type === 'string'\n            ? x => typeof x === type\n            : x => x instanceof type;\n        return this.select(item => {\n            if (!f(item))\n                throw new Error(item + ' not of type ' + type);\n            return item;\n        });\n    };\n    /// Determines whether a sequence contains a specified element.\n    /// A custom function can be used to determine equality between elements.\n    Linqer.Enumerable.prototype.contains = function (item, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureFunction(equalityComparer);\n        return this.any(x => equalityComparer(x, item));\n    };\n    Linqer.Enumerable.prototype.defaultIfEmpty = function () {\n        throw new Error('defaultIfEmpty not implemented for Javascript');\n    };\n    /// Produces the set difference of two sequences WARNING: using the comparer is slower\n    Linqer.Enumerable.prototype.except = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        // use a Set for performance if the comparer is not set\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const distinctValues = Linqer.Enumerable.from(iterable).toSet();\n                for (const item of self) {\n                    if (!distinctValues.has(item))\n                        yield item;\n                }\n            }\n            // use exceptByHash from Linqer.extra for better performance\n            : function* () {\n                const values = Linqer._toArray(iterable);\n                for (const item of self) {\n                    let unique = true;\n                    for (let i = 0; i < values.length; i++) {\n                        if (equalityComparer(item, values[i])) {\n                            unique = false;\n                            break;\n                        }\n                    }\n                    if (unique)\n                        yield item;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Produces the set intersection of two sequences. WARNING: using a comparer is slower\n    Linqer.Enumerable.prototype.intersect = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        const self = this;\n        // use a Set for performance if the comparer is not set\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const distinctValues = new Set(Linqer.Enumerable.from(iterable));\n                for (const item of self) {\n                    if (distinctValues.has(item))\n                        yield item;\n                }\n            }\n            // use intersectByHash from Linqer.extra for better performance\n            : function* () {\n                const values = Linqer._toArray(iterable);\n                for (const item of self) {\n                    let unique = true;\n                    for (let i = 0; i < values.length; i++) {\n                        if (equalityComparer(item, values[i])) {\n                            unique = false;\n                            break;\n                        }\n                    }\n                    if (!unique)\n                        yield item;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    /// same as count\n    Linqer.Enumerable.prototype.longCount = function () {\n        return this.count();\n    };\n    /// Filters the elements of a sequence based on their type\n    /// If type is a string, it will filter based on typeof, else it will use instanceof\n    Linqer.Enumerable.prototype.ofType = function (type) {\n        const condition = typeof type === 'string'\n            ? x => typeof x === type\n            : x => x instanceof type;\n        return this.where(condition);\n    };\n    /// Adds a value to the beginning of the sequence.\n    Linqer.Enumerable.prototype.prepend = function (item) {\n        return new Linqer.Enumerable([item]).concat(this);\n    };\n    /// Inverts the order of the elements in a sequence.\n    Linqer.Enumerable.prototype.reverse = function () {\n        Linqer._ensureInternalTryGetAt(this);\n        const self = this;\n        // if it can seek, just read the enumerable backwards\n        const gen = this._canSeek\n            ? function* () {\n                const length = self.count();\n                for (let index = length - 1; index >= 0; index--) {\n                    yield self.elementAt(index);\n                }\n            }\n            // else enumerate it all into an array, then read it backwards\n            : function* () {\n                const arr = self.toArray();\n                for (let index = arr.length - 1; index >= 0; index--) {\n                    yield arr[index];\n                }\n            };\n        // the count is the same when reversed\n        const result = new Linqer.Enumerable(gen);\n        Linqer._ensureInternalCount(this);\n        result._count = this._count;\n        Linqer._ensureInternalTryGetAt(this);\n        // have a custom indexer only if the original enumerable could seek\n        if (this._canSeek) {\n            const self = this;\n            result._canSeek = true;\n            result._tryGetAt = index => self._tryGetAt(self.count() - index - 1);\n        }\n        return result;\n    };\n    /// Projects each element of a sequence to an iterable and flattens the resulting sequences into one sequence.\n    Linqer.Enumerable.prototype.selectMany = function (selector) {\n        if (typeof selector !== 'undefined') {\n            Linqer._ensureFunction(selector);\n        }\n        else {\n            selector = x => x;\n        }\n        const self = this;\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                const iter = selector(item, index);\n                Linqer._ensureIterable(iter);\n                for (const child of iter) {\n                    yield child;\n                }\n                index++;\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Determines whether two sequences are equal and in the same order according to an equality comparer.\n    Linqer.Enumerable.prototype.sequenceEqual = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        Linqer._ensureFunction(equalityComparer);\n        const iterator1 = this[Symbol.iterator]();\n        const iterator2 = Linqer.Enumerable.from(iterable)[Symbol.iterator]();\n        let done = false;\n        do {\n            const val1 = iterator1.next();\n            const val2 = iterator2.next();\n            const equal = (val1.done && val2.done) || (!val1.done && !val2.done && equalityComparer(val1.value, val2.value));\n            if (!equal)\n                return false;\n            done = !!val1.done;\n        } while (!done);\n        return true;\n    };\n    /// Returns the single element of a sequence and throws if it doesn't have exactly one\n    Linqer.Enumerable.prototype.single = function () {\n        const iterator = this[Symbol.iterator]();\n        let val = iterator.next();\n        if (val.done)\n            throw new Error('Sequence contains no elements');\n        const result = val.value;\n        val = iterator.next();\n        if (!val.done)\n            throw new Error('Sequence contains more than one element');\n        return result;\n    };\n    /// Returns the single element of a sequence or undefined if none found. It throws if the sequence contains multiple items.\n    Linqer.Enumerable.prototype.singleOrDefault = function () {\n        const iterator = this[Symbol.iterator]();\n        let val = iterator.next();\n        if (val.done)\n            return undefined;\n        const result = val.value;\n        val = iterator.next();\n        if (!val.done)\n            throw new Error('Sequence contains more than one element');\n        return result;\n    };\n    /// Selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.\n    Linqer.Enumerable.prototype.slice = function (start = 0, end) {\n        let enumerable = this;\n        // when the end is defined and positive and start is negative,\n        // the only way to compute the last index is to know the count\n        if (end !== undefined && end >= 0 && (start || 0) < 0) {\n            enumerable = enumerable.toList();\n            start = enumerable.count() + start;\n        }\n        if (start !== 0) {\n            if (start > 0) {\n                enumerable = enumerable.skip(start);\n            }\n            else {\n                enumerable = enumerable.takeLast(-start);\n            }\n        }\n        if (end !== undefined) {\n            if (end >= 0) {\n                enumerable = enumerable.take(end - start);\n            }\n            else {\n                enumerable = enumerable.skipLast(-end);\n            }\n        }\n        return enumerable;\n    };\n    /// Returns a new enumerable collection that contains the elements from source with the last nr elements of the source collection omitted.\n    Linqer.Enumerable.prototype.skipLast = function (nr) {\n        const self = this;\n        // the generator is using a buffer to cache nr values \n        // and only yields the values that overflow from it\n        const gen = function* () {\n            let nrLeft = nr;\n            const buffer = Array(nrLeft);\n            let index = 0;\n            let offset = 0;\n            for (const item of self) {\n                const value = buffer[index - offset];\n                buffer[index - offset] = item;\n                index++;\n                if (index - offset >= nrLeft) {\n                    offset += nrLeft;\n                }\n                if (index > nrLeft) {\n                    yield value;\n                }\n            }\n            buffer.length = 0;\n        };\n        const result = new Linqer.Enumerable(gen);\n        // the count is the original count minus the skipped items and at least 0  \n        result._count = () => Math.max(0, self.count() - nr);\n        Linqer._ensureInternalTryGetAt(this);\n        result._canSeek = this._canSeek;\n        // it has an indexer only if the original enumerable can seek\n        if (this._canSeek) {\n            result._tryGetAt = index => {\n                if (index >= result.count())\n                    return null;\n                return self._tryGetAt(index);\n            };\n        }\n        return result;\n    };\n    /// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.\n    Linqer.Enumerable.prototype.skipWhile = function (condition) {\n        Linqer._ensureFunction(condition);\n        const self = this;\n        let skip = true;\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                if (skip && !condition(item, index)) {\n                    skip = false;\n                }\n                if (!skip) {\n                    yield item;\n                }\n                index++;\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Returns a new enumerable collection that contains the last nr elements from source.\n    Linqer.Enumerable.prototype.takeLast = function (nr) {\n        Linqer._ensureInternalTryGetAt(this);\n        const self = this;\n        const gen = this._canSeek\n            // taking the last items is easy if the enumerable can seek\n            ? function* () {\n                let nrLeft = nr;\n                const length = self.count();\n                for (let index = length - nrLeft; index < length; index++) {\n                    yield self.elementAt(index);\n                }\n            }\n            // else the generator uses a buffer to fill with values\n            // and yields them after the entire thing has been iterated\n            : function* () {\n                let nrLeft = nr;\n                let index = 0;\n                const buffer = Array(nrLeft);\n                for (const item of self) {\n                    buffer[index % nrLeft] = item;\n                    index++;\n                }\n                for (let i = 0; i < nrLeft && i < index; i++) {\n                    yield buffer[(index + i) % nrLeft];\n                }\n            };\n        const result = new Linqer.Enumerable(gen);\n        // the count is the minimum between nr and the enumerable count\n        result._count = () => Math.min(nr, self.count());\n        result._canSeek = self._canSeek;\n        // this can seek only if the original enumerable could seek\n        if (self._canSeek) {\n            result._tryGetAt = index => {\n                if (index < 0 || index >= result.count())\n                    return null;\n                return self._tryGetAt(self.count() - nr + index);\n            };\n        }\n        return result;\n    };\n    /// Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.\n    Linqer.Enumerable.prototype.takeWhile = function (condition) {\n        Linqer._ensureFunction(condition);\n        const self = this;\n        const gen = function* () {\n            let index = 0;\n            for (const item of self) {\n                if (condition(item, index)) {\n                    yield item;\n                }\n                else {\n                    break;\n                }\n                index++;\n            }\n        };\n        return new Linqer.Enumerable(gen);\n    };\n    Linqer.Enumerable.prototype.toDictionary = function () {\n        throw new Error('use toMap or toObject instead of toDictionary');\n    };\n    /// creates a map from an Enumerable\n    Linqer.Enumerable.prototype.toMap = function (keySelector, valueSelector = x => x) {\n        Linqer._ensureFunction(keySelector);\n        Linqer._ensureFunction(valueSelector);\n        const result = new Map();\n        let index = 0;\n        for (const item of this) {\n            result.set(keySelector(item, index), valueSelector(item, index));\n            index++;\n        }\n        return result;\n    };\n    /// creates an object from an enumerable\n    Linqer.Enumerable.prototype.toObject = function (keySelector, valueSelector = x => x) {\n        Linqer._ensureFunction(keySelector);\n        Linqer._ensureFunction(valueSelector);\n        const result = {};\n        let index = 0;\n        for (const item of this) {\n            result[keySelector(item, index)] = valueSelector(item);\n            index++;\n        }\n        return result;\n    };\n    Linqer.Enumerable.prototype.toHashSet = function () {\n        throw new Error('use toSet instead of toHashSet');\n    };\n    /// creates a set from an enumerable\n    Linqer.Enumerable.prototype.toSet = function () {\n        const result = new Set();\n        for (const item of this) {\n            result.add(item);\n        }\n        return result;\n    };\n    /// Produces the set union of two sequences.\n    Linqer.Enumerable.prototype.union = function (iterable, equalityComparer = Linqer.EqualityComparer.default) {\n        Linqer._ensureIterable(iterable);\n        return this.concat(iterable).distinct(equalityComparer);\n    };\n    /// Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.\n    Linqer.Enumerable.prototype.zip = function (iterable, zipper) {\n        Linqer._ensureIterable(iterable);\n        if (!zipper) {\n            zipper = (i1, i2) => [i1, i2];\n        }\n        else {\n            Linqer._ensureFunction(zipper);\n        }\n        const self = this;\n        const gen = function* () {\n            let index = 0;\n            const iterator1 = self[Symbol.iterator]();\n            const iterator2 = Linqer.Enumerable.from(iterable)[Symbol.iterator]();\n            let done = false;\n            do {\n                const val1 = iterator1.next();\n                const val2 = iterator2.next();\n                done = !!(val1.done || val2.done);\n                if (!done) {\n                    yield zipper(val1.value, val2.value, index);\n                }\n                index++;\n            } while (!done);\n        };\n        return new Linqer.Enumerable(gen);\n    };\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n(function (Linqer) {\n    /// Groups the elements of a sequence.\n    Linqer.Enumerable.prototype.groupBy = function (keySelector) {\n        Linqer._ensureFunction(keySelector);\n        const self = this;\n        const gen = function* () {\n            const groupMap = new Map();\n            let index = 0;\n            // iterate all items and group them in a Map\n            for (const item of self) {\n                const key = keySelector(item, index);\n                const group = groupMap.get(key);\n                if (group) {\n                    group.push(item);\n                }\n                else {\n                    groupMap.set(key, [item]);\n                }\n                index++;\n            }\n            // then yield a GroupEnumerable for each group\n            for (const [key, items] of groupMap) {\n                const group = new GroupEnumerable(items, key);\n                yield group;\n            }\n        };\n        const result = new Linqer.Enumerable(gen);\n        return result;\n    };\n    /// Correlates the elements of two sequences based on key equality and groups the results. A specified equalityComparer is used to compare keys.\n    /// WARNING: using the equality comparer will be slower\n    Linqer.Enumerable.prototype.groupJoin = function (iterable, innerKeySelector, outerKeySelector, resultSelector, equalityComparer = Linqer.EqualityComparer.default) {\n        const self = this;\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const lookup = new Linqer.Enumerable(iterable)\n                    .groupBy(outerKeySelector)\n                    .toMap(g => g.key, g => g);\n                let index = 0;\n                for (const innerItem of self) {\n                    const arr = Linqer._toArray(lookup.get(innerKeySelector(innerItem, index)));\n                    yield resultSelector(innerItem, arr);\n                    index++;\n                }\n            }\n            : function* () {\n                let innerIndex = 0;\n                for (const innerItem of self) {\n                    const arr = [];\n                    let outerIndex = 0;\n                    for (const outerItem of Linqer.Enumerable.from(iterable)) {\n                        if (equalityComparer(innerKeySelector(innerItem, innerIndex), outerKeySelector(outerItem, outerIndex))) {\n                            arr.push(outerItem);\n                        }\n                        outerIndex++;\n                    }\n                    yield resultSelector(innerItem, arr);\n                    innerIndex++;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    /// Correlates the elements of two sequences based on matching keys.\n    /// WARNING: using the equality comparer will be slower\n    Linqer.Enumerable.prototype.join = function (iterable, innerKeySelector, outerKeySelector, resultSelector, equalityComparer = Linqer.EqualityComparer.default) {\n        const self = this;\n        const gen = equalityComparer === Linqer.EqualityComparer.default\n            ? function* () {\n                const lookup = new Linqer.Enumerable(iterable)\n                    .groupBy(outerKeySelector)\n                    .toMap(g => g.key, g => g);\n                let index = 0;\n                for (const innerItem of self) {\n                    const group = lookup.get(innerKeySelector(innerItem, index));\n                    if (group) {\n                        for (const outerItem of group) {\n                            yield resultSelector(innerItem, outerItem);\n                        }\n                    }\n                    index++;\n                }\n            }\n            : function* () {\n                let innerIndex = 0;\n                for (const innerItem of self) {\n                    let outerIndex = 0;\n                    for (const outerItem of Linqer.Enumerable.from(iterable)) {\n                        if (equalityComparer(innerKeySelector(innerItem, innerIndex), outerKeySelector(outerItem, outerIndex))) {\n                            yield resultSelector(innerItem, outerItem);\n                        }\n                        outerIndex++;\n                    }\n                    innerIndex++;\n                }\n            };\n        return new Linqer.Enumerable(gen);\n    };\n    Linqer.Enumerable.prototype.toLookup = function () {\n        throw new Error('use groupBy instead of toLookup');\n    };\n    /**\n     * An Enumerable that also exposes a group key\n     *\n     * @export\n     * @class GroupEnumerable\n     * @extends {Enumerable}\n     */\n    class GroupEnumerable extends Linqer.Enumerable {\n        constructor(iterable, key) {\n            super(iterable);\n            this.key = key;\n        }\n    }\n    Linqer.GroupEnumerable = GroupEnumerable;\n})(Linqer || (Linqer = {}));\n/// <reference path=\"./LInQer.Slim.ts\" />\nvar Linqer;\n/// <reference path=\"./LInQer.Slim.ts\" />\n(function (Linqer) {\n    /// Sorts the elements of a sequence in ascending order.\n    Linqer.Enumerable.prototype.orderBy = function (keySelector) {\n        if (keySelector) {\n            Linqer._ensureFunction(keySelector);\n        }\n        else {\n            keySelector = item => item;\n        }\n        return new OrderedEnumerable(this, keySelector, true);\n    };\n    /// Sorts the elements of a sequence in descending order.\n    Linqer.Enumerable.prototype.orderByDescending = function (keySelector) {\n        if (keySelector) {\n            Linqer._ensureFunction(keySelector);\n        }\n        else {\n            keySelector = item => item;\n        }\n        return new OrderedEnumerable(this, keySelector, false);\n    };\n    /// use QuickSort for ordering (default). Recommended when take, skip, takeLast, skipLast are used after orderBy\n    Linqer.Enumerable.prototype.useQuickSort = function () {\n        this._useQuickSort = true;\n        return this;\n    };\n    /// use the default browser sort implementation for ordering at all times\n    Linqer.Enumerable.prototype.useBrowserSort = function () {\n        this._useQuickSort = false;\n        return this;\n    };\n    //static sort: (arr: any[], comparer?: IComparer) => void;\n    Linqer.Enumerable.sort = function (arr, comparer = Linqer._defaultComparer) {\n        _quickSort(arr, 0, arr.length - 1, comparer, 0, Number.MAX_SAFE_INTEGER);\n        return arr;\n    };\n    let RestrictionType;\n    (function (RestrictionType) {\n        RestrictionType[RestrictionType[\"skip\"] = 0] = \"skip\";\n        RestrictionType[RestrictionType[\"skipLast\"] = 1] = \"skipLast\";\n        RestrictionType[RestrictionType[\"take\"] = 2] = \"take\";\n        RestrictionType[RestrictionType[\"takeLast\"] = 3] = \"takeLast\";\n    })(RestrictionType || (RestrictionType = {}));\n    /**\n     * An Enumerable yielding ordered items\n     *\n     * @export\n     * @class OrderedEnumerable\n     * @extends {Enumerable}\n     */\n    class OrderedEnumerable extends Linqer.Enumerable {\n        /**\n         *Creates an instance of OrderedEnumerable.\n         * @param {IterableType} src\n         * @param {ISelector} [keySelector]\n         * @param {boolean} [ascending=true]\n         * @memberof OrderedEnumerable\n         */\n        constructor(src, keySelector, ascending = true) {\n            super(src);\n            this._keySelectors = [];\n            this._restrictions = [];\n            if (keySelector) {\n                this._keySelectors.push({ keySelector: keySelector, ascending: ascending });\n            }\n            const self = this;\n            // generator gets an array of the original, \n            // sorted inside the interval determined by functions such as skip, take, skipLast, takeLast\n            this._generator = function* () {\n                let { startIndex, endIndex, arr } = this.getSortedArray();\n                if (arr) {\n                    for (let index = startIndex; index < endIndex; index++) {\n                        yield arr[index];\n                    }\n                }\n            };\n            // the count is the difference between the end and start indexes\n            // if no skip/take functions were used, this will be the original count\n            this._count = () => {\n                const totalCount = Linqer.Enumerable.from(self._src).count();\n                const { startIndex, endIndex } = this.getStartAndEndIndexes(self._restrictions, totalCount);\n                return endIndex - startIndex;\n            };\n            // an ordered enumerable cannot seek\n            this._canSeek = false;\n            this._tryGetAt = () => { throw new Error('Ordered enumerables cannot seek'); };\n        }\n        getSortedArray() {\n            const self = this;\n            let startIndex;\n            let endIndex;\n            let arr = null;\n            const innerEnumerable = self._src;\n            Linqer._ensureInternalTryGetAt(innerEnumerable);\n            // try to avoid enumerating the entire original into an array\n            if (innerEnumerable._canSeek) {\n                ({ startIndex, endIndex } = self.getStartAndEndIndexes(self._restrictions, innerEnumerable.count()));\n            }\n            else {\n                arr = Array.from(self._src);\n                ({ startIndex, endIndex } = self.getStartAndEndIndexes(self._restrictions, arr.length));\n            }\n            if (startIndex < endIndex) {\n                if (!arr) {\n                    arr = Array.from(self._src);\n                }\n                // only quicksort supports partial ordering inside an interval\n                const sort = self._useQuickSort\n                    ? (a, c) => _quickSort(a, 0, a.length - 1, c, startIndex, endIndex)\n                    : (a, c) => a.sort(c);\n                const sortFunc = self.generateSortFunc(self._keySelectors);\n                sort(arr, sortFunc);\n                return {\n                    startIndex,\n                    endIndex,\n                    arr\n                };\n            }\n            else {\n                return {\n                    startIndex,\n                    endIndex,\n                    arr: null\n                };\n            }\n        }\n        generateSortFunc(selectors) {\n            // simplify the selectors into an array of comparers\n            const comparers = selectors.map(s => {\n                const f = s.keySelector;\n                const comparer = (i1, i2) => {\n                    const k1 = f(i1);\n                    const k2 = f(i2);\n                    if (k1 > k2)\n                        return 1;\n                    if (k1 < k2)\n                        return -1;\n                    return 0;\n                };\n                return s.ascending\n                    ? comparer\n                    : (i1, i2) => -comparer(i1, i2);\n            });\n            // optimize the resulting sort function in the most common case\n            // (ordered by a single criterion)\n            return comparers.length == 1\n                ? comparers[0]\n                : (i1, i2) => {\n                    for (let i = 0; i < comparers.length; i++) {\n                        const v = comparers[i](i1, i2);\n                        if (v)\n                            return v;\n                    }\n                    return 0;\n                };\n        }\n        /// calculate the interval in which an array needs to have ordered items for this ordered enumerable\n        getStartAndEndIndexes(restrictions, arrLength) {\n            let startIndex = 0;\n            let endIndex = arrLength;\n            for (const restriction of restrictions) {\n                switch (restriction.type) {\n                    case RestrictionType.take:\n                        endIndex = Math.min(endIndex, startIndex + restriction.nr);\n                        break;\n                    case RestrictionType.skip:\n                        startIndex = Math.min(endIndex, startIndex + restriction.nr);\n                        break;\n                    case RestrictionType.takeLast:\n                        startIndex = Math.max(startIndex, endIndex - restriction.nr);\n                        break;\n                    case RestrictionType.skipLast:\n                        endIndex = Math.max(startIndex, endIndex - restriction.nr);\n                        break;\n                }\n            }\n            return { startIndex, endIndex };\n        }\n        /**\n         * Performs a subsequent ordering of the elements in a sequence in ascending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        thenBy(keySelector) {\n            this._keySelectors.push({ keySelector: keySelector, ascending: true });\n            return this;\n        }\n        /**\n         * Performs a subsequent ordering of the elements in a sequence in descending order.\n         *\n         * @param {ISelector} keySelector\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        thenByDescending(keySelector) {\n            this._keySelectors.push({ keySelector: keySelector, ascending: false });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of take\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        take(nr) {\n            this._restrictions.push({ type: RestrictionType.take, nr: nr });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of takeLast\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        takeLast(nr) {\n            this._restrictions.push({ type: RestrictionType.takeLast, nr: nr });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of skip\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        skip(nr) {\n            this._restrictions.push({ type: RestrictionType.skip, nr: nr });\n            return this;\n        }\n        /**\n         * Deferred and optimized implementation of skipLast\n         *\n         * @param {number} nr\n         * @returns {OrderedEnumerable}\n         * @memberof OrderedEnumerable\n         */\n        skipLast(nr) {\n            this._restrictions.push({ type: RestrictionType.skipLast, nr: nr });\n            return this;\n        }\n        /**\n         * An optimized implementation of toArray\n         *\n         * @returns {any[]}\n         * @memberof OrderedEnumerable\n         */\n        toArray() {\n            const { startIndex, endIndex, arr } = this.getSortedArray();\n            return arr\n                ? arr.slice(startIndex, endIndex)\n                : [];\n        }\n        /**\n         * An optimized implementation of toMap\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} [valueSelector=x => x]\n         * @returns {Map<any, any>}\n         * @memberof OrderedEnumerable\n         */\n        toMap(keySelector, valueSelector = x => x) {\n            Linqer._ensureFunction(keySelector);\n            Linqer._ensureFunction(valueSelector);\n            const result = new Map();\n            const arr = this.toArray();\n            for (let i = 0; i < arr.length; i++) {\n                result.set(keySelector(arr[i], i), valueSelector(arr[i], i));\n            }\n            return result;\n        }\n        /**\n         * An optimized implementation of toObject\n         *\n         * @param {ISelector} keySelector\n         * @param {ISelector} [valueSelector=x => x]\n         * @returns {{ [key: string]: any }}\n         * @memberof OrderedEnumerable\n         */\n        toObject(keySelector, valueSelector = x => x) {\n            Linqer._ensureFunction(keySelector);\n            Linqer._ensureFunction(valueSelector);\n            const result = {};\n            const arr = this.toArray();\n            for (let i = 0; i < arr.length; i++) {\n                result[keySelector(arr[i], i)] = valueSelector(arr[i], i);\n            }\n            return result;\n        }\n        /**\n         * An optimized implementation of to Set\n         *\n         * @returns {Set<any>}\n         * @memberof OrderedEnumerable\n         */\n        toSet() {\n            const result = new Set();\n            const arr = this.toArray();\n            for (let i = 0; i < arr.length; i++) {\n                result.add(arr[i]);\n            }\n            return result;\n        }\n    }\n    Linqer.OrderedEnumerable = OrderedEnumerable;\n    const _insertionSortThreshold = 64;\n    /// insertion sort is used for small intervals\n    function _insertionsort(arr, leftIndex, rightIndex, comparer) {\n        for (let j = leftIndex; j <= rightIndex; j++) {\n            const key = arr[j];\n            let i = j - 1;\n            while (i >= leftIndex && comparer(arr[i], key) > 0) {\n                arr[i + 1] = arr[i];\n                i--;\n            }\n            arr[i + 1] = key;\n        }\n    }\n    /// swap two items in an array by index\n    function _swapArrayItems(array, leftIndex, rightIndex) {\n        const temp = array[leftIndex];\n        array[leftIndex] = array[rightIndex];\n        array[rightIndex] = temp;\n    }\n    // Quicksort partition by center value coming from both sides\n    function _partition(items, left, right, comparer) {\n        const pivot = items[(right + left) >> 1];\n        while (left <= right) {\n            while (comparer(items[left], pivot) < 0) {\n                left++;\n            }\n            while (comparer(items[right], pivot) > 0) {\n                right--;\n            }\n            if (left < right) {\n                _swapArrayItems(items, left, right);\n                left++;\n                right--;\n            }\n            else {\n                if (left === right)\n                    return left + 1;\n            }\n        }\n        return left;\n    }\n    /// optimized Quicksort algorithm\n    function _quickSort(items, left, right, comparer = Linqer._defaultComparer, minIndex = 0, maxIndex = Number.MAX_SAFE_INTEGER) {\n        if (!items.length)\n            return items;\n        // store partition indexes to be processed in here\n        const partitions = [];\n        partitions.push({ left, right });\n        let size = 1;\n        // the actual size of the partitions array never decreases\n        // but we keep score of the number of partitions in 'size'\n        // and we reuse slots whenever possible\n        while (size) {\n            const partition = { left, right } = partitions[size - 1];\n            if (right - left < _insertionSortThreshold) {\n                _insertionsort(items, left, right, comparer);\n                size--;\n                continue;\n            }\n            const index = _partition(items, left, right, comparer);\n            if (left < index - 1 && index - 1 >= minIndex) {\n                partition.right = index - 1;\n                if (index < right && index < maxIndex) {\n                    partitions[size] = { left: index, right };\n                    size++;\n                }\n            }\n            else {\n                if (index < right && index < maxIndex) {\n                    partition.left = index;\n                }\n                else {\n                    size--;\n                }\n            }\n        }\n        return items;\n    }\n})(Linqer || (Linqer = {}));\n// export to NPM\nif (typeof (module) !== 'undefined') {\n    module.exports = Linqer;\n}\n//# sourceMappingURL=LInQer.js.map"
  },
  {
    "path": "LInQer.slim.js",
    "content": "\"use strict\";\nvar Linqer;\n(function (Linqer) {\n    /**\n     * wrapper class over iterable instances that exposes the methods usually found in .NET LINQ\n     *\n     * @export\n     * @class Enumerable\n     * @implements {Iterable<any>}\n     * @implements {IUsesQuickSort}\n     */\n    class Enumerable {\n        /**\n         * You should never use this. Instead use Enumerable.from\n         * @param {IterableType} src\n         * @memberof Enumerable\n         */\n        constructor(src) {\n            _ensureIterable(src);\n            this._src = src;\n            const iteratorFunction = src[Symbol.iterator];\n            // the generator is either the iterator of the source enumerable\n            // or the generator function that was provided as the source itself\n            if (iteratorFunction) {\n                this._generator = iteratorFunction.bind(src);\n            }\n            else {\n                this._generator = src;\n            }\n            // set sorting method on an enumerable and all the derived ones should inherit it\n            // TODO: a better method of doing this\n            this._useQuickSort = src._useQuickSort !== undefined\n                ? src._useQuickSort\n                : true;\n            this._canSeek = false;\n            this._count = null;\n            this._tryGetAt = null;\n            this._wasIterated = false;\n        }\n        /**\n         * Wraps an iterable item into an Enumerable if it's not already one\n         *\n         * @static\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static from(iterable) {\n            if (iterable instanceof Enumerable)\n                return iterable;\n            return new Enumerable(iterable);\n        }\n        /**\n         * the Enumerable instance exposes the same iterator as the wrapped iterable or generator function\n         *\n         * @returns {Iterator<any>}\n         * @memberof Enumerable\n         */\n        [Symbol.iterator]() {\n            this._wasIterated = true;\n            return this._generator();\n        }\n        /**\n         * returns an empty Enumerable\n         *\n         * @static\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static empty() {\n            const result = new Enumerable([]);\n            result._count = () => 0;\n            result._tryGetAt = (index) => null;\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         * generates a sequence of integer numbers within a specified range.\n         *\n         * @static\n         * @param {number} start\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static range(start, count) {\n            const gen = function* () {\n                for (let i = 0; i < count; i++) {\n                    yield start + i;\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => count;\n            result._tryGetAt = index => {\n                if (index >= 0 && index < count)\n                    return { value: start + index };\n                return null;\n            };\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         *  Generates a sequence that contains one repeated value.\n         *\n         * @static\n         * @param {*} item\n         * @param {number} count\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        static repeat(item, count) {\n            const gen = function* () {\n                for (let i = 0; i < count; i++) {\n                    yield item;\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => count;\n            result._tryGetAt = index => {\n                if (index >= 0 && index < count)\n                    return { value: item };\n                return null;\n            };\n            result._canSeek = true;\n            return result;\n        }\n        /**\n         * Same value as count(), but will throw an Error if enumerable is not seekable and has to be iterated to get the length\n         */\n        get length() {\n            _ensureInternalTryGetAt(this);\n            if (!this._canSeek)\n                throw new Error('Calling length on this enumerable will iterate it. Use count()');\n            return this.count();\n        }\n        /**\n         * Concatenates two sequences by appending iterable to the existing one.\n         *\n         * @param {IterableType} iterable\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        concat(iterable) {\n            _ensureIterable(iterable);\n            const self = this;\n            // the generator will iterate the enumerable first, then the iterable that was given as a parameter\n            // this will be able to seek if both the original and the iterable derived enumerable can seek\n            // the indexing function will get items from the first and then second enumerable without iteration\n            const gen = function* () {\n                for (const item of self) {\n                    yield item;\n                }\n                for (const item of Enumerable.from(iterable)) {\n                    yield item;\n                }\n            };\n            const result = new Enumerable(gen);\n            const other = Enumerable.from(iterable);\n            result._count = () => self.count() + other.count();\n            _ensureInternalTryGetAt(this);\n            _ensureInternalTryGetAt(other);\n            result._canSeek = self._canSeek && other._canSeek;\n            if (self._canSeek) {\n                result._tryGetAt = index => {\n                    return self._tryGetAt(index) || other._tryGetAt(index - self.count());\n                };\n            }\n            return result;\n        }\n        /**\n         * Returns the number of elements in a sequence.\n         *\n         * @returns {number}\n         * @memberof Enumerable\n         */\n        count() {\n            _ensureInternalCount(this);\n            return this._count();\n        }\n        /**\n         * Returns distinct elements from a sequence.\n         * WARNING: using a comparer makes this slower. Not specifying it uses a Set to determine distinctiveness.\n         *\n         * @param {IEqualityComparer} [equalityComparer=EqualityComparer.default]\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        distinct(equalityComparer = Linqer.EqualityComparer.default) {\n            const self = this;\n            // if the comparer function is not provided, a Set will be used to quickly determine distinctiveness\n            const gen = equalityComparer === Linqer.EqualityComparer.default\n                ? function* () {\n                    const distinctValues = new Set();\n                    for (const item of self) {\n                        const size = distinctValues.size;\n                        distinctValues.add(item);\n                        if (size < distinctValues.size) {\n                            yield item;\n                        }\n                    }\n                }\n                // otherwise values will be compared with previous values ( O(n^2) )\n                // use distinctByHash in Linqer.extra to use a hashing function ( O(n log n) )\n                : function* () {\n                    const values = [];\n                    for (const item of self) {\n                        let unique = true;\n                        for (let i = 0; i < values.length; i++) {\n                            if (equalityComparer(item, values[i])) {\n                                unique = false;\n                                break;\n                            }\n                        }\n                        if (unique)\n                            yield item;\n                        values.push(item);\n                    }\n                };\n            return new Enumerable(gen);\n        }\n        /**\n         * Returns the element at a specified index in a sequence.\n         *\n         * @param {number} index\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        elementAt(index) {\n            _ensureInternalTryGetAt(this);\n            const result = this._tryGetAt(index);\n            if (!result)\n                throw new Error('Index out of range');\n            return result.value;\n        }\n        /**\n         * Returns the element at a specified index in a sequence or undefined if the index is out of range.\n         *\n         * @param {number} index\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        elementAtOrDefault(index) {\n            _ensureInternalTryGetAt(this);\n            const result = this._tryGetAt(index);\n            if (!result)\n                return undefined;\n            return result.value;\n        }\n        /**\n         * Returns the first element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        first() {\n            return this.elementAt(0);\n        }\n        /**\n         * Returns the first element of a sequence, or a default value if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        firstOrDefault() {\n            return this.elementAtOrDefault(0);\n        }\n        /**\n         * Returns the last element of a sequence.\n         *\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        last() {\n            _ensureInternalTryGetAt(this);\n            // if this cannot seek, getting the last element requires iterating the whole thing\n            if (!this._canSeek) {\n                let result = null;\n                let found = false;\n                for (const item of this) {\n                    result = item;\n                    found = true;\n                }\n                if (found)\n                    return result;\n                throw new Error('The enumeration is empty');\n            }\n            // if this can seek, then just go directly at the last element\n            const count = this.count();\n            return this.elementAt(count - 1);\n        }\n        /**\n         * Returns the last element of a sequence, or undefined if no element is found.\n         *\n         * @returns {(any | undefined)}\n         * @memberof Enumerable\n         */\n        lastOrDefault() {\n            _ensureInternalTryGetAt(this);\n            if (!this._canSeek) {\n                let result = undefined;\n                for (const item of this) {\n                    result = item;\n                }\n                return result;\n            }\n            const count = this.count();\n            return this.elementAtOrDefault(count - 1);\n        }\n        /**\n         * Returns the count, minimum and maximum value in a sequence of values.\n         * A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {{ count: number, min: any, max: any }}\n         * @memberof Enumerable\n         */\n        stats(comparer) {\n            if (comparer) {\n                _ensureFunction(comparer);\n            }\n            else {\n                comparer = Linqer._defaultComparer;\n            }\n            const agg = {\n                count: 0,\n                min: undefined,\n                max: undefined\n            };\n            for (const item of this) {\n                if (typeof agg.min === 'undefined' || comparer(item, agg.min) < 0)\n                    agg.min = item;\n                if (typeof agg.max === 'undefined' || comparer(item, agg.max) > 0)\n                    agg.max = item;\n                agg.count++;\n            }\n            return agg;\n        }\n        /**\n         *  Returns the minimum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        min(comparer) {\n            const stats = this.stats(comparer);\n            return stats.count === 0\n                ? undefined\n                : stats.min;\n        }\n        /**\n         *  Returns the maximum value in a sequence of values.\n         *  A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)\n         *\n         * @param {IComparer} [comparer]\n         * @returns {*}\n         * @memberof Enumerable\n         */\n        max(comparer) {\n            const stats = this.stats(comparer);\n            return stats.count === 0\n                ? undefined\n                : stats.max;\n        }\n        /**\n         * Projects each element of a sequence into a new form.\n         *\n         * @param {ISelector} selector\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        select(selector) {\n            _ensureFunction(selector);\n            const self = this;\n            // the generator is applying the selector on all the items of the enumerable\n            // the count of the resulting enumerable is the same as the original's\n            // the indexer is the same as that of the original, with the selector applied on the value\n            const gen = function* () {\n                let index = 0;\n                for (const item of self) {\n                    yield selector(item, index);\n                    index++;\n                }\n            };\n            const result = new Enumerable(gen);\n            _ensureInternalCount(this);\n            result._count = this._count;\n            _ensureInternalTryGetAt(self);\n            result._canSeek = self._canSeek;\n            result._tryGetAt = index => {\n                const res = self._tryGetAt(index);\n                if (!res)\n                    return res;\n                return { value: selector(res.value) };\n            };\n            return result;\n        }\n        /**\n         * Bypasses a specified number of elements in a sequence and then returns the remaining elements.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        skip(nr) {\n            const self = this;\n            // the generator just enumerates the first nr numbers then starts yielding values\n            // the count is the same as the original enumerable, minus the skipped items and at least 0\n            // the indexer is the same as for the original, with an offset\n            const gen = function* () {\n                let nrLeft = nr;\n                for (const item of self) {\n                    if (nrLeft > 0) {\n                        nrLeft--;\n                    }\n                    else {\n                        yield item;\n                    }\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => Math.max(0, self.count() - nr);\n            _ensureInternalTryGetAt(this);\n            result._canSeek = this._canSeek;\n            result._tryGetAt = index => self._tryGetAt(index + nr);\n            return result;\n        }\n        /**\n         * Takes start elements, ignores howmany elements, continues with the new items and continues with the original enumerable\n         * Equivalent to the value of an array after performing splice on it with the same parameters\n         * @param start\n         * @param howmany\n         * @param items\n         * @returns splice\n         */\n        splice(start, howmany, ...newItems) {\n            // tried to define length and splice so that this is seen as an Array-like object, \n            // but it doesn't work on properties. length needs to be a field.\n            return this.take(start).concat(newItems).concat(this.skip(start + howmany));\n        }\n        /**\n         * Computes the sum of a sequence of numeric values.\n         *\n         * @returns {(number | undefined)}\n         * @memberof Enumerable\n         */\n        sum() {\n            const stats = this.sumAndCount();\n            return stats.count === 0\n                ? undefined\n                : stats.sum;\n        }\n        /**\n         * Computes the sum and count of a sequence of numeric values.\n         *\n         * @returns {{ sum: number, count: number }}\n         * @memberof Enumerable\n         */\n        sumAndCount() {\n            const agg = {\n                count: 0,\n                sum: 0\n            };\n            for (const item of this) {\n                agg.sum = agg.count === 0\n                    ? _toNumber(item)\n                    : agg.sum + _toNumber(item);\n                agg.count++;\n            }\n            return agg;\n        }\n        /**\n         * Returns a specified number of contiguous elements from the start of a sequence.\n         *\n         * @param {number} nr\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        take(nr) {\n            const self = this;\n            // the generator will stop after nr items yielded\n            // the count is the maximum between the total count and nr\n            // the indexer is the same, as long as it's not higher than nr\n            const gen = function* () {\n                let nrLeft = nr;\n                for (const item of self) {\n                    if (nrLeft > 0) {\n                        yield item;\n                        nrLeft--;\n                    }\n                    if (nrLeft <= 0) {\n                        break;\n                    }\n                }\n            };\n            const result = new Enumerable(gen);\n            result._count = () => Math.min(nr, self.count());\n            _ensureInternalTryGetAt(this);\n            result._canSeek = self._canSeek;\n            if (self._canSeek) {\n                result._tryGetAt = index => {\n                    if (index >= nr)\n                        return null;\n                    return self._tryGetAt(index);\n                };\n            }\n            return result;\n        }\n        /**\n         * creates an array from an Enumerable\n         *\n         * @returns {any[]}\n         * @memberof Enumerable\n         */\n        toArray() {\n            var _a;\n            _ensureInternalTryGetAt(this);\n            // this should be faster than Array.from(this)\n            if (this._canSeek) {\n                const arr = new Array(this.count());\n                for (let i = 0; i < arr.length; i++) {\n                    arr[i] = (_a = this._tryGetAt(i)) === null || _a === void 0 ? void 0 : _a.value;\n                }\n                return arr;\n            }\n            // try to optimize the array growth by increasing it \n            // by 64 every time it is needed \n            const minIncrease = 64;\n            let size = 0;\n            const arr = [];\n            for (const item of this) {\n                if (size === arr.length) {\n                    arr.length += minIncrease;\n                }\n                arr[size] = item;\n                size++;\n            }\n            arr.length = size;\n            return arr;\n        }\n        /**\n         * similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do count and elementAt without iterating\n         *\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        toList() {\n            _ensureInternalTryGetAt(this);\n            if (this._canSeek)\n                return this;\n            return Enumerable.from(this.toArray());\n        }\n        /**\n         * Filters a sequence of values based on a predicate.\n         *\n         * @param {IFilter} condition\n         * @returns {Enumerable}\n         * @memberof Enumerable\n         */\n        where(condition) {\n            _ensureFunction(condition);\n            const self = this;\n            // cannot imply the count or indexer from the condition\n            // where will have to iterate through the whole thing\n            const gen = function* () {\n                let index = 0;\n                for (const item of self) {\n                    if (condition(item, index)) {\n                        yield item;\n                    }\n                    index++;\n                }\n            };\n            return new Enumerable(gen);\n        }\n    }\n    Linqer.Enumerable = Enumerable;\n    // throw if src is not a generator function or an iteratable\n    function _ensureIterable(src) {\n        if (src) {\n            if (src[Symbol.iterator])\n                return;\n            if (typeof src === 'function' && src.constructor.name === 'GeneratorFunction')\n                return;\n        }\n        throw new Error('the argument must be iterable!');\n    }\n    Linqer._ensureIterable = _ensureIterable;\n    // throw if f is not a function\n    function _ensureFunction(f) {\n        if (!f || typeof f !== 'function')\n            throw new Error('the argument needs to be a function!');\n    }\n    Linqer._ensureFunction = _ensureFunction;\n    // return Nan if this is not a number\n    // different from Number(obj), which would cast strings to numbers\n    function _toNumber(obj) {\n        return typeof obj === 'number'\n            ? obj\n            : Number.NaN;\n    }\n    // return the iterable if already an array or use Array.from to create one\n    function _toArray(iterable) {\n        if (!iterable)\n            return [];\n        if (Array.isArray(iterable))\n            return iterable;\n        return Array.from(iterable);\n    }\n    Linqer._toArray = _toArray;\n    // if the internal count function is not defined, set it to the most appropriate one\n    function _ensureInternalCount(enumerable) {\n        if (enumerable._count)\n            return;\n        if (enumerable._src instanceof Enumerable) {\n            // the count is the same as the underlying enumerable\n            const innerEnumerable = enumerable._src;\n            _ensureInternalCount(innerEnumerable);\n            enumerable._count = () => innerEnumerable._count();\n            return;\n        }\n        const src = enumerable._src;\n        // this could cause false positives, but if it has a numeric length or size, use it\n        if (typeof src !== 'function' && typeof src.length === 'number') {\n            enumerable._count = () => src.length;\n            return;\n        }\n        if (typeof src.size === 'number') {\n            enumerable._count = () => src.size;\n            return;\n        }\n        // otherwise iterate the whole thing and count all items\n        enumerable._count = () => {\n            let x = 0;\n            for (const item of enumerable)\n                x++;\n            return x;\n        };\n    }\n    Linqer._ensureInternalCount = _ensureInternalCount;\n    // ensure there is an internal indexer function adequate for this enumerable\n    // this also determines if the enumerable can seek\n    function _ensureInternalTryGetAt(enumerable) {\n        if (enumerable._tryGetAt)\n            return;\n        enumerable._canSeek = true;\n        if (enumerable._src instanceof Enumerable) {\n            // indexer and seekability is the same as for the underlying enumerable\n            const innerEnumerable = enumerable._src;\n            _ensureInternalTryGetAt(innerEnumerable);\n            enumerable._tryGetAt = index => innerEnumerable._tryGetAt(index);\n            enumerable._canSeek = innerEnumerable._canSeek;\n            return;\n        }\n        if (typeof enumerable._src === 'string') {\n            // a string can be accessed by index\n            enumerable._tryGetAt = index => {\n                if (index < enumerable._src.length) {\n                    return { value: enumerable._src.charAt(index) };\n                }\n                return null;\n            };\n            return;\n        }\n        if (Array.isArray(enumerable._src)) {\n            // an array can be accessed by index\n            enumerable._tryGetAt = index => {\n                if (index >= 0 && index < enumerable._src.length) {\n                    return { value: enumerable._src[index] };\n                }\n                return null;\n            };\n            return;\n        }\n        const src = enumerable._src;\n        if (typeof enumerable._src !== 'function' && typeof src.length === 'number') {\n            // try to access an object with a defined numeric length by indexing it\n            // might cause false positives\n            enumerable._tryGetAt = index => {\n                if (index < src.length && typeof src[index] !== 'undefined') {\n                    return { value: src[index] };\n                }\n                return null;\n            };\n            return;\n        }\n        enumerable._canSeek = false;\n        // TODO other specialized types? objects, maps, sets?\n        enumerable._tryGetAt = index => {\n            let x = 0;\n            for (const item of enumerable) {\n                if (index === x)\n                    return { value: item };\n                x++;\n            }\n            return null;\n        };\n    }\n    Linqer._ensureInternalTryGetAt = _ensureInternalTryGetAt;\n    /**\n     * The default comparer function between two items\n     * @param item1\n     * @param item2\n     */\n    Linqer._defaultComparer = (item1, item2) => {\n        if (item1 > item2)\n            return 1;\n        if (item1 < item2)\n            return -1;\n        return 0;\n    };\n    /**\n     * Predefined equality comparers\n     * default is the equivalent of ==\n     * exact is the equivalent of ===\n     */\n    Linqer.EqualityComparer = {\n        default: (item1, item2) => item1 == item2,\n        exact: (item1, item2) => item1 === item2,\n    };\n})(Linqer || (Linqer = {}));\n//# sourceMappingURL=LInQer.Slim.js.map"
  },
  {
    "path": "README.md",
    "content": "MAJOR UPDATE: I've rewritten the entire thing into [linqer-ts](https://www.npmjs.com/package/@siderite/linqer-ts). Any improvements or updates will be on that project.\n\n# LInQer\nThe C# Language Integrated Queries ported for Javascript for amazing performance\n\n[![npm version](https://badge.fury.io/js/%40siderite%2Flinqer.svg)](https://badge.fury.io/js/%40siderite%2Flinqer) [![License: MIT](https://img.shields.io/badge/Licence-MIT-blueviolet)](https://opensource.org/licenses/MIT)\n\n# Installation\n```sh\n$ npm install @siderite/linqer\n```\n\n# Quick start\n```sh\nconst source = ... an array or a generator function or anything that is iterable... ;\nconst enumerable = Linqer.Enumerable.from(source); // now you can both iterate and use LINQ like functions\nconst result = enumerable\n                .where(item=>!!item.value) // like filter\n                .select(item=>{ value: item.value, key: item.name }) // like map\n                .groupBy(item=>item.key)\n                .where(g=>g.length>10)\n                .orderBy(g=>g.key)\n                .selectMany()\n                .skip(15)\n                .take(5);\nfor (const item of result) ...\n```\nin Node.js you have to prepend:\n```\nconst Linqer = require('@siderite/linqer');\n```\n\nin Typescript, use the .ts files directly or install @types/node and use require, I guess. I couldn't make it work for both TS and JS.\nI will try to make that happen in version 2, which will probably have a different file layout.\n\n\n# Licence\nMIT\n\nArray functions in Javascript create a new array for each operation, which is terribly wasteful. Using iterators and generator functions and objects, we can limit the operations to the items in the array that interest us, not all of them.\n\n# Blog post\nhttps://siderite.dev/blog/linq-in-javascript-linqer. Leave comments there or add Issues on GitHub for feedback and support.\n\n# Hosted\nFind it hosted on GitHub Pages and use it freely in your projects at: \n - https://siderite.github.io/LInQer/LInQer.min.js - main library\n - https://siderite.github.io/LInQer/LInQer.slim.min.js - only basic functionality\n - https://siderite.github.io/LInQer/LInQer.extra.min.js - extra functionality (needs main Linqer)\n\n# Reference\nReference **Linqer.slim.js** for the basic methods:\n- from, empty, range, repeat - static on Linqer.Enumerable\n- length property - same as count, but throws error if the enumerable needs to be enumerated to get the length (no side effects)\n- concat\n- count\n- distinct\n- elementAt and elementAtOrDefault\n- first and firstOrDefault\n- last and lastOrDefault\n- min, max, stats (min, max and count)\n- select\n- skip and take\n- splice function - kind of useless, but it was an experiment to see if I can make Enumerable appear as an Array-like object\n- sum and sumAndCount (sum and count)\n- toArray\n- toList - similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do *count* and *elementAt* without iterating\n- where\n\nReference **Linqer.js** for all of the original Enumerable methods, the ones in slim and then the following:\n- aggregate\n- all\n- any\n- append\n- average\n- asEnumerable\n- cast\n- contains\n- defaultIfEmpty - throws not implemented\n- except\n- intersect\n- join\n- groupBy\n- groupJoin\n- longCount\n- ofType\n- orderBy\n- orderByDescending\n- prepend\n- reverse\n- selectMany\n- sequenceEqual\n- single\n- singleOrDefault\n- skip - on an ordered enumerable\n- skipLast - on a regular or ordered enumerable\n- skipWhile\n- slice\n- take - on an ordered enumerable\n- takeLast - on a regular or ordered enumerable\n- takeWhile\n- thenBy - on an ordered enumerable\n- thenByDescending - on an ordered enumerable\n- toDictionary - throws not implemented\n- toLookup - throws not implemented\n- toMap\n- toObject\n- toHashSet - throws not implemented\n- toSet\n- union\n- zip\n\nReference **Linqer.extra.js** (needs **Linqer.js**) for some additional methods:\n- shuffle - randomizes the enumerable\n- randomSample - implements random reservoir sampling of k items\n- distinctByHash - distinct based on a hashing function, not a comparer - faster\n- exceptByHash - except based on a hashing function, not a comparer - faster\n- intersectByHash - intersect based on a hashing function, not a comparer - faster\n- binarySearch - find the index of a value in a sorted enumerable by binary search\n- lag - joins each item of the enumerable with previous items from the same enumerable\n- lead - joins each item of the enumerable with next items from the same enumerable\n- padStart - pad enumerable at the start to a minimum length\n- padEnd - pad enumerable at the end to a minimum length\n\n# Original *Enumerable* .NET class\n\nThe original C# class can be found here: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable .\n\n# Building the solution\n\nThe library has been ported to Typescript. Run **build.bat** to create the .js and .map files from the .ts code."
  },
  {
    "path": "Release.txt",
    "content": "2020-03-08 - 1.2.2\n\t- made typings work for Visual Studio Code for Node.js\n2020-02-16 - 1.2.1\n\t- added comments to the code to better explain the mechanism\n\t- bugfix: canSeek was not set for reverse\n2020-02-16 - 1.2.0\n\t- bugfix: lead had the wrong indexing function for elementAt\n\t- bugfix: ordered enumerables mistakenly reported being able to seek (elementAt)\n\t- performance improvements for toArray, reverse, shuffle, binarySearch\n\t- performance improvements for orderBy and sort in place\n2020-02-14 - 1.1.5\n\t- fixed a few bugs\n\t- added slice\n\t- added splice and length, however Enumerable is not seen as an Array-like object, because length is a property not a field\n2020-02-13 - 1.1.4\n\t- Simplified the partition stack code\n2020-02-09 - 1.1.3\n\t- Added typings for Intellisense in TypeScript\n2020-02-09 - 1.1.2\n\t- optimized Quicksort and orderBy even more\n2020-02-09 - 1.1.1\n\t- separated the performance tests in their own files\n\t- small performance improvements\n\t- reverted the Quicksort algorithm to its original version\n\t- tried Timsort, it's pretty cool, but large and hard to control\n2020-02-06 - 1.1.0\n\t- change of algorithm for sorting\n\t- useQuickSort and useBrowserSort now just set the sort mechanism, QuickSort is default\n\t- added static Enumerable.sort(arr,comparer) which uses Quicksort to sort an array in place\n2020-02-02 - 1.0.7\n  - library now exports Linqer as the module.exports object\n2020-02-02 - 1.0.6\n  - used case sensitive main entry point\n2020-02-02 - 1.0.5\n  - added Linqer.all.js for node.js use and used it as the main entry point\n  - optimized sorting even more\n2020-01-29 - 1.0.3\n  - updated README\n  - moved binarySearch on Enumerable (the user has the responsibility to have it ordered)\n2020-01-27 - 1.0.2\n  - added toList to return a seekable Enumerable\n  - added lag and lead to return a join between the enumerable and itself with an offset\n  - added padEnd and padStart to return enumerable of at least a specific length, filling the missing items with a given value\n2020-01-23 - 1.0.1\n  - added randomSample functionality\n2020-01-22 - 1.0.0\n  - official launch\n"
  },
  {
    "path": "build.bat",
    "content": "@ECHO OFF\nREM Delete Javascript files as we will generate them now\nDEL LInQer.extra.js\nDEL LInQer.extra.min.js\nDEL LInQer.js\nDEL LInQer.min.js\nDEL LInQer.slim.js\nDEL LInQer.slim.min.js\nDEL LInQer.all.js\n\nDEL LInQer.extra.js.map\nDEL LInQer.js.map\nDEL LInQer.slim.js.map\nDEL LInQer.all.js.map\n\nREM Requires npm install typescript -g\ncall tsc --p tsconfig.json --sourceMap\ncall tsc --p tsconfig.slim.json --sourceMap --noResolve\ncall tsc --p tsconfig.extra.json --sourceMap --noResolve\ncall tsc --p tsconfig.all.json --sourceMap\nECHO export = Linqer; >> linqer.all.d.ts\n\nREM Delete intermediary Javascript files\nDEL LInQer.Enumerable.js\nDEL LInQer.GroupEnumerable.js\nDEL LInQer.OrderedEnumerable.js\n\nDEL LInQer.Enumerable.js.map\nDEL LInQer.GroupEnumerable.js.map\nDEL LInQer.OrderedEnumerable.js.map\n\nREM Requires npm install terser -g\ncall terser --compress --mangle -o LInQer.min.js -- LInQer.js\ncall terser --compress --mangle -o LInQer.slim.min.js -- LInQer.slim.js\ncall terser --compress --mangle -o LInQer.extra.min.js -- LInQer.extra.js\n"
  },
  {
    "path": "npm.export.ts",
    "content": "// export to NPM\nif (typeof(module) !== 'undefined') {\n\tmodule.exports = Linqer;\n}\n\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"@siderite/linqer\",\n  \"version\": \"1.3.0\",\n  \"description\": \"The C# Language Integrated Queries ported for Javascript for amazing performance\",\n  \"main\": \"LInQer.all.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/Siderite/LInQer.git\"\n  },\n  \"keywords\": [\n    \"LINQ\",\n    \"Javascript\",\n    \"ES6\",\n    \"iterator\",\n    \"generator\",\n    \"Typescript\"\n  ],\n  \"author\": \"Siderite\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/Siderite/LInQer/issues\"\n  },\n  \"homepage\": \"https://siderite.dev/blog/linq-in-javascript-linqer\",\n  \"dependencies\": {\n    \"@types/node\": \"^13.7.0\"\n  },\n  \"devDependencies\": {},\n  \"typings\": \"./LInQer.all.d.ts\"\n}\n"
  },
  {
    "path": "qUnit/qunit-2.9.2.css",
    "content": "/*!\n * QUnit 2.9.2\n * https://qunitjs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2019-02-21T22:49Z\n */\n\n/** Font Family and Sizes */\n\n#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult {\n\tfont-family: \"Helvetica Neue Light\", \"HelveticaNeue-Light\", \"Helvetica Neue\", Calibri, Helvetica, Arial, sans-serif;\n}\n\n#qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }\n#qunit-tests { font-size: smaller; }\n\n\n/** Resets */\n\n#qunit-tests, #qunit-header, #qunit-banner, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {\n\tmargin: 0;\n\tpadding: 0;\n}\n\n\n/** Header (excluding toolbar) */\n\n#qunit-header {\n\tpadding: 0.5em 0 0.5em 1em;\n\n\tcolor: #8699A4;\n\tbackground-color: #0D3349;\n\n\tfont-size: 1.5em;\n\tline-height: 1em;\n\tfont-weight: 400;\n\n\tborder-radius: 5px 5px 0 0;\n}\n\n#qunit-header a {\n\ttext-decoration: none;\n\tcolor: #C2CCD1;\n}\n\n#qunit-header a:hover,\n#qunit-header a:focus {\n\tcolor: #FFF;\n}\n\n#qunit-banner {\n\theight: 5px;\n}\n\n#qunit-filteredTest {\n\tpadding: 0.5em 1em 0.5em 1em;\n\tcolor: #366097;\n\tbackground-color: #F4FF77;\n}\n\n#qunit-userAgent {\n\tpadding: 0.5em 1em 0.5em 1em;\n\tcolor: #FFF;\n\tbackground-color: #2B81AF;\n\ttext-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;\n}\n\n\n/** Toolbar */\n\n#qunit-testrunner-toolbar {\n\tpadding: 0.5em 1em 0.5em 1em;\n\tcolor: #5E740B;\n\tbackground-color: #EEE;\n}\n\n#qunit-testrunner-toolbar .clearfix {\n\theight: 0;\n\tclear: both;\n}\n\n#qunit-testrunner-toolbar label {\n\tdisplay: inline-block;\n}\n\n#qunit-testrunner-toolbar input[type=checkbox],\n#qunit-testrunner-toolbar input[type=radio] {\n\tmargin: 3px;\n\tvertical-align: -2px;\n}\n\n#qunit-testrunner-toolbar input[type=text] {\n\tbox-sizing: border-box;\n\theight: 1.6em;\n}\n\n.qunit-url-config,\n.qunit-filter,\n#qunit-modulefilter {\n\tdisplay: inline-block;\n\tline-height: 2.1em;\n}\n\n.qunit-filter,\n#qunit-modulefilter {\n\tfloat: right;\n\tposition: relative;\n\tmargin-left: 1em;\n}\n\n.qunit-url-config label {\n\tmargin-right: 0.5em;\n}\n\n#qunit-modulefilter-search {\n\tbox-sizing: border-box;\n\twidth: 400px;\n}\n\n#qunit-modulefilter-search-container:after {\n\tposition: absolute;\n\tright: 0.3em;\n\tcontent: \"\\25bc\";\n\tcolor: black;\n}\n\n#qunit-modulefilter-dropdown {\n\t/* align with #qunit-modulefilter-search */\n\tbox-sizing: border-box;\n\twidth: 400px;\n\tposition: absolute;\n\tright: 0;\n\ttop: 50%;\n\tmargin-top: 0.8em;\n\n\tborder: 1px solid #D3D3D3;\n\tborder-top: none;\n\tborder-radius: 0 0 .25em .25em;\n\tcolor: #000;\n\tbackground-color: #F5F5F5;\n\tz-index: 99;\n}\n\n#qunit-modulefilter-dropdown a {\n\tcolor: inherit;\n\ttext-decoration: none;\n}\n\n#qunit-modulefilter-dropdown .clickable.checked {\n\tfont-weight: bold;\n\tcolor: #000;\n\tbackground-color: #D2E0E6;\n}\n\n#qunit-modulefilter-dropdown .clickable:hover {\n\tcolor: #FFF;\n\tbackground-color: #0D3349;\n}\n\n#qunit-modulefilter-actions {\n\tdisplay: block;\n\toverflow: auto;\n\n\t/* align with #qunit-modulefilter-dropdown-list */\n\tfont: smaller/1.5em sans-serif;\n}\n\n#qunit-modulefilter-dropdown #qunit-modulefilter-actions > * {\n\tbox-sizing: border-box;\n\tmax-height: 2.8em;\n\tdisplay: block;\n\tpadding: 0.4em;\n}\n\n#qunit-modulefilter-dropdown #qunit-modulefilter-actions > button {\n\tfloat: right;\n\tfont: inherit;\n}\n\n#qunit-modulefilter-dropdown #qunit-modulefilter-actions > :last-child {\n\t/* insert padding to align with checkbox margins */\n\tpadding-left: 3px;\n}\n\n#qunit-modulefilter-dropdown-list {\n\tmax-height: 200px;\n\toverflow-y: auto;\n\tmargin: 0;\n\tborder-top: 2px groove threedhighlight;\n\tpadding: 0.4em 0 0;\n\tfont: smaller/1.5em sans-serif;\n}\n\n#qunit-modulefilter-dropdown-list li {\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n\n#qunit-modulefilter-dropdown-list .clickable {\n\tdisplay: block;\n\tpadding-left: 0.15em;\n}\n\n\n/** Tests: Pass/Fail */\n\n#qunit-tests {\n\tlist-style-position: inside;\n}\n\n#qunit-tests li {\n\tpadding: 0.4em 1em 0.4em 1em;\n\tborder-bottom: 1px solid #FFF;\n\tlist-style-position: inside;\n}\n\n#qunit-tests > li {\n\tdisplay: none;\n}\n\n#qunit-tests li.running,\n#qunit-tests li.pass,\n#qunit-tests li.fail,\n#qunit-tests li.skipped,\n#qunit-tests li.aborted {\n\tdisplay: list-item;\n}\n\n#qunit-tests.hidepass {\n\tposition: relative;\n}\n\n#qunit-tests.hidepass li.running,\n#qunit-tests.hidepass li.pass:not(.todo) {\n\tvisibility: hidden;\n\tposition: absolute;\n\twidth:   0;\n\theight:  0;\n\tpadding: 0;\n\tborder:  0;\n\tmargin:  0;\n}\n\n#qunit-tests li strong {\n\tcursor: pointer;\n}\n\n#qunit-tests li.skipped strong {\n\tcursor: default;\n}\n\n#qunit-tests li a {\n\tpadding: 0.5em;\n\tcolor: #C2CCD1;\n\ttext-decoration: none;\n}\n\n#qunit-tests li p a {\n\tpadding: 0.25em;\n\tcolor: #6B6464;\n}\n#qunit-tests li a:hover,\n#qunit-tests li a:focus {\n\tcolor: #000;\n}\n\n#qunit-tests li .runtime {\n\tfloat: right;\n\tfont-size: smaller;\n}\n\n.qunit-assert-list {\n\tmargin-top: 0.5em;\n\tpadding: 0.5em;\n\n\tbackground-color: #FFF;\n\n\tborder-radius: 5px;\n}\n\n.qunit-source {\n\tmargin: 0.6em 0 0.3em;\n}\n\n.qunit-collapsed {\n\tdisplay: none;\n}\n\n#qunit-tests table {\n\tborder-collapse: collapse;\n\tmargin-top: 0.2em;\n}\n\n#qunit-tests th {\n\ttext-align: right;\n\tvertical-align: top;\n\tpadding: 0 0.5em 0 0;\n}\n\n#qunit-tests td {\n\tvertical-align: top;\n}\n\n#qunit-tests pre {\n\tmargin: 0;\n\twhite-space: pre-wrap;\n\tword-wrap: break-word;\n}\n\n#qunit-tests del {\n\tcolor: #374E0C;\n\tbackground-color: #E0F2BE;\n\ttext-decoration: none;\n}\n\n#qunit-tests ins {\n\tcolor: #500;\n\tbackground-color: #FFCACA;\n\ttext-decoration: none;\n}\n\n/*** Test Counts */\n\n#qunit-tests b.counts                       { color: #000; }\n#qunit-tests b.passed                       { color: #5E740B; }\n#qunit-tests b.failed                       { color: #710909; }\n\n#qunit-tests li li {\n\tpadding: 5px;\n\tbackground-color: #FFF;\n\tborder-bottom: none;\n\tlist-style-position: inside;\n}\n\n/*** Passing Styles */\n\n#qunit-tests li li.pass {\n\tcolor: #3C510C;\n\tbackground-color: #FFF;\n\tborder-left: 10px solid #C6E746;\n}\n\n#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }\n#qunit-tests .pass .test-name               { color: #366097; }\n\n#qunit-tests .pass .test-actual,\n#qunit-tests .pass .test-expected           { color: #999; }\n\n#qunit-banner.qunit-pass                    { background-color: #C6E746; }\n\n/*** Failing Styles */\n\n#qunit-tests li li.fail {\n\tcolor: #710909;\n\tbackground-color: #FFF;\n\tborder-left: 10px solid #EE5757;\n\twhite-space: pre;\n}\n\n#qunit-tests > li:last-child {\n\tborder-radius: 0 0 5px 5px;\n}\n\n#qunit-tests .fail                          { color: #000; background-color: #EE5757; }\n#qunit-tests .fail .test-name,\n#qunit-tests .fail .module-name             { color: #000; }\n\n#qunit-tests .fail .test-actual             { color: #EE5757; }\n#qunit-tests .fail .test-expected           { color: #008000; }\n\n#qunit-banner.qunit-fail                    { background-color: #EE5757; }\n\n\n/*** Aborted tests */\n#qunit-tests .aborted { color: #000; background-color: orange; }\n/*** Skipped tests */\n\n#qunit-tests .skipped {\n\tbackground-color: #EBECE9;\n}\n\n#qunit-tests .qunit-todo-label,\n#qunit-tests .qunit-skipped-label {\n\tbackground-color: #F4FF77;\n\tdisplay: inline-block;\n\tfont-style: normal;\n\tcolor: #366097;\n\tline-height: 1.8em;\n\tpadding: 0 0.5em;\n\tmargin: -0.4em 0.4em -0.4em 0;\n}\n\n#qunit-tests .qunit-todo-label {\n\tbackground-color: #EEE;\n}\n\n/** Result */\n\n#qunit-testresult {\n\tcolor: #2B81AF;\n\tbackground-color: #D2E0E6;\n\n\tborder-bottom: 1px solid #FFF;\n}\n#qunit-testresult .clearfix {\n\theight: 0;\n\tclear: both;\n}\n#qunit-testresult .module-name {\n\tfont-weight: 700;\n}\n#qunit-testresult-display {\n\tpadding: 0.5em 1em 0.5em 1em;\n\twidth: 85%;\n\tfloat:left;\n}\n#qunit-testresult-controls {\n\tpadding: 0.5em 1em 0.5em 1em;\n  width: 10%;\n\tfloat:left;\n}\n\n/** Fixture */\n\n#qunit-fixture {\n\tposition: absolute;\n\ttop: -10000px;\n\tleft: -10000px;\n\twidth: 1000px;\n\theight: 1000px;\n}\n"
  },
  {
    "path": "qUnit/qunit-2.9.2.js",
    "content": "/*!\n * QUnit 2.9.2\n * https://qunitjs.com/\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2019-02-21T22:49Z\n */\n(function (global$1) {\n  'use strict';\n\n  global$1 = global$1 && global$1.hasOwnProperty('default') ? global$1['default'] : global$1;\n\n  var window$1 = global$1.window;\n  var self$1 = global$1.self;\n  var console = global$1.console;\n  var setTimeout$1 = global$1.setTimeout;\n  var clearTimeout = global$1.clearTimeout;\n\n  var document$1 = window$1 && window$1.document;\n  var navigator = window$1 && window$1.navigator;\n\n  var localSessionStorage = function () {\n  \tvar x = \"qunit-test-string\";\n  \ttry {\n  \t\tglobal$1.sessionStorage.setItem(x, x);\n  \t\tglobal$1.sessionStorage.removeItem(x);\n  \t\treturn global$1.sessionStorage;\n  \t} catch (e) {\n  \t\treturn undefined;\n  \t}\n  }();\n\n  /**\n   * Returns a function that proxies to the given method name on the globals\n   * console object. The proxy will also detect if the console doesn't exist and\n   * will appropriately no-op. This allows support for IE9, which doesn't have a\n   * console if the developer tools are not open.\n   */\n  function consoleProxy(method) {\n  \treturn function () {\n  \t\tif (console) {\n  \t\t\tconsole[method].apply(console, arguments);\n  \t\t}\n  \t};\n  }\n\n  var Logger = {\n  \twarn: consoleProxy(\"warn\")\n  };\n\n  var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n    return typeof obj;\n  } : function (obj) {\n    return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n  };\n\n\n\n\n\n\n\n\n\n\n\n  var classCallCheck = function (instance, Constructor) {\n    if (!(instance instanceof Constructor)) {\n      throw new TypeError(\"Cannot call a class as a function\");\n    }\n  };\n\n  var createClass = function () {\n    function defineProperties(target, props) {\n      for (var i = 0; i < props.length; i++) {\n        var descriptor = props[i];\n        descriptor.enumerable = descriptor.enumerable || false;\n        descriptor.configurable = true;\n        if (\"value\" in descriptor) descriptor.writable = true;\n        Object.defineProperty(target, descriptor.key, descriptor);\n      }\n    }\n\n    return function (Constructor, protoProps, staticProps) {\n      if (protoProps) defineProperties(Constructor.prototype, protoProps);\n      if (staticProps) defineProperties(Constructor, staticProps);\n      return Constructor;\n    };\n  }();\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n  var toConsumableArray = function (arr) {\n    if (Array.isArray(arr)) {\n      for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n      return arr2;\n    } else {\n      return Array.from(arr);\n    }\n  };\n\n  var toString = Object.prototype.toString;\n  var hasOwn = Object.prototype.hasOwnProperty;\n  var now = Date.now || function () {\n  \treturn new Date().getTime();\n  };\n\n  var hasPerformanceApi = detectPerformanceApi();\n  var performance = hasPerformanceApi ? window$1.performance : undefined;\n  var performanceNow = hasPerformanceApi ? performance.now.bind(performance) : now;\n\n  function detectPerformanceApi() {\n  \treturn window$1 && typeof window$1.performance !== \"undefined\" && typeof window$1.performance.mark === \"function\" && typeof window$1.performance.measure === \"function\";\n  }\n\n  function measure(comment, startMark, endMark) {\n\n  \t// `performance.measure` may fail if the mark could not be found.\n  \t// reasons a specific mark could not be found include: outside code invoking `performance.clearMarks()`\n  \ttry {\n  \t\tperformance.measure(comment, startMark, endMark);\n  \t} catch (ex) {\n  \t\tLogger.warn(\"performance.measure could not be executed because of \", ex.message);\n  \t}\n  }\n\n  var defined = {\n  \tdocument: window$1 && window$1.document !== undefined,\n  \tsetTimeout: setTimeout$1 !== undefined\n  };\n\n  // Returns a new Array with the elements that are in a but not in b\n  function diff(a, b) {\n  \tvar i,\n  \t    j,\n  \t    result = a.slice();\n\n  \tfor (i = 0; i < result.length; i++) {\n  \t\tfor (j = 0; j < b.length; j++) {\n  \t\t\tif (result[i] === b[j]) {\n  \t\t\t\tresult.splice(i, 1);\n  \t\t\t\ti--;\n  \t\t\t\tbreak;\n  \t\t\t}\n  \t\t}\n  \t}\n  \treturn result;\n  }\n\n  /**\n   * Determines whether an element exists in a given array or not.\n   *\n   * @method inArray\n   * @param {Any} elem\n   * @param {Array} array\n   * @return {Boolean}\n   */\n  function inArray(elem, array) {\n  \treturn array.indexOf(elem) !== -1;\n  }\n\n  /**\n   * Makes a clone of an object using only Array or Object as base,\n   * and copies over the own enumerable properties.\n   *\n   * @param {Object} obj\n   * @return {Object} New object with only the own properties (recursively).\n   */\n  function objectValues(obj) {\n  \tvar key,\n  \t    val,\n  \t    vals = is(\"array\", obj) ? [] : {};\n  \tfor (key in obj) {\n  \t\tif (hasOwn.call(obj, key)) {\n  \t\t\tval = obj[key];\n  \t\t\tvals[key] = val === Object(val) ? objectValues(val) : val;\n  \t\t}\n  \t}\n  \treturn vals;\n  }\n\n  function extend(a, b, undefOnly) {\n  \tfor (var prop in b) {\n  \t\tif (hasOwn.call(b, prop)) {\n  \t\t\tif (b[prop] === undefined) {\n  \t\t\t\tdelete a[prop];\n  \t\t\t} else if (!(undefOnly && typeof a[prop] !== \"undefined\")) {\n  \t\t\t\ta[prop] = b[prop];\n  \t\t\t}\n  \t\t}\n  \t}\n\n  \treturn a;\n  }\n\n  function objectType(obj) {\n  \tif (typeof obj === \"undefined\") {\n  \t\treturn \"undefined\";\n  \t}\n\n  \t// Consider: typeof null === object\n  \tif (obj === null) {\n  \t\treturn \"null\";\n  \t}\n\n  \tvar match = toString.call(obj).match(/^\\[object\\s(.*)\\]$/),\n  \t    type = match && match[1];\n\n  \tswitch (type) {\n  \t\tcase \"Number\":\n  \t\t\tif (isNaN(obj)) {\n  \t\t\t\treturn \"nan\";\n  \t\t\t}\n  \t\t\treturn \"number\";\n  \t\tcase \"String\":\n  \t\tcase \"Boolean\":\n  \t\tcase \"Array\":\n  \t\tcase \"Set\":\n  \t\tcase \"Map\":\n  \t\tcase \"Date\":\n  \t\tcase \"RegExp\":\n  \t\tcase \"Function\":\n  \t\tcase \"Symbol\":\n  \t\t\treturn type.toLowerCase();\n  \t\tdefault:\n  \t\t\treturn typeof obj === \"undefined\" ? \"undefined\" : _typeof(obj);\n  \t}\n  }\n\n  // Safe object type checking\n  function is(type, obj) {\n  \treturn objectType(obj) === type;\n  }\n\n  // Based on Java's String.hashCode, a simple but not\n  // rigorously collision resistant hashing function\n  function generateHash(module, testName) {\n  \tvar str = module + \"\\x1C\" + testName;\n  \tvar hash = 0;\n\n  \tfor (var i = 0; i < str.length; i++) {\n  \t\thash = (hash << 5) - hash + str.charCodeAt(i);\n  \t\thash |= 0;\n  \t}\n\n  \t// Convert the possibly negative integer hash code into an 8 character hex string, which isn't\n  \t// strictly necessary but increases user understanding that the id is a SHA-like hash\n  \tvar hex = (0x100000000 + hash).toString(16);\n  \tif (hex.length < 8) {\n  \t\thex = \"0000000\" + hex;\n  \t}\n\n  \treturn hex.slice(-8);\n  }\n\n  // Test for equality any JavaScript type.\n  // Authors: Philippe Rathé <prathe@gmail.com>, David Chan <david@troi.org>\n  var equiv = (function () {\n\n  \t// Value pairs queued for comparison. Used for breadth-first processing order, recursion\n  \t// detection and avoiding repeated comparison (see below for details).\n  \t// Elements are { a: val, b: val }.\n  \tvar pairs = [];\n\n  \tvar getProto = Object.getPrototypeOf || function (obj) {\n  \t\treturn obj.__proto__;\n  \t};\n\n  \tfunction useStrictEquality(a, b) {\n\n  \t\t// This only gets called if a and b are not strict equal, and is used to compare on\n  \t\t// the primitive values inside object wrappers. For example:\n  \t\t// `var i = 1;`\n  \t\t// `var j = new Number(1);`\n  \t\t// Neither a nor b can be null, as a !== b and they have the same type.\n  \t\tif ((typeof a === \"undefined\" ? \"undefined\" : _typeof(a)) === \"object\") {\n  \t\t\ta = a.valueOf();\n  \t\t}\n  \t\tif ((typeof b === \"undefined\" ? \"undefined\" : _typeof(b)) === \"object\") {\n  \t\t\tb = b.valueOf();\n  \t\t}\n\n  \t\treturn a === b;\n  \t}\n\n  \tfunction compareConstructors(a, b) {\n  \t\tvar protoA = getProto(a);\n  \t\tvar protoB = getProto(b);\n\n  \t\t// Comparing constructors is more strict than using `instanceof`\n  \t\tif (a.constructor === b.constructor) {\n  \t\t\treturn true;\n  \t\t}\n\n  \t\t// Ref #851\n  \t\t// If the obj prototype descends from a null constructor, treat it\n  \t\t// as a null prototype.\n  \t\tif (protoA && protoA.constructor === null) {\n  \t\t\tprotoA = null;\n  \t\t}\n  \t\tif (protoB && protoB.constructor === null) {\n  \t\t\tprotoB = null;\n  \t\t}\n\n  \t\t// Allow objects with no prototype to be equivalent to\n  \t\t// objects with Object as their constructor.\n  \t\tif (protoA === null && protoB === Object.prototype || protoB === null && protoA === Object.prototype) {\n  \t\t\treturn true;\n  \t\t}\n\n  \t\treturn false;\n  \t}\n\n  \tfunction getRegExpFlags(regexp) {\n  \t\treturn \"flags\" in regexp ? regexp.flags : regexp.toString().match(/[gimuy]*$/)[0];\n  \t}\n\n  \tfunction isContainer(val) {\n  \t\treturn [\"object\", \"array\", \"map\", \"set\"].indexOf(objectType(val)) !== -1;\n  \t}\n\n  \tfunction breadthFirstCompareChild(a, b) {\n\n  \t\t// If a is a container not reference-equal to b, postpone the comparison to the\n  \t\t// end of the pairs queue -- unless (a, b) has been seen before, in which case skip\n  \t\t// over the pair.\n  \t\tif (a === b) {\n  \t\t\treturn true;\n  \t\t}\n  \t\tif (!isContainer(a)) {\n  \t\t\treturn typeEquiv(a, b);\n  \t\t}\n  \t\tif (pairs.every(function (pair) {\n  \t\t\treturn pair.a !== a || pair.b !== b;\n  \t\t})) {\n\n  \t\t\t// Not yet started comparing this pair\n  \t\t\tpairs.push({ a: a, b: b });\n  \t\t}\n  \t\treturn true;\n  \t}\n\n  \tvar callbacks = {\n  \t\t\"string\": useStrictEquality,\n  \t\t\"boolean\": useStrictEquality,\n  \t\t\"number\": useStrictEquality,\n  \t\t\"null\": useStrictEquality,\n  \t\t\"undefined\": useStrictEquality,\n  \t\t\"symbol\": useStrictEquality,\n  \t\t\"date\": useStrictEquality,\n\n  \t\t\"nan\": function nan() {\n  \t\t\treturn true;\n  \t\t},\n\n  \t\t\"regexp\": function regexp(a, b) {\n  \t\t\treturn a.source === b.source &&\n\n  \t\t\t// Include flags in the comparison\n  \t\t\tgetRegExpFlags(a) === getRegExpFlags(b);\n  \t\t},\n\n  \t\t// abort (identical references / instance methods were skipped earlier)\n  \t\t\"function\": function _function() {\n  \t\t\treturn false;\n  \t\t},\n\n  \t\t\"array\": function array(a, b) {\n  \t\t\tvar i, len;\n\n  \t\t\tlen = a.length;\n  \t\t\tif (len !== b.length) {\n\n  \t\t\t\t// Safe and faster\n  \t\t\t\treturn false;\n  \t\t\t}\n\n  \t\t\tfor (i = 0; i < len; i++) {\n\n  \t\t\t\t// Compare non-containers; queue non-reference-equal containers\n  \t\t\t\tif (!breadthFirstCompareChild(a[i], b[i])) {\n  \t\t\t\t\treturn false;\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\treturn true;\n  \t\t},\n\n  \t\t// Define sets a and b to be equivalent if for each element aVal in a, there\n  \t\t// is some element bVal in b such that aVal and bVal are equivalent. Element\n  \t\t// repetitions are not counted, so these are equivalent:\n  \t\t// a = new Set( [ {}, [], [] ] );\n  \t\t// b = new Set( [ {}, {}, [] ] );\n  \t\t\"set\": function set$$1(a, b) {\n  \t\t\tvar innerEq,\n  \t\t\t    outerEq = true;\n\n  \t\t\tif (a.size !== b.size) {\n\n  \t\t\t\t// This optimization has certain quirks because of the lack of\n  \t\t\t\t// repetition counting. For instance, adding the same\n  \t\t\t\t// (reference-identical) element to two equivalent sets can\n  \t\t\t\t// make them non-equivalent.\n  \t\t\t\treturn false;\n  \t\t\t}\n\n  \t\t\ta.forEach(function (aVal) {\n\n  \t\t\t\t// Short-circuit if the result is already known. (Using for...of\n  \t\t\t\t// with a break clause would be cleaner here, but it would cause\n  \t\t\t\t// a syntax error on older Javascript implementations even if\n  \t\t\t\t// Set is unused)\n  \t\t\t\tif (!outerEq) {\n  \t\t\t\t\treturn;\n  \t\t\t\t}\n\n  \t\t\t\tinnerEq = false;\n\n  \t\t\t\tb.forEach(function (bVal) {\n  \t\t\t\t\tvar parentPairs;\n\n  \t\t\t\t\t// Likewise, short-circuit if the result is already known\n  \t\t\t\t\tif (innerEq) {\n  \t\t\t\t\t\treturn;\n  \t\t\t\t\t}\n\n  \t\t\t\t\t// Swap out the global pairs list, as the nested call to\n  \t\t\t\t\t// innerEquiv will clobber its contents\n  \t\t\t\t\tparentPairs = pairs;\n  \t\t\t\t\tif (innerEquiv(bVal, aVal)) {\n  \t\t\t\t\t\tinnerEq = true;\n  \t\t\t\t\t}\n\n  \t\t\t\t\t// Replace the global pairs list\n  \t\t\t\t\tpairs = parentPairs;\n  \t\t\t\t});\n\n  \t\t\t\tif (!innerEq) {\n  \t\t\t\t\touterEq = false;\n  \t\t\t\t}\n  \t\t\t});\n\n  \t\t\treturn outerEq;\n  \t\t},\n\n  \t\t// Define maps a and b to be equivalent if for each key-value pair (aKey, aVal)\n  \t\t// in a, there is some key-value pair (bKey, bVal) in b such that\n  \t\t// [ aKey, aVal ] and [ bKey, bVal ] are equivalent. Key repetitions are not\n  \t\t// counted, so these are equivalent:\n  \t\t// a = new Map( [ [ {}, 1 ], [ {}, 1 ], [ [], 1 ] ] );\n  \t\t// b = new Map( [ [ {}, 1 ], [ [], 1 ], [ [], 1 ] ] );\n  \t\t\"map\": function map(a, b) {\n  \t\t\tvar innerEq,\n  \t\t\t    outerEq = true;\n\n  \t\t\tif (a.size !== b.size) {\n\n  \t\t\t\t// This optimization has certain quirks because of the lack of\n  \t\t\t\t// repetition counting. For instance, adding the same\n  \t\t\t\t// (reference-identical) key-value pair to two equivalent maps\n  \t\t\t\t// can make them non-equivalent.\n  \t\t\t\treturn false;\n  \t\t\t}\n\n  \t\t\ta.forEach(function (aVal, aKey) {\n\n  \t\t\t\t// Short-circuit if the result is already known. (Using for...of\n  \t\t\t\t// with a break clause would be cleaner here, but it would cause\n  \t\t\t\t// a syntax error on older Javascript implementations even if\n  \t\t\t\t// Map is unused)\n  \t\t\t\tif (!outerEq) {\n  \t\t\t\t\treturn;\n  \t\t\t\t}\n\n  \t\t\t\tinnerEq = false;\n\n  \t\t\t\tb.forEach(function (bVal, bKey) {\n  \t\t\t\t\tvar parentPairs;\n\n  \t\t\t\t\t// Likewise, short-circuit if the result is already known\n  \t\t\t\t\tif (innerEq) {\n  \t\t\t\t\t\treturn;\n  \t\t\t\t\t}\n\n  \t\t\t\t\t// Swap out the global pairs list, as the nested call to\n  \t\t\t\t\t// innerEquiv will clobber its contents\n  \t\t\t\t\tparentPairs = pairs;\n  \t\t\t\t\tif (innerEquiv([bVal, bKey], [aVal, aKey])) {\n  \t\t\t\t\t\tinnerEq = true;\n  \t\t\t\t\t}\n\n  \t\t\t\t\t// Replace the global pairs list\n  \t\t\t\t\tpairs = parentPairs;\n  \t\t\t\t});\n\n  \t\t\t\tif (!innerEq) {\n  \t\t\t\t\touterEq = false;\n  \t\t\t\t}\n  \t\t\t});\n\n  \t\t\treturn outerEq;\n  \t\t},\n\n  \t\t\"object\": function object(a, b) {\n  \t\t\tvar i,\n  \t\t\t    aProperties = [],\n  \t\t\t    bProperties = [];\n\n  \t\t\tif (compareConstructors(a, b) === false) {\n  \t\t\t\treturn false;\n  \t\t\t}\n\n  \t\t\t// Be strict: don't ensure hasOwnProperty and go deep\n  \t\t\tfor (i in a) {\n\n  \t\t\t\t// Collect a's properties\n  \t\t\t\taProperties.push(i);\n\n  \t\t\t\t// Skip OOP methods that look the same\n  \t\t\t\tif (a.constructor !== Object && typeof a.constructor !== \"undefined\" && typeof a[i] === \"function\" && typeof b[i] === \"function\" && a[i].toString() === b[i].toString()) {\n  \t\t\t\t\tcontinue;\n  \t\t\t\t}\n\n  \t\t\t\t// Compare non-containers; queue non-reference-equal containers\n  \t\t\t\tif (!breadthFirstCompareChild(a[i], b[i])) {\n  \t\t\t\t\treturn false;\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\tfor (i in b) {\n\n  \t\t\t\t// Collect b's properties\n  \t\t\t\tbProperties.push(i);\n  \t\t\t}\n\n  \t\t\t// Ensures identical properties name\n  \t\t\treturn typeEquiv(aProperties.sort(), bProperties.sort());\n  \t\t}\n  \t};\n\n  \tfunction typeEquiv(a, b) {\n  \t\tvar type = objectType(a);\n\n  \t\t// Callbacks for containers will append to the pairs queue to achieve breadth-first\n  \t\t// search order. The pairs queue is also used to avoid reprocessing any pair of\n  \t\t// containers that are reference-equal to a previously visited pair (a special case\n  \t\t// this being recursion detection).\n  \t\t//\n  \t\t// Because of this approach, once typeEquiv returns a false value, it should not be\n  \t\t// called again without clearing the pair queue else it may wrongly report a visited\n  \t\t// pair as being equivalent.\n  \t\treturn objectType(b) === type && callbacks[type](a, b);\n  \t}\n\n  \tfunction innerEquiv(a, b) {\n  \t\tvar i, pair;\n\n  \t\t// We're done when there's nothing more to compare\n  \t\tif (arguments.length < 2) {\n  \t\t\treturn true;\n  \t\t}\n\n  \t\t// Clear the global pair queue and add the top-level values being compared\n  \t\tpairs = [{ a: a, b: b }];\n\n  \t\tfor (i = 0; i < pairs.length; i++) {\n  \t\t\tpair = pairs[i];\n\n  \t\t\t// Perform type-specific comparison on any pairs that are not strictly\n  \t\t\t// equal. For container types, that comparison will postpone comparison\n  \t\t\t// of any sub-container pair to the end of the pair queue. This gives\n  \t\t\t// breadth-first search order. It also avoids the reprocessing of\n  \t\t\t// reference-equal siblings, cousins etc, which can have a significant speed\n  \t\t\t// impact when comparing a container of small objects each of which has a\n  \t\t\t// reference to the same (singleton) large object.\n  \t\t\tif (pair.a !== pair.b && !typeEquiv(pair.a, pair.b)) {\n  \t\t\t\treturn false;\n  \t\t\t}\n  \t\t}\n\n  \t\t// ...across all consecutive argument pairs\n  \t\treturn arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1));\n  \t}\n\n  \treturn function () {\n  \t\tvar result = innerEquiv.apply(undefined, arguments);\n\n  \t\t// Release any retained objects\n  \t\tpairs.length = 0;\n  \t\treturn result;\n  \t};\n  })();\n\n  /**\n   * Config object: Maintain internal state\n   * Later exposed as QUnit.config\n   * `config` initialized at top of scope\n   */\n  var config = {\n\n  \t// The queue of tests to run\n  \tqueue: [],\n\n  \t// Block until document ready\n  \tblocking: true,\n\n  \t// By default, run previously failed tests first\n  \t// very useful in combination with \"Hide passed tests\" checked\n  \treorder: true,\n\n  \t// By default, modify document.title when suite is done\n  \taltertitle: true,\n\n  \t// HTML Reporter: collapse every test except the first failing test\n  \t// If false, all failing tests will be expanded\n  \tcollapse: true,\n\n  \t// By default, scroll to top of the page when suite is done\n  \tscrolltop: true,\n\n  \t// Depth up-to which object will be dumped\n  \tmaxDepth: 5,\n\n  \t// When enabled, all tests must call expect()\n  \trequireExpects: false,\n\n  \t// Placeholder for user-configurable form-exposed URL parameters\n  \turlConfig: [],\n\n  \t// Set of all modules.\n  \tmodules: [],\n\n  \t// The first unnamed module\n  \tcurrentModule: {\n  \t\tname: \"\",\n  \t\ttests: [],\n  \t\tchildModules: [],\n  \t\ttestsRun: 0,\n  \t\tunskippedTestsRun: 0,\n  \t\thooks: {\n  \t\t\tbefore: [],\n  \t\t\tbeforeEach: [],\n  \t\t\tafterEach: [],\n  \t\t\tafter: []\n  \t\t}\n  \t},\n\n  \tcallbacks: {},\n\n  \t// The storage module to use for reordering tests\n  \tstorage: localSessionStorage\n  };\n\n  // take a predefined QUnit.config and extend the defaults\n  var globalConfig = window$1 && window$1.QUnit && window$1.QUnit.config;\n\n  // only extend the global config if there is no QUnit overload\n  if (window$1 && window$1.QUnit && !window$1.QUnit.version) {\n  \textend(config, globalConfig);\n  }\n\n  // Push a loose unnamed module to the modules collection\n  config.modules.push(config.currentModule);\n\n  // Based on jsDump by Ariel Flesler\n  // http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html\n  var dump = (function () {\n  \tfunction quote(str) {\n  \t\treturn \"\\\"\" + str.toString().replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\";\n  \t}\n  \tfunction literal(o) {\n  \t\treturn o + \"\";\n  \t}\n  \tfunction join(pre, arr, post) {\n  \t\tvar s = dump.separator(),\n  \t\t    base = dump.indent(),\n  \t\t    inner = dump.indent(1);\n  \t\tif (arr.join) {\n  \t\t\tarr = arr.join(\",\" + s + inner);\n  \t\t}\n  \t\tif (!arr) {\n  \t\t\treturn pre + post;\n  \t\t}\n  \t\treturn [pre, inner + arr, base + post].join(s);\n  \t}\n  \tfunction array(arr, stack) {\n  \t\tvar i = arr.length,\n  \t\t    ret = new Array(i);\n\n  \t\tif (dump.maxDepth && dump.depth > dump.maxDepth) {\n  \t\t\treturn \"[object Array]\";\n  \t\t}\n\n  \t\tthis.up();\n  \t\twhile (i--) {\n  \t\t\tret[i] = this.parse(arr[i], undefined, stack);\n  \t\t}\n  \t\tthis.down();\n  \t\treturn join(\"[\", ret, \"]\");\n  \t}\n\n  \tfunction isArray(obj) {\n  \t\treturn (\n\n  \t\t\t//Native Arrays\n  \t\t\ttoString.call(obj) === \"[object Array]\" ||\n\n  \t\t\t// NodeList objects\n  \t\t\ttypeof obj.length === \"number\" && obj.item !== undefined && (obj.length ? obj.item(0) === obj[0] : obj.item(0) === null && obj[0] === undefined)\n  \t\t);\n  \t}\n\n  \tvar reName = /^function (\\w+)/,\n  \t    dump = {\n\n  \t\t// The objType is used mostly internally, you can fix a (custom) type in advance\n  \t\tparse: function parse(obj, objType, stack) {\n  \t\t\tstack = stack || [];\n  \t\t\tvar res,\n  \t\t\t    parser,\n  \t\t\t    parserType,\n  \t\t\t    objIndex = stack.indexOf(obj);\n\n  \t\t\tif (objIndex !== -1) {\n  \t\t\t\treturn \"recursion(\" + (objIndex - stack.length) + \")\";\n  \t\t\t}\n\n  \t\t\tobjType = objType || this.typeOf(obj);\n  \t\t\tparser = this.parsers[objType];\n  \t\t\tparserType = typeof parser === \"undefined\" ? \"undefined\" : _typeof(parser);\n\n  \t\t\tif (parserType === \"function\") {\n  \t\t\t\tstack.push(obj);\n  \t\t\t\tres = parser.call(this, obj, stack);\n  \t\t\t\tstack.pop();\n  \t\t\t\treturn res;\n  \t\t\t}\n  \t\t\treturn parserType === \"string\" ? parser : this.parsers.error;\n  \t\t},\n  \t\ttypeOf: function typeOf(obj) {\n  \t\t\tvar type;\n\n  \t\t\tif (obj === null) {\n  \t\t\t\ttype = \"null\";\n  \t\t\t} else if (typeof obj === \"undefined\") {\n  \t\t\t\ttype = \"undefined\";\n  \t\t\t} else if (is(\"regexp\", obj)) {\n  \t\t\t\ttype = \"regexp\";\n  \t\t\t} else if (is(\"date\", obj)) {\n  \t\t\t\ttype = \"date\";\n  \t\t\t} else if (is(\"function\", obj)) {\n  \t\t\t\ttype = \"function\";\n  \t\t\t} else if (obj.setInterval !== undefined && obj.document !== undefined && obj.nodeType === undefined) {\n  \t\t\t\ttype = \"window\";\n  \t\t\t} else if (obj.nodeType === 9) {\n  \t\t\t\ttype = \"document\";\n  \t\t\t} else if (obj.nodeType) {\n  \t\t\t\ttype = \"node\";\n  \t\t\t} else if (isArray(obj)) {\n  \t\t\t\ttype = \"array\";\n  \t\t\t} else if (obj.constructor === Error.prototype.constructor) {\n  \t\t\t\ttype = \"error\";\n  \t\t\t} else {\n  \t\t\t\ttype = typeof obj === \"undefined\" ? \"undefined\" : _typeof(obj);\n  \t\t\t}\n  \t\t\treturn type;\n  \t\t},\n\n  \t\tseparator: function separator() {\n  \t\t\tif (this.multiline) {\n  \t\t\t\treturn this.HTML ? \"<br />\" : \"\\n\";\n  \t\t\t} else {\n  \t\t\t\treturn this.HTML ? \"&#160;\" : \" \";\n  \t\t\t}\n  \t\t},\n\n  \t\t// Extra can be a number, shortcut for increasing-calling-decreasing\n  \t\tindent: function indent(extra) {\n  \t\t\tif (!this.multiline) {\n  \t\t\t\treturn \"\";\n  \t\t\t}\n  \t\t\tvar chr = this.indentChar;\n  \t\t\tif (this.HTML) {\n  \t\t\t\tchr = chr.replace(/\\t/g, \"   \").replace(/ /g, \"&#160;\");\n  \t\t\t}\n  \t\t\treturn new Array(this.depth + (extra || 0)).join(chr);\n  \t\t},\n  \t\tup: function up(a) {\n  \t\t\tthis.depth += a || 1;\n  \t\t},\n  \t\tdown: function down(a) {\n  \t\t\tthis.depth -= a || 1;\n  \t\t},\n  \t\tsetParser: function setParser(name, parser) {\n  \t\t\tthis.parsers[name] = parser;\n  \t\t},\n\n  \t\t// The next 3 are exposed so you can use them\n  \t\tquote: quote,\n  \t\tliteral: literal,\n  \t\tjoin: join,\n  \t\tdepth: 1,\n  \t\tmaxDepth: config.maxDepth,\n\n  \t\t// This is the list of parsers, to modify them, use dump.setParser\n  \t\tparsers: {\n  \t\t\twindow: \"[Window]\",\n  \t\t\tdocument: \"[Document]\",\n  \t\t\terror: function error(_error) {\n  \t\t\t\treturn \"Error(\\\"\" + _error.message + \"\\\")\";\n  \t\t\t},\n  \t\t\tunknown: \"[Unknown]\",\n  \t\t\t\"null\": \"null\",\n  \t\t\t\"undefined\": \"undefined\",\n  \t\t\t\"function\": function _function(fn) {\n  \t\t\t\tvar ret = \"function\",\n\n\n  \t\t\t\t// Functions never have name in IE\n  \t\t\t\tname = \"name\" in fn ? fn.name : (reName.exec(fn) || [])[1];\n\n  \t\t\t\tif (name) {\n  \t\t\t\t\tret += \" \" + name;\n  \t\t\t\t}\n  \t\t\t\tret += \"(\";\n\n  \t\t\t\tret = [ret, dump.parse(fn, \"functionArgs\"), \"){\"].join(\"\");\n  \t\t\t\treturn join(ret, dump.parse(fn, \"functionCode\"), \"}\");\n  \t\t\t},\n  \t\t\tarray: array,\n  \t\t\tnodelist: array,\n  \t\t\t\"arguments\": array,\n  \t\t\tobject: function object(map, stack) {\n  \t\t\t\tvar keys,\n  \t\t\t\t    key,\n  \t\t\t\t    val,\n  \t\t\t\t    i,\n  \t\t\t\t    nonEnumerableProperties,\n  \t\t\t\t    ret = [];\n\n  \t\t\t\tif (dump.maxDepth && dump.depth > dump.maxDepth) {\n  \t\t\t\t\treturn \"[object Object]\";\n  \t\t\t\t}\n\n  \t\t\t\tdump.up();\n  \t\t\t\tkeys = [];\n  \t\t\t\tfor (key in map) {\n  \t\t\t\t\tkeys.push(key);\n  \t\t\t\t}\n\n  \t\t\t\t// Some properties are not always enumerable on Error objects.\n  \t\t\t\tnonEnumerableProperties = [\"message\", \"name\"];\n  \t\t\t\tfor (i in nonEnumerableProperties) {\n  \t\t\t\t\tkey = nonEnumerableProperties[i];\n  \t\t\t\t\tif (key in map && !inArray(key, keys)) {\n  \t\t\t\t\t\tkeys.push(key);\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t\tkeys.sort();\n  \t\t\t\tfor (i = 0; i < keys.length; i++) {\n  \t\t\t\t\tkey = keys[i];\n  \t\t\t\t\tval = map[key];\n  \t\t\t\t\tret.push(dump.parse(key, \"key\") + \": \" + dump.parse(val, undefined, stack));\n  \t\t\t\t}\n  \t\t\t\tdump.down();\n  \t\t\t\treturn join(\"{\", ret, \"}\");\n  \t\t\t},\n  \t\t\tnode: function node(_node) {\n  \t\t\t\tvar len,\n  \t\t\t\t    i,\n  \t\t\t\t    val,\n  \t\t\t\t    open = dump.HTML ? \"&lt;\" : \"<\",\n  \t\t\t\t    close = dump.HTML ? \"&gt;\" : \">\",\n  \t\t\t\t    tag = _node.nodeName.toLowerCase(),\n  \t\t\t\t    ret = open + tag,\n  \t\t\t\t    attrs = _node.attributes;\n\n  \t\t\t\tif (attrs) {\n  \t\t\t\t\tfor (i = 0, len = attrs.length; i < len; i++) {\n  \t\t\t\t\t\tval = attrs[i].nodeValue;\n\n  \t\t\t\t\t\t// IE6 includes all attributes in .attributes, even ones not explicitly\n  \t\t\t\t\t\t// set. Those have values like undefined, null, 0, false, \"\" or\n  \t\t\t\t\t\t// \"inherit\".\n  \t\t\t\t\t\tif (val && val !== \"inherit\") {\n  \t\t\t\t\t\t\tret += \" \" + attrs[i].nodeName + \"=\" + dump.parse(val, \"attribute\");\n  \t\t\t\t\t\t}\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t\tret += close;\n\n  \t\t\t\t// Show content of TextNode or CDATASection\n  \t\t\t\tif (_node.nodeType === 3 || _node.nodeType === 4) {\n  \t\t\t\t\tret += _node.nodeValue;\n  \t\t\t\t}\n\n  \t\t\t\treturn ret + open + \"/\" + tag + close;\n  \t\t\t},\n\n  \t\t\t// Function calls it internally, it's the arguments part of the function\n  \t\t\tfunctionArgs: function functionArgs(fn) {\n  \t\t\t\tvar args,\n  \t\t\t\t    l = fn.length;\n\n  \t\t\t\tif (!l) {\n  \t\t\t\t\treturn \"\";\n  \t\t\t\t}\n\n  \t\t\t\targs = new Array(l);\n  \t\t\t\twhile (l--) {\n\n  \t\t\t\t\t// 97 is 'a'\n  \t\t\t\t\targs[l] = String.fromCharCode(97 + l);\n  \t\t\t\t}\n  \t\t\t\treturn \" \" + args.join(\", \") + \" \";\n  \t\t\t},\n\n  \t\t\t// Object calls it internally, the key part of an item in a map\n  \t\t\tkey: quote,\n\n  \t\t\t// Function calls it internally, it's the content of the function\n  \t\t\tfunctionCode: \"[code]\",\n\n  \t\t\t// Node calls it internally, it's a html attribute value\n  \t\t\tattribute: quote,\n  \t\t\tstring: quote,\n  \t\t\tdate: quote,\n  \t\t\tregexp: literal,\n  \t\t\tnumber: literal,\n  \t\t\t\"boolean\": literal,\n  \t\t\tsymbol: function symbol(sym) {\n  \t\t\t\treturn sym.toString();\n  \t\t\t}\n  \t\t},\n\n  \t\t// If true, entities are escaped ( <, >, \\t, space and \\n )\n  \t\tHTML: false,\n\n  \t\t// Indentation unit\n  \t\tindentChar: \"  \",\n\n  \t\t// If true, items in a collection, are separated by a \\n, else just a space.\n  \t\tmultiline: true\n  \t};\n\n  \treturn dump;\n  })();\n\n  var SuiteReport = function () {\n  \tfunction SuiteReport(name, parentSuite) {\n  \t\tclassCallCheck(this, SuiteReport);\n\n  \t\tthis.name = name;\n  \t\tthis.fullName = parentSuite ? parentSuite.fullName.concat(name) : [];\n\n  \t\tthis.tests = [];\n  \t\tthis.childSuites = [];\n\n  \t\tif (parentSuite) {\n  \t\t\tparentSuite.pushChildSuite(this);\n  \t\t}\n  \t}\n\n  \tcreateClass(SuiteReport, [{\n  \t\tkey: \"start\",\n  \t\tvalue: function start(recordTime) {\n  \t\t\tif (recordTime) {\n  \t\t\t\tthis._startTime = performanceNow();\n\n  \t\t\t\tif (performance) {\n  \t\t\t\t\tvar suiteLevel = this.fullName.length;\n  \t\t\t\t\tperformance.mark(\"qunit_suite_\" + suiteLevel + \"_start\");\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\treturn {\n  \t\t\t\tname: this.name,\n  \t\t\t\tfullName: this.fullName.slice(),\n  \t\t\t\ttests: this.tests.map(function (test) {\n  \t\t\t\t\treturn test.start();\n  \t\t\t\t}),\n  \t\t\t\tchildSuites: this.childSuites.map(function (suite) {\n  \t\t\t\t\treturn suite.start();\n  \t\t\t\t}),\n  \t\t\t\ttestCounts: {\n  \t\t\t\t\ttotal: this.getTestCounts().total\n  \t\t\t\t}\n  \t\t\t};\n  \t\t}\n  \t}, {\n  \t\tkey: \"end\",\n  \t\tvalue: function end(recordTime) {\n  \t\t\tif (recordTime) {\n  \t\t\t\tthis._endTime = performanceNow();\n\n  \t\t\t\tif (performance) {\n  \t\t\t\t\tvar suiteLevel = this.fullName.length;\n  \t\t\t\t\tperformance.mark(\"qunit_suite_\" + suiteLevel + \"_end\");\n\n  \t\t\t\t\tvar suiteName = this.fullName.join(\" – \");\n\n  \t\t\t\t\tmeasure(suiteLevel === 0 ? \"QUnit Test Run\" : \"QUnit Test Suite: \" + suiteName, \"qunit_suite_\" + suiteLevel + \"_start\", \"qunit_suite_\" + suiteLevel + \"_end\");\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\treturn {\n  \t\t\t\tname: this.name,\n  \t\t\t\tfullName: this.fullName.slice(),\n  \t\t\t\ttests: this.tests.map(function (test) {\n  \t\t\t\t\treturn test.end();\n  \t\t\t\t}),\n  \t\t\t\tchildSuites: this.childSuites.map(function (suite) {\n  \t\t\t\t\treturn suite.end();\n  \t\t\t\t}),\n  \t\t\t\ttestCounts: this.getTestCounts(),\n  \t\t\t\truntime: this.getRuntime(),\n  \t\t\t\tstatus: this.getStatus()\n  \t\t\t};\n  \t\t}\n  \t}, {\n  \t\tkey: \"pushChildSuite\",\n  \t\tvalue: function pushChildSuite(suite) {\n  \t\t\tthis.childSuites.push(suite);\n  \t\t}\n  \t}, {\n  \t\tkey: \"pushTest\",\n  \t\tvalue: function pushTest(test) {\n  \t\t\tthis.tests.push(test);\n  \t\t}\n  \t}, {\n  \t\tkey: \"getRuntime\",\n  \t\tvalue: function getRuntime() {\n  \t\t\treturn this._endTime - this._startTime;\n  \t\t}\n  \t}, {\n  \t\tkey: \"getTestCounts\",\n  \t\tvalue: function getTestCounts() {\n  \t\t\tvar counts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { passed: 0, failed: 0, skipped: 0, todo: 0, total: 0 };\n\n  \t\t\tcounts = this.tests.reduce(function (counts, test) {\n  \t\t\t\tif (test.valid) {\n  \t\t\t\t\tcounts[test.getStatus()]++;\n  \t\t\t\t\tcounts.total++;\n  \t\t\t\t}\n\n  \t\t\t\treturn counts;\n  \t\t\t}, counts);\n\n  \t\t\treturn this.childSuites.reduce(function (counts, suite) {\n  \t\t\t\treturn suite.getTestCounts(counts);\n  \t\t\t}, counts);\n  \t\t}\n  \t}, {\n  \t\tkey: \"getStatus\",\n  \t\tvalue: function getStatus() {\n  \t\t\tvar _getTestCounts = this.getTestCounts(),\n  \t\t\t    total = _getTestCounts.total,\n  \t\t\t    failed = _getTestCounts.failed,\n  \t\t\t    skipped = _getTestCounts.skipped,\n  \t\t\t    todo = _getTestCounts.todo;\n\n  \t\t\tif (failed) {\n  \t\t\t\treturn \"failed\";\n  \t\t\t} else {\n  \t\t\t\tif (skipped === total) {\n  \t\t\t\t\treturn \"skipped\";\n  \t\t\t\t} else if (todo === total) {\n  \t\t\t\t\treturn \"todo\";\n  \t\t\t\t} else {\n  \t\t\t\t\treturn \"passed\";\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n  \t}]);\n  \treturn SuiteReport;\n  }();\n\n  var focused = false;\n\n  var moduleStack = [];\n\n  function createModule(name, testEnvironment, modifiers) {\n  \tvar parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null;\n  \tvar moduleName = parentModule !== null ? [parentModule.name, name].join(\" > \") : name;\n  \tvar parentSuite = parentModule ? parentModule.suiteReport : globalSuite;\n\n  \tvar skip = parentModule !== null && parentModule.skip || modifiers.skip;\n  \tvar todo = parentModule !== null && parentModule.todo || modifiers.todo;\n\n  \tvar module = {\n  \t\tname: moduleName,\n  \t\tparentModule: parentModule,\n  \t\ttests: [],\n  \t\tmoduleId: generateHash(moduleName),\n  \t\ttestsRun: 0,\n  \t\tunskippedTestsRun: 0,\n  \t\tchildModules: [],\n  \t\tsuiteReport: new SuiteReport(name, parentSuite),\n\n  \t\t// Pass along `skip` and `todo` properties from parent module, in case\n  \t\t// there is one, to childs. And use own otherwise.\n  \t\t// This property will be used to mark own tests and tests of child suites\n  \t\t// as either `skipped` or `todo`.\n  \t\tskip: skip,\n  \t\ttodo: skip ? false : todo\n  \t};\n\n  \tvar env = {};\n  \tif (parentModule) {\n  \t\tparentModule.childModules.push(module);\n  \t\textend(env, parentModule.testEnvironment);\n  \t}\n  \textend(env, testEnvironment);\n  \tmodule.testEnvironment = env;\n\n  \tconfig.modules.push(module);\n  \treturn module;\n  }\n\n  function processModule(name, options, executeNow) {\n  \tvar modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n  \tif (objectType(options) === \"function\") {\n  \t\texecuteNow = options;\n  \t\toptions = undefined;\n  \t}\n\n  \tvar module = createModule(name, options, modifiers);\n\n  \t// Move any hooks to a 'hooks' object\n  \tvar testEnvironment = module.testEnvironment;\n  \tvar hooks = module.hooks = {};\n\n  \tsetHookFromEnvironment(hooks, testEnvironment, \"before\");\n  \tsetHookFromEnvironment(hooks, testEnvironment, \"beforeEach\");\n  \tsetHookFromEnvironment(hooks, testEnvironment, \"afterEach\");\n  \tsetHookFromEnvironment(hooks, testEnvironment, \"after\");\n\n  \tvar moduleFns = {\n  \t\tbefore: setHookFunction(module, \"before\"),\n  \t\tbeforeEach: setHookFunction(module, \"beforeEach\"),\n  \t\tafterEach: setHookFunction(module, \"afterEach\"),\n  \t\tafter: setHookFunction(module, \"after\")\n  \t};\n\n  \tvar currentModule = config.currentModule;\n  \tif (objectType(executeNow) === \"function\") {\n  \t\tmoduleStack.push(module);\n  \t\tconfig.currentModule = module;\n  \t\texecuteNow.call(module.testEnvironment, moduleFns);\n  \t\tmoduleStack.pop();\n  \t\tmodule = module.parentModule || currentModule;\n  \t}\n\n  \tconfig.currentModule = module;\n\n  \tfunction setHookFromEnvironment(hooks, environment, name) {\n  \t\tvar potentialHook = environment[name];\n  \t\thooks[name] = typeof potentialHook === \"function\" ? [potentialHook] : [];\n  \t\tdelete environment[name];\n  \t}\n\n  \tfunction setHookFunction(module, hookName) {\n  \t\treturn function setHook(callback) {\n  \t\t\tmodule.hooks[hookName].push(callback);\n  \t\t};\n  \t}\n  }\n\n  function module$1(name, options, executeNow) {\n  \tif (focused) {\n  \t\treturn;\n  \t}\n\n  \tprocessModule(name, options, executeNow);\n  }\n\n  module$1.only = function () {\n  \tif (focused) {\n  \t\treturn;\n  \t}\n\n  \tconfig.modules.length = 0;\n  \tconfig.queue.length = 0;\n\n  \tmodule$1.apply(undefined, arguments);\n\n  \tfocused = true;\n  };\n\n  module$1.skip = function (name, options, executeNow) {\n  \tif (focused) {\n  \t\treturn;\n  \t}\n\n  \tprocessModule(name, options, executeNow, { skip: true });\n  };\n\n  module$1.todo = function (name, options, executeNow) {\n  \tif (focused) {\n  \t\treturn;\n  \t}\n\n  \tprocessModule(name, options, executeNow, { todo: true });\n  };\n\n  var LISTENERS = Object.create(null);\n  var SUPPORTED_EVENTS = [\"runStart\", \"suiteStart\", \"testStart\", \"assertion\", \"testEnd\", \"suiteEnd\", \"runEnd\"];\n\n  /**\n   * Emits an event with the specified data to all currently registered listeners.\n   * Callbacks will fire in the order in which they are registered (FIFO). This\n   * function is not exposed publicly; it is used by QUnit internals to emit\n   * logging events.\n   *\n   * @private\n   * @method emit\n   * @param {String} eventName\n   * @param {Object} data\n   * @return {Void}\n   */\n  function emit(eventName, data) {\n  \tif (objectType(eventName) !== \"string\") {\n  \t\tthrow new TypeError(\"eventName must be a string when emitting an event\");\n  \t}\n\n  \t// Clone the callbacks in case one of them registers a new callback\n  \tvar originalCallbacks = LISTENERS[eventName];\n  \tvar callbacks = originalCallbacks ? [].concat(toConsumableArray(originalCallbacks)) : [];\n\n  \tfor (var i = 0; i < callbacks.length; i++) {\n  \t\tcallbacks[i](data);\n  \t}\n  }\n\n  /**\n   * Registers a callback as a listener to the specified event.\n   *\n   * @public\n   * @method on\n   * @param {String} eventName\n   * @param {Function} callback\n   * @return {Void}\n   */\n  function on(eventName, callback) {\n  \tif (objectType(eventName) !== \"string\") {\n  \t\tthrow new TypeError(\"eventName must be a string when registering a listener\");\n  \t} else if (!inArray(eventName, SUPPORTED_EVENTS)) {\n  \t\tvar events = SUPPORTED_EVENTS.join(\", \");\n  \t\tthrow new Error(\"\\\"\" + eventName + \"\\\" is not a valid event; must be one of: \" + events + \".\");\n  \t} else if (objectType(callback) !== \"function\") {\n  \t\tthrow new TypeError(\"callback must be a function when registering a listener\");\n  \t}\n\n  \tif (!LISTENERS[eventName]) {\n  \t\tLISTENERS[eventName] = [];\n  \t}\n\n  \t// Don't register the same callback more than once\n  \tif (!inArray(callback, LISTENERS[eventName])) {\n  \t\tLISTENERS[eventName].push(callback);\n  \t}\n  }\n\n  function objectOrFunction(x) {\n    var type = typeof x === 'undefined' ? 'undefined' : _typeof(x);\n    return x !== null && (type === 'object' || type === 'function');\n  }\n\n  function isFunction(x) {\n    return typeof x === 'function';\n  }\n\n\n\n  var _isArray = void 0;\n  if (Array.isArray) {\n    _isArray = Array.isArray;\n  } else {\n    _isArray = function _isArray(x) {\n      return Object.prototype.toString.call(x) === '[object Array]';\n    };\n  }\n\n  var isArray = _isArray;\n\n  var len = 0;\n  var vertxNext = void 0;\n  var customSchedulerFn = void 0;\n\n  var asap = function asap(callback, arg) {\n    queue[len] = callback;\n    queue[len + 1] = arg;\n    len += 2;\n    if (len === 2) {\n      // If len is 2, that means that we need to schedule an async flush.\n      // If additional callbacks are queued before the queue is flushed, they\n      // will be processed by this flush that we are scheduling.\n      if (customSchedulerFn) {\n        customSchedulerFn(flush);\n      } else {\n        scheduleFlush();\n      }\n    }\n  };\n\n  function setScheduler(scheduleFn) {\n    customSchedulerFn = scheduleFn;\n  }\n\n  function setAsap(asapFn) {\n    asap = asapFn;\n  }\n\n  var browserWindow = typeof window !== 'undefined' ? window : undefined;\n  var browserGlobal = browserWindow || {};\n  var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\n  var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n  // test for web worker but not in IE10\n  var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n  // node\n  function useNextTick() {\n    // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n    // see https://github.com/cujojs/when/issues/410 for details\n    return function () {\n      return process.nextTick(flush);\n    };\n  }\n\n  // vertx\n  function useVertxTimer() {\n    if (typeof vertxNext !== 'undefined') {\n      return function () {\n        vertxNext(flush);\n      };\n    }\n\n    return useSetTimeout();\n  }\n\n  function useMutationObserver() {\n    var iterations = 0;\n    var observer = new BrowserMutationObserver(flush);\n    var node = document.createTextNode('');\n    observer.observe(node, { characterData: true });\n\n    return function () {\n      node.data = iterations = ++iterations % 2;\n    };\n  }\n\n  // web worker\n  function useMessageChannel() {\n    var channel = new MessageChannel();\n    channel.port1.onmessage = flush;\n    return function () {\n      return channel.port2.postMessage(0);\n    };\n  }\n\n  function useSetTimeout() {\n    // Store setTimeout reference so es6-promise will be unaffected by\n    // other code modifying setTimeout (like sinon.useFakeTimers())\n    var globalSetTimeout = setTimeout;\n    return function () {\n      return globalSetTimeout(flush, 1);\n    };\n  }\n\n  var queue = new Array(1000);\n  function flush() {\n    for (var i = 0; i < len; i += 2) {\n      var callback = queue[i];\n      var arg = queue[i + 1];\n\n      callback(arg);\n\n      queue[i] = undefined;\n      queue[i + 1] = undefined;\n    }\n\n    len = 0;\n  }\n\n  function attemptVertx() {\n    try {\n      var vertx = Function('return this')().require('vertx');\n      vertxNext = vertx.runOnLoop || vertx.runOnContext;\n      return useVertxTimer();\n    } catch (e) {\n      return useSetTimeout();\n    }\n  }\n\n  var scheduleFlush = void 0;\n  // Decide what async method to use to triggering processing of queued callbacks:\n  if (isNode) {\n    scheduleFlush = useNextTick();\n  } else if (BrowserMutationObserver) {\n    scheduleFlush = useMutationObserver();\n  } else if (isWorker) {\n    scheduleFlush = useMessageChannel();\n  } else if (browserWindow === undefined && typeof require === 'function') {\n    scheduleFlush = attemptVertx();\n  } else {\n    scheduleFlush = useSetTimeout();\n  }\n\n  function then(onFulfillment, onRejection) {\n    var parent = this;\n\n    var child = new this.constructor(noop);\n\n    if (child[PROMISE_ID] === undefined) {\n      makePromise(child);\n    }\n\n    var _state = parent._state;\n\n\n    if (_state) {\n      var callback = arguments[_state - 1];\n      asap(function () {\n        return invokeCallback(_state, child, callback, parent._result);\n      });\n    } else {\n      subscribe(parent, child, onFulfillment, onRejection);\n    }\n\n    return child;\n  }\n\n  /**\n    `Promise.resolve` returns a promise that will become resolved with the\n    passed `value`. It is shorthand for the following:\n\n    ```javascript\n    let promise = new Promise(function(resolve, reject){\n      resolve(1);\n    });\n\n    promise.then(function(value){\n      // value === 1\n    });\n    ```\n\n    Instead of writing the above, your code now simply becomes the following:\n\n    ```javascript\n    let promise = Promise.resolve(1);\n\n    promise.then(function(value){\n      // value === 1\n    });\n    ```\n\n    @method resolve\n    @static\n    @param {Any} value value that the returned promise will be resolved with\n    Useful for tooling.\n    @return {Promise} a promise that will become fulfilled with the given\n    `value`\n  */\n  function resolve$1(object) {\n    /*jshint validthis:true */\n    var Constructor = this;\n\n    if (object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object.constructor === Constructor) {\n      return object;\n    }\n\n    var promise = new Constructor(noop);\n    resolve(promise, object);\n    return promise;\n  }\n\n  var PROMISE_ID = Math.random().toString(36).substring(2);\n\n  function noop() {}\n\n  var PENDING = void 0;\n  var FULFILLED = 1;\n  var REJECTED = 2;\n\n  var TRY_CATCH_ERROR = { error: null };\n\n  function selfFulfillment() {\n    return new TypeError(\"You cannot resolve a promise with itself\");\n  }\n\n  function cannotReturnOwn() {\n    return new TypeError('A promises callback cannot return that same promise.');\n  }\n\n  function getThen(promise) {\n    try {\n      return promise.then;\n    } catch (error) {\n      TRY_CATCH_ERROR.error = error;\n      return TRY_CATCH_ERROR;\n    }\n  }\n\n  function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n    try {\n      then$$1.call(value, fulfillmentHandler, rejectionHandler);\n    } catch (e) {\n      return e;\n    }\n  }\n\n  function handleForeignThenable(promise, thenable, then$$1) {\n    asap(function (promise) {\n      var sealed = false;\n      var error = tryThen(then$$1, thenable, function (value) {\n        if (sealed) {\n          return;\n        }\n        sealed = true;\n        if (thenable !== value) {\n          resolve(promise, value);\n        } else {\n          fulfill(promise, value);\n        }\n      }, function (reason) {\n        if (sealed) {\n          return;\n        }\n        sealed = true;\n\n        reject(promise, reason);\n      }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n      if (!sealed && error) {\n        sealed = true;\n        reject(promise, error);\n      }\n    }, promise);\n  }\n\n  function handleOwnThenable(promise, thenable) {\n    if (thenable._state === FULFILLED) {\n      fulfill(promise, thenable._result);\n    } else if (thenable._state === REJECTED) {\n      reject(promise, thenable._result);\n    } else {\n      subscribe(thenable, undefined, function (value) {\n        return resolve(promise, value);\n      }, function (reason) {\n        return reject(promise, reason);\n      });\n    }\n  }\n\n  function handleMaybeThenable(promise, maybeThenable, then$$1) {\n    if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n      handleOwnThenable(promise, maybeThenable);\n    } else {\n      if (then$$1 === TRY_CATCH_ERROR) {\n        reject(promise, TRY_CATCH_ERROR.error);\n        TRY_CATCH_ERROR.error = null;\n      } else if (then$$1 === undefined) {\n        fulfill(promise, maybeThenable);\n      } else if (isFunction(then$$1)) {\n        handleForeignThenable(promise, maybeThenable, then$$1);\n      } else {\n        fulfill(promise, maybeThenable);\n      }\n    }\n  }\n\n  function resolve(promise, value) {\n    if (promise === value) {\n      reject(promise, selfFulfillment());\n    } else if (objectOrFunction(value)) {\n      handleMaybeThenable(promise, value, getThen(value));\n    } else {\n      fulfill(promise, value);\n    }\n  }\n\n  function publishRejection(promise) {\n    if (promise._onerror) {\n      promise._onerror(promise._result);\n    }\n\n    publish(promise);\n  }\n\n  function fulfill(promise, value) {\n    if (promise._state !== PENDING) {\n      return;\n    }\n\n    promise._result = value;\n    promise._state = FULFILLED;\n\n    if (promise._subscribers.length !== 0) {\n      asap(publish, promise);\n    }\n  }\n\n  function reject(promise, reason) {\n    if (promise._state !== PENDING) {\n      return;\n    }\n    promise._state = REJECTED;\n    promise._result = reason;\n\n    asap(publishRejection, promise);\n  }\n\n  function subscribe(parent, child, onFulfillment, onRejection) {\n    var _subscribers = parent._subscribers;\n    var length = _subscribers.length;\n\n\n    parent._onerror = null;\n\n    _subscribers[length] = child;\n    _subscribers[length + FULFILLED] = onFulfillment;\n    _subscribers[length + REJECTED] = onRejection;\n\n    if (length === 0 && parent._state) {\n      asap(publish, parent);\n    }\n  }\n\n  function publish(promise) {\n    var subscribers = promise._subscribers;\n    var settled = promise._state;\n\n    if (subscribers.length === 0) {\n      return;\n    }\n\n    var child = void 0,\n        callback = void 0,\n        detail = promise._result;\n\n    for (var i = 0; i < subscribers.length; i += 3) {\n      child = subscribers[i];\n      callback = subscribers[i + settled];\n\n      if (child) {\n        invokeCallback(settled, child, callback, detail);\n      } else {\n        callback(detail);\n      }\n    }\n\n    promise._subscribers.length = 0;\n  }\n\n  function tryCatch(callback, detail) {\n    try {\n      return callback(detail);\n    } catch (e) {\n      TRY_CATCH_ERROR.error = e;\n      return TRY_CATCH_ERROR;\n    }\n  }\n\n  function invokeCallback(settled, promise, callback, detail) {\n    var hasCallback = isFunction(callback),\n        value = void 0,\n        error = void 0,\n        succeeded = void 0,\n        failed = void 0;\n\n    if (hasCallback) {\n      value = tryCatch(callback, detail);\n\n      if (value === TRY_CATCH_ERROR) {\n        failed = true;\n        error = value.error;\n        value.error = null;\n      } else {\n        succeeded = true;\n      }\n\n      if (promise === value) {\n        reject(promise, cannotReturnOwn());\n        return;\n      }\n    } else {\n      value = detail;\n      succeeded = true;\n    }\n\n    if (promise._state !== PENDING) {\n      // noop\n    } else if (hasCallback && succeeded) {\n      resolve(promise, value);\n    } else if (failed) {\n      reject(promise, error);\n    } else if (settled === FULFILLED) {\n      fulfill(promise, value);\n    } else if (settled === REJECTED) {\n      reject(promise, value);\n    }\n  }\n\n  function initializePromise(promise, resolver) {\n    try {\n      resolver(function resolvePromise(value) {\n        resolve(promise, value);\n      }, function rejectPromise(reason) {\n        reject(promise, reason);\n      });\n    } catch (e) {\n      reject(promise, e);\n    }\n  }\n\n  var id = 0;\n  function nextId() {\n    return id++;\n  }\n\n  function makePromise(promise) {\n    promise[PROMISE_ID] = id++;\n    promise._state = undefined;\n    promise._result = undefined;\n    promise._subscribers = [];\n  }\n\n  function validationError() {\n    return new Error('Array Methods must be provided an Array');\n  }\n\n  var Enumerator = function () {\n    function Enumerator(Constructor, input) {\n      classCallCheck(this, Enumerator);\n\n      this._instanceConstructor = Constructor;\n      this.promise = new Constructor(noop);\n\n      if (!this.promise[PROMISE_ID]) {\n        makePromise(this.promise);\n      }\n\n      if (isArray(input)) {\n        this.length = input.length;\n        this._remaining = input.length;\n\n        this._result = new Array(this.length);\n\n        if (this.length === 0) {\n          fulfill(this.promise, this._result);\n        } else {\n          this.length = this.length || 0;\n          this._enumerate(input);\n          if (this._remaining === 0) {\n            fulfill(this.promise, this._result);\n          }\n        }\n      } else {\n        reject(this.promise, validationError());\n      }\n    }\n\n    createClass(Enumerator, [{\n      key: '_enumerate',\n      value: function _enumerate(input) {\n        for (var i = 0; this._state === PENDING && i < input.length; i++) {\n          this._eachEntry(input[i], i);\n        }\n      }\n    }, {\n      key: '_eachEntry',\n      value: function _eachEntry(entry, i) {\n        var c = this._instanceConstructor;\n        var resolve$$1 = c.resolve;\n\n\n        if (resolve$$1 === resolve$1) {\n          var _then = getThen(entry);\n\n          if (_then === then && entry._state !== PENDING) {\n            this._settledAt(entry._state, i, entry._result);\n          } else if (typeof _then !== 'function') {\n            this._remaining--;\n            this._result[i] = entry;\n          } else if (c === Promise$2) {\n            var promise = new c(noop);\n            handleMaybeThenable(promise, entry, _then);\n            this._willSettleAt(promise, i);\n          } else {\n            this._willSettleAt(new c(function (resolve$$1) {\n              return resolve$$1(entry);\n            }), i);\n          }\n        } else {\n          this._willSettleAt(resolve$$1(entry), i);\n        }\n      }\n    }, {\n      key: '_settledAt',\n      value: function _settledAt(state, i, value) {\n        var promise = this.promise;\n\n\n        if (promise._state === PENDING) {\n          this._remaining--;\n\n          if (state === REJECTED) {\n            reject(promise, value);\n          } else {\n            this._result[i] = value;\n          }\n        }\n\n        if (this._remaining === 0) {\n          fulfill(promise, this._result);\n        }\n      }\n    }, {\n      key: '_willSettleAt',\n      value: function _willSettleAt(promise, i) {\n        var enumerator = this;\n\n        subscribe(promise, undefined, function (value) {\n          return enumerator._settledAt(FULFILLED, i, value);\n        }, function (reason) {\n          return enumerator._settledAt(REJECTED, i, reason);\n        });\n      }\n    }]);\n    return Enumerator;\n  }();\n\n  /**\n    `Promise.all` accepts an array of promises, and returns a new promise which\n    is fulfilled with an array of fulfillment values for the passed promises, or\n    rejected with the reason of the first passed promise to be rejected. It casts all\n    elements of the passed iterable to promises as it runs this algorithm.\n\n    Example:\n\n    ```javascript\n    let promise1 = resolve(1);\n    let promise2 = resolve(2);\n    let promise3 = resolve(3);\n    let promises = [ promise1, promise2, promise3 ];\n\n    Promise.all(promises).then(function(array){\n      // The array here would be [ 1, 2, 3 ];\n    });\n    ```\n\n    If any of the `promises` given to `all` are rejected, the first promise\n    that is rejected will be given as an argument to the returned promises's\n    rejection handler. For example:\n\n    Example:\n\n    ```javascript\n    let promise1 = resolve(1);\n    let promise2 = reject(new Error(\"2\"));\n    let promise3 = reject(new Error(\"3\"));\n    let promises = [ promise1, promise2, promise3 ];\n\n    Promise.all(promises).then(function(array){\n      // Code here never runs because there are rejected promises!\n    }, function(error) {\n      // error.message === \"2\"\n    });\n    ```\n\n    @method all\n    @static\n    @param {Array} entries array of promises\n    @param {String} label optional string for labeling the promise.\n    Useful for tooling.\n    @return {Promise} promise that is fulfilled when all `promises` have been\n    fulfilled, or rejected if any of them become rejected.\n    @static\n  */\n  function all(entries) {\n    return new Enumerator(this, entries).promise;\n  }\n\n  /**\n    `Promise.race` returns a new promise which is settled in the same way as the\n    first passed promise to settle.\n\n    Example:\n\n    ```javascript\n    let promise1 = new Promise(function(resolve, reject){\n      setTimeout(function(){\n        resolve('promise 1');\n      }, 200);\n    });\n\n    let promise2 = new Promise(function(resolve, reject){\n      setTimeout(function(){\n        resolve('promise 2');\n      }, 100);\n    });\n\n    Promise.race([promise1, promise2]).then(function(result){\n      // result === 'promise 2' because it was resolved before promise1\n      // was resolved.\n    });\n    ```\n\n    `Promise.race` is deterministic in that only the state of the first\n    settled promise matters. For example, even if other promises given to the\n    `promises` array argument are resolved, but the first settled promise has\n    become rejected before the other promises became fulfilled, the returned\n    promise will become rejected:\n\n    ```javascript\n    let promise1 = new Promise(function(resolve, reject){\n      setTimeout(function(){\n        resolve('promise 1');\n      }, 200);\n    });\n\n    let promise2 = new Promise(function(resolve, reject){\n      setTimeout(function(){\n        reject(new Error('promise 2'));\n      }, 100);\n    });\n\n    Promise.race([promise1, promise2]).then(function(result){\n      // Code here never runs\n    }, function(reason){\n      // reason.message === 'promise 2' because promise 2 became rejected before\n      // promise 1 became fulfilled\n    });\n    ```\n\n    An example real-world use case is implementing timeouts:\n\n    ```javascript\n    Promise.race([ajax('foo.json'), timeout(5000)])\n    ```\n\n    @method race\n    @static\n    @param {Array} promises array of promises to observe\n    Useful for tooling.\n    @return {Promise} a promise which settles in the same way as the first passed\n    promise to settle.\n  */\n  function race(entries) {\n    /*jshint validthis:true */\n    var Constructor = this;\n\n    if (!isArray(entries)) {\n      return new Constructor(function (_, reject) {\n        return reject(new TypeError('You must pass an array to race.'));\n      });\n    } else {\n      return new Constructor(function (resolve, reject) {\n        var length = entries.length;\n        for (var i = 0; i < length; i++) {\n          Constructor.resolve(entries[i]).then(resolve, reject);\n        }\n      });\n    }\n  }\n\n  /**\n    `Promise.reject` returns a promise rejected with the passed `reason`.\n    It is shorthand for the following:\n\n    ```javascript\n    let promise = new Promise(function(resolve, reject){\n      reject(new Error('WHOOPS'));\n    });\n\n    promise.then(function(value){\n      // Code here doesn't run because the promise is rejected!\n    }, function(reason){\n      // reason.message === 'WHOOPS'\n    });\n    ```\n\n    Instead of writing the above, your code now simply becomes the following:\n\n    ```javascript\n    let promise = Promise.reject(new Error('WHOOPS'));\n\n    promise.then(function(value){\n      // Code here doesn't run because the promise is rejected!\n    }, function(reason){\n      // reason.message === 'WHOOPS'\n    });\n    ```\n\n    @method reject\n    @static\n    @param {Any} reason value that the returned promise will be rejected with.\n    Useful for tooling.\n    @return {Promise} a promise rejected with the given `reason`.\n  */\n  function reject$1(reason) {\n    /*jshint validthis:true */\n    var Constructor = this;\n    var promise = new Constructor(noop);\n    reject(promise, reason);\n    return promise;\n  }\n\n  function needsResolver() {\n    throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n  }\n\n  function needsNew() {\n    throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n  }\n\n  /**\n    Promise objects represent the eventual result of an asynchronous operation. The\n    primary way of interacting with a promise is through its `then` method, which\n    registers callbacks to receive either a promise's eventual value or the reason\n    why the promise cannot be fulfilled.\n\n    Terminology\n    -----------\n\n    - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n    - `thenable` is an object or function that defines a `then` method.\n    - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n    - `exception` is a value that is thrown using the throw statement.\n    - `reason` is a value that indicates why a promise was rejected.\n    - `settled` the final resting state of a promise, fulfilled or rejected.\n\n    A promise can be in one of three states: pending, fulfilled, or rejected.\n\n    Promises that are fulfilled have a fulfillment value and are in the fulfilled\n    state.  Promises that are rejected have a rejection reason and are in the\n    rejected state.  A fulfillment value is never a thenable.\n\n    Promises can also be said to *resolve* a value.  If this value is also a\n    promise, then the original promise's settled state will match the value's\n    settled state.  So a promise that *resolves* a promise that rejects will\n    itself reject, and a promise that *resolves* a promise that fulfills will\n    itself fulfill.\n\n\n    Basic Usage:\n    ------------\n\n    ```js\n    let promise = new Promise(function(resolve, reject) {\n      // on success\n      resolve(value);\n\n      // on failure\n      reject(reason);\n    });\n\n    promise.then(function(value) {\n      // on fulfillment\n    }, function(reason) {\n      // on rejection\n    });\n    ```\n\n    Advanced Usage:\n    ---------------\n\n    Promises shine when abstracting away asynchronous interactions such as\n    `XMLHttpRequest`s.\n\n    ```js\n    function getJSON(url) {\n      return new Promise(function(resolve, reject){\n        let xhr = new XMLHttpRequest();\n\n        xhr.open('GET', url);\n        xhr.onreadystatechange = handler;\n        xhr.responseType = 'json';\n        xhr.setRequestHeader('Accept', 'application/json');\n        xhr.send();\n\n        function handler() {\n          if (this.readyState === this.DONE) {\n            if (this.status === 200) {\n              resolve(this.response);\n            } else {\n              reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n            }\n          }\n        };\n      });\n    }\n\n    getJSON('/posts.json').then(function(json) {\n      // on fulfillment\n    }, function(reason) {\n      // on rejection\n    });\n    ```\n\n    Unlike callbacks, promises are great composable primitives.\n\n    ```js\n    Promise.all([\n      getJSON('/posts'),\n      getJSON('/comments')\n    ]).then(function(values){\n      values[0] // => postsJSON\n      values[1] // => commentsJSON\n\n      return values;\n    });\n    ```\n\n    @class Promise\n    @param {Function} resolver\n    Useful for tooling.\n    @constructor\n  */\n\n  var Promise$2 = function () {\n    function Promise(resolver) {\n      classCallCheck(this, Promise);\n\n      this[PROMISE_ID] = nextId();\n      this._result = this._state = undefined;\n      this._subscribers = [];\n\n      if (noop !== resolver) {\n        typeof resolver !== 'function' && needsResolver();\n        this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n      }\n    }\n\n    /**\n    The primary way of interacting with a promise is through its `then` method,\n    which registers callbacks to receive either a promise's eventual value or the\n    reason why the promise cannot be fulfilled.\n     ```js\n    findUser().then(function(user){\n      // user is available\n    }, function(reason){\n      // user is unavailable, and you are given the reason why\n    });\n    ```\n     Chaining\n    --------\n     The return value of `then` is itself a promise.  This second, 'downstream'\n    promise is resolved with the return value of the first promise's fulfillment\n    or rejection handler, or rejected if the handler throws an exception.\n     ```js\n    findUser().then(function (user) {\n      return user.name;\n    }, function (reason) {\n      return 'default name';\n    }).then(function (userName) {\n      // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n      // will be `'default name'`\n    });\n     findUser().then(function (user) {\n      throw new Error('Found user, but still unhappy');\n    }, function (reason) {\n      throw new Error('`findUser` rejected and we're unhappy');\n    }).then(function (value) {\n      // never reached\n    }, function (reason) {\n      // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n      // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n    });\n    ```\n    If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n     ```js\n    findUser().then(function (user) {\n      throw new PedagogicalException('Upstream error');\n    }).then(function (value) {\n      // never reached\n    }).then(function (value) {\n      // never reached\n    }, function (reason) {\n      // The `PedgagocialException` is propagated all the way down to here\n    });\n    ```\n     Assimilation\n    ------------\n     Sometimes the value you want to propagate to a downstream promise can only be\n    retrieved asynchronously. This can be achieved by returning a promise in the\n    fulfillment or rejection handler. The downstream promise will then be pending\n    until the returned promise is settled. This is called *assimilation*.\n     ```js\n    findUser().then(function (user) {\n      return findCommentsByAuthor(user);\n    }).then(function (comments) {\n      // The user's comments are now available\n    });\n    ```\n     If the assimliated promise rejects, then the downstream promise will also reject.\n     ```js\n    findUser().then(function (user) {\n      return findCommentsByAuthor(user);\n    }).then(function (comments) {\n      // If `findCommentsByAuthor` fulfills, we'll have the value here\n    }, function (reason) {\n      // If `findCommentsByAuthor` rejects, we'll have the reason here\n    });\n    ```\n     Simple Example\n    --------------\n     Synchronous Example\n     ```javascript\n    let result;\n     try {\n      result = findResult();\n      // success\n    } catch(reason) {\n      // failure\n    }\n    ```\n     Errback Example\n     ```js\n    findResult(function(result, err){\n      if (err) {\n        // failure\n      } else {\n        // success\n      }\n    });\n    ```\n     Promise Example;\n     ```javascript\n    findResult().then(function(result){\n      // success\n    }, function(reason){\n      // failure\n    });\n    ```\n     Advanced Example\n    --------------\n     Synchronous Example\n     ```javascript\n    let author, books;\n     try {\n      author = findAuthor();\n      books  = findBooksByAuthor(author);\n      // success\n    } catch(reason) {\n      // failure\n    }\n    ```\n     Errback Example\n     ```js\n     function foundBooks(books) {\n     }\n     function failure(reason) {\n     }\n     findAuthor(function(author, err){\n      if (err) {\n        failure(err);\n        // failure\n      } else {\n        try {\n          findBoooksByAuthor(author, function(books, err) {\n            if (err) {\n              failure(err);\n            } else {\n              try {\n                foundBooks(books);\n              } catch(reason) {\n                failure(reason);\n              }\n            }\n          });\n        } catch(error) {\n          failure(err);\n        }\n        // success\n      }\n    });\n    ```\n     Promise Example;\n     ```javascript\n    findAuthor().\n      then(findBooksByAuthor).\n      then(function(books){\n        // found books\n    }).catch(function(reason){\n      // something went wrong\n    });\n    ```\n     @method then\n    @param {Function} onFulfilled\n    @param {Function} onRejected\n    Useful for tooling.\n    @return {Promise}\n    */\n\n    /**\n    `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n    as the catch block of a try/catch statement.\n    ```js\n    function findAuthor(){\n    throw new Error('couldn't find that author');\n    }\n    // synchronous\n    try {\n    findAuthor();\n    } catch(reason) {\n    // something went wrong\n    }\n    // async with promises\n    findAuthor().catch(function(reason){\n    // something went wrong\n    });\n    ```\n    @method catch\n    @param {Function} onRejection\n    Useful for tooling.\n    @return {Promise}\n    */\n\n\n    createClass(Promise, [{\n      key: 'catch',\n      value: function _catch(onRejection) {\n        return this.then(null, onRejection);\n      }\n\n      /**\n        `finally` will be invoked regardless of the promise's fate just as native\n        try/catch/finally behaves\n      \n        Synchronous example:\n      \n        ```js\n        findAuthor() {\n          if (Math.random() > 0.5) {\n            throw new Error();\n          }\n          return new Author();\n        }\n      \n        try {\n          return findAuthor(); // succeed or fail\n        } catch(error) {\n          return findOtherAuther();\n        } finally {\n          // always runs\n          // doesn't affect the return value\n        }\n        ```\n      \n        Asynchronous example:\n      \n        ```js\n        findAuthor().catch(function(reason){\n          return findOtherAuther();\n        }).finally(function(){\n          // author was either found, or not\n        });\n        ```\n      \n        @method finally\n        @param {Function} callback\n        @return {Promise}\n      */\n\n    }, {\n      key: 'finally',\n      value: function _finally(callback) {\n        var promise = this;\n        var constructor = promise.constructor;\n\n        if (isFunction(callback)) {\n          return promise.then(function (value) {\n            return constructor.resolve(callback()).then(function () {\n              return value;\n            });\n          }, function (reason) {\n            return constructor.resolve(callback()).then(function () {\n              throw reason;\n            });\n          });\n        }\n\n        return promise.then(callback, callback);\n      }\n    }]);\n    return Promise;\n  }();\n\n  Promise$2.prototype.then = then;\n  Promise$2.all = all;\n  Promise$2.race = race;\n  Promise$2.resolve = resolve$1;\n  Promise$2.reject = reject$1;\n  Promise$2._setScheduler = setScheduler;\n  Promise$2._setAsap = setAsap;\n  Promise$2._asap = asap;\n\n  /*global self*/\n  function polyfill() {\n    var local = void 0;\n\n    if (typeof global !== 'undefined') {\n      local = global;\n    } else if (typeof self !== 'undefined') {\n      local = self;\n    } else {\n      try {\n        local = Function('return this')();\n      } catch (e) {\n        throw new Error('polyfill failed because global object is unavailable in this environment');\n      }\n    }\n\n    var P = local.Promise;\n\n    if (P) {\n      var promiseToString = null;\n      try {\n        promiseToString = Object.prototype.toString.call(P.resolve());\n      } catch (e) {\n        // silently ignored\n      }\n\n      if (promiseToString === '[object Promise]' && !P.cast) {\n        return;\n      }\n    }\n\n    local.Promise = Promise$2;\n  }\n\n  // Strange compat..\n  Promise$2.polyfill = polyfill;\n  Promise$2.Promise = Promise$2;\n\n  var Promise$1 = typeof Promise !== \"undefined\" ? Promise : Promise$2;\n\n  // Register logging callbacks\n  function registerLoggingCallbacks(obj) {\n  \tvar i,\n  \t    l,\n  \t    key,\n  \t    callbackNames = [\"begin\", \"done\", \"log\", \"testStart\", \"testDone\", \"moduleStart\", \"moduleDone\"];\n\n  \tfunction registerLoggingCallback(key) {\n  \t\tvar loggingCallback = function loggingCallback(callback) {\n  \t\t\tif (objectType(callback) !== \"function\") {\n  \t\t\t\tthrow new Error(\"QUnit logging methods require a callback function as their first parameters.\");\n  \t\t\t}\n\n  \t\t\tconfig.callbacks[key].push(callback);\n  \t\t};\n\n  \t\treturn loggingCallback;\n  \t}\n\n  \tfor (i = 0, l = callbackNames.length; i < l; i++) {\n  \t\tkey = callbackNames[i];\n\n  \t\t// Initialize key collection of logging callback\n  \t\tif (objectType(config.callbacks[key]) === \"undefined\") {\n  \t\t\tconfig.callbacks[key] = [];\n  \t\t}\n\n  \t\tobj[key] = registerLoggingCallback(key);\n  \t}\n  }\n\n  function runLoggingCallbacks(key, args) {\n  \tvar callbacks = config.callbacks[key];\n\n  \t// Handling 'log' callbacks separately. Unlike the other callbacks,\n  \t// the log callback is not controlled by the processing queue,\n  \t// but rather used by asserts. Hence to promisfy the 'log' callback\n  \t// would mean promisfying each step of a test\n  \tif (key === \"log\") {\n  \t\tcallbacks.map(function (callback) {\n  \t\t\treturn callback(args);\n  \t\t});\n  \t\treturn;\n  \t}\n\n  \t// ensure that each callback is executed serially\n  \treturn callbacks.reduce(function (promiseChain, callback) {\n  \t\treturn promiseChain.then(function () {\n  \t\t\treturn Promise$1.resolve(callback(args));\n  \t\t});\n  \t}, Promise$1.resolve([]));\n  }\n\n  // Doesn't support IE9, it will return undefined on these browsers\n  // See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack\n  var fileName = (sourceFromStacktrace(0) || \"\").replace(/(:\\d+)+\\)?/, \"\").replace(/.+\\//, \"\");\n\n  function extractStacktrace(e, offset) {\n  \toffset = offset === undefined ? 4 : offset;\n\n  \tvar stack, include, i;\n\n  \tif (e && e.stack) {\n  \t\tstack = e.stack.split(\"\\n\");\n  \t\tif (/^error$/i.test(stack[0])) {\n  \t\t\tstack.shift();\n  \t\t}\n  \t\tif (fileName) {\n  \t\t\tinclude = [];\n  \t\t\tfor (i = offset; i < stack.length; i++) {\n  \t\t\t\tif (stack[i].indexOf(fileName) !== -1) {\n  \t\t\t\t\tbreak;\n  \t\t\t\t}\n  \t\t\t\tinclude.push(stack[i]);\n  \t\t\t}\n  \t\t\tif (include.length) {\n  \t\t\t\treturn include.join(\"\\n\");\n  \t\t\t}\n  \t\t}\n  \t\treturn stack[offset];\n  \t}\n  }\n\n  function sourceFromStacktrace(offset) {\n  \tvar error = new Error();\n\n  \t// Support: Safari <=7 only, IE <=10 - 11 only\n  \t// Not all browsers generate the `stack` property for `new Error()`, see also #636\n  \tif (!error.stack) {\n  \t\ttry {\n  \t\t\tthrow error;\n  \t\t} catch (err) {\n  \t\t\terror = err;\n  \t\t}\n  \t}\n\n  \treturn extractStacktrace(error, offset);\n  }\n\n  var priorityCount = 0;\n  var unitSampler = void 0;\n\n  // This is a queue of functions that are tasks within a single test.\n  // After tests are dequeued from config.queue they are expanded into\n  // a set of tasks in this queue.\n  var taskQueue = [];\n\n  /**\n   * Advances the taskQueue to the next task. If the taskQueue is empty,\n   * process the testQueue\n   */\n  function advance() {\n  \tadvanceTaskQueue();\n\n  \tif (!taskQueue.length && !config.blocking && !config.current) {\n  \t\tadvanceTestQueue();\n  \t}\n  }\n\n  /**\n   * Advances the taskQueue with an increased depth\n   */\n  function advanceTaskQueue() {\n  \tvar start = now();\n  \tconfig.depth = (config.depth || 0) + 1;\n\n  \tprocessTaskQueue(start);\n\n  \tconfig.depth--;\n  }\n\n  /**\n   * Process the first task on the taskQueue as a promise.\n   * Each task is a function returned by https://github.com/qunitjs/qunit/blob/master/src/test.js#L381\n   */\n  function processTaskQueue(start) {\n  \tif (taskQueue.length && !config.blocking) {\n  \t\tvar elapsedTime = now() - start;\n\n  \t\tif (!defined.setTimeout || config.updateRate <= 0 || elapsedTime < config.updateRate) {\n  \t\t\tvar task = taskQueue.shift();\n  \t\t\tPromise$1.resolve(task()).then(function () {\n  \t\t\t\tif (!taskQueue.length) {\n  \t\t\t\t\tadvance();\n  \t\t\t\t} else {\n  \t\t\t\t\tprocessTaskQueue(start);\n  \t\t\t\t}\n  \t\t\t});\n  \t\t} else {\n  \t\t\tsetTimeout$1(advance);\n  \t\t}\n  \t}\n  }\n\n  /**\n   * Advance the testQueue to the next test to process. Call done() if testQueue completes.\n   */\n  function advanceTestQueue() {\n  \tif (!config.blocking && !config.queue.length && config.depth === 0) {\n  \t\tdone();\n  \t\treturn;\n  \t}\n\n  \tvar testTasks = config.queue.shift();\n  \taddToTaskQueue(testTasks());\n\n  \tif (priorityCount > 0) {\n  \t\tpriorityCount--;\n  \t}\n\n  \tadvance();\n  }\n\n  /**\n   * Enqueue the tasks for a test into the task queue.\n   * @param {Array} tasksArray\n   */\n  function addToTaskQueue(tasksArray) {\n  \ttaskQueue.push.apply(taskQueue, toConsumableArray(tasksArray));\n  }\n\n  /**\n   * Return the number of tasks remaining in the task queue to be processed.\n   * @return {Number}\n   */\n  function taskQueueLength() {\n  \treturn taskQueue.length;\n  }\n\n  /**\n   * Adds a test to the TestQueue for execution.\n   * @param {Function} testTasksFunc\n   * @param {Boolean} prioritize\n   * @param {String} seed\n   */\n  function addToTestQueue(testTasksFunc, prioritize, seed) {\n  \tif (prioritize) {\n  \t\tconfig.queue.splice(priorityCount++, 0, testTasksFunc);\n  \t} else if (seed) {\n  \t\tif (!unitSampler) {\n  \t\t\tunitSampler = unitSamplerGenerator(seed);\n  \t\t}\n\n  \t\t// Insert into a random position after all prioritized items\n  \t\tvar index = Math.floor(unitSampler() * (config.queue.length - priorityCount + 1));\n  \t\tconfig.queue.splice(priorityCount + index, 0, testTasksFunc);\n  \t} else {\n  \t\tconfig.queue.push(testTasksFunc);\n  \t}\n  }\n\n  /**\n   * Creates a seeded \"sample\" generator which is used for randomizing tests.\n   */\n  function unitSamplerGenerator(seed) {\n\n  \t// 32-bit xorshift, requires only a nonzero seed\n  \t// http://excamera.com/sphinx/article-xorshift.html\n  \tvar sample = parseInt(generateHash(seed), 16) || -1;\n  \treturn function () {\n  \t\tsample ^= sample << 13;\n  \t\tsample ^= sample >>> 17;\n  \t\tsample ^= sample << 5;\n\n  \t\t// ECMAScript has no unsigned number type\n  \t\tif (sample < 0) {\n  \t\t\tsample += 0x100000000;\n  \t\t}\n\n  \t\treturn sample / 0x100000000;\n  \t};\n  }\n\n  /**\n   * This function is called when the ProcessingQueue is done processing all\n   * items. It handles emitting the final run events.\n   */\n  function done() {\n  \tvar storage = config.storage;\n\n  \tProcessingQueue.finished = true;\n\n  \tvar runtime = now() - config.started;\n  \tvar passed = config.stats.all - config.stats.bad;\n\n  \tif (config.stats.all === 0) {\n\n  \t\tif (config.filter && config.filter.length) {\n  \t\t\tthrow new Error(\"No tests matched the filter \\\"\" + config.filter + \"\\\".\");\n  \t\t}\n\n  \t\tif (config.module && config.module.length) {\n  \t\t\tthrow new Error(\"No tests matched the module \\\"\" + config.module + \"\\\".\");\n  \t\t}\n\n  \t\tif (config.moduleId && config.moduleId.length) {\n  \t\t\tthrow new Error(\"No tests matched the moduleId \\\"\" + config.moduleId + \"\\\".\");\n  \t\t}\n\n  \t\tif (config.testId && config.testId.length) {\n  \t\t\tthrow new Error(\"No tests matched the testId \\\"\" + config.testId + \"\\\".\");\n  \t\t}\n\n  \t\tthrow new Error(\"No tests were run.\");\n  \t}\n\n  \temit(\"runEnd\", globalSuite.end(true));\n  \trunLoggingCallbacks(\"done\", {\n  \t\tpassed: passed,\n  \t\tfailed: config.stats.bad,\n  \t\ttotal: config.stats.all,\n  \t\truntime: runtime\n  \t}).then(function () {\n\n  \t\t// Clear own storage items if all tests passed\n  \t\tif (storage && config.stats.bad === 0) {\n  \t\t\tfor (var i = storage.length - 1; i >= 0; i--) {\n  \t\t\t\tvar key = storage.key(i);\n\n  \t\t\t\tif (key.indexOf(\"qunit-test-\") === 0) {\n  \t\t\t\t\tstorage.removeItem(key);\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n  \t});\n  }\n\n  var ProcessingQueue = {\n  \tfinished: false,\n  \tadd: addToTestQueue,\n  \tadvance: advance,\n  \ttaskCount: taskQueueLength\n  };\n\n  var TestReport = function () {\n  \tfunction TestReport(name, suite, options) {\n  \t\tclassCallCheck(this, TestReport);\n\n  \t\tthis.name = name;\n  \t\tthis.suiteName = suite.name;\n  \t\tthis.fullName = suite.fullName.concat(name);\n  \t\tthis.runtime = 0;\n  \t\tthis.assertions = [];\n\n  \t\tthis.skipped = !!options.skip;\n  \t\tthis.todo = !!options.todo;\n\n  \t\tthis.valid = options.valid;\n\n  \t\tthis._startTime = 0;\n  \t\tthis._endTime = 0;\n\n  \t\tsuite.pushTest(this);\n  \t}\n\n  \tcreateClass(TestReport, [{\n  \t\tkey: \"start\",\n  \t\tvalue: function start(recordTime) {\n  \t\t\tif (recordTime) {\n  \t\t\t\tthis._startTime = performanceNow();\n  \t\t\t\tif (performance) {\n  \t\t\t\t\tperformance.mark(\"qunit_test_start\");\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\treturn {\n  \t\t\t\tname: this.name,\n  \t\t\t\tsuiteName: this.suiteName,\n  \t\t\t\tfullName: this.fullName.slice()\n  \t\t\t};\n  \t\t}\n  \t}, {\n  \t\tkey: \"end\",\n  \t\tvalue: function end(recordTime) {\n  \t\t\tif (recordTime) {\n  \t\t\t\tthis._endTime = performanceNow();\n  \t\t\t\tif (performance) {\n  \t\t\t\t\tperformance.mark(\"qunit_test_end\");\n\n  \t\t\t\t\tvar testName = this.fullName.join(\" – \");\n\n  \t\t\t\t\tmeasure(\"QUnit Test: \" + testName, \"qunit_test_start\", \"qunit_test_end\");\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\treturn extend(this.start(), {\n  \t\t\t\truntime: this.getRuntime(),\n  \t\t\t\tstatus: this.getStatus(),\n  \t\t\t\terrors: this.getFailedAssertions(),\n  \t\t\t\tassertions: this.getAssertions()\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"pushAssertion\",\n  \t\tvalue: function pushAssertion(assertion) {\n  \t\t\tthis.assertions.push(assertion);\n  \t\t}\n  \t}, {\n  \t\tkey: \"getRuntime\",\n  \t\tvalue: function getRuntime() {\n  \t\t\treturn this._endTime - this._startTime;\n  \t\t}\n  \t}, {\n  \t\tkey: \"getStatus\",\n  \t\tvalue: function getStatus() {\n  \t\t\tif (this.skipped) {\n  \t\t\t\treturn \"skipped\";\n  \t\t\t}\n\n  \t\t\tvar testPassed = this.getFailedAssertions().length > 0 ? this.todo : !this.todo;\n\n  \t\t\tif (!testPassed) {\n  \t\t\t\treturn \"failed\";\n  \t\t\t} else if (this.todo) {\n  \t\t\t\treturn \"todo\";\n  \t\t\t} else {\n  \t\t\t\treturn \"passed\";\n  \t\t\t}\n  \t\t}\n  \t}, {\n  \t\tkey: \"getFailedAssertions\",\n  \t\tvalue: function getFailedAssertions() {\n  \t\t\treturn this.assertions.filter(function (assertion) {\n  \t\t\t\treturn !assertion.passed;\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"getAssertions\",\n  \t\tvalue: function getAssertions() {\n  \t\t\treturn this.assertions.slice();\n  \t\t}\n\n  \t\t// Remove actual and expected values from assertions. This is to prevent\n  \t\t// leaking memory throughout a test suite.\n\n  \t}, {\n  \t\tkey: \"slimAssertions\",\n  \t\tvalue: function slimAssertions() {\n  \t\t\tthis.assertions = this.assertions.map(function (assertion) {\n  \t\t\t\tdelete assertion.actual;\n  \t\t\t\tdelete assertion.expected;\n  \t\t\t\treturn assertion;\n  \t\t\t});\n  \t\t}\n  \t}]);\n  \treturn TestReport;\n  }();\n\n  var focused$1 = false;\n\n  function Test(settings) {\n  \tvar i, l;\n\n  \t++Test.count;\n\n  \tthis.expected = null;\n  \tthis.assertions = [];\n  \tthis.semaphore = 0;\n  \tthis.module = config.currentModule;\n  \tthis.stack = sourceFromStacktrace(3);\n  \tthis.steps = [];\n  \tthis.timeout = undefined;\n\n  \t// If a module is skipped, all its tests and the tests of the child suites\n  \t// should be treated as skipped even if they are defined as `only` or `todo`.\n  \t// As for `todo` module, all its tests will be treated as `todo` except for\n  \t// tests defined as `skip` which will be left intact.\n  \t//\n  \t// So, if a test is defined as `todo` and is inside a skipped module, we should\n  \t// then treat that test as if was defined as `skip`.\n  \tif (this.module.skip) {\n  \t\tsettings.skip = true;\n  \t\tsettings.todo = false;\n\n  \t\t// Skipped tests should be left intact\n  \t} else if (this.module.todo && !settings.skip) {\n  \t\tsettings.todo = true;\n  \t}\n\n  \textend(this, settings);\n\n  \tthis.testReport = new TestReport(settings.testName, this.module.suiteReport, {\n  \t\ttodo: settings.todo,\n  \t\tskip: settings.skip,\n  \t\tvalid: this.valid()\n  \t});\n\n  \t// Register unique strings\n  \tfor (i = 0, l = this.module.tests; i < l.length; i++) {\n  \t\tif (this.module.tests[i].name === this.testName) {\n  \t\t\tthis.testName += \" \";\n  \t\t}\n  \t}\n\n  \tthis.testId = generateHash(this.module.name, this.testName);\n\n  \tthis.module.tests.push({\n  \t\tname: this.testName,\n  \t\ttestId: this.testId,\n  \t\tskip: !!settings.skip\n  \t});\n\n  \tif (settings.skip) {\n\n  \t\t// Skipped tests will fully ignore any sent callback\n  \t\tthis.callback = function () {};\n  \t\tthis.async = false;\n  \t\tthis.expected = 0;\n  \t} else {\n  \t\tif (typeof this.callback !== \"function\") {\n  \t\t\tvar method = this.todo ? \"todo\" : \"test\";\n\n  \t\t\t// eslint-disable-next-line max-len\n  \t\t\tthrow new TypeError(\"You must provide a function as a test callback to QUnit.\" + method + \"(\\\"\" + settings.testName + \"\\\")\");\n  \t\t}\n\n  \t\tthis.assert = new Assert(this);\n  \t}\n  }\n\n  Test.count = 0;\n\n  function getNotStartedModules(startModule) {\n  \tvar module = startModule,\n  \t    modules = [];\n\n  \twhile (module && module.testsRun === 0) {\n  \t\tmodules.push(module);\n  \t\tmodule = module.parentModule;\n  \t}\n\n  \t// The above push modules from the child to the parent\n  \t// return a reversed order with the top being the top most parent module\n  \treturn modules.reverse();\n  }\n\n  Test.prototype = {\n  \tbefore: function before() {\n  \t\tvar _this = this;\n\n  \t\tvar module = this.module,\n  \t\t    notStartedModules = getNotStartedModules(module);\n\n  \t\t// ensure the callbacks are executed serially for each module\n  \t\tvar callbackPromises = notStartedModules.reduce(function (promiseChain, startModule) {\n  \t\t\treturn promiseChain.then(function () {\n  \t\t\t\tstartModule.stats = { all: 0, bad: 0, started: now() };\n  \t\t\t\temit(\"suiteStart\", startModule.suiteReport.start(true));\n  \t\t\t\treturn runLoggingCallbacks(\"moduleStart\", {\n  \t\t\t\t\tname: startModule.name,\n  \t\t\t\t\ttests: startModule.tests\n  \t\t\t\t});\n  \t\t\t});\n  \t\t}, Promise$1.resolve([]));\n\n  \t\treturn callbackPromises.then(function () {\n  \t\t\tconfig.current = _this;\n\n  \t\t\t_this.testEnvironment = extend({}, module.testEnvironment);\n\n  \t\t\t_this.started = now();\n  \t\t\temit(\"testStart\", _this.testReport.start(true));\n  \t\t\treturn runLoggingCallbacks(\"testStart\", {\n  \t\t\t\tname: _this.testName,\n  \t\t\t\tmodule: module.name,\n  \t\t\t\ttestId: _this.testId,\n  \t\t\t\tpreviousFailure: _this.previousFailure\n  \t\t\t}).then(function () {\n  \t\t\t\tif (!config.pollution) {\n  \t\t\t\t\tsaveGlobal();\n  \t\t\t\t}\n  \t\t\t});\n  \t\t});\n  \t},\n\n  \trun: function run() {\n  \t\tvar promise;\n\n  \t\tconfig.current = this;\n\n  \t\tthis.callbackStarted = now();\n\n  \t\tif (config.notrycatch) {\n  \t\t\trunTest(this);\n  \t\t\treturn;\n  \t\t}\n\n  \t\ttry {\n  \t\t\trunTest(this);\n  \t\t} catch (e) {\n  \t\t\tthis.pushFailure(\"Died on test #\" + (this.assertions.length + 1) + \" \" + this.stack + \": \" + (e.message || e), extractStacktrace(e, 0));\n\n  \t\t\t// Else next test will carry the responsibility\n  \t\t\tsaveGlobal();\n\n  \t\t\t// Restart the tests if they're blocking\n  \t\t\tif (config.blocking) {\n  \t\t\t\tinternalRecover(this);\n  \t\t\t}\n  \t\t}\n\n  \t\tfunction runTest(test) {\n  \t\t\tpromise = test.callback.call(test.testEnvironment, test.assert);\n  \t\t\ttest.resolvePromise(promise);\n\n  \t\t\t// If the test has a \"lock\" on it, but the timeout is 0, then we push a\n  \t\t\t// failure as the test should be synchronous.\n  \t\t\tif (test.timeout === 0 && test.semaphore !== 0) {\n  \t\t\t\tpushFailure(\"Test did not finish synchronously even though assert.timeout( 0 ) was used.\", sourceFromStacktrace(2));\n  \t\t\t}\n  \t\t}\n  \t},\n\n  \tafter: function after() {\n  \t\tcheckPollution();\n  \t},\n\n  \tqueueHook: function queueHook(hook, hookName, hookOwner) {\n  \t\tvar _this2 = this;\n\n  \t\tvar callHook = function callHook() {\n  \t\t\tvar promise = hook.call(_this2.testEnvironment, _this2.assert);\n  \t\t\t_this2.resolvePromise(promise, hookName);\n  \t\t};\n\n  \t\tvar runHook = function runHook() {\n  \t\t\tif (hookName === \"before\") {\n  \t\t\t\tif (hookOwner.unskippedTestsRun !== 0) {\n  \t\t\t\t\treturn;\n  \t\t\t\t}\n\n  \t\t\t\t_this2.preserveEnvironment = true;\n  \t\t\t}\n\n  \t\t\t// The 'after' hook should only execute when there are not tests left and\n  \t\t\t// when the 'after' and 'finish' tasks are the only tasks left to process\n  \t\t\tif (hookName === \"after\" && hookOwner.unskippedTestsRun !== numberOfUnskippedTests(hookOwner) - 1 && (config.queue.length > 0 || ProcessingQueue.taskCount() > 2)) {\n  \t\t\t\treturn;\n  \t\t\t}\n\n  \t\t\tconfig.current = _this2;\n  \t\t\tif (config.notrycatch) {\n  \t\t\t\tcallHook();\n  \t\t\t\treturn;\n  \t\t\t}\n  \t\t\ttry {\n  \t\t\t\tcallHook();\n  \t\t\t} catch (error) {\n  \t\t\t\t_this2.pushFailure(hookName + \" failed on \" + _this2.testName + \": \" + (error.message || error), extractStacktrace(error, 0));\n  \t\t\t}\n  \t\t};\n\n  \t\treturn runHook;\n  \t},\n\n\n  \t// Currently only used for module level hooks, can be used to add global level ones\n  \thooks: function hooks(handler) {\n  \t\tvar hooks = [];\n\n  \t\tfunction processHooks(test, module) {\n  \t\t\tif (module.parentModule) {\n  \t\t\t\tprocessHooks(test, module.parentModule);\n  \t\t\t}\n\n  \t\t\tif (module.hooks[handler].length) {\n  \t\t\t\tfor (var i = 0; i < module.hooks[handler].length; i++) {\n  \t\t\t\t\thooks.push(test.queueHook(module.hooks[handler][i], handler, module));\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n\n  \t\t// Hooks are ignored on skipped tests\n  \t\tif (!this.skip) {\n  \t\t\tprocessHooks(this, this.module);\n  \t\t}\n\n  \t\treturn hooks;\n  \t},\n\n\n  \tfinish: function finish() {\n  \t\tconfig.current = this;\n\n  \t\t// Release the test callback to ensure that anything referenced has been\n  \t\t// released to be garbage collected.\n  \t\tthis.callback = undefined;\n\n  \t\tif (this.steps.length) {\n  \t\t\tvar stepsList = this.steps.join(\", \");\n  \t\t\tthis.pushFailure(\"Expected assert.verifySteps() to be called before end of test \" + (\"after using assert.step(). Unverified steps: \" + stepsList), this.stack);\n  \t\t}\n\n  \t\tif (config.requireExpects && this.expected === null) {\n  \t\t\tthis.pushFailure(\"Expected number of assertions to be defined, but expect() was \" + \"not called.\", this.stack);\n  \t\t} else if (this.expected !== null && this.expected !== this.assertions.length) {\n  \t\t\tthis.pushFailure(\"Expected \" + this.expected + \" assertions, but \" + this.assertions.length + \" were run\", this.stack);\n  \t\t} else if (this.expected === null && !this.assertions.length) {\n  \t\t\tthis.pushFailure(\"Expected at least one assertion, but none were run - call \" + \"expect(0) to accept zero assertions.\", this.stack);\n  \t\t}\n\n  \t\tvar i,\n  \t\t    module = this.module,\n  \t\t    moduleName = module.name,\n  \t\t    testName = this.testName,\n  \t\t    skipped = !!this.skip,\n  \t\t    todo = !!this.todo,\n  \t\t    bad = 0,\n  \t\t    storage = config.storage;\n\n  \t\tthis.runtime = now() - this.started;\n\n  \t\tconfig.stats.all += this.assertions.length;\n  \t\tmodule.stats.all += this.assertions.length;\n\n  \t\tfor (i = 0; i < this.assertions.length; i++) {\n  \t\t\tif (!this.assertions[i].result) {\n  \t\t\t\tbad++;\n  \t\t\t\tconfig.stats.bad++;\n  \t\t\t\tmodule.stats.bad++;\n  \t\t\t}\n  \t\t}\n\n  \t\tnotifyTestsRan(module, skipped);\n\n  \t\t// Store result when possible\n  \t\tif (storage) {\n  \t\t\tif (bad) {\n  \t\t\t\tstorage.setItem(\"qunit-test-\" + moduleName + \"-\" + testName, bad);\n  \t\t\t} else {\n  \t\t\t\tstorage.removeItem(\"qunit-test-\" + moduleName + \"-\" + testName);\n  \t\t\t}\n  \t\t}\n\n  \t\t// After emitting the js-reporters event we cleanup the assertion data to\n  \t\t// avoid leaking it. It is not used by the legacy testDone callbacks.\n  \t\temit(\"testEnd\", this.testReport.end(true));\n  \t\tthis.testReport.slimAssertions();\n\n  \t\treturn runLoggingCallbacks(\"testDone\", {\n  \t\t\tname: testName,\n  \t\t\tmodule: moduleName,\n  \t\t\tskipped: skipped,\n  \t\t\ttodo: todo,\n  \t\t\tfailed: bad,\n  \t\t\tpassed: this.assertions.length - bad,\n  \t\t\ttotal: this.assertions.length,\n  \t\t\truntime: skipped ? 0 : this.runtime,\n\n  \t\t\t// HTML Reporter use\n  \t\t\tassertions: this.assertions,\n  \t\t\ttestId: this.testId,\n\n  \t\t\t// Source of Test\n  \t\t\tsource: this.stack\n  \t\t}).then(function () {\n  \t\t\tif (module.testsRun === numberOfTests(module)) {\n  \t\t\t\tvar completedModules = [module];\n\n  \t\t\t\t// Check if the parent modules, iteratively, are done. If that the case,\n  \t\t\t\t// we emit the `suiteEnd` event and trigger `moduleDone` callback.\n  \t\t\t\tvar parent = module.parentModule;\n  \t\t\t\twhile (parent && parent.testsRun === numberOfTests(parent)) {\n  \t\t\t\t\tcompletedModules.push(parent);\n  \t\t\t\t\tparent = parent.parentModule;\n  \t\t\t\t}\n\n  \t\t\t\treturn completedModules.reduce(function (promiseChain, completedModule) {\n  \t\t\t\t\treturn promiseChain.then(function () {\n  \t\t\t\t\t\treturn logSuiteEnd(completedModule);\n  \t\t\t\t\t});\n  \t\t\t\t}, Promise$1.resolve([]));\n  \t\t\t}\n  \t\t}).then(function () {\n  \t\t\tconfig.current = undefined;\n  \t\t});\n\n  \t\tfunction logSuiteEnd(module) {\n\n  \t\t\t// Reset `module.hooks` to ensure that anything referenced in these hooks\n  \t\t\t// has been released to be garbage collected.\n  \t\t\tmodule.hooks = {};\n\n  \t\t\temit(\"suiteEnd\", module.suiteReport.end(true));\n  \t\t\treturn runLoggingCallbacks(\"moduleDone\", {\n  \t\t\t\tname: module.name,\n  \t\t\t\ttests: module.tests,\n  \t\t\t\tfailed: module.stats.bad,\n  \t\t\t\tpassed: module.stats.all - module.stats.bad,\n  \t\t\t\ttotal: module.stats.all,\n  \t\t\t\truntime: now() - module.stats.started\n  \t\t\t});\n  \t\t}\n  \t},\n\n  \tpreserveTestEnvironment: function preserveTestEnvironment() {\n  \t\tif (this.preserveEnvironment) {\n  \t\t\tthis.module.testEnvironment = this.testEnvironment;\n  \t\t\tthis.testEnvironment = extend({}, this.module.testEnvironment);\n  \t\t}\n  \t},\n\n  \tqueue: function queue() {\n  \t\tvar test = this;\n\n  \t\tif (!this.valid()) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\tfunction runTest() {\n  \t\t\treturn [function () {\n  \t\t\t\treturn test.before();\n  \t\t\t}].concat(toConsumableArray(test.hooks(\"before\")), [function () {\n  \t\t\t\ttest.preserveTestEnvironment();\n  \t\t\t}], toConsumableArray(test.hooks(\"beforeEach\")), [function () {\n  \t\t\t\ttest.run();\n  \t\t\t}], toConsumableArray(test.hooks(\"afterEach\").reverse()), toConsumableArray(test.hooks(\"after\").reverse()), [function () {\n  \t\t\t\ttest.after();\n  \t\t\t}, function () {\n  \t\t\t\treturn test.finish();\n  \t\t\t}]);\n  \t\t}\n\n  \t\tvar previousFailCount = config.storage && +config.storage.getItem(\"qunit-test-\" + this.module.name + \"-\" + this.testName);\n\n  \t\t// Prioritize previously failed tests, detected from storage\n  \t\tvar prioritize = config.reorder && !!previousFailCount;\n\n  \t\tthis.previousFailure = !!previousFailCount;\n\n  \t\tProcessingQueue.add(runTest, prioritize, config.seed);\n\n  \t\t// If the queue has already finished, we manually process the new test\n  \t\tif (ProcessingQueue.finished) {\n  \t\t\tProcessingQueue.advance();\n  \t\t}\n  \t},\n\n\n  \tpushResult: function pushResult(resultInfo) {\n  \t\tif (this !== config.current) {\n  \t\t\tthrow new Error(\"Assertion occurred after test had finished.\");\n  \t\t}\n\n  \t\t// Destructure of resultInfo = { result, actual, expected, message, negative }\n  \t\tvar source,\n  \t\t    details = {\n  \t\t\tmodule: this.module.name,\n  \t\t\tname: this.testName,\n  \t\t\tresult: resultInfo.result,\n  \t\t\tmessage: resultInfo.message,\n  \t\t\tactual: resultInfo.actual,\n  \t\t\ttestId: this.testId,\n  \t\t\tnegative: resultInfo.negative || false,\n  \t\t\truntime: now() - this.started,\n  \t\t\ttodo: !!this.todo\n  \t\t};\n\n  \t\tif (hasOwn.call(resultInfo, \"expected\")) {\n  \t\t\tdetails.expected = resultInfo.expected;\n  \t\t}\n\n  \t\tif (!resultInfo.result) {\n  \t\t\tsource = resultInfo.source || sourceFromStacktrace();\n\n  \t\t\tif (source) {\n  \t\t\t\tdetails.source = source;\n  \t\t\t}\n  \t\t}\n\n  \t\tthis.logAssertion(details);\n\n  \t\tthis.assertions.push({\n  \t\t\tresult: !!resultInfo.result,\n  \t\t\tmessage: resultInfo.message\n  \t\t});\n  \t},\n\n  \tpushFailure: function pushFailure(message, source, actual) {\n  \t\tif (!(this instanceof Test)) {\n  \t\t\tthrow new Error(\"pushFailure() assertion outside test context, was \" + sourceFromStacktrace(2));\n  \t\t}\n\n  \t\tthis.pushResult({\n  \t\t\tresult: false,\n  \t\t\tmessage: message || \"error\",\n  \t\t\tactual: actual || null,\n  \t\t\tsource: source\n  \t\t});\n  \t},\n\n  \t/**\n    * Log assertion details using both the old QUnit.log interface and\n    * QUnit.on( \"assertion\" ) interface.\n    *\n    * @private\n    */\n  \tlogAssertion: function logAssertion(details) {\n  \t\trunLoggingCallbacks(\"log\", details);\n\n  \t\tvar assertion = {\n  \t\t\tpassed: details.result,\n  \t\t\tactual: details.actual,\n  \t\t\texpected: details.expected,\n  \t\t\tmessage: details.message,\n  \t\t\tstack: details.source,\n  \t\t\ttodo: details.todo\n  \t\t};\n  \t\tthis.testReport.pushAssertion(assertion);\n  \t\temit(\"assertion\", assertion);\n  \t},\n\n\n  \tresolvePromise: function resolvePromise(promise, phase) {\n  \t\tvar then,\n  \t\t    resume,\n  \t\t    message,\n  \t\t    test = this;\n  \t\tif (promise != null) {\n  \t\t\tthen = promise.then;\n  \t\t\tif (objectType(then) === \"function\") {\n  \t\t\t\tresume = internalStop(test);\n  \t\t\t\tif (config.notrycatch) {\n  \t\t\t\t\tthen.call(promise, function () {\n  \t\t\t\t\t\tresume();\n  \t\t\t\t\t});\n  \t\t\t\t} else {\n  \t\t\t\t\tthen.call(promise, function () {\n  \t\t\t\t\t\tresume();\n  \t\t\t\t\t}, function (error) {\n  \t\t\t\t\t\tmessage = \"Promise rejected \" + (!phase ? \"during\" : phase.replace(/Each$/, \"\")) + \" \\\"\" + test.testName + \"\\\": \" + (error && error.message || error);\n  \t\t\t\t\t\ttest.pushFailure(message, extractStacktrace(error, 0));\n\n  \t\t\t\t\t\t// Else next test will carry the responsibility\n  \t\t\t\t\t\tsaveGlobal();\n\n  \t\t\t\t\t\t// Unblock\n  \t\t\t\t\t\tinternalRecover(test);\n  \t\t\t\t\t});\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n  \t},\n\n  \tvalid: function valid() {\n  \t\tvar filter = config.filter,\n  \t\t    regexFilter = /^(!?)\\/([\\w\\W]*)\\/(i?$)/.exec(filter),\n  \t\t    module = config.module && config.module.toLowerCase(),\n  \t\t    fullName = this.module.name + \": \" + this.testName;\n\n  \t\tfunction moduleChainNameMatch(testModule) {\n  \t\t\tvar testModuleName = testModule.name ? testModule.name.toLowerCase() : null;\n  \t\t\tif (testModuleName === module) {\n  \t\t\t\treturn true;\n  \t\t\t} else if (testModule.parentModule) {\n  \t\t\t\treturn moduleChainNameMatch(testModule.parentModule);\n  \t\t\t} else {\n  \t\t\t\treturn false;\n  \t\t\t}\n  \t\t}\n\n  \t\tfunction moduleChainIdMatch(testModule) {\n  \t\t\treturn inArray(testModule.moduleId, config.moduleId) || testModule.parentModule && moduleChainIdMatch(testModule.parentModule);\n  \t\t}\n\n  \t\t// Internally-generated tests are always valid\n  \t\tif (this.callback && this.callback.validTest) {\n  \t\t\treturn true;\n  \t\t}\n\n  \t\tif (config.moduleId && config.moduleId.length > 0 && !moduleChainIdMatch(this.module)) {\n\n  \t\t\treturn false;\n  \t\t}\n\n  \t\tif (config.testId && config.testId.length > 0 && !inArray(this.testId, config.testId)) {\n\n  \t\t\treturn false;\n  \t\t}\n\n  \t\tif (module && !moduleChainNameMatch(this.module)) {\n  \t\t\treturn false;\n  \t\t}\n\n  \t\tif (!filter) {\n  \t\t\treturn true;\n  \t\t}\n\n  \t\treturn regexFilter ? this.regexFilter(!!regexFilter[1], regexFilter[2], regexFilter[3], fullName) : this.stringFilter(filter, fullName);\n  \t},\n\n  \tregexFilter: function regexFilter(exclude, pattern, flags, fullName) {\n  \t\tvar regex = new RegExp(pattern, flags);\n  \t\tvar match = regex.test(fullName);\n\n  \t\treturn match !== exclude;\n  \t},\n\n  \tstringFilter: function stringFilter(filter, fullName) {\n  \t\tfilter = filter.toLowerCase();\n  \t\tfullName = fullName.toLowerCase();\n\n  \t\tvar include = filter.charAt(0) !== \"!\";\n  \t\tif (!include) {\n  \t\t\tfilter = filter.slice(1);\n  \t\t}\n\n  \t\t// If the filter matches, we need to honour include\n  \t\tif (fullName.indexOf(filter) !== -1) {\n  \t\t\treturn include;\n  \t\t}\n\n  \t\t// Otherwise, do the opposite\n  \t\treturn !include;\n  \t}\n  };\n\n  function pushFailure() {\n  \tif (!config.current) {\n  \t\tthrow new Error(\"pushFailure() assertion outside test context, in \" + sourceFromStacktrace(2));\n  \t}\n\n  \t// Gets current test obj\n  \tvar currentTest = config.current;\n\n  \treturn currentTest.pushFailure.apply(currentTest, arguments);\n  }\n\n  function saveGlobal() {\n  \tconfig.pollution = [];\n\n  \tif (config.noglobals) {\n  \t\tfor (var key in global$1) {\n  \t\t\tif (hasOwn.call(global$1, key)) {\n\n  \t\t\t\t// In Opera sometimes DOM element ids show up here, ignore them\n  \t\t\t\tif (/^qunit-test-output/.test(key)) {\n  \t\t\t\t\tcontinue;\n  \t\t\t\t}\n  \t\t\t\tconfig.pollution.push(key);\n  \t\t\t}\n  \t\t}\n  \t}\n  }\n\n  function checkPollution() {\n  \tvar newGlobals,\n  \t    deletedGlobals,\n  \t    old = config.pollution;\n\n  \tsaveGlobal();\n\n  \tnewGlobals = diff(config.pollution, old);\n  \tif (newGlobals.length > 0) {\n  \t\tpushFailure(\"Introduced global variable(s): \" + newGlobals.join(\", \"));\n  \t}\n\n  \tdeletedGlobals = diff(old, config.pollution);\n  \tif (deletedGlobals.length > 0) {\n  \t\tpushFailure(\"Deleted global variable(s): \" + deletedGlobals.join(\", \"));\n  \t}\n  }\n\n  // Will be exposed as QUnit.test\n  function test(testName, callback) {\n  \tif (focused$1) {\n  \t\treturn;\n  \t}\n\n  \tvar newTest = new Test({\n  \t\ttestName: testName,\n  \t\tcallback: callback\n  \t});\n\n  \tnewTest.queue();\n  }\n\n  function todo(testName, callback) {\n  \tif (focused$1) {\n  \t\treturn;\n  \t}\n\n  \tvar newTest = new Test({\n  \t\ttestName: testName,\n  \t\tcallback: callback,\n  \t\ttodo: true\n  \t});\n\n  \tnewTest.queue();\n  }\n\n  // Will be exposed as QUnit.skip\n  function skip(testName) {\n  \tif (focused$1) {\n  \t\treturn;\n  \t}\n\n  \tvar test = new Test({\n  \t\ttestName: testName,\n  \t\tskip: true\n  \t});\n\n  \ttest.queue();\n  }\n\n  // Will be exposed as QUnit.only\n  function only(testName, callback) {\n  \tif (focused$1) {\n  \t\treturn;\n  \t}\n\n  \tconfig.queue.length = 0;\n  \tfocused$1 = true;\n\n  \tvar newTest = new Test({\n  \t\ttestName: testName,\n  \t\tcallback: callback\n  \t});\n\n  \tnewTest.queue();\n  }\n\n  // Put a hold on processing and return a function that will release it.\n  function internalStop(test) {\n  \tvar released = false;\n  \ttest.semaphore += 1;\n  \tconfig.blocking = true;\n\n  \t// Set a recovery timeout, if so configured.\n  \tif (defined.setTimeout) {\n  \t\tvar timeoutDuration = void 0;\n\n  \t\tif (typeof test.timeout === \"number\") {\n  \t\t\ttimeoutDuration = test.timeout;\n  \t\t} else if (typeof config.testTimeout === \"number\") {\n  \t\t\ttimeoutDuration = config.testTimeout;\n  \t\t}\n\n  \t\tif (typeof timeoutDuration === \"number\" && timeoutDuration > 0) {\n  \t\t\tclearTimeout(config.timeout);\n  \t\t\tconfig.timeout = setTimeout$1(function () {\n  \t\t\t\tpushFailure(\"Test took longer than \" + timeoutDuration + \"ms; test timed out.\", sourceFromStacktrace(2));\n  \t\t\t\treleased = true;\n  \t\t\t\tinternalRecover(test);\n  \t\t\t}, timeoutDuration);\n  \t\t}\n  \t}\n\n  \treturn function resume() {\n  \t\tif (released) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\treleased = true;\n  \t\ttest.semaphore -= 1;\n  \t\tinternalStart(test);\n  \t};\n  }\n\n  // Forcefully release all processing holds.\n  function internalRecover(test) {\n  \ttest.semaphore = 0;\n  \tinternalStart(test);\n  }\n\n  // Release a processing hold, scheduling a resumption attempt if no holds remain.\n  function internalStart(test) {\n\n  \t// If semaphore is non-numeric, throw error\n  \tif (isNaN(test.semaphore)) {\n  \t\ttest.semaphore = 0;\n\n  \t\tpushFailure(\"Invalid value on test.semaphore\", sourceFromStacktrace(2));\n  \t\treturn;\n  \t}\n\n  \t// Don't start until equal number of stop-calls\n  \tif (test.semaphore > 0) {\n  \t\treturn;\n  \t}\n\n  \t// Throw an Error if start is called more often than stop\n  \tif (test.semaphore < 0) {\n  \t\ttest.semaphore = 0;\n\n  \t\tpushFailure(\"Tried to restart test while already started (test's semaphore was 0 already)\", sourceFromStacktrace(2));\n  \t\treturn;\n  \t}\n\n  \t// Add a slight delay to allow more assertions etc.\n  \tif (defined.setTimeout) {\n  \t\tif (config.timeout) {\n  \t\t\tclearTimeout(config.timeout);\n  \t\t}\n  \t\tconfig.timeout = setTimeout$1(function () {\n  \t\t\tif (test.semaphore > 0) {\n  \t\t\t\treturn;\n  \t\t\t}\n\n  \t\t\tif (config.timeout) {\n  \t\t\t\tclearTimeout(config.timeout);\n  \t\t\t}\n\n  \t\t\tbegin();\n  \t\t});\n  \t} else {\n  \t\tbegin();\n  \t}\n  }\n\n  function collectTests(module) {\n  \tvar tests = [].concat(module.tests);\n  \tvar modules = [].concat(toConsumableArray(module.childModules));\n\n  \t// Do a breadth-first traversal of the child modules\n  \twhile (modules.length) {\n  \t\tvar nextModule = modules.shift();\n  \t\ttests.push.apply(tests, nextModule.tests);\n  \t\tmodules.push.apply(modules, toConsumableArray(nextModule.childModules));\n  \t}\n\n  \treturn tests;\n  }\n\n  function numberOfTests(module) {\n  \treturn collectTests(module).length;\n  }\n\n  function numberOfUnskippedTests(module) {\n  \treturn collectTests(module).filter(function (test) {\n  \t\treturn !test.skip;\n  \t}).length;\n  }\n\n  function notifyTestsRan(module, skipped) {\n  \tmodule.testsRun++;\n  \tif (!skipped) {\n  \t\tmodule.unskippedTestsRun++;\n  \t}\n  \twhile (module = module.parentModule) {\n  \t\tmodule.testsRun++;\n  \t\tif (!skipped) {\n  \t\t\tmodule.unskippedTestsRun++;\n  \t\t}\n  \t}\n  }\n\n  var Assert = function () {\n  \tfunction Assert(testContext) {\n  \t\tclassCallCheck(this, Assert);\n\n  \t\tthis.test = testContext;\n  \t}\n\n  \t// Assert helpers\n\n  \tcreateClass(Assert, [{\n  \t\tkey: \"timeout\",\n  \t\tvalue: function timeout(duration) {\n  \t\t\tif (typeof duration !== \"number\") {\n  \t\t\t\tthrow new Error(\"You must pass a number as the duration to assert.timeout\");\n  \t\t\t}\n\n  \t\t\tthis.test.timeout = duration;\n  \t\t}\n\n  \t\t// Documents a \"step\", which is a string value, in a test as a passing assertion\n\n  \t}, {\n  \t\tkey: \"step\",\n  \t\tvalue: function step(message) {\n  \t\t\tvar assertionMessage = message;\n  \t\t\tvar result = !!message;\n\n  \t\t\tthis.test.steps.push(message);\n\n  \t\t\tif (objectType(message) === \"undefined\" || message === \"\") {\n  \t\t\t\tassertionMessage = \"You must provide a message to assert.step\";\n  \t\t\t} else if (objectType(message) !== \"string\") {\n  \t\t\t\tassertionMessage = \"You must provide a string value to assert.step\";\n  \t\t\t\tresult = false;\n  \t\t\t}\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: result,\n  \t\t\t\tmessage: assertionMessage\n  \t\t\t});\n  \t\t}\n\n  \t\t// Verifies the steps in a test match a given array of string values\n\n  \t}, {\n  \t\tkey: \"verifySteps\",\n  \t\tvalue: function verifySteps(steps, message) {\n\n  \t\t\t// Since the steps array is just string values, we can clone with slice\n  \t\t\tvar actualStepsClone = this.test.steps.slice();\n  \t\t\tthis.deepEqual(actualStepsClone, steps, message);\n  \t\t\tthis.test.steps.length = 0;\n  \t\t}\n\n  \t\t// Specify the number of expected assertions to guarantee that failed test\n  \t\t// (no assertions are run at all) don't slip through.\n\n  \t}, {\n  \t\tkey: \"expect\",\n  \t\tvalue: function expect(asserts) {\n  \t\t\tif (arguments.length === 1) {\n  \t\t\t\tthis.test.expected = asserts;\n  \t\t\t} else {\n  \t\t\t\treturn this.test.expected;\n  \t\t\t}\n  \t\t}\n\n  \t\t// Put a hold on processing and return a function that will release it a maximum of once.\n\n  \t}, {\n  \t\tkey: \"async\",\n  \t\tvalue: function async(count) {\n  \t\t\tvar test$$1 = this.test;\n\n  \t\t\tvar popped = false,\n  \t\t\t    acceptCallCount = count;\n\n  \t\t\tif (typeof acceptCallCount === \"undefined\") {\n  \t\t\t\tacceptCallCount = 1;\n  \t\t\t}\n\n  \t\t\tvar resume = internalStop(test$$1);\n\n  \t\t\treturn function done() {\n  \t\t\t\tif (config.current !== test$$1) {\n  \t\t\t\t\tthrow Error(\"assert.async callback called after test finished.\");\n  \t\t\t\t}\n\n  \t\t\t\tif (popped) {\n  \t\t\t\t\ttest$$1.pushFailure(\"Too many calls to the `assert.async` callback\", sourceFromStacktrace(2));\n  \t\t\t\t\treturn;\n  \t\t\t\t}\n\n  \t\t\t\tacceptCallCount -= 1;\n  \t\t\t\tif (acceptCallCount > 0) {\n  \t\t\t\t\treturn;\n  \t\t\t\t}\n\n  \t\t\t\tpopped = true;\n  \t\t\t\tresume();\n  \t\t\t};\n  \t\t}\n\n  \t\t// Exports test.push() to the user API\n  \t\t// Alias of pushResult.\n\n  \t}, {\n  \t\tkey: \"push\",\n  \t\tvalue: function push(result, actual, expected, message, negative) {\n  \t\t\tLogger.warn(\"assert.push is deprecated and will be removed in QUnit 3.0.\" + \" Please use assert.pushResult instead (https://api.qunitjs.com/assert/pushResult).\");\n\n  \t\t\tvar currentAssert = this instanceof Assert ? this : config.current.assert;\n  \t\t\treturn currentAssert.pushResult({\n  \t\t\t\tresult: result,\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message,\n  \t\t\t\tnegative: negative\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"pushResult\",\n  \t\tvalue: function pushResult(resultInfo) {\n\n  \t\t\t// Destructure of resultInfo = { result, actual, expected, message, negative }\n  \t\t\tvar assert = this;\n  \t\t\tvar currentTest = assert instanceof Assert && assert.test || config.current;\n\n  \t\t\t// Backwards compatibility fix.\n  \t\t\t// Allows the direct use of global exported assertions and QUnit.assert.*\n  \t\t\t// Although, it's use is not recommended as it can leak assertions\n  \t\t\t// to other tests from async tests, because we only get a reference to the current test,\n  \t\t\t// not exactly the test where assertion were intended to be called.\n  \t\t\tif (!currentTest) {\n  \t\t\t\tthrow new Error(\"assertion outside test context, in \" + sourceFromStacktrace(2));\n  \t\t\t}\n\n  \t\t\tif (!(assert instanceof Assert)) {\n  \t\t\t\tassert = currentTest.assert;\n  \t\t\t}\n\n  \t\t\treturn assert.test.pushResult(resultInfo);\n  \t\t}\n  \t}, {\n  \t\tkey: \"ok\",\n  \t\tvalue: function ok(result, message) {\n  \t\t\tif (!message) {\n  \t\t\t\tmessage = result ? \"okay\" : \"failed, expected argument to be truthy, was: \" + dump.parse(result);\n  \t\t\t}\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: !!result,\n  \t\t\t\tactual: result,\n  \t\t\t\texpected: true,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"notOk\",\n  \t\tvalue: function notOk(result, message) {\n  \t\t\tif (!message) {\n  \t\t\t\tmessage = !result ? \"okay\" : \"failed, expected argument to be falsy, was: \" + dump.parse(result);\n  \t\t\t}\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: !result,\n  \t\t\t\tactual: result,\n  \t\t\t\texpected: false,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"equal\",\n  \t\tvalue: function equal(actual, expected, message) {\n\n  \t\t\t// eslint-disable-next-line eqeqeq\n  \t\t\tvar result = expected == actual;\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: result,\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"notEqual\",\n  \t\tvalue: function notEqual(actual, expected, message) {\n\n  \t\t\t// eslint-disable-next-line eqeqeq\n  \t\t\tvar result = expected != actual;\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: result,\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message,\n  \t\t\t\tnegative: true\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"propEqual\",\n  \t\tvalue: function propEqual(actual, expected, message) {\n  \t\t\tactual = objectValues(actual);\n  \t\t\texpected = objectValues(expected);\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: equiv(actual, expected),\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"notPropEqual\",\n  \t\tvalue: function notPropEqual(actual, expected, message) {\n  \t\t\tactual = objectValues(actual);\n  \t\t\texpected = objectValues(expected);\n\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: !equiv(actual, expected),\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message,\n  \t\t\t\tnegative: true\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"deepEqual\",\n  \t\tvalue: function deepEqual(actual, expected, message) {\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: equiv(actual, expected),\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"notDeepEqual\",\n  \t\tvalue: function notDeepEqual(actual, expected, message) {\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: !equiv(actual, expected),\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message,\n  \t\t\t\tnegative: true\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"strictEqual\",\n  \t\tvalue: function strictEqual(actual, expected, message) {\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: expected === actual,\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"notStrictEqual\",\n  \t\tvalue: function notStrictEqual(actual, expected, message) {\n  \t\t\tthis.pushResult({\n  \t\t\t\tresult: expected !== actual,\n  \t\t\t\tactual: actual,\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message,\n  \t\t\t\tnegative: true\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"throws\",\n  \t\tvalue: function throws(block, expected, message) {\n  \t\t\tvar actual = void 0,\n  \t\t\t    result = false;\n\n  \t\t\tvar currentTest = this instanceof Assert && this.test || config.current;\n\n  \t\t\t// 'expected' is optional unless doing string comparison\n  \t\t\tif (objectType(expected) === \"string\") {\n  \t\t\t\tif (message == null) {\n  \t\t\t\t\tmessage = expected;\n  \t\t\t\t\texpected = null;\n  \t\t\t\t} else {\n  \t\t\t\t\tthrow new Error(\"throws/raises does not accept a string value for the expected argument.\\n\" + \"Use a non-string object value (e.g. regExp) instead if it's necessary.\");\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\tcurrentTest.ignoreGlobalErrors = true;\n  \t\t\ttry {\n  \t\t\t\tblock.call(currentTest.testEnvironment);\n  \t\t\t} catch (e) {\n  \t\t\t\tactual = e;\n  \t\t\t}\n  \t\t\tcurrentTest.ignoreGlobalErrors = false;\n\n  \t\t\tif (actual) {\n  \t\t\t\tvar expectedType = objectType(expected);\n\n  \t\t\t\t// We don't want to validate thrown error\n  \t\t\t\tif (!expected) {\n  \t\t\t\t\tresult = true;\n\n  \t\t\t\t\t// Expected is a regexp\n  \t\t\t\t} else if (expectedType === \"regexp\") {\n  \t\t\t\t\tresult = expected.test(errorString(actual));\n\n  \t\t\t\t\t// Log the string form of the regexp\n  \t\t\t\t\texpected = String(expected);\n\n  \t\t\t\t\t// Expected is a constructor, maybe an Error constructor\n  \t\t\t\t} else if (expectedType === \"function\" && actual instanceof expected) {\n  \t\t\t\t\tresult = true;\n\n  \t\t\t\t\t// Expected is an Error object\n  \t\t\t\t} else if (expectedType === \"object\") {\n  \t\t\t\t\tresult = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message;\n\n  \t\t\t\t\t// Log the string form of the Error object\n  \t\t\t\t\texpected = errorString(expected);\n\n  \t\t\t\t\t// Expected is a validation function which returns true if validation passed\n  \t\t\t\t} else if (expectedType === \"function\" && expected.call({}, actual) === true) {\n  \t\t\t\t\texpected = null;\n  \t\t\t\t\tresult = true;\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\tcurrentTest.assert.pushResult({\n  \t\t\t\tresult: result,\n\n  \t\t\t\t// undefined if it didn't throw\n  \t\t\t\tactual: actual && errorString(actual),\n  \t\t\t\texpected: expected,\n  \t\t\t\tmessage: message\n  \t\t\t});\n  \t\t}\n  \t}, {\n  \t\tkey: \"rejects\",\n  \t\tvalue: function rejects(promise, expected, message) {\n  \t\t\tvar result = false;\n\n  \t\t\tvar currentTest = this instanceof Assert && this.test || config.current;\n\n  \t\t\t// 'expected' is optional unless doing string comparison\n  \t\t\tif (objectType(expected) === \"string\") {\n  \t\t\t\tif (message === undefined) {\n  \t\t\t\t\tmessage = expected;\n  \t\t\t\t\texpected = undefined;\n  \t\t\t\t} else {\n  \t\t\t\t\tmessage = \"assert.rejects does not accept a string value for the expected \" + \"argument.\\nUse a non-string object value (e.g. validator function) instead \" + \"if necessary.\";\n\n  \t\t\t\t\tcurrentTest.assert.pushResult({\n  \t\t\t\t\t\tresult: false,\n  \t\t\t\t\t\tmessage: message\n  \t\t\t\t\t});\n\n  \t\t\t\t\treturn;\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\tvar then = promise && promise.then;\n  \t\t\tif (objectType(then) !== \"function\") {\n  \t\t\t\tvar _message = \"The value provided to `assert.rejects` in \" + \"\\\"\" + currentTest.testName + \"\\\" was not a promise.\";\n\n  \t\t\t\tcurrentTest.assert.pushResult({\n  \t\t\t\t\tresult: false,\n  \t\t\t\t\tmessage: _message,\n  \t\t\t\t\tactual: promise\n  \t\t\t\t});\n\n  \t\t\t\treturn;\n  \t\t\t}\n\n  \t\t\tvar done = this.async();\n\n  \t\t\treturn then.call(promise, function handleFulfillment() {\n  \t\t\t\tvar message = \"The promise returned by the `assert.rejects` callback in \" + \"\\\"\" + currentTest.testName + \"\\\" did not reject.\";\n\n  \t\t\t\tcurrentTest.assert.pushResult({\n  \t\t\t\t\tresult: false,\n  \t\t\t\t\tmessage: message,\n  \t\t\t\t\tactual: promise\n  \t\t\t\t});\n\n  \t\t\t\tdone();\n  \t\t\t}, function handleRejection(actual) {\n  \t\t\t\tvar expectedType = objectType(expected);\n\n  \t\t\t\t// We don't want to validate\n  \t\t\t\tif (expected === undefined) {\n  \t\t\t\t\tresult = true;\n\n  \t\t\t\t\t// Expected is a regexp\n  \t\t\t\t} else if (expectedType === \"regexp\") {\n  \t\t\t\t\tresult = expected.test(errorString(actual));\n\n  \t\t\t\t\t// Log the string form of the regexp\n  \t\t\t\t\texpected = String(expected);\n\n  \t\t\t\t\t// Expected is a constructor, maybe an Error constructor\n  \t\t\t\t} else if (expectedType === \"function\" && actual instanceof expected) {\n  \t\t\t\t\tresult = true;\n\n  \t\t\t\t\t// Expected is an Error object\n  \t\t\t\t} else if (expectedType === \"object\") {\n  \t\t\t\t\tresult = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message;\n\n  \t\t\t\t\t// Log the string form of the Error object\n  \t\t\t\t\texpected = errorString(expected);\n\n  \t\t\t\t\t// Expected is a validation function which returns true if validation passed\n  \t\t\t\t} else {\n  \t\t\t\t\tif (expectedType === \"function\") {\n  \t\t\t\t\t\tresult = expected.call({}, actual) === true;\n  \t\t\t\t\t\texpected = null;\n\n  \t\t\t\t\t\t// Expected is some other invalid type\n  \t\t\t\t\t} else {\n  \t\t\t\t\t\tresult = false;\n  \t\t\t\t\t\tmessage = \"invalid expected value provided to `assert.rejects` \" + \"callback in \\\"\" + currentTest.testName + \"\\\": \" + expectedType + \".\";\n  \t\t\t\t\t}\n  \t\t\t\t}\n\n  \t\t\t\tcurrentTest.assert.pushResult({\n  \t\t\t\t\tresult: result,\n\n  \t\t\t\t\t// leave rejection value of undefined as-is\n  \t\t\t\t\tactual: actual && errorString(actual),\n  \t\t\t\t\texpected: expected,\n  \t\t\t\t\tmessage: message\n  \t\t\t\t});\n\n  \t\t\t\tdone();\n  \t\t\t});\n  \t\t}\n  \t}]);\n  \treturn Assert;\n  }();\n\n  // Provide an alternative to assert.throws(), for environments that consider throws a reserved word\n  // Known to us are: Closure Compiler, Narwhal\n  // eslint-disable-next-line dot-notation\n\n\n  Assert.prototype.raises = Assert.prototype[\"throws\"];\n\n  /**\n   * Converts an error into a simple string for comparisons.\n   *\n   * @param {Error|Object} error\n   * @return {String}\n   */\n  function errorString(error) {\n  \tvar resultErrorString = error.toString();\n\n  \t// If the error wasn't a subclass of Error but something like\n  \t// an object literal with name and message properties...\n  \tif (resultErrorString.substring(0, 7) === \"[object\") {\n  \t\tvar name = error.name ? error.name.toString() : \"Error\";\n  \t\tvar message = error.message ? error.message.toString() : \"\";\n\n  \t\tif (name && message) {\n  \t\t\treturn name + \": \" + message;\n  \t\t} else if (name) {\n  \t\t\treturn name;\n  \t\t} else if (message) {\n  \t\t\treturn message;\n  \t\t} else {\n  \t\t\treturn \"Error\";\n  \t\t}\n  \t} else {\n  \t\treturn resultErrorString;\n  \t}\n  }\n\n  /* global module, exports, define */\n  function exportQUnit(QUnit) {\n\n  \tif (defined.document) {\n\n  \t\t// QUnit may be defined when it is preconfigured but then only QUnit and QUnit.config may be defined.\n  \t\tif (window$1.QUnit && window$1.QUnit.version) {\n  \t\t\tthrow new Error(\"QUnit has already been defined.\");\n  \t\t}\n\n  \t\twindow$1.QUnit = QUnit;\n  \t}\n\n  \t// For nodejs\n  \tif (typeof module !== \"undefined\" && module && module.exports) {\n  \t\tmodule.exports = QUnit;\n\n  \t\t// For consistency with CommonJS environments' exports\n  \t\tmodule.exports.QUnit = QUnit;\n  \t}\n\n  \t// For CommonJS with exports, but without module.exports, like Rhino\n  \tif (typeof exports !== \"undefined\" && exports) {\n  \t\texports.QUnit = QUnit;\n  \t}\n\n  \tif (typeof define === \"function\" && define.amd) {\n  \t\tdefine(function () {\n  \t\t\treturn QUnit;\n  \t\t});\n  \t\tQUnit.config.autostart = false;\n  \t}\n\n  \t// For Web/Service Workers\n  \tif (self$1 && self$1.WorkerGlobalScope && self$1 instanceof self$1.WorkerGlobalScope) {\n  \t\tself$1.QUnit = QUnit;\n  \t}\n  }\n\n  // Handle an unhandled exception. By convention, returns true if further\n  // error handling should be suppressed and false otherwise.\n  // In this case, we will only suppress further error handling if the\n  // \"ignoreGlobalErrors\" configuration option is enabled.\n  function onError(error) {\n  \tfor (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n  \t\targs[_key - 1] = arguments[_key];\n  \t}\n\n  \tif (config.current) {\n  \t\tif (config.current.ignoreGlobalErrors) {\n  \t\t\treturn true;\n  \t\t}\n  \t\tpushFailure.apply(undefined, [error.message, error.stacktrace || error.fileName + \":\" + error.lineNumber].concat(args));\n  \t} else {\n  \t\ttest(\"global failure\", extend(function () {\n  \t\t\tpushFailure.apply(undefined, [error.message, error.stacktrace || error.fileName + \":\" + error.lineNumber].concat(args));\n  \t\t}, { validTest: true }));\n  \t}\n\n  \treturn false;\n  }\n\n  // Handle an unhandled rejection\n  function onUnhandledRejection(reason) {\n  \tvar resultInfo = {\n  \t\tresult: false,\n  \t\tmessage: reason.message || \"error\",\n  \t\tactual: reason,\n  \t\tsource: reason.stack || sourceFromStacktrace(3)\n  \t};\n\n  \tvar currentTest = config.current;\n  \tif (currentTest) {\n  \t\tcurrentTest.assert.pushResult(resultInfo);\n  \t} else {\n  \t\ttest(\"global failure\", extend(function (assert) {\n  \t\t\tassert.pushResult(resultInfo);\n  \t\t}, { validTest: true }));\n  \t}\n  }\n\n  var QUnit = {};\n  var globalSuite = new SuiteReport();\n\n  // The initial \"currentModule\" represents the global (or top-level) module that\n  // is not explicitly defined by the user, therefore we add the \"globalSuite\" to\n  // it since each module has a suiteReport associated with it.\n  config.currentModule.suiteReport = globalSuite;\n\n  var globalStartCalled = false;\n  var runStarted = false;\n\n  // Figure out if we're running the tests from a server or not\n  QUnit.isLocal = !(defined.document && window$1.location.protocol !== \"file:\");\n\n  // Expose the current QUnit version\n  QUnit.version = \"2.9.2\";\n\n  extend(QUnit, {\n  \ton: on,\n\n  \tmodule: module$1,\n\n  \ttest: test,\n\n  \ttodo: todo,\n\n  \tskip: skip,\n\n  \tonly: only,\n\n  \tstart: function start(count) {\n  \t\tvar globalStartAlreadyCalled = globalStartCalled;\n\n  \t\tif (!config.current) {\n  \t\t\tglobalStartCalled = true;\n\n  \t\t\tif (runStarted) {\n  \t\t\t\tthrow new Error(\"Called start() while test already started running\");\n  \t\t\t} else if (globalStartAlreadyCalled || count > 1) {\n  \t\t\t\tthrow new Error(\"Called start() outside of a test context too many times\");\n  \t\t\t} else if (config.autostart) {\n  \t\t\t\tthrow new Error(\"Called start() outside of a test context when \" + \"QUnit.config.autostart was true\");\n  \t\t\t} else if (!config.pageLoaded) {\n\n  \t\t\t\t// The page isn't completely loaded yet, so we set autostart and then\n  \t\t\t\t// load if we're in Node or wait for the browser's load event.\n  \t\t\t\tconfig.autostart = true;\n\n  \t\t\t\t// Starts from Node even if .load was not previously called. We still return\n  \t\t\t\t// early otherwise we'll wind up \"beginning\" twice.\n  \t\t\t\tif (!defined.document) {\n  \t\t\t\t\tQUnit.load();\n  \t\t\t\t}\n\n  \t\t\t\treturn;\n  \t\t\t}\n  \t\t} else {\n  \t\t\tthrow new Error(\"QUnit.start cannot be called inside a test context.\");\n  \t\t}\n\n  \t\tscheduleBegin();\n  \t},\n\n  \tconfig: config,\n\n  \tis: is,\n\n  \tobjectType: objectType,\n\n  \textend: extend,\n\n  \tload: function load() {\n  \t\tconfig.pageLoaded = true;\n\n  \t\t// Initialize the configuration options\n  \t\textend(config, {\n  \t\t\tstats: { all: 0, bad: 0 },\n  \t\t\tstarted: 0,\n  \t\t\tupdateRate: 1000,\n  \t\t\tautostart: true,\n  \t\t\tfilter: \"\"\n  \t\t}, true);\n\n  \t\tif (!runStarted) {\n  \t\t\tconfig.blocking = false;\n\n  \t\t\tif (config.autostart) {\n  \t\t\t\tscheduleBegin();\n  \t\t\t}\n  \t\t}\n  \t},\n\n  \tstack: function stack(offset) {\n  \t\toffset = (offset || 0) + 2;\n  \t\treturn sourceFromStacktrace(offset);\n  \t},\n\n  \tonError: onError,\n\n  \tonUnhandledRejection: onUnhandledRejection\n  });\n\n  QUnit.pushFailure = pushFailure;\n  QUnit.assert = Assert.prototype;\n  QUnit.equiv = equiv;\n  QUnit.dump = dump;\n\n  registerLoggingCallbacks(QUnit);\n\n  function scheduleBegin() {\n\n  \trunStarted = true;\n\n  \t// Add a slight delay to allow definition of more modules and tests.\n  \tif (defined.setTimeout) {\n  \t\tsetTimeout$1(function () {\n  \t\t\tbegin();\n  \t\t});\n  \t} else {\n  \t\tbegin();\n  \t}\n  }\n\n  function unblockAndAdvanceQueue() {\n  \tconfig.blocking = false;\n  \tProcessingQueue.advance();\n  }\n\n  function begin() {\n  \tvar i,\n  \t    l,\n  \t    modulesLog = [];\n\n  \t// If the test run hasn't officially begun yet\n  \tif (!config.started) {\n\n  \t\t// Record the time of the test run's beginning\n  \t\tconfig.started = now();\n\n  \t\t// Delete the loose unnamed module if unused.\n  \t\tif (config.modules[0].name === \"\" && config.modules[0].tests.length === 0) {\n  \t\t\tconfig.modules.shift();\n  \t\t}\n\n  \t\t// Avoid unnecessary information by not logging modules' test environments\n  \t\tfor (i = 0, l = config.modules.length; i < l; i++) {\n  \t\t\tmodulesLog.push({\n  \t\t\t\tname: config.modules[i].name,\n  \t\t\t\ttests: config.modules[i].tests\n  \t\t\t});\n  \t\t}\n\n  \t\t// The test run is officially beginning now\n  \t\temit(\"runStart\", globalSuite.start(true));\n  \t\trunLoggingCallbacks(\"begin\", {\n  \t\t\ttotalTests: Test.count,\n  \t\t\tmodules: modulesLog\n  \t\t}).then(unblockAndAdvanceQueue);\n  \t} else {\n  \t\tunblockAndAdvanceQueue();\n  \t}\n  }\n\n  exportQUnit(QUnit);\n\n  (function () {\n\n  \tif (typeof window$1 === \"undefined\" || typeof document$1 === \"undefined\") {\n  \t\treturn;\n  \t}\n\n  \tvar config = QUnit.config,\n  \t    hasOwn = Object.prototype.hasOwnProperty;\n\n  \t// Stores fixture HTML for resetting later\n  \tfunction storeFixture() {\n\n  \t\t// Avoid overwriting user-defined values\n  \t\tif (hasOwn.call(config, \"fixture\")) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\tvar fixture = document$1.getElementById(\"qunit-fixture\");\n  \t\tif (fixture) {\n  \t\t\tconfig.fixture = fixture.cloneNode(true);\n  \t\t}\n  \t}\n\n  \tQUnit.begin(storeFixture);\n\n  \t// Resets the fixture DOM element if available.\n  \tfunction resetFixture() {\n  \t\tif (config.fixture == null) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\tvar fixture = document$1.getElementById(\"qunit-fixture\");\n  \t\tvar resetFixtureType = _typeof(config.fixture);\n  \t\tif (resetFixtureType === \"string\") {\n\n  \t\t\t// support user defined values for `config.fixture`\n  \t\t\tvar newFixture = document$1.createElement(\"div\");\n  \t\t\tnewFixture.setAttribute(\"id\", \"qunit-fixture\");\n  \t\t\tnewFixture.innerHTML = config.fixture;\n  \t\t\tfixture.parentNode.replaceChild(newFixture, fixture);\n  \t\t} else {\n  \t\t\tvar clonedFixture = config.fixture.cloneNode(true);\n  \t\t\tfixture.parentNode.replaceChild(clonedFixture, fixture);\n  \t\t}\n  \t}\n\n  \tQUnit.testStart(resetFixture);\n  })();\n\n  (function () {\n\n  \t// Only interact with URLs via window.location\n  \tvar location = typeof window$1 !== \"undefined\" && window$1.location;\n  \tif (!location) {\n  \t\treturn;\n  \t}\n\n  \tvar urlParams = getUrlParams();\n\n  \tQUnit.urlParams = urlParams;\n\n  \t// Match module/test by inclusion in an array\n  \tQUnit.config.moduleId = [].concat(urlParams.moduleId || []);\n  \tQUnit.config.testId = [].concat(urlParams.testId || []);\n\n  \t// Exact case-insensitive match of the module name\n  \tQUnit.config.module = urlParams.module;\n\n  \t// Regular expression or case-insenstive substring match against \"moduleName: testName\"\n  \tQUnit.config.filter = urlParams.filter;\n\n  \t// Test order randomization\n  \tif (urlParams.seed === true) {\n\n  \t\t// Generate a random seed if the option is specified without a value\n  \t\tQUnit.config.seed = Math.random().toString(36).slice(2);\n  \t} else if (urlParams.seed) {\n  \t\tQUnit.config.seed = urlParams.seed;\n  \t}\n\n  \t// Add URL-parameter-mapped config values with UI form rendering data\n  \tQUnit.config.urlConfig.push({\n  \t\tid: \"hidepassed\",\n  \t\tlabel: \"Hide passed tests\",\n  \t\ttooltip: \"Only show tests and assertions that fail. Stored as query-strings.\"\n  \t}, {\n  \t\tid: \"noglobals\",\n  \t\tlabel: \"Check for Globals\",\n  \t\ttooltip: \"Enabling this will test if any test introduces new properties on the \" + \"global object (`window` in Browsers). Stored as query-strings.\"\n  \t}, {\n  \t\tid: \"notrycatch\",\n  \t\tlabel: \"No try-catch\",\n  \t\ttooltip: \"Enabling this will run tests outside of a try-catch block. Makes debugging \" + \"exceptions in IE reasonable. Stored as query-strings.\"\n  \t});\n\n  \tQUnit.begin(function () {\n  \t\tvar i,\n  \t\t    option,\n  \t\t    urlConfig = QUnit.config.urlConfig;\n\n  \t\tfor (i = 0; i < urlConfig.length; i++) {\n\n  \t\t\t// Options can be either strings or objects with nonempty \"id\" properties\n  \t\t\toption = QUnit.config.urlConfig[i];\n  \t\t\tif (typeof option !== \"string\") {\n  \t\t\t\toption = option.id;\n  \t\t\t}\n\n  \t\t\tif (QUnit.config[option] === undefined) {\n  \t\t\t\tQUnit.config[option] = urlParams[option];\n  \t\t\t}\n  \t\t}\n  \t});\n\n  \tfunction getUrlParams() {\n  \t\tvar i, param, name, value;\n  \t\tvar urlParams = Object.create(null);\n  \t\tvar params = location.search.slice(1).split(\"&\");\n  \t\tvar length = params.length;\n\n  \t\tfor (i = 0; i < length; i++) {\n  \t\t\tif (params[i]) {\n  \t\t\t\tparam = params[i].split(\"=\");\n  \t\t\t\tname = decodeQueryParam(param[0]);\n\n  \t\t\t\t// Allow just a key to turn on a flag, e.g., test.html?noglobals\n  \t\t\t\tvalue = param.length === 1 || decodeQueryParam(param.slice(1).join(\"=\"));\n  \t\t\t\tif (name in urlParams) {\n  \t\t\t\t\turlParams[name] = [].concat(urlParams[name], value);\n  \t\t\t\t} else {\n  \t\t\t\t\turlParams[name] = value;\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n\n  \t\treturn urlParams;\n  \t}\n\n  \tfunction decodeQueryParam(param) {\n  \t\treturn decodeURIComponent(param.replace(/\\+/g, \"%20\"));\n  \t}\n  })();\n\n  var stats = {\n  \tpassedTests: 0,\n  \tfailedTests: 0,\n  \tskippedTests: 0,\n  \ttodoTests: 0\n  };\n\n  // Escape text for attribute or text content.\n  function escapeText(s) {\n  \tif (!s) {\n  \t\treturn \"\";\n  \t}\n  \ts = s + \"\";\n\n  \t// Both single quotes and double quotes (for attributes)\n  \treturn s.replace(/['\"<>&]/g, function (s) {\n  \t\tswitch (s) {\n  \t\t\tcase \"'\":\n  \t\t\t\treturn \"&#039;\";\n  \t\t\tcase \"\\\"\":\n  \t\t\t\treturn \"&quot;\";\n  \t\t\tcase \"<\":\n  \t\t\t\treturn \"&lt;\";\n  \t\t\tcase \">\":\n  \t\t\t\treturn \"&gt;\";\n  \t\t\tcase \"&\":\n  \t\t\t\treturn \"&amp;\";\n  \t\t}\n  \t});\n  }\n\n  (function () {\n\n  \t// Don't load the HTML Reporter on non-browser environments\n  \tif (typeof window$1 === \"undefined\" || !window$1.document) {\n  \t\treturn;\n  \t}\n\n  \tvar config = QUnit.config,\n  \t    hiddenTests = [],\n  \t    document = window$1.document,\n  \t    collapseNext = false,\n  \t    hasOwn = Object.prototype.hasOwnProperty,\n  \t    unfilteredUrl = setUrl({ filter: undefined, module: undefined,\n  \t\tmoduleId: undefined, testId: undefined }),\n  \t    modulesList = [];\n\n  \tfunction addEvent(elem, type, fn) {\n  \t\telem.addEventListener(type, fn, false);\n  \t}\n\n  \tfunction removeEvent(elem, type, fn) {\n  \t\telem.removeEventListener(type, fn, false);\n  \t}\n\n  \tfunction addEvents(elems, type, fn) {\n  \t\tvar i = elems.length;\n  \t\twhile (i--) {\n  \t\t\taddEvent(elems[i], type, fn);\n  \t\t}\n  \t}\n\n  \tfunction hasClass(elem, name) {\n  \t\treturn (\" \" + elem.className + \" \").indexOf(\" \" + name + \" \") >= 0;\n  \t}\n\n  \tfunction addClass(elem, name) {\n  \t\tif (!hasClass(elem, name)) {\n  \t\t\telem.className += (elem.className ? \" \" : \"\") + name;\n  \t\t}\n  \t}\n\n  \tfunction toggleClass(elem, name, force) {\n  \t\tif (force || typeof force === \"undefined\" && !hasClass(elem, name)) {\n  \t\t\taddClass(elem, name);\n  \t\t} else {\n  \t\t\tremoveClass(elem, name);\n  \t\t}\n  \t}\n\n  \tfunction removeClass(elem, name) {\n  \t\tvar set = \" \" + elem.className + \" \";\n\n  \t\t// Class name may appear multiple times\n  \t\twhile (set.indexOf(\" \" + name + \" \") >= 0) {\n  \t\t\tset = set.replace(\" \" + name + \" \", \" \");\n  \t\t}\n\n  \t\t// Trim for prettiness\n  \t\telem.className = typeof set.trim === \"function\" ? set.trim() : set.replace(/^\\s+|\\s+$/g, \"\");\n  \t}\n\n  \tfunction id(name) {\n  \t\treturn document.getElementById && document.getElementById(name);\n  \t}\n\n  \tfunction abortTests() {\n  \t\tvar abortButton = id(\"qunit-abort-tests-button\");\n  \t\tif (abortButton) {\n  \t\t\tabortButton.disabled = true;\n  \t\t\tabortButton.innerHTML = \"Aborting...\";\n  \t\t}\n  \t\tQUnit.config.queue.length = 0;\n  \t\treturn false;\n  \t}\n\n  \tfunction interceptNavigation(ev) {\n  \t\tapplyUrlParams();\n\n  \t\tif (ev && ev.preventDefault) {\n  \t\t\tev.preventDefault();\n  \t\t}\n\n  \t\treturn false;\n  \t}\n\n  \tfunction getUrlConfigHtml() {\n  \t\tvar i,\n  \t\t    j,\n  \t\t    val,\n  \t\t    escaped,\n  \t\t    escapedTooltip,\n  \t\t    selection = false,\n  \t\t    urlConfig = config.urlConfig,\n  \t\t    urlConfigHtml = \"\";\n\n  \t\tfor (i = 0; i < urlConfig.length; i++) {\n\n  \t\t\t// Options can be either strings or objects with nonempty \"id\" properties\n  \t\t\tval = config.urlConfig[i];\n  \t\t\tif (typeof val === \"string\") {\n  \t\t\t\tval = {\n  \t\t\t\t\tid: val,\n  \t\t\t\t\tlabel: val\n  \t\t\t\t};\n  \t\t\t}\n\n  \t\t\tescaped = escapeText(val.id);\n  \t\t\tescapedTooltip = escapeText(val.tooltip);\n\n  \t\t\tif (!val.value || typeof val.value === \"string\") {\n  \t\t\t\turlConfigHtml += \"<label for='qunit-urlconfig-\" + escaped + \"' title='\" + escapedTooltip + \"'><input id='qunit-urlconfig-\" + escaped + \"' name='\" + escaped + \"' type='checkbox'\" + (val.value ? \" value='\" + escapeText(val.value) + \"'\" : \"\") + (config[val.id] ? \" checked='checked'\" : \"\") + \" title='\" + escapedTooltip + \"' />\" + escapeText(val.label) + \"</label>\";\n  \t\t\t} else {\n  \t\t\t\turlConfigHtml += \"<label for='qunit-urlconfig-\" + escaped + \"' title='\" + escapedTooltip + \"'>\" + val.label + \": </label><select id='qunit-urlconfig-\" + escaped + \"' name='\" + escaped + \"' title='\" + escapedTooltip + \"'><option></option>\";\n\n  \t\t\t\tif (QUnit.is(\"array\", val.value)) {\n  \t\t\t\t\tfor (j = 0; j < val.value.length; j++) {\n  \t\t\t\t\t\tescaped = escapeText(val.value[j]);\n  \t\t\t\t\t\turlConfigHtml += \"<option value='\" + escaped + \"'\" + (config[val.id] === val.value[j] ? (selection = true) && \" selected='selected'\" : \"\") + \">\" + escaped + \"</option>\";\n  \t\t\t\t\t}\n  \t\t\t\t} else {\n  \t\t\t\t\tfor (j in val.value) {\n  \t\t\t\t\t\tif (hasOwn.call(val.value, j)) {\n  \t\t\t\t\t\t\turlConfigHtml += \"<option value='\" + escapeText(j) + \"'\" + (config[val.id] === j ? (selection = true) && \" selected='selected'\" : \"\") + \">\" + escapeText(val.value[j]) + \"</option>\";\n  \t\t\t\t\t\t}\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t\tif (config[val.id] && !selection) {\n  \t\t\t\t\tescaped = escapeText(config[val.id]);\n  \t\t\t\t\turlConfigHtml += \"<option value='\" + escaped + \"' selected='selected' disabled='disabled'>\" + escaped + \"</option>\";\n  \t\t\t\t}\n  \t\t\t\turlConfigHtml += \"</select>\";\n  \t\t\t}\n  \t\t}\n\n  \t\treturn urlConfigHtml;\n  \t}\n\n  \t// Handle \"click\" events on toolbar checkboxes and \"change\" for select menus.\n  \t// Updates the URL with the new state of `config.urlConfig` values.\n  \tfunction toolbarChanged() {\n  \t\tvar updatedUrl,\n  \t\t    value,\n  \t\t    tests,\n  \t\t    field = this,\n  \t\t    params = {};\n\n  \t\t// Detect if field is a select menu or a checkbox\n  \t\tif (\"selectedIndex\" in field) {\n  \t\t\tvalue = field.options[field.selectedIndex].value || undefined;\n  \t\t} else {\n  \t\t\tvalue = field.checked ? field.defaultValue || true : undefined;\n  \t\t}\n\n  \t\tparams[field.name] = value;\n  \t\tupdatedUrl = setUrl(params);\n\n  \t\t// Check if we can apply the change without a page refresh\n  \t\tif (\"hidepassed\" === field.name && \"replaceState\" in window$1.history) {\n  \t\t\tQUnit.urlParams[field.name] = value;\n  \t\t\tconfig[field.name] = value || false;\n  \t\t\ttests = id(\"qunit-tests\");\n  \t\t\tif (tests) {\n  \t\t\t\tvar length = tests.children.length;\n  \t\t\t\tvar children = tests.children;\n\n  \t\t\t\tif (field.checked) {\n  \t\t\t\t\tfor (var i = 0; i < length; i++) {\n  \t\t\t\t\t\tvar test = children[i];\n\n  \t\t\t\t\t\tif (test && test.className.indexOf(\"pass\") > -1) {\n  \t\t\t\t\t\t\thiddenTests.push(test);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t}\n\n  \t\t\t\t\tvar _iteratorNormalCompletion = true;\n  \t\t\t\t\tvar _didIteratorError = false;\n  \t\t\t\t\tvar _iteratorError = undefined;\n\n  \t\t\t\t\ttry {\n  \t\t\t\t\t\tfor (var _iterator = hiddenTests[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n  \t\t\t\t\t\t\tvar hiddenTest = _step.value;\n\n  \t\t\t\t\t\t\ttests.removeChild(hiddenTest);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t} catch (err) {\n  \t\t\t\t\t\t_didIteratorError = true;\n  \t\t\t\t\t\t_iteratorError = err;\n  \t\t\t\t\t} finally {\n  \t\t\t\t\t\ttry {\n  \t\t\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return) {\n  \t\t\t\t\t\t\t\t_iterator.return();\n  \t\t\t\t\t\t\t}\n  \t\t\t\t\t\t} finally {\n  \t\t\t\t\t\t\tif (_didIteratorError) {\n  \t\t\t\t\t\t\t\tthrow _iteratorError;\n  \t\t\t\t\t\t\t}\n  \t\t\t\t\t\t}\n  \t\t\t\t\t}\n  \t\t\t\t} else {\n  \t\t\t\t\twhile ((test = hiddenTests.pop()) != null) {\n  \t\t\t\t\t\ttests.appendChild(test);\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\twindow$1.history.replaceState(null, \"\", updatedUrl);\n  \t\t} else {\n  \t\t\twindow$1.location = updatedUrl;\n  \t\t}\n  \t}\n\n  \tfunction setUrl(params) {\n  \t\tvar key,\n  \t\t    arrValue,\n  \t\t    i,\n  \t\t    querystring = \"?\",\n  \t\t    location = window$1.location;\n\n  \t\tparams = QUnit.extend(QUnit.extend({}, QUnit.urlParams), params);\n\n  \t\tfor (key in params) {\n\n  \t\t\t// Skip inherited or undefined properties\n  \t\t\tif (hasOwn.call(params, key) && params[key] !== undefined) {\n\n  \t\t\t\t// Output a parameter for each value of this key\n  \t\t\t\t// (but usually just one)\n  \t\t\t\tarrValue = [].concat(params[key]);\n  \t\t\t\tfor (i = 0; i < arrValue.length; i++) {\n  \t\t\t\t\tquerystring += encodeURIComponent(key);\n  \t\t\t\t\tif (arrValue[i] !== true) {\n  \t\t\t\t\t\tquerystring += \"=\" + encodeURIComponent(arrValue[i]);\n  \t\t\t\t\t}\n  \t\t\t\t\tquerystring += \"&\";\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n  \t\treturn location.protocol + \"//\" + location.host + location.pathname + querystring.slice(0, -1);\n  \t}\n\n  \tfunction applyUrlParams() {\n  \t\tvar i,\n  \t\t    selectedModules = [],\n  \t\t    modulesList = id(\"qunit-modulefilter-dropdown-list\").getElementsByTagName(\"input\"),\n  \t\t    filter = id(\"qunit-filter-input\").value;\n\n  \t\tfor (i = 0; i < modulesList.length; i++) {\n  \t\t\tif (modulesList[i].checked) {\n  \t\t\t\tselectedModules.push(modulesList[i].value);\n  \t\t\t}\n  \t\t}\n\n  \t\twindow$1.location = setUrl({\n  \t\t\tfilter: filter === \"\" ? undefined : filter,\n  \t\t\tmoduleId: selectedModules.length === 0 ? undefined : selectedModules,\n\n  \t\t\t// Remove module and testId filter\n  \t\t\tmodule: undefined,\n  \t\t\ttestId: undefined\n  \t\t});\n  \t}\n\n  \tfunction toolbarUrlConfigContainer() {\n  \t\tvar urlConfigContainer = document.createElement(\"span\");\n\n  \t\turlConfigContainer.innerHTML = getUrlConfigHtml();\n  \t\taddClass(urlConfigContainer, \"qunit-url-config\");\n\n  \t\taddEvents(urlConfigContainer.getElementsByTagName(\"input\"), \"change\", toolbarChanged);\n  \t\taddEvents(urlConfigContainer.getElementsByTagName(\"select\"), \"change\", toolbarChanged);\n\n  \t\treturn urlConfigContainer;\n  \t}\n\n  \tfunction abortTestsButton() {\n  \t\tvar button = document.createElement(\"button\");\n  \t\tbutton.id = \"qunit-abort-tests-button\";\n  \t\tbutton.innerHTML = \"Abort\";\n  \t\taddEvent(button, \"click\", abortTests);\n  \t\treturn button;\n  \t}\n\n  \tfunction toolbarLooseFilter() {\n  \t\tvar filter = document.createElement(\"form\"),\n  \t\t    label = document.createElement(\"label\"),\n  \t\t    input = document.createElement(\"input\"),\n  \t\t    button = document.createElement(\"button\");\n\n  \t\taddClass(filter, \"qunit-filter\");\n\n  \t\tlabel.innerHTML = \"Filter: \";\n\n  \t\tinput.type = \"text\";\n  \t\tinput.value = config.filter || \"\";\n  \t\tinput.name = \"filter\";\n  \t\tinput.id = \"qunit-filter-input\";\n\n  \t\tbutton.innerHTML = \"Go\";\n\n  \t\tlabel.appendChild(input);\n\n  \t\tfilter.appendChild(label);\n  \t\tfilter.appendChild(document.createTextNode(\" \"));\n  \t\tfilter.appendChild(button);\n  \t\taddEvent(filter, \"submit\", interceptNavigation);\n\n  \t\treturn filter;\n  \t}\n\n  \tfunction moduleListHtml() {\n  \t\tvar i,\n  \t\t    checked,\n  \t\t    html = \"\";\n\n  \t\tfor (i = 0; i < config.modules.length; i++) {\n  \t\t\tif (config.modules[i].name !== \"\") {\n  \t\t\t\tchecked = config.moduleId.indexOf(config.modules[i].moduleId) > -1;\n  \t\t\t\thtml += \"<li><label class='clickable\" + (checked ? \" checked\" : \"\") + \"'><input type='checkbox' \" + \"value='\" + config.modules[i].moduleId + \"'\" + (checked ? \" checked='checked'\" : \"\") + \" />\" + escapeText(config.modules[i].name) + \"</label></li>\";\n  \t\t\t}\n  \t\t}\n\n  \t\treturn html;\n  \t}\n\n  \tfunction toolbarModuleFilter() {\n  \t\tvar commit,\n  \t\t    reset,\n  \t\t    moduleFilter = document.createElement(\"form\"),\n  \t\t    label = document.createElement(\"label\"),\n  \t\t    moduleSearch = document.createElement(\"input\"),\n  \t\t    dropDown = document.createElement(\"div\"),\n  \t\t    actions = document.createElement(\"span\"),\n  \t\t    applyButton = document.createElement(\"button\"),\n  \t\t    resetButton = document.createElement(\"button\"),\n  \t\t    allModulesLabel = document.createElement(\"label\"),\n  \t\t    allCheckbox = document.createElement(\"input\"),\n  \t\t    dropDownList = document.createElement(\"ul\"),\n  \t\t    dirty = false;\n\n  \t\tmoduleSearch.id = \"qunit-modulefilter-search\";\n  \t\tmoduleSearch.autocomplete = \"off\";\n  \t\taddEvent(moduleSearch, \"input\", searchInput);\n  \t\taddEvent(moduleSearch, \"input\", searchFocus);\n  \t\taddEvent(moduleSearch, \"focus\", searchFocus);\n  \t\taddEvent(moduleSearch, \"click\", searchFocus);\n\n  \t\tlabel.id = \"qunit-modulefilter-search-container\";\n  \t\tlabel.innerHTML = \"Module: \";\n  \t\tlabel.appendChild(moduleSearch);\n\n  \t\tapplyButton.textContent = \"Apply\";\n  \t\tapplyButton.style.display = \"none\";\n\n  \t\tresetButton.textContent = \"Reset\";\n  \t\tresetButton.type = \"reset\";\n  \t\tresetButton.style.display = \"none\";\n\n  \t\tallCheckbox.type = \"checkbox\";\n  \t\tallCheckbox.checked = config.moduleId.length === 0;\n\n  \t\tallModulesLabel.className = \"clickable\";\n  \t\tif (config.moduleId.length) {\n  \t\t\tallModulesLabel.className = \"checked\";\n  \t\t}\n  \t\tallModulesLabel.appendChild(allCheckbox);\n  \t\tallModulesLabel.appendChild(document.createTextNode(\"All modules\"));\n\n  \t\tactions.id = \"qunit-modulefilter-actions\";\n  \t\tactions.appendChild(applyButton);\n  \t\tactions.appendChild(resetButton);\n  \t\tactions.appendChild(allModulesLabel);\n  \t\tcommit = actions.firstChild;\n  \t\treset = commit.nextSibling;\n  \t\taddEvent(commit, \"click\", applyUrlParams);\n\n  \t\tdropDownList.id = \"qunit-modulefilter-dropdown-list\";\n  \t\tdropDownList.innerHTML = moduleListHtml();\n\n  \t\tdropDown.id = \"qunit-modulefilter-dropdown\";\n  \t\tdropDown.style.display = \"none\";\n  \t\tdropDown.appendChild(actions);\n  \t\tdropDown.appendChild(dropDownList);\n  \t\taddEvent(dropDown, \"change\", selectionChange);\n  \t\tselectionChange();\n\n  \t\tmoduleFilter.id = \"qunit-modulefilter\";\n  \t\tmoduleFilter.appendChild(label);\n  \t\tmoduleFilter.appendChild(dropDown);\n  \t\taddEvent(moduleFilter, \"submit\", interceptNavigation);\n  \t\taddEvent(moduleFilter, \"reset\", function () {\n\n  \t\t\t// Let the reset happen, then update styles\n  \t\t\twindow$1.setTimeout(selectionChange);\n  \t\t});\n\n  \t\t// Enables show/hide for the dropdown\n  \t\tfunction searchFocus() {\n  \t\t\tif (dropDown.style.display !== \"none\") {\n  \t\t\t\treturn;\n  \t\t\t}\n\n  \t\t\tdropDown.style.display = \"block\";\n  \t\t\taddEvent(document, \"click\", hideHandler);\n  \t\t\taddEvent(document, \"keydown\", hideHandler);\n\n  \t\t\t// Hide on Escape keydown or outside-container click\n  \t\t\tfunction hideHandler(e) {\n  \t\t\t\tvar inContainer = moduleFilter.contains(e.target);\n\n  \t\t\t\tif (e.keyCode === 27 || !inContainer) {\n  \t\t\t\t\tif (e.keyCode === 27 && inContainer) {\n  \t\t\t\t\t\tmoduleSearch.focus();\n  \t\t\t\t\t}\n  \t\t\t\t\tdropDown.style.display = \"none\";\n  \t\t\t\t\tremoveEvent(document, \"click\", hideHandler);\n  \t\t\t\t\tremoveEvent(document, \"keydown\", hideHandler);\n  \t\t\t\t\tmoduleSearch.value = \"\";\n  \t\t\t\t\tsearchInput();\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n\n  \t\t// Processes module search box input\n  \t\tfunction searchInput() {\n  \t\t\tvar i,\n  \t\t\t    item,\n  \t\t\t    searchText = moduleSearch.value.toLowerCase(),\n  \t\t\t    listItems = dropDownList.children;\n\n  \t\t\tfor (i = 0; i < listItems.length; i++) {\n  \t\t\t\titem = listItems[i];\n  \t\t\t\tif (!searchText || item.textContent.toLowerCase().indexOf(searchText) > -1) {\n  \t\t\t\t\titem.style.display = \"\";\n  \t\t\t\t} else {\n  \t\t\t\t\titem.style.display = \"none\";\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n\n  \t\t// Processes selection changes\n  \t\tfunction selectionChange(evt) {\n  \t\t\tvar i,\n  \t\t\t    item,\n  \t\t\t    checkbox = evt && evt.target || allCheckbox,\n  \t\t\t    modulesList = dropDownList.getElementsByTagName(\"input\"),\n  \t\t\t    selectedNames = [];\n\n  \t\t\ttoggleClass(checkbox.parentNode, \"checked\", checkbox.checked);\n\n  \t\t\tdirty = false;\n  \t\t\tif (checkbox.checked && checkbox !== allCheckbox) {\n  \t\t\t\tallCheckbox.checked = false;\n  \t\t\t\tremoveClass(allCheckbox.parentNode, \"checked\");\n  \t\t\t}\n  \t\t\tfor (i = 0; i < modulesList.length; i++) {\n  \t\t\t\titem = modulesList[i];\n  \t\t\t\tif (!evt) {\n  \t\t\t\t\ttoggleClass(item.parentNode, \"checked\", item.checked);\n  \t\t\t\t} else if (checkbox === allCheckbox && checkbox.checked) {\n  \t\t\t\t\titem.checked = false;\n  \t\t\t\t\tremoveClass(item.parentNode, \"checked\");\n  \t\t\t\t}\n  \t\t\t\tdirty = dirty || item.checked !== item.defaultChecked;\n  \t\t\t\tif (item.checked) {\n  \t\t\t\t\tselectedNames.push(item.parentNode.textContent);\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\tcommit.style.display = reset.style.display = dirty ? \"\" : \"none\";\n  \t\t\tmoduleSearch.placeholder = selectedNames.join(\", \") || allCheckbox.parentNode.textContent;\n  \t\t\tmoduleSearch.title = \"Type to filter list. Current selection:\\n\" + (selectedNames.join(\"\\n\") || allCheckbox.parentNode.textContent);\n  \t\t}\n\n  \t\treturn moduleFilter;\n  \t}\n\n  \tfunction appendToolbar() {\n  \t\tvar toolbar = id(\"qunit-testrunner-toolbar\");\n\n  \t\tif (toolbar) {\n  \t\t\ttoolbar.appendChild(toolbarUrlConfigContainer());\n  \t\t\ttoolbar.appendChild(toolbarModuleFilter());\n  \t\t\ttoolbar.appendChild(toolbarLooseFilter());\n  \t\t\ttoolbar.appendChild(document.createElement(\"div\")).className = \"clearfix\";\n  \t\t}\n  \t}\n\n  \tfunction appendHeader() {\n  \t\tvar header = id(\"qunit-header\");\n\n  \t\tif (header) {\n  \t\t\theader.innerHTML = \"<a href='\" + escapeText(unfilteredUrl) + \"'>\" + header.innerHTML + \"</a> \";\n  \t\t}\n  \t}\n\n  \tfunction appendBanner() {\n  \t\tvar banner = id(\"qunit-banner\");\n\n  \t\tif (banner) {\n  \t\t\tbanner.className = \"\";\n  \t\t}\n  \t}\n\n  \tfunction appendTestResults() {\n  \t\tvar tests = id(\"qunit-tests\"),\n  \t\t    result = id(\"qunit-testresult\"),\n  \t\t    controls;\n\n  \t\tif (result) {\n  \t\t\tresult.parentNode.removeChild(result);\n  \t\t}\n\n  \t\tif (tests) {\n  \t\t\ttests.innerHTML = \"\";\n  \t\t\tresult = document.createElement(\"p\");\n  \t\t\tresult.id = \"qunit-testresult\";\n  \t\t\tresult.className = \"result\";\n  \t\t\ttests.parentNode.insertBefore(result, tests);\n  \t\t\tresult.innerHTML = \"<div id=\\\"qunit-testresult-display\\\">Running...<br />&#160;</div>\" + \"<div id=\\\"qunit-testresult-controls\\\"></div>\" + \"<div class=\\\"clearfix\\\"></div>\";\n  \t\t\tcontrols = id(\"qunit-testresult-controls\");\n  \t\t}\n\n  \t\tif (controls) {\n  \t\t\tcontrols.appendChild(abortTestsButton());\n  \t\t}\n  \t}\n\n  \tfunction appendFilteredTest() {\n  \t\tvar testId = QUnit.config.testId;\n  \t\tif (!testId || testId.length <= 0) {\n  \t\t\treturn \"\";\n  \t\t}\n  \t\treturn \"<div id='qunit-filteredTest'>Rerunning selected tests: \" + escapeText(testId.join(\", \")) + \" <a id='qunit-clearFilter' href='\" + escapeText(unfilteredUrl) + \"'>Run all tests</a></div>\";\n  \t}\n\n  \tfunction appendUserAgent() {\n  \t\tvar userAgent = id(\"qunit-userAgent\");\n\n  \t\tif (userAgent) {\n  \t\t\tuserAgent.innerHTML = \"\";\n  \t\t\tuserAgent.appendChild(document.createTextNode(\"QUnit \" + QUnit.version + \"; \" + navigator.userAgent));\n  \t\t}\n  \t}\n\n  \tfunction appendInterface() {\n  \t\tvar qunit = id(\"qunit\");\n\n  \t\tif (qunit) {\n  \t\t\tqunit.innerHTML = \"<h1 id='qunit-header'>\" + escapeText(document.title) + \"</h1>\" + \"<h2 id='qunit-banner'></h2>\" + \"<div id='qunit-testrunner-toolbar'></div>\" + appendFilteredTest() + \"<h2 id='qunit-userAgent'></h2>\" + \"<ol id='qunit-tests'></ol>\";\n  \t\t}\n\n  \t\tappendHeader();\n  \t\tappendBanner();\n  \t\tappendTestResults();\n  \t\tappendUserAgent();\n  \t\tappendToolbar();\n  \t}\n\n  \tfunction appendTest(name, testId, moduleName) {\n  \t\tvar title,\n  \t\t    rerunTrigger,\n  \t\t    testBlock,\n  \t\t    assertList,\n  \t\t    tests = id(\"qunit-tests\");\n\n  \t\tif (!tests) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\ttitle = document.createElement(\"strong\");\n  \t\ttitle.innerHTML = getNameHtml(name, moduleName);\n\n  \t\trerunTrigger = document.createElement(\"a\");\n  \t\trerunTrigger.innerHTML = \"Rerun\";\n  \t\trerunTrigger.href = setUrl({ testId: testId });\n\n  \t\ttestBlock = document.createElement(\"li\");\n  \t\ttestBlock.appendChild(title);\n  \t\ttestBlock.appendChild(rerunTrigger);\n  \t\ttestBlock.id = \"qunit-test-output-\" + testId;\n\n  \t\tassertList = document.createElement(\"ol\");\n  \t\tassertList.className = \"qunit-assert-list\";\n\n  \t\ttestBlock.appendChild(assertList);\n\n  \t\ttests.appendChild(testBlock);\n  \t}\n\n  \t// HTML Reporter initialization and load\n  \tQUnit.begin(function (details) {\n  \t\tvar i, moduleObj;\n\n  \t\t// Sort modules by name for the picker\n  \t\tfor (i = 0; i < details.modules.length; i++) {\n  \t\t\tmoduleObj = details.modules[i];\n  \t\t\tif (moduleObj.name) {\n  \t\t\t\tmodulesList.push(moduleObj.name);\n  \t\t\t}\n  \t\t}\n  \t\tmodulesList.sort(function (a, b) {\n  \t\t\treturn a.localeCompare(b);\n  \t\t});\n\n  \t\t// Initialize QUnit elements\n  \t\tappendInterface();\n  \t});\n\n  \tQUnit.done(function (details) {\n  \t\tvar banner = id(\"qunit-banner\"),\n  \t\t    tests = id(\"qunit-tests\"),\n  \t\t    abortButton = id(\"qunit-abort-tests-button\"),\n  \t\t    totalTests = stats.passedTests + stats.skippedTests + stats.todoTests + stats.failedTests,\n  \t\t    html = [totalTests, \" tests completed in \", details.runtime, \" milliseconds, with \", stats.failedTests, \" failed, \", stats.skippedTests, \" skipped, and \", stats.todoTests, \" todo.<br />\", \"<span class='passed'>\", details.passed, \"</span> assertions of <span class='total'>\", details.total, \"</span> passed, <span class='failed'>\", details.failed, \"</span> failed.\"].join(\"\"),\n  \t\t    test,\n  \t\t    assertLi,\n  \t\t    assertList;\n\n  \t\t// Update remaing tests to aborted\n  \t\tif (abortButton && abortButton.disabled) {\n  \t\t\thtml = \"Tests aborted after \" + details.runtime + \" milliseconds.\";\n\n  \t\t\tfor (var i = 0; i < tests.children.length; i++) {\n  \t\t\t\ttest = tests.children[i];\n  \t\t\t\tif (test.className === \"\" || test.className === \"running\") {\n  \t\t\t\t\ttest.className = \"aborted\";\n  \t\t\t\t\tassertList = test.getElementsByTagName(\"ol\")[0];\n  \t\t\t\t\tassertLi = document.createElement(\"li\");\n  \t\t\t\t\tassertLi.className = \"fail\";\n  \t\t\t\t\tassertLi.innerHTML = \"Test aborted.\";\n  \t\t\t\t\tassertList.appendChild(assertLi);\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n\n  \t\tif (banner && (!abortButton || abortButton.disabled === false)) {\n  \t\t\tbanner.className = stats.failedTests ? \"qunit-fail\" : \"qunit-pass\";\n  \t\t}\n\n  \t\tif (abortButton) {\n  \t\t\tabortButton.parentNode.removeChild(abortButton);\n  \t\t}\n\n  \t\tif (tests) {\n  \t\t\tid(\"qunit-testresult-display\").innerHTML = html;\n  \t\t}\n\n  \t\tif (config.altertitle && document.title) {\n\n  \t\t\t// Show ✖ for good, ✔ for bad suite result in title\n  \t\t\t// use escape sequences in case file gets loaded with non-utf-8\n  \t\t\t// charset\n  \t\t\tdocument.title = [stats.failedTests ? \"\\u2716\" : \"\\u2714\", document.title.replace(/^[\\u2714\\u2716] /i, \"\")].join(\" \");\n  \t\t}\n\n  \t\t// Scroll back to top to show results\n  \t\tif (config.scrolltop && window$1.scrollTo) {\n  \t\t\twindow$1.scrollTo(0, 0);\n  \t\t}\n  \t});\n\n  \tfunction getNameHtml(name, module) {\n  \t\tvar nameHtml = \"\";\n\n  \t\tif (module) {\n  \t\t\tnameHtml = \"<span class='module-name'>\" + escapeText(module) + \"</span>: \";\n  \t\t}\n\n  \t\tnameHtml += \"<span class='test-name'>\" + escapeText(name) + \"</span>\";\n\n  \t\treturn nameHtml;\n  \t}\n\n  \tQUnit.testStart(function (details) {\n  \t\tvar running, bad;\n\n  \t\tappendTest(details.name, details.testId, details.module);\n\n  \t\trunning = id(\"qunit-testresult-display\");\n\n  \t\tif (running) {\n  \t\t\taddClass(running, \"running\");\n\n  \t\t\tbad = QUnit.config.reorder && details.previousFailure;\n\n  \t\t\trunning.innerHTML = [bad ? \"Rerunning previously failed test: <br />\" : \"Running: <br />\", getNameHtml(details.name, details.module)].join(\"\");\n  \t\t}\n  \t});\n\n  \tfunction stripHtml(string) {\n\n  \t\t// Strip tags, html entity and whitespaces\n  \t\treturn string.replace(/<\\/?[^>]+(>|$)/g, \"\").replace(/&quot;/g, \"\").replace(/\\s+/g, \"\");\n  \t}\n\n  \tQUnit.log(function (details) {\n  \t\tvar assertList,\n  \t\t    assertLi,\n  \t\t    message,\n  \t\t    expected,\n  \t\t    actual,\n  \t\t    diff,\n  \t\t    showDiff = false,\n  \t\t    testItem = id(\"qunit-test-output-\" + details.testId);\n\n  \t\tif (!testItem) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\tmessage = escapeText(details.message) || (details.result ? \"okay\" : \"failed\");\n  \t\tmessage = \"<span class='test-message'>\" + message + \"</span>\";\n  \t\tmessage += \"<span class='runtime'>@ \" + details.runtime + \" ms</span>\";\n\n  \t\t// The pushFailure doesn't provide details.expected\n  \t\t// when it calls, it's implicit to also not show expected and diff stuff\n  \t\t// Also, we need to check details.expected existence, as it can exist and be undefined\n  \t\tif (!details.result && hasOwn.call(details, \"expected\")) {\n  \t\t\tif (details.negative) {\n  \t\t\t\texpected = \"NOT \" + QUnit.dump.parse(details.expected);\n  \t\t\t} else {\n  \t\t\t\texpected = QUnit.dump.parse(details.expected);\n  \t\t\t}\n\n  \t\t\tactual = QUnit.dump.parse(details.actual);\n  \t\t\tmessage += \"<table><tr class='test-expected'><th>Expected: </th><td><pre>\" + escapeText(expected) + \"</pre></td></tr>\";\n\n  \t\t\tif (actual !== expected) {\n\n  \t\t\t\tmessage += \"<tr class='test-actual'><th>Result: </th><td><pre>\" + escapeText(actual) + \"</pre></td></tr>\";\n\n  \t\t\t\tif (typeof details.actual === \"number\" && typeof details.expected === \"number\") {\n  \t\t\t\t\tif (!isNaN(details.actual) && !isNaN(details.expected)) {\n  \t\t\t\t\t\tshowDiff = true;\n  \t\t\t\t\t\tdiff = details.actual - details.expected;\n  \t\t\t\t\t\tdiff = (diff > 0 ? \"+\" : \"\") + diff;\n  \t\t\t\t\t}\n  \t\t\t\t} else if (typeof details.actual !== \"boolean\" && typeof details.expected !== \"boolean\") {\n  \t\t\t\t\tdiff = QUnit.diff(expected, actual);\n\n  \t\t\t\t\t// don't show diff if there is zero overlap\n  \t\t\t\t\tshowDiff = stripHtml(diff).length !== stripHtml(expected).length + stripHtml(actual).length;\n  \t\t\t\t}\n\n  \t\t\t\tif (showDiff) {\n  \t\t\t\t\tmessage += \"<tr class='test-diff'><th>Diff: </th><td><pre>\" + diff + \"</pre></td></tr>\";\n  \t\t\t\t}\n  \t\t\t} else if (expected.indexOf(\"[object Array]\") !== -1 || expected.indexOf(\"[object Object]\") !== -1) {\n  \t\t\t\tmessage += \"<tr class='test-message'><th>Message: </th><td>\" + \"Diff suppressed as the depth of object is more than current max depth (\" + QUnit.config.maxDepth + \").<p>Hint: Use <code>QUnit.dump.maxDepth</code> to \" + \" run with a higher max depth or <a href='\" + escapeText(setUrl({ maxDepth: -1 })) + \"'>\" + \"Rerun</a> without max depth.</p></td></tr>\";\n  \t\t\t} else {\n  \t\t\t\tmessage += \"<tr class='test-message'><th>Message: </th><td>\" + \"Diff suppressed as the expected and actual results have an equivalent\" + \" serialization</td></tr>\";\n  \t\t\t}\n\n  \t\t\tif (details.source) {\n  \t\t\t\tmessage += \"<tr class='test-source'><th>Source: </th><td><pre>\" + escapeText(details.source) + \"</pre></td></tr>\";\n  \t\t\t}\n\n  \t\t\tmessage += \"</table>\";\n\n  \t\t\t// This occurs when pushFailure is set and we have an extracted stack trace\n  \t\t} else if (!details.result && details.source) {\n  \t\t\tmessage += \"<table>\" + \"<tr class='test-source'><th>Source: </th><td><pre>\" + escapeText(details.source) + \"</pre></td></tr>\" + \"</table>\";\n  \t\t}\n\n  \t\tassertList = testItem.getElementsByTagName(\"ol\")[0];\n\n  \t\tassertLi = document.createElement(\"li\");\n  \t\tassertLi.className = details.result ? \"pass\" : \"fail\";\n  \t\tassertLi.innerHTML = message;\n  \t\tassertList.appendChild(assertLi);\n  \t});\n\n  \tQUnit.testDone(function (details) {\n  \t\tvar testTitle,\n  \t\t    time,\n  \t\t    testItem,\n  \t\t    assertList,\n  \t\t    status,\n  \t\t    good,\n  \t\t    bad,\n  \t\t    testCounts,\n  \t\t    skipped,\n  \t\t    sourceName,\n  \t\t    tests = id(\"qunit-tests\");\n\n  \t\tif (!tests) {\n  \t\t\treturn;\n  \t\t}\n\n  \t\ttestItem = id(\"qunit-test-output-\" + details.testId);\n\n  \t\tremoveClass(testItem, \"running\");\n\n  \t\tif (details.failed > 0) {\n  \t\t\tstatus = \"failed\";\n  \t\t} else if (details.todo) {\n  \t\t\tstatus = \"todo\";\n  \t\t} else {\n  \t\t\tstatus = details.skipped ? \"skipped\" : \"passed\";\n  \t\t}\n\n  \t\tassertList = testItem.getElementsByTagName(\"ol\")[0];\n\n  \t\tgood = details.passed;\n  \t\tbad = details.failed;\n\n  \t\t// This test passed if it has no unexpected failed assertions\n  \t\tvar testPassed = details.failed > 0 ? details.todo : !details.todo;\n\n  \t\tif (testPassed) {\n\n  \t\t\t// Collapse the passing tests\n  \t\t\taddClass(assertList, \"qunit-collapsed\");\n  \t\t} else if (config.collapse) {\n  \t\t\tif (!collapseNext) {\n\n  \t\t\t\t// Skip collapsing the first failing test\n  \t\t\t\tcollapseNext = true;\n  \t\t\t} else {\n\n  \t\t\t\t// Collapse remaining tests\n  \t\t\t\taddClass(assertList, \"qunit-collapsed\");\n  \t\t\t}\n  \t\t}\n\n  \t\t// The testItem.firstChild is the test name\n  \t\ttestTitle = testItem.firstChild;\n\n  \t\ttestCounts = bad ? \"<b class='failed'>\" + bad + \"</b>, \" + \"<b class='passed'>\" + good + \"</b>, \" : \"\";\n\n  \t\ttestTitle.innerHTML += \" <b class='counts'>(\" + testCounts + details.assertions.length + \")</b>\";\n\n  \t\tif (details.skipped) {\n  \t\t\tstats.skippedTests++;\n\n  \t\t\ttestItem.className = \"skipped\";\n  \t\t\tskipped = document.createElement(\"em\");\n  \t\t\tskipped.className = \"qunit-skipped-label\";\n  \t\t\tskipped.innerHTML = \"skipped\";\n  \t\t\ttestItem.insertBefore(skipped, testTitle);\n  \t\t} else {\n  \t\t\taddEvent(testTitle, \"click\", function () {\n  \t\t\t\ttoggleClass(assertList, \"qunit-collapsed\");\n  \t\t\t});\n\n  \t\t\ttestItem.className = testPassed ? \"pass\" : \"fail\";\n\n  \t\t\tif (details.todo) {\n  \t\t\t\tvar todoLabel = document.createElement(\"em\");\n  \t\t\t\ttodoLabel.className = \"qunit-todo-label\";\n  \t\t\t\ttodoLabel.innerHTML = \"todo\";\n  \t\t\t\ttestItem.className += \" todo\";\n  \t\t\t\ttestItem.insertBefore(todoLabel, testTitle);\n  \t\t\t}\n\n  \t\t\ttime = document.createElement(\"span\");\n  \t\t\ttime.className = \"runtime\";\n  \t\t\ttime.innerHTML = details.runtime + \" ms\";\n  \t\t\ttestItem.insertBefore(time, assertList);\n\n  \t\t\tif (!testPassed) {\n  \t\t\t\tstats.failedTests++;\n  \t\t\t} else if (details.todo) {\n  \t\t\t\tstats.todoTests++;\n  \t\t\t} else {\n  \t\t\t\tstats.passedTests++;\n  \t\t\t}\n  \t\t}\n\n  \t\t// Show the source of the test when showing assertions\n  \t\tif (details.source) {\n  \t\t\tsourceName = document.createElement(\"p\");\n  \t\t\tsourceName.innerHTML = \"<strong>Source: </strong>\" + escapeText(details.source);\n  \t\t\taddClass(sourceName, \"qunit-source\");\n  \t\t\tif (testPassed) {\n  \t\t\t\taddClass(sourceName, \"qunit-collapsed\");\n  \t\t\t}\n  \t\t\taddEvent(testTitle, \"click\", function () {\n  \t\t\t\ttoggleClass(sourceName, \"qunit-collapsed\");\n  \t\t\t});\n  \t\t\ttestItem.appendChild(sourceName);\n  \t\t}\n\n  \t\tif (config.hidepassed && status === \"passed\") {\n\n  \t\t\t// use removeChild instead of remove because of support\n  \t\t\thiddenTests.push(testItem);\n\n  \t\t\ttests.removeChild(testItem);\n  \t\t}\n  \t});\n\n  \t// Avoid readyState issue with phantomjs\n  \t// Ref: #818\n  \tvar notPhantom = function (p) {\n  \t\treturn !(p && p.version && p.version.major > 0);\n  \t}(window$1.phantom);\n\n  \tif (notPhantom && document.readyState === \"complete\") {\n  \t\tQUnit.load();\n  \t} else {\n  \t\taddEvent(window$1, \"load\", QUnit.load);\n  \t}\n\n  \t// Wrap window.onerror. We will call the original window.onerror to see if\n  \t// the existing handler fully handles the error; if not, we will call the\n  \t// QUnit.onError function.\n  \tvar originalWindowOnError = window$1.onerror;\n\n  \t// Cover uncaught exceptions\n  \t// Returning true will suppress the default browser handler,\n  \t// returning false will let it run.\n  \twindow$1.onerror = function (message, fileName, lineNumber, columnNumber, errorObj) {\n  \t\tvar ret = false;\n  \t\tif (originalWindowOnError) {\n  \t\t\tfor (var _len = arguments.length, args = Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {\n  \t\t\t\targs[_key - 5] = arguments[_key];\n  \t\t\t}\n\n  \t\t\tret = originalWindowOnError.call.apply(originalWindowOnError, [this, message, fileName, lineNumber, columnNumber, errorObj].concat(args));\n  \t\t}\n\n  \t\t// Treat return value as window.onerror itself does,\n  \t\t// Only do our handling if not suppressed.\n  \t\tif (ret !== true) {\n  \t\t\tvar error = {\n  \t\t\t\tmessage: message,\n  \t\t\t\tfileName: fileName,\n  \t\t\t\tlineNumber: lineNumber\n  \t\t\t};\n\n  \t\t\t// According to\n  \t\t\t// https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror,\n  \t\t\t// most modern browsers support an errorObj argument; use that to\n  \t\t\t// get a full stack trace if it's available.\n  \t\t\tif (errorObj && errorObj.stack) {\n  \t\t\t\terror.stacktrace = extractStacktrace(errorObj, 0);\n  \t\t\t}\n\n  \t\t\tret = QUnit.onError(error);\n  \t\t}\n\n  \t\treturn ret;\n  \t};\n\n  \t// Listen for unhandled rejections, and call QUnit.onUnhandledRejection\n  \twindow$1.addEventListener(\"unhandledrejection\", function (event) {\n  \t\tQUnit.onUnhandledRejection(event.reason);\n  \t});\n  })();\n\n  /*\n   * This file is a modified version of google-diff-match-patch's JavaScript implementation\n   * (https://code.google.com/p/google-diff-match-patch/source/browse/trunk/javascript/diff_match_patch_uncompressed.js),\n   * modifications are licensed as more fully set forth in LICENSE.txt.\n   *\n   * The original source of google-diff-match-patch is attributable and licensed as follows:\n   *\n   * Copyright 2006 Google Inc.\n   * https://code.google.com/p/google-diff-match-patch/\n   *\n   * Licensed under the Apache License, Version 2.0 (the \"License\");\n   * you may not use this file except in compliance with the License.\n   * You may obtain a copy of the License at\n   *\n   * https://www.apache.org/licenses/LICENSE-2.0\n   *\n   * Unless required by applicable law or agreed to in writing, software\n   * distributed under the License is distributed on an \"AS IS\" BASIS,\n   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   * See the License for the specific language governing permissions and\n   * limitations under the License.\n   *\n   * More Info:\n   *  https://code.google.com/p/google-diff-match-patch/\n   *\n   * Usage: QUnit.diff(expected, actual)\n   *\n   */\n  QUnit.diff = function () {\n  \tfunction DiffMatchPatch() {}\n\n  \t//  DIFF FUNCTIONS\n\n  \t/**\n    * The data structure representing a diff is an array of tuples:\n    * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n    * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n    */\n  \tvar DIFF_DELETE = -1,\n  \t    DIFF_INSERT = 1,\n  \t    DIFF_EQUAL = 0;\n\n  \t/**\n    * Find the differences between two texts.  Simplifies the problem by stripping\n    * any common prefix or suffix off the texts before diffing.\n    * @param {string} text1 Old string to be diffed.\n    * @param {string} text2 New string to be diffed.\n    * @param {boolean=} optChecklines Optional speedup flag. If present and false,\n    *     then don't run a line-level diff first to identify the changed areas.\n    *     Defaults to true, which does a faster, slightly less optimal diff.\n    * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.\n    */\n  \tDiffMatchPatch.prototype.DiffMain = function (text1, text2, optChecklines) {\n  \t\tvar deadline, checklines, commonlength, commonprefix, commonsuffix, diffs;\n\n  \t\t// The diff must be complete in up to 1 second.\n  \t\tdeadline = new Date().getTime() + 1000;\n\n  \t\t// Check for null inputs.\n  \t\tif (text1 === null || text2 === null) {\n  \t\t\tthrow new Error(\"Null input. (DiffMain)\");\n  \t\t}\n\n  \t\t// Check for equality (speedup).\n  \t\tif (text1 === text2) {\n  \t\t\tif (text1) {\n  \t\t\t\treturn [[DIFF_EQUAL, text1]];\n  \t\t\t}\n  \t\t\treturn [];\n  \t\t}\n\n  \t\tif (typeof optChecklines === \"undefined\") {\n  \t\t\toptChecklines = true;\n  \t\t}\n\n  \t\tchecklines = optChecklines;\n\n  \t\t// Trim off common prefix (speedup).\n  \t\tcommonlength = this.diffCommonPrefix(text1, text2);\n  \t\tcommonprefix = text1.substring(0, commonlength);\n  \t\ttext1 = text1.substring(commonlength);\n  \t\ttext2 = text2.substring(commonlength);\n\n  \t\t// Trim off common suffix (speedup).\n  \t\tcommonlength = this.diffCommonSuffix(text1, text2);\n  \t\tcommonsuffix = text1.substring(text1.length - commonlength);\n  \t\ttext1 = text1.substring(0, text1.length - commonlength);\n  \t\ttext2 = text2.substring(0, text2.length - commonlength);\n\n  \t\t// Compute the diff on the middle block.\n  \t\tdiffs = this.diffCompute(text1, text2, checklines, deadline);\n\n  \t\t// Restore the prefix and suffix.\n  \t\tif (commonprefix) {\n  \t\t\tdiffs.unshift([DIFF_EQUAL, commonprefix]);\n  \t\t}\n  \t\tif (commonsuffix) {\n  \t\t\tdiffs.push([DIFF_EQUAL, commonsuffix]);\n  \t\t}\n  \t\tthis.diffCleanupMerge(diffs);\n  \t\treturn diffs;\n  \t};\n\n  \t/**\n    * Reduce the number of edits by eliminating operationally trivial equalities.\n    * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.\n    */\n  \tDiffMatchPatch.prototype.diffCleanupEfficiency = function (diffs) {\n  \t\tvar changes, equalities, equalitiesLength, lastequality, pointer, preIns, preDel, postIns, postDel;\n  \t\tchanges = false;\n  \t\tequalities = []; // Stack of indices where equalities are found.\n  \t\tequalitiesLength = 0; // Keeping our own length var is faster in JS.\n  \t\t/** @type {?string} */\n  \t\tlastequality = null;\n\n  \t\t// Always equal to diffs[equalities[equalitiesLength - 1]][1]\n  \t\tpointer = 0; // Index of current position.\n\n  \t\t// Is there an insertion operation before the last equality.\n  \t\tpreIns = false;\n\n  \t\t// Is there a deletion operation before the last equality.\n  \t\tpreDel = false;\n\n  \t\t// Is there an insertion operation after the last equality.\n  \t\tpostIns = false;\n\n  \t\t// Is there a deletion operation after the last equality.\n  \t\tpostDel = false;\n  \t\twhile (pointer < diffs.length) {\n\n  \t\t\t// Equality found.\n  \t\t\tif (diffs[pointer][0] === DIFF_EQUAL) {\n  \t\t\t\tif (diffs[pointer][1].length < 4 && (postIns || postDel)) {\n\n  \t\t\t\t\t// Candidate found.\n  \t\t\t\t\tequalities[equalitiesLength++] = pointer;\n  \t\t\t\t\tpreIns = postIns;\n  \t\t\t\t\tpreDel = postDel;\n  \t\t\t\t\tlastequality = diffs[pointer][1];\n  \t\t\t\t} else {\n\n  \t\t\t\t\t// Not a candidate, and can never become one.\n  \t\t\t\t\tequalitiesLength = 0;\n  \t\t\t\t\tlastequality = null;\n  \t\t\t\t}\n  \t\t\t\tpostIns = postDel = false;\n\n  \t\t\t\t// An insertion or deletion.\n  \t\t\t} else {\n\n  \t\t\t\tif (diffs[pointer][0] === DIFF_DELETE) {\n  \t\t\t\t\tpostDel = true;\n  \t\t\t\t} else {\n  \t\t\t\t\tpostIns = true;\n  \t\t\t\t}\n\n  \t\t\t\t/*\n       * Five types to be split:\n       * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>\n       * <ins>A</ins>X<ins>C</ins><del>D</del>\n       * <ins>A</ins><del>B</del>X<ins>C</ins>\n       * <ins>A</del>X<ins>C</ins><del>D</del>\n       * <ins>A</ins><del>B</del>X<del>C</del>\n       */\n  \t\t\t\tif (lastequality && (preIns && preDel && postIns && postDel || lastequality.length < 2 && preIns + preDel + postIns + postDel === 3)) {\n\n  \t\t\t\t\t// Duplicate record.\n  \t\t\t\t\tdiffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]);\n\n  \t\t\t\t\t// Change second copy to insert.\n  \t\t\t\t\tdiffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;\n  \t\t\t\t\tequalitiesLength--; // Throw away the equality we just deleted;\n  \t\t\t\t\tlastequality = null;\n  \t\t\t\t\tif (preIns && preDel) {\n\n  \t\t\t\t\t\t// No changes made which could affect previous entry, keep going.\n  \t\t\t\t\t\tpostIns = postDel = true;\n  \t\t\t\t\t\tequalitiesLength = 0;\n  \t\t\t\t\t} else {\n  \t\t\t\t\t\tequalitiesLength--; // Throw away the previous equality.\n  \t\t\t\t\t\tpointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;\n  \t\t\t\t\t\tpostIns = postDel = false;\n  \t\t\t\t\t}\n  \t\t\t\t\tchanges = true;\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\tpointer++;\n  \t\t}\n\n  \t\tif (changes) {\n  \t\t\tthis.diffCleanupMerge(diffs);\n  \t\t}\n  \t};\n\n  \t/**\n    * Convert a diff array into a pretty HTML report.\n    * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.\n    * @param {integer} string to be beautified.\n    * @return {string} HTML representation.\n    */\n  \tDiffMatchPatch.prototype.diffPrettyHtml = function (diffs) {\n  \t\tvar op,\n  \t\t    data,\n  \t\t    x,\n  \t\t    html = [];\n  \t\tfor (x = 0; x < diffs.length; x++) {\n  \t\t\top = diffs[x][0]; // Operation (insert, delete, equal)\n  \t\t\tdata = diffs[x][1]; // Text of change.\n  \t\t\tswitch (op) {\n  \t\t\t\tcase DIFF_INSERT:\n  \t\t\t\t\thtml[x] = \"<ins>\" + escapeText(data) + \"</ins>\";\n  \t\t\t\t\tbreak;\n  \t\t\t\tcase DIFF_DELETE:\n  \t\t\t\t\thtml[x] = \"<del>\" + escapeText(data) + \"</del>\";\n  \t\t\t\t\tbreak;\n  \t\t\t\tcase DIFF_EQUAL:\n  \t\t\t\t\thtml[x] = \"<span>\" + escapeText(data) + \"</span>\";\n  \t\t\t\t\tbreak;\n  \t\t\t}\n  \t\t}\n  \t\treturn html.join(\"\");\n  \t};\n\n  \t/**\n    * Determine the common prefix of two strings.\n    * @param {string} text1 First string.\n    * @param {string} text2 Second string.\n    * @return {number} The number of characters common to the start of each\n    *     string.\n    */\n  \tDiffMatchPatch.prototype.diffCommonPrefix = function (text1, text2) {\n  \t\tvar pointermid, pointermax, pointermin, pointerstart;\n\n  \t\t// Quick check for common null cases.\n  \t\tif (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {\n  \t\t\treturn 0;\n  \t\t}\n\n  \t\t// Binary search.\n  \t\t// Performance analysis: https://neil.fraser.name/news/2007/10/09/\n  \t\tpointermin = 0;\n  \t\tpointermax = Math.min(text1.length, text2.length);\n  \t\tpointermid = pointermax;\n  \t\tpointerstart = 0;\n  \t\twhile (pointermin < pointermid) {\n  \t\t\tif (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) {\n  \t\t\t\tpointermin = pointermid;\n  \t\t\t\tpointerstart = pointermin;\n  \t\t\t} else {\n  \t\t\t\tpointermax = pointermid;\n  \t\t\t}\n  \t\t\tpointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n  \t\t}\n  \t\treturn pointermid;\n  \t};\n\n  \t/**\n    * Determine the common suffix of two strings.\n    * @param {string} text1 First string.\n    * @param {string} text2 Second string.\n    * @return {number} The number of characters common to the end of each string.\n    */\n  \tDiffMatchPatch.prototype.diffCommonSuffix = function (text1, text2) {\n  \t\tvar pointermid, pointermax, pointermin, pointerend;\n\n  \t\t// Quick check for common null cases.\n  \t\tif (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) {\n  \t\t\treturn 0;\n  \t\t}\n\n  \t\t// Binary search.\n  \t\t// Performance analysis: https://neil.fraser.name/news/2007/10/09/\n  \t\tpointermin = 0;\n  \t\tpointermax = Math.min(text1.length, text2.length);\n  \t\tpointermid = pointermax;\n  \t\tpointerend = 0;\n  \t\twhile (pointermin < pointermid) {\n  \t\t\tif (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) {\n  \t\t\t\tpointermin = pointermid;\n  \t\t\t\tpointerend = pointermin;\n  \t\t\t} else {\n  \t\t\t\tpointermax = pointermid;\n  \t\t\t}\n  \t\t\tpointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n  \t\t}\n  \t\treturn pointermid;\n  \t};\n\n  \t/**\n    * Find the differences between two texts.  Assumes that the texts do not\n    * have any common prefix or suffix.\n    * @param {string} text1 Old string to be diffed.\n    * @param {string} text2 New string to be diffed.\n    * @param {boolean} checklines Speedup flag.  If false, then don't run a\n    *     line-level diff first to identify the changed areas.\n    *     If true, then run a faster, slightly less optimal diff.\n    * @param {number} deadline Time when the diff should be complete by.\n    * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffCompute = function (text1, text2, checklines, deadline) {\n  \t\tvar diffs, longtext, shorttext, i, hm, text1A, text2A, text1B, text2B, midCommon, diffsA, diffsB;\n\n  \t\tif (!text1) {\n\n  \t\t\t// Just add some text (speedup).\n  \t\t\treturn [[DIFF_INSERT, text2]];\n  \t\t}\n\n  \t\tif (!text2) {\n\n  \t\t\t// Just delete some text (speedup).\n  \t\t\treturn [[DIFF_DELETE, text1]];\n  \t\t}\n\n  \t\tlongtext = text1.length > text2.length ? text1 : text2;\n  \t\tshorttext = text1.length > text2.length ? text2 : text1;\n  \t\ti = longtext.indexOf(shorttext);\n  \t\tif (i !== -1) {\n\n  \t\t\t// Shorter text is inside the longer text (speedup).\n  \t\t\tdiffs = [[DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], [DIFF_INSERT, longtext.substring(i + shorttext.length)]];\n\n  \t\t\t// Swap insertions for deletions if diff is reversed.\n  \t\t\tif (text1.length > text2.length) {\n  \t\t\t\tdiffs[0][0] = diffs[2][0] = DIFF_DELETE;\n  \t\t\t}\n  \t\t\treturn diffs;\n  \t\t}\n\n  \t\tif (shorttext.length === 1) {\n\n  \t\t\t// Single character string.\n  \t\t\t// After the previous speedup, the character can't be an equality.\n  \t\t\treturn [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n  \t\t}\n\n  \t\t// Check to see if the problem can be split in two.\n  \t\thm = this.diffHalfMatch(text1, text2);\n  \t\tif (hm) {\n\n  \t\t\t// A half-match was found, sort out the return data.\n  \t\t\ttext1A = hm[0];\n  \t\t\ttext1B = hm[1];\n  \t\t\ttext2A = hm[2];\n  \t\t\ttext2B = hm[3];\n  \t\t\tmidCommon = hm[4];\n\n  \t\t\t// Send both pairs off for separate processing.\n  \t\t\tdiffsA = this.DiffMain(text1A, text2A, checklines, deadline);\n  \t\t\tdiffsB = this.DiffMain(text1B, text2B, checklines, deadline);\n\n  \t\t\t// Merge the results.\n  \t\t\treturn diffsA.concat([[DIFF_EQUAL, midCommon]], diffsB);\n  \t\t}\n\n  \t\tif (checklines && text1.length > 100 && text2.length > 100) {\n  \t\t\treturn this.diffLineMode(text1, text2, deadline);\n  \t\t}\n\n  \t\treturn this.diffBisect(text1, text2, deadline);\n  \t};\n\n  \t/**\n    * Do the two texts share a substring which is at least half the length of the\n    * longer text?\n    * This speedup can produce non-minimal diffs.\n    * @param {string} text1 First string.\n    * @param {string} text2 Second string.\n    * @return {Array.<string>} Five element Array, containing the prefix of\n    *     text1, the suffix of text1, the prefix of text2, the suffix of\n    *     text2 and the common middle.  Or null if there was no match.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffHalfMatch = function (text1, text2) {\n  \t\tvar longtext, shorttext, dmp, text1A, text2B, text2A, text1B, midCommon, hm1, hm2, hm;\n\n  \t\tlongtext = text1.length > text2.length ? text1 : text2;\n  \t\tshorttext = text1.length > text2.length ? text2 : text1;\n  \t\tif (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n  \t\t\treturn null; // Pointless.\n  \t\t}\n  \t\tdmp = this; // 'this' becomes 'window' in a closure.\n\n  \t\t/**\n     * Does a substring of shorttext exist within longtext such that the substring\n     * is at least half the length of longtext?\n     * Closure, but does not reference any external variables.\n     * @param {string} longtext Longer string.\n     * @param {string} shorttext Shorter string.\n     * @param {number} i Start index of quarter length substring within longtext.\n     * @return {Array.<string>} Five element Array, containing the prefix of\n     *     longtext, the suffix of longtext, the prefix of shorttext, the suffix\n     *     of shorttext and the common middle.  Or null if there was no match.\n     * @private\n     */\n  \t\tfunction diffHalfMatchI(longtext, shorttext, i) {\n  \t\t\tvar seed, j, bestCommon, prefixLength, suffixLength, bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;\n\n  \t\t\t// Start with a 1/4 length substring at position i as a seed.\n  \t\t\tseed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n  \t\t\tj = -1;\n  \t\t\tbestCommon = \"\";\n  \t\t\twhile ((j = shorttext.indexOf(seed, j + 1)) !== -1) {\n  \t\t\t\tprefixLength = dmp.diffCommonPrefix(longtext.substring(i), shorttext.substring(j));\n  \t\t\t\tsuffixLength = dmp.diffCommonSuffix(longtext.substring(0, i), shorttext.substring(0, j));\n  \t\t\t\tif (bestCommon.length < suffixLength + prefixLength) {\n  \t\t\t\t\tbestCommon = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength);\n  \t\t\t\t\tbestLongtextA = longtext.substring(0, i - suffixLength);\n  \t\t\t\t\tbestLongtextB = longtext.substring(i + prefixLength);\n  \t\t\t\t\tbestShorttextA = shorttext.substring(0, j - suffixLength);\n  \t\t\t\t\tbestShorttextB = shorttext.substring(j + prefixLength);\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\tif (bestCommon.length * 2 >= longtext.length) {\n  \t\t\t\treturn [bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB, bestCommon];\n  \t\t\t} else {\n  \t\t\t\treturn null;\n  \t\t\t}\n  \t\t}\n\n  \t\t// First check if the second quarter is the seed for a half-match.\n  \t\thm1 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 4));\n\n  \t\t// Check again based on the third quarter.\n  \t\thm2 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 2));\n  \t\tif (!hm1 && !hm2) {\n  \t\t\treturn null;\n  \t\t} else if (!hm2) {\n  \t\t\thm = hm1;\n  \t\t} else if (!hm1) {\n  \t\t\thm = hm2;\n  \t\t} else {\n\n  \t\t\t// Both matched.  Select the longest.\n  \t\t\thm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n  \t\t}\n\n  \t\t// A half-match was found, sort out the return data.\n  \t\tif (text1.length > text2.length) {\n  \t\t\ttext1A = hm[0];\n  \t\t\ttext1B = hm[1];\n  \t\t\ttext2A = hm[2];\n  \t\t\ttext2B = hm[3];\n  \t\t} else {\n  \t\t\ttext2A = hm[0];\n  \t\t\ttext2B = hm[1];\n  \t\t\ttext1A = hm[2];\n  \t\t\ttext1B = hm[3];\n  \t\t}\n  \t\tmidCommon = hm[4];\n  \t\treturn [text1A, text1B, text2A, text2B, midCommon];\n  \t};\n\n  \t/**\n    * Do a quick line-level diff on both strings, then rediff the parts for\n    * greater accuracy.\n    * This speedup can produce non-minimal diffs.\n    * @param {string} text1 Old string to be diffed.\n    * @param {string} text2 New string to be diffed.\n    * @param {number} deadline Time when the diff should be complete by.\n    * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffLineMode = function (text1, text2, deadline) {\n  \t\tvar a, diffs, linearray, pointer, countInsert, countDelete, textInsert, textDelete, j;\n\n  \t\t// Scan the text on a line-by-line basis first.\n  \t\ta = this.diffLinesToChars(text1, text2);\n  \t\ttext1 = a.chars1;\n  \t\ttext2 = a.chars2;\n  \t\tlinearray = a.lineArray;\n\n  \t\tdiffs = this.DiffMain(text1, text2, false, deadline);\n\n  \t\t// Convert the diff back to original text.\n  \t\tthis.diffCharsToLines(diffs, linearray);\n\n  \t\t// Eliminate freak matches (e.g. blank lines)\n  \t\tthis.diffCleanupSemantic(diffs);\n\n  \t\t// Rediff any replacement blocks, this time character-by-character.\n  \t\t// Add a dummy entry at the end.\n  \t\tdiffs.push([DIFF_EQUAL, \"\"]);\n  \t\tpointer = 0;\n  \t\tcountDelete = 0;\n  \t\tcountInsert = 0;\n  \t\ttextDelete = \"\";\n  \t\ttextInsert = \"\";\n  \t\twhile (pointer < diffs.length) {\n  \t\t\tswitch (diffs[pointer][0]) {\n  \t\t\t\tcase DIFF_INSERT:\n  \t\t\t\t\tcountInsert++;\n  \t\t\t\t\ttextInsert += diffs[pointer][1];\n  \t\t\t\t\tbreak;\n  \t\t\t\tcase DIFF_DELETE:\n  \t\t\t\t\tcountDelete++;\n  \t\t\t\t\ttextDelete += diffs[pointer][1];\n  \t\t\t\t\tbreak;\n  \t\t\t\tcase DIFF_EQUAL:\n\n  \t\t\t\t\t// Upon reaching an equality, check for prior redundancies.\n  \t\t\t\t\tif (countDelete >= 1 && countInsert >= 1) {\n\n  \t\t\t\t\t\t// Delete the offending records and add the merged ones.\n  \t\t\t\t\t\tdiffs.splice(pointer - countDelete - countInsert, countDelete + countInsert);\n  \t\t\t\t\t\tpointer = pointer - countDelete - countInsert;\n  \t\t\t\t\t\ta = this.DiffMain(textDelete, textInsert, false, deadline);\n  \t\t\t\t\t\tfor (j = a.length - 1; j >= 0; j--) {\n  \t\t\t\t\t\t\tdiffs.splice(pointer, 0, a[j]);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t\tpointer = pointer + a.length;\n  \t\t\t\t\t}\n  \t\t\t\t\tcountInsert = 0;\n  \t\t\t\t\tcountDelete = 0;\n  \t\t\t\t\ttextDelete = \"\";\n  \t\t\t\t\ttextInsert = \"\";\n  \t\t\t\t\tbreak;\n  \t\t\t}\n  \t\t\tpointer++;\n  \t\t}\n  \t\tdiffs.pop(); // Remove the dummy entry at the end.\n\n  \t\treturn diffs;\n  \t};\n\n  \t/**\n    * Find the 'middle snake' of a diff, split the problem in two\n    * and return the recursively constructed diff.\n    * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n    * @param {string} text1 Old string to be diffed.\n    * @param {string} text2 New string to be diffed.\n    * @param {number} deadline Time at which to bail if not yet complete.\n    * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffBisect = function (text1, text2, deadline) {\n  \t\tvar text1Length, text2Length, maxD, vOffset, vLength, v1, v2, x, delta, front, k1start, k1end, k2start, k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2;\n\n  \t\t// Cache the text lengths to prevent multiple calls.\n  \t\ttext1Length = text1.length;\n  \t\ttext2Length = text2.length;\n  \t\tmaxD = Math.ceil((text1Length + text2Length) / 2);\n  \t\tvOffset = maxD;\n  \t\tvLength = 2 * maxD;\n  \t\tv1 = new Array(vLength);\n  \t\tv2 = new Array(vLength);\n\n  \t\t// Setting all elements to -1 is faster in Chrome & Firefox than mixing\n  \t\t// integers and undefined.\n  \t\tfor (x = 0; x < vLength; x++) {\n  \t\t\tv1[x] = -1;\n  \t\t\tv2[x] = -1;\n  \t\t}\n  \t\tv1[vOffset + 1] = 0;\n  \t\tv2[vOffset + 1] = 0;\n  \t\tdelta = text1Length - text2Length;\n\n  \t\t// If the total number of characters is odd, then the front path will collide\n  \t\t// with the reverse path.\n  \t\tfront = delta % 2 !== 0;\n\n  \t\t// Offsets for start and end of k loop.\n  \t\t// Prevents mapping of space beyond the grid.\n  \t\tk1start = 0;\n  \t\tk1end = 0;\n  \t\tk2start = 0;\n  \t\tk2end = 0;\n  \t\tfor (d = 0; d < maxD; d++) {\n\n  \t\t\t// Bail out if deadline is reached.\n  \t\t\tif (new Date().getTime() > deadline) {\n  \t\t\t\tbreak;\n  \t\t\t}\n\n  \t\t\t// Walk the front path one step.\n  \t\t\tfor (k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n  \t\t\t\tk1Offset = vOffset + k1;\n  \t\t\t\tif (k1 === -d || k1 !== d && v1[k1Offset - 1] < v1[k1Offset + 1]) {\n  \t\t\t\t\tx1 = v1[k1Offset + 1];\n  \t\t\t\t} else {\n  \t\t\t\t\tx1 = v1[k1Offset - 1] + 1;\n  \t\t\t\t}\n  \t\t\t\ty1 = x1 - k1;\n  \t\t\t\twhile (x1 < text1Length && y1 < text2Length && text1.charAt(x1) === text2.charAt(y1)) {\n  \t\t\t\t\tx1++;\n  \t\t\t\t\ty1++;\n  \t\t\t\t}\n  \t\t\t\tv1[k1Offset] = x1;\n  \t\t\t\tif (x1 > text1Length) {\n\n  \t\t\t\t\t// Ran off the right of the graph.\n  \t\t\t\t\tk1end += 2;\n  \t\t\t\t} else if (y1 > text2Length) {\n\n  \t\t\t\t\t// Ran off the bottom of the graph.\n  \t\t\t\t\tk1start += 2;\n  \t\t\t\t} else if (front) {\n  \t\t\t\t\tk2Offset = vOffset + delta - k1;\n  \t\t\t\t\tif (k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] !== -1) {\n\n  \t\t\t\t\t\t// Mirror x2 onto top-left coordinate system.\n  \t\t\t\t\t\tx2 = text1Length - v2[k2Offset];\n  \t\t\t\t\t\tif (x1 >= x2) {\n\n  \t\t\t\t\t\t\t// Overlap detected.\n  \t\t\t\t\t\t\treturn this.diffBisectSplit(text1, text2, x1, y1, deadline);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t}\n\n  \t\t\t// Walk the reverse path one step.\n  \t\t\tfor (k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n  \t\t\t\tk2Offset = vOffset + k2;\n  \t\t\t\tif (k2 === -d || k2 !== d && v2[k2Offset - 1] < v2[k2Offset + 1]) {\n  \t\t\t\t\tx2 = v2[k2Offset + 1];\n  \t\t\t\t} else {\n  \t\t\t\t\tx2 = v2[k2Offset - 1] + 1;\n  \t\t\t\t}\n  \t\t\t\ty2 = x2 - k2;\n  \t\t\t\twhile (x2 < text1Length && y2 < text2Length && text1.charAt(text1Length - x2 - 1) === text2.charAt(text2Length - y2 - 1)) {\n  \t\t\t\t\tx2++;\n  \t\t\t\t\ty2++;\n  \t\t\t\t}\n  \t\t\t\tv2[k2Offset] = x2;\n  \t\t\t\tif (x2 > text1Length) {\n\n  \t\t\t\t\t// Ran off the left of the graph.\n  \t\t\t\t\tk2end += 2;\n  \t\t\t\t} else if (y2 > text2Length) {\n\n  \t\t\t\t\t// Ran off the top of the graph.\n  \t\t\t\t\tk2start += 2;\n  \t\t\t\t} else if (!front) {\n  \t\t\t\t\tk1Offset = vOffset + delta - k2;\n  \t\t\t\t\tif (k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] !== -1) {\n  \t\t\t\t\t\tx1 = v1[k1Offset];\n  \t\t\t\t\t\ty1 = vOffset + x1 - k1Offset;\n\n  \t\t\t\t\t\t// Mirror x2 onto top-left coordinate system.\n  \t\t\t\t\t\tx2 = text1Length - x2;\n  \t\t\t\t\t\tif (x1 >= x2) {\n\n  \t\t\t\t\t\t\t// Overlap detected.\n  \t\t\t\t\t\t\treturn this.diffBisectSplit(text1, text2, x1, y1, deadline);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t}\n  \t\t}\n\n  \t\t// Diff took too long and hit the deadline or\n  \t\t// number of diffs equals number of characters, no commonality at all.\n  \t\treturn [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n  \t};\n\n  \t/**\n    * Given the location of the 'middle snake', split the diff in two parts\n    * and recurse.\n    * @param {string} text1 Old string to be diffed.\n    * @param {string} text2 New string to be diffed.\n    * @param {number} x Index of split point in text1.\n    * @param {number} y Index of split point in text2.\n    * @param {number} deadline Time at which to bail if not yet complete.\n    * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffBisectSplit = function (text1, text2, x, y, deadline) {\n  \t\tvar text1a, text1b, text2a, text2b, diffs, diffsb;\n  \t\ttext1a = text1.substring(0, x);\n  \t\ttext2a = text2.substring(0, y);\n  \t\ttext1b = text1.substring(x);\n  \t\ttext2b = text2.substring(y);\n\n  \t\t// Compute both diffs serially.\n  \t\tdiffs = this.DiffMain(text1a, text2a, false, deadline);\n  \t\tdiffsb = this.DiffMain(text1b, text2b, false, deadline);\n\n  \t\treturn diffs.concat(diffsb);\n  \t};\n\n  \t/**\n    * Reduce the number of edits by eliminating semantically trivial equalities.\n    * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.\n    */\n  \tDiffMatchPatch.prototype.diffCleanupSemantic = function (diffs) {\n  \t\tvar changes, equalities, equalitiesLength, lastequality, pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1, lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2;\n  \t\tchanges = false;\n  \t\tequalities = []; // Stack of indices where equalities are found.\n  \t\tequalitiesLength = 0; // Keeping our own length var is faster in JS.\n  \t\t/** @type {?string} */\n  \t\tlastequality = null;\n\n  \t\t// Always equal to diffs[equalities[equalitiesLength - 1]][1]\n  \t\tpointer = 0; // Index of current position.\n\n  \t\t// Number of characters that changed prior to the equality.\n  \t\tlengthInsertions1 = 0;\n  \t\tlengthDeletions1 = 0;\n\n  \t\t// Number of characters that changed after the equality.\n  \t\tlengthInsertions2 = 0;\n  \t\tlengthDeletions2 = 0;\n  \t\twhile (pointer < diffs.length) {\n  \t\t\tif (diffs[pointer][0] === DIFF_EQUAL) {\n  \t\t\t\t// Equality found.\n  \t\t\t\tequalities[equalitiesLength++] = pointer;\n  \t\t\t\tlengthInsertions1 = lengthInsertions2;\n  \t\t\t\tlengthDeletions1 = lengthDeletions2;\n  \t\t\t\tlengthInsertions2 = 0;\n  \t\t\t\tlengthDeletions2 = 0;\n  \t\t\t\tlastequality = diffs[pointer][1];\n  \t\t\t} else {\n  \t\t\t\t// An insertion or deletion.\n  \t\t\t\tif (diffs[pointer][0] === DIFF_INSERT) {\n  \t\t\t\t\tlengthInsertions2 += diffs[pointer][1].length;\n  \t\t\t\t} else {\n  \t\t\t\t\tlengthDeletions2 += diffs[pointer][1].length;\n  \t\t\t\t}\n\n  \t\t\t\t// Eliminate an equality that is smaller or equal to the edits on both\n  \t\t\t\t// sides of it.\n  \t\t\t\tif (lastequality && lastequality.length <= Math.max(lengthInsertions1, lengthDeletions1) && lastequality.length <= Math.max(lengthInsertions2, lengthDeletions2)) {\n\n  \t\t\t\t\t// Duplicate record.\n  \t\t\t\t\tdiffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]);\n\n  \t\t\t\t\t// Change second copy to insert.\n  \t\t\t\t\tdiffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;\n\n  \t\t\t\t\t// Throw away the equality we just deleted.\n  \t\t\t\t\tequalitiesLength--;\n\n  \t\t\t\t\t// Throw away the previous equality (it needs to be reevaluated).\n  \t\t\t\t\tequalitiesLength--;\n  \t\t\t\t\tpointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;\n\n  \t\t\t\t\t// Reset the counters.\n  \t\t\t\t\tlengthInsertions1 = 0;\n  \t\t\t\t\tlengthDeletions1 = 0;\n  \t\t\t\t\tlengthInsertions2 = 0;\n  \t\t\t\t\tlengthDeletions2 = 0;\n  \t\t\t\t\tlastequality = null;\n  \t\t\t\t\tchanges = true;\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\tpointer++;\n  \t\t}\n\n  \t\t// Normalize the diff.\n  \t\tif (changes) {\n  \t\t\tthis.diffCleanupMerge(diffs);\n  \t\t}\n\n  \t\t// Find any overlaps between deletions and insertions.\n  \t\t// e.g: <del>abcxxx</del><ins>xxxdef</ins>\n  \t\t//   -> <del>abc</del>xxx<ins>def</ins>\n  \t\t// e.g: <del>xxxabc</del><ins>defxxx</ins>\n  \t\t//   -> <ins>def</ins>xxx<del>abc</del>\n  \t\t// Only extract an overlap if it is as big as the edit ahead or behind it.\n  \t\tpointer = 1;\n  \t\twhile (pointer < diffs.length) {\n  \t\t\tif (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) {\n  \t\t\t\tdeletion = diffs[pointer - 1][1];\n  \t\t\t\tinsertion = diffs[pointer][1];\n  \t\t\t\toverlapLength1 = this.diffCommonOverlap(deletion, insertion);\n  \t\t\t\toverlapLength2 = this.diffCommonOverlap(insertion, deletion);\n  \t\t\t\tif (overlapLength1 >= overlapLength2) {\n  \t\t\t\t\tif (overlapLength1 >= deletion.length / 2 || overlapLength1 >= insertion.length / 2) {\n\n  \t\t\t\t\t\t// Overlap found.  Insert an equality and trim the surrounding edits.\n  \t\t\t\t\t\tdiffs.splice(pointer, 0, [DIFF_EQUAL, insertion.substring(0, overlapLength1)]);\n  \t\t\t\t\t\tdiffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlapLength1);\n  \t\t\t\t\t\tdiffs[pointer + 1][1] = insertion.substring(overlapLength1);\n  \t\t\t\t\t\tpointer++;\n  \t\t\t\t\t}\n  \t\t\t\t} else {\n  \t\t\t\t\tif (overlapLength2 >= deletion.length / 2 || overlapLength2 >= insertion.length / 2) {\n\n  \t\t\t\t\t\t// Reverse overlap found.\n  \t\t\t\t\t\t// Insert an equality and swap and trim the surrounding edits.\n  \t\t\t\t\t\tdiffs.splice(pointer, 0, [DIFF_EQUAL, deletion.substring(0, overlapLength2)]);\n\n  \t\t\t\t\t\tdiffs[pointer - 1][0] = DIFF_INSERT;\n  \t\t\t\t\t\tdiffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlapLength2);\n  \t\t\t\t\t\tdiffs[pointer + 1][0] = DIFF_DELETE;\n  \t\t\t\t\t\tdiffs[pointer + 1][1] = deletion.substring(overlapLength2);\n  \t\t\t\t\t\tpointer++;\n  \t\t\t\t\t}\n  \t\t\t\t}\n  \t\t\t\tpointer++;\n  \t\t\t}\n  \t\t\tpointer++;\n  \t\t}\n  \t};\n\n  \t/**\n    * Determine if the suffix of one string is the prefix of another.\n    * @param {string} text1 First string.\n    * @param {string} text2 Second string.\n    * @return {number} The number of characters common to the end of the first\n    *     string and the start of the second string.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffCommonOverlap = function (text1, text2) {\n  \t\tvar text1Length, text2Length, textLength, best, length, pattern, found;\n\n  \t\t// Cache the text lengths to prevent multiple calls.\n  \t\ttext1Length = text1.length;\n  \t\ttext2Length = text2.length;\n\n  \t\t// Eliminate the null case.\n  \t\tif (text1Length === 0 || text2Length === 0) {\n  \t\t\treturn 0;\n  \t\t}\n\n  \t\t// Truncate the longer string.\n  \t\tif (text1Length > text2Length) {\n  \t\t\ttext1 = text1.substring(text1Length - text2Length);\n  \t\t} else if (text1Length < text2Length) {\n  \t\t\ttext2 = text2.substring(0, text1Length);\n  \t\t}\n  \t\ttextLength = Math.min(text1Length, text2Length);\n\n  \t\t// Quick check for the worst case.\n  \t\tif (text1 === text2) {\n  \t\t\treturn textLength;\n  \t\t}\n\n  \t\t// Start by looking for a single character match\n  \t\t// and increase length until no match is found.\n  \t\t// Performance analysis: https://neil.fraser.name/news/2010/11/04/\n  \t\tbest = 0;\n  \t\tlength = 1;\n  \t\twhile (true) {\n  \t\t\tpattern = text1.substring(textLength - length);\n  \t\t\tfound = text2.indexOf(pattern);\n  \t\t\tif (found === -1) {\n  \t\t\t\treturn best;\n  \t\t\t}\n  \t\t\tlength += found;\n  \t\t\tif (found === 0 || text1.substring(textLength - length) === text2.substring(0, length)) {\n  \t\t\t\tbest = length;\n  \t\t\t\tlength++;\n  \t\t\t}\n  \t\t}\n  \t};\n\n  \t/**\n    * Split two texts into an array of strings.  Reduce the texts to a string of\n    * hashes where each Unicode character represents one line.\n    * @param {string} text1 First string.\n    * @param {string} text2 Second string.\n    * @return {{chars1: string, chars2: string, lineArray: !Array.<string>}}\n    *     An object containing the encoded text1, the encoded text2 and\n    *     the array of unique strings.\n    *     The zeroth element of the array of unique strings is intentionally blank.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffLinesToChars = function (text1, text2) {\n  \t\tvar lineArray, lineHash, chars1, chars2;\n  \t\tlineArray = []; // E.g. lineArray[4] === 'Hello\\n'\n  \t\tlineHash = {}; // E.g. lineHash['Hello\\n'] === 4\n\n  \t\t// '\\x00' is a valid character, but various debuggers don't like it.\n  \t\t// So we'll insert a junk entry to avoid generating a null character.\n  \t\tlineArray[0] = \"\";\n\n  \t\t/**\n     * Split a text into an array of strings.  Reduce the texts to a string of\n     * hashes where each Unicode character represents one line.\n     * Modifies linearray and linehash through being a closure.\n     * @param {string} text String to encode.\n     * @return {string} Encoded string.\n     * @private\n     */\n  \t\tfunction diffLinesToCharsMunge(text) {\n  \t\t\tvar chars, lineStart, lineEnd, lineArrayLength, line;\n  \t\t\tchars = \"\";\n\n  \t\t\t// Walk the text, pulling out a substring for each line.\n  \t\t\t// text.split('\\n') would would temporarily double our memory footprint.\n  \t\t\t// Modifying text would create many large strings to garbage collect.\n  \t\t\tlineStart = 0;\n  \t\t\tlineEnd = -1;\n\n  \t\t\t// Keeping our own length variable is faster than looking it up.\n  \t\t\tlineArrayLength = lineArray.length;\n  \t\t\twhile (lineEnd < text.length - 1) {\n  \t\t\t\tlineEnd = text.indexOf(\"\\n\", lineStart);\n  \t\t\t\tif (lineEnd === -1) {\n  \t\t\t\t\tlineEnd = text.length - 1;\n  \t\t\t\t}\n  \t\t\t\tline = text.substring(lineStart, lineEnd + 1);\n  \t\t\t\tlineStart = lineEnd + 1;\n\n  \t\t\t\tvar lineHashExists = lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== undefined;\n\n  \t\t\t\tif (lineHashExists) {\n  \t\t\t\t\tchars += String.fromCharCode(lineHash[line]);\n  \t\t\t\t} else {\n  \t\t\t\t\tchars += String.fromCharCode(lineArrayLength);\n  \t\t\t\t\tlineHash[line] = lineArrayLength;\n  \t\t\t\t\tlineArray[lineArrayLength++] = line;\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\treturn chars;\n  \t\t}\n\n  \t\tchars1 = diffLinesToCharsMunge(text1);\n  \t\tchars2 = diffLinesToCharsMunge(text2);\n  \t\treturn {\n  \t\t\tchars1: chars1,\n  \t\t\tchars2: chars2,\n  \t\t\tlineArray: lineArray\n  \t\t};\n  \t};\n\n  \t/**\n    * Rehydrate the text in a diff from a string of line hashes to real lines of\n    * text.\n    * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.\n    * @param {!Array.<string>} lineArray Array of unique strings.\n    * @private\n    */\n  \tDiffMatchPatch.prototype.diffCharsToLines = function (diffs, lineArray) {\n  \t\tvar x, chars, text, y;\n  \t\tfor (x = 0; x < diffs.length; x++) {\n  \t\t\tchars = diffs[x][1];\n  \t\t\ttext = [];\n  \t\t\tfor (y = 0; y < chars.length; y++) {\n  \t\t\t\ttext[y] = lineArray[chars.charCodeAt(y)];\n  \t\t\t}\n  \t\t\tdiffs[x][1] = text.join(\"\");\n  \t\t}\n  \t};\n\n  \t/**\n    * Reorder and merge like edit sections.  Merge equalities.\n    * Any edit section can move as long as it doesn't cross an equality.\n    * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.\n    */\n  \tDiffMatchPatch.prototype.diffCleanupMerge = function (diffs) {\n  \t\tvar pointer, countDelete, countInsert, textInsert, textDelete, commonlength, changes, diffPointer, position;\n  \t\tdiffs.push([DIFF_EQUAL, \"\"]); // Add a dummy entry at the end.\n  \t\tpointer = 0;\n  \t\tcountDelete = 0;\n  \t\tcountInsert = 0;\n  \t\ttextDelete = \"\";\n  \t\ttextInsert = \"\";\n\n  \t\twhile (pointer < diffs.length) {\n  \t\t\tswitch (diffs[pointer][0]) {\n  \t\t\t\tcase DIFF_INSERT:\n  \t\t\t\t\tcountInsert++;\n  \t\t\t\t\ttextInsert += diffs[pointer][1];\n  \t\t\t\t\tpointer++;\n  \t\t\t\t\tbreak;\n  \t\t\t\tcase DIFF_DELETE:\n  \t\t\t\t\tcountDelete++;\n  \t\t\t\t\ttextDelete += diffs[pointer][1];\n  \t\t\t\t\tpointer++;\n  \t\t\t\t\tbreak;\n  \t\t\t\tcase DIFF_EQUAL:\n\n  \t\t\t\t\t// Upon reaching an equality, check for prior redundancies.\n  \t\t\t\t\tif (countDelete + countInsert > 1) {\n  \t\t\t\t\t\tif (countDelete !== 0 && countInsert !== 0) {\n\n  \t\t\t\t\t\t\t// Factor out any common prefixes.\n  \t\t\t\t\t\t\tcommonlength = this.diffCommonPrefix(textInsert, textDelete);\n  \t\t\t\t\t\t\tif (commonlength !== 0) {\n  \t\t\t\t\t\t\t\tif (pointer - countDelete - countInsert > 0 && diffs[pointer - countDelete - countInsert - 1][0] === DIFF_EQUAL) {\n  \t\t\t\t\t\t\t\t\tdiffs[pointer - countDelete - countInsert - 1][1] += textInsert.substring(0, commonlength);\n  \t\t\t\t\t\t\t\t} else {\n  \t\t\t\t\t\t\t\t\tdiffs.splice(0, 0, [DIFF_EQUAL, textInsert.substring(0, commonlength)]);\n  \t\t\t\t\t\t\t\t\tpointer++;\n  \t\t\t\t\t\t\t\t}\n  \t\t\t\t\t\t\t\ttextInsert = textInsert.substring(commonlength);\n  \t\t\t\t\t\t\t\ttextDelete = textDelete.substring(commonlength);\n  \t\t\t\t\t\t\t}\n\n  \t\t\t\t\t\t\t// Factor out any common suffixies.\n  \t\t\t\t\t\t\tcommonlength = this.diffCommonSuffix(textInsert, textDelete);\n  \t\t\t\t\t\t\tif (commonlength !== 0) {\n  \t\t\t\t\t\t\t\tdiffs[pointer][1] = textInsert.substring(textInsert.length - commonlength) + diffs[pointer][1];\n  \t\t\t\t\t\t\t\ttextInsert = textInsert.substring(0, textInsert.length - commonlength);\n  \t\t\t\t\t\t\t\ttextDelete = textDelete.substring(0, textDelete.length - commonlength);\n  \t\t\t\t\t\t\t}\n  \t\t\t\t\t\t}\n\n  \t\t\t\t\t\t// Delete the offending records and add the merged ones.\n  \t\t\t\t\t\tif (countDelete === 0) {\n  \t\t\t\t\t\t\tdiffs.splice(pointer - countInsert, countDelete + countInsert, [DIFF_INSERT, textInsert]);\n  \t\t\t\t\t\t} else if (countInsert === 0) {\n  \t\t\t\t\t\t\tdiffs.splice(pointer - countDelete, countDelete + countInsert, [DIFF_DELETE, textDelete]);\n  \t\t\t\t\t\t} else {\n  \t\t\t\t\t\t\tdiffs.splice(pointer - countDelete - countInsert, countDelete + countInsert, [DIFF_DELETE, textDelete], [DIFF_INSERT, textInsert]);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t\tpointer = pointer - countDelete - countInsert + (countDelete ? 1 : 0) + (countInsert ? 1 : 0) + 1;\n  \t\t\t\t\t} else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {\n\n  \t\t\t\t\t\t// Merge this equality with the previous one.\n  \t\t\t\t\t\tdiffs[pointer - 1][1] += diffs[pointer][1];\n  \t\t\t\t\t\tdiffs.splice(pointer, 1);\n  \t\t\t\t\t} else {\n  \t\t\t\t\t\tpointer++;\n  \t\t\t\t\t}\n  \t\t\t\t\tcountInsert = 0;\n  \t\t\t\t\tcountDelete = 0;\n  \t\t\t\t\ttextDelete = \"\";\n  \t\t\t\t\ttextInsert = \"\";\n  \t\t\t\t\tbreak;\n  \t\t\t}\n  \t\t}\n  \t\tif (diffs[diffs.length - 1][1] === \"\") {\n  \t\t\tdiffs.pop(); // Remove the dummy entry at the end.\n  \t\t}\n\n  \t\t// Second pass: look for single edits surrounded on both sides by equalities\n  \t\t// which can be shifted sideways to eliminate an equality.\n  \t\t// e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC\n  \t\tchanges = false;\n  \t\tpointer = 1;\n\n  \t\t// Intentionally ignore the first and last element (don't need checking).\n  \t\twhile (pointer < diffs.length - 1) {\n  \t\t\tif (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) {\n\n  \t\t\t\tdiffPointer = diffs[pointer][1];\n  \t\t\t\tposition = diffPointer.substring(diffPointer.length - diffs[pointer - 1][1].length);\n\n  \t\t\t\t// This is a single edit surrounded by equalities.\n  \t\t\t\tif (position === diffs[pointer - 1][1]) {\n\n  \t\t\t\t\t// Shift the edit over the previous equality.\n  \t\t\t\t\tdiffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);\n  \t\t\t\t\tdiffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n  \t\t\t\t\tdiffs.splice(pointer - 1, 1);\n  \t\t\t\t\tchanges = true;\n  \t\t\t\t} else if (diffPointer.substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) {\n\n  \t\t\t\t\t// Shift the edit over the next equality.\n  \t\t\t\t\tdiffs[pointer - 1][1] += diffs[pointer + 1][1];\n  \t\t\t\t\tdiffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];\n  \t\t\t\t\tdiffs.splice(pointer + 1, 1);\n  \t\t\t\t\tchanges = true;\n  \t\t\t\t}\n  \t\t\t}\n  \t\t\tpointer++;\n  \t\t}\n\n  \t\t// If shifts were made, the diff needs reordering and another shift sweep.\n  \t\tif (changes) {\n  \t\t\tthis.diffCleanupMerge(diffs);\n  \t\t}\n  \t};\n\n  \treturn function (o, n) {\n  \t\tvar diff, output, text;\n  \t\tdiff = new DiffMatchPatch();\n  \t\toutput = diff.DiffMain(o, n);\n  \t\tdiff.diffCleanupEfficiency(output);\n  \t\ttext = diff.diffPrettyHtml(output);\n\n  \t\treturn text;\n  \t};\n  }();\n\n}((function() { return this; }())));\n"
  },
  {
    "path": "tests.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width\">\n  <title>Unit tests for LInQer</title>\n  <link rel=\"stylesheet\" href=\"qunit/qunit-2.9.2.css\">\n  <script src=\"LInQer.js\"></script>\n  <script src=\"LInQer.extra.js\"></script>\n</head>\n<body>\n  <div id=\"qunit\"></div>\n  <div id=\"qunit-fixture\"></div>\n  <script src=\"qunit/qunit-2.9.2.js\"></script>\n  <script src=\"tests.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "tests.js",
    "content": "/* eslint-disable no-undef */\nEnumerable = Linqer.Enumerable;\n\n// object and method tests\nQUnit.module('object and method tests');\n\nQUnit.test( \"Enumerable.from with empty array\", function( assert ) {\n    const enumerable = Enumerable.from([]);\n    const result =[];\n    for (const item of enumerable) result.push(item);\n            \n    assert.deepEqual( result,[], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.from with non empty array\", function( assert ) {\n    const enumerable = Enumerable.from([1,'a2',3,null]);\n    const result =[];\n    for (const item of enumerable) result.push(item);\n            \n    assert.deepEqual( result,[1,'a2',3,null], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.from with generator function\", function( assert ) {\n    function* gen() {\n        yield 1;\n        yield 'a2';\n        yield 3;\n        yield null;\n    }\n    const enumerable = Enumerable.from(gen());\n    const result =[];\n    for (const item of enumerable) result.push(item);\n            \n    assert.deepEqual( result,[1,'a2',3,null], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.empty\", function( assert ) {\n    const enumerable = Enumerable.empty();\n    const result =[];\n    for (const item of enumerable) result.push(item);\n            \n    assert.deepEqual( result,[], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.range\", function( assert ) {\n    const enumerable = Enumerable.range(10,2);\n    const result =[];\n    for (const item of enumerable) result.push(item);\n            \n    assert.deepEqual( result,[10,11], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.repeat\", function( assert ) {\n    const enumerable = Enumerable.repeat(10,2);\n    const result =[];\n    for (const item of enumerable) result.push(item);\n            \n    assert.deepEqual( result,[10,10], \"Passed!\" );\n});\n\n\nQUnit.test( \"Enumerable.aggregate with numbers\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).aggregate(10,(acc,item)=>acc+item*2);\n    assert.deepEqual( result,22, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.aggregate with text\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).aggregate(10,(acc,item)=>acc+' '+(item*2));\n    assert.deepEqual( result,'10 2 4 6', \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.all true\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).all(item=>item>0);\n    assert.deepEqual( result,true, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.all false\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).all(item=>item>2);\n    assert.deepEqual( result,false, \"Passed!\" );\n});\n\n\nQUnit.test( \"Enumerable.any true\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).any(item=>item>2);\n    assert.deepEqual( result,true, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.any false\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).any(item=>item>10);\n    assert.deepEqual( result,false, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.append\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).append(4).toArray();\n    assert.deepEqual( result,[1,2,3,4], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.average empty\", function( assert ) {\n    const result = Enumerable.from([]).average();\n    assert.deepEqual( result,undefined, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.average numbers\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).average();\n    assert.deepEqual( result,2, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.average not numbers\", function( assert ) {\n    const result = Enumerable.from([1,'xx2',5]).average();\n    assert.deepEqual( result,Number.NaN, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.concat\", function( assert ) {\n    const result = Enumerable.from([1,'xx2',5]).concat([6,7,8]).toArray();\n    assert.deepEqual( result,[1,'xx2',5,6,7,8], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.contains true\", function( assert ) {\n    const result = Enumerable.from([1,'xx2',5]).contains(5);\n    assert.deepEqual( result,true, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.contains false\", function( assert ) {\n    const result = Enumerable.from([1,'xx2',5]).contains(6);\n    assert.deepEqual( result,false, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.count array\", function( assert ) {\n    const result = Enumerable.from([1,'xx2',5]).count();\n    assert.deepEqual( result,3, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.count Map\", function( assert ) {\n    const map = new Map();\n    map.set(1,2);\n    map.set('a','3');\n    const result = Enumerable.from(map).count();\n    assert.deepEqual( result,2, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.count Set\", function( assert ) {\n    const result = Enumerable.from(new Set().add(1).add(2).add(3).add(4)).count();\n    assert.deepEqual( result,4, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.count generator function\", function( assert ) {\n    function* gen() {\n        yield 'a';\n        yield 1;\n    }\n    const result = Enumerable.from(gen()).count();\n    assert.deepEqual( result,2, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.distinct\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).distinct().toArray();\n    assert.deepEqual( result,[1,2,3,'3'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.distinct equality comparer\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).distinct((i1,i2)=>+(i1) === +(i2)).toArray();\n    assert.deepEqual( result,[1,2,3], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.elementAt in range array\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).elementAt(3);\n    assert.deepEqual( result,3, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.elementAt below range array\", function( assert ) {\n    assert.throws( ()=>Enumerable.from([1,2,2,3,'3']).elementAt(-3), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.elementAt above range array\", function( assert ) {\n    assert.throws( ()=>Enumerable.from([1,2,2,3,'3']).elementAt(30), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.elementAtOrDefault in range array\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).elementAtOrDefault(3);\n    assert.deepEqual( result,3, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.elementAtOrDefault below range array\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).elementAtOrDefault(-3);\n    assert.deepEqual( result,undefined, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.elementAtOrDefault above range array\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).elementAtOrDefault(30);\n    assert.deepEqual( result,undefined, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.except\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).except([2,3]).toArray();\n    assert.deepEqual( result,[1,'3'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.except equality comparer\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).except([2,3],(i1,i2)=>+(i1) === +(i2)).toArray();\n    assert.deepEqual( result,[1], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.first\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).first();\n    assert.deepEqual( result,1, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.first empty\", function( assert ) {\n    assert.throws(()=>Enumerable.from([]).first(), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.firstOrDefault\", function( assert ) {\n    const result = Enumerable.from([]).firstOrDefault();\n    assert.deepEqual( result,undefined, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.groupBy\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3','sasa','0x4']).groupBy(item=>+(item)>2).toArray();\n    assert.deepEqual( result.length,2, \"Passed!\" );\n    assert.deepEqual( result[0].key,false, \"Passed!\" );\n    assert.deepEqual( result[0].toArray(),[1,2,2,'sasa'], \"Passed!\" );\n    assert.deepEqual( result[1].key,true, \"Passed!\" );\n    assert.deepEqual( result[1].toArray(),[3,'3','0x4'], \"Passed!\" );\n});\n\n\nQUnit.test( \"Enumerable.groupJoin\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,37])\n                        .groupJoin([10,12,331,13,56,3,22,57,43,467,212],i=>i+'',i=>(i+'').charAt(0),(i1,i2)=>{\n                            return {i1:i1,i2:i2};\n                        })\n                        .toArray();\n    assert.deepEqual(result, [\n        { 'i1': 1, 'i2': [10, 12, 13] }, \n        { 'i1': 2, 'i2': [22, 212] }, \n        { 'i1': 3, 'i2': [331, 3] }, \n        { 'i1': 4, 'i2': [43, 467] },\n        { 'i1': 37, 'i2': [] }\n    ], \"Passed!\");\n});\nQUnit.test( \"Enumerable.groupJoin equality comparer\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,37])\n                        .groupJoin([10,12,331,13,56,3,22,57,43,467,212],i=>i,i=>i,(i1,i2)=>{\n                            return {i1:i1,i2:i2};\n                        },(i1,i2)=>i2%i1===0)\n                        .toArray();\n    assert.deepEqual(result, [\n        { 'i1': 1, 'i2': [10, 12, 331, 13, 56, 3, 22, 57, 43, 467, 212] }, \n        { 'i1': 2, 'i2': [10, 12, 56, 22, 212] }, \n        { 'i1': 3, 'i2': [12, 3, 57] }, \n        { 'i1': 4, 'i2': [12, 56, 212] },\n        { 'i1': 37, 'i2': [] }\n    ], \"Passed!\");\n});\n\n\nQUnit.test( \"Enumerable.intersect\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).intersect([2,3,4]).toArray();\n    assert.deepEqual( result,[2,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.intersect equality comparer\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).intersect([2,3,4],(i1,i2)=>+i1 === +i2).toArray();\n    assert.deepEqual( result,[2,2,3,'3'], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.join\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,37])\n                        .join([10,12,331,13,56,3,22,57,43,467,212],i=>i+'',i=>(i+'').charAt(0),(i1,i2)=>i1+':'+i2)\n                        .toArray();\n    assert.deepEqual(result, [\n        '1:10', '1:12', '1:13', \n        '2:22', '2:212', \n        '3:331', '3:3', \n        '4:43', '4:467'\n    ], \"Passed!\");\n});\nQUnit.test( \"Enumerable.join equality comparer\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,37])\n                        .join([10,12,331,13,56,3,22,57,43,467,212],i=>i,i=>i,(i1,i2)=>i1+':'+i2,(i1,i2)=>i2%i1===0)\n                        .toArray();\n    assert.deepEqual(result, [\n        '1:10', '1:12', '1:331', '1:13', '1:56', '1:3', '1:22', '1:57', '1:43', '1:467', '1:212',\n        '2:10', '2:12', '2:56', '2:22', '2:212', \n        '3:12', '3:3', '3:57', \n        '4:12', '4:56', '4:212'\n    ], \"Passed!\");\n});\n\n\nQUnit.test( \"Enumerable.last\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).last();\n    assert.deepEqual( result,'3', \"Passed!\" );\n});\nQUnit.test( \"Enumerable.last empty\", function( assert ) {\n    assert.throws(()=>Enumerable.from([]).last(), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lastOrDefault\", function( assert ) {\n    const result = Enumerable.from([]).lastOrDefault();\n    assert.deepEqual( result,undefined, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.longCount empty\", function( assert ) {\n    const result = Enumerable.from([]).longCount();\n    assert.deepEqual( result,0, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.longCount array\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).longCount();\n    assert.deepEqual( result,3, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.max numbers\", function( assert ) {\n    const result = Enumerable.from([3,5,1,2,56,2,-100,43]).max();\n    assert.deepEqual( result,56, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.max strings\", function( assert ) {\n    const result = Enumerable.from(['ba','a','abba','aaa','bb']).max();\n    assert.deepEqual( result,'bb', \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.min number\", function( assert ) {\n    const result = Enumerable.from([3,5,1,2,56,2,-100,43]).min();\n    assert.deepEqual( result,-100, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.min custom comparer\", function( assert ) {\n    const result = Enumerable.from([3,5,1,2,56,2,-100,43]).min((i1,i2)=>i1.toString().length-i2.toString().length);\n    assert.deepEqual( result,3, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.ofType string parameter\", function( assert ) {\n    const result = Enumerable.from([undefined, null, Number.NaN,1,-1000,'some text',{value:'an object'}, Enumerable.empty]).ofType('string').toArray();\n    assert.deepEqual( result,['some text'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.ofType type parameter\", function( assert ) {\n    const enumerable = Enumerable.empty();\n    const result = Enumerable.from([undefined, null, Number.NaN,1,-1000,'some text',{value:'an object'}, enumerable]).ofType(Linqer.Enumerable).toArray();\n    assert.deepEqual( result,[enumerable], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.orderBy\", function( assert ) {\n    const result = Enumerable.from([1,3,2,4,5,0]).orderBy().toArray();\n    assert.deepEqual( result,[0,1,2,3,4,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.orderBy custom comparer forced QuickSort\", function( assert ) {\n    const result = Enumerable.from([1,3,2,4,5,0])\n                    .orderBy(i=>i%2)\n                    .take(Number.MAX_SAFE_INTEGER) // force QuickSort\n                    .toArray();\n    assert.deepEqual( result.map(i=>i%2),[0,0,0,1,1,1], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.orderBy custom comparer browser sort\", function( assert ) {\n    const result = Enumerable.from([1,3,2,4,5,0])\n        .useBrowserSort()\n        .orderBy(i=>i%2)\n        .toArray();\n    assert.deepEqual( result,[2,4,0,1,3,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.orderByDescending\", function( assert ) {\n    const result = Enumerable.from([1,3,2,4,5,0]).orderByDescending().toArray();\n    assert.deepEqual( result,[5,4,3,2,1,0], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.prepend\", function( assert ) {\n    const result = Enumerable.from([1,3,2]).prepend(0).toArray();\n    assert.deepEqual( result,[0,1,3,2], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.reverse\", function( assert ) {\n    const result = Enumerable.from(['a',1,3,2]).reverse().toArray();\n    assert.deepEqual( result,[2,3,1,'a'], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.select\", function( assert ) {\n    const result = Enumerable.from(['a',1,3,2]).select(item=>Number.isInteger(item)?item*item:item+'^2').toArray();\n    assert.deepEqual( result,['a^2',1,9,4], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.selectMany\", function( assert ) {\n    const result = Enumerable.from([[1,2],[2,3]]).selectMany().toArray();\n    assert.deepEqual( result,[1,2,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.selectMany custom function\", function( assert ) {\n    const result = Enumerable.from([[1,2],[2,3,4]]).selectMany(item=>[item.length]).toArray();\n    assert.deepEqual( result,[2,3], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.sequenceEqual true\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).sequenceEqual([1,2,3]);\n    assert.deepEqual( result,true, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.sequenceEqual false shorter\", function( assert ) {\n    const result = Enumerable.from([1,2]).sequenceEqual([1,2,3]);\n    assert.deepEqual( result,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.sequenceEqual false shorter 2\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).sequenceEqual([1,2]);\n    assert.deepEqual( result,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.sequenceEqual false out of order\", function( assert ) {\n    const result = Enumerable.from([1,3,2]).sequenceEqual([1,2,3]);\n    assert.deepEqual( result,false, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.single true\", function( assert ) {\n    const result = Enumerable.from([11]).single();\n    assert.deepEqual( result,11, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.single empty throws\", function( assert ) {\n    assert.throws( ()=>Enumerable.empty().single(), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.single multiple throws\", function( assert ) {\n    assert.throws( ()=>Enumerable.from([1,2]).single(), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.singleOrDefault true\", function( assert ) {\n    const result = Enumerable.from([11]).singleOrDefault();\n    assert.deepEqual( result,11, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.singleOrDefault empty\", function( assert ) {\n    const result = Enumerable.from([]).singleOrDefault();\n    assert.deepEqual( result,undefined, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.singleOrDefault multiple throws\", function( assert ) {\n    assert.throws( ()=>Enumerable.from([1,2]).singleOrDefault(), \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.skip\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).skip(2).toArray();\n    assert.deepEqual( result,[3,4,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.skipLast\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).skipLast(2).toArray();\n    assert.deepEqual( result,[1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.skipWhile\", function( assert ) {\n    const result = Enumerable.from([1,2,3,2,1]).skipWhile(item=>item<3).toArray();\n    assert.deepEqual( result,[3,2,1], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.slice empty\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice().toArray();\n    assert.deepEqual( result,arr.slice(), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.slice positive\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice(2).toArray();\n    assert.deepEqual( result,arr.slice(2), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.slice positive positive\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice(2,4).toArray();\n    assert.deepEqual( result,arr.slice(2,4), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.slice negative\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice(-2).toArray();\n    assert.deepEqual( result,arr.slice(-2), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.slice negative positive\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice(-2,4).toArray();\n    assert.deepEqual( result,arr.slice(-2,4), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.slice negative positive 2\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice(-4,2).toArray();\n    assert.deepEqual( result,arr.slice(-4,2), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.slice negative negative\", function( assert ) {\n    const arr=[1,2,3,4,5];\n    const result = Enumerable.from(arr).slice(-4,-1).toArray();\n    assert.deepEqual( result,arr.slice(-4,-1), \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.sum numbers\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).sum();\n    assert.deepEqual( result,15, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.sum numbers with some strings\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,'6']).sum();\n    assert.deepEqual( result,Number.NaN, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.take\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).take(2).toArray();\n    assert.deepEqual( result,[1,2], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.takeLast array\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).takeLast(2).toArray();\n    assert.deepEqual( result,[4,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.takeLast generator\", function( assert ) {\n    function* gen() {\n        yield 1;\n        yield 2;\n        yield 3;\n        yield 4;\n        yield 5;\n    }\n    const result = Enumerable.from(gen()).takeLast(2).toArray();\n    assert.deepEqual( result,[4,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.takeWhile\", function( assert ) {\n    const result = Enumerable.from([1,2,3,2,1]).takeWhile(item=>item<3).toArray();\n    assert.deepEqual( result,[1,2], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.toMap\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).toMap(item=>item,item=>item*item);\n    assert.deepEqual( result,new Map([[1,1],[2,4],[3,9],[4,16],[5,25]]), \"Passed!\" );\n});\nQUnit.test( \"Enumerable.toObject\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).toObject(item=>'k'+item);\n    assert.deepEqual( result,{k1:1,k2:2,k3:3,k4:4,k5:5}, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.toSet\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).toSet();\n    assert.deepEqual( result,new Set([1,2,3,4,5]), \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.union\", function( assert ) {\n    const result = Enumerable.from([1,1,2]).union([3,2]).toArray();\n    assert.deepEqual( result,[1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.union equality comparer\", function( assert ) {\n    const result = Enumerable.from([11,12,26]).union([31,23],(i1,i2)=>(i1+'').charAt(0)===(i2+'').charAt(0)).toArray();\n    assert.deepEqual( result,[11,26,31], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.where\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5]).where(item=>item%2).toArray();\n    assert.deepEqual( result,[1,3,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.where with index\", function( assert ) {\n    const idxs=[];\n    const result = Enumerable.from([1,2,3,4,5]).where((item,index)=>{\n        idxs.push(index);\n        return item%2;\n    }).toArray();\n    assert.deepEqual( result,[1,3,5], \"Passed!\" );\n    assert.deepEqual( idxs,[0,1,2,3,4], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.zip\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4]).zip(['a','b','c'],(i1,i2)=>i2+' '+i1).toArray();\n    assert.deepEqual( result,['a 1','b 2','c 3'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.zip with index\", function( assert ) {\n    const idxs=[];\n    const result = Enumerable.from([1,2,3,4]).zip(['a','b','c'],(i1,i2,index)=>{\n        idxs.push(index);\n        return i2+' '+i1;\n    }).toArray();\n    assert.deepEqual( result,['a 1','b 2','c 3'], \"Passed!\" );\n    assert.deepEqual( idxs,[0, 1, 2], \"Passed!\" );\n});\n\n// OrderedEnumerable tests\nQUnit.module('OrderedEnumerable tests');\n\nQUnit.test( \"OrderedEnumerable.thenBy\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4]).orderBy(i=>i%2==0).thenBy(i=>-i).toArray();\n    assert.deepEqual( result,[3,1,4,2], \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable.thenByDescending\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4]).orderByDescending(i=>i%2==0).thenByDescending(i=>-i).toArray();\n    assert.deepEqual( result,[2,4,1,3], \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable.thenByDescending and thenBy and select QuickSort\", function( assert ) {\n    let result = Enumerable.from(['a1','a2','a3','b1','b2','c1','c3'])\n                    .useQuickSort()\n                    .orderBy(i=>0)\n                    .thenByDescending(i=>i.charAt(1))\n                    .thenBy(i=>i.charAt(0)=='b')\n                    .select(i=>'x'+i)\n                    .toArray();\n    //assert.deepEqual( result,['xa3','xc3','xa2','xb2','xc1','xa1','xb1'], \"Passed!\" );\n    assert.deepEqual( result.map(i=>i.charAt(2)),['3','3','2','2','1','1','1'], \"Passed!\" );\n    assert.deepEqual( result[3].charAt(1),'b', \"Passed!\" );\n    assert.deepEqual( result[6].charAt(1),'b', \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable.thenByDescending and thenBy and select default sort\", function( assert ) {\n    const result = Enumerable.from(['a1','a2','a3','b1','b2','c1','c3'])\n                    .useBrowserSort()\n                    .orderBy(i=>0)\n                    .thenByDescending(i=>i.charAt(1))\n                    .thenBy(i=>i.charAt(0)=='b')\n                    .select(i=>'x'+i)\n                    .toArray();\n    assert.deepEqual( result,['xa3','xc3','xa2','xb2','xa1','xc1','xb1'], \"Passed!\" );\n});\n\nQUnit.test( \"OrderedEnumerable then take\", function( assert ) {\n    const result = Enumerable.from([3,2,1,4]).orderBy().take(2).toArray();\n    assert.deepEqual( result,[1,2], \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable then skip\", function( assert ) {\n    const result = Enumerable.from([3,2,1,4]).orderBy().skip(2).toArray();\n    assert.deepEqual( result,[3,4], \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable then takeLast\", function( assert ) {\n    const result = Enumerable.from([3,2,1,4]).orderBy().takeLast(2).toArray();\n    assert.deepEqual( result,[3,4], \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable then skipLast\", function( assert ) {\n    const result = Enumerable.from([3,2,1,4]).orderBy().take(2).toArray();\n    assert.deepEqual( result,[1,2], \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable with multiple restrictions\", function( assert ) {\n    const result = Enumerable.from([3,2,1,4,6,5,9,8,7,0]).orderBy().skip(2).take(7).skipLast(3).takeLast(2);\n    assert.deepEqual(result._wasIterated,false,\"Passed!\");\n    const arr = result.toArray();\n    assert.deepEqual( arr,[4,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.sort in place\", function( assert ) {\n    const arr = [1,2,3,4];\n    const result = Enumerable.sort(arr, i=>i%2==1);\n    assert.deepEqual( arr, result, \"Passed!\" );\n    assert.deepEqual( arr.map(i=>i%2),[0,0,1,1], \"Passed!\" );\n});\n\n\n// repeat tests\nQUnit.module('repeat tests');\n\nQUnit.test( \"Enumerable.range repeat\", function( assert ) {\n    const result = Enumerable.range(1,3);\n    assert.deepEqual( Array.from(result),[1,2,3], \"Passed!\" );\n    assert.deepEqual( Array.from(result),[1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.take repeat\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,6,7,8,9]).take(3);\n    assert.deepEqual( Array.from(result),[1,2,3], \"Passed!\" );\n    assert.deepEqual( Array.from(result),[1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.take repeat\", function( assert ) {\n    const result = Enumerable.from([3,2,1]).reverse();\n    assert.deepEqual( Array.from(result),[1,2,3], \"Passed!\" );\n    assert.deepEqual( Array.from(result),[1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.take orderBy\", function( assert ) {\n    const result = Enumerable.from([2,4,5,3,1]).orderBy();\n    assert.deepEqual( Array.from(result),[1,2,3,4,5], \"Passed!\" );\n    assert.deepEqual( Array.from(result),[1,2,3,4,5], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.take orderBy take\", function( assert ) {\n    const result = Enumerable.from([2,4,5,3,1]).orderBy().skip(1).take(3);\n    assert.deepEqual( Array.from(result),[2,3,4], \"Passed!\" );\n    assert.deepEqual( Array.from(result),[2,3,4], \"Passed!\" );\n});\n\n\n// composable count tests\nQUnit.module('composable count tests');\n\nQUnit.test( \"Enumerable.empty count\", function( assert ) {\n    const result = Enumerable.empty();\n    assert.deepEqual( result.elementAtOrDefault(1), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.repeat count\", function( assert ) {\n    const result = Enumerable.repeat(100,1000000000);\n    assert.deepEqual( result.elementAtOrDefault(12345), 100, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.range count\", function( assert ) {\n    const result = Enumerable.range(100,1000000000);\n    assert.deepEqual( result.elementAtOrDefault(12345), 12445, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.concat seekable count \", function( assert ) {\n    const result = Enumerable.range(100,10000).concat(Enumerable.repeat(10,20000));\n    assert.deepEqual( result.count(), 30000, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.concat unseekable count\", function( assert ) {\n    const iterable = Enumerable.from(function*(){ yield 1; })\n    const result = Enumerable.range(100,10000).concat(iterable);\n    assert.deepEqual( result.count(), 10001, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n    assert.deepEqual( iterable._wasIterated, true, \"Passed!\" );\n});\nQUnit.test( \"orderBy count\", function( assert ) {\n    const result = Enumerable.range(100,10000).orderBy(i=>i+1);\n    assert.deepEqual( result.count(), 10000, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"reverse count\", function( assert ) {\n    const result = Enumerable.range(100,10000).reverse();\n    assert.deepEqual( result.count(), 10000, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"skip count\", function( assert ) {\n    const result = Enumerable.range(100,10000).skip(5);\n    assert.deepEqual( result.count(), 9995, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"skipLast count\", function( assert ) {\n    const result = Enumerable.range(100,10000).skipLast(5);\n    assert.deepEqual( result.count(), 9995, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"take count\", function( assert ) {\n    const result = Enumerable.range(100,10000).take(5);\n    assert.deepEqual( result.count(), 5, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"takeLast count\", function( assert ) {\n    const result = Enumerable.range(100,10000).takeLast(5);\n    assert.deepEqual( result.count(), 5, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"OrderedEnumerable with multiple restrictions count\", function( assert ) {\n    let result = Enumerable.from([3,2,1,4,6,5,9,8,7,0]).orderBy();\n    assert.deepEqual(result._wasIterated,false,\"Passed!\");\n    assert.deepEqual(result.count(),10,\"Passed!\");\n    assert.deepEqual(result._wasIterated,false,\"Passed!\");\n    result = result.skip(2).take(7).skipLast(3).takeLast(2);\n    assert.deepEqual(result._wasIterated,false,\"Passed!\");\n    assert.deepEqual(result.count(),2,\"Passed!\");\n    assert.deepEqual(result._wasIterated,false,\"Passed!\");\n});\n\n// seek tests\nQUnit.module('seek tests');\nQUnit.test( \"Enumerable.empty seek\", function( assert ) {\n    const result = Enumerable.empty();\n    assert.deepEqual( result.count(), 0, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.range seek\", function( assert ) {\n    const result = Enumerable.range(0,100000);\n    assert.deepEqual( result.count(), 100000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 10000, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.repeat seek\", function( assert ) {\n    const result = Enumerable.repeat(123,100000);\n    assert.deepEqual( result.count(), 100000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 123, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"append seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).append(666666);\n    assert.deepEqual( result.count(), 100001, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(100000), 666666, \"Passed!\" );\n    assert.deepEqual( result.first(), 0, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"concat array seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).concat([0,1,2,3,4,5]);\n    assert.deepEqual( result.count(), 100006, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(100004), 4, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"concat Enumerable seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).concat(Enumerable.range(0,6));\n    assert.deepEqual( result.count(), 100006, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(100004), 4, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"prepend seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).prepend(666666);\n    assert.deepEqual( result.count(), 100001, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(100000), 99999, \"Passed!\" );\n    assert.deepEqual( result.first(), 666666, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"reverse seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).reverse();\n    assert.deepEqual( result.count(), 100000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 89999, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"select seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).select(i=>'a'+i);\n    assert.deepEqual( result.count(), 100000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 'a10000', \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(1000000), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"skip seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).skip(50000);\n    assert.deepEqual( result.count(), 50000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 60000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(1000000), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"skipLast seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).skipLast(50000);\n    assert.deepEqual( result.count(), 50000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 10000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(50000), undefined, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(1000000), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"take seek\", function( assert ) {\n    const result = Enumerable.range(0,100000).take(50000);\n    assert.deepEqual( result.count(), 50000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 10000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(50000), undefined, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(1000000), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\nQUnit.test( \"skip takeLast\", function( assert ) {\n    const result = Enumerable.range(0,100000).takeLast(50000);\n    assert.deepEqual( result.count(), 50000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(10000), 60000, \"Passed!\" );\n    assert.deepEqual( result.elementAtOrDefault(1000000), undefined, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\n\n\n// Extra features\nQUnit.module('Extra features');\n\nQUnit.test( \"Enumerable.shuffle\", function( assert ) {\n    const result = Enumerable.range(1,10).shuffle();\n    assert.deepEqual(result._wasIterated, false,'Passed!');\n    let arr = result.toArray();\n    assert.deepEqual(result._wasIterated, true,'Passed!');\n    assert.notDeepEqual(arr, Enumerable.range(1,10).toArray(),'Passed!');\n    arr = result.toArray().sort((i1,i2)=>i1-i2);\n    assert.deepEqual(arr, Enumerable.range(1,10).toArray(),'Passed!');\n});\nQUnit.test( \"shuffle count\", function( assert ) {\n    const result = Enumerable.range(100,10000).shuffle();\n    assert.deepEqual( result.count(), 10000, \"Passed!\" );\n    assert.deepEqual( result._wasIterated, false, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.randomSample canSeek\", function( assert ) {\n    const result = Enumerable.range(1,100000).randomSample(100);\n    const avg = Math.round(result.average());\n    assert.deepEqual(result.count(),100,\"Sample average is \"+avg+\" and it should be close to 50000\");\n});\nQUnit.test( \"Enumerable.randomSample no canSeek\", function( assert ) {\n    const result = Enumerable.from(function*() {\n        for (let i=0; i<100000; i++)\n            yield i;\n    }).randomSample(100);\n    const avg = Math.round(result.average());\n    assert.deepEqual(result.count(),100,\"Sample average is \"+avg+\" and it should be close to 50000\");\n});\nQUnit.test( \"Enumerable.randomSample no canSeek limit\", function( assert ) {\n    const result = Enumerable.from(function*() {\n        let i=0;\n        while (true) {\n            yield i;\n            if (i>100000) {\n                throw Error('It should never go above the limit of 100000')\n            }\n            i++;\n        }\n    }).randomSample(100,100000);\n    const avg = Math.round(result.average());\n    assert.deepEqual(result.count(),100,\"Sample average is \"+avg+\" and it should be close to 50000\");\n});\n\nQUnit.test( \"Enumerable.binarySearch\", function( assert ) {\n    const result = Enumerable.range(1,10).select(i=>i*10).orderBy();\n    assert.deepEqual(result._wasIterated, false,'Passed!');\n    let index = result.binarySearch(80);\n    assert.deepEqual(result._wasIterated, false,'Passed!');\n    assert.deepEqual(index, 7,'Passed!');\n    index = result.binarySearch(45);\n    assert.deepEqual(index, false,'Passed!');\n});\n\nQUnit.test( \"Enumerable.distinctByHash\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).distinctByHash(i=>+i).toArray();\n    assert.deepEqual( result,[1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.exceptByHash\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).exceptByHash([2,3],i=>+i).toArray();\n    assert.deepEqual( result,[1], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.intersectByHash\", function( assert ) {\n    const result = Enumerable.from([1,2,2,3,'3']).intersectByHash([2,3],i=>+i).toArray();\n    assert.deepEqual( result,[2,2,3,'3'], \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.lag canSeek\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,6]).lag(1,(i1,i2)=>i1+''+i2).toArray();\n    assert.deepEqual( result,['1undefined','21','32','43','54','65'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lead canSeek\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,6]).lead(1,(i1,i2)=>i1+''+i2).toArray();\n    assert.deepEqual( result,['12','23','34','45','56','6undefined'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lag no canSeek\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3,4,5,6]) yield item; }).lag(1,(i1,i2)=>i1+''+i2).toArray();\n    assert.deepEqual( result,['1undefined','21','32','43','54','65'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lead no canSeek\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3,4,5,6]) yield item; }).lead(1,(i1,i2)=>i1+''+i2).toArray();\n    assert.deepEqual( result,['12','23','34','45','56','6undefined'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lag no canSeek 2\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3,4,5,6]) yield item; }).lag(2,(i1,i2)=>i1+''+i2).toArray();\n    assert.deepEqual( result,['1undefined','2undefined','31','42','53','64'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lead no canSeek 2\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3,4,5,6]) yield item; }).lead(2,(i1,i2)=>i1+''+i2).toArray();\n    assert.deepEqual( result,['13','24','35','46','5undefined','6undefined'], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lag canSeek count\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,6]).lag(1,(i1,i2)=>i1+''+i2);\n    assert.deepEqual( result.count(),6, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lead canSeek count\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,6]).lead(1,(i1,i2)=>i1+''+i2);\n    assert.deepEqual( result.count(),6, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lag no canSeek count\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3,4,5,6]) yield item; }).lag(1,(i1,i2)=>i1+''+i2);\n    assert.deepEqual( result.count(),6, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,true, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lag canSeek elementAt\", function( assert ) {\n    const result = Enumerable.from([1,2,3,4,5,6]).lag(1,(i1,i2)=>i1+''+i2);\n    assert.deepEqual( result.elementAt(1),'21', \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.lag no canSeek count\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3,4,5,6]) yield item; }).lag(1,(i1,i2)=>i1+''+i2);\n    assert.deepEqual( result.elementAt(1),'21', \"Passed!\" );\n    assert.deepEqual( result._wasIterated,true, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.padEnd canSeek value\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padEnd(5,16).toArray();\n    assert.deepEqual( result,[1,2,3,16,16], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padEnd canSeek func\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padEnd(5,i=>i+11).toArray();\n    assert.deepEqual( result,[1,2,3,14,15], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padEnd canSeek func count\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padEnd(5,i=>i+11);\n    assert.deepEqual( result.count(),5, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padEnd canSeek func elementAt\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padEnd(5,i=>i+11);\n    assert.deepEqual( result.elementAt(4),15, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padEnd no canSeek func elementAt\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3]) yield item; }).padEnd(5,i=>i+11);\n    assert.deepEqual( result.elementAt(4),15, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,true, \"Passed!\" );\n});\n\nQUnit.test( \"Enumerable.padStart canSeek value\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padStart(5,16).toArray();\n    assert.deepEqual( result,[16,16,1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padStart canSeek func\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padStart(5,i=>i+11).toArray();\n    assert.deepEqual( result,[11,12,1,2,3], \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padStart canSeek func count\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padStart(5,i=>i+11);\n    assert.deepEqual( result.count(),5, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padStart canSeek func elementAt\", function( assert ) {\n    const result = Enumerable.from([1,2,3]).padStart(5,i=>i+11);\n    assert.deepEqual( result.elementAt(4),3, \"Passed!\" );\n    assert.deepEqual( result.elementAt(1),12, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,false, \"Passed!\" );\n});\nQUnit.test( \"Enumerable.padStart no canSeek func elementAt\", function( assert ) {\n    const result = Enumerable.from(function*() { for (const item of [1,2,3]) yield item; }).padStart(5,i=>i+11);\n    assert.deepEqual( result.elementAt(4),3, \"Passed!\" );\n    assert.deepEqual( result.elementAt(1),12, \"Passed!\" );\n    assert.deepEqual( result._wasIterated,true, \"Passed!\" );\n});\n\nQUnit.test( \"GitHub issue #22\", function( assert ) {\n    const result = Enumerable.from([{ a: [1,2] }, { a: [2,3,4] }]).selectMany(x => x.a).toArray();\n    assert.deepEqual( result,[1,2,2,3,4], \"Passed!\" );\n});\n"
  },
  {
    "path": "tests.performance.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width\">\n  <title>Performance tests for LInQer</title>\n  <link rel=\"stylesheet\" href=\"qunit/qunit-2.9.2.css\">\n  <script src=\"LInQer.js\"></script>\n  <script src=\"LInQer.extra.js\"></script>\n</head>\n<body>\n  <div id=\"qunit\"></div>\n  <div id=\"qunit-fixture\"></div>\n  <script src=\"qunit/qunit-2.9.2.js\"></script>\n  <script src=\"tests.performance.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "tests.performance.js",
    "content": "Enumerable = Linqer.Enumerable;\nconst largeNumber = 10000000;\n\n// performance tests\nQUnit.module('performance tests');\n\nQUnit.test( \"Use only items that are required - standard\", function( assert ) {\n    const largeArray = Array(largeNumber).fill(10);\n    const startTime = performance.now();\n    const someCalculation = largeArray.filter(x=>x===10).map(x=>'v'+x).slice(100,110);\n    Array.from(someCalculation);\n    const endTime = performance.now();\n    assert.ok(true,'Standard array use took '+(endTime-startTime)+'milliseconds');\n});\n\nQUnit.test( \"Use only items that are required - Enumerable\", function( assert ) {\n    const largeArray = Array(largeNumber).fill(10);\n    const startTime = performance.now();\n    const someCalculation = Enumerable.from(largeArray).where(x=>x===10).select(x=>'v'+x).skip(100).take(10).toArray();\n    Array.from(someCalculation);\n    const endTime = performance.now();\n    assert.ok(true,'Enumerable use took '+(endTime-startTime)+'milliseconds');\n});\n\nQUnit.test( \"OrderBy performance random\", function( assert ) {\n    const size = largeNumber;\n    const largeArray1 = Enumerable.range(1,size).shuffle().toArray();\n\n    let startTime = performance.now();\n    const result1 = Array.from(largeArray1).sort((i1,i2)=>i2-i1);\n    let endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using Array.from then .sort took '+(endTime-startTime)+' milliseconds');\n\n    startTime = performance.now();\n    const result2 = Enumerable.from(largeArray1).orderBy(i=>size-i).useBrowserSort().toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using browser sort internally took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result2[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result2[i]);\n            break;\n        }\n    }\n\n    startTime = performance.now();\n    const result3 = Enumerable.from(largeArray1).orderBy(i=>size-i).useQuickSort().toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using QuickSort took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result3[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result3[i]);\n            break;\n        }\n    }\n});\n\nQUnit.test( \"OrderBy performance already ordered\", function( assert ) {\n    const size = largeNumber;\n    const largeArray1 = Enumerable.range(1,size).toArray();\n\n    let startTime = performance.now();\n    const result1 = Array.from(largeArray1).sort((i1,i2)=>i2-i1);\n    let endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using Array.from then .sort took '+(endTime-startTime)+' milliseconds');\n\n    startTime = performance.now();\n    const result2 = Enumerable.from(largeArray1).orderBy(i=>size-i).useBrowserSort().toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using browser sort internally took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result2[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result2[i]);\n            break;\n        }\n    }\n\n    startTime = performance.now();\n    const result3 = Enumerable.from(largeArray1).orderBy(i=>size-i).useQuickSort().toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using QuickSort took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result3[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result3[i]);\n            break;\n        }\n    }\n});\n\nQUnit.test( \"OrderBy performance same value\", function( assert ) {\n    const size = largeNumber;\n    const largeArray1 = Enumerable.repeat(1,size).toArray();\n\n    let startTime = performance.now();\n    const result1 = Array.from(largeArray1).sort((i1,i2)=>i2-i1);\n    let endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using Array.from then .sort took '+(endTime-startTime)+' milliseconds');\n\n    startTime = performance.now();\n    const result2 = Enumerable.from(largeArray1).orderBy(i=>size-i).useBrowserSort().toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using browser sort internally took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result2[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result2[i]);\n            break;\n        }\n    }\n\n    startTime = performance.now();\n    const result3 = Enumerable.from(largeArray1).orderBy(i=>size-i).useQuickSort().toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items using QuickSort took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result3[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result3[i]);\n            break;\n        }\n    }\n});\n\nQUnit.test( \"OrderBy take performance random\", function( assert ) {\n    const size = largeNumber;\n    const largeArray1 = Enumerable.range(1,size).shuffle().toArray();\n    const largeArray2 = Array.from(largeArray1);\n\n    let startTime = performance.now();\n    let result1 = Enumerable.from(largeArray1.sort((i1,i2)=>i2-i1)).skip(100000).take(10000).toArray();\n    let endTime = performance.now();\n    assert.ok(true,'Order '+size+' items skip and take using .sort took '+(endTime-startTime)+' milliseconds');\n\n    startTime = performance.now();\n    let result2 = Enumerable.from(largeArray2).orderBy(i=>size-i).skip(100000).take(10000).toArray();\n    endTime = performance.now();\n    assert.ok(true,'Order '+size+' items skip and take using QuickSort took '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result2[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result2[i]);\n            break;\n        }\n    }\n});\n\nQUnit.test( \"sort in place performance random\", function( assert ) {\n    const size = largeNumber;\n    const largeArray1 = Enumerable.range(1,size).shuffle().toArray();\n    const largeArray2 = Array.from(largeArray1);\n\n    let startTime = performance.now();\n    const result1 = largeArray1.sort(Linqer._defaultComparer);\n    let endTime = performance.now();\n    assert.ok(true,'Sort inline '+size+' items using Array.sort took '+(endTime-startTime)+' milliseconds');\n\n    startTime = performance.now();\n    const result2 = Enumerable.sort(largeArray2);\n    endTime = performance.now();\n    assert.ok(true,'Sort inline '+size+' items using QuickSort '+(endTime-startTime)+' milliseconds');\n\n    for (let i=0; i<size; i++) {\n        if (result1[i]!=result2[i]) {\n            assert.ok(false,'Arrays are not the same at index '+i+': '+result1[i]+' != '+result2[i]);\n            break;\n        }\n    }\n});\n"
  },
  {
    "path": "tests.slim.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width\">\n  <title>Unit tests for LInQer (Slim)</title>\n  <link rel=\"stylesheet\" href=\"qunit/qunit-2.9.2.css\">\n  <script src=\"LInQer.slim.js\"></script>\n</head>\n<body>\n  <div id=\"qunit\"></div>\n  <div id=\"qunit-fixture\"></div>\n  <script src=\"qunit/qunit-2.9.2.js\"></script>\n  <script src=\"tests.slim.js\"></script>\n</body>\n</html>"
  },
  {
    "path": "tests.slim.js",
    "content": "Enumerable = Linqer.Enumerable;\n\n// object and method tests\nQUnit.module('object and method tests');\n\nQUnit.test(\"Enumerable.from with empty array\", function (assert) {\n    const enumerable = Enumerable.from([]);\n    const result = [];\n    for (const item of enumerable) result.push(item);\n\n    assert.deepEqual(result, [], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.from with non empty array\", function (assert) {\n    const enumerable = Enumerable.from([1, 'a2', 3, null]);\n    const result = [];\n    for (const item of enumerable) result.push(item);\n\n    assert.deepEqual(result, [1, 'a2', 3, null], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.from with generator function\", function (assert) {\n    function* gen() {\n        yield 1;\n        yield 'a2';\n        yield 3;\n        yield null;\n    }\n    const enumerable = Enumerable.from(gen());\n    const result = [];\n    for (const item of enumerable) result.push(item);\n\n    assert.deepEqual(result, [1, 'a2', 3, null], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.concat\", function (assert) {\n    const result = Enumerable.from([1, 'xx2', 5]).concat([6, 7, 8]).toArray();\n    assert.deepEqual(result, [1, 'xx2', 5, 6, 7, 8], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.count array\", function (assert) {\n    const result = Enumerable.from([1, 'xx2', 5]).count();\n    assert.deepEqual(result, 3, \"Passed!\");\n});\nQUnit.test(\"Enumerable.count Map\", function (assert) {\n    const map = new Map();\n    map.set(1, 2);\n    map.set('a', '3');\n    const result = Enumerable.from(map).count();\n    assert.deepEqual(result, 2, \"Passed!\");\n});\nQUnit.test(\"Enumerable.count Set\", function (assert) {\n    const result = Enumerable.from(new Set().add(1).add(2).add(3).add(4)).count();\n    assert.deepEqual(result, 4, \"Passed!\");\n});\nQUnit.test(\"Enumerable.count generator function\", function (assert) {\n    function* gen() {\n        yield 'a';\n        yield 1;\n    }\n    const result = Enumerable.from(gen()).count();\n    assert.deepEqual(result, 2, \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.distinct\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).distinct().toArray();\n    assert.deepEqual(result, [1, 2, 3, '3'], \"Passed!\");\n});\nQUnit.test(\"Enumerable.distinct equality comparer\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).distinct((i1, i2) => +(i1) === +(i2)).toArray();\n    assert.deepEqual(result, [1, 2, 3], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.elementAt in range array\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).elementAt(3);\n    assert.deepEqual(result, 3, \"Passed!\");\n});\nQUnit.test(\"Enumerable.elementAt below range array\", function (assert) {\n    assert.throws(() => Enumerable.from([1, 2, 2, 3, '3']).elementAt(-3), \"Passed!\");\n});\nQUnit.test(\"Enumerable.elementAt above range array\", function (assert) {\n    assert.throws(() => Enumerable.from([1, 2, 2, 3, '3']).elementAt(30), \"Passed!\");\n});\nQUnit.test(\"Enumerable.elementAtOrDefault in range array\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).elementAtOrDefault(3);\n    assert.deepEqual(result, 3, \"Passed!\");\n});\nQUnit.test(\"Enumerable.elementAtOrDefault below range array\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).elementAtOrDefault(-3);\n    assert.deepEqual(result, undefined, \"Passed!\");\n});\nQUnit.test(\"Enumerable.elementAtOrDefault above range array\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).elementAtOrDefault(30);\n    assert.deepEqual(result, undefined, \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.first\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).first();\n    assert.deepEqual(result, 1, \"Passed!\");\n});\nQUnit.test(\"Enumerable.first empty\", function (assert) {\n    assert.throws(() => Enumerable.from([]).first(), \"Passed!\");\n});\nQUnit.test(\"Enumerable.firstOrDefault\", function (assert) {\n    const result = Enumerable.from([]).firstOrDefault();\n    assert.deepEqual(result, undefined, \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.last\", function (assert) {\n    const result = Enumerable.from([1, 2, 2, 3, '3']).last();\n    assert.deepEqual(result, '3', \"Passed!\");\n});\nQUnit.test(\"Enumerable.last empty\", function (assert) {\n    assert.throws(() => Enumerable.from([]).last(), \"Passed!\");\n});\nQUnit.test(\"Enumerable.lastOrDefault\", function (assert) {\n    const result = Enumerable.from([]).lastOrDefault();\n    assert.deepEqual(result, undefined, \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.max numbers\", function (assert) {\n    const result = Enumerable.from([3, 5, 1, 2, 56, 2, -100, 43]).max();\n    assert.deepEqual(result, 56, \"Passed!\");\n});\nQUnit.test(\"Enumerable.max strings\", function (assert) {\n    const result = Enumerable.from(['ba', 'a', 'abba', 'aaa', 'bb']).max();\n    assert.deepEqual(result, 'bb', \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.min number\", function (assert) {\n    const result = Enumerable.from([3, 5, 1, 2, 56, 2, -100, 43]).min();\n    assert.deepEqual(result, -100, \"Passed!\");\n});\nQUnit.test(\"Enumerable.min custom comparer\", function (assert) {\n    const result = Enumerable.from([3, 5, 1, 2, 56, 2, -100, 43]).min((i1, i2) => i1.toString().length - i2.toString().length);\n    assert.deepEqual(result, 3, \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.select\", function (assert) {\n    const result = Enumerable.from(['a', 1, 3, 2]).select(item => Number.isInteger(item) ? item * item : item + '^2').toArray();\n    assert.deepEqual(result, ['a^2', 1, 9, 4], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.skip\", function (assert) {\n    const result = Enumerable.from([1, 2, 3, 4, 5]).skip(2).toArray();\n    assert.deepEqual(result, [3, 4, 5], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.sum numbers\", function (assert) {\n    const result = Enumerable.from([1, 2, 3, 4, 5]).sum();\n    assert.deepEqual(result, 15, \"Passed!\");\n});\nQUnit.test(\"Enumerable.sum numbers with some strings\", function (assert) {\n    const result = Enumerable.from([1, 2, 3, 4, 5, '6']).sum();\n    assert.deepEqual(result, Number.NaN, \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.take\", function (assert) {\n    const result = Enumerable.from([1, 2, 3, 4, 5]).take(2).toArray();\n    assert.deepEqual(result, [1, 2], \"Passed!\");\n});\n\nQUnit.test(\"Enumerable.where\", function (assert) {\n    const result = Enumerable.from([1, 2, 3, 4, 5]).where(item => item % 2).toArray();\n    assert.deepEqual(result, [1, 3, 5], \"Passed!\");\n});\nQUnit.test(\"Enumerable.where with index\", function (assert) {\n    const idxs = [];\n    const result = Enumerable.from([1, 2, 3, 4, 5]).where((item, index) => {\n        idxs.push(index);\n        return item % 2;\n    }).toArray();\n    assert.deepEqual(result, [1, 3, 5], \"Passed!\");\n    assert.deepEqual(idxs, [0, 1, 2, 3, 4], \"Passed!\");\n});\n\n\n// composable count tests\nQUnit.module('composable count tests');\n\nQUnit.test(\"Enumerable.concat seekable count \", function (assert) {\n    const result = Enumerable.range(100, 10000).concat(Enumerable.range(10, 20000));\n    assert.deepEqual(result.count(), 30000, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"Enumerable.concat unseekable count\", function (assert) {\n    const iterable = Enumerable.from(function* () { yield 1; })\n    const result = Enumerable.range(100, 10000).concat(iterable);\n    assert.deepEqual(result.count(), 10001, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n    assert.deepEqual(iterable._wasIterated, true, \"Passed!\");\n});\nQUnit.test(\"skip count\", function (assert) {\n    const result = Enumerable.range(100, 10000).skip(5);\n    assert.deepEqual(result.count(), 9995, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"take count\", function (assert) {\n    const result = Enumerable.range(100, 10000).take(5);\n    assert.deepEqual(result.count(), 5, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\n\n// seek tests\nQUnit.module('seek tests');\nQUnit.test(\"Enumerable.empty seek\", function (assert) {\n    const result = Enumerable.from([]);\n    assert.deepEqual(result.count(), 0, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(10000), undefined, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"concat array seek\", function (assert) {\n    const result = Enumerable.range(0, 100000).concat([0, 1, 2, 3, 4, 5]);\n    assert.deepEqual(result.count(), 100006, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(100004), 4, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"concat Enumerable seek\", function (assert) {\n    const result = Enumerable.range(0, 100000).concat(Enumerable.range(0, 6));\n    assert.deepEqual(result.count(), 100006, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(100004), 4, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"select seek\", function (assert) {\n    const result = Enumerable.range(0, 100000).select(i => 'a' + i);\n    assert.deepEqual(result.count(), 100000, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(10000), 'a10000', \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(1000000), undefined, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"skip seek\", function (assert) {\n    const result = Enumerable.range(0, 100000).skip(50000);\n    assert.deepEqual(result.count(), 50000, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(10000), 60000, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(1000000), undefined, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\nQUnit.test(\"take seek\", function (assert) {\n    const result = Enumerable.range(0, 100000).take(50000);\n    assert.deepEqual(result.count(), 50000, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(10000), 10000, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(50000), undefined, \"Passed!\");\n    assert.deepEqual(result.elementAtOrDefault(1000000), undefined, \"Passed!\");\n    assert.deepEqual(result._wasIterated, false, \"Passed!\");\n});\n"
  },
  {
    "path": "tsconfig.all.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Basic Options */\n    // \"incremental\": true,                   /* Enable incremental compilation */\n    \"target\": \"es6\",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */\n    \"module\": \"system\",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */\n    // \"lib\": [],                             /* Specify library files to be included in the compilation. */\n    // \"allowJs\": true,                       /* Allow javascript files to be compiled. */\n    // \"checkJs\": true,                       /* Report errors in .js files. */\n    // \"jsx\": \"preserve\",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */\n    \"declaration\": true,                   /* Generates corresponding '.d.ts' file. */\n    // \"declarationMap\": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */\n    // \"sourceMap\": true,                     /* Generates corresponding '.map' file. */\n    \"outFile\": \"./LInQer.all.js\",                       /* Concatenate and emit output to single file. */\n    // \"outDir\": \"./\",                        /* Redirect output structure to the directory. */\n    // \"rootDir\": \"./\",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */\n    // \"composite\": true,                     /* Enable project compilation */\n    // \"tsBuildInfoFile\": \"./\",               /* Specify file to store incremental compilation information */\n    // \"removeComments\": true,                /* Do not emit comments to output. */\n    // \"noEmit\": true,                        /* Do not emit outputs. */\n    // \"importHelpers\": true,                 /* Import emit helpers from 'tslib'. */\n    // \"downlevelIteration\": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */\n    // \"isolatedModules\": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */\n\n    /* Strict Type-Checking Options */\n    \"strict\": true,                           /* Enable all strict type-checking options. */\n    \"noImplicitAny\": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */\n    \"strictNullChecks\": true,              /* Enable strict null checks. */\n    \"strictFunctionTypes\": true,           /* Enable strict checking of function types. */\n    \"strictBindCallApply\": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */\n    \"strictPropertyInitialization\": true,  /* Enable strict checking of property initialization in classes. */\n    \"noImplicitThis\": true,                /* Raise error on 'this' expressions with an implied 'any' type. */\n    \"alwaysStrict\": true,                  /* Parse in strict mode and emit \"use strict\" for each source file. */\n\n    /* Additional Checks */\n    // \"noUnusedLocals\": true,                /* Report errors on unused locals. */\n    // \"noUnusedParameters\": true,            /* Report errors on unused parameters. */\n    // \"noImplicitReturns\": true,             /* Report error when not all code paths in function return a value. */\n    // \"noFallthroughCasesInSwitch\": true,    /* Report errors for fallthrough cases in switch statement. */\n\n    /* Module Resolution Options */\n    \"moduleResolution\": \"node\",            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */\n    // \"baseUrl\": \"./\",                       /* Base directory to resolve non-absolute module names. */\n    // \"paths\": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */\n    // \"rootDirs\": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */\n    // \"typeRoots\": [],                       /* List of folders to include type definitions from. */\n    // \"types\": [],                           /* Type declaration files to be included in compilation. */\n    // \"allowSyntheticDefaultImports\": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */\n    \"esModuleInterop\": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */\n    // \"preserveSymlinks\": true,              /* Do not resolve the real path of symlinks. */\n    // \"allowUmdGlobalAccess\": true,          /* Allow accessing UMD globals from modules. */\n\n    /* Source Map Options */\n    // \"sourceRoot\": \"\",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */\n    // \"mapRoot\": \"\",                         /* Specify the location where debugger should locate map files instead of generated locations. */\n    // \"inlineSourceMap\": true,               /* Emit a single file with source maps instead of having a separate file. */\n    // \"inlineSources\": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */\n\n    /* Experimental Options */\n     \"experimentalDecorators\": true,        /* Enables experimental support for ES7 decorators. */\n     \"emitDecoratorMetadata\": true,         /* Enables experimental support for emitting type metadata for decorators. */\n\n    /* Advanced Options */\n    \"forceConsistentCasingInFileNames\": true  /* Disallow inconsistently-cased references to the same file. */\n  },\n  \"compileOnSave\": true,\n  \"files\": [\"./LInQer.Slim.ts\",\"./LInQer.Enumerable.ts\",\"./LInQer.GroupEnumerable.ts\",\"./LInQer.OrderedEnumerable.ts\",\"./LInQer.Extra.ts\",\"./npm.export.ts\"]\n}\n"
  },
  {
    "path": "tsconfig.extra.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Basic Options */\n    // \"incremental\": true,                   /* Enable incremental compilation */\n    \"target\": \"es6\",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */\n    \"module\": \"system\",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */\n    // \"lib\": [],                             /* Specify library files to be included in the compilation. */\n    // \"allowJs\": true,                       /* Allow javascript files to be compiled. */\n    // \"checkJs\": true,                       /* Report errors in .js files. */\n    // \"jsx\": \"preserve\",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */\n    // \"declaration\": true,                   /* Generates corresponding '.d.ts' file. */\n    // \"declarationMap\": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */\n    // \"sourceMap\": true,                     /* Generates corresponding '.map' file. */\n    // \"outFile\": \"./LInQer.extra.js\",                       /* Concatenate and emit output to single file. */\n    // \"outDir\": \"./\",                        /* Redirect output structure to the directory. */\n    // \"rootDir\": \"./\",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */\n    // \"composite\": true,                     /* Enable project compilation */\n    // \"tsBuildInfoFile\": \"./\",               /* Specify file to store incremental compilation information */\n    // \"removeComments\": true,                /* Do not emit comments to output. */\n    // \"noEmit\": true,                        /* Do not emit outputs. */\n    // \"importHelpers\": true,                 /* Import emit helpers from 'tslib'. */\n    // \"downlevelIteration\": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */\n    // \"isolatedModules\": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */\n\n    /* Strict Type-Checking Options */\n    \"strict\": true,                           /* Enable all strict type-checking options. */\n     \"noImplicitAny\": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */\n     \"strictNullChecks\": true,              /* Enable strict null checks. */\n     \"strictFunctionTypes\": true,           /* Enable strict checking of function types. */\n     \"strictBindCallApply\": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */\n     \"strictPropertyInitialization\": true,  /* Enable strict checking of property initialization in classes. */\n     \"noImplicitThis\": true,                /* Raise error on 'this' expressions with an implied 'any' type. */\n     \"alwaysStrict\": true,                  /* Parse in strict mode and emit \"use strict\" for each source file. */\n\n    /* Additional Checks */\n    // \"noUnusedLocals\": true,                /* Report errors on unused locals. */\n    // \"noUnusedParameters\": true,            /* Report errors on unused parameters. */\n    // \"noImplicitReturns\": true,             /* Report error when not all code paths in function return a value. */\n    // \"noFallthroughCasesInSwitch\": true,    /* Report errors for fallthrough cases in switch statement. */\n\n    /* Module Resolution Options */\n    // \"moduleResolution\": \"node\",            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */\n    // \"baseUrl\": \"./\",                       /* Base directory to resolve non-absolute module names. */\n    // \"paths\": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */\n    // \"rootDirs\": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */\n    // \"typeRoots\": [],                       /* List of folders to include type definitions from. */\n    // \"types\": [],                           /* Type declaration files to be included in compilation. */\n    // \"allowSyntheticDefaultImports\": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */\n    \"esModuleInterop\": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */\n    // \"preserveSymlinks\": true,              /* Do not resolve the real path of symlinks. */\n    // \"allowUmdGlobalAccess\": true,          /* Allow accessing UMD globals from modules. */\n\n    /* Source Map Options */\n    // \"sourceRoot\": \"\",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */\n    // \"mapRoot\": \"\",                         /* Specify the location where debugger should locate map files instead of generated locations. */\n    // \"inlineSourceMap\": true,               /* Emit a single file with source maps instead of having a separate file. */\n    // \"inlineSources\": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */\n\n    /* Experimental Options */\n     \"experimentalDecorators\": true,        /* Enables experimental support for ES7 decorators. */\n     \"emitDecoratorMetadata\": true,         /* Enables experimental support for emitting type metadata for decorators. */\n\n    /* Advanced Options */\n    \"forceConsistentCasingInFileNames\": true  /* Disallow inconsistently-cased references to the same file. */\n  },\n  \"compileOnSave\": true,\n  \"files\": [\"./LInQer.extra.ts\", \"./LInQer.Slim.ts\",\"./LInQer.Enumerable.ts\",\"./LInQer.GroupEnumerable.ts\",\"./LInQer.OrderedEnumerable.ts\"]\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Basic Options */\n    // \"incremental\": true,                   /* Enable incremental compilation */\n    \"target\": \"es6\",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */\n    \"module\": \"system\",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */\n    // \"lib\": [],                             /* Specify library files to be included in the compilation. */\n    // \"allowJs\": true,                       /* Allow javascript files to be compiled. */\n    // \"checkJs\": true,                       /* Report errors in .js files. */\n    // \"jsx\": \"preserve\",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */\n    // \"declaration\": true,                   /* Generates corresponding '.d.ts' file. */\n    // \"declarationMap\": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */\n    // \"sourceMap\": true,                     /* Generates corresponding '.map' file. */\n    \"outFile\": \"./LInQer.js\",                       /* Concatenate and emit output to single file. */\n    // \"outDir\": \"./\",                        /* Redirect output structure to the directory. */\n    // \"rootDir\": \"./\",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */\n    // \"composite\": true,                     /* Enable project compilation */\n    // \"tsBuildInfoFile\": \"./\",               /* Specify file to store incremental compilation information */\n    // \"removeComments\": true,                /* Do not emit comments to output. */\n    // \"noEmit\": true,                        /* Do not emit outputs. */\n    // \"importHelpers\": true,                 /* Import emit helpers from 'tslib'. */\n    // \"downlevelIteration\": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */\n    // \"isolatedModules\": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */\n\n    /* Strict Type-Checking Options */\n    \"strict\": true,                           /* Enable all strict type-checking options. */\n    \"noImplicitAny\": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */\n    \"strictNullChecks\": true,              /* Enable strict null checks. */\n    \"strictFunctionTypes\": true,           /* Enable strict checking of function types. */\n    \"strictBindCallApply\": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */\n    \"strictPropertyInitialization\": true,  /* Enable strict checking of property initialization in classes. */\n    \"noImplicitThis\": true,                /* Raise error on 'this' expressions with an implied 'any' type. */\n    \"alwaysStrict\": true,                  /* Parse in strict mode and emit \"use strict\" for each source file. */\n\n    /* Additional Checks */\n    // \"noUnusedLocals\": true,                /* Report errors on unused locals. */\n    // \"noUnusedParameters\": true,            /* Report errors on unused parameters. */\n    // \"noImplicitReturns\": true,             /* Report error when not all code paths in function return a value. */\n    // \"noFallthroughCasesInSwitch\": true,    /* Report errors for fallthrough cases in switch statement. */\n\n    /* Module Resolution Options */\n    // \"moduleResolution\": \"node\",            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */\n    // \"baseUrl\": \"./\",                       /* Base directory to resolve non-absolute module names. */\n    // \"paths\": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */\n    // \"rootDirs\": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */\n    // \"typeRoots\": [],                       /* List of folders to include type definitions from. */\n    // \"types\": [],                           /* Type declaration files to be included in compilation. */\n    // \"allowSyntheticDefaultImports\": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */\n    \"esModuleInterop\": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */\n    // \"preserveSymlinks\": true,              /* Do not resolve the real path of symlinks. */\n    // \"allowUmdGlobalAccess\": true,          /* Allow accessing UMD globals from modules. */\n\n    /* Source Map Options */\n    // \"sourceRoot\": \"\",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */\n    // \"mapRoot\": \"\",                         /* Specify the location where debugger should locate map files instead of generated locations. */\n    // \"inlineSourceMap\": true,               /* Emit a single file with source maps instead of having a separate file. */\n    // \"inlineSources\": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */\n\n    /* Experimental Options */\n     \"experimentalDecorators\": true,        /* Enables experimental support for ES7 decorators. */\n     \"emitDecoratorMetadata\": true,         /* Enables experimental support for emitting type metadata for decorators. */\n\n    /* Advanced Options */\n    \"forceConsistentCasingInFileNames\": true  /* Disallow inconsistently-cased references to the same file. */\n  },\n  \"compileOnSave\": true,\n  \"files\": [\"./LInQer.Slim.ts\",\"./LInQer.Enumerable.ts\",\"./LInQer.GroupEnumerable.ts\",\"./LInQer.OrderedEnumerable.ts\",\"./npm.export.ts\"]\n}\n"
  },
  {
    "path": "tsconfig.slim.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Basic Options */\n    // \"incremental\": true,                   /* Enable incremental compilation */\n    \"target\": \"es6\",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */\n    \"module\": \"system\",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */\n    // \"lib\": [],                             /* Specify library files to be included in the compilation. */\n    // \"allowJs\": true,                       /* Allow javascript files to be compiled. */\n    // \"checkJs\": true,                       /* Report errors in .js files. */\n    // \"jsx\": \"preserve\",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */\n    // \"declaration\": true,                   /* Generates corresponding '.d.ts' file. */\n    // \"declarationMap\": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */\n    // \"sourceMap\": true,                     /* Generates corresponding '.map' file. */\n    \"outFile\": \"./LInQer.slim.js\",                       /* Concatenate and emit output to single file. */\n    // \"outDir\": \"./\",                        /* Redirect output structure to the directory. */\n    // \"rootDir\": \"./\",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */\n    // \"composite\": true,                     /* Enable project compilation */\n    // \"tsBuildInfoFile\": \"./\",               /* Specify file to store incremental compilation information */\n    // \"removeComments\": true,                /* Do not emit comments to output. */\n    // \"noEmit\": true,                        /* Do not emit outputs. */\n    // \"importHelpers\": true,                 /* Import emit helpers from 'tslib'. */\n    // \"downlevelIteration\": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */\n    // \"isolatedModules\": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */\n\n    /* Strict Type-Checking Options */\n    \"strict\": true,                           /* Enable all strict type-checking options. */\n     \"noImplicitAny\": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */\n     \"strictNullChecks\": true,              /* Enable strict null checks. */\n     \"strictFunctionTypes\": true,           /* Enable strict checking of function types. */\n     \"strictBindCallApply\": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */\n     \"strictPropertyInitialization\": true,  /* Enable strict checking of property initialization in classes. */\n     \"noImplicitThis\": true,                /* Raise error on 'this' expressions with an implied 'any' type. */\n     \"alwaysStrict\": true,                  /* Parse in strict mode and emit \"use strict\" for each source file. */\n\n    /* Additional Checks */\n    // \"noUnusedLocals\": true,                /* Report errors on unused locals. */\n    // \"noUnusedParameters\": true,            /* Report errors on unused parameters. */\n    // \"noImplicitReturns\": true,             /* Report error when not all code paths in function return a value. */\n    // \"noFallthroughCasesInSwitch\": true,    /* Report errors for fallthrough cases in switch statement. */\n\n    /* Module Resolution Options */\n    // \"moduleResolution\": \"node\",            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */\n    // \"baseUrl\": \"./\",                       /* Base directory to resolve non-absolute module names. */\n    // \"paths\": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */\n    // \"rootDirs\": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */\n    // \"typeRoots\": [],                       /* List of folders to include type definitions from. */\n    // \"types\": [],                           /* Type declaration files to be included in compilation. */\n    // \"allowSyntheticDefaultImports\": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */\n    \"esModuleInterop\": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */\n    // \"preserveSymlinks\": true,              /* Do not resolve the real path of symlinks. */\n    // \"allowUmdGlobalAccess\": true,          /* Allow accessing UMD globals from modules. */\n\n    /* Source Map Options */\n    // \"sourceRoot\": \"\",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */\n    // \"mapRoot\": \"\",                         /* Specify the location where debugger should locate map files instead of generated locations. */\n    // \"inlineSourceMap\": true,               /* Emit a single file with source maps instead of having a separate file. */\n    // \"inlineSources\": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */\n\n    /* Experimental Options */\n     \"experimentalDecorators\": true,        /* Enables experimental support for ES7 decorators. */\n     \"emitDecoratorMetadata\": true,         /* Enables experimental support for emitting type metadata for decorators. */\n\n    /* Advanced Options */\n    \"forceConsistentCasingInFileNames\": true  /* Disallow inconsistently-cased references to the same file. */\n  },\n  \"compileOnSave\": true,\n  \"files\": [\"./LInQer.Slim.ts\"]\n}\n"
  }
]