// Metro module 379 (f380). import _classCallCheck from "./_classCallCheck"; import _createClass from "./_createClass"; import Module357 from "./Module357"; import AnimatedProps from "./AnimatedProps"; import { cxxNativeAnimatedEnabled } from "./Module27"; let env402 = {}; env402[4] = 1; const Animation = function Animation(a0) { _classCallCheck(this, Animation); this._useNativeDriver = Module357.shouldUseNativeDriver(a0); this.__active = false; let isInteraction = a0.isInteraction; if (isInteraction == null) { isInteraction = !this._useNativeDriver; } this.__isInteraction = isInteraction; this.__isLooping = a0.isLooping; let iterations = a0.iterations; if (iterations == null) { iterations = 1; } this.__iterations = iterations; }; export default _createClass(Animation, [{ key: "start", value: function start(a0, a1, a2, a3, a4) { if (!this._useNativeDriver && a4.__isNative === true) { throw new Error("Attempting to run JS driven animation on animated node that has been moved to \"native\" earlier by starting an animation with `useNativeDriver: true`"); } this._onEnd = a2; this.__active = true; } }, { key: "stop", value: function stop() { let r2, r5; if (this._nativeID != null) { const _nativeID = this._nativeID; const r15 = `${_nativeID}:stopAnimation`; try { r5 = importDefault; r2 = dependencyMap; Module357.API.setWaitingForIdentifier(r15); Module357.API.stopAnimation(_nativeID); } catch (r35) { Module357.API.unsetWaitingForIdentifier(r15); throw r35; } r5(r2[2]).API.unsetWaitingForIdentifier(r15); } this.__active = false; } }, { key: "__getNativeAnimationConfig", value: function __getNativeAnimationConfig() { throw new Error("This animation type cannot be offloaded to native"); } }, { key: "__findAnimatedPropsNodes", value: function __findAnimatedPropsNodes(a0) { const r0 = []; if (a0 instanceof AnimatedProps) { r0.push(a0); return r0; } for (const item of a0.__getChildren()) { r0.push.apply(r0, [...this.__findAnimatedPropsNodes(item)]); } return r0; } }, { key: "__startAnimationIfNative", value: function __startAnimationIfNative(a0) { let c23739_0 = a0; if (this._useNativeDriver) { const r20 = `${env402[4]}:startAnimation`; env402[4] = env402[4] + 1; Module357.API.setWaitingForIdentifier(r20); try { try { const r9 = this.__getNativeAnimationConfig(); a0.__makeNative(r9.platformConfig); this._nativeID = Module357.generateNewAnimationId(); Module357.API.startAnimatingNode(this._nativeID, a0.__getNativeTag(), r9, (a0) => { this.__notifyAnimationEnd(a0); const { value, offset } = a0; if (value != null) { c23739_0.__onAnimatedValueUpdateReceived(value, offset); if (!cxxNativeAnimatedEnabled() && this.__isLooping === true) { return void 0; } this.__findAnimatedPropsNodes(c23739_0).forEach((item) => item.update()); } }); } catch ($e) { throw $e; } } catch (r51) { Module357.API.unsetWaitingForIdentifier(r20); throw r51; } Module357.API.unsetWaitingForIdentifier(r20); return true; } return false; } }, { key: "__notifyAnimationEnd", value: function __notifyAnimationEnd(a0) { const _onEnd = this._onEnd; if (_onEnd != null) { this._onEnd = null; _onEnd(a0); } } }, { key: "__getDebugID", value: function __getDebugID() {} }]);