{"ast":null,"code":"'use strict';\n\nimport Animation from \"./Animation\";\nimport { shouldUseNativeDriver } from \"../NativeAnimatedHelper\";\nclass DecayAnimation extends Animation {\n  constructor(config) {\n    var _config$deceleration, _config$isInteraction, _config$iterations;\n    super();\n    this._deceleration = (_config$deceleration = config.deceleration) !== null && _config$deceleration !== void 0 ? _config$deceleration : 0.998;\n    this._velocity = config.velocity;\n    this._useNativeDriver = shouldUseNativeDriver(config);\n    this.__isInteraction = (_config$isInteraction = config.isInteraction) !== null && _config$isInteraction !== void 0 ? _config$isInteraction : !this._useNativeDriver;\n    this.__iterations = (_config$iterations = config.iterations) !== null && _config$iterations !== void 0 ? _config$iterations : 1;\n  }\n  __getNativeAnimationConfig() {\n    return {\n      type: 'decay',\n      deceleration: this._deceleration,\n      velocity: this._velocity,\n      iterations: this.__iterations\n    };\n  }\n  start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {\n    this.__active = true;\n    this._lastValue = fromValue;\n    this._fromValue = fromValue;\n    this._onUpdate = onUpdate;\n    this.__onEnd = onEnd;\n    this._startTime = Date.now();\n    if (this._useNativeDriver) {\n      this.__startNativeAnimation(animatedValue);\n    } else {\n      this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n    }\n  }\n  onUpdate() {\n    var now = Date.now();\n    var value = this._fromValue + this._velocity / (1 - this._deceleration) * (1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));\n    this._onUpdate(value);\n    if (Math.abs(this._lastValue - value) < 0.1) {\n      this.__debouncedOnEnd({\n        finished: true\n      });\n      return;\n    }\n    this._lastValue = value;\n    if (this.__active) {\n      this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n    }\n  }\n  stop() {\n    super.stop();\n    this.__active = false;\n    global.cancelAnimationFrame(this._animationFrame);\n    this.__debouncedOnEnd({\n      finished: false\n    });\n  }\n}\nexport default DecayAnimation;","map":{"version":3,"names":["Animation","shouldUseNativeDriver","DecayAnimation","constructor","config","_config$deceleration","_config$isInteraction","_config$iterations","_deceleration","deceleration","_velocity","velocity","_useNativeDriver","__isInteraction","isInteraction","__iterations","iterations","__getNativeAnimationConfig","type","start","fromValue","onUpdate","onEnd","previousAnimation","animatedValue","__active","_lastValue","_fromValue","_onUpdate","__onEnd","_startTime","Date","now","__startNativeAnimation","_animationFrame","requestAnimationFrame","bind","value","Math","exp","abs","__debouncedOnEnd","finished","stop","global","cancelAnimationFrame"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/vendor/react-native/Animated/animations/DecayAnimation.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 * \n * @format\n */\n\n'use strict';\n\nimport Animation from './Animation';\nimport { shouldUseNativeDriver } from '../NativeAnimatedHelper';\nclass DecayAnimation extends Animation {\n  constructor(config) {\n    var _config$deceleration, _config$isInteraction, _config$iterations;\n    super();\n    this._deceleration = (_config$deceleration = config.deceleration) !== null && _config$deceleration !== void 0 ? _config$deceleration : 0.998;\n    this._velocity = config.velocity;\n    this._useNativeDriver = shouldUseNativeDriver(config);\n    this.__isInteraction = (_config$isInteraction = config.isInteraction) !== null && _config$isInteraction !== void 0 ? _config$isInteraction : !this._useNativeDriver;\n    this.__iterations = (_config$iterations = config.iterations) !== null && _config$iterations !== void 0 ? _config$iterations : 1;\n  }\n  __getNativeAnimationConfig() {\n    return {\n      type: 'decay',\n      deceleration: this._deceleration,\n      velocity: this._velocity,\n      iterations: this.__iterations\n    };\n  }\n  start(fromValue, onUpdate, onEnd, previousAnimation, animatedValue) {\n    this.__active = true;\n    this._lastValue = fromValue;\n    this._fromValue = fromValue;\n    this._onUpdate = onUpdate;\n    this.__onEnd = onEnd;\n    this._startTime = Date.now();\n    if (this._useNativeDriver) {\n      this.__startNativeAnimation(animatedValue);\n    } else {\n      this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n    }\n  }\n  onUpdate() {\n    var now = Date.now();\n    var value = this._fromValue + this._velocity / (1 - this._deceleration) * (1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));\n    this._onUpdate(value);\n    if (Math.abs(this._lastValue - value) < 0.1) {\n      this.__debouncedOnEnd({\n        finished: true\n      });\n      return;\n    }\n    this._lastValue = value;\n    if (this.__active) {\n      this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));\n    }\n  }\n  stop() {\n    super.stop();\n    this.__active = false;\n    global.cancelAnimationFrame(this._animationFrame);\n    this.__debouncedOnEnd({\n      finished: false\n    });\n  }\n}\nexport default DecayAnimation;"],"mappings":"AAUA,YAAY;;AAEZ,OAAOA,SAAS;AAChB,SAASC,qBAAqB;AAC9B,MAAMC,cAAc,SAASF,SAAS,CAAC;EACrCG,WAAWA,CAACC,MAAM,EAAE;IAClB,IAAIC,oBAAoB,EAAEC,qBAAqB,EAAEC,kBAAkB;IACnE,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,aAAa,GAAG,CAACH,oBAAoB,GAAGD,MAAM,CAACK,YAAY,MAAM,IAAI,IAAIJ,oBAAoB,KAAK,KAAK,CAAC,GAAGA,oBAAoB,GAAG,KAAK;IAC5I,IAAI,CAACK,SAAS,GAAGN,MAAM,CAACO,QAAQ;IAChC,IAAI,CAACC,gBAAgB,GAAGX,qBAAqB,CAACG,MAAM,CAAC;IACrD,IAAI,CAACS,eAAe,GAAG,CAACP,qBAAqB,GAAGF,MAAM,CAACU,aAAa,MAAM,IAAI,IAAIR,qBAAqB,KAAK,KAAK,CAAC,GAAGA,qBAAqB,GAAG,CAAC,IAAI,CAACM,gBAAgB;IACnK,IAAI,CAACG,YAAY,GAAG,CAACR,kBAAkB,GAAGH,MAAM,CAACY,UAAU,MAAM,IAAI,IAAIT,kBAAkB,KAAK,KAAK,CAAC,GAAGA,kBAAkB,GAAG,CAAC;EACjI;EACAU,0BAA0BA,CAAA,EAAG;IAC3B,OAAO;MACLC,IAAI,EAAE,OAAO;MACbT,YA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