// Metro module 14192 (f14193). import { AnalyticEvents } from "../../Constants"; import AnalyticsUtils from "../../utils/AnalyticsUtils"; import MonitoringAgent from "../monitoring/MonitoringAgent"; import { MetricEvents } from "../../_bundle/Module5872"; import DiscordAppState_native from "../app_state/DiscordAppState.native"; let c9966_4 = 30000; class QuestHomeRoundtripTracker { constructor() { return { __proto__: new.target.prototype, startTime: null, timeoutTimer: null }; } clearTimeoutTimer() { if (this.timeoutTimer != null) { clearTimeout(this.timeoutTimer); this.timeoutTimer = null; } } sendMetric(a0, a1, a2) { AnalyticsUtils.track(AnalyticEvents.QUEST_HOME_ROUNDTRIP, { timeout: a0, duration: a1 }); if (!(Math.random() > 0.1)) { MonitoringAgent.distribution({ name: MetricEvents.QUEST_HOME_ROUNDTRIP, tags: [`includes_bounties:${a2}`, `timeout:${a0}`] }, a1); } } startTracking(r4 = {}) { let includesBounties2 = r4.includesBounties; if (includesBounties2 === void 0) { includesBounties2 = false; } const includesBounties = includesBounties2; this.clearTracking(); this.startTime = performance.now(); this.timeoutTimer = setTimeout(() => { this.stopTracking({ includesBounties, timeout: true }); }, c9966_4); } stopTracking(r2 = {}) { const { includesBounties: includesBounties2 = false, timeout = false } = r2; if (this.startTime != null) { if (DiscordAppState_native.getState() === "active") { this.sendMetric(timeout, Math.min(timeout ? c9966_4 : Math.round(performance.now() - this.startTime), c9966_4), includesBounties2); } this.clearTracking(); } } clearTracking() { this.clearTimeoutTimer(); this.startTime = null; } } const prototype = QuestHomeRoundtripTracker.prototype; export default { __proto__: prototype, startTime: null, timeoutTimer: null };