00001 00010 ;(function() { 00011 00013 var undefined; 00014 00016 var VERSION = '4.17.4'; 00017 00019 var FUNC_ERROR_TEXT = 'Expected a function'; 00020 00022 var COMPARE_PARTIAL_FLAG = 1, 00023 COMPARE_UNORDERED_FLAG = 2; 00024 00026 var WRAP_BIND_FLAG = 1, 00027 WRAP_PARTIAL_FLAG = 32; 00028 00030 var INFINITY = 1 / 0, 00031 MAX_SAFE_INTEGER = 9007199254740991; 00032 00034 var argsTag = '[object Arguments]', 00035 arrayTag = '[object Array]', 00036 asyncTag = '[object AsyncFunction]', 00037 boolTag = '[object Boolean]', 00038 dateTag = '[object Date]', 00039 errorTag = '[object Error]', 00040 funcTag = '[object Function]', 00041 genTag = '[object GeneratorFunction]', 00042 numberTag = '[object Number]', 00043 objectTag = '[object Object]', 00044 proxyTag = '[object Proxy]', 00045 regexpTag = '[object RegExp]', 00046 stringTag = '[object String]'; 00047 00049 var reUnescapedHtml = /[&<>"']/g, 00050 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 00051 00053 var htmlEscapes = { 00054 '&': '&', 00055 '<': '<', 00056 '>': '>', 00057 '"': '"', 00058 "'": ''' 00059 }; 00060 00062 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 00063 00065 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 00066 00068 var root = freeGlobal || freeSelf || Function('return this')(); 00069 00071 var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; 00072 00074 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; 00075 00076 /*--------------------------------------------------------------------------*/ 00077 00086 function arrayPush(array, values) { 00087 array.push.apply(array, values); 00088 return array; 00089 } 00090 00102 function baseFindIndex(array, predicate, fromIndex, fromRight) { 00103 var length = array.length, 00104 index = fromIndex + (fromRight ? 1 : -1); 00105 00106 while ((fromRight ? index-- : ++index < length)) { 00107 if (predicate(array[index], index, array)) { 00108 return index; 00109 } 00110 } 00111 return -1; 00112 } 00113 00121 function baseProperty(key) { 00122 return function(object) { 00123 return object == null ? undefined : object[key]; 00124 }; 00125 } 00126 00134 function basePropertyOf(object) { 00135 return function(key) { 00136 return object == null ? undefined : object[key]; 00137 }; 00138 } 00139 00153 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 00154 eachFunc(collection, function(value, index, collection) { 00155 accumulator = initAccum 00156 ? (initAccum = false, value) 00157 : iteratee(accumulator, value, index, collection); 00158 }); 00159 return accumulator; 00160 } 00161 00172 function baseValues(object, props) { 00173 return baseMap(props, function(key) { 00174 return object[key]; 00175 }); 00176 } 00177 00185 var escapeHtmlChar = basePropertyOf(htmlEscapes); 00186 00195 function overArg(func, transform) { 00196 return function(arg) { 00197 return func(transform(arg)); 00198 }; 00199 } 00200 00201 /*--------------------------------------------------------------------------*/ 00202 00204 var arrayProto = Array.prototype, 00205 objectProto = Object.prototype; 00206 00208 var hasOwnProperty = objectProto.hasOwnProperty; 00209 00211 var idCounter = 0; 00212 00218 var nativeObjectToString = objectProto.toString; 00219 00221 var oldDash = root._; 00222 00224 var objectCreate = Object.create, 00225 propertyIsEnumerable = objectProto.propertyIsEnumerable; 00226 00227 /* Built-in method references for those with the same name as other `lodash` methods. */ 00228 var nativeIsFinite = root.isFinite, 00229 nativeKeys = overArg(Object.keys, Object), 00230 nativeMax = Math.max; 00231 00232 /*------------------------------------------------------------------------*/ 00233 00351 function lodash(value) { 00352 return value instanceof LodashWrapper 00353 ? value 00354 : new LodashWrapper(value); 00355 } 00356 00365 var baseCreate = (function() { 00366 function object() {} 00367 return function(proto) { 00368 if (!isObject(proto)) { 00369 return {}; 00370 } 00371 if (objectCreate) { 00372 return objectCreate(proto); 00373 } 00374 object.prototype = proto; 00375 var result = new object; 00376 object.prototype = undefined; 00377 return result; 00378 }; 00379 }()); 00380 00388 function LodashWrapper(value, chainAll) { 00389 this.__wrapped__ = value; 00390 this.__actions__ = []; 00391 this.__chain__ = !!chainAll; 00392 } 00393 00394 LodashWrapper.prototype = baseCreate(lodash.prototype); 00395 LodashWrapper.prototype.constructor = LodashWrapper; 00396 00397 /*------------------------------------------------------------------------*/ 00398 00409 function assignValue(object, key, value) { 00410 var objValue = object[key]; 00411 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 00412 (value === undefined && !(key in object))) { 00413 baseAssignValue(object, key, value); 00414 } 00415 } 00416 00426 function baseAssignValue(object, key, value) { 00427 object[key] = value; 00428 } 00429 00440 function baseDelay(func, wait, args) { 00441 if (typeof func != 'function') { 00442 throw new TypeError(FUNC_ERROR_TEXT); 00443 } 00444 return setTimeout(function() { func.apply(undefined, args); }, wait); 00445 } 00446 00455 var baseEach = createBaseEach(baseForOwn); 00456 00466 function baseEvery(collection, predicate) { 00467 var result = true; 00468 baseEach(collection, function(value, index, collection) { 00469 result = !!predicate(value, index, collection); 00470 return result; 00471 }); 00472 return result; 00473 } 00474 00485 function baseExtremum(array, iteratee, comparator) { 00486 var index = -1, 00487 length = array.length; 00488 00489 while (++index < length) { 00490 var value = array[index], 00491 current = iteratee(value); 00492 00493 if (current != null && (computed === undefined 00494 ? (current === current && !false) 00495 : comparator(current, computed) 00496 )) { 00497 var computed = current, 00498 result = value; 00499 } 00500 } 00501 return result; 00502 } 00503 00512 function baseFilter(collection, predicate) { 00513 var result = []; 00514 baseEach(collection, function(value, index, collection) { 00515 if (predicate(value, index, collection)) { 00516 result.push(value); 00517 } 00518 }); 00519 return result; 00520 } 00521 00533 function baseFlatten(array, depth, predicate, isStrict, result) { 00534 var index = -1, 00535 length = array.length; 00536 00537 predicate || (predicate = isFlattenable); 00538 result || (result = []); 00539 00540 while (++index < length) { 00541 var value = array[index]; 00542 if (depth > 0 && predicate(value)) { 00543 if (depth > 1) { 00544 // Recursively flatten arrays (susceptible to call stack limits). 00545 baseFlatten(value, depth - 1, predicate, isStrict, result); 00546 } else { 00547 arrayPush(result, value); 00548 } 00549 } else if (!isStrict) { 00550 result[result.length] = value; 00551 } 00552 } 00553 return result; 00554 } 00555 00567 var baseFor = createBaseFor(); 00568 00577 function baseForOwn(object, iteratee) { 00578 return object && baseFor(object, iteratee, keys); 00579 } 00580 00590 function baseFunctions(object, props) { 00591 return baseFilter(props, function(key) { 00592 return isFunction(object[key]); 00593 }); 00594 } 00595 00603 function baseGetTag(value) { 00604 return objectToString(value); 00605 } 00606 00616 function baseGt(value, other) { 00617 return value > other; 00618 } 00619 00627 var baseIsArguments = noop; 00628 00636 function baseIsDate(value) { 00637 return isObjectLike(value) && baseGetTag(value) == dateTag; 00638 } 00639 00654 function baseIsEqual(value, other, bitmask, customizer, stack) { 00655 if (value === other) { 00656 return true; 00657 } 00658 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 00659 return value !== value && other !== other; 00660 } 00661 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 00662 } 00663 00678 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 00679 var objIsArr = isArray(object), 00680 othIsArr = isArray(other), 00681 objTag = objIsArr ? arrayTag : baseGetTag(object), 00682 othTag = othIsArr ? arrayTag : baseGetTag(other); 00683 00684 objTag = objTag == argsTag ? objectTag : objTag; 00685 othTag = othTag == argsTag ? objectTag : othTag; 00686 00687 var objIsObj = objTag == objectTag, 00688 othIsObj = othTag == objectTag, 00689 isSameTag = objTag == othTag; 00690 00691 stack || (stack = []); 00692 var objStack = find(stack, function(entry) { 00693 return entry[0] == object; 00694 }); 00695 var othStack = find(stack, function(entry) { 00696 return entry[0] == other; 00697 }); 00698 if (objStack && othStack) { 00699 return objStack[1] == other; 00700 } 00701 stack.push([object, other]); 00702 stack.push([other, object]); 00703 if (isSameTag && !objIsObj) { 00704 var result = (objIsArr) 00705 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 00706 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 00707 stack.pop(); 00708 return result; 00709 } 00710 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 00711 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 00712 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 00713 00714 if (objIsWrapped || othIsWrapped) { 00715 var objUnwrapped = objIsWrapped ? object.value() : object, 00716 othUnwrapped = othIsWrapped ? other.value() : other; 00717 00718 var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 00719 stack.pop(); 00720 return result; 00721 } 00722 } 00723 if (!isSameTag) { 00724 return false; 00725 } 00726 var result = equalObjects(object, other, bitmask, customizer, equalFunc, stack); 00727 stack.pop(); 00728 return result; 00729 } 00730 00738 function baseIsRegExp(value) { 00739 return isObjectLike(value) && baseGetTag(value) == regexpTag; 00740 } 00741 00749 function baseIteratee(func) { 00750 if (typeof func == 'function') { 00751 return func; 00752 } 00753 if (func == null) { 00754 return identity; 00755 } 00756 return (typeof func == 'object' ? baseMatches : baseProperty)(func); 00757 } 00758 00768 function baseLt(value, other) { 00769 return value < other; 00770 } 00771 00780 function baseMap(collection, iteratee) { 00781 var index = -1, 00782 result = isArrayLike(collection) ? Array(collection.length) : []; 00783 00784 baseEach(collection, function(value, key, collection) { 00785 result[++index] = iteratee(value, key, collection); 00786 }); 00787 return result; 00788 } 00789 00797 function baseMatches(source) { 00798 var props = nativeKeys(source); 00799 return function(object) { 00800 var length = props.length; 00801 if (object == null) { 00802 return !length; 00803 } 00804 object = Object(object); 00805 while (length--) { 00806 var key = props[length]; 00807 if (!(key in object && 00808 baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG) 00809 )) { 00810 return false; 00811 } 00812 } 00813 return true; 00814 }; 00815 } 00816 00826 function basePick(object, props) { 00827 object = Object(object); 00828 return reduce(props, function(result, key) { 00829 if (key in object) { 00830 result[key] = object[key]; 00831 } 00832 return result; 00833 }, {}); 00834 } 00835 00844 function baseRest(func, start) { 00845 return setToString(overRest(func, start, identity), func + ''); 00846 } 00847 00857 function baseSlice(array, start, end) { 00858 var index = -1, 00859 length = array.length; 00860 00861 if (start < 0) { 00862 start = -start > length ? 0 : (length + start); 00863 } 00864 end = end > length ? length : end; 00865 if (end < 0) { 00866 end += length; 00867 } 00868 length = start > end ? 0 : ((end - start) >>> 0); 00869 start >>>= 0; 00870 00871 var result = Array(length); 00872 while (++index < length) { 00873 result[index] = array[index + start]; 00874 } 00875 return result; 00876 } 00877 00886 function copyArray(source) { 00887 return baseSlice(source, 0, source.length); 00888 } 00889 00899 function baseSome(collection, predicate) { 00900 var result; 00901 00902 baseEach(collection, function(value, index, collection) { 00903 result = predicate(value, index, collection); 00904 return !result; 00905 }); 00906 return !!result; 00907 } 00908 00919 function baseWrapperValue(value, actions) { 00920 var result = value; 00921 return reduce(actions, function(result, action) { 00922 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 00923 }, result); 00924 } 00925 00934 function compareAscending(value, other) { 00935 if (value !== other) { 00936 var valIsDefined = value !== undefined, 00937 valIsNull = value === null, 00938 valIsReflexive = value === value, 00939 valIsSymbol = false; 00940 00941 var othIsDefined = other !== undefined, 00942 othIsNull = other === null, 00943 othIsReflexive = other === other, 00944 othIsSymbol = false; 00945 00946 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 00947 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 00948 (valIsNull && othIsDefined && othIsReflexive) || 00949 (!valIsDefined && othIsReflexive) || 00950 !valIsReflexive) { 00951 return 1; 00952 } 00953 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 00954 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 00955 (othIsNull && valIsDefined && valIsReflexive) || 00956 (!othIsDefined && valIsReflexive) || 00957 !othIsReflexive) { 00958 return -1; 00959 } 00960 } 00961 return 0; 00962 } 00963 00974 function copyObject(source, props, object, customizer) { 00975 var isNew = !object; 00976 object || (object = {}); 00977 00978 var index = -1, 00979 length = props.length; 00980 00981 while (++index < length) { 00982 var key = props[index]; 00983 00984 var newValue = customizer 00985 ? customizer(object[key], source[key], key, object, source) 00986 : undefined; 00987 00988 if (newValue === undefined) { 00989 newValue = source[key]; 00990 } 00991 if (isNew) { 00992 baseAssignValue(object, key, newValue); 00993 } else { 00994 assignValue(object, key, newValue); 00995 } 00996 } 00997 return object; 00998 } 00999 01007 function createAssigner(assigner) { 01008 return baseRest(function(object, sources) { 01009 var index = -1, 01010 length = sources.length, 01011 customizer = length > 1 ? sources[length - 1] : undefined; 01012 01013 customizer = (assigner.length > 3 && typeof customizer == 'function') 01014 ? (length--, customizer) 01015 : undefined; 01016 01017 object = Object(object); 01018 while (++index < length) { 01019 var source = sources[index]; 01020 if (source) { 01021 assigner(object, source, index, customizer); 01022 } 01023 } 01024 return object; 01025 }); 01026 } 01027 01036 function createBaseEach(eachFunc, fromRight) { 01037 return function(collection, iteratee) { 01038 if (collection == null) { 01039 return collection; 01040 } 01041 if (!isArrayLike(collection)) { 01042 return eachFunc(collection, iteratee); 01043 } 01044 var length = collection.length, 01045 index = fromRight ? length : -1, 01046 iterable = Object(collection); 01047 01048 while ((fromRight ? index-- : ++index < length)) { 01049 if (iteratee(iterable[index], index, iterable) === false) { 01050 break; 01051 } 01052 } 01053 return collection; 01054 }; 01055 } 01056 01064 function createBaseFor(fromRight) { 01065 return function(object, iteratee, keysFunc) { 01066 var index = -1, 01067 iterable = Object(object), 01068 props = keysFunc(object), 01069 length = props.length; 01070 01071 while (length--) { 01072 var key = props[fromRight ? length : ++index]; 01073 if (iteratee(iterable[key], key, iterable) === false) { 01074 break; 01075 } 01076 } 01077 return object; 01078 }; 01079 } 01080 01089 function createCtor(Ctor) { 01090 return function() { 01091 // Use a `switch` statement to work with class constructors. See 01092 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 01093 // for more details. 01094 var args = arguments; 01095 var thisBinding = baseCreate(Ctor.prototype), 01096 result = Ctor.apply(thisBinding, args); 01097 01098 // Mimic the constructor's `return` behavior. 01099 // See https://es5.github.io/#x13.2.2 for more details. 01100 return isObject(result) ? result : thisBinding; 01101 }; 01102 } 01103 01111 function createFind(findIndexFunc) { 01112 return function(collection, predicate, fromIndex) { 01113 var iterable = Object(collection); 01114 if (!isArrayLike(collection)) { 01115 var iteratee = baseIteratee(predicate, 3); 01116 collection = keys(collection); 01117 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 01118 } 01119 var index = findIndexFunc(collection, predicate, fromIndex); 01120 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 01121 }; 01122 } 01123 01136 function createPartial(func, bitmask, thisArg, partials) { 01137 if (typeof func != 'function') { 01138 throw new TypeError(FUNC_ERROR_TEXT); 01139 } 01140 var isBind = bitmask & WRAP_BIND_FLAG, 01141 Ctor = createCtor(func); 01142 01143 function wrapper() { 01144 var argsIndex = -1, 01145 argsLength = arguments.length, 01146 leftIndex = -1, 01147 leftLength = partials.length, 01148 args = Array(leftLength + argsLength), 01149 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 01150 01151 while (++leftIndex < leftLength) { 01152 args[leftIndex] = partials[leftIndex]; 01153 } 01154 while (argsLength--) { 01155 args[leftIndex++] = arguments[++argsIndex]; 01156 } 01157 return fn.apply(isBind ? thisArg : this, args); 01158 } 01159 return wrapper; 01160 } 01161 01174 function customDefaultsAssignIn(objValue, srcValue, key, object) { 01175 if (objValue === undefined || 01176 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 01177 return srcValue; 01178 } 01179 return objValue; 01180 } 01181 01195 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 01196 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 01197 arrLength = array.length, 01198 othLength = other.length; 01199 01200 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 01201 return false; 01202 } 01203 var index = -1, 01204 result = true, 01205 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; 01206 01207 // Ignore non-index properties. 01208 while (++index < arrLength) { 01209 var arrValue = array[index], 01210 othValue = other[index]; 01211 01212 var compared; 01213 if (compared !== undefined) { 01214 if (compared) { 01215 continue; 01216 } 01217 result = false; 01218 break; 01219 } 01220 // Recursively compare arrays (susceptible to call stack limits). 01221 if (seen) { 01222 if (!baseSome(other, function(othValue, othIndex) { 01223 if (!indexOf(seen, othIndex) && 01224 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 01225 return seen.push(othIndex); 01226 } 01227 })) { 01228 result = false; 01229 break; 01230 } 01231 } else if (!( 01232 arrValue === othValue || 01233 equalFunc(arrValue, othValue, bitmask, customizer, stack) 01234 )) { 01235 result = false; 01236 break; 01237 } 01238 } 01239 return result; 01240 } 01241 01259 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 01260 switch (tag) { 01261 01262 case boolTag: 01263 case dateTag: 01264 case numberTag: 01265 // Coerce booleans to `1` or `0` and dates to milliseconds. 01266 // Invalid dates are coerced to `NaN`. 01267 return eq(+object, +other); 01268 01269 case errorTag: 01270 return object.name == other.name && object.message == other.message; 01271 01272 case regexpTag: 01273 case stringTag: 01274 // Coerce regexes to strings and treat strings, primitives and objects, 01275 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 01276 // for more details. 01277 return object == (other + ''); 01278 01279 } 01280 return false; 01281 } 01282 01296 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 01297 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 01298 objProps = keys(object), 01299 objLength = objProps.length, 01300 othProps = keys(other), 01301 othLength = othProps.length; 01302 01303 if (objLength != othLength && !isPartial) { 01304 return false; 01305 } 01306 var index = objLength; 01307 while (index--) { 01308 var key = objProps[index]; 01309 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 01310 return false; 01311 } 01312 } 01313 var result = true; 01314 01315 var skipCtor = isPartial; 01316 while (++index < objLength) { 01317 key = objProps[index]; 01318 var objValue = object[key], 01319 othValue = other[key]; 01320 01321 var compared; 01322 // Recursively compare objects (susceptible to call stack limits). 01323 if (!(compared === undefined 01324 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 01325 : compared 01326 )) { 01327 result = false; 01328 break; 01329 } 01330 skipCtor || (skipCtor = key == 'constructor'); 01331 } 01332 if (result && !skipCtor) { 01333 var objCtor = object.constructor, 01334 othCtor = other.constructor; 01335 01336 // Non `Object` object instances with different constructors are not equal. 01337 if (objCtor != othCtor && 01338 ('constructor' in object && 'constructor' in other) && 01339 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 01340 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 01341 result = false; 01342 } 01343 } 01344 return result; 01345 } 01346 01354 function flatRest(func) { 01355 return setToString(overRest(func, undefined, flatten), func + ''); 01356 } 01357 01365 function isFlattenable(value) { 01366 return isArray(value) || isArguments(value); 01367 } 01368 01378 function nativeKeysIn(object) { 01379 var result = []; 01380 if (object != null) { 01381 for (var key in Object(object)) { 01382 result.push(key); 01383 } 01384 } 01385 return result; 01386 } 01387 01395 function objectToString(value) { 01396 return nativeObjectToString.call(value); 01397 } 01398 01408 function overRest(func, start, transform) { 01409 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 01410 return function() { 01411 var args = arguments, 01412 index = -1, 01413 length = nativeMax(args.length - start, 0), 01414 array = Array(length); 01415 01416 while (++index < length) { 01417 array[index] = args[start + index]; 01418 } 01419 index = -1; 01420 var otherArgs = Array(start + 1); 01421 while (++index < start) { 01422 otherArgs[index] = args[index]; 01423 } 01424 otherArgs[start] = transform(array); 01425 return func.apply(this, otherArgs); 01426 }; 01427 } 01428 01437 var setToString = identity; 01438 01439 /*------------------------------------------------------------------------*/ 01440 01456 function compact(array) { 01457 return baseFilter(array, Boolean); 01458 } 01459 01482 function concat() { 01483 var length = arguments.length; 01484 if (!length) { 01485 return []; 01486 } 01487 var args = Array(length - 1), 01488 array = arguments[0], 01489 index = length; 01490 01491 while (index--) { 01492 args[index - 1] = arguments[index]; 01493 } 01494 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 01495 } 01496 01532 function findIndex(array, predicate, fromIndex) { 01533 var length = array == null ? 0 : array.length; 01534 if (!length) { 01535 return -1; 01536 } 01537 var index = fromIndex == null ? 0 : toInteger(fromIndex); 01538 if (index < 0) { 01539 index = nativeMax(length + index, 0); 01540 } 01541 return baseFindIndex(array, baseIteratee(predicate, 3), index); 01542 } 01543 01558 function flatten(array) { 01559 var length = array == null ? 0 : array.length; 01560 return length ? baseFlatten(array, 1) : []; 01561 } 01562 01577 function flattenDeep(array) { 01578 var length = array == null ? 0 : array.length; 01579 return length ? baseFlatten(array, INFINITY) : []; 01580 } 01581 01600 function head(array) { 01601 return (array && array.length) ? array[0] : undefined; 01602 } 01603 01627 function indexOf(array, value, fromIndex) { 01628 var length = array == null ? 0 : array.length; 01629 if (typeof fromIndex == 'number') { 01630 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; 01631 } else { 01632 fromIndex = 0; 01633 } 01634 var index = (fromIndex || 0) - 1, 01635 isReflexive = value === value; 01636 01637 while (++index < length) { 01638 var other = array[index]; 01639 if ((isReflexive ? other === value : other !== other)) { 01640 return index; 01641 } 01642 } 01643 return -1; 01644 } 01645 01660 function last(array) { 01661 var length = array == null ? 0 : array.length; 01662 return length ? array[length - 1] : undefined; 01663 } 01664 01681 function slice(array, start, end) { 01682 var length = array == null ? 0 : array.length; 01683 start = start == null ? 0 : +start; 01684 end = end === undefined ? length : +end; 01685 return length ? baseSlice(array, start, end) : []; 01686 } 01687 01688 /*------------------------------------------------------------------------*/ 01689 01719 function chain(value) { 01720 var result = lodash(value); 01721 result.__chain__ = true; 01722 return result; 01723 } 01724 01748 function tap(value, interceptor) { 01749 interceptor(value); 01750 return value; 01751 } 01752 01776 function thru(value, interceptor) { 01777 return interceptor(value); 01778 } 01779 01807 function wrapperChain() { 01808 return chain(this); 01809 } 01810 01825 function wrapperValue() { 01826 return baseWrapperValue(this.__wrapped__, this.__actions__); 01827 } 01828 01829 /*------------------------------------------------------------------------*/ 01830 01872 function every(collection, predicate, guard) { 01873 predicate = guard ? undefined : predicate; 01874 return baseEvery(collection, baseIteratee(predicate)); 01875 } 01876 01914 function filter(collection, predicate) { 01915 return baseFilter(collection, baseIteratee(predicate)); 01916 } 01917 01954 var find = createFind(findIndex); 01955 01986 function forEach(collection, iteratee) { 01987 return baseEach(collection, baseIteratee(iteratee)); 01988 } 01989 02032 function map(collection, iteratee) { 02033 return baseMap(collection, baseIteratee(iteratee)); 02034 } 02035 02073 function reduce(collection, iteratee, accumulator) { 02074 return baseReduce(collection, baseIteratee(iteratee), accumulator, arguments.length < 3, baseEach); 02075 } 02076 02098 function size(collection) { 02099 if (collection == null) { 02100 return 0; 02101 } 02102 collection = isArrayLike(collection) ? collection : nativeKeys(collection); 02103 return collection.length; 02104 } 02105 02142 function some(collection, predicate, guard) { 02143 predicate = guard ? undefined : predicate; 02144 return baseSome(collection, baseIteratee(predicate)); 02145 } 02146 02176 function sortBy(collection, iteratee) { 02177 var index = 0; 02178 iteratee = baseIteratee(iteratee); 02179 02180 return baseMap(baseMap(collection, function(value, key, collection) { 02181 return { 'value': value, 'index': index++, 'criteria': iteratee(value, key, collection) }; 02182 }).sort(function(object, other) { 02183 return compareAscending(object.criteria, other.criteria) || (object.index - other.index); 02184 }), baseProperty('value')); 02185 } 02186 02187 /*------------------------------------------------------------------------*/ 02188 02206 function before(n, func) { 02207 var result; 02208 if (typeof func != 'function') { 02209 throw new TypeError(FUNC_ERROR_TEXT); 02210 } 02211 n = toInteger(n); 02212 return function() { 02213 if (--n > 0) { 02214 result = func.apply(this, arguments); 02215 } 02216 if (n <= 1) { 02217 func = undefined; 02218 } 02219 return result; 02220 }; 02221 } 02222 02258 var bind = baseRest(function(func, thisArg, partials) { 02259 return createPartial(func, WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG, thisArg, partials); 02260 }); 02261 02280 var defer = baseRest(function(func, args) { 02281 return baseDelay(func, 1, args); 02282 }); 02283 02303 var delay = baseRest(function(func, wait, args) { 02304 return baseDelay(func, toNumber(wait) || 0, args); 02305 }); 02306 02327 function negate(predicate) { 02328 if (typeof predicate != 'function') { 02329 throw new TypeError(FUNC_ERROR_TEXT); 02330 } 02331 return function() { 02332 var args = arguments; 02333 return !predicate.apply(this, args); 02334 }; 02335 } 02336 02355 function once(func) { 02356 return before(2, func); 02357 } 02358 02359 /*------------------------------------------------------------------------*/ 02360 02387 function clone(value) { 02388 if (!isObject(value)) { 02389 return value; 02390 } 02391 return isArray(value) ? copyArray(value) : copyObject(value, nativeKeys(value)); 02392 } 02393 02426 function eq(value, other) { 02427 return value === other || (value !== value && other !== other); 02428 } 02429 02448 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 02449 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 02450 !propertyIsEnumerable.call(value, 'callee'); 02451 }; 02452 02476 var isArray = Array.isArray; 02477 02503 function isArrayLike(value) { 02504 return value != null && isLength(value.length) && !isFunction(value); 02505 } 02506 02524 function isBoolean(value) { 02525 return value === true || value === false || 02526 (isObjectLike(value) && baseGetTag(value) == boolTag); 02527 } 02528 02546 var isDate = baseIsDate; 02547 02581 function isEmpty(value) { 02582 if (isArrayLike(value) && 02583 (isArray(value) || isString(value) || 02584 isFunction(value.splice) || isArguments(value))) { 02585 return !value.length; 02586 } 02587 return !nativeKeys(value).length; 02588 } 02589 02618 function isEqual(value, other) { 02619 return baseIsEqual(value, other); 02620 } 02621 02648 function isFinite(value) { 02649 return typeof value == 'number' && nativeIsFinite(value); 02650 } 02651 02669 function isFunction(value) { 02670 if (!isObject(value)) { 02671 return false; 02672 } 02673 // The use of `Object#toString` avoids issues with the `typeof` operator 02674 // in Safari 9 which returns 'object' for typed arrays and other constructors. 02675 var tag = baseGetTag(value); 02676 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 02677 } 02678 02705 function isLength(value) { 02706 return typeof value == 'number' && 02707 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 02708 } 02709 02735 function isObject(value) { 02736 var type = typeof value; 02737 return value != null && (type == 'object' || type == 'function'); 02738 } 02739 02764 function isObjectLike(value) { 02765 return value != null && typeof value == 'object'; 02766 } 02767 02796 function isNaN(value) { 02797 // An `NaN` primitive is the only value that is not equal to itself. 02798 // Perform the `toStringTag` check first to avoid errors with some 02799 // ActiveX objects in IE. 02800 return isNumber(value) && value != +value; 02801 } 02802 02820 function isNull(value) { 02821 return value === null; 02822 } 02823 02850 function isNumber(value) { 02851 return typeof value == 'number' || 02852 (isObjectLike(value) && baseGetTag(value) == numberTag); 02853 } 02854 02872 var isRegExp = baseIsRegExp; 02873 02891 function isString(value) { 02892 return typeof value == 'string' || 02893 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 02894 } 02895 02913 function isUndefined(value) { 02914 return value === undefined; 02915 } 02916 02940 function toArray(value) { 02941 if (!isArrayLike(value)) { 02942 return values(value); 02943 } 02944 return value.length ? copyArray(value) : []; 02945 } 02946 02973 var toInteger = Number; 02974 02998 var toNumber = Number; 02999 03021 function toString(value) { 03022 if (typeof value == 'string') { 03023 return value; 03024 } 03025 return value == null ? '' : (value + ''); 03026 } 03027 03028 /*------------------------------------------------------------------------*/ 03029 03062 var assign = createAssigner(function(object, source) { 03063 copyObject(source, nativeKeys(source), object); 03064 }); 03065 03097 var assignIn = createAssigner(function(object, source) { 03098 copyObject(source, nativeKeysIn(source), object); 03099 }); 03100 03130 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 03131 copyObject(source, keysIn(source), object, customizer); 03132 }); 03133 03168 function create(prototype, properties) { 03169 var result = baseCreate(prototype); 03170 return properties == null ? result : assign(result, properties); 03171 } 03172 03194 var defaults = baseRest(function(args) { 03195 args.push(undefined, customDefaultsAssignIn); 03196 return assignInWith.apply(undefined, args); 03197 }); 03198 03226 function has(object, path) { 03227 return object != null && hasOwnProperty.call(object, path); 03228 } 03229 03258 var keys = nativeKeys; 03259 03283 var keysIn = nativeKeysIn; 03284 03302 var pick = flatRest(function(object, paths) { 03303 return object == null ? {} : basePick(object, paths); 03304 }); 03305 03335 function result(object, path, defaultValue) { 03336 var value = object == null ? undefined : object[path]; 03337 if (value === undefined) { 03338 value = defaultValue; 03339 } 03340 return isFunction(value) ? value.call(object) : value; 03341 } 03342 03369 function values(object) { 03370 return object == null ? [] : baseValues(object, keys(object)); 03371 } 03372 03373 /*------------------------------------------------------------------------*/ 03374 03403 function escape(string) { 03404 string = toString(string); 03405 return (string && reHasUnescapedHtml.test(string)) 03406 ? string.replace(reUnescapedHtml, escapeHtmlChar) 03407 : string; 03408 } 03409 03410 /*------------------------------------------------------------------------*/ 03411 03428 function identity(value) { 03429 return value; 03430 } 03431 03474 var iteratee = baseIteratee; 03475 03504 function matches(source) { 03505 return baseMatches(assign({}, source)); 03506 } 03507 03544 function mixin(object, source, options) { 03545 var props = keys(source), 03546 methodNames = baseFunctions(source, props); 03547 03548 if (options == null && 03549 !(isObject(source) && (methodNames.length || !props.length))) { 03550 options = source; 03551 source = object; 03552 object = this; 03553 methodNames = baseFunctions(source, keys(source)); 03554 } 03555 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 03556 isFunc = isFunction(object); 03557 03558 baseEach(methodNames, function(methodName) { 03559 var func = source[methodName]; 03560 object[methodName] = func; 03561 if (isFunc) { 03562 object.prototype[methodName] = function() { 03563 var chainAll = this.__chain__; 03564 if (chain || chainAll) { 03565 var result = object(this.__wrapped__), 03566 actions = result.__actions__ = copyArray(this.__actions__); 03567 03568 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 03569 result.__chain__ = chainAll; 03570 return result; 03571 } 03572 return func.apply(object, arrayPush([this.value()], arguments)); 03573 }; 03574 } 03575 }); 03576 03577 return object; 03578 } 03579 03593 function noConflict() { 03594 if (root._ === this) { 03595 root._ = oldDash; 03596 } 03597 return this; 03598 } 03599 03612 function noop() { 03613 // No operation performed. 03614 } 03615 03633 function uniqueId(prefix) { 03634 var id = ++idCounter; 03635 return toString(prefix) + id; 03636 } 03637 03638 /*------------------------------------------------------------------------*/ 03639 03658 function max(array) { 03659 return (array && array.length) 03660 ? baseExtremum(array, identity, baseGt) 03661 : undefined; 03662 } 03663 03682 function min(array) { 03683 return (array && array.length) 03684 ? baseExtremum(array, identity, baseLt) 03685 : undefined; 03686 } 03687 03688 /*------------------------------------------------------------------------*/ 03689 03690 // Add methods that return wrapped values in chain sequences. 03691 lodash.assignIn = assignIn; 03692 lodash.before = before; 03693 lodash.bind = bind; 03694 lodash.chain = chain; 03695 lodash.compact = compact; 03696 lodash.concat = concat; 03697 lodash.create = create; 03698 lodash.defaults = defaults; 03699 lodash.defer = defer; 03700 lodash.delay = delay; 03701 lodash.filter = filter; 03702 lodash.flatten = flatten; 03703 lodash.flattenDeep = flattenDeep; 03704 lodash.iteratee = iteratee; 03705 lodash.keys = keys; 03706 lodash.map = map; 03707 lodash.matches = matches; 03708 lodash.mixin = mixin; 03709 lodash.negate = negate; 03710 lodash.once = once; 03711 lodash.pick = pick; 03712 lodash.slice = slice; 03713 lodash.sortBy = sortBy; 03714 lodash.tap = tap; 03715 lodash.thru = thru; 03716 lodash.toArray = toArray; 03717 lodash.values = values; 03718 03719 // Add aliases. 03720 lodash.extend = assignIn; 03721 03722 // Add methods to `lodash.prototype`. 03723 mixin(lodash, lodash); 03724 03725 /*------------------------------------------------------------------------*/ 03726 03727 // Add methods that return unwrapped values in chain sequences. 03728 lodash.clone = clone; 03729 lodash.escape = escape; 03730 lodash.every = every; 03731 lodash.find = find; 03732 lodash.forEach = forEach; 03733 lodash.has = has; 03734 lodash.head = head; 03735 lodash.identity = identity; 03736 lodash.indexOf = indexOf; 03737 lodash.isArguments = isArguments; 03738 lodash.isArray = isArray; 03739 lodash.isBoolean = isBoolean; 03740 lodash.isDate = isDate; 03741 lodash.isEmpty = isEmpty; 03742 lodash.isEqual = isEqual; 03743 lodash.isFinite = isFinite; 03744 lodash.isFunction = isFunction; 03745 lodash.isNaN = isNaN; 03746 lodash.isNull = isNull; 03747 lodash.isNumber = isNumber; 03748 lodash.isObject = isObject; 03749 lodash.isRegExp = isRegExp; 03750 lodash.isString = isString; 03751 lodash.isUndefined = isUndefined; 03752 lodash.last = last; 03753 lodash.max = max; 03754 lodash.min = min; 03755 lodash.noConflict = noConflict; 03756 lodash.noop = noop; 03757 lodash.reduce = reduce; 03758 lodash.result = result; 03759 lodash.size = size; 03760 lodash.some = some; 03761 lodash.uniqueId = uniqueId; 03762 03763 // Add aliases. 03764 lodash.each = forEach; 03765 lodash.first = head; 03766 03767 mixin(lodash, (function() { 03768 var source = {}; 03769 baseForOwn(lodash, function(func, methodName) { 03770 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 03771 source[methodName] = func; 03772 } 03773 }); 03774 return source; 03775 }()), { 'chain': false }); 03776 03777 /*------------------------------------------------------------------------*/ 03778 03786 lodash.VERSION = VERSION; 03787 03788 // Add `Array` methods to `lodash.prototype`. 03789 baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 03790 var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName], 03791 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 03792 retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName); 03793 03794 lodash.prototype[methodName] = function() { 03795 var args = arguments; 03796 if (retUnwrapped && !this.__chain__) { 03797 var value = this.value(); 03798 return func.apply(isArray(value) ? value : [], args); 03799 } 03800 return this[chainName](function(value) { 03801 return func.apply(isArray(value) ? value : [], args); 03802 }); 03803 }; 03804 }); 03805 03806 // Add chain sequence methods to the `lodash` wrapper. 03807 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 03808 03809 /*--------------------------------------------------------------------------*/ 03810 03811 // Some AMD build optimizers, like r.js, check for condition patterns like: 03812 if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { 03813 // Expose Lodash on the global object to prevent errors when Lodash is 03814 // loaded by a script tag in the presence of an AMD loader. 03815 // See http://requirejs.org/docs/errors.html#mismatch for more details. 03816 // Use `_.noConflict` to remove Lodash from the global object. 03817 root._ = lodash; 03818 03819 // Define as an anonymous module so, through path mapping, it can be 03820 // referenced as the "underscore" module. 03821 define(function() { 03822 return lodash; 03823 }); 03824 } 03825 // Check for `exports` after `define` in case a build optimizer adds it. 03826 else if (freeModule) { 03827 // Export for Node.js. 03828 (freeModule.exports = lodash)._ = lodash; 03829 // Export for CommonJS support. 03830 freeExports._ = lodash; 03831 } 03832 else { 03833 // Export to the global object. 03834 root._ = lodash; 03835 } 03836 }.call(this));