@overlayed/app 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
- var He = Object.defineProperty;
2
- var ze = (n, e, t) => e in n ? He(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var c = (n, e, t) => ze(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { type as K } from "arktype";
5
- import { createRequire as Y } from "node:module";
6
- import k, { existsSync as qe, mkdirSync as We, readFileSync as _e, writeFileSync as Qe, copyFileSync as Xe } from "node:fs";
7
- import m, { resolve as Je } from "node:path";
8
- import v from "node:fs/promises";
9
- import ke from "jszip";
10
- import { createHash as Ye } from "node:crypto";
11
- import Ze, { app as Pe } from "electron";
12
- var et = Object.defineProperty, tt = (n, e, t) => e in n ? et(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, R = (n, e, t) => tt(n, typeof e != "symbol" ? e + "" : e, t);
13
- function nt(n) {
14
- return { all: n = n || /* @__PURE__ */ new Map(), on: function(e, t) {
15
- var r = n.get(e);
16
- r ? r.push(t) : n.set(e, [t]);
1
+ var tt = Object.defineProperty;
2
+ var rt = (s, e, t) => e in s ? tt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var l = (s, e, t) => rt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { type as L } from "arktype";
5
+ import P, { mkdirSync as ce, existsSync as he, writeFileSync as ue, createWriteStream as Oe, readdirSync as Me, unlinkSync as $e, readFileSync as Ae, copyFileSync as st } from "node:fs";
6
+ import f, { join as D, resolve as nt } from "node:path";
7
+ import { createRequire as ee } from "node:module";
8
+ import w from "node:fs/promises";
9
+ import Re from "jszip";
10
+ import { createHash as it } from "node:crypto";
11
+ import at, { app as xe } from "electron";
12
+ var ot = Object.defineProperty, lt = (s, e, t) => e in s ? ot(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, b = (s, e, t) => lt(s, typeof e != "symbol" ? e + "" : e, t);
13
+ function ct(s) {
14
+ return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
15
+ var r = s.get(e);
16
+ r ? r.push(t) : s.set(e, [t]);
17
17
  }, off: function(e, t) {
18
- var r = n.get(e);
19
- r && (t ? r.splice(r.indexOf(t) >>> 0, 1) : n.set(e, []));
18
+ var r = s.get(e);
19
+ r && (t ? r.splice(r.indexOf(t) >>> 0, 1) : s.set(e, []));
20
20
  }, emit: function(e, t) {
21
- var r = n.get(e);
22
- r && r.slice().map(function(s) {
23
- s(t);
24
- }), (r = n.get("*")) && r.slice().map(function(s) {
25
- s(e, t);
21
+ var r = s.get(e);
22
+ r && r.slice().map(function(n) {
23
+ n(t);
24
+ }), (r = s.get("*")) && r.slice().map(function(n) {
25
+ n(e, t);
26
26
  });
27
27
  } };
28
28
  }
29
- let Ce = class {
29
+ let de = class {
30
30
  constructor() {
31
- R(this, "emitter"), this.emitter = nt();
31
+ b(this, "emitter"), this.emitter = ct();
32
32
  }
33
33
  on(e, t) {
34
34
  this.emitter.on(e, t);
@@ -44,14 +44,14 @@ let Ce = class {
44
44
  });
45
45
  }
46
46
  };
47
- function Ke(n, ...e) {
47
+ function ge(s, ...e) {
48
48
  var t;
49
- return t = class extends n {
49
+ return t = class extends s {
50
50
  /**
51
51
  * Lazy get the static instance
52
52
  */
53
53
  static getInstance() {
54
- return this._instance || (this._instance = new n(...e)), this._instance;
54
+ return this._instance || (this._instance = new s(...e)), this._instance;
55
55
  }
56
56
  /**
57
57
  * Release the instance (most of the time you won't need this)
@@ -59,9 +59,9 @@ function Ke(n, ...e) {
59
59
  static clearInstance() {
60
60
  this._instance = void 0;
61
61
  }
62
- }, R(t, "_instance"), t;
62
+ }, b(t, "_instance"), t;
63
63
  }
64
- class rt extends Ce {
64
+ let ht = class extends de {
65
65
  destroy() {
66
66
  this.removeAllListeners();
67
67
  }
@@ -89,21 +89,200 @@ class rt extends Ce {
89
89
  timestamp: Date.now()
90
90
  });
91
91
  }
92
- }
93
- Ke(rt);
94
- const st = Y(import.meta.url), {
95
- PipeEventServer: it,
96
- PipeEventClient: xn,
97
- PipeEventBase: $n,
98
- ProcessMonitor: Dn,
99
- Process: Tn,
100
- InjectionMethod: Bn,
101
- AccessLevel: Gn,
102
- HardwareInterface: jn
103
- } = st("@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node");
104
- let at = class extends Ce {
92
+ };
93
+ ge(ht);
94
+ let ut = class Te extends de {
95
+ constructor(e, t, r = "") {
96
+ super(), b(this, "stream"), b(this, "logPath"), b(this, "baseFileName"), b(this, "currentDate"), b(this, "rotationCheckInterval"), b(this, "isRotating", !1), this.logPath = e, this.baseFileName = t.replace(".log", ""), this.currentDate = this.getDateString(/* @__PURE__ */ new Date()), this.ensureLogDirectory(), this.ensureLogFile(), this.stream = this.createStream(), this.rotationCheckInterval = this.startRotationCheck(), this.cleanupOldLogs();
97
+ }
98
+ static scope(e, t, r) {
99
+ return new Te(e, t, r);
100
+ }
101
+ log(...e) {
102
+ this.write("log", ...e);
103
+ }
104
+ error(...e) {
105
+ this.write("error", ...e);
106
+ }
107
+ warn(...e) {
108
+ this.write("warn", ...e);
109
+ }
110
+ info(...e) {
111
+ this.write("info", ...e);
112
+ }
113
+ debug(...e) {
114
+ this.write("debug", ...e);
115
+ }
116
+ async close() {
117
+ clearInterval(this.rotationCheckInterval), await new Promise((e) => {
118
+ this.stream.end(() => e());
119
+ });
120
+ }
121
+ getCurrentFileName() {
122
+ return this.getFileName(this.currentDate);
123
+ }
124
+ getFileName(e) {
125
+ return `${this.baseFileName}-${e}.log`;
126
+ }
127
+ ensureLogDirectory() {
128
+ try {
129
+ ce(this.logPath, { recursive: !0 });
130
+ } catch (e) {
131
+ throw console.error(`Failed to create log directory ${this.logPath}:`, e), e;
132
+ }
133
+ }
134
+ ensureLogFile() {
135
+ const e = D(this.logPath, this.getFileName(this.currentDate));
136
+ if (!he(e))
137
+ try {
138
+ ue(e, "", "utf8");
139
+ } catch (t) {
140
+ throw console.error(`Failed to create log file ${e}:`, t), t;
141
+ }
142
+ }
143
+ getDateString(e) {
144
+ return e.toISOString().split("T")[0];
145
+ }
146
+ createStream() {
147
+ const e = D(this.logPath, this.getFileName(this.currentDate));
148
+ return Oe(e, {
149
+ flags: "a",
150
+ encoding: "utf8"
151
+ });
152
+ }
153
+ async rotateLogs() {
154
+ if (this.isRotating) return;
155
+ this.isRotating = !0;
156
+ const e = this.getDateString(/* @__PURE__ */ new Date());
157
+ e !== this.currentDate && await new Promise((t) => {
158
+ this.stream.end(() => {
159
+ this.currentDate = e, this.stream = this.createStream(), this.cleanupOldLogs(), t();
160
+ });
161
+ }), this.isRotating = !1;
162
+ }
163
+ startRotationCheck() {
164
+ return setInterval(() => this.rotateLogs(), 6e4);
165
+ }
166
+ cleanupOldLogs() {
167
+ const e = Me(this.logPath), t = /* @__PURE__ */ new Date();
168
+ t.setDate(t.getDate() - 3), e.filter((r) => r.startsWith(this.baseFileName) && r.endsWith(".log")).filter((r) => {
169
+ const n = r.replace(`${this.baseFileName}-`, "").replace(".log", "");
170
+ return new Date(n) < t;
171
+ }).forEach((r) => {
172
+ try {
173
+ $e(D(this.logPath, r));
174
+ } catch (n) {
175
+ console.error(`Failed to delete old log file ${r}:`, n);
176
+ }
177
+ });
178
+ }
179
+ write(e, ...t) {
180
+ const r = /* @__PURE__ */ new Date(), n = r.toISOString().replace("T", " ").replace(/\.\d+Z$/, "") + `.${r.getMilliseconds().toString().padStart(3, "0")}`, i = t.map((o) => typeof o == "object" ? JSON.stringify(o, void 0, 2) : String(o)).join(" "), a = `[${n}] [${e}] ${i}
181
+ `;
182
+ this.stream.write(a, (o) => {
183
+ o ? this.emit("error", o) : this.emit("write", a);
184
+ });
185
+ }
186
+ };
187
+ const dt = () => f.join(process.env.APPDATA ?? "", "overlayed"), gt = (s) => f.join(dt(), "apps", s), ft = (s) => f.join(gt(s), "logs");
188
+ let pt = class {
189
+ constructor() {
190
+ b(this, "data", []);
191
+ }
192
+ get size() {
193
+ return this.data.length;
194
+ }
195
+ add(e) {
196
+ this.data.push(e);
197
+ }
198
+ next() {
199
+ return this.data.shift();
200
+ }
201
+ clear() {
202
+ this.data.length = 0;
203
+ }
204
+ *flush() {
205
+ for (; this.size > 0; ) {
206
+ const e = this.next();
207
+ e && (yield e);
208
+ }
209
+ }
210
+ }, yt = class {
211
+ constructor() {
212
+ b(this, "fileName", "app.log"), b(this, "fileLogger"), b(this, "path"), b(this, "appId"), b(this, "messageQueue", new pt());
213
+ }
214
+ init(e) {
215
+ this.appId = e, this.path = ft(e), this.fileLogger = new ut(this.path, this.fileName), this.messageQueue.flush().forEach((t) => {
216
+ var r;
217
+ (r = this.fileLogger) == null || r[t.type](...t.args);
218
+ });
219
+ }
220
+ scope(e) {
221
+ if (!this.appId || !this.path)
222
+ throw new Error("Logger not initialized");
223
+ const t = `[${e}]`;
224
+ return {
225
+ scope: (r) => this.scope(r),
226
+ error: (...r) => this.error(t, ...r),
227
+ warn: (...r) => this.warn(t, ...r),
228
+ info: (...r) => this.info(t, ...r),
229
+ log: (...r) => this.log(t, ...r),
230
+ debug: (...r) => this.debug(t, ...r),
231
+ captureSentryException: (...r) => this.captureSentryException(t, ...r),
232
+ sentryError: (...r) => this.sentryError(t, ...r),
233
+ sentryLog: (...r) => this.sentryLog(t, ...r),
234
+ sentryWarn: (...r) => this.sentryWarn(t, ...r)
235
+ };
236
+ }
237
+ error(...e) {
238
+ this.handle("error", ...e);
239
+ }
240
+ warn(...e) {
241
+ this.handle("warn", ...e);
242
+ }
243
+ info(...e) {
244
+ this.handle("log", ...e);
245
+ }
246
+ debug(...e) {
247
+ this.handle("debug", ...e);
248
+ }
249
+ log(...e) {
250
+ this.handle("log", ...e);
251
+ }
252
+ captureSentryException(...e) {
253
+ this.handle("error", ...e);
254
+ }
255
+ sentryError(...e) {
256
+ this.handle("error", ...e);
257
+ }
258
+ sentryLog(...e) {
259
+ this.handle("log", ...e);
260
+ }
261
+ sentryWarn(...e) {
262
+ this.handle("warn", ...e);
263
+ }
264
+ sentryInfo(...e) {
265
+ this.handle("log", ...e);
266
+ }
267
+ handle(e, ...t) {
268
+ var r;
269
+ console[e](...t), ((r = this.fileLogger) == null ? void 0 : r[e](...t)) ?? this.messageQueue.add({ type: e, args: t });
270
+ }
271
+ };
272
+ ge(yt);
273
+ const mt = ee(import.meta.url), {
274
+ PipeEventServer: bt,
275
+ PipeEventClient: Yr,
276
+ PipeEventBase: Zr,
277
+ ProcessMonitor: es,
278
+ Process: ts,
279
+ InjectionMethod: rs,
280
+ AccessLevel: ss,
281
+ HardwareInterface: ns
282
+ } = mt("@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node");
283
+ let vt = class extends de {
105
284
  constructor(e) {
106
- super(), R(this, "server", null), R(this, "_hasConnection", !1), R(this, "pipeId"), this.pipeId = e, this.init();
285
+ super(), b(this, "server", null), b(this, "_hasConnection", !1), b(this, "pipeId"), this.pipeId = e, this.init();
107
286
  }
108
287
  get hasConnection() {
109
288
  return this._hasConnection;
@@ -115,7 +294,7 @@ let at = class extends Ce {
115
294
  // TODO make sure that new events and new event keys do not stop the app from working
116
295
  // this is because we may have new events/event keys from a DLL but the types/validations might not be up to date
117
296
  init() {
118
- this.server = new it(this.pipeId, { clientCount: 1, access: 1 }), this.server.on("event", (e) => {
297
+ this.server = new bt(this.pipeId, { clientCount: 1, access: 1 }), this.server.on("event", (e) => {
119
298
  try {
120
299
  const t = JSON.parse(e);
121
300
  this.emit("data", [t]);
@@ -129,27 +308,27 @@ let at = class extends Ce {
129
308
  });
130
309
  }
131
310
  };
132
- const oe = Ke(at, "stats-cc");
133
- function ot(n) {
134
- return { all: n = n || /* @__PURE__ */ new Map(), on: function(e, t) {
135
- var r = n.get(e);
136
- r ? r.push(t) : n.set(e, [t]);
311
+ const fe = ge(vt, "stats-cc");
312
+ function wt(s) {
313
+ return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
314
+ var r = s.get(e);
315
+ r ? r.push(t) : s.set(e, [t]);
137
316
  }, off: function(e, t) {
138
- var r = n.get(e);
139
- r && (t ? r.splice(r.indexOf(t) >>> 0, 1) : n.set(e, []));
317
+ var r = s.get(e);
318
+ r && (t ? r.splice(r.indexOf(t) >>> 0, 1) : s.set(e, []));
140
319
  }, emit: function(e, t) {
141
- var r = n.get(e);
142
- r && r.slice().map(function(s) {
143
- s(t);
144
- }), (r = n.get("*")) && r.slice().map(function(s) {
145
- s(e, t);
320
+ var r = s.get(e);
321
+ r && r.slice().map(function(n) {
322
+ n(t);
323
+ }), (r = s.get("*")) && r.slice().map(function(n) {
324
+ n(e, t);
146
325
  });
147
326
  } };
148
327
  }
149
- class Se {
328
+ class pe {
150
329
  constructor() {
151
- c(this, "emitter");
152
- this.emitter = ot();
330
+ l(this, "emitter");
331
+ this.emitter = wt();
153
332
  }
154
333
  on(e, t) {
155
334
  this.emitter.on(e, t);
@@ -165,14 +344,14 @@ class Se {
165
344
  });
166
345
  }
167
346
  }
168
- function _(n, ...e) {
347
+ function E(s, ...e) {
169
348
  var r;
170
- return r = class extends n {
349
+ return r = class extends s {
171
350
  /**
172
351
  * Lazy get the static instance
173
352
  */
174
353
  static getInstance() {
175
- return this._instance || (this._instance = new n(...e)), this._instance;
354
+ return this._instance || (this._instance = new s(...e)), this._instance;
176
355
  }
177
356
  /**
178
357
  * Release the instance (most of the time you won't need this)
@@ -180,9 +359,9 @@ function _(n, ...e) {
180
359
  static clearInstance() {
181
360
  this._instance = void 0;
182
361
  }
183
- }, c(r, "_instance"), r;
362
+ }, l(r, "_instance"), r;
184
363
  }
185
- class lt extends Se {
364
+ class It extends pe {
186
365
  destroy() {
187
366
  this.removeAllListeners();
188
367
  }
@@ -211,15 +390,15 @@ class lt extends Se {
211
390
  });
212
391
  }
213
392
  }
214
- const I = _(lt);
215
- class ct {
393
+ const I = E(It);
394
+ class Et {
216
395
  constructor(e) {
217
- c(this, "data");
218
- c(this, "_schema");
219
- c(this, "_defaultValue");
220
- c(this, "_path");
221
- const { schema: t, default: r, path: s } = e;
222
- this._schema = t, this._defaultValue = r, this._path = s;
396
+ l(this, "data");
397
+ l(this, "_schema");
398
+ l(this, "_defaultValue");
399
+ l(this, "_path");
400
+ const { schema: t, default: r, path: n } = e;
401
+ this._schema = t, this._defaultValue = r, this._path = n;
223
402
  }
224
403
  set(e) {
225
404
  const t = this._schema["~standard"].validate(e);
@@ -240,7 +419,7 @@ class ct {
240
419
  save(e) {
241
420
  const t = this.onBeforeSave(e);
242
421
  try {
243
- k.writeFileSync(this.getFilePath(), JSON.stringify(t, void 0, 2));
422
+ P.writeFileSync(this.getFilePath(), JSON.stringify(t, void 0, 2));
244
423
  } catch {
245
424
  return;
246
425
  }
@@ -253,7 +432,7 @@ class ct {
253
432
  return this.data = e, e;
254
433
  }
255
434
  try {
256
- const e = k.readFileSync(this.getFilePath(), "utf8"), t = this.onAfterLoad(this.parseStoredData(e));
435
+ const e = P.readFileSync(this.getFilePath(), "utf8"), t = this.onAfterLoad(this.parseStoredData(e));
257
436
  return this.data = t, t;
258
437
  } catch {
259
438
  return this.data = this._defaultValue;
@@ -270,35 +449,35 @@ class ct {
270
449
  }
271
450
  parseStoredData(e) {
272
451
  try {
273
- const r = K("string.json.parse").to("object")(e);
274
- if (r instanceof K.errors)
452
+ const r = L("string.json.parse").to("object")(e);
453
+ if (r instanceof L.errors)
275
454
  return this._defaultValue;
276
- const s = this._schema["~standard"].validate(r);
277
- if (s instanceof Promise)
455
+ const n = this._schema["~standard"].validate(r);
456
+ if (n instanceof Promise)
278
457
  throw new Error("StructuredConfigFile does not support async validation");
279
- return s.issues ? this.migrate(r, this._defaultValue) : this.migrate(s.value, this._defaultValue);
458
+ return n.issues ? this.migrate(r, this._defaultValue) : this.migrate(n.value, this._defaultValue);
280
459
  } catch {
281
460
  return this._defaultValue;
282
461
  }
283
462
  }
284
463
  canReadWriteFile(e) {
285
464
  try {
286
- return k.accessSync(e, k.constants.R_OK | k.constants.W_OK), !0;
465
+ return P.accessSync(e, P.constants.R_OK | P.constants.W_OK), !0;
287
466
  } catch {
288
467
  return !1;
289
468
  }
290
469
  }
291
470
  fileExists(e) {
292
471
  try {
293
- return k.accessSync(e, k.constants.F_OK), !0;
472
+ return P.accessSync(e, P.constants.F_OK), !0;
294
473
  } catch {
295
474
  return !1;
296
475
  }
297
476
  }
298
477
  migrate(e, t) {
299
478
  const r = { ...e };
300
- for (const s in t)
301
- Object.prototype.hasOwnProperty.call(t, s) && (s in e ? e[s] !== null && t[s] !== null && typeof e[s] == "object" && typeof t[s] == "object" && !Array.isArray(e[s]) && !Array.isArray(t[s]) ? r[s] = this.migrate(e[s], t[s]) : Array.isArray(t[s]) && (r[s] = e[s]) : r[s] = t[s]);
479
+ for (const n in t)
480
+ Object.prototype.hasOwnProperty.call(t, n) && (n in e ? e[n] !== null && t[n] !== null && typeof e[n] == "object" && typeof t[n] == "object" && !Array.isArray(e[n]) && !Array.isArray(t[n]) ? r[n] = this.migrate(e[n], t[n]) : Array.isArray(t[n]) && (r[n] = e[n]) : r[n] = t[n]);
302
481
  return r;
303
482
  }
304
483
  reportInvalidConfigFile(e) {
@@ -309,77 +488,210 @@ class ct {
309
488
  });
310
489
  }
311
490
  }
312
- const Me = {
313
- scope: (n) => ({
314
- log: (...e) => {
315
- console.log(n, ...e);
316
- },
317
- error: (...e) => {
318
- console.error(n, ...e);
319
- },
320
- warn: (...e) => {
321
- console.warn(n, ...e);
322
- },
323
- info: (...e) => {
324
- console.info(n, ...e);
325
- },
326
- debug: (...e) => {
327
- console.debug(n, ...e);
328
- },
329
- captureSentryException: (...e) => {
330
- console.error(n, ...e);
331
- },
332
- sentryError: (...e) => {
333
- console.error(n, ...e);
334
- },
335
- sentryLog: (...e) => {
336
- console.log(n, ...e);
337
- },
338
- sentryWarn: (...e) => {
339
- console.warn(n, ...e);
491
+ class ye extends pe {
492
+ constructor(t, r, n = "") {
493
+ super();
494
+ l(this, "stream");
495
+ l(this, "logPath");
496
+ l(this, "baseFileName");
497
+ l(this, "currentDate");
498
+ l(this, "rotationCheckInterval");
499
+ l(this, "isRotating", !1);
500
+ this.logPath = t, this.baseFileName = r.replace(".log", ""), this.currentDate = this.getDateString(/* @__PURE__ */ new Date()), this.ensureLogDirectory(), this.ensureLogFile(), this.stream = this.createStream(), this.rotationCheckInterval = this.startRotationCheck(), this.cleanupOldLogs();
501
+ }
502
+ static scope(t, r, n) {
503
+ return new ye(t, r, n);
504
+ }
505
+ log(...t) {
506
+ this.write("log", ...t);
507
+ }
508
+ error(...t) {
509
+ this.write("error", ...t);
510
+ }
511
+ warn(...t) {
512
+ this.write("warn", ...t);
513
+ }
514
+ info(...t) {
515
+ this.write("info", ...t);
516
+ }
517
+ debug(...t) {
518
+ this.write("debug", ...t);
519
+ }
520
+ async close() {
521
+ clearInterval(this.rotationCheckInterval), await new Promise((t) => {
522
+ this.stream.end(() => t());
523
+ });
524
+ }
525
+ getCurrentFileName() {
526
+ return this.getFileName(this.currentDate);
527
+ }
528
+ getFileName(t) {
529
+ return `${this.baseFileName}-${t}.log`;
530
+ }
531
+ ensureLogDirectory() {
532
+ try {
533
+ ce(this.logPath, { recursive: !0 });
534
+ } catch (t) {
535
+ throw console.error(`Failed to create log directory ${this.logPath}:`, t), t;
536
+ }
537
+ }
538
+ ensureLogFile() {
539
+ const t = D(this.logPath, this.getFileName(this.currentDate));
540
+ if (!he(t))
541
+ try {
542
+ ue(t, "", "utf8");
543
+ } catch (r) {
544
+ throw console.error(`Failed to create log file ${t}:`, r), r;
545
+ }
546
+ }
547
+ getDateString(t) {
548
+ return t.toISOString().split("T")[0];
549
+ }
550
+ createStream() {
551
+ const t = D(this.logPath, this.getFileName(this.currentDate));
552
+ return Oe(t, {
553
+ flags: "a",
554
+ encoding: "utf8"
555
+ });
556
+ }
557
+ async rotateLogs() {
558
+ if (this.isRotating) return;
559
+ this.isRotating = !0;
560
+ const t = this.getDateString(/* @__PURE__ */ new Date());
561
+ t !== this.currentDate && await new Promise((r) => {
562
+ this.stream.end(() => {
563
+ this.currentDate = t, this.stream = this.createStream(), this.cleanupOldLogs(), r();
564
+ });
565
+ }), this.isRotating = !1;
566
+ }
567
+ startRotationCheck() {
568
+ return setInterval(() => this.rotateLogs(), 6e4);
569
+ }
570
+ cleanupOldLogs() {
571
+ const t = Me(this.logPath), r = /* @__PURE__ */ new Date();
572
+ r.setDate(r.getDate() - 3), t.filter((n) => n.startsWith(this.baseFileName) && n.endsWith(".log")).filter((n) => {
573
+ const i = n.replace(`${this.baseFileName}-`, "").replace(".log", "");
574
+ return new Date(i) < r;
575
+ }).forEach((n) => {
576
+ try {
577
+ $e(D(this.logPath, n));
578
+ } catch (i) {
579
+ console.error(`Failed to delete old log file ${n}:`, i);
580
+ }
581
+ });
582
+ }
583
+ write(t, ...r) {
584
+ const n = /* @__PURE__ */ new Date(), i = n.toISOString().replace("T", " ").replace(/\.\d+Z$/, "") + `.${n.getMilliseconds().toString().padStart(3, "0")}`, a = r.map((c) => typeof c == "object" ? JSON.stringify(c, void 0, 2) : String(c)).join(" "), o = `[${i}] [${t}] ${a}
585
+ `;
586
+ this.stream.write(o, (c) => {
587
+ c ? this.emit("error", c) : this.emit("write", o);
588
+ });
589
+ }
590
+ }
591
+ const te = () => f.join(process.env.APPDATA ?? "", "overlayed"), _t = (s) => f.join(te(), "apps", s), kt = (s) => f.join(_t(s), "logs");
592
+ class Be {
593
+ constructor() {
594
+ l(this, "data", []);
595
+ }
596
+ get size() {
597
+ return this.data.length;
598
+ }
599
+ add(e) {
600
+ this.data.push(e);
601
+ }
602
+ next() {
603
+ return this.data.shift();
604
+ }
605
+ clear() {
606
+ this.data.length = 0;
607
+ }
608
+ *flush() {
609
+ for (; this.size > 0; ) {
610
+ const e = this.next();
611
+ e && (yield e);
340
612
  }
341
- }),
342
- error: (...n) => {
343
- console.error(name, ...n);
344
- },
345
- warn: (...n) => {
346
- console.warn(name, ...n);
347
- },
348
- info: (...n) => {
349
- console.info(name, ...n);
350
- },
351
- debug: (...n) => {
352
- console.debug(name, ...n);
353
- },
354
- captureSentryException: (...n) => {
355
- console.error(name, ...n);
356
- },
357
- sentryError: (...n) => {
358
- console.error(name, ...n);
359
- },
360
- sentryLog: (...n) => {
361
- console.log(name, ...n);
362
- },
363
- sentryWarn: (...n) => {
364
- console.warn(name, ...n);
365
- },
366
- sentryInfo: (...n) => {
367
- console.info(name, ...n);
368
- }
369
- }, le = () => m.join(process.env.APPDATA ?? "", "overlayed");
370
- function ut(n = []) {
371
- return m.normalize(m.join(le(), global.OVERLAYED.APP_NAME, ...n));
613
+ }
372
614
  }
373
- const dt = K({
615
+ class Pt {
616
+ constructor() {
617
+ l(this, "fileName", "app.log");
618
+ l(this, "fileLogger");
619
+ l(this, "path");
620
+ l(this, "appId");
621
+ l(this, "messageQueue", new Be());
622
+ }
623
+ init(e) {
624
+ this.appId = e, this.path = kt(e), this.fileLogger = new ye(this.path, this.fileName), this.messageQueue.flush().forEach((t) => {
625
+ var r;
626
+ (r = this.fileLogger) == null || r[t.type](...t.args);
627
+ });
628
+ }
629
+ scope(e) {
630
+ if (!this.appId || !this.path)
631
+ throw new Error("Logger not initialized");
632
+ const t = `[${e}]`;
633
+ return {
634
+ scope: (r) => this.scope(r),
635
+ error: (...r) => this.error(t, ...r),
636
+ warn: (...r) => this.warn(t, ...r),
637
+ info: (...r) => this.info(t, ...r),
638
+ log: (...r) => this.log(t, ...r),
639
+ debug: (...r) => this.debug(t, ...r),
640
+ captureSentryException: (...r) => this.captureSentryException(t, ...r),
641
+ sentryError: (...r) => this.sentryError(t, ...r),
642
+ sentryLog: (...r) => this.sentryLog(t, ...r),
643
+ sentryWarn: (...r) => this.sentryWarn(t, ...r)
644
+ };
645
+ }
646
+ error(...e) {
647
+ this.handle("error", ...e);
648
+ }
649
+ warn(...e) {
650
+ this.handle("warn", ...e);
651
+ }
652
+ info(...e) {
653
+ this.handle("log", ...e);
654
+ }
655
+ debug(...e) {
656
+ this.handle("debug", ...e);
657
+ }
658
+ log(...e) {
659
+ this.handle("log", ...e);
660
+ }
661
+ captureSentryException(...e) {
662
+ this.handle("error", ...e);
663
+ }
664
+ sentryError(...e) {
665
+ this.handle("error", ...e);
666
+ }
667
+ sentryLog(...e) {
668
+ this.handle("log", ...e);
669
+ }
670
+ sentryWarn(...e) {
671
+ this.handle("warn", ...e);
672
+ }
673
+ sentryInfo(...e) {
674
+ this.handle("log", ...e);
675
+ }
676
+ handle(e, ...t) {
677
+ var r;
678
+ console[e](...t), ((r = this.fileLogger) == null ? void 0 : r[e](...t)) ?? this.messageQueue.add({ type: e, args: t });
679
+ }
680
+ }
681
+ const me = E(Pt);
682
+ function St(s = []) {
683
+ return f.normalize(f.join(te(), global.OVERLAYED.APP_NAME, ...s));
684
+ }
685
+ const Ct = L({
374
686
  game: "string",
375
687
  type: "string",
376
688
  creation_time: "number"
377
689
  });
378
- class Ae {
690
+ class Ne {
379
691
  constructor(e) {
380
- c(this, "logger");
381
- c(this, "initialized", !1);
382
- this.logger = Me.scope(e);
692
+ l(this, "logger");
693
+ l(this, "initialized", !1);
694
+ this.logger = me.getInstance().scope(e);
383
695
  }
384
696
  init() {
385
697
  this.logger.log("Initializing"), this.initialized = !0;
@@ -388,12 +700,12 @@ class Ae {
388
700
  this.logger.log("Destroying"), this.initialized = !1;
389
701
  }
390
702
  }
391
- class G extends Se {
703
+ class N extends pe {
392
704
  constructor(t) {
393
705
  super();
394
- c(this, "logger");
395
- c(this, "initialized", !1);
396
- this.logger = Me.scope(t);
706
+ l(this, "logger");
707
+ l(this, "initialized", !1);
708
+ this.logger = me.getInstance().scope(t);
397
709
  }
398
710
  init() {
399
711
  this.logger.log("Initializing"), this.initialized = !0;
@@ -402,157 +714,157 @@ class G extends Se {
402
714
  this.logger.log("Destroying"), this.initialized = !1, this.removeAllListeners();
403
715
  }
404
716
  }
405
- var L = "object", Le = "function", Oe = "prototype", ee = "text", ce = "json", ye = "abort", ne = "paramsSerializer", me = "addEventListener", V = "status", w = "headers", Z = Object, S = void 0, W = null, re = Z[Oe], Q = Z.keys, x = Array.isArray, be = "method", Fe = "HEAD", se = "GET", Re = "OPTIONS", ht = "POST", gt = "PUT", ft = "PATCH", pt = "DELETE";
406
- function yt(n, e) {
717
+ var M = "object", Ge = "function", je = "prototype", se = "text", be = "json", Pe = "abort", ne = "paramsSerializer", Se = "addEventListener", V = "status", k = "headers", re = Object, K = void 0, J = null, ie = re[je], X = re.keys, A = Array.isArray, Ce = "method", Ve = "HEAD", ae = "GET", He = "OPTIONS", Lt = "POST", Kt = "PUT", Ft = "PATCH", Dt = "DELETE";
718
+ function Ot(s, e) {
407
719
  let t = new AbortController();
408
720
  function r(o) {
409
- t.abort(o), a();
721
+ t.abort(o), i();
410
722
  }
411
- let s = [];
412
- for (let o of n) {
723
+ let n = [];
724
+ for (let o of s) {
413
725
  if ((o == null ? void 0 : o.aborted) === !0) {
414
726
  r(o.reason);
415
727
  break;
416
728
  }
417
- if (o != null && o[me]) {
418
- let l = () => {
729
+ if (o != null && o[Se]) {
730
+ let c = () => {
419
731
  r(o.reason);
420
732
  };
421
- s.push(() => {
422
- var d;
423
- (d = o.removeEventListener) == null || d.call(o, ye, l);
424
- }), o[me](ye, l);
733
+ n.push(() => {
734
+ var u;
735
+ (u = o.removeEventListener) == null || u.call(o, Pe, c);
736
+ }), o[Se](Pe, c);
425
737
  }
426
738
  }
427
- function a() {
428
- s.forEach((o) => o()), e == null || e();
739
+ function i() {
740
+ n.forEach((o) => o()), e == null || e();
429
741
  }
430
- let i = t.signal;
431
- return i.clear = a, i;
742
+ let a = t.signal;
743
+ return a.clear = i, a;
432
744
  }
433
- var ve = Z.getPrototypeOf, Ie = (n) => {
434
- if (n !== W && typeof n === L) {
435
- if (typeof ve === Le) {
436
- let e = ve(n);
437
- return e === re || e === W;
745
+ var Le = re.getPrototypeOf, Ke = (s) => {
746
+ if (s !== J && typeof s === M) {
747
+ if (typeof Le === Ge) {
748
+ let e = Le(s);
749
+ return e === ie || e === J;
438
750
  }
439
- return re.toString.call(n) === `[${L} Object]`;
751
+ return ie.toString.call(s) === `[${M} Object]`;
440
752
  }
441
753
  return !1;
442
- }, ue = (...n) => n.reduce((e, t) => {
443
- if (x(t)) throw new TypeError(`Arguments must be ${L}s, not arrays.`);
444
- return Q(t).forEach((r) => {
445
- ["__proto__", "constructor", Oe].includes(r) || (x(e[r]) && x(t[r]) ? e[r] = Array.from(new Set(e[r].concat(t[r]))) : Ie(e[r]) && Ie(t[r]) ? e[r] = ue(e[r], t[r]) : e[r] = t[r]);
754
+ }, ve = (...s) => s.reduce((e, t) => {
755
+ if (A(t)) throw new TypeError(`Arguments must be ${M}s, not arrays.`);
756
+ return X(t).forEach((r) => {
757
+ ["__proto__", "constructor", je].includes(r) || (A(e[r]) && A(t[r]) ? e[r] = Array.from(new Set(e[r].concat(t[r]))) : Ke(e[r]) && Ke(t[r]) ? e[r] = ve(e[r], t[r]) : e[r] = t[r]);
446
758
  }), e;
447
759
  }, {});
448
- function de(n, e = !0, t = W, r) {
449
- if (n === S || n === W) return "";
450
- let s = [], a = e ? encodeURIComponent : (g) => g, i = x(n), { arrayFormat: o, allowDots: l, serializeDate: d } = r || {}, h = (g) => {
451
- if (l && !i) return `.${g}`;
452
- if (i) {
760
+ function we(s, e = !0, t = J, r) {
761
+ if (s === K || s === J) return "";
762
+ let n = [], i = e ? encodeURIComponent : (g) => g, a = A(s), { arrayFormat: o, allowDots: c, serializeDate: u } = r || {}, d = (g) => {
763
+ if (c && !a) return `.${g}`;
764
+ if (a) {
453
765
  if (o === "brackets") return "[]";
454
766
  if (o === "repeat") return "";
455
767
  }
456
768
  return `[${g}]`;
457
769
  };
458
- for (let g in n) if (re.hasOwnProperty.call(n, g)) {
459
- let u = n[g];
460
- if (u !== S) {
461
- let p = t ? `${t}${h(g)}` : a(g);
462
- if (!isNaN(u) && u instanceof Date && (u = d ? d(u) : u.toISOString()), typeof u === L) {
463
- let f = de(u, e, p, r);
464
- f !== "" && s.push(f);
465
- } else s.push(`${a(p)}=${a(u)}`);
770
+ for (let g in s) if (ie.hasOwnProperty.call(s, g)) {
771
+ let h = s[g];
772
+ if (h !== K) {
773
+ let y = t ? `${t}${d(g)}` : i(g);
774
+ if (!isNaN(h) && h instanceof Date && (h = u ? u(h) : h.toISOString()), typeof h === M) {
775
+ let p = we(h, e, y, r);
776
+ p !== "" && n.push(p);
777
+ } else n.push(`${i(y)}=${i(h)}`);
466
778
  }
467
779
  }
468
- return s.join("&");
780
+ return n.join("&");
469
781
  }
470
- function ie(n) {
471
- return x(n) ? n.map(ie) : (n && typeof n === L && Q(n).forEach((e) => {
472
- let t = n[e];
473
- t === S ? delete n[e] : ie(t);
474
- }), n);
782
+ function oe(s) {
783
+ return A(s) ? s.map(oe) : (s && typeof s === M && X(s).forEach((e) => {
784
+ let t = s[e];
785
+ t === K ? delete s[e] : oe(t);
786
+ }), s);
475
787
  }
476
- function mt(n) {
477
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(n);
788
+ function Mt(s) {
789
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(s);
478
790
  }
479
- function bt(n, e) {
480
- return n ? e ? (n.endsWith("/") ? n : n + "/") + (e[0] === "/" ? e.slice(1) : e) : n : e || "";
791
+ function $t(s, e) {
792
+ return s ? e ? (s.endsWith("/") ? s : s + "/") + (e[0] === "/" ? e.slice(1) : e) : s : e || "";
481
793
  }
482
- var vt = "XiorError", It = "XiorTimeoutError", xe = class extends Error {
483
- constructor(n, e, t) {
484
- super(n), this.name = vt, this.request = e, this.config = e, this.response = t;
794
+ var At = "XiorError", Rt = "XiorTimeoutError", Ue = class extends Error {
795
+ constructor(s, e, t) {
796
+ super(s), this.name = At, this.request = e, this.config = e, this.response = t;
485
797
  }
486
- }, Et = class extends xe {
798
+ }, xt = class extends Ue {
487
799
  constructor(e, t, r) {
488
- super(e, t, r), this.name = It;
800
+ super(e, t, r), this.name = Rt;
489
801
  }
490
- }, wt = Object.defineProperty, _t = Object.defineProperties, kt = Object.getOwnPropertyDescriptors, X = Object.getOwnPropertySymbols, $e = Object.prototype.hasOwnProperty, De = Object.prototype.propertyIsEnumerable, Ee = (n, e, t) => e in n ? wt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, $ = (n, e) => {
491
- for (var t in e || (e = {})) $e.call(e, t) && Ee(n, t, e[t]);
492
- if (X) for (var t of X(e)) De.call(e, t) && Ee(n, t, e[t]);
493
- return n;
494
- }, z = (n, e) => _t(n, kt(e)), Pt = (n, e) => {
802
+ }, Tt = Object.defineProperty, Bt = Object.defineProperties, Nt = Object.getOwnPropertyDescriptors, Y = Object.getOwnPropertySymbols, ze = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable, Fe = (s, e, t) => e in s ? Tt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, R = (s, e) => {
803
+ for (var t in e || (e = {})) ze.call(e, t) && Fe(s, t, e[t]);
804
+ if (Y) for (var t of Y(e)) We.call(e, t) && Fe(s, t, e[t]);
805
+ return s;
806
+ }, q = (s, e) => Bt(s, Nt(e)), Gt = (s, e) => {
495
807
  var t = {};
496
- for (var r in n) $e.call(n, r) && e.indexOf(r) < 0 && (t[r] = n[r]);
497
- if (n != null && X) for (var r of X(n)) e.indexOf(r) < 0 && De.call(n, r) && (t[r] = n[r]);
808
+ for (var r in s) ze.call(s, r) && e.indexOf(r) < 0 && (t[r] = s[r]);
809
+ if (s != null && Y) for (var r of Y(s)) e.indexOf(r) < 0 && We.call(s, r) && (t[r] = s[r]);
498
810
  return t;
499
- }, D = (n, e, t) => new Promise((r, s) => {
500
- var a = (l) => {
811
+ }, x = (s, e, t) => new Promise((r, n) => {
812
+ var i = (c) => {
501
813
  try {
502
- o(t.next(l));
503
- } catch (d) {
504
- s(d);
814
+ o(t.next(c));
815
+ } catch (u) {
816
+ n(u);
505
817
  }
506
- }, i = (l) => {
818
+ }, a = (c) => {
507
819
  try {
508
- o(t.throw(l));
509
- } catch (d) {
510
- s(d);
820
+ o(t.throw(c));
821
+ } catch (u) {
822
+ n(u);
511
823
  }
512
- }, o = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(a, i);
513
- o((t = t.apply(n, e)).next());
514
- }), he = "application/", Te = `${he}x-www-form-urlencoded`, Be = RegExp, Ct = new Be(`^${Te}`, "i"), Kt = `${he}${ce}`, St = new Be(`^${he}.*${ce}.*`, "i");
515
- function Mt(n = se) {
516
- return [Fe, se, Re].includes(n);
824
+ }, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(i, a);
825
+ o((t = t.apply(s, e)).next());
826
+ }), Ie = "application/", qe = `${Ie}x-www-form-urlencoded`, Qe = RegExp, jt = new Qe(`^${qe}`, "i"), Vt = `${Ie}${be}`, Ht = new Qe(`^${Ie}.*${be}.*`, "i");
827
+ function Ut(s = ae) {
828
+ return [Ve, ae, He].includes(s);
517
829
  }
518
- var At = typeof URLSearchParams != `${S}`;
519
- function Lt(n) {
520
- return D(this, null, function* () {
521
- let e = n[ne] || de, t = n.encodeURI !== !1, r = n[be] && n[be].toUpperCase(), s = n.url, a = s, i = At && n.data instanceof URLSearchParams, o = i ? Z.fromEntries(n.data.entries()) : n.data, l = o, d = n != null && n[w] ? $({}, n[w]) : {}, h = n.params, g = Mt(r);
522
- if (o && typeof o.append !== Le) {
523
- let u = "", p = "content-type";
524
- if (n != null && n[w]) {
525
- let f = Q(n[w]).find((E) => E.toLowerCase() === p);
526
- f && (p = f, u = n[w][f]);
830
+ var zt = typeof URLSearchParams != `${K}`;
831
+ function Wt(s) {
832
+ return x(this, null, function* () {
833
+ let e = s[ne] || we, t = s.encodeURI !== !1, r = s[Ce] && s[Ce].toUpperCase(), n = s.url, i = n, a = zt && s.data instanceof URLSearchParams, o = a ? re.fromEntries(s.data.entries()) : s.data, c = o, u = s != null && s[k] ? R({}, s[k]) : {}, d = s.params, g = Ut(r);
834
+ if (o && typeof o.append !== Ge) {
835
+ let h = "", y = "content-type";
836
+ if (s != null && s[k]) {
837
+ let p = X(s[k]).find((_) => _.toLowerCase() === y);
838
+ p && (y = p, h = s[k][p]);
527
839
  }
528
- (!u || i) && (u = g || i ? Te : Kt, d[p] = u), typeof o === L && (g && h && (h = ue(o, h)), St.test(u) ? l = JSON.stringify(ie(o)) : !g && Ct.test(u) && (l = e(o)));
840
+ (!h || a) && (h = g || a ? qe : Vt, u[y] = h), typeof o === M && (g && d && (d = ve(o, d)), Ht.test(h) ? c = JSON.stringify(oe(o)) : !g && jt.test(h) && (c = e(o)));
529
841
  }
530
- if (h && Q(h).length > 0) {
531
- let u = e(h, t);
532
- s += s.includes("?") ? `&${u}` : `?${u}`;
842
+ if (d && X(d).length > 0) {
843
+ let h = e(d, t);
844
+ n += n.includes("?") ? `&${h}` : `?${h}`;
533
845
  }
534
- return z($({}, n), { _data: l, _url: s, data: o, url: a, method: r, [w]: d, isGet: g });
846
+ return q(R({}, s), { _data: c, _url: n, data: o, url: i, method: r, [k]: u, isGet: g });
535
847
  });
536
848
  }
537
- var Ot = typeof AbortController != `${S}`;
538
- function Ft(n, e) {
539
- return D(this, null, function* () {
849
+ var qt = typeof AbortController != `${K}`;
850
+ function Qt(s, e) {
851
+ return x(this, null, function* () {
540
852
  let t;
541
- if (!e || !n.ok || [ee, ce].includes(e)) {
542
- if (t = yield n[ee](), t && e !== ee) try {
853
+ if (!e || !s.ok || [se, be].includes(e)) {
854
+ if (t = yield s[se](), t && e !== se) try {
543
855
  t = JSON.parse(t);
544
856
  } catch {
545
857
  }
546
858
  } else {
547
- if (e === "blob") return n.blob();
548
- if (e === "arraybuffer") return n.arrayBuffer();
859
+ if (e === "blob") return s.blob();
860
+ if (e === "arraybuffer") return s.arrayBuffer();
549
861
  }
550
862
  return t;
551
863
  });
552
864
  }
553
- var Rt = (n) => new A(n), A = class {
865
+ var Jt = (s) => new O(s), O = class {
554
866
  constructor(e) {
555
- this.REQI = [], this.RESI = [], this.P = [], this.config = e, this.defaults = { params: {}, [w]: {} };
867
+ this.REQI = [], this.RESI = [], this.P = [], this.config = e, this.defaults = { params: {}, [k]: {} };
556
868
  }
557
869
  get interceptors() {
558
870
  return { request: { use: (e, t, r) => (this.REQI.push(e), e), eject: (e) => {
@@ -573,209 +885,209 @@ var Rt = (n) => new A(n), A = class {
573
885
  } };
574
886
  }
575
887
  request(e) {
576
- return D(this, null, function* () {
577
- let t = ue(this.config || {}, this.defaults, typeof e == "string" ? { url: e } : e), r = "credentials";
578
- t.withCredentials && !t[r] && (t[r] = "include"), t[ne] || (t[ne] = de);
579
- for (let i of this.REQI) t = yield i(t);
580
- let s = this._.bind(this);
581
- this.P.forEach((i) => {
582
- s = i(s, this);
888
+ return x(this, null, function* () {
889
+ let t = ve(this.config || {}, this.defaults, typeof e == "string" ? { url: e } : e), r = "credentials";
890
+ t.withCredentials && !t[r] && (t[r] = "include"), t[ne] || (t[ne] = we);
891
+ for (let a of this.REQI) t = yield a(t);
892
+ let n = this._.bind(this);
893
+ this.P.forEach((a) => {
894
+ n = a(n, this);
583
895
  });
584
- let a = s(t);
896
+ let i = n(t);
585
897
  if (!t._did) {
586
- let i = 0, o = [];
587
- for (this.RESI.forEach(function(l) {
588
- o.push(l.fn, l.onRejected);
589
- }); o.length > i; ) a = a.then(o[i++], o[i++]);
898
+ let a = 0, o = [];
899
+ for (this.RESI.forEach(function(c) {
900
+ o.push(c.fn, c.onRejected);
901
+ }); o.length > a; ) i = i.then(o[a++], o[a++]);
590
902
  }
591
- return a;
903
+ return i;
592
904
  });
593
905
  }
594
906
  _(e) {
595
- return D(this, null, function* () {
596
- let t = yield Lt(e), { url: r, method: s, headers: a, timeout: i, signal: o, data: l, _data: d, _url: h, isGet: g, fetch: u } = t, p = Pt(t, ["url", "method", "headers", "timeout", "signal", "data", "_data", "_url", "isGet", "fetch"]);
597
- e._url = h;
598
- let f, E = [], j = S;
599
- if (i && Ot) {
600
- let b = new AbortController();
601
- j = setTimeout(() => {
602
- b.abort(new Et(`timeout of ${i}ms exceeded`, e));
603
- }, i), E.push(b.signal);
907
+ return x(this, null, function* () {
908
+ let t = yield Wt(e), { url: r, method: n, headers: i, timeout: a, signal: o, data: c, _data: u, _url: d, isGet: g, fetch: h } = t, y = Gt(t, ["url", "method", "headers", "timeout", "signal", "data", "_data", "_url", "isGet", "fetch"]);
909
+ e._url = d;
910
+ let p, _ = [], G = K;
911
+ if (a && qt) {
912
+ let v = new AbortController();
913
+ G = setTimeout(() => {
914
+ v.abort(new xt(`timeout of ${a}ms exceeded`, e));
915
+ }, a), _.push(v.signal);
604
916
  }
605
- o && E.push(o), f = E[0], E.length > 1 && (f = yt(E, () => {
606
- clearTimeout(j);
917
+ o && _.push(o), p = _[0], _.length > 1 && (p = Ot(_, () => {
918
+ clearTimeout(G);
607
919
  }));
608
- let N = h || r, fe = "baseURL";
609
- return e[fe] && !mt(N) && (N = bt(e[fe], N)), (u || fetch)(N, z($({ body: g ? S : d }, p), { signal: f, method: s, headers: a })).then((b) => D(this, null, function* () {
610
- let { responseType: Ve } = e, pe = { data: yield Ft(b, Ve), response: b, config: e, request: e, [V]: b[V], statusText: b.statusText, [w]: b[w] };
611
- if (!b.ok) {
612
- let Ue = new xe(b[V] ? `Request failed with status code ${b[V]}` : "Network error", e, pe);
613
- return Promise.reject(Ue);
920
+ let j = d || r, _e = "baseURL";
921
+ return e[_e] && !Mt(j) && (j = $t(e[_e], j)), (h || fetch)(j, q(R({ body: g ? K : u }, y), { signal: p, method: n, headers: i })).then((v) => x(this, null, function* () {
922
+ let { responseType: Ze } = e, ke = { data: yield Qt(v, Ze), response: v, config: e, request: e, [V]: v[V], statusText: v.statusText, [k]: v[k] };
923
+ if (!v.ok) {
924
+ let et = new Ue(v[V] ? `Request failed with status code ${v[V]}` : "Network error", e, ke);
925
+ return Promise.reject(et);
614
926
  }
615
- return pe;
927
+ return ke;
616
928
  })).finally(() => {
617
- var b;
618
- j && clearTimeout(j), (b = f == null ? void 0 : f.clear) == null || b.call(f);
929
+ var v;
930
+ G && clearTimeout(G), (v = p == null ? void 0 : p.clear) == null || v.call(p);
619
931
  });
620
932
  });
621
933
  }
622
934
  cG(e) {
623
- return (t, r) => this.request(r ? z($({}, r), { method: e, url: t }) : { method: e, url: t });
935
+ return (t, r) => this.request(r ? q(R({}, r), { method: e, url: t }) : { method: e, url: t });
624
936
  }
625
937
  cP(e) {
626
- return (t, r, s) => this.request(s ? z($({}, s), { method: e, url: t, data: r }) : { method: e, url: t, data: r });
938
+ return (t, r, n) => this.request(n ? q(R({}, n), { method: e, url: t, data: r }) : { method: e, url: t, data: r });
627
939
  }
628
940
  get(e, t) {
629
- return this.cG(se)(e, t);
941
+ return this.cG(ae)(e, t);
630
942
  }
631
943
  head(e, t) {
632
- return this.cG(Fe)(e, t);
944
+ return this.cG(Ve)(e, t);
633
945
  }
634
946
  post(e, t, r) {
635
- return this.cP(ht)(e, t, r);
947
+ return this.cP(Lt)(e, t, r);
636
948
  }
637
949
  put(e, t, r) {
638
- return this.cP(gt)(e, t, r);
950
+ return this.cP(Kt)(e, t, r);
639
951
  }
640
952
  patch(e, t, r) {
641
- return this.cP(ft)(e, t, r);
953
+ return this.cP(Ft)(e, t, r);
642
954
  }
643
955
  delete(e, t) {
644
- return this.cG(pt)(e, t);
956
+ return this.cG(Dt)(e, t);
645
957
  }
646
958
  options(e, t) {
647
- return this.cG(Re)(e, t);
959
+ return this.cG(He)(e, t);
648
960
  }
649
961
  };
650
- A.create = Rt, A.VERSION = "0.7.7";
651
- var xt = Object.assign(A.create(), { create: A.create, VERSION: A.VERSION }), Ge = xt;
652
- const je = Ge.create({
962
+ O.create = Jt, O.VERSION = "0.7.7";
963
+ var Xt = Object.assign(O.create(), { create: O.create, VERSION: O.VERSION }), Je = Xt;
964
+ const Xe = Je.create({
653
965
  baseURL: "https://updater.stats.cc",
654
966
  headers: {
655
967
  Accept: "application/json",
656
968
  "Accept-Encoding": "gzip, deflate, br"
657
969
  }
658
- }), ge = Ge.create({
970
+ }), Ee = Je.create({
659
971
  baseURL: "https://api.stats.cc",
660
972
  headers: {
661
973
  Accept: "application/json",
662
974
  "Accept-Encoding": "gzip, deflate, br"
663
975
  }
664
976
  });
665
- function $t(n, e) {
666
- return je.get(`/v1/native/${n}/version.txt`, {
977
+ function Yt(s, e) {
978
+ return Xe.get(`/v1/native/${s}/version.txt`, {
667
979
  params: { channel: e },
668
980
  responseType: "text"
669
981
  });
670
982
  }
671
- function Dt(n, e) {
672
- return je.get(`/v1/native/${n}/files`, {
983
+ function Zt(s, e) {
984
+ return Xe.get(`/v1/native/${s}/files`, {
673
985
  params: { channel: e },
674
986
  responseType: "arraybuffer"
675
987
  });
676
988
  }
677
- function Tt() {
678
- return ge.get("/v1/raven/config");
989
+ function er() {
990
+ return Ee.get("/v1/raven/config");
679
991
  }
680
- function Bt(n, e) {
681
- return ge.get(`/v1/raven/games/${n}/builds/${e}/check`);
992
+ function tr(s, e) {
993
+ return Ee.get(`/v1/raven/games/${s}/builds/${e}/check`);
682
994
  }
683
- function Gt(n, e) {
995
+ function rr(s, e) {
684
996
  const t = new FormData();
685
- return t.append("file", e), ge.post(`/v1/raven/games/${n}/builds/upload`, t, {});
997
+ return t.append("file", e), Ee.post(`/v1/raven/games/${s}/builds/upload`, t, {});
686
998
  }
687
- function jt(n) {
688
- return n instanceof Error && (n.name === "XiorError" || n.name === "XiorTimeoutError");
999
+ function sr(s) {
1000
+ return s instanceof Error && (s.name === "XiorError" || s.name === "XiorTimeoutError");
689
1001
  }
690
- function Nt(n) {
691
- return !!(n && "kind" in n.data && "message" in n.data);
1002
+ function nr(s) {
1003
+ return !!(s && "kind" in s.data && "message" in s.data);
692
1004
  }
693
- const Vt = {
1005
+ const ir = {
694
1006
  buildChannel: "alpha"
695
1007
  };
696
- class Ut extends G {
1008
+ class ar extends N {
697
1009
  constructor() {
698
1010
  super("NativeDllManager");
699
- c(this, "UPDATE_CHECK_INTERVAL_MS", 1e3 * 60 * 5);
1011
+ l(this, "UPDATE_CHECK_INTERVAL_MS", 1e3 * 60 * 5);
700
1012
  // 5 minutes
701
- c(this, "targetDir");
702
- c(this, "updateInterval");
703
- this.targetDir = m.join(le(), "resources"), this.logger.log("Target directory", this.targetDir);
1013
+ l(this, "targetDir");
1014
+ l(this, "updateInterval");
1015
+ this.targetDir = f.join(te(), "resources"), this.logger.log("Target directory", this.targetDir);
704
1016
  }
705
1017
  async initWithDlls(t) {
706
- super.init(), await v.mkdir(this.targetDir, { recursive: !0 }), await this.checkForUpdates(t), clearInterval(this.updateInterval), this.updateInterval = setInterval(() => this.checkForUpdates(t), this.UPDATE_CHECK_INTERVAL_MS);
1018
+ super.init(), await w.mkdir(this.targetDir, { recursive: !0 }), await this.checkForUpdates(t), clearInterval(this.updateInterval), this.updateInterval = setInterval(() => this.checkForUpdates(t), this.UPDATE_CHECK_INTERVAL_MS);
707
1019
  }
708
1020
  destroy() {
709
1021
  this.updateInterval && (clearInterval(this.updateInterval), this.updateInterval = void 0), super.destroy();
710
1022
  }
711
1023
  async getCurrentVersion(t) {
712
1024
  try {
713
- const r = m.join(this.targetDir, t, "version.txt");
714
- return await v.readFile(r, "utf-8");
1025
+ const r = f.join(this.targetDir, t, "version.txt");
1026
+ return await w.readFile(r, "utf-8");
715
1027
  } catch {
716
1028
  return null;
717
1029
  }
718
1030
  }
719
1031
  getTargetPath(t) {
720
- return m.join(this.targetDir, t);
1032
+ return f.join(this.targetDir, t);
721
1033
  }
722
1034
  getTargetVersionPath(t, r) {
723
- return m.join(this.getTargetPath(t), r);
1035
+ return f.join(this.getTargetPath(t), r);
724
1036
  }
725
1037
  async checkForUpdates(t) {
726
- const r = Vt.buildChannel;
1038
+ const r = ir.buildChannel;
727
1039
  this.logger.log("Checking for updates");
728
- for (const s of t)
1040
+ for (const n of t)
729
1041
  try {
730
- const { data: a } = await $t(s, r), i = await this.getCurrentVersion(s);
731
- this.logger.log(`${s} > Update Check. current: ${i}, latest: ${a}`);
732
- const o = a !== i;
733
- this.logger.log(`${s} > Update found: ${i} -> ${a}`), await this.downloadAndExtractDll(s, a, r, o), this.logger.log(`${s} > Downloaded and extracted`), o && (this.logger.log(`${s} > Cleaning up versions older than ${a}`), await this.cleanupOldVersions(s, a)), this.emit("dllUpdated", { identifier: s, version: a });
734
- } catch (a) {
735
- this.logger.captureSentryException(`${s} > Error checking/updating`, a);
1042
+ const { data: i } = await Yt(n, r), a = await this.getCurrentVersion(n);
1043
+ this.logger.log(`${n} > Update Check. current: ${a}, latest: ${i}`);
1044
+ const o = i !== a;
1045
+ this.logger.log(`${n} > Update found: ${a} -> ${i}`), await this.downloadAndExtractDll(n, i, r, o), this.logger.log(`${n} > Downloaded and extracted`), o && (this.logger.log(`${n} > Cleaning up versions older than ${i}`), await this.cleanupOldVersions(n, i)), this.emit("dllUpdated", { identifier: n, version: i });
1046
+ } catch (i) {
1047
+ this.logger.captureSentryException(`${n} > Error checking/updating`, i);
736
1048
  }
737
1049
  }
738
- async downloadAndExtractDll(t, r, s, a) {
739
- const { data: i } = await Dt(t, s), o = this.getTargetPath(t), l = this.getTargetVersionPath(t, r);
740
- await v.mkdir(l, { recursive: !0 });
741
- const d = new ke();
742
- await d.loadAsync(i);
743
- const h = Object.keys(d.files).map(async (u) => {
744
- const p = d.files[u];
745
- if (p && !p.dir) {
746
- const f = m.join(l, u);
747
- if (!a)
1050
+ async downloadAndExtractDll(t, r, n, i) {
1051
+ const { data: a } = await Zt(t, n), o = this.getTargetPath(t), c = this.getTargetVersionPath(t, r);
1052
+ await w.mkdir(c, { recursive: !0 });
1053
+ const u = new Re();
1054
+ await u.loadAsync(a);
1055
+ const d = Object.keys(u.files).map(async (h) => {
1056
+ const y = u.files[h];
1057
+ if (y && !y.dir) {
1058
+ const p = f.join(c, h);
1059
+ if (!i)
748
1060
  try {
749
- await v.access(f, v.constants.F_OK);
1061
+ await w.access(p, w.constants.F_OK);
750
1062
  return;
751
1063
  } catch {
752
- this.logger.warn(`${t} > File missing, re-downloading: ${f}`);
1064
+ this.logger.warn(`${t} > File missing, re-downloading: ${p}`);
753
1065
  }
754
- const E = await p.async("nodebuffer");
755
- await v.writeFile(f, E);
1066
+ const _ = await y.async("nodebuffer");
1067
+ await w.writeFile(p, _);
756
1068
  }
757
1069
  });
758
- await Promise.all(h);
759
- const g = m.join(o, "version.txt");
760
- this.logger.log("Saving version file", g), await v.writeFile(g, r);
1070
+ await Promise.all(d);
1071
+ const g = f.join(o, "version.txt");
1072
+ this.logger.log("Saving version file", g), await w.writeFile(g, r);
761
1073
  }
762
1074
  async cleanupOldVersions(t, r) {
763
- const s = m.join(this.targetDir, t), a = await v.readdir(s, { withFileTypes: !0 });
764
- for (const i of a)
765
- i.isDirectory() && i.name !== r && await v.rm(m.join(s, i.name), { recursive: !0, force: !0 });
1075
+ const n = f.join(this.targetDir, t), i = await w.readdir(n, { withFileTypes: !0 });
1076
+ for (const a of i)
1077
+ a.isDirectory() && a.name !== r && await w.rm(f.join(n, a.name), { recursive: !0, force: !0 });
766
1078
  }
767
1079
  }
768
- const J = _(Ut);
769
- class Ht extends G {
1080
+ const Z = E(ar);
1081
+ class or extends N {
770
1082
  constructor() {
771
1083
  super("RavenManager");
772
- c(this, "REFETCH_INTERVAL", 1e3 * 60 * 5);
773
- c(this, "FAILED_REFETCH_INTERVAL", 1e3 * 30);
774
- c(this, "_ravenConfig");
775
- c(this, "_executableToGameMap", /* @__PURE__ */ new Map());
776
- c(this, "_executablesArray", []);
777
- c(this, "_refetchIntervalHandler", null);
778
- c(this, "_failedRefetchTimeoutHandler", null);
1084
+ l(this, "REFETCH_INTERVAL", 1e3 * 60 * 5);
1085
+ l(this, "FAILED_REFETCH_INTERVAL", 1e3 * 30);
1086
+ l(this, "_ravenConfig");
1087
+ l(this, "_executableToGameMap", /* @__PURE__ */ new Map());
1088
+ l(this, "_executablesArray", []);
1089
+ l(this, "_refetchIntervalHandler", null);
1090
+ l(this, "_failedRefetchTimeoutHandler", null);
779
1091
  }
780
1092
  init() {
781
1093
  super.init(), this.fetchRavenConfig(), this._refetchIntervalHandler = setInterval(() => {
@@ -792,21 +1104,21 @@ class Ht extends G {
792
1104
  return this._executableToGameMap;
793
1105
  }
794
1106
  destroy() {
795
- this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler), J.getInstance().destroy(), super.destroy();
1107
+ this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler), Z.getInstance().destroy(), super.destroy();
796
1108
  }
797
1109
  async fetchRavenConfig() {
798
1110
  try {
799
- const t = await Tt();
1111
+ const t = await er();
800
1112
  this._ravenConfig = t.data, this.resetState();
801
1113
  const r = /* @__PURE__ */ new Set();
802
- for (const s of this._ravenConfig.games) {
803
- for (const a of s.executables) {
804
- const i = a.toLowerCase();
805
- this._executableToGameMap.set(i, s), this._executablesArray.push(i);
1114
+ for (const n of this._ravenConfig.games) {
1115
+ for (const i of n.executables) {
1116
+ const a = i.toLowerCase();
1117
+ this._executableToGameMap.set(a, n), this._executablesArray.push(a);
806
1118
  }
807
- s.dlls_to_inject.forEach((a) => r.add(a));
1119
+ n.dlls_to_inject.forEach((i) => r.add(i));
808
1120
  }
809
- await J.getInstance().initWithDlls(Array.from(r)), this.logger.log("Raven updated", this._ravenConfig), this.emit("executablesUpdated", { executables: this.executables, map: this._executableToGameMap });
1121
+ await Z.getInstance().initWithDlls(Array.from(r)), this.logger.log("Raven updated", this._ravenConfig), this.emit("executablesUpdated", { executables: this.executables, map: this._executableToGameMap });
810
1122
  } catch (t) {
811
1123
  this.logger.captureSentryException("Failed to fetch Raven config", t), this._failedRefetchTimeoutHandler = setTimeout(() => this.fetchRavenConfig(), this.FAILED_REFETCH_INTERVAL);
812
1124
  }
@@ -815,23 +1127,23 @@ class Ht extends G {
815
1127
  this._executableToGameMap.clear(), this._executablesArray = [];
816
1128
  }
817
1129
  }
818
- const T = _(Ht), zt = Y(import.meta.url), {
819
- PipeEventServer: Hn,
820
- PipeEventClient: zn,
821
- PipeEventBase: qn,
822
- ProcessMonitor: qt,
823
- Process: U,
824
- InjectionMethod: Wn,
825
- AccessLevel: Qn,
826
- HardwareInterface: Wt
827
- } = zt("@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node");
828
- class Qt extends G {
1130
+ const T = E(or), lr = ee(import.meta.url), {
1131
+ PipeEventServer: ls,
1132
+ PipeEventClient: cs,
1133
+ PipeEventBase: hs,
1134
+ ProcessMonitor: cr,
1135
+ Process: H,
1136
+ InjectionMethod: us,
1137
+ AccessLevel: ds,
1138
+ HardwareInterface: hr
1139
+ } = lr("@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node");
1140
+ class ur extends N {
829
1141
  constructor() {
830
1142
  super("ProcessManager");
831
- c(this, "_processMonitor");
832
- c(this, "_processes", /* @__PURE__ */ new Map());
833
- c(this, "boundOnRavenManagerExecutablesUpdated", this.onRavenManagerExecutablesUpdated.bind(this));
834
- this._processMonitor = new qt();
1143
+ l(this, "_processMonitor");
1144
+ l(this, "_processes", /* @__PURE__ */ new Map());
1145
+ l(this, "boundOnRavenManagerExecutablesUpdated", this.onRavenManagerExecutablesUpdated.bind(this));
1146
+ this._processMonitor = new cr();
835
1147
  }
836
1148
  get hasAnyActiveProcesses() {
837
1149
  return this.activeProcesses.length > 0;
@@ -851,7 +1163,7 @@ class Qt extends G {
851
1163
  }
852
1164
  isProcessRunning(t) {
853
1165
  const r = this._processes.get(t);
854
- return (r == null ? void 0 : r.some((s) => !s.destroyedAt)) ?? !1;
1166
+ return (r == null ? void 0 : r.some((n) => !n.destroyedAt)) ?? !1;
855
1167
  }
856
1168
  onRavenManagerExecutablesUpdated(t) {
857
1169
  t.executables.forEach((r) => {
@@ -871,15 +1183,15 @@ class Qt extends G {
871
1183
  deleteProcess(t) {
872
1184
  if (!t.name)
873
1185
  return;
874
- const r = this._processes.get(t.name), s = (r == null ? void 0 : r.filter((a) => a.id !== t.id)) ?? [];
875
- s.length === 0 ? this._processes.delete(t.name) : this._processes.set(t.name, s);
1186
+ const r = this._processes.get(t.name), n = (r == null ? void 0 : r.filter((i) => i.id !== t.id)) ?? [];
1187
+ n.length === 0 ? this._processes.delete(t.name) : this._processes.set(t.name, n);
876
1188
  }
877
1189
  }
878
- const C = _(Qt), Xt = Y(import.meta.url), { RenderInterface: Jt, renderHookPath: Xn } = Xt("@overlayed/app/dist/render-interface/build/overlayed_render_interface_x64.node");
879
- var Yt = Object.defineProperty, Zt = (n, e, t) => e in n ? Yt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, q = (n, e, t) => Zt(n, typeof e != "symbol" ? e + "" : e, t);
880
- class en {
1190
+ const C = E(ur), dr = ee(import.meta.url), { RenderInterface: gr, renderHookPath: gs } = dr("@overlayed/app/dist/render-interface/build/overlayed_render_interface_x64.node");
1191
+ var fr = Object.defineProperty, pr = (s, e, t) => e in s ? fr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, Q = (s, e, t) => pr(s, typeof e != "symbol" ? e + "" : e, t);
1192
+ let yr = class {
881
1193
  constructor(e) {
882
- q(this, "_instance"), q(this, "_resolution"), q(this, "boundOnResolutionChanged", this.onResolutionChanged.bind(this)), this._instance = e, this._resolution = { width: 0, height: 0 }, this._instance.on("resolution", this.boundOnResolutionChanged);
1194
+ Q(this, "_instance"), Q(this, "_resolution"), Q(this, "boundOnResolutionChanged", this.onResolutionChanged.bind(this)), this._instance = e, this._resolution = { width: 0, height: 0 }, this._instance.on("resolution", this.boundOnResolutionChanged);
883
1195
  }
884
1196
  destroy() {
885
1197
  this._instance.off("resolution", this.boundOnResolutionChanged);
@@ -893,46 +1205,23 @@ class en {
893
1205
  onResolutionChanged(e, t) {
894
1206
  this._resolution = { width: e, height: t };
895
1207
  }
896
- }
897
- let tn = class {
1208
+ };
1209
+ class mr {
898
1210
  constructor() {
899
- q(this, "interfaces", {});
1211
+ Q(this, "interfaces", {});
900
1212
  }
901
1213
  createInterface(e) {
902
- return this.interfaces[e] ? this.interfaces[e] : (this.interfaces[e] = new en(new Jt(e, { access: 1 })), this.interfaces[e]);
1214
+ return this.interfaces[e] ? this.interfaces[e] : (this.interfaces[e] = new yr(new gr(e, { access: 1 })), this.interfaces[e]);
903
1215
  }
904
1216
  getInterface(e) {
905
1217
  return this.interfaces[e] ? this.interfaces[e] : this.createInterface(e);
906
1218
  }
907
- };
908
- const O = _(tn);
909
- var nn = Object.defineProperty, rn = (n, e, t) => e in n ? nn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, F = (n, e, t) => rn(n, typeof e != "symbol" ? e + "" : e, t);
910
- class sn {
911
- constructor() {
912
- F(this, "data", []);
913
- }
914
- get size() {
915
- return this.data.length;
916
- }
917
- add(e) {
918
- this.data.push(e);
919
- }
920
- next() {
921
- return this.data.shift();
922
- }
923
- clear() {
924
- this.data.length = 0;
925
- }
926
- *flush() {
927
- for (; this.size > 0; ) {
928
- const e = this.next();
929
- e && (yield e);
930
- }
931
- }
932
1219
  }
933
- class an {
1220
+ const $ = E(mr);
1221
+ var br = Object.defineProperty, vr = (s, e, t) => e in s ? br(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, U = (s, e, t) => vr(s, typeof e != "symbol" ? e + "" : e, t);
1222
+ class wr {
934
1223
  constructor(e) {
935
- F(this, "_clientId", null), F(this, "_userId", null), F(this, "options"), F(this, "eventQueue"), this.options = this.resolveOptions(e), this.eventQueue = new sn(), this.setupFlushInterval();
1224
+ U(this, "_clientId", null), U(this, "_userId", null), U(this, "options"), U(this, "eventQueue"), this.options = this.resolveOptions(e), this.eventQueue = new Be(), this.setupFlushInterval();
936
1225
  }
937
1226
  set clientId(e) {
938
1227
  this._clientId = e;
@@ -957,15 +1246,15 @@ class an {
957
1246
  };
958
1247
  }
959
1248
  }
960
- const P = _(an), on = Y(import.meta.url), ln = on.resolve("@overlayed/app/dist/render-interface/build/overlayed_render_hook_x64.dll");
961
- class cn extends G {
1249
+ const S = E(wr), Ir = ee(import.meta.url), Er = Ir.resolve("@overlayed/app/dist/render-interface/build/overlayed_render_hook_x64.dll");
1250
+ class _r extends N {
962
1251
  constructor() {
963
1252
  super("GameLaunchManager");
964
- c(this, "boundOnProcessCreate", this.onProcessCreate.bind(this));
965
- c(this, "boundOnProcessDestroy", this.onProcessDestroy.bind(this));
1253
+ l(this, "boundOnProcessCreate", this.onProcessCreate.bind(this));
1254
+ l(this, "boundOnProcessDestroy", this.onProcessDestroy.bind(this));
966
1255
  }
967
1256
  init() {
968
- super.init(), O.getInstance().createInterface("OGG_SIEGE"), C.getInstance().on("create", this.boundOnProcessCreate), C.getInstance().on("destroy", this.boundOnProcessDestroy);
1257
+ super.init(), $.getInstance().createInterface("OGG_SIEGE"), C.getInstance().on("create", this.boundOnProcessCreate), C.getInstance().on("destroy", this.boundOnProcessDestroy);
969
1258
  }
970
1259
  destroy() {
971
1260
  C.getInstance().off("create", this.boundOnProcessCreate), C.getInstance().off("destroy", this.boundOnProcessDestroy), super.destroy();
@@ -974,76 +1263,76 @@ class cn extends G {
974
1263
  const r = this.getRavenGame(t);
975
1264
  if (!r)
976
1265
  return;
977
- if (this.logger.log("Game Launched", r), this.logger.log("Process is elevated: ", t.isElevated), this.logger.log("Current process is elevated: ", U.currentProcess.isElevated), t.isElevated && !U.currentProcess.isElevated) {
1266
+ if (this.logger.log("Game Launched", r), this.logger.log("Process is elevated: ", t.isElevated), this.logger.log("Current process is elevated: ", H.currentProcess.isElevated), t.isElevated && !H.currentProcess.isElevated) {
978
1267
  I.getInstance().fatal("Game is elevated but the App is not", "ELEVATION_MISMATCH", {
979
- appElevated: !!U.currentProcess.isElevated,
1268
+ appElevated: !!H.currentProcess.isElevated,
980
1269
  gameElevated: !!t.isElevated
981
1270
  }), this.logger.sentryLog("Game elevated but App is not", {
982
- appElevated: U.currentProcess.isElevated,
1271
+ appElevated: H.currentProcess.isElevated,
983
1272
  gameElevated: t.isElevated
984
1273
  });
985
1274
  return;
986
1275
  }
987
- const s = this.copyDll(ln);
988
- if (s)
1276
+ const n = this.copyDll(Er);
1277
+ if (n)
989
1278
  try {
990
- await t.injectDll(s), this.logger.log("Render Interface Injection Successful", s);
991
- } catch (i) {
992
- this.logger.captureSentryException("Render Interface Injection Failed", i), this.logger.sentryError("Render Interface Injection Failed", {
993
- renderInterfacePath: s
1279
+ await t.injectDll(n), this.logger.log("Render Interface Injection Successful", n);
1280
+ } catch (a) {
1281
+ this.logger.captureSentryException("Render Interface Injection Failed", a), this.logger.sentryError("Render Interface Injection Failed", {
1282
+ renderInterfacePath: n
994
1283
  });
995
1284
  }
996
- const a = r == null ? void 0 : r.dlls_to_inject.map(async (i) => {
997
- const o = await J.getInstance().getCurrentVersion(i);
1285
+ const i = r == null ? void 0 : r.dlls_to_inject.map(async (a) => {
1286
+ const o = await Z.getInstance().getCurrentVersion(a);
998
1287
  if (!o)
999
- return this.logger.sentryError("No version found for DLL", { identifier: i }), Promise.resolve();
1000
- const l = J.getInstance().getTargetVersionPath(i, o);
1001
- this.logger.log("DLL Path", l);
1002
- const d = await this.getDllFiles(l);
1003
- return this.logger.log("DLL Files", d), Promise.all(
1004
- d.map(async (h) => {
1005
- const g = m.basename(h), u = m.join(l, g);
1006
- if (!u)
1288
+ return this.logger.sentryError("No version found for DLL", { identifier: a }), Promise.resolve();
1289
+ const c = Z.getInstance().getTargetVersionPath(a, o);
1290
+ this.logger.log("DLL Path", c);
1291
+ const u = await this.getDllFiles(c);
1292
+ return this.logger.log("DLL Files", u), Promise.all(
1293
+ u.map(async (d) => {
1294
+ const g = f.basename(d), h = f.join(c, g);
1295
+ if (!h)
1007
1296
  return Promise.resolve();
1008
- this.logger.log("Injecting: ", u);
1297
+ this.logger.log("Injecting: ", h);
1009
1298
  try {
1010
- return t.injectDll(u).then(() => {
1011
- this.logger.log("Injection Successful", u);
1012
- }).catch((p) => {
1013
- this.logger.sentryError("Injection Failed [1]", { targetPath: u }, p);
1299
+ return t.injectDll(h).then(() => {
1300
+ this.logger.log("Injection Successful", h);
1301
+ }).catch((y) => {
1302
+ this.logger.sentryError("Injection Failed [1]", { targetPath: h }, y);
1014
1303
  });
1015
- } catch (p) {
1016
- return this.logger.sentryError("Injection Failed [2]", { targetPath: u }, p), Promise.reject(p);
1304
+ } catch (y) {
1305
+ return this.logger.sentryError("Injection Failed [2]", { targetPath: h }, y), Promise.reject(y);
1017
1306
  }
1018
1307
  })
1019
1308
  );
1020
1309
  });
1021
- await Promise.allSettled(a), this.emit("gameLaunchInternal", { ravenGame: r, process: t }), this.emit("gameLaunch", { game: r.identifier }), P.getInstance().track("game_launch", {
1310
+ await Promise.allSettled(i), this.emit("gameLaunchInternal", { ravenGame: r, process: t }), this.emit("gameLaunch", { game: r.identifier }), S.getInstance().track("game_launch", {
1022
1311
  game: r.identifier
1023
1312
  });
1024
1313
  }
1025
1314
  copyDll(t) {
1026
- const r = m.basename(t), s = Je(t), a = m.join(le(), "resources"), i = m.join(a, r);
1027
- this.logger.debug("Copying", s, "to", i);
1315
+ const r = f.basename(t), n = nt(t), i = f.join(te(), "resources"), a = f.join(i, r);
1316
+ this.logger.debug("Copying", n, "to", a);
1028
1317
  try {
1029
- qe(a) || We(a, { recursive: !0 });
1030
- const o = _e(s);
1031
- Qe(i, o), Xe(s, i);
1318
+ he(i) || ce(i, { recursive: !0 });
1319
+ const o = Ae(n);
1320
+ ue(a, o), st(n, a);
1032
1321
  } catch (o) {
1033
- return o.code === "EBUSY" ? i : (this.logger.captureSentryException("Failed to copy", o), this.logger.sentryError("Failed to copy", { originalPath: s, targetPath: i }), !1);
1322
+ return o.code === "EBUSY" ? a : (this.logger.captureSentryException("Failed to copy", o), this.logger.sentryError("Failed to copy", { originalPath: n, targetPath: a }), !1);
1034
1323
  }
1035
- return i;
1324
+ return a;
1036
1325
  }
1037
1326
  async getDllFiles(t) {
1038
1327
  try {
1039
- return (await v.readdir(t)).filter((s) => s.endsWith(".dll")).map((s) => m.join(t, s));
1328
+ return (await w.readdir(t)).filter((n) => n.endsWith(".dll")).map((n) => f.join(t, n));
1040
1329
  } catch (r) {
1041
1330
  return this.logger.captureSentryException("Failed to read DLL directory", r), this.logger.sentryError("Failed to read DLL directory", { dllPath: t }), [];
1042
1331
  }
1043
1332
  }
1044
1333
  onProcessDestroy({ process: t }) {
1045
1334
  const r = this.getRavenGame(t);
1046
- r && (this.emit("gameCloseInternal", { ravenGame: r, process: t }), this.emit("gameClose", { game: r.identifier }), P.getInstance().track("game_close", {
1335
+ r && (this.emit("gameCloseInternal", { ravenGame: r, process: t }), this.emit("gameClose", { game: r.identifier }), S.getInstance().track("game_close", {
1047
1336
  game: r.identifier
1048
1337
  }));
1049
1338
  }
@@ -1058,11 +1347,11 @@ class cn extends G {
1058
1347
  return r;
1059
1348
  }
1060
1349
  }
1061
- const B = _(cn);
1062
- class un extends Ae {
1350
+ const B = E(_r);
1351
+ class kr extends Ne {
1063
1352
  constructor() {
1064
1353
  super("GameBuildManager");
1065
- c(this, "boundOnGameLaunch", this.onGameLaunch.bind(this));
1354
+ l(this, "boundOnGameLaunch", this.onGameLaunch.bind(this));
1066
1355
  }
1067
1356
  init() {
1068
1357
  super.init(), B.getInstance().on("gameLaunchInternal", this.boundOnGameLaunch);
@@ -1071,39 +1360,39 @@ class un extends Ae {
1071
1360
  B.getInstance().off("gameLaunchInternal", this.boundOnGameLaunch), super.destroy();
1072
1361
  }
1073
1362
  async onGameLaunch(t) {
1074
- const { ravenGame: r, process: s } = t;
1075
- if (!s.path || !s.name) {
1363
+ const { ravenGame: r, process: n } = t;
1364
+ if (!n.path || !n.name) {
1076
1365
  this.logger.sentryError(
1077
1366
  "Process path or name not found, could not check for build hash",
1078
1367
  void 0,
1079
- s
1368
+ n
1080
1369
  );
1081
1370
  return;
1082
1371
  }
1083
- const a = _e(s.path), i = Ye("sha256").update(a).digest("hex");
1084
- this.logger.log("Process Path", s.path), this.logger.log("Process Name", s.name), this.logger.log("Build Hash", i);
1372
+ const i = Ae(n.path), a = it("sha256").update(i).digest("hex");
1373
+ this.logger.log("Process Path", n.path), this.logger.log("Process Name", n.name), this.logger.log("Build Hash", a);
1085
1374
  let o = !1;
1086
1375
  try {
1087
- o = (await Bt(r.identifier, i)).data.upload;
1088
- } catch (h) {
1089
- this.logger.captureSentryException("Error checking game build hash", h);
1376
+ o = (await tr(r.identifier, a)).data.upload;
1377
+ } catch (d) {
1378
+ this.logger.captureSentryException("Error checking game build hash", d);
1090
1379
  return;
1091
1380
  }
1092
1381
  if (!o) {
1093
1382
  this.logger.log("Build hash already exists, skipping upload");
1094
1383
  return;
1095
1384
  }
1096
- const l = new ke();
1097
- l.file(s.name, a);
1098
- const d = await l.generateAsync({ type: "blob" });
1385
+ const c = new Re();
1386
+ c.file(n.name, i);
1387
+ const u = await c.generateAsync({ type: "blob" });
1099
1388
  try {
1100
- this.logger.log("Uploading build (size: ", d.size, " bytes)"), await Gt(r.identifier, d), this.logger.log("Build uploaded successfully");
1101
- } catch (h) {
1102
- jt(h) ? Nt(h.response) ? this.logger.captureSentryException("Error uploading build hash, api error", h) : this.logger.captureSentryException("Error uploading build hash, request error", h) : this.logger.captureSentryException("Error uploading build hash, unknown error", h);
1389
+ this.logger.log("Uploading build (size: ", u.size, " bytes)"), await rr(r.identifier, u), this.logger.log("Build uploaded successfully");
1390
+ } catch (d) {
1391
+ sr(d) ? nr(d.response) ? this.logger.captureSentryException("Error uploading build hash, api error", d) : this.logger.captureSentryException("Error uploading build hash, request error", d) : this.logger.captureSentryException("Error uploading build hash, unknown error", d);
1103
1392
  }
1104
1393
  }
1105
1394
  }
1106
- const Ne = _(un), ae = /* @__PURE__ */ new Map([
1395
+ const Ye = E(kr), le = /* @__PURE__ */ new Map([
1107
1396
  [1, "LeftButton"],
1108
1397
  [2, "RightButton"],
1109
1398
  [3, "Cancel"],
@@ -1296,48 +1585,48 @@ const Ne = _(un), ae = /* @__PURE__ */ new Map([
1296
1585
  [252, "Noname"],
1297
1586
  [253, "PA1"],
1298
1587
  [254, "OEM_Clear"]
1299
- ]), we = new Map(ae.entries().map(([n, e]) => [e, n])), dn = K({
1588
+ ]), De = new Map(le.entries().map(([s, e]) => [e, s])), Pr = L({
1300
1589
  "[string]": {
1301
1590
  keys: "string[]",
1302
- mode: K("'toggle' | 'hold'").pipe((n) => n ?? "toggle")
1591
+ mode: L("'toggle' | 'hold'").pipe((s) => s ?? "toggle")
1303
1592
  }
1304
1593
  });
1305
- class hn extends G {
1594
+ class Sr extends N {
1306
1595
  constructor(t) {
1307
1596
  super("KeybindManager");
1308
- c(this, "preferencesKeybindToCallbacks", /* @__PURE__ */ new Map());
1309
- c(this, "pressedKeys", /* @__PURE__ */ new Set());
1310
- c(this, "activeKeybinds", /* @__PURE__ */ new Set());
1311
- c(this, "triggeredToggleKeybinds", /* @__PURE__ */ new Set());
1312
- c(this, "boundHandleKeyboardFocus", this.handleKeyboardFocus.bind(this));
1313
- c(this, "boundHandleKeyDown", this.handleKeyDown.bind(this));
1314
- c(this, "boundHandleKeyUp", this.handleKeyUp.bind(this));
1315
- c(this, "keybindsFile");
1597
+ l(this, "preferencesKeybindToCallbacks", /* @__PURE__ */ new Map());
1598
+ l(this, "pressedKeys", /* @__PURE__ */ new Set());
1599
+ l(this, "activeKeybinds", /* @__PURE__ */ new Set());
1600
+ l(this, "triggeredToggleKeybinds", /* @__PURE__ */ new Set());
1601
+ l(this, "boundHandleKeyboardFocus", this.handleKeyboardFocus.bind(this));
1602
+ l(this, "boundHandleKeyDown", this.handleKeyDown.bind(this));
1603
+ l(this, "boundHandleKeyUp", this.handleKeyUp.bind(this));
1604
+ l(this, "keybindsFile");
1316
1605
  // TODO try to figure out a better way to handle this
1317
- c(this, "keybindListeningPaused", !1);
1318
- this.keybindsFile = new ct({
1319
- path: ut(["keybinds.json"]),
1320
- schema: dn,
1606
+ l(this, "keybindListeningPaused", !1);
1607
+ this.keybindsFile = new Et({
1608
+ path: St(["keybinds.json"]),
1609
+ schema: Pr,
1321
1610
  default: t
1322
1611
  });
1323
1612
  }
1324
1613
  init() {
1325
1614
  super.init();
1326
- const t = O.getInstance().getInterface("OGG_SIEGE");
1615
+ const t = $.getInstance().getInterface("OGG_SIEGE");
1327
1616
  t.instance.on("keyboardFocus", this.boundHandleKeyboardFocus), t.instance.on("keyDown", this.boundHandleKeyDown), t.instance.on("keyUp", this.boundHandleKeyUp);
1328
1617
  }
1329
1618
  // TODO support multiple callbacks
1330
1619
  async onKeybindToggled(t, r) {
1331
- const s = this.preferencesKeybindToCallbacks.get(t) || {};
1332
- s.toggle = r, this.preferencesKeybindToCallbacks.set(t, s);
1620
+ const n = this.preferencesKeybindToCallbacks.get(t) || {};
1621
+ n.toggle = r, this.preferencesKeybindToCallbacks.set(t, n);
1333
1622
  }
1334
1623
  async onKeybindDown(t, r) {
1335
- const s = this.preferencesKeybindToCallbacks.get(t) || {};
1336
- s.down = r, this.preferencesKeybindToCallbacks.set(t, s);
1624
+ const n = this.preferencesKeybindToCallbacks.get(t) || {};
1625
+ n.down = r, this.preferencesKeybindToCallbacks.set(t, n);
1337
1626
  }
1338
1627
  async onKeybindUp(t, r) {
1339
- const s = this.preferencesKeybindToCallbacks.get(t) || {};
1340
- s.up = r, this.preferencesKeybindToCallbacks.set(t, s);
1628
+ const n = this.preferencesKeybindToCallbacks.get(t) || {};
1629
+ n.up = r, this.preferencesKeybindToCallbacks.set(t, n);
1341
1630
  }
1342
1631
  async updateKeybind(t, r) {
1343
1632
  this.keybindsFile.set({
@@ -1346,7 +1635,7 @@ class hn extends G {
1346
1635
  }
1347
1636
  async updateKeybinds(t) {
1348
1637
  const r = Object.fromEntries(
1349
- Object.entries(t).filter(([s, a]) => a !== void 0)
1638
+ Object.entries(t).filter(([n, i]) => i !== void 0)
1350
1639
  );
1351
1640
  this.keybindsFile.set({
1352
1641
  ...this.keybindsFile.get(),
@@ -1357,13 +1646,13 @@ class hn extends G {
1357
1646
  return this.keybindsFile.get();
1358
1647
  }
1359
1648
  destroy() {
1360
- const t = O.getInstance().getInterface("OGG_SIEGE");
1649
+ const t = $.getInstance().getInterface("OGG_SIEGE");
1361
1650
  t.instance.off("keyboardFocus", this.boundHandleKeyboardFocus), t.instance.off("keyDown", this.boundHandleKeyDown), t.instance.off("keyUp", this.boundHandleKeyUp), super.destroy();
1362
1651
  }
1363
1652
  handleKeyDown(t) {
1364
1653
  if (this.keybindListeningPaused)
1365
1654
  return;
1366
- const r = ae.get(t.key);
1655
+ const r = le.get(t.key);
1367
1656
  if (!r) {
1368
1657
  this.logger.error("Unknown key down", t);
1369
1658
  return;
@@ -1376,71 +1665,71 @@ class hn extends G {
1376
1665
  async handleKeyUp(t) {
1377
1666
  if (this.keybindListeningPaused)
1378
1667
  return;
1379
- const r = ae.get(t.key);
1668
+ const r = le.get(t.key);
1380
1669
  if (!r)
1381
1670
  return;
1382
1671
  this.pressedKeys.delete(r);
1383
- const s = this.keybindsFile.get();
1384
- for (const [a] of this.preferencesKeybindToCallbacks.entries())
1385
- s[a].keys.includes(r) && this.triggeredToggleKeybinds.delete(a);
1672
+ const n = this.keybindsFile.get();
1673
+ for (const [i] of this.preferencesKeybindToCallbacks.entries())
1674
+ n[i].keys.includes(r) && this.triggeredToggleKeybinds.delete(i);
1386
1675
  this.checkKeybindUps();
1387
1676
  }
1388
1677
  async checkKeybindUps() {
1389
1678
  const t = this.keybindsFile.get();
1390
- for (const [r, s] of this.preferencesKeybindToCallbacks.entries()) {
1391
- if (!s.up) continue;
1392
- const a = t[r];
1393
- this.activeKeybinds.has(r) && a.keys.some((i) => !this.pressedKeys.has(i)) && (this.activeKeybinds.delete(r), s.up(), this.logger.log("Keybind up triggered", this.getKeybindToString(a)));
1679
+ for (const [r, n] of this.preferencesKeybindToCallbacks.entries()) {
1680
+ if (!n.up) continue;
1681
+ const i = t[r];
1682
+ this.activeKeybinds.has(r) && i.keys.some((a) => !this.pressedKeys.has(a)) && (this.activeKeybinds.delete(r), n.up(), this.logger.log("Keybind up triggered", this.getKeybindToString(i)));
1394
1683
  }
1395
1684
  }
1396
1685
  async checkKeybindings() {
1397
1686
  const t = this.keybindsFile.get();
1398
- for (const [r, s] of this.preferencesKeybindToCallbacks.entries()) {
1399
- const a = t[r];
1400
- if (a.keys.length === this.pressedKeys.size && a.keys.every((o) => we.has(o) ? this.pressedKeys.has(o) : !1)) {
1401
- this.triggerKeybind(a, s, r);
1687
+ for (const [r, n] of this.preferencesKeybindToCallbacks.entries()) {
1688
+ const i = t[r];
1689
+ if (i.keys.length === this.pressedKeys.size && i.keys.every((o) => De.has(o) ? this.pressedKeys.has(o) : !1)) {
1690
+ this.triggerKeybind(i, n, r);
1402
1691
  return;
1403
1692
  }
1404
1693
  }
1405
- for (const [r, s] of this.preferencesKeybindToCallbacks.entries()) {
1406
- const a = t[r];
1407
- a.keys.every((o) => we.has(o) ? this.pressedKeys.has(o) : (this.logger.error("Unknown key", o, a), !1)) && this.triggerKeybind(a, s, r);
1694
+ for (const [r, n] of this.preferencesKeybindToCallbacks.entries()) {
1695
+ const i = t[r];
1696
+ i.keys.every((o) => De.has(o) ? this.pressedKeys.has(o) : (this.logger.error("Unknown key", o, i), !1)) && this.triggerKeybind(i, n, r);
1408
1697
  }
1409
1698
  }
1410
- triggerKeybind(t, r, s) {
1411
- const a = t.mode;
1412
- if (a === "toggle" && r.toggle && !this.triggeredToggleKeybinds.has(s)) {
1413
- const i = r.toggle();
1414
- this.triggeredToggleKeybinds.add(s), this.logger.log(
1415
- i ? `Keybind pressed rejected: ${i}` : "Keybind pressed accepted",
1699
+ triggerKeybind(t, r, n) {
1700
+ const i = t.mode;
1701
+ if (i === "toggle" && r.toggle && !this.triggeredToggleKeybinds.has(n)) {
1702
+ const a = r.toggle();
1703
+ this.triggeredToggleKeybinds.add(n), this.logger.log(
1704
+ a ? `Keybind pressed rejected: ${a}` : "Keybind pressed accepted",
1416
1705
  this.getKeybindToString(t)
1417
1706
  );
1418
1707
  }
1419
- if (a === "hold" && r.down && !this.activeKeybinds.has(s)) {
1420
- const i = r.down();
1421
- i ? this.logger.log(`Keybind down rejected: ${i}`, this.getKeybindToString(t)) : (this.activeKeybinds.add(s), this.logger.log("Keybind down accepted", this.getKeybindToString(t)));
1708
+ if (i === "hold" && r.down && !this.activeKeybinds.has(n)) {
1709
+ const a = r.down();
1710
+ a ? this.logger.log(`Keybind down rejected: ${a}`, this.getKeybindToString(t)) : (this.activeKeybinds.add(n), this.logger.log("Keybind down accepted", this.getKeybindToString(t)));
1422
1711
  }
1423
1712
  }
1424
1713
  getKeybindToString(t) {
1425
1714
  return `(${t.keys.join("+")}${t.mode ? ` ${t.mode}` : ""})`;
1426
1715
  }
1427
1716
  }
1428
- class gn extends Ae {
1717
+ class Cr extends Ne {
1429
1718
  constructor(t) {
1430
1719
  super("OverridesManager");
1431
- c(this, "renderInterface");
1432
- c(this, "globalCursorOverrideCount", /* @__PURE__ */ new Set());
1433
- c(this, "globalMouseBlockCount", /* @__PURE__ */ new Set());
1434
- c(this, "globalKeyboardBlockCount", /* @__PURE__ */ new Set());
1435
- c(this, "keyInputBlocks", {});
1436
- this.renderInterface = O.getInstance().getInterface(t);
1720
+ l(this, "renderInterface");
1721
+ l(this, "globalCursorOverrideCount", /* @__PURE__ */ new Set());
1722
+ l(this, "globalMouseBlockCount", /* @__PURE__ */ new Set());
1723
+ l(this, "globalKeyboardBlockCount", /* @__PURE__ */ new Set());
1724
+ l(this, "keyInputBlocks", {});
1725
+ this.renderInterface = $.getInstance().getInterface(t);
1437
1726
  }
1438
1727
  scope(t) {
1439
1728
  return {
1440
1729
  setGlobalCursorOverride: (r) => this.setGlobalCursorOverride(t, r),
1441
1730
  setGlobalMouseBlock: (r) => this.setGlobalMouseBlock(t, r),
1442
1731
  setGlobalKeyboardBlock: (r) => this.setGlobalKeyboardBlock(t, r),
1443
- setKeyInputBlock: (r, s) => this.setKeyInputBlock(t, r, s)
1732
+ setKeyInputBlock: (r, n) => this.setKeyInputBlock(t, r, n)
1444
1733
  };
1445
1734
  }
1446
1735
  setGlobalCursorOverride(t, r) {
@@ -1452,38 +1741,39 @@ class gn extends Ae {
1452
1741
  setGlobalKeyboardBlock(t, r) {
1453
1742
  r ? this.globalKeyboardBlockCount.add(t) : this.globalKeyboardBlockCount.delete(t), r && this.globalKeyboardBlockCount.size === 1 ? this.renderInterface.instance.setGlobalKeyboardBlock(!0) : !r && this.globalKeyboardBlockCount.size === 0 && this.renderInterface.instance.setGlobalKeyboardBlock(!1);
1454
1743
  }
1455
- setKeyInputBlock(t, r, s) {
1456
- this.keyInputBlocks[r] || (this.keyInputBlocks[r] = /* @__PURE__ */ new Set()), s ? this.keyInputBlocks[r].add(t) : this.keyInputBlocks[r].delete(t), s && this.keyInputBlocks[r].size === 1 ? this.renderInterface.instance.setKeyInputBlock(r, !0) : !s && this.keyInputBlocks[r].size === 0 && this.renderInterface.instance.setKeyInputBlock(r, !1);
1744
+ setKeyInputBlock(t, r, n) {
1745
+ this.keyInputBlocks[r] || (this.keyInputBlocks[r] = /* @__PURE__ */ new Set()), n ? this.keyInputBlocks[r].add(t) : this.keyInputBlocks[r].delete(t), n && this.keyInputBlocks[r].size === 1 ? this.renderInterface.instance.setKeyInputBlock(r, !0) : !n && this.keyInputBlocks[r].size === 0 && this.renderInterface.instance.setKeyInputBlock(r, !1);
1457
1746
  }
1458
1747
  }
1459
- const fn = _(gn, "OGG_SIEGE");
1460
- let te = !1, H;
1461
- function Yn(n) {
1462
- const { init: e = !0 } = n;
1463
- if (pn(n), te)
1464
- return H;
1748
+ const Lr = E(Cr, "OGG_SIEGE");
1749
+ let z = !1, W;
1750
+ function ps(s) {
1751
+ const { init: e = !0 } = s;
1752
+ if (Kr(s), me.getInstance().init(s.appName), z)
1753
+ return W;
1465
1754
  function t() {
1466
- kn(n);
1467
- const r = /* @__PURE__ */ new Map(), s = bn(n.modules, r), a = vn(), i = En(n.keybinds), o = wn(), l = _n();
1468
- yn(), In(n, r), te = !0, H = {
1469
- ...s,
1470
- ...a,
1471
- keybinds: i,
1755
+ Tr(s);
1756
+ const r = /* @__PURE__ */ new Map(), n = Or(s.modules, r), i = Mr(), a = Ar(s.keybinds), o = Rr(), c = xr();
1757
+ Fr(), $r(s, r), z = !0, W = {
1758
+ ...n,
1759
+ ...i,
1760
+ keybinds: a,
1472
1761
  windows: o,
1473
- input: l,
1762
+ input: c,
1474
1763
  hasAnyActiveProcesses: () => C.getInstance().hasAnyActiveProcesses,
1475
- init: t
1764
+ init: t,
1765
+ initialized: z
1476
1766
  };
1477
1767
  }
1478
- return e ? (t(), H) : new Proxy(
1768
+ return e ? (t(), W) : new Proxy(
1479
1769
  {
1480
1770
  init: t
1481
1771
  },
1482
1772
  {
1483
- get: (r, s) => {
1484
- if (s !== "init" && !te)
1485
- throw new Error("overlayed was called before initialized");
1486
- return s === "init" ? r[s] : H[s];
1773
+ get: (r, n) => {
1774
+ if (n !== "init" && !z)
1775
+ throw new Error(`overlayed was called before initialized: ${n}`);
1776
+ return n === "init" ? r[n] : W[n];
1487
1777
  }
1488
1778
  }
1489
1779
  );
@@ -1493,58 +1783,58 @@ global.OVERLAYED = new Proxy({}, {
1493
1783
  throw new Error("function overlayed was not called");
1494
1784
  }
1495
1785
  });
1496
- function pn(n) {
1786
+ function Kr(s) {
1497
1787
  global.OVERLAYED = {
1498
- APP_NAME: n.appName
1788
+ APP_NAME: s.appName
1499
1789
  };
1500
1790
  }
1501
- function yn() {
1502
- Ne.getInstance().init(), B.getInstance().init(), C.getInstance().init(), T.getInstance().init(), Pe.on("quit", () => {
1503
- mn();
1791
+ function Fr() {
1792
+ Ye.getInstance().init(), B.getInstance().init(), C.getInstance().init(), T.getInstance().init(), xe.on("quit", () => {
1793
+ Dr();
1504
1794
  });
1505
1795
  }
1506
- function mn() {
1507
- T.getInstance().destroy(), B.getInstance().destroy(), Ne.getInstance().destroy(), C.getInstance().destroy(), O.getInstance().getInterface("OGG_SIEGE").destroy(), oe.getInstance().destroy(), I.getInstance().destroy();
1796
+ function Dr() {
1797
+ T.getInstance().destroy(), B.getInstance().destroy(), Ye.getInstance().destroy(), C.getInstance().destroy(), $.getInstance().getInterface("OGG_SIEGE").destroy(), fe.getInstance().destroy(), I.getInstance().destroy();
1508
1798
  }
1509
- function bn(n, e) {
1510
- return n.reduce((t, r) => {
1511
- const s = r.key;
1512
- return t[s] = {
1799
+ function Or(s, e) {
1800
+ return s.reduce((t, r) => {
1801
+ const n = r.key;
1802
+ return t[n] = {
1513
1803
  // prettier-ignore
1514
- on(a, i) {
1515
- const o = M(s, a), l = e.get(o) ?? /* @__PURE__ */ new Set();
1516
- l.add(i), e.set(o, l);
1804
+ on(i, a) {
1805
+ const o = F(n, i), c = e.get(o) ?? /* @__PURE__ */ new Set();
1806
+ c.add(a), e.set(o, c);
1517
1807
  },
1518
- onAny(a) {
1519
- const i = M(s, "*"), o = e.get(i) ?? /* @__PURE__ */ new Set();
1520
- o.add(a), e.set(i, o);
1808
+ onAny(i) {
1809
+ const a = F(n, "*"), o = e.get(a) ?? /* @__PURE__ */ new Set();
1810
+ o.add(i), e.set(a, o);
1521
1811
  },
1522
1812
  // prettier-ignore
1523
- off(a, i) {
1524
- const o = M(s, a), l = e.get(o) ?? /* @__PURE__ */ new Set();
1525
- l.delete(i), e.set(o, l);
1813
+ off(i, a) {
1814
+ const o = F(n, i), c = e.get(o) ?? /* @__PURE__ */ new Set();
1815
+ c.delete(a), e.set(o, c);
1526
1816
  },
1527
1817
  // prettier-ignore
1528
- offAny(a) {
1529
- const i = M(s, "*"), o = e.get(i) ?? /* @__PURE__ */ new Set();
1530
- o.delete(a), e.set(i, o);
1818
+ offAny(i) {
1819
+ const a = F(n, "*"), o = e.get(a) ?? /* @__PURE__ */ new Set();
1820
+ o.delete(i), e.set(a, o);
1531
1821
  }
1532
1822
  }, t;
1533
1823
  }, {});
1534
1824
  }
1535
- function vn() {
1536
- const n = I.getInstance(), e = B.getInstance();
1825
+ function Mr() {
1826
+ const s = I.getInstance(), e = B.getInstance();
1537
1827
  return {
1538
1828
  on: (t, r) => {
1539
1829
  switch (t) {
1540
1830
  case "fatal":
1541
- n.on("fatal", r);
1831
+ s.on("fatal", r);
1542
1832
  break;
1543
1833
  case "error":
1544
- n.on("error", r);
1834
+ s.on("error", r);
1545
1835
  break;
1546
1836
  case "warning":
1547
- n.on("warning", r);
1837
+ s.on("warning", r);
1548
1838
  break;
1549
1839
  case "gameLaunch":
1550
1840
  e.on("gameLaunch", r);
@@ -1559,13 +1849,13 @@ function vn() {
1559
1849
  off: (t, r) => {
1560
1850
  switch (t) {
1561
1851
  case "fatal":
1562
- n.off("fatal", r);
1852
+ s.off("fatal", r);
1563
1853
  break;
1564
1854
  case "error":
1565
- n.off("error", r);
1855
+ s.off("error", r);
1566
1856
  break;
1567
1857
  case "warning":
1568
- n.off("warning", r);
1858
+ s.off("warning", r);
1569
1859
  break;
1570
1860
  case "gameLaunch":
1571
1861
  e.off("gameLaunch", r);
@@ -1579,57 +1869,57 @@ function vn() {
1579
1869
  }
1580
1870
  };
1581
1871
  }
1582
- function M(n, e) {
1583
- return `${n}:${e}`;
1872
+ function F(s, e) {
1873
+ return `${s}:${e}`;
1584
1874
  }
1585
- function In(n, e) {
1586
- const t = oe.getInstance();
1587
- function r(s) {
1588
- const a = dt(s);
1589
- if (a instanceof K.errors) {
1875
+ function $r(s, e) {
1876
+ const t = fe.getInstance();
1877
+ function r(n) {
1878
+ const i = Ct(n);
1879
+ if (i instanceof L.errors) {
1590
1880
  I.getInstance().warn("Invalid event", "INVALID_EVENT", {
1591
- summary: a.summary
1881
+ summary: i.summary
1592
1882
  });
1593
1883
  return;
1594
1884
  }
1595
- const i = n.modules.find((f) => f.key === a.game), o = i == null ? void 0 : i.events.event;
1885
+ const a = s.modules.find((p) => p.key === i.game), o = a == null ? void 0 : a.events.event;
1596
1886
  if (!o)
1597
1887
  return;
1598
- const l = o(s);
1599
- if (l instanceof K.errors) {
1888
+ const c = o(n);
1889
+ if (c instanceof L.errors) {
1600
1890
  I.getInstance().warn("Invalid event", "INVALID_EVENT", {
1601
- summary: l.summary
1891
+ summary: c.summary
1602
1892
  });
1603
1893
  return;
1604
1894
  }
1605
- const d = M(i.key, l.type), h = M(i.key, "*"), g = e.get(d), u = e.get(h), p = [...Array.from(g ?? []), ...Array.from(u ?? [])];
1606
- p.length !== 0 && p.forEach((f) => {
1607
- f(l);
1895
+ const u = F(a.key, c.type), d = F(a.key, "*"), g = e.get(u), h = e.get(d), y = [...Array.from(g ?? []), ...Array.from(h ?? [])];
1896
+ y.length !== 0 && y.forEach((p) => {
1897
+ p(c);
1608
1898
  });
1609
1899
  }
1610
- return t.on("data", (s) => s.forEach(r)), t.on("error", (s) => {
1900
+ return t.on("data", (n) => n.forEach(r)), t.on("error", (n) => {
1611
1901
  I.getInstance().error("Pipe server error", "PIPE_SERVER_ERROR", {
1612
- error: s
1902
+ error: n
1613
1903
  });
1614
1904
  }), t;
1615
1905
  }
1616
- function En(n) {
1617
- const e = new hn(n), t = {};
1618
- for (const s in n)
1619
- t[s] = {
1620
- on: (a, i) => {
1621
- switch (a) {
1906
+ function Ar(s) {
1907
+ const e = new Sr(s), t = {};
1908
+ for (const n in s)
1909
+ t[n] = {
1910
+ on: (i, a) => {
1911
+ switch (i) {
1622
1912
  case "down":
1623
- e.onKeybindDown(s, i);
1913
+ e.onKeybindDown(n, a);
1624
1914
  break;
1625
1915
  case "up":
1626
- e.onKeybindUp(s, i);
1916
+ e.onKeybindUp(n, a);
1627
1917
  break;
1628
1918
  case "toggle":
1629
- e.onKeybindToggled(s, i);
1919
+ e.onKeybindToggled(n, a);
1630
1920
  break;
1631
1921
  default:
1632
- throw new Error(`Event type not implemented ${a}`, { cause: [a, i] });
1922
+ throw new Error(`Event type not implemented ${i}`, { cause: [i, a] });
1633
1923
  }
1634
1924
  }
1635
1925
  };
@@ -1642,76 +1932,76 @@ function En(n) {
1642
1932
  resumeKeybindListening: () => {
1643
1933
  e.keybindListeningPaused = !1;
1644
1934
  },
1645
- updateKeybind: (s, a) => {
1646
- e.updateKeybind(s, a);
1935
+ updateKeybind: (n, i) => {
1936
+ e.updateKeybind(n, i);
1647
1937
  },
1648
- updateKeybinds: (s) => {
1649
- e.updateKeybinds(s);
1938
+ updateKeybinds: (n) => {
1939
+ e.updateKeybinds(n);
1650
1940
  }
1651
1941
  };
1652
- return e.init(), Pe.on("quit", () => {
1942
+ return e.init(), xe.on("quit", () => {
1653
1943
  e.destroy();
1654
1944
  }), r;
1655
1945
  }
1656
- function wn() {
1946
+ function Rr() {
1657
1947
  return {
1658
- createWindow: (n) => y().instance.newWindowInternal(Ze.BrowserWindow, n),
1659
- on: (n, e) => y().instance.on(n, e),
1660
- off: (n, e) => y().instance.off(n, e),
1661
- once: (n, e) => y().instance.once(n, e),
1662
- addListener: (n, e) => y().instance.addListener(n, e),
1663
- removeListener: (n, e) => y().instance.removeListener(n, e),
1664
- removeAllListeners: () => y().instance.removeAllListeners(),
1665
- prependListener: (n, e) => y().instance.prependListener(n, e),
1666
- prependOnceListener: (n, e) => y().instance.prependOnceListener(n, e),
1948
+ createWindow: (s) => m().instance.newWindowInternal(at.BrowserWindow, s),
1949
+ on: (s, e) => m().instance.on(s, e),
1950
+ off: (s, e) => m().instance.off(s, e),
1951
+ once: (s, e) => m().instance.once(s, e),
1952
+ addListener: (s, e) => m().instance.addListener(s, e),
1953
+ removeListener: (s, e) => m().instance.removeListener(s, e),
1954
+ removeAllListeners: () => m().instance.removeAllListeners(),
1955
+ prependListener: (s, e) => m().instance.prependListener(s, e),
1956
+ prependOnceListener: (s, e) => m().instance.prependOnceListener(s, e),
1667
1957
  getActiveGameInfo: () => {
1668
- const n = y(), e = oe.getInstance();
1958
+ const s = m(), e = fe.getInstance();
1669
1959
  return {
1670
- resolution: n.resolution,
1960
+ resolution: s.resolution,
1671
1961
  isConnected: e.hasConnection
1672
1962
  };
1673
1963
  }
1674
1964
  };
1675
1965
  }
1676
- function _n() {
1966
+ function xr() {
1677
1967
  return {
1678
- scope: (n) => fn.getInstance().scope(n),
1968
+ scope: (s) => Lr.getInstance().scope(s),
1679
1969
  raw: {
1680
- setGlobalMouseBlock: (n) => y().instance.setGlobalMouseBlock(n),
1681
- setGlobalKeyboardBlock: (n) => y().instance.setGlobalKeyboardBlock(n),
1682
- setGlobalCursorOverride: (n) => y().instance.setGlobalCursorOverride(n),
1683
- setKeyInputBlock: (n, e) => y().instance.setKeyInputBlock(n, e),
1684
- getGlobalMouseBlock: () => y().instance.getGlobalMouseBlock(),
1685
- getGlobalKeyboardBlock: () => y().instance.getGlobalKeyboardBlock(),
1686
- getGlobalCursorOverride: () => y().instance.getGlobalCursorOverride(),
1687
- getKeyInputBlock: (n) => y().instance.getKeyInputBlock(n)
1970
+ setGlobalMouseBlock: (s) => m().instance.setGlobalMouseBlock(s),
1971
+ setGlobalKeyboardBlock: (s) => m().instance.setGlobalKeyboardBlock(s),
1972
+ setGlobalCursorOverride: (s) => m().instance.setGlobalCursorOverride(s),
1973
+ setKeyInputBlock: (s, e) => m().instance.setKeyInputBlock(s, e),
1974
+ getGlobalMouseBlock: () => m().instance.getGlobalMouseBlock(),
1975
+ getGlobalKeyboardBlock: () => m().instance.getGlobalKeyboardBlock(),
1976
+ getGlobalCursorOverride: () => m().instance.getGlobalCursorOverride(),
1977
+ getKeyInputBlock: (s) => m().instance.getKeyInputBlock(s)
1688
1978
  }
1689
1979
  };
1690
1980
  }
1691
- function kn(n) {
1692
- P.getInstance().clientId = n.appName, P.getInstance().userId = Wt.generateUniqueIdentifier(), I.getInstance().on("fatal", (e) => {
1693
- P.getInstance().track("fatal", {
1981
+ function Tr(s) {
1982
+ S.getInstance().clientId = s.appName, S.getInstance().userId = hr.generateUniqueIdentifier(), I.getInstance().on("fatal", (e) => {
1983
+ S.getInstance().track("fatal", {
1694
1984
  message: e.message,
1695
1985
  code: e.code,
1696
1986
  data: e.data
1697
1987
  });
1698
1988
  }), I.getInstance().on("error", (e) => {
1699
- P.getInstance().track("error", {
1989
+ S.getInstance().track("error", {
1700
1990
  message: e.message,
1701
1991
  code: e.code,
1702
1992
  data: e.data
1703
1993
  });
1704
1994
  }), I.getInstance().on("warning", (e) => {
1705
- P.getInstance().track("warning", {
1995
+ S.getInstance().track("warning", {
1706
1996
  message: e.message,
1707
1997
  code: e.code,
1708
1998
  data: e.data
1709
1999
  });
1710
2000
  });
1711
2001
  }
1712
- function y() {
1713
- return O.getInstance().getInterface("OGG_SIEGE");
2002
+ function m() {
2003
+ return $.getInstance().getInterface("OGG_SIEGE");
1714
2004
  }
1715
2005
  export {
1716
- Yn as overlayed
2006
+ ps as overlayed
1717
2007
  };