From 1e4283aad35e08f0a2cd3dba303100454d7f7c01 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 13 Oct 2012 15:12:21 -0700 Subject: [PATCH] Remove compiling from `_.functions`, `_.isEmpty`, `_.pairs`, `_.values`, `_.contains`, `_.find`, `_.invoke`, `_.pluck`, `_.reduce`, and `_.where`. Former-commit-id: 207f20330ede82cb58d4f008fe5164771e97a8b0 --- build.js | 78 ++++++++----- build/pre-compile.js | 32 +----- lodash.js | 238 +++++++++++++++++++-------------------- lodash.min.js | 70 ++++++------ lodash.underscore.min.js | 61 +++++----- 5 files changed, 238 insertions(+), 241 deletions(-) diff --git a/build.js b/build.js index 78f6740a1..0d6cb0a92 100755 --- a/build.js +++ b/build.js @@ -70,8 +70,8 @@ 'clone': ['extend', 'forEach', 'forOwn', 'isArguments', 'isPlainObject'], 'compact': [], 'compose': [], - 'contains': [], - 'countBy': ['forEach', 'identity'], + 'contains': ['some'], + 'countBy': ['forEach'], 'debounce': [], 'defaults': ['isArguments'], 'defer': [], @@ -81,27 +81,27 @@ 'every': ['identity'], 'extend': ['isArguments'], 'filter': ['identity'], - 'find': ['identity'], + 'find': ['some'], 'first': [], 'flatten': ['isArray'], 'forEach': ['identity'], 'forIn': ['identity', 'isArguments'], 'forOwn': ['identity', 'isArguments'], - 'functions': ['isArguments', 'isFunction'], - 'groupBy': ['forEach', 'identity'], + 'functions': ['forIn', 'isFunction'], + 'groupBy': ['forEach'], 'has': [], 'identity': [], 'indexOf': ['sortedIndex'], 'initial': [], 'intersection': ['indexOf'], 'invert': [], - 'invoke': [], + 'invoke': ['forEach'], 'isArguments': [], 'isArray': [], 'isBoolean': [], 'isDate': [], 'isElement': [], - 'isEmpty': ['isArguments', 'isFunction'], + 'isEmpty': ['forOwn', 'isArguments', 'isFunction'], 'isEqual': ['isArguments', 'isFunction'], 'isFinite': [], 'isFunction': [], @@ -125,15 +125,15 @@ 'mixin': ['forEach', 'functions'], 'noConflict': [], 'object': [], - 'omit': ['forIn', 'indexOf', 'isArguments'], + 'omit': ['forIn', 'indexOf'], 'once': [], - 'pairs': [], + 'pairs': ['forOwn'], 'partial': ['isFunction'], 'pick': ['forIn'], - 'pluck': [], + 'pluck': ['forEach'], 'random': [], 'range': [], - 'reduce': ['identity'], + 'reduce': ['forEach'], 'reduceRight': ['forEach', 'keys'], 'reject': ['identity'], 'rest': [], @@ -141,20 +141,20 @@ 'shuffle': ['forEach'], 'size': ['keys'], 'some': ['identity'], - 'sortBy': ['forEach', 'identity'], + 'sortBy': ['forEach'], 'sortedIndex': ['identity'], 'tap': ['mixin'], 'template': ['escape'], 'throttle': [], 'times': [], - 'toArray': ['isFunction', 'values'], + 'toArray': ['values'], 'unescape': [], 'union': ['indexOf'], 'uniq': ['identity', 'indexOf'], 'uniqueId': [], 'value': ['mixin'], - 'values': ['isArguments'], - 'where': ['forIn'], + 'values': ['forOwn'], + 'where': ['forEach', 'forIn'], 'without': ['indexOf'], 'wrap': [], 'zip': ['max', 'pluck'] @@ -676,9 +676,9 @@ return removeVar(source, 'isKeysFast') // remove optimized branch in `iteratorTemplate` .replace(/(?: *\/\/.*\n)* *'( *)<% *if *\(isKeysFast[\s\S]+?'\1<% *} *else *\{ *%>.+\n([\s\S]+?) *'\1<% *} *%>.+/, "'\\n' +\n$2") - // remove `isKeysFast` from `beforeLoop.object` of `mapIteratorOptions` + // remove `isKeysFast` from `beforeLoop.object` of `_.map` .replace(/=\s*'\s*\+\s*\(isKeysFast.+/, "= []'") - // remove `isKeysFast` from `inLoop.object` of `mapIteratorOptions`, `invoke`, `pairs`, `pluck`, and `sortBy` + // remove `isKeysFast` from `inLoop.object` of `_.map` .replace(/'\s*\+\s*\(isKeysFast[^)]+?\)\s*\+\s*'/g, '.push') // remove data object property assignment in `createIterator` .replace(/ *'isKeysFast':.+\n/, ''); @@ -948,6 +948,11 @@ // flag used to specify replacing Lo-Dash's `_.clone` with Underscore's var useUnderscoreClone = isUnderscore; + // flags used to specify exposing Lo-Dash methods in an Underscore build + var exposeForIn = !isUnderscore, + exposeForOwn = !isUnderscore, + exposeIsPlainObject = !isUnderscore; + /*------------------------------------------------------------------------*/ // names of methods to include in the build @@ -972,11 +977,13 @@ (result = getDependencies(optionToMethodsArray(source, value))); }); - // use Lo-Dash's clone if explicitly requested - if (result && result.indexOf('clone') > -1) { - useUnderscoreClone = false; + // include Lo-Dash's methods if explicitly requested + if (result) { + exposeForIn = result.indexOf('forIn') > -1; + exposeForOwn = result.indexOf('forOwn') > -1; + exposeIsPlainObject = result.indexOf('isPlainObject') > -1; + useUnderscoreClone = result.indexOf('clone') < 0; } - // add method names required by Backbone and Underscore builds if (isBackbone && !result) { result = getDependencies(backboneDependencies); @@ -1123,7 +1130,7 @@ ].join('\n')); // replace `arrayLikeClasses` in `_.isEmpty` - source = source.replace(/'if *\(arrayLikeClasses[\s\S]+?' \|\|\\n/, "'if (isArray(value) || className == stringClass ||"); + source = source.replace(/if *\(\(arrayLikeClasses.+?noArgsClass.+/, 'if (isArray(value) || className == stringClass ||'); // replace `arrayLikeClasses` in `_.isEqual` source = source.replace(/(?: *\/\/.*\n)*( +)var isArr *= *arrayLikeClasses[^}]+}/, '$1var isArr = isArray(a);'); @@ -1248,11 +1255,22 @@ }); if (isUnderscore) { - // remove "compiled template cleanup" from `_.template` - source = source.replace(/(?:\s*\/\/.*)*\n *source *=.+?isEvaluating.+?reEmptyStringLeading[\s\S]+?\);/, ''); - source = removeVar(source, 'reEmptyStringLeading'); - source = removeVar(source, 'reEmptyStringMiddle'); - source = removeVar(source, 'reEmptyStringTrailing'); + // remove `_.forIn`, `_.forOwn`, and `_.isPlainObject` assignments + (function() { + var snippet = getMethodAssignments(source), + modified = snippet; + + if (!exposeForIn) { + modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.forIn *= *.+\n/, ''); + } + if (!exposeForOwn) { + modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.forOwn *= *.+\n/, ''); + } + if (!exposeIsPlainObject) { + modified = modified.replace(/(?:\n *\/\/.*\s*)* *lodash\.isPlainObject *= *.+\n/, ''); + } + source = source.replace(snippet, modified); + }()); // replace `isArguments` and its fallback (function() { @@ -1267,6 +1285,12 @@ .replace(/\bnoArgsClass\b/g, '!lodash.isArguments(arguments)'); }); }()); + + // remove "compiled template cleanup" from `_.template` + source = source.replace(/(?:\s*\/\/.*)*\n *source *=.+?isEvaluating.+?reEmptyStringLeading[\s\S]+?\);/, ''); + source = removeVar(source, 'reEmptyStringLeading'); + source = removeVar(source, 'reEmptyStringMiddle'); + source = removeVar(source, 'reEmptyStringTrailing'); } else { source = removeIsArgumentsFallback(source); diff --git a/build/pre-compile.js b/build/pre-compile.js index 3d2afa552..8fb409c9f 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -21,37 +21,20 @@ 'object', 'ownIndex', 'ownProps', - 'prop', 'propertyIsEnumerable', - 'propIndex', - 'props', 'result', 'skipProto', - 'slice', 'stringClass', 'thisArg', 'toString', - 'undefined', 'value', // lesser used variables - 'args', - 'arrayLikeClasses', 'bind', - 'className', - 'forIn', 'funcs', 'isArguments', - 'isFunc', 'isFunction', - 'methodName', - 'objectClass', - 'objectTypes', - 'pass', - 'properties', - 'property', - 'propsLength', - 'target' + 'objectTypes' ]; /** Used to minify `compileIterator` option properties */ @@ -290,10 +273,10 @@ // remove debug sourceURL use in `_.template` source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, ''); - // minify internal properties used by 'compareAscending', `_.merge`, and `_.sortBy` + // minify internal properties used by 'compareAscending' and `_.sortBy` (function() { var properties = ['criteria', 'index', 'value'], - snippets = source.match(/( +)function (?:compareAscending|merge|sortBy)\b[\s\S]+?\n\1}/g); + snippets = source.match(/( +)function (?:compareAscending|sortBy)\b[\s\S]+?\n\1}/g); if (!snippets) { return; @@ -309,13 +292,8 @@ modified = modified .replace(reBracketProp, "['" + minNames[index] + "']") - .replace(reDotProp, '.' + minNames[index]) - .replace(rePropColon, "$1'" + minNames[index] + "':") - - // correct `value.source` in regexp branch of `_.clone` - if (property == 'source') { - modified = modified.replace("value['" + minNames[index] + "']", "value['source']"); - } + .replace(reDotProp, "['" + minNames[index] + "']") + .replace(rePropColon, "$1'" + minNames[index] + "':"); }); // replace with modified snippet diff --git a/lodash.js b/lodash.js index 0c598cd20..ada830bdc 100644 --- a/lodash.js +++ b/lodash.js @@ -425,8 +425,8 @@ ); /** - * Reusable iterator options shared by `every`, `filter`, - * `find`, `forEach`, `forIn`, `forOwn`, `map`, `reject`, and `some`. + * Reusable iterator options shared by `every`, `filter`, forEach`, `forIn`, + * `forOwn`, `map`, `reject`, and `some`. */ var baseIteratorOptions = { 'args': 'collection, callback, thisArg', @@ -452,13 +452,13 @@ 'bottom': ' }\n}' }; - /** Reusable iterator options for `filter`, `reject`, and `where` */ + /** Reusable iterator options for `filter` and `reject` */ var filterIteratorOptions = { 'init': '[]', 'inLoop': 'callback(value, index, collection) && result.push(value)' }; - /** Reusable iterator options for `find`, `forEach`, `forIn`, and `forOwn` */ + /** Reusable iterator options for `forEach`, `forIn`, and `forOwn` */ var forEachIteratorOptions = { 'top': 'callback = createCallback(callback, thisArg)' }; @@ -470,19 +470,6 @@ } }; - /** Reusable iterator options for `invoke`, `map`, and `pluck` */ - var mapIteratorOptions = { - 'init': 'collection || []', - 'beforeLoop': { - 'array': 'result = Array(length)', - 'object': 'result = ' + (isKeysFast ? 'Array(length)' : '[]') - }, - 'inLoop': { - 'array': 'result[index] = callback(value, index, collection)', - 'object': 'result' + (isKeysFast ? '[ownIndex] = ' : '.push') + '(callback(value, index, collection))' - } - }; - /*--------------------------------------------------------------------------*/ /** @@ -701,16 +688,14 @@ } // create the function factory var factory = Function( - 'arrayLikeClasses, bind, createCallback, forIn, hasOwnProperty, isArguments, ' + - 'isFunction, objectClass, objectTypes, nativeKeys, propertyIsEnumerable, ' + - 'slice, stringClass, toString, undefined', + 'bind, createCallback, forIn, hasOwnProperty, isArguments, isFunction, ' + + 'objectTypes, nativeKeys, propertyIsEnumerable, stringClass, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - arrayLikeClasses, bind, createCallback, forIn, hasOwnProperty, isArguments, - isFunction, objectClass, objectTypes, nativeKeys, propertyIsEnumerable, - slice, stringClass, toString + bind, createCallback, forIn, hasOwnProperty, isArguments, isFunction, + objectTypes, nativeKeys, propertyIsEnumerable, stringClass, toString ); } @@ -1171,13 +1156,15 @@ * _.functions(_); * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] */ - var functions = createIterator({ - 'useHas': false, - 'args': 'object', - 'init': '[]', - 'inLoop': 'isFunction(value) && result.push(index)', - 'bottom': 'result.sort()' - }); + function functions(object) { + var result = []; + forIn(object, function(value, key) { + if (isFunction(value)) { + result.push(key); + } + }); + return result.sort(); + } /** * Checks if the specified object `property` exists and is a direct property, @@ -1270,21 +1257,23 @@ * _.isEmpty(''); * // => true */ - var isEmpty = createIterator({ - 'args': 'value', - 'init': 'true', - 'top': - 'var className = toString.call(value),\n' + - ' length = value.length;\n' + - 'if (arrayLikeClasses[className]' + - (noArgsClass ? ' || isArguments(value)' : '') + ' ||\n' + - ' (className == objectClass && length === +length &&\n' + - ' isFunction(value.splice))' + - ') return !length', - 'inLoop': { - 'object': 'return false' + function isEmpty(value) { + var result = true; + if (!value) { + return result; } - }); + var className = toString.call(value), + length = value.length; + + if ((arrayLikeClasses[className] || (noArgsClass && isArguments(value))) || + (className == objectClass && length === +length && isFunction(value.splice))) { + return !length; + } + forOwn(value, function() { + return (result = false); + }); + return result; + } /** * Performs a deep comparison between two values to determine if they are @@ -1778,11 +1767,13 @@ * _.pairs({ 'moe': 30, 'larry': 40, 'curly': 50 }); * // => [['moe', 30], ['larry', 40], ['curly', 50]] (order is not guaranteed) */ - var pairs = createIterator({ - 'args': 'object', - 'init':'[]', - 'inLoop': 'result' + (isKeysFast ? '[ownIndex] = ' : '.push') + '([index, value])' - }); + function pairs(object) { + var result = []; + forOwn(object, function(value, key) { + result.push([key, value]); + }); + return result; + } /** * Creates a shallow clone of `object` composed of the specified properties. @@ -1846,11 +1837,13 @@ * _.values({ 'one': 1, 'two': 2, 'three': 3 }); * // => [1, 2, 3] */ - var values = createIterator({ - 'args': 'object', - 'init': '[]', - 'inLoop': 'result.push(value)' - }); + function values(object) { + var result = []; + forOwn(object, function(value) { + result.push(value); + }); + return result; + } /*--------------------------------------------------------------------------*/ @@ -1876,15 +1869,11 @@ * _.contains('curly', 'ur'); * // => true */ - var contains = createIterator({ - 'args': 'collection, target', - 'init': 'false', - 'noCharByIndex': false, - 'beforeLoop': { - 'array': 'if (toString.call(collection) == stringClass) return collection.indexOf(target) > -1' - }, - 'inLoop': 'if (value === target) return true' - }); + function contains(collection, target) { + return toString.call(collection) == stringClass + ? collection.indexOf(target) > -1 + : some(collection, function(value) { return value === target; }); + } /** * Creates an object composed of keys returned from running each element of @@ -1983,10 +1972,14 @@ * var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); * // => 2 */ - var find = createIterator(baseIteratorOptions, forEachIteratorOptions, { - 'init': 'undefined', - 'inLoop': 'if (callback(value, index, collection)) return value' - }); + function find(collection, callback, thisArg) { + var result; + callback = createCallback(callback, thisArg); + some(collection, function(value, index, collection) { + return callback(value, index, collection) && (result = value, true); + }); + return result; + } /** * Iterates over a `collection`, executing the `callback` for each element in @@ -2070,19 +2063,16 @@ * _.invoke([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ - var invoke = createIterator(mapIteratorOptions, { - 'args': 'collection, methodName', - 'top': - 'var args = slice.call(arguments, 2),\n' + - ' isFunc = typeof methodName == \'function\'', - 'inLoop': { - 'array': - 'result[index] = (isFunc ? methodName : value[methodName]).apply(value, args)', - 'object': - 'result' + (isKeysFast ? '[ownIndex] = ' : '.push') + - '((isFunc ? methodName : value[methodName]).apply(value, args))' - } - }); + function invoke(collection, methodName) { + var args = slice.call(arguments, 2), + isFunc = typeof methodName == 'function', + result = []; + + forEach(collection, function(value) { + result.push((isFunc ? methodName : value[methodName]).apply(value, args)); + }); + return result; + } /** * Creates an array of values by running each element in the `collection` @@ -2105,7 +2095,17 @@ * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); * // => [3, 6, 9] (order is not guaranteed) */ - var map = createIterator(baseIteratorOptions, mapIteratorOptions); + var map = createIterator(baseIteratorOptions, { + 'init': 'collection || []', + 'beforeLoop': { + 'array': 'result = Array(length)', + 'object': 'result = ' + (isKeysFast ? 'Array(length)' : '[]') + }, + 'inLoop': { + 'array': 'result[index] = callback(value, index, collection)', + 'object': 'result' + (isKeysFast ? '[ownIndex] = ' : '.push') + '(callback(value, index, collection))' + } + }); /** * Retrieves the maximum value of an `array`. If `callback` is passed, @@ -2220,13 +2220,13 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry', 'curly'] */ - var pluck = createIterator(mapIteratorOptions, { - 'args': 'collection, property', - 'inLoop': { - 'array': 'result[index] = value[property]', - 'object': 'result' + (isKeysFast ? '[ownIndex] = ' : '.push') + '(value[property])' - } - }); + function pluck(collection, property) { + var result = []; + forEach(collection, function(value) { + result.push(value[property]); + }); + return result; + } /** * Boils down a `collection` to a single value. The initial state of the @@ -2248,24 +2248,16 @@ * var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; }); * // => 6 */ - var reduce = createIterator({ - 'args': 'collection, callback, accumulator, thisArg', - 'init': 'accumulator', - 'top': - 'var noaccum = arguments.length < 3;\n' + - 'callback = createCallback(callback, thisArg)', - 'beforeLoop': { - 'array': 'if (noaccum) result = iteratee[++index]' - }, - 'inLoop': { - 'array': - 'result = callback(result, value, index, collection)', - 'object': - 'result = noaccum\n' + - ' ? (noaccum = false, value)\n' + - ' : callback(result, value, index, collection)' - } - }); + function reduce(collection, callback, accumulator, thisArg) { + var noaccum = arguments.length < 3; + callback = createCallback(callback, thisArg); + forEach(collection, function(value, index, collection) { + accumulator = noaccum + ? (noaccum = false, value) + : callback(accumulator, value, index, collection) + }); + return accumulator; + } /** * The right-associative version of `_.reduce`. @@ -2430,7 +2422,6 @@ function sortBy(collection, callback, thisArg) { var result = []; callback = createCallback(callback, thisArg); - forEach(collection, function(value, index, collection) { result.push({ 'criteria': callback(value, index, collection), @@ -2494,19 +2485,26 @@ * _.where(stooges, { 'age': 40 }); * // => [{ 'name': 'moe', 'age': 40 }] */ - var where = createIterator(filterIteratorOptions, { - 'args': 'collection, properties', - 'top': - 'var props = [];\n' + - 'forIn(properties, function(value, prop) { props.push(prop) });\n' + - 'var propsLength = props.length', - 'inLoop': - 'for (var pass = true, propIndex = 0; propIndex < propsLength; propIndex++) {\n' + - ' var prop = props[propIndex];\n' + - ' if (!(pass = value[prop] === properties[prop])) break\n' + - '}\n' + - 'pass && result.push(value)' - }); + function where(collection, properties) { + var props = []; + forIn(properties, function(value, prop) { props.push(prop); }); + + var propsLength = props.length, + result = []; + + forEach(collection, function(value) { + for (var pass = true, propIndex = 0; propIndex < propsLength; propIndex++) { + var prop = props[propIndex]; + if (!(pass = value[prop] === properties[prop])) { + break; + } + } + if (pass) { + result.push(value); + } + }); + return result; + } /*--------------------------------------------------------------------------*/ diff --git a/lodash.min.js b/lodash.min.js index ad96091e8..0d502f550 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -2,38 +2,38 @@ Lo-Dash 0.8.2 lodash.com/license Underscore.js 1.4.2 underscorejs.org/LICENSE */ -;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||H),s=i?{}:e;if(i)for(n=t-1;++nn||e===t)return 1;if(es;s++)i+="i='"+e.o[s]+"';if(","constructor"==e.o[s]&&(i+="!(g&&g.prototype===j)&&"),i+="h.call(j,i)){A=j[i];"+ -e.l.h+"}"}if(e.c||e.m)i+="}"}return i+=e.e+";return t",Function("D,E,F,I,e,f,J,h,M,O,Q,S,T,X,Y,l,q,v,w,y,z","var G=function("+t+"){"+i+"};return G")(Dt,_,L,u,Q,f,en,Z,T,v,$t,m,Jt,mt,Ht,ut,tt,nt,yt,rt)}function c(e){return"\\"+Bt[e]}function h(e){return Qt[e]}function p(){}function d(e){return Gt[e]}function v(e){return rt.call(e)==ct}function m(e){return"function"==typeof e}function g(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Lt||"function"==typeof e.toString||"string"!=typeof -(e+""))&&(!m(n)||n instanceof n)?xt?(en(e,function(e,n,r){return t=!Z.call(r,n),i}),t===i):(en(e,function(e,n){t=n}),t===i||Z.call(e,t)):t}function y(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=Ht[typeof e]){var u=rt.call(e);if(!Pt[u]||Nt&&v(e))return e;var a=u==ht,n=a||(u==mt?Jt(e):n)}if(!n||!t)return n?a?nt.call(e):Zt({},e):e;n=e.constructor;switch(u){case pt:case dt:return new n(+e);case vt:case yt:return new n(e);case gt:return n(e.source,U.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[ -u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?mn:tn)(e,function(e,n){f[n]=y(e,t,r,s,o)}),f}function b(e,t,s,o){if(e==r||t==r)return e===t;if(e===t)return 0!==e||1/e==1/t;if(Ht[typeof e]||Ht[typeof t])e=e.__wrapped__||e,t=t.__wrapped__||t;var u=rt.call(e);if(u!=rt.call(t))return i;switch(u){case pt:case dt:return+e==+t;case vt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case gt:case yt:return e==t+""}var a=Dt[u];if(Nt&&!a&&(a=v(e))&&!v(t)||!a&&(u!=mt||Lt&&("function"!=typeof e. -toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=b(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!m(a)||!(a instanceof a&&m(f)&&f instanceof f)))return i;for(var c in e)if(Z.call(e,c)&&(l++,!Z.call(t,c)||!b(e[c],t[c],s,o)))return i;for(c in t)if(Z.call(t,c)&&!(l--))return i;if( -Et)for(;7>++u;)if(c=J[u],Z.call(e,c)&&(!Z.call(t,c)||!b(e[c],t[c],s,o)))return i;return n}function w(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=f(t,n),mn(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function E(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if(o!==+o)var a=sn(e),o=a.length;else kt&&rt.call(e)==yt&&(s=e.split(""));return mn(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function S(e,t,n){ -if(e)return t==r||n?e[0]:nt.call(e,0,t)}function x(e,t){for(var n=-1,r=e?e.length:0,i=[];++nn?at(0,i+n):n||0)-1;else if(n)return r=C(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])>>1,e[r]T(a,r))a.push(r),u.push(e[s]);return u}function L(e,t){return Ot||it&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,F=/&(?:amp|lt|gt|quot|#x27);/g,I=/\b__p\+='';/g,q=/\b(__p\+=)''\+/g,R=/(__e\(.*?\)|\b__t\))\+'';/g,U=/\w*$/,z=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,W=RegExp("^"+(D.valueOf+"" -).replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),X=/($^)/,V=/[&<>"']/g,$=/['\n\r\t\u2028\u2029\\]/g,J="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),K=Math.ceil,Q=_.concat,G=Math.floor,Y=W.test(Y=Object.getPrototypeOf)&&Y,Z=D.hasOwnProperty,et=_.push,tt=D.propertyIsEnumerable,nt=_.slice,rt=D.toString,it=W.test(it=nt.bind)&&it,st=W.test(st=Array.isArray)&&st,ot=e.isFinite,ut=W.test(ut=Object.keys)&&ut -,at=Math.max,ft=Math.min,lt=Math.random,ct="[object Arguments]",ht="[object Array]",pt="[object Boolean]",dt="[object Date]",vt="[object Number]",mt="[object Object]",gt="[object RegExp]",yt="[object String]",bt=e.clearTimeout,wt=e.setTimeout,Et,St,xt,Tt=n;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);for(r in arguments)Tt=!r;Et=4>(n+"").length,xt="x"!=n[0],St=(n.splice.call(t,0,1),t[0])})(1);var Nt=!v(arguments),Ct="x"!=nt.call("x" -)[0],kt="xx"!="x"[0]+Object("x")[0];try{var Lt=("[object Object]",rt.call(e.document||0)==mt)}catch(At){}var Ot=it&&/\n|Opera/.test(it+rt.call(e.opera)),Mt=ut&&/^.+$|true/.test(ut+!!e.attachEvent),_t=!Ot,Dt={};Dt[pt]=Dt[dt]=Dt["[object Function]"]=Dt[vt]=Dt[mt]=Dt[gt]=i,Dt[ct]=Dt[ht]=Dt[yt]=n;var Pt={};Pt[ct]=Pt["[object Function]"]=i,Pt[ht]=Pt[pt]=Pt[dt]=Pt[vt]=Pt[mt]=Pt[gt]=Pt[yt]=n;var Ht={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Bt={"\\":"\\","'":"'","\n":"n" -,"\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var jt={a:"d,c,x",p:"c=f(c,x)",h:"if(c(A,i,d)===false)return t"},Ft={i:"{}",p:"c=f(c,x)",h:"var p=c(A,i,d);(h.call(t,p)?t[p]++:t[p]=1)"},It={i:"true",h:"if(!c(A,i,d))return!t"},qt={q:i,r:i,a:"m",p:"for(var a=1,b=arguments.length;a":">",'"':""","'":"'"},Gt=Vt(Qt),Yt=l(qt,{h:"if(t[i]==null)"+qt.h}),Zt=l(qt),en=l(jt,Ut,zt,{q:i}),tn=l(jt,Ut,zt),nn=l({q:i,a:"m",i:"[]",h:"S(A)&&t.push(i)",e:"t.sort()"}),rn=l({a:"A",i:"true",p:"var H=y.call(A),k=A.length;if(D[H]"+(Nt?"||O(A)":"")+"||(H==X&&k===+k&&S(A.splice)))return!k",h:{k:"return false"}}),sn=ut?function( -e){var t=typeof e;return"function"==t&&tt.call(e,"prototype")?Kt(e):e&&Ht[t]?ut(e):[]}:Kt,on=l(qt,{a:"m,dd,N",p:"var P,C=arguments,a=0;if(N==I){var b=2,ee=C[3],ff=C[4]}else var b=C.length,ee=[],ff=[];while(++a-1"},h:"if(A===hh)return true"}),hn=l(jt,Ft),pn=l(jt,It),dn=l(jt,Rt),vn=l(jt,Ut,{i:"z",h:"if(c(A,i,d))return A"}),mn=l(jt,Ut),gn=l(jt,Ft,{h:"var p=c(A,i,d);(h.call(t,p)?t[p]:t[p]=[]).push(A)"}),yn=l(Wt,{a:"d,U" -,p:"var C=v.call(arguments,2),R=typeof U=='function'",h:{b:"t[i]=(R?U:A[U]).apply(A,C)",k:"t"+(Mt?"[n]=":".push")+"((R?U:A[U]).apply(A,C))"}}),bn=l(jt,Wt),wn=l(Wt,{a:"d,bb",h:{b:"t[i]=A[bb]",k:"t"+(Mt?"[n]=":".push")+"(A[bb])"}}),En=l({a:"d,c,B,x",i:"B",p:"var V=arguments.length<3;c=f(c,x)",d:{b:"if(V)t=j[++i]"},h:{b:"t=c(t,A,i,d)",k:"t=V?(V=false,A):c(t,A,i,d)"}}),Sn=l(jt,Rt,{h:"!"+Rt.h}),xn=l(jt,It,{i:"false",h:It.h.replace("!","")}),Tn=l(jt,Ft,Wt,{h:{b:"t[i]={a:c(A,i,d),b:i,c:A}",k:"t"+(Mt?"[n]=" -:".push")+"({a:c(A,i,d),b:i,c:A})"},e:"t.sort(I);k=t.length;while(k--)t[k]=t[k].c"}),Nn=l(Rt,{a:"d,aa",p:"var s=[];J(aa,function(A,p){s.push(p)});var cc=s.length",h:"for(var Z=true,r=0;r1){while(++ie?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=L,s.bindAll= -Cn,s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=y,s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++tT(s,u)){for(var a=1;an?at(0,r+n):ft(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return a(t,e,nt.call(arguments,2))},s.map=bn,s.max=w,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Z.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=on,s.min=function(e,t,n){var r= -Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=f(t,n),mn(e,function(e,n,i){n=t(e,n,i),n=f?(bt(u),a=r,s=e.apply(o,i)):u||(u=wt(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rT(r,i)&&r.push(i)}return r},s.uniq=k,s.uniqueId=function(e){var t=P++;return e?e+t:t},s.values=ln,s.where=Nn,s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20),i=[];++t=(n||U),s=i?{}:e;if(i)for(n=t-1;++nn||e===t)return 1;if(es;s++)i+="h='"+e.o[s]+"';if(","constructor"==e.o[s]&&(i+="!(f&&f.prototype===i)&&"),i+="g.call(i,h)){u=i[h];"+ +e.l.h+"}"}if(e.c||e.m)i+="}"}return i+=e.e+";return p",Function("v,e,forIn,g,x,y,z,k,o,r,t","return function("+t+"){"+i+"}")(H,f,sn,ot,v,m,Ut,dt,at,Nt,lt)}function c(e){return"\\"+zt[e]}function h(e){return en[e]}function p(){}function d(e){return tn[e]}function v(e){return lt.call(e)==yt}function m(e){return"function"==typeof e}function g(e){var t=i;if(!e||"object"!=typeof e||v(e))return t;var n=e.constructor;return(!Ht||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!m(n)||n instanceof +n)?Ot?(sn(e,function(e,n,r){return t=!ot.call(r,n),i}),t===i):(sn(e,function(e,n){t=n}),t===i||ot.call(e,t)):t}function y(e,t,n,s,o){if(e==r)return e;n&&(t=i);if(n=Ut[typeof e]){var u=lt.call(e);if(!Rt[u]||_t&&v(e))return e;var a=u==bt,n=a||(u==xt?Yt(e):n)}if(!n||!t)return n?a?ft.call(e):rn({},e):e;n=e.constructor;switch(u){case wt:case Et:return new n(+e);case St:case Nt:return new n(e);case Tt:return n(e.source,K.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n( +e.length):{};return s.push(e),o.push(f),(a?ln:on)(e,function(e,n){f[n]=y(e,t,r,s,o)}),f}function b(e){var t=[];return sn(e,function(e,n){m(e)&&t.push(n)}),t.sort()}function w(e,t,s,o){if(e==r||t==r)return e===t;if(e===t)return 0!==e||1/e==1/t;if(Ut[typeof e]||Ut[typeof t])e=e.__wrapped__||e,t=t.__wrapped__||t;var u=lt.call(e);if(u!=lt.call(t))return i;switch(u){case wt:case Et:return+e==+t;case St:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Tt:case Nt:return e==t+""}var a=qt[u];if(_t&&!a&&(a=v(e) +)&&!v(t)||!a&&(u!=xt||Ht&&("function"!=typeof e.toString&&"string"==typeof (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+""))))return i;s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=w(e[l],t[l],s,o)););return f}a=e.constructor,f=t.constructor;if(a!=f&&(!m(a)||!(a instanceof a&&m(f)&&f instanceof f)))return i;for(var c in e)if(ot.call(e,c)&&(l++,!ot.call(t,c)||!w(e[c],t[c],s,o)))return i +;for(c in t)if(ot.call(t,c)&&!(l--))return i;if(Lt)for(;7>++u;)if(c=tt[u],ot.call(e,c)&&(!ot.call(t,c)||!w(e[c],t[c],s,o)))return i;return n}function E(e,t,n){var s=arguments,o=0,a=2,f=s[3],l=s[4];n!=u&&(a=s.length,f=[],l=[]);for(;++or&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function C(e,t){var n=[];return ln(e,function(e){n.push(e[t])}),n}function k(e,t,n,r){var s=3>arguments.length,t=f(t,r);return ln(e,function( +e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function L(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if(o!==+o)var a=un(e),o=a.length;else Pt&<.call(e)==Nt&&(s=e.split(""));return ln(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function A(e,t,n){if(e)return t==r||n?e[0]:ft.call(e,0,t)}function O(e,t){for(var n=-1,r=e?e.length:0,i=[];++nn?vt(0 +,i+n):n||0)-1;else if(n)return r=D(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])>>1,e[r]M(a,r))a.push(r),u.push(e[s]);return u}function H +(e,t){return jt||ct&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,X=/&(?:amp|lt|gt|quot|#x27);/g,V=/\b__p\+='';/g,$=/\b(__p\+=)''\+/g,J=/(__e\(.*?\)|\b__t\))\+'';/g,K=/\w*$/,Q=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,G=RegExp("^"+(q.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Y=/($^)/,Z=/[&<>"']/g,et=/['\n\r\t\u2028\u2029\\]/g,tt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf" +.split(" "),nt=Math.ceil,rt=I.concat,it=Math.floor,st=G.test(st=Object.getPrototypeOf)&&st,ot=q.hasOwnProperty,ut=I.push,at=q.propertyIsEnumerable,ft=I.slice,lt=q.toString,ct=G.test(ct=ft.bind)&&ct,ht=G.test(ht=Array.isArray)&&ht,pt=e.isFinite,dt=G.test(dt=Object.keys)&&dt,vt=Math.max,mt=Math.min,gt=Math.random,yt="[object Arguments]",bt="[object Array]",wt="[object Boolean]",Et="[object Date]",St="[object Number]",xt="[object Object]",Tt="[object RegExp]",Nt="[object String]",Ct=e.clearTimeout,kt= +e.setTimeout,Lt,At,Ot,Mt=n;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);for(r in arguments)Mt=!r;Lt=4>(n+"").length,Ot="x"!=n[0],At=(n.splice.call(t,0,1),t[0])})(1);var _t=!v(arguments),Dt="x"!=ft.call("x")[0],Pt="xx"!="x"[0]+Object("x")[0];try{var Ht=("[object Object]",lt.call(e.document||0)==xt)}catch(Bt){}var jt=ct&&/\n|Opera/.test(ct+lt.call(e.opera)),Ft=dt&&/^.+$|true/.test(dt+!!e.attachEvent),It=!jt,qt={};qt[wt]=qt[Et]=qt["[object Function]" +]=qt[St]=qt[xt]=qt[Tt]=i,qt[yt]=qt[bt]=qt[Nt]=n;var Rt={};Rt[yt]=Rt["[object Function]"]=i,Rt[bt]=Rt[wt]=Rt[Et]=Rt[St]=Rt[xt]=Rt[Tt]=Rt[Nt]=n;var Ut={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},zt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""};var Wt={a:"d,c,s",p:"c=e(c,s)",h:"if(c(u,h,d)===false)return p"},Xt={i:"true" +,h:"if(!c(u,h,d))return!p"},Vt={q:i,r:i,a:"l",p:"for(var a=1,b=arguments.length;a":">",'"':""","'":"'"},tn=Qt(en),nn=l(Vt,{h:"if(p[h]==null)"+Vt.h}),rn=l(Vt),sn=l(Wt,Jt,Kt,{q:i}),on=l(Wt,Jt,Kt),un=dt?function(e){var t=typeof e;return"function"==t&&at.call(e,"prototype")?Zt(e):e&&Ut[t]?dt(e):[]}:Zt,an=l(Wt,Xt),fn=l(Wt,$t),ln=l(Wt,Jt),cn=l(Wt,{i:"d||[]",d:{b:"p=Array(j)",k:"p="+(Ft?"Array(j)":"[]")},h:{b:"p[h]=c(u,h,d)",k:"p"+(Ft?"[m]=":".push")+"(c(u,h,d))"}} +),hn=l(Wt,$t,{h:"!"+$t.h}),pn=l(Wt,Xt,{i:"false",h:Xt.h.replace("!","")}),dn=l({q:i,r:i,a:"l",p:"var w=arguments,h=0,j=w.length;if(j>1){while(++he?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=H,s.bindAll=dn,s.chain=function(e){return e=new s(e),e.__chain__=n,e},s.clone=y,s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++tM(s,u)){for(var a=1;an?vt(0,r+n):mt(n,r-1))+1); +r--;)if(e[r]===t)return r;return-1},s.lateBind=function(e,t){return a(t,e,ft.call(arguments,2))},s.map=cn,s.max=N,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return ot.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=E,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=f(t,n),ln(e,function(e,n,i){n=t(e,n,i),nM(s,n))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return on(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return a(e,ft.call(arguments,1 +))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=rt.apply(I,arguments),o=s.length;++i=f?(Ct(u),a=r,s=e.apply(o,i)):u||(u=kt(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rM(r,i)&&r.push(i)}return r},s.uniq=P,s.uniqueId=function( +e){var t=R++;return e?e+t:t},s.values=S,s.where=function(e,t){var r=[];sn(t,function(e,t){r.push(t)});var i=r.length,s=[];return ln(e,function(e){for(var o=n,u=0;uarguments.length,t=x(t,r),f=e.length;s=-1;if(f===+f)for(a&&(u=e[++s]);++sn||e===t)return 1 -;if(er&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function _(e,t,n,r){var s=e?e.length:0,o=3>arguments.length;if(s!==+s)var u=At(e),s=u.length;return f(e,function(a,f,l){f=u?u[--s]:--s,n=o?(o=i,e[f]):t.call(r,n,e[f],f,l)}),n}function D(e,t,n){if(e)return t==r||n?e[0]:ot.call(e,0,t)}function P(e,t){for(var n=-1,r=e?e.length:0,i=[];++nn?ht(0, -i+n):n||0)-1;else if(n)return r=j(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])>>1,e[r]H(a,r))a.push(r),u.push(e[s]);return u}function I -(e,t){return xt||at&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,J=/&(?:amp|lt|gt|quot|#x27);/g,K=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,Q=RegExp("^"+(W.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),G=/($^)/,Y=/[&<>"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,et=Math.ceil,tt=z.concat,nt=Math.floor,rt=Q.test(rt=Object.getPrototypeOf)&&rt,it=W.hasOwnProperty,st=z.push,ot=z.slice,ut=W.toString,at=Q.test(at=ot.bind)&&at,ft=Q.test(ft=Array.isArray -)&&ft,lt=e.isFinite,ct=Q.test(ct=Object.keys)&&ct,ht=Math.max,pt=Math.min,dt=Math.random,vt="[object Boolean]",mt="[object Date]",gt="[object Number]",yt="[object Object]",bt="[object RegExp]",wt="[object String]",Et=e.clearTimeout,St=e.setTimeout,xt=at&&/\n|Opera/.test(at+ut.call(e.opera)),Tt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Nt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};w.templateSettings={escape:/<%-([\s\S]+?)%>/g -,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},w.isArguments=function(e){return"[object Arguments]"==ut.call(e)},w.isArguments(arguments)||(w.isArguments=function(e){return e?it.call(e,"callee"):i});var Ct=ft||function(e){return"[object Array]"==ut.call(e)};L(/x/)&&(L=function(e){return"[object Function]"==ut.call(e)});var W=rt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=rt(t))&&rt(n);return n?e==n||rt(e)==n&&!isArguments(e):A -(e)}:A,kt={"&":"&","<":"<",">":">",'"':""","'":"'"},Lt=b(kt),At=ct?function(e){return e&&Tt[typeof e]?ct(e):[]}:y;w.VERSION="0.8.2",w.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},w.bind=I,w.bindAll=function(e){var t,n,r=e,i=e;if(!e)return i;n=arguments,t=0;var s=n.length;if(1H(r,s,n)&&i.push(s)}return i},w.escape=function(e){return e==r?"":(e+"").replace(Y,N)},w.every=h,w.extend=g,w.filter=c,w.find=l,w.first=D,w.flatten=P,w.forEach=f,w.forIn=m,w.forOwn=function(e,t,n){var r;if(!e)return e;t=x(t,n);for(r in e)it.call(e,r)&&(n=e[r],t(n,r,e));return e},w.functions=v,w.groupBy=function(e,t,n){var r,i={};if(!e)return i;var t=x(t,n),s=e.length -,n=-1;if(s===+s)for(;++nH(i,s)){for(var o=1;oH(arguments[o],s))continue e;i.push(s)}}return i -},w.invert=b,w.invoke=function(e,t){var n,r,i=e,s=e||[];if(!e)return s;var o=ot.call(arguments,2),u="function"==typeof t,a=i.length;n=-1;if(a===+a)for(s=Array(a);++nn?ht(0,r+n):pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},w.map=a,w.max=M,w.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return it.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},w.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+ -s)t=x(t,n),f(e,function(e,n,i){n=t(e,n,i),nH(a,r))o[r]=i;return o},w.once=function(e){var t,s=i;return function(){ -return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},w.pairs=function(e){var t,n,r=[];if(!e)return r;for(t in e)it.call(e,t)&&(n=e[t],r.push([t,n]));return r},w.pick=function(e,t,n){var r,i,s=e,o={};if(!e)return o;if("function"!=typeof t){r=0,i=tt.apply(z,arguments);for(s=i.length;++r=f?(Et(u),a=r,s=e.apply(o,i)):u||(u=St(n,f)),s}},w.times=function( -e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rH(r,i)&&r.push(i)}return r},w.uniq=F,w.uniqueId=function(e){var t=X++;return e?e+t:t},w.values=d,w.where=function(e,t){var r,i,s=[];if(!e)return s;var o=[];m(t,function( -e,t){o.push(t)});var u=o.length,a=e.length;r=-1;if(a===+a)for(;++rH(arguments,i,1)&&r.push(i)}return r},w.wrap=function(e,t){return function(){var n=[e];return arguments.length&&st.apply(n,arguments),t.apply(this,n)}},w.zip=function(e){for(var t=-1 -,n=e?M(u(arguments,"length")):0,r=Array(n);++tn||e===t)return 1;if(er&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function O(e,t){var n=[];return u(e,function(e){n.push(e[t])}),n}function M(e,t,n,r){var s=3>arguments.length,t=y(t,r);return u(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function _(e,t,n,r +){var s=e?e.length:0,o=3>arguments.length;if(s!==+s)var a=Ot(e),s=a.length;return u(e,function(u,f,l){f=a?a[--s]:--s,n=o?(o=i,e[f]):t.call(r,n,e[f],f,l)}),n}function D(e,t,n){if(e)return t==r||n?e[0]:ot.call(e,0,t)}function P(e,t){for(var n=-1,r=e?e.length:0,i=[];++nn?ht(0,i+n):n||0)-1;else if(n)return r=j(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])>>1,e[r]H(a,r))a.push(r),u.push(e[s]);return u}function I(e,t){return Tt||at&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,J=/&(?:amp|lt|gt|quot|#x27);/g +,K=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,Q=RegExp("^"+(W.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),G=/($^)/,Y=/[&<>"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,et=Math.ceil,tt=z.concat,nt=Math.floor,rt=Q.test(rt=Object.getPrototypeOf)&&rt,it=W.hasOwnProperty,st=z.push,ot=z.slice,ut=W.toString,at=Q.test(at=ot.bind)&&at,ft=Q.test(ft=Array.isArray)&&ft,lt=e.isFinite,ct=Q.test(ct=Object.keys)&&ct,ht=Math.max,pt=Math.min,dt=Math.random,vt="[object Boolean]" +,mt="[object Date]",gt="[object Number]",yt="[object Object]",bt="[object RegExp]",wt="[object String]",Et=e.clearTimeout,St=e.setTimeout,xt;(function(){function e(){this.x=1}var t={0:1,length:1},n=[];e.prototype={valueOf:1,y:1};for(var r in new e)n.push(r);xt=(n.splice.call(t,0,1),t[0])})(1);var Tt=at&&/\n|Opera/.test(at+ut.call(e.opera)),Nt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i,unknown:n},Ct={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"} +;v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},v.isArguments=function(e){return"[object Arguments]"==ut.call(e)},v.isArguments(arguments)||(v.isArguments=function(e){return e?it.call(e,"callee"):i});var kt=ft||function(e){return"[object Array]"==ut.call(e)};x(/x/)&&(x=function(e){return"[object Function]"==ut.call(e)});var Lt={"&":"&","<":"<",">":">",'"':""","'":"'"},At=d(Lt),Ot=ct?function(e){return e&&Nt[typeof +e]?ct(e):[]}:p;v.VERSION="0.8.2",v.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},v.bind=I,v.bindAll=function(e){var t,n,r=e,i=e;if(!e)return i;n=arguments,t=0;var s=n.length;if(1H(r,s,n)&&i.push(s)}return i},v.escape=function(e){return e==r?"":(e+"").replace(Y,w)},v.every=f,v.extend= +h,v.filter=a,v.find=L,v.first=D,v.flatten=P,v.forEach=u,v.functions=T,v.groupBy=function(e,t,n){var r={},t=y(t,n);return u(e,function(e,n,i){n=t(e,n,i),(it.call(r,n)?r[n]:r[n]=[]).push(e)}),r},v.has=function(e,t){return e?it.call(e,t):i},v.identity=q,v.indexOf=H,v.initial=function(e,t,n){return e?ot.call(e,0,-(t==r||n?1:t)):[]},v.intersection=function(e){var t=arguments.length,n=-1,r=e.length,i=[];e:for(;++nH(i,s)){for(var o=1;oH(arguments[o],s))continue e;i.push( +s)}}return i},v.invert=d,v.invoke=function(e,t){var n=ot.call(arguments,2),r="function"==typeof t,i=[];return u(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},v.isArray=kt,v.isBoolean=function(e){return e===n||e===i||ut.call(e)==vt},v.isDate=function(e){return ut.call(e)==mt},v.isElement=function(e){return e?1===e.nodeType:i},v.isEmpty=function(e){var t=n;if(!e)return t;var r=ut.call(e),s=e.length;return kt(e)||r==wt||r==yt&&s===+s&&x(e.splice)?!s:(l(e,function(){return t=i}),t)},v.isEqual=N,v. +isFinite=function(e){return lt(e)&&ut.call(e)==gt},v.isFunction=x,v.isNaN=function(e){return ut.call(e)==gt&&e!=+e},v.isNull=function(e){return e===r},v.isNumber=function(e){return ut.call(e)==gt},v.isObject=function(e){return e?Nt[typeof e]:i},v.isRegExp=function(e){return ut.call(e)==bt},v.isString=function(e){return ut.call(e)==wt},v.isUndefined=function(e){return e===t},v.keys=Ot,v.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:ot.call(e,-t||i)}},v.lastIndexOf=function(e,t,n) +{var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?ht(0,r+n):pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},v.map=o,v.max=A,v.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return it.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},v.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||s!==+s)t=y(t,n),u(e,function(e,n,i){n=t(e,n,i),nH(s,n))i[n]=e}),i},v.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},v.pairs=function(e){var t=[];return l(e,function(e,n){t.push([n,e])}),t},v.pick=function(e,t,n){var r={};if("function"!=typeof +t)for(var i=0,s=tt.apply(z,arguments),o=s.length;++i=f?(Et(u),a=r,s=e.apply(o,i)):u||(u=St(n,f)),s}},v.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++rH(r,i)&& +r.push(i)}return r},v.uniq=F,v.uniqueId=function(e){var t=X++;return e?e+t:t},v.values=C,v.where=function(e,t){var r=[];c(t,function(e,t){r.push(t)});var i=r.length,s=[];return u(e,function(e){for(var o=n,u=0;uH(arguments,i,1)&&r.push(i)}return r},v.wrap=function(e,t){return function(){var n=[e];return arguments.length&&st.apply(n,arguments),t.apply(this,n)}},v.zip=function(e) +{for(var t=-1,n=e?A(O(arguments,"length")):0,r=Array(n);++t