{"ast":null,"code":"'use strict';\n\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport InteractionManager from \"../../../exports/InteractionManager\";\nvar Batchinator = function () {\n  function Batchinator(callback, delayMS) {\n    _classCallCheck(this, Batchinator);\n    this._delay = delayMS;\n    this._callback = callback;\n  }\n  return _createClass(Batchinator, [{\n    key: \"dispose\",\n    value: function dispose(options) {\n      if (options === void 0) {\n        options = {\n          abort: false\n        };\n      }\n      if (this._taskHandle) {\n        this._taskHandle.cancel();\n        if (!options.abort) {\n          this._callback();\n        }\n        this._taskHandle = null;\n      }\n    }\n  }, {\n    key: \"schedule\",\n    value: function schedule() {\n      var _this = this;\n      if (this._taskHandle) {\n        return;\n      }\n      var timeoutHandle = setTimeout(function () {\n        _this._taskHandle = InteractionManager.runAfterInteractions(function () {\n          _this._taskHandle = null;\n          _this._callback();\n        });\n      }, this._delay);\n      this._taskHandle = {\n        cancel: function cancel() {\n          return clearTimeout(timeoutHandle);\n        }\n      };\n    }\n  }]);\n}();\nexport default Batchinator;","map":{"version":3,"names":["_classCallCheck","_createClass","InteractionManager","Batchinator","callback","delayMS","_delay","_callback","key","value","dispose","options","abort","_taskHandle","cancel","schedule","_this","timeoutHandle","setTimeout","runAfterInteractions","clearTimeout"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/vendor/react-native/Batchinator/index.js"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n */\n\n'use strict';\n\nimport InteractionManager from '../../../exports/InteractionManager';\n\n/**\n * A simple class for batching up invocations of a low-pri callback. A timeout is set to run the\n * callback once after a delay, no matter how many times it's scheduled. Once the delay is reached,\n * InteractionManager.runAfterInteractions is used to invoke the callback after any hi-pri\n * interactions are done running.\n *\n * Make sure to cleanup with dispose().  Example:\n *\n *   class Widget extends React.Component {\n *     _batchedSave: new Batchinator(() => this._saveState, 1000);\n *     _saveSate() {\n *       // save this.state to disk\n *     }\n *     componentDidUpdate() {\n *       this._batchedSave.schedule();\n *     }\n *     componentWillUnmount() {\n *       this._batchedSave.dispose();\n *     }\n *     ...\n *   }\n */\nclass Batchinator {\n  constructor(callback, delayMS) {\n    this._delay = delayMS;\n    this._callback = callback;\n  }\n  /*\n   * Cleanup any pending tasks.\n   *\n   * By default, if there is a pending task the callback is run immediately. Set the option abort to\n   * true to not call the callback if it was pending.\n   */\n  dispose(options) {\n    if (options === void 0) {\n      options = {\n        abort: false\n      };\n    }\n    if (this._taskHandle) {\n      this._taskHandle.cancel();\n      if (!options.abort) {\n        this._callback();\n      }\n      this._taskHandle = null;\n    }\n  }\n  schedule() {\n    if (this._taskHandle) {\n      return;\n    }\n    var timeoutHandle = setTimeout(() => {\n      this._taskHandle = InteractionManager.runAfterInteractions(() => {\n        // Note that we clear the handle before invoking the callback so that if the callback calls\n        // schedule again, it will actually schedule another task.\n        this._taskHandle = null;\n        this._callback();\n      });\n    }, this._delay);\n    this._taskHandle = {\n      cancel: () => clearTimeout(timeoutHandle)\n    };\n  }\n}\nexport default Batchinator;"],"mappings":"AAUA,YAAY;;AAAC,OAAAA,eAAA;AAAA,OAAAC,YAAA;AAEb,OAAOC,kBAAkB;AAA4C,IAwB/DC,WAAW;EACf,SAAAA,YAAYC,QAAQ,EAAEC,OAAO,EAAE;IAAAL,eAAA,OAAAG,WAAA;IAC7B,IAAI,CAACG,MAAM,GAAGD,OAAO;IACrB,IAAI,CAACE,SAAS,GAAGH,QAAQ;EAC3B;EAAC,OAAAH,YAAA,CAAAE,WAAA;IAAAK,GAAA;IAAAC,KAAA,EAOD,SAAAC,OAAOA,CAACC,OAAO,EAAE;MACf,IAAIA,OAAO,KAAK,KAAK,CAAC,EAAE;QACtBA,OAAO,GAAG;UACRC,KAAK,EAAE;QACT,CAAC;MACH;MACA,IAAI,IAAI,CAACC,WA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