{"version":3,"sources":["node_modules\\react-dom\\lib\\Transaction.js"],"names":["_prodInvariant","require","invariant","OBSERVED_ERROR","TransactionImpl","reinitializeTransaction","transactionWrappers","getTransactionWrappers","wrapperInitData","length","_isInTransaction","isInTransaction","perform","method","scope","a","b","c","d","e","f","process","env","NODE_ENV","errorThrown","ret","initializeAll","call","closeAll","err","startIndex","i","wrapper","initialize","initData","close","module","exports"],"mappings":";;;;;;;;;;;AAWA;;AAEA,GAAIA,gBAAiBC,QAAQ,sBAAR,CAArB;;AAEA,GAAIC,WAAYD,QAAQ,oBAAR,CAAhB;;AAEA,GAAIE,gBAAiB,EAArB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,GAAIC,iBAAkB;;;;;;;;AAQpBC,wBAAyB,kCAAY;AACnC,KAAKC,mBAAL,CAA2B,KAAKC,sBAAL,EAA3B;AACA,GAAI,KAAKC,eAAT,CAA0B;AACxB,KAAKA,eAAL,CAAqBC,MAArB,CAA8B,CAA9B;AACD,CAFD,IAEO;AACL,KAAKD,eAAL,CAAuB,EAAvB;AACD;AACD,KAAKE,gBAAL,CAAwB,KAAxB;AACD,CAhBmB;;AAkBpBA,iBAAkB,KAlBE;;;;;;AAwBpBH,uBAAwB,IAxBJ;;AA0BpBI,gBAAiB,0BAAY;AAC3B,MAAO,CAAC,CAAC,KAAKD,gBAAd;AACD,CA5BmB;;;;;;;;;;;;;;;;;;;;;AAiDpBE,QAAS,iBAAUC,MAAV,CAAkBC,KAAlB,CAAyBC,CAAzB,CAA4BC,CAA5B,CAA+BC,CAA/B,CAAkCC,CAAlC,CAAqCC,CAArC,CAAwCC,CAAxC,CAA2C;;AAElD,CAAC,CAAC,KAAKT,eAAL,EAAF,CAA2BU,QAAQC,GAAR,CAAYC,QAAZ,GAAyB,YAAzB,CAAwCrB,UAAU,KAAV,CAAiB,6GAAjB,CAAxC,CAA0KF,eAAe,IAAf,CAArM,CAA4N,IAA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AUE,UAAV,CAAsB;AAC9B,CAAC,KAAKnB,eAAL,EAAD,CAA0BU,QAAQC,GAAR,CAAYC,QAAZ,GAAyB,YAAzB,CAAwCrB,UAAU,KAAV,CAAiB,sEAAjB,CAAxC,CAAmIF,eAAe,IAAf,CAA7J,CAAoL,IAAK,EAAzL;AACA,GAAIM,qBAAsB,KAAKA,mBAA/B;AACA,IAAK,GAAIyB,GAAID,UAAb,CAAyBC,EAAIzB,oBAAoBG,MAAjD,CAAyDsB,GAAzD,CAA8D;AAC5D,GAAIC,SAAU1B,oBAAoByB,CAApB,CAAd;AACA,GAAIG,UAAW,KAAK1B,eAAL,CAAqBuB,CAArB,CAAf;AACA,GAAIP,YAAJ;AACA,GAAI;;;;;AAKFA,YAAc,IAAd;AACA,GAAIU,WAAa/B,cAAb,EAA+B6B,QAAQG,KAA3C,CAAkD;AAChDH,QAAQG,KAAR,CAAcR,IAAd,CAAmB,IAAnB,CAAyBO,QAAzB;AACD;AACDV,YAAc,KAAd;AACD,CAVD,OAUU;AACR,GAAIA,WAAJ,CAAiB;;;;AAIf,GAAI;AACF,KAAKI,QAAL,CAAcG,EAAI,CAAlB;AACD,CAAC,MAAOZ,CAAP,CAAU,CAAE;AACf;AACF;AACF;AACD,KAAKX,eAAL,CAAqBC,MAArB,CAA8B,CAA9B;AACD,CA/ImB,CAAtB;;;AAkJA2B,OAAOC,OAAP,CAAiBjC,eAAjB","file":"Transaction.js","sourceRoot":"d:/Work/Office/react-native-on-web/cli/tmpl/project","sourcesContent":["/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * \n */\n\n'use strict';\n\nvar _prodInvariant = require('./reactProdInvariant');\n\nvar invariant = require('fbjs/lib/invariant');\n\nvar OBSERVED_ERROR = {};\n\n/**\n * `Transaction` creates a black box that is able to wrap any method such that\n * certain invariants are maintained before and after the method is invoked\n * (Even if an exception is thrown while invoking the wrapped method). Whoever\n * instantiates a transaction can provide enforcers of the invariants at\n * creation time. The `Transaction` class itself will supply one additional\n * automatic invariant for you - the invariant that any transaction instance\n * should not be run while it is already being run. You would typically create a\n * single instance of a `Transaction` for reuse multiple times, that potentially\n * is used to wrap several different methods. Wrappers are extremely simple -\n * they only require implementing two methods.\n *\n * <pre>\n *                       wrappers (injected at creation time)\n *                                      +        +\n *                                      |        |\n *                    +-----------------|--------|--------------+\n *                    |                 v        |              |\n *                    |      +---------------+   |              |\n *                    |   +--|    wrapper1   |---|----+         |\n *                    |   |  +---------------+   v    |         |\n *                    |   |          +-------------+  |         |\n *                    |   |     +----|   wrapper2  |--------+   |\n *                    |   |     |    +-------------+  |     |   |\n *                    |   |     |                     |     |   |\n *                    |   v     v                     v     v   | wrapper\n *                    | +---+ +---+   +---------+   +---+ +---+ | invariants\n * perform(anyMethod) | |   | |   |   |         |   |   | |   | | maintained\n * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->\n *                    | |   | |   |   |         |   |   | |   | |\n *                    | |   | |   |   |         |   |   | |   | |\n *                    | |   | |   |   |         |   |   | |   | |\n *                    | +---+ +---+   +---------+   +---+ +---+ |\n *                    |  initialize                    close    |\n *                    +-----------------------------------------+\n * </pre>\n *\n * Use cases:\n * - Preserving the input selection ranges before/after reconciliation.\n *   Restoring selection even in the event of an unexpected error.\n * - Deactivating events while rearranging the DOM, preventing blurs/focuses,\n *   while guaranteeing that afterwards, the event system is reactivated.\n * - Flushing a queue of collected DOM mutations to the main UI thread after a\n *   reconciliation takes place in a worker thread.\n * - Invoking any collected `componentDidUpdate` callbacks after rendering new\n *   content.\n * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue\n *   to preserve the `scrollTop` (an automatic scroll aware DOM).\n * - (Future use case): Layout calculations before and after DOM updates.\n *\n * Transactional plugin API:\n * - A module that has an `initialize` method that returns any precomputation.\n * - and a `close` method that accepts the precomputation. `close` is invoked\n *   when the wrapped process is completed, or has failed.\n *\n * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules\n * that implement `initialize` and `close`.\n * @return {Transaction} Single transaction for reuse in thread.\n *\n * @class Transaction\n */\nvar TransactionImpl = {\n  /**\n   * Sets up this instance so that it is prepared for collecting metrics. Does\n   * so such that this setup method may be used on an instance that is already\n   * initialized, in a way that does not consume additional memory upon reuse.\n   * That can be useful if you decide to make your subclass of this mixin a\n   * \"PooledClass\".\n   */\n  reinitializeTransaction: function () {\n    this.transactionWrappers = this.getTransactionWrappers();\n    if (this.wrapperInitData) {\n      this.wrapperInitData.length = 0;\n    } else {\n      this.wrapperInitData = [];\n    }\n    this._isInTransaction = false;\n  },\n\n  _isInTransaction: false,\n\n  /**\n   * @abstract\n   * @return {Array<TransactionWrapper>} Array of transaction wrappers.\n   */\n  getTransactionWrappers: null,\n\n  isInTransaction: function () {\n    return !!this._isInTransaction;\n  },\n\n  /* eslint-disable space-before-function-paren */\n\n  /**\n   * Executes the function within a safety window. Use this for the top level\n   * methods that result in large amounts of computation/mutations that would\n   * need to be safety checked. The optional arguments helps prevent the need\n   * to bind in many cases.\n   *\n   * @param {function} method Member of scope to call.\n   * @param {Object} scope Scope to invoke from.\n   * @param {Object?=} a Argument to pass to the method.\n   * @param {Object?=} b Argument to pass to the method.\n   * @param {Object?=} c Argument to pass to the method.\n   * @param {Object?=} d Argument to pass to the method.\n   * @param {Object?=} e Argument to pass to the method.\n   * @param {Object?=} f Argument to pass to the method.\n   *\n   * @return {*} Return value from `method`.\n   */\n  perform: function (method, scope, a, b, c, d, e, f) {\n    /* eslint-enable space-before-function-paren */\n    !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;\n    var errorThrown;\n    var ret;\n    try {\n      this._isInTransaction = true;\n      // Catching errors makes debugging more difficult, so we start with\n      // errorThrown set to true before setting it to false after calling\n      // close -- if it's still set to true in the finally block, it means\n      // one of these calls threw.\n      errorThrown = true;\n      this.initializeAll(0);\n      ret = method.call(scope, a, b, c, d, e, f);\n      errorThrown = false;\n    } finally {\n      try {\n        if (errorThrown) {\n          // If `method` throws, prefer to show that stack trace over any thrown\n          // by invoking `closeAll`.\n          try {\n            this.closeAll(0);\n          } catch (err) {}\n        } else {\n          // Since `method` didn't throw, we don't want to silence the exception\n          // here.\n          this.closeAll(0);\n        }\n      } finally {\n        this._isInTransaction = false;\n      }\n    }\n    return ret;\n  },\n\n  initializeAll: function (startIndex) {\n    var transactionWrappers = this.transactionWrappers;\n    for (var i = startIndex; i < transactionWrappers.length; i++) {\n      var wrapper = transactionWrappers[i];\n      try {\n        // Catching errors makes debugging more difficult, so we start with the\n        // OBSERVED_ERROR state before overwriting it with the real return value\n        // of initialize -- if it's still set to OBSERVED_ERROR in the finally\n        // block, it means wrapper.initialize threw.\n        this.wrapperInitData[i] = OBSERVED_ERROR;\n        this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;\n      } finally {\n        if (this.wrapperInitData[i] === OBSERVED_ERROR) {\n          // The initializer for wrapper i threw an error; initialize the\n          // remaining wrappers but silence any exceptions from them to ensure\n          // that the first error is the one to bubble up.\n          try {\n            this.initializeAll(i + 1);\n          } catch (err) {}\n        }\n      }\n    }\n  },\n\n  /**\n   * Invokes each of `this.transactionWrappers.close[i]` functions, passing into\n   * them the respective return values of `this.transactionWrappers.init[i]`\n   * (`close`rs that correspond to initializers that failed will not be\n   * invoked).\n   */\n  closeAll: function (startIndex) {\n    !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;\n    var transactionWrappers = this.transactionWrappers;\n    for (var i = startIndex; i < transactionWrappers.length; i++) {\n      var wrapper = transactionWrappers[i];\n      var initData = this.wrapperInitData[i];\n      var errorThrown;\n      try {\n        // Catching errors makes debugging more difficult, so we start with\n        // errorThrown set to true before setting it to false after calling\n        // close -- if it's still set to true in the finally block, it means\n        // wrapper.close threw.\n        errorThrown = true;\n        if (initData !== OBSERVED_ERROR && wrapper.close) {\n          wrapper.close.call(this, initData);\n        }\n        errorThrown = false;\n      } finally {\n        if (errorThrown) {\n          // The closer for wrapper i threw an error; close the remaining\n          // wrappers but silence any exceptions from them to ensure that the\n          // first error is the one to bubble up.\n          try {\n            this.closeAll(i + 1);\n          } catch (e) {}\n        }\n      }\n    }\n    this.wrapperInitData.length = 0;\n  }\n};\n\nmodule.exports = TransactionImpl;"]}