/* Metro module 8621; source: modules/reanimated/native/useStateFromSharedValue.tsx; dependencies: [57, 31, 690, 4017, 2] */ import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as ReactBatchUpdatesNativeModule from '../../../external/discord_common/js/shared/utils/ReactBatchUpdates.native.tsx'; /* Metro dependency 690 */ function _fun68033(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:6, offset: 0x01c3c748, size: 251 bytes, params: 8, frame: 19 const env0_0 = require; const _arrayLikeToArray_68036 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const Map = global.Map; const map = new Map(); object = {code: 'function useStateFromSharedValueTsx1(id,listener,sharedValue){const{runOnJS}=this.__closure;sharedValue.addListener(id,function(value){return runOnJS(listener)(value);});}'}; object = {code: 'function useStateFromSharedValueTsx2(id,sharedValue){sharedValue.removeListener(id);}'}; (FileImportTrackerModule).fileFinishedImporting('modules/reanimated/native/useStateFromSharedValue.tsx'); exports.default = useStateFromSharedValue; exports.useDerivedStateFromSharedValue = useDerivedStateFromSharedValue; function _createForOfIteratorHelperLoose_68034(a0, a1) { // fn#68034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:121, offset: 0x01c3c843, size: 372 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun68035; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_68036(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_68036(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_68036(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun68035; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); function _fun68035() { // fn#68035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:692, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function useListenerSubscription(a0, a1) { // fn#68037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1335, offset: 0x01c3c9b7, size: 58 bytes, params: 3, frame: 15 const env0_0 = a0; const env0_1 = a1; ReactModule.useLayoutEffect(_fun68038, [a0, a1]); function _fun68038() { // fn#68038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1392, offset: 0x01c3c9f1, size: 234 bytes, params: 1, frame: 22 var environment; var set; var binding2; var moduleValue; var runOnUI; var closure; var object; const value = environment.__proto__; let binding = env1_5; const r1 = binding.get(env0_0) ?? createListenerState(env0_0); var env0_0 = r1; r1.listeners.add(require); if (r1.listeners.size === 1) { binding = env1_5; set = binding.set; binding2 = env0_0; Reflect.apply(set, binding, [binding2, r1]); moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */; runOnUI = moduleValue.runOnUI; closure = function(a0, a1, a2) { var env0_0 = a1; a2.addListener(a0, _fun68043); }; object = {}; object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS; closure.__closure = object; closure.__workletHash = 568027628003; closure.__initData = env1_6; Reflect.apply(runOnUI, moduleValue, [closure])(r1.listenerId, r1.valueListener, binding2); } return _fun68044; function createListenerState(a0) { // fn#68039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1428, offset: 0x01c3cadb, size: 82 bytes, params: 2, frame: 11 var environment; const Set = global.Set; let set = new Set(); const object = {sharedValue: a0, listeners: set, valueListener: valueListener}; set = environment.__proto__.__proto__; const binding = env2_4; object.listenerId = typeof binding === 'bigint' ? binding + 1n : +binding + 1; return object; function valueListener(a0) { // fn#68040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1521, owner: createListenerState.valueListener, offset: 0x01c3cb2d, size: 54 bytes, params: 2, frame: 12 var environment; const env0_0 = a0; const value = environment.__proto__.__proto__.__proto__; (ReactBatchUpdatesNativeModule).batchUpdates(_fun68041); function _fun68041() { // fn#68041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1548, offset: 0x01c3cb63, size: 67 bytes, params: 1, frame: 14 var r2; var value4; var value5; let value = environment.__proto__.__proto__.__proto__.__proto__; const _createForOfIteratorHelperLoose_68034Binding = _createForOfIteratorHelperLoose_68034; value = environment.__proto__; value = _createForOfIteratorHelperLoose_68034Binding(env1_0); const value2 = value(); let done = value2.done; if (!done) { for (r2 = value2; true; r2 = value5) { value4 = r2.value; value4(env0_0); value5 = value(); done = value5.done; if (done) { break; } } } } } } function s_68042(a0, a1, a2) { // fn#68042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1734, offset: 0x01c3cba6, size: 38 bytes, params: 4, frame: 13 const env0_0 = a1; a2.addListener(a0, _fun68043); function _fun68043(a0) { // fn#68043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1767, offset: 0x01c3cbcc, size: 52 bytes, params: 2, frame: 12 let value = environment.__proto__.__proto__.__proto__; value = require(4017) /* metro dependency 4017: ReanimatedRexport */; value = value.runOnJS(require); return value(a0); } } function _fun68044() { // fn#68044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:1916, offset: 0x01c3cc00, size: 168 bytes, params: 1, frame: 17 var environment; var value3; var moduleValue; var runOnUI; var closure; var value4; var listenerId; var binding; env0_0.listeners.delete(require); if (env0_0.listeners.size === 0) { value3 = environment.__proto__.__proto__; moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */; runOnUI = moduleValue.runOnUI; closure = function(a0, a1) { a1.removeListener(a0); }; closure.__closure = {}; closure.__workletHash = 15997703035823; closure.__initData = env2_7; value4 = Reflect.apply(runOnUI, moduleValue, [closure]); listenerId = env0_0.listenerId; binding = env1_0; value4(listenerId, binding); env2_5.delete(binding); } } } } function useStateFromSharedValue(a0) { // fn#68046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2229, offset: 0x01c3ccbd, size: 73 bytes, params: 2, frame: 15 const env0_0 = a0; const value3 = Module00057(ReactModule.useState(_fun68047), 2); const property = value3[0]; useListenerSubscription(a0, value3[1]); return property; function _fun68047() { // fn#68047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2283, offset: 0x01c3cd06, size: 18 bytes, params: 1, frame: 9 return env0_0.get(); } } function useDerivedStateFromSharedValue(a0, a1) { // fn#68048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2393, offset: 0x01c3cd18, size: 150 bytes, params: 3, frame: 17 const env0_0 = a0; const env0_1 = a1; const [property, env0_2] = env0_2Binding(env0_3Binding.useState(_fun68049), 2); var env0_3Binding = ReactModule.useRef(a1); env0_3Binding.useLayoutEffect(_fun68050); useListenerSubscription(a0, env0_3Binding.useCallback(_fun68051, [])); return property; function _fun68049() { // fn#68049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2456, offset: 0x01c3cdae, size: 30 bytes, params: 1, frame: 12 return require(env0_0.get(), undefined); } function _fun68050() { // fn#68050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2536, offset: 0x01c3cdcc, size: 21 bytes, params: 1, frame: 2 ReactModule.current = require; } function _fun68051(a0) { // fn#68051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2577, offset: 0x01c3cde1, size: 32 bytes, params: 2, frame: 11 const env0_0 = a0; return env0_2(_fun68052); function _fun68052(a0) { // fn#68052, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8806:2583, offset: 0x01c3ce01, size: 30 bytes, params: 2, frame: 13 return env1_3.current(env0_0, a0); } } } } global.__d(_fun68033, 8621, [57, 31, 690, 4017, 2]) /* metro module 8621, dependencies: [57, 31, 690, 4017, 2] */;