\" )\n\t\t\t\t.attr({\n\t\t\t\t\tid: id,\n\t\t\t\t\trole: \"tooltip\"\n\t\t\t\t})\n\t\t\t\t.addClass( \"ui-tooltip ui-widget ui-corner-all ui-widget-content \" +\n\t\t\t\t\t( this.options.tooltipClass || \"\" ) );\n\t\t$( \"
\" )\n\t\t\t.addClass( \"ui-tooltip-content\" )\n\t\t\t.appendTo( tooltip );\n\t\ttooltip.appendTo( this.document[0].body );\n\t\tif ( $.fn.bgiframe ) {\n\t\t\ttooltip.bgiframe();\n\t\t}\n\t\tthis.tooltips[ id ] = element;\n\t\treturn tooltip;\n\t},\n\n\t_find: function( target ) {\n\t\tvar id = target.data( \"ui-tooltip-id\" );\n\t\treturn id ? $( \"#\" + id ) : $();\n\t},\n\n\t_destroy: function() {\n\t\t$.each( this.tooltips, function( id ) {\n\t\t\t$( \"#\" + id ).remove();\n\t\t});\n\t}\n});\n\n\n","/*\n * Copyright (C) 2011 - present Instructure, Inc.\n *\n * This file is part of Canvas.\n *\n * Canvas is free software: you can redistribute it and/or modify it under\n * the terms of the GNU Affero General Public License as published by the Free\n * Software Foundation, version 3 of the License.\n *\n * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n * details.\n *\n * You should have received a copy of the GNU Affero General Public License along\n * with this program. If not, see
.\n */\n\n// //\n// if you want underscore in your code. require 'underscore' (this file)\nconst _ = require('lodash-underscore')\n\n// grab the global '_' variable, make it not global and return it\nmodule.exports = _.noConflict()\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport React from 'react';\nvar loggedInitialDeprecationWarning = false;\n/* eslint-disable no-console */\n\nfunction getRenderStack() {\n var renderStack = '';\n\n try {\n renderStack = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDebugCurrentFrame.getStackAddendum();\n } catch (error) {// log happened outside a react render or couldn't figure out where in the render stack we are.\n }\n\n return renderStack;\n}\n\nfunction logMessage(level, withRenderStack, condition, message) {\n if (process.env.NODE_ENV !== 'production' && !condition) {\n if (typeof console[level] === 'function') {\n var _console;\n\n var renderStack = withRenderStack ? getRenderStack() : '';\n\n for (var _len = arguments.length, args = new Array(_len > 4 ? _len - 4 : 0), _key = 4; _key < _len; _key++) {\n args[_key - 4] = arguments[_key];\n }\n\n (_console = console)[level].apply(_console, [\"Warning: \".concat(message)].concat(args, [renderStack]));\n } else {\n throw new Error(\"'\".concat(level, \"' is not a valid console method!\"));\n }\n }\n}\n\nfunction logDeprecated(condition, message) {\n if (!process.env.OMIT_INSTUI_DEPRECATION_WARNINGS) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n args[_key2 - 2] = arguments[_key2];\n }\n\n logMessage.apply(void 0, ['warn', true, condition, message].concat(args));\n } else if (!condition && !loggedInitialDeprecationWarning) {\n loggedInitialDeprecationWarning = true;\n logMessage('warn', false, condition, ['There are Instructure UI deprecation warnings that are being hidden because the `OMIT_INSTUI_DEPRECATION_WARNINGS` environment variable is set. Remove or unset this variable to see the full list of warnings in your console.', 'These warnings will give you advance notice of breaking changes and upgrade guidance to keep your code up to date with the latest Instructure UI versions.'].join('\\n\\n'));\n }\n}\n\nexport var error = function error() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return logMessage.apply(void 0, ['error', true].concat(args));\n};\nexport var warn = function warn() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return logMessage.apply(void 0, ['warn', true].concat(args));\n};\nexport var warnDeprecated = function warnDeprecated() {\n return logDeprecated.apply(void 0, arguments);\n};\nexport var info = function info() {\n var _console2;\n\n return (_console2 = console).info.apply(_console2, arguments);\n};\nexport var assert = function assert() {\n var _console3;\n\n return (_console3 = console).assert.apply(_console3, arguments);\n};\nexport var debug = function debug() {\n var _console4;\n\n return (_console4 = console).debug.apply(_console4, arguments);\n};\nexport var log = function log() {\n var _console5;\n\n return (_console5 = console).log.apply(_console5, arguments);\n};\n/* eslint-enable no-console */","// TinyColor v1.4.1\n// https://github.com/bgrins/TinyColor\n// Brian Grinstead, MIT License\n\n(function(Math) {\n\nvar trimLeft = /^\\s+/,\n trimRight = /\\s+$/,\n tinyCounter = 0,\n mathRound = Math.round,\n mathMin = Math.min,\n mathMax = Math.max,\n mathRandom = Math.random;\n\nfunction tinycolor (color, opts) {\n\n color = (color) ? color : '';\n opts = opts || { };\n\n // If input is already a tinycolor, return itself\n if (color instanceof tinycolor) {\n return color;\n }\n // If we are called as a function, call using new instead\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color, opts);\n }\n\n var rgb = inputToRGB(color);\n this._originalInput = color,\n this._r = rgb.r,\n this._g = rgb.g,\n this._b = rgb.b,\n this._a = rgb.a,\n this._roundA = mathRound(100*this._a) / 100,\n this._format = opts.format || rgb.format;\n this._gradientType = opts.gradientType;\n\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this._r < 1) { this._r = mathRound(this._r); }\n if (this._g < 1) { this._g = mathRound(this._g); }\n if (this._b < 1) { this._b = mathRound(this._b); }\n\n this._ok = rgb.ok;\n this._tc_id = tinyCounter++;\n}\n\ntinycolor.prototype = {\n isDark: function() {\n return this.getBrightness() < 128;\n },\n isLight: function() {\n return !this.isDark();\n },\n isValid: function() {\n return this._ok;\n },\n getOriginalInput: function() {\n return this._originalInput;\n },\n getFormat: function() {\n return this._format;\n },\n getAlpha: function() {\n return this._a;\n },\n getBrightness: function() {\n //http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n },\n getLuminance: function() {\n //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var RsRGB, GsRGB, BsRGB, R, G, B;\n RsRGB = rgb.r/255;\n GsRGB = rgb.g/255;\n BsRGB = rgb.b/255;\n\n if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}\n if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}\n if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}\n return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);\n },\n setAlpha: function(value) {\n this._a = boundAlpha(value);\n this._roundA = mathRound(100*this._a) / 100;\n return this;\n },\n toHsv: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };\n },\n toHsvString: function() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);\n return (this._a == 1) ?\n \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" :\n \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \"+ this._roundA + \")\";\n },\n toHsl: function() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };\n },\n toHslString: function() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);\n return (this._a == 1) ?\n \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" :\n \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \"+ this._roundA + \")\";\n },\n toHex: function(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function(allow3Char) {\n return '#' + this.toHex(allow3Char);\n },\n toHex8: function(allow4Char) {\n return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);\n },\n toHex8String: function(allow4Char) {\n return '#' + this.toHex8(allow4Char);\n },\n toRgb: function() {\n return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };\n },\n toRgbString: function() {\n return (this._a == 1) ?\n \"rgb(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \")\" :\n \"rgba(\" + mathRound(this._r) + \", \" + mathRound(this._g) + \", \" + mathRound(this._b) + \", \" + this._roundA + \")\";\n },\n toPercentageRgb: function() {\n return { r: mathRound(bound01(this._r, 255) * 100) + \"%\", g: mathRound(bound01(this._g, 255) * 100) + \"%\", b: mathRound(bound01(this._b, 255) * 100) + \"%\", a: this._a };\n },\n toPercentageRgbString: function() {\n return (this._a == 1) ?\n \"rgb(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%)\" :\n \"rgba(\" + mathRound(bound01(this._r, 255) * 100) + \"%, \" + mathRound(bound01(this._g, 255) * 100) + \"%, \" + mathRound(bound01(this._b, 255) * 100) + \"%, \" + this._roundA + \")\";\n },\n toName: function() {\n if (this._a === 0) {\n return \"transparent\";\n }\n\n if (this._a < 1) {\n return false;\n }\n\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function(secondColor) {\n var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? \"GradientType = 1, \" : \"\";\n\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);\n }\n\n return \"progid:DXImageTransform.Microsoft.gradient(\"+gradientType+\"startColorstr=\"+hex8String+\",endColorstr=\"+secondHex8String+\")\";\n },\n toString: function(format) {\n var formatSet = !!format;\n format = format || this._format;\n\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === \"hex\" || format === \"hex6\" || format === \"hex3\" || format === \"hex4\" || format === \"hex8\" || format === \"name\");\n\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === \"name\" && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === \"rgb\") {\n formattedString = this.toRgbString();\n }\n if (format === \"prgb\") {\n formattedString = this.toPercentageRgbString();\n }\n if (format === \"hex\" || format === \"hex6\") {\n formattedString = this.toHexString();\n }\n if (format === \"hex3\") {\n formattedString = this.toHexString(true);\n }\n if (format === \"hex4\") {\n formattedString = this.toHex8String(true);\n }\n if (format === \"hex8\") {\n formattedString = this.toHex8String();\n }\n if (format === \"name\") {\n formattedString = this.toName();\n }\n if (format === \"hsl\") {\n formattedString = this.toHslString();\n }\n if (format === \"hsv\") {\n formattedString = this.toHsvString();\n }\n\n return formattedString || this.toHexString();\n },\n clone: function() {\n return tinycolor(this.toString());\n },\n\n _applyModification: function(fn, args) {\n var color = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color._r;\n this._g = color._g;\n this._b = color._b;\n this.setAlpha(color._a);\n return this;\n },\n lighten: function() {\n return this._applyModification(lighten, arguments);\n },\n brighten: function() {\n return this._applyModification(brighten, arguments);\n },\n darken: function() {\n return this._applyModification(darken, arguments);\n },\n desaturate: function() {\n return this._applyModification(desaturate, arguments);\n },\n saturate: function() {\n return this._applyModification(saturate, arguments);\n },\n greyscale: function() {\n return this._applyModification(greyscale, arguments);\n },\n spin: function() {\n return this._applyModification(spin, arguments);\n },\n\n _applyCombination: function(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function() {\n return this._applyCombination(analogous, arguments);\n },\n complement: function() {\n return this._applyCombination(complement, arguments);\n },\n monochromatic: function() {\n return this._applyCombination(monochromatic, arguments);\n },\n splitcomplement: function() {\n return this._applyCombination(splitcomplement, arguments);\n },\n triad: function() {\n return this._applyCombination(triad, arguments);\n },\n tetrad: function() {\n return this._applyCombination(tetrad, arguments);\n }\n};\n\n// If input is an object, force 1 into \"1.0\" to handle ratios properly\n// String input requires \"1.0\" as input, so 1 will be treated as 1\ntinycolor.fromRatio = function(color, opts) {\n if (typeof color == \"object\") {\n var newColor = {};\n for (var i in color) {\n if (color.hasOwnProperty(i)) {\n if (i === \"a\") {\n newColor[i] = color[i];\n }\n else {\n newColor[i] = convertToPercentage(color[i]);\n }\n }\n }\n color = newColor;\n }\n\n return tinycolor(color, opts);\n};\n\n// Given a string or object, convert that input to RGB\n// Possible string inputs:\n//\n// \"red\"\n// \"#f00\" or \"f00\"\n// \"#ff0000\" or \"ff0000\"\n// \"#ff000000\" or \"ff000000\"\n// \"rgb 255 0 0\" or \"rgb (255, 0, 0)\"\n// \"rgb 1.0 0 0\" or \"rgb (1, 0, 0)\"\n// \"rgba (255, 0, 0, 1)\" or \"rgba 255, 0, 0, 1\"\n// \"rgba (1.0, 0, 0, 1)\" or \"rgba 1.0, 0, 0, 1\"\n// \"hsl(0, 100%, 50%)\" or \"hsl 0 100% 50%\"\n// \"hsla(0, 100%, 50%, 1)\" or \"hsla 0 100% 50%, 1\"\n// \"hsv(0, 100%, 100%)\" or \"hsv 0 100% 100%\"\n//\nfunction inputToRGB(color) {\n\n var rgb = { r: 0, g: 0, b: 0 };\n var a = 1;\n var s = null;\n var v = null;\n var l = null;\n var ok = false;\n var format = false;\n\n if (typeof color == \"string\") {\n color = stringInputToObject(color);\n }\n\n if (typeof color == \"object\") {\n if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {\n rgb = rgbToRgb(color.r, color.g, color.b);\n ok = true;\n format = String(color.r).substr(-1) === \"%\" ? \"prgb\" : \"rgb\";\n }\n else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {\n s = convertToPercentage(color.s);\n v = convertToPercentage(color.v);\n rgb = hsvToRgb(color.h, s, v);\n ok = true;\n format = \"hsv\";\n }\n else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {\n s = convertToPercentage(color.s);\n l = convertToPercentage(color.l);\n rgb = hslToRgb(color.h, s, l);\n ok = true;\n format = \"hsl\";\n }\n\n if (color.hasOwnProperty(\"a\")) {\n a = color.a;\n }\n }\n\n a = boundAlpha(a);\n\n return {\n ok: ok,\n format: color.format || format,\n r: mathMin(255, mathMax(rgb.r, 0)),\n g: mathMin(255, mathMax(rgb.g, 0)),\n b: mathMin(255, mathMax(rgb.b, 0)),\n a: a\n };\n}\n\n\n// Conversion Functions\n// --------------------\n\n// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:\n//
\n\n// `rgbToRgb`\n// Handle bounds / percentage checking to conform to CSS color spec\n// \n// *Assumes:* r, g, b in [0, 255] or [0, 1]\n// *Returns:* { r, g, b } in [0, 255]\nfunction rgbToRgb(r, g, b){\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n}\n\n// `rgbToHsl`\n// Converts an RGB color value to HSL.\n// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]\n// *Returns:* { h, s, l } in [0,1]\nfunction rgbToHsl(r, g, b) {\n\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min) {\n h = s = 0; // achromatic\n }\n else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n\n h /= 6;\n }\n\n return { h: h, s: s, l: l };\n}\n\n// `hslToRgb`\n// Converts an HSL color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\nfunction hslToRgb(h, s, l) {\n var r, g, b;\n\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n\n function hue2rgb(p, q, t) {\n if(t < 0) t += 1;\n if(t > 1) t -= 1;\n if(t < 1/6) return p + (q - p) * 6 * t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n }\n\n if(s === 0) {\n r = g = b = l; // achromatic\n }\n else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n}\n\n// `rgbToHsv`\n// Converts an RGB color value to HSV\n// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]\n// *Returns:* { h, s, v } in [0,1]\nfunction rgbToHsv(r, g, b) {\n\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b), min = mathMin(r, g, b);\n var h, s, v = max;\n\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n\n if(max == min) {\n h = 0; // achromatic\n }\n else {\n switch(max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h, s: s, v: v };\n}\n\n// `hsvToRgb`\n// Converts an HSV color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\n function hsvToRgb(h, s, v) {\n\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n\n var i = Math.floor(h),\n f = h - i,\n p = v * (1 - s),\n q = v * (1 - f * s),\n t = v * (1 - (1 - f) * s),\n mod = i % 6,\n r = [v, q, p, p, t, v][mod],\n g = [t, v, v, q, p, p][mod],\n b = [p, p, t, v, v, q][mod];\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n}\n\n// `rgbToHex`\n// Converts an RGB color to hex\n// Assumes r, g, and b are contained in the set [0, 255]\n// Returns a 3 or 6 character hex\nfunction rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n}\n\n// `rgbaToHex`\n// Converts an RGBA color plus alpha transparency to hex\n// Assumes r, g, b are contained in the set [0, 255] and\n// a in [0, 1]. Returns a 4 or 8 character rgba hex\nfunction rgbaToHex(r, g, b, a, allow4Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16)),\n pad2(convertDecimalToHex(a))\n ];\n\n // Return a 4 character hex if possible\n if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);\n }\n\n return hex.join(\"\");\n}\n\n// `rgbaToArgbHex`\n// Converts an RGBA color to an ARGB Hex8 string\n// Rarely used, but required for \"toFilter()\"\nfunction rgbaToArgbHex(r, g, b, a) {\n\n var hex = [\n pad2(convertDecimalToHex(a)),\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n return hex.join(\"\");\n}\n\n// `equals`\n// Can be called with any tinycolor input\ntinycolor.equals = function (color1, color2) {\n if (!color1 || !color2) { return false; }\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n};\n\ntinycolor.random = function() {\n return tinycolor.fromRatio({\n r: mathRandom(),\n g: mathRandom(),\n b: mathRandom()\n });\n};\n\n\n// Modification Functions\n// ----------------------\n// Thanks to less.js for some of the basics here\n// \n\nfunction desaturate(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\n\nfunction saturate(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\n\nfunction greyscale(color) {\n return tinycolor(color).desaturate(100);\n}\n\nfunction lighten (color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\nfunction brighten(color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var rgb = tinycolor(color).toRgb();\n rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));\n rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));\n rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));\n return tinycolor(rgb);\n}\n\nfunction darken (color, amount) {\n amount = (amount === 0) ? 0 : (amount || 10);\n var hsl = tinycolor(color).toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\n// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n// Values outside of this range will be wrapped into this range.\nfunction spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}\n\n// Combination Functions\n// ---------------------\n// Thanks to jQuery xColor for some of the ideas behind these\n// \n\nfunction complement(color) {\n var hsl = tinycolor(color).toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return tinycolor(hsl);\n}\n\nfunction triad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })\n ];\n}\n\nfunction tetrad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),\n tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })\n ];\n}\n\nfunction splitcomplement(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [\n tinycolor(color),\n tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),\n tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})\n ];\n}\n\nfunction analogous(color, results, slices) {\n results = results || 6;\n slices = slices || 30;\n\n var hsl = tinycolor(color).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color)];\n\n for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(tinycolor(hsl));\n }\n return ret;\n}\n\nfunction monochromatic(color, results) {\n results = results || 6;\n var hsv = tinycolor(color).toHsv();\n var h = hsv.h, s = hsv.s, v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n\n while (results--) {\n ret.push(tinycolor({ h: h, s: s, v: v}));\n v = (v + modification) % 1;\n }\n\n return ret;\n}\n\n// Utility Functions\n// ---------------------\n\ntinycolor.mix = function(color1, color2, amount) {\n amount = (amount === 0) ? 0 : (amount || 50);\n\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n\n var p = amount / 100;\n\n var rgba = {\n r: ((rgb2.r - rgb1.r) * p) + rgb1.r,\n g: ((rgb2.g - rgb1.g) * p) + rgb1.g,\n b: ((rgb2.b - rgb1.b) * p) + rgb1.b,\n a: ((rgb2.a - rgb1.a) * p) + rgb1.a\n };\n\n return tinycolor(rgba);\n};\n\n\n// Readability Functions\n// ---------------------\n// false\n// tinycolor.isReadable(\"#000\", \"#111\",{level:\"AA\",size:\"large\"}) => false\ntinycolor.isReadable = function(color1, color2, wcag2) {\n var readability = tinycolor.readability(color1, color2);\n var wcag2Parms, out;\n\n out = false;\n\n wcag2Parms = validateWCAG2Parms(wcag2);\n switch (wcag2Parms.level + wcag2Parms.size) {\n case \"AAsmall\":\n case \"AAAlarge\":\n out = readability >= 4.5;\n break;\n case \"AAlarge\":\n out = readability >= 3;\n break;\n case \"AAAsmall\":\n out = readability >= 7;\n break;\n }\n return out;\n\n};\n\n// `mostReadable`\n// Given a base color and a list of possible foreground or background\n// colors for that base, returns the most readable color.\n// Optionally returns Black or White if the most readable color is unreadable.\n// *Example*\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:false}).toHexString(); // \"#112255\"\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:true}).toHexString(); // \"#ffffff\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"large\"}).toHexString(); // \"#faf3f3\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"small\"}).toHexString(); // \"#ffffff\"\ntinycolor.mostReadable = function(baseColor, colorList, args) {\n var bestColor = null;\n var bestScore = 0;\n var readability;\n var includeFallbackColors, level, size ;\n args = args || {};\n includeFallbackColors = args.includeFallbackColors ;\n level = args.level;\n size = args.size;\n\n for (var i= 0; i < colorList.length ; i++) {\n readability = tinycolor.readability(baseColor, colorList[i]);\n if (readability > bestScore) {\n bestScore = readability;\n bestColor = tinycolor(colorList[i]);\n }\n }\n\n if (tinycolor.isReadable(baseColor, bestColor, {\"level\":level,\"size\":size}) || !includeFallbackColors) {\n return bestColor;\n }\n else {\n args.includeFallbackColors=false;\n return tinycolor.mostReadable(baseColor,[\"#fff\", \"#000\"],args);\n }\n};\n\n\n// Big List of Colors\n// ------------------\n// \nvar names = tinycolor.names = {\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n};\n\n// Make it easy to access colors via `hexNames[hex]`\nvar hexNames = tinycolor.hexNames = flip(names);\n\n\n// Utilities\n// ---------\n\n// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`\nfunction flip(o) {\n var flipped = { };\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n}\n\n// Return a valid alpha value [0,1] with all invalid values being set to 1\nfunction boundAlpha(a) {\n a = parseFloat(a);\n\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n\n return a;\n}\n\n// Take input from [0, n] and return it as [0, 1]\nfunction bound01(n, max) {\n if (isOnePointZero(n)) { n = \"100%\"; }\n\n var processPercent = isPercentage(n);\n n = mathMin(max, mathMax(0, parseFloat(n)));\n\n // Automatically convert percentage into number\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n\n // Handle floating point rounding errors\n if ((Math.abs(n - max) < 0.000001)) {\n return 1;\n }\n\n // Convert into [0, 1] range if it isn't already\n return (n % max) / parseFloat(max);\n}\n\n// Force a number between 0 and 1\nfunction clamp01(val) {\n return mathMin(1, mathMax(0, val));\n}\n\n// Parse a base-16 hex value into a base-10 integer\nfunction parseIntFromHex(val) {\n return parseInt(val, 16);\n}\n\n// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1\n// \nfunction isOnePointZero(n) {\n return typeof n == \"string\" && n.indexOf('.') != -1 && parseFloat(n) === 1;\n}\n\n// Check to see if string passed in is a percentage\nfunction isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}\n\n// Force a hex value to have 2 characters\nfunction pad2(c) {\n return c.length == 1 ? '0' + c : '' + c;\n}\n\n// Replace a decimal with it's percentage value\nfunction convertToPercentage(n) {\n if (n <= 1) {\n n = (n * 100) + \"%\";\n }\n\n return n;\n}\n\n// Converts a decimal to a hex value\nfunction convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n}\n// Converts a hex value to a decimal\nfunction convertHexToDecimal(h) {\n return (parseIntFromHex(h) / 255);\n}\n\nvar matchers = (function() {\n\n // \n var CSS_INTEGER = \"[-\\\\+]?\\\\d+%?\";\n\n // \n var CSS_NUMBER = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\";\n\n // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.\n var CSS_UNIT = \"(?:\" + CSS_NUMBER + \")|(?:\" + CSS_INTEGER + \")\";\n\n // Actual matching.\n // Parentheses and commas are optional, but not required.\n // Whitespace can take the place of commas or opening paren\n var PERMISSIVE_MATCH3 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n var PERMISSIVE_MATCH4 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n\n return {\n CSS_UNIT: new RegExp(CSS_UNIT),\n rgb: new RegExp(\"rgb\" + PERMISSIVE_MATCH3),\n rgba: new RegExp(\"rgba\" + PERMISSIVE_MATCH4),\n hsl: new RegExp(\"hsl\" + PERMISSIVE_MATCH3),\n hsla: new RegExp(\"hsla\" + PERMISSIVE_MATCH4),\n hsv: new RegExp(\"hsv\" + PERMISSIVE_MATCH3),\n hsva: new RegExp(\"hsva\" + PERMISSIVE_MATCH4),\n hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n})();\n\n// `isValidCSSUnit`\n// Take in a single string / number and check to see if it looks like a CSS unit\n// (see `matchers` above for definition).\nfunction isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}\n\n// `stringInputToObject`\n// Permissive string parsing. Take in a number of formats, and output an object\n// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`\nfunction stringInputToObject(color) {\n\n color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();\n var named = false;\n if (names[color]) {\n color = names[color];\n named = true;\n }\n else if (color == 'transparent') {\n return { r: 0, g: 0, b: 0, a: 0, format: \"name\" };\n }\n\n // Try to match string input using regular expressions.\n // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]\n // Just return an object and let the conversion functions handle that.\n // This way the result will be the same whether the tinycolor is initialized with string or object.\n var match;\n if ((match = matchers.rgb.exec(color))) {\n return { r: match[1], g: match[2], b: match[3] };\n }\n if ((match = matchers.rgba.exec(color))) {\n return { r: match[1], g: match[2], b: match[3], a: match[4] };\n }\n if ((match = matchers.hsl.exec(color))) {\n return { h: match[1], s: match[2], l: match[3] };\n }\n if ((match = matchers.hsla.exec(color))) {\n return { h: match[1], s: match[2], l: match[3], a: match[4] };\n }\n if ((match = matchers.hsv.exec(color))) {\n return { h: match[1], s: match[2], v: match[3] };\n }\n if ((match = matchers.hsva.exec(color))) {\n return { h: match[1], s: match[2], v: match[3], a: match[4] };\n }\n if ((match = matchers.hex8.exec(color))) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n a: convertHexToDecimal(match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if ((match = matchers.hex6.exec(color))) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n if ((match = matchers.hex4.exec(color))) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n a: convertHexToDecimal(match[4] + '' + match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if ((match = matchers.hex3.exec(color))) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n\n return false;\n}\n\nfunction validateWCAG2Parms(parms) {\n // return valid WCAG2 parms for isReadable.\n // If input parms are invalid, return {\"level\":\"AA\", \"size\":\"small\"}\n var level, size;\n parms = parms || {\"level\":\"AA\", \"size\":\"small\"};\n level = (parms.level || \"AA\").toUpperCase();\n size = (parms.size || \"small\").toLowerCase();\n if (level !== \"AA\" && level !== \"AAA\") {\n level = \"AA\";\n }\n if (size !== \"small\" && size !== \"large\") {\n size = \"small\";\n }\n return {\"level\":level, \"size\":size};\n}\n\n// Node: Export function\nif (typeof module !== \"undefined\" && module.exports) {\n module.exports = tinycolor;\n}\n// AMD/requirejs: Define the module\nelse if (typeof define === 'function' && define.amd) {\n define(function () {return tinycolor;});\n}\n// Browser: Expose to window\nelse {\n window.tinycolor = tinycolor;\n}\n\n})(Math);\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","// This file is copy/pasted from https://unpkg.com/@instructure/ui-themeable@6.10.0/es/themeable.js but with 'newless' added and the relative imports changed to absolute package paths\n\nimport _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'\nimport _createClass from '@babel/runtime/helpers/esm/createClass'\nimport _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn'\nimport _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf'\nimport _get from '@babel/runtime/helpers/esm/get'\nimport _inherits from '@babel/runtime/helpers/esm/inherits'\nimport {warn as _warn} from '@instructure/console'\n\n/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport {decorator} from '@instructure/ui-decorator'\nimport {isEmpty, shallowEqual, deepEqual} from '@instructure/ui-utils'\nimport {uid} from '@instructure/uid'\nimport {findDOMNode} from '@instructure/ui-dom-utils'\nimport {ThemeContext} from '@instructure/ui-themeable/es/ThemeContext'\nimport {applyVariablesToNode, setTextDirection} from '@instructure/ui-themeable'\nimport {\n generateComponentTheme,\n generateTheme,\n registerComponentTheme,\n mountComponentStyles\n} from '@instructure/ui-themeable/es/ThemeRegistry'\n\nimport newless from 'newless'\n\n/**\n * ---\n * category: utilities/themes\n * ---\n * A decorator or higher order component that makes a component `themeable`.\n *\n * As a HOC:\n *\n * ```js\n * import themeable from '@instructure/ui-themeable'\n * import styles from 'styles.css'\n * import theme from 'theme.js'\n *\n * class Example extends React.Component {\n * render () {\n * return Hello
\n * }\n * }\n *\n * export default themeable(theme, styles)(Example)\n * ```\n *\n * Note: in the above example, the CSS file must be transformed into a JS object\n * via [babel](#babel-plugin-themeable-styles) or [webpack](#ui-webpack-config) loader.\n *\n * Themeable components inject their themed styles into the document when they are mounted.\n *\n * After the initial mount, a themeable component's theme can be configured explicitly\n * via its `theme` prop or passed via React context using the [ApplyTheme](#ApplyTheme) component.\n *\n * Themeable components register themselves with the [global theme registry](#registry)\n * when they are imported into the application, so you will need to be sure to import them\n * before you mount your application so that the default themed styles can be generated and injected.\n *\n * @param {function} theme - A function that generates the component theme variables.\n * @param {object} styles - The component styles object.\n * @return {function} composes the themeable component.\n */\n\nconst emptyObj = {}\n/*\n * Note: there are consumers (like canvas-lms and other edu org repos) that are\n * consuming this file directly from \"/src\" (as opposed to \"/es\" or \"/lib\" like normal)\n * because they need this file to not have the babel \"class\" transform ran against it\n * (aka they need it to use real es6 `class`es, since you can't extend real es6\n * class from es5 transpiled code)\n *\n * Which means that for the time being, we can't use any other es6/7/8 features in\n * here that aren't supported by \"last 2 edge versions\" since we can't rely on babel\n * to transpile them for those apps.\n *\n * So, that means don't use \"static\" class properties (like `static PropTypes = {...}`),\n * or object spread (like \"{...foo, ..bar}\")\" in this file until instUI 7 is released.\n * Once we release instUI 7, the plan is to stop transpiling the \"/es\" dir for ie11\n * so once we do that, this caveat no longer applies.\n */\n\nconst themeable = decorator(function (ComposedComponent, theme) {\n const styles = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}\n const displayName = ComposedComponent.displayName || ComposedComponent.name\n let componentId = ''.concat((styles && styles.componentId) || uid())\n\n if (process.env.NODE_ENV !== 'production') {\n componentId = ''.concat(displayName, '__').concat(componentId)\n\n /* #__PURE__ */\n\n /* #__PURE__ */\n _warn(\n parseInt(React.version) >= 15,\n '[themeable] React 15 or higher is required. You are running React version '.concat(\n React.version,\n '.'\n )\n )\n }\n\n const contextKey = Symbol(componentId)\n const template =\n styles && typeof styles.template === 'function'\n ? styles.template\n : function () {\n /* #__PURE__ */\n\n /* #__PURE__ */\n _warn(\n false,\n '[themeable] Invalid styles for: %O. Use @instructure/babel-plugin-themeable-styles to transform CSS imports.',\n displayName\n )\n\n return ''\n }\n registerComponentTheme(contextKey, theme)\n\n const getContext = function getContext(context) {\n const themeContext = ThemeContext.getThemeContext(context)\n return themeContext || emptyObj\n }\n\n const getThemeFromContext = function getThemeFromContext(context) {\n const _getContext = getContext(context),\n theme = _getContext.theme\n\n if (theme && theme[contextKey]) {\n return {...theme[contextKey]}\n } else {\n return emptyObj\n }\n }\n\n const generateThemeForContextKey = function generateThemeForContextKey(themeKey, overrides) {\n return generateComponentTheme(contextKey, themeKey, overrides)\n }\n\n const ThemeableComponent =\n /* #__PURE__ */\n (function (_ComposedComponent) {\n _inherits(ThemeableComponent, _ComposedComponent)\n\n function ThemeableComponent() {\n let _this\n\n _classCallCheck(this, ThemeableComponent)\n\n const res = (_this = _possibleConstructorReturn(\n this,\n _getPrototypeOf(ThemeableComponent).apply(this, arguments)\n ))\n\n _this._themeCache = null\n _this._instanceId = uid(displayName)\n return _possibleConstructorReturn(_this, res)\n }\n\n _createClass(ThemeableComponent, [\n {\n key: 'componentWillMount',\n value: function componentWillMount() {\n const defaultTheme = generateThemeForContextKey()\n mountComponentStyles(template, defaultTheme, componentId)\n\n if (_get(_getPrototypeOf(ThemeableComponent.prototype), 'componentWillMount', this)) {\n _get(_getPrototypeOf(ThemeableComponent.prototype), 'componentWillMount', this).call(\n this\n )\n }\n }\n },\n {\n key: 'componentDidMount',\n value: function componentDidMount() {\n this.applyTheme()\n setTextDirection()\n\n if (_get(_getPrototypeOf(ThemeableComponent.prototype), 'componentDidMount', this)) {\n _get(_getPrototypeOf(ThemeableComponent.prototype), 'componentDidMount', this).call(\n this\n )\n }\n }\n },\n {\n key: 'shouldComponentUpdate',\n value: function shouldComponentUpdate(nextProps, nextState, nextContext) {\n const themeContextWillChange = !deepEqual(\n ThemeContext.getThemeContext(this.context),\n ThemeContext.getThemeContext(nextContext)\n )\n if (themeContextWillChange) return true\n\n if (\n _get(_getPrototypeOf(ThemeableComponent.prototype), 'shouldComponentUpdate', this)\n ) {\n return _get(\n _getPrototypeOf(ThemeableComponent.prototype),\n 'shouldComponentUpdate',\n this\n ).call(this, nextProps, nextState, nextContext)\n }\n\n return (\n !shallowEqual(this.props, nextProps) ||\n !shallowEqual(this.state, nextState) ||\n !shallowEqual(this.context, nextContext)\n )\n }\n },\n {\n key: 'componentWillUpdate',\n value: function componentWillUpdate(nextProps, nextState, nextContext) {\n if (\n !deepEqual(nextProps.theme, this.props.theme) ||\n !deepEqual(getThemeFromContext(nextContext), getThemeFromContext(this.context))\n ) {\n this._themeCache = null\n }\n\n if (_get(_getPrototypeOf(ThemeableComponent.prototype), 'componentWillUpdate', this)) {\n _get(_getPrototypeOf(ThemeableComponent.prototype), 'componentWillUpdate', this).call(\n this,\n nextProps,\n nextState,\n nextContext\n )\n }\n }\n },\n {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState, prevContext) {\n this.applyTheme()\n\n if (_get(_getPrototypeOf(ThemeableComponent.prototype), 'componentDidUpdate', this)) {\n _get(_getPrototypeOf(ThemeableComponent.prototype), 'componentDidUpdate', this).call(\n this,\n prevProps,\n prevState,\n prevContext\n )\n }\n }\n },\n {\n key: 'applyTheme',\n value: function applyTheme(DOMNode) {\n if (isEmpty(this.theme)) {\n return\n }\n\n const defaultTheme = generateThemeForContextKey()\n applyVariablesToNode(\n DOMNode || findDOMNode(this), // eslint-disable-line react/no-find-dom-node\n this.theme,\n defaultTheme,\n componentId,\n template, // for IE 11\n this.scope // for IE 11\n )\n }\n },\n {\n key: 'scope',\n get: function get() {\n return ''.concat(componentId, '__').concat(this._instanceId)\n }\n },\n {\n key: 'theme',\n get: function get() {\n if (this._themeCache !== null) {\n return this._themeCache\n }\n\n const _getContext2 = getContext(this.context),\n immutable = _getContext2.immutable\n\n let theme = getThemeFromContext(this.context)\n\n if (this.props.theme && !isEmpty(this.props.theme)) {\n if (!theme) {\n theme = this.props.theme\n } else if (immutable) {\n /* #__PURE__ */\n\n /* #__PURE__ */\n _warn(\n false,\n '[themeable] Parent theme is immutable. Cannot apply theme: %O',\n this.props.theme\n )\n } else {\n theme = isEmpty(theme) ? this.props.theme : {...theme, ...this.props.theme}\n }\n } // pass in the component theme as overrides\n\n this._themeCache = generateThemeForContextKey(null, theme)\n return this._themeCache\n }\n }\n ])\n\n return ThemeableComponent\n })(newless(ComposedComponent))\n\n ThemeableComponent.componentId = componentId\n ThemeableComponent.theme = contextKey\n ThemeableComponent.contextTypes = {\n ...ComposedComponent.contextTypes,\n ...ThemeContext.types\n }\n ThemeableComponent.propTypes = {\n ...ComposedComponent.propTypes,\n theme: PropTypes.object // eslint-disable-line react/forbid-prop-types\n }\n ThemeableComponent.generateTheme = generateThemeForContextKey\n return ThemeableComponent\n})\n/**\n * Utility to generate a theme for all themeable components that have been registered.\n * This theme can be applied using the [ApplyTheme](#ApplyTheme) component.\n *\n * @param {String} themeKey The theme to use (for global theme variables across components)\n * @param {Object} overrides theme variable overrides (usually for dynamic/user defined values)\n * @return {Object} A theme config to use with ``\n */\n\nthemeable.generateTheme = generateTheme\nexport default themeable\nexport {themeable}\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar fs;\n\nvar maybeLoadJSON = function maybeLoadJSON(path) {\n fs = fs || require(\"fs\");\n var data = {};\n\n if (fs.existsSync(path)) {\n try {\n data = JSON.parse(fs.readFileSync(path).toString());\n } catch (e) {\n console.log(e);\n }\n }\n\n return data;\n};\n\nvar I18nliner = {\n ignore() {\n fs = fs || require(\"fs\");\n var ignores = [];\n\n if (fs.existsSync(\".i18nignore\")) {\n ignores = fs.readFileSync(\".i18nignore\").toString().trim().split(/\\r?\\n|\\r/);\n }\n\n return ignores;\n },\n\n set(key, value, fn) {\n var prevValue = this.config[key];\n this.config[key] = value;\n\n if (fn) {\n try {\n fn();\n } finally {\n this.config[key] = prevValue;\n }\n }\n },\n\n loadConfig() {\n var config = maybeLoadJSON(\".i18nrc\");\n\n for (var key in config) {\n if (key !== \"plugins\") {\n this.set(key, config[key]);\n }\n } // plugins need to be loaded last to allow them to get\n // the full config option when they are initialized\n\n\n if (config.plugins && config.plugins.length > 0) {\n this.loadPlugins(config.plugins);\n }\n },\n\n loadPlugins(plugins) {\n plugins.forEach(function (pluginName) {\n var plugin = require(pluginName);\n\n if (plugin.default) plugin = plugin.default;\n plugin({\n processors: this.Commands.Check.processors,\n config: this.config\n });\n }.bind(this));\n },\n\n config: {\n inferredKeyFormat: 'underscored_crc32',\n\n /*\n literal:\n Just use the literal string as its translation key\n underscored:\n Underscored ascii representation of the string, truncated to\n bytes\n underscored_crc32:\n Underscored, with a checksum at the end to avoid collisions\n */\n underscoredKeyLength: 50,\n basePath: \".\",\n\n /*\n Where to look for files. Additionally, the output json file\n will be relative to this.\n */\n directories: [],\n\n /*\n Further limit extraction to these directories. If empty,\n I18nliner will look everywhere under \n */\n babylonPlugins: [\"jsx\", \"classProperties\", \"objectRestSpread\"]\n /*\n The set of babylon plugins to use in AST parsing.\n See: https://github.com/babel/babel/tree/master/packages/babylon#plugins\n */\n\n }\n};\nvar _default = I18nliner;\nexports.default = _default;\n","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * ---\n * category: utilities/themes\n * ---\n * Polyfill custom media for [themeable](#themeable) components.\n * Searches for strings like `(--mediumMin)` and replaces it with the\n * variable value (e.g. `variables.mediumMin`)\n * @param {String} cssText the CSS text to apply the custom media to\n * @param {Object|Function} variables object containing custom media variables, or a function that returns the variables object that will be lazy-evaluated only if there are matched media query\n * @returns {String} CSS text with custom media values applied\n */\nfunction applyCustomMediaToCss(cssText, variables) {\n var matches = getMatches(cssText, /@media\\s*[^(]*\\((--[^)]+)\\)?/g);\n var result = cssText;\n\n if (matches.length > 0) {\n var vars = typeof variables === 'function' ? variables() : variables;\n matches.forEach(function (match) {\n var matcher = new RegExp(match[1].replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'gm');\n result = result.replace(matcher, vars[match[1]]);\n });\n }\n\n return result;\n}\n\nfunction getMatches(str, regex) {\n var matches = [];\n var match;\n var matcher = regex;\n matcher.lastIndex = 0;\n matcher = new RegExp(matcher.source, 'g'); // eslint-disable-next-line no-cond-assign\n\n while ((match = matcher.exec(str)) !== null) {\n matches.push(match);\n\n if (matcher.lastIndex === match.index) {\n matcher.lastIndex++;\n }\n }\n\n return matches;\n}\n\nexport default applyCustomMediaToCss;\nexport { applyCustomMediaToCss };","/*!\n * jQuery UI Widget @VERSION\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Dual licensed under the MIT or GPL Version 2 licenses.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Widget\n */\nimport $ from 'jquery'\n\nvar uuid = 0,\n\tslice = Array.prototype.slice,\n\t_cleanData = $.cleanData;\n$.cleanData = function( elems ) {\n\tfor ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {\n\t\ttry {\n\t\t\t$( elem ).triggerHandler( \"remove\" );\n\t\t// http://bugs.jquery.com/ticket/8235\n\t\t} catch( e ) {}\n\t}\n\t_cleanData( elems );\n};\n\n$.widget = function( name, base, prototype ) {\n\tvar fullName, existingConstructor, constructor, basePrototype,\n\t\tnamespace = name.split( \".\" )[ 0 ];\n\n\tname = name.split( \".\" )[ 1 ];\n\tfullName = namespace + \"-\" + name;\n\n\tif ( !prototype ) {\n\t\tprototype = base;\n\t\tbase = $.Widget;\n\t}\n\n\t// create selector for plugin\n\t$.expr[ \":\" ][ fullName ] = function( elem ) {\n\t\treturn !!$.data( elem, fullName );\n\t};\n\n\t$[ namespace ] = $[ namespace ] || {};\n\texistingConstructor = $[ namespace ][ name ];\n\tconstructor = $[ namespace ][ name ] = function( options, element ) {\n\t\t// allow instantiation without \"new\" keyword\n\t\tif ( !this._createWidget ) {\n\t\t\treturn new constructor( options, element );\n\t\t}\n\n\t\t// allow instantiation without initializing for simple inheritance\n\t\t// must use \"new\" keyword (the code above always passes args)\n\t\tif ( arguments.length ) {\n\t\t\tthis._createWidget( options, element );\n\t\t}\n\t};\n\t// extend with the existing constructor to carry over any static properties\n\t$.extend( constructor, existingConstructor, {\n\t\tversion: prototype.version,\n\t\t// copy the object used to create the prototype in case we need to\n\t\t// redefine the widget later\n\t\t_proto: $.extend( {}, prototype ),\n\t\t// track widgets that inherit from this widget in case this widget is\n\t\t// redefined after a widget inherits from it\n\t\t_childConstructors: []\n\t});\n\n\tbasePrototype = new base();\n\t// we need to make the options hash a property directly on the new instance\n\t// otherwise we'll modify the options hash on the prototype that we're\n\t// inheriting from\n\tbasePrototype.options = $.widget.extend( {}, basePrototype.options );\n\t$.each( prototype, function( prop, value ) {\n\t\tif ( $.isFunction( value ) ) {\n\t\t\tprototype[ prop ] = (function() {\n\t\t\t\tvar _super = function() {\n\t\t\t\t\t\treturn base.prototype[ prop ].apply( this, arguments );\n\t\t\t\t\t},\n\t\t\t\t\t_superApply = function( args ) {\n\t\t\t\t\t\treturn base.prototype[ prop ].apply( this, args );\n\t\t\t\t\t};\n\t\t\t\treturn function() {\n\t\t\t\t\tvar __super = this._super,\n\t\t\t\t\t\t__superApply = this._superApply,\n\t\t\t\t\t\treturnValue;\n\n\t\t\t\t\tthis._super = _super;\n\t\t\t\t\tthis._superApply = _superApply;\n\n\t\t\t\t\treturnValue = value.apply( this, arguments );\n\n\t\t\t\t\tthis._super = __super;\n\t\t\t\t\tthis._superApply = __superApply;\n\n\t\t\t\t\treturn returnValue;\n\t\t\t\t};\n\t\t\t})();\n\t\t}\n\t});\n\tconstructor.prototype = $.widget.extend( basePrototype, {\n\t\t// TODO: remove support for widgetEventPrefix\n\t\t// always use the name + a colon as the prefix, e.g., draggable:start\n\t\t// don't prefix for widgets that aren't DOM-based\n\t\twidgetEventPrefix: name\n\t}, prototype, {\n\t\tconstructor: constructor,\n\t\tnamespace: namespace,\n\t\twidgetName: name,\n\t\t// TODO remove widgetBaseClass, see #8155\n\t\twidgetBaseClass: fullName,\n\t\twidgetFullName: fullName\n\t});\n\n\t// If this widget is being redefined then we need to find all widgets that\n\t// are inheriting from it and redefine all of them so that they inherit from\n\t// the new version of this widget. We're essentially trying to replace one\n\t// level in the prototype chain.\n\tif ( existingConstructor ) {\n\t\t$.each( existingConstructor._childConstructors, function( i, child ) {\n\t\t\tvar childPrototype = child.prototype;\n\n\t\t\t// redefine the child widget using the same prototype that was\n\t\t\t// originally used, but inherit from the new version of the base\n\t\t\t$.widget( childPrototype.namespace + \".\" + childPrototype.widgetName, constructor, child._proto );\n\t\t});\n\t\t// remove the list of existing child constructors from the old constructor\n\t\t// so the old child constructors can be garbage collected\n\t\tdelete existingConstructor._childConstructors;\n\t} else {\n\t\tbase._childConstructors.push( constructor );\n\t}\n\n\t$.widget.bridge( name, constructor );\n};\n\n$.widget.extend = function( target ) {\n\tvar input = slice.call( arguments, 1 ),\n\t\tinputIndex = 0,\n\t\tinputLength = input.length,\n\t\tkey,\n\t\tvalue;\n\tfor ( ; inputIndex < inputLength; inputIndex++ ) {\n\t\tfor ( key in input[ inputIndex ] ) {\n\t\t\tvalue = input[ inputIndex ][ key ];\n\t\t\tif (input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {\n\t\t\t\ttarget[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value;\n\t\t\t}\n\t\t}\n\t}\n\treturn target;\n};\n\n$.widget.bridge = function( name, object ) {\n\tvar fullName = object.prototype.widgetFullName;\n\t$.fn[ name ] = function( options ) {\n\t\tvar isMethodCall = typeof options === \"string\",\n\t\t\targs = slice.call( arguments, 1 ),\n\t\t\treturnValue = this;\n\n\t\t// allow multiple hashes to be passed on init\n\t\toptions = !isMethodCall && args.length ?\n\t\t\t$.widget.extend.apply( null, [ options ].concat(args) ) :\n\t\t\toptions;\n\n\t\tif ( isMethodCall ) {\n\t\t\tthis.each(function() {\n\t\t\t\tvar methodValue,\n\t\t\t\t\tinstance = $.data( this, fullName );\n\t\t\t\tif ( !instance ) {\n\t\t\t\t\treturn $.error( \"cannot call methods on \" + name + \" prior to initialization; \" +\n\t\t\t\t\t\t\"attempted to call method '\" + options + \"'\" );\n\t\t\t\t}\n\t\t\t\tif ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === \"_\" ) {\n\t\t\t\t\treturn $.error( \"no such method '\" + options + \"' for \" + name + \" widget instance\" );\n\t\t\t\t}\n\t\t\t\tmethodValue = instance[ options ].apply( instance, args );\n\t\t\t\tif ( methodValue !== instance && methodValue !== undefined ) {\n\t\t\t\t\treturnValue = methodValue && methodValue.jquery ?\n\t\t\t\t\t\treturnValue.pushStack( methodValue.get() ) :\n\t\t\t\t\t\tmethodValue;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tthis.each(function() {\n\t\t\t\tvar instance = $.data( this, fullName );\n\t\t\t\tif ( instance ) {\n\t\t\t\t\tinstance.option( options || {} )._init();\n\t\t\t\t} else {\n\t\t\t\t\tnew object( options, this );\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn returnValue;\n\t};\n};\n\n$.Widget = function( options, element ) {};\n$.Widget._childConstructors = [];\n\n$.Widget.prototype = {\n\twidgetName: \"widget\",\n\twidgetEventPrefix: \"\",\n\tdefaultElement: \"\",\n\toptions: {\n\t\tdisabled: false,\n\n\t\t// callbacks\n\t\tcreate: null\n\t},\n\t_createWidget: function( options, element ) {\n\t\telement = $( element || this.defaultElement || this )[ 0 ];\n\t\tthis.element = $( element );\n\t\tthis.uuid = uuid++;\n\t\tthis.eventNamespace = \".\" + this.widgetName + this.uuid;\n\t\tthis.options = $.widget.extend( {},\n\t\t\tthis.options,\n\t\t\tthis._getCreateOptions(),\n\t\t\toptions );\n\n\t\tthis.bindings = $();\n\t\tthis.hoverable = $();\n\t\tthis.focusable = $();\n\n\t\tif ( element !== this ) {\n\t\t\t// 1.9 BC for #7810\n\t\t\t// TODO remove dual storage\n\t\t\t$.data( element, this.widgetName, this );\n\t\t\t$.data( element, this.widgetFullName, this );\n\t\t\tthis._on({ remove: \"destroy\" });\n\t\t\tthis.document = $( element.style ?\n\t\t\t\t// element within the document\n\t\t\t\telement.ownerDocument :\n\t\t\t\t// element is window or document\n\t\t\t\telement.document || element );\n\t\t\tthis.window = $( this.document[0].defaultView || this.document[0].parentWindow );\n\t\t}\n\n\t\tthis._create();\n\t\tthis._trigger( \"create\", null, this._getCreateEventData() );\n\t\tthis._init();\n\t},\n\t_getCreateOptions: $.noop,\n\t_getCreateEventData: $.noop,\n\t_create: $.noop,\n\t_init: $.noop,\n\n\tdestroy: function() {\n\t\tthis._destroy();\n\t\t// we can probably remove the unbind calls in 2.0\n\t\t// all event bindings should go through this._on()\n\t\tthis.element\n\t\t\t.unbind( this.eventNamespace )\n\t\t\t// 1.9 BC for #7810\n\t\t\t// TODO remove dual storage\n\t\t\t.removeData( this.widgetName )\n\t\t\t.removeData( this.widgetFullName )\n\t\t\t// support: jquery <1.6.3\n\t\t\t// http://bugs.jquery.com/ticket/9413\n\t\t\t.removeData( $.camelCase( this.widgetFullName ) );\n\t\tthis.widget()\n\t\t\t.unbind( this.eventNamespace )\n\t\t\t.removeAttr( \"aria-disabled\" )\n\t\t\t.removeClass(\n\t\t\t\tthis.widgetFullName + \"-disabled \" +\n\t\t\t\t\"ui-state-disabled\" );\n\n\t\t// clean up events and states\n\t\tthis.bindings.unbind( this.eventNamespace );\n\t\tthis.hoverable.removeClass( \"ui-state-hover\" );\n\t\tthis.focusable.removeClass( \"ui-state-focus\" );\n\t},\n\t_destroy: $.noop,\n\n\twidget: function() {\n\t\treturn this.element;\n\t},\n\n\toption: function( key, value ) {\n\t\tvar options = key,\n\t\t\tparts,\n\t\t\tcurOption,\n\t\t\ti;\n\n\t\tif ( arguments.length === 0 ) {\n\t\t\t// don't return a reference to the internal hash\n\t\t\treturn $.widget.extend( {}, this.options );\n\t\t}\n\n\t\tif ( typeof key === \"string\" ) {\n\t\t\t// handle nested keys, e.g., \"foo.bar\" => { foo: { bar: ___ } }\n\t\t\toptions = {};\n\t\t\tparts = key.split( \".\" );\n\t\t\tkey = parts.shift();\n\t\t\tif ( parts.length ) {\n\t\t\t\tcurOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );\n\t\t\t\tfor ( i = 0; i < parts.length - 1; i++ ) {\n\t\t\t\t\tcurOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};\n\t\t\t\t\tcurOption = curOption[ parts[ i ] ];\n\t\t\t\t}\n\t\t\t\tkey = parts.pop();\n\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\treturn curOption[ key ] === undefined ? null : curOption[ key ];\n\t\t\t\t}\n\t\t\t\tcurOption[ key ] = value;\n\t\t\t} else {\n\t\t\t\tif ( value === undefined ) {\n\t\t\t\t\treturn this.options[ key ] === undefined ? null : this.options[ key ];\n\t\t\t\t}\n\t\t\t\toptions[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tthis._setOptions( options );\n\n\t\treturn this;\n\t},\n\t_setOptions: function( options ) {\n\t\tvar key;\n\n\t\tfor ( key in options ) {\n\t\t\tthis._setOption( key, options[ key ] );\n\t\t}\n\n\t\treturn this;\n\t},\n\t_setOption: function( key, value ) {\n\t\tthis.options[ key ] = value;\n\n\t\tif ( key === \"disabled\" ) {\n\t\t\tthis.widget()\n\t\t\t\t.toggleClass( this.widgetFullName + \"-disabled ui-state-disabled\", !!value )\n\t\t\t\t.attr( \"aria-disabled\", value );\n\t\t\tthis.hoverable.removeClass( \"ui-state-hover\" );\n\t\t\tthis.focusable.removeClass( \"ui-state-focus\" );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tenable: function() {\n\t\treturn this._setOption( \"disabled\", false );\n\t},\n\tdisable: function() {\n\t\treturn this._setOption( \"disabled\", true );\n\t},\n\n\t_on: function( element, handlers ) {\n\t\t// no element argument, shuffle and use this.element\n\t\tif ( !handlers ) {\n\t\t\thandlers = element;\n\t\t\telement = this.element;\n\t\t} else {\n\t\t\t// accept selectors, DOM elements\n\t\t\telement = $( element );\n\t\t\tthis.bindings = this.bindings.add( element );\n\t\t}\n\n\t\tvar instance = this;\n\t\t$.each( handlers, function( event, handler ) {\n\t\t\tfunction handlerProxy() {\n\t\t\t\t// allow widgets to customize the disabled handling\n\t\t\t\t// - disabled as an array instead of boolean\n\t\t\t\t// - disabled class as method for disabling individual parts\n\t\t\t\tif ( instance.options.disabled === true ||\n\t\t\t\t\t\t$( this ).hasClass( \"ui-state-disabled\" ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\treturn ( typeof handler === \"string\" ? instance[ handler ] : handler )\n\t\t\t\t\t.apply( instance, arguments );\n\t\t\t}\n\n\t\t\t// copy the guid so direct unbinding works\n\t\t\tif ( typeof handler !== \"string\" ) {\n\t\t\t\thandlerProxy.guid = handler.guid =\n\t\t\t\t\thandler.guid || handlerProxy.guid || $.guid++;\n\t\t\t}\n\n\t\t\tvar match = event.match( /^(\\w+)\\s*(.*)$/ ),\n\t\t\t\teventName = match[1] + instance.eventNamespace,\n\t\t\t\tselector = match[2];\n\t\t\tif ( selector ) {\n\t\t\t\tinstance.widget().delegate( selector, eventName, handlerProxy );\n\t\t\t} else {\n\t\t\t\telement.bind( eventName, handlerProxy );\n\t\t\t}\n\t\t});\n\t},\n\n\t_off: function( element, eventName ) {\n\t\teventName = (eventName || \"\").split( \" \" ).join( this.eventNamespace + \" \" ) + this.eventNamespace;\n\t\telement.unbind( eventName ).undelegate( eventName );\n\t},\n\n\t_delay: function( handler, delay ) {\n\t\tfunction handlerProxy() {\n\t\t\treturn ( typeof handler === \"string\" ? instance[ handler ] : handler )\n\t\t\t\t.apply( instance, arguments );\n\t\t}\n\t\tvar instance = this;\n\t\treturn setTimeout( handlerProxy, delay || 0 );\n\t},\n\n\t_hoverable: function( element ) {\n\t\tthis.hoverable = this.hoverable.add( element );\n\t\tthis._on( element, {\n\t\t\tmouseenter: function( event ) {\n\t\t\t\t$( event.currentTarget ).addClass( \"ui-state-hover\" );\n\t\t\t},\n\t\t\tmouseleave: function( event ) {\n\t\t\t\t$( event.currentTarget ).removeClass( \"ui-state-hover\" );\n\t\t\t}\n\t\t});\n\t},\n\n\t_focusable: function( element ) {\n\t\tthis.focusable = this.focusable.add( element );\n\t\tthis._on( element, {\n\t\t\tfocusin: function( event ) {\n\t\t\t\t$( event.currentTarget ).addClass( \"ui-state-focus\" );\n\t\t\t},\n\t\t\tfocusout: function( event ) {\n\t\t\t\t$( event.currentTarget ).removeClass( \"ui-state-focus\" );\n\t\t\t}\n\t\t});\n\t},\n\n\t_trigger: function( type, event, data ) {\n\t\tvar prop, orig,\n\t\t\tcallback = this.options[ type ];\n\n\t\tdata = data || {};\n\t\tevent = $.Event( event );\n\t\tevent.type = ( type === this.widgetEventPrefix ?\n\t\t\ttype :\n\t\t\tthis.widgetEventPrefix + type ).toLowerCase();\n\t\t// the original event may come from any element\n\t\t// so we need to reset the target on the new event\n\t\tevent.target = this.element[ 0 ];\n\n\t\t// copy original event properties over to the new event\n\t\torig = event.originalEvent;\n\t\tif ( orig ) {\n\t\t\tfor ( prop in orig ) {\n\t\t\t\tif ( !( prop in event ) ) {\n\t\t\t\t\tevent[ prop ] = orig[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.element.trigger( event, data );\n\t\treturn !( $.isFunction( callback ) &&\n\t\t\tcallback.apply( this.element[0], [ event ].concat( data ) ) === false ||\n\t\t\tevent.isDefaultPrevented() );\n\t}\n};\n\n$.each( { show: \"fadeIn\", hide: \"fadeOut\" }, function( method, defaultEffect ) {\n\t$.Widget.prototype[ \"_\" + method ] = function( element, options, callback ) {\n\t\tif ( typeof options === \"string\" ) {\n\t\t\toptions = { effect: options };\n\t\t}\n\t\tvar hasOptions,\n\t\t\teffectName = !options ?\n\t\t\t\tmethod :\n\t\t\t\toptions === true || typeof options === \"number\" ?\n\t\t\t\t\tdefaultEffect :\n\t\t\t\t\toptions.effect || defaultEffect;\n\t\toptions = options || {};\n\t\tif ( typeof options === \"number\" ) {\n\t\t\toptions = { duration: options };\n\t\t}\n\t\thasOptions = !$.isEmptyObject( options );\n\t\tif ( typeof options === 'object' ) {\n options.complete = callback;\n }\n\t\tif ( options.delay ) {\n\t\t\telement.delay( options.delay );\n\t\t}\n\t\tif ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {\n\t\t\telement[ method ]( options );\n\t\t} else if ( effectName !== method && element[ effectName ] ) {\n\t\t\telement[ effectName ]( options.duration, options.easing, callback );\n\t\t} else {\n\t\t\telement.queue(function( next ) {\n\t\t\t\t$( this )[ method ]();\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback.call( element[ 0 ] );\n\t\t\t\t}\n\t\t\t\tnext();\n\t\t\t});\n\t\t}\n\t};\n});\n\n// DEPRECATED\nif ( $.uiBackCompat !== false ) {\n\t$.Widget.prototype._getCreateOptions = function() {\n\t\treturn $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];\n\t};\n}\n\n\n","import $ from 'jquery'\nimport './widget-unpatched'\n\n// This function is the same as $.widget.extend\n// except for this additional check on the target:\n// && $.isPlainObject(target[key])\n//\n// The change is because it was merging strings and objects\n// which caused problems. Here's an example of what it was doing:\n// $.widget.extend({}, {handle: 'e,s,se'}, {handle: {s: 'div.ui-resizable-s'}})\n// => {0: 'e',\n// 1: ',',\n// 2: 's',\n// 3: ',',\n// 4: 's',\n// 5: 'e',\n// s: 'div.ui-resizable-s'}\n$.widget.extend = function(target) {\n var input = Array.prototype.slice.call(arguments, 1),\n inputIndex = 0,\n inputLength = input.length,\n key,\n value\n for (; inputIndex < inputLength; inputIndex++) {\n for (key in input[inputIndex]) {\n value = input[inputIndex][key]\n if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {\n target[key] =\n $.isPlainObject(value) && $.isPlainObject(target[key])\n ? $.widget.extend({}, target[key], value)\n : value\n }\n }\n }\n return target\n}\n\nexport default $\n","/*\n * Copyright (C) 2011 - present Instructure, Inc.\n *\n * This file is part of Canvas.\n *\n * Canvas is free software: you can redistribute it and/or modify it under\n * the terms of the GNU Affero General Public License as published by the Free\n * Software Foundation, version 3 of the License.\n *\n * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY\n * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n * details.\n *\n * You should have received a copy of the GNU Affero General Public License along\n * with this program. If not, see
.\n */\n\nimport $ from 'jquery'\nimport authenticity_token from '@canvas/authenticity-token'\nimport INST from 'browser-sniffer'\n\nconst DONE_READY_STATE = 4\n\nconst _getJSON = $.getJSON\n$.getJSON = function(url, data, _callback) {\n const xhr = _getJSON.apply($, arguments)\n $.ajaxJSON.storeRequest(xhr, url, 'GET', data)\n return xhr\n}\n// Wrapper for default $.ajax behavior. On error will call\n// the default error method if no error method is provided.\n$.ajaxJSON = function(url, submit_type, data = {}, success, error, options) {\n if (!url && error) {\n error(null, null, 'URL required for requests', null)\n return\n }\n url = url || '.'\n if (\n submit_type !== 'GET' &&\n // if it's a json request and has already been JSON.stringify'ed,\n // then we can't attach properties to `data` since it's already a string\n typeof data !== 'string'\n ) {\n data._method = submit_type\n submit_type = 'POST'\n data.authenticity_token = authenticity_token()\n }\n const ajaxError = function(xhr, textStatus, errorThrown) {\n if (textStatus === 'abort') {\n return // request aborted, do nothing\n }\n let data = xhr\n if (xhr.responseText) {\n const text = xhr.responseText.replace(/(<([^>]+)>)/gi, '')\n data = {message: text}\n try {\n data = $.parseJSON(xhr.responseText)\n } catch (e) {}\n }\n if (options && options.skipDefaultError) {\n $.ajaxJSON.ignoredXHRs.push(xhr)\n }\n if (error && $.isFunction(error)) {\n error(data, xhr, textStatus, errorThrown)\n } else {\n $.ajaxJSON.unhandledXHRs.push(xhr)\n }\n }\n const params = {\n url,\n dataType: 'json',\n type: submit_type,\n success(data, textStatus, xhr) {\n data = data || {}\n let page_view_update_url = null\n if (\n xhr &&\n xhr.getResponseHeader &&\n (page_view_update_url = xhr.getResponseHeader('X-Canvas-Page-View-Update-Url'))\n ) {\n setTimeout(() => {\n $(document).triggerHandler('page_view_update_url_received', page_view_update_url)\n }, 50)\n }\n if (!data.length && data.errors) {\n ajaxError(data.errors, null, '')\n if (!options || !options.skipDefaultError) {\n $.fn.defaultAjaxError.func.call(\n $.fn.defaultAjaxError.object,\n null,\n data,\n '0',\n data.errors\n )\n } else {\n $.ajaxJSON.ignoredXHRs.push(xhr)\n }\n } else if (success && $.isFunction(success)) {\n success(data, xhr)\n }\n },\n error(_xhr) {\n ajaxError.apply(this, arguments)\n },\n complete(_xhr) {},\n data\n }\n if (options && options.timeout) {\n params.timeout = options.timeout\n }\n if (options && options.contentType) {\n params.contentType = options.contentType\n }\n\n const xhr = $.ajax(params)\n $.ajaxJSON.storeRequest(xhr, url, submit_type, data)\n return xhr\n}\n$.ajaxJSON.unhandledXHRs = []\n$.ajaxJSON.ignoredXHRs = []\n$.ajaxJSON.passedRequests = []\n$.ajaxJSON.storeRequest = function(xhr, url, submit_type, data) {\n $.ajaxJSON.passedRequests.push({xhr, url, submit_type, data})\n}\n\n$.ajaxJSON.findRequest = xhr => $.ajaxJSON.passedRequests.find(req => req.xhr === xhr)\n\n$.ajaxJSON.abortRequest = xhr => {\n if (xhr && xhr.readyState !== DONE_READY_STATE) {\n xhr.abort()\n }\n}\n\n$.ajaxJSON.isUnauthenticated = function(xhr) {\n if (xhr.status !== 401) {\n return false\n }\n\n let json_data\n try {\n json_data = $.parseJSON(xhr.responseText)\n } catch (e) {}\n\n return !!json_data && json_data.status === 'unauthenticated'\n}\n\n// Defines a default error for all ajax requests. Will always be called\n// in the development environment, and as a last-ditch error catching\n// otherwise. See \"ajax_errors.js\"\n$.fn.defaultAjaxError = function(func) {\n $.fn.defaultAjaxError.object = this\n $.fn.defaultAjaxError.func = function(event, request, settings, error) {\n const inProduction = INST.environment === 'production'\n const unhandled = $.inArray(request, $.ajaxJSON.unhandledXHRs) !== -1\n const ignore = $.inArray(request, $.ajaxJSON.ignoredXHRs) !== -1\n if ((!inProduction || unhandled || $.ajaxJSON.isUnauthenticated(request)) && !ignore) {\n // $.grep will throw an error if it somehow gets something without length like undefined\n $.ajaxJSON.unhandledXHRs = $.ajaxJSON.unhandledXHRs\n ? $.grep($.ajaxJSON.unhandledXHRs, xhr => xhr !== request)\n : $.ajaxJSON.unhandledXHRs\n const debugOnly = !!unhandled\n func.call(this, event, request, settings, error, debugOnly)\n }\n }\n this.ajaxError($.fn.defaultAjaxError.func)\n}\n\nexport default $.ajaxJSON\n","exports.parse = require('./lib/parse');\nexports.stringify = require('./lib/stringify');\n","/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 - present Instructure, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * ---\n * category: utilities/themes\n * ---\n * Formats a variable as a CSS variable (prefixed with `--`)\n * @param {String} variableName\n * @param {String} prefix an optional prefix to add to the variable name\n * @returns {String} formatted variable name\n */\nfunction formatVariableName(variableName, prefix) {\n var name = prefix ? \"\".concat(prefix, \"-\").concat(variableName) : variableName;\n return \"--\".concat(name);\n}\n\nexport default formatVariableName;\nexport { formatVariableName };","/**\n * @license\n * Lo-Dash 2.4.1 (Custom Build)
\n * Build: `lodash underscore plus=\"cloneDeep\" exports=\"amd,global\"`\n * Copyright 2012-2013 The Dojo Foundation
\n * Based on Underscore.js 1.5.2
\n * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre ES5 environments */\n var undefined;\n\n /** Used to pool arrays and objects used internally */\n var arrayPool = [];\n\n /** Used to generate unique IDs */\n var idCounter = 0;\n\n /** Used internally to indicate various things */\n var indicatorObject = {};\n\n /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */\n var keyPrefix = +new Date + '';\n\n /** Used as the max size of the `arrayPool` and `objectPool` */\n var maxPoolSize = 40;\n\n /** Used to match regexp flags from their coerced string values */\n var reFlags = /\\w*$/;\n\n /** Used to match \"interpolate\" template delimiters */\n var reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to ensure capturing order of template delimiters */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals */\n var reUnescapedString = /['\\n\\r\\t\\u2028\\u2029\\\\]/g;\n\n /** `Object#toString` result shortcuts */\n var argsClass = '[object Arguments]',\n arrayClass = '[object Array]',\n boolClass = '[object Boolean]',\n dateClass = '[object Date]',\n funcClass = '[object Function]',\n numberClass = '[object Number]',\n objectClass = '[object Object]',\n regexpClass = '[object RegExp]',\n stringClass = '[object String]';\n\n /** Used to identify object classifications that `_.clone` supports */\n var cloneableClasses = {};\n cloneableClasses[funcClass] = false;\n cloneableClasses[argsClass] = cloneableClasses[arrayClass] =\n cloneableClasses[boolClass] = cloneableClasses[dateClass] =\n cloneableClasses[numberClass] = cloneableClasses[objectClass] =\n cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;\n\n /** Used to determine if values are of the language type Object */\n var objectTypes = {\n 'boolean': false,\n 'function': true,\n 'object': true,\n 'number': false,\n 'string': false,\n 'undefined': false\n };\n\n /** Used to escape characters for inclusion in compiled string literals */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\t': 't',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Used as a reference to the global object */\n var root = (objectTypes[typeof window] && window) || this;\n\n /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */\n var freeGlobal = objectTypes[typeof global] && global;\n if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {\n root = freeGlobal;\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * The base implementation of `_.indexOf` without support for binary searches\n * or `fromIndex` constraints.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value or `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n var index = (fromIndex || 0) - 1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * Used by `sortBy` to compare transformed `collection` elements, stable sorting\n * them in ascending order.\n *\n * @private\n * @param {Object} a The object to compare to `b`.\n * @param {Object} b The object to compare to `a`.\n * @returns {number} Returns the sort order indicator of `1` or `-1`.\n */\n function compareAscending(a, b) {\n var ac = a.criteria,\n bc = b.criteria,\n index = -1,\n length = ac.length;\n\n while (++index < length) {\n var value = ac[index],\n other = bc[index];\n\n if (value !== other) {\n if (value > other || typeof value == 'undefined') {\n return 1;\n }\n if (value < other || typeof other == 'undefined') {\n return -1;\n }\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to return the same value for\n // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247\n //\n // This also ensures a stable sort in V8 and other engines.\n // See http://code.google.com/p/v8/issues/detail?id=90\n return a.index - b.index;\n }\n\n /**\n * Used by `template` to escape characters for inclusion in compiled\n * string literals.\n *\n * @private\n * @param {string} match The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(match) {\n return '\\\\' + stringEscapes[match];\n }\n\n /**\n * Gets an array from the array pool or creates a new one if the pool is empty.\n *\n * @private\n * @returns {Array} The array from the pool.\n */\n function getArray() {\n return arrayPool.pop() || [];\n }\n\n /**\n * Releases the given array back to the array pool.\n *\n * @private\n * @param {Array} [array] The array to release.\n */\n function releaseArray(array) {\n array.length = 0;\n if (arrayPool.length < maxPoolSize) {\n arrayPool.push(array);\n }\n }\n\n /**\n * Slices the `collection` from the `start` index up to, but not including,\n * the `end` index.\n *\n * Note: This function is used instead of `Array#slice` to support node lists\n * in IE < 9 and to ensure dense arrays are returned.\n *\n * @private\n * @param {Array|Object|string} collection The collection to slice.\n * @param {number} start The start index.\n * @param {number} end The end index.\n * @returns {Array} Returns the new array.\n */\n function slice(array, start, end) {\n start || (start = 0);\n if (typeof end == 'undefined') {\n end = array ? array.length : 0;\n }\n var index = -1,\n length = end - start || 0,\n result = Array(length < 0 ? 0 : length);\n\n while (++index < length) {\n result[index] = array[start + index];\n }\n return result;\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Used for `Array` method references.\n *\n * Normally `Array.prototype` would suffice, however, using an array literal\n * avoids issues in Narwhal.\n */\n var arrayRef = [];\n\n /** Used for native method references */\n var objectProto = Object.prototype;\n\n /** Used to restore the original `_` reference in `noConflict` */\n var oldDash = root._;\n\n /** Used to resolve the internal [[Class]] of values */\n var toString = objectProto.toString;\n\n /** Used to detect if a method is native */\n var reNative = RegExp('^' +\n String(toString)\n .replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/toString| for [^\\]]+/g, '.*?') + '$'\n );\n\n /** Native method shortcuts */\n var ceil = Math.ceil,\n floor = Math.floor,\n hasOwnProperty = objectProto.hasOwnProperty,\n push = arrayRef.push,\n propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n /* Native method shortcuts for methods with the same name as other `lodash` methods */\n var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,\n nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,\n nativeIsFinite = root.isFinite,\n nativeIsNaN = root.isNaN,\n nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeRandom = Math.random;\n\n /** Used to lookup a built-in constructor by [[Class]] */\n var ctorByClass = {};\n ctorByClass[arrayClass] = Array;\n ctorByClass[boolClass] = Boolean;\n ctorByClass[dateClass] = Date;\n ctorByClass[funcClass] = Function;\n ctorByClass[objectClass] = Object;\n ctorByClass[numberClass] = Number;\n ctorByClass[regexpClass] = RegExp;\n ctorByClass[stringClass] = String;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps the given value to enable intuitive\n * method chaining.\n *\n * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:\n * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,\n * and `unshift`\n *\n * Chaining is supported in custom builds as long as the `value` method is\n * implicitly or explicitly included in the build.\n *\n * The chainable wrapper functions are:\n * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,\n * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,\n * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,\n * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,\n * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,\n * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,\n * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,\n * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,\n * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,\n * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,\n * and `zip`\n *\n * The non-chainable wrapper functions are:\n * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,\n * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,\n * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,\n * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,\n * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,\n * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,\n * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,\n * `template`, `unescape`, `uniqueId`, and `value`\n *\n * The wrapper functions `first` and `last` return wrapped values when `n` is\n * provided, otherwise they return unwrapped values.\n *\n * Explicit chaining can be enabled by using the `_.chain` method.\n *\n * @name _\n * @constructor\n * @category Chaining\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns a `lodash` instance.\n * @example\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // returns an unwrapped value\n * wrapped.reduce(function(sum, num) {\n * return sum + num;\n * });\n * // => 6\n *\n * // returns a wrapped value\n * var squares = wrapped.map(function(num) {\n * return num * num;\n * });\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n return (value instanceof lodash)\n ? value\n : new lodashWrapper(value);\n }\n\n /**\n * A fast path for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap in a `lodash` instance.\n * @param {boolean} chainAll A flag to enable chaining for all methods\n * @returns {Object} Returns a `lodash` instance.\n */\n function lodashWrapper(value, chainAll) {\n this.__chain__ = !!chainAll;\n this.__wrapped__ = value;\n }\n // ensure `new lodashWrapper` is an instance of `lodash`\n lodashWrapper.prototype = lodash.prototype;\n\n /**\n * An object used to flag environments features.\n *\n * @static\n * @memberOf _\n * @type Object\n */\n var support = {};\n\n (function() {\n var object = { '0': 1, 'length': 1 };\n\n /**\n * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.\n *\n * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`\n * and `splice()` functions that fail to remove the last element, `value[0]`,\n * of array-like objects even though the `length` property is set to `0`.\n * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`\n * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.\n *\n * @memberOf _.support\n * @type boolean\n */\n support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]);\n }(1));\n\n /**\n * By default, the template delimiters used by Lo-Dash are similar to those in\n * embedded Ruby (ERB). Change the following template settings to use alternative\n * delimiters.\n *\n * @static\n * @memberOf _\n * @type Object\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'escape': /<%-([\\s\\S]+?)%>/g,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'evaluate': /<%([\\s\\S]+?)%>/g,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type string\n */\n 'variable': ''\n };\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * The base implementation of `_.bind` that creates the bound function and\n * sets its meta data.\n *\n * @private\n * @param {Array} bindData The bind data array.\n * @returns {Function} Returns the new bound function.\n */\n function baseBind(bindData) {\n var func = bindData[0],\n partialArgs = bindData[2],\n thisArg = bindData[4];\n\n function bound() {\n // `Function#bind` spec\n // http://es5.github.io/#x15.3.4.5\n if (partialArgs) {\n // avoid `arguments` object deoptimizations by using `slice` instead\n // of `Array.prototype.slice.call` and not assigning `arguments` to a\n // variable as a ternary expression\n var args = slice(partialArgs);\n push.apply(args, arguments);\n }\n // mimic the constructor's `return` behavior\n // http://es5.github.io/#x13.2.2\n if (this instanceof bound) {\n // ensure `new bound` is an instance of `func`\n var thisBinding = baseCreate(func.prototype),\n result = func.apply(thisBinding, args || arguments);\n return isObject(result) ? result : thisBinding;\n }\n return func.apply(thisArg, args || arguments);\n }\n return bound;\n }\n\n /**\n * The base implementation of `_.clone` without argument juggling or support\n * for `thisArg` binding.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep=false] Specify a deep clone.\n * @param {Function} [callback] The function to customize cloning values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates clones with source counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, isDeep, callback, stackA, stackB) {\n if (callback) {\n var result = callback(value);\n if (typeof result != 'undefined') {\n return result;\n }\n }\n // inspect [[Class]]\n var isObj = isObject(value);\n if (isObj) {\n var className = toString.call(value);\n if (!cloneableClasses[className]) {\n return value;\n }\n var ctor = ctorByClass[className];\n switch (className) {\n case boolClass:\n case dateClass:\n return new ctor(+value);\n\n case numberClass:\n case stringClass:\n return new ctor(value);\n\n case regexpClass:\n result = ctor(value.source, reFlags.exec(value));\n result.lastIndex = value.lastIndex;\n return result;\n }\n } else {\n return value;\n }\n var isArr = isArray(value);\n if (isDeep) {\n // check for circular references and return corresponding clone\n var initedStack = !stackA;\n stackA || (stackA = getArray());\n stackB || (stackB = getArray());\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == value) {\n return stackB[length];\n }\n }\n result = isArr ? ctor(value.length) : {};\n }\n else {\n result = isArr ? slice(value) : assign({}, value);\n }\n // add array properties assigned by `RegExp#exec`\n if (isArr) {\n if (hasOwnProperty.call(value, 'index')) {\n result.index = value.index;\n }\n if (hasOwnProperty.call(value, 'input')) {\n result.input = value.input;\n }\n }\n // exit for shallow clone\n if (!isDeep) {\n return result;\n }\n // add the source value to the stack of traversed objects\n // and associate it with its clone\n stackA.push(value);\n stackB.push(result);\n\n // recursively populate clone (susceptible to call stack limits)\n (isArr ? forEach : forOwn)(value, function(objValue, key) {\n result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);\n });\n\n if (initedStack) {\n releaseArray(stackA);\n releaseArray(stackB);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n function baseCreate(prototype, properties) {\n return isObject(prototype) ? nativeCreate(prototype) : {};\n }\n // fallback for browsers without `Object.create`\n if (!nativeCreate) {\n baseCreate = (function() {\n function Object() {}\n return function(prototype) {\n if (isObject(prototype)) {\n Object.prototype = prototype;\n var result = new Object;\n Object.prototype = null;\n }\n return result || root.Object();\n };\n }());\n }\n\n /**\n * The base implementation of `_.createCallback` without support for creating\n * \"_.pluck\" or \"_.where\" style callbacks.\n *\n * @private\n * @param {*} [func=identity] The value to convert to a callback.\n * @param {*} [thisArg] The `this` binding of the created callback.\n * @param {number} [argCount] The number of arguments the callback accepts.\n * @returns {Function} Returns a callback function.\n */\n function baseCreateCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n // exit early for no `thisArg` or already bound by `Function#bind`\n if (typeof thisArg == 'undefined' || !('prototype' in func)) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 2: return function(a, b) {\n return func.call(thisArg, a, b);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n }\n return bind(func, thisArg);\n }\n\n /**\n * The base implementation of `createWrapper` that creates the wrapper and\n * sets its meta data.\n *\n * @private\n * @param {Array} bindData The bind data array.\n * @returns {Function} Returns the new function.\n */\n function baseCreateWrapper(bindData) {\n var func = bindData[0],\n bitmask = bindData[1],\n partialArgs = bindData[2],\n partialRightArgs = bindData[3],\n thisArg = bindData[4],\n arity = bindData[5];\n\n var isBind = bitmask & 1,\n isBindKey = bitmask & 2,\n isCurry = bitmask & 4,\n isCurryBound = bitmask & 8,\n key = func;\n\n function bound() {\n var thisBinding = isBind ? thisArg : this;\n if (partialArgs) {\n var args = slice(partialArgs);\n push.apply(args, arguments);\n }\n if (partialRightArgs || isCurry) {\n args || (args = slice(arguments));\n if (partialRightArgs) {\n push.apply(args, partialRightArgs);\n }\n if (isCurry && args.length < arity) {\n bitmask |= 16 & ~32;\n return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);\n }\n }\n args || (args = arguments);\n if (isBindKey) {\n func = thisBinding[key];\n }\n if (this instanceof bound) {\n thisBinding = baseCreate(func.prototype);\n var result = func.apply(thisBinding, args);\n return isObject(result) ? result : thisBinding;\n }\n return func.apply(thisBinding, args);\n }\n return bound;\n }\n\n /**\n * The base implementation of `_.difference` that accepts a single array\n * of values to exclude.\n *\n * @private\n * @param {Array} array The array to process.\n * @param {Array} [values] The array of values to exclude.\n * @returns {Array} Returns a new array of filtered values.\n */\n function baseDifference(array, values) {\n var index = -1,\n indexOf = getIndexOf(),\n length = array ? array.length : 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (indexOf(values, value) < 0) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` without support for callback\n * shorthands or `thisArg` binding.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.\n * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.\n * @param {number} [fromIndex=0] The index to start from.\n * @returns {Array} Returns a new flattened array.\n */\n function baseFlatten(array, isShallow, isStrict, fromIndex) {\n var index = (fromIndex || 0) - 1,\n length = array ? array.length : 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n\n if (value && typeof value == 'object' && typeof value.length == 'number'\n && (isArray(value) || isArguments(value))) {\n // recursively flatten arrays (susceptible to call stack limits)\n if (!isShallow) {\n value = baseFlatten(value, isShallow, isStrict);\n }\n var valIndex = -1,\n valLength = value.length,\n resIndex = result.length;\n\n result.length += valLength;\n while (++valIndex < valLength) {\n result[resIndex++] = value[valIndex];\n }\n } else if (!isStrict) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.isEqual`, without support for `thisArg` binding,\n * that allows partial \"_.where\" style comparisons.\n *\n * @private\n * @param {*} a The value to compare.\n * @param {*} b The other value to compare.\n * @param {Function} [callback] The function to customize comparing values.\n * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.\n * @param {Array} [stackA=[]] Tracks traversed `a` objects.\n * @param {Array} [stackB=[]] Tracks traversed `b` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(a, b, stackA, stackB) {\n if (a === b) {\n return a !== 0 || (1 / a == 1 / b);\n }\n var type = typeof a,\n otherType = typeof b;\n\n if (a === a &&\n !(a && objectTypes[type]) &&\n !(b && objectTypes[otherType])) {\n return false;\n }\n if (a == null || b == null) {\n return a === b;\n }\n var className = toString.call(a),\n otherClass = toString.call(b);\n\n if (className != otherClass) {\n return false;\n }\n switch (className) {\n case boolClass:\n case dateClass:\n return +a == +b;\n\n case numberClass:\n return a != +a\n ? b != +b\n : (a == 0 ? (1 / a == 1 / b) : a == +b);\n\n case regexpClass:\n case stringClass:\n return a == String(b);\n }\n var isArr = className == arrayClass;\n if (!isArr) {\n var aWrapped = a instanceof lodash,\n bWrapped = b instanceof lodash;\n\n if (aWrapped || bWrapped) {\n return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, stackA, stackB);\n }\n if (className != objectClass) {\n return false;\n }\n var ctorA = a.constructor,\n ctorB = b.constructor;\n\n if (ctorA != ctorB &&\n !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&\n ('constructor' in a && 'constructor' in b)\n ) {\n return false;\n }\n }\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == a) {\n return stackB[length] == b;\n }\n }\n var result = true,\n size = 0;\n\n stackA.push(a);\n stackB.push(b);\n\n if (isArr) {\n size = b.length;\n result = size == a.length;\n\n if (result) {\n while (size--) {\n if (!(result = baseIsEqual(a[size], b[size], stackA, stackB))) {\n break;\n }\n }\n }\n }\n else {\n forIn(b, function(value, key, b) {\n if (hasOwnProperty.call(b, key)) {\n size++;\n return !(result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, stackA, stackB)) && indicatorObject;\n }\n });\n\n if (result) {\n forIn(a, function(value, key, a) {\n if (hasOwnProperty.call(a, key)) {\n return !(result = --size > -1) && indicatorObject;\n }\n });\n }\n }\n stackA.pop();\n stackB.pop();\n return result;\n }\n\n /**\n * The base implementation of `_.random` without argument juggling or support\n * for returning floating-point numbers.\n *\n * @private\n * @param {number} min The minimum possible value.\n * @param {number} max The maximum possible value.\n * @returns {number} Returns a random number.\n */\n function baseRandom(min, max) {\n return min + floor(nativeRandom() * (max - min + 1));\n }\n\n /**\n * The base implementation of `_.uniq` without support for callback shorthands\n * or `thisArg` binding.\n *\n * @private\n * @param {Array} array The array to process.\n * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.\n * @param {Function} [callback] The function called per iteration.\n * @returns {Array} Returns a duplicate-value-free array.\n */\n function baseUniq(array, isSorted, callback) {\n var index = -1,\n indexOf = getIndexOf(),\n length = array ? array.length : 0,\n result = [],\n seen = callback ? [] : result;\n\n while (++index < length) {\n var value = array[index],\n computed = callback ? callback(value, index, array) : value;\n\n if (isSorted\n ? !index || seen[seen.length - 1] !== computed\n : indexOf(seen, computed) < 0\n ) {\n if (callback) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * Creates a function that aggregates a collection, creating an object composed\n * of keys generated from the results of running each element of the collection\n * through a callback. The given `setter` function sets the keys and values\n * of the composed object.\n *\n * @private\n * @param {Function} setter The setter function.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter) {\n return function(collection, callback, thisArg) {\n var result = {};\n callback = createCallback(callback, thisArg, 3);\n\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (typeof length == 'number') {\n while (++index < length) {\n var value = collection[index];\n setter(result, value, callback(value, index, collection), collection);\n }\n } else {\n forOwn(collection, function(value, key, collection) {\n setter(result, value, callback(value, key, collection), collection);\n });\n }\n return result;\n };\n }\n\n /**\n * Creates a function that, when called, either curries or invokes `func`\n * with an optional `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of method flags to compose.\n * The bitmask may be composed of the following flags:\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry`\n * 8 - `_.curry` (bound)\n * 16 - `_.partial`\n * 32 - `_.partialRight`\n * @param {Array} [partialArgs] An array of arguments to prepend to those\n * provided to the new function.\n * @param {Array} [partialRightArgs] An array of arguments to append to those\n * provided to the new function.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new function.\n */\n function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {\n var isBind = bitmask & 1,\n isBindKey = bitmask & 2,\n isCurry = bitmask & 4,\n isCurryBound = bitmask & 8,\n isPartial = bitmask & 16,\n isPartialRight = bitmask & 32;\n\n if (!isBindKey && !isFunction(func)) {\n throw new TypeError;\n }\n if (isPartial && !partialArgs.length) {\n bitmask &= ~16;\n isPartial = partialArgs = false;\n }\n if (isPartialRight && !partialRightArgs.length) {\n bitmask &= ~32;\n isPartialRight = partialRightArgs = false;\n }\n // fast path for `_.bind`\n var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;\n return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);\n }\n\n /**\n * Used by `escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} match The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeHtmlChar(match) {\n return htmlEscapes[match];\n }\n\n /**\n * Gets the appropriate \"indexOf\" function. If the `_.indexOf` method is\n * customized, this method returns the custom method, otherwise it returns\n * the `baseIndexOf` function.\n *\n * @private\n * @returns {Function} Returns the \"indexOf\" function.\n */\n function getIndexOf() {\n var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;\n return result;\n }\n\n /**\n * Checks if `value` is a native function.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.\n */\n function isNative(value) {\n return typeof value == 'function' && reNative.test(value);\n }\n\n /**\n * Used by `unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} match The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n function unescapeHtmlChar(match) {\n return htmlUnescapes[match];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Checks if `value` is an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.\n * @example\n *\n * (function() { return _.isArguments(arguments); })(1, 2, 3);\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n function isArguments(value) {\n return value && typeof value == 'object' && typeof value.length == 'number' &&\n toString.call(value) == argsClass || false;\n }\n // fallback for browsers that can't detect `arguments` objects by [[Class]]\n if (!isArguments(arguments)) {\n isArguments = function(value) {\n return value && typeof value == 'object' && typeof value.length == 'number' &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false;\n };\n }\n\n /**\n * Checks if `value` is an array.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is an array, else `false`.\n * @example\n *\n * (function() { return _.isArray(arguments); })();\n * // => false\n *\n * _.isArray([1, 2, 3]);\n * // => true\n */\n var isArray = nativeIsArray || function(value) {\n return value && typeof value == 'object' && typeof value.length == 'number' &&\n toString.call(value) == arrayClass || false;\n };\n\n /**\n * A fallback implementation of `Object.keys` which produces an array of the\n * given object's own enumerable property names.\n *\n * @private\n * @type Function\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns an array of property names.\n */\n var shimKeys = function(object) {\n var index, iterable = object, result = [];\n if (!iterable) return result;\n if (!(objectTypes[typeof object])) return result;\n for (index in iterable) {\n if (hasOwnProperty.call(iterable, index)) {\n result.push(index);\n }\n }\n return result\n };\n\n /**\n * Creates an array composed of the own enumerable property names of an object.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns an array of property names.\n * @example\n *\n * _.keys({ 'one': 1, 'two': 2, 'three': 3 });\n * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)\n */\n var keys = !nativeKeys ? shimKeys : function(object) {\n if (!isObject(object)) {\n return [];\n }\n return nativeKeys(object);\n };\n\n /**\n * Used to convert characters to HTML entities:\n *\n * Though the `>` character is escaped for symmetry, characters like `>` and `/`\n * don't require escaping in HTML and have no special meaning unless they're part\n * of a tag or an unquoted attribute value.\n * http://mathiasbynens.be/notes/ambiguous-ampersands (under \"semi-related fun fact\")\n */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n };\n\n /** Used to convert HTML entities to characters */\n var htmlUnescapes = invert(htmlEscapes);\n\n /** Used to match HTML entities and HTML characters */\n var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),\n reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Assigns own enumerable properties of source object(s) to the destination\n * object. Subsequent sources will overwrite property assignments of previous\n * sources. If a callback is provided it will be executed to produce the\n * assigned values. The callback is bound to `thisArg` and invoked with two\n * arguments; (objectValue, sourceValue).\n *\n * @static\n * @memberOf _\n * @type Function\n * @alias extend\n * @category Objects\n * @param {Object} object The destination object.\n * @param {...Object} [source] The source objects.\n * @param {Function} [callback] The function to customize assigning values.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns the destination object.\n * @example\n *\n * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });\n * // => { 'name': 'fred', 'employer': 'slate' }\n *\n * var defaults = _.partialRight(_.assign, function(a, b) {\n * return typeof a == 'undefined' ? b : a;\n * });\n *\n * var object = { 'name': 'barney' };\n * defaults(object, { 'name': 'fred', 'employer': 'slate' });\n * // => { 'name': 'barney', 'employer': 'slate' }\n */\n function assign(object) {\n if (!object) {\n return object;\n }\n for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {\n var iterable = arguments[argsIndex];\n if (iterable) {\n for (var key in iterable) {\n object[key] = iterable[key];\n }\n }\n }\n return object;\n }\n\n /**\n * Creates a clone of `value`. If `isDeep` is `true` nested objects will also\n * be cloned, otherwise they will be assigned by reference. If a callback\n * is provided it will be executed to produce the cloned values. If the\n * callback returns `undefined` cloning will be handled by the method instead.\n * The callback is bound to `thisArg` and invoked with one argument; (value).\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep=false] Specify a deep clone.\n * @param {Function} [callback] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the cloned value.\n * @example\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * var shallow = _.clone(characters);\n * shallow[0] === characters[0];\n * // => true\n *\n * var deep = _.clone(characters, true);\n * deep[0] === characters[0];\n * // => false\n *\n * _.mixin({\n * 'clone': _.partialRight(_.clone, function(value) {\n * return _.isElement(value) ? value.cloneNode(false) : undefined;\n * })\n * });\n *\n * var clone = _.clone(document.body);\n * clone.childNodes.length;\n * // => 0\n */\n function clone(value, isDeep, callback, thisArg) {\n // allows working with \"Collections\" methods without using their `index`\n // and `collection` arguments for `isDeep` and `callback`\n if (typeof isDeep != 'boolean' && isDeep != null) {\n thisArg = callback;\n callback = isDeep;\n isDeep = false;\n }\n return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));\n }\n\n /**\n * Creates a deep clone of `value`. If a callback is provided it will be\n * executed to produce the cloned values. If the callback returns `undefined`\n * cloning will be handled by the method instead. The callback is bound to\n * `thisArg` and invoked with one argument; (value).\n *\n * Note: This method is loosely based on the structured clone algorithm. Functions\n * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and\n * objects created by constructors other than `Object` are cloned to plain `Object` objects.\n * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to deep clone.\n * @param {Function} [callback] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the deep cloned value.\n * @example\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * var deep = _.cloneDeep(characters);\n * deep[0] === characters[0];\n * // => false\n *\n * var view = {\n * 'label': 'docs',\n * 'node': element\n * };\n *\n * var clone = _.cloneDeep(view, function(value) {\n * return _.isElement(value) ? value.cloneNode(true) : undefined;\n * });\n *\n * clone.node == view.node;\n * // => false\n */\n function cloneDeep(value, callback, thisArg) {\n return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));\n }\n\n /**\n * Assigns own enumerable properties of source object(s) to the destination\n * object for all destination properties that resolve to `undefined`. Once a\n * property is set, additional defaults of the same property will be ignored.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Objects\n * @param {Object} object The destination object.\n * @param {...Object} [source] The source objects.\n * @param- {Object} [guard] Allows working with `_.reduce` without using its\n * `key` and `object` arguments as sources.\n * @returns {Object} Returns the destination object.\n * @example\n *\n * var object = { 'name': 'barney' };\n * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });\n * // => { 'name': 'barney', 'employer': 'slate' }\n */\n function defaults(object) {\n if (!object) {\n return object;\n }\n for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {\n var iterable = arguments[argsIndex];\n if (iterable) {\n for (var key in iterable) {\n if (typeof object[key] == 'undefined') {\n object[key] = iterable[key];\n }\n }\n }\n }\n return object;\n }\n\n /**\n * Iterates over own and inherited enumerable properties of an object,\n * executing the callback for each property. The callback is bound to `thisArg`\n * and invoked with three arguments; (value, key, object). Callbacks may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Objects\n * @param {Object} object The object to iterate over.\n * @param {Function} [callback=identity] The function called per iteration.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * Shape.prototype.move = function(x, y) {\n * this.x += x;\n * this.y += y;\n * };\n *\n * _.forIn(new Shape, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)\n */\n var forIn = function(collection, callback) {\n var index, iterable = collection, result = iterable;\n if (!iterable) return result;\n if (!objectTypes[typeof iterable]) return result;\n for (index in iterable) {\n if (callback(iterable[index], index, collection) === indicatorObject) return result;\n }\n return result\n };\n\n /**\n * Iterates over own enumerable properties of an object, executing the callback\n * for each property. The callback is bound to `thisArg` and invoked with three\n * arguments; (value, key, object). Callbacks may exit iteration early by\n * explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Objects\n * @param {Object} object The object to iterate over.\n * @param {Function} [callback=identity] The function called per iteration.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {\n * console.log(key);\n * });\n * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)\n */\n var forOwn = function(collection, callback) {\n var index, iterable = collection, result = iterable;\n if (!iterable) return result;\n if (!objectTypes[typeof iterable]) return result;\n for (index in iterable) {\n if (hasOwnProperty.call(iterable, index)) {\n if (callback(iterable[index], index, collection) === indicatorObject) return result;\n }\n }\n return result\n };\n\n /**\n * Creates a sorted array of property names of all enumerable properties,\n * own and inherited, of `object` that have function values.\n *\n * @static\n * @memberOf _\n * @alias methods\n * @category Objects\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns an array of property names that have function values.\n * @example\n *\n * _.functions(_);\n * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]\n */\n function functions(object) {\n var result = [];\n forIn(object, function(value, key) {\n if (isFunction(value)) {\n result.push(key);\n }\n });\n return result.sort();\n }\n\n /**\n * Checks if the specified property name exists as a direct property of `object`,\n * instead of an inherited property.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The object to inspect.\n * @param {string} key The name of the property to check.\n * @returns {boolean} Returns `true` if key is a direct property, else `false`.\n * @example\n *\n * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');\n * // => true\n */\n function has(object, key) {\n return object ? hasOwnProperty.call(object, key) : false;\n }\n\n /**\n * Creates an object composed of the inverted keys and values of the given object.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The object to invert.\n * @returns {Object} Returns the created inverted object.\n * @example\n *\n * _.invert({ 'first': 'fred', 'second': 'barney' });\n * // => { 'fred': 'first', 'barney': 'second' }\n */\n function invert(object) {\n var index = -1,\n props = keys(object),\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index];\n result[object[key]] = key;\n }\n return result;\n }\n\n /**\n * Checks if `value` is a boolean value.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.\n * @example\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false ||\n value && typeof value == 'object' && toString.call(value) == boolClass || false;\n }\n\n /**\n * Checks if `value` is a date.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a date, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n */\n function isDate(value) {\n return value && typeof value == 'object' && toString.call(value) == dateClass || false;\n }\n\n /**\n * Checks if `value` is a DOM element.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n */\n function isElement(value) {\n return value && value.nodeType === 1 || false;\n }\n\n /**\n * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a\n * length of `0` and objects with no own enumerable properties are considered\n * \"empty\".\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Array|Object|string} value The value to inspect.\n * @returns {boolean} Returns `true` if the `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({});\n * // => true\n *\n * _.isEmpty('');\n * // => true\n */\n function isEmpty(value) {\n if (!value) {\n return true;\n }\n if (isArray(value) || isString(value)) {\n return !value.length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent to each other. If a callback is provided it will be executed\n * to compare values. If the callback returns `undefined` comparisons will\n * be handled by the method instead. The callback is bound to `thisArg` and\n * invoked with two arguments; (a, b).\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} a The value to compare.\n * @param {*} b The other value to compare.\n * @param {Function} [callback] The function to customize comparing values.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'name': 'fred' };\n * var copy = { 'name': 'fred' };\n *\n * object == copy;\n * // => false\n *\n * _.isEqual(object, copy);\n * // => true\n *\n * var words = ['hello', 'goodbye'];\n * var otherWords = ['hi', 'goodbye'];\n *\n * _.isEqual(words, otherWords, function(a, b) {\n * var reGreet = /^(?:hello|hi)$/i,\n * aGreet = _.isString(a) && reGreet.test(a),\n * bGreet = _.isString(b) && reGreet.test(b);\n *\n * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;\n * });\n * // => true\n */\n function isEqual(a, b) {\n return baseIsEqual(a, b);\n }\n\n /**\n * Checks if `value` is, or can be coerced to, a finite number.\n *\n * Note: This is not the same as native `isFinite` which will return true for\n * booleans and empty strings. See http://es5.github.io/#x15.1.2.5.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is finite, else `false`.\n * @example\n *\n * _.isFinite(-101);\n * // => true\n *\n * _.isFinite('10');\n * // => true\n *\n * _.isFinite(true);\n * // => false\n *\n * _.isFinite('');\n * // => false\n *\n * _.isFinite(Infinity);\n * // => false\n */\n function isFinite(value) {\n return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));\n }\n\n /**\n * Checks if `value` is a function.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n */\n function isFunction(value) {\n return typeof value == 'function';\n }\n // fallback for older versions of Chrome and Safari\n if (isFunction(/x/)) {\n isFunction = function(value) {\n return typeof value == 'function' && toString.call(value) == funcClass;\n };\n }\n\n /**\n * Checks if `value` is the language type of Object.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\n function isObject(value) {\n // check if the value is the ECMAScript language type of Object\n // http://es5.github.io/#x8\n // and avoid a V8 bug\n // http://code.google.com/p/v8/issues/detail?id=2291\n return !!(value && objectTypes[typeof value]);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * Note: This is not the same as native `isNaN` which will return `true` for\n * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // `NaN` as a primitive is the only value that is not equal to itself\n // (perform the [[Class]] check first to avoid errors with some host objects in IE)\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(undefined);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is a number.\n *\n * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(8.4 * 5);\n * // => true\n */\n function isNumber(value) {\n return typeof value == 'number' ||\n value && typeof value == 'object' && toString.call(value) == numberClass || false;\n }\n\n /**\n * Checks if `value` is a regular expression.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.\n * @example\n *\n * _.isRegExp(/fred/);\n * // => true\n */\n function isRegExp(value) {\n return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false;\n }\n\n /**\n * Checks if `value` is a string.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is a string, else `false`.\n * @example\n *\n * _.isString('fred');\n * // => true\n */\n function isString(value) {\n return typeof value == 'string' ||\n value && typeof value == 'object' && toString.call(value) == stringClass || false;\n }\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n */\n function isUndefined(value) {\n return typeof value == 'undefined';\n }\n\n /**\n * Creates a shallow clone of `object` excluding the specified properties.\n * Property names may be specified as individual arguments or as arrays of\n * property names. If a callback is provided it will be executed for each\n * property of `object` omitting the properties the callback returns truey\n * for. The callback is bound to `thisArg` and invoked with three arguments;\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The source object.\n * @param {Function|...string|string[]} [callback] The properties to omit or the\n * function called per iteration.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns an object without the omitted properties.\n * @example\n *\n * _.omit({ 'name': 'fred', 'age': 40 }, 'age');\n * // => { 'name': 'fred' }\n *\n * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {\n * return typeof value == 'number';\n * });\n * // => { 'name': 'fred' }\n */\n function omit(object) {\n var props = [];\n forIn(object, function(value, key) {\n props.push(key);\n });\n props = baseDifference(props, baseFlatten(arguments, true, false, 1));\n\n var index = -1,\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index];\n result[key] = object[key];\n }\n return result;\n }\n\n /**\n * Creates a two dimensional array of an object's key-value pairs,\n * i.e. `[[key1, value1], [key2, value2]]`.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns new array of key-value pairs.\n * @example\n *\n * _.pairs({ 'barney': 36, 'fred': 40 });\n * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments)\n */\n function pairs(object) {\n var index = -1,\n props = keys(object),\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n var key = props[index];\n result[index] = [key, object[key]];\n }\n return result;\n }\n\n /**\n * Creates a shallow clone of `object` composed of the specified properties.\n * Property names may be specified as individual arguments or as arrays of\n * property names. If a callback is provided it will be executed for each\n * property of `object` picking the properties the callback returns truey\n * for. The callback is bound to `thisArg` and invoked with three arguments;\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The source object.\n * @param {Function|...string|string[]} [callback] The function called per\n * iteration or property names to pick, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns an object composed of the picked properties.\n * @example\n *\n * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name');\n * // => { 'name': 'fred' }\n *\n * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) {\n * return key.charAt(0) != '_';\n * });\n * // => { 'name': 'fred' }\n */\n function pick(object) {\n var index = -1,\n props = baseFlatten(arguments, true, false, 1),\n length = props.length,\n result = {};\n\n if (object == null) return result;\n while (++index < length) {\n var key = props[index];\n if (key in object) {\n result[key] = object[key];\n }\n }\n return result;\n }\n\n /**\n * Creates an array composed of the own enumerable property values of `object`.\n *\n * @static\n * @memberOf _\n * @category Objects\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns an array of property values.\n * @example\n *\n * _.values({ 'one': 1, 'two': 2, 'three': 3 });\n * // => [1, 2, 3] (property order is not guaranteed across environments)\n */\n function values(object) {\n var index = -1,\n props = keys(object),\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = object[props[index]];\n }\n return result;\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Checks if a given value is present in a collection using strict equality\n * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the\n * offset from the end of the collection.\n *\n * @static\n * @memberOf _\n * @alias include\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {*} target The value to check for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {boolean} Returns `true` if the `target` element is found, else `false`.\n * @example\n *\n * _.contains([1, 2, 3], 1);\n * // => true\n *\n * _.contains([1, 2, 3], 1, 2);\n * // => false\n *\n * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');\n * // => true\n *\n * _.contains('pebbles', 'eb');\n * // => true\n */\n function contains(collection, target) {\n var indexOf = getIndexOf(),\n length = collection ? collection.length : 0,\n result = false;\n if (length && typeof length == 'number') {\n result = indexOf(collection, target) > -1;\n } else {\n forOwn(collection, function(value) {\n return (result = value === target) && indicatorObject;\n });\n }\n return result;\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through the callback. The corresponding value\n * of each key is the number of times the key was returned by the callback.\n * The callback is bound to `thisArg` and invoked with three arguments;\n * (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });\n * // => { '4': 1, '6': 2 }\n *\n * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);\n * // => { '4': 1, '6': 2 }\n *\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);\n });\n\n /**\n * Checks if the given callback returns truey value for **all** elements of\n * a collection. The callback is bound to `thisArg` and invoked with three\n * arguments; (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias all\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {boolean} Returns `true` if all elements passed the callback check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes']);\n * // => false\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.every(characters, 'age');\n * // => true\n *\n * // using \"_.where\" callback shorthand\n * _.every(characters, { 'age': 36 });\n * // => false\n */\n function every(collection, callback, thisArg) {\n var result = true;\n callback = createCallback(callback, thisArg, 3);\n\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (typeof length == 'number') {\n while (++index < length) {\n if (!(result = !!callback(collection[index], index, collection))) {\n break;\n }\n }\n } else {\n forOwn(collection, function(value, index, collection) {\n return !(result = !!callback(value, index, collection)) && indicatorObject;\n });\n }\n return result;\n }\n\n /**\n * Iterates over elements of a collection, returning an array of all elements\n * the callback returns truey for. The callback is bound to `thisArg` and\n * invoked with three arguments; (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias select\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a new array of elements that passed the callback check.\n * @example\n *\n * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });\n * // => [2, 4, 6]\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36, 'blocked': false },\n * { 'name': 'fred', 'age': 40, 'blocked': true }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.filter(characters, 'blocked');\n * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]\n *\n * // using \"_.where\" callback shorthand\n * _.filter(characters, { 'age': 36 });\n * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]\n */\n function filter(collection, callback, thisArg) {\n var result = [];\n callback = createCallback(callback, thisArg, 3);\n\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (typeof length == 'number') {\n while (++index < length) {\n var value = collection[index];\n if (callback(value, index, collection)) {\n result.push(value);\n }\n }\n } else {\n forOwn(collection, function(value, index, collection) {\n if (callback(value, index, collection)) {\n result.push(value);\n }\n });\n }\n return result;\n }\n\n /**\n * Iterates over elements of a collection, returning the first element that\n * the callback returns truey for. The callback is bound to `thisArg` and\n * invoked with three arguments; (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias detect, findWhere\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the found element, else `undefined`.\n * @example\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36, 'blocked': false },\n * { 'name': 'fred', 'age': 40, 'blocked': true },\n * { 'name': 'pebbles', 'age': 1, 'blocked': false }\n * ];\n *\n * _.find(characters, function(chr) {\n * return chr.age < 40;\n * });\n * // => { 'name': 'barney', 'age': 36, 'blocked': false }\n *\n * // using \"_.where\" callback shorthand\n * _.find(characters, { 'age': 1 });\n * // => { 'name': 'pebbles', 'age': 1, 'blocked': false }\n *\n * // using \"_.pluck\" callback shorthand\n * _.find(characters, 'blocked');\n * // => { 'name': 'fred', 'age': 40, 'blocked': true }\n */\n function find(collection, callback, thisArg) {\n callback = createCallback(callback, thisArg, 3);\n\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (typeof length == 'number') {\n while (++index < length) {\n var value = collection[index];\n if (callback(value, index, collection)) {\n return value;\n }\n }\n } else {\n var result;\n forOwn(collection, function(value, index, collection) {\n if (callback(value, index, collection)) {\n result = value;\n return indicatorObject;\n }\n });\n return result;\n }\n }\n\n /**\n * Examines each element in a `collection`, returning the first that\n * has the given properties. When checking `properties`, this method\n * performs a deep comparison between values to determine if they are\n * equivalent to each other.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Object} properties The object of property values to filter by.\n * @returns {*} Returns the found element, else `undefined`.\n * @example\n *\n * var food = [\n * { 'name': 'apple', 'organic': false, 'type': 'fruit' },\n * { 'name': 'banana', 'organic': true, 'type': 'fruit' },\n * { 'name': 'beet', 'organic': false, 'type': 'vegetable' }\n * ];\n *\n * _.findWhere(food, { 'type': 'vegetable' });\n * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }\n */\n function findWhere(object, properties) {\n return where(object, properties, true);\n }\n\n /**\n * Iterates over elements of a collection, executing the callback for each\n * element. The callback is bound to `thisArg` and invoked with three arguments;\n * (value, index|key, collection). Callbacks may exit iteration early by\n * explicitly returning `false`.\n *\n * Note: As with other \"Collections\" methods, objects with a `length` property\n * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`\n * may be used for object iteration.\n *\n * @static\n * @memberOf _\n * @alias each\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [callback=identity] The function called per iteration.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');\n * // => logs each number and returns '1,2,3'\n *\n * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });\n * // => logs each number and returns the object (property order is not guaranteed across environments)\n */\n function forEach(collection, callback, thisArg) {\n var index = -1,\n length = collection ? collection.length : 0;\n\n callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);\n if (typeof length == 'number') {\n while (++index < length) {\n if (callback(collection[index], index, collection) === indicatorObject) {\n break;\n }\n }\n } else {\n forOwn(collection, callback);\n }\n }\n\n /**\n * This method is like `_.forEach` except that it iterates over elements\n * of a `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @alias eachRight\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [callback=identity] The function called per iteration.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');\n * // => logs each number from right to left and returns '3,2,1'\n */\n function forEachRight(collection, callback) {\n var length = collection ? collection.length : 0;\n if (typeof length == 'number') {\n while (length--) {\n if (callback(collection[length], length, collection) === false) {\n break;\n }\n }\n } else {\n var props = keys(collection);\n length = props.length;\n forOwn(collection, function(value, key, collection) {\n key = props ? props[--length] : --length;\n return callback(collection[key], key, collection) === false && indicatorObject;\n });\n }\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of a collection through the callback. The corresponding value\n * of each key is an array of the elements responsible for generating the key.\n * The callback is bound to `thisArg` and invoked with three arguments;\n * (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * // using \"_.pluck\" callback shorthand\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of the collection through the given callback. The corresponding\n * value of each key is the last element responsible for generating the key.\n * The callback is bound to `thisArg` and invoked with three arguments;\n * (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var keys = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.indexBy(keys, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n *\n * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String);\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n */\n var indexBy = createAggregator(function(result, value, key) {\n result[key] = value;\n });\n\n /**\n * Invokes the method named by `methodName` on each element in the `collection`\n * returning an array of the results of each invoked method. Additional arguments\n * will be provided to each invoked method. If `methodName` is a function it\n * will be invoked for, and `this` bound to, each element in the `collection`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|string} methodName The name of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [arg] Arguments to invoke the method with.\n * @returns {Array} Returns a new array of the results of each invoked method.\n * @example\n *\n * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invoke([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n function invoke(collection, methodName) {\n var args = slice(arguments, 2),\n index = -1,\n isFunc = typeof methodName == 'function',\n length = collection ? collection.length : 0,\n result = Array(typeof length == 'number' ? length : 0);\n\n forEach(collection, function(value) {\n result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);\n });\n return result;\n }\n\n /**\n * Creates an array of values by running each element in the collection\n * through the callback. The callback is bound to `thisArg` and invoked with\n * three arguments; (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias collect\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a new array of the results of each `callback` execution.\n * @example\n *\n * _.map([1, 2, 3], function(num) { return num * 3; });\n * // => [3, 6, 9]\n *\n * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });\n * // => [3, 6, 9] (property order is not guaranteed across environments)\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.map(characters, 'name');\n * // => ['barney', 'fred']\n */\n function map(collection, callback, thisArg) {\n var index = -1,\n length = collection ? collection.length : 0;\n\n callback = createCallback(callback, thisArg, 3);\n if (typeof length == 'number') {\n var result = Array(length);\n while (++index < length) {\n result[index] = callback(collection[index], index, collection);\n }\n } else {\n result = [];\n forOwn(collection, function(value, key, collection) {\n result[++index] = callback(value, key, collection);\n });\n }\n return result;\n }\n\n /**\n * Retrieves the maximum value of a collection. If the collection is empty or\n * falsey `-Infinity` is returned. If a callback is provided it will be executed\n * for each value in the collection to generate the criterion by which the value\n * is ranked. The callback is bound to `thisArg` and invoked with three\n * arguments; (value, index, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * _.max(characters, function(chr) { return chr.age; });\n * // => { 'name': 'fred', 'age': 40 };\n *\n * // using \"_.pluck\" callback shorthand\n * _.max(characters, 'age');\n * // => { 'name': 'fred', 'age': 40 };\n */\n function max(collection, callback, thisArg) {\n var computed = -Infinity,\n result = computed;\n\n // allows working with functions like `_.map` without using\n // their `index` argument as a callback\n if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {\n callback = null;\n }\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (callback == null && typeof length == 'number') {\n while (++index < length) {\n var value = collection[index];\n if (value > result) {\n result = value;\n }\n }\n } else {\n callback = createCallback(callback, thisArg, 3);\n\n forEach(collection, function(value, index, collection) {\n var current = callback(value, index, collection);\n if (current > computed) {\n computed = current;\n result = value;\n }\n });\n }\n return result;\n }\n\n /**\n * Retrieves the minimum value of a collection. If the collection is empty or\n * falsey `Infinity` is returned. If a callback is provided it will be executed\n * for each value in the collection to generate the criterion by which the value\n * is ranked. The callback is bound to `thisArg` and invoked with three\n * arguments; (value, index, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * _.min(characters, function(chr) { return chr.age; });\n * // => { 'name': 'barney', 'age': 36 };\n *\n * // using \"_.pluck\" callback shorthand\n * _.min(characters, 'age');\n * // => { 'name': 'barney', 'age': 36 };\n */\n function min(collection, callback, thisArg) {\n var computed = Infinity,\n result = computed;\n\n // allows working with functions like `_.map` without using\n // their `index` argument as a callback\n if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {\n callback = null;\n }\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (callback == null && typeof length == 'number') {\n while (++index < length) {\n var value = collection[index];\n if (value < result) {\n result = value;\n }\n }\n } else {\n callback = createCallback(callback, thisArg, 3);\n\n forEach(collection, function(value, index, collection) {\n var current = callback(value, index, collection);\n if (current < computed) {\n computed = current;\n result = value;\n }\n });\n }\n return result;\n }\n\n /**\n * Retrieves the value of a specified property from all elements in the collection.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {string} property The name of the property to pluck.\n * @returns {Array} Returns a new array of property values.\n * @example\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * _.pluck(characters, 'name');\n * // => ['barney', 'fred']\n */\n var pluck = map;\n\n /**\n * Reduces a collection to a value which is the accumulated result of running\n * each element in the collection through the callback, where each successive\n * callback execution consumes the return value of the previous execution. If\n * `accumulator` is not provided the first element of the collection will be\n * used as the initial `accumulator` value. The callback is bound to `thisArg`\n * and invoked with four arguments; (accumulator, value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @alias foldl, inject\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [callback=identity] The function called per iteration.\n * @param {*} [accumulator] Initial value of the accumulator.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * var sum = _.reduce([1, 2, 3], function(sum, num) {\n * return sum + num;\n * });\n * // => 6\n *\n * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {\n * result[key] = num * 3;\n * return result;\n * }, {});\n * // => { 'a': 3, 'b': 6, 'c': 9 }\n */\n function reduce(collection, callback, accumulator, thisArg) {\n if (!collection) return accumulator;\n var noaccum = arguments.length < 3;\n callback = createCallback(callback, thisArg, 4);\n\n var index = -1,\n length = collection.length;\n\n if (typeof length == 'number') {\n if (noaccum) {\n accumulator = collection[++index];\n }\n while (++index < length) {\n accumulator = callback(accumulator, collection[index], index, collection);\n }\n } else {\n forOwn(collection, function(value, index, collection) {\n accumulator = noaccum\n ? (noaccum = false, value)\n : callback(accumulator, value, index, collection)\n });\n }\n return accumulator;\n }\n\n /**\n * This method is like `_.reduce` except that it iterates over elements\n * of a `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @alias foldr\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [callback=identity] The function called per iteration.\n * @param {*} [accumulator] Initial value of the accumulator.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * var list = [[0, 1], [2, 3], [4, 5]];\n * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n function reduceRight(collection, callback, accumulator, thisArg) {\n var noaccum = arguments.length < 3;\n callback = createCallback(callback, thisArg, 4);\n forEachRight(collection, function(value, index, collection) {\n accumulator = noaccum\n ? (noaccum = false, value)\n : callback(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The opposite of `_.filter` this method returns the elements of a\n * collection that the callback does **not** return truey for.\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a new array of elements that failed the callback check.\n * @example\n *\n * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });\n * // => [1, 3, 5]\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36, 'blocked': false },\n * { 'name': 'fred', 'age': 40, 'blocked': true }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.reject(characters, 'blocked');\n * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]\n *\n * // using \"_.where\" callback shorthand\n * _.reject(characters, { 'age': 36 });\n * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]\n */\n function reject(collection, callback, thisArg) {\n callback = createCallback(callback, thisArg, 3);\n return filter(collection, function(value, index, collection) {\n return !callback(value, index, collection);\n });\n }\n\n /**\n * Retrieves a random element or `n` random elements from a collection.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to sample.\n * @param {number} [n] The number of elements to sample.\n * @param- {Object} [guard] Allows working with functions like `_.map`\n * without using their `index` arguments as `n`.\n * @returns {Array} Returns the random sample(s) of `collection`.\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n *\n * _.sample([1, 2, 3, 4], 2);\n * // => [3, 1]\n */\n function sample(collection, n, guard) {\n if (collection && typeof collection.length != 'number') {\n collection = values(collection);\n }\n if (n == null || guard) {\n return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;\n }\n var result = shuffle(collection);\n result.length = nativeMin(nativeMax(0, n), result.length);\n return result;\n }\n\n /**\n * Creates an array of shuffled values, using a version of the Fisher-Yates\n * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to shuffle.\n * @returns {Array} Returns a new shuffled collection.\n * @example\n *\n * _.shuffle([1, 2, 3, 4, 5, 6]);\n * // => [4, 1, 6, 3, 5, 2]\n */\n function shuffle(collection) {\n var index = -1,\n length = collection ? collection.length : 0,\n result = Array(typeof length == 'number' ? length : 0);\n\n forEach(collection, function(value) {\n var rand = baseRandom(0, ++index);\n result[index] = result[rand];\n result[rand] = value;\n });\n return result;\n }\n\n /**\n * Gets the size of the `collection` by returning `collection.length` for arrays\n * and array-like objects or the number of own enumerable properties for objects.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns `collection.length` or number of own enumerable properties.\n * @example\n *\n * _.size([1, 2]);\n * // => 2\n *\n * _.size({ 'one': 1, 'two': 2, 'three': 3 });\n * // => 3\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n var length = collection ? collection.length : 0;\n return typeof length == 'number' ? length : keys(collection).length;\n }\n\n /**\n * Checks if the callback returns a truey value for **any** element of a\n * collection. The function returns as soon as it finds a passing value and\n * does not iterate over the entire collection. The callback is bound to\n * `thisArg` and invoked with three arguments; (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias any\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {boolean} Returns `true` if any element passed the callback check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36, 'blocked': false },\n * { 'name': 'fred', 'age': 40, 'blocked': true }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.some(characters, 'blocked');\n * // => true\n *\n * // using \"_.where\" callback shorthand\n * _.some(characters, { 'age': 1 });\n * // => false\n */\n function some(collection, callback, thisArg) {\n var result;\n callback = createCallback(callback, thisArg, 3);\n\n var index = -1,\n length = collection ? collection.length : 0;\n\n if (typeof length == 'number') {\n while (++index < length) {\n if ((result = callback(collection[index], index, collection))) {\n break;\n }\n }\n } else {\n forOwn(collection, function(value, index, collection) {\n return (result = callback(value, index, collection)) && indicatorObject;\n });\n }\n return !!result;\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection through the callback. This method\n * performs a stable sort, that is, it will preserve the original sort order\n * of equal elements. The callback is bound to `thisArg` and invoked with\n * three arguments; (value, index|key, collection).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an array of property names is provided for `callback` the collection\n * will be sorted by each property value.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Array|Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a new array of sorted elements.\n * @example\n *\n * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });\n * // => [3, 1, 2]\n *\n * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);\n * // => [3, 1, 2]\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 },\n * { 'name': 'barney', 'age': 26 },\n * { 'name': 'fred', 'age': 30 }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.map(_.sortBy(characters, 'age'), _.values);\n * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]]\n *\n * // sorting by multiple properties\n * _.map(_.sortBy(characters, ['name', 'age']), _.values);\n * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]\n */\n function sortBy(collection, callback, thisArg) {\n var index = -1,\n length = collection ? collection.length : 0,\n result = Array(typeof length == 'number' ? length : 0);\n\n callback = createCallback(callback, thisArg, 3);\n forEach(collection, function(value, key, collection) {\n result[++index] = {\n 'criteria': [callback(value, key, collection)],\n 'index': index,\n 'value': value\n };\n });\n\n length = result.length;\n result.sort(compareAscending);\n while (length--) {\n result[length] = result[length].value;\n }\n return result;\n }\n\n /**\n * Converts the `collection` to an array.\n *\n * @static\n * @memberOf _\n * @category Collections\n * @param {Array|Object|string} collection The collection to convert.\n * @returns {Array} Returns the new converted array.\n * @example\n *\n * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);\n * // => [2, 3, 4]\n */\n function toArray(collection) {\n if (isArray(collection)) {\n return slice(collection);\n }\n if (collection && typeof collection.length == 'number') {\n return map(collection);\n }\n return values(collection);\n }\n\n /**\n * Performs a deep comparison of each element in a `collection` to the given\n * `properties` object, returning an array of all elements that have equivalent\n * property values.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Collections\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Object} props The object of property values to filter by.\n * @returns {Array} Returns a new array of elements that have the given properties.\n * @example\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] },\n * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }\n * ];\n *\n * _.where(characters, { 'age': 36 });\n * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }]\n *\n * _.where(characters, { 'pets': ['dino'] });\n * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }]\n */\n function where(collection, properties, first) {\n return (first && isEmpty(properties))\n ? undefined\n : (first ? find : filter)(collection, properties);\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are all falsey.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to compact.\n * @returns {Array} Returns a new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * Creates an array excluding all values of the provided arrays using strict\n * equality for comparisons, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to process.\n * @param {...Array} [values] The arrays of values to exclude.\n * @returns {Array} Returns a new array of filtered values.\n * @example\n *\n * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);\n * // => [1, 3, 4]\n */\n function difference(array) {\n return baseDifference(array, baseFlatten(arguments, true, true, 1));\n }\n\n /**\n * Gets the first element or first `n` elements of an array. If a callback\n * is provided elements at the beginning of the array are returned as long\n * as the callback returns truey. The callback is bound to `thisArg` and\n * invoked with three arguments; (value, index, array).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias head, take\n * @category Arrays\n * @param {Array} array The array to query.\n * @param {Function|Object|number|string} [callback] The function called\n * per element or the number of elements to return. If a property name or\n * object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n * style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the first element(s) of `array`.\n * @example\n *\n * _.first([1, 2, 3]);\n * // => 1\n *\n * _.first([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.first([1, 2, 3], function(num) {\n * return num < 3;\n * });\n * // => [1, 2]\n *\n * var characters = [\n * { 'name': 'barney', 'blocked': true, 'employer': 'slate' },\n * { 'name': 'fred', 'blocked': false, 'employer': 'slate' },\n * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.first(characters, 'blocked');\n * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }]\n *\n * // using \"_.where\" callback shorthand\n * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name');\n * // => ['barney', 'fred']\n */\n function first(array, callback, thisArg) {\n var n = 0,\n length = array ? array.length : 0;\n\n if (typeof callback != 'number' && callback != null) {\n var index = -1;\n callback = createCallback(callback, thisArg, 3);\n while (++index < length && callback(array[index], index, array)) {\n n++;\n }\n } else {\n n = callback;\n if (n == null || thisArg) {\n return array ? array[0] : undefined;\n }\n }\n return slice(array, 0, nativeMin(nativeMax(0, n), length));\n }\n\n /**\n * Flattens a nested array (the nesting can be to any depth). If `isShallow`\n * is truey, the array will only be flattened a single level. If a callback\n * is provided each element of the array is passed through the callback before\n * flattening. The callback is bound to `thisArg` and invoked with three\n * arguments; (value, index, array).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to flatten.\n * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a new flattened array.\n * @example\n *\n * _.flatten([1, [2], [3, [[4]]]]);\n * // => [1, 2, 3, 4];\n *\n * _.flatten([1, [2], [3, [[4]]]], true);\n * // => [1, 2, 3, [[4]]];\n *\n * var characters = [\n * { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },\n * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.flatten(characters, 'pets');\n * // => ['hoppy', 'baby puss', 'dino']\n */\n function flatten(array, isShallow) {\n return baseFlatten(array, isShallow);\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found using\n * strict equality for comparisons, i.e. `===`. If the array is already sorted\n * providing `true` for `fromIndex` will run a faster binary search.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {boolean|number} [fromIndex=0] The index to search from or `true`\n * to perform a binary search on a sorted array.\n * @returns {number} Returns the index of the matched value or `-1`.\n * @example\n *\n * _.indexOf([1, 2, 3, 1, 2, 3], 2);\n * // => 1\n *\n * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);\n * // => 4\n *\n * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);\n * // => 2\n */\n function indexOf(array, value, fromIndex) {\n if (typeof fromIndex == 'number') {\n var length = array ? array.length : 0;\n fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);\n } else if (fromIndex) {\n var index = sortedIndex(array, value);\n return array[index] === value ? index : -1;\n }\n return baseIndexOf(array, value, fromIndex);\n }\n\n /**\n * Gets all but the last element or last `n` elements of an array. If a\n * callback is provided elements at the end of the array are excluded from\n * the result as long as the callback returns truey. The callback is bound\n * to `thisArg` and invoked with three arguments; (value, index, array).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to query.\n * @param {Function|Object|number|string} [callback=1] The function called\n * per element or the number of elements to exclude. If a property name or\n * object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n * style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n *\n * _.initial([1, 2, 3], 2);\n * // => [1]\n *\n * _.initial([1, 2, 3], function(num) {\n * return num > 1;\n * });\n * // => [1]\n *\n * var characters = [\n * { 'name': 'barney', 'blocked': false, 'employer': 'slate' },\n * { 'name': 'fred', 'blocked': true, 'employer': 'slate' },\n * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.initial(characters, 'blocked');\n * // => [{ 'name': 'barney', 'blocked': false, 'employer': 'slate' }]\n *\n * // using \"_.where\" callback shorthand\n * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name');\n * // => ['barney', 'fred']\n */\n function initial(array, callback, thisArg) {\n var n = 0,\n length = array ? array.length : 0;\n\n if (typeof callback != 'number' && callback != null) {\n var index = length;\n callback = createCallback(callback, thisArg, 3);\n while (index-- && callback(array[index], index, array)) {\n n++;\n }\n } else {\n n = (callback == null || thisArg) ? 1 : callback || n;\n }\n return slice(array, 0, nativeMin(nativeMax(0, length - n), length));\n }\n\n /**\n * Creates an array of unique values present in all provided arrays using\n * strict equality for comparisons, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {...Array} [array] The arrays to inspect.\n * @returns {Array} Returns an array of shared values.\n * @example\n *\n * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);\n * // => [1, 2]\n */\n function intersection() {\n var args = [],\n argsIndex = -1,\n argsLength = arguments.length;\n\n while (++argsIndex < argsLength) {\n var value = arguments[argsIndex];\n if (isArray(value) || isArguments(value)) {\n args.push(value);\n }\n }\n var array = args[0],\n index = -1,\n indexOf = getIndexOf(),\n length = array ? array.length : 0,\n result = [];\n\n outer:\n while (++index < length) {\n value = array[index];\n if (indexOf(result, value) < 0) {\n var argsIndex = argsLength;\n while (--argsIndex) {\n if (indexOf(args[argsIndex], value) < 0) {\n continue outer;\n }\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * Gets the last element or last `n` elements of an array. If a callback is\n * provided elements at the end of the array are returned as long as the\n * callback returns truey. The callback is bound to `thisArg` and invoked\n * with three arguments; (value, index, array).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to query.\n * @param {Function|Object|number|string} [callback] The function called\n * per element or the number of elements to return. If a property name or\n * object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n * style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {*} Returns the last element(s) of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n *\n * _.last([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.last([1, 2, 3], function(num) {\n * return num > 1;\n * });\n * // => [2, 3]\n *\n * var characters = [\n * { 'name': 'barney', 'blocked': false, 'employer': 'slate' },\n * { 'name': 'fred', 'blocked': true, 'employer': 'slate' },\n * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.pluck(_.last(characters, 'blocked'), 'name');\n * // => ['fred', 'pebbles']\n *\n * // using \"_.where\" callback shorthand\n * _.last(characters, { 'employer': 'na' });\n * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]\n */\n function last(array, callback, thisArg) {\n var n = 0,\n length = array ? array.length : 0;\n\n if (typeof callback != 'number' && callback != null) {\n var index = length;\n callback = createCallback(callback, thisArg, 3);\n while (index-- && callback(array[index], index, array)) {\n n++;\n }\n } else {\n n = callback;\n if (n == null || thisArg) {\n return array ? array[length - 1] : undefined;\n }\n }\n return slice(array, nativeMax(0, length - n));\n }\n\n /**\n * Gets the index at which the last occurrence of `value` is found using strict\n * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used\n * as the offset from the end of the collection.\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the matched value or `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);\n * // => 4\n *\n * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);\n * // => 1\n */\n function lastIndexOf(array, value, fromIndex) {\n var index = array ? array.length : 0;\n if (typeof fromIndex == 'number') {\n index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;\n }\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to but not including `end`. If `start` is less than `stop` a\n * zero-length range is created unless a negative `step` is specified.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns a new range array.\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\n function range(start, end, step) {\n start = +start || 0;\n step = (+step || 1);\n\n if (end == null) {\n end = start;\n start = 0;\n }\n // use `Array(length)` so engines like Chakra and V8 avoid slower modes\n // http://youtu.be/XAqIpGU8ZZk#t=17m25s\n var index = -1,\n length = nativeMax(0, ceil((end - start) / step)),\n result = Array(length);\n\n while (++index < length) {\n result[index] = start;\n start += step;\n }\n return result;\n }\n\n /**\n * The opposite of `_.initial` this method gets all but the first element or\n * first `n` elements of an array. If a callback function is provided elements\n * at the beginning of the array are excluded from the result as long as the\n * callback returns truey. The callback is bound to `thisArg` and invoked\n * with three arguments; (value, index, array).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias drop, tail\n * @category Arrays\n * @param {Array} array The array to query.\n * @param {Function|Object|number|string} [callback=1] The function called\n * per element or the number of elements to exclude. If a property name or\n * object is provided it will be used to create a \"_.pluck\" or \"_.where\"\n * style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a slice of `array`.\n * @example\n *\n * _.rest([1, 2, 3]);\n * // => [2, 3]\n *\n * _.rest([1, 2, 3], 2);\n * // => [3]\n *\n * _.rest([1, 2, 3], function(num) {\n * return num < 3;\n * });\n * // => [3]\n *\n * var characters = [\n * { 'name': 'barney', 'blocked': true, 'employer': 'slate' },\n * { 'name': 'fred', 'blocked': false, 'employer': 'slate' },\n * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }\n * ];\n *\n * // using \"_.pluck\" callback shorthand\n * _.pluck(_.rest(characters, 'blocked'), 'name');\n * // => ['fred', 'pebbles']\n *\n * // using \"_.where\" callback shorthand\n * _.rest(characters, { 'employer': 'slate' });\n * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]\n */\n function rest(array, callback, thisArg) {\n if (typeof callback != 'number' && callback != null) {\n var n = 0,\n index = -1,\n length = array ? array.length : 0;\n\n callback = createCallback(callback, thisArg, 3);\n while (++index < length && callback(array[index], index, array)) {\n n++;\n }\n } else {\n n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);\n }\n return slice(array, n);\n }\n\n /**\n * Uses a binary search to determine the smallest index at which a value\n * should be inserted into a given sorted array in order to maintain the sort\n * order of the array. If a callback is provided it will be executed for\n * `value` and each element of `array` to compute their sort ranking. The\n * callback is bound to `thisArg` and invoked with one argument; (value).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([20, 30, 50], 40);\n * // => 2\n *\n * // using \"_.pluck\" callback shorthand\n * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');\n * // => 2\n *\n * var dict = {\n * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }\n * };\n *\n * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {\n * return dict.wordToNumber[word];\n * });\n * // => 2\n *\n * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {\n * return this.wordToNumber[word];\n * }, dict);\n * // => 2\n */\n function sortedIndex(array, value, callback, thisArg) {\n var low = 0,\n high = array ? array.length : low;\n\n // explicitly reference `identity` for better inlining in Firefox\n callback = callback ? createCallback(callback, thisArg, 1) : identity;\n value = callback(value);\n\n while (low < high) {\n var mid = (low + high) >>> 1;\n (callback(array[mid]) < value)\n ? low = mid + 1\n : high = mid;\n }\n return low;\n }\n\n /**\n * Creates an array of unique values, in order, of the provided arrays using\n * strict equality for comparisons, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {...Array} [array] The arrays to inspect.\n * @returns {Array} Returns an array of combined values.\n * @example\n *\n * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);\n * // => [1, 2, 3, 5, 4]\n */\n function union() {\n return baseUniq(baseFlatten(arguments, true, true));\n }\n\n /**\n * Creates a duplicate-value-free version of an array using strict equality\n * for comparisons, i.e. `===`. If the array is sorted, providing\n * `true` for `isSorted` will use a faster algorithm. If a callback is provided\n * each element of `array` is passed through the callback before uniqueness\n * is computed. The callback is bound to `thisArg` and invoked with three\n * arguments; (value, index, array).\n *\n * If a property name is provided for `callback` the created \"_.pluck\" style\n * callback will return the property value of the given element.\n *\n * If an object is provided for `callback` the created \"_.where\" style callback\n * will return `true` for elements that have the properties of the given object,\n * else `false`.\n *\n * @static\n * @memberOf _\n * @alias unique\n * @category Arrays\n * @param {Array} array The array to process.\n * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.\n * @param {Function|Object|string} [callback=identity] The function called\n * per iteration. If a property name or object is provided it will be used\n * to create a \"_.pluck\" or \"_.where\" style callback, respectively.\n * @param {*} [thisArg] The `this` binding of `callback`.\n * @returns {Array} Returns a duplicate-value-free array.\n * @example\n *\n * _.uniq([1, 2, 1, 3, 1]);\n * // => [1, 2, 3]\n *\n * _.uniq([1, 1, 2, 2, 3], true);\n * // => [1, 2, 3]\n *\n * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });\n * // => ['A', 'b', 'C']\n *\n * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);\n * // => [1, 2.5, 3]\n *\n * // using \"_.pluck\" callback shorthand\n * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniq(array, isSorted, callback, thisArg) {\n // juggle arguments\n if (typeof isSorted != 'boolean' && isSorted != null) {\n thisArg = callback;\n callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;\n isSorted = false;\n }\n if (callback != null) {\n callback = createCallback(callback, thisArg, 3);\n }\n return baseUniq(array, isSorted, callback);\n }\n\n /**\n * Creates an array excluding all provided values using strict equality for\n * comparisons, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @category Arrays\n * @param {Array} array The array to filter.\n * @param {...*} [value] The values to exclude.\n * @returns {Array} Returns a new array of filtered values.\n * @example\n *\n * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);\n * // => [2, 3, 4]\n */\n function without(array) {\n return baseDifference(array, slice(arguments, 1));\n }\n\n /**\n * Creates an array of grouped elements, the first of which contains the first\n * elements of the given arrays, the second of which contains the second\n * elements of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @alias unzip\n * @category Arrays\n * @param {...Array} [array] Arrays to process.\n * @returns {Array} Returns a new array of grouped elements.\n * @example\n *\n * _.zip(['fred', 'barney'], [30, 40], [true, false]);\n * // => [['fred', 30, true], ['barney', 40, false]]\n */\n function zip() {\n var index = -1,\n length = max(pluck(arguments, 'length')),\n result = Array(length < 0 ? 0 : length);\n\n while (++index < length) {\n result[index] = pluck(arguments, index);\n }\n return result;\n }\n\n /**\n * Creates an object composed from arrays of `keys` and `values`. Provide\n * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`\n * or two arrays, one of `keys` and one of corresponding `values`.\n *\n * @static\n * @memberOf _\n * @alias object\n * @category Arrays\n * @param {Array} keys The array of keys.\n * @param {Array} [values=[]] The array of values.\n * @returns {Object} Returns an object composed of the given keys and\n * corresponding values.\n * @example\n *\n * _.zipObject(['fred', 'barney'], [30, 40]);\n * // => { 'fred': 30, 'barney': 40 }\n */\n function zipObject(keys, values) {\n var index = -1,\n length = keys ? keys.length : 0,\n result = {};\n\n if (!values && length && !isArray(keys[0])) {\n values = [];\n }\n while (++index < length) {\n var key = keys[index];\n if (values) {\n result[key] = values[index];\n } else if (key) {\n result[key[0]] = key[1];\n }\n }\n return result;\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Creates a function that executes `func`, with the `this` binding and\n * arguments of the created function, only after being called `n` times.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {number} n The number of times the function must be called before\n * `func` is executed.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('Done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => logs 'Done saving!', after all saves have completed\n */\n function after(n, func) {\n if (!isFunction(func)) {\n throw new TypeError;\n }\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that, when called, invokes `func` with the `this`\n * binding of `thisArg` and prepends any additional `bind` arguments to those\n * provided to the bound function.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to bind.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {...*} [arg] Arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var func = function(greeting) {\n * return greeting + ' ' + this.name;\n * };\n *\n * func = _.bind(func, { 'name': 'fred' }, 'hi');\n * func();\n * // => 'hi fred'\n */\n function bind(func, thisArg) {\n return arguments.length > 2\n ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)\n : createWrapper(func, 1, null, null, thisArg);\n }\n\n /**\n * Binds methods of an object to the object itself, overwriting the existing\n * method. Method names may be specified as individual arguments or as arrays\n * of method names. If no method names are provided all the function properties\n * of `object` will be bound.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Object} object The object to bind and assign the bound methods to.\n * @param {...string} [methodName] The object method names to\n * bind, specified as individual method names or arrays of method names.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var view = {\n * 'label': 'docs',\n * 'onClick': function() { console.log('clicked ' + this.label); }\n * };\n *\n * _.bindAll(view);\n * jQuery('#docs').on('click', view.onClick);\n * // => logs 'clicked docs', when the button is clicked\n */\n function bindAll(object) {\n var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),\n index = -1,\n length = funcs.length;\n\n while (++index < length) {\n var key = funcs[index];\n object[key] = createWrapper(object[key], 1, null, null, object);\n }\n return object;\n }\n\n /**\n * Creates a function that is the composition of the provided functions,\n * where each function consumes the return value of the function that follows.\n * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.\n * Each function is executed with the `this` binding of the composed function.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {...Function} [func] Functions to compose.\n * @returns {Function} Returns the new composed function.\n * @example\n *\n * var realNameMap = {\n * 'pebbles': 'penelope'\n * };\n *\n * var format = function(name) {\n * name = realNameMap[name.toLowerCase()] || name;\n * return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();\n * };\n *\n * var greet = function(formatted) {\n * return 'Hiya ' + formatted + '!';\n * };\n *\n * var welcome = _.compose(greet, format);\n * welcome('pebbles');\n * // => 'Hiya Penelope!'\n */\n function compose() {\n var funcs = arguments,\n length = funcs.length;\n\n while (length--) {\n if (!isFunction(funcs[length])) {\n throw new TypeError;\n }\n }\n return function() {\n var args = arguments,\n length = funcs.length;\n\n while (length--) {\n args = [funcs[length].apply(this, args)];\n }\n return args[0];\n };\n }\n\n /**\n * Creates a function that will delay the execution of `func` until after\n * `wait` milliseconds have elapsed since the last time it was invoked.\n * Provide an options object to indicate that `func` should be invoked on\n * the leading and/or trailing edge of the `wait` timeout. Subsequent calls\n * to the debounced function will return the result of the last `func` call.\n *\n * Note: If `leading` and `trailing` options are `true` `func` will be called\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to debounce.\n * @param {number} wait The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called.\n * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // avoid costly calculations while the window size is in flux\n * var lazyLayout = _.debounce(calculateLayout, 150);\n * jQuery(window).on('resize', lazyLayout);\n *\n * // execute `sendMail` when the click event is fired, debouncing subsequent calls\n * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * });\n *\n * // ensure `batchLog` is executed once after 1 second of debounced calls\n * var source = new EventSource('/stream');\n * source.addEventListener('message', _.debounce(batchLog, 250, {\n * 'maxWait': 1000\n * }, false);\n */\n function debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n maxWait = false,\n trailing = true;\n\n if (!isFunction(func)) {\n throw new TypeError;\n }\n wait = nativeMax(0, wait) || 0;\n if (options === true) {\n var leading = true;\n trailing = false;\n } else if (isObject(options)) {\n leading = options.leading;\n maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);\n trailing = 'trailing' in options ? options.trailing : trailing;\n }\n var delayed = function() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0) {\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n var isCalled = trailingCall;\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = null;\n }\n }\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n };\n\n var maxDelayed = function() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (trailing || (maxWait !== wait)) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = null;\n }\n }\n };\n\n return function() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = null;\n }\n return result;\n };\n }\n\n /**\n * Defers executing the `func` function until the current call stack has cleared.\n * Additional arguments will be provided to `func` when it is invoked.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to defer.\n * @param {...*} [arg] Arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) { console.log(text); }, 'deferred');\n * // logs 'deferred' after one or more milliseconds\n */\n function defer(func) {\n if (!isFunction(func)) {\n throw new TypeError;\n }\n var args = slice(arguments, 1);\n return setTimeout(function() { func.apply(undefined, args); }, 1);\n }\n\n /**\n * Executes the `func` function after `wait` milliseconds. Additional arguments\n * will be provided to `func` when it is invoked.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay execution.\n * @param {...*} [arg] Arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) { console.log(text); }, 1000, 'later');\n * // => logs 'later' after one second\n */\n function delay(func, wait) {\n if (!isFunction(func)) {\n throw new TypeError;\n }\n var args = slice(arguments, 2);\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided it will be used to determine the cache key for storing the result\n * based on the arguments provided to the memoized function. By default, the\n * first argument provided to the memoized function is used as the cache key.\n * The `func` is executed with the `this` binding of the memoized function.\n * The result cache is exposed as the `cache` property on the memoized function.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] A function used to resolve the cache key.\n * @returns {Function} Returns the new memoizing function.\n * @example\n *\n * var fibonacci = _.memoize(function(n) {\n * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);\n * });\n *\n * fibonacci(9)\n * // => 34\n *\n * var data = {\n * 'fred': { 'name': 'fred', 'age': 40 },\n * 'pebbles': { 'name': 'pebbles', 'age': 1 }\n * };\n *\n * // modifying the result cache\n * var get = _.memoize(function(name) { return data[name]; }, _.identity);\n * get('pebbles');\n * // => { 'name': 'pebbles', 'age': 1 }\n *\n * get.cache.pebbles.name = 'penelope';\n * get('pebbles');\n * // => { 'name': 'penelope', 'age': 1 }\n */\n function memoize(func, resolver) {\n var cache = {};\n return function() {\n var key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];\n return hasOwnProperty.call(cache, key)\n ? cache[key]\n : (cache[key] = func.apply(this, arguments));\n };\n }\n\n /**\n * Creates a function that is restricted to execute `func` once. Repeat calls to\n * the function will return the value of the first call. The `func` is executed\n * with the `this` binding of the created function.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // `initialize` executes `createApplication` once\n */\n function once(func) {\n var ran,\n result;\n\n if (!isFunction(func)) {\n throw new TypeError;\n }\n return function() {\n if (ran) {\n return result;\n }\n ran = true;\n result = func.apply(this, arguments);\n\n // clear the `func` variable so the function may be garbage collected\n func = null;\n return result;\n };\n }\n\n /**\n * Creates a function that, when called, invokes `func` with any additional\n * `partial` arguments prepended to those provided to the new function. This\n * method is similar to `_.bind` except it does **not** alter the `this` binding.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [arg] Arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * var greet = function(greeting, name) { return greeting + ' ' + name; };\n * var hi = _.partial(greet, 'hi');\n * hi('fred');\n * // => 'hi fred'\n */\n function partial(func) {\n return createWrapper(func, 16, slice(arguments, 1));\n }\n\n /**\n * Creates a function that, when executed, will only call the `func` function\n * at most once per every `wait` milliseconds. Provide an options object to\n * indicate that `func` should be invoked on the leading and/or trailing edge\n * of the `wait` timeout. Subsequent calls to the throttled function will\n * return the result of the last `func` call.\n *\n * Note: If `leading` and `trailing` options are `true` `func` will be called\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {Function} func The function to throttle.\n * @param {number} wait The number of milliseconds to throttle executions to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * var throttled = _.throttle(updatePosition, 100);\n * jQuery(window).on('scroll', throttled);\n *\n * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes\n * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {\n * 'trailing': false\n * }));\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (!isFunction(func)) {\n throw new TypeError;\n }\n if (options === false) {\n leading = false;\n } else if (isObject(options)) {\n leading = 'leading' in options ? options.leading : leading;\n trailing = 'trailing' in options ? options.trailing : trailing;\n }\n options = {};\n options.leading = leading;\n options.maxWait = wait;\n options.trailing = trailing;\n\n return debounce(func, wait, options);\n }\n\n /**\n * Creates a function that provides `value` to the wrapper function as its\n * first argument. Additional arguments provided to the function are appended\n * to those provided to the wrapper function. The wrapper is executed with\n * the `this` binding of the created function.\n *\n * @static\n * @memberOf _\n * @category Functions\n * @param {*} value The value to wrap.\n * @param {Function} wrapper The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '' + func(text) + '
';\n * });\n *\n * p('Fred, Wilma, & Pebbles');\n * // => 'Fred, Wilma, & Pebbles
'\n */\n function wrap(value, wrapper) {\n return createWrapper(wrapper, 16, [value]);\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Produces a callback bound to an optional `thisArg`. If `func` is a property\n * name the created callback will return the property value for a given element.\n * If `func` is an object the created callback will return `true` for elements\n * that contain the equivalent object properties, otherwise it will return `false`.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {*} [func=identity] The value to convert to a callback.\n * @param {*} [thisArg] The `this` binding of the created callback.\n * @param {number} [argCount] The number of arguments the callback accepts.\n * @returns {Function} Returns a callback function.\n * @example\n *\n * var characters = [\n * { 'name': 'barney', 'age': 36 },\n * { 'name': 'fred', 'age': 40 }\n * ];\n *\n * // wrap to create custom callback shorthands\n * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {\n * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);\n * return !match ? func(callback, thisArg) : function(object) {\n * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];\n * };\n * });\n *\n * _.filter(characters, 'age__gt38');\n * // => [{ 'name': 'fred', 'age': 40 }]\n */\n function createCallback(func, thisArg, argCount) {\n var type = typeof func;\n if (func == null || type == 'function') {\n return baseCreateCallback(func, thisArg, argCount);\n }\n // handle \"_.pluck\" style callback shorthands\n if (type != 'object') {\n return property(func);\n }\n var props = keys(func);\n return function(object) {\n var length = props.length,\n result = false;\n\n while (length--) {\n if (!(result = object[props[length]] === func[props[length]])) {\n break;\n }\n }\n return result;\n };\n }\n\n /**\n * Converts the characters `&`, `<`, `>`, `\"`, and `'` in `string` to their\n * corresponding HTML entities.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {string} string The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('Fred, Wilma, & Pebbles');\n * // => 'Fred, Wilma, & Pebbles'\n */\n function escape(string) {\n return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);\n }\n\n /**\n * This method returns the first argument provided to it.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'name': 'fred' };\n * _.identity(object) === object;\n * // => true\n */\n function identity(value) {\n return value;\n }\n\n /**\n * Adds function properties of a source object to the destination object.\n * If `object` is a function methods will be added to its prototype as well.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {Function|Object} [object=lodash] object The destination object.\n * @param {Object} source The object of functions to add.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.chain=true] Specify whether the functions added are chainable.\n * @example\n *\n * function capitalize(string) {\n * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();\n * }\n *\n * _.mixin({ 'capitalize': capitalize });\n * _.capitalize('fred');\n * // => 'Fred'\n *\n * _('fred').capitalize().value();\n * // => 'Fred'\n *\n * _.mixin({ 'capitalize': capitalize }, { 'chain': false });\n * _('fred').capitalize();\n * // => 'Fred'\n */\n function mixin(object) {\n forEach(functions(object), function(methodName) {\n var func = lodash[methodName] = object[methodName];\n\n lodash.prototype[methodName] = function() {\n var args = [this.__wrapped__];\n push.apply(args, arguments);\n\n var result = func.apply(lodash, args);\n return this.__chain__\n ? new lodashWrapper(result, true)\n : result;\n };\n });\n }\n\n /**\n * Reverts the '_' variable to its previous value and returns a reference to\n * the `lodash` function.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @returns {Function} Returns the `lodash` function.\n * @example\n *\n * var lodash = _.noConflict();\n */\n function noConflict() {\n root._ = oldDash;\n return this;\n }\n\n /**\n * A no-operation function.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @example\n *\n * var object = { 'name': 'fred' };\n * _.noop(object) === undefined;\n * // => true\n */\n function noop() {\n // no operation performed\n }\n\n /**\n * Gets the number of milliseconds that have elapsed since the Unix epoch\n * (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @example\n *\n * var stamp = _.now();\n * _.defer(function() { console.log(_.now() - stamp); });\n * // => logs the number of milliseconds it took for the deferred function to be called\n */\n var now = isNative(now = Date.now) && now || function() {\n return new Date().getTime();\n };\n\n /**\n * Creates a \"_.pluck\" style function, which returns the `key` value of a\n * given object.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {string} key The name of the property to retrieve.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var characters = [\n * { 'name': 'fred', 'age': 40 },\n * { 'name': 'barney', 'age': 36 }\n * ];\n *\n * var getName = _.property('name');\n *\n * _.map(characters, getName);\n * // => ['barney', 'fred']\n *\n * _.sortBy(characters, getName);\n * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }]\n */\n function property(key) {\n return function(object) {\n return object[key];\n };\n }\n\n /**\n * Produces a random number between `min` and `max` (inclusive). If only one\n * argument is provided a number between `0` and the given number will be\n * returned. If `floating` is truey or either `min` or `max` are floats a\n * floating-point number will be returned instead of an integer.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {number} [min=0] The minimum possible value.\n * @param {number} [max=1] The maximum possible value.\n * @param {boolean} [floating=false] Specify returning a floating-point number.\n * @returns {number} Returns a random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(min, max) {\n if (min == null && max == null) {\n max = 1;\n }\n min = +min || 0;\n if (max == null) {\n max = min;\n min = 0;\n } else {\n max = +max || 0;\n }\n return min + floor(nativeRandom() * (max - min + 1));\n }\n\n /**\n * Resolves the value of property `key` on `object`. If `key` is a function\n * it will be invoked with the `this` binding of `object` and its result returned,\n * else the property value is returned. If `object` is falsey then `undefined`\n * is returned.\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {Object} object The object to inspect.\n * @param {string} key The name of the property to resolve.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = {\n * 'cheese': 'crumpets',\n * 'stuff': function() {\n * return 'nonsense';\n * }\n * };\n *\n * _.result(object, 'cheese');\n * // => 'crumpets'\n *\n * _.result(object, 'stuff');\n * // => 'nonsense'\n */\n function result(object, key) {\n if (object) {\n var value = object[key];\n return isFunction(value) ? object[key]() : value;\n }\n }\n\n /**\n * A micro-templating method that handles arbitrary delimiters, preserves\n * whitespace, and correctly escapes quotes within interpolated code.\n *\n * Note: In the development build, `_.template` utilizes sourceURLs for easier\n * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl\n *\n * For more information on precompiling templates see:\n * http://lodash.com/custom-builds\n *\n * For more information on Chrome extension sandboxes see:\n * http://developer.chrome.com/stable/extensions/sandboxingEval.html\n *\n * @static\n * @memberOf _\n * @category Utilities\n * @param {string} text The template text.\n * @param {Object} data The data object used to populate the text.\n * @param {Object} [options] The options object.\n * @param {RegExp} [options.escape] The \"escape\" delimiter.\n * @param {RegExp} [options.evaluate] The \"evaluate\" delimiter.\n * @param {Object} [options.imports] An object to import into the template as local variables.\n * @param {RegExp} [options.interpolate] The \"interpolate\" delimiter.\n * @param {string} [sourceURL] The sourceURL of the template's compiled source.\n * @param {string} [variable] The data object variable name.\n * @returns {Function|string} Returns a compiled function when no `data` object\n * is given, else it returns the interpolated text.\n * @example\n *\n * // using the \"interpolate\" delimiter to create a compiled template\n * var compiled = _.template('hello <%= name %>');\n * compiled({ 'name': 'fred' });\n * // => 'hello fred'\n *\n * // using the \"escape\" delimiter to escape HTML in data property values\n * _.template('<%- value %>', { 'value': '