UNPKG

mini-program-cljs

Version:

1 lines 48.2 kB
["^ ","~:resource-id",["~:shadow.build.classpath/resource","goog/functions/functions.js"],"~:js","goog.provide(\"goog.functions\");\n/**\n * @param {T} retValue\n * @return {function():T}\n * @template T\n */\ngoog.functions.constant = function(retValue) {\n return function() {\n return retValue;\n };\n};\n/** @type {function(...):boolean} */ goog.functions.FALSE = function() {\n return false;\n};\n/** @type {function(...):boolean} */ goog.functions.TRUE = function() {\n return true;\n};\n/** @type {function(...):null} */ goog.functions.NULL = function() {\n return null;\n};\n/**\n * @param {T=} opt_returnValue\n * @param {...*} var_args\n * @return {T}\n * @template T\n */\ngoog.functions.identity = function(opt_returnValue, var_args) {\n return opt_returnValue;\n};\n/**\n * @param {string} message\n * @return {!Function}\n */\ngoog.functions.error = function(message) {\n return function() {\n throw new Error(message);\n };\n};\n/**\n * @param {*} err\n * @return {!Function}\n */\ngoog.functions.fail = function(err) {\n return function() {\n throw err;\n };\n};\n/**\n * @param {Function} f\n * @param {number=} opt_numArgs\n * @return {!Function}\n */\ngoog.functions.lock = function(f, opt_numArgs) {\n opt_numArgs = opt_numArgs || 0;\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));\n };\n};\n/**\n * @param {number} n\n * @return {!Function}\n */\ngoog.functions.nth = function(n) {\n return function() {\n return arguments[n];\n };\n};\n/**\n * @param {!Function} fn\n * @param {...*} var_args\n * @return {!Function}\n */\ngoog.functions.partialRight = function(fn, var_args) {\n /** @const */ var rightArgs = Array.prototype.slice.call(arguments, 1);\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n /** @const */ var newArgs = Array.prototype.slice.call(arguments);\n newArgs.push.apply(newArgs, rightArgs);\n return fn.apply(self, newArgs);\n };\n};\n/**\n * @param {Function} f\n * @param {T} retValue\n * @return {function(...?):T}\n * @template T\n */\ngoog.functions.withReturnValue = function(f, retValue) {\n return goog.functions.sequence(f, goog.functions.constant(retValue));\n};\n/**\n * @param {*} value\n * @param {boolean=} opt_useLooseComparison\n * @return {function(*):boolean}\n */\ngoog.functions.equalTo = function(value, opt_useLooseComparison) {\n return function(other) {\n return opt_useLooseComparison ? value == other : value === other;\n };\n};\n/**\n * @param {function(...?):T} fn\n * @param {...Function} var_args\n * @return {function(...?):T}\n * @template T\n */\ngoog.functions.compose = function(fn, var_args) {\n /** @const */ var functions = arguments;\n /** @const */ var length = functions.length;\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n var result;\n if (length) {\n result = functions[length - 1].apply(self, arguments);\n }\n for (var i = length - 2; i >= 0; i--) {\n result = functions[i].call(self, result);\n }\n return result;\n };\n};\n/**\n * @param {...Function} var_args\n * @return {!Function}\n */\ngoog.functions.sequence = function(var_args) {\n /** @const */ var functions = arguments;\n /** @const */ var length = functions.length;\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n var result;\n for (var i = 0; i < length; i++) {\n result = functions[i].apply(self, arguments);\n }\n return result;\n };\n};\n/**\n * @param {...Function} var_args\n * @return {function(...?):boolean}\n */\ngoog.functions.and = function(var_args) {\n /** @const */ var functions = arguments;\n /** @const */ var length = functions.length;\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n for (var i = 0; i < length; i++) {\n if (!functions[i].apply(self, arguments)) {\n return false;\n }\n }\n return true;\n };\n};\n/**\n * @param {...Function} var_args\n * @return {function(...?):boolean}\n */\ngoog.functions.or = function(var_args) {\n /** @const */ var functions = arguments;\n /** @const */ var length = functions.length;\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n for (var i = 0; i < length; i++) {\n if (functions[i].apply(self, arguments)) {\n return true;\n }\n }\n return false;\n };\n};\n/**\n * @param {!Function} f\n * @return {function(...?):boolean}\n */\ngoog.functions.not = function(f) {\n return function() {\n /** @const */ var self = /** @type {*} */ (this);\n return !f.apply(self, arguments);\n };\n};\n/**\n * @param {function(new:T,...)} constructor\n * @param {...*} var_args\n * @return {T}\n * @template T\n */\ngoog.functions.create = function(constructor, var_args) {\n /** @const @final @constructor */ var temp = function() {\n };\n temp.prototype = constructor.prototype;\n /** @const */ var obj = new temp;\n constructor.apply(obj, Array.prototype.slice.call(arguments, 1));\n return obj;\n};\n/** @define {boolean} */ goog.functions.CACHE_RETURN_VALUE = goog.define(\"goog.functions.CACHE_RETURN_VALUE\", true);\n/**\n * @param {function():T} fn\n * @return {function():T}\n * @template T\n */\ngoog.functions.cacheReturnValue = function(fn) {\n var called = false;\n var value;\n return function() {\n if (!goog.functions.CACHE_RETURN_VALUE) {\n return fn();\n }\n if (!called) {\n value = fn();\n called = true;\n }\n return value;\n };\n};\n/**\n * @param {function():*} f\n * @return {function():undefined}\n */\ngoog.functions.once = function(f) {\n var inner = f;\n return function() {\n if (inner) {\n /** @const */ var tmp = inner;\n inner = null;\n tmp();\n }\n };\n};\n/**\n * @param {function(this:SCOPE,...?)} f\n * @param {number} interval\n * @param {SCOPE=} opt_scope\n * @return {function(...?):undefined}\n * @template SCOPE\n */\ngoog.functions.debounce = function(f, interval, opt_scope) {\n var timeout = 0;\n return (/** @type {function(...?)} */ (function(var_args) {\n goog.global.clearTimeout(timeout);\n /** @const */ var args = arguments;\n timeout = goog.global.setTimeout(function() {\n f.apply(opt_scope, args);\n }, interval);\n }));\n};\n/**\n * @param {function(this:SCOPE,...?)} f\n * @param {number} interval\n * @param {SCOPE=} opt_scope\n * @return {function(...?):undefined}\n * @template SCOPE\n */\ngoog.functions.throttle = function(f, interval, opt_scope) {\n var timeout = 0;\n var shouldFire = false;\n var args = [];\n /** @const */ var handleTimeout = function() {\n timeout = 0;\n if (shouldFire) {\n shouldFire = false;\n fire();\n }\n };\n /** @const */ var fire = function() {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n f.apply(opt_scope, args);\n };\n return (/** @type {function(...?)} */ (function(var_args) {\n args = arguments;\n if (!timeout) {\n fire();\n } else {\n shouldFire = true;\n }\n }));\n};\n/**\n * @param {function(this:SCOPE,...?)} f\n * @param {number} interval\n * @param {SCOPE=} opt_scope\n * @return {function(...?):undefined}\n * @template SCOPE\n */\ngoog.functions.rateLimit = function(f, interval, opt_scope) {\n var timeout = 0;\n /** @const */ var handleTimeout = function() {\n timeout = 0;\n };\n return (/** @type {function(...?)} */ (function(var_args) {\n if (!timeout) {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n f.apply(opt_scope, arguments);\n }\n }));\n};\n","~:source","// Copyright 2008 The Closure Library Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @fileoverview Utilities for creating functions. Loosely inspired by these\n * java classes from the Guava library:\n * com.google.common.base.Functions\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Functions.html\n *\n * com.google.common.base.Predicates\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Predicates.html\n *\n * More about these can be found at\n * https://github.com/google/guava/wiki/FunctionalExplained\n *\n * @author nicksantos@google.com (Nick Santos)\n */\n\n\ngoog.provide('goog.functions');\n\n\n/**\n * Creates a function that always returns the same value.\n * @param {T} retValue The value to return.\n * @return {function():T} The new function.\n * @template T\n */\ngoog.functions.constant = function(retValue) {\n return function() { return retValue; };\n};\n\n\n/**\n * Always returns false.\n * @type {function(...): boolean}\n */\ngoog.functions.FALSE = function() {\n return false;\n};\n\n\n/**\n * Always returns true.\n * @type {function(...): boolean}\n */\ngoog.functions.TRUE = function() {\n return true;\n};\n\n\n/**\n * Always returns NULL.\n * @type {function(...): null}\n */\ngoog.functions.NULL = function() {\n return null;\n};\n\n\n/**\n * A simple function that returns the first argument of whatever is passed\n * into it.\n * @param {T=} opt_returnValue The single value that will be returned.\n * @param {...*} var_args Optional trailing arguments. These are ignored.\n * @return {T} The first argument passed in, or undefined if nothing was passed.\n * @template T\n */\ngoog.functions.identity = function(opt_returnValue, var_args) {\n return opt_returnValue;\n};\n\n\n/**\n * Creates a function that always throws an error with the given message.\n * @param {string} message The error message.\n * @return {!Function} The error-throwing function.\n */\ngoog.functions.error = function(message) {\n return function() {\n throw new Error(message);\n };\n};\n\n\n/**\n * Creates a function that throws the given object.\n * @param {*} err An object to be thrown.\n * @return {!Function} The error-throwing function.\n */\ngoog.functions.fail = function(err) {\n return function() { throw err; };\n};\n\n\n/**\n * Given a function, create a function that keeps opt_numArgs arguments and\n * silently discards all additional arguments.\n * @param {Function} f The original function.\n * @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0.\n * @return {!Function} A version of f that only keeps the first opt_numArgs\n * arguments.\n */\ngoog.functions.lock = function(f, opt_numArgs) {\n opt_numArgs = opt_numArgs || 0;\n return function() {\n const self = /** @type {*} */ (this);\n return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));\n };\n};\n\n\n/**\n * Creates a function that returns its nth argument.\n * @param {number} n The position of the return argument.\n * @return {!Function} A new function.\n */\ngoog.functions.nth = function(n) {\n return function() { return arguments[n]; };\n};\n\n\n/**\n * Like goog.partial(), except that arguments are added after arguments to the\n * returned function.\n *\n * Usage:\n * function f(arg1, arg2, arg3, arg4) { ... }\n * var g = goog.functions.partialRight(f, arg3, arg4);\n * g(arg1, arg2);\n *\n * @param {!Function} fn A function to partially apply.\n * @param {...*} var_args Additional arguments that are partially applied to fn\n * at the end.\n * @return {!Function} A partially-applied form of the function goog.partial()\n * was invoked as a method of.\n */\ngoog.functions.partialRight = function(fn, var_args) {\n const rightArgs = Array.prototype.slice.call(arguments, 1);\n return function() {\n const self = /** @type {*} */ (this);\n const newArgs = Array.prototype.slice.call(arguments);\n newArgs.push.apply(newArgs, rightArgs);\n return fn.apply(self, newArgs);\n };\n};\n\n\n/**\n * Given a function, create a new function that swallows its return value\n * and replaces it with a new one.\n * @param {Function} f A function.\n * @param {T} retValue A new return value.\n * @return {function(...?):T} A new function.\n * @template T\n */\ngoog.functions.withReturnValue = function(f, retValue) {\n return goog.functions.sequence(f, goog.functions.constant(retValue));\n};\n\n\n/**\n * Creates a function that returns whether its argument equals the given value.\n *\n * Example:\n * var key = goog.object.findKey(obj, goog.functions.equalTo('needle'));\n *\n * @param {*} value The value to compare to.\n * @param {boolean=} opt_useLooseComparison Whether to use a loose (==)\n * comparison rather than a strict (===) one. Defaults to false.\n * @return {function(*):boolean} The new function.\n */\ngoog.functions.equalTo = function(value, opt_useLooseComparison) {\n return function(other) {\n return opt_useLooseComparison ? (value == other) : (value === other);\n };\n};\n\n\n/**\n * Creates the composition of the functions passed in.\n * For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)).\n * @param {function(...?):T} fn The final function.\n * @param {...Function} var_args A list of functions.\n * @return {function(...?):T} The composition of all inputs.\n * @template T\n */\ngoog.functions.compose = function(fn, var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = /** @type {*} */ (this);\n let result;\n if (length) {\n result = functions[length - 1].apply(self, arguments);\n }\n\n for (let i = length - 2; i >= 0; i--) {\n result = functions[i].call(self, result);\n }\n return result;\n };\n};\n\n\n/**\n * Creates a function that calls the functions passed in in sequence, and\n * returns the value of the last function. For example,\n * (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x).\n * @param {...Function} var_args A list of functions.\n * @return {!Function} A function that calls all inputs in sequence.\n */\ngoog.functions.sequence = function(var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = /** @type {*} */ (this);\n let result;\n for (let i = 0; i < length; i++) {\n result = functions[i].apply(self, arguments);\n }\n return result;\n };\n};\n\n\n/**\n * Creates a function that returns true if each of its components evaluates\n * to true. The components are evaluated in order, and the evaluation will be\n * short-circuited as soon as a function returns false.\n * For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x).\n * @param {...Function} var_args A list of functions.\n * @return {function(...?):boolean} A function that ANDs its component\n * functions.\n */\ngoog.functions.and = function(var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = /** @type {*} */ (this);\n for (let i = 0; i < length; i++) {\n if (!functions[i].apply(self, arguments)) {\n return false;\n }\n }\n return true;\n };\n};\n\n\n/**\n * Creates a function that returns true if any of its components evaluates\n * to true. The components are evaluated in order, and the evaluation will be\n * short-circuited as soon as a function returns true.\n * For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x).\n * @param {...Function} var_args A list of functions.\n * @return {function(...?):boolean} A function that ORs its component\n * functions.\n */\ngoog.functions.or = function(var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = /** @type {*} */ (this);\n for (let i = 0; i < length; i++) {\n if (functions[i].apply(self, arguments)) {\n return true;\n }\n }\n return false;\n };\n};\n\n\n/**\n * Creates a function that returns the Boolean opposite of a provided function.\n * For example, (goog.functions.not(f))(x) is equivalent to !f(x).\n * @param {!Function} f The original function.\n * @return {function(...?):boolean} A function that delegates to f and returns\n * opposite.\n */\ngoog.functions.not = function(f) {\n return function() {\n const self = /** @type {*} */ (this);\n return !f.apply(self, arguments);\n };\n};\n\n\n/**\n * Generic factory function to construct an object given the constructor\n * and the arguments. Intended to be bound to create object factories.\n *\n * Example:\n *\n * var factory = goog.partial(goog.functions.create, Class);\n *\n * @param {function(new:T, ...)} constructor The constructor for the Object.\n * @param {...*} var_args The arguments to be passed to the constructor.\n * @return {T} A new instance of the class given in `constructor`.\n * @template T\n */\ngoog.functions.create = function(constructor, var_args) {\n /**\n * @constructor\n * @final\n */\n const temp = function() {};\n temp.prototype = constructor.prototype;\n\n // obj will have constructor's prototype in its chain and\n // 'obj instanceof constructor' will be true.\n const obj = new temp();\n\n // obj is initialized by constructor.\n // arguments is only array-like so lacks shift(), but can be used with\n // the Array prototype function.\n constructor.apply(obj, Array.prototype.slice.call(arguments, 1));\n return obj;\n};\n\n\n/**\n * @define {boolean} Whether the return value cache should be used.\n * This should only be used to disable caches when testing.\n */\ngoog.functions.CACHE_RETURN_VALUE =\n goog.define('goog.functions.CACHE_RETURN_VALUE', true);\n\n\n/**\n * Gives a wrapper function that caches the return value of a parameterless\n * function when first called.\n *\n * When called for the first time, the given function is called and its\n * return value is cached (thus this is only appropriate for idempotent\n * functions). Subsequent calls will return the cached return value. This\n * allows the evaluation of expensive functions to be delayed until first used.\n *\n * To cache the return values of functions with parameters, see goog.memoize.\n *\n * @param {function():T} fn A function to lazily evaluate.\n * @return {function():T} A wrapped version the function.\n * @template T\n */\ngoog.functions.cacheReturnValue = function(fn) {\n let called = false;\n let value;\n\n return function() {\n if (!goog.functions.CACHE_RETURN_VALUE) {\n return fn();\n }\n\n if (!called) {\n value = fn();\n called = true;\n }\n\n return value;\n };\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once. All\n * additional calls are no-ops.\n *\n * This is particularly useful for initialization functions\n * that should be called, at most, once.\n *\n * @param {function():*} f Function to call.\n * @return {function():undefined} Wrapped function.\n */\ngoog.functions.once = function(f) {\n // Keep a reference to the function that we null out when we're done with\n // it -- that way, the function can be GC'd when we're done with it.\n let inner = f;\n return function() {\n if (inner) {\n const tmp = inner;\n inner = null;\n tmp();\n }\n };\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once per interval\n * (specified in milliseconds). If the wrapper function is called N times within\n * that interval, only the Nth call will go through.\n *\n * This is particularly useful for batching up repeated actions where the\n * last action should win. This can be used, for example, for refreshing an\n * autocomplete pop-up every so often rather than updating with every keystroke,\n * since the final text typed by the user is the one that should produce the\n * final autocomplete results. For more stateful debouncing with support for\n * pausing, resuming, and canceling debounced actions, use\n * `goog.async.Debouncer`.\n *\n * @param {function(this:SCOPE, ...?)} f Function to call.\n * @param {number} interval Interval over which to debounce. The function will\n * only be called after the full interval has elapsed since the last call.\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\n * @return {function(...?): undefined} Wrapped function.\n * @template SCOPE\n */\ngoog.functions.debounce = function(f, interval, opt_scope) {\n let timeout = 0;\n return /** @type {function(...?)} */ (function(var_args) {\n goog.global.clearTimeout(timeout);\n const args = arguments;\n timeout = goog.global.setTimeout(function() {\n f.apply(opt_scope, args);\n }, interval);\n });\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once per interval\n * (specified in milliseconds). If the wrapper function is called N times in\n * that interval, both the 1st and the Nth calls will go through.\n *\n * This is particularly useful for limiting repeated user requests where the\n * the last action should win, but you also don't want to wait until the end of\n * the interval before sending a request out, as it leads to a perception of\n * slowness for the user.\n *\n * @param {function(this:SCOPE, ...?)} f Function to call.\n * @param {number} interval Interval over which to throttle. The function can\n * only be called once per interval.\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\n * @return {function(...?): undefined} Wrapped function.\n * @template SCOPE\n */\ngoog.functions.throttle = function(f, interval, opt_scope) {\n let timeout = 0;\n let shouldFire = false;\n let args = [];\n\n const handleTimeout = function() {\n timeout = 0;\n if (shouldFire) {\n shouldFire = false;\n fire();\n }\n };\n\n const fire = function() {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n f.apply(opt_scope, args);\n };\n\n return /** @type {function(...?)} */ (function(var_args) {\n args = arguments;\n if (!timeout) {\n fire();\n } else {\n shouldFire = true;\n }\n });\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once per interval\n * (specified in milliseconds). If the wrapper function is called N times within\n * that interval, only the 1st call will go through.\n *\n * This is particularly useful for limiting repeated user requests where the\n * first request is guaranteed to have all the data required to perform the\n * final action, so there's no need to wait until the end of the interval before\n * sending the request out.\n *\n * @param {function(this:SCOPE, ...?)} f Function to call.\n * @param {number} interval Interval over which to rate-limit. The function will\n * only be called once per interval, and ignored for the remainer of the\n * interval.\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\n * @return {function(...?): undefined} Wrapped function.\n * @template SCOPE\n */\ngoog.functions.rateLimit = function(f, interval, opt_scope) {\n let timeout = 0;\n\n const handleTimeout = function() {\n timeout = 0;\n };\n\n return /** @type {function(...?)} */ (function(var_args) {\n if (!timeout) {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n f.apply(opt_scope, arguments);\n }\n });\n};\n","~:compiled-at",1584073468334,"~:source-map-json","{\n\"version\":3,\n\"file\":\"goog.functions.functions.js\",\n\"lineCount\":298,\n\"mappings\":\"AA8BAA,IAAAC,QAAA,CAAa,gBAAb,CAAA;AASA;;;;;AAAAD,IAAAE,UAAAC,SAAA,GAA0BC,QAAQ,CAACC,QAAD,CAAW;AAC3C,SAAO,QAAQ,EAAG;AAAE,WAAOA,QAAP;AAAF,GAAlB;AAD2C,CAA7C;AASA,qCAAAL,IAAAE,UAAAI,MAAA,GAAuBC,QAAQ,EAAG;AAChC,SAAO,KAAP;AADgC,CAAlC;AASA,qCAAAP,IAAAE,UAAAM,KAAA,GAAsBC,QAAQ,EAAG;AAC/B,SAAO,IAAP;AAD+B,CAAjC;AASA,kCAAAT,IAAAE,UAAAQ,KAAA,GAAsBC,QAAQ,EAAG;AAC/B,SAAO,IAAP;AAD+B,CAAjC;AAaA;;;;;;AAAAX,IAAAE,UAAAU,SAAA,GAA0BC,QAAQ,CAACC,eAAD,EAAkBC,QAAlB,CAA4B;AAC5D,SAAOD,eAAP;AAD4D,CAA9D;AAUA;;;;AAAAd,IAAAE,UAAAc,MAAA,GAAuBC,QAAQ,CAACC,OAAD,CAAU;AACvC,SAAO,QAAQ,EAAG;AAChB,UAAM,IAAIC,KAAJ,CAAUD,OAAV,CAAN;AADgB,GAAlB;AADuC,CAAzC;AAYA;;;;AAAAlB,IAAAE,UAAAkB,KAAA,GAAsBC,QAAQ,CAACC,GAAD,CAAM;AAClC,SAAO,QAAQ,EAAG;AAAE,UAAMA,GAAN;AAAF,GAAlB;AADkC,CAApC;AAaA;;;;;AAAAtB,IAAAE,UAAAqB,KAAA,GAAsBC,QAAQ,CAACC,CAAD,EAAIC,WAAJ,CAAiB;AAC7CA,aAAA,GAAcA,WAAd,IAA6B,CAA7B;AACA,SAAO,QAAQ,EAAG;kBACh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AAAkF,OAAAG,WAAA,CAAuBI,aAAvB,EAAsCV,QAAtC,CAAV;AACAtD,OAAAG,MAAA,CAAQoD,SAAR,EAAmB/C,SAAnB,CAAA;AAFY;AADyC,GAApB,CAArC;AAP0D,CAA5D;;\",\n\"sources\":[\"goog/functions/functions.js\"],\n\"sourcesContent\":[\"// Copyright 2008 The Closure Library Authors. All Rights Reserved.\\n//\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n// you may not use this file except in compliance with the License.\\n// You may obtain a copy of the License at\\n//\\n// http://www.apache.org/licenses/LICENSE-2.0\\n//\\n// Unless required by applicable law or agreed to in writing, software\\n// distributed under the License is distributed on an \\\"AS-IS\\\" BASIS,\\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n// See the License for the specific language governing permissions and\\n// limitations under the License.\\n\\n/**\\n * @fileoverview Utilities for creating functions. Loosely inspired by these\\n * java classes from the Guava library:\\n * com.google.common.base.Functions\\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Functions.html\\n *\\n * com.google.common.base.Predicates\\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Predicates.html\\n *\\n * More about these can be found at\\n * https://github.com/google/guava/wiki/FunctionalExplained\\n *\\n * @author nicksantos@google.com (Nick Santos)\\n */\\n\\n\\ngoog.provide('goog.functions');\\n\\n\\n/**\\n * Creates a function that always returns the same value.\\n * @param {T} retValue The value to return.\\n * @return {function():T} The new function.\\n * @template T\\n */\\ngoog.functions.constant = function(retValue) {\\n return function() { return retValue; };\\n};\\n\\n\\n/**\\n * Always returns false.\\n * @type {function(...): boolean}\\n */\\ngoog.functions.FALSE = function() {\\n return false;\\n};\\n\\n\\n/**\\n * Always returns true.\\n * @type {function(...): boolean}\\n */\\ngoog.functions.TRUE = function() {\\n return true;\\n};\\n\\n\\n/**\\n * Always returns NULL.\\n * @type {function(...): null}\\n */\\ngoog.functions.NULL = function() {\\n return null;\\n};\\n\\n\\n/**\\n * A simple function that returns the first argument of whatever is passed\\n * into it.\\n * @param {T=} opt_returnValue The single value that will be returned.\\n * @param {...*} var_args Optional trailing arguments. These are ignored.\\n * @return {T} The first argument passed in, or undefined if nothing was passed.\\n * @template T\\n */\\ngoog.functions.identity = function(opt_returnValue, var_args) {\\n return opt_returnValue;\\n};\\n\\n\\n/**\\n * Creates a function that always throws an error with the given message.\\n * @param {string} message The error message.\\n * @return {!Function} The error-throwing function.\\n */\\ngoog.functions.error = function(message) {\\n return function() {\\n throw new Error(message);\\n };\\n};\\n\\n\\n/**\\n * Creates a function that throws the given object.\\n * @param {*} err An object to be thrown.\\n * @return {!Function} The error-throwing function.\\n */\\ngoog.functions.fail = function(err) {\\n return function() { throw err; };\\n};\\n\\n\\n/**\\n * Given a function, create a function that keeps opt_numArgs arguments and\\n * silently discards all additional arguments.\\n * @param {Function} f The original function.\\n * @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0.\\n * @return {!Function} A version of f that only keeps the first opt_numArgs\\n * arguments.\\n */\\ngoog.functions.lock = function(f, opt_numArgs) {\\n opt_numArgs = opt_numArgs || 0;\\n return function() {\\n const self = /** @type {*} */ (this);\\n return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns its nth argument.\\n * @param {number} n The position of the return argument.\\n * @return {!Function} A new function.\\n */\\ngoog.functions.nth = function(n) {\\n return function() { return arguments[n]; };\\n};\\n\\n\\n/**\\n * Like goog.partial(), except that arguments are added after arguments to the\\n * returned function.\\n *\\n * Usage:\\n * function f(arg1, arg2, arg3, arg4) { ... }\\n * var g = goog.functions.partialRight(f, arg3, arg4);\\n * g(arg1, arg2);\\n *\\n * @param {!Function} fn A function to partially apply.\\n * @param {...*} var_args Additional arguments that are partially applied to fn\\n * at the end.\\n * @return {!Function} A partially-applied form of the function goog.partial()\\n * was invoked as a method of.\\n */\\ngoog.functions.partialRight = function(fn, var_args) {\\n const rightArgs = Array.prototype.slice.call(arguments, 1);\\n return function() {\\n const self = /** @type {*} */ (this);\\n const newArgs = Array.prototype.slice.call(arguments);\\n newArgs.push.apply(newArgs, rightArgs);\\n return fn.apply(self, newArgs);\\n };\\n};\\n\\n\\n/**\\n * Given a function, create a new function that swallows its return value\\n * and replaces it with a new one.\\n * @param {Function} f A function.\\n * @param {T} retValue A new return value.\\n * @return {function(...?):T} A new function.\\n * @template T\\n */\\ngoog.functions.withReturnValue = function(f, retValue) {\\n return goog.functions.sequence(f, goog.functions.constant(retValue));\\n};\\n\\n\\n/**\\n * Creates a function that returns whether its argument equals the given value.\\n *\\n * Example:\\n * var key = goog.object.findKey(obj, goog.functions.equalTo('needle'));\\n *\\n * @param {*} value The value to compare to.\\n * @param {boolean=} opt_useLooseComparison Whether to use a loose (==)\\n * comparison rather than a strict (===) one. Defaults to false.\\n * @return {function(*):boolean} The new function.\\n */\\ngoog.functions.equalTo = function(value, opt_useLooseComparison) {\\n return function(other) {\\n return opt_useLooseComparison ? (value == other) : (value === other);\\n };\\n};\\n\\n\\n/**\\n * Creates the composition of the functions passed in.\\n * For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)).\\n * @param {function(...?):T} fn The final function.\\n * @param {...Function} var_args A list of functions.\\n * @return {function(...?):T} The composition of all inputs.\\n * @template T\\n */\\ngoog.functions.compose = function(fn, var_args) {\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n const self = /** @type {*} */ (this);\\n let result;\\n if (length) {\\n result = functions[length - 1].apply(self, arguments);\\n }\\n\\n for (let i = length - 2; i >= 0; i--) {\\n result = functions[i].call(self, result);\\n }\\n return result;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that calls the functions passed in in sequence, and\\n * returns the value of the last function. For example,\\n * (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x).\\n * @param {...Function} var_args A list of functions.\\n * @return {!Function} A function that calls all inputs in sequence.\\n */\\ngoog.functions.sequence = function(var_args) {\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n const self = /** @type {*} */ (this);\\n let result;\\n for (let i = 0; i < length; i++) {\\n result = functions[i].apply(self, arguments);\\n }\\n return result;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns true if each of its components evaluates\\n * to true. The components are evaluated in order, and the evaluation will be\\n * short-circuited as soon as a function returns false.\\n * For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x).\\n * @param {...Function} var_args A list of functions.\\n * @return {function(...?):boolean} A function that ANDs its component\\n * functions.\\n */\\ngoog.functions.and = function(var_args) {\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n const self = /** @type {*} */ (this);\\n for (let i = 0; i < length; i++) {\\n if (!functions[i].apply(self, arguments)) {\\n return false;\\n }\\n }\\n return true;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns true if any of its components evaluates\\n * to true. The components are evaluated in order, and the evaluation will be\\n * short-circuited as soon as a function returns true.\\n * For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x).\\n * @param {...Function} var_args A list of functions.\\n * @return {function(...?):boolean} A function that ORs its component\\n * functions.\\n */\\ngoog.functions.or = function(var_args) {\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n const self = /** @type {*} */ (this);\\n for (let i = 0; i < length; i++) {\\n if (functions[i].apply(self, arguments)) {\\n return true;\\n }\\n }\\n return false;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns the Boolean opposite of a provided function.\\n * For example, (goog.functions.not(f))(x) is equivalent to !f(x).\\n * @param {!Function} f The original function.\\n * @return {function(...?):boolean} A function that delegates to f and returns\\n * opposite.\\n */\\ngoog.functions.not = function(f) {\\n return function() {\\n const self = /** @type {*} */ (this);\\n return !f.apply(self, arguments);\\n };\\n};\\n\\n\\n/**\\n * Generic factory function to construct an object given the constructor\\n * and the arguments. Intended to be bound to create object factories.\\n *\\n * Example:\\n *\\n * var factory = goog.partial(goog.functions.create, Class);\\n *\\n * @param {function(new:T, ...)} constructor The constructor for the Object.\\n * @param {...*} var_args The arguments to be passed to the constructor.\\n * @return {T} A new instance of the class given in `constructor`.\\n * @template T\\n */\\ngoog.functions.create = function(constructor, var_args) {\\n /**\\n * @constructor\\n * @final\\n */\\n const temp = function() {};\\n temp.prototype = constructor.prototype;\\n\\n // obj will have constructor's prototype in its chain and\\n // 'obj instanceof constructor' will be true.\\n const obj = new temp();\\n\\n // obj is initialized by constructor.\\n // arguments is only array-like so lacks shift(), but can be used with\\n // the Array prototype function.\\n constructor.apply(obj, Array.prototype.slice.call(arguments, 1));\\n return obj;\\n};\\n\\n\\n/**\\n * @define {boolean} Whether the return value cache should be used.\\n * This should only be used to disable caches when testing.\\n */\\ngoog.functions.CACHE_RETURN_VALUE =\\n goog.define('goog.functions.CACHE_RETURN_VALUE', true);\\n\\n\\n/**\\n * Gives a wrapper function that caches the return value of a parameterless\\n * function when first called.\\n *\\n * When called for the first time, the given function is called and its\\n * return value is cached (thus this is only appropriate for idempotent\\n * functions). Subsequent calls will return the cached return value. This\\n * allows the evaluation of expensive functions to be delayed until first used.\\n *\\n * To cache the return values of functions with parameters, see goog.memoize.\\n *\\n * @param {function():T} fn A function to lazily evaluate.\\n * @return {function():T} A wrapped version the function.\\n * @template T\\n */\\ngoog.functions.cacheReturnValue = function(fn) {\\n let called = false;\\n let value;\\n\\n return function() {\\n if (!goog.functions.CACHE_RETURN_VALUE) {\\n return fn();\\n }\\n\\n if (!called) {\\n value = fn();\\n called = true;\\n }\\n\\n return value;\\n };\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once. All\\n * additional calls are no-ops.\\n *\\n * This is particularly useful for initialization functions\\n * that should be called, at most, once.\\n *\\n * @param {function():*} f Function to call.\\n * @return {function():undefined} Wrapped function.\\n */\\ngoog.functions.once = function(f) {\\n // Keep a reference to the function that we null out when we're done with\\n // it -- that way, the function can be GC'd when we're done with it.\\n let inner = f;\\n return function() {\\n if (inner) {\\n const tmp = inner;\\n inner = null;\\n tmp();\\n }\\n };\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once per interval\\n * (specified in milliseconds). If the wrapper function is called N times within\\n * that interval, only the Nth call will go through.\\n *\\n * This is particularly useful for batching up repeated actions where the\\n * last action should win. This can be used, for example, for refreshing an\\n * autocomplete pop-up every so often rather than updating with every keystroke,\\n * since the final text typed by the user is the one that should produce the\\n * final autocomplete results. For more stateful debouncing with support for\\n * pausing, resuming, and canceling debounced actions, use\\n * `goog.async.Debouncer`.\\n *\\n * @param {function(this:SCOPE, ...?)} f Function to call.\\n * @param {number} interval Interval over which to debounce. The function will\\n * only be called after the full interval has elapsed since the last call.\\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\\n * @return {function(...?): undefined} Wrapped function.\\n * @template SCOPE\\n */\\ngoog.functions.debounce = function(f, interval, opt_scope) {\\n let timeout = 0;\\n return /** @type {function(...?)} */ (function(var_args) {\\n goog.global.clearTimeout(timeout);\\n const args = arguments;\\n timeout = goog.global.setTimeout(function() {\\n f.apply(opt_scope, args);\\n }, interval);\\n });\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once per interval\\n * (specified in milliseconds). If the wrapper function is called N times in\\n * that interval, both the 1st and the Nth calls will go through.\\n *\\n * This is particularly useful for limiting repeated user requests where the\\n * the last action should win, but you also don't want to wait until the end of\\n * the interval before sending a request out, as it leads to a perception of\\n * slowness for the user.\\n *\\n * @param {function(this:SCOPE, ...?)} f Function to call.\\n * @param {number} interval Interval over which to throttle. The function can\\n * only be called once per interval.\\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\\n * @return {function(...?): undefined} Wrapped function.\\n * @template SCOPE\\n */\\ngoog.functions.throttle = function(f, interval, opt_scope) {\\n let timeout = 0;\\n let shouldFire = false;\\n let args = [];\\n\\n const handleTimeout = function() {\\n timeout = 0;\\n if (shouldFire) {\\n shouldFire = false;\\n fire();\\n }\\n };\\n\\n const fire = function() {\\n timeout = goog.global.setTimeout(handleTimeout, interval);\\n f.apply(opt_scope, args);\\n };\\n\\n return /** @type {function(...?)} */ (function(var_args) {\\n args = arguments;\\n if (!timeout) {\\n fire();\\n } else {\\n shouldFire = true;\\n }\\n });\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once per interval\\n * (specified in milliseconds). If the wrapper function is called N times within\\n * that interval, only the 1st call will go through.\\n *\\n * This is particularly useful for limiting repeated user requests where the\\n * first request is guaranteed to have all the data required to perform the\\n * final action, so there's no need to wait until the end of the interval before\\n * sending the request out.\\n *\\n * @param {function(this:SCOPE, ...?)} f Function to call.\\n * @param {number} interval Interval over which to rate-limit. The function will\\n * only be called once per interval, and ignored for the remainer of the\\n * interval.\\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\\n * @return {function(...?): undefined} Wrapped function.\\n * @template SCOPE\\n */\\ngoog.functions.rateLimit = function(f, interval, opt_scope) {\\n let timeout = 0;\\n\\n const handleTimeout = function() {\\n timeout = 0;\\n };\\n\\n return /** @type {function(...?)} */ (function(var_args) {\\n if (!timeout) {\\n timeout = goog.global.setTimeout(handleTimeout, interval);\\n f.apply(opt_scope, arguments);\\n }\\n });\\n};\\n\"],\n\"names\":[\"goog\",\"provide\",\"functions\",\"constant\",\"goog.functions.constant\",\"retValue\",\"FALSE\",\"goog.functions.FALSE\",\"TRUE\",\"goog.functions.TRUE\",\"NULL\",\"goog.functions.NULL\",\"identity\",\"goog.functions.identity\",\"opt_returnValue\",\"var_args\",\"error\",\"goog.functions.error\",\"message\",\"Error\",\"fail\",\"goog.functions.fail\",\"err\",\"lock\",\"goog.functions.lock\",\"f\",\"opt_numArgs\",\"self\",\"apply\",\"Array\",\"prototype\",\"slice\",\"call\",\"arguments\",\"nth\",\"goog.functions.nth\",\"n\",\"partialRight\",\"goog.functions.partialRight\",\"fn\",\"rightArgs\",\"newArgs\",\"push\",\"withReturnValue\",\"goog.functions.withReturnValue\",\"sequence\",\"equalTo\",\"goog.functions.equalTo\",\"value\",\"opt_useLooseComparison\",\"other\",\"compose\",\"goog.functions.compose\",\"length\",\"result\",\"i\",\"goog.functions.sequence\",\"and\",\"goog.functions.and\",\"or\",\"goog.functions.or\",\"not\",\"goog.functions.not\",\"create\",\"goog.functions.create\",\"constructor\",\"temp\",\"obj\",\"CACHE_RETURN_VALUE\",\"define\",\"cacheReturnValue\",\"goog.functions.cacheReturnValue\",\"called\",\"once\",\"goog.functions.once\",\"inner\",\"tmp\",\"debounce\",\"goog.functions.debounce\",\"interval\",\"opt_scope\",\"timeout\",\"global\",\"clearTimeout\",\"args\",\"setTimeout\",\"throttle\",\"goog.functions.throttle\",\"shouldFire\",\"handleTimeout\",\"fire\",\"rateLimit\",\"goog.functions.rateLimit\"]\n}\n"]