diff --git a/lodash.js b/lodash.js index da7846412..4edd57c1c 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 3.0.0-pre (Custom Build) + * lodash 3.0.0-pre (Custom Build) * Build: `lodash modern -o ./lodash.js` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 @@ -9,7 +9,7 @@ */ ;(function() { - /** Used as a safe reference for `undefined` in pre ES5 environments. */ + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** Used as the semantic version number. */ @@ -45,6 +45,32 @@ /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + + var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + /** Used to match empty string literals in compiled template source. */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -62,8 +88,8 @@ reInterpolate = /<%=([\s\S]+?)%>/g; /** - * Used to match ES6 template delimiters. - * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) + * Used to match ES template delimiters. + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) * for more details. */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; @@ -133,48 +159,22 @@ /** Used to make template sourceURLs easier to identify. */ var templateCounter = -1; - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; + /** Used to identify `toStringTag` values of typed arrays. */ + var typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dateTag] = typedArrayTags[errorTag] = + typedArrayTags[funcTag] = typedArrayTags[mapTag] = + typedArrayTags[numberTag] = typedArrayTags[objectTag] = + typedArrayTags[regexpTag] = typedArrayTags[setTag] = + typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; - var arrayBufferTag = '[object ArrayBuffer]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to identify object classifications that are treated like arrays. */ - var arrayLikeTags = {}; - arrayLikeTags[argsTag] = - arrayLikeTags[arrayTag] = arrayLikeTags[float32Tag] = - arrayLikeTags[float64Tag] = arrayLikeTags[int8Tag] = - arrayLikeTags[int16Tag] = arrayLikeTags[int32Tag] = - arrayLikeTags[uint8Tag] = arrayLikeTags[uint8ClampedTag] = - arrayLikeTags[uint16Tag] = arrayLikeTags[uint32Tag] = true; - arrayLikeTags[arrayBufferTag] = arrayLikeTags[boolTag] = - arrayLikeTags[dateTag] = arrayLikeTags[errorTag] = - arrayLikeTags[funcTag] = arrayLikeTags[mapTag] = - arrayLikeTags[numberTag] = arrayLikeTags[objectTag] = - arrayLikeTags[regexpTag] = arrayLikeTags[setTag] = - arrayLikeTags[stringTag] = arrayLikeTags[weakMapTag] = false; - - /** Used to identify object classifications that `_.clone` supports. */ + /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = @@ -185,9 +185,9 @@ cloneableTags[regexpTag] = cloneableTags[stringTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = - cloneableTags[funcTag] = cloneableTags[mapTag] = - cloneableTags[setTag] = cloneableTags[weakMapTag] = false; + cloneableTags[errorTag] = cloneableTags[funcTag] = + cloneableTags[mapTag] = cloneableTags[setTag] = + cloneableTags[weakMapTag] = false; /** Used as an internal `_.debounce` options object by `_.throttle`. */ var debounceOptions = { @@ -346,6 +346,21 @@ return array; } + /** + * Converts `value` to a string if it is not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + /** * Used by `_.max` and `_.min` as the default callback for string values. * @@ -425,11 +440,12 @@ } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value - // for `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247. + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. // // This also ensures a stable sort in V8 and other engines. - // See https://code.google.com/p/v8/issues/detail?id=90. + // See https://code.google.com/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } @@ -490,19 +506,6 @@ return -1; } - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - value = +value; - return value > -1 && value % 1 == 0 && (length == null || value < length); - } - /** * Checks if `value` is object-like. * @@ -662,7 +665,7 @@ // Avoid issues with some ES3 environments that attempt to use values, named // after built-in constructors like `Object`, for the creation of literals. // ES5 clears this up by stating that literals must use built-in constructors. - // See http://es5.github.io/#x11.1.5. + // See https://es5.github.io/#x11.1.5 for more details. context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; /** Native constructor references. */ @@ -698,7 +701,7 @@ /** * Used to resolve the `toStringTag` of values. - * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) * for more details. */ var objToString = objectProto.toString; @@ -742,6 +745,7 @@ /* Native method references for those with the same name as other `lodash` methods. */ var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, + nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, nativeIsFinite = context.isFinite, nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, @@ -765,7 +769,7 @@ /** * Used as the maximum length of an array-like value. - * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; @@ -791,7 +795,7 @@ * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. * - * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: + * In addition to lodash methods, wrappers also have the following `Array` methods: * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, * and `unshift` * @@ -813,9 +817,9 @@ * `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, * `rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, * `sortBy`, `sortByAll`, `splice`, `take`, `takeRight`, `takeRightWhile`, - * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, - * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, + * `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, + * `where`, `without`, `wrap`, `xor`, `zip`, and `zipObject` * * The wrapper functions that are **not** chainable by default are: * `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, @@ -824,12 +828,13 @@ * `identity`, `includes`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, * `isFunction`, `isMatch` , `isNative`, `isNaN`, `isNull`, `isNumber`, - * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`, `now`, `pad`, - * `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `runInContext`, `shift`, `size`, `snakeCase`, `some`, - * `sortedIndex`, `sortedLastIndex`, `startsWith`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words` + * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, + * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, + * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, + * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, + * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, + * `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, + * `unescape`, `uniqueId`, `value`, and `words` * * The wrapper function `sample` will return a wrapped value when `n` is provided, * otherwise an unwrapped value is returned. @@ -943,7 +948,7 @@ }(0, 0)); /** - * By default, the template delimiters used by Lo-Dash are like those in + * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB). Change the following template settings to use * alternative delimiters. * @@ -1168,7 +1173,7 @@ * @private * @name has * @memberOf _.memoize.Cache - * @param {string} key The name of the entry to check. + * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapHas(key) { @@ -1204,7 +1209,7 @@ function SetCache(values) { var length = values ? values.length : 0; - this.data = { 'number': {}, 'set': new Set }; + this.data = { 'hash': nativeCreate(null), 'set': new Set }; while (length--) { this.push(values[length]); } @@ -1220,9 +1225,8 @@ * @returns {number} Returns `0` if `value` is found, else `-1`. */ function cacheIndexOf(cache, value) { - var type = typeof value, - data = cache.data, - result = type == 'number' ? data[type][value] : data.set.has(value); + var data = cache.data, + result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; return result ? 0 : -1; } @@ -1236,48 +1240,33 @@ * @param {*} value The value to cache. */ function cachePush(value) { - var data = this.data, - type = typeof value; - - if (type == 'number') { - data[type][value] = true; - } else { + var data = this.data; + if (typeof value == 'string' || isObject(value)) { data.set.add(value); + } else { + data.hash[value] = true; } } /*------------------------------------------------------------------------*/ /** - * Converts an `arguments` object to a plain `Object` object. + * Copies the values of `source` to `array`. * * @private - * @param {Object} args The `arguments` object to convert. - * @returns {Object} Returns the new converted object. + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. */ - function argsToObject(args) { - var result = { 'length': 0 }; - push.apply(result, args); - return result; - } - - /** - * Copies the values of `array` to `other`. - * - * @private - * @param {Array} array The array to copy. - * @param {Array} [other=[]] The array to copy values to. - * @returns {Array} Returns `other`. - */ - function arrayCopy(array, other) { + function arrayCopy(source, array) { var index = -1, - length = array.length, - result = other || Array(length); + length = source.length; + array || (array = Array(length)); while (++index < length) { - result[index] = array[index]; + array[index] = source[index]; } - return result; + return array; } /** @@ -1437,8 +1426,8 @@ * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initFromArray] Specify using the first element of - * `array` as the initial value. + * @param {boolean} [initFromArray] Specify using the first element of `array` + * as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initFromArray) { @@ -1462,8 +1451,8 @@ * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. - * @param {boolean} [initFromArray] Specify using the last element of - * `array` as the initial value. + * @param {boolean} [initFromArray] Specify using the last element of `array` + * as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initFromArray) { @@ -1541,22 +1530,21 @@ * @returns {Object} Returns the destination object. */ function baseAssign(object, source, customizer) { + var props = keys(source); + if (!customizer) { + return baseCopy(source, object, props); + } var index = -1, - props = keys(source), - length = props.length; + length = props.length while (++index < length) { - var key = props[index]; - if (customizer) { - var value = object[key], - result = customizer(value, source[key], key, object, source); + var key = props[index], + value = object[key], + result = customizer(value, source[key], key, object, source); - if ((result === result ? result !== value : value === value) || - (typeof value == 'undefined' && !(key in object))) { - object[key] = result; - } - } else { - object[key] = source[key]; + if ((result === result ? result !== value : value === value) || + (typeof value == 'undefined' && !(key in object))) { + object[key] = result; } } return object; @@ -1590,6 +1578,30 @@ return result; } + /** + * Copies the properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Object} [object={}] The object to copy properties to. + * @param {Array} props The property names to copy. + * @returns {Object} Returns `object`. + */ + function baseCopy(source, object, props) { + if (!props) { + props = object; + object = {}; + } + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = source[key]; + } + return object; + } + /** * The base implementation of `_.bindAll` without support for individual * method name arguments. @@ -1622,7 +1634,6 @@ */ function baseCallback(func, thisArg, argCount) { var type = typeof func; - if (type == 'function') { return (typeof thisArg != 'undefined' && isBindable(func)) ? bindCallback(func, thisArg, argCount) @@ -1634,7 +1645,7 @@ // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' ? baseMatches(func, !argCount) - : baseProperty(argCount ? (func + '') : func); + : baseProperty(argCount ? baseToString(func) : func); } /** @@ -1672,10 +1683,10 @@ var tag = objToString.call(value), isFunc = tag == funcTag; - if (tag == objectTag || (isFunc && !object)) { + if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = initCloneObject(isFunc ? {} : value); if (!isDeep) { - return baseAssign(result, value); + return baseCopy(value, result, keys(value)); } } else { return cloneableTags[tag] @@ -1848,7 +1859,6 @@ */ function baseEvery(collection, predicate) { var result = true; - baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; @@ -1867,7 +1877,6 @@ */ function baseFilter(collection, predicate) { var result = []; - baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); @@ -1885,13 +1894,12 @@ * @param {Array|Object|string} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found - * element instead of the element itself. + * @param {boolean} [retKey] Specify returning the key of the found element + * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFind(collection, predicate, eachFunc, retKey) { var result; - eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = retKey ? key : value; @@ -1922,8 +1930,8 @@ var value = array[index]; if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { - // Recursively flatten arrays (susceptible to call stack limits). if (isDeep) { + // Recursively flatten arrays (susceptible to call stack limits). value = baseFlatten(value, isDeep, isStrict); } var valIndex = -1, @@ -2111,13 +2119,13 @@ /** * A specialized version of `baseIsEqual` for arrays and objects which performs - * a deep comparison between objects and tracks traversed objects enabling - * objects with circular references to be compared. + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. * * @private - * @param {Array} object The object to compare. - * @param {Array} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of arbitrary values. + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparing objects. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `value` objects. @@ -2125,20 +2133,26 @@ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) { - var objTag = isArray(object) ? arrayTag : objToString.call(object), - objIsArg = objTag == argsTag, - objIsArr = !objIsArg && arrayLikeTags[objTag], - othTag = isArray(other) ? arrayTag : objToString.call(other), - othIsArg = othTag == argsTag, - othIsArr = !othIsArg && arrayLikeTags[othTag]; + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; - if (objIsArg) { - object = argsToObject(object); - objTag = objectTag; + if (!objIsArr) { + objTag = objToString.call(object); + if (objTag == argsTag) { + objTag = objectTag; + } else if (objTag != objectTag) { + objIsArr = isTypedArray(object); + } } - if (othIsArg) { - other = argsToObject(other); - othTag = objectTag; + if (!othIsArr) { + othTag = objToString.call(other); + if (othTag == argsTag) { + othTag = objectTag; + } else if (othTag != objectTag) { + othIsArr = isTypedArray(other); + } } var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, @@ -2156,9 +2170,8 @@ if (!isSameTag) { return false; } - // Assume cyclic structures are equal. - // The algorithm for detecting cyclic structures is adapted from ES 5.1 - // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3). + // Assume cyclic values are equal. + // For more information on detecting circular references see https://es5.github.io/#JO. stackA || (stackA = []); stackB || (stackB = []); @@ -2172,7 +2185,6 @@ stackA.push(object); stackB.push(other); - // Recursively compare objects and arrays (susceptible to call stack limits). var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB); stackA.pop(); @@ -2241,7 +2253,6 @@ */ function baseMap(collection, iteratee) { var result = []; - baseEach(collection, function(value, key, collection) { result.push(iteratee(value, key, collection)); }); @@ -2300,65 +2311,89 @@ * @returns {Object} Returns the destination object. */ function baseMerge(object, source, customizer, stackA, stackB) { - var isSrcArr = isArrayLike(source); + var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); (isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { - var isArr = isArrayLike(srcValue), - isObj = isPlainObject(srcValue), - value = object[key]; - - if (!(isArr || isObj)) { - var result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; - - if (isCommon) { - result = srcValue; - } - if ((isSrcArr || typeof result != 'undefined') && - (isCommon || (result === result ? result !== value : value === value))) { - object[key] = result; - } - return; + if (isObjectLike(srcValue)) { + stackA || (stackA = []); + stackB || (stackB = []); + return baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); } - // Avoid merging previously merged cyclic sources. - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == srcValue) { - object[key] = stackB[length]; - return; - } - } - result = customizer ? customizer(value, srcValue, key, object, source) : undefined; - isCommon = typeof result == 'undefined'; + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = typeof result == 'undefined'; if (isCommon) { - result = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); + result = srcValue; } - // Add the source value to the stack of traversed objects and associate - // it with its merged value. - stackA.push(srcValue); - stackB.push(result); - - // Recursively merge objects and arrays (susceptible to call stack limits). - if (isCommon) { - object[key] = baseMerge(result, srcValue, customizer, stackA, stackB); - } else if (result === result ? result !== value : value === value) { + if ((isSrcArr || typeof result != 'undefined') && + (isCommon || (result === result ? result !== value : value === value))) { object[key] = result; } }); return object; } + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize merging properties. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates values with source counterparts. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ + function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { + var length = stackA.length, + srcValue = source[key]; + + while (length--) { + if (stackA[length] == srcValue) { + object[key] = stackB[length]; + return; + } + } + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = typeof result == 'undefined'; + + if (isCommon) { + result = srcValue; + if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { + result = isArray(value) + ? value + : (value ? arrayCopy(value) : []); + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + result = isArguments(value) + ? toPlainObject(value) + : (isPlainObject(value) ? value : {}); + } + } + // Add the source value to the stack of traversed objects and associate + // it with its merged value. + stackA.push(srcValue); + stackB.push(result); + + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); + } else if (result === result ? result !== value : value === value) { + object[key] = result; + } + } + /** * The base implementation of `_.property` which does not coerce `key` to a string. * * @private - * @param {string} key The name of the property to get. + * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { @@ -2807,9 +2842,9 @@ */ function createAggregator(setter, initializer) { return function(collection, iteratee, thisArg) { + var result = initializer ? initializer() : {}; iteratee = getCallback(iteratee, thisArg, 3); - var result = initializer ? initializer() : {}; if (isArray(collection)) { var index = -1, length = collection.length; @@ -2854,7 +2889,10 @@ } var index = 0; while (++index < length) { - assigner(object, arguments[index], customizer); + var source = arguments[index]; + if (source) { + assigner(object, source, customizer); + } } return object; }; @@ -2885,7 +2923,7 @@ * @param {Array} [values] The values to cache. * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. */ - var createCache = !Set ? constant(null) : function(values) { + var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { return new SetCache(values); }; @@ -2925,7 +2963,7 @@ result = Ctor.apply(thisBinding, arguments); // Mimic the constructor's `return` behavior. - // See http://es5.github.io/#x13.2.2. + // See https://es5.github.io/#x13.2.2 for more details. return isObject(result) ? result : thisBinding; }; } @@ -3065,7 +3103,7 @@ return ''; } var padLength = length - strLength; - chars = chars == null ? ' ' : (chars + ''); + chars = chars == null ? ' ' : baseToString(chars); return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); } @@ -3177,7 +3215,7 @@ * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. - * @param {Function} equalFunc The function to determine equivalents of arbitrary values. + * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparing arrays. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA] Tracks traversed `value` objects. @@ -3205,6 +3243,7 @@ : customizer(arrValue, othValue, index); } if (typeof result == 'undefined') { + // Recursively compare arrays (susceptible to call stack limits). if (isWhere) { var othIndex = othLength; while (othIndex--) { @@ -3226,8 +3265,8 @@ * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * - * **Note:** This function only supports comparing values with `toStringTag` - * values of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} value The object to compare. @@ -3255,9 +3294,9 @@ case regexpTag: case stringTag: - // Coerce regexes to strings (http://es5.github.io/#x15.10.6.4) and - // treat strings primitives and string objects as equal. - return object == (other + ''); + // Coerce regexes to strings and treat strings primitives and string + // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. + return object == baseToString(other); } return false; } @@ -3269,7 +3308,7 @@ * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of arbitrary values. + * @param {Function} equalFunc The function to determine equivalents of values. * @param {Function} [customizer] The function to customize comparing values. * @param {boolean} [isWhere] Specify performing partial comparisons. * @param {Array} [stackA] Tracks traversed `value` objects. @@ -3303,6 +3342,7 @@ : customizer(objValue, othValue, key); } if (typeof result == 'undefined') { + // Recursively compare objects (susceptible to call stack limits). result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB); } } @@ -3457,8 +3497,8 @@ /** * Initializes an object clone based on its `toStringTag`. * - * **Note:** This function only supports cloning values with `toStringTag` - * values of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * **Note:** This function only supports cloning values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * * @private @@ -3470,11 +3510,6 @@ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { - case argsTag: - var result = new Ctor; - result.length = object.length; - return arrayCopy(object, result); - case arrayBufferTag: return bufferClone(object); @@ -3493,24 +3528,12 @@ return new Ctor(object); case regexpTag: - result = new Ctor(object.source, reFlags.exec(object)); + var result = new Ctor(object.source, reFlags.exec(object)); result.lastIndex = object.lastIndex; } return result; } - /** - * Checks if `value` is an array-like object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. - */ - function isArrayLike(value) { - return (isObjectLike(value) && isLength(value.length) && - (arrayLikeTags[objToString.call(value)])) || false; - } - /** * Checks if `func` is eligible for `this` binding. * @@ -3536,6 +3559,20 @@ return result; } + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = +value; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + /** * Checks if the provided arguments are from an iteratee call. * @@ -3554,7 +3591,7 @@ var length = object.length, prereq = isLength(length) && isIndex(index, length); } else { - prereq = type == 'string'; + prereq = type == 'string' && index in value; } return prereq && object[index] === value; } @@ -3662,8 +3699,8 @@ } /** - * A specialized version of `_.pick` that picks `object` properties - * specified by the `props` array. + * A specialized version of `_.pick` that picks `object` properties specified + * by the `props` array. * * @private * @param {Object} object The source object. @@ -3697,7 +3734,6 @@ */ function pickByCallback(object, predicate) { var result = {}; - baseForIn(object, function(value, key, object) { if (predicate(value, key, object)) { result[key] = value; @@ -3733,7 +3769,8 @@ * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short * period of time, it will trip its breaker and transition to an identity function - * to avoid garbage collection pauses in V8. See https://code.google.com/p/v8/issues/detail?id=2070. + * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) + * for more details. * * @private * @param {Function} func The function to associate metadata with. @@ -3849,21 +3886,6 @@ return isObject(value) ? value : Object(value); } - /** - * Converts `value` to a string if it is not one. An empty string is - * returned for `null` or `undefined` values. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ - function toString(value) { - if (typeof value == 'string') { - return value; - } - return value == null ? '' : (value + ''); - } - /*------------------------------------------------------------------------*/ /** @@ -3938,7 +3960,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4232,7 +4254,6 @@ */ function findLastIndex(array, predicate, thisArg) { var length = array ? array.length : 0; - predicate = getCallback(predicate, thisArg, 3); while (length--) { if (predicate(array[length], length, array)) { @@ -4317,7 +4338,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4380,7 +4401,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4509,7 +4530,7 @@ * **Notes:** * - Unlike `_.without`, this method mutates `array`. * - `SameValueZero` comparisons are like strict equality comparisons, e.g. `===`, - * except that `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * except that `NaN` matches `NaN`. See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4546,9 +4567,9 @@ } /** - * Removes elements from `array` corresponding to the specified indexes and - * returns an array of the removed elements. Indexes may be specified as an - * array of indexes or as individual arguments. + * Removes elements from `array` corresponding to the given indexes and returns + * an array of the removed elements. Indexes may be specified as an array of + * indexes or as individual arguments. * * **Note:** Unlike `_.at`, this method mutates `array`. * @@ -4929,7 +4950,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4963,7 +4984,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -5016,7 +5037,7 @@ /** * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre `_.zip` + * elements and creates an array regrouping the elements to their pre-`_.zip` * configuration. * * @static @@ -5049,7 +5070,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -5069,7 +5090,7 @@ /** * Creates an array that is the symmetric difference of the provided arrays. - * See [Wikipedia](http://en.wikipedia.org/wiki/Symmetric_difference) for + * See [Wikipedia](https://en.wikipedia.org/wiki/Symmetric_difference) for * more details. * * @static @@ -5336,7 +5357,7 @@ /*------------------------------------------------------------------------*/ /** - * Creates an array of elements corresponding to the specified keys, or indexes, + * Creates an array of elements corresponding to the given keys, or indexes, * of `collection`. Keys may be specified as individual arguments or as arrays * of keys. * @@ -5370,7 +5391,7 @@ * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -5543,7 +5564,6 @@ */ function filter(collection, predicate, thisArg) { var func = isArray(collection) ? arrayFilter : baseFilter; - predicate = getCallback(predicate, thisArg, 3); return func(collection, predicate); } @@ -5856,9 +5876,8 @@ * // => ['barney', 'fred'] */ function map(collection, iteratee, thisArg) { - iteratee = getCallback(iteratee, thisArg, 3); - var func = isArray(collection) ? arrayMap : baseMap; + iteratee = getCallback(iteratee, thisArg, 3); return func(collection, iteratee); } @@ -6001,13 +6020,13 @@ }, function() { return [[], []]; }); /** - * Gets the value of a specified property from all elements in `collection`. + * Gets the value of `key` from all elements in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {string} key The name of the property to pluck. + * @param {string} key The key of the property to pluck. * @returns {Array} Returns the property values. * @example * @@ -6124,7 +6143,6 @@ */ function reject(collection, predicate, thisArg) { var func = isArray(collection) ? arrayFilter : baseFilter; - predicate = getCallback(predicate, thisArg, 3); return func(collection, function(value, index, collection) { return !predicate(value, index, collection); @@ -6162,7 +6180,7 @@ /** * Creates an array of shuffled values, using a version of the Fisher-Yates - * shuffle. See [Wikipedia](http://en.wikipedia.org/wiki/Fisher-Yates_shuffle) + * shuffle. See [Wikipedia](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle) * for more details. * * @static @@ -6309,15 +6327,14 @@ * // => ['barney', 'fred', 'pebbles'] */ function sortBy(collection, iteratee, thisArg) { - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; - } - iteratee = getCallback(iteratee, thisArg, 3); - var index = -1, length = collection ? collection.length : 0, result = isLength(length) ? Array(length) : []; + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + iteratee = getCallback(iteratee, thisArg, 3); baseEach(collection, function(value, key, collection) { result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; }); @@ -6369,30 +6386,6 @@ return baseSortBy(result, compareMultipleAscending); } - /** - * Converts `collection` to an array. - * - * @static - * @memberOf _ - * @category Collection - * @param {Array|Object|string} collection The collection to convert. - * @returns {Array} Returns the new converted array. - * @example - * - * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - * // => [2, 3, 4] - */ - function toArray(collection) { - var length = collection ? collection.length : 0; - if (!isLength(length)) { - return values(collection); - } - if (!length) { - return []; - } - return arrayCopy(collection); - } - /** * Performs a deep comparison between each element in `collection` and the * source object, returning an array of all elements that have equivalent @@ -6505,7 +6498,7 @@ if (guard && isIterateeCall(func, n, guard)) { n = null; } - n = n == null ? func.length : (+n || 0); + n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); return createWrapper(func, ARY_FLAG, null, null, null, null, n); } @@ -6685,7 +6678,7 @@ * Creates a function that accepts one or more arguments of `func` that when * called either invokes `func` returning its result, if all `func` arguments * have been provided, or returns a function that accepts one or more of the - * remaining `func` arguments, and so on. The arity of `func` can be specified + * remaining `func` arguments, and so on. The arity of `func` may be specified * if `func.length` is not sufficient. * * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, @@ -7091,9 +7084,9 @@ * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the ES6 `Map` method interface + * constructor with one whose instances implement the ES `Map` method interface * of `get`, `has`, and `set`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) * for more details. * * @static @@ -7724,8 +7717,8 @@ /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on ES6 `Number.isFinite`. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) + * **Note:** This method is based on ES `Number.isFinite`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) * for more details. * * @static @@ -7772,7 +7765,7 @@ */ function isFunction(value) { // Avoid a Chakra JIT bug in compatibility modes of IE 11. - // See https://github.com/jashkenas/underscore/issues/1621. + // See https://github.com/jashkenas/underscore/issues/1621 for more details. return typeof value == 'function' || false; } // Fallback for environments that return incorrect `typeof` operator results. @@ -7789,7 +7782,7 @@ * Checks if `value` is the language type of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * - * **Note:** See the [ES5 spec](http://es5.github.io/#x8) for more details. + * **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. * * @static * @memberOf _ @@ -7809,7 +7802,7 @@ */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return type == 'function' || (value && type == 'object') || false; } @@ -7880,7 +7873,7 @@ * Checks if `value` is `NaN`. * * **Note:** This method is not the same as native `isNaN` which returns `true` - * for `undefined` and other non-numeric values. See the [ES5 spec](http://es5.github.io/#x15.1.2.4) + * for `undefined` and other non-numeric values. See the [ES5 spec](https://es5.github.io/#x15.1.2.4) * for more details. * * @static @@ -7981,8 +7974,8 @@ } /** - * Checks if `value` is an object created by the `Object` constructor or has - * a `[[Prototype]]` of `null`. + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. * * **Note:** This method assumes objects created by the `Object` constructor * have no inherited enumerable properties. @@ -7994,12 +7987,11 @@ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * - * function Shape() { - * this.x = 0; - * this.y = 0; + * function Foo() { + * this.a = 1; * } * - * _.isPlainObject(new Shape); + * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); @@ -8063,6 +8055,26 @@ return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag) || false; } + /** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ + function isTypedArray(value) { + return (isObjectLike(value) && isLength(value.length) && typedArrayTags[objToString.call(value)]) || false; + } + /** * Checks if `value` is `undefined`. * @@ -8083,6 +8095,57 @@ return typeof value == 'undefined'; } + /** + * Converts `value` to an array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3); + * // => [2, 3] + */ + function toArray(value) { + var length = value ? value.length : 0; + if (!isLength(length)) { + return values(value); + } + if (!length) { + return []; + } + return arrayCopy(value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable + * properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return baseCopy(value, keysIn(value)); + } + /*------------------------------------------------------------------------*/ /** @@ -8153,7 +8216,7 @@ if (guard && isIterateeCall(prototype, properties, guard)) { properties = null; } - return properties ? baseAssign(result, properties) : result; + return properties ? baseCopy(properties, result, keys(properties)) : result; } /** @@ -8257,8 +8320,8 @@ * // => returns `pebbles` assuming `_.findKey` returns `barney` * * // using the "_.matches" callback shorthand - * _.findLastKey(users, { 'age': 40 }); - * // => 'fred' + * _.findLastKey(users, { 'age': 36 }); + * // => 'barney' * * // using the "_.property" callback shorthand * _.findLastKey(users, 'active'); @@ -8284,17 +8347,17 @@ * @returns {Object} Returns `object`. * @example * - * function Shape() { - * this.x = 0; - * this.y = 0; + * function Foo() { + * this.a = 1; + * this.b = 2; * } * - * Shape.prototype.z = 0; + * Foo.prototype.c = 3; * - * _.forIn(new Shape, function(value, key) { + * _.forIn(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'x', 'y', and 'z' (iteration order is not guaranteed) + * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed) */ function forIn(object, iteratee, thisArg) { if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { @@ -8316,17 +8379,17 @@ * @returns {Object} Returns `object`. * @example * - * function Shape() { - * this.x = 0; - * this.y = 0; + * function Foo() { + * this.a = 1; + * this.b = 2; * } * - * Shape.prototype.z = 0; + * Foo.prototype.c = 3; * - * _.forInRight(new Shape, function(value, key) { + * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); - * // => logs 'z', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'z' + * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c' */ function forInRight(object, iteratee, thisArg) { iteratee = bindCallback(iteratee, thisArg, 3); @@ -8403,14 +8466,14 @@ } /** - * Checks if the specified property name exists as a direct property of `object`, - * instead of an inherited property. + * Checks if `key` exists as a direct property of `object` instead of an + * inherited property. * * @static * @memberOf _ * @category Object * @param {Object} object The object to inspect. - * @param {string} key The name of the property to check. + * @param {string} key The key to check. * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. * @example * @@ -8477,7 +8540,7 @@ * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) * for more details. * * @static @@ -8487,15 +8550,15 @@ * @returns {Array} Returns the array of property names. * @example * - * function Shape() { - * this.x = 0; - * this.y = 0; + * function Foo() { + * this.a = 1; + * this.b = 2; * } * - * Shape.prototype.z = 0; + * Foo.prototype.c = 3; * - * _.keys(new Shape); - * // => ['x', 'y'] (iteration order is not guaranteed) + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] @@ -8524,15 +8587,15 @@ * @returns {Array} Returns the array of property names. * @example * - * function Shape() { - * this.x = 0; - * this.y = 0; + * function Foo() { + * this.a = 1; + * this.b = 2; * } * - * Shape.prototype.z = 0; + * Foo.prototype.c = 3; * - * _.keysIn(new Shape); - * // => ['x', 'y', 'z'] (iteration order is not guaranteed) + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { if (object == null) { @@ -8600,9 +8663,9 @@ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee, thisArg) { + var result = {}; iteratee = getCallback(iteratee, thisArg, 3); - var result = {}; baseForOwn(object, function(value, key, object) { result[key] = iteratee(value, key, object); }); @@ -8771,7 +8834,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to query. - * @param {string} key The name of the property to resolve. + * @param {string} key The key of the property to resolve. * @param {*} [defaultValue] The value returned if the property value * resolves to `undefined`. * @returns {*} Returns the resolved value. @@ -8831,9 +8894,9 @@ * // => { 'a': 3, 'b': 6, 'c': 9 } */ function transform(object, iteratee, accumulator, thisArg) { + var isArr = isArray(object) || isTypedArray(object); iteratee = getCallback(iteratee, thisArg, 4); - var isArr = isArrayLike(object); if (accumulator == null) { if (isArr || isObject(object)) { var Ctor = object.constructor; @@ -8864,15 +8927,15 @@ * @returns {Array} Returns the array of property values. * @example * - * function Shape(x, y) { - * this.x = x; - * this.y = y; + * function Foo() { + * this.a = 1; + * this.b = 2; * } * - * Shape.prototype.z = 0; + * Foo.prototype.c = 3; * - * _.values(new Shape(2, 1)); - * // => [2, 1] (iteration order is not guaranteed) + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] @@ -8894,15 +8957,15 @@ * @returns {Array} Returns the array of property values. * @example * - * function Shape(x, y) { - * this.x = x; - * this.y = y; + * function Foo() { + * this.a = 1; + * this.b = 2; * } * - * Shape.prototype.z = 0; + * Foo.prototype.c = 3; * - * _.valuesIn(new Shape(2, 1)); - * // => [2, 1, 0] (iteration order is not guaranteed) + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { return baseValues(object, keysIn(object)); @@ -8976,12 +9039,12 @@ /** * Converts `string` to camel case. - * See [Wikipedia](http://en.wikipedia.org/wiki/CamelCase) for more details. + * See [Wikipedia](https://en.wikipedia.org/wiki/CamelCase) for more details. * * @static * @memberOf _ * @category String - * @param {string} [string=''] The string to camel case. + * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * @@ -9013,13 +9076,13 @@ * // => 'Fred' */ function capitalize(string) { - string = toString(string); + string = baseToString(string); return string && (string.charAt(0).toUpperCase() + string.slice(1)); } /** * Deburrs `string` by converting latin-1 supplementary letters to basic latin letters. - * See [Wikipedia](http://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * See [Wikipedia](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * for more details. * * @static @@ -9033,7 +9096,7 @@ * // => 'deja vu' */ function deburr(string) { - string = toString(string); + string = baseToString(string); return string && string.replace(reLatin1, deburrLetter); } @@ -9059,7 +9122,7 @@ * // => true */ function endsWith(string, target, position) { - string = toString(string); + string = baseToString(string); target = (target + ''); var length = string.length; @@ -9072,18 +9135,18 @@ * their corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional characters - * use a third-party library like [_he_](http://mths.be/he). + * use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't require escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. - * See [Mathias Bynens's article](http://mathiasbynens.be/notes/ambiguous-ampersands) + * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in Internet Explorer < 9, they can break out - * of attribute values or HTML comments. See [#102](http://html5sec.org/#102), - * [#108](http://html5sec.org/#108), and [#133](http://html5sec.org/#133) of - * the [HTML5 Security Cheatsheet](http://html5sec.org/) for more details. + * of attribute values or HTML comments. See [#102](https://html5sec.org/#102), + * [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133) of + * the [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. * * When working with HTML you should always quote attribute values to reduce * XSS vectors. See [Ryan Grove's article](http://wonko.com/post/html-escaping) @@ -9101,7 +9164,7 @@ */ function escape(string) { // Reset `lastIndex` because in IE < 9 `String#replace` does not. - string = toString(string); + string = baseToString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; @@ -9122,7 +9185,7 @@ * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { - string = toString(string); + string = baseToString(string); return (string && reHasRegExpChars.test(string)) ? string.replace(reRegExpChars, '\\$&') : string; @@ -9130,13 +9193,13 @@ /** * Converts `string` to kebab case (a.k.a. spinal case). - * See [Wikipedia](http://en.wikipedia.org/wiki/Letter_case#Computers) for + * See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Computers) for * more details. * * @static * @memberOf _ * @category String - * @param {string} [string=''] The string to kebab case. + * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * @@ -9177,7 +9240,7 @@ * // => 'abc' */ function pad(string, length, chars) { - string = toString(string); + string = baseToString(string); length = +length; var strLength = string.length; @@ -9216,7 +9279,7 @@ * // => 'abc' */ function padLeft(string, length, chars) { - string = toString(string); + string = baseToString(string); return string && (createPad(string, length, chars) + string); } @@ -9244,7 +9307,7 @@ * // => 'abc' */ function padRight(string, length, chars) { - string = toString(string); + string = baseToString(string); return string && (string + createPad(string, length, chars)); } @@ -9254,12 +9317,12 @@ * in which case a `radix` of `16` is used. * * **Note:** This method aligns with the ES5 implementation of `parseInt`. - * See the [ES5 spec](http://es5.github.io/#E) for more details. + * See the [ES5 spec](https://es5.github.io/#E) for more details. * * @static * @memberOf _ * @category String - * @param {string} string The string to parse. + * @param {string} string The string to convert. * @param {number} [radix] The radix to interpret `value` by. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {number} Returns the converted integer. @@ -9280,9 +9343,9 @@ // Fallback for environments with pre-ES5 implementations. if (nativeParseInt(whitespace + '08') != 8) { parseInt = function(string, radix, guard) { - // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. // Chrome fails to trim leading whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109. + // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. if (guard ? isIterateeCall(string, radix, guard) : radix == null) { radix = 0; } else if (radix) { @@ -9315,15 +9378,13 @@ */ function repeat(string, n) { var result = ''; + string = baseToString(string); n = +n; - - if (n < 1 || string == null || !nativeIsFinite(n)) { + if (n < 1 || !string || !nativeIsFinite(n)) { return result; } - string = (string + ''); - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See http://en.wikipedia.org/wiki/Exponentiation_by_squaring. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. do { if (n % 2) { result += string; @@ -9337,12 +9398,12 @@ /** * Converts `string` to snake case. - * See [Wikipedia](http://en.wikipedia.org/wiki/Snake_case) for more details. + * See [Wikipedia](https://en.wikipedia.org/wiki/Snake_case) for more details. * * @static * @memberOf _ * @category String - * @param {string} [string=''] The string to snake case. + * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * @@ -9381,7 +9442,7 @@ * // => true */ function startsWith(string, target, position) { - string = toString(string); + string = baseToString(string); position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); return string.lastIndexOf(target, position) == position; } @@ -9398,7 +9459,7 @@ * for more details. * * For more information on precompiling templates see - * [Lo-Dash's custom builds documentation](https://lodash.com/custom-builds). + * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). @@ -9438,7 +9499,7 @@ * compiled({ 'user': 'barney' }); * // => 'hello barney!' * - * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter + * // using the ES delimiter as an alternative to the default "interpolate" delimiter * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' @@ -9490,7 +9551,7 @@ if (otherOptions && isIterateeCall(string, options, otherOptions)) { options = otherOptions = null; } - string = toString(string); + string = baseToString(string); options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), @@ -9512,7 +9573,6 @@ , 'g'); // Use a sourceURL for easier debugging. - // See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl. var sourceURL = '//# sourceURL=' + ('sourceURL' in options ? options.sourceURL @@ -9546,7 +9606,7 @@ source += "';\n"; - // If `variable` is not specified, wrap a with-statement around the generated + // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. var variable = options.variable; if (!variable) { @@ -9612,14 +9672,14 @@ */ function trim(string, chars, guard) { var value = string; - string = toString(string); + string = baseToString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1); } - chars = (chars + ''); + chars = baseToString(chars); return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1); } @@ -9643,14 +9703,14 @@ */ function trimLeft(string, chars, guard) { var value = string; - string = toString(string); + string = baseToString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string)) } - return string.slice(charsLeftIndex(string, (chars + ''))); + return string.slice(charsLeftIndex(string, baseToString(chars))); } /** @@ -9673,14 +9733,14 @@ */ function trimRight(string, chars, guard) { var value = string; - string = toString(string); + string = baseToString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(0, trimmedRightIndex(string) + 1) } - return string.slice(0, charsRightIndex(string, (chars + '')) + 1); + return string.slice(0, charsRightIndex(string, baseToString(chars)) + 1); } /** @@ -9726,12 +9786,12 @@ if (isObject(options)) { var separator = 'separator' in options ? options.separator : separator; length = 'length' in options ? +options.length || 0 : length; - omission = 'omission' in options ? (options.omission + '') : omission; + omission = 'omission' in options ? baseToString(options.omission) : omission; } else { length = +options || 0; } } - string = toString(string); + string = baseToString(string); if (length >= string.length) { return string; } @@ -9773,7 +9833,7 @@ * corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional HTML - * entities use a third-party library like [_he_](http://mths.be/he). + * entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ @@ -9786,7 +9846,7 @@ * // => 'fred, barney, & pebbles' */ function unescape(string) { - string = toString(string); + string = baseToString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; @@ -9814,7 +9874,7 @@ if (guard && isIterateeCall(string, pattern, guard)) { pattern = null; } - string = toString(string); + string = baseToString(string); return string.match(pattern || reWords) || []; } @@ -9930,9 +9990,9 @@ } /** - * Creates a "_.matches" style predicate function which performs a deep comparison - * between a given object and `source`, returning `true` if the given object - * has equivalent property values, else `false`. + * Creates a function which performs a deep comparison between a given object + * and `source`, returning `true` if the given object has equivalent property + * values, else `false`. * * @static * @memberOf _ @@ -10076,13 +10136,12 @@ } /** - * Creates a "_.property" style function which returns the property value - * of `key` on a given object. + * Creates a function which returns the property value of `key` on a given object. * * @static * @memberOf _ * @category Utility - * @param {string} key The name of the property to get. + * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. * @example * @@ -10174,7 +10233,7 @@ end = +end || 0; } // Use `Array(length)` so engines like Chakra and V8 avoid slower modes. - // See http://youtu.be/XAqIpGU8ZZk#t=17m25s. + // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details. var index = -1, length = nativeMax(ceil((end - start) / (step || 1)), 0), result = Array(length); @@ -10249,7 +10308,7 @@ */ function uniqueId(prefix) { var id = ++idCounter; - return toString(prefix) + id; + return baseToString(prefix) + id; } /*------------------------------------------------------------------------*/ @@ -10353,6 +10412,7 @@ lodash.thru = thru; lodash.times = times; lodash.toArray = toArray; + lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; @@ -10427,6 +10487,7 @@ lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isString = isString; + lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined; lodash.kebabCase = kebabCase; lodash.last = last; @@ -10517,14 +10578,12 @@ var isFilter = index == LAZY_FILTER_FLAG; LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { - iteratee = getCallback(iteratee, thisArg, 3); - var result = this.clone(), filtered = result.filtered, iteratees = result.iteratees || (result.iteratees = []); result.filtered = filtered || isFilter || (index == LAZY_WHILE_FLAG && result.dir < 0); - iteratees.push({ 'iteratee': iteratee, 'type': index }); + iteratees.push({ 'iteratee': getCallback(iteratee, thisArg, 3), 'type': index }); return result; }; }); @@ -10586,12 +10645,11 @@ }); LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) { - iteratee = getCallback(iteratee, thisArg, 3); - var done, lastIndex, isRight = this.dir < 0; + iteratee = getCallback(iteratee, thisArg, 3); return this.filter(function(value, index, array) { done = done && (isRight ? index < lastIndex : index > lastIndex); lastIndex = index; @@ -10601,7 +10659,6 @@ LazyWrapper.prototype.reject = function(iteratee, thisArg) { iteratee = getCallback(iteratee, thisArg, 3); - return this.filter(function(value, index, array) { return !iteratee(value, index, array); }); @@ -10693,14 +10750,15 @@ /*--------------------------------------------------------------------------*/ - // Export Lo-Dash. + // Export lodash. var _ = runInContext(); // Some AMD build optimizers like r.js check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { - // Expose Lo-Dash to the global object when an AMD loader is present to avoid - // errors in cases where Lo-Dash is loaded by a script tag and not intended - // as an AMD module. See http://requirejs.org/docs/errors.html#mismatch. + // Expose lodash to the global object when an AMD loader is present to avoid + // errors in cases where lodash is loaded by a script tag and not intended + // as an AMD module. See http://requirejs.org/docs/errors.html#mismatch for + // more details. root._ = _; // Define as an anonymous module so, through path mapping, it can be diff --git a/lodash.min.js b/lodash.min.js index 117b14cd2..1abb9d59e 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -1,85 +1,85 @@ /** * @license - * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE + * lodash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE * Build: `lodash modern -o ./lodash.js` */ -;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n) -}function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Zt(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++ui(r,a)&&u.push(a); -return u}function or(n,t){var r=n?n.length:0;if(!oe(r))return gr(n,t);for(var e=-1,u=pe(n);++et&&(t=-t>u?0:u+t),r=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t,r=mu(u);++eu(a,s)&&((r||f)&&a.push(s),c.push(l)) -}return c}function Cr(n,t){for(var r=-1,e=t.length,u=mu(e);++r>>1,i=n[o];(r?i<=t:it||null==r)return r; -if(3=o&&f<=i&&(e=O&&t>u||e>u&&t>=O)||o)&&(t&x&&(r[2]=p[2],f|=e&x?0:j),(e=p[3])&&(u=r[3],r[3]=u?Ur(u,e,p[4]):Mt(e),r[4]=u?v(r[3],B):Mt(p[4])),(e=p[5])&&(u=r[5],r[5]=u?Lr(u,e,p[6]):Mt(e),r[6]=u?v(r[5],B):Mt(p[6])),(e=p[7])&&(r[7]=Mt(e)),t&C&&(r[8]=null==r[8]?p[8]:eo(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=f),t=r[1],f=r[9] -}return r[9]=null==f?a?0:n.length:ro(f-c,0)||0,(p?mo:xo)(t==x?zr(r[0],r[2]):t!=k&&t!=(x|k)||r[4].length?Pr.apply(null,r):Vr.apply(null,r),r)}function Zr(n,t,r,e,u,o,i){var f=-1,a=n.length,c=t.length,l=true;if(a!=c&&(!u||c<=a))return false;for(;l&&++fu)||i===e&&i===o)&&(u=i,o=n)}),o}function Hr(n,t,r){var e=Wt.callback||pu,e=e===pu?tr:e;return r?e(n,t,r):e}function Qr(n,r,e){var u=Wt.indexOf||_e,u=u===_e?t:u;return n?u(n,r,e):u}function ne(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&Nu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function te(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Eu),new n -}function re(n,t,r){var e=n.constructor;switch(t){case lt:var u=new e;return u.length=n.length,Mt(n,u);case bt:return Fr(n);case pt:case ht:return new e(+n);case wt:case xt:case At:case jt:case Et:case Rt:case kt:case It:case Ot:return t=n.buffer,new e(r?Fr(t):t,n.byteOffset,n.length);case dt:case mt:return new e(n);case _t:u=new e(n.source,X.exec(n)),u.lastIndex=n.lastIndex}return u}function ee(n){return h(n)&&oe(n.length)&&Ct[Uu.call(n)]||false}function ue(n,t,r){if(!Xe(r))return false;var e=typeof t; -return"number"==e?(e=r.length,e=oe(e)&&p(t,e)):e="string"==e,e&&r[t]===n}function oe(n){return typeof n=="number"&&-1t?0:t)):[] -}function ve(n,t,r){var e=n?n.length:0;return e?((r?ue(n,t,r):null==t)&&(t=1),t=e-(+t||0),kr(n,0,0>t?0:t)):[]}function de(n,t,r){var e=-1,u=n?n.length:0;for(t=Hr(t,r,3);++ee?ro(u+e,0):e||0;else if(e)return e=Tr(n,r),n=n[e],(r===r?r===n:n!==n)?e:-1;return t(n,r,e)}function me(n){return ge(n,1)}function be(n,r,e,u){if(!n||!n.length)return[];typeof r!="boolean"&&null!=r&&(u=e,e=ue(n,r,u)?null:r,r=false); -var o=Hr();if((o!==tr||null!=e)&&(e=o(e,u,3)),r&&Qr()==t){r=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++e>>0,e=mu(r);++tr?ro(e+r,0):r||0:0,typeof n=="string"||!Co(n)&&tu(n)?rarguments.length,or)}function We(n,t,r,e){return(Co(n)?Gt:Rr)(n,Hr(t,e,4),r,3>arguments.length,ir)}function Ne(n,t,r){return(r?ue(n,t,r):null==t)?(n=se(n),t=n.length,0t?0:+t||0,n.length),n)}function Fe(n){n=se(n); -for(var t=-1,r=n.length,e=mu(r);++t=r||r>t?(f&&Mu(f),r=p,f=s=p=b,r&&(h=Oo(),a=n.apply(l,i),s||f||(i=l=null))):s=Zu(e,r)}function u(){s&&Mu(s),f=s=p=b,(v||g!==t)&&(h=Oo(),a=n.apply(l,i),s||f||(i=l=null))}function o(){if(i=arguments,c=Oo(),l=this,p=v&&(s||!d),false===g)var r=d&&!s; -else{f||d||(h=c);var o=g-(c-h),y=0>=o||o>g;y?(f&&(f=Mu(f)),h=c,a=n.apply(l,i)):f||(f=Zu(u,o))}return y&&s?s=Mu(s):s||t===g||(s=Zu(e,t)),r&&(y=true,a=n.apply(l,i)),!y||s||f||(i=l=null),a}var i,f,a,c,l,s,p,h=0,g=false,v=true;if(!Je(n))throw new Iu($);if(t=0>t?0:t,true===r)var d=true,v=false;else Xe(r)&&(d=r.leading,g="maxWait"in r&&ro(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Mu(s),f&&Mu(f),f=s=p=b},o}function qe(){var n=arguments,t=n.length-1;if(0>t)return function(){};if(!Pt(n,Je))throw new Iu($); -return function(){for(var r=t,e=n[r].apply(this,arguments);r--;)e=n[r].call(this,e);return e}}function Pe(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!Je(n)||t&&!Je(t))throw new Iu($);return r.cache=new Pe.Cache,r}function Ke(n){var t=kr(arguments,1),r=v(t,Ke.placeholder);return Yr(n,k,null,t,r)}function Ve(n){var t=kr(arguments,1),r=v(t,Ve.placeholder);return Yr(n,I,null,t,r)}function Ye(n){return oe(h(n)?n.length:b)&&Uu.call(n)==lt||false -}function Ze(n){return n&&1===n.nodeType&&h(n)&&-1t||null==n||!no(t))return r;n+="";do t%2&&(r+=n),t=qu(t/2),n+=n;while(t);return r}function cu(n,t,r){var e=n;return(n=he(n))?(r?ue(e,t,r):null==t)?n.slice(d(n),y(n)+1):(t+="",n.slice(u(n,t),o(n,t)+1)):n}function lu(n,t,r){return r&&ue(n,t,r)&&(t=null),n=he(n),n.match(t||ft)||[]}function su(n){try{return n()}catch(t){return Ge(t)?t:wu(t)}}function pu(n,t,r){return r&&ue(n,t,r)&&(t=null),tr(n,t)}function hu(n){return function(){return n}}function gu(n){return n}function vu(n){return xr(n,true) -}function du(n,t,r){if(null==r){var e=Xe(t),u=e&&No(t);((u=u&&u.length&&dr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=dr(t,No(t)));var o=true,e=-1,i=Je(n),f=u.length;false===r?o=false:Xe(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,ho=Hu?Hu.BYTES_PER_ELEMENT:0,go=Au.pow(2,53)-1,vo=Xu&&new Xu,yo=Wt.support={};!function(n){yo.funcDecomp=!He(g.WinRTError)&&ot.test(m),yo.funcNames=typeof xu.name=="string";try{yo.dom=11===Su.createDocumentFragment().nodeType}catch(t){yo.dom=false -}try{yo.nonEnumArgs=!Vu.call(arguments,1)}catch(r){yo.nonEnumArgs=true}}(0,0),Wt.templateSettings={escape:Y,evaluate:Z,interpolate:G,variable:"",imports:{_:Wt}};var _o=function(){function n(){}return function(t){if(Xe(t)){n.prototype=t;var r=new n;n.prototype=null}return r||g.Object()}}(),mo=vo?function(n,t){return vo.set(n,t),n}:gu;zu||(Fr=Bu&&Ju?function(n){var t=n.byteLength,r=Hu?qu(t/ho):0,e=r*ho,u=new Bu(t);if(r){var o=new Hu(u,0,r);o.set(new Hu(n,0,r))}return t!=e&&(o=new Ju(u,e),o.set(new Ju(n,e))),u -}:hu(null));var bo=Yu?function(n){return new Lt(n)}:hu(null),wo=vo?function(n){return vo.get(n)}:yu,xo=function(){var n=0,t=0;return function(r,e){var u=Oo(),o=N-(u-t);if(t=u,0=W)return r}else n=0;return mo(r,e)}}(),Ao=$r(function(n,t,r){Nu.call(n,r)?++n[r]:n[r]=1}),jo=$r(function(n,t,r){Nu.call(n,r)?n[r].push(t):n[r]=[t]}),Eo=$r(function(n,t,r){n[r]=t}),Ro=qr(Yt),ko=qr(function(n){for(var t=-1,r=n.length,e=co;++t--n?t.apply(this,arguments):void 0}},Wt.ary=function(n,t,r){return r&&ue(n,t,r)&&(t=null),t=null==t?n.length:+t||0,Yr(n,C,null,null,null,null,t) -},Wt.assign=Wo,Wt.at=function(n){return oe(n?n.length:0)&&(n=se(n)),nr(n,lr(arguments,false,false,1))},Wt.before=Le,Wt.bind=$e,Wt.bindAll=function(n){for(var t=n,r=1(s?Bt(s,f):o(l,f))){for(r=e;--r;){var p=u[r];if(0>(p?Bt(p,f):o(n[r],f)))continue n}s&&s.push(f),l.push(f)}return l},Wt.invert=function(n,t,r){r&&ue(n,t,r)&&(t=null),r=-1; -for(var e=No(n),u=e.length,o={};++rt?0:t)):[]},Wt.takeRight=function(n,t,r){var e=n?n.length:0; -return e?((r?ue(n,t,r):null==t)&&(t=1),t=e-(+t||0),kr(n,0>t?0:t)):[]},Wt.takeRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=Hr(t,r,3);e--&&t(n[e],e,n););return kr(n,e+1)},Wt.takeWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];var u=-1;for(t=Hr(t,r,3);++un||!no(n))return[];var e=-1,u=mu(eo(n,lo));for(t=Nr(t,r,1);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Wt.escape=function(n){return(n=he(n))&&V.test(n)?n.replace(P,c):n},Wt.escapeRegExp=iu,Wt.every=Re,Wt.find=Ie,Wt.findIndex=de,Wt.findKey=function(n,t,r){return t=Hr(t,r,3),cr(n,t,gr,true) -},Wt.findLast=function(n,t,r){return t=Hr(t,r,3),cr(n,t,ir)},Wt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Hr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Wt.findLastKey=function(n,t,r){return t=Hr(t,r,3),cr(n,t,vr,true)},Wt.findWhere=function(n,t){return Ie(n,vu(t))},Wt.first=ye,Wt.has=function(n,t){return n?Nu.call(n,t):false},Wt.identity=gu,Wt.includes=Ee,Wt.indexOf=_e,Wt.isArguments=Ye,Wt.isArray=Co,Wt.isBoolean=function(n){return true===n||false===n||h(n)&&Uu.call(n)==pt||false},Wt.isDate=function(n){return h(n)&&Uu.call(n)==ht||false -},Wt.isElement=Ze,Wt.isEmpty=function(n){if(null==n)return true;var t=n.length;return oe(t)&&(Co(n)||tu(n)||Ye(n)||h(n)&&Je(n.splice))?!t:!No(n).length},Wt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Nr(r,e,3),!r&&ie(n)&&ie(t)?n===t:(e=r?r(n,t):b,typeof e=="undefined"?_r(n,t,r):!!e)},Wt.isError=Ge,Wt.isFinite=So,Wt.isFunction=Je,Wt.isMatch=function(n,t,r,e){var u=No(t),o=u.length;if(r=typeof r=="function"&&Nr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ie(e))return null!=n&&e===n[i]&&Nu.call(n,i) -}for(var i=mu(o),f=mu(o);o--;)e=i[o]=t[u[o]],f[o]=ie(e);return br(n,u,i,f,r)},Wt.isNaN=function(n){return Qe(n)&&n!=+n},Wt.isNative=He,Wt.isNull=function(n){return null===n},Wt.isNumber=Qe,Wt.isObject=Xe,Wt.isPlainObject=To,Wt.isRegExp=nu,Wt.isString=tu,Wt.isUndefined=function(n){return typeof n=="undefined"},Wt.kebabCase=Lo,Wt.last=function(n){var t=n?n.length:0;return t?n[t-1]:b},Wt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?ro(e+r,0):eo(r||0,e-1))+1; -else if(r)return u=Tr(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return s(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Wt.max=Ro,Wt.min=ko,Wt.noConflict=function(){return g._=Lu,this},Wt.noop=yu,Wt.now=Oo,Wt.pad=function(n,t,r){n=he(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Wt.template=function(n,t,r){var e=Wt.templateSettings;r&&ue(n,t,r)&&(t=r=null),n=he(n),t=Qt(Qt({},r||t),e,Ht),r=Qt(Qt({},t.imports),e.imports,Ht);var u,o,i=No(r),f=Cr(r,i),a=0;r=t.interpolate||rt;var c="__p+='";r=Ru((t.escape||rt).source+"|"+r.source+"|"+(r===G?J:rt).source+"|"+(t.evaluate||rt).source+"|$","g"); -var s="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,f,s){return e||(e=i),c+=n.slice(a,s).replace(it,l),r&&(u=true,c+="'+__e("+r+")+'"),f&&(o=true,c+="';"+f+";\n__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),a=s+t.length,t}),c+="';",(t=t.variable)||(c="with(obj){"+c+"}"),c=(o?c.replace(z,""):c).replace(D,"$1").replace(M,"$1;"),c="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}",t=su(function(){return xu(i,s+"return "+c).apply(b,f) -}),t.source=c,Ge(t))throw t;return t},Wt.trim=cu,Wt.trimLeft=function(n,t,r){var e=n;return(n=he(n))?n.slice((r?ue(e,t,r):null==t)?d(n):u(n,t+"")):n},Wt.trimRight=function(n,t,r){var e=n;return(n=he(n))?(r?ue(e,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,o(n,t+"")+1):n},Wt.trunc=function(n,t,r){r&&ue(n,t,r)&&(t=null);var e=S;if(r=T,null!=t)if(Xe(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?t.omission+"":r}else e=+t||0;if(n=he(n),e>=n.length)return n;if(e-=r.length,1>e)return r; -if(t=n.slice(0,e),null==u)return t+r;if(nu(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=Ru(u.source,(X.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1u.dir,i.push({iteratee:n,type:t}),u -}}),qt(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";Ft.prototype[n]=function(e){e=null==e?1:ro(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?eo(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},Ft.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Ft.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),qt(["first","last"],function(n,t){var r="take"+(t?"Right":"");Ft.prototype[n]=function(){return this[r](1).value()[0] -}}),qt(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");Ft.prototype[n]=function(){return this[r](1)}}),qt(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?vu:_u;Ft.prototype[n]=function(n){return this[r](e(n))}}),Ft.prototype.dropWhile=function(n,t){n=Hr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},Ft.prototype.reject=function(n,t){return n=Hr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},Ft.prototype.slice=function(n,t){n=null==n?0:+n||0; -var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},gr(Ft.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Wt.prototype[t]=function(){function e(n){return n=[n],Ku.apply(n,o),Wt[t].apply(Wt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,f=!!this.__actions__.length,a=u instanceof Ft,c=a&&!f;return r&&!i?c?n.call(u):Wt[t](this.value()):a||Co(u)?(u=n.apply(c?u:new Ft(this),o),r||!f&&!u.actions||(u.actions||(u.actions=[])).push({func:je,args:[e],thisArg:Wt}),new Nt(u,i)):this.thru(e) -}}),qt("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Ou[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Wt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),Ft.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new Ft(this.wrapped);return e.actions=n?Mt(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?Mt(t):null,e.takeCount=this.takeCount,e.views=r?Mt(r):null,e -},Ft.prototype.reverse=function(){var n=this.filtered,t=n?new Ft(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},Ft.prototype.value=function(){var n=this.wrapped.value();if(!Co(n))return Sr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,f=-1,a=o?o.length:0;++f"'`]/g,K=RegExp(q.source),V=RegExp(P.source),Y=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,G=/<%=([\s\S]+?)%>/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,X=/\w*$/,H=/^\s*function[ \n\r\t]+\w/,Q=/^0[xX]/,nt=/^\[object .+?Constructor\]$/,tt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,rt=/($^)/,et=/[.*+?^${}()|[\]\/\\]/g,ut=RegExp(et.source),ot=/\bthis\b/,it=/['\n\r\u2028\u2029\\]/g,ft=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),at=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",ct="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),lt="[object Arguments]",st="[object Array]",pt="[object Boolean]",ht="[object Date]",gt="[object Error]",vt="[object Function]",dt="[object Number]",yt="[object Object]",_t="[object RegExp]",mt="[object String]",bt="[object ArrayBuffer]",wt="[object Float32Array]",xt="[object Float64Array]",At="[object Int8Array]",jt="[object Int16Array]",Et="[object Int32Array]",Rt="[object Uint8Array]",kt="[object Uint8ClampedArray]",It="[object Uint16Array]",Ot="[object Uint32Array]",Ct={}; -Ct[lt]=Ct[st]=Ct[wt]=Ct[xt]=Ct[At]=Ct[jt]=Ct[Et]=Ct[Rt]=Ct[kt]=Ct[It]=Ct[Ot]=true,Ct[bt]=Ct[pt]=Ct[ht]=Ct[gt]=Ct[vt]=Ct["[object Map]"]=Ct[dt]=Ct[yt]=Ct[_t]=Ct["[object Set]"]=Ct[mt]=Ct["[object WeakMap]"]=false;var St={};St[lt]=St[st]=St[bt]=St[pt]=St[ht]=St[wt]=St[xt]=St[At]=St[jt]=St[Et]=St[dt]=St[yt]=St[_t]=St[mt]=St[Rt]=St[kt]=St[It]=St[Ot]=true,St[gt]=St[vt]=St["[object Map]"]=St["[object Set]"]=St["[object WeakMap]"]=false;var Tt={leading:false,maxWait:0,trailing:false},Wt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ft={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ut={"function":true,object:true},Lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=Ut[typeof window]&&window!==(this&&this.window)?window:this,Bt=Ut[typeof exports]&&exports&&!exports.nodeType&&exports,Ut=Ut[typeof module]&&module&&!module.nodeType&&module,zt=Bt&&Ut&&typeof global=="object"&&global; -!zt||zt.global!==zt&&zt.window!==zt&&zt.self!==zt||($t=zt);var zt=Ut&&Ut.exports===Bt&&Bt,Dt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($t._=Dt, define(function(){return Dt})):Bt&&Ut?zt?(Ut.exports=Dt)._=Dt:Bt._=Dt:$t._=Dt}).call(this); +;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n) +}function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Yt(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++ui(r,f)&&u.push(f);return u}function or(n,t){var r=n?n.length:0;if(!ue(r))return gr(n,t);for(var e=-1,u=se(n);++et&&(t=-t>u?0:u+t),r=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t,r=mu(u);++eu(f,s)&&((r||a)&&f.push(s),c.push(l))}return c}function Or(n,t){for(var r=-1,e=t.length,u=mu(e);++r>>1,i=n[o]; +(r?i<=t:it||null==r)return r;if(3=o&&a<=i&&(e=O&&t>u||e>u&&t>=O)||o)&&(t&x&&(r[2]=p[2],a|=e&x?0:j),(e=p[3])&&(u=r[3],r[3]=u?Fr(u,e,p[4]):zt(e),r[4]=u?v(r[3],B):zt(p[4])),(e=p[5])&&(u=r[5],r[5]=u?Ur(u,e,p[6]):zt(e),r[6]=u?v(r[5],B):zt(p[6])),(e=p[7])&&(r[7]=zt(e)),t&C&&(r[8]=null==r[8]?p[8]:uo(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=a),t=r[1],a=r[9]}return r[9]=null==a?f?0:n.length:eo(a-c,0)||0,(p?bo:Ao)(t==x?Br(r[0],r[2]):t!=R&&t!=(x|R)||r[4].length?qr.apply(null,r):Kr.apply(null,r),r) +}function Yr(n,t,r,e,u,o,i){var a=-1,f=n.length,c=t.length,l=true;if(f!=c&&(!u||c<=f))return false;for(;l&&++au)||i===e&&i===o)&&(u=i,o=n) +}),o}function Xr(n,t,r){var e=Wt.callback||pu,e=e===pu?tr:e;return r?e(n,t,r):e}function Hr(n,r,e){var u=Wt.indexOf||de,u=u===de?t:u;return n?u(n,r,e):u}function Qr(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&Nu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function ne(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=ku),new n}function te(n,t,r){var e=n.constructor;switch(t){case J:return Nr(n);case M:case q:return new e(+n);case X:case H:case Q:case nt:case tt:case rt:case et:case ut:case ot:return t=n.buffer,new e(r?Nr(t):t,n.byteOffset,n.length); +case V:case G:return new e(n);case Z:var u=new e(n.source,yt.exec(n));u.lastIndex=n.lastIndex}return u}function re(n,t){return n=+n,t=null==t?vo:t,-1t?0:t)):[]}function he(n,t,r){var e=n?n.length:0;return e?((r?ee(n,t,r):null==t)&&(t=1),t=e-(+t||0),Er(n,0,0>t?0:t)):[]}function ge(n,t,r){var e=-1,u=n?n.length:0;for(t=Xr(t,r,3);++ee?eo(u+e,0):e||0;else if(e)return e=Tr(n,r),n=n[e],(r===r?r===n:n!==n)?e:-1; +return t(n,r,e)}function ye(n){return pe(n,1)}function _e(n,r,e,u){if(!n||!n.length)return[];typeof r!="boolean"&&null!=r&&(u=e,e=ee(n,r,u)?null:r,r=false);var o=Xr();if((o!==tr||null!=e)&&(e=o(e,u,3)),r&&Hr()==t){r=e;var i;e=-1,u=n.length;for(var o=-1,a=[];++e>>0,e=mu(r);++tr?eo(e+r,0):r||0:0,typeof n=="string"||!To(n)&&Qe(n)?rarguments.length,or)}function Te(n,t,r,e){return(To(n)?Zt:kr)(n,Xr(t,e,4),r,3>arguments.length,ir)}function Se(n,t,r){return(r?ee(n,t,r):null==t)?(n=le(n),t=n.length,0t?0:+t||0,n.length),n) +}function We(n){n=le(n);for(var t=-1,r=n.length,e=mu(r);++t=r||r>t?(a&&Mu(a),r=p,a=s=p=b,r&&(h=Co(),f=n.apply(l,i),s||a||(i=l=null))):s=Zu(e,r)}function u(){s&&Mu(s),a=s=p=b,(v||g!==t)&&(h=Co(),f=n.apply(l,i),s||a||(i=l=null)) +}function o(){if(i=arguments,c=Co(),l=this,p=v&&(s||!d),false===g)var r=d&&!s;else{a||d||(h=c);var o=g-(c-h),y=0>=o||o>g;y?(a&&(a=Mu(a)),h=c,f=n.apply(l,i)):a||(a=Zu(u,o))}return y&&s?s=Mu(s):s||t===g||(s=Zu(e,t)),r&&(y=true,f=n.apply(l,i)),!y||s||a||(i=l=null),f}var i,a,f,c,l,s,p,h=0,g=false,v=true;if(!Ze(n))throw new Iu($);if(t=0>t?0:t,true===r)var d=true,v=false;else Ge(r)&&(d=r.leading,g="maxWait"in r&&eo(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Mu(s),a&&Mu(a),a=s=p=b},o}function De(){var n=arguments,t=n.length-1; +if(0>t)return function(){};if(!qt(n,Ze))throw new Iu($);return function(){for(var r=t,e=n[r].apply(this,arguments);r--;)e=n[r].call(this,e);return e}}function Me(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!Ze(n)||t&&!Ze(t))throw new Iu($);return r.cache=new Me.Cache,r}function qe(n){var t=Er(arguments,1),r=v(t,qe.placeholder);return Vr(n,R,null,t,r)}function Pe(n){var t=Er(arguments,1),r=v(t,Pe.placeholder); +return Vr(n,I,null,t,r)}function Ke(n){return ue(h(n)?n.length:b)&&Uu.call(n)==z||false}function Ve(n){return n&&1===n.nodeType&&h(n)&&-1t||!n||!to(t))return r;do t%2&&(r+=n),t=qu(t/2),n+=n;while(t);return r}function cu(n,t,r){var u=n;return(n=e(n))?(r?ee(u,t,r):null==t)?n.slice(d(n),y(n)+1):(t=e(t),n.slice(o(n,t),i(n,t)+1)):n}function lu(n,t,r){return r&&ee(n,t,r)&&(t=null),n=e(n),n.match(t||Rt)||[] +}function su(n){try{return n()}catch(t){return Ye(t)?t:wu(t)}}function pu(n,t,r){return r&&ee(n,t,r)&&(t=null),tr(n,t)}function hu(n){return function(){return n}}function gu(n){return n}function vu(n){return wr(n,true)}function du(n,t,r){if(null==r){var e=Ge(t),u=e&&Fo(t);((u=u&&u.length&&dr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=dr(t,Fo(t)));var o=true,e=-1,i=Ze(n),a=u.length;false===r?o=false:Ge(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,go=Hu?Hu.BYTES_PER_ELEMENT:0,vo=Au.pow(2,53)-1,yo=Xu&&new Xu,_o=Wt.support={};!function(n){_o.funcDecomp=!Je(g.WinRTError)&&kt.test(m),_o.funcNames=typeof xu.name=="string";try{_o.dom=11===Tu.createDocumentFragment().nodeType +}catch(t){_o.dom=false}try{_o.nonEnumArgs=!Vu.call(arguments,1)}catch(r){_o.nonEnumArgs=true}}(0,0),Wt.templateSettings={escape:ht,evaluate:gt,interpolate:vt,variable:"",imports:{_:Wt}};var mo=function(){function n(){}return function(t){if(Ge(t)){n.prototype=t;var r=new n;n.prototype=null}return r||g.Object()}}(),bo=yo?function(n,t){return yo.set(n,t),n}:gu;zu||(Nr=Bu&&Ju?function(n){var t=n.byteLength,r=Hu?qu(t/go):0,e=r*go,u=new Bu(t);if(r){var o=new Hu(u,0,r);o.set(new Hu(n,0,r))}return t!=e&&(o=new Ju(u,e),o.set(new Ju(n,e))),u +}:hu(null));var wo=no&&Yu?function(n){return new Lt(n)}:hu(null),xo=yo?function(n){return yo.get(n)}:yu,Ao=function(){var n=0,t=0;return function(r,e){var u=Co(),o=N-(u-t);if(t=u,0=W)return r}else n=0;return bo(r,e)}}(),jo=Lr(function(n,t,r){Nu.call(n,r)?++n[r]:n[r]=1}),ko=Lr(function(n,t,r){Nu.call(n,r)?n[r].push(t):n[r]=[t]}),Eo=Lr(function(n,t,r){n[r]=t}),Ro=Mr(Vt),Io=Mr(function(n){for(var t=-1,r=n.length,e=lo;++t--n?t.apply(this,arguments):void 0}},Wt.ary=function(n,t,r){return r&&ee(n,t,r)&&(t=null),t=n&&null==t?n.length:eo(+t||0,0),Vr(n,C,null,null,null,null,t) +},Wt.assign=No,Wt.at=function(n){return ue(n?n.length:0)&&(n=le(n)),Qt(n,lr(arguments,false,false,1))},Wt.before=Fe,Wt.bind=Ue,Wt.bindAll=function(n){for(var t=n,r=1(s?Bt(s,a):o(l,a))){for(r=e;--r;){var p=u[r];if(0>(p?Bt(p,a):o(n[r],a)))continue n}s&&s.push(a),l.push(a)}return l},Wt.invert=function(n,t,r){r&&ee(n,t,r)&&(t=null),r=-1; +for(var e=Fo(n),u=e.length,o={};++rt?0:t)):[]},Wt.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?ee(n,t,r):null==t)&&(t=1),t=e-(+t||0),Er(n,0>t?0:t)):[] +},Wt.takeRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=Xr(t,r,3);e--&&t(n[e],e,n););return Er(n,e+1)},Wt.takeWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];var u=-1;for(t=Xr(t,r,3);++un||!to(n))return[];var e=-1,u=mu(uo(n,so));for(t=Wr(t,r,1);++er?0:+r||0,u))-t.length,0<=r&&n.indexOf(t,r)==r},Wt.escape=function(n){return(n=e(n))&&pt.test(n)?n.replace(lt,l):n},Wt.escapeRegExp=iu,Wt.every=je,Wt.find=Ee,Wt.findIndex=ge,Wt.findKey=function(n,t,r){return t=Xr(t,r,3),cr(n,t,gr,true) +},Wt.findLast=function(n,t,r){return t=Xr(t,r,3),cr(n,t,ir)},Wt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Xr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Wt.findLastKey=function(n,t,r){return t=Xr(t,r,3),cr(n,t,vr,true)},Wt.findWhere=function(n,t){return Ee(n,vu(t))},Wt.first=ve,Wt.has=function(n,t){return n?Nu.call(n,t):false},Wt.identity=gu,Wt.includes=Ae,Wt.indexOf=de,Wt.isArguments=Ke,Wt.isArray=To,Wt.isBoolean=function(n){return true===n||false===n||h(n)&&Uu.call(n)==M||false},Wt.isDate=function(n){return h(n)&&Uu.call(n)==q||false +},Wt.isElement=Ve,Wt.isEmpty=function(n){if(null==n)return true;var t=n.length;return ue(t)&&(To(n)||Qe(n)||Ke(n)||h(n)&&Ze(n.splice))?!t:!Fo(n).length},Wt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Wr(r,e,3),!r&&oe(n)&&oe(t)?n===t:(e=r?r(n,t):b,typeof e=="undefined"?_r(n,t,r):!!e)},Wt.isError=Ye,Wt.isFinite=So,Wt.isFunction=Ze,Wt.isMatch=function(n,t,r,e){var u=Fo(t),o=u.length;if(r=typeof r=="function"&&Wr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],oe(e))return null!=n&&e===n[i]&&Nu.call(n,i) +}for(var i=mu(o),a=mu(o);o--;)e=i[o]=t[u[o]],a[o]=oe(e);return mr(n,u,i,a,r)},Wt.isNaN=function(n){return Xe(n)&&n!=+n},Wt.isNative=Je,Wt.isNull=function(n){return null===n},Wt.isNumber=Xe,Wt.isObject=Ge,Wt.isPlainObject=Wo,Wt.isRegExp=He,Wt.isString=Qe,Wt.isTypedArray=nu,Wt.isUndefined=function(n){return typeof n=="undefined"},Wt.kebabCase=$o,Wt.last=function(n){var t=n?n.length:0;return t?n[t-1]:b},Wt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?eo(e+r,0):uo(r||0,e-1))+1; +else if(r)return u=Tr(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Wt.max=Ro,Wt.min=Io,Wt.noConflict=function(){return g._=Lu,this},Wt.noop=yu,Wt.now=Co,Wt.pad=function(n,t,r){n=e(n),t=+t;var u=n.length;return ur?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Wt.template=function(n,t,r){var u=Wt.templateSettings;r&&ee(n,t,r)&&(t=r=null),n=e(n),t=Ht(Ht({},r||t),u,Xt),r=Ht(Ht({},t.imports),u.imports,Xt);var o,i,a=Fo(r),f=Or(r,a),c=0;r=t.interpolate||xt;var l="__p+='";r=Eu((t.escape||xt).source+"|"+r.source+"|"+(r===vt?dt:xt).source+"|"+(t.evaluate||xt).source+"|$","g"); +var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,a,f){return e||(e=u),l+=n.slice(c,f).replace(Et,s),r&&(o=true,l+="'+__e("+r+")+'"),a&&(i=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=f+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(it,""):l).replace(at,"$1").replace(ft,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=su(function(){return xu(a,p+"return "+l).apply(b,f) +}),t.source=l,Ye(t))throw t;return t},Wt.trim=cu,Wt.trimLeft=function(n,t,r){var u=n;return(n=e(n))?n.slice((r?ee(u,t,r):null==t)?d(n):o(n,e(t))):n},Wt.trimRight=function(n,t,r){var u=n;return(n=e(n))?(r?ee(u,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,i(n,e(t))+1):n},Wt.trunc=function(n,t,r){r&&ee(n,t,r)&&(t=null);var u=T;if(r=S,null!=t)if(Ge(t)){var o="separator"in t?t.separator:o,u="length"in t?+t.length||0:u;r="omission"in t?e(t.omission):r}else u=+t||0;if(n=e(n),u>=n.length)return n;if(u-=r.length,1>u)return r; +if(t=n.slice(0,u),null==o)return t+r;if(He(o)){if(n.slice(u).search(o)){var i,a=n.slice(0,u);for(o.global||(o=Eu(o.source,(yt.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(a);)i=n.index;t=t.slice(0,null==i?u:i)}}else n.indexOf(o,u)!=u&&(o=t.lastIndexOf(o),-1u.dir,i.push({iteratee:Xr(n,e,3),type:t}),u +}}),Mt(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";Ft.prototype[n]=function(e){e=null==e?1:eo(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?uo(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},Ft.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Ft.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),Mt(["first","last"],function(n,t){var r="take"+(t?"Right":"");Ft.prototype[n]=function(){return this[r](1).value()[0] +}}),Mt(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");Ft.prototype[n]=function(){return this[r](1)}}),Mt(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?vu:_u;Ft.prototype[n]=function(n){return this[r](e(n))}}),Ft.prototype.dropWhile=function(n,t){var r,e,u=0>this.dir;return n=Xr(n,t,3),this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},Ft.prototype.reject=function(n,t){return n=Xr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},Ft.prototype.slice=function(n,t){n=null==n?0:+n||0; +var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},gr(Ft.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Wt.prototype[t]=function(){function e(n){return n=[n],Ku.apply(n,o),Wt[t].apply(Wt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,a=!!this.__actions__.length,f=u instanceof Ft,c=f&&!a;return r&&!i?c?n.call(u):Wt[t](this.value()):f||To(u)?(u=n.apply(c?u:new Ft(this),o),r||!a&&!u.actions||(u.actions||(u.actions=[])).push({func:xe,args:[e],thisArg:Wt}),new Nt(u,i)):this.thru(e) +}}),Mt("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Ou[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Wt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),Ft.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new Ft(this.wrapped);return e.actions=n?zt(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?zt(t):null,e.takeCount=this.takeCount,e.views=r?zt(r):null,e +},Ft.prototype.reverse=function(){var n=this.filtered,t=n?new Ft(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},Ft.prototype.value=function(){var n=this.wrapped.value();if(!To(n))return Cr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,st=RegExp(ct.source),pt=RegExp(lt.source),ht=/<%-([\s\S]+?)%>/g,gt=/<%([\s\S]+?)%>/g,vt=/<%=([\s\S]+?)%>/g,dt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,_t=/^\s*function[ \n\r\t]+\w/,mt=/^0[xX]/,bt=/^\[object .+?Constructor\]$/,wt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,xt=/($^)/,At=/[.*+?^${}()|[\]\/\\]/g,jt=RegExp(At.source),kt=/\bthis\b/,Et=/['\n\r\u2028\u2029\\]/g,Rt=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),It=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Ot="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),Ct={}; +Ct[X]=Ct[H]=Ct[Q]=Ct[nt]=Ct[tt]=Ct[rt]=Ct[et]=Ct[ut]=Ct[ot]=true,Ct[z]=Ct[D]=Ct[J]=Ct[M]=Ct[q]=Ct[P]=Ct[K]=Ct["[object Map]"]=Ct[V]=Ct[Y]=Ct[Z]=Ct["[object Set]"]=Ct[G]=Ct["[object WeakMap]"]=false;var Tt={};Tt[z]=Tt[D]=Tt[J]=Tt[M]=Tt[q]=Tt[X]=Tt[H]=Tt[Q]=Tt[nt]=Tt[tt]=Tt[V]=Tt[Y]=Tt[Z]=Tt[G]=Tt[rt]=Tt[et]=Tt[ut]=Tt[ot]=true,Tt[P]=Tt[K]=Tt["[object Map]"]=Tt["[object Set]"]=Tt["[object WeakMap]"]=false;var St={leading:false,maxWait:0,trailing:false},Wt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ft={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ut={"function":true,object:true},Lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=Ut[typeof window]&&window!==(this&&this.window)?window:this,Bt=Ut[typeof exports]&&exports&&!exports.nodeType&&exports,Ut=Ut[typeof module]&&module&&!module.nodeType&&module,zt=Bt&&Ut&&typeof global=="object"&&global; +!zt||zt.global!==zt&&zt.window!==zt&&zt.self!==zt||($t=zt);var zt=Ut&&Ut.exports===Bt&&Bt,Dt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($t._=Dt, define(function(){return Dt})):Bt&&Ut?zt?(Ut.exports=Dt)._=Dt:Bt._=Dt:$t._=Dt}).call(this); \ No newline at end of file