356 lines
15 KiB
TypeScript
356 lines
15 KiB
TypeScript
/* Metro module 10183; source: modules/quests/native/QuestContentImpressionTracker.native.tsx; dependencies: [57, 31, 7030, 9515, 661, 6266, 566, 9513, 9514, 7121, 2] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import UsePrevious from '../../../hooks/usePrevious.tsx'; /* Metro dependency 6266 */
|
|
import AppStateStore from '../../../stores/native/AppStateStore.tsx'; /* Metro dependency 7030 */
|
|
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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ContentImpressionTrackerHooksModule from '../lib/analytics/ContentImpressionTrackerHooks.tsx'; /* Metro dependency 9513 */
|
|
import * as ContentImpressionTrackerModule from '../lib/analytics/ContentImpressionTracker.tsx'; /* Metro dependency 9514 */
|
|
import * as ContentImpressionTrackerConstantsModule from '../lib/analytics/ContentImpressionTrackerConstants.tsx'; /* Metro dependency 9515 */
|
|
|
|
function _fun79242(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79242, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:6, offset: 0x01e4a496, size: 260 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_79245 = 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});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/quests/native/QuestContentImpressionTracker.native.tsx');
|
|
exports.QuestContentImpressionTrackerNative = QuestContentImpressionTrackerNative;
|
|
function _createForOfIteratorHelperLoose_79243(a0, a1) { // fn#79243, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:228, offset: 0x01e4a59a, 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 _fun79244;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_79245(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_79245(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_79245(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun79244;
|
|
}
|
|
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 _fun79244() { // fn#79244, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:799, 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 useVisibilityData({adContentIds, visibilityRef, overrideVisibility}) { // fn#79246, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:2034, offset: 0x01e4a70e, size: 175 bytes, params: 2, frame: 20
|
|
const [property, property2] = Module00057(ReactModule.useState(0), 2);
|
|
ReactModule.useEffect(_fun79247, [adContentIds, property2, visibilityRef]);
|
|
const r2 = overrideVisibility ?? property >= MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE;
|
|
object = {visible: r2};
|
|
object.visibleChanged = r2 !== (importDefault(6266) /* metro dependency 6266: usePrevious */)(r2);
|
|
return object;
|
|
function _fun79247() { // fn#79247, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:2172, offset: 0x01e4a7bd, size: 50 bytes, params: 1, frame: 11
|
|
initHandlers({adContentIds: adContentIds, setVisibilityPercentage: env0_2, visibilityRef: visibilityRef});
|
|
function initHandlers({adContentIds, setVisibilityPercentage, visibilityRef}) { // fn#79248, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:2178, offset: 0x01e4a7ef, size: 99 bytes, params: 2, frame: 14
|
|
var environment;
|
|
var r1;
|
|
var closure;
|
|
var value;
|
|
var value2;
|
|
var done;
|
|
var value3;
|
|
var value4;
|
|
reducibleJoin3: while (true) {
|
|
if (visibilityRef == null) {
|
|
break reducibleJoin3;
|
|
}
|
|
closure = function(a0) {
|
|
var env0_0 = a0;
|
|
var visibilityRefBinding = visibilityRef;
|
|
var children = visibilityRefBinding.current.children;
|
|
var object = {};
|
|
var children2 = visibilityRefBinding.current.children;
|
|
copyDataProperties(object, children2[a0], children2);
|
|
object['calculateVisibility'] = _fun79250;
|
|
children[a0] = object;
|
|
};
|
|
value = environment.__proto__.__proto__;
|
|
value = _createForOfIteratorHelperLoose_79243(adContentIds);
|
|
value2 = value();
|
|
done = value2.done;
|
|
if (done) {
|
|
break reducibleJoin3;
|
|
}
|
|
r1 = value2;
|
|
reducibleLoop2: while (true) {
|
|
value3 = r1.value;
|
|
closure(value3);
|
|
value4 = value();
|
|
done = value4.done;
|
|
if (done) {
|
|
break reducibleJoin3;
|
|
}
|
|
r1 = value4;
|
|
continue reducibleLoop2;
|
|
}
|
|
}
|
|
function initHandlers_loop(a0) { // fn#79249, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:2287, owner: initHandlers._loop, offset: 0x01e4a852, size: 73 bytes, params: 2, frame: 14
|
|
const env0_0 = a0;
|
|
const visibilityRefBinding = visibilityRef;
|
|
const children = visibilityRefBinding.current.children;
|
|
const object = {};
|
|
const children2 = visibilityRefBinding.current.children;
|
|
copyDataProperties(object, children2[a0], children2);
|
|
object['calculateVisibility'] = calculateVisibility;
|
|
children[a0] = object;
|
|
function calculateVisibility() { // fn#79250, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:2367, owner: initHandlers._loop.calculateVisibility, offset: 0x01e4a89b, size: 51 bytes, params: 1, frame: 12
|
|
setVisibilityPercentage(calculateVisibilityPercentage({visibilityRef: visibilityRef, entityId: env0_0}));
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function QuestContentImpressionTrackerNative(a0) { // fn#79252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:2809, offset: 0x01e4ab58, size: 370 bytes, params: 2, frame: 23
|
|
const state = (require(566) /* metro dependency 566: flux */).useStateFromStores([AppStateStore], function() {
|
|
return AppStateStore.getState();
|
|
});
|
|
const ACTIVE = AppStates.ACTIVE;
|
|
const value2 = state === ACTIVE;
|
|
const value3 = ReactModule.useRef(null);
|
|
const value4 = (UsePrevious)(value2);
|
|
const {key,
|
|
adContentIds} = (ContentImpressionTrackerHooksModule).useAdContentImpressionTrackerProps(a0);
|
|
object = {};
|
|
copyDataProperties(object, a0, undefined);
|
|
object['adContentIds'] = adContentIds;
|
|
const value6 = useVisibilityData(object);
|
|
object = {};
|
|
const value7 = copyDataProperties(object, a0, undefined);
|
|
copyDataProperties(object, value6, value7);
|
|
object['focused'] = value2;
|
|
object['focusedChanged'] = value2 !== value4;
|
|
object['reference'] = value3;
|
|
object['isFocused'] = value2;
|
|
const createElementBinding = createElement;
|
|
const QuestContentImpressionTracker = (ContentImpressionTrackerModule).QuestContentImpressionTracker;
|
|
const value8 = 'questOrQuests' in a0;
|
|
const object2 = {};
|
|
copyDataProperties(object2, object, value7);
|
|
object2['key'] = key;
|
|
object2['adContentIds'] = adContentIds;
|
|
if (value8) {
|
|
object2['adCreativeType'] = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType.QUEST;
|
|
} else {
|
|
object2['adCreativeType'] = a0.adCreativeType;
|
|
}
|
|
return createElementBinding(QuestContentImpressionTracker, object2);
|
|
}
|
|
|
|
}
|
|
|
|
function calculateVisibilityPercentage({visibilityRef, entityId}) { // fn#79251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10369:1172, offset: 0x01e4a8ce, size: 650 bytes, params: 2, frame: 19
|
|
var r3;
|
|
var r0;
|
|
var r4;
|
|
var current;
|
|
var property;
|
|
var parent;
|
|
var items2;
|
|
var scrollX;
|
|
var x;
|
|
var width;
|
|
var items3;
|
|
var firstItemOffset;
|
|
var Math;
|
|
var max;
|
|
var min;
|
|
var value2;
|
|
let value = undefined;
|
|
if (visibilityRef == null) {
|
|
r3 = value;
|
|
} else {
|
|
current = visibilityRef.current;
|
|
r3 = current == null || current.children == null ? value : current.children[entityId];
|
|
}
|
|
let layout = r3 == null ? value : r3.layout;
|
|
if (layout == null) {
|
|
return 0;
|
|
}
|
|
if (visibilityRef == null) {
|
|
layout = value;
|
|
} else {
|
|
parent = visibilityRef.current.parent;
|
|
layout = parent == null ? value : parent.layout;
|
|
}
|
|
if (layout == null) {
|
|
return 0;
|
|
}
|
|
let r2 = visibilityRef.current.axis ?? 'vertical';
|
|
if (r2 === 'horizontal') {
|
|
current = visibilityRef.current;
|
|
parent = current.parent;
|
|
scrollX = parent.scrollX;
|
|
if (scrollX == null) {
|
|
return 0;
|
|
}
|
|
layout = r3.layout;
|
|
x = layout.x;
|
|
items2 = [x];
|
|
layout = r3.layout;
|
|
x = layout.x;
|
|
layout = r3.layout;
|
|
width = layout.width;
|
|
items2[1] = x + width;
|
|
current = visibilityRef.current;
|
|
parent = current.parent;
|
|
scrollX = parent.scrollX;
|
|
items3 = [scrollX];
|
|
current = visibilityRef.current;
|
|
parent = current.parent;
|
|
scrollX = parent.scrollX;
|
|
current = visibilityRef.current;
|
|
parent = current.parent;
|
|
layout = parent.layout;
|
|
width = layout.width;
|
|
items3[1] = scrollX + width;
|
|
layout = r3.layout;
|
|
width = layout.width;
|
|
r0 = items3;
|
|
r2 = items2;
|
|
r4 = width;
|
|
current = visibilityRef.current;
|
|
parent = current.parent;
|
|
firstItemOffset = parent.firstItemOffset;
|
|
if (firstItemOffset != null) {
|
|
firstItemOffset = visibilityRef.current.parent.firstItemOffset;
|
|
r2[0] += firstItemOffset;
|
|
r2[1] += firstItemOffset;
|
|
}
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
property = r2[0];
|
|
value = Reflect.apply(max, Math, [property, r0[0]]);
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
property = r2[1];
|
|
value2 = Reflect.apply(min, Math, [property, r0[1]]);
|
|
} else {
|
|
if (visibilityRef.current.parent.scrollY == null) {
|
|
return 0;
|
|
}
|
|
var y = r3.layout.y;
|
|
items2 = [y];
|
|
y = r3.layout.y;
|
|
var height = r3.layout.height;
|
|
items2[1] = y + height;
|
|
height = r3.layout.height;
|
|
r0 = [visibilityRef.current.parent.scrollY,
|
|
visibilityRef.current.parent.scrollY + visibilityRef.current.parent.layout.height];
|
|
r2 = items2;
|
|
r4 = height;
|
|
firstItemOffset = visibilityRef.current.parent.firstItemOffset;
|
|
if (firstItemOffset != null) {
|
|
firstItemOffset = visibilityRef.current.parent.firstItemOffset;
|
|
r2[0] += firstItemOffset;
|
|
r2[1] += firstItemOffset;
|
|
}
|
|
Math = global.Math;
|
|
value = Math.max(r2[0], r0[0]);
|
|
Math = global.Math;
|
|
value2 = Math.min(r2[1], r0[1]);
|
|
}
|
|
Math = global.Math;
|
|
value = Math.max(0, value2 - value);
|
|
Math = global.Math;
|
|
return Math.min(value / r4, 1);
|
|
}
|
|
|
|
global.__d(_fun79242, 10183, [57, 31, 7030, 9515, 661, 6266, 566, 9513, 9514, 7121,
|
|
2]) /* metro module 10183, dependencies: [57, 31, 7030, 9515, 661, 6266, 566, 9513, 9514, 7121, 2] */;
|