@fest-lib/uniform 0.1.6 → 0.1.8

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/uniform.js CHANGED
@@ -1,10 +1,11 @@
1
- var sr = /* @__PURE__ */ (function(e) {
1
+ import { Promised as rn, UUIDv4 as h, deepOperateAndClone as he, isCanJustReturn as Me, isCanTransfer as Ie, isNotComplexArray as ot, isPrimitive as Ae } from "@fest-lib/core";
2
+ var Qs = /* @__PURE__ */ (function(e) {
2
3
  return e.SUCCESS = "success", e.ERROR = "error", e;
3
- })({}), rr = /* @__PURE__ */ (function(e) {
4
+ })({}), Vs = /* @__PURE__ */ (function(e) {
4
5
  return e.PRIMITIVE = "primitive", e.NUMBER = "number", e.STRING = "string", e.BOOLEAN = "boolean", e.BIGINT = "bigint", e.UNDEFINED = "undefined", e.NULL = "null", e.OBJECT = "object", e.FUNCTION = "function", e.ARRAY = "array", e.MAP = "map", e.SET = "set", e.SYMBOL = "symbol", e.WEAK_REF = "weakRef", e.PROMISE = "promise", e.UNKNOWN = "unknown", e;
5
6
  })({}), d = /* @__PURE__ */ (function(e) {
6
7
  return e.GET = "get", e.SET = "set", e.CALL = "call", e.APPLY = "apply", e.CONSTRUCT = "construct", e.DELETE = "delete", e.DELETE_PROPERTY = "deleteProperty", e.HAS = "has", e.OWN_KEYS = "ownKeys", e.GET_OWN_PROPERTY_DESCRIPTOR = "getOwnPropertyDescriptor", e.GET_PROPERTY_DESCRIPTOR = "getPropertyDescriptor", e.GET_PROTOTYPE_OF = "getPrototypeOf", e.SET_PROTOTYPE_OF = "setPrototypeOf", e.IS_EXTENSIBLE = "isExtensible", e.PREVENT_EXTENSIONS = "preventExtensions", e.TRANSFER = "transfer", e.IMPORT = "import", e.DISPOSE = "dispose", e;
7
- })({}), dn = {
8
+ })({}), on = {
8
9
  ws: "websocket",
9
10
  socket: "websocket",
10
11
  socketio: "socket-io",
@@ -14,15 +15,15 @@ var sr = /* @__PURE__ */ (function(e) {
14
15
  "service-worker-host": "service-worker",
15
16
  "ring-buffer": "atomics"
16
17
  };
17
- function fn(e) {
18
+ function an(e) {
18
19
  const t = String(e ?? "").trim().toLowerCase();
19
- return t ? dn[t] ?? t : "internal";
20
+ return t ? on[t] ?? t : "internal";
20
21
  }
21
- function ie(e) {
22
- return typeof e == "string" ? fn(e) : typeof Worker < "u" && e instanceof Worker ? "worker" : typeof SharedWorker < "u" && e instanceof SharedWorker ? "shared-worker" : typeof MessagePort < "u" && e instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && e instanceof BroadcastChannel ? "broadcast" : typeof WebSocket < "u" && e instanceof WebSocket ? "websocket" : typeof RTCDataChannel < "u" && e instanceof RTCDataChannel ? "rtc-data" : typeof chrome < "u" && e && typeof e == "object" && typeof e.postMessage == "function" && e.onMessage?.addListener ? "chrome-port" : "internal";
22
+ function Z(e) {
23
+ return typeof e == "string" ? an(e) : typeof Worker < "u" && e instanceof Worker ? "worker" : typeof SharedWorker < "u" && e instanceof SharedWorker ? "shared-worker" : typeof MessagePort < "u" && e instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && e instanceof BroadcastChannel ? "broadcast" : typeof WebSocket < "u" && e instanceof WebSocket ? "websocket" : typeof RTCDataChannel < "u" && e instanceof RTCDataChannel ? "rtc-data" : typeof chrome < "u" && e && typeof e == "object" && typeof e.postMessage == "function" && e.onMessage?.addListener ? "chrome-port" : "internal";
23
24
  }
24
- function dt(e) {
25
- const t = ie(e);
25
+ function at(e) {
26
+ const t = Z(e);
26
27
  return {
27
28
  type: t,
28
29
  supports: {
@@ -134,7 +135,7 @@ function dt(e) {
134
135
  }[t]
135
136
  };
136
137
  }
137
- function y(e, t) {
138
+ function g(e, t) {
138
139
  return (n, s) => {
139
140
  const r = s ?? n?.transferable ?? [], { transferable: i, ...o } = n;
140
141
  if (e instanceof Worker) {
@@ -243,8 +244,8 @@ function m(e, t, n, s, r) {
243
244
  }
244
245
  if (e === "chrome-tabs" && typeof chrome < "u" && chrome.runtime) {
245
246
  const c = r?.tabId;
246
- if (c != null) return ft(c, (h) => t(h));
247
- const l = (h) => (t(h), !1);
247
+ if (c != null) return ct(c, (u) => t(u));
248
+ const l = (u) => (t(u), !1);
248
249
  return chrome.runtime.onMessage.addListener(l), () => chrome.runtime.onMessage.removeListener(l);
249
250
  }
250
251
  if (e === "chrome-port" && typeof chrome < "u" && chrome.runtime) {
@@ -262,10 +263,10 @@ function m(e, t, n, s, r) {
262
263
  return navigator.serviceWorker.addEventListener("message", i), () => navigator.serviceWorker.removeEventListener("message", i);
263
264
  if (e === "service-worker-host" || e === "self") {
264
265
  const c = (l) => {
265
- const h = e === "service-worker-host" ? l.source?.id : void 0;
266
- t(h ? {
266
+ const u = e === "service-worker-host" ? l.source?.id : void 0;
267
+ t(u ? {
267
268
  ...l.data,
268
- _clientId: h
269
+ _clientId: u
269
270
  } : l.data);
270
271
  };
271
272
  return self.addEventListener("message", c), () => self.removeEventListener("message", c);
@@ -273,13 +274,13 @@ function m(e, t, n, s, r) {
273
274
  return () => {
274
275
  };
275
276
  }
276
- function pn(e, t) {
277
+ function cn(e, t) {
277
278
  if (typeof chrome > "u" || !chrome.runtime) return () => {
278
279
  };
279
280
  const n = (s, r, i) => e(s, i, r);
280
281
  return t?.external && chrome.runtime.onMessageExternal ? (chrome.runtime.onMessageExternal.addListener(n), () => chrome.runtime.onMessageExternal.removeListener(n)) : (chrome.runtime.onMessage.addListener(n), () => chrome.runtime.onMessage.removeListener(n));
281
282
  }
282
- function ft(e, t) {
283
+ function ct(e, t) {
283
284
  if (typeof chrome > "u" || !chrome.runtime) return () => {
284
285
  };
285
286
  const n = (s, r) => {
@@ -287,7 +288,7 @@ function ft(e, t) {
287
288
  };
288
289
  return chrome.runtime.onMessage.addListener(n), () => chrome.runtime.onMessage.removeListener(n);
289
290
  }
290
- function pt(e, t = {}) {
291
+ function lt(e, t = {}) {
291
292
  let n = new WebSocket(e, t.protocols);
292
293
  t.binaryType && (n.binaryType = t.binaryType);
293
294
  let s = 0, r = null;
@@ -304,12 +305,12 @@ function pt(e, t = {}) {
304
305
  socket: n,
305
306
  send: i,
306
307
  listen: (c) => {
307
- const l = (h) => {
308
- if (typeof h.data == "string") try {
309
- c(JSON.parse(h.data));
308
+ const l = (u) => {
309
+ if (typeof u.data == "string") try {
310
+ c(JSON.parse(u.data));
310
311
  } catch {
311
312
  }
312
- else c(h.data);
313
+ else c(u.data);
313
314
  };
314
315
  return n.addEventListener("message", l), () => n.removeEventListener("message", l);
315
316
  },
@@ -317,7 +318,7 @@ function pt(e, t = {}) {
317
318
  close: a
318
319
  };
319
320
  }
320
- function _t(e) {
321
+ function ht(e) {
321
322
  const t = new BroadcastChannel(e);
322
323
  return {
323
324
  channel: t,
@@ -329,132 +330,18 @@ function _t(e) {
329
330
  close: () => t.close()
330
331
  };
331
332
  }
332
- var ir = {
333
- createSender: y,
333
+ var Ks = {
334
+ createSender: g,
334
335
  createListener: m,
335
- detectType: ie,
336
- getMeta: dt,
336
+ detectType: Z,
337
+ getMeta: at,
337
338
  chrome: {
338
- createListener: pn,
339
- createTabsListener: ft
339
+ createListener: cn,
340
+ createTabsListener: ct
340
341
  },
341
- websocket: pt,
342
- broadcast: _t
343
- }, mt = /* @__PURE__ */ Symbol.for("@fix"), A = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, _n = (e, t) => A(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, g = (e, t) => e?.[mt] ?? e ?? t ?? t, mn = (e) => {
344
- if (typeof e == "function" || e == null) return e;
345
- const t = function() {
346
- };
347
- return t[mt] = e, t;
348
- }, gn = (e) => crypto?.getRandomValues ? crypto?.getRandomValues?.(e) : (() => {
349
- const t = new Uint8Array(e.length);
350
- for (let n = 0; n < e.length; n++) t[n] = Math.floor(Math.random() * 256);
351
- return t;
352
- })(), u = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^ gn?.(/* @__PURE__ */ new Uint8Array(1))?.[0] & 15 >> +e / 4).toString(16)), gt = (e) => Array.isArray(e) ? e?.flatMap?.((t) => Array.isArray(t) ? gt(t) : t) : e, Oe = (e) => gt(e)?.every?.(L), L = (e) => A(e) || typeof SharedArrayBuffer == "function" && e instanceof SharedArrayBuffer || yn(e) || Array.isArray(e) && Oe(e), yn = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Re = (e) => A(e) || typeof ArrayBuffer == "function" && e instanceof ArrayBuffer || typeof MessagePort == "function" && e instanceof MessagePort || typeof ReadableStream == "function" && e instanceof ReadableStream || typeof WritableStream == "function" && e instanceof WritableStream || typeof TransformStream == "function" && e instanceof TransformStream || typeof ImageBitmap == "function" && e instanceof ImageBitmap || typeof VideoFrame == "function" && e instanceof VideoFrame || typeof OffscreenCanvas == "function" && e instanceof OffscreenCanvas || typeof RTCDataChannel == "function" && e instanceof RTCDataChannel || typeof AudioData == "function" && e instanceof AudioData || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream || typeof WebTransportSendStream == "function" && e instanceof WebTransportSendStream || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream, B = (e, t, n) => {
353
- if (Array.isArray(e))
354
- return e.every(L) ? e.map(t) : e.map((s, r) => B(s, t, [e, r]));
355
- if (e instanceof Map) {
356
- const s = Array.from(e.entries());
357
- return s.map(([r, i]) => i).every(L) ? new Map(s.map(([r, i]) => [r, t(i, r, e)])) : new Map(s.map(([r, i]) => [r, B(i, t, [e, r])]));
358
- }
359
- if (e instanceof Set) {
360
- const s = Array.from(e.entries()), r = s.map(([i, o]) => o);
361
- return s.every(L) ? new Set(r.map(t)) : new Set(r.map((i) => B(i, t, [e, i])));
362
- }
363
- if (typeof e == "object" && e?.constructor == Object && Object.prototype.toString.call(e) == "[object Object]") {
364
- const s = Array.from(Object.entries(e));
365
- return s.map(([r, i]) => i).every(L) ? Object.fromEntries(s.map(([r, i]) => [r, t(i, r, e)])) : Object.fromEntries(s.map(([r, i]) => [r, B(i, t, [e, r])]));
366
- }
367
- return t(e, n?.[1] ?? "", n?.[0] ?? null);
368
- }, R = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), x = (e, t) => e instanceof Promise || typeof e?.then == "function" ? R?.has?.(e) ? t(R?.get?.(e)) : Promise.try?.(async () => {
369
- const n = await e;
370
- return R?.set?.(e, n), n;
371
- })?.then?.(t) : t(e), bn = class {
372
- #e;
373
- #t;
374
- constructor(e, t) {
375
- this.#e = e, this.#t = t;
376
- }
377
- defineProperty(e, t, n) {
378
- return g(e) instanceof Promise ? Reflect.defineProperty(e, t, n) : x(g(e), (s) => Reflect.defineProperty(s, t, n));
379
- }
380
- deleteProperty(e, t) {
381
- return g(e) instanceof Promise ? Reflect.deleteProperty(e, t) : x(g(e), (n) => Reflect.deleteProperty(n, t));
382
- }
383
- getPrototypeOf(e) {
384
- return g(e) instanceof Promise ? Reflect.getPrototypeOf(e) : x(g(e), (t) => Reflect.getPrototypeOf(t));
385
- }
386
- setPrototypeOf(e, t) {
387
- return g(e) instanceof Promise ? Reflect.setPrototypeOf(e, t) : x(g(e), (n) => Reflect.setPrototypeOf(n, t));
388
- }
389
- isExtensible(e) {
390
- return g(e) instanceof Promise ? Reflect.isExtensible(e) : x(g(e), (t) => Reflect.isExtensible(t));
391
- }
392
- preventExtensions(e) {
393
- return g(e) instanceof Promise ? Reflect.ownKeys(e) : x(g(e), (t) => Reflect.preventExtensions(t));
394
- }
395
- ownKeys(e) {
396
- const t = g(e);
397
- return t instanceof Promise ? Object.keys(t) : x(t, (n) => (typeof n == "object" || typeof n == "function") && n != null ? Object.keys(n) : []) ?? [];
398
- }
399
- getOwnPropertyDescriptor(e, t) {
400
- return g(e) instanceof Promise ? Reflect.getOwnPropertyDescriptor(e, t) : x(g(e), (n) => Reflect.getOwnPropertyDescriptor(n, t));
401
- }
402
- construct(e, t, n) {
403
- return x(g(e), (s) => Reflect.construct(s, t, n));
404
- }
405
- has(e, t) {
406
- return g(e) instanceof Promise ? Reflect.has(e, t) : x(g(e), (n) => Reflect.has(n, t));
407
- }
408
- get(e, t, n) {
409
- if (e = g(e), t == "promise") return e;
410
- if (t == "resolve" && this.#e) return (...r) => {
411
- const i = this.#e?.(...r);
412
- return this.#e = null, i;
413
- };
414
- if (t == "reject" && this.#t) return (...r) => {
415
- const i = this.#t?.(...r);
416
- return this.#t = null, i;
417
- };
418
- if (t == "then" || t == "catch" || t == "finally") {
419
- if (e instanceof Promise) return e?.[t]?.bind?.(e);
420
- {
421
- const r = Promise.try(() => e);
422
- return r?.[t]?.bind?.(r);
423
- }
424
- }
425
- let s;
426
- return R?.has?.(e) && (s = R?.get?.(e))?.[t] != null ? s = R?.get?.(e)?.[t] : s = yt(x(e, async (r) => {
427
- if (g(r) instanceof Promise) return Reflect.get(r, t, n);
428
- if (A(r)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? r : void 0;
429
- let i;
430
- try {
431
- i = Reflect.get(r, t, n);
432
- } catch {
433
- i = e?.[t];
434
- }
435
- return typeof i == "function" ? i?.bind?.(r) : i;
436
- })), t == Symbol.toStringTag ? A(s) ? String(s ?? "") || "" : s?.[Symbol.toStringTag]?.() || String(s ?? "") || "" : t == Symbol.toPrimitive ? (r) => {
437
- if (A(s)) return _n(s, r);
438
- } : s;
439
- }
440
- set(e, t, n) {
441
- return x(g(e), (s) => Reflect.set(s, t, n));
442
- }
443
- apply(e, t, n) {
444
- if (this.#e) {
445
- const s = this.#e?.(...n);
446
- return this.#e = null, s;
447
- }
448
- return x(g(e, this.#e), (s) => {
449
- if (typeof s == "function")
450
- return g(s) instanceof Promise, Reflect.apply(s, t, n);
451
- });
452
- }
453
- };
454
- function yt(e, t, n) {
455
- return e instanceof Promise || typeof e?.then == "function" ? R?.has?.(e) ? R?.get?.(e) : (Ze?.has?.(e) || e?.then?.((s) => R?.set?.(e, s)), Ze?.getOrInsertComputed?.(e, () => new Proxy(mn(e), new bn(t, n)))) : e;
456
- }
457
- var De = class {
342
+ websocket: lt,
343
+ broadcast: ht
344
+ }, Re = class {
458
345
  _unsubscribe;
459
346
  _closed = !1;
460
347
  constructor(e) {
@@ -466,7 +353,7 @@ var De = class {
466
353
  unsubscribe() {
467
354
  this._closed || (this._closed = !0, this._unsubscribe());
468
355
  }
469
- }, C = class {
356
+ }, v = class {
470
357
  _producer;
471
358
  constructor(e) {
472
359
  this._producer = e;
@@ -495,7 +382,7 @@ var De = class {
495
382
  } catch (c) {
496
383
  a.error(c);
497
384
  }
498
- return new De(o);
385
+ return new Re(o);
499
386
  }
500
387
  pipe(...e) {
501
388
  return e.reduce((t, n) => n(t), this);
@@ -530,7 +417,7 @@ var De = class {
530
417
  } catch (s) {
531
418
  t.error?.(s);
532
419
  }
533
- return new De(() => {
420
+ return new Re(() => {
534
421
  this._subs.delete(t);
535
422
  });
536
423
  }
@@ -543,14 +430,14 @@ var De = class {
543
430
  get subscriberCount() {
544
431
  return this._subs.size;
545
432
  }
546
- }, or = class extends _ {
433
+ }, Ys = class extends _ {
547
434
  constructor(e = 1) {
548
435
  super({
549
436
  bufferSize: e,
550
437
  replayOnSubscribe: !0
551
438
  });
552
439
  }
553
- }, wn = class {
440
+ }, ln = class {
554
441
  _transport;
555
442
  _channelName;
556
443
  _send;
@@ -559,19 +446,19 @@ var De = class {
559
446
  _cleanup = null;
560
447
  _listening = !1;
561
448
  constructor(e, t) {
562
- this._transport = e, this._channelName = t, this._send = y(e);
449
+ this._transport = e, this._channelName = t, this._send = g(e);
563
450
  }
564
451
  next(e, t) {
565
452
  this._send(e, t);
566
453
  }
567
454
  subscribe(e) {
568
455
  const t = typeof e == "function" ? { next: e } : e;
569
- return this._subs.add(t), this._listening || this._activate(), new De(() => {
456
+ return this._subs.add(t), this._listening || this._activate(), new Re(() => {
570
457
  this._subs.delete(t), this._subs.size === 0 && this._deactivate();
571
458
  });
572
459
  }
573
460
  request(e) {
574
- const t = e.reqId ?? u();
461
+ const t = e.reqId ?? h();
575
462
  return new Promise((n, s) => {
576
463
  this._pending.set(t, {
577
464
  resolve: n,
@@ -610,9 +497,9 @@ var De = class {
610
497
  return this._listening;
611
498
  }
612
499
  };
613
- function et(e, t, n) {
614
- const s = y(e);
615
- return new C((r) => m(e, (o) => {
500
+ function Ve(e, t, n) {
501
+ const s = g(e);
502
+ return new v((r) => m(e, (o) => {
616
503
  if (!r.active) return;
617
504
  n ? n(o, (c, l) => {
618
505
  s({
@@ -625,17 +512,17 @@ function et(e, t, n) {
625
512
  }, r) : r.next(o);
626
513
  }, (o) => r.error(o), () => r.complete()));
627
514
  }
628
- function vn(e) {
515
+ function hn(e) {
629
516
  return async (t, n, s) => {
630
517
  if (t.type !== "request") {
631
518
  s.next(t);
632
519
  return;
633
520
  }
634
- const r = await Fe(t.payload, t.reqId, e);
521
+ const r = await De(t.payload, t.reqId, e);
635
522
  r && n(r.response, r.transfer), s.next(t);
636
523
  };
637
524
  }
638
- var ar = class extends _ {
525
+ var Js = class extends _ {
639
526
  constructor(e, t) {
640
527
  super(), e.subscribe({
641
528
  next: (n) => {
@@ -645,21 +532,21 @@ var ar = class extends _ {
645
532
  complete: () => this.complete()
646
533
  });
647
534
  }
648
- }, bt = (e) => (t) => new C((n) => {
535
+ }, ut = (e) => (t) => new v((n) => {
649
536
  const s = t.subscribe({
650
537
  next: (r) => e(r) && n.next(r),
651
538
  error: (r) => n.error(r),
652
539
  complete: () => n.complete()
653
540
  });
654
541
  return () => s.unsubscribe();
655
- }), cr = (e) => (t) => new C((n) => {
542
+ }), Xs = (e) => (t) => new v((n) => {
656
543
  const s = t.subscribe({
657
544
  next: (r) => n.next(e(r)),
658
545
  error: (r) => n.error(r),
659
546
  complete: () => n.complete()
660
547
  });
661
548
  return () => s.unsubscribe();
662
- }), lr = (e) => (t) => new C((n) => {
549
+ }), Zs = (e) => (t) => new v((n) => {
663
550
  let s = 0;
664
551
  const r = t.subscribe({
665
552
  next: (i) => {
@@ -669,7 +556,7 @@ var ar = class extends _ {
669
556
  complete: () => n.complete()
670
557
  });
671
558
  return () => r.unsubscribe();
672
- }), ur = (e) => (t) => new C((n) => {
559
+ }), er = (e) => (t) => new v((n) => {
673
560
  const s = t.subscribe({
674
561
  next: (i) => n.next(i),
675
562
  error: (i) => n.error(i),
@@ -678,7 +565,7 @@ var ar = class extends _ {
678
565
  return () => {
679
566
  s.unsubscribe(), r.unsubscribe();
680
567
  };
681
- }), hr = (e) => (t) => new C((n) => {
568
+ }), tr = (e) => (t) => new v((n) => {
682
569
  let s;
683
570
  const r = t.subscribe({
684
571
  next: (i) => {
@@ -690,7 +577,7 @@ var ar = class extends _ {
690
577
  return () => {
691
578
  clearTimeout(s), r.unsubscribe();
692
579
  };
693
- }), dr = (e) => (t) => new C((n) => {
580
+ }), nr = (e) => (t) => new v((n) => {
694
581
  let s = 0;
695
582
  const r = t.subscribe({
696
583
  next: (i) => {
@@ -701,36 +588,36 @@ var ar = class extends _ {
701
588
  complete: () => n.complete()
702
589
  });
703
590
  return () => r.unsubscribe();
704
- }), Cn = (e, t) => new C((n) => {
591
+ }), un = (e, t) => new v((n) => {
705
592
  const s = (r) => n.active && n.next(r);
706
593
  return e.addEventListener(t, s), () => e.removeEventListener(t, s);
707
- }), xn = (e) => new C((t) => {
594
+ }), dn = (e) => new v((t) => {
708
595
  e.then((n) => {
709
596
  t.next(n), t.complete();
710
597
  }).catch((n) => t.error(n));
711
- }), kn = (e, t) => new C((n) => {
598
+ }), fn = (e, t) => new v((n) => {
712
599
  const s = setTimeout(() => {
713
600
  n.next(e), n.complete();
714
601
  }, t);
715
602
  return () => clearTimeout(s);
716
- }), Sn = (e) => new C((t) => {
603
+ }), pn = (e) => new v((t) => {
717
604
  let n = 0;
718
605
  const s = setInterval(() => t.next(n++), e);
719
606
  return () => clearInterval(s);
720
- }), En = (...e) => new C((t) => {
607
+ }), _n = (...e) => new v((t) => {
721
608
  const n = e.map((s) => s.subscribe({
722
609
  next: (r) => t.next(r),
723
610
  error: (r) => t.error(r)
724
611
  }));
725
612
  return () => n.forEach((s) => s.unsubscribe());
726
- }), fr = () => u(), N = (e, t) => (n) => {
727
- const s = y(e), r = (i, o) => s(i, o);
613
+ }), sr = () => h(), M = (e, t) => (n) => {
614
+ const s = g(e), r = (i, o) => s(i, o);
728
615
  return m(e, (i) => {
729
616
  n.active && (t ? t(i, r, n) : n.next(i));
730
617
  }, (i) => n.error(i), () => n.complete());
731
- }, pr = (e, t) => N(e, t), _r = (e, t) => N(e, t), mr = (e, t) => N(new BroadcastChannel(e), t), gr = (e, t, n) => N(new WebSocket(typeof e == "string" ? e : e.href, t), n), yr = (e) => N("chrome-runtime", e), br = (e) => N("service-worker-client", e), wr = (e) => N("service-worker-host", e), vr = (e) => N("self", e);
732
- function In(e, t, n) {
733
- const s = y(e), r = new C((i) => N(e, n)(i));
618
+ }, rr = (e, t) => M(e, t), ir = (e, t) => M(e, t), or = (e, t) => M(new BroadcastChannel(e), t), ar = (e, t, n) => M(new WebSocket(typeof e == "string" ? e : e.href, t), n), cr = (e) => M("chrome-runtime", e), lr = (e) => M("service-worker-client", e), hr = (e) => M("service-worker-host", e), ur = (e) => M("self", e);
619
+ function mn(e, t, n) {
620
+ const s = g(e), r = new v((i) => M(e, n)(i));
734
621
  return {
735
622
  inbound: r,
736
623
  outbound: { next: s },
@@ -738,25 +625,25 @@ function In(e, t, n) {
738
625
  send: (i, o) => s(i, o)
739
626
  };
740
627
  }
741
- function Tn(e, t) {
742
- return new C((n) => {
628
+ function gn(e, t) {
629
+ return new v((n) => {
743
630
  const s = (r) => n.active && n.next(r);
744
631
  return e.addEventListener(t, s), () => e.removeEventListener(t, s);
745
632
  });
746
633
  }
747
- var Cr = {
748
- channel: (e, t) => new wn(e, t),
749
- invoker: (e, t, n) => et(e, t, n),
750
- handler: (e, t) => et(e, t, vn(t)),
751
- bidirectional: In,
752
- fromEvent: Cn,
753
- fromPromise: xn,
754
- delay: kn,
755
- interval: Sn,
756
- merge: En,
757
- when: Tn
634
+ var dr = {
635
+ channel: (e, t) => new ln(e, t),
636
+ invoker: (e, t, n) => Ve(e, t, n),
637
+ handler: (e, t) => Ve(e, t, hn(t)),
638
+ bidirectional: mn,
639
+ fromEvent: un,
640
+ fromPromise: dn,
641
+ delay: fn,
642
+ interval: pn,
643
+ merge: _n,
644
+ when: gn
758
645
  };
759
- function J() {
646
+ function H() {
760
647
  if (typeof globalThis.Deno < "u") return "deno";
761
648
  if (typeof globalThis.process < "u" && globalThis.process?.versions?.node) return "node";
762
649
  const e = globalThis.ServiceWorkerGlobalScope, t = globalThis.SharedWorkerGlobalScope, n = globalThis.DedicatedWorkerGlobalScope;
@@ -772,18 +659,18 @@ function J() {
772
659
  }
773
660
  return typeof globalThis < "u" && typeof document < "u" ? "window" : "unknown";
774
661
  }
775
- function tt(e) {
662
+ function Ke(e) {
776
663
  if (typeof RTCDataChannel < "u" && e instanceof RTCDataChannel) return "rtc-data";
777
- const t = ie(e);
664
+ const t = Z(e);
778
665
  return t && t !== "internal" ? t : e === self || e === globalThis || e === "self" ? "self" : "internal";
779
666
  }
780
- function Pn(e) {
667
+ function bn(e) {
781
668
  if (!e) return "unknown";
782
669
  if (e.contextType) return e.contextType;
783
670
  const t = e.sender ?? "";
784
671
  return t.includes("worker") ? "worker" : t.includes("sw") || t.includes("service") ? "service-worker" : t.includes("chrome") || t.includes("crx") ? "chrome-content" : t.includes("background") ? "chrome-background" : "unknown";
785
672
  }
786
- var Mn = {
673
+ var yn = {
787
674
  get: (e, t) => Reflect.get(e, t),
788
675
  set: (e, t, n) => Reflect.set(e, t, n),
789
676
  has: (e, t) => Reflect.has(e, t),
@@ -796,11 +683,11 @@ var Mn = {
796
683
  setPrototypeOf: (e, t) => Reflect.setPrototypeOf(e, t),
797
684
  isExtensible: (e) => Reflect.isExtensible(e),
798
685
  preventExtensions: (e) => Reflect.preventExtensions(e)
799
- }, wt = class {
686
+ }, dt = class {
800
687
  _channel;
801
688
  _contextType;
802
689
  constructor(e) {
803
- this._contextType = e.autoDetect !== !1 ? J() : "unknown", this._channel = I({
690
+ this._contextType = e.autoDetect !== !1 ? H() : "unknown", this._channel = S({
804
691
  name: e.channel,
805
692
  timeout: e.timeout,
806
693
  autoListen: !1
@@ -839,11 +726,11 @@ var Mn = {
839
726
  close() {
840
727
  this._channel.close();
841
728
  }
842
- }, vt = class {
729
+ }, ft = class {
843
730
  _channel;
844
731
  _contextType;
845
732
  constructor(e) {
846
- this._contextType = e.autoDetect !== !1 ? J() : "unknown", this._channel = I({
733
+ this._contextType = e.autoDetect !== !1 ? H() : "unknown", this._channel = S({
847
734
  name: e.channel,
848
735
  timeout: e.timeout,
849
736
  autoListen: !1
@@ -867,12 +754,12 @@ var Mn = {
867
754
  close() {
868
755
  this._channel.close();
869
756
  }
870
- }, An = class {
757
+ }, wn = class {
871
758
  requestor;
872
759
  responder;
873
760
  _contextType;
874
761
  constructor(e) {
875
- this._contextType = e.autoDetect !== !1 ? J() : "unknown", this.requestor = new wt(e), this.responder = new vt(e);
762
+ this._contextType = e.autoDetect !== !1 ? H() : "unknown", this.requestor = new dt(e), this.responder = new ft(e);
876
763
  }
877
764
  connect(e) {
878
765
  return this.requestor.connect(e), this.responder.listen(e), this;
@@ -893,33 +780,33 @@ var Mn = {
893
780
  this.requestor.close(), this.responder.close();
894
781
  }
895
782
  };
896
- function xr(e, t) {
897
- return new wt({
783
+ function fr(e, t) {
784
+ return new dt({
898
785
  channel: e,
899
786
  ...t
900
787
  });
901
788
  }
902
- function Rn(e, t) {
903
- return new vt({
789
+ function vn(e, t) {
790
+ return new ft({
904
791
  channel: e,
905
792
  ...t
906
793
  });
907
794
  }
908
- function Le(e, t) {
909
- return new An({
795
+ function qe(e, t) {
796
+ return new wn({
910
797
  channel: e,
911
798
  ...t
912
799
  });
913
800
  }
914
- function kr(e, t, n) {
915
- return Le(e, n).connect(t);
801
+ function pr(e, t, n) {
802
+ return qe(e, n).connect(t);
916
803
  }
917
- function Sr(e, t) {
918
- const n = Le(e, {
804
+ function _r(e, t) {
805
+ const n = qe(e, {
919
806
  autoDetect: !0,
920
807
  ...t
921
808
  });
922
- switch (J()) {
809
+ switch (H()) {
923
810
  case "worker":
924
811
  case "service-worker":
925
812
  case "shared-worker":
@@ -929,11 +816,10 @@ function Sr(e, t) {
929
816
  case "chrome-background":
930
817
  case "chrome-popup":
931
818
  n.connect("chrome-runtime");
932
- break;
933
819
  }
934
820
  return n;
935
821
  }
936
- var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbol.for("uniform.proxy.internals"), qn = class {
822
+ var pt = /* @__PURE__ */ Symbol.for("uniform.proxy"), _t = /* @__PURE__ */ Symbol.for("uniform.proxy.internals"), Cn = class {
937
823
  _invoker;
938
824
  _config;
939
825
  _childCache = /* @__PURE__ */ new Map();
@@ -948,10 +834,10 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
948
834
  }
949
835
  get(e, t, n) {
950
836
  const s = String(t);
951
- if (t === Ct) return !0;
952
- if (t === xt) return this._config;
953
- if (t === Hn) return !0;
954
- if (t === Z) return this._getDescriptor();
837
+ if (t === pt) return !0;
838
+ if (t === _t) return this._config;
839
+ if (t === qn) return !0;
840
+ if (t === Q) return this._getDescriptor();
955
841
  if (t === "then" || t === "catch" || t === "finally" || typeof t == "symbol") return;
956
842
  if (t === "$path") return this._config.basePath;
957
843
  if (t === "$channel") return this._config.channel;
@@ -959,7 +845,7 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
959
845
  if (t === "$invoke") return this._invoker;
960
846
  const r = [...this._config.basePath, s];
961
847
  if (this._config.cache && this._childCache.has(s)) return this._childCache.get(s);
962
- const i = oe(this._invoker, {
848
+ const i = ee(this._invoker, {
963
849
  ...this._config,
964
850
  basePath: r
965
851
  });
@@ -1009,7 +895,7 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
1009
895
  primitive: !1
1010
896
  };
1011
897
  }
1012
- }, Er = class {
898
+ }, mr = class {
1013
899
  _dispatch;
1014
900
  constructor(e) {
1015
901
  this._dispatch = e;
@@ -1051,47 +937,47 @@ var Ct = /* @__PURE__ */ Symbol.for("uniform.proxy"), xt = /* @__PURE__ */ Symbo
1051
937
  return this._dispatch(d.CONSTRUCT, e);
1052
938
  }
1053
939
  };
1054
- function oe(e, t) {
940
+ function ee(e, t) {
1055
941
  const n = function() {
1056
- }, s = new qn(e, t);
942
+ }, s = new Cn(e, t);
1057
943
  return new Proxy(n, s);
1058
944
  }
1059
- function kt(e, t, n) {
945
+ function mt(e, t, n) {
1060
946
  if (!e || typeof e != "object" || e.primitive) return e;
1061
- const s = nt.get(e);
947
+ const s = Ye.get(e);
1062
948
  if (s) return s;
1063
- const r = oe(t, {
949
+ const r = ee(t, {
1064
950
  channel: n ?? e.channel ?? "unknown",
1065
951
  basePath: e.path ?? []
1066
952
  });
1067
- return nt.set(e, r), ge.set(r, e), r;
953
+ return Ye.set(e, r), de.set(r, e), r;
1068
954
  }
1069
- function St(e) {
955
+ function gt(e) {
1070
956
  if (!e || typeof e != "object" && typeof e != "function") return !1;
1071
957
  try {
1072
- return Reflect.get(e, Ct) === !0;
958
+ return Reflect.get(e, pt) === !0;
1073
959
  } catch {
1074
960
  return !1;
1075
961
  }
1076
962
  }
1077
- function Ir(e) {
1078
- return St(e) ? e.$descriptor ?? null : null;
963
+ function gr(e) {
964
+ return gt(e) ? e.$descriptor ?? null : null;
1079
965
  }
1080
- function Tr(e) {
1081
- if (!St(e)) return null;
966
+ function br(e) {
967
+ if (!gt(e)) return null;
1082
968
  try {
1083
- const t = Reflect.get(e, xt);
969
+ const t = Reflect.get(e, _t);
1084
970
  return !t || typeof t != "object" ? null : t;
1085
971
  } catch {
1086
972
  return null;
1087
973
  }
1088
974
  }
1089
- function Nn(e, t) {
1090
- return Qn(e, t);
975
+ function xn(e, t) {
976
+ return Ln(e, t);
1091
977
  }
1092
- function On(e, t = []) {
1093
- return oe((s, r, i) => e.request({
1094
- id: u(),
978
+ function kn(e, t = []) {
979
+ return ee((s, r, i) => e.request({
980
+ id: h(),
1095
981
  channel: e.channelName,
1096
982
  sender: e.senderId ?? "proxy",
1097
983
  type: "request",
@@ -1105,7 +991,7 @@ function On(e, t = []) {
1105
991
  basePath: t
1106
992
  });
1107
993
  }
1108
- var Dn = class {
994
+ var Sn = class {
1109
995
  _config = {};
1110
996
  _invoker = null;
1111
997
  channel(e) {
@@ -1126,14 +1012,14 @@ var Dn = class {
1126
1012
  build() {
1127
1013
  if (!this._invoker) throw new Error("Invoker is required. Call .invoker() before .build()");
1128
1014
  if (!this._config.channel) throw new Error("Channel is required. Call .channel() before .build()");
1129
- return oe(this._invoker, this._config);
1015
+ return ee(this._invoker, this._config);
1130
1016
  }
1131
1017
  };
1132
- function Pr() {
1133
- return new Dn();
1018
+ function yr() {
1019
+ return new Sn();
1134
1020
  }
1135
- var Ln = kt;
1136
- function Bn(e) {
1021
+ var En = mt;
1022
+ function In(e) {
1137
1023
  return [
1138
1024
  e.localChannel,
1139
1025
  e.remoteChannel,
@@ -1142,11 +1028,11 @@ function Bn(e) {
1142
1028
  e.direction
1143
1029
  ].join("::");
1144
1030
  }
1145
- function Wn(e, t = {}) {
1031
+ function Tn(e, t = {}) {
1146
1032
  const n = t.includeClosed ?? !1, s = t.status ?? (n ? void 0 : "active");
1147
1033
  return [...e].filter((r) => !(s && r.status !== s || t.channel && r.localChannel !== t.channel && r.remoteChannel !== t.channel || t.localChannel && r.localChannel !== t.localChannel || t.remoteChannel && r.remoteChannel !== t.remoteChannel || t.sender && r.sender !== t.sender || t.transportType && r.transportType !== t.transportType || t.direction && r.direction !== t.direction)).sort((r, i) => i.updatedAt - r.updatedAt);
1148
1034
  }
1149
- var Et = class {
1035
+ var bt = class {
1150
1036
  _createId;
1151
1037
  _emitEvent;
1152
1038
  _connections = /* @__PURE__ */ new Map();
@@ -1154,7 +1040,7 @@ var Et = class {
1154
1040
  this._createId = e, this._emitEvent = t;
1155
1041
  }
1156
1042
  register(e) {
1157
- const t = Bn(e), n = Date.now(), s = this._connections.get(t);
1043
+ const t = In(e), n = Date.now(), s = this._connections.get(t);
1158
1044
  if (s)
1159
1045
  return s.updatedAt = n, s.status = "active", s.metadata = {
1160
1046
  ...s.metadata,
@@ -1206,7 +1092,7 @@ var Et = class {
1206
1092
  }));
1207
1093
  }
1208
1094
  query(e = {}) {
1209
- return Wn(this._connections.values(), e);
1095
+ return Tn(this._connections.values(), e);
1210
1096
  }
1211
1097
  values() {
1212
1098
  return [...this._connections.values()];
@@ -1214,14 +1100,14 @@ var Et = class {
1214
1100
  clear() {
1215
1101
  this._connections.clear();
1216
1102
  }
1217
- }, It = class {
1103
+ }, yt = class {
1218
1104
  _name;
1219
1105
  _contextType;
1220
1106
  _config;
1221
1107
  _transports = /* @__PURE__ */ new Map();
1222
1108
  _defaultTransport = null;
1223
1109
  _connectionEvents = new _({ bufferSize: 200 });
1224
- _connectionRegistry = new Et(() => u(), (e) => this._connectionEvents.next(e));
1110
+ _connectionRegistry = new bt(() => h(), (e) => this._connectionEvents.next(e));
1225
1111
  _pending = /* @__PURE__ */ new Map();
1226
1112
  _subscriptions = [];
1227
1113
  _inbound = new _({ bufferSize: 100 });
@@ -1238,17 +1124,17 @@ var Et = class {
1238
1124
  }
1239
1125
  constructor(e) {
1240
1126
  const t = typeof e == "string" ? { name: e } : e;
1241
- this._name = t.name, this._contextType = t.autoDetect !== !1 ? J() : "unknown", this._config = {
1127
+ this._name = t.name, this._contextType = t.autoDetect !== !1 ? H() : "unknown", this._config = {
1242
1128
  name: t.name,
1243
1129
  autoDetect: t.autoDetect ?? !0,
1244
1130
  timeout: t.timeout ?? 3e4,
1245
- reflect: t.reflect ?? Mn,
1131
+ reflect: t.reflect ?? yn,
1246
1132
  bufferSize: t.bufferSize ?? 100,
1247
1133
  autoListen: t.autoListen ?? !0
1248
1134
  }, this._config.autoListen && this._isWorkerContext() && this.listen(self);
1249
1135
  }
1250
1136
  connect(e, t = {}) {
1251
- const n = tt(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = this._createTransportBinding(e, n, s, t);
1137
+ const n = Ke(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = this._createTransportBinding(e, n, s, t);
1252
1138
  this._transports.set(s, r), this._defaultTransport || (this._defaultTransport = r);
1253
1139
  const i = this._registerConnection({
1254
1140
  localChannel: this._name,
@@ -1265,7 +1151,7 @@ var Et = class {
1265
1151
  }), this;
1266
1152
  }
1267
1153
  listen(e, t = {}) {
1268
- const n = tt(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = (o) => this._handleIncoming(o), i = this._registerConnection({
1154
+ const n = Ke(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = (o) => this._handleIncoming(o), i = this._registerConnection({
1269
1155
  localChannel: this._name,
1270
1156
  remoteChannel: s,
1271
1157
  sender: s,
@@ -1320,7 +1206,7 @@ var Et = class {
1320
1206
  }
1321
1207
  expose(e, t) {
1322
1208
  const n = [e];
1323
- return ye(n, t), this._exposed.set(e, {
1209
+ return fe(n, t), this._exposed.set(e, {
1324
1210
  name: e,
1325
1211
  obj: t,
1326
1212
  path: n
@@ -1334,7 +1220,7 @@ var Et = class {
1334
1220
  return this.invoke(t ?? this._getDefaultTarget(), d.IMPORT, [], [e]);
1335
1221
  }
1336
1222
  invoke(e, t, n, s = []) {
1337
- const r = u(), i = Promise.withResolvers();
1223
+ const r = h(), i = Promise.withResolvers();
1338
1224
  this._pending.set(r, i);
1339
1225
  const o = setTimeout(() => {
1340
1226
  this._pending.has(r) && (this._pending.delete(r), i.reject(/* @__PURE__ */ new Error(`Request timeout: ${t} on ${n.join(".")}`)));
@@ -1374,7 +1260,7 @@ var Et = class {
1374
1260
  return this.proxy(t, [e]);
1375
1261
  }
1376
1262
  wrapDescriptor(e, t) {
1377
- return kt(e, (s, r, i) => {
1263
+ return mt(e, (s, r, i) => {
1378
1264
  const o = t ?? e?.channel ?? this._getDefaultTarget();
1379
1265
  return this.invoke(o, s, r, i);
1380
1266
  }, t ?? e?.channel ?? this._getDefaultTarget());
@@ -1387,7 +1273,7 @@ var Et = class {
1387
1273
  }
1388
1274
  emit(e, t, n) {
1389
1275
  const s = {
1390
- id: u(),
1276
+ id: h(),
1391
1277
  channel: e,
1392
1278
  sender: this._name,
1393
1279
  type: "event",
@@ -1488,7 +1374,6 @@ var Et = class {
1488
1374
  break;
1489
1375
  case "signal":
1490
1376
  this._handleSignal(e);
1491
- break;
1492
1377
  }
1493
1378
  }
1494
1379
  _handleResponse(e) {
@@ -1521,13 +1406,13 @@ var Et = class {
1521
1406
  path: s,
1522
1407
  args: r ?? [],
1523
1408
  timestamp: Date.now(),
1524
- contextType: Pn(e)
1409
+ contextType: bn(e)
1525
1410
  });
1526
1411
  const { result: a, toTransfer: c, newPath: l } = await this._executeAction(n, s, r ?? [], i);
1527
1412
  await this._sendResponse(o, n, i, l, a, c);
1528
1413
  }
1529
1414
  async _executeAction(e, t, n, s) {
1530
- const { result: r, toTransfer: i, path: o } = Dt(e, t, n, {
1415
+ const { result: r, toTransfer: i, path: o } = Pt(e, t, n, {
1531
1416
  channel: this._name,
1532
1417
  sender: s,
1533
1418
  reflect: this._config.reflect
@@ -1539,7 +1424,7 @@ var Et = class {
1539
1424
  };
1540
1425
  }
1541
1426
  async _sendResponse(e, t, n, s, r, i) {
1542
- const { response: o, transfer: a } = await Lt(e, t, this._name, n, s, r, i), c = {
1427
+ const { response: o, transfer: a } = await Mt(e, t, this._name, n, s, r, i), c = {
1543
1428
  id: e,
1544
1429
  ...o,
1545
1430
  timestamp: Date.now(),
@@ -1565,7 +1450,7 @@ var Et = class {
1565
1450
  }
1566
1451
  _emitConnectionSignal(e, t, n = {}) {
1567
1452
  const s = {
1568
- id: u(),
1453
+ id: h(),
1569
1454
  type: "signal",
1570
1455
  channel: e.targetChannel,
1571
1456
  sender: this._name,
@@ -1590,7 +1475,7 @@ var Et = class {
1590
1475
  }
1591
1476
  _sendSignalToTarget(e, t, n, s) {
1592
1477
  const r = {
1593
- id: u(),
1478
+ id: h(),
1594
1479
  type: "signal",
1595
1480
  channel: n.to ?? this._name,
1596
1481
  sender: this._name,
@@ -1738,10 +1623,10 @@ var Et = class {
1738
1623
  return this._defaultTransport ? this._defaultTransport.targetChannel : "worker";
1739
1624
  }
1740
1625
  _inferTargetChannel(e, t) {
1741
- return t === "worker" ? "worker" : t === "broadcast" && e.name ? e.name : t === "self" ? "self" : `${t}-${u().slice(0, 8)}`;
1626
+ return t === "worker" ? "worker" : t === "broadcast" && e.name ? e.name : t === "self" ? "self" : `${t}-${h().slice(0, 8)}`;
1742
1627
  }
1743
1628
  _createProxy(e, t) {
1744
- return oe((s, r, i) => this.invoke(e, s, r, i), {
1629
+ return ee((s, r, i) => this.invoke(e, s, r, i), {
1745
1630
  channel: e,
1746
1631
  basePath: t,
1747
1632
  cache: !0,
@@ -1756,24 +1641,24 @@ var Et = class {
1756
1641
  ].includes(this._contextType);
1757
1642
  }
1758
1643
  };
1759
- function I(e) {
1760
- return new It(e);
1644
+ function S(e) {
1645
+ return new yt(e);
1761
1646
  }
1762
- function Mr(e, t, n) {
1763
- return I({
1647
+ function wr(e, t, n) {
1648
+ return S({
1764
1649
  name: e,
1765
1650
  ...n
1766
1651
  }).attach(t, n);
1767
1652
  }
1768
- function Ar(e, t, n) {
1653
+ function vr(e, t, n) {
1769
1654
  const s = new MessageChannel();
1770
1655
  return s.port1.start(), s.port2.start(), {
1771
- channel1: I({
1656
+ channel1: S({
1772
1657
  name: e,
1773
1658
  autoListen: !1,
1774
1659
  ...n
1775
1660
  }).attach(s.port1, { targetChannel: t }),
1776
- channel2: I({
1661
+ channel2: S({
1777
1662
  name: t,
1778
1663
  autoListen: !1,
1779
1664
  ...n
@@ -1781,47 +1666,47 @@ function Ar(e, t, n) {
1781
1666
  messageChannel: s
1782
1667
  };
1783
1668
  }
1784
- var Q = /* @__PURE__ */ new Map();
1785
- function Rr(e, t) {
1786
- return Q.has(e) || Q.set(e, I({
1669
+ var U = /* @__PURE__ */ new Map();
1670
+ function Cr(e, t) {
1671
+ return U.has(e) || U.set(e, S({
1787
1672
  name: e,
1788
1673
  ...t
1789
- })), Q.get(e);
1674
+ })), U.get(e);
1790
1675
  }
1791
- function qr() {
1792
- return [...Q.keys()];
1676
+ function xr() {
1677
+ return [...U.keys()];
1793
1678
  }
1794
- function Nr(e) {
1795
- const t = Q.get(e);
1796
- return t ? (t.close(), Q.delete(e)) : !1;
1679
+ function kr(e) {
1680
+ const t = U.get(e);
1681
+ return t ? (t.close(), U.delete(e)) : !1;
1797
1682
  }
1798
- var ue = null;
1799
- function ae() {
1800
- if (!ue) {
1801
- const e = J();
1683
+ var re = null;
1684
+ function te() {
1685
+ if (!re) {
1686
+ const e = H();
1802
1687
  [
1803
1688
  "worker",
1804
1689
  "shared-worker",
1805
1690
  "service-worker"
1806
- ].includes(e) ? ue = I({
1691
+ ].includes(e) ? re = S({
1807
1692
  name: "worker",
1808
1693
  autoListen: !0
1809
- }) : ue = I({
1694
+ }) : re = S({
1810
1695
  name: "host",
1811
1696
  autoListen: !1
1812
1697
  });
1813
1698
  }
1814
- return ue;
1699
+ return re;
1815
1700
  }
1816
- function Or(e, t) {
1817
- ae().expose(e, t);
1701
+ function Sr(e, t) {
1702
+ te().expose(e, t);
1818
1703
  }
1819
- function Dr(e, t) {
1820
- return ae().remote(e, t);
1704
+ function Er(e, t) {
1705
+ return te().remote(e, t);
1821
1706
  }
1822
- var Tt = (e, t = null) => ae().proxy(e), Lr = (e, t, n = {}) => Tt(t, null), Br = (e, t, n = {}) => ae().wrapDescriptor(e, e?.channel ?? n?.connectChannel);
1823
- function Wr(e, t) {
1824
- const n = I({
1707
+ var wt = (e, t = null) => te().proxy(e), Ir = (e, t, n = {}) => wt(t, null), Tr = (e, t, n = {}) => te().wrapDescriptor(e, e?.channel ?? n?.connectChannel);
1708
+ function Pr(e, t) {
1709
+ const n = S({
1825
1710
  name: t,
1826
1711
  autoListen: !1
1827
1712
  });
@@ -1833,7 +1718,7 @@ function Wr(e, t) {
1833
1718
  request: (s) => n.invoke(t, d.CALL, [], [s])
1834
1719
  };
1835
1720
  }
1836
- var k = {
1721
+ var C = {
1837
1722
  rjb: "rejectBy",
1838
1723
  rvb: "resolveBy",
1839
1724
  rj: "reject",
@@ -1843,49 +1728,49 @@ var k = {
1843
1728
  a: "array",
1844
1729
  ta: "typedarray",
1845
1730
  udf: "undefined"
1846
- }, $r = [
1847
- typeof ArrayBuffer != k.udf ? ArrayBuffer : null,
1848
- typeof MessagePort != k.udf ? MessagePort : null,
1849
- typeof ReadableStream != k.udf ? ReadableStream : null,
1850
- typeof WritableStream != k.udf ? WritableStream : null,
1851
- typeof TransformStream != k.udf ? TransformStream : null,
1852
- typeof WebTransportReceiveStream != k.udf ? WebTransportReceiveStream : null,
1853
- typeof WebTransportSendStream != k.udf ? WebTransportSendStream : null,
1854
- typeof AudioData != k.udf ? AudioData : null,
1855
- typeof ImageBitmap != k.udf ? ImageBitmap : null,
1856
- typeof VideoFrame != k.udf ? VideoFrame : null,
1857
- typeof OffscreenCanvas != k.udf ? OffscreenCanvas : null,
1858
- typeof RTCDataChannel != k.udf ? RTCDataChannel : null
1859
- ].filter((e) => e != null), Pt = () => {
1731
+ }, Mr = [
1732
+ typeof ArrayBuffer != C.udf ? ArrayBuffer : null,
1733
+ typeof MessagePort != C.udf ? MessagePort : null,
1734
+ typeof ReadableStream != C.udf ? ReadableStream : null,
1735
+ typeof WritableStream != C.udf ? WritableStream : null,
1736
+ typeof TransformStream != C.udf ? TransformStream : null,
1737
+ typeof WebTransportReceiveStream != C.udf ? WebTransportReceiveStream : null,
1738
+ typeof WebTransportSendStream != C.udf ? WebTransportSendStream : null,
1739
+ typeof AudioData != C.udf ? AudioData : null,
1740
+ typeof ImageBitmap != C.udf ? ImageBitmap : null,
1741
+ typeof VideoFrame != C.udf ? VideoFrame : null,
1742
+ typeof OffscreenCanvas != C.udf ? OffscreenCanvas : null,
1743
+ typeof RTCDataChannel != C.udf ? RTCDataChannel : null
1744
+ ].filter((e) => e != null), vt = () => {
1860
1745
  try {
1861
1746
  const e = globalThis?.ServiceWorkerGlobalScope;
1862
1747
  return typeof e < "u" && globalThis instanceof e;
1863
1748
  } catch {
1864
1749
  return !1;
1865
1750
  }
1866
- }, $n = () => {
1751
+ }, Pn = () => {
1867
1752
  try {
1868
1753
  return typeof chrome < "u" && !!chrome?.runtime?.id;
1869
1754
  } catch {
1870
1755
  return !1;
1871
1756
  }
1872
- }, Be = () => {
1873
- if ($n()) return "chrome-extension";
1874
- if (Pt()) return "service-worker";
1757
+ }, Ne = () => {
1758
+ if (Pn()) return "chrome-extension";
1759
+ if (vt()) return "service-worker";
1875
1760
  try {
1876
1761
  if (typeof document < "u") return "main";
1877
1762
  } catch {
1878
1763
  }
1879
1764
  return "unknown";
1880
- }, Fn = () => {
1881
- if (Pt()) return !1;
1765
+ }, Mn = () => {
1766
+ if (vt()) return !1;
1882
1767
  try {
1883
1768
  return typeof Worker < "u";
1884
1769
  } catch {
1885
1770
  return !1;
1886
1771
  }
1887
1772
  };
1888
- function Mt() {
1773
+ function Ct() {
1889
1774
  try {
1890
1775
  const e = globalThis.location?.href;
1891
1776
  if (typeof e == "string" && e.length > 0) return e;
@@ -1897,16 +1782,16 @@ function Mt() {
1897
1782
  }
1898
1783
  return "";
1899
1784
  }
1900
- function q(e) {
1901
- const t = Mt();
1785
+ function P(e) {
1786
+ const t = Ct();
1902
1787
  if (!t.length) throw new TypeError("[uniform] No base URL for worker resolution (missing location / document.baseURI)");
1903
1788
  const n = e.startsWith("/") ? e.replace(/^\//, "./") : e;
1904
1789
  return new URL(n, t).href;
1905
1790
  }
1906
- var ke = /* @__PURE__ */ new Map(), v = {
1791
+ var ye = /* @__PURE__ */ new Map(), w = {
1907
1792
  name: "unknown",
1908
1793
  instance: null
1909
- }, Se = /* @__PURE__ */ new Map(), At = (e) => [...Object.values(d)].includes(e), Fr = (e) => {
1794
+ }, we = /* @__PURE__ */ new Map(), xt = (e) => [...Object.values(d)].includes(e), Ar = (e) => {
1910
1795
  if (e instanceof Worker) return e;
1911
1796
  if (e instanceof URL) return new Worker(e.href, { type: "module" });
1912
1797
  if (typeof e == "function") try {
@@ -1914,117 +1799,113 @@ var ke = /* @__PURE__ */ new Map(), v = {
1914
1799
  } catch {
1915
1800
  return e({ type: "module" });
1916
1801
  }
1917
- return typeof e == "string" ? e.startsWith("/") ? new Worker(q(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(q(e), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([e], { type: "application/javascript" })), { type: "module" }) : e instanceof Blob || e instanceof File ? new Worker(URL.createObjectURL(e), { type: "module" }) : e ?? (typeof self < "u" ? self : null);
1918
- }, Rt = class {
1802
+ return typeof e == "string" ? e.startsWith("/") ? new Worker(P(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(P(e), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([e], { type: "application/javascript" })), { type: "module" }) : e instanceof Blob || e instanceof File ? new Worker(URL.createObjectURL(e), { type: "module" }) : e ?? (typeof self < "u" ? self : null);
1803
+ }, kt = class {
1919
1804
  channelName;
1920
1805
  options;
1921
1806
  _channel;
1922
1807
  constructor(e, t = {}) {
1923
- this.channelName = e, this.options = t, this._channel = ae();
1808
+ this.channelName = e, this.options = t, this._channel = te();
1924
1809
  }
1925
1810
  request(e, t, n, s = {}) {
1926
- return typeof e == "string" && (e = [e]), Array.isArray(t) && At(e) && (s = n, n = t, t = e, e = []), this._channel.invoke(this.channelName, t, e, n);
1811
+ return typeof e == "string" && (e = [e]), Array.isArray(t) && xt(e) && (s = n, n = t, t = e, e = []), this._channel.invoke(this.channelName, t, e, n);
1927
1812
  }
1928
1813
  doImportModule(e, t) {
1929
1814
  return this._channel.import(e, this.channelName);
1930
1815
  }
1931
- }, Un = class {
1816
+ }, An = class {
1932
1817
  channel;
1933
1818
  options;
1934
1819
  _unified;
1935
1820
  broadcasts = {};
1936
1821
  constructor(e, t = {}) {
1937
- this.channel = e, this.options = t, this._unified = I({
1822
+ this.channel = e, this.options = t, this._unified = S({
1938
1823
  name: e,
1939
1824
  autoListen: !1
1940
- }), v.name = e, v.instance = this;
1825
+ }), w.name = e, w.instance = this;
1941
1826
  }
1942
1827
  createRemoteChannel(e, t = {}, n) {
1943
- return n && (this._unified.attach(n, { targetChannel: e }), this.broadcasts[e] = n), Promise.resolve(new Rt(e, t));
1828
+ return n && (this._unified.attach(n, { targetChannel: e }), this.broadcasts[e] = n), Promise.resolve(new kt(e, t));
1944
1829
  }
1945
1830
  getChannel() {
1946
1831
  return this.channel;
1947
1832
  }
1948
1833
  request(e, t, n, s = {}, r = "worker") {
1949
- return typeof e == "string" && (e = [e]), Array.isArray(t) && At(e) && (r = s, s = n, n = t, t = e, e = []), this._unified.invoke(r, t, e, n);
1834
+ return typeof e == "string" && (e = [e]), Array.isArray(t) && xt(e) && (r = s, s = n, n = t, t = e, e = []), this._unified.invoke(r, t, e, n);
1950
1835
  }
1951
1836
  resolveResponse(e, t) {
1952
1837
  return Promise.resolve(t);
1953
1838
  }
1954
1839
  async handleAndResponse(e, t, n) {
1955
- const s = await Fe(e, t, this.channel);
1840
+ const s = await De(e, t, this.channel);
1956
1841
  s && n?.(s.response, s.transfer);
1957
1842
  }
1958
1843
  close() {
1959
1844
  this._unified.close();
1960
1845
  }
1961
- }, We = (e = "$host$") => {
1962
- if (v?.instance && e === "$host$") return v.instance;
1963
- if (Se.has(e)) return Se.get(e) ?? null;
1964
- const t = new Un(e);
1965
- return e === "$host$" && (v.name = e, v.instance = t), Se.set(e, t), t;
1966
- }, qt = (e = "$host$") => We(e), X = (e, t = {}, n = typeof self < "u" ? self : null) => {
1967
- const s = qt(e ?? "$host$");
1846
+ }, Oe = (e = "$host$") => {
1847
+ if (w?.instance && e === "$host$") return w.instance;
1848
+ if (we.has(e)) return we.get(e) ?? null;
1849
+ const t = new An(e);
1850
+ return e === "$host$" && (w.name = e, w.instance = t), we.set(e, t), t;
1851
+ }, St = (e = "$host$") => Oe(e), G = (e, t = {}, n = typeof self < "u" ? self : null) => {
1852
+ const s = St(e ?? "$host$");
1968
1853
  return s?.createRemoteChannel?.(e, t, n) ?? s;
1969
- }, Ur = (e, t = {}, n) => {
1854
+ }, Rr = (e, t = {}, n) => {
1970
1855
  if (e == null || n) return;
1971
- if (ke.has(e)) return ke.get(e);
1856
+ if (ye.has(e)) return ye.get(e);
1972
1857
  const s = {
1973
1858
  channel: e,
1974
- instance: v.instance,
1975
- remote: Promise.resolve(new Rt(e, t))
1859
+ instance: w.instance,
1860
+ remote: Promise.resolve(new kt(e, t))
1976
1861
  };
1977
- return ke.set(e, s), s;
1978
- }, me = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), zr = (e, t) => me.get(e)?.[t], zn = (e, t = v?.name, n) => typeof e == "object" && e != null || typeof e == "function" && e != null ? ge.has(e) ? ge.get(e) : me.has(e) ? me.get(e) : Oe(e) || n?.includes?.(e) || t == v?.name ? e : {
1862
+ return ye.set(e, s), s;
1863
+ }, ue = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), qr = (e, t) => ue.get(e)?.[t], Rn = (e, t = w?.name, n) => typeof e == "object" && e != null || typeof e == "function" && e != null ? de.has(e) ? de.get(e) : ue.has(e) ? ue.get(e) : ot(e) || n?.includes?.(e) || t == w?.name ? e : {
1979
1864
  $isDescriptor: !0,
1980
- path: W.get(e) ?? (() => {
1981
- const s = [u()];
1982
- return ye(s, e), s;
1865
+ path: D.get(e) ?? (() => {
1866
+ const s = [h()];
1867
+ return fe(s, e), s;
1983
1868
  })(),
1984
- owner: v?.name,
1869
+ owner: w?.name,
1985
1870
  channel: t,
1986
- primitive: A(e),
1871
+ primitive: Ae(e),
1987
1872
  writable: !0,
1988
1873
  enumerable: !0,
1989
1874
  configurable: !0,
1990
1875
  argumentCount: e instanceof Function ? e.length : -1
1991
- } : L(e) ? e : null, Hn = /* @__PURE__ */ Symbol.for("@requestHandler"), Z = /* @__PURE__ */ Symbol.for("@descriptor"), Ee = (e) => L(e) || e?.[Z] ? e : e?.$isDescriptor ? Ln(e, async () => {
1992
- }) : Oe(e) ? e : null, Gn = (e) => typeof e != "function" && typeof e != "object" || e == null ? e : ge.get(e) ?? me.get(e) ?? e, he = (e) => {
1993
- if (typeof e != "object" && typeof e != "function" || e == null || (e = Gn(e), typeof e != "object" && typeof e != "function" || e == null)) return e;
1994
- if (Array.isArray(e)) return e.map(he);
1995
- if (e instanceof Map) return new Map(Array.from(e.entries()).map(([t, n]) => [t, he(n)]));
1996
- if (e instanceof Set) return new Set(Array.from(e.values()).map(he));
1997
- if (typeof e == "object") for (const t of Object.keys(e)) e[t] = he(e[t]);
1876
+ } : Me(e) ? e : null, qn = /* @__PURE__ */ Symbol.for("@requestHandler"), Q = /* @__PURE__ */ Symbol.for("@descriptor"), ve = (e) => Me(e) || e?.[Q] ? e : e?.$isDescriptor ? En(e, async () => {
1877
+ }) : ot(e) ? e : null, Nn = (e) => typeof e != "function" && typeof e != "object" || e == null ? e : de.get(e) ?? ue.get(e) ?? e, ie = (e) => {
1878
+ if (typeof e != "object" && typeof e != "function" || e == null || (e = Nn(e), typeof e != "object" && typeof e != "function" || e == null)) return e;
1879
+ if (Array.isArray(e)) return e.map(ie);
1880
+ if (e instanceof Map) return new Map(Array.from(e.entries()).map(([t, n]) => [t, ie(n)]));
1881
+ if (e instanceof Set) return new Set(Array.from(e.values()).map(ie));
1882
+ if (typeof e == "object") for (const t of Object.keys(e)) e[t] = ie(e[t]);
1998
1883
  return e;
1999
- }, re = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new WeakMap(), $e = (e, t) => {
1884
+ }, X = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new WeakMap(), Et = (e, t) => {
2000
1885
  if (t != null && !Array.isArray(t) && (t = [t]), t == null || t?.length < 1) return e;
2001
- const n = e?.[Z] ?? (e?.$isDescriptor ? e : null);
2002
- if (n && n?.owner == v?.name && (e = z(n?.path) ?? e), A(e)) return e;
1886
+ const n = e?.[Q] ?? (e?.$isDescriptor ? e : null);
1887
+ if (n && n?.owner == w?.name && (e = L(n?.path) ?? e), Ae(e)) return e;
2003
1888
  for (const s of t)
2004
1889
  if (e = e?.[s], e == null) return e;
2005
1890
  return e;
2006
- }, z = (e) => {
1891
+ }, L = (e) => {
2007
1892
  if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
2008
- const t = re?.get?.(e?.[0]) ?? null;
2009
- return t != null ? $e(t, e?.slice?.(1)) : null;
2010
- }, ye = (e, t) => {
2011
- const n = t?.[Z] ?? (t?.$isDescriptor ? t : null);
2012
- if (n && n?.owner == v?.name && (t = z(n?.path) ?? t), e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
2013
- const s = re?.get?.(e?.[0]) ?? null;
2014
- return e?.length > 1 ? $e(s, e?.slice?.(1, -1))[e?.[e?.length - 1]] = t : re?.set?.(e?.[0], t), (typeof t == "object" || typeof t == "function") && W?.set?.(t, e), t;
2015
- }, Nt = (e) => {
2016
- if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return !1;
2017
- const t = re?.get?.(e?.[0]) ?? null;
2018
- return !t && e?.length <= 1 ? (re?.delete?.(e?.[0]), !0) : !1;
2019
- }, jn = (e) => {
2020
- const t = e?.[Z] ?? (e?.$isDescriptor ? e : null);
2021
- t && t?.owner == v?.name && (e = z(t?.path) ?? e);
2022
- const n = W?.get?.(e) ?? t?.path;
2023
- return n == null || n?.length < 1 ? !1 : (Nt(n), (typeof e == "object" || typeof e == "function") && W?.delete?.(e), !0);
2024
- }, Vn = (e) => {
2025
- const t = e?.[Z] ?? (e?.$isDescriptor ? e : null);
2026
- return (W?.get?.(e) ?? t?.path) == null;
2027
- }, D = (e) => (typeof e == "object" || typeof e == "function") && e != null, Ot = {
1893
+ const t = X?.get?.(e?.[0]) ?? null;
1894
+ return t != null ? Et(t, e?.slice?.(1)) : null;
1895
+ }, fe = (e, t) => {
1896
+ const n = t?.[Q] ?? (t?.$isDescriptor ? t : null);
1897
+ if (n && n?.owner == w?.name && (t = L(n?.path) ?? t), e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
1898
+ const s = X?.get?.(e?.[0]) ?? null;
1899
+ return e?.length > 1 ? Et(s, e?.slice?.(1, -1))[e?.[e?.length - 1]] = t : X?.set?.(e?.[0], t), (typeof t == "object" || typeof t == "function") && D?.set?.(t, e), t;
1900
+ }, It = (e) => (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1 ? !1 : !(X?.get?.(e?.[0]) ?? null) && e?.length <= 1 ? (X?.delete?.(e?.[0]), !0) : !1), On = (e) => {
1901
+ const t = e?.[Q] ?? (e?.$isDescriptor ? e : null);
1902
+ t && t?.owner == w?.name && (e = L(t?.path) ?? e);
1903
+ const n = D?.get?.(e) ?? t?.path;
1904
+ return n == null || n?.length < 1 ? !1 : (It(n), (typeof e == "object" || typeof e == "function") && D?.delete?.(e), !0);
1905
+ }, Dn = (e) => {
1906
+ const t = e?.[Q] ?? (e?.$isDescriptor ? e : null);
1907
+ return (D?.get?.(e) ?? t?.path) == null;
1908
+ }, R = (e) => (typeof e == "object" || typeof e == "function") && e != null, Tt = {
2028
1909
  get: (e, t) => e?.[t],
2029
1910
  set: (e, t, n) => (e[t] = n, !0),
2030
1911
  has: (e, t) => t in e,
@@ -2038,9 +1919,9 @@ var ke = /* @__PURE__ */ new Map(), v = {
2038
1919
  isExtensible: (e) => Object.isExtensible(e),
2039
1920
  preventExtensions: (e) => Object.preventExtensions(e)
2040
1921
  };
2041
- function Dt(e, t, n, s = {}) {
2042
- const { channel: r = "", sender: i = "", reflect: o = Ot } = s, a = s.target ?? z(t), c = [];
2043
- let l = null, h = t;
1922
+ function Pt(e, t, n, s = {}) {
1923
+ const { channel: r = "", sender: i = "", reflect: o = Tt } = s, a = s.target ?? L(t), c = [];
1924
+ let l = null, u = t;
2044
1925
  switch (String(e).toLowerCase()) {
2045
1926
  case "import":
2046
1927
  case d.IMPORT:
@@ -2051,18 +1932,18 @@ function Dt(e, t, n, s = {}) {
2051
1932
  break;
2052
1933
  case "transfer":
2053
1934
  case d.TRANSFER:
2054
- Re(a) && r !== i && c.push(a), l = a;
1935
+ Ie(a) && r !== i && c.push(a), l = a;
2055
1936
  break;
2056
1937
  case "get":
2057
1938
  case d.GET: {
2058
- const p = n?.[0], w = o.get?.(a, p) ?? a?.[p];
2059
- l = typeof w == "function" && a != null ? w.bind(a) : w, h = [...t, String(p)];
1939
+ const p = n?.[0], y = o.get?.(a, p) ?? a?.[p];
1940
+ l = typeof y == "function" && a != null ? y.bind(a) : y, u = [...t, String(p)];
2060
1941
  break;
2061
1942
  }
2062
1943
  case "set":
2063
1944
  case d.SET: {
2064
- const [p, w] = n, S = B(w, Ee);
2065
- s.target ? l = o.set?.(a, p, S) ?? (a[p] = S, !0) : l = o.set?.(a, p, S) ?? ye([...t, String(p)], S);
1945
+ const [p, y] = n, x = he(y, ve);
1946
+ s.target ? l = o.set?.(a, p, x) ?? (a[p] = x, !0) : l = o.set?.(a, p, x) ?? fe([...t, String(p)], x);
2066
1947
  break;
2067
1948
  }
2068
1949
  case "apply":
@@ -2070,14 +1951,14 @@ function Dt(e, t, n, s = {}) {
2070
1951
  case d.APPLY:
2071
1952
  case d.CALL:
2072
1953
  if (typeof a == "function") {
2073
- const p = s.context ?? (s.target ? void 0 : z(t.slice(0, -1))), w = B(n?.[0] ?? n ?? [], Ee);
2074
- l = o.apply?.(a, p, w) ?? a.apply(p, w), Re(l) && t?.at(-1) === "transfer" && r !== i && c.push(l);
1954
+ const p = s.context ?? (s.target ? void 0 : L(t.slice(0, -1))), y = he(n?.[0] ?? n ?? [], ve);
1955
+ l = o.apply?.(a, p, y) ?? a.apply(p, y), Ie(l) && t?.at(-1) === "transfer" && r !== i && c.push(l);
2075
1956
  }
2076
1957
  break;
2077
1958
  case "construct":
2078
1959
  case d.CONSTRUCT:
2079
1960
  if (typeof a == "function") {
2080
- const p = B(n?.[0] ?? n ?? [], Ee);
1961
+ const p = he(n?.[0] ?? n ?? [], ve);
2081
1962
  l = o.construct?.(a, p) ?? new a(...p);
2082
1963
  }
2083
1964
  break;
@@ -2091,50 +1972,49 @@ function Dt(e, t, n, s = {}) {
2091
1972
  const p = t[t.length - 1];
2092
1973
  l = o.deleteProperty?.(a, p) ?? delete a[p];
2093
1974
  } else
2094
- l = t?.length > 0 ? Nt(t) : jn(a), l && (h = W.get(a) ?? []);
1975
+ l = t?.length > 0 ? It(t) : On(a), l && (u = D.get(a) ?? []);
2095
1976
  break;
2096
1977
  case "has":
2097
1978
  case d.HAS:
2098
- l = o.has?.(a, n?.[0]) ?? (D(a) ? n?.[0] in a : !1);
1979
+ l = o.has?.(a, n?.[0]) ?? (R(a) ? n?.[0] in a : !1);
2099
1980
  break;
2100
1981
  case "ownkeys":
2101
1982
  case d.OWN_KEYS:
2102
- l = o.ownKeys?.(a) ?? (D(a) ? Object.keys(a) : []);
1983
+ l = o.ownKeys?.(a) ?? (R(a) ? Object.keys(a) : []);
2103
1984
  break;
2104
1985
  case "getownpropertydescriptor":
2105
1986
  case "getpropertydescriptor":
2106
1987
  case d.GET_OWN_PROPERTY_DESCRIPTOR:
2107
1988
  case d.GET_PROPERTY_DESCRIPTOR:
2108
- l = o.getOwnPropertyDescriptor?.(a, n?.[0] ?? t?.at(-1) ?? "") ?? (D(a) ? Object.getOwnPropertyDescriptor(a, n?.[0] ?? t?.at(-1) ?? "") : void 0);
1989
+ l = o.getOwnPropertyDescriptor?.(a, n?.[0] ?? t?.at(-1) ?? "") ?? (R(a) ? Object.getOwnPropertyDescriptor(a, n?.[0] ?? t?.at(-1) ?? "") : void 0);
2109
1990
  break;
2110
1991
  case "getprototypeof":
2111
1992
  case d.GET_PROTOTYPE_OF:
2112
- l = o.getPrototypeOf?.(a) ?? (D(a) ? Object.getPrototypeOf(a) : null);
1993
+ l = o.getPrototypeOf?.(a) ?? (R(a) ? Object.getPrototypeOf(a) : null);
2113
1994
  break;
2114
1995
  case "setprototypeof":
2115
1996
  case d.SET_PROTOTYPE_OF:
2116
- l = o.setPrototypeOf?.(a, n?.[0]) ?? (D(a) ? Object.setPrototypeOf(a, n?.[0]) : !1);
1997
+ l = o.setPrototypeOf?.(a, n?.[0]) ?? (R(a) ? Object.setPrototypeOf(a, n?.[0]) : !1);
2117
1998
  break;
2118
1999
  case "isextensible":
2119
2000
  case d.IS_EXTENSIBLE:
2120
- l = o.isExtensible?.(a) ?? (D(a) ? Object.isExtensible(a) : !0);
2001
+ l = o.isExtensible?.(a) ?? (R(a) ? Object.isExtensible(a) : !0);
2121
2002
  break;
2122
2003
  case "preventextensions":
2123
2004
  case d.PREVENT_EXTENSIONS:
2124
- l = o.preventExtensions?.(a) ?? (D(a) ? Object.preventExtensions(a) : !1);
2125
- break;
2005
+ l = o.preventExtensions?.(a) ?? (R(a) ? Object.preventExtensions(a) : !1);
2126
2006
  }
2127
2007
  return {
2128
2008
  result: l,
2129
2009
  toTransfer: c,
2130
- path: h
2010
+ path: u
2131
2011
  };
2132
2012
  }
2133
- async function Lt(e, t, n, s, r, i, o) {
2134
- const a = await i, c = Re(a) && o.includes(a) || L(a);
2013
+ async function Mt(e, t, n, s, r, i, o) {
2014
+ const a = await i, c = Ie(a) && o.includes(a) || Me(a);
2135
2015
  let l = r;
2136
- !c && t !== "get" && t !== d.GET && (typeof a == "object" || typeof a == "function") && (Vn(a) ? (l = [u()], ye(l, a)) : l = W.get(a) ?? []);
2137
- const h = z(l), p = t === "get" || t === d.GET ? l?.at(-1) : void 0, w = z(r), S = B(a, (hn) => zn(hn, n, o)) ?? a;
2016
+ !c && t !== "get" && t !== d.GET && (typeof a == "object" || typeof a == "function") && (Dn(a) ? (l = [h()], fe(l, a)) : l = D.get(a) ?? []);
2017
+ const u = L(l), p = t === "get" || t === d.GET ? l?.at(-1) : void 0, y = L(r), x = he(a, (sn) => Rn(sn, n, o)) ?? a;
2138
2018
  return {
2139
2019
  response: {
2140
2020
  channel: s,
@@ -2143,7 +2023,7 @@ async function Lt(e, t, n, s, r, i, o) {
2143
2023
  action: t,
2144
2024
  type: "response",
2145
2025
  payload: {
2146
- result: c ? S : null,
2026
+ result: c ? x : null,
2147
2027
  type: typeof a,
2148
2028
  channel: s,
2149
2029
  sender: n,
@@ -2152,29 +2032,29 @@ async function Lt(e, t, n, s, r, i, o) {
2152
2032
  path: l,
2153
2033
  owner: n,
2154
2034
  channel: n,
2155
- primitive: A(a),
2035
+ primitive: Ae(a),
2156
2036
  writable: !0,
2157
2037
  enumerable: !0,
2158
2038
  configurable: !0,
2159
- argumentCount: w instanceof Function ? w.length : -1,
2160
- ...D(h) && p != null ? Object.getOwnPropertyDescriptor(h, p) : {}
2039
+ argumentCount: y instanceof Function ? y.length : -1,
2040
+ ...R(u) && p != null ? Object.getOwnPropertyDescriptor(u, p) : {}
2161
2041
  }
2162
2042
  }
2163
2043
  },
2164
2044
  transfer: o
2165
2045
  };
2166
2046
  }
2167
- async function Fe(e, t, n, s) {
2047
+ async function De(e, t, n, s) {
2168
2048
  const { channel: r, sender: i, path: o, action: a, args: c } = e;
2169
2049
  if (r !== n) return null;
2170
- const { result: l, toTransfer: h, path: p } = Dt(a, o, c, {
2050
+ const { result: l, toTransfer: u, path: p } = Pt(a, o, c, {
2171
2051
  channel: r,
2172
2052
  sender: i,
2173
2053
  ...s
2174
2054
  });
2175
- return Lt(t, a, n, i, p, l, h);
2055
+ return Mt(t, a, n, i, p, l, u);
2176
2056
  }
2177
- function Qn(e, t = Ot) {
2057
+ function Ln(e, t = Tt) {
2178
2058
  return async (n, s, r) => {
2179
2059
  let i = e, o = e;
2180
2060
  for (let c = 0; c < s.length; c++)
@@ -2218,10 +2098,10 @@ function Qn(e, t = Ot) {
2218
2098
  }
2219
2099
  };
2220
2100
  }
2221
- var Kn = class {
2101
+ var Bn = class {
2222
2102
  _name;
2223
2103
  _transportType;
2224
- _id = u();
2104
+ _id = h();
2225
2105
  _state = "disconnected";
2226
2106
  _inbound = new _({ bufferSize: 1e3 });
2227
2107
  _outbound = new _({ bufferSize: 1e3 });
@@ -2253,7 +2133,7 @@ var Kn = class {
2253
2133
  }, this._setupSubscriptions();
2254
2134
  }
2255
2135
  subscribe(e, t) {
2256
- return (t ? bt((n) => n.sender === t)(this._inbound) : this._inbound).subscribe(typeof e == "function" ? { next: e } : e);
2136
+ return (t ? ut((n) => n.sender === t)(this._inbound) : this._inbound).subscribe(typeof e == "function" ? { next: e } : e);
2257
2137
  }
2258
2138
  next(e) {
2259
2139
  if (this._state !== "connected") {
@@ -2263,13 +2143,13 @@ var Kn = class {
2263
2143
  this._outbound.next(e), this._stats.messagesSent++;
2264
2144
  }
2265
2145
  async request(e, t, n = {}) {
2266
- const s = u(), r = Promise.withResolvers();
2146
+ const s = h(), r = Promise.withResolvers();
2267
2147
  this._pending.set(s, r);
2268
2148
  const i = setTimeout(() => {
2269
2149
  this._pending.has(s) && (this._pending.delete(s), r.reject(/* @__PURE__ */ new Error("Request timeout")));
2270
2150
  }, n.timeout ?? this._opts.timeout);
2271
2151
  return this.next({
2272
- id: u(),
2152
+ id: h(),
2273
2153
  channel: e,
2274
2154
  sender: this._name,
2275
2155
  type: "request",
@@ -2284,7 +2164,7 @@ var Kn = class {
2284
2164
  }
2285
2165
  respond(e, t) {
2286
2166
  this.next({
2287
- id: u(),
2167
+ id: h(),
2288
2168
  channel: e.sender,
2289
2169
  sender: this._name,
2290
2170
  type: "response",
@@ -2295,7 +2175,7 @@ var Kn = class {
2295
2175
  }
2296
2176
  emit(e, t, n) {
2297
2177
  this.next({
2298
- id: u(),
2178
+ id: h(),
2299
2179
  channel: e,
2300
2180
  sender: this._name,
2301
2181
  type: "event",
@@ -2383,14 +2263,14 @@ var Kn = class {
2383
2263
  connectedChannels: new Set(this._connectedPeers.keys())
2384
2264
  };
2385
2265
  }
2386
- }, Yn = class ne {
2266
+ }, Wn = class Y {
2387
2267
  _connections = /* @__PURE__ */ new Map();
2388
2268
  static _instance = null;
2389
2269
  static getInstance() {
2390
- return ne._instance || (ne._instance = new ne()), ne._instance;
2270
+ return Y._instance || (Y._instance = new Y()), Y._instance;
2391
2271
  }
2392
2272
  getOrCreate(t, n = "internal", s = {}) {
2393
- return this._connections.has(t) || this._connections.set(t, new Kn(t, n, s)), this._connections.get(t);
2273
+ return this._connections.has(t) || this._connections.set(t, new Bn(t, n, s)), this._connections.get(t);
2394
2274
  }
2395
2275
  get(t) {
2396
2276
  return this._connections.get(t);
@@ -2410,13 +2290,13 @@ var Kn = class {
2410
2290
  get names() {
2411
2291
  return [...this._connections.keys()];
2412
2292
  }
2413
- }, Ue = () => Yn.getInstance(), Bt = (e, t, n) => Ue().getOrCreate(e, t, n), Hr = (e = "$host$", t) => Bt(e, "internal", {
2293
+ }, Le = () => Wn.getInstance(), At = (e, t, n) => Le().getOrCreate(e, t, n), Nr = (e = "$host$", t) => At(e, "internal", {
2414
2294
  ...t,
2415
2295
  metadata: {
2416
2296
  ...t?.metadata,
2417
2297
  isHost: !0
2418
2298
  }
2419
- }), T = class {
2299
+ }), E = class {
2420
2300
  _channelName;
2421
2301
  _transportType;
2422
2302
  _options;
@@ -2468,7 +2348,7 @@ var Kn = class {
2468
2348
  get outbound() {
2469
2349
  return this._outbound;
2470
2350
  }
2471
- }, Jn = class extends T {
2351
+ }, $n = class extends E {
2472
2352
  _workerSource;
2473
2353
  _worker = null;
2474
2354
  _cleanup = null;
@@ -2479,7 +2359,7 @@ var Kn = class {
2479
2359
  attach() {
2480
2360
  if (this._isAttached) return;
2481
2361
  this._worker = this._resolveWorker();
2482
- const e = y(this._worker);
2362
+ const e = g(this._worker);
2483
2363
  this._cleanup = m(this._worker, (t) => this._handleIncoming(t), (t) => this._inbound.error(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
2484
2364
  }
2485
2365
  detach() {
@@ -2493,7 +2373,7 @@ var Kn = class {
2493
2373
  sender: t,
2494
2374
  options: n,
2495
2375
  messagePort: s,
2496
- reqId: u()
2376
+ reqId: h()
2497
2377
  }, { transfer: r });
2498
2378
  }
2499
2379
  connectChannel(e, t, n, s) {
@@ -2504,12 +2384,12 @@ var Kn = class {
2504
2384
  sender: t,
2505
2385
  port: n,
2506
2386
  options: s,
2507
- reqId: u()
2387
+ reqId: h()
2508
2388
  }, { transfer: r });
2509
2389
  }
2510
2390
  listChannels() {
2511
2391
  return new Promise((e) => {
2512
- const t = u(), n = (r) => {
2392
+ const t = h(), n = (r) => {
2513
2393
  const i = r;
2514
2394
  i.type === "channelList" && i.reqId === t && (s.unsubscribe(), e(i.channels ?? []));
2515
2395
  }, s = this._inbound.subscribe(n);
@@ -2523,7 +2403,7 @@ var Kn = class {
2523
2403
  }
2524
2404
  _handleIncoming(e) {
2525
2405
  (e?.type === "channelCreated" || e?.type === "channelConnected") && this._emitIncomingConnection({
2526
- id: e.reqId ?? u(),
2406
+ id: e.reqId ?? h(),
2527
2407
  channel: e.channel,
2528
2408
  sender: e.sender ?? "worker",
2529
2409
  transportType: "worker",
@@ -2536,13 +2416,13 @@ var Kn = class {
2536
2416
  if (this._ownWorker = !0, typeof this._workerSource == "function") return this._workerSource();
2537
2417
  if (this._workerSource instanceof URL) return new Worker(this._workerSource.href, { type: "module" });
2538
2418
  if (typeof this._workerSource == "string")
2539
- return this._workerSource.startsWith("/") ? new Worker(q(this._workerSource.replace(/^\//, "./")), { type: "module" }) : URL.canParse(this._workerSource) || this._workerSource.startsWith("./") ? new Worker(q(this._workerSource), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([this._workerSource], { type: "application/javascript" })), { type: "module" });
2419
+ return this._workerSource.startsWith("/") ? new Worker(P(this._workerSource.replace(/^\//, "./")), { type: "module" }) : URL.canParse(this._workerSource) || this._workerSource.startsWith("./") ? new Worker(P(this._workerSource), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([this._workerSource], { type: "application/javascript" })), { type: "module" });
2540
2420
  throw new Error("Invalid worker source");
2541
2421
  }
2542
2422
  get worker() {
2543
2423
  return this._worker;
2544
2424
  }
2545
- }, Xn = class extends T {
2425
+ }, Fn = class extends E {
2546
2426
  _port;
2547
2427
  _cleanup = null;
2548
2428
  constructor(e, t, n = {}) {
@@ -2550,7 +2430,7 @@ var Kn = class {
2550
2430
  }
2551
2431
  attach() {
2552
2432
  if (this._isAttached) return;
2553
- const e = y(this._port);
2433
+ const e = g(this._port);
2554
2434
  this._cleanup = m(this._port, (t) => this._inbound.next(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
2555
2435
  }
2556
2436
  detach() {
@@ -2559,7 +2439,7 @@ var Kn = class {
2559
2439
  get port() {
2560
2440
  return this._port;
2561
2441
  }
2562
- }, Zn = class extends T {
2442
+ }, Un = class extends E {
2563
2443
  _bcName;
2564
2444
  _channel = null;
2565
2445
  _cleanup = null;
@@ -2570,7 +2450,7 @@ var Kn = class {
2570
2450
  attach() {
2571
2451
  if (this._isAttached) return;
2572
2452
  this._channel = new BroadcastChannel(this._bcName ?? this._channelName);
2573
- const e = y(this._channel);
2453
+ const e = g(this._channel);
2574
2454
  this._cleanup = m(this._channel, (t) => {
2575
2455
  t?.sender !== this._channelName && this._handleIncoming(t);
2576
2456
  }), this._subscriptions.push(this._outbound.subscribe((t) => e(t))), this._isAttached = !0, this._announcePresence();
@@ -2579,7 +2459,7 @@ var Kn = class {
2579
2459
  if (e?.type === "announce" || e?.type === "connect") {
2580
2460
  const t = e.sender ?? "unknown", n = !this._connectedPeers.has(t);
2581
2461
  this._connectedPeers.add(t), n && (this._emitIncomingConnection({
2582
- id: e.reqId ?? u(),
2462
+ id: e.reqId ?? h(),
2583
2463
  channel: e.channel ?? this._channelName,
2584
2464
  sender: t,
2585
2465
  transportType: "broadcast",
@@ -2607,7 +2487,7 @@ var Kn = class {
2607
2487
  detach() {
2608
2488
  this._cleanup?.(), this._channel?.close(), this._channel = null, this._connectedPeers.clear(), super.detach();
2609
2489
  }
2610
- }, es = class extends T {
2490
+ }, jn = class extends E {
2611
2491
  _url;
2612
2492
  _protocols;
2613
2493
  _ws = null;
@@ -2630,7 +2510,7 @@ var Kn = class {
2630
2510
  };
2631
2511
  this._ws.addEventListener("open", () => {
2632
2512
  this._state.next("open"), this._pending.forEach((n) => t(n)), this._pending = [], this._emitIncomingConnection({
2633
- id: u(),
2513
+ id: h(),
2634
2514
  channel: this._channelName,
2635
2515
  sender: "server",
2636
2516
  transportType: "websocket",
@@ -2644,7 +2524,7 @@ var Kn = class {
2644
2524
  if (e?.type === "channel-connect" || e?.type === "peer-connect" || e?.type === "join") {
2645
2525
  const t = e.channel ?? e.room ?? this._channelName;
2646
2526
  this._connectedChannels.has(t) || (this._connectedChannels.add(t), this._emitIncomingConnection({
2647
- id: e.id ?? u(),
2527
+ id: e.id ?? h(),
2648
2528
  channel: t,
2649
2529
  sender: e.sender ?? e.peerId ?? "remote",
2650
2530
  transportType: "websocket",
@@ -2656,7 +2536,7 @@ var Kn = class {
2656
2536
  }
2657
2537
  joinChannel(e) {
2658
2538
  this.send({
2659
- id: u(),
2539
+ id: h(),
2660
2540
  type: "join",
2661
2541
  channel: e,
2662
2542
  sender: this._channelName,
@@ -2665,7 +2545,7 @@ var Kn = class {
2665
2545
  }
2666
2546
  leaveChannel(e) {
2667
2547
  this._connectedChannels.delete(e), this.send({
2668
- id: u(),
2548
+ id: h(),
2669
2549
  type: "leave",
2670
2550
  channel: e,
2671
2551
  sender: this._channelName,
@@ -2684,20 +2564,20 @@ var Kn = class {
2684
2564
  get state() {
2685
2565
  return this._state;
2686
2566
  }
2687
- }, ts = class extends T {
2567
+ }, zn = class extends E {
2688
2568
  _cleanup = null;
2689
2569
  constructor(e, t = {}) {
2690
2570
  super(e, "chrome-runtime", t);
2691
2571
  }
2692
2572
  attach() {
2693
2573
  if (this._isAttached || typeof chrome > "u" || !chrome.runtime) return;
2694
- const e = y("chrome-runtime");
2574
+ const e = g("chrome-runtime");
2695
2575
  this._cleanup = m("chrome-runtime", (t) => this._inbound.next(t), void 0), this._subscriptions.push(this._outbound.subscribe((t) => e(t))), this._isAttached = !0;
2696
2576
  }
2697
2577
  detach() {
2698
2578
  this._cleanup?.(), super.detach();
2699
2579
  }
2700
- }, ns = class extends T {
2580
+ }, Hn = class extends E {
2701
2581
  _tabId;
2702
2582
  _cleanup = null;
2703
2583
  constructor(e, t, n = {}) {
@@ -2719,7 +2599,7 @@ var Kn = class {
2719
2599
  setTabId(e) {
2720
2600
  this._tabId = e;
2721
2601
  }
2722
- }, ss = class extends T {
2602
+ }, Gn = class extends E {
2723
2603
  _portName;
2724
2604
  _tabId;
2725
2605
  _cleanup = null;
@@ -2746,7 +2626,7 @@ var Kn = class {
2746
2626
  detach() {
2747
2627
  this._cleanup?.(), super.detach();
2748
2628
  }
2749
- }, rs = class extends T {
2629
+ }, Qn = class extends E {
2750
2630
  _externalId;
2751
2631
  _cleanup = null;
2752
2632
  constructor(e, t, n = {}) {
@@ -2760,7 +2640,7 @@ var Kn = class {
2760
2640
  detach() {
2761
2641
  this._cleanup?.(), super.detach();
2762
2642
  }
2763
- }, is = class extends T {
2643
+ }, Vn = class extends E {
2764
2644
  _isHost;
2765
2645
  _cleanup = null;
2766
2646
  constructor(e, t = !1, n = {}) {
@@ -2768,25 +2648,25 @@ var Kn = class {
2768
2648
  }
2769
2649
  attach() {
2770
2650
  if (this._isAttached) return;
2771
- const e = this._isHost ? "service-worker-host" : "service-worker-client", t = y(e);
2651
+ const e = this._isHost ? "service-worker-host" : "service-worker-client", t = g(e);
2772
2652
  this._cleanup = m(e, (n) => this._inbound.next(n)), this._subscriptions.push(this._outbound.subscribe((n) => t(n, n.transferable))), this._isAttached = !0;
2773
2653
  }
2774
2654
  detach() {
2775
2655
  this._cleanup?.(), super.detach();
2776
2656
  }
2777
- }, os = class extends T {
2657
+ }, Kn = class extends E {
2778
2658
  _cleanup = null;
2779
2659
  constructor(e, t = {}) {
2780
2660
  super(e, "self", t);
2781
2661
  }
2782
2662
  attach() {
2783
2663
  if (this._isAttached) return;
2784
- const e = y("self");
2664
+ const e = g("self");
2785
2665
  this._cleanup = m("self", (t) => this._handleIncoming(t)), this._subscriptions.push(this._outbound.subscribe((t) => e(t, t.transferable))), this._isAttached = !0;
2786
2666
  }
2787
2667
  _handleIncoming(e) {
2788
2668
  (e?.type === "createChannel" || e?.type === "connectChannel") && this._emitIncomingConnection({
2789
- id: e.reqId ?? u(),
2669
+ id: e.reqId ?? h(),
2790
2670
  channel: e.channel,
2791
2671
  sender: e.sender ?? "unknown",
2792
2672
  transportType: "self",
@@ -2807,19 +2687,19 @@ var Kn = class {
2807
2687
  detach() {
2808
2688
  this._cleanup?.(), super.detach();
2809
2689
  }
2810
- }, Gr = {
2811
- worker: (e, t, n) => new Jn(e, t, n),
2812
- messagePort: (e, t, n) => new Xn(e, t, n),
2813
- broadcast: (e, t, n) => new Zn(e, t, n),
2814
- websocket: (e, t, n, s) => new es(e, t, n, s),
2815
- chromeRuntime: (e, t) => new ts(e, t),
2816
- chromeTabs: (e, t, n) => new ns(e, t, n),
2817
- chromePort: (e, t, n, s) => new ss(e, t, n, s),
2818
- chromeExternal: (e, t, n) => new rs(e, t, n),
2819
- serviceWorker: (e, t, n) => new is(e, t, n),
2820
- self: (e, t) => new os(e, t)
2690
+ }, Or = {
2691
+ worker: (e, t, n) => new $n(e, t, n),
2692
+ messagePort: (e, t, n) => new Fn(e, t, n),
2693
+ broadcast: (e, t, n) => new Un(e, t, n),
2694
+ websocket: (e, t, n, s) => new jn(e, t, n, s),
2695
+ chromeRuntime: (e, t) => new zn(e, t),
2696
+ chromeTabs: (e, t, n) => new Hn(e, t, n),
2697
+ chromePort: (e, t, n, s) => new Gn(e, t, n, s),
2698
+ chromeExternal: (e, t, n) => new Qn(e, t, n),
2699
+ serviceWorker: (e, t, n) => new Vn(e, t, n),
2700
+ self: (e, t) => new Kn(e, t)
2821
2701
  };
2822
- function jr(e) {
2702
+ function Dr(e) {
2823
2703
  const t = [], n = new _({ bufferSize: 100 });
2824
2704
  for (const s of e) s.subscribeIncoming((r) => {
2825
2705
  t.push(r), n.next(r);
@@ -2829,13 +2709,13 @@ function jr(e) {
2829
2709
  getConnections: () => [...t]
2830
2710
  };
2831
2711
  }
2832
- var as = "uniform_channels", cs = 1, f = {
2712
+ var Yn = "uniform_channels", Jn = 1, f = {
2833
2713
  MESSAGES: "messages",
2834
2714
  MAILBOX: "mailbox",
2835
2715
  PENDING: "pending",
2836
2716
  EXCHANGE: "exchange",
2837
2717
  TRANSACTIONS: "transactions"
2838
- }, ls = class {
2718
+ }, Xn = class {
2839
2719
  _db = null;
2840
2720
  _isOpen = !1;
2841
2721
  _openPromise = null;
@@ -2847,7 +2727,7 @@ var as = "uniform_channels", cs = 1, f = {
2847
2727
  }
2848
2728
  async open() {
2849
2729
  return this._db && this._isOpen ? this._db : this._openPromise ? this._openPromise : (this._openPromise = new Promise((e, t) => {
2850
- const n = indexedDB.open(as, cs);
2730
+ const n = indexedDB.open(Yn, Jn);
2851
2731
  n.onerror = () => {
2852
2732
  this._openPromise = null, t(/* @__PURE__ */ new Error("Failed to open IndexedDB"));
2853
2733
  }, n.onsuccess = () => {
@@ -2882,7 +2762,7 @@ var as = "uniform_channels", cs = 1, f = {
2882
2762
  }
2883
2763
  async defer(e, t = {}) {
2884
2764
  const n = await this.open(), s = {
2885
- id: u(),
2765
+ id: h(),
2886
2766
  channel: e.channel,
2887
2767
  sender: e.sender ?? this._channelName,
2888
2768
  recipient: e.channel,
@@ -2990,7 +2870,7 @@ var as = "uniform_channels", cs = 1, f = {
2990
2870
  }
2991
2871
  async registerPending(e) {
2992
2872
  const t = await this.open(), n = {
2993
- id: u(),
2873
+ id: h(),
2994
2874
  channel: this._channelName,
2995
2875
  type: e.type,
2996
2876
  data: e.data,
@@ -3037,7 +2917,7 @@ var as = "uniform_channels", cs = 1, f = {
3037
2917
  }
3038
2918
  async exchangePut(e, t, n = {}) {
3039
2919
  const s = await this.open(), r = {
3040
- id: u(),
2920
+ id: h(),
3041
2921
  key: e,
3042
2922
  value: t,
3043
2923
  owner: this._channelName,
@@ -3049,8 +2929,8 @@ var as = "uniform_channels", cs = 1, f = {
3049
2929
  return new Promise((i, o) => {
3050
2930
  const a = s.transaction(f.EXCHANGE, "readwrite"), c = a.objectStore(f.EXCHANGE), l = c.index("key").get(e);
3051
2931
  l.onsuccess = () => {
3052
- const h = l.result;
3053
- h && (r.id = h.id, r.version = h.version + 1, r.createdAt = h.createdAt), c.put(r);
2932
+ const u = l.result;
2933
+ u && (r.id = u.id, r.version = u.version + 1, r.createdAt = u.createdAt), c.put(r);
3054
2934
  }, a.oncomplete = () => {
3055
2935
  this._exchangeUpdates.next(r), i(r.id);
3056
2936
  }, a.onerror = () => o(/* @__PURE__ */ new Error("Failed to put exchange data"));
@@ -3128,7 +3008,7 @@ var as = "uniform_channels", cs = 1, f = {
3128
3008
  return e.owner === this._channelName || e.sharedWith.includes("*") ? !0 : e.sharedWith.includes(this._channelName);
3129
3009
  }
3130
3010
  async beginTransaction() {
3131
- return new us(this);
3011
+ return new Zn(this);
3132
3012
  }
3133
3013
  async executeTransaction(e) {
3134
3014
  const t = await this.open(), n = new Set(e.map((s) => s.store));
@@ -3153,7 +3033,6 @@ var as = "uniform_channels", cs = 1, f = {
3153
3033
  });
3154
3034
  };
3155
3035
  }
3156
- break;
3157
3036
  }
3158
3037
  }
3159
3038
  i.oncomplete = () => s(), i.onerror = () => r(/* @__PURE__ */ new Error("Transaction failed"));
@@ -3172,23 +3051,23 @@ var as = "uniform_channels", cs = 1, f = {
3172
3051
  let a = 0;
3173
3052
  const c = i.openCursor();
3174
3053
  c.onsuccess = () => {
3175
- const h = c.result;
3176
- if (h) {
3177
- const p = h.value;
3178
- p.expiresAt && p.expiresAt < t && (h.delete(), a++), h.continue();
3054
+ const u = c.result;
3055
+ if (u) {
3056
+ const p = u.value;
3057
+ p.expiresAt && p.expiresAt < t && (u.delete(), a++), u.continue();
3179
3058
  }
3180
3059
  };
3181
3060
  const l = o.openCursor();
3182
3061
  l.onsuccess = () => {
3183
- const h = l.result;
3184
- if (h) {
3185
- const p = h.value;
3186
- p.expiresAt && p.expiresAt < t && (h.delete(), a++), h.continue();
3062
+ const u = l.result;
3063
+ if (u) {
3064
+ const p = u.value;
3065
+ p.expiresAt && p.expiresAt < t && (u.delete(), a++), u.continue();
3187
3066
  }
3188
3067
  }, r.oncomplete = () => n(a), r.onerror = () => s(/* @__PURE__ */ new Error("Failed to cleanup expired"));
3189
3068
  });
3190
3069
  }
3191
- }, us = class {
3070
+ }, Zn = class {
3192
3071
  _storage;
3193
3072
  _operations = [];
3194
3073
  _isCommitted = !1;
@@ -3198,7 +3077,7 @@ var as = "uniform_channels", cs = 1, f = {
3198
3077
  }
3199
3078
  put(e, t) {
3200
3079
  return this._checkState(), this._operations.push({
3201
- id: u(),
3080
+ id: h(),
3202
3081
  type: "put",
3203
3082
  store: e,
3204
3083
  value: t,
@@ -3207,7 +3086,7 @@ var as = "uniform_channels", cs = 1, f = {
3207
3086
  }
3208
3087
  delete(e, t) {
3209
3088
  return this._checkState(), this._operations.push({
3210
- id: u(),
3089
+ id: h(),
3211
3090
  type: "delete",
3212
3091
  store: e,
3213
3092
  key: t,
@@ -3216,7 +3095,7 @@ var as = "uniform_channels", cs = 1, f = {
3216
3095
  }
3217
3096
  update(e, t, n) {
3218
3097
  return this._checkState(), this._operations.push({
3219
- id: u(),
3098
+ id: h(),
3220
3099
  type: "update",
3221
3100
  store: e,
3222
3101
  key: t,
@@ -3241,26 +3120,26 @@ var as = "uniform_channels", cs = 1, f = {
3241
3120
  if (this._isCommitted) throw new Error("Transaction already committed");
3242
3121
  if (this._isRolledBack) throw new Error("Transaction already rolled back");
3243
3122
  }
3244
- }, se = /* @__PURE__ */ new Map();
3245
- function Wt(e) {
3246
- return se.has(e) || se.set(e, new ls(e)), se.get(e);
3123
+ }, J = /* @__PURE__ */ new Map();
3124
+ function Rt(e) {
3125
+ return J.has(e) || J.set(e, new Xn(e)), J.get(e);
3247
3126
  }
3248
- function Vr() {
3249
- for (const e of se.values()) e.close();
3250
- se.clear();
3127
+ function Lr() {
3128
+ for (const e of J.values()) e.close();
3129
+ J.clear();
3251
3130
  }
3252
- var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "", $t = class {
3131
+ var Je = Ct(), es = Je.length > 0 ? new URL("../transport/Worker.ts", Je) : "", qt = class {
3253
3132
  _channel;
3254
3133
  _context;
3255
3134
  _options;
3256
3135
  _connection;
3257
3136
  _storage;
3258
3137
  constructor(e, t, n = {}) {
3259
- this._channel = e, this._context = t, this._options = n, this._connection = Bt(e), this._storage = Wt(e);
3138
+ this._channel = e, this._context = t, this._options = n, this._connection = At(e), this._storage = Rt(e);
3260
3139
  }
3261
3140
  async request(e, t, n, s = {}) {
3262
3141
  let r = typeof e == "string" ? [e] : e, i = t, o = n;
3263
- return Array.isArray(t) && Ut(e) && (s = n, o = t, i = e, r = []), this._context.getHost()?.request(r, i, o, s, this._channel);
3142
+ return Array.isArray(t) && Ot(e) && (s = n, o = t, i = e, r = []), this._context.getHost()?.request(r, i, o, s, this._channel);
3264
3143
  }
3265
3144
  async doImportModule(e, t = {}) {
3266
3145
  return this.request([], d.IMPORT, [e], t);
@@ -3285,7 +3164,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3285
3164
  get context() {
3286
3165
  return this._context;
3287
3166
  }
3288
- }, O = class {
3167
+ }, A = class {
3289
3168
  _channel;
3290
3169
  _context;
3291
3170
  _options;
@@ -3301,14 +3180,14 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3301
3180
  return this._unified.__getPrivate("_transports");
3302
3181
  }
3303
3182
  constructor(e, t, n = {}) {
3304
- this._channel = e, this._context = t, this._options = n, this._connection = Ue().getOrCreate(e, "internal", n), this._unified = new It({
3183
+ this._channel = e, this._context = t, this._options = n, this._connection = Le().getOrCreate(e, "internal", n), this._unified = new yt({
3305
3184
  name: e,
3306
3185
  autoListen: !1,
3307
3186
  timeout: n?.timeout
3308
3187
  });
3309
3188
  }
3310
3189
  createRemoteChannel(e, t = {}, n) {
3311
- const s = ds(n ?? this._context.$createOrUseExistingRemote(e, t, n ?? null)?.messageChannel?.port1), r = Ht(s?.target ?? s);
3190
+ const s = ts(n ?? this._context.$createOrUseExistingRemote(e, t, n ?? null)?.messageChannel?.port1), r = Lt(s?.target ?? s);
3312
3191
  return this._unified.listen(s?.target, { targetChannel: e }), s && (this._broadcasts?.set?.(e, s), r === "self" && typeof postMessage > "u" || this._unified.connect(s, { targetChannel: e }), this._context.$registerConnection({
3313
3192
  localChannel: this._channel,
3314
3193
  remoteChannel: e,
@@ -3318,7 +3197,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3318
3197
  }), this.notifyChannel(e, {
3319
3198
  contextId: this._context.id,
3320
3199
  contextName: this._context.hostName
3321
- }, "connect")), new $t(e, this._context, t);
3200
+ }, "connect")), new qt(e, this._context, t);
3322
3201
  }
3323
3202
  getChannel() {
3324
3203
  return this._channel;
@@ -3328,7 +3207,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3328
3207
  }
3329
3208
  request(e, t, n, s = {}, r = "worker") {
3330
3209
  let i = typeof e == "string" ? [e] : e, o = n;
3331
- return Array.isArray(t) && Ut(e) && (r = s, s = n, o = t, t = e, i = []), this._unified.invoke(r, t, i ?? [], Array.isArray(o) ? o : [o]);
3210
+ return Array.isArray(t) && Ot(e) && (r = s, s = n, o = t, t = e, i = []), this._unified.invoke(r, t, i ?? [], Array.isArray(o) ? o : [o]);
3332
3211
  }
3333
3212
  resolveResponse(e, t) {
3334
3213
  this._forResolves.get(e)?.resolve?.(t);
@@ -3353,9 +3232,9 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3353
3232
  get unified() {
3354
3233
  return this._unified;
3355
3234
  }
3356
- }, Ft = class {
3235
+ }, Nt = class {
3357
3236
  _options;
3358
- _id = u();
3237
+ _id = h();
3359
3238
  _hostName;
3360
3239
  _host = null;
3361
3240
  _endpoints = /* @__PURE__ */ new Map();
@@ -3364,7 +3243,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3364
3243
  _remoteChannels = /* @__PURE__ */ new Map();
3365
3244
  _deferredChannels = /* @__PURE__ */ new Map();
3366
3245
  _connectionEvents = new _({ bufferSize: 200 });
3367
- _connectionRegistry = new Et(() => u(), (e) => this._emitConnectionEvent(e));
3246
+ _connectionRegistry = new bt(() => h(), (e) => this._emitConnectionEvent(e));
3368
3247
  _closed = !1;
3369
3248
  _globalSelf = null;
3370
3249
  constructor(e = {}) {
@@ -3375,7 +3254,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3375
3254
  const t = e ?? this._hostName;
3376
3255
  if (this._hostName = t, this._endpoints.has(t))
3377
3256
  return this._host = this._endpoints.get(t).handler, this._host;
3378
- this._host = new O(t, this, this._options.defaultOptions);
3257
+ this._host = new A(t, this, this._options.defaultOptions);
3379
3258
  const n = {
3380
3259
  name: t,
3381
3260
  handler: this._host,
@@ -3425,7 +3304,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3425
3304
  }
3426
3305
  createChannel(e, t = {}) {
3427
3306
  if (this._endpoints.has(e)) return this._endpoints.get(e);
3428
- const n = new O(e, this, {
3307
+ const n = new A(e, this, {
3429
3308
  ...this._options.defaultOptions,
3430
3309
  ...t
3431
3310
  }), s = {
@@ -3474,9 +3353,9 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3474
3353
  return this._endpoints.has(e) ? this._endpoints.get(e) : this._deferredChannels.has(e) ? this.initDeferred(e) : null;
3475
3354
  }
3476
3355
  async addWorker(e, t, n = {}) {
3477
- const s = rt(t);
3356
+ const s = Xe(t);
3478
3357
  if (!s) throw new Error(`Failed to create worker for channel: ${e}`);
3479
- const r = new O(e, this, {
3358
+ const r = new A(e, this, {
3480
3359
  ...this._options.defaultOptions,
3481
3360
  ...n
3482
3361
  }), i = r.createRemoteChannel(e, n, s), o = {
@@ -3497,7 +3376,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3497
3376
  }), o;
3498
3377
  }
3499
3378
  async addPort(e, t, n = {}) {
3500
- const s = new O(e, this, {
3379
+ const s = new A(e, this, {
3501
3380
  ...this._options.defaultOptions,
3502
3381
  ...n
3503
3382
  });
@@ -3520,7 +3399,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3520
3399
  }), i;
3521
3400
  }
3522
3401
  async addBroadcast(e, t, n = {}) {
3523
- const s = new BroadcastChannel(t ?? e), r = new O(e, this, {
3402
+ const s = new BroadcastChannel(t ?? e), r = new A(e, this, {
3524
3403
  ...this._options.defaultOptions,
3525
3404
  ...n
3526
3405
  }), i = r.createRemoteChannel(e, n, s), o = {
@@ -3541,7 +3420,7 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3541
3420
  }), o;
3542
3421
  }
3543
3422
  addSelfChannel(e, t = {}) {
3544
- const n = new O(e, this, {
3423
+ const n = new A(e, this, {
3545
3424
  ...this._options.defaultOptions,
3546
3425
  ...t
3547
3426
  }), s = this._globalSelf ?? (typeof self < "u" ? self : null), r = {
@@ -3574,10 +3453,10 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3574
3453
  }
3575
3454
  }
3576
3455
  createChannelPair(e, t, n = {}) {
3577
- const s = new MessageChannel(), r = new O(e, this, {
3456
+ const s = new MessageChannel(), r = new A(e, this, {
3578
3457
  ...this._options.defaultOptions,
3579
3458
  ...n
3580
- }), i = new O(t, this, {
3459
+ }), i = new A(t, this, {
3581
3460
  ...this._options.defaultOptions,
3582
3461
  ...n
3583
3462
  });
@@ -3617,10 +3496,10 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3617
3496
  $createOrUseExistingRemote(e, t = {}, n) {
3618
3497
  if (e == null || n) return null;
3619
3498
  if (this._remoteChannels.has(e)) return this._remoteChannels.get(e);
3620
- const s = new MessageChannel(), r = yt(new Promise((o) => {
3621
- const a = rt(hs);
3499
+ const s = new MessageChannel(), r = rn(new Promise((o) => {
3500
+ const a = Xe(es);
3622
3501
  a?.addEventListener?.("message", (c) => {
3623
- c.data.type === "channelCreated" && (s.port1?.start?.(), o(new $t(c.data.channel, this, t)));
3502
+ c.data.type === "channelCreated" && (s.port1?.start?.(), o(new qt(c.data.channel, this, t)));
3624
3503
  }), a?.postMessage?.({
3625
3504
  type: "createChannel",
3626
3505
  channel: e,
@@ -3705,13 +3584,13 @@ var st = Mt(), hs = st.length > 0 ? new URL("../transport/Worker.ts", st) : "",
3705
3584
  });
3706
3585
  }
3707
3586
  };
3708
- function Ut(e) {
3587
+ function Ot(e) {
3709
3588
  return [...Object.values(d)].includes(e);
3710
3589
  }
3711
- function ds(e) {
3590
+ function ts(e) {
3712
3591
  if (!e) return null;
3713
- if (zt(e)) return e;
3714
- const t = e, n = Ht(t);
3592
+ if (Dt(e)) return e;
3593
+ const t = e, n = Lt(t);
3715
3594
  return {
3716
3595
  target: t,
3717
3596
  targetChannel: "unknown",
@@ -3732,14 +3611,14 @@ function ds(e) {
3732
3611
  close: t.close?.bind(t)
3733
3612
  };
3734
3613
  }
3735
- function zt(e) {
3614
+ function Dt(e) {
3736
3615
  return !!e && typeof e == "object" && "target" in e && typeof e.postMessage == "function";
3737
3616
  }
3738
- function Ht(e) {
3739
- const t = zt(e) ? e.target : e;
3617
+ function Lt(e) {
3618
+ const t = Dt(e) ? e.target : e;
3740
3619
  return t ? t === "chrome-runtime" ? "chrome-runtime" : t === "chrome-tabs" ? "chrome-tabs" : t === "chrome-port" ? "chrome-port" : t === "chrome-external" ? "chrome-external" : typeof MessagePort < "u" && t instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && t instanceof BroadcastChannel ? "broadcast" : typeof Worker < "u" && t instanceof Worker ? "worker" : typeof WebSocket < "u" && t instanceof WebSocket ? "websocket" : typeof chrome < "u" && typeof t == "object" && t && typeof t.postMessage == "function" && t.onMessage?.addListener ? "chrome-port" : typeof self < "u" && t === self ? "self" : "internal" : "internal";
3741
3620
  }
3742
- function rt(e) {
3621
+ function Xe(e) {
3743
3622
  if (e instanceof Worker) return e;
3744
3623
  if (e instanceof URL) return new Worker(e.href, { type: "module" });
3745
3624
  if (typeof e == "function") try {
@@ -3747,44 +3626,44 @@ function rt(e) {
3747
3626
  } catch {
3748
3627
  return e({ type: "module" });
3749
3628
  }
3750
- return typeof e == "string" ? e.startsWith("/") ? new Worker(q(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(q(e), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([e], { type: "application/javascript" })), { type: "module" }) : e instanceof Blob || e instanceof File ? new Worker(URL.createObjectURL(e), { type: "module" }) : e ?? (typeof self < "u" ? self : null);
3629
+ return typeof e == "string" ? e.startsWith("/") ? new Worker(P(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(P(e), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([e], { type: "application/javascript" })), { type: "module" }) : e instanceof Blob || e instanceof File ? new Worker(URL.createObjectURL(e), { type: "module" }) : e ?? (typeof self < "u" ? self : null);
3751
3630
  }
3752
- var $ = /* @__PURE__ */ new Map(), de = null;
3753
- function F() {
3754
- return de || (de = new Ft({
3631
+ var q = /* @__PURE__ */ new Map(), oe = null;
3632
+ function N() {
3633
+ return oe || (oe = new Nt({
3755
3634
  name: "$default$",
3756
3635
  useGlobalSelf: !0
3757
- }), $.set("$default$", de)), de;
3636
+ }), q.set("$default$", oe)), oe;
3758
3637
  }
3759
- function ce(e = {}) {
3760
- const t = new Ft(e);
3761
- return e.name && $.set(e.name, t), t;
3638
+ function ne(e = {}) {
3639
+ const t = new Nt(e);
3640
+ return e.name && q.set(e.name, t), t;
3762
3641
  }
3763
- function fs(e, t = {}) {
3764
- return $.has(e) ? $.get(e) : ce({
3642
+ function ns(e, t = {}) {
3643
+ return q.has(e) ? q.get(e) : ne({
3765
3644
  ...t,
3766
3645
  name: e
3767
3646
  });
3768
3647
  }
3769
- function Qr(e) {
3770
- return $.get(e);
3648
+ function Br(e) {
3649
+ return q.get(e);
3771
3650
  }
3772
- function Kr(e) {
3773
- const t = $.get(e);
3774
- return t ? (t.close(), $.delete(e)) : !1;
3651
+ function Wr(e) {
3652
+ const t = q.get(e);
3653
+ return t ? (t.close(), q.delete(e)) : !1;
3775
3654
  }
3776
- function Yr() {
3777
- return [...$.keys()];
3655
+ function $r() {
3656
+ return [...q.keys()];
3778
3657
  }
3779
- function ps(e, t = {}) {
3780
- const n = ce(t);
3658
+ function ss(e, t = {}) {
3659
+ const n = ne(t);
3781
3660
  return {
3782
3661
  context: n,
3783
3662
  channels: n.createChannels(e)
3784
3663
  };
3785
3664
  }
3786
- async function _s(e, t, n = {}) {
3787
- const s = ce(n.contextOptions);
3665
+ async function rs(e, t, n = {}) {
3666
+ const s = ne(n.contextOptions);
3788
3667
  return {
3789
3668
  context: s,
3790
3669
  module: await s.importModuleInChannel(e, t, {
@@ -3793,31 +3672,31 @@ async function _s(e, t, n = {}) {
3793
3672
  })
3794
3673
  };
3795
3674
  }
3796
- async function Jr(e, t, n = {}) {
3797
- return F().addWorker(e, t, n);
3675
+ async function Fr(e, t, n = {}) {
3676
+ return N().addWorker(e, t, n);
3798
3677
  }
3799
- async function Xr(e, t, n = {}) {
3800
- return F().addPort(e, t, n);
3678
+ async function Ur(e, t, n = {}) {
3679
+ return N().addPort(e, t, n);
3801
3680
  }
3802
- async function Zr(e, t, n = {}) {
3803
- return F().addBroadcast(e, t, n);
3681
+ async function jr(e, t, n = {}) {
3682
+ return N().addBroadcast(e, t, n);
3804
3683
  }
3805
- function ei(e, t = {}) {
3806
- return F().addSelfChannel(e, t);
3684
+ function zr(e, t = {}) {
3685
+ return N().addSelfChannel(e, t);
3807
3686
  }
3808
- function ti(e, t) {
3809
- F().defer(e, t);
3687
+ function Hr(e, t) {
3688
+ N().defer(e, t);
3810
3689
  }
3811
- async function ni(e) {
3812
- return F().initDeferred(e);
3690
+ async function Gr(e) {
3691
+ return N().initDeferred(e);
3813
3692
  }
3814
- async function si(e) {
3815
- return F().getChannelAsync(e);
3693
+ async function Qr(e) {
3694
+ return N().getChannelAsync(e);
3816
3695
  }
3817
- function ri(e, t, n = {}) {
3818
- return F().createChannelPair(e, t, n);
3696
+ function Vr(e, t, n = {}) {
3697
+ return N().createChannelPair(e, t, n);
3819
3698
  }
3820
- var P = class {
3699
+ var I = class {
3821
3700
  _subs = /* @__PURE__ */ new Set();
3822
3701
  _listening = !1;
3823
3702
  _cleanup = null;
@@ -3856,11 +3735,11 @@ var P = class {
3856
3735
  get isListening() {
3857
3736
  return this._listening;
3858
3737
  }
3859
- }, it = class extends P {
3738
+ }, Ze = class extends I {
3860
3739
  _worker;
3861
3740
  _send;
3862
3741
  constructor(e) {
3863
- super(), this._worker = e, this._send = y(this._worker);
3742
+ super(), this._worker = e, this._send = g(this._worker);
3864
3743
  }
3865
3744
  next(e, t) {
3866
3745
  this._send(e, t);
@@ -3874,11 +3753,11 @@ var P = class {
3874
3753
  get worker() {
3875
3754
  return this._worker;
3876
3755
  }
3877
- }, Ie = class extends P {
3756
+ }, Ce = class extends I {
3878
3757
  _port;
3879
3758
  _send;
3880
3759
  constructor(e) {
3881
- super(), this._port = e, this._send = y(this._port);
3760
+ super(), this._port = e, this._send = g(this._port);
3882
3761
  }
3883
3762
  next(e, t) {
3884
3763
  this._send(e, t);
@@ -3889,12 +3768,12 @@ var P = class {
3889
3768
  get port() {
3890
3769
  return this._port;
3891
3770
  }
3892
- }, ms = class extends P {
3771
+ }, is = class extends I {
3893
3772
  _name;
3894
3773
  _channel;
3895
3774
  _send;
3896
3775
  constructor(e) {
3897
- super(), this._name = e, this._channel = new BroadcastChannel(e), this._send = y(this._channel);
3776
+ super(), this._name = e, this._channel = new BroadcastChannel(e), this._send = g(this._channel);
3898
3777
  }
3899
3778
  next(e) {
3900
3779
  this._send(e);
@@ -3907,7 +3786,7 @@ var P = class {
3907
3786
  close() {
3908
3787
  this._channel.close(), super.close();
3909
3788
  }
3910
- }, gs = class extends P {
3789
+ }, os = class extends I {
3911
3790
  _url;
3912
3791
  _protocols;
3913
3792
  _ws = null;
@@ -3945,15 +3824,15 @@ var P = class {
3945
3824
  get isOpen() {
3946
3825
  return this._ws?.readyState === WebSocket.OPEN;
3947
3826
  }
3948
- }, ys = class extends P {
3949
- _send = y("chrome-runtime");
3827
+ }, as = class extends I {
3828
+ _send = g("chrome-runtime");
3950
3829
  next(e) {
3951
3830
  this._send(e);
3952
3831
  }
3953
3832
  _activate() {
3954
3833
  this._listening || (this._cleanup = m("chrome-runtime", (e) => this._dispatch(e)), this._listening = !0);
3955
3834
  }
3956
- }, bs = class extends P {
3835
+ }, cs = class extends I {
3957
3836
  _tabId;
3958
3837
  constructor(e) {
3959
3838
  super(), this._tabId = e;
@@ -3969,12 +3848,12 @@ var P = class {
3969
3848
  _activate() {
3970
3849
  this._listening || (this._cleanup = m("chrome-tabs", (e) => this._dispatch(e), void 0, void 0, { tabId: this._tabId }), this._listening = !0);
3971
3850
  }
3972
- }, ws = class extends P {
3851
+ }, ls = class extends I {
3973
3852
  _portName;
3974
3853
  _tabId;
3975
3854
  _send;
3976
3855
  constructor(e, t) {
3977
- super(), this._portName = e, this._tabId = t, this._send = y("chrome-port", {
3856
+ super(), this._portName = e, this._tabId = t, this._send = g("chrome-port", {
3978
3857
  portName: e,
3979
3858
  tabId: t
3980
3859
  });
@@ -3988,54 +3867,54 @@ var P = class {
3988
3867
  tabId: this._tabId
3989
3868
  }), this._listening = !0);
3990
3869
  }
3991
- }, vs = class extends P {
3992
- _send = y("service-worker-client");
3870
+ }, hs = class extends I {
3871
+ _send = g("service-worker-client");
3993
3872
  next(e, t) {
3994
3873
  this._send(e, t);
3995
3874
  }
3996
3875
  _activate() {
3997
3876
  this._listening || (this._cleanup = m("service-worker-client", (e) => this._dispatch(e)), this._listening = !0);
3998
3877
  }
3999
- }, Cs = class extends P {
4000
- _send = y("service-worker-host");
3878
+ }, us = class extends I {
3879
+ _send = g("service-worker-host");
4001
3880
  next(e, t) {
4002
3881
  this._send(e, t);
4003
3882
  }
4004
3883
  _activate() {
4005
3884
  this._listening || (this._cleanup = m("service-worker-host", (e) => this._dispatch(e)), this._listening = !0);
4006
3885
  }
4007
- }, xs = class extends P {
4008
- _send = y("self");
3886
+ }, ds = class extends I {
3887
+ _send = g("self");
4009
3888
  next(e, t) {
4010
3889
  this._send(e, t);
4011
3890
  }
4012
3891
  _activate() {
4013
3892
  this._listening || (this._cleanup = m("self", (e) => this._dispatch(e)), this._listening = !0);
4014
3893
  }
4015
- }, ii = {
4016
- worker: (e) => new it(e),
4017
- workerFromUrl: (e, t) => new it(new Worker(typeof e == "string" ? e : e.href, {
3894
+ }, Kr = {
3895
+ worker: (e) => new Ze(e),
3896
+ workerFromUrl: (e, t) => new Ze(new Worker(typeof e == "string" ? e : e.href, {
4018
3897
  type: "module",
4019
3898
  ...t
4020
3899
  })),
4021
- messagePort: (e) => new Ie(e),
3900
+ messagePort: (e) => new Ce(e),
4022
3901
  messageChannel: () => {
4023
3902
  const e = new MessageChannel();
4024
3903
  return {
4025
- port1: new Ie(e.port1),
4026
- port2: new Ie(e.port2)
3904
+ port1: new Ce(e.port1),
3905
+ port2: new Ce(e.port2)
4027
3906
  };
4028
3907
  },
4029
- broadcast: (e) => new ms(e),
4030
- websocket: (e, t) => new gs(e, t),
4031
- chromeRuntime: () => new ys(),
4032
- chromeTabs: (e) => new bs(e),
4033
- chromePort: (e, t) => new ws(e, t),
4034
- serviceWorkerClient: () => new vs(),
4035
- serviceWorkerHost: () => new Cs(),
4036
- self: () => new xs()
3908
+ broadcast: (e) => new is(e),
3909
+ websocket: (e, t) => new os(e, t),
3910
+ chromeRuntime: () => new as(),
3911
+ chromeTabs: (e) => new cs(e),
3912
+ chromePort: (e, t) => new ls(e, t),
3913
+ serviceWorkerClient: () => new hs(),
3914
+ serviceWorkerHost: () => new us(),
3915
+ self: () => new ds()
4037
3916
  };
4038
- function oi(e, t) {
3917
+ function Yr(e, t) {
4039
3918
  return {
4040
3919
  send: (n, s) => e.next(n, s),
4041
3920
  subscribe: (n) => t.subscribe({ next: n }),
@@ -4044,7 +3923,7 @@ function oi(e, t) {
4044
3923
  }
4045
3924
  };
4046
3925
  }
4047
- var Gt = class {
3926
+ var Bt = class {
4048
3927
  _context;
4049
3928
  _config;
4050
3929
  _subscriptions = [];
@@ -4054,7 +3933,7 @@ var Gt = class {
4054
3933
  constructor(e = {}) {
4055
3934
  this._config = {
4056
3935
  name: e.name ?? "worker",
4057
- workerName: e.workerName ?? `worker-${u().slice(0, 8)}`,
3936
+ workerName: e.workerName ?? `worker-${h().slice(0, 8)}`,
4058
3937
  autoAcceptChannels: e.autoAcceptChannels ?? !0,
4059
3938
  allowedChannels: e.allowedChannels ?? [],
4060
3939
  maxChannels: e.maxChannels ?? 100,
@@ -4063,7 +3942,7 @@ var Gt = class {
4063
3942
  defaultOptions: e.defaultOptions ?? {},
4064
3943
  isolatedStorage: e.isolatedStorage ?? !1,
4065
3944
  ...e
4066
- }, this._context = ce({
3945
+ }, this._context = ne({
4067
3946
  name: this._config.name,
4068
3947
  useGlobalSelf: !0,
4069
3948
  defaultOptions: e.defaultOptions
@@ -4162,7 +4041,7 @@ var Gt = class {
4162
4041
  }
4163
4042
  _handleCreateChannel(e) {
4164
4043
  const t = {
4165
- id: e.reqId ?? u(),
4044
+ id: e.reqId ?? h(),
4166
4045
  channel: e.channel,
4167
4046
  sender: e.sender ?? "unknown",
4168
4047
  type: "channel",
@@ -4174,7 +4053,7 @@ var Gt = class {
4174
4053
  }
4175
4054
  _handleConnectChannel(e) {
4176
4055
  const t = {
4177
- id: e.reqId ?? u(),
4056
+ id: e.reqId ?? h(),
4178
4057
  channel: e.channel,
4179
4058
  sender: e.sender ?? "unknown",
4180
4059
  type: e.portType ?? "channel",
@@ -4194,7 +4073,7 @@ var Gt = class {
4194
4073
  _handleAddPort(e) {
4195
4074
  if (!e.port || !e.channel) return;
4196
4075
  const t = {
4197
- id: e.reqId ?? u(),
4076
+ id: e.reqId ?? h(),
4198
4077
  channel: e.channel,
4199
4078
  sender: e.sender ?? "unknown",
4200
4079
  type: "port",
@@ -4233,39 +4112,39 @@ var Gt = class {
4233
4112
  close() {
4234
4113
  this._subscriptions.forEach((e) => e.unsubscribe()), this._subscriptions = [], this._incomingConnections.complete(), this._channelCreated.complete(), this._channelClosed.complete(), this._context.close();
4235
4114
  }
4236
- }, K = null;
4237
- function ze(e) {
4238
- return K || (K = new Gt(e)), K;
4115
+ }, j = null;
4116
+ function Be(e) {
4117
+ return j || (j = new Bt(e)), j;
4239
4118
  }
4240
- function ai(e) {
4241
- return K?.close(), K = new Gt(e), K;
4119
+ function Jr(e) {
4120
+ return j?.close(), j = new Bt(e), j;
4242
4121
  }
4243
- function ci(e) {
4244
- return ze().subscribeConnections(e);
4122
+ function Xr(e) {
4123
+ return Be().subscribeConnections(e);
4245
4124
  }
4246
- function li(e) {
4247
- return ze().subscribeChannelCreated(e);
4125
+ function Zr(e) {
4126
+ return Be().subscribeChannelCreated(e);
4248
4127
  }
4249
- var fe = null, pe = null;
4250
- function jt(e) {
4251
- return fe || (fe = Rn(e ?? "worker"), fe.listen(self)), fe;
4128
+ var ae = null, ce = null;
4129
+ function Wt(e) {
4130
+ return ae || (ae = vn(e ?? "worker"), ae.listen(self)), ae;
4252
4131
  }
4253
- function Vt(e) {
4254
- return pe || (pe = Le(e ?? "worker"), pe.connect(self)), pe;
4132
+ function $t(e) {
4133
+ return ce || (ce = qe(e ?? "worker"), ce.connect(self)), ce;
4255
4134
  }
4256
- function ui(e, t) {
4257
- jt().expose(e, t);
4135
+ function ei(e, t) {
4136
+ Wt().expose(e, t);
4258
4137
  }
4259
- function hi(e) {
4260
- return jt().subscribeInvocations(e);
4138
+ function ti(e) {
4139
+ return Wt().subscribeInvocations(e);
4261
4140
  }
4262
- function di(e = "host", t = []) {
4263
- return Vt().createProxy(e, t);
4141
+ function ni(e = "host", t = []) {
4142
+ return $t().createProxy(e, t);
4264
4143
  }
4265
- function fi(e, t = "host") {
4266
- return Vt().importModule(t, e);
4144
+ function si(e, t = "host") {
4145
+ return $t().importModule(t, e);
4267
4146
  }
4268
- var pi = ze({ name: "worker" }), be = class {
4147
+ var ri = Be({ name: "worker" }), pe = class {
4269
4148
  _subs = /* @__PURE__ */ new Set();
4270
4149
  _listening = !1;
4271
4150
  _cleanup = null;
@@ -4291,7 +4170,7 @@ var pi = ze({ name: "worker" }), be = class {
4291
4170
  close() {
4292
4171
  this._subs.forEach((e) => e.complete?.()), this._subs.clear(), this._deactivate();
4293
4172
  }
4294
- }, He = class extends be {
4173
+ }, We = class extends pe {
4295
4174
  _handler;
4296
4175
  _options;
4297
4176
  _pending = /* @__PURE__ */ new Map();
@@ -4304,7 +4183,7 @@ var pi = ze({ name: "worker" }), be = class {
4304
4183
  chrome.runtime.sendMessage(i);
4305
4184
  }
4306
4185
  request(e) {
4307
- const t = e.reqId ?? u();
4186
+ const t = e.reqId ?? h();
4308
4187
  return new Promise((n, s) => {
4309
4188
  this._pending.set(t, {
4310
4189
  resolve: n,
@@ -4326,7 +4205,7 @@ var pi = ze({ name: "worker" }), be = class {
4326
4205
  if (this._options.filterSender && !this._options.filterSender(n) || this._options.filterMessage && !this._options.filterMessage(t)) return !1;
4327
4206
  const r = {
4328
4207
  ...t,
4329
- id: t.id ?? u(),
4208
+ id: t.id ?? h(),
4330
4209
  _sender: n,
4331
4210
  _tabId: n.tab?.id,
4332
4211
  _frameId: n.frameId
@@ -4351,7 +4230,7 @@ var pi = ze({ name: "worker" }), be = class {
4351
4230
  };
4352
4231
  chrome.runtime.onMessage.addListener(e), this._cleanup = () => chrome.runtime.onMessage.removeListener(e), this._listening = !0;
4353
4232
  }
4354
- }, Ge = class extends be {
4233
+ }, $e = class extends pe {
4355
4234
  _tabId;
4356
4235
  _options;
4357
4236
  constructor(e, t = {}) {
@@ -4371,7 +4250,7 @@ var pi = ze({ name: "worker" }), be = class {
4371
4250
  if (this._tabId != null && n.tab?.id !== this._tabId || this._options.filterSender && !this._options.filterSender(n)) return;
4372
4251
  const s = {
4373
4252
  ...t,
4374
- id: t.id ?? u(),
4253
+ id: t.id ?? h(),
4375
4254
  _sender: n,
4376
4255
  _tabId: n.tab?.id,
4377
4256
  _frameId: n.frameId
@@ -4380,7 +4259,7 @@ var pi = ze({ name: "worker" }), be = class {
4380
4259
  };
4381
4260
  chrome.runtime.onMessage.addListener(e), this._cleanup = () => chrome.runtime.onMessage.removeListener(e), this._listening = !0;
4382
4261
  }
4383
- }, je = class extends be {
4262
+ }, Fe = class extends pe {
4384
4263
  _portName;
4385
4264
  _tabId;
4386
4265
  _port = null;
@@ -4402,7 +4281,7 @@ var pi = ze({ name: "worker" }), be = class {
4402
4281
  _setupListeners() {
4403
4282
  this._port && (this._port.onMessage.addListener((e) => this._dispatch({
4404
4283
  ...e,
4405
- id: e.id ?? u()
4284
+ id: e.id ?? h()
4406
4285
  })), this._port.onDisconnect.addListener(() => {
4407
4286
  this._subs.forEach((e) => e.complete?.()), this._port = null;
4408
4287
  }));
@@ -4419,7 +4298,7 @@ var pi = ze({ name: "worker" }), be = class {
4419
4298
  get isConnected() {
4420
4299
  return this._port != null;
4421
4300
  }
4422
- }, Qt = class extends be {
4301
+ }, Ft = class extends pe {
4423
4302
  _extensionId;
4424
4303
  constructor(e) {
4425
4304
  super(), this._extensionId = e;
@@ -4434,14 +4313,14 @@ var pi = ze({ name: "worker" }), be = class {
4434
4313
  const e = (t, n) => {
4435
4314
  this._dispatch({
4436
4315
  ...t,
4437
- id: t.id ?? u(),
4316
+ id: t.id ?? h(),
4438
4317
  _sender: n
4439
4318
  });
4440
4319
  };
4441
4320
  chrome.runtime.onMessageExternal.addListener(e), this._cleanup = () => chrome.runtime.onMessageExternal.removeListener(e), this._listening = !0;
4442
4321
  }
4443
4322
  };
4444
- function _i(e, t) {
4323
+ function ii(e, t) {
4445
4324
  return async (n, s, r) => {
4446
4325
  if (n.type !== "request") {
4447
4326
  r.next(n);
@@ -4451,7 +4330,7 @@ function _i(e, t) {
4451
4330
  if (i && t[i]) try {
4452
4331
  const o = await t[i](n.payload?.args ?? [], n);
4453
4332
  s({
4454
- id: u(),
4333
+ id: h(),
4455
4334
  channel: n.sender,
4456
4335
  sender: e,
4457
4336
  reqId: n.reqId,
@@ -4461,7 +4340,7 @@ function _i(e, t) {
4461
4340
  });
4462
4341
  } catch (o) {
4463
4342
  s({
4464
- id: u(),
4343
+ id: h(),
4465
4344
  channel: n.sender,
4466
4345
  sender: e,
4467
4346
  reqId: n.reqId,
@@ -4473,12 +4352,12 @@ function _i(e, t) {
4473
4352
  else r.next(n);
4474
4353
  };
4475
4354
  }
4476
- var mi = {
4477
- runtime: (e, t) => new He(e, t),
4478
- tabs: (e, t) => new Ge(e, t),
4479
- port: (e, t) => new je(e, t),
4480
- external: (e) => new Qt(e)
4481
- }, we = class {
4355
+ var oi = {
4356
+ runtime: (e, t) => new We(e, t),
4357
+ tabs: (e, t) => new $e(e, t),
4358
+ port: (e, t) => new Fe(e, t),
4359
+ external: (e) => new Ft(e)
4360
+ }, _e = class {
4482
4361
  _socket;
4483
4362
  _channelName;
4484
4363
  _options;
@@ -4500,7 +4379,7 @@ var mi = {
4500
4379
  this._socket.emit(e, t);
4501
4380
  }
4502
4381
  request(e, t) {
4503
- const n = e.reqId ?? u();
4382
+ const n = e.reqId ?? h();
4504
4383
  return new Promise((s, r) => {
4505
4384
  this._pending.set(n, {
4506
4385
  resolve: s,
@@ -4533,7 +4412,7 @@ var mi = {
4533
4412
  const r = (i, o) => {
4534
4413
  const a = {
4535
4414
  ...typeof i == "object" ? i : { payload: i },
4536
- id: i?.id ?? u(),
4415
+ id: i?.id ?? h(),
4537
4416
  event: s,
4538
4417
  ack: o
4539
4418
  };
@@ -4573,7 +4452,7 @@ var mi = {
4573
4452
  get state() {
4574
4453
  return this._state;
4575
4454
  }
4576
- }, ks = class {
4455
+ }, fs = class {
4577
4456
  _parent;
4578
4457
  _roomName;
4579
4458
  _subs = /* @__PURE__ */ new Set();
@@ -4614,14 +4493,14 @@ var mi = {
4614
4493
  return this._roomName;
4615
4494
  }
4616
4495
  };
4617
- function gi(e, t) {
4496
+ function ai(e, t) {
4618
4497
  return async (n) => {
4619
4498
  if (n.type !== "request" || !n.ack) return;
4620
4499
  const s = n.payload?.action;
4621
4500
  if (s && t[s]) try {
4622
4501
  const r = await t[s](n.payload?.args ?? [], n);
4623
4502
  n.ack({
4624
- id: u(),
4503
+ id: h(),
4625
4504
  channel: n.sender,
4626
4505
  sender: e,
4627
4506
  reqId: n.reqId,
@@ -4631,7 +4510,7 @@ function gi(e, t) {
4631
4510
  });
4632
4511
  } catch (r) {
4633
4512
  n.ack({
4634
- id: u(),
4513
+ id: h(),
4635
4514
  channel: n.sender,
4636
4515
  sender: e,
4637
4516
  reqId: n.reqId,
@@ -4642,14 +4521,14 @@ function gi(e, t) {
4642
4521
  }
4643
4522
  };
4644
4523
  }
4645
- var yi = {
4646
- create: (e, t, n) => new we(e, t, n),
4647
- room: (e, t) => new ks(e, t)
4524
+ var ci = {
4525
+ create: (e, t, n) => new _e(e, t, n),
4526
+ room: (e, t) => new fs(e, t)
4648
4527
  };
4649
- function bi(e, t, n) {
4650
- return new we(e, t, n);
4528
+ function li(e, t, n) {
4529
+ return new _e(e, t, n);
4651
4530
  }
4652
- var ve = class {
4531
+ var me = class {
4653
4532
  _scriptUrl;
4654
4533
  _channelName;
4655
4534
  _options;
@@ -4659,7 +4538,7 @@ var ve = class {
4659
4538
  _pending = /* @__PURE__ */ new Map();
4660
4539
  _listening = !1;
4661
4540
  _cleanup = null;
4662
- _portId = u();
4541
+ _portId = h();
4663
4542
  _state = new _();
4664
4543
  constructor(e, t, n = {}) {
4665
4544
  this._scriptUrl = e, this._channelName = t, this._options = n, n.autoConnect !== !1 && this.connect();
@@ -4672,7 +4551,7 @@ var ve = class {
4672
4551
  credentials: this._options.credentials,
4673
4552
  type: this._options.type
4674
4553
  }), this._port = this._worker.port, this._setupListeners(), this._port.start(), this._state.next("connecting"), this.send({
4675
- id: u(),
4554
+ id: h(),
4676
4555
  channel: this._channelName,
4677
4556
  sender: this._portId,
4678
4557
  type: "signal",
@@ -4694,7 +4573,7 @@ var ve = class {
4694
4573
  }, t ?? []);
4695
4574
  }
4696
4575
  request(e) {
4697
- const t = e.reqId ?? u();
4576
+ const t = e.reqId ?? h();
4698
4577
  return new Promise((n, s) => {
4699
4578
  const r = setTimeout(() => {
4700
4579
  this._pending.has(t) && (this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout")));
@@ -4759,7 +4638,7 @@ var ve = class {
4759
4638
  }
4760
4639
  disconnect() {
4761
4640
  this.send({
4762
- id: u(),
4641
+ id: h(),
4763
4642
  channel: this._channelName,
4764
4643
  sender: this._portId,
4765
4644
  type: "signal",
@@ -4787,7 +4666,7 @@ var ve = class {
4787
4666
  get channelName() {
4788
4667
  return this._channelName;
4789
4668
  }
4790
- }, Ve = class {
4669
+ }, Ue = class {
4791
4670
  _channelName;
4792
4671
  _ports = /* @__PURE__ */ new Map();
4793
4672
  _subs = /* @__PURE__ */ new Set();
@@ -4797,7 +4676,7 @@ var ve = class {
4797
4676
  }
4798
4677
  _setupGlobalHandler() {
4799
4678
  typeof self < "u" && "onconnect" in self && (self.onconnect = (e) => {
4800
- const t = e.ports[0], n = u();
4679
+ const t = e.ports[0], n = h();
4801
4680
  this._registerPort(n, t);
4802
4681
  }, this._state.next("ready"));
4803
4682
  }
@@ -4816,7 +4695,7 @@ var ve = class {
4816
4695
  port: t,
4817
4696
  info: n
4818
4697
  }), t.postMessage({
4819
- id: u(),
4698
+ id: h(),
4820
4699
  channel: this._channelName,
4821
4700
  sender: "host",
4822
4701
  type: "signal",
@@ -4868,7 +4747,7 @@ var ve = class {
4868
4747
  }
4869
4748
  respond(e, t, n) {
4870
4749
  !e.portId || !e.reqId || this.send(e.portId, {
4871
- id: u(),
4750
+ id: h(),
4872
4751
  channel: e.sender,
4873
4752
  sender: this._channelName,
4874
4753
  type: "response",
@@ -4900,33 +4779,33 @@ var ve = class {
4900
4779
  return this._channelName;
4901
4780
  }
4902
4781
  };
4903
- function wi(e, t, n) {
4904
- return new ve(e, t, n);
4782
+ function hi(e, t, n) {
4783
+ return new me(e, t, n);
4905
4784
  }
4906
- function vi(e) {
4907
- return new Ve(e);
4785
+ function ui(e) {
4786
+ return new Ue(e);
4908
4787
  }
4909
- var Ci = {
4910
- client: (e, t, n) => new ve(e, t, n),
4911
- host: (e) => new Ve(e)
4912
- }, ee = null;
4913
- async function Kt() {
4914
- if (ee) return ee;
4788
+ var di = {
4789
+ client: (e, t, n) => new me(e, t, n),
4790
+ host: (e) => new Ue(e)
4791
+ }, V = null;
4792
+ async function Ut() {
4793
+ if (V) return V;
4915
4794
  try {
4916
- const e = await import("./cbor-x-DhdMOAu4.js");
4917
- ee = {
4795
+ const e = await import("./cbor-x-CR9Hs652.js");
4796
+ V = {
4918
4797
  encode: (t) => e.encode(t),
4919
4798
  decode: (t) => e.decode(t)
4920
4799
  };
4921
4800
  } catch {
4922
- ee = {
4923
- encode: (e) => new TextEncoder().encode(JSON.stringify(e, Ss)),
4924
- decode: (e) => JSON.parse(new TextDecoder().decode(e), Es)
4801
+ V = {
4802
+ encode: (e) => new TextEncoder().encode(JSON.stringify(e, ps)),
4803
+ decode: (e) => JSON.parse(new TextDecoder().decode(e), _s)
4925
4804
  };
4926
4805
  }
4927
- return ee;
4806
+ return V;
4928
4807
  }
4929
- function Ss(e, t) {
4808
+ function ps(e, t) {
4930
4809
  return ArrayBuffer.isView(t) && !(t instanceof DataView) ? {
4931
4810
  __typedArray: !0,
4932
4811
  type: t.constructor.name,
@@ -4936,38 +4815,38 @@ function Ss(e, t) {
4936
4815
  data: Array.from(new Uint8Array(t))
4937
4816
  } : t;
4938
4817
  }
4939
- function Es(e, t) {
4818
+ function _s(e, t) {
4940
4819
  if (t?.__typedArray) {
4941
4820
  const n = globalThis[t.type];
4942
4821
  return n ? new n(t.data) : t.data;
4943
4822
  }
4944
4823
  return t?.__arrayBuffer ? new Uint8Array(t.data).buffer : t;
4945
4824
  }
4946
- var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1, Ts = 2, Ps = 4, V = class {
4825
+ var jt = 32, K = 0, xe = 4, et = 8, tt = 12, W = 16, le = 20, ke = jt, ms = 1, gs = 2, bs = 4, F = class {
4947
4826
  _config;
4948
4827
  _sharedBuffer;
4949
4828
  _int32View;
4950
4829
  _uint8View;
4951
4830
  _maxDataSize;
4952
4831
  constructor(e = 65536, t = {}) {
4953
- this._config = t, typeof e == "number" ? this._sharedBuffer = new SharedArrayBuffer(e) : this._sharedBuffer = e, this._int32View = new Int32Array(this._sharedBuffer), this._uint8View = new Uint8Array(this._sharedBuffer), this._maxDataSize = this._config.maxMessageSize ?? this._sharedBuffer.byteLength - Yt;
4832
+ this._config = t, typeof e == "number" ? this._sharedBuffer = new SharedArrayBuffer(e) : this._sharedBuffer = e, this._int32View = new Int32Array(this._sharedBuffer), this._uint8View = new Uint8Array(this._sharedBuffer), this._maxDataSize = this._config.maxMessageSize ?? this._sharedBuffer.byteLength - jt;
4954
4833
  }
4955
4834
  async write(e, t = 0) {
4956
4835
  if (e.byteLength > this._maxDataSize) throw new Error(`Message too large: ${e.byteLength} > ${this._maxDataSize}`);
4957
- for (; Atomics.compareExchange(this._int32View, te / 4, 0, 1) !== 0; ) this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, te / 4, 1, this._config.waitTimeout ?? 100).value : Atomics.wait(this._int32View, te / 4, 1, this._config.waitTimeout ?? 100);
4836
+ for (; Atomics.compareExchange(this._int32View, K / 4, 0, 1) !== 0; ) this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, K / 4, 1, this._config.waitTimeout ?? 100).value : Atomics.wait(this._int32View, K / 4, 1, this._config.waitTimeout ?? 100);
4958
4837
  try {
4959
- return Atomics.store(this._int32View, ot / 4, e.byteLength), Atomics.store(this._int32View, at / 4, t), this._uint8View.set(e, Pe), Atomics.add(this._int32View, Te / 4, 1), Atomics.store(this._int32View, G / 4, 1), Atomics.notify(this._int32View, G / 4), !0;
4838
+ return Atomics.store(this._int32View, et / 4, e.byteLength), Atomics.store(this._int32View, tt / 4, t), this._uint8View.set(e, ke), Atomics.add(this._int32View, xe / 4, 1), Atomics.store(this._int32View, W / 4, 1), Atomics.notify(this._int32View, W / 4), !0;
4960
4839
  } finally {
4961
- Atomics.store(this._int32View, te / 4, 0), Atomics.notify(this._int32View, te / 4);
4840
+ Atomics.store(this._int32View, K / 4, 0), Atomics.notify(this._int32View, K / 4);
4962
4841
  }
4963
4842
  }
4964
4843
  async read() {
4965
- if (Atomics.load(this._int32View, G / 4) === 0 && (this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, G / 4, 0, this._config.waitTimeout ?? 1e3).value : Atomics.wait(this._int32View, G / 4, 0, this._config.waitTimeout ?? 1e3)) === "timed-out")
4844
+ if (Atomics.load(this._int32View, W / 4) === 0 && (this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, W / 4, 0, this._config.waitTimeout ?? 1e3).value : Atomics.wait(this._int32View, W / 4, 0, this._config.waitTimeout ?? 1e3)) === "timed-out")
4966
4845
  return null;
4967
- const e = Atomics.load(this._int32View, ot / 4), t = Atomics.load(this._int32View, at / 4), n = Atomics.load(this._int32View, Te / 4);
4846
+ const e = Atomics.load(this._int32View, et / 4), t = Atomics.load(this._int32View, tt / 4), n = Atomics.load(this._int32View, xe / 4);
4968
4847
  if (e <= 0 || e > this._maxDataSize) return null;
4969
4848
  const s = new Uint8Array(e);
4970
- return s.set(this._uint8View.subarray(Pe, Pe + e)), Atomics.store(this._int32View, G / 4, 0), Atomics.add(this._int32View, _e / 4, 1), Atomics.notify(this._int32View, _e / 4), {
4849
+ return s.set(this._uint8View.subarray(ke, ke + e)), Atomics.store(this._int32View, W / 4, 0), Atomics.add(this._int32View, le / 4, 1), Atomics.notify(this._int32View, le / 4), {
4971
4850
  data: s,
4972
4851
  flags: t,
4973
4852
  seq: n
@@ -4976,9 +4855,9 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
4976
4855
  async waitAck(e) {
4977
4856
  const t = this._config.waitTimeout ?? 5e3, n = Date.now();
4978
4857
  for (; Date.now() - n < t; ) {
4979
- const s = Atomics.load(this._int32View, _e / 4);
4858
+ const s = Atomics.load(this._int32View, le / 4);
4980
4859
  if (s >= e) return !0;
4981
- this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, _e / 4, s, 100).value : await new Promise((r) => setTimeout(r, 10));
4860
+ this._config.useAsyncWait && "waitAsync" in Atomics ? await Atomics.waitAsync(this._int32View, le / 4, s, 100).value : await new Promise((r) => setTimeout(r, 10));
4982
4861
  }
4983
4862
  return !1;
4984
4863
  }
@@ -4986,9 +4865,9 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
4986
4865
  return this._sharedBuffer;
4987
4866
  }
4988
4867
  get currentSeq() {
4989
- return Atomics.load(this._int32View, Te / 4);
4868
+ return Atomics.load(this._int32View, xe / 4);
4990
4869
  }
4991
- }, le = class {
4870
+ }, se = class {
4992
4871
  _channelName;
4993
4872
  _config;
4994
4873
  _sendBuffer;
@@ -4998,29 +4877,29 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
4998
4877
  _pending = /* @__PURE__ */ new Map();
4999
4878
  _polling = !1;
5000
4879
  _pollAbort = null;
5001
- _workerId = u();
4880
+ _workerId = h();
5002
4881
  _lastSeq = 0;
5003
4882
  _state = new _();
5004
4883
  constructor(e, t, n, s = {}) {
5005
- this._channelName = e, this._config = s, this._sendBuffer = t instanceof V ? t : new V(t, s), this._recvBuffer = n instanceof V ? n : new V(n, s), this._init();
4884
+ this._channelName = e, this._config = s, this._sendBuffer = t instanceof F ? t : new F(t, s), this._recvBuffer = n instanceof F ? n : new F(n, s), this._init();
5006
4885
  }
5007
4886
  async _init() {
5008
- this._encoder = await Kt(), this._state.next("ready");
4887
+ this._encoder = await Ut(), this._state.next("ready");
5009
4888
  }
5010
4889
  async send(e, t) {
5011
4890
  this._encoder || await this._init();
5012
4891
  const { transferable: n, ...s } = e;
5013
4892
  let r = 0;
5014
- t?.length && (r |= Is, s._transferMeta = t.map((o, a) => ({
4893
+ t?.length && (r |= ms, s._transferMeta = t.map((o, a) => ({
5015
4894
  index: a,
5016
4895
  type: o.constructor.name,
5017
4896
  transferred: o instanceof ArrayBuffer && "transfer" in o
5018
4897
  })));
5019
4898
  const i = this._encoder.encode(s);
5020
- this._config.compression && i.length > 1024 && (r |= Ts), await this._sendBuffer.write(i, r);
4899
+ this._config.compression && i.length > 1024 && (r |= gs), await this._sendBuffer.write(i, r);
5021
4900
  }
5022
4901
  async request(e) {
5023
- const t = e.reqId ?? u();
4902
+ const t = e.reqId ?? h();
5024
4903
  return new Promise((n, s) => {
5025
4904
  const r = setTimeout(() => {
5026
4905
  this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
@@ -5056,7 +4935,7 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
5056
4935
  if (!e || e.seq <= this._lastSeq) continue;
5057
4936
  this._lastSeq = e.seq;
5058
4937
  const t = this._encoder.decode(e.data);
5059
- if (t.seq = e.seq, t.workerId = t.workerId ?? this._workerId, (e.flags & Ps || t.type === "response") && t.reqId) {
4938
+ if (t.seq = e.seq, t.workerId = t.workerId ?? this._workerId, (e.flags & bs || t.type === "response") && t.reqId) {
5060
4939
  const n = this._pending.get(t.reqId);
5061
4940
  if (n) {
5062
4941
  this._pending.delete(t.reqId), t.payload?.error ? n.reject(new Error(t.payload.error)) : n.resolve(t.payload?.result ?? t.payload);
@@ -5094,20 +4973,20 @@ var Yt = 32, te = 0, Te = 4, ot = 8, at = 12, G = 16, _e = 20, Pe = Yt, Is = 1,
5094
4973
  return this._channelName;
5095
4974
  }
5096
4975
  };
5097
- function Jt(e, t = {}) {
4976
+ function zt(e, t = {}) {
5098
4977
  const n = t.bufferSize ?? 65536, s = new SharedArrayBuffer(n), r = new SharedArrayBuffer(n);
5099
4978
  return {
5100
- main: new le(e, s, r, t),
4979
+ main: new se(e, s, r, t),
5101
4980
  worker: {
5102
4981
  sendBuffer: r,
5103
4982
  recvBuffer: s
5104
4983
  }
5105
4984
  };
5106
4985
  }
5107
- function xi(e, t, n, s = {}) {
5108
- return new le(e, t, n, s);
4986
+ function fi(e, t, n, s = {}) {
4987
+ return new se(e, t, n, s);
5109
4988
  }
5110
- var Xt = class b {
4989
+ var Ht = class b {
5111
4990
  _buffer;
5112
4991
  _meta;
5113
4992
  _data;
@@ -5162,31 +5041,31 @@ var Xt = class b {
5162
5041
  get overflow() {
5163
5042
  return Atomics.load(this._meta, b.OVERFLOW);
5164
5043
  }
5165
- }, ki = {
5166
- create: (e, t, n, s) => new le(e, t, n, s),
5167
- createPair: (e, t) => Jt(e, t),
5168
- createBuffer: (e, t) => new V(e, t),
5169
- createRingBuffer: (e) => new Xt(e),
5170
- getCBOR: Kt
5171
- }, Ms = [
5044
+ }, pi = {
5045
+ create: (e, t, n, s) => new se(e, t, n, s),
5046
+ createPair: (e, t) => zt(e, t),
5047
+ createBuffer: (e, t) => new F(e, t),
5048
+ createRingBuffer: (e) => new Ht(e),
5049
+ getCBOR: Ut
5050
+ }, ys = [
5172
5051
  { urls: "stun:stun.l.google.com:19302" },
5173
5052
  { urls: "stun:stun1.l.google.com:19302" },
5174
5053
  { urls: "stun:stun2.l.google.com:19302" }
5175
- ], Ce = class {
5054
+ ], ge = class {
5176
5055
  _channelName;
5177
5056
  _config;
5178
5057
  _pc;
5179
5058
  _channel = null;
5180
5059
  _subs = /* @__PURE__ */ new Set();
5181
5060
  _pending = /* @__PURE__ */ new Map();
5182
- _localId = u();
5061
+ _localId = h();
5183
5062
  _remoteId = null;
5184
5063
  _state = new _();
5185
5064
  _channelState = new _();
5186
5065
  _iceCandidates = [];
5187
5066
  _iceGatheringComplete = !1;
5188
5067
  constructor(e, t = {}) {
5189
- this._channelName = e, this._config = t, this._pc = new RTCPeerConnection({ iceServers: t.iceServers ?? Ms }), this._setupPeerConnection();
5068
+ this._channelName = e, this._config = t, this._pc = new RTCPeerConnection({ iceServers: t.iceServers ?? ys }), this._setupPeerConnection();
5190
5069
  }
5191
5070
  _setupPeerConnection() {
5192
5071
  this._pc.onicecandidate = (e) => {
@@ -5269,7 +5148,7 @@ var Xt = class b {
5269
5148
  t || e.binary ? this._channel.send(this._encodeBinary(i)) : this._channel.send(JSON.stringify(i));
5270
5149
  }
5271
5150
  request(e) {
5272
- const t = e.reqId ?? u();
5151
+ const t = e.reqId ?? h();
5273
5152
  return new Promise((n, s) => {
5274
5153
  const r = setTimeout(() => {
5275
5154
  this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
@@ -5337,11 +5216,11 @@ var Xt = class b {
5337
5216
  get channelName() {
5338
5217
  return this._channelName;
5339
5218
  }
5340
- }, Qe = class {
5219
+ }, je = class {
5341
5220
  _channelName;
5342
5221
  _config;
5343
5222
  _peers = /* @__PURE__ */ new Map();
5344
- _localId = u();
5223
+ _localId = h();
5345
5224
  _subs = /* @__PURE__ */ new Set();
5346
5225
  _signalingCleanup = null;
5347
5226
  _peerEvents = new _();
@@ -5370,14 +5249,13 @@ var Xt = class b {
5370
5249
  }
5371
5250
  case "disconnect":
5372
5251
  this._removePeer(t.fromPeerId);
5373
- break;
5374
5252
  }
5375
5253
  });
5376
5254
  typeof e == "function" ? this._signalingCleanup = e : e && "unsubscribe" in e && (this._signalingCleanup = () => e.unsubscribe());
5377
5255
  }
5378
5256
  _getOrCreatePeer(e) {
5379
5257
  let t = this._peers.get(e);
5380
- return t || (t = new Ce(this._channelName, this._config), this._peers.set(e, t), t.state.subscribe({ next: (n) => {
5258
+ return t || (t = new ge(this._channelName, this._config), this._peers.set(e, t), t.state.subscribe({ next: (n) => {
5381
5259
  n === "connected" ? this._peerEvents.next({
5382
5260
  type: "connected",
5383
5261
  peerId: e,
@@ -5460,7 +5338,7 @@ var Xt = class b {
5460
5338
  return this._channelName;
5461
5339
  }
5462
5340
  };
5463
- function Zt(e) {
5341
+ function Gt(e) {
5464
5342
  const t = new BroadcastChannel(`rtc-signaling:${e}`), n = /* @__PURE__ */ new Set();
5465
5343
  return t.onmessage = (s) => {
5466
5344
  for (const r of n) r(s.data);
@@ -5479,11 +5357,11 @@ function Zt(e) {
5479
5357
  }
5480
5358
  };
5481
5359
  }
5482
- var Si = {
5483
- createPeer: (e, t) => new Ce(e, t),
5484
- createManager: (e, t) => new Qe(e, t),
5485
- createSignaling: (e) => Zt(e)
5486
- }, H = class {
5360
+ var _i = {
5361
+ createPeer: (e, t) => new ge(e, t),
5362
+ createManager: (e, t) => new je(e, t),
5363
+ createSignaling: (e) => Gt(e)
5364
+ }, B = class {
5487
5365
  _channelName;
5488
5366
  _config;
5489
5367
  _port;
@@ -5491,7 +5369,7 @@ var Si = {
5491
5369
  _pending = /* @__PURE__ */ new Map();
5492
5370
  _listening = !1;
5493
5371
  _cleanup = null;
5494
- _portId = u();
5372
+ _portId = h();
5495
5373
  _state = new _();
5496
5374
  _keepAliveTimer = null;
5497
5375
  constructor(e, t, n = {}) {
@@ -5509,7 +5387,7 @@ var Si = {
5509
5387
  }
5510
5388
  if (s.type === "signal" && s.payload?.action === "ping") {
5511
5389
  this.send({
5512
- id: u(),
5390
+ id: h(),
5513
5391
  channel: this._channelName,
5514
5392
  sender: this._portId,
5515
5393
  type: "signal",
@@ -5543,7 +5421,7 @@ var Si = {
5543
5421
  }, t ?? []);
5544
5422
  }
5545
5423
  request(e) {
5546
- const t = e.reqId ?? u();
5424
+ const t = e.reqId ?? h();
5547
5425
  return new Promise((n, s) => {
5548
5426
  const r = setTimeout(() => {
5549
5427
  this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
@@ -5575,7 +5453,7 @@ var Si = {
5575
5453
  _startKeepAlive() {
5576
5454
  this._keepAliveTimer = setInterval(() => {
5577
5455
  this.send({
5578
- id: u(),
5456
+ id: h(),
5579
5457
  channel: this._channelName,
5580
5458
  sender: this._portId,
5581
5459
  type: "signal",
@@ -5602,18 +5480,18 @@ var Si = {
5602
5480
  return this._channelName;
5603
5481
  }
5604
5482
  };
5605
- function xe(e, t) {
5483
+ function be(e, t) {
5606
5484
  const n = new MessageChannel();
5607
5485
  return {
5608
- local: new H(n.port1, e, t),
5486
+ local: new B(n.port1, e, t),
5609
5487
  remote: n.port2,
5610
5488
  transfer: () => n.port2
5611
5489
  };
5612
5490
  }
5613
- function Ei(e, t, n) {
5614
- return new H(e, t, n);
5491
+ function mi(e, t, n) {
5492
+ return new B(e, t, n);
5615
5493
  }
5616
- var en = class {
5494
+ var Qt = class {
5617
5495
  _defaultConfig;
5618
5496
  _channels = /* @__PURE__ */ new Map();
5619
5497
  _mainPort = null;
@@ -5622,7 +5500,7 @@ var en = class {
5622
5500
  this._defaultConfig = e;
5623
5501
  }
5624
5502
  create(e, t) {
5625
- const n = xe(e, {
5503
+ const n = be(e, {
5626
5504
  ...this._defaultConfig,
5627
5505
  ...t
5628
5506
  });
@@ -5635,7 +5513,7 @@ var en = class {
5635
5513
  } }), this._channels.set(e, n.local), n;
5636
5514
  }
5637
5515
  add(e, t, n) {
5638
- const s = new H(t, e, {
5516
+ const s = new B(t, e, {
5639
5517
  ...this._defaultConfig,
5640
5518
  ...n
5641
5519
  });
@@ -5684,7 +5562,7 @@ var en = class {
5684
5562
  get size() {
5685
5563
  return this._channels.size;
5686
5564
  }
5687
- }, qe = class {
5565
+ }, Te = class {
5688
5566
  _target;
5689
5567
  _channelName;
5690
5568
  _config;
@@ -5697,7 +5575,7 @@ var en = class {
5697
5575
  async connect() {
5698
5576
  if (this._transport && this._handshakeComplete) return this._transport;
5699
5577
  this._state.next("connecting");
5700
- const { local: e, remote: t } = xe(this._channelName, this._config);
5578
+ const { local: e, remote: t } = be(this._channelName, this._config);
5701
5579
  return this._target.postMessage({
5702
5580
  type: "port-connect",
5703
5581
  channelName: this._channelName,
@@ -5713,9 +5591,9 @@ var en = class {
5713
5591
  static listen(e, t, n) {
5714
5592
  const s = (r) => {
5715
5593
  if (r.data?.type !== "port-connect" || r.data?.channelName !== e || !r.ports[0]) return;
5716
- const i = new H(r.ports[0], e, n);
5594
+ const i = new B(r.ports[0], e, n);
5717
5595
  i.send({
5718
- id: u(),
5596
+ id: h(),
5719
5597
  channel: e,
5720
5598
  sender: i.portId,
5721
5599
  type: "signal",
@@ -5737,15 +5615,15 @@ var en = class {
5737
5615
  return this._transport;
5738
5616
  }
5739
5617
  };
5740
- function As(e, t = []) {
5741
- return On({
5618
+ function ws(e, t = []) {
5619
+ return kn({
5742
5620
  request: (n) => e.request(n),
5743
5621
  channelName: e.channelName,
5744
5622
  senderId: e.portId
5745
5623
  }, t);
5746
5624
  }
5747
- function Rs(e, t) {
5748
- const n = Nn(t);
5625
+ function vs(e, t) {
5626
+ const n = xn(t);
5749
5627
  return e.subscribe({ next: async (s) => {
5750
5628
  if (s.type !== "request" || !s.payload?.path) return;
5751
5629
  const { action: r, path: i, args: o } = s.payload;
@@ -5756,7 +5634,7 @@ function Rs(e, t) {
5756
5634
  c = l instanceof Error ? l.message : String(l);
5757
5635
  }
5758
5636
  e.send({
5759
- id: u(),
5637
+ id: h(),
5760
5638
  channel: s.sender,
5761
5639
  sender: e.portId,
5762
5640
  type: "response",
@@ -5765,15 +5643,15 @@ function Rs(e, t) {
5765
5643
  });
5766
5644
  } });
5767
5645
  }
5768
- var Ii = {
5769
- create: (e, t, n) => new H(e, t, n),
5770
- createPair: (e, t) => xe(e, t),
5771
- createPool: (e) => new en(e),
5772
- createWindowConnector: (e, t, n) => new qe(e, t, n),
5773
- listen: qe.listen,
5774
- createProxy: As,
5775
- expose: Rs
5776
- }, Ke = class {
5646
+ var gi = {
5647
+ create: (e, t, n) => new B(e, t, n),
5648
+ createPair: (e, t) => be(e, t),
5649
+ createPool: (e) => new Qt(e),
5650
+ createWindowConnector: (e, t, n) => new Te(e, t, n),
5651
+ listen: Te.listen,
5652
+ createProxy: ws,
5653
+ expose: vs
5654
+ }, ze = class {
5777
5655
  _db = null;
5778
5656
  _config;
5779
5657
  _changes = new _();
@@ -5895,25 +5773,25 @@ var Ii = {
5895
5773
  let o = 0;
5896
5774
  const a = e.offset ?? 0, c = e.limit ?? 1 / 0, l = r.openCursor(e.range, e.direction);
5897
5775
  l.onsuccess = () => {
5898
- const h = l.result;
5899
- if (!h || i.length >= c) {
5776
+ const u = l.result;
5777
+ if (!u || i.length >= c) {
5900
5778
  t(i);
5901
5779
  return;
5902
5780
  }
5903
- const p = h.value;
5781
+ const p = u.value;
5904
5782
  if (p.expiresAt && p.expiresAt < Date.now()) {
5905
- h.continue();
5783
+ u.continue();
5906
5784
  return;
5907
5785
  }
5908
5786
  if (e.filter && !e.filter(p)) {
5909
- h.continue();
5787
+ u.continue();
5910
5788
  return;
5911
5789
  }
5912
5790
  if (o < a) {
5913
- o++, h.continue();
5791
+ o++, u.continue();
5914
5792
  return;
5915
5793
  }
5916
- i.push(p), h.continue();
5794
+ i.push(p), u.continue();
5917
5795
  }, l.onerror = () => n(/* @__PURE__ */ new Error(`Query failed: ${l.error?.message}`));
5918
5796
  });
5919
5797
  }
@@ -5984,7 +5862,7 @@ var Ii = {
5984
5862
  get changes() {
5985
5863
  return this._changes;
5986
5864
  }
5987
- }, tn = class extends Ke {
5865
+ }, Vt = class extends ze {
5988
5866
  constructor(e = "uniform-message-queue") {
5989
5867
  super({
5990
5868
  dbName: e,
@@ -6014,7 +5892,7 @@ var Ii = {
6014
5892
  });
6015
5893
  }
6016
5894
  async enqueue(e) {
6017
- const t = Date.now(), n = u(), s = {
5895
+ const t = Date.now(), n = h(), s = {
6018
5896
  id: n,
6019
5897
  channel: e.channel,
6020
5898
  sender: e.sender,
@@ -6050,10 +5928,10 @@ var Ii = {
6050
5928
  async getPendingCount(e) {
6051
5929
  return (await this.query({ filter: (t) => t.data.channel === e && t.data.status === "pending" })).length;
6052
5930
  }
6053
- }, Ti = {
6054
- create: (e) => new Ke(e),
6055
- createMessageQueue: (e) => new tn(e)
6056
- }, Ye = class {
5931
+ }, bi = {
5932
+ create: (e) => new ze(e),
5933
+ createMessageQueue: (e) => new Vt(e)
5934
+ }, He = class {
6057
5935
  _connection;
6058
5936
  _storage;
6059
5937
  _clients = /* @__PURE__ */ new Map();
@@ -6066,11 +5944,11 @@ var Ii = {
6066
5944
  this._config = {
6067
5945
  enableOfflineQueue: !0,
6068
5946
  maxOfflineQueueSize: 100,
6069
- messageTTL: 1440 * 60 * 1e3,
5947
+ messageTTL: 864e5,
6070
5948
  autoCleanup: !0,
6071
- cleanupInterval: 60 * 1e3,
5949
+ cleanupInterval: 6e4,
6072
5950
  ...e
6073
- }, this._connection = Ue().getOrCreate(this._config.channelName, "service-worker", { metadata: { isHost: !0 } }), this._storage = Wt(this._config.channelName), this._setupMessageHandlers(), this._config.autoCleanup && this._startCleanupInterval();
5951
+ }, this._connection = Le().getOrCreate(this._config.channelName, "service-worker", { metadata: { isHost: !0 } }), this._storage = Rt(this._config.channelName), this._setupMessageHandlers(), this._config.autoCleanup && this._startCleanupInterval();
6074
5952
  }
6075
5953
  async registerClient(e, t = {}) {
6076
5954
  const n = {
@@ -6220,7 +6098,7 @@ var Ii = {
6220
6098
  }
6221
6099
  async _handleRequest(e) {
6222
6100
  const t = {
6223
- id: u(),
6101
+ id: h(),
6224
6102
  channel: e.sender,
6225
6103
  sender: this._config.channelName,
6226
6104
  type: "response",
@@ -6278,7 +6156,7 @@ var Ii = {
6278
6156
  const e = await clients.matchAll({ includeUncontrolled: !0 }), t = new Set(e.map((n) => n.id));
6279
6157
  for (const n of this._clients.keys()) t.has(n) || this.unregisterClient(n);
6280
6158
  }
6281
- }, Je = class {
6159
+ }, Ge = class {
6282
6160
  _channelName;
6283
6161
  _registration = null;
6284
6162
  _messageHandler = null;
@@ -6333,9 +6211,9 @@ var Ii = {
6333
6211
  });
6334
6212
  }
6335
6213
  async request(e, t = {}) {
6336
- const n = u(), s = Promise.withResolvers();
6214
+ const n = h(), s = Promise.withResolvers();
6337
6215
  return this._pendingRequests.set(n, s), this._sendToSW({
6338
- id: u(),
6216
+ id: h(),
6339
6217
  type: "request",
6340
6218
  channel: this._channelName,
6341
6219
  sender: "client",
@@ -6351,7 +6229,7 @@ var Ii = {
6351
6229
  }
6352
6230
  emit(e, t, n) {
6353
6231
  this._sendToSW({
6354
- id: u(),
6232
+ id: h(),
6355
6233
  type: "event",
6356
6234
  channel: n ?? this._channelName,
6357
6235
  sender: "client",
@@ -6366,7 +6244,7 @@ var Ii = {
6366
6244
  return this._subject.subscribe({ next: e });
6367
6245
  }
6368
6246
  on(e, t) {
6369
- return bt((n) => n.type === "event" && n.payload?.type === e)(this._subject).subscribe({ next: (n) => t(n.payload?.data) });
6247
+ return ut((n) => n.type === "event" && n.payload?.type === e)(this._subject).subscribe({ next: (n) => t(n.payload?.data) });
6370
6248
  }
6371
6249
  get isConnected() {
6372
6250
  return this._isConnected;
@@ -6388,13 +6266,13 @@ var Ii = {
6388
6266
  });
6389
6267
  };
6390
6268
  };
6391
- function Pi(e) {
6392
- return new Ye(e);
6269
+ function yi(e) {
6270
+ return new He(e);
6393
6271
  }
6394
- function Mi(e) {
6395
- return new Je(e);
6272
+ function wi(e) {
6273
+ return new Ge(e);
6396
6274
  }
6397
- function qs(e, t = self) {
6275
+ function Cs(e, t = self) {
6398
6276
  const n = (s) => {
6399
6277
  const r = String(s.source?.id || "").trim();
6400
6278
  r && e.handleClientMessage(r, s.data);
@@ -6405,7 +6283,7 @@ function qs(e, t = self) {
6405
6283
  t.removeEventListener("message", n), e.stop();
6406
6284
  } };
6407
6285
  }
6408
- var Ns = class {
6286
+ var xs = class {
6409
6287
  _type;
6410
6288
  _channelName;
6411
6289
  _config;
@@ -6417,7 +6295,7 @@ var Ns = class {
6417
6295
  this._type = e, this._channelName = t, this._config = n;
6418
6296
  }
6419
6297
  request(e) {
6420
- const t = e.reqId ?? u();
6298
+ const t = e.reqId ?? h();
6421
6299
  return new Promise((n, s) => {
6422
6300
  const r = setTimeout(() => {
6423
6301
  this._pending.delete(t), s(/* @__PURE__ */ new Error("Request timeout"));
@@ -6475,12 +6353,12 @@ var Ns = class {
6475
6353
  get state() {
6476
6354
  return this._state;
6477
6355
  }
6478
- }, ct = class extends Ns {
6356
+ }, nt = class extends xs {
6479
6357
  _target;
6480
6358
  _sendFn;
6481
6359
  _cleanup = null;
6482
6360
  constructor(e, t) {
6483
- super(ie(e), t.channelName, t), this._target = e, this._sendFn = y(e), this._setupListener();
6361
+ super(Z(e), t.channelName, t), this._target = e, this._sendFn = g(e), this._setupListener();
6484
6362
  }
6485
6363
  _setupListener() {
6486
6364
  this._cleanup = m(this._target, (e) => this._handleMessage(e), (e) => this._subs.forEach((t) => t.error?.(e)), () => this._subs.forEach((e) => e.complete?.())), this._ready = !0, this._state.next("connected");
@@ -6492,7 +6370,7 @@ var Ns = class {
6492
6370
  this._cleanup?.(), super.close();
6493
6371
  }
6494
6372
  };
6495
- function j(e, t = {}, n = {}) {
6373
+ function $(e, t = {}, n = {}) {
6496
6374
  const s = {
6497
6375
  channelName: e,
6498
6376
  timeout: 3e4,
@@ -6501,10 +6379,10 @@ function j(e, t = {}, n = {}) {
6501
6379
  };
6502
6380
  if (t.worker) {
6503
6381
  const i = t.worker.existing ?? new Worker(t.worker.scriptUrl, t.worker.options);
6504
- return new ct(i, s);
6382
+ return new nt(i, s);
6505
6383
  }
6506
6384
  if (t.sharedWorker) {
6507
- const i = new ve(t.sharedWorker.scriptUrl, e, t.sharedWorker.options);
6385
+ const i = new me(t.sharedWorker.scriptUrl, e, t.sharedWorker.options);
6508
6386
  return {
6509
6387
  send: (o, a) => i.send(o, a),
6510
6388
  request: (o) => i.request(o),
@@ -6516,7 +6394,7 @@ function j(e, t = {}, n = {}) {
6516
6394
  };
6517
6395
  }
6518
6396
  if (t.websocket) {
6519
- const i = pt(t.websocket.url, {
6397
+ const i = lt(t.websocket.url, {
6520
6398
  protocols: t.websocket.protocols,
6521
6399
  reconnect: t.websocket.reconnect
6522
6400
  }), o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
@@ -6534,16 +6412,16 @@ function j(e, t = {}, n = {}) {
6534
6412
  }
6535
6413
  }), {
6536
6414
  send: (c, l) => i.send(c, l),
6537
- request: (c) => new Promise((l, h) => {
6538
- const p = c.reqId ?? u(), w = setTimeout(() => {
6539
- a.delete(p), h(/* @__PURE__ */ new Error("Request timeout"));
6415
+ request: (c) => new Promise((l, u) => {
6416
+ const p = c.reqId ?? h(), y = setTimeout(() => {
6417
+ a.delete(p), u(/* @__PURE__ */ new Error("Request timeout"));
6540
6418
  }, s.timeout);
6541
6419
  a.set(p, {
6542
- resolve: (S) => {
6543
- clearTimeout(w), l(S);
6420
+ resolve: (x) => {
6421
+ clearTimeout(y), l(x);
6544
6422
  },
6545
- reject: (S) => {
6546
- clearTimeout(w), h(S);
6423
+ reject: (x) => {
6424
+ clearTimeout(y), u(x);
6547
6425
  },
6548
6426
  timestamp: Date.now()
6549
6427
  }), i.send({
@@ -6568,11 +6446,11 @@ function j(e, t = {}, n = {}) {
6568
6446
  };
6569
6447
  }
6570
6448
  if (t.broadcast) {
6571
- const i = _t(t.broadcast.name ?? e);
6572
- return new ct(i.channel, s);
6449
+ const i = ht(t.broadcast.name ?? e);
6450
+ return new nt(i.channel, s);
6573
6451
  }
6574
6452
  if (t.port?.port) {
6575
- const i = new H(t.port.port, e, t.port.config);
6453
+ const i = new B(t.port.port, e, t.port.config);
6576
6454
  return {
6577
6455
  send: (o, a) => i.send(o, a),
6578
6456
  request: (o) => i.request(o),
@@ -6585,7 +6463,7 @@ function j(e, t = {}, n = {}) {
6585
6463
  }
6586
6464
  if (t.chrome) {
6587
6465
  if (t.chrome.mode === "runtime") {
6588
- const i = new He(void 0, t.chrome.options);
6466
+ const i = new We(void 0, t.chrome.options);
6589
6467
  return {
6590
6468
  send: (o) => i.send(o),
6591
6469
  request: (o) => i.request(o),
@@ -6597,7 +6475,7 @@ function j(e, t = {}, n = {}) {
6597
6475
  };
6598
6476
  }
6599
6477
  if (t.chrome.mode === "tabs") {
6600
- const i = new Ge(t.chrome.tabId, t.chrome.options);
6478
+ const i = new $e(t.chrome.tabId, t.chrome.options);
6601
6479
  return {
6602
6480
  send: (o) => i.send(o),
6603
6481
  request: () => Promise.reject("Not supported"),
@@ -6609,7 +6487,7 @@ function j(e, t = {}, n = {}) {
6609
6487
  };
6610
6488
  }
6611
6489
  if (t.chrome.mode === "port") {
6612
- const i = new je(t.chrome.portName ?? e, t.chrome.tabId);
6490
+ const i = new Fe(t.chrome.portName ?? e, t.chrome.tabId);
6613
6491
  return {
6614
6492
  send: (o) => i.send(o),
6615
6493
  request: () => Promise.reject("Not supported"),
@@ -6621,7 +6499,7 @@ function j(e, t = {}, n = {}) {
6621
6499
  };
6622
6500
  }
6623
6501
  if (t.chrome.mode === "external") {
6624
- const i = new Qt(t.chrome.options?.extensionId);
6502
+ const i = new Ft(t.chrome.options?.extensionId);
6625
6503
  return {
6626
6504
  send: (o) => i.send(o),
6627
6505
  request: () => Promise.reject("Not supported"),
@@ -6634,7 +6512,7 @@ function j(e, t = {}, n = {}) {
6634
6512
  }
6635
6513
  }
6636
6514
  if (t.socketio) {
6637
- const i = new we(t.socketio.socket, e, t.socketio.options);
6515
+ const i = new _e(t.socketio.socket, e, t.socketio.options);
6638
6516
  return {
6639
6517
  send: (o) => i.send(o),
6640
6518
  request: (o) => i.request(o),
@@ -6647,10 +6525,10 @@ function j(e, t = {}, n = {}) {
6647
6525
  }
6648
6526
  if (t.serviceWorker) {
6649
6527
  if (t.serviceWorker.mode === "host") {
6650
- const i = new Ye({
6528
+ const i = new He({
6651
6529
  channelName: e,
6652
6530
  ...t.serviceWorker.config ?? {}
6653
- }), o = qs(i);
6531
+ }), o = Cs(i);
6654
6532
  return {
6655
6533
  send: (a) => {
6656
6534
  i.broadcastToAll(a);
@@ -6664,7 +6542,7 @@ function j(e, t = {}, n = {}) {
6664
6542
  };
6665
6543
  }
6666
6544
  if (t.serviceWorker.mode === "client") {
6667
- const i = new Je(e);
6545
+ const i = new Ge(e);
6668
6546
  return i.connect(), {
6669
6547
  send: (o) => i.emit(o.type, o.payload, o.channel),
6670
6548
  request: (o) => i.request(o.payload?.action ?? "unknown", o.payload),
@@ -6677,7 +6555,7 @@ function j(e, t = {}, n = {}) {
6677
6555
  }
6678
6556
  }
6679
6557
  if (t.atomics) {
6680
- const i = new le(e, t.atomics.sendBuffer, t.atomics.recvBuffer, t.atomics.config);
6558
+ const i = new se(e, t.atomics.sendBuffer, t.atomics.recvBuffer, t.atomics.config);
6681
6559
  return {
6682
6560
  send: (o, a) => i.send(o),
6683
6561
  request: (o) => i.request(o),
@@ -6690,7 +6568,7 @@ function j(e, t = {}, n = {}) {
6690
6568
  }
6691
6569
  if (t.rtc) {
6692
6570
  if (t.rtc.mode === "peer") {
6693
- const i = new Ce(e, t.rtc.config);
6571
+ const i = new ge(e, t.rtc.config);
6694
6572
  return {
6695
6573
  send: (o) => i.send(o),
6696
6574
  request: (o) => i.request(o),
@@ -6702,7 +6580,7 @@ function j(e, t = {}, n = {}) {
6702
6580
  };
6703
6581
  }
6704
6582
  if (t.rtc.mode === "manager") {
6705
- const i = new Qe(e, t.rtc.config);
6583
+ const i = new je(e, t.rtc.config);
6706
6584
  return {
6707
6585
  send: (o) => i.broadcast(o),
6708
6586
  request: () => Promise.reject("Use manager.request(peerId, msg) directly"),
@@ -6725,7 +6603,7 @@ function j(e, t = {}, n = {}) {
6725
6603
  isReady: !0
6726
6604
  };
6727
6605
  }
6728
- var Os = class {
6606
+ var ks = class {
6729
6607
  _transports = /* @__PURE__ */ new Map();
6730
6608
  register(e, t) {
6731
6609
  this._transports.set(e, t);
@@ -6735,7 +6613,7 @@ var Os = class {
6735
6613
  }
6736
6614
  getOrCreate(e, t = {}, n = {}) {
6737
6615
  let s = this._transports.get(e);
6738
- return s || (s = j(e, t, n), this._transports.set(e, s)), s;
6616
+ return s || (s = $(e, t, n), this._transports.set(e, s)), s;
6739
6617
  }
6740
6618
  remove(e) {
6741
6619
  const t = this._transports.get(e);
@@ -6751,55 +6629,55 @@ var Os = class {
6751
6629
  get size() {
6752
6630
  return this._transports.size;
6753
6631
  }
6754
- }, Me = null;
6755
- function Ds() {
6756
- return Me || (Me = new Os()), Me;
6632
+ }, Se = null;
6633
+ function Ss() {
6634
+ return Se || (Se = new ks()), Se;
6757
6635
  }
6758
- var Ai = {
6759
- create: j,
6760
- registry: Ds,
6761
- fromWorker: (e, t, n) => j(t, { worker: { existing: e } }, n),
6762
- fromPort: (e, t, n) => j(t, { port: { port: e } }, n),
6763
- fromWebSocket: (e, t, n) => j(t, { websocket: { url: e } }, n),
6764
- fromBroadcast: (e, t) => j(e, { broadcast: {} }, t),
6636
+ var vi = {
6637
+ create: $,
6638
+ registry: Ss,
6639
+ fromWorker: (e, t, n) => $(t, { worker: { existing: e } }, n),
6640
+ fromPort: (e, t, n) => $(t, { port: { port: e } }, n),
6641
+ fromWebSocket: (e, t, n) => $(t, { websocket: { url: e } }, n),
6642
+ fromBroadcast: (e, t) => $(e, { broadcast: {} }, t),
6765
6643
  sharedWorker: {
6766
- client: (e, t, n) => new ve(e, t, n),
6767
- host: (e) => new Ve(e)
6644
+ client: (e, t, n) => new me(e, t, n),
6645
+ host: (e) => new Ue(e)
6768
6646
  },
6769
6647
  atomics: {
6770
- create: (e, t, n, s) => new le(e, t, n, s),
6771
- createPair: Jt,
6772
- buffer: (e) => new V(e),
6773
- ringBuffer: () => new Xt()
6648
+ create: (e, t, n, s) => new se(e, t, n, s),
6649
+ createPair: zt,
6650
+ buffer: (e) => new F(e),
6651
+ ringBuffer: () => new Ht()
6774
6652
  },
6775
6653
  rtc: {
6776
- peer: (e, t) => new Ce(e, t),
6777
- manager: (e, t) => new Qe(e, t),
6778
- signaling: Zt
6654
+ peer: (e, t) => new ge(e, t),
6655
+ manager: (e, t) => new je(e, t),
6656
+ signaling: Gt
6779
6657
  },
6780
6658
  port: {
6781
- create: (e, t, n) => new H(e, t, n),
6782
- createPair: xe,
6783
- pool: (e) => new en(e),
6784
- windowConnector: (e, t) => new qe(e, t)
6659
+ create: (e, t, n) => new B(e, t, n),
6660
+ createPair: be,
6661
+ pool: (e) => new Qt(e),
6662
+ windowConnector: (e, t) => new Te(e, t)
6785
6663
  },
6786
6664
  storage: {
6787
- create: (e) => new Ke(e),
6788
- messageQueue: (e) => new tn(e)
6665
+ create: (e) => new ze(e),
6666
+ messageQueue: (e) => new Vt(e)
6789
6667
  },
6790
6668
  serviceWorker: {
6791
- host: (e) => new Ye(e),
6792
- client: (e) => new Je(e)
6669
+ host: (e) => new He(e),
6670
+ client: (e) => new Ge(e)
6793
6671
  },
6794
- socketio: (e, t, n) => new we(e, t, n),
6672
+ socketio: (e, t, n) => new _e(e, t, n),
6795
6673
  chrome: {
6796
- runtime: (e) => new He(void 0, e),
6797
- tabs: (e, t) => new Ge(e, t),
6798
- port: (e, t) => new je(e, t)
6674
+ runtime: (e) => new We(void 0, e),
6675
+ tabs: (e, t) => new $e(e, t),
6676
+ port: (e, t) => new Fe(e, t)
6799
6677
  },
6800
- detect: ie,
6801
- meta: dt
6802
- }, Ls = class {
6678
+ detect: Z,
6679
+ meta: at
6680
+ }, Es = class {
6803
6681
  config;
6804
6682
  onChannelReady;
6805
6683
  underlyingChannel = null;
@@ -6817,7 +6695,7 @@ var Ai = {
6817
6695
  async request(e, t = []) {
6818
6696
  return this.isConnected && this.underlyingChannel ? this.underlyingChannel.request(e, t) : new Promise((n, s) => {
6819
6697
  const r = {
6820
- id: u(),
6698
+ id: h(),
6821
6699
  method: e,
6822
6700
  args: t,
6823
6701
  resolve: n,
@@ -6855,7 +6733,7 @@ var Ai = {
6855
6733
  close() {
6856
6734
  this.rejectAllQueued(/* @__PURE__ */ new Error("Channel closed")), this.underlyingChannel?.close(), this.underlyingChannel = null, this.isConnected = !1, this.connectionPromise = null;
6857
6735
  }
6858
- }, Bs = async () => {
6736
+ }, Is = async () => {
6859
6737
  const e = await chrome.tabs.query({
6860
6738
  active: !0,
6861
6739
  currentWindow: !0
@@ -6863,20 +6741,20 @@ var Ai = {
6863
6741
  if (e.length === 0) throw new Error("No active tab found");
6864
6742
  if (!e[0].id) throw new Error("Active tab has no ID");
6865
6743
  return e[0].id;
6866
- }, Ri = async () => {
6744
+ }, Ci = async () => {
6867
6745
  try {
6868
- return await Bs();
6746
+ return await Is();
6869
6747
  } catch {
6870
6748
  const e = (await chrome.tabs.query({ currentWindow: !0 })).find((t) => t.active);
6871
6749
  if (!e?.id) throw new Error("No visible tab found");
6872
6750
  return e.id;
6873
6751
  }
6874
- }, qi = (e, t = "worker") => {
6875
- const n = We(t ?? "worker");
6752
+ }, xi = (e, t = "worker") => {
6753
+ const n = Oe(t ?? "worker");
6876
6754
  return Object.keys(e).forEach((s) => {
6877
6755
  e[s];
6878
6756
  }), n;
6879
- }, nn = class {
6757
+ }, Kt = class {
6880
6758
  channel = null;
6881
6759
  isChannelReady = !1;
6882
6760
  pendingRequests = /* @__PURE__ */ new Map();
@@ -6900,7 +6778,7 @@ var Ai = {
6900
6778
  async request(e, t, n) {
6901
6779
  if (!this.isChannelReady || !this.channel) return new Promise((i, o) => {
6902
6780
  const a = {
6903
- id: u(),
6781
+ id: h(),
6904
6782
  method: e,
6905
6783
  args: [t],
6906
6784
  resolve: i,
@@ -6912,7 +6790,7 @@ var Ai = {
6912
6790
  const s = {
6913
6791
  ...this.options,
6914
6792
  ...n
6915
- }, r = u();
6793
+ }, r = h();
6916
6794
  return new Promise((i, o) => {
6917
6795
  const a = setTimeout(() => {
6918
6796
  this.pendingRequests.delete(r), o(/* @__PURE__ */ new Error(`Request timeout: ${e}`));
@@ -6944,7 +6822,7 @@ var Ai = {
6944
6822
  }
6945
6823
  notify(e, t) {
6946
6824
  const n = {
6947
- id: u(),
6825
+ id: h(),
6948
6826
  type: e,
6949
6827
  payload: t,
6950
6828
  timestamp: Date.now()
@@ -6962,7 +6840,7 @@ var Ai = {
6962
6840
  flushBatch() {
6963
6841
  if (this.messageQueue.length === 0) return;
6964
6842
  const e = {
6965
- id: u(),
6843
+ id: h(),
6966
6844
  type: "batch",
6967
6845
  payload: this.messageQueue,
6968
6846
  timestamp: Date.now()
@@ -6989,7 +6867,7 @@ var Ai = {
6989
6867
  clearTimeout(n), t(/* @__PURE__ */ new Error("Channel closed"));
6990
6868
  this.pendingRequests.clear(), this.channel?.close?.();
6991
6869
  }
6992
- }, sn = class rn {
6870
+ }, Yt = class Jt {
6993
6871
  db = null;
6994
6872
  dbPromise = null;
6995
6873
  options;
@@ -6998,14 +6876,14 @@ var Ai = {
6998
6876
  dbName: t.dbName ?? "UniformMessageQueue",
6999
6877
  storeName: t.storeName ?? "messages",
7000
6878
  maxRetries: t.maxRetries ?? 3,
7001
- defaultExpirationMs: t.defaultExpirationMs ?? 1440 * 60 * 1e3,
6879
+ defaultExpirationMs: t.defaultExpirationMs ?? 864e5,
7002
6880
  fallbackStorageKey: t.fallbackStorageKey ?? "uniform_message_queue"
7003
6881
  };
7004
6882
  }
7005
6883
  async initDB() {
7006
6884
  if (this.db) return this.db;
7007
6885
  if (this.dbPromise) return this.dbPromise;
7008
- if (!rn.isIndexedDBAvailable())
6886
+ if (!Jt.isIndexedDBAvailable())
7009
6887
  return console.warn("[MessageQueue] IndexedDB not available, using sessionStorage fallback"), null;
7010
6888
  this.dbPromise = new Promise((t, n) => {
7011
6889
  const s = indexedDB.open(this.options.dbName, 1);
@@ -7171,19 +7049,19 @@ var Ai = {
7171
7049
  return !1;
7172
7050
  }
7173
7051
  }
7174
- }, Ae = /* @__PURE__ */ new Map();
7175
- function Ws(e) {
7052
+ }, Ee = /* @__PURE__ */ new Map();
7053
+ function Ts(e) {
7176
7054
  const t = e?.dbName ?? "default";
7177
- return Ae.has(t) || Ae.set(t, new sn(e)), Ae.get(t);
7055
+ return Ee.has(t) || Ee.set(t, new Yt(e)), Ee.get(t);
7178
7056
  }
7179
- function Ni(e) {
7180
- return new sn(e);
7057
+ function ki(e) {
7058
+ return new Yt(e);
7181
7059
  }
7182
- var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7183
- lt || (lt = !0, chrome?.runtime?.onMessage?.addListener?.((e, t, n) => {
7060
+ var T = /* @__PURE__ */ new Map(), st = !1, Xt = () => {
7061
+ st || (st = !0, chrome?.runtime?.onMessage?.addListener?.((e, t, n) => {
7184
7062
  const s = e?.channelName ?? e?.target;
7185
7063
  if (!s) return;
7186
- const r = M.get(s);
7064
+ const r = T.get(s);
7187
7065
  if (!r || r.size === 0) return;
7188
7066
  const i = {
7189
7067
  data: e,
@@ -7198,20 +7076,20 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7198
7076
  }
7199
7077
  return !0;
7200
7078
  }));
7201
- }, an = class {
7079
+ }, Zt = class {
7202
7080
  channelName;
7203
7081
  listeners = /* @__PURE__ */ new Set();
7204
7082
  constructor(e) {
7205
- this.channelName = e, on();
7083
+ this.channelName = e, Xt();
7206
7084
  }
7207
7085
  addEventListener(e, t) {
7208
7086
  if (e !== "message") return;
7209
7087
  this.listeners.add(t);
7210
- let n = M.get(this.channelName);
7211
- n || (n = /* @__PURE__ */ new Set(), M.set(this.channelName, n)), n.add(t);
7088
+ let n = T.get(this.channelName);
7089
+ n || (n = /* @__PURE__ */ new Set(), T.set(this.channelName, n)), n.add(t);
7212
7090
  }
7213
7091
  removeEventListener(e, t) {
7214
- e === "message" && (this.listeners.delete(t), M.get(this.channelName)?.delete(t));
7092
+ e === "message" && (this.listeners.delete(t), T.get(this.channelName)?.delete(t));
7215
7093
  }
7216
7094
  postMessage(e) {
7217
7095
  const t = {
@@ -7223,10 +7101,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7223
7101
  });
7224
7102
  }
7225
7103
  close() {
7226
- for (const e of this.listeners) M.get(this.channelName)?.delete(e);
7104
+ for (const e of this.listeners) T.get(this.channelName)?.delete(e);
7227
7105
  this.listeners.clear();
7228
7106
  }
7229
- }, $s = class {
7107
+ }, Ps = class {
7230
7108
  wrappedByOriginal = /* @__PURE__ */ new Map();
7231
7109
  wrappedListeners = /* @__PURE__ */ new Set();
7232
7110
  channelName;
@@ -7237,7 +7115,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7237
7115
  this.channelName = e, this.mode = t?.mode || "broadcast", this.tabFilter = t?.tabFilter, this.tabIdGetter = t?.tabIdGetter || this.getCurrentTabId, this.startListening();
7238
7116
  }
7239
7117
  startListening() {
7240
- on();
7118
+ Xt();
7241
7119
  }
7242
7120
  addEventListener(e, t) {
7243
7121
  if (e !== "message" || this.wrappedByOriginal.get(t)) return;
@@ -7256,13 +7134,13 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7256
7134
  }
7257
7135
  };
7258
7136
  this.wrappedByOriginal.set(t, n), this.wrappedListeners.add(n);
7259
- let s = M.get(this.channelName);
7260
- s || (s = /* @__PURE__ */ new Set(), M.set(this.channelName, s)), s.add(n);
7137
+ let s = T.get(this.channelName);
7138
+ s || (s = /* @__PURE__ */ new Set(), T.set(this.channelName, s)), s.add(n);
7261
7139
  }
7262
7140
  removeEventListener(e, t) {
7263
7141
  if (e !== "message") return;
7264
7142
  const n = this.wrappedByOriginal.get(t);
7265
- n && (this.wrappedByOriginal.delete(t), this.wrappedListeners.delete(n), M.get(this.channelName)?.delete(n));
7143
+ n && (this.wrappedByOriginal.delete(t), this.wrappedListeners.delete(n), T.get(this.channelName)?.delete(n));
7266
7144
  }
7267
7145
  sendToTab(e, t) {
7268
7146
  const n = {
@@ -7328,10 +7206,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7328
7206
  return this.tabIdGetter ? await this.tabIdGetter() : 0;
7329
7207
  }
7330
7208
  close() {
7331
- for (const e of this.wrappedListeners) M.get(this.channelName)?.delete(e);
7209
+ for (const e of this.wrappedListeners) T.get(this.channelName)?.delete(e);
7332
7210
  this.wrappedListeners.clear(), this.wrappedByOriginal.clear();
7333
7211
  }
7334
- }, Oi = class {
7212
+ }, Si = class {
7335
7213
  port;
7336
7214
  channelName;
7337
7215
  listeners = /* @__PURE__ */ new Set();
@@ -7366,31 +7244,31 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7366
7244
  close() {
7367
7245
  this.listeners.clear(), this.port?.disconnect?.();
7368
7246
  }
7369
- }, Di = async (e) => {
7247
+ }, Ei = async (e) => {
7370
7248
  let t;
7371
7249
  try {
7372
7250
  if (typeof e.script != "string") throw new Error("Chrome extension worker channel requires config.script to be a string path");
7373
7251
  t = new Worker(chrome.runtime.getURL(e.script), e.options);
7374
7252
  } catch {
7375
- typeof e.script == "string" ? t = new Worker(q(e.script), e.options) : typeof e.script == "function" ? t = e.script() : t = e.script;
7253
+ typeof e.script == "string" ? t = new Worker(P(e.script), e.options) : typeof e.script == "function" ? t = e.script() : t = e.script;
7376
7254
  }
7377
- const n = await X(e.name, {}, t);
7255
+ const n = await G(e.name, {}, t);
7378
7256
  return n?.remote ?? n;
7379
- }, Li = (e) => new an(e), Bi = (e) => {
7380
- const t = X(e, {}, new an(e));
7381
- return t?.remote ?? t;
7382
- }, Fs = (e, t) => {
7383
- const n = X(e, {}, new $s(e, t));
7257
+ }, Ii = (e) => new Zt(e), Ti = (e) => {
7258
+ const t = new Zt(e), n = G(e, {}, t);
7384
7259
  return n?.remote ?? n;
7385
- }, Wi = (e, t) => Fs(e, t), $i = (e = "$host$") => We(e ?? "$host$"), Fi = (e, t) => new Ls(e, t), Us = async (e) => ({
7260
+ }, Ms = (e, t) => {
7261
+ const n = new Ps(e, t), s = G(e, {}, n);
7262
+ return s?.remote ?? s;
7263
+ }, Pi = (e, t) => Ms(e, t), Mi = (e = "$host$") => Oe(e ?? "$host$"), Ai = (e, t) => new Es(e, t), As = async (e) => ({
7386
7264
  async request(t, n = []) {
7387
7265
  return new Promise((s, r) => {
7388
- const i = new BroadcastChannel(`${e.name}-sw-channel`), o = u(), a = setTimeout(() => {
7266
+ const i = new BroadcastChannel(`${e.name}-sw-channel`), o = h(), a = setTimeout(() => {
7389
7267
  i.close(), r(/* @__PURE__ */ new Error(`Service worker request timeout: ${t}`));
7390
7268
  }, 1e4);
7391
7269
  i.onmessage = (c) => {
7392
- const { id: l, result: h, error: p } = c.data;
7393
- l === o && (clearTimeout(a), i.close(), p ? r(new Error(p)) : s(h));
7270
+ const { id: l, result: u, error: p } = c.data;
7271
+ l === o && (clearTimeout(a), i.close(), p ? r(new Error(p)) : s(u));
7394
7272
  }, i.postMessage({
7395
7273
  id: o,
7396
7274
  type: "request",
@@ -7401,80 +7279,83 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7401
7279
  },
7402
7280
  close() {
7403
7281
  }
7404
- }), cn = async (e) => {
7282
+ }), en = async (e) => {
7405
7283
  const t = e.context;
7406
- if (t === "service-worker") return Us(e);
7284
+ if (t === "service-worker") return As(e);
7407
7285
  let n;
7408
7286
  if (typeof e.script == "function") n = e.script();
7409
7287
  else if (e.script instanceof Worker) n = e.script;
7410
7288
  else if (t === "chrome-extension") try {
7411
7289
  n = new Worker(chrome.runtime.getURL(e.script), e.options);
7412
7290
  } catch {
7413
- n = new Worker(q(e.script), e.options);
7414
- }
7415
- else n = new Worker(q(e.script), e.options);
7416
- return await X(e.name, {}, n);
7417
- }, Ui = async (e, t) => new nn(await cn(e), t), zs = (e, t, n) => {
7418
- const s = new nn(null, t, n);
7419
- return cn(e).then((r) => {
7291
+ n = new Worker(P(e.script), e.options);
7292
+ }
7293
+ else n = new Worker(P(e.script), e.options);
7294
+ return await G(e.name, {}, n);
7295
+ }, Ri = async (e, t) => {
7296
+ const n = await en(e);
7297
+ return new Kt(n, t);
7298
+ }, Rs = (e, t, n) => {
7299
+ const s = new Kt(null, t, n);
7300
+ return en(e).then((r) => {
7420
7301
  s.setChannel(r);
7421
7302
  }).catch((r) => {
7422
7303
  console.error("[createQueuedOptimizedWorkerChannel] Failed to create base channel:", r), s.close();
7423
7304
  }), s;
7424
- }, Hs = /* @__PURE__ */ new Set([
7305
+ }, qs = /* @__PURE__ */ new Set([
7425
7306
  "invoke",
7426
7307
  "mail",
7427
7308
  "attach",
7428
7309
  "deliver",
7429
7310
  "defer"
7430
- ]), Gs = /* @__PURE__ */ new Set([
7311
+ ]), Ns = /* @__PURE__ */ new Set([
7431
7312
  "request",
7432
7313
  "response",
7433
7314
  "invoke",
7434
7315
  "ack",
7435
7316
  "act",
7436
7317
  "ask"
7437
- ]), ut = "mail", E = (e) => String(e ?? "").trim(), js = (e) => {
7318
+ ]), rt = "mail", k = (e) => String(e ?? "").trim(), Os = (e) => {
7438
7319
  if (!e) return;
7439
- const t = (Array.isArray(e) ? e : [e]).map(E).filter(Boolean);
7320
+ const t = (Array.isArray(e) ? e : [e]).map(k).filter(Boolean);
7440
7321
  return t.length > 0 ? t : void 0;
7441
- }, Vs = (e) => {
7322
+ }, Ds = (e) => {
7442
7323
  if (e != null)
7443
7324
  return Array.isArray(e) ? e : [e];
7444
- }, Qs = (e) => {
7325
+ }, Ls = (e) => {
7445
7326
  if (e != null)
7446
7327
  return Array.isArray(e) ? e : [e];
7447
- }, Ks = (e) => {
7448
- const t = Array.isArray(e) ? e : e ? [e] : [ut], n = [];
7449
- for (const s of t) Hs.has(s) && !n.includes(s) && n.push(s);
7450
- return n.length > 0 ? n : [ut];
7451
- }, Ys = (e) => {
7452
- const t = E(e.type);
7453
- if (Gs.has(t)) return t;
7454
- const n = E(e.op);
7328
+ }, Bs = (e) => {
7329
+ const t = Array.isArray(e) ? e : e ? [e] : [rt], n = [];
7330
+ for (const s of t) qs.has(s) && !n.includes(s) && n.push(s);
7331
+ return n.length > 0 ? n : [rt];
7332
+ }, Ws = (e) => {
7333
+ const t = k(e.type);
7334
+ if (Ns.has(t)) return t;
7335
+ const n = k(e.op);
7455
7336
  return n === "get" || n === "set" || n === "apply" || n === "import" ? "invoke" : e.error ? "response" : "request";
7456
- }, Js = (e, t) => e.op ? e.op : t === "invoke" ? "invoke" : t === "act" ? "deliver" : "mail", Xs = (e) => {
7457
- const t = E(e).toLowerCase();
7337
+ }, $s = (e, t) => e.op ? e.op : t === "invoke" ? "invoke" : t === "act" ? "deliver" : "mail", Fs = (e) => {
7338
+ const t = k(e).toLowerCase();
7458
7339
  return t || "unknown";
7459
- }, Zs = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `uniform_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`, Ne = (e) => {
7460
- const t = Number.isFinite(e.timestamp) ? Number(e.timestamp) : Date.now(), n = E(e.srcChannel ?? e.source) || "uniform", s = E(e.destination), r = e.dstChannel ?? (s || void 0), i = E(e.uuid ?? e.id) || Zs(), o = Ys(e), a = e.payload ?? e.data, c = { ...e.metadata ?? {} };
7340
+ }, Us = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `uniform_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`, Pe = (e) => {
7341
+ const t = Number.isFinite(e.timestamp) ? Number(e.timestamp) : Date.now(), n = k(e.srcChannel ?? e.source) || "uniform", s = k(e.destination), r = e.dstChannel ?? (s || void 0), i = k(e.uuid ?? e.id) || Us(), o = Ws(e), a = e.payload ?? e.data, c = { ...e.metadata ?? {} };
7461
7342
  return {
7462
- purpose: Ks(e.purpose),
7463
- protocol: Xs(e.protocol),
7343
+ purpose: Bs(e.purpose),
7344
+ protocol: Fs(e.protocol),
7464
7345
  redirect: !!e.redirect,
7465
7346
  flags: { ...e.flags ?? {} },
7466
7347
  type: o,
7467
- path: js(e.path),
7348
+ path: Os(e.path),
7468
7349
  result: e.result,
7469
- args: Vs(e.args),
7470
- op: Js(e, o),
7350
+ args: Ds(e.args),
7351
+ op: $s(e, o),
7471
7352
  error: e.error ? String(e.error) : void 0,
7472
7353
  timestamp: t,
7473
- where: E(e.where) || void 0,
7354
+ where: k(e.where) || void 0,
7474
7355
  uuid: i,
7475
- bridges: Array.isArray(e.bridges) ? e.bridges.map(E).filter(Boolean) : [],
7356
+ bridges: Array.isArray(e.bridges) ? e.bridges.map(k).filter(Boolean) : [],
7476
7357
  payload: a,
7477
- transfer: Qs(e.transfer),
7358
+ transfer: Ls(e.transfer),
7478
7359
  extension: e.extension,
7479
7360
  defer: e.defer,
7480
7361
  srcChannel: n,
@@ -7483,14 +7364,14 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7483
7364
  source: n,
7484
7365
  destination: s || void 0,
7485
7366
  data: a,
7486
- contentType: E(e.contentType) || void 0,
7367
+ contentType: k(e.contentType) || void 0,
7487
7368
  metadata: c
7488
7369
  };
7489
- }, er = (e) => {
7370
+ }, js = (e) => {
7490
7371
  if (!e || typeof e != "object") return !1;
7491
7372
  const t = e;
7492
7373
  return typeof t.uuid == "string" && typeof t.srcChannel == "string" && Array.isArray(t.purpose) && typeof t.type == "string";
7493
- }, ht = (e) => (er(e), Ne(e)), tr = class {
7374
+ }, it = (e) => (js(e), Pe(e)), zs = class {
7494
7375
  seen = /* @__PURE__ */ new Map();
7495
7376
  windowMs;
7496
7377
  constructor(e = 300) {
@@ -7503,12 +7384,12 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7503
7384
  prune(e) {
7504
7385
  for (const [t, n] of this.seen.entries()) e - n > this.windowMs && this.seen.delete(t);
7505
7386
  }
7506
- }, nr = class {
7387
+ }, Hs = class {
7507
7388
  storageKey;
7508
7389
  maxMessages;
7509
7390
  defaultTTLMs;
7510
7391
  constructor(e) {
7511
- this.storageKey = e?.storageKey ?? "uniform-messaging-pending", this.maxMessages = e?.maxMessages ?? 200, this.defaultTTLMs = e?.defaultTTLMs ?? 1440 * 60 * 1e3;
7392
+ this.storageKey = e?.storageKey ?? "uniform-messaging-pending", this.maxMessages = e?.maxMessages ?? 200, this.defaultTTLMs = e?.defaultTTLMs ?? 864e5;
7512
7393
  }
7513
7394
  read() {
7514
7395
  if (typeof window > "u" || typeof localStorage > "u") return [];
@@ -7554,7 +7435,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7554
7435
  clear() {
7555
7436
  this.write([]);
7556
7437
  }
7557
- }, ln = class {
7438
+ }, tn = class {
7558
7439
  handlers = /* @__PURE__ */ new Map();
7559
7440
  channels = /* @__PURE__ */ new Map();
7560
7441
  workerChannels = /* @__PURE__ */ new Map();
@@ -7567,10 +7448,10 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7567
7448
  executionContext;
7568
7449
  channelMappings;
7569
7450
  componentRegistry = /* @__PURE__ */ new Map();
7570
- replayGuard = new tr(300);
7451
+ replayGuard = new zs(300);
7571
7452
  localChannelId = "";
7572
7453
  constructor(e = {}) {
7573
- this.executionContext = Be(), this.localChannelId = `${this.executionContext}:${Math.random().toString(36).slice(2, 10)}`, this.channelMappings = e.channelMappings ?? {}, this.messageQueue = Ws(e.queueOptions), this.pendingStore = new nr(e.pendingStoreOptions), this.setupGlobalListeners();
7454
+ this.executionContext = Ne(), this.localChannelId = `${this.executionContext}:${Math.random().toString(36).slice(2, 10)}`, this.channelMappings = e.channelMappings ?? {}, this.messageQueue = Ts(e.queueOptions), this.pendingStore = new Hs(e.pendingStoreOptions), this.setupGlobalListeners();
7574
7455
  }
7575
7456
  registerHandler(e, t) {
7576
7457
  this.handlers.has(e) || this.handlers.set(e, []), this.handlers.get(e).push(t);
@@ -7591,7 +7472,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7591
7472
  })), !1);
7592
7473
  }
7593
7474
  async processMessage(e) {
7594
- const t = ht(e);
7475
+ const t = it(e);
7595
7476
  if (!this.replayGuard.accept(t)) return;
7596
7477
  const n = t.destination ?? "general", s = this.handlers.get(n) ?? [];
7597
7478
  for (const r of s) if (r.canHandle(t)) try {
@@ -7601,7 +7482,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7601
7482
  }
7602
7483
  }
7603
7484
  async tryDeliverMessage(e) {
7604
- const t = ht(e);
7485
+ const t = it(e);
7605
7486
  if (t.destination && this.handlers.has(t.destination))
7606
7487
  return await this.processMessage(t), !0;
7607
7488
  const n = this.getChannelForDestination(t.destination);
@@ -7627,7 +7508,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7627
7508
  console.log(`[UnifiedMessaging] Skipping worker '${s.name}' in ${this.executionContext} context`);
7628
7509
  continue;
7629
7510
  }
7630
- const r = zs({
7511
+ const r = Rs({
7631
7512
  name: s.name,
7632
7513
  script: s.script,
7633
7514
  options: s.options,
@@ -7700,7 +7581,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7700
7581
  for (const i of n.stages) {
7701
7582
  const o = i.timeout ?? r, a = i.retries ?? 0;
7702
7583
  for (let c = 0; c <= a; c++) try {
7703
- s = await Promise.race([i.handler(s), new Promise((l, h) => setTimeout(() => h(/* @__PURE__ */ new Error(`Stage '${i.name}' timeout`)), o))]);
7584
+ s = await Promise.race([i.handler(s), new Promise((l, u) => setTimeout(() => u(/* @__PURE__ */ new Error(`Stage '${i.name}' timeout`)), o))]);
7704
7585
  break;
7705
7586
  } catch (l) {
7706
7587
  if (c === a)
@@ -7768,7 +7649,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7768
7649
  if (this.executionContext === "chrome-extension") return "chrome-extension";
7769
7650
  }
7770
7651
  toProtocolMessage(e, t) {
7771
- return Ne({
7652
+ return Pe({
7772
7653
  ...e,
7773
7654
  id: e.id,
7774
7655
  type: e.type ?? "unknown",
@@ -7786,7 +7667,7 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7786
7667
  });
7787
7668
  }
7788
7669
  isWorkerSupported(e) {
7789
- return this.executionContext === "service-worker" ? !0 : this.executionContext === "chrome-extension" ? Fn() : !0;
7670
+ return this.executionContext === "service-worker" ? !0 : this.executionContext === "chrome-extension" ? Mn() : !0;
7790
7671
  }
7791
7672
  setupGlobalListeners() {
7792
7673
  typeof window < "u" && globalThis.addEventListener("message", (e) => {
@@ -7811,26 +7692,26 @@ var M = /* @__PURE__ */ new Map(), lt = !1, on = () => {
7811
7692
  for (const e of this.channels.values()) (e instanceof BroadcastChannel || e && "close" in e) && e.close();
7812
7693
  this.channels.clear(), this.workerChannels.clear(), this.handlers.clear(), this.pipelines.clear();
7813
7694
  }
7814
- }, Y = null;
7815
- function Xe(e) {
7816
- return Y || (Y = new ln(e)), Y;
7695
+ }, z = null;
7696
+ function Qe(e) {
7697
+ return z || (z = new tn(e)), z;
7817
7698
  }
7818
- function zi(e) {
7819
- return new ln(e);
7699
+ function qi(e) {
7700
+ return new tn(e);
7820
7701
  }
7821
- function Hi() {
7822
- Y && (Y.destroy(), Y = null);
7702
+ function Ni() {
7703
+ z && (z.destroy(), z = null);
7823
7704
  }
7824
- function Gi(e) {
7825
- return Xe().sendMessage(e);
7705
+ function Oi(e) {
7706
+ return Qe().sendMessage(e);
7826
7707
  }
7827
- function ji(e, t) {
7828
- Xe().registerHandler(e, t);
7708
+ function Di(e, t) {
7709
+ Qe().registerHandler(e, t);
7829
7710
  }
7830
- function Vi(e) {
7831
- return Xe().getBroadcastChannel(e);
7711
+ function Li(e) {
7712
+ return Qe().getBroadcastChannel(e);
7832
7713
  }
7833
- var un = class {
7714
+ var nn = class {
7834
7715
  channels = /* @__PURE__ */ new Map();
7835
7716
  readyPromises = /* @__PURE__ */ new Map();
7836
7717
  messageHandlers = /* @__PURE__ */ new Map();
@@ -7838,7 +7719,7 @@ var un = class {
7838
7719
  executionContext;
7839
7720
  logPrefix;
7840
7721
  constructor(e = {}) {
7841
- this.channelConfigs = e.channels ?? {}, this.logPrefix = e.logPrefix ?? "[ServiceChannels]", this.executionContext = Be(), console.log(`${this.logPrefix} Initialized in ${this.executionContext} context`);
7722
+ this.channelConfigs = e.channels ?? {}, this.logPrefix = e.logPrefix ?? "[ServiceChannels]", this.executionContext = Ne(), console.log(`${this.logPrefix} Initialized in ${this.executionContext} context`);
7842
7723
  }
7843
7724
  registerConfigs(e) {
7844
7725
  this.channelConfigs = {
@@ -7946,24 +7827,24 @@ var un = class {
7946
7827
  return this.executionContext;
7947
7828
  }
7948
7829
  };
7949
- function Qi(e) {
7950
- return new un(e);
7830
+ function Bi(e) {
7831
+ return new nn(e);
7951
7832
  }
7952
- var U = null;
7953
- function Ki(e) {
7954
- return U ? e?.channels && U.registerConfigs(e.channels) : U = new un(e), U;
7833
+ var O = null;
7834
+ function Wi(e) {
7835
+ return O ? e?.channels && O.registerConfigs(e.channels) : O = new nn(e), O;
7955
7836
  }
7956
- function Yi() {
7957
- U && (U.closeAll(), U = null);
7837
+ function $i() {
7838
+ O && (O.closeAll(), O = null);
7958
7839
  }
7959
- function Ji(e, t, n) {
7960
- const s = /* @__PURE__ */ new Map(), r = y(e);
7840
+ function Fi(e, t, n) {
7841
+ const s = /* @__PURE__ */ new Map(), r = g(e);
7961
7842
  return (i) => {
7962
- const o = (l) => l.type === "response" && l.reqId ? (h) => {
7843
+ const o = (l) => l.type === "response" && l.reqId ? (u) => {
7963
7844
  const p = s.get(l.reqId);
7964
- p && (p.resolve(h), s.delete(l.reqId));
7965
- } : l.type === "request" ? (h, p) => r({
7966
- ...h,
7845
+ p && (p.resolve(u), s.delete(l.reqId));
7846
+ } : l.type === "request" ? (u, p) => r({
7847
+ ...u,
7967
7848
  channel: l.sender,
7968
7849
  sender: t,
7969
7850
  type: "response",
@@ -7971,25 +7852,25 @@ function Ji(e, t, n) {
7971
7852
  }, p) : r, c = m(e, (l) => {
7972
7853
  if (i.active) {
7973
7854
  if (l.type === "response" && l.reqId) {
7974
- const h = s.get(l.reqId);
7975
- h && (h.resolve(l.payload), s.delete(l.reqId));
7855
+ const u = s.get(l.reqId);
7856
+ u && (u.resolve(l.payload), s.delete(l.reqId));
7976
7857
  }
7977
7858
  n ? n(l, o(l)) : i.next(l);
7978
7859
  }
7979
7860
  }, (l) => i.error(l), () => i.complete());
7980
7861
  return i.request = (l) => {
7981
- const h = l.reqId ?? u();
7982
- return l.reqId = h, new Promise((p, w) => {
7983
- s.set(h, {
7862
+ const u = l.reqId ?? h();
7863
+ return l.reqId = u, new Promise((p, y) => {
7864
+ s.set(u, {
7984
7865
  resolve: p,
7985
- reject: w,
7866
+ reject: y,
7986
7867
  timestamp: Date.now()
7987
7868
  }), r(l);
7988
7869
  });
7989
7870
  }, c;
7990
7871
  };
7991
7872
  }
7992
- var Xi = class {
7873
+ var Ui = class {
7993
7874
  _transport;
7994
7875
  _channelName;
7995
7876
  _pending = /* @__PURE__ */ new Map();
@@ -7998,7 +7879,7 @@ var Xi = class {
7998
7879
  _send;
7999
7880
  _active = !1;
8000
7881
  constructor(e, t) {
8001
- this._transport = e, this._channelName = t, this._send = y(e);
7882
+ this._transport = e, this._channelName = t, this._send = g(e);
8002
7883
  }
8003
7884
  subscribe(e) {
8004
7885
  return this._subs.add(e), this._active || this._activate(), { unsubscribe: () => {
@@ -8009,7 +7890,7 @@ var Xi = class {
8009
7890
  this._send(e, t);
8010
7891
  }
8011
7892
  request(e) {
8012
- const t = e.reqId ?? u();
7893
+ const t = e.reqId ?? h();
8013
7894
  return new Promise((n, s) => {
8014
7895
  this._pending.set(t, {
8015
7896
  resolve: n,
@@ -8038,19 +7919,19 @@ var Xi = class {
8038
7919
  this._cleanup?.(), this._cleanup = null, this._active = !1;
8039
7920
  }
8040
7921
  };
8041
- function Zi(e, t = {}) {
7922
+ function ji(e, t = {}) {
8042
7923
  return async (n, s) => {
8043
7924
  if (n.type !== "request" || n.channel !== e) return;
8044
7925
  t.onRequest?.(n.payload);
8045
- const r = await Fe(n.payload, n.reqId, e);
7926
+ const r = await De(n.payload, n.reqId, e);
8046
7927
  r && (t.onResponse?.(r.response), s({
8047
7928
  ...r.response,
8048
- id: u(),
7929
+ id: h(),
8049
7930
  timestamp: Date.now()
8050
7931
  }, r.transfer));
8051
7932
  };
8052
7933
  }
8053
- var eo = class {
7934
+ var zi = class {
8054
7935
  _channelName;
8055
7936
  _targetChannel;
8056
7937
  _pending = /* @__PURE__ */ new Map();
@@ -8073,8 +7954,8 @@ var eo = class {
8073
7954
  }
8074
7955
  dispatch(e, t, n) {
8075
7956
  if (!this._subscriber?.active) return Promise.reject(/* @__PURE__ */ new Error("Not connected"));
8076
- const s = u(), r = {
8077
- id: u(),
7957
+ const s = h(), r = {
7958
+ id: h(),
8078
7959
  channel: this._targetChannel,
8079
7960
  sender: this._channelName,
8080
7961
  type: "request",
@@ -8094,11 +7975,11 @@ var eo = class {
8094
7975
  }));
8095
7976
  return this._subscriber.next(r), i;
8096
7977
  }
8097
- }, to = async (e, t = {}, n = null) => X(e, t, n ?? (typeof self < "u" ? self : null)), no = async (e, t, n = {}, s = typeof self < "u" ? self : null) => (await X(e, n?.channelOptions, s))?.doImportModule?.(t, n?.importOptions), so = ce, ro = fs, io = ps, oo = _s, ao = async (e, t = {}, n = typeof self < "u" ? self : null, s = "$host$") => {
8098
- const r = qt(s ?? "$host$");
8099
- return await r?.createRemoteChannel(e, t, n), Tt(e, r ?? v?.instance);
8100
- }, co = (e, t = {}) => {
8101
- const n = Be();
7978
+ }, Hi = async (e, t = {}, n = null) => G(e, t, n ?? (typeof self < "u" ? self : null)), Gi = async (e, t, n = {}, s = typeof self < "u" ? self : null) => (await G(e, n?.channelOptions, s))?.doImportModule?.(t, n?.importOptions), Qi = ne, Vi = ns, Ki = ss, Yi = rs, Ji = async (e, t = {}, n = typeof self < "u" ? self : null, s = "$host$") => {
7979
+ const r = St(s ?? "$host$");
7980
+ return await r?.createRemoteChannel(e, t, n), wt(e, r ?? w?.instance);
7981
+ }, Xi = (e, t = {}) => {
7982
+ const n = Ne();
8102
7983
  return n !== "chrome-extension" ? {
8103
7984
  async request(s) {
8104
7985
  throw new Error(`Chrome extension messaging not available in ${n}`);
@@ -8132,286 +8013,286 @@ var eo = class {
8132
8013
  };
8133
8014
  };
8134
8015
  export {
8135
- Ur as $createOrUseExistingChannel,
8136
- Z as $descriptor,
8137
- Hn as $requestHandler,
8138
- Ns as AbstractTransport,
8139
- V as AtomicsBuffer,
8140
- Xt as AtomicsRingBuffer,
8141
- le as AtomicsTransport,
8142
- ki as AtomicsTransportFactory,
8143
- An as BidirectionalInvoker,
8144
- ms as BroadcastChannelObservable,
8145
- Zn as BroadcastChannelTransport,
8146
- Se as CHANNEL_MAP,
8147
- Kn as ChannelConnection,
8148
- Ft as ChannelContext,
8149
- Un as ChannelHandler,
8150
- Xi as ChannelMessageObservable,
8151
- C as ChannelNativeObservable,
8152
- wn as ChannelObservable,
8153
- ls as ChannelStorage,
8016
+ Rr as $createOrUseExistingChannel,
8017
+ Q as $descriptor,
8018
+ qn as $requestHandler,
8019
+ xs as AbstractTransport,
8020
+ F as AtomicsBuffer,
8021
+ Ht as AtomicsRingBuffer,
8022
+ se as AtomicsTransport,
8023
+ pi as AtomicsTransportFactory,
8024
+ wn as BidirectionalInvoker,
8025
+ is as BroadcastChannelObservable,
8026
+ Un as BroadcastChannelTransport,
8027
+ we as CHANNEL_MAP,
8028
+ Bn as ChannelConnection,
8029
+ Nt as ChannelContext,
8030
+ An as ChannelHandler,
8031
+ Ui as ChannelMessageObservable,
8032
+ v as ChannelNativeObservable,
8033
+ ln as ChannelObservable,
8034
+ Xn as ChannelStorage,
8154
8035
  _ as ChannelSubject,
8155
- us as ChannelTransaction,
8156
- an as ChromeExtensionBroadcastChannel,
8157
- Oi as ChromeExtensionPortChannel,
8158
- $s as ChromeExtensionTabsChannel,
8159
- Qt as ChromeExternalObservable,
8160
- rs as ChromeExternalTransport,
8161
- mi as ChromeObservableFactory,
8162
- je as ChromePortObservable,
8163
- ss as ChromePortTransport,
8164
- He as ChromeRuntimeObservable,
8165
- ts as ChromeRuntimeTransport,
8166
- Ge as ChromeTabsObservable,
8167
- ns as ChromeTabsTransport,
8168
- Yn as ConnectionPool,
8169
- Mn as DefaultReflect,
8170
- Er as DispatchHandler,
8171
- Er as DispatchProxyHandler,
8172
- ar as MessageObservable,
8173
- Ie as MessagePortObservable,
8174
- Xn as MessagePortTransport,
8175
- sn as MessageQueue,
8176
- tn as MessageQueueStorage,
8177
- C as Observable,
8178
- Un as ObservableChannelHandler,
8179
- Cr as ObservableFactory,
8180
- eo as ObservableRequestDispatcher,
8181
- nn as OptimizedWorkerChannel,
8182
- xt as PROXY_INTERNALS,
8183
- Ct as PROXY_MARKER,
8184
- nr as PendingMessageStore,
8185
- en as PortPool,
8186
- H as PortTransport,
8187
- Ii as PortTransportFactory,
8188
- tr as ProtocolReplayGuard,
8189
- Dn as ProxyBuilder,
8190
- Ls as QueuedWorkerChannel,
8191
- zr as READ,
8192
- Qe as RTCPeerManager,
8193
- Ce as RTCPeerTransport,
8194
- Si as RTCTransportFactory,
8195
- Rt as RemoteChannelHelper,
8196
- ke as RemoteChannels,
8197
- qn as RemoteProxyHandler,
8198
- or as ReplayChannelSubject,
8199
- wt as Requestor,
8200
- vt as Responder,
8201
- v as SELF_CHANNEL,
8202
- xs as SelfObservable,
8203
- os as SelfTransport,
8204
- un as ServiceChannelManager,
8205
- Je as ServiceWorkerClient,
8206
- vs as ServiceWorkerClientObservable,
8207
- Ye as ServiceWorkerHost,
8208
- Cs as ServiceWorkerHostObservable,
8209
- is as ServiceWorkerTransport,
8210
- ve as SharedWorkerClient,
8211
- Ve as SharedWorkerHost,
8212
- Ci as SharedWorkerObservableFactory,
8213
- we as SocketIOObservable,
8214
- yi as SocketIOObservableFactory,
8215
- ks as SocketIORoomObservable,
8216
- Ke as TransferableStorage,
8217
- Ti as TransferableStorageFactory,
8218
- T as TransportAdapter,
8219
- ws as TransportChromePortObservable,
8220
- ys as TransportChromeRuntimeObservable,
8221
- bs as TransportChromeTabsObservable,
8222
- ir as TransportCoreFactory,
8223
- Gr as TransportFactory,
8224
- P as TransportObservable,
8225
- ii as TransportObservableFactory,
8226
- It as UnifiedChannel,
8227
- ln as UnifiedMessagingManager,
8228
- Ai as UnifiedTransportFactory,
8036
+ Zn as ChannelTransaction,
8037
+ Zt as ChromeExtensionBroadcastChannel,
8038
+ Si as ChromeExtensionPortChannel,
8039
+ Ps as ChromeExtensionTabsChannel,
8040
+ Ft as ChromeExternalObservable,
8041
+ Qn as ChromeExternalTransport,
8042
+ oi as ChromeObservableFactory,
8043
+ Fe as ChromePortObservable,
8044
+ Gn as ChromePortTransport,
8045
+ We as ChromeRuntimeObservable,
8046
+ zn as ChromeRuntimeTransport,
8047
+ $e as ChromeTabsObservable,
8048
+ Hn as ChromeTabsTransport,
8049
+ Wn as ConnectionPool,
8050
+ yn as DefaultReflect,
8051
+ mr as DispatchHandler,
8052
+ mr as DispatchProxyHandler,
8053
+ Js as MessageObservable,
8054
+ Ce as MessagePortObservable,
8055
+ Fn as MessagePortTransport,
8056
+ Yt as MessageQueue,
8057
+ Vt as MessageQueueStorage,
8058
+ v as Observable,
8059
+ An as ObservableChannelHandler,
8060
+ dr as ObservableFactory,
8061
+ zi as ObservableRequestDispatcher,
8062
+ Kt as OptimizedWorkerChannel,
8063
+ _t as PROXY_INTERNALS,
8064
+ pt as PROXY_MARKER,
8065
+ Hs as PendingMessageStore,
8066
+ Qt as PortPool,
8067
+ B as PortTransport,
8068
+ gi as PortTransportFactory,
8069
+ zs as ProtocolReplayGuard,
8070
+ Sn as ProxyBuilder,
8071
+ Es as QueuedWorkerChannel,
8072
+ qr as READ,
8073
+ je as RTCPeerManager,
8074
+ ge as RTCPeerTransport,
8075
+ _i as RTCTransportFactory,
8076
+ kt as RemoteChannelHelper,
8077
+ ye as RemoteChannels,
8078
+ Cn as RemoteProxyHandler,
8079
+ Ys as ReplayChannelSubject,
8080
+ dt as Requestor,
8081
+ ft as Responder,
8082
+ w as SELF_CHANNEL,
8083
+ ds as SelfObservable,
8084
+ Kn as SelfTransport,
8085
+ nn as ServiceChannelManager,
8086
+ Ge as ServiceWorkerClient,
8087
+ hs as ServiceWorkerClientObservable,
8088
+ He as ServiceWorkerHost,
8089
+ us as ServiceWorkerHostObservable,
8090
+ Vn as ServiceWorkerTransport,
8091
+ me as SharedWorkerClient,
8092
+ Ue as SharedWorkerHost,
8093
+ di as SharedWorkerObservableFactory,
8094
+ _e as SocketIOObservable,
8095
+ ci as SocketIOObservableFactory,
8096
+ fs as SocketIORoomObservable,
8097
+ ze as TransferableStorage,
8098
+ bi as TransferableStorageFactory,
8099
+ E as TransportAdapter,
8100
+ ls as TransportChromePortObservable,
8101
+ as as TransportChromeRuntimeObservable,
8102
+ cs as TransportChromeTabsObservable,
8103
+ Ks as TransportCoreFactory,
8104
+ Or as TransportFactory,
8105
+ I as TransportObservable,
8106
+ Kr as TransportObservableFactory,
8107
+ yt as UnifiedChannel,
8108
+ tn as UnifiedMessagingManager,
8109
+ vi as UnifiedTransportFactory,
8229
8110
  d as WReflectAction,
8230
- sr as WStatus,
8231
- rr as WType,
8232
- gs as WebSocketObservable,
8233
- es as WebSocketTransport,
8234
- qe as WindowPortConnector,
8235
- Gt as WorkerContext,
8236
- it as WorkerObservable,
8237
- Jn as WorkerTransport,
8238
- Zr as addBroadcastChannel,
8239
- Xr as addPortChannel,
8240
- ei as addSelfChannelToDefault,
8241
- Jr as addWorkerChannel,
8242
- Sr as autoInvoker,
8243
- qs as bindServiceWorkerHostBridge,
8244
- Lt as buildResponse,
8245
- Vr as closeAllStorage,
8246
- Nr as closeUnifiedChannel,
8247
- ao as connectToChannelAsModule,
8248
- Jt as createAtomicsChannelPair,
8249
- In as createBidirectionalChannel,
8250
- oi as createBidirectionalTransport,
8251
- Zt as createBroadcastSignaling,
8252
- _t as createBroadcastTransport,
8253
- ce as createChannelContext,
8254
- xe as createChannelPair,
8255
- Zi as createChannelRequestHandler,
8256
- ps as createChannelsInContext,
8257
- Li as createChromeExtensionBroadcast,
8258
- Bi as createChromeExtensionBroadcastChannel,
8259
- Di as createChromeExtensionChannel,
8260
- co as createChromeExtensionRuntimeChannel,
8261
- Fs as createChromeExtensionTabsChannel,
8262
- Wi as createChromeExtensionTabsMessagingChannel,
8263
- pn as createChromeListener,
8264
- _i as createChromeRequestHandler,
8265
- ft as createChromeTabsListener,
8266
- jr as createConnectionObserver,
8267
- so as createContext,
8268
- ri as createDefaultChannelPair,
8269
- Nn as createExposeHandler,
8270
- Ei as createFromPort,
8271
- qt as createHostChannel,
8272
- di as createHostProxy,
8273
- Le as createInvoker,
8274
- et as createInvokerObservable,
8275
- fr as createMessageId,
8276
- Ni as createMessageQueue,
8277
- io as createMultiChannel,
8278
- Wr as createObservableChannel,
8279
- Ui as createOptimizedWorkerChannel,
8280
- X as createOrUseExistingChannel,
8281
- As as createPortProxy,
8282
- Ne as createProtocolEnvelope,
8283
- zs as createQueuedOptimizedWorkerChannel,
8284
- Fi as createQueuedWorkerChannel,
8285
- vn as createReflectHandler,
8286
- oe as createRemoteProxy,
8287
- xr as createRequestor,
8288
- Rn as createResponder,
8289
- On as createSenderProxy,
8290
- Qi as createServiceChannelManager,
8291
- Us as createServiceWorkerChannel,
8292
- Mi as createServiceWorkerClient,
8293
- Pi as createServiceWorkerHost,
8294
- vi as createSharedWorkerHostObservable,
8295
- wi as createSharedWorkerObservable,
8296
- bi as createSocketObservable,
8297
- gi as createSocketRequestHandler,
8298
- j as createTransport,
8111
+ Qs as WStatus,
8112
+ Vs as WType,
8113
+ os as WebSocketObservable,
8114
+ jn as WebSocketTransport,
8115
+ Te as WindowPortConnector,
8116
+ Bt as WorkerContext,
8117
+ Ze as WorkerObservable,
8118
+ $n as WorkerTransport,
8119
+ jr as addBroadcastChannel,
8120
+ Ur as addPortChannel,
8121
+ zr as addSelfChannelToDefault,
8122
+ Fr as addWorkerChannel,
8123
+ _r as autoInvoker,
8124
+ Cs as bindServiceWorkerHostBridge,
8125
+ Mt as buildResponse,
8126
+ Lr as closeAllStorage,
8127
+ kr as closeUnifiedChannel,
8128
+ Ji as connectToChannelAsModule,
8129
+ zt as createAtomicsChannelPair,
8130
+ mn as createBidirectionalChannel,
8131
+ Yr as createBidirectionalTransport,
8132
+ Gt as createBroadcastSignaling,
8133
+ ht as createBroadcastTransport,
8134
+ ne as createChannelContext,
8135
+ be as createChannelPair,
8136
+ ji as createChannelRequestHandler,
8137
+ ss as createChannelsInContext,
8138
+ Ii as createChromeExtensionBroadcast,
8139
+ Ti as createChromeExtensionBroadcastChannel,
8140
+ Ei as createChromeExtensionChannel,
8141
+ Xi as createChromeExtensionRuntimeChannel,
8142
+ Ms as createChromeExtensionTabsChannel,
8143
+ Pi as createChromeExtensionTabsMessagingChannel,
8144
+ cn as createChromeListener,
8145
+ ii as createChromeRequestHandler,
8146
+ ct as createChromeTabsListener,
8147
+ Dr as createConnectionObserver,
8148
+ Qi as createContext,
8149
+ Vr as createDefaultChannelPair,
8150
+ xn as createExposeHandler,
8151
+ mi as createFromPort,
8152
+ St as createHostChannel,
8153
+ ni as createHostProxy,
8154
+ qe as createInvoker,
8155
+ Ve as createInvokerObservable,
8156
+ sr as createMessageId,
8157
+ ki as createMessageQueue,
8158
+ Ki as createMultiChannel,
8159
+ Pr as createObservableChannel,
8160
+ Ri as createOptimizedWorkerChannel,
8161
+ G as createOrUseExistingChannel,
8162
+ ws as createPortProxy,
8163
+ Pe as createProtocolEnvelope,
8164
+ Rs as createQueuedOptimizedWorkerChannel,
8165
+ Ai as createQueuedWorkerChannel,
8166
+ hn as createReflectHandler,
8167
+ ee as createRemoteProxy,
8168
+ fr as createRequestor,
8169
+ vn as createResponder,
8170
+ kn as createSenderProxy,
8171
+ Bi as createServiceChannelManager,
8172
+ As as createServiceWorkerChannel,
8173
+ wi as createServiceWorkerClient,
8174
+ yi as createServiceWorkerHost,
8175
+ ui as createSharedWorkerHostObservable,
8176
+ hi as createSharedWorkerObservable,
8177
+ li as createSocketObservable,
8178
+ ai as createSocketRequestHandler,
8179
+ $ as createTransport,
8299
8180
  m as createTransportListener,
8300
- y as createTransportSender,
8301
- I as createUnifiedChannel,
8302
- Ar as createUnifiedChannelPair,
8303
- zi as createUnifiedMessaging,
8304
- pt as createWebSocketTransport,
8305
- xi as createWorkerAtomicsTransport,
8306
- cn as createWorkerChannel,
8307
- hr as debounce,
8308
- ti as deferChannel,
8309
- kn as delay,
8310
- Kr as deleteContext,
8311
- nt as descMap,
8312
- J as detectContextType,
8313
- Be as detectExecutionContext,
8314
- Pn as detectIncomingContextType,
8315
- tt as detectTransport,
8316
- ie as detectTransportType,
8317
- Dt as executeAction,
8318
- Or as exposeFromUnified,
8319
- ui as exposeFromWorker,
8320
- Rs as exposeOverPort,
8321
- bt as filter,
8322
- Cn as fromEvent,
8323
- xn as fromPromise,
8324
- Vi as getBroadcastChannel,
8325
- si as getChannelFromDefault,
8326
- Wt as getChannelStorage,
8327
- Bt as getConnection,
8328
- Ue as getConnectionPool,
8329
- Qr as getContext,
8330
- Yr as getContextNames,
8331
- Bs as getCurrentTabId,
8332
- F as getDefaultContext,
8333
- Hr as getHostConnection,
8334
- Ws as getMessageQueue,
8335
- fs as getOrCreateContext,
8336
- Ir as getProxyDescriptor,
8337
- Tr as getProxyInternals,
8338
- Ki as getServiceChannelManager,
8339
- ro as getSharedContext,
8340
- dt as getTransportMeta,
8341
- Ds as getTransportRegistry,
8342
- Rr as getUnifiedChannel,
8343
- qr as getUnifiedChannelNames,
8344
- Xe as getUnifiedMessaging,
8345
- Ri as getVisibleTabId,
8346
- ae as getWorkerChannel,
8347
- ze as getWorkerContext,
8348
- Vt as getWorkerInvoker,
8349
- Mt as getWorkerResolveBaseUrl,
8350
- jt as getWorkerResponder,
8351
- me as handMap,
8352
- Fe as handleRequest,
8353
- Vn as hasNoPath,
8354
- fi as importInHost,
8355
- oo as importIsolatedModule,
8356
- no as importModuleInChannel,
8357
- _s as importModuleInContext,
8358
- We as initChannelHandler,
8359
- ni as initDeferredChannel,
8360
- $i as initMainChannel,
8361
- ai as initWorkerContext,
8362
- Sn as interval,
8363
- $n as isChromeExtensionContext,
8364
- er as isProtocolEnvelope,
8365
- St as isRemoteProxy,
8366
- Pt as isServiceWorkerContext,
8367
- Fr as loadWorker,
8368
- mr as makeBroadcastInvoker,
8369
- Ji as makeChannelMessageHandler,
8370
- yr as makeChromeRuntimeInvoker,
8371
- _r as makeMessagePortInvoker,
8372
- Br as makeObservableRequestProxy,
8373
- Ln as makeRequestProxy,
8374
- vr as makeSelfInvoker,
8375
- br as makeServiceWorkerClientInvoker,
8376
- wr as makeServiceWorkerHostInvoker,
8377
- gr as makeWebSocketInvoker,
8378
- pr as makeWorkerInvoker,
8379
- cr as map,
8380
- En as merge,
8381
- ht as normalizeProtocolEnvelope,
8382
- Ee as normalizeRef,
8383
- zn as objectToRef,
8384
- li as onWorkerChannelCreated,
8385
- ci as onWorkerConnection,
8386
- hi as onWorkerInvocation,
8387
- Pr as proxyBuilder,
8388
- z as readByPath,
8389
- ji as registerHandler,
8390
- qi as registerWorkerAPI,
8391
- W as registeredInPath,
8392
- Dr as remoteFromUnified,
8393
- jn as removeByData,
8394
- Nt as removeByPath,
8395
- Yi as resetServiceChannelManager,
8396
- Hi as resetUnifiedMessaging,
8397
- q as resolveWorkerSpecifierHref,
8398
- Gi as sendMessage,
8399
- kr as setupInvoker,
8400
- Mr as setupUnifiedChannel,
8401
- re as storedData,
8402
- Fn as supportsDedicatedWorkers,
8403
- to as sync,
8404
- lr as take,
8405
- ur as takeUntil,
8406
- dr as throttle,
8407
- $e as traverseByPath,
8408
- Gn as unwrapDescriptorFromProxy,
8409
- he as unwrapDescriptorFromProxyRecursive,
8410
- Tn as when,
8411
- pi as workerContext,
8412
- Tt as wrapChannel,
8413
- kt as wrapDescriptor,
8414
- ge as wrapMap,
8415
- Lr as wrapObservableChannel,
8416
- ye as writeByPath
8181
+ g as createTransportSender,
8182
+ S as createUnifiedChannel,
8183
+ vr as createUnifiedChannelPair,
8184
+ qi as createUnifiedMessaging,
8185
+ lt as createWebSocketTransport,
8186
+ fi as createWorkerAtomicsTransport,
8187
+ en as createWorkerChannel,
8188
+ tr as debounce,
8189
+ Hr as deferChannel,
8190
+ fn as delay,
8191
+ Wr as deleteContext,
8192
+ Ye as descMap,
8193
+ H as detectContextType,
8194
+ Ne as detectExecutionContext,
8195
+ bn as detectIncomingContextType,
8196
+ Ke as detectTransport,
8197
+ Z as detectTransportType,
8198
+ Pt as executeAction,
8199
+ Sr as exposeFromUnified,
8200
+ ei as exposeFromWorker,
8201
+ vs as exposeOverPort,
8202
+ ut as filter,
8203
+ un as fromEvent,
8204
+ dn as fromPromise,
8205
+ Li as getBroadcastChannel,
8206
+ Qr as getChannelFromDefault,
8207
+ Rt as getChannelStorage,
8208
+ At as getConnection,
8209
+ Le as getConnectionPool,
8210
+ Br as getContext,
8211
+ $r as getContextNames,
8212
+ Is as getCurrentTabId,
8213
+ N as getDefaultContext,
8214
+ Nr as getHostConnection,
8215
+ Ts as getMessageQueue,
8216
+ ns as getOrCreateContext,
8217
+ gr as getProxyDescriptor,
8218
+ br as getProxyInternals,
8219
+ Wi as getServiceChannelManager,
8220
+ Vi as getSharedContext,
8221
+ at as getTransportMeta,
8222
+ Ss as getTransportRegistry,
8223
+ Cr as getUnifiedChannel,
8224
+ xr as getUnifiedChannelNames,
8225
+ Qe as getUnifiedMessaging,
8226
+ Ci as getVisibleTabId,
8227
+ te as getWorkerChannel,
8228
+ Be as getWorkerContext,
8229
+ $t as getWorkerInvoker,
8230
+ Ct as getWorkerResolveBaseUrl,
8231
+ Wt as getWorkerResponder,
8232
+ ue as handMap,
8233
+ De as handleRequest,
8234
+ Dn as hasNoPath,
8235
+ si as importInHost,
8236
+ Yi as importIsolatedModule,
8237
+ Gi as importModuleInChannel,
8238
+ rs as importModuleInContext,
8239
+ Oe as initChannelHandler,
8240
+ Gr as initDeferredChannel,
8241
+ Mi as initMainChannel,
8242
+ Jr as initWorkerContext,
8243
+ pn as interval,
8244
+ Pn as isChromeExtensionContext,
8245
+ js as isProtocolEnvelope,
8246
+ gt as isRemoteProxy,
8247
+ vt as isServiceWorkerContext,
8248
+ Ar as loadWorker,
8249
+ or as makeBroadcastInvoker,
8250
+ Fi as makeChannelMessageHandler,
8251
+ cr as makeChromeRuntimeInvoker,
8252
+ ir as makeMessagePortInvoker,
8253
+ Tr as makeObservableRequestProxy,
8254
+ En as makeRequestProxy,
8255
+ ur as makeSelfInvoker,
8256
+ lr as makeServiceWorkerClientInvoker,
8257
+ hr as makeServiceWorkerHostInvoker,
8258
+ ar as makeWebSocketInvoker,
8259
+ rr as makeWorkerInvoker,
8260
+ Xs as map,
8261
+ _n as merge,
8262
+ it as normalizeProtocolEnvelope,
8263
+ ve as normalizeRef,
8264
+ Rn as objectToRef,
8265
+ Zr as onWorkerChannelCreated,
8266
+ Xr as onWorkerConnection,
8267
+ ti as onWorkerInvocation,
8268
+ yr as proxyBuilder,
8269
+ L as readByPath,
8270
+ Di as registerHandler,
8271
+ xi as registerWorkerAPI,
8272
+ D as registeredInPath,
8273
+ Er as remoteFromUnified,
8274
+ On as removeByData,
8275
+ It as removeByPath,
8276
+ $i as resetServiceChannelManager,
8277
+ Ni as resetUnifiedMessaging,
8278
+ P as resolveWorkerSpecifierHref,
8279
+ Oi as sendMessage,
8280
+ pr as setupInvoker,
8281
+ wr as setupUnifiedChannel,
8282
+ X as storedData,
8283
+ Mn as supportsDedicatedWorkers,
8284
+ Hi as sync,
8285
+ Zs as take,
8286
+ er as takeUntil,
8287
+ nr as throttle,
8288
+ Et as traverseByPath,
8289
+ Nn as unwrapDescriptorFromProxy,
8290
+ ie as unwrapDescriptorFromProxyRecursive,
8291
+ gn as when,
8292
+ ri as workerContext,
8293
+ wt as wrapChannel,
8294
+ mt as wrapDescriptor,
8295
+ de as wrapMap,
8296
+ Ir as wrapObservableChannel,
8297
+ fe as writeByPath
8417
8298
  };