Deferred
,\n * and may have an execution sequence of callback functions added to it. Each\n * DeferredList
instance is single use and may be fired only once.\n *\n * The default behavior of a DeferredList
is to wait for a success\n * or error result from every Deferred
in its input list. Once\n * every result is available, the DeferredList
's execution sequence\n * is fired with a list of [success, result]
array pairs, where\n * success
is a boolean indicating whether result
was\n * the product of a callback or errback. The list's completion criteria and\n * result list may be modified by setting one or more of the boolean options\n * documented below.\n *\n * Deferred
instances passed into a DeferredList
are\n * independent, and may have additional callbacks and errbacks added to their\n * execution sequences after they are passed as inputs to the list.\n *\n * @param {!Array} list An array of deferred results to\n * wait for.\n * @param {boolean=} opt_fireOnOneCallback Whether to stop waiting as soon as\n * one input completes successfully. In this case, the\n * DeferredList
's callback chain will be called with a two\n * element array, [index, result]
, where index
\n * identifies which input Deferred
produced the successful\n * result
.\n * @param {boolean=} opt_fireOnOneErrback Whether to stop waiting as soon as one\n * input reports an error. The failing result is passed to the\n * DeferredList
's errback sequence.\n * @param {boolean=} opt_consumeErrors When true, any errors fired by a\n * Deferred
in the input list will be captured and replaced\n * with a succeeding null result. Any callbacks added to the\n * Deferred
after its use in the DeferredList
will\n * receive null instead of the error.\n * @param {Function=} opt_canceler A function that will be called if the\n * DeferredList
is canceled. @see goog.async.Deferred#cancel\n * @param {Object=} opt_defaultScope The default scope to invoke callbacks or\n * errbacks in.\n * @constructor\n * @extends {goog.async.Deferred}\n */\ngoog.async.DeferredList = function(\n list, opt_fireOnOneCallback, opt_fireOnOneErrback, opt_consumeErrors,\n opt_canceler, opt_defaultScope) {\n 'use strict';\n goog.async.DeferredList.base(\n this, 'constructor', opt_canceler, opt_defaultScope);\n\n /**\n * The list of Deferred objects to wait for.\n * @const {!Array}\n * @private\n */\n this.list_ = list;\n\n /**\n * The stored return values of the Deferred objects.\n * @const {!Array}\n * @private\n */\n this.deferredResults_ = [];\n\n /**\n * Whether to fire on the first successful callback instead of waiting for\n * every Deferred to complete.\n * @const {boolean}\n * @private\n */\n this.fireOnOneCallback_ = !!opt_fireOnOneCallback;\n\n /**\n * Whether to fire on the first error result received instead of waiting for\n * every Deferred to complete.\n * @const {boolean}\n * @private\n */\n this.fireOnOneErrback_ = !!opt_fireOnOneErrback;\n\n /**\n * Whether to stop error propagation on the input Deferred objects. If the\n * DeferredList sees an error from one of the Deferred inputs, the error will\n * be captured, and the Deferred will be returned to success state with a null\n * return value.\n * @const {boolean}\n * @private\n */\n this.consumeErrors_ = !!opt_consumeErrors;\n\n /**\n * The number of input deferred objects that have fired.\n * @private {number}\n */\n this.numFinished_ = 0;\n\n for (let i = 0; i < list.length; i++) {\n const d = list[i];\n d.addCallbacks(goog.bind(this.handleCallback_, this, i, true),\n goog.bind(this.handleCallback_, this, i, false));\n }\n\n if (list.length == 0 && !this.fireOnOneCallback_) {\n this.callback(this.deferredResults_);\n }\n};\ngoog.inherits(goog.async.DeferredList, goog.async.Deferred);\n\n\n/**\n * Registers the result from an input deferred callback or errback. The result\n * is returned and may be passed to additional handlers in the callback chain.\n *\n * @param {number} index The index of the firing deferred object in the input\n * list.\n * @param {boolean} success Whether the result is from a callback or errback.\n * @param {*} result The result of the callback or errback.\n * @return {*} The result, to be handled by the next handler in the deferred's\n * callback chain (if any). If consumeErrors is set, an error result is\n * replaced with null.\n * @private\n */\ngoog.async.DeferredList.prototype.handleCallback_ = function(\n index, success, result) {\n 'use strict';\n this.numFinished_++;\n this.deferredResults_[index] = [success, result];\n\n if (!this.hasFired()) {\n if (this.fireOnOneCallback_ && success) {\n this.callback([index, result]);\n } else if (this.fireOnOneErrback_ && !success) {\n this.errback(result);\n } else if (this.numFinished_ == this.list_.length) {\n this.callback(this.deferredResults_);\n }\n }\n\n if (this.consumeErrors_ && !success) {\n result = null;\n }\n\n return result;\n};\n\n\n/** @override */\ngoog.async.DeferredList.prototype.errback = function(res) {\n 'use strict';\n goog.async.DeferredList.base(this, 'errback', res);\n\n // On error, cancel any pending requests.\n for (let i = 0; i < this.list_.length; i++) {\n this.list_[i].cancel();\n }\n};\n\n\n/**\n * Creates a DeferredList
that gathers results from multiple\n * Deferred
inputs. If all inputs succeed, the callback is fired\n * with the list of results as a flat array. If any input fails, the list's\n * errback is fired immediately with the offending error, and all other pending\n * inputs are canceled.\n *\n * @param {!Array} list The list of Deferred
\n * inputs to wait for.\n * @return {!goog.async.Deferred} The deferred list of results from the inputs\n * if they all succeed, or the error result of the first input to fail.\n */\ngoog.async.DeferredList.gatherResults = function(list) {\n 'use strict';\n return new goog.async.DeferredList(list, false, true)\n .addCallback(function(results) {\n 'use strict';\n const output = [];\n for (let i = 0; i < results.length; i++) {\n output[i] = results[i][1];\n }\n return output;\n });\n};\n","~:last-modified",1684857788279,"~:requires",["^3",["~$goog","~$goog.async.Deferred"]],"~:pom-info",["^ ","~:description","The Google Closure Library is a collection of JavaScript code\n designed for use with the Google Closure JavaScript Compiler.\n\n This non-official distribution was prepared by the ClojureScript\n team at http://clojure.org/\n\n This package contains extensions to the Google Closure Library\n using third-party components, which may be distributed under\n licenses other than the Apache license. Licenses for individual\n library components may be found in source-code comments.","~:group-id","~$org.clojure","~:artifact-id","~$google-closure-library-third-party","~:name","Google Closure Library Third-Party Extensions","~:id","~$org.clojure/google-closure-library-third-party","~:url","http://code.google.com/p/closure-library/","~:parent-group-id","~$org.sonatype.oss","~:coordinate",["^H","0.0-20230227-c7c0a541"],"~:version","0.0-20230227-c7c0a541"],"~:goog-requires",["^3",["^?"]],"~:inspect-info",["^ ","~:js-str-offsets",[],"~:js-esm",false,"~:js-imports",[],"~:js-invalid-requires",[],"^2",["goog.async.DeferredList"],"~:js-language","es6","~:goog-module",null,"~:goog-module-legacy-namespace",false,"~:js-requires",[],"^N",["goog.async.Deferred"],"~:goog-require-types",[],"~:uses-global-buffer",false,"~:uses-global-process",false],"^I",["~#url","jar:file:/home/chris/.m2/repository/org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar!/goog/mochikit/async/deferredlist.js"],"~:provides",["^3",["^4"]],"^X",["^3",[]],"~:from-jar",true,"~:goog-src",true,"~:deps",["^>","^?"]],["^ ","^1",["f5ea82eb1309b81ada6a14371bb848323c65e38b"],"^2",["^3",["~$goog.async.Deferred.CanceledError","^?","~$goog.async.Deferred.AlreadyCalledError"]],"^5","goog.mochikit.async.deferred.js","^6",["^7","goog/mochikit/async/deferred.js"],"^8","goog/mochikit/async/deferred.js","^9","^:","^;","/**\n * @license\n * Copyright 2005, 2007 Bob Ippolito. All Rights Reserved.\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: MIT\n */\n\n// Portions of this code are from MochiKit, received by The Closure\n// Library Authors under the MIT license. All other code is Copyright\n// The Closure Library Authors.\n\n/**\n * @fileoverview Classes for tracking asynchronous operations and handling the\n * results. The Deferred object here is patterned after the Deferred object in\n * the Twisted python networking framework.\n *\n * See: http://twistedmatrix.com/projects/core/documentation/howto/defer.html\n *\n * Based on the Dojo code which in turn is based on the MochiKit code.\n *\n */\n\ngoog.provide('goog.async.Deferred');\ngoog.provide('goog.async.Deferred.AlreadyCalledError');\ngoog.provide('goog.async.Deferred.CanceledError');\n\ngoog.require('goog.Promise');\ngoog.require('goog.Thenable');\ngoog.require('goog.array');\ngoog.require('goog.asserts');\ngoog.require('goog.debug.Error');\n\n\n\n/**\n * A Deferred represents the result of an asynchronous operation. A Deferred\n * instance has no result when it is created, and is \"fired\" (given an initial\n * result) by calling `callback` or `errback`.\n *\n * Once fired, the result is passed through a sequence of callback functions\n * registered with `addCallback` or `addErrback`. The functions may\n * mutate the result before it is passed to the next function in the sequence.\n *\n * Callbacks and errbacks may be added at any time, including after the Deferred\n * has been \"fired\". If there are no pending actions in the execution sequence\n * of a fired Deferred, any new callback functions will be called with the last\n * computed result. Adding a callback function is the only way to access the\n * result of the Deferred.\n *\n * If a Deferred operation is canceled, an optional user-provided cancellation\n * function is invoked which may perform any special cleanup, followed by firing\n * the Deferred's errback sequence with a `CanceledError`. If the\n * Deferred has already fired, cancellation is ignored.\n *\n * Deferreds may be templated to a specific type they produce using generics\n * with syntax such as:\n *\n * /** @type {goog.async.DeferredisImmediate
is true\n * then 3 is alerted immediately, otherwise 6 is alerted after a 2-second delay.\n *\n * \n * var value;\n * if (isImmediate) {\n * value = 3;\n * } else {\n * value = new goog.async.Deferred();\n * setTimeout(function() { value.callback(6); }, 2000);\n * }\n *\n * var d = goog.async.Deferred.when(value, alert);\n *\n *\n * @param {*} value Deferred or normal value to pass to the callback.\n * @param {function(this:T, ?):?} callback The callback to execute.\n * @param {T=} opt_scope An optional scope to call the callback in.\n * @return {!goog.async.Deferred} A new Deferred that will call the input\n * callback with the input value.\n * @template T\n */\ngoog.async.Deferred.when = function(value, callback, opt_scope) {\n 'use strict';\n if (value instanceof goog.async.Deferred) {\n return value.branch(true).addCallback(callback, opt_scope);\n } else {\n return goog.async.Deferred.succeed(value).addCallback(callback, opt_scope);\n }\n};\n\n\n\n/**\n * An error sub class that is used when a Deferred has already been called.\n * @param {!goog.async.Deferred} deferred The Deferred.\n *\n * @constructor\n * @extends {goog.debug.Error}\n */\ngoog.async.Deferred.AlreadyCalledError = function(deferred) {\n 'use strict';\n goog.debug.Error.call(this);\n\n /**\n * The Deferred that raised this error.\n * @type {goog.async.Deferred}\n */\n this.deferred = deferred;\n};\ngoog.inherits(goog.async.Deferred.AlreadyCalledError, goog.debug.Error);\n\n\n/** @override */\ngoog.async.Deferred.AlreadyCalledError.prototype.message =\n 'Deferred has already fired';\n\n\n/** @override */\ngoog.async.Deferred.AlreadyCalledError.prototype.name = 'AlreadyCalledError';\n\n\n\n/**\n * An error sub class that is used when a Deferred is canceled.\n *\n * @param {!goog.async.Deferred} deferred The Deferred object.\n * @constructor\n * @extends {goog.debug.Error}\n */\ngoog.async.Deferred.CanceledError = function(deferred) {\n 'use strict';\n goog.debug.Error.call(this);\n\n /**\n * The Deferred that raised this error.\n * @type {goog.async.Deferred}\n */\n this.deferred = deferred;\n};\ngoog.inherits(goog.async.Deferred.CanceledError, goog.debug.Error);\n\n\n/** @override */\ngoog.async.Deferred.CanceledError.prototype.message = 'Deferred was canceled';\n\n\n/** @override */\ngoog.async.Deferred.CanceledError.prototype.name = 'CanceledError';\n\n\n\n/**\n * Wrapper around errors that are scheduled to be thrown by failing deferreds\n * after a timeout.\n *\n * @param {*} error Error from a failing deferred.\n * @constructor\n * @final\n * @private\n * @struct\n */\ngoog.async.Deferred.Error_ = function(error) {\n 'use strict';\n /** @const @private {number} */\n this.id_ = goog.global.setTimeout(goog.bind(this.throwError, this), 0);\n\n /** @const @private {*} */\n this.error_ = error;\n};\n\n\n/**\n * Actually throws the error and removes it from the list of pending\n * deferred errors.\n */\ngoog.async.Deferred.Error_.prototype.throwError = function() {\n 'use strict';\n goog.asserts.assert(\n goog.async.Deferred.errorMap_[this.id_],\n 'Cannot throw an error that is not scheduled.');\n delete goog.async.Deferred.errorMap_[this.id_];\n goog.async.Deferred.unhandledErrorHandler_(this.error_);\n};\n\n\n/**\n * Resets the error throw timer.\n */\ngoog.async.Deferred.Error_.prototype.resetTimer = function() {\n 'use strict';\n goog.global.clearTimeout(this.id_);\n};\n\n\n/**\n * Map of unhandled errors scheduled to be rethrown in a future timestep.\n * @private {!Object<(number|string), goog.async.Deferred.Error_>}\n */\ngoog.async.Deferred.errorMap_ = {};\n\n\n/**\n * Schedules an error to be thrown after a delay.\n * @param {*} error Error from a failing deferred.\n * @return {number} Id of the error.\n * @private\n */\ngoog.async.Deferred.scheduleError_ = function(error) {\n 'use strict';\n const deferredError = new goog.async.Deferred.Error_(error);\n goog.async.Deferred.errorMap_[deferredError.id_] = deferredError;\n return deferredError.id_;\n};\n\n\n/**\n * Unschedules an error from being thrown.\n * @param {number} id Id of the deferred error to unschedule.\n * @private\n */\ngoog.async.Deferred.unscheduleError_ = function(id) {\n 'use strict';\n const error = goog.async.Deferred.errorMap_[id];\n if (error) {\n error.resetTimer();\n delete goog.async.Deferred.errorMap_[id];\n }\n};\n\n\n/**\n * Asserts that there are no pending deferred errors. If there are any\n * scheduled errors, one will be thrown immediately to make this function fail.\n */\ngoog.async.Deferred.assertNoErrors = function() {\n 'use strict';\n const map = goog.async.Deferred.errorMap_;\n for (let key in map) {\n const error = map[key];\n error.resetTimer();\n error.throwError();\n }\n};\n","^<",1684857788279,"^=",["^3",["~$goog.asserts","^>","~$goog.debug.Error","~$goog.Promise","~$goog.array","~$goog.Thenable"]],"^@",["^ ","^A","The Google Closure Library is a collection of JavaScript code\n designed for use with the Google Closure JavaScript Compiler.\n\n This non-official distribution was prepared by the ClojureScript\n team at http://clojure.org/\n\n This package contains extensions to the Google Closure Library\n using third-party components, which may be distributed under\n licenses other than the Apache license. Licenses for individual\n library components may be found in source-code comments.","^B","^C","^D","^E","^F","Google Closure Library Third-Party Extensions","^G","^H","^I","http://code.google.com/p/closure-library/","^J","^K","^L",["^H","0.0-20230227-c7c0a541"],"^M","0.0-20230227-c7c0a541"],"^N",["^3",["^16","^17","^18","^19","^1:"]],"^O",["^ ","^P",[],"^Q",false,"^R",[],"^S",[],"^2",["goog.async.Deferred","goog.async.Deferred.AlreadyCalledError","goog.async.Deferred.CanceledError"],"^T","es6","^U",null,"^V",false,"^W",[],"^N",["goog.Promise","goog.Thenable","goog.array","goog.asserts","goog.debug.Error"],"^X",[],"^Y",false,"^Z",false],"^I",["^[","jar:file:/home/chris/.m2/repository/org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar!/goog/mochikit/async/deferred.js"],"^10",["^3",["^14","^?","^15"]],"^X",["^3",[]],"^11",true,"^12",true,"^13",["^>","^18","^1:","^19","^16","^17"]]],"~:shadow.build.classpath/CACHE-TIMESTAMP",1684857790000]