decord/source/modules/app_analytics/clickstream/Clickstream.tsx

160 lines
4.6 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 5696
2026-07-27 11:26:19 +00:00
// Function ID: 49223
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-25 08:10:48 +00:00
// Dependencies: [57, 1194, 4203, 21, 5697, 675, 5698, 2]
2026-07-20 16:05:17 +00:00
// Exports: trackClickstream
2026-07-25 08:10:48 +00:00
// Module 5696 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
const require = arg1;
function _createForOfIteratorHelperLoose(iterable) {
let closure_0 = iterable;
iterable = "undefined" !== typeof Symbol;
if (iterable) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol;
2026-07-23 10:11:24 +00:00
iterable = iterable[Symbol.iterator];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (!iterable) {
iterable = iterable[Symbol.iterator];
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (iterable) {
const iter = iterable.call(iterable);
2026-07-20 16:05:17 +00:00
const next = iter.next;
return next.bind(iter);
} else {
const _Array = Array;
2026-07-23 10:11:24 +00:00
let tmp = iterable;
if (!Array.isArray(iterable)) {
2026-07-20 16:05:17 +00:00
let tmp2;
2026-07-23 10:11:24 +00:00
if (iterable) {
if ("string" === typeof iterable) {
tmp2 = _arrayLikeToArray(iterable, undefined);
2026-07-20 16:05:17 +00:00
} else {
const toString = {}.toString;
2026-07-23 10:11:24 +00:00
const substr = toString.call(iterable).slice(8, -1);
2026-07-20 16:05:17 +00:00
let name = substr;
if (tmp3) {
2026-07-23 10:11:24 +00:00
name = iterable.constructor.name;
2026-07-20 16:05:17 +00:00
}
if ("Map" !== name) {
if ("Set" !== name) {
if ("Arguments" === name) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray(iterable, undefined);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr;
}
const _Array2 = Array;
2026-07-23 10:11:24 +00:00
arr = Array.from(iterable);
const callResult = toString.call(iterable);
tmp3 = "Object" === substr && iterable.constructor;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2;
if (!tmp2) {
const _TypeError = TypeError;
const typeError = new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
throw typeError;
}
}
if (tmp) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0;
2026-07-20 16:05:17 +00:00
return () => {
2026-07-23 10:11:24 +00:00
if (closure_1 >= length.length) {
2026-07-20 16:05:17 +00:00
let obj = { done: true };
} else {
obj = { done: false };
closure_1 = tmp3 + 1;
2026-07-23 10:11:24 +00:00
obj.value = length[+closure_1];
2026-07-20 16:05:17 +00:00
}
return obj;
};
}
}
function _arrayLikeToArray(arg0, arg1) {
let length;
if (tmp) {
length = arg0.length;
}
const ArrayResult = Array(length);
for (let num = 0; num < length; num = num + 1) {
ArrayResult[num] = arg0[num];
}
return ArrayResult;
}
function isClickstreamEnabled(flag) {
if (flag === undefined) {
flag = true;
}
if (flag) {
2026-07-23 10:11:24 +00:00
const extractTimestampResult = importDefault(21).extractTimestamp(id.getId());
if (extractTimestampResult !== c7) {
2026-07-20 16:05:17 +00:00
drainClickstream(false);
2026-07-23 10:11:24 +00:00
c7 = extractTimestampResult;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const obj = importDefault(21);
2026-07-25 08:10:48 +00:00
let closure_8 = require(5697) /* clickstreamExperimentEnabled */.clickstreamExperimentEnabled();
const obj2 = require(5697) /* clickstreamExperimentEnabled */;
2026-07-20 16:05:17 +00:00
}
return closure_8;
}
function drainClickstream(flag) {
let done;
if (flag === undefined) {
flag = true;
}
if (isClickstreamEnabled(flag)) {
const tmp5 = _createForOfIteratorHelperLoose(map);
let iter = tmp5();
if (!iter.done) {
do {
2026-07-23 10:11:24 +00:00
let tmp6 = callback;
let tmp7 = callback(iter.value, 2);
2026-07-20 16:05:17 +00:00
let first = tmp7[0];
2026-07-23 10:11:24 +00:00
let tmp9 = importDefault;
let tmp10 = dependencyMap;
let obj = importDefault(675);
let tmp11 = require;
2026-07-25 08:10:48 +00:00
let obj2 = require(5698) /* getClickstreamDrainEvent */;
2026-07-20 16:05:17 +00:00
let trackResult = obj.track(first, obj2.getClickstreamDrainEvent(first, tmp7[1]));
let iter2 = tmp5();
iter = iter2;
done = iter2.done;
} while (!done);
}
map.clear();
} else {
map.clear();
}
}
const map = new Map();
2026-07-23 10:11:24 +00:00
let c7 = -1;
let c8 = false;
let result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/app_analytics/clickstream/Clickstream.tsx");
2026-07-20 16:05:17 +00:00
export const trackClickstream = function trackClickstream(GUILD_VIEWED_CLICKSTREAM, arg1) {
if (isClickstreamEnabled()) {
if (!map.has(GUILD_VIEWED_CLICKSTREAM)) {
const result = map.set(GUILD_VIEWED_CLICKSTREAM, []);
}
const value = map.get(GUILD_VIEWED_CLICKSTREAM);
if (null != value) {
const obj = {};
const _Date = Date;
const date = new Date();
obj.timestamp = date;
obj.rtc_state = state.getState();
const merged = Object.assign(arg1);
value.push(obj);
}
}
};
export { drainClickstream };