decord/source/1057_InteractionManager.js

125 lines
4.2 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1057
// Function ID: 1058
2026-07-20 16:05:17 +00:00
// Name: InteractionManager
2026-07-29 08:29:29 +00:00
// Dependencies: [41, 42, 1056]
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 1057 (InteractionManager)
2026-07-23 10:11:24 +00:00
import _classCallCheck from "_classCallCheck";
2026-07-29 08:29:29 +00:00
import _createClass from "_createClass";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
const InteractionManager = require;
2026-07-20 16:05:17 +00:00
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2026-07-29 08:29:29 +00:00
let c3 = 0;
class InteractionManager {
constructor() {
self = this;
tmp = InteractionManager;
tmp2 = outer1_2(this, InteractionManager);
__init = InteractionManager.prototype.__init;
call = __init.call;
if (typeof call === "unknown") {
__initResult = __init();
} else {
callResult = call(self);
}
__init2 = tmp.prototype.__init2;
call2 = __init2.call;
if (typeof call2 === "unknown") {
__init2Result = __init2();
} else {
call2Result = call2(self);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
let items = [
{
2026-07-20 16:05:17 +00:00
key: "__init",
value: function __init() {
this._longestInteractionList = [];
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "__init2",
value: function __init2() {
this._longestInteractionMap = new Map();
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "_resetInteractions",
value: function _resetInteractions() {
2026-07-29 08:29:29 +00:00
const interactionCount = InteractionManager(1056).getInteractionCount();
2026-07-20 16:05:17 +00:00
this._longestInteractionList.length = 0;
const _longestInteractionMap = this._longestInteractionMap;
_longestInteractionMap.clear();
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "_estimateP98LongestInteraction",
value: function _estimateP98LongestInteraction() {
const diff = this._longestInteractionList.length - 1;
2026-07-29 08:29:29 +00:00
const obj = InteractionManager(1056);
return this._longestInteractionList[Math.min(Math, diff, Math.floor(Math, (obj.getInteractionCount(obj) - c3) / 50))];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "_processEntry",
value: function _processEntry(interactionId) {
const self = this;
const _onBeforeProcessingEntry = this._onBeforeProcessingEntry;
2026-07-29 08:29:29 +00:00
if (_onBeforeProcessingEntry != null) {
const result = _onBeforeProcessingEntry(interactionId);
2026-07-20 16:05:17 +00:00
}
if (interactionId.interactionId) {
const _longestInteractionList = self._longestInteractionList;
const _longestInteractionMap = self._longestInteractionMap;
const value = _longestInteractionMap.get(interactionId.interactionId);
if (value) {
if (interactionId.duration > value._latency) {
const items = [interactionId];
value.entries = items;
value._latency = interactionId.duration;
let obj = value;
} else {
obj = value;
if (tmp6) {
const entries = value.entries;
entries.push(interactionId);
obj = value;
}
2026-07-29 08:29:29 +00:00
tmp6 = interactionId.duration === value._latency && interactionId.startTime === value.entries[0].startTime;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-29 08:29:29 +00:00
obj = { id: null, entries: null, _latency: null };
obj[0] = interactionId.interactionId;
2026-07-20 16:05:17 +00:00
const items1 = [interactionId];
2026-07-29 08:29:29 +00:00
obj[1] = items1;
obj[2] = interactionId.duration;
2026-07-20 16:05:17 +00:00
const _longestInteractionMap2 = self._longestInteractionMap;
2026-07-29 08:29:29 +00:00
const result1 = _longestInteractionMap2.set(obj.id, obj);
2026-07-20 16:05:17 +00:00
const prop = self._longestInteractionList;
prop.push(obj);
}
const _longestInteractionList2 = self._longestInteractionList;
const sorted = _longestInteractionList2.sort((_latency, _latency2) => _latency2._latency - _latency._latency);
if (self._longestInteractionList.length > 10) {
const prop1 = self._longestInteractionList;
const spliceResult = prop1.splice(10);
2026-07-29 08:29:29 +00:00
for (const item10060 of spliceResult) {
2026-07-20 16:05:17 +00:00
let _longestInteractionMap3 = self._longestInteractionMap;
2026-07-29 08:29:29 +00:00
let deleteResult = _longestInteractionMap3.delete(item10060.id);
2026-07-23 10:11:24 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
}
const _onAfterProcessingINPCandidate = self._onAfterProcessingINPCandidate;
2026-07-29 08:29:29 +00:00
if (_onAfterProcessingINPCandidate != null) {
const result2 = _onAfterProcessingINPCandidate(obj);
2026-07-20 16:05:17 +00:00
}
const atResult = _longestInteractionList.at(-1);
}
}
2026-07-29 08:29:29 +00:00
}
];
export const InteractionManager = _createClass(InteractionManager, items);