@npaw/forge-web 10.0.4 → 10.2.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.
Binary file
package/dist/index.cjs CHANGED
@@ -378,6 +378,20 @@ var ResourceTimingCorrelator = class {
378
378
  }
379
379
  };
380
380
 
381
+ // src/global.ts
382
+ function getGlobalObject() {
383
+ if (typeof globalThis !== "undefined") {
384
+ return globalThis;
385
+ }
386
+ if (typeof self !== "undefined") {
387
+ return self;
388
+ }
389
+ if (typeof window !== "undefined") {
390
+ return window;
391
+ }
392
+ throw new Error("no global object available");
393
+ }
394
+
381
395
  // src/sections-capture.ts
382
396
  var DEFAULT_VISIBILITY_THRESHOLD_PCT = 50;
383
397
  var DEFAULT_IMPRESSION_MIN_VISIBLE_MS = 1e3;
@@ -1271,7 +1285,7 @@ function resolveIntersectionObserverFactory(environment) {
1271
1285
  if (environment.intersectionObserverFactory) {
1272
1286
  return environment.intersectionObserverFactory;
1273
1287
  }
1274
- const ctor = globalThis.IntersectionObserver;
1288
+ const ctor = getGlobalObject().IntersectionObserver;
1275
1289
  if (typeof ctor !== "function") {
1276
1290
  return void 0;
1277
1291
  }
@@ -1281,7 +1295,7 @@ function resolveMutationObserverFactory(environment) {
1281
1295
  if (environment.mutationObserverFactory) {
1282
1296
  return environment.mutationObserverFactory;
1283
1297
  }
1284
- const ctor = globalThis.MutationObserver;
1298
+ const ctor = getGlobalObject().MutationObserver;
1285
1299
  if (typeof ctor !== "function") {
1286
1300
  return void 0;
1287
1301
  }
@@ -3412,7 +3426,7 @@ function persistentDeviceUuid() {
3412
3426
  }
3413
3427
  const generated = randomUuid();
3414
3428
  try {
3415
- (_a = globalThis.localStorage) == null ? void 0 : _a.setItem(DEVICE_UUID_STORAGE_KEY, generated);
3429
+ (_a = getGlobalObject().localStorage) == null ? void 0 : _a.setItem(DEVICE_UUID_STORAGE_KEY, generated);
3416
3430
  } catch (e) {
3417
3431
  }
3418
3432
  return generated;
@@ -3420,14 +3434,14 @@ function persistentDeviceUuid() {
3420
3434
  function readStoredUuid() {
3421
3435
  var _a;
3422
3436
  try {
3423
- const value = (_a = globalThis.localStorage) == null ? void 0 : _a.getItem(DEVICE_UUID_STORAGE_KEY);
3437
+ const value = (_a = getGlobalObject().localStorage) == null ? void 0 : _a.getItem(DEVICE_UUID_STORAGE_KEY);
3424
3438
  return value && value.trim().length > 0 ? value : void 0;
3425
3439
  } catch (e) {
3426
3440
  return void 0;
3427
3441
  }
3428
3442
  }
3429
3443
  function randomUuid() {
3430
- const cryptoRef = globalThis.crypto;
3444
+ const cryptoRef = getGlobalObject().crypto;
3431
3445
  if (typeof (cryptoRef == null ? void 0 : cryptoRef.randomUUID) === "function") {
3432
3446
  return cryptoRef.randomUUID();
3433
3447
  }
@@ -3561,11 +3575,11 @@ function readDownlinkKbps(environment) {
3561
3575
  }
3562
3576
  function readBrowserDeviceInsightsEnvironment() {
3563
3577
  const environment = {};
3564
- const performanceRef = globalThis.performance;
3578
+ const performanceRef = getGlobalObject().performance;
3565
3579
  if (performanceRef && typeof performanceRef.memory === "object" && performanceRef.memory !== null) {
3566
3580
  environment.memory = () => performanceRef.memory;
3567
3581
  }
3568
- const navigatorRef = globalThis.navigator;
3582
+ const navigatorRef = getGlobalObject().navigator;
3569
3583
  if (navigatorRef && typeof navigatorRef.getBattery === "function") {
3570
3584
  environment.getBattery = () => navigatorRef.getBattery();
3571
3585
  }
@@ -3656,8 +3670,17 @@ function diagnosticFromError(error, code) {
3656
3670
  function isPromiseLike(value) {
3657
3671
  return Boolean(value && typeof value.then === "function");
3658
3672
  }
3673
+ function fromEntries(entries) {
3674
+ const result = {};
3675
+ for (const entry of entries) {
3676
+ result[entry[0]] = entry[1];
3677
+ }
3678
+ return result;
3679
+ }
3659
3680
 
3660
3681
  // src/effects.ts
3682
+ var MAX_COMMAND_SUBSCRIPTIONS = 64;
3683
+ var COMMAND_NAME_PATTERN = /^[A-Za-z0-9_.-]{1,64}$/;
3661
3684
  var BrowserEffectExecutor = class {
3662
3685
  constructor(options) {
3663
3686
  this.timers = /* @__PURE__ */ new Map();
@@ -3666,6 +3689,7 @@ var BrowserEffectExecutor = class {
3666
3689
  this.diagnosticListeners = /* @__PURE__ */ new Set();
3667
3690
  this.logListeners = /* @__PURE__ */ new Set();
3668
3691
  this.capturePlanListeners = /* @__PURE__ */ new Set();
3692
+ this.commandListeners = /* @__PURE__ */ new Map();
3669
3693
  this.clock = options.clock;
3670
3694
  this.transport = options.transport;
3671
3695
  this.storage = options.storage;
@@ -3680,6 +3704,18 @@ var BrowserEffectExecutor = class {
3680
3704
  if (options.onLog) {
3681
3705
  this.logListeners.add(options.onLog);
3682
3706
  }
3707
+ if (options.commandListeners) {
3708
+ for (const name of Object.keys(options.commandListeners)) {
3709
+ const listeners = options.commandListeners[name];
3710
+ if (!listeners) {
3711
+ continue;
3712
+ }
3713
+ const entries = Array.isArray(listeners) ? listeners : [listeners];
3714
+ for (const listener of entries) {
3715
+ this.registerCommandListener(name, listener);
3716
+ }
3717
+ }
3718
+ }
3683
3719
  }
3684
3720
  addEventListener(listener) {
3685
3721
  this.eventListeners.add(listener);
@@ -3700,6 +3736,51 @@ var BrowserEffectExecutor = class {
3700
3736
  }
3701
3737
  return () => this.capturePlanListeners.delete(listener);
3702
3738
  }
3739
+ /**
3740
+ * Registers a remote command listener and re-sends the full subscription
3741
+ * set to the kernel. Every call is its own registration, even for a
3742
+ * function already registered under the name. Returns the unsubscribe
3743
+ * closure, which removes only that registration and re-sends the set
3744
+ * without the name once its last registration is gone.
3745
+ */
3746
+ addCommandListener(name, listener) {
3747
+ const registration = this.registerCommandListener(name, listener);
3748
+ if (!registration) {
3749
+ return () => void 0;
3750
+ }
3751
+ this.syncCommandSubscriptions();
3752
+ let active = true;
3753
+ return () => {
3754
+ if (!active) {
3755
+ return;
3756
+ }
3757
+ active = false;
3758
+ const registrations = this.commandListeners.get(registration.name);
3759
+ if (!registrations) {
3760
+ return;
3761
+ }
3762
+ const index = registrations.indexOf(registration);
3763
+ if (index >= 0) {
3764
+ registrations.splice(index, 1);
3765
+ }
3766
+ if (registrations.length === 0) {
3767
+ this.commandListeners.delete(registration.name);
3768
+ }
3769
+ this.syncCommandSubscriptions();
3770
+ };
3771
+ }
3772
+ /** The command names currently subscribed, sorted. */
3773
+ commandSubscriptions() {
3774
+ return Array.from(this.commandListeners.keys()).sort();
3775
+ }
3776
+ /** Sends the current subscription set (used by the bridge after `start`). */
3777
+ syncCommandSubscriptions() {
3778
+ this.submitCompletion({ type: "setCommandSubscriptions", names: this.commandSubscriptions() });
3779
+ }
3780
+ /** Drops every command listener without re-syncing (the runtime is gone). */
3781
+ clearCommandListeners() {
3782
+ this.commandListeners.clear();
3783
+ }
3703
3784
  execute(effects) {
3704
3785
  for (const effect of effects) {
3705
3786
  switch (effect.type) {
@@ -3736,6 +3817,9 @@ var BrowserEffectExecutor = class {
3736
3817
  case "deviceSampleRequest":
3737
3818
  this.track(this.executeDeviceSampleRequest(effect.families));
3738
3819
  break;
3820
+ case "commandRequest":
3821
+ this.dispatchCommandRequest({ id: effect.id, name: effect.name, args: effect.args });
3822
+ break;
3739
3823
  default:
3740
3824
  break;
3741
3825
  }
@@ -3839,6 +3923,75 @@ var BrowserEffectExecutor = class {
3839
3923
  }
3840
3924
  this.submitCompletion({ type: "recordDeviceSample", sample: compactDeviceSample(sample) });
3841
3925
  }
3926
+ /**
3927
+ * Validates and stores a listener. Blank or malformed names and the 65th
3928
+ * distinct name are refused with a diagnostic (the kernel would drop them
3929
+ * anyway) so a typo surfaces instead of silently never firing.
3930
+ */
3931
+ registerCommandListener(rawName, listener) {
3932
+ const name = typeof rawName === "string" ? rawName.trim() : "";
3933
+ if (!COMMAND_NAME_PATTERN.test(name)) {
3934
+ this.emitDiagnostic({
3935
+ code: "command_name_invalid",
3936
+ message: "command names are 1-64 characters of [A-Za-z0-9_.-]",
3937
+ recoverable: true,
3938
+ attributes: { name: String(rawName).slice(0, 64) }
3939
+ });
3940
+ return void 0;
3941
+ }
3942
+ let registrations = this.commandListeners.get(name);
3943
+ if (!registrations) {
3944
+ if (this.commandListeners.size >= MAX_COMMAND_SUBSCRIPTIONS) {
3945
+ this.emitDiagnostic({
3946
+ code: "command_subscriptions_limit",
3947
+ message: `at most ${MAX_COMMAND_SUBSCRIPTIONS} distinct command names can be subscribed`,
3948
+ recoverable: true,
3949
+ attributes: { name }
3950
+ });
3951
+ return void 0;
3952
+ }
3953
+ registrations = [];
3954
+ this.commandListeners.set(name, registrations);
3955
+ }
3956
+ const registration = { name, listener };
3957
+ registrations.push(registration);
3958
+ return registration;
3959
+ }
3960
+ /**
3961
+ * Hands a delivered command to every registration of its name, in
3962
+ * registration order and over a snapshot: a listener added or removed
3963
+ * while dispatching does not change who receives the in-flight command.
3964
+ * Each registration gets its own once-guarded `answer`; the kernel keeps
3965
+ * the first answer per command id. No registration (a race with an
3966
+ * unsubscribe) means no answer from here - the kernel auto-answers only
3967
+ * names nobody subscribed to.
3968
+ */
3969
+ dispatchCommandRequest(command) {
3970
+ const registrations = this.commandListeners.get(command.name);
3971
+ if (!registrations || registrations.length === 0) {
3972
+ return;
3973
+ }
3974
+ for (const { listener } of registrations.slice()) {
3975
+ let answered = false;
3976
+ const answer = (handled, details) => {
3977
+ if (answered) {
3978
+ return;
3979
+ }
3980
+ answered = true;
3981
+ this.submitCompletion({
3982
+ type: "commandAnswer",
3983
+ commandId: command.id,
3984
+ handled: Boolean(handled),
3985
+ details: normalizeDetails(details)
3986
+ });
3987
+ };
3988
+ try {
3989
+ listener({ id: command.id, name: command.name, args: command.args.slice() }, answer);
3990
+ } catch (error) {
3991
+ this.emitDiagnostic(diagnosticFromError(error, "command_listener_failed"));
3992
+ }
3993
+ }
3994
+ }
3842
3995
  scheduleTimer(timer) {
3843
3996
  this.cancelTimer(timer.id);
3844
3997
  const startedAtMs = this.clock.nowMs();
@@ -3916,6 +4069,20 @@ function actualTimestamp(base, actualDelayMs) {
3916
4069
  elapsedRealtimeMs: Math.round(base.elapsedRealtimeMs + actualDelayMs)
3917
4070
  };
3918
4071
  }
4072
+ function normalizeDetails(details) {
4073
+ const normalized = {};
4074
+ if (!details || typeof details !== "object") {
4075
+ return normalized;
4076
+ }
4077
+ for (const key of Object.keys(details)) {
4078
+ const value = details[key];
4079
+ if (value === void 0 || value === null) {
4080
+ continue;
4081
+ }
4082
+ normalized[key] = String(value);
4083
+ }
4084
+ return normalized;
4085
+ }
3919
4086
 
3920
4087
  // src/errors.ts
3921
4088
  var ForgeCreateError = class extends Error {
@@ -3955,13 +4122,14 @@ function createBrowserStorage() {
3955
4122
  }
3956
4123
  function safeLocalStorage() {
3957
4124
  try {
3958
- if (typeof globalThis.localStorage === "undefined") {
4125
+ const host = getGlobalObject();
4126
+ if (typeof host.localStorage === "undefined") {
3959
4127
  return null;
3960
4128
  }
3961
4129
  const probe = "__npaw_forge_storage_probe__";
3962
- globalThis.localStorage.setItem(probe, "1");
3963
- globalThis.localStorage.removeItem(probe);
3964
- return globalThis.localStorage;
4130
+ host.localStorage.setItem(probe, "1");
4131
+ host.localStorage.removeItem(probe);
4132
+ return host.localStorage;
3965
4133
  } catch (e) {
3966
4134
  return null;
3967
4135
  }
@@ -3970,10 +4138,11 @@ function safeLocalStorage() {
3970
4138
  // src/transport.ts
3971
4139
  var BrowserForgeTransport = class {
3972
4140
  async send(request) {
3973
- if (typeof globalThis.fetch === "function") {
4141
+ const host = getGlobalObject();
4142
+ if (typeof host.fetch === "function") {
3974
4143
  return sendWithFetch(request);
3975
4144
  }
3976
- if (typeof globalThis.XMLHttpRequest === "function") {
4145
+ if (typeof host.XMLHttpRequest === "function") {
3977
4146
  return sendWithXhr(request);
3978
4147
  }
3979
4148
  throw new Error("fetch and XMLHttpRequest are unavailable");
@@ -3988,7 +4157,7 @@ async function sendWithFetch(request) {
3988
4157
  if (body !== void 0) {
3989
4158
  init.body = body;
3990
4159
  }
3991
- const response = await withoutNetworkCapture(() => globalThis.fetch(requestUrl(request), init));
4160
+ const response = await withoutNetworkCapture(() => getGlobalObject().fetch(requestUrl(request), init));
3992
4161
  const headers = {};
3993
4162
  response.headers.forEach((value, key) => {
3994
4163
  headers[key] = value;
@@ -4041,8 +4210,9 @@ function requestUrl(request) {
4041
4210
  return base.toString();
4042
4211
  }
4043
4212
  function browserBaseUrl() {
4044
- if (typeof globalThis.location !== "undefined" && globalThis.location.href) {
4045
- return globalThis.location.href;
4213
+ const host = getGlobalObject();
4214
+ if (typeof host.location !== "undefined" && host.location.href) {
4215
+ return host.location.href;
4046
4216
  }
4047
4217
  return "https://localhost/";
4048
4218
  }
@@ -4130,6 +4300,9 @@ function assertRuntimeSupport() {
4130
4300
  if (typeof ArrayBuffer === "undefined" || typeof Uint8Array === "undefined") {
4131
4301
  throw new Error("typed arrays are unavailable");
4132
4302
  }
4303
+ if (typeof TextEncoder === "undefined" || typeof TextDecoder === "undefined") {
4304
+ throw new Error("TextEncoder/TextDecoder are unavailable");
4305
+ }
4133
4306
  }
4134
4307
 
4135
4308
  // src/runtime.ts
@@ -4153,7 +4326,8 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
4153
4326
  onEvent: options.onEvent,
4154
4327
  onDiagnostic: options.onDiagnostic,
4155
4328
  onLog: options.onLog,
4156
- deviceSampleCollector: options.deviceSampleCollector
4329
+ deviceSampleCollector: options.deviceSampleCollector,
4330
+ commandListeners: options.commandListeners
4157
4331
  });
4158
4332
  }
4159
4333
  static async create(options) {
@@ -4168,7 +4342,20 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
4168
4342
  attributes: {}
4169
4343
  });
4170
4344
  }
4171
- const module2 = await normalizeWasmLoader(options.wasm).load();
4345
+ let module2;
4346
+ try {
4347
+ module2 = await normalizeWasmLoader(options.wasm).load();
4348
+ } catch (error) {
4349
+ if (error instanceof ForgeCreateError) {
4350
+ throw error;
4351
+ }
4352
+ throw new ForgeCreateError({
4353
+ code: "wasm_instantiate_failed",
4354
+ message: describeWasmLoadError(error),
4355
+ recoverable: false,
4356
+ attributes: {}
4357
+ });
4358
+ }
4172
4359
  const response = module2.forgeRuntimeCreate(runtimeConfig(options));
4173
4360
  if (!response.ok || !response.value) {
4174
4361
  throw new ForgeCreateError(boundaryDiagnostic(response.error));
@@ -4182,9 +4369,14 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
4182
4369
  onEvent: options.onEvent,
4183
4370
  onDiagnostic: options.onDiagnostic,
4184
4371
  onLog: options.onLog,
4185
- deviceSampleCollector: deviceSampleCollector(options)
4372
+ deviceSampleCollector: deviceSampleCollector(options),
4373
+ commandListeners: options.commandListeners
4186
4374
  });
4187
4375
  await bridge.process({ type: "start" });
4376
+ const subscriptions = bridge.commandSubscriptions();
4377
+ if (subscriptions.length > 0) {
4378
+ await bridge.process({ type: "setCommandSubscriptions", names: subscriptions });
4379
+ }
4188
4380
  return { bridge, module: module2 };
4189
4381
  }
4190
4382
  nowMs() {
@@ -4199,6 +4391,21 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
4199
4391
  onLog(listener) {
4200
4392
  return this.executor.addLogListener(listener);
4201
4393
  }
4394
+ /**
4395
+ * Subscribes to a remote command name. Adding or removing a listener
4396
+ * re-sends the full subscription set to the kernel. Once the runtime is
4397
+ * destroyed nothing is registered and the returned unsubscribe is inert.
4398
+ */
4399
+ onCommand(name, listener) {
4400
+ if (this.destroyed) {
4401
+ return () => void 0;
4402
+ }
4403
+ return this.executor.addCommandListener(name, listener);
4404
+ }
4405
+ /** The command names currently subscribed, sorted. */
4406
+ commandSubscriptions() {
4407
+ return this.executor.commandSubscriptions();
4408
+ }
4202
4409
  /**
4203
4410
  * Subscribes to kernel-computed capture plans. The latest plan already
4204
4411
  * observed by the effect executor is replayed to the new listener so
@@ -4236,6 +4443,7 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
4236
4443
  const batch = response.ok && response.value ? response.value : errorBatchFromBoundary(response.error);
4237
4444
  this.executor.execute(batch.effects);
4238
4445
  this.executor.cancelAll();
4446
+ this.executor.clearCommandListeners();
4239
4447
  await this.drainIdle();
4240
4448
  (_b = (_a = this.module).forgeRuntimeRelease) == null ? void 0 : _b.call(_a, this.handle);
4241
4449
  return batch;
@@ -4295,6 +4503,8 @@ var ForgeRuntimeBridge = class _ForgeRuntimeBridge {
4295
4503
  } : command;
4296
4504
  case "recordDeviceSample":
4297
4505
  return command.sample.sampledAtMs === void 0 ? { ...command, sample: { ...command.sample, sampledAtMs: this.nowMs() } } : command;
4506
+ case "commandAnswer":
4507
+ return command.timemarkMs === void 0 ? { ...command, timemarkMs: this.nowMs() } : command;
4298
4508
  default:
4299
4509
  return command;
4300
4510
  }
@@ -4452,6 +4662,13 @@ function errorBatchFromBoundary(error) {
4452
4662
  const diagnostic = boundaryDiagnostic(error);
4453
4663
  return errorBatch(diagnostic.code, diagnostic.message);
4454
4664
  }
4665
+ function describeWasmLoadError(error) {
4666
+ if (error instanceof Error) {
4667
+ const name = error.name && error.name !== "Error" ? `${error.name}: ` : "";
4668
+ return `WASM kernel failed to load: ${name}${error.message}`;
4669
+ }
4670
+ return `WASM kernel failed to load: ${String(error)}`;
4671
+ }
4455
4672
  function boundaryDiagnostic(error) {
4456
4673
  if (!error) {
4457
4674
  return {
@@ -4542,7 +4759,7 @@ var ForgeConnectionTypeObserver = class {
4542
4759
  }
4543
4760
  };
4544
4761
  function readNavigatorConnection() {
4545
- const navigatorRef = globalThis.navigator;
4762
+ const navigatorRef = getGlobalObject().navigator;
4546
4763
  return navigatorRef == null ? void 0 : navigatorRef.connection;
4547
4764
  }
4548
4765
 
@@ -4607,7 +4824,7 @@ function fixFromPosition(position) {
4607
4824
  };
4608
4825
  }
4609
4826
  function readGeolocationEnvironment() {
4610
- const navigatorRef = globalThis.navigator;
4827
+ const navigatorRef = getGlobalObject().navigator;
4611
4828
  const geolocation = navigatorRef == null ? void 0 : navigatorRef.geolocation;
4612
4829
  const permissions = navigatorRef == null ? void 0 : navigatorRef.permissions;
4613
4830
  if (!geolocation || !(permissions == null ? void 0 : permissions.query)) {
@@ -5276,6 +5493,19 @@ var _NPAWForge = class _NPAWForge {
5276
5493
  onLog(listener) {
5277
5494
  return this.runtime.onLog(listener);
5278
5495
  }
5496
+ /**
5497
+ * Listens for a remote command by name. The backend delivers commands in the
5498
+ * responses of Forge's own analytics requests, so they arrive only while
5499
+ * events flow; a command nobody subscribed to is answered `handled=false`
5500
+ * by the kernel and never re-delivered - register listeners early (or
5501
+ * through `commandListeners` at create time). Every listener of the name
5502
+ * runs; call `answer(handled, details?)` at most once per listener, the
5503
+ * first answer per command id is reported as a `command-answer` event.
5504
+ * Returns the unsubscribe function.
5505
+ */
5506
+ onCommand(name, listener) {
5507
+ return this.runtime.onCommand(name, listener);
5508
+ }
5279
5509
  async startSession(params) {
5280
5510
  var _a, _b;
5281
5511
  const result = await this.session("sessionstart", params);
@@ -11674,7 +11904,7 @@ var MediaTailorAdsAdapter = class extends BaseWebAdAdapter {
11674
11904
  if (this.fetchAttempts >= maxFetchRetries) {
11675
11905
  return;
11676
11906
  }
11677
- const fetchFn = (_d = (_c = this.options) == null ? void 0 : _c.fetch) != null ? _d : globalThis.fetch;
11907
+ const fetchFn = (_d = (_c = this.options) == null ? void 0 : _c.fetch) != null ? _d : getGlobalObject().fetch;
11678
11908
  if (typeof fetchFn !== "function") {
11679
11909
  return;
11680
11910
  }
@@ -13206,7 +13436,7 @@ function freewheelEvents() {
13206
13436
  ERROR_VAST_XML_PARSING: "ERROR_VAST_XML_PARSING",
13207
13437
  ERROR_PARSE: "ERROR_PARSE"
13208
13438
  };
13209
- return Object.fromEntries(
13439
+ return fromEntries(
13210
13440
  Object.entries(fallback).map(([key, value]) => {
13211
13441
  var _a;
13212
13442
  return [key, (_a = stringValue(read(sdk, key))) != null ? _a : value];
@@ -13344,7 +13574,7 @@ function bitmovinEvents(player) {
13344
13574
  StallStarted: "StallStarted",
13345
13575
  StallEnded: "StallEnded"
13346
13576
  };
13347
- return Object.fromEntries(
13577
+ return fromEntries(
13348
13578
  Object.entries(fallback).map(([key, value]) => {
13349
13579
  var _a;
13350
13580
  return [key, (_a = stringValue(read(events, key))) != null ? _a : value];
@@ -13705,7 +13935,7 @@ function storedFastDataPingTimeSeconds(value) {
13705
13935
  }
13706
13936
  }
13707
13937
  function cleanObject(value) {
13708
- return Object.fromEntries(
13938
+ return fromEntries(
13709
13939
  Object.entries(value).filter((entry) => entry[1] !== void 0)
13710
13940
  );
13711
13941
  }
@@ -13790,7 +14020,7 @@ function stripQuery(value) {
13790
14020
  return value == null ? void 0 : value.split("?")[0];
13791
14021
  }
13792
14022
  function globalRecord(name) {
13793
- return memberRecord(globalThis[name]);
14023
+ return memberRecord(getGlobalObject()[name]);
13794
14024
  }
13795
14025
  function realmOf(candidate) {
13796
14026
  var _a;