// Metro module 380 (f381). import _classCallCheck from "./_classCallCheck"; import _createClass from "./_createClass"; import _possibleConstructorReturn from "./_possibleConstructorReturn"; import _getPrototypeOf from "./_getPrototypeOf"; import _get from "./_get"; import _inherits from "./_inherits"; import _classPrivateFieldBase from "./_classPrivateFieldBase"; import _classPrivateFieldKey from "./_classPrivateFieldKey"; import flattenStyle from "./flattenStyle"; import AnimatedStyle from "./AnimatedStyle"; import AnimatedNode from "./AnimatedNode"; import flatAnimatedNodes from "./flatAnimatedNodes"; import { AnimatedEvent } from "./AnimatedEvent"; import Module357 from "./Module357"; import Module38 from "./Module38"; import { findNodeHandle } from "./Module114"; import { cxxNativeAnimatedEnabled, useSharedAnimatedBackend } from "./Module27"; import { getNodeFromPublicInstance } from "./Module272"; function $mk66412($env) { return function(a0) { const r0 = $env; return r0[1].apply(r0[0], a0); }; } let _connectAnimatedView2, _connectShadowNode2, _disconnectAnimatedView2, c404_11, c404_12, c404_13, hasOwnProperty, hasOwn; let AnimatedProps; let env404 = {}; env404[10] = function _isNativeReflectConstruct() { let c12291_0; try { c12291_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); } catch ($e) {} const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() { return !!c12291_0; }; env404[10] = _isNativeReflectConstruct2; return _isNativeReflectConstruct2(); }; _connectAnimatedView2 = function _connectAnimatedView2(a0) { Module38(this.__isNative, "Expected node to be marked as \"native\""); const connectedViewTag = findNodeHandle(a0.instance); if (connectedViewTag == null) { throw new Error("Unable to locate attached view in the native tree"); } Module357.API.connectAnimatedNodeToView(this.__getNativeTag(), connectedViewTag); a0.connectedViewTag = connectedViewTag; }; _connectShadowNode2 = function _connectShadowNode2(a0) { if (cxxNativeAnimatedEnabled() && useSharedAnimatedBackend()) { Module38(this.__isNative, "Expected node to be marked as \"native\""); const nodeFromPublicInstance = getNodeFromPublicInstance(a0.instance); if (nodeFromPublicInstance != null) { Module357.API.connectAnimatedNodeToShadowNodeFamily(this.__getNativeTag(), nodeFromPublicInstance); } } }; _disconnectAnimatedView2 = function _disconnectAnimatedView2(a0) { Module38(this.__isNative, "Expected node to be marked as \"native\""); const connectedViewTag = a0.connectedViewTag; if (connectedViewTag != null) { Module357.API.disconnectAnimatedNodeFromView(this.__getNativeTag(), connectedViewTag); a0.connectedViewTag = null; } }; c404_11 = _classPrivateFieldKey("connectAnimatedView"); c404_12 = _classPrivateFieldKey("connectShadowNode"); c404_13 = _classPrivateFieldKey("disconnectAnimatedView"); AnimatedProps = function AnimatedProps(a0, a1, a2, a3, a4) { let r68, r72; _classCallCheck(this, AnimatedProps); const r14 = [a4]; const r13 = _getPrototypeOf(AnimatedProps); const r36 = _possibleConstructorReturn(this, (0, env404[10])() ? Reflect.construct(r13, r14, _getPrototypeOf(this).constructor) : r13.apply(this, r14)); Object.defineProperty(r36, c404_13, { value: _disconnectAnimatedView2 }); Object.defineProperty(r36, c404_12, { value: _connectShadowNode2 }); Object.defineProperty(r36, c404_11, { value: _connectAnimatedView2 }); r36._target = null; r36._rootTag = void 0; const r56 = []; const r57 = []; const r58 = {}; const r61 = Object.keys(a0); const length = r61.length; let r0 = 0; while (r0 < length) { const r17 = r61[r0]; const r23 = a0[r17]; const r1 = r0; if (a2 != null && !hasOwn(a2, r17)) { r58[r17] = r23; } else { if (r17 === "style") { r68 = void 0; r72 = r23; if (typeof r23 === "object") { const r73 = r23 != null; r68 = void 0; r72 = r23; if (r73) { const r76 = flattenStyle(r23); r68 = AnimatedStyle.from(r76, a2?.style, r23); r72 = r76; } } } else { r68 = r23 instanceof AnimatedNode ? r23 : flatAnimatedNodes.from(r23); r72 = r23; } if (r68 == null) { r58[r17] = r72; } else { r56.push(r17); r57.push(r68); r58[r17] = r68; } } r0 = r1 + 1; } const [_nodeKeys, _nodes, _props] = [r56, r57, r58]; r36._nodeKeys = _nodeKeys; r36._nodes = _nodes; r36._props = _props; r36._callback = a1; r36._rootTag = a3; return r36; }; _inherits(AnimatedProps, AnimatedNode); const r70 = _createClass(AnimatedProps, [{ key: "__getValue", value: function __getValue() { const r5 = {}; const r16 = Object.keys(this._props); const length = r16.length; let r0 = 0; while (r0 < length) { const r11 = r16[r0]; const r12 = this._props[r11]; const r21 = r12 instanceof AnimatedNode; const r1 = r0; if (r21) { r5[r11] = r12.__getValue(); } else if (r12 instanceof AnimatedEvent) { r5[r11] = r12.__getHandler(); } else { r5[r11] = r12; } r0 = r1 + 1; } return r5; } }, { key: "__getValueWithStaticProps", value: function __getValueWithStaticProps(a0) { let r45; const r6 = { ...a0 }; const r9 = Object.keys(a0); const length = r9.length; let r0 = 0; while (r0 < length) { const r14 = r9[r0]; const r16 = this._props[r14]; const r1 = r0; if (r14 === "style") { const style = a0.style; const r41 = flattenStyle(style); if (r16 instanceof AnimatedStyle) { if (r41 == null) { r45 = {}; } else { r45 = r41; if (r45 === style) { r45 = { ...r41 }; } } r16.__replaceAnimatedNodeWithValues(r45); r6[r14] = r16.__getValueForStyle(r45); } else { r6[r14] = r41; } } else if (r16 instanceof AnimatedNode) { r6[r14] = r16.__getValue(); } else if (r16 instanceof AnimatedEvent) { r6[r14] = r16.__getHandler(); } r0 = r1 + 1; } return r6; } }, { key: "__getNativeAnimatedEventTuples", value: function __getNativeAnimatedEventTuples() { const r5 = []; const r15 = Object.keys(this._props); const length = r15.length; let r0 = 0; while (r0 < length) { const r13 = r15[r0]; const r12 = this._props[r13]; let r22 = r12 instanceof AnimatedEvent; const r1 = r0; if (r22) { r22 = r12.__isNative; } if (r22) { r5.push([r13, r12]); } r0 = r1 + 1; } return r5; } }, { key: "__getAnimatedValue", value: function __getAnimatedValue() { const r4 = {}; const _nodeKeys = this._nodeKeys; const _nodes = this._nodes; const length = _nodes.length; let r0 = 0; while (r0 < length) { r4[_nodeKeys[r0]] = _nodes[r0].__getAnimatedValue(); r0 = r0 + 1; } return r4; } }, { key: "__attach", value: function __attach() { const _nodes = this._nodes; const length = _nodes.length; let r0 = 0; while (r0 < length) { _nodes[r0].__addChild(this); r0 = r0 + 1; } let env23740; const r13 = env23740 = {}; env23740[0] = this; let r20 = _get(_getPrototypeOf(AnimatedProps.prototype), "__attach", this); env23740[1] = r20; if (typeof r20 === "function") { r20 = $mk66412(r13); } r20([]); } }, { key: "__detach", value: function __detach() { if (this.__isNative && this._target != null) { _classPrivateFieldBase(this, c404_13)[c404_13](this._target); } this._target = null; const _nodes = this._nodes; const length = _nodes.length; let r0 = 0; while (r0 < length) { _nodes[r0].__removeChild(this); r0 = r0 + 1; } let env23741; const r25 = env23741 = {}; env23741[0] = this; let r32 = _get(_getPrototypeOf(AnimatedProps.prototype), "__detach", this); env23741[1] = r32; if (typeof r32 === "function") { r32 = $mk66412(r25); } r32([]); } }, { key: "update", value: function update() { this._callback(); } }, { key: "__makeNative", value: function __makeNative(a0) { const _nodes = this._nodes; const length = _nodes.length; let r0 = 0; while (r0 < length) { _nodes[r0].__makeNative(a0); r0 = r0 + 1; } if (!this.__isNative) { let env23742; this.__isNative = true; const r18 = env23742 = {}; env23742[0] = this; env23742[1] = void 0; let r24 = _get(_getPrototypeOf(AnimatedProps.prototype), "__setPlatformConfig", this); env23742[1] = r24; if (typeof r24 === "function") { r24 = $mk66412(r18); } r24([a0]); if (this._target != null) { const _target = this._target; _classPrivateFieldBase(this, c404_11)[c404_11](_target); _classPrivateFieldBase(this, c404_12)[c404_12](_target); } } } }, { key: "setNativeView", value: function setNativeView(a0) { if (this._target?.instance !== a0) { const _target = { instance: a0, connectedViewTag: null }; this._target = _target; if (this.__isNative) { _classPrivateFieldBase(this, c404_11)[c404_11](_target); _classPrivateFieldBase(this, c404_12)[c404_12](_target); } } } }, { key: "__restoreDefaultValues", value: function __restoreDefaultValues() { if (this.__isNative) { Module357.API.restoreDefaultValues(this.__getNativeTag()); } } }, { key: "__getNativeConfig", value: function __getNativeConfig() { const r9 = this.__getPlatformConfig(); const props = {}; const _nodeKeys = this._nodeKeys; const _nodes = this._nodes; const length = _nodes.length; let r0 = 0; while (r0 < length) { const r11 = _nodeKeys[r0]; const r12 = _nodes[r0]; r12.__makeNative(r9); props[r11] = r12.__getNativeTag(); r0 = r0 + 1; } let _rootTag = this._rootTag; if (_rootTag == null) { _rootTag = void 0; } return { type: "props", props, rootTag: _rootTag, debugID: this.__getDebugID() }; } }]); hasOwnProperty = Object.prototype.hasOwnProperty; let hasOwn2 = Object.hasOwn; if (hasOwn2 == null) { hasOwn2 = (a0, a1) => hasOwnProperty.call(a0, a1); } hasOwn = hasOwn2; export default r70;