@micro-lc/preview 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
2
  (() => {
3
- // ../../node_modules/tslib/tslib.es6.mjs
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined")
7
+ return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
10
+
11
+ // ../../node_modules/@micro-lc/post-channel/dist/es/index.js
12
+ var __require2 = /* @__PURE__ */ ((x) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
+ get: (a, b) => (typeof __require !== "undefined" ? __require : a)[b]
14
+ }) : x)(function(x) {
15
+ if (typeof __require !== "undefined")
16
+ return __require.apply(this, arguments);
17
+ throw Error('Dynamic require of "' + x + '" is not supported');
18
+ });
4
19
  var extendStatics = function(d, b) {
5
20
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
6
21
  d2.__proto__ = b2;
@@ -176,16 +191,24 @@
176
191
  if (!Symbol.asyncIterator)
177
192
  throw new TypeError("Symbol.asyncIterator is not defined.");
178
193
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
179
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
194
+ return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
180
195
  return this;
181
196
  }, i;
182
- function verb(n) {
183
- if (g[n])
197
+ function awaitReturn(f) {
198
+ return function(v) {
199
+ return Promise.resolve(v).then(f, reject);
200
+ };
201
+ }
202
+ function verb(n, f) {
203
+ if (g[n]) {
184
204
  i[n] = function(v) {
185
205
  return new Promise(function(a, b) {
186
206
  q.push([n, v, a, b]) > 1 || resume(n, v);
187
207
  });
188
208
  };
209
+ if (f)
210
+ i[n] = f(i[n]);
211
+ }
189
212
  }
190
213
  function resume(n, v) {
191
214
  try {
@@ -228,13 +251,9 @@
228
251
  }, reject);
229
252
  }
230
253
  }
231
-
232
- // ../../node_modules/rxjs/dist/esm5/internal/util/isFunction.js
233
254
  function isFunction(value) {
234
255
  return typeof value === "function";
235
256
  }
236
-
237
- // ../../node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
238
257
  function createErrorClass(createImpl) {
239
258
  var _super = function(instance) {
240
259
  Error.call(instance);
@@ -245,8 +264,6 @@
245
264
  ctorFunc.prototype.constructor = ctorFunc;
246
265
  return ctorFunc;
247
266
  }
248
-
249
- // ../../node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
250
267
  var UnsubscriptionError = createErrorClass(function(_super) {
251
268
  return function UnsubscriptionErrorImpl(errors) {
252
269
  _super(this);
@@ -257,24 +274,20 @@
257
274
  this.errors = errors;
258
275
  };
259
276
  });
260
-
261
- // ../../node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
262
277
  function arrRemove(arr, item) {
263
278
  if (arr) {
264
279
  var index = arr.indexOf(item);
265
280
  0 <= index && arr.splice(index, 1);
266
281
  }
267
282
  }
268
-
269
- // ../../node_modules/rxjs/dist/esm5/internal/Subscription.js
270
283
  var Subscription = function() {
271
- function Subscription2(initialTeardown) {
284
+ function Subscription22(initialTeardown) {
272
285
  this.initialTeardown = initialTeardown;
273
286
  this.closed = false;
274
287
  this._parentage = null;
275
288
  this._finalizers = null;
276
289
  }
277
- Subscription2.prototype.unsubscribe = function() {
290
+ Subscription22.prototype.unsubscribe = function() {
278
291
  var e_1, _a, e_2, _b;
279
292
  var errors;
280
293
  if (!this.closed) {
@@ -345,13 +358,13 @@
345
358
  }
346
359
  }
347
360
  };
348
- Subscription2.prototype.add = function(teardown) {
361
+ Subscription22.prototype.add = function(teardown) {
349
362
  var _a;
350
363
  if (teardown && teardown !== this) {
351
364
  if (this.closed) {
352
365
  execFinalizer(teardown);
353
366
  } else {
354
- if (teardown instanceof Subscription2) {
367
+ if (teardown instanceof Subscription22) {
355
368
  if (teardown.closed || teardown._hasParent(this)) {
356
369
  return;
357
370
  }
@@ -361,15 +374,15 @@
361
374
  }
362
375
  }
363
376
  };
364
- Subscription2.prototype._hasParent = function(parent) {
377
+ Subscription22.prototype._hasParent = function(parent) {
365
378
  var _parentage = this._parentage;
366
379
  return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
367
380
  };
368
- Subscription2.prototype._addParent = function(parent) {
381
+ Subscription22.prototype._addParent = function(parent) {
369
382
  var _parentage = this._parentage;
370
383
  this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
371
384
  };
372
- Subscription2.prototype._removeParent = function(parent) {
385
+ Subscription22.prototype._removeParent = function(parent) {
373
386
  var _parentage = this._parentage;
374
387
  if (_parentage === parent) {
375
388
  this._parentage = null;
@@ -377,19 +390,19 @@
377
390
  arrRemove(_parentage, parent);
378
391
  }
379
392
  };
380
- Subscription2.prototype.remove = function(teardown) {
393
+ Subscription22.prototype.remove = function(teardown) {
381
394
  var _finalizers = this._finalizers;
382
395
  _finalizers && arrRemove(_finalizers, teardown);
383
- if (teardown instanceof Subscription2) {
396
+ if (teardown instanceof Subscription22) {
384
397
  teardown._removeParent(this);
385
398
  }
386
399
  };
387
- Subscription2.EMPTY = function() {
388
- var empty = new Subscription2();
400
+ Subscription22.EMPTY = function() {
401
+ var empty = new Subscription22();
389
402
  empty.closed = true;
390
403
  return empty;
391
404
  }();
392
- return Subscription2;
405
+ return Subscription22;
393
406
  }();
394
407
  var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
395
408
  function isSubscription(value) {
@@ -402,8 +415,6 @@
402
415
  finalizer.unsubscribe();
403
416
  }
404
417
  }
405
-
406
- // ../../node_modules/rxjs/dist/esm5/internal/config.js
407
418
  var config = {
408
419
  onUnhandledError: null,
409
420
  onStoppedNotification: null,
@@ -411,8 +422,6 @@
411
422
  useDeprecatedSynchronousErrorHandling: false,
412
423
  useDeprecatedNextContext: false
413
424
  };
414
-
415
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
416
425
  var timeoutProvider = {
417
426
  setTimeout: function(handler, timeout) {
418
427
  var args = [];
@@ -431,8 +440,6 @@
431
440
  },
432
441
  delegate: void 0
433
442
  };
434
-
435
- // ../../node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
436
443
  function reportUnhandledError(err) {
437
444
  timeoutProvider.setTimeout(function() {
438
445
  var onUnhandledError = config.onUnhandledError;
@@ -443,12 +450,8 @@
443
450
  }
444
451
  });
445
452
  }
446
-
447
- // ../../node_modules/rxjs/dist/esm5/internal/util/noop.js
448
453
  function noop() {
449
454
  }
450
-
451
- // ../../node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
452
455
  var COMPLETE_NOTIFICATION = function() {
453
456
  return createNotification("C", void 0, void 0);
454
457
  }();
@@ -465,8 +468,6 @@
465
468
  error
466
469
  };
467
470
  }
468
-
469
- // ../../node_modules/rxjs/dist/esm5/internal/util/errorContext.js
470
471
  var context = null;
471
472
  function errorContext(cb) {
472
473
  if (config.useDeprecatedSynchronousErrorHandling) {
@@ -492,11 +493,9 @@
492
493
  context.error = err;
493
494
  }
494
495
  }
495
-
496
- // ../../node_modules/rxjs/dist/esm5/internal/Subscriber.js
497
496
  var Subscriber = function(_super) {
498
- __extends(Subscriber2, _super);
499
- function Subscriber2(destination) {
497
+ __extends(Subscriber22, _super);
498
+ function Subscriber22(destination) {
500
499
  var _this = _super.call(this) || this;
501
500
  _this.isStopped = false;
502
501
  if (destination) {
@@ -509,17 +508,17 @@
509
508
  }
510
509
  return _this;
511
510
  }
512
- Subscriber2.create = function(next, error, complete) {
511
+ Subscriber22.create = function(next, error, complete) {
513
512
  return new SafeSubscriber(next, error, complete);
514
513
  };
515
- Subscriber2.prototype.next = function(value) {
514
+ Subscriber22.prototype.next = function(value) {
516
515
  if (this.isStopped) {
517
516
  handleStoppedNotification(nextNotification(value), this);
518
517
  } else {
519
518
  this._next(value);
520
519
  }
521
520
  };
522
- Subscriber2.prototype.error = function(err) {
521
+ Subscriber22.prototype.error = function(err) {
523
522
  if (this.isStopped) {
524
523
  handleStoppedNotification(errorNotification(err), this);
525
524
  } else {
@@ -527,7 +526,7 @@
527
526
  this._error(err);
528
527
  }
529
528
  };
530
- Subscriber2.prototype.complete = function() {
529
+ Subscriber22.prototype.complete = function() {
531
530
  if (this.isStopped) {
532
531
  handleStoppedNotification(COMPLETE_NOTIFICATION, this);
533
532
  } else {
@@ -535,41 +534,41 @@
535
534
  this._complete();
536
535
  }
537
536
  };
538
- Subscriber2.prototype.unsubscribe = function() {
537
+ Subscriber22.prototype.unsubscribe = function() {
539
538
  if (!this.closed) {
540
539
  this.isStopped = true;
541
540
  _super.prototype.unsubscribe.call(this);
542
541
  this.destination = null;
543
542
  }
544
543
  };
545
- Subscriber2.prototype._next = function(value) {
544
+ Subscriber22.prototype._next = function(value) {
546
545
  this.destination.next(value);
547
546
  };
548
- Subscriber2.prototype._error = function(err) {
547
+ Subscriber22.prototype._error = function(err) {
549
548
  try {
550
549
  this.destination.error(err);
551
550
  } finally {
552
551
  this.unsubscribe();
553
552
  }
554
553
  };
555
- Subscriber2.prototype._complete = function() {
554
+ Subscriber22.prototype._complete = function() {
556
555
  try {
557
556
  this.destination.complete();
558
557
  } finally {
559
558
  this.unsubscribe();
560
559
  }
561
560
  };
562
- return Subscriber2;
561
+ return Subscriber22;
563
562
  }(Subscription);
564
563
  var _bind = Function.prototype.bind;
565
564
  function bind(fn, thisArg) {
566
565
  return _bind.call(fn, thisArg);
567
566
  }
568
567
  var ConsumerObserver = function() {
569
- function ConsumerObserver2(partialObserver) {
568
+ function ConsumerObserver22(partialObserver) {
570
569
  this.partialObserver = partialObserver;
571
570
  }
572
- ConsumerObserver2.prototype.next = function(value) {
571
+ ConsumerObserver22.prototype.next = function(value) {
573
572
  var partialObserver = this.partialObserver;
574
573
  if (partialObserver.next) {
575
574
  try {
@@ -579,7 +578,7 @@
579
578
  }
580
579
  }
581
580
  };
582
- ConsumerObserver2.prototype.error = function(err) {
581
+ ConsumerObserver22.prototype.error = function(err) {
583
582
  var partialObserver = this.partialObserver;
584
583
  if (partialObserver.error) {
585
584
  try {
@@ -591,7 +590,7 @@
591
590
  handleUnhandledError(err);
592
591
  }
593
592
  };
594
- ConsumerObserver2.prototype.complete = function() {
593
+ ConsumerObserver22.prototype.complete = function() {
595
594
  var partialObserver = this.partialObserver;
596
595
  if (partialObserver.complete) {
597
596
  try {
@@ -601,11 +600,11 @@
601
600
  }
602
601
  }
603
602
  };
604
- return ConsumerObserver2;
603
+ return ConsumerObserver22;
605
604
  }();
606
605
  var SafeSubscriber = function(_super) {
607
- __extends(SafeSubscriber2, _super);
608
- function SafeSubscriber2(observerOrNext, error, complete) {
606
+ __extends(SafeSubscriber22, _super);
607
+ function SafeSubscriber22(observerOrNext, error, complete) {
609
608
  var _this = _super.call(this) || this;
610
609
  var partialObserver;
611
610
  if (isFunction(observerOrNext) || !observerOrNext) {
@@ -633,7 +632,7 @@
633
632
  _this.destination = new ConsumerObserver(partialObserver);
634
633
  return _this;
635
634
  }
636
- return SafeSubscriber2;
635
+ return SafeSubscriber22;
637
636
  }(Subscriber);
638
637
  function handleUnhandledError(error) {
639
638
  if (config.useDeprecatedSynchronousErrorHandling) {
@@ -657,18 +656,12 @@
657
656
  error: defaultErrorHandler,
658
657
  complete: noop
659
658
  };
660
-
661
- // ../../node_modules/rxjs/dist/esm5/internal/symbol/observable.js
662
659
  var observable = function() {
663
660
  return typeof Symbol === "function" && Symbol.observable || "@@observable";
664
661
  }();
665
-
666
- // ../../node_modules/rxjs/dist/esm5/internal/util/identity.js
667
662
  function identity(x) {
668
663
  return x;
669
664
  }
670
-
671
- // ../../node_modules/rxjs/dist/esm5/internal/util/pipe.js
672
665
  function pipeFromArray(fns) {
673
666
  if (fns.length === 0) {
674
667
  return identity;
@@ -682,21 +675,19 @@
682
675
  }, input);
683
676
  };
684
677
  }
685
-
686
- // ../../node_modules/rxjs/dist/esm5/internal/Observable.js
687
678
  var Observable = function() {
688
- function Observable2(subscribe) {
679
+ function Observable22(subscribe) {
689
680
  if (subscribe) {
690
681
  this._subscribe = subscribe;
691
682
  }
692
683
  }
693
- Observable2.prototype.lift = function(operator) {
694
- var observable2 = new Observable2();
695
- observable2.source = this;
696
- observable2.operator = operator;
697
- return observable2;
684
+ Observable22.prototype.lift = function(operator) {
685
+ var observable22 = new Observable22();
686
+ observable22.source = this;
687
+ observable22.operator = operator;
688
+ return observable22;
698
689
  };
699
- Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
690
+ Observable22.prototype.subscribe = function(observerOrNext, error, complete) {
700
691
  var _this = this;
701
692
  var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
702
693
  errorContext(function() {
@@ -705,14 +696,14 @@
705
696
  });
706
697
  return subscriber;
707
698
  };
708
- Observable2.prototype._trySubscribe = function(sink) {
699
+ Observable22.prototype._trySubscribe = function(sink) {
709
700
  try {
710
701
  return this._subscribe(sink);
711
702
  } catch (err) {
712
703
  sink.error(err);
713
704
  }
714
705
  };
715
- Observable2.prototype.forEach = function(next, promiseCtor) {
706
+ Observable22.prototype.forEach = function(next, promiseCtor) {
716
707
  var _this = this;
717
708
  promiseCtor = getPromiseCtor(promiseCtor);
718
709
  return new promiseCtor(function(resolve, reject) {
@@ -731,21 +722,21 @@
731
722
  _this.subscribe(subscriber);
732
723
  });
733
724
  };
734
- Observable2.prototype._subscribe = function(subscriber) {
725
+ Observable22.prototype._subscribe = function(subscriber) {
735
726
  var _a;
736
727
  return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
737
728
  };
738
- Observable2.prototype[observable] = function() {
729
+ Observable22.prototype[observable] = function() {
739
730
  return this;
740
731
  };
741
- Observable2.prototype.pipe = function() {
732
+ Observable22.prototype.pipe = function() {
742
733
  var operations = [];
743
734
  for (var _i = 0; _i < arguments.length; _i++) {
744
735
  operations[_i] = arguments[_i];
745
736
  }
746
737
  return pipeFromArray(operations)(this);
747
738
  };
748
- Observable2.prototype.toPromise = function(promiseCtor) {
739
+ Observable22.prototype.toPromise = function(promiseCtor) {
749
740
  var _this = this;
750
741
  promiseCtor = getPromiseCtor(promiseCtor);
751
742
  return new promiseCtor(function(resolve, reject) {
@@ -759,10 +750,10 @@
759
750
  });
760
751
  });
761
752
  };
762
- Observable2.create = function(subscribe) {
763
- return new Observable2(subscribe);
753
+ Observable22.create = function(subscribe) {
754
+ return new Observable22(subscribe);
764
755
  };
765
- return Observable2;
756
+ return Observable22;
766
757
  }();
767
758
  function getPromiseCtor(promiseCtor) {
768
759
  var _a;
@@ -774,8 +765,6 @@
774
765
  function isSubscriber(value) {
775
766
  return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
776
767
  }
777
-
778
- // ../../node_modules/rxjs/dist/esm5/internal/util/lift.js
779
768
  function hasLift(source) {
780
769
  return isFunction(source === null || source === void 0 ? void 0 : source.lift);
781
770
  }
@@ -793,8 +782,6 @@
793
782
  throw new TypeError("Unable to lift unknown Observable type");
794
783
  };
795
784
  }
796
-
797
- // ../../node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js
798
785
  function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
799
786
  return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
800
787
  }
@@ -841,8 +828,6 @@
841
828
  };
842
829
  return OperatorSubscriber2;
843
830
  }(Subscriber);
844
-
845
- // ../../node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js
846
831
  var ObjectUnsubscribedError = createErrorClass(function(_super) {
847
832
  return function ObjectUnsubscribedErrorImpl() {
848
833
  _super(this);
@@ -850,11 +835,9 @@
850
835
  this.message = "object unsubscribed";
851
836
  };
852
837
  });
853
-
854
- // ../../node_modules/rxjs/dist/esm5/internal/Subject.js
855
838
  var Subject = function(_super) {
856
- __extends(Subject2, _super);
857
- function Subject2() {
839
+ __extends(Subject22, _super);
840
+ function Subject22() {
858
841
  var _this = _super.call(this) || this;
859
842
  _this.closed = false;
860
843
  _this.currentObservers = null;
@@ -864,17 +847,17 @@
864
847
  _this.thrownError = null;
865
848
  return _this;
866
849
  }
867
- Subject2.prototype.lift = function(operator) {
850
+ Subject22.prototype.lift = function(operator) {
868
851
  var subject = new AnonymousSubject(this, this);
869
852
  subject.operator = operator;
870
853
  return subject;
871
854
  };
872
- Subject2.prototype._throwIfClosed = function() {
855
+ Subject22.prototype._throwIfClosed = function() {
873
856
  if (this.closed) {
874
857
  throw new ObjectUnsubscribedError();
875
858
  }
876
859
  };
877
- Subject2.prototype.next = function(value) {
860
+ Subject22.prototype.next = function(value) {
878
861
  var _this = this;
879
862
  errorContext(function() {
880
863
  var e_1, _a;
@@ -902,7 +885,7 @@
902
885
  }
903
886
  });
904
887
  };
905
- Subject2.prototype.error = function(err) {
888
+ Subject22.prototype.error = function(err) {
906
889
  var _this = this;
907
890
  errorContext(function() {
908
891
  _this._throwIfClosed();
@@ -916,7 +899,7 @@
916
899
  }
917
900
  });
918
901
  };
919
- Subject2.prototype.complete = function() {
902
+ Subject22.prototype.complete = function() {
920
903
  var _this = this;
921
904
  errorContext(function() {
922
905
  _this._throwIfClosed();
@@ -929,11 +912,11 @@
929
912
  }
930
913
  });
931
914
  };
932
- Subject2.prototype.unsubscribe = function() {
915
+ Subject22.prototype.unsubscribe = function() {
933
916
  this.isStopped = this.closed = true;
934
917
  this.observers = this.currentObservers = null;
935
918
  };
936
- Object.defineProperty(Subject2.prototype, "observed", {
919
+ Object.defineProperty(Subject22.prototype, "observed", {
937
920
  get: function() {
938
921
  var _a;
939
922
  return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
@@ -941,16 +924,16 @@
941
924
  enumerable: false,
942
925
  configurable: true
943
926
  });
944
- Subject2.prototype._trySubscribe = function(subscriber) {
927
+ Subject22.prototype._trySubscribe = function(subscriber) {
945
928
  this._throwIfClosed();
946
929
  return _super.prototype._trySubscribe.call(this, subscriber);
947
930
  };
948
- Subject2.prototype._subscribe = function(subscriber) {
931
+ Subject22.prototype._subscribe = function(subscriber) {
949
932
  this._throwIfClosed();
950
933
  this._checkFinalizedStatuses(subscriber);
951
934
  return this._innerSubscribe(subscriber);
952
935
  };
953
- Subject2.prototype._innerSubscribe = function(subscriber) {
936
+ Subject22.prototype._innerSubscribe = function(subscriber) {
954
937
  var _this = this;
955
938
  var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
956
939
  if (hasError || isStopped) {
@@ -963,7 +946,7 @@
963
946
  arrRemove(observers, subscriber);
964
947
  });
965
948
  };
966
- Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
949
+ Subject22.prototype._checkFinalizedStatuses = function(subscriber) {
967
950
  var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
968
951
  if (hasError) {
969
952
  subscriber.error(thrownError);
@@ -971,55 +954,51 @@
971
954
  subscriber.complete();
972
955
  }
973
956
  };
974
- Subject2.prototype.asObservable = function() {
975
- var observable2 = new Observable();
976
- observable2.source = this;
977
- return observable2;
957
+ Subject22.prototype.asObservable = function() {
958
+ var observable22 = new Observable();
959
+ observable22.source = this;
960
+ return observable22;
978
961
  };
979
- Subject2.create = function(destination, source) {
962
+ Subject22.create = function(destination, source) {
980
963
  return new AnonymousSubject(destination, source);
981
964
  };
982
- return Subject2;
965
+ return Subject22;
983
966
  }(Observable);
984
967
  var AnonymousSubject = function(_super) {
985
- __extends(AnonymousSubject2, _super);
986
- function AnonymousSubject2(destination, source) {
968
+ __extends(AnonymousSubject22, _super);
969
+ function AnonymousSubject22(destination, source) {
987
970
  var _this = _super.call(this) || this;
988
971
  _this.destination = destination;
989
972
  _this.source = source;
990
973
  return _this;
991
974
  }
992
- AnonymousSubject2.prototype.next = function(value) {
975
+ AnonymousSubject22.prototype.next = function(value) {
993
976
  var _a, _b;
994
977
  (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
995
978
  };
996
- AnonymousSubject2.prototype.error = function(err) {
979
+ AnonymousSubject22.prototype.error = function(err) {
997
980
  var _a, _b;
998
981
  (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
999
982
  };
1000
- AnonymousSubject2.prototype.complete = function() {
983
+ AnonymousSubject22.prototype.complete = function() {
1001
984
  var _a, _b;
1002
985
  (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1003
986
  };
1004
- AnonymousSubject2.prototype._subscribe = function(subscriber) {
987
+ AnonymousSubject22.prototype._subscribe = function(subscriber) {
1005
988
  var _a, _b;
1006
989
  return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1007
990
  };
1008
- return AnonymousSubject2;
991
+ return AnonymousSubject22;
1009
992
  }(Subject);
1010
-
1011
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js
1012
993
  var dateTimestampProvider = {
1013
994
  now: function() {
1014
995
  return (dateTimestampProvider.delegate || Date).now();
1015
996
  },
1016
997
  delegate: void 0
1017
998
  };
1018
-
1019
- // ../../node_modules/rxjs/dist/esm5/internal/ReplaySubject.js
1020
999
  var ReplaySubject = function(_super) {
1021
- __extends(ReplaySubject2, _super);
1022
- function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
1000
+ __extends(ReplaySubject22, _super);
1001
+ function ReplaySubject22(_bufferSize, _windowTime, _timestampProvider) {
1023
1002
  if (_bufferSize === void 0) {
1024
1003
  _bufferSize = Infinity;
1025
1004
  }
@@ -1040,7 +1019,7 @@
1040
1019
  _this._windowTime = Math.max(1, _windowTime);
1041
1020
  return _this;
1042
1021
  }
1043
- ReplaySubject2.prototype.next = function(value) {
1022
+ ReplaySubject22.prototype.next = function(value) {
1044
1023
  var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
1045
1024
  if (!isStopped) {
1046
1025
  _buffer.push(value);
@@ -1049,7 +1028,7 @@
1049
1028
  this._trimBuffer();
1050
1029
  _super.prototype.next.call(this, value);
1051
1030
  };
1052
- ReplaySubject2.prototype._subscribe = function(subscriber) {
1031
+ ReplaySubject22.prototype._subscribe = function(subscriber) {
1053
1032
  this._throwIfClosed();
1054
1033
  this._trimBuffer();
1055
1034
  var subscription = this._innerSubscribe(subscriber);
@@ -1061,7 +1040,7 @@
1061
1040
  this._checkFinalizedStatuses(subscriber);
1062
1041
  return subscription;
1063
1042
  };
1064
- ReplaySubject2.prototype._trimBuffer = function() {
1043
+ ReplaySubject22.prototype._trimBuffer = function() {
1065
1044
  var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
1066
1045
  var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
1067
1046
  _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
@@ -1074,10 +1053,8 @@
1074
1053
  last && _buffer.splice(0, last + 1);
1075
1054
  }
1076
1055
  };
1077
- return ReplaySubject2;
1056
+ return ReplaySubject22;
1078
1057
  }(Subject);
1079
-
1080
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/Action.js
1081
1058
  var Action = function(_super) {
1082
1059
  __extends(Action2, _super);
1083
1060
  function Action2(scheduler, work) {
@@ -1091,8 +1068,6 @@
1091
1068
  };
1092
1069
  return Action2;
1093
1070
  }(Subscription);
1094
-
1095
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js
1096
1071
  var intervalProvider = {
1097
1072
  setInterval: function(handler, timeout) {
1098
1073
  var args = [];
@@ -1111,8 +1086,6 @@
1111
1086
  },
1112
1087
  delegate: void 0
1113
1088
  };
1114
-
1115
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js
1116
1089
  var AsyncAction = function(_super) {
1117
1090
  __extends(AsyncAction2, _super);
1118
1091
  function AsyncAction2(scheduler, work) {
@@ -1201,8 +1174,6 @@
1201
1174
  };
1202
1175
  return AsyncAction2;
1203
1176
  }(Action);
1204
-
1205
- // ../../node_modules/rxjs/dist/esm5/internal/Scheduler.js
1206
1177
  var Scheduler = function() {
1207
1178
  function Scheduler2(schedulerActionCtor, now) {
1208
1179
  if (now === void 0) {
@@ -1220,8 +1191,6 @@
1220
1191
  Scheduler2.now = dateTimestampProvider.now;
1221
1192
  return Scheduler2;
1222
1193
  }();
1223
-
1224
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js
1225
1194
  var AsyncScheduler = function(_super) {
1226
1195
  __extends(AsyncScheduler2, _super);
1227
1196
  function AsyncScheduler2(SchedulerAction, now) {
@@ -1256,47 +1225,29 @@
1256
1225
  };
1257
1226
  return AsyncScheduler2;
1258
1227
  }(Scheduler);
1259
-
1260
- // ../../node_modules/rxjs/dist/esm5/internal/scheduler/async.js
1261
1228
  var asyncScheduler = new AsyncScheduler(AsyncAction);
1262
1229
  var async = asyncScheduler;
1263
-
1264
- // ../../node_modules/rxjs/dist/esm5/internal/observable/empty.js
1265
1230
  var EMPTY = new Observable(function(subscriber) {
1266
1231
  return subscriber.complete();
1267
1232
  });
1268
-
1269
- // ../../node_modules/rxjs/dist/esm5/internal/util/isScheduler.js
1270
1233
  function isScheduler(value) {
1271
1234
  return value && isFunction(value.schedule);
1272
1235
  }
1273
-
1274
- // ../../node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js
1275
1236
  var isArrayLike = function(x) {
1276
1237
  return x && typeof x.length === "number" && typeof x !== "function";
1277
1238
  };
1278
-
1279
- // ../../node_modules/rxjs/dist/esm5/internal/util/isPromise.js
1280
1239
  function isPromise(value) {
1281
1240
  return isFunction(value === null || value === void 0 ? void 0 : value.then);
1282
1241
  }
1283
-
1284
- // ../../node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js
1285
1242
  function isInteropObservable(input) {
1286
1243
  return isFunction(input[observable]);
1287
1244
  }
1288
-
1289
- // ../../node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js
1290
1245
  function isAsyncIterable(obj) {
1291
1246
  return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1292
1247
  }
1293
-
1294
- // ../../node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js
1295
1248
  function createInvalidObservableTypeError(input) {
1296
1249
  return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
1297
1250
  }
1298
-
1299
- // ../../node_modules/rxjs/dist/esm5/internal/symbol/iterator.js
1300
1251
  function getSymbolIterator() {
1301
1252
  if (typeof Symbol !== "function" || !Symbol.iterator) {
1302
1253
  return "@@iterator";
@@ -1304,13 +1255,9 @@
1304
1255
  return Symbol.iterator;
1305
1256
  }
1306
1257
  var iterator = getSymbolIterator();
1307
-
1308
- // ../../node_modules/rxjs/dist/esm5/internal/util/isIterable.js
1309
1258
  function isIterable(input) {
1310
1259
  return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
1311
1260
  }
1312
-
1313
- // ../../node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js
1314
1261
  function readableStreamLikeToAsyncGenerator(readableStream) {
1315
1262
  return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
1316
1263
  var reader, _a, value, done;
@@ -1354,8 +1301,6 @@
1354
1301
  function isReadableStreamLike(obj) {
1355
1302
  return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
1356
1303
  }
1357
-
1358
- // ../../node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js
1359
1304
  function innerFrom(input) {
1360
1305
  if (input instanceof Observable) {
1361
1306
  return input;
@@ -1499,30 +1444,6 @@
1499
1444
  });
1500
1445
  });
1501
1446
  }
1502
-
1503
- // ../../node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js
1504
- function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
1505
- if (delay === void 0) {
1506
- delay = 0;
1507
- }
1508
- if (repeat === void 0) {
1509
- repeat = false;
1510
- }
1511
- var scheduleSubscription = scheduler.schedule(function() {
1512
- work();
1513
- if (repeat) {
1514
- parentSubscription.add(this.schedule(null, delay));
1515
- } else {
1516
- this.unsubscribe();
1517
- }
1518
- }, delay);
1519
- parentSubscription.add(scheduleSubscription);
1520
- if (!repeat) {
1521
- return scheduleSubscription;
1522
- }
1523
- }
1524
-
1525
- // ../../node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
1526
1447
  var EmptyError = createErrorClass(function(_super) {
1527
1448
  return function EmptyErrorImpl() {
1528
1449
  _super(this);
@@ -1530,10 +1451,31 @@
1530
1451
  this.message = "no elements in sequence";
1531
1452
  };
1532
1453
  });
1533
-
1534
- // ../../node_modules/rxjs/dist/esm5/internal/firstValueFrom.js
1535
- function firstValueFrom(source, config2) {
1536
- var hasConfig = typeof config2 === "object";
1454
+ function lastValueFrom(source, config22) {
1455
+ var hasConfig = typeof config22 === "object";
1456
+ return new Promise(function(resolve, reject) {
1457
+ var _hasValue = false;
1458
+ var _value;
1459
+ source.subscribe({
1460
+ next: function(value) {
1461
+ _value = value;
1462
+ _hasValue = true;
1463
+ },
1464
+ error: reject,
1465
+ complete: function() {
1466
+ if (_hasValue) {
1467
+ resolve(_value);
1468
+ } else if (hasConfig) {
1469
+ resolve(config22.defaultValue);
1470
+ } else {
1471
+ reject(new EmptyError());
1472
+ }
1473
+ }
1474
+ });
1475
+ });
1476
+ }
1477
+ function firstValueFrom(source, config22) {
1478
+ var hasConfig = typeof config22 === "object";
1537
1479
  return new Promise(function(resolve, reject) {
1538
1480
  var subscriber = new SafeSubscriber({
1539
1481
  next: function(value) {
@@ -1543,7 +1485,7 @@
1543
1485
  error: reject,
1544
1486
  complete: function() {
1545
1487
  if (hasConfig) {
1546
- resolve(config2.defaultValue);
1488
+ resolve(config22.defaultValue);
1547
1489
  } else {
1548
1490
  reject(new EmptyError());
1549
1491
  }
@@ -1552,13 +1494,9 @@
1552
1494
  source.subscribe(subscriber);
1553
1495
  });
1554
1496
  }
1555
-
1556
- // ../../node_modules/rxjs/dist/esm5/internal/util/isDate.js
1557
1497
  function isValidDate(value) {
1558
1498
  return value instanceof Date && !isNaN(value);
1559
1499
  }
1560
-
1561
- // ../../node_modules/rxjs/dist/esm5/internal/operators/map.js
1562
1500
  function map(project, thisArg) {
1563
1501
  return operate(function(source, subscriber) {
1564
1502
  var index = 0;
@@ -1567,156 +1505,6 @@
1567
1505
  }));
1568
1506
  });
1569
1507
  }
1570
-
1571
- // ../../node_modules/rxjs/dist/esm5/internal/util/mapOneOrManyArgs.js
1572
- var isArray = Array.isArray;
1573
- function callOrApply(fn, args) {
1574
- return isArray(args) ? fn.apply(void 0, __spreadArray([], __read(args))) : fn(args);
1575
- }
1576
- function mapOneOrManyArgs(fn) {
1577
- return map(function(args) {
1578
- return callOrApply(fn, args);
1579
- });
1580
- }
1581
-
1582
- // ../../node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js
1583
- function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
1584
- var buffer = [];
1585
- var active = 0;
1586
- var index = 0;
1587
- var isComplete = false;
1588
- var checkComplete = function() {
1589
- if (isComplete && !buffer.length && !active) {
1590
- subscriber.complete();
1591
- }
1592
- };
1593
- var outerNext = function(value) {
1594
- return active < concurrent ? doInnerSub(value) : buffer.push(value);
1595
- };
1596
- var doInnerSub = function(value) {
1597
- expand && subscriber.next(value);
1598
- active++;
1599
- var innerComplete = false;
1600
- innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
1601
- onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
1602
- if (expand) {
1603
- outerNext(innerValue);
1604
- } else {
1605
- subscriber.next(innerValue);
1606
- }
1607
- }, function() {
1608
- innerComplete = true;
1609
- }, void 0, function() {
1610
- if (innerComplete) {
1611
- try {
1612
- active--;
1613
- var _loop_1 = function() {
1614
- var bufferedValue = buffer.shift();
1615
- if (innerSubScheduler) {
1616
- executeSchedule(subscriber, innerSubScheduler, function() {
1617
- return doInnerSub(bufferedValue);
1618
- });
1619
- } else {
1620
- doInnerSub(bufferedValue);
1621
- }
1622
- };
1623
- while (buffer.length && active < concurrent) {
1624
- _loop_1();
1625
- }
1626
- checkComplete();
1627
- } catch (err) {
1628
- subscriber.error(err);
1629
- }
1630
- }
1631
- }));
1632
- };
1633
- source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
1634
- isComplete = true;
1635
- checkComplete();
1636
- }));
1637
- return function() {
1638
- additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
1639
- };
1640
- }
1641
-
1642
- // ../../node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js
1643
- function mergeMap(project, resultSelector, concurrent) {
1644
- if (concurrent === void 0) {
1645
- concurrent = Infinity;
1646
- }
1647
- if (isFunction(resultSelector)) {
1648
- return mergeMap(function(a, i) {
1649
- return map(function(b, ii) {
1650
- return resultSelector(a, b, i, ii);
1651
- })(innerFrom(project(a, i)));
1652
- }, concurrent);
1653
- } else if (typeof resultSelector === "number") {
1654
- concurrent = resultSelector;
1655
- }
1656
- return operate(function(source, subscriber) {
1657
- return mergeInternals(source, subscriber, project, concurrent);
1658
- });
1659
- }
1660
-
1661
- // ../../node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js
1662
- var nodeEventEmitterMethods = ["addListener", "removeListener"];
1663
- var eventTargetMethods = ["addEventListener", "removeEventListener"];
1664
- var jqueryMethods = ["on", "off"];
1665
- function fromEvent(target, eventName, options, resultSelector) {
1666
- if (isFunction(options)) {
1667
- resultSelector = options;
1668
- options = void 0;
1669
- }
1670
- if (resultSelector) {
1671
- return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));
1672
- }
1673
- var _a = __read(isEventTarget(target) ? eventTargetMethods.map(function(methodName) {
1674
- return function(handler) {
1675
- return target[methodName](eventName, handler, options);
1676
- };
1677
- }) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [], 2), add = _a[0], remove = _a[1];
1678
- if (!add) {
1679
- if (isArrayLike(target)) {
1680
- return mergeMap(function(subTarget) {
1681
- return fromEvent(subTarget, eventName, options);
1682
- })(innerFrom(target));
1683
- }
1684
- }
1685
- if (!add) {
1686
- throw new TypeError("Invalid event target");
1687
- }
1688
- return new Observable(function(subscriber) {
1689
- var handler = function() {
1690
- var args = [];
1691
- for (var _i = 0; _i < arguments.length; _i++) {
1692
- args[_i] = arguments[_i];
1693
- }
1694
- return subscriber.next(1 < args.length ? args : args[0]);
1695
- };
1696
- add(handler);
1697
- return function() {
1698
- return remove(handler);
1699
- };
1700
- });
1701
- }
1702
- function toCommonHandlerRegistry(target, eventName) {
1703
- return function(methodName) {
1704
- return function(handler) {
1705
- return target[methodName](eventName, handler);
1706
- };
1707
- };
1708
- }
1709
- function isNodeStyleEventEmitter(target) {
1710
- return isFunction(target.addListener) && isFunction(target.removeListener);
1711
- }
1712
- function isJQueryStyleEventEmitter(target) {
1713
- return isFunction(target.on) && isFunction(target.off);
1714
- }
1715
- function isEventTarget(target) {
1716
- return isFunction(target.addEventListener) && isFunction(target.removeEventListener);
1717
- }
1718
-
1719
- // ../../node_modules/rxjs/dist/esm5/internal/observable/timer.js
1720
1508
  function timer(dueTime, intervalOrScheduler, scheduler) {
1721
1509
  if (dueTime === void 0) {
1722
1510
  dueTime = 0;
@@ -1750,8 +1538,6 @@
1750
1538
  }, due);
1751
1539
  });
1752
1540
  }
1753
-
1754
- // ../../node_modules/rxjs/dist/esm5/internal/observable/interval.js
1755
1541
  function interval(period, scheduler) {
1756
1542
  if (period === void 0) {
1757
1543
  period = 0;
@@ -1764,8 +1550,11 @@
1764
1550
  }
1765
1551
  return timer(period, period, scheduler);
1766
1552
  }
1767
-
1768
- // ../../node_modules/rxjs/dist/esm5/internal/operators/filter.js
1553
+ function not(pred, thisArg) {
1554
+ return function(value, index) {
1555
+ return !pred.call(thisArg, value, index);
1556
+ };
1557
+ }
1769
1558
  function filter(predicate, thisArg) {
1770
1559
  return operate(function(source, subscriber) {
1771
1560
  var index = 0;
@@ -1774,8 +1563,9 @@
1774
1563
  }));
1775
1564
  });
1776
1565
  }
1777
-
1778
- // ../../node_modules/rxjs/dist/esm5/internal/operators/take.js
1566
+ function partition(source, predicate, thisArg) {
1567
+ return [filter(predicate, thisArg)(innerFrom(source)), filter(not(predicate, thisArg))(innerFrom(source))];
1568
+ }
1779
1569
  function take(count) {
1780
1570
  return count <= 0 ? function() {
1781
1571
  return EMPTY;
@@ -1791,8 +1581,15 @@
1791
1581
  }));
1792
1582
  });
1793
1583
  }
1794
-
1795
- // ../post-channel/dist/esm/index.js
1584
+ var Msg = /* @__PURE__ */ ((_Msg) => {
1585
+ _Msg["Msg"] = "msg";
1586
+ return _Msg;
1587
+ })(Msg || {});
1588
+ var SynAck = /* @__PURE__ */ ((SynAck2) => {
1589
+ SynAck2["Ack"] = "ack";
1590
+ SynAck2["Syn"] = "syn";
1591
+ return SynAck2;
1592
+ })(SynAck || {});
1796
1593
  var fromServiceWorkerToReceiver = (self2, options) => (clientId) => ({
1797
1594
  postMessage: (message) => {
1798
1595
  const { errorCatcher: errorCatcher2 = () => () => {
@@ -1800,17 +1597,42 @@
1800
1597
  self2.clients.get(clientId).then((client) => client?.postMessage(message, rest)).catch(errorCatcher2(clientId, message));
1801
1598
  }
1802
1599
  });
1803
- var SynAck = /* @__PURE__ */ ((SynAck2) => {
1804
- SynAck2["Ack"] = "ack";
1805
- SynAck2["Syn"] = "syn";
1806
- return SynAck2;
1807
- })(SynAck || {});
1600
+ var fromWindowToReceiver = (self2, options) => {
1601
+ return {
1602
+ postMessage: (message) => {
1603
+ self2.postMessage(message, options?.targetOrigin ?? "*", options?.transfer);
1604
+ }
1605
+ };
1606
+ };
1607
+ var adapters = {
1608
+ fromChild(window2) {
1609
+ return {
1610
+ from: window2,
1611
+ to: fromWindowToReceiver(window2.parent)
1612
+ };
1613
+ },
1614
+ fromParent(iframe) {
1615
+ if (iframe.contentWindow) {
1616
+ if (iframe.ownerDocument.defaultView) {
1617
+ return {
1618
+ from: iframe.ownerDocument.defaultView,
1619
+ to: fromWindowToReceiver(iframe.contentWindow)
1620
+ };
1621
+ }
1622
+ throw new TypeError("iframe ownerDocument.defaultView is null");
1623
+ }
1624
+ throw new TypeError("iframe contentWindow is null");
1625
+ },
1626
+ fromServiceWorkerToReceiver,
1627
+ fromWindowToReceiver
1628
+ };
1808
1629
  var synackKeys = Object.values(SynAck);
1630
+ var msgKeys = Object.values(Msg);
1809
1631
  var getData = (message) => message.data;
1810
- var synackFilter = (type) => (data) => data.type === type.toString();
1632
+ var synackFilter = (type) => (data) => data.type === type;
1811
1633
  var isPostChannelMessage = (message) => {
1812
1634
  const data = message.data;
1813
- return typeof data === "object" && data !== null && "type" in data && typeof data.type === "string" && "instance" in data && typeof data.instance === "string" && "content" in data;
1635
+ return typeof data === "object" && data !== null && "type" in data && typeof data.type === "string" && [...synackKeys, ...msgKeys].includes(data.type) && "instance" in data && typeof data.instance === "string" && "content" in data;
1814
1636
  };
1815
1637
  var generateDarkColorHex = () => {
1816
1638
  let color = "#";
@@ -1819,123 +1641,133 @@
1819
1641
  }
1820
1642
  return color;
1821
1643
  };
1822
- var PostChannel = class {
1823
- __generateId;
1644
+ var PostChannel = class _PostChannel {
1645
+ static __generateId = () => {
1646
+ if (window) {
1647
+ return window.crypto.randomUUID();
1648
+ }
1649
+ return __require2("crypto").randomUUID();
1650
+ };
1651
+ static utils = {
1652
+ isPostChannelMessage
1653
+ };
1824
1654
  __instance;
1825
- __colors;
1655
+ __sender;
1826
1656
  __listener;
1827
1657
  __log;
1828
1658
  __receiver;
1659
+ __handler;
1829
1660
  __subscription;
1830
1661
  __okToWrite;
1831
1662
  __write$;
1832
- __recv$;
1833
- __connect(instance, period) {
1663
+ __synack$;
1664
+ __user$;
1665
+ __colors;
1666
+ __connect(period) {
1834
1667
  const synSubscription = interval(period).subscribe(() => this.__receiver.postMessage({
1835
- content: instance,
1836
- instance,
1837
- type: "syn".toString()
1668
+ content: this.__instance,
1669
+ instance: this.__instance,
1670
+ type: "syn"
1671
+ /* Syn */
1838
1672
  }));
1839
1673
  this.__subscription.add(synSubscription);
1840
1674
  this.__subscription.add(
1841
- this.__recv$.pipe(
1842
- map(getData),
1675
+ this.__user$.subscribe((message) => {
1676
+ lastValueFrom(this.__okToWrite.pipe(take(1))).then((foreignInstance) => {
1677
+ if (message.instance === foreignInstance) {
1678
+ this.__listener(message.content);
1679
+ if (message._id !== void 0) {
1680
+ this.__receiver.postMessage({
1681
+ content: message._id,
1682
+ instance: this.__instance,
1683
+ type: "ack"
1684
+ /* Ack */
1685
+ });
1686
+ }
1687
+ }
1688
+ }).catch((err) => {
1689
+ console.error("Unexpected error", err.message);
1690
+ });
1691
+ })
1692
+ );
1693
+ this.__subscription.add(
1694
+ this.__synack$.pipe(
1843
1695
  filter(synackFilter(
1844
1696
  "ack"
1845
1697
  /* Ack */
1846
1698
  )),
1847
- filter(({ content }) => content === instance),
1699
+ filter(({ content }) => content === this.instance),
1848
1700
  take(1)
1849
1701
  ).subscribe(({ instance: foreignInstance }) => {
1850
- this.__okToWrite.next(0);
1851
- this.__subscription.add(
1852
- this.__recv$.pipe(
1853
- filter(
1854
- ({ data: { type, instance: incomingInstance } }) => !synackKeys.includes(type) && incomingInstance === foreignInstance
1855
- )
1856
- ).subscribe((message) => {
1857
- this.__listener(message);
1858
- const { data } = message;
1859
- if (data._id !== void 0) {
1860
- this.__receiver.postMessage({
1861
- ...data,
1862
- content: data,
1863
- instance,
1864
- type: "ack"
1865
- /* Ack */
1866
- });
1867
- }
1868
- })
1869
- );
1702
+ this.__okToWrite.next(foreignInstance);
1870
1703
  synSubscription.unsubscribe();
1871
1704
  })
1872
1705
  );
1873
1706
  this.__subscription.add(
1874
- this.__recv$.pipe(
1875
- map(getData),
1707
+ this.__synack$.pipe(
1708
+ // must check whether is not short-circuiting
1709
+ // in an infinite loop by syncing with itself
1876
1710
  filter(synackFilter(
1877
1711
  "syn"
1878
1712
  /* Syn */
1879
1713
  )),
1880
- // must check whether is not short-circuiting
1881
- // in an infinite loop by syncing with itself
1882
- filter(({ instance: foreignInstance }) => foreignInstance !== instance),
1714
+ filter(({ instance: foreignInstance }) => foreignInstance !== this.instance),
1883
1715
  take(1)
1884
1716
  ).subscribe(({ content }) => {
1885
1717
  this.__receiver.postMessage({
1886
1718
  content,
1887
- instance,
1719
+ instance: this.instance,
1888
1720
  type: "ack"
1889
1721
  /* Ack */
1890
1722
  });
1891
1723
  })
1892
1724
  );
1893
1725
  }
1894
- __write(message, messageId) {
1895
- const extra = {};
1896
- if (messageId !== void 0) {
1897
- extra._id = messageId;
1898
- }
1726
+ __write(message, _id) {
1899
1727
  this.__subscription.add(
1900
1728
  this.__write$.subscribe(() => {
1901
- const outgoingMessage = Object.assign(
1902
- message,
1903
- {
1904
- instance: this.__instance,
1905
- ...extra
1906
- }
1907
- );
1729
+ const outgoingMessage = {
1730
+ _id,
1731
+ content: message,
1732
+ instance: this.__instance,
1733
+ type: "msg"
1734
+ /* Msg */
1735
+ };
1908
1736
  this.__receiver.postMessage(outgoingMessage);
1909
- this.__log?.(outgoingMessage);
1737
+ this.__log?.(message);
1910
1738
  })
1911
1739
  );
1912
1740
  }
1913
- constructor(listener, from, to, opts) {
1914
- this.__generateId = () => globalThis.crypto.randomUUID();
1915
- const instance = this.__generateId();
1916
- const messages = new ReplaySubject();
1917
- const fromSubscription = fromEvent(from, "message").pipe(filter(isPostChannelMessage)).subscribe(messages);
1741
+ constructor(listener, opts) {
1742
+ const events = new Subject();
1743
+ this.__instance = opts.instance ?? _PostChannel.__generateId();
1744
+ this.__listener = listener;
1745
+ this.__sender = opts.from;
1746
+ this.__receiver = opts.to;
1747
+ this.__handler = (message) => events.next(message);
1748
+ this.__log = opts.log && opts.log.bind(this);
1918
1749
  this.__subscription = new Subscription();
1919
- this.__subscription.add(fromSubscription);
1750
+ this.__sender.addEventListener("message", this.__handler);
1751
+ const [synackMessages, userMessages] = partition(
1752
+ events.pipe(filter(isPostChannelMessage), map(getData)),
1753
+ (message) => synackKeys.includes(message.type)
1754
+ );
1755
+ this.__synack$ = synackMessages;
1756
+ this.__user$ = userMessages;
1920
1757
  this.__okToWrite = new ReplaySubject(1);
1921
1758
  this.__write$ = this.__okToWrite.pipe(take(1));
1922
- this.__recv$ = messages.asObservable();
1923
- this.__listener = listener;
1924
- this.__log = opts?.log && opts.log.bind(this);
1925
- this.__instance = instance;
1926
1759
  const color = generateDarkColorHex();
1927
1760
  this.__colors = {
1928
1761
  bg: `${color}22`,
1929
1762
  fg: color
1930
1763
  };
1931
- this.__receiver = to;
1932
1764
  this.__connect(
1933
- instance,
1934
1765
  opts?.period ? opts.period : 10
1935
1766
  );
1936
1767
  }
1937
1768
  disconnect() {
1938
1769
  this.__subscription.unsubscribe();
1770
+ this.__sender.removeEventListener("message", this.__handler);
1939
1771
  }
1940
1772
  send(message) {
1941
1773
  this.__write(message);
@@ -1945,15 +1777,14 @@
1945
1777
  const promise = new Promise((resolve) => {
1946
1778
  done = resolve;
1947
1779
  });
1948
- const messageId = this.__generateId();
1780
+ const messageId = _PostChannel.__generateId();
1949
1781
  this.__subscription.add(
1950
- this.__recv$.pipe(
1951
- map(getData),
1782
+ this.__synack$.pipe(
1952
1783
  filter(synackFilter(
1953
1784
  "ack"
1954
1785
  /* Ack */
1955
1786
  )),
1956
- filter(({ _id }) => _id === messageId),
1787
+ filter(({ content }) => content === messageId),
1957
1788
  take(1)
1958
1789
  ).subscribe(() => done())
1959
1790
  );
@@ -1975,76 +1806,927 @@
1975
1806
  });
1976
1807
  }
1977
1808
  };
1978
- var src_default = PostChannel;
1979
-
1980
- // service-worker.ts
1981
- var openChannels = /* @__PURE__ */ new Map();
1982
- var sourceMap = /* @__PURE__ */ new Map();
1983
- var tosMap = /* @__PURE__ */ new Map();
1984
- var isAvailable = (key, map2) => {
1985
- const iter = map2.keys();
1986
- let matchingKey;
1987
- let { done = false, value } = iter.next();
1988
- while (!done && matchingKey === void 0) {
1989
- if (value !== void 0 && key.startsWith(value)) {
1990
- matchingKey = value;
1991
- done = true;
1992
- }
1993
- const { value: nextValue, done: nextDone = false } = iter.next();
1994
- done = nextDone;
1995
- value = nextValue;
1996
- }
1997
- return matchingKey;
1809
+ var createPostChannel = (listener, opts) => {
1810
+ const channel = new PostChannel(listener, opts);
1811
+ return channel.ready.then(() => channel);
1998
1812
  };
1999
- var isWindowClient = (source) => source !== null && "id" in source;
2000
- var errorCatcher = (clientId) => (error) => console.error(`[SW]: error on ${clientId} - ${String(error)}`);
2001
- var getReceiver = fromServiceWorkerToReceiver(self, { errorCatcher });
2002
- var makeListener = (clientId) => {
2003
- return function listener({ data }) {
2004
- const workerMessageData = data;
2005
- switch (workerMessageData.type) {
2006
- case "set-source-map": {
2007
- const { content } = workerMessageData;
2008
- const clientMaps = Object.entries(content).reduce((maps, [key, value]) => {
2009
- const { clientSourceMap, clientTosMap } = maps;
2010
- const { headers = {} } = value;
2011
- if (Object.keys(headers).length > 0) {
2012
- clientTosMap.set(encodeURI(value.to), headers);
2013
- }
2014
- clientSourceMap.set(encodeURI(key), value);
2015
- return maps;
2016
- }, { clientSourceMap: /* @__PURE__ */ new Map(), clientTosMap: /* @__PURE__ */ new Map() });
2017
- sourceMap.set(clientId, clientMaps.clientSourceMap);
2018
- tosMap.set(clientId, clientMaps.clientTosMap);
2019
- break;
2020
- }
2021
- case "unload-client": {
2022
- sourceMap.delete(clientId);
2023
- tosMap.delete(clientId);
2024
- openChannels.delete(clientId);
2025
- this.disconnect();
2026
- break;
2027
- }
2028
- default:
2029
- break;
2030
- }
1813
+
1814
+ // ../../node_modules/tslib/tslib.es6.mjs
1815
+ var extendStatics2 = function(d, b) {
1816
+ extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
1817
+ d2.__proto__ = b2;
1818
+ } || function(d2, b2) {
1819
+ for (var p in b2)
1820
+ if (Object.prototype.hasOwnProperty.call(b2, p))
1821
+ d2[p] = b2[p];
2031
1822
  };
1823
+ return extendStatics2(d, b);
2032
1824
  };
2033
- var createChannel = (clientId) => {
2034
- const listenerToSubscription = /* @__PURE__ */ new Map();
2035
- const buffer = new ReplaySubject();
2036
- const sender = {
2037
- addEventListener(_, listener) {
2038
- listenerToSubscription.set(listener, buffer.subscribe((msg) => listener(msg)));
2039
- },
2040
- removeEventListener(_, listener) {
2041
- listenerToSubscription.get(listener)?.unsubscribe();
1825
+ function __extends2(d, b) {
1826
+ if (typeof b !== "function" && b !== null)
1827
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1828
+ extendStatics2(d, b);
1829
+ function __() {
1830
+ this.constructor = d;
1831
+ }
1832
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1833
+ }
1834
+ function __values2(o) {
1835
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1836
+ if (m)
1837
+ return m.call(o);
1838
+ if (o && typeof o.length === "number")
1839
+ return {
1840
+ next: function() {
1841
+ if (o && i >= o.length)
1842
+ o = void 0;
1843
+ return { value: o && o[i++], done: !o };
1844
+ }
1845
+ };
1846
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1847
+ }
1848
+ function __read2(o, n) {
1849
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1850
+ if (!m)
1851
+ return o;
1852
+ var i = m.call(o), r, ar = [], e;
1853
+ try {
1854
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
1855
+ ar.push(r.value);
1856
+ } catch (error) {
1857
+ e = { error };
1858
+ } finally {
1859
+ try {
1860
+ if (r && !r.done && (m = i["return"]))
1861
+ m.call(i);
1862
+ } finally {
1863
+ if (e)
1864
+ throw e.error;
1865
+ }
1866
+ }
1867
+ return ar;
1868
+ }
1869
+ function __spreadArray2(to, from, pack) {
1870
+ if (pack || arguments.length === 2)
1871
+ for (var i = 0, l = from.length, ar; i < l; i++) {
1872
+ if (ar || !(i in from)) {
1873
+ if (!ar)
1874
+ ar = Array.prototype.slice.call(from, 0, i);
1875
+ ar[i] = from[i];
1876
+ }
1877
+ }
1878
+ return to.concat(ar || Array.prototype.slice.call(from));
1879
+ }
1880
+
1881
+ // ../../node_modules/rxjs/dist/esm5/internal/util/isFunction.js
1882
+ function isFunction2(value) {
1883
+ return typeof value === "function";
1884
+ }
1885
+
1886
+ // ../../node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
1887
+ function createErrorClass2(createImpl) {
1888
+ var _super = function(instance) {
1889
+ Error.call(instance);
1890
+ instance.stack = new Error().stack;
1891
+ };
1892
+ var ctorFunc = createImpl(_super);
1893
+ ctorFunc.prototype = Object.create(Error.prototype);
1894
+ ctorFunc.prototype.constructor = ctorFunc;
1895
+ return ctorFunc;
1896
+ }
1897
+
1898
+ // ../../node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
1899
+ var UnsubscriptionError2 = createErrorClass2(function(_super) {
1900
+ return function UnsubscriptionErrorImpl(errors) {
1901
+ _super(this);
1902
+ this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
1903
+ return i + 1 + ") " + err.toString();
1904
+ }).join("\n ") : "";
1905
+ this.name = "UnsubscriptionError";
1906
+ this.errors = errors;
1907
+ };
1908
+ });
1909
+
1910
+ // ../../node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
1911
+ function arrRemove2(arr, item) {
1912
+ if (arr) {
1913
+ var index = arr.indexOf(item);
1914
+ 0 <= index && arr.splice(index, 1);
1915
+ }
1916
+ }
1917
+
1918
+ // ../../node_modules/rxjs/dist/esm5/internal/Subscription.js
1919
+ var Subscription2 = function() {
1920
+ function Subscription3(initialTeardown) {
1921
+ this.initialTeardown = initialTeardown;
1922
+ this.closed = false;
1923
+ this._parentage = null;
1924
+ this._finalizers = null;
1925
+ }
1926
+ Subscription3.prototype.unsubscribe = function() {
1927
+ var e_1, _a, e_2, _b;
1928
+ var errors;
1929
+ if (!this.closed) {
1930
+ this.closed = true;
1931
+ var _parentage = this._parentage;
1932
+ if (_parentage) {
1933
+ this._parentage = null;
1934
+ if (Array.isArray(_parentage)) {
1935
+ try {
1936
+ for (var _parentage_1 = __values2(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
1937
+ var parent_1 = _parentage_1_1.value;
1938
+ parent_1.remove(this);
1939
+ }
1940
+ } catch (e_1_1) {
1941
+ e_1 = { error: e_1_1 };
1942
+ } finally {
1943
+ try {
1944
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return))
1945
+ _a.call(_parentage_1);
1946
+ } finally {
1947
+ if (e_1)
1948
+ throw e_1.error;
1949
+ }
1950
+ }
1951
+ } else {
1952
+ _parentage.remove(this);
1953
+ }
1954
+ }
1955
+ var initialFinalizer = this.initialTeardown;
1956
+ if (isFunction2(initialFinalizer)) {
1957
+ try {
1958
+ initialFinalizer();
1959
+ } catch (e) {
1960
+ errors = e instanceof UnsubscriptionError2 ? e.errors : [e];
1961
+ }
1962
+ }
1963
+ var _finalizers = this._finalizers;
1964
+ if (_finalizers) {
1965
+ this._finalizers = null;
1966
+ try {
1967
+ for (var _finalizers_1 = __values2(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
1968
+ var finalizer = _finalizers_1_1.value;
1969
+ try {
1970
+ execFinalizer2(finalizer);
1971
+ } catch (err) {
1972
+ errors = errors !== null && errors !== void 0 ? errors : [];
1973
+ if (err instanceof UnsubscriptionError2) {
1974
+ errors = __spreadArray2(__spreadArray2([], __read2(errors)), __read2(err.errors));
1975
+ } else {
1976
+ errors.push(err);
1977
+ }
1978
+ }
1979
+ }
1980
+ } catch (e_2_1) {
1981
+ e_2 = { error: e_2_1 };
1982
+ } finally {
1983
+ try {
1984
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
1985
+ _b.call(_finalizers_1);
1986
+ } finally {
1987
+ if (e_2)
1988
+ throw e_2.error;
1989
+ }
1990
+ }
1991
+ }
1992
+ if (errors) {
1993
+ throw new UnsubscriptionError2(errors);
1994
+ }
1995
+ }
1996
+ };
1997
+ Subscription3.prototype.add = function(teardown) {
1998
+ var _a;
1999
+ if (teardown && teardown !== this) {
2000
+ if (this.closed) {
2001
+ execFinalizer2(teardown);
2002
+ } else {
2003
+ if (teardown instanceof Subscription3) {
2004
+ if (teardown.closed || teardown._hasParent(this)) {
2005
+ return;
2006
+ }
2007
+ teardown._addParent(this);
2008
+ }
2009
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
2010
+ }
2011
+ }
2012
+ };
2013
+ Subscription3.prototype._hasParent = function(parent) {
2014
+ var _parentage = this._parentage;
2015
+ return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
2016
+ };
2017
+ Subscription3.prototype._addParent = function(parent) {
2018
+ var _parentage = this._parentage;
2019
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
2020
+ };
2021
+ Subscription3.prototype._removeParent = function(parent) {
2022
+ var _parentage = this._parentage;
2023
+ if (_parentage === parent) {
2024
+ this._parentage = null;
2025
+ } else if (Array.isArray(_parentage)) {
2026
+ arrRemove2(_parentage, parent);
2027
+ }
2028
+ };
2029
+ Subscription3.prototype.remove = function(teardown) {
2030
+ var _finalizers = this._finalizers;
2031
+ _finalizers && arrRemove2(_finalizers, teardown);
2032
+ if (teardown instanceof Subscription3) {
2033
+ teardown._removeParent(this);
2034
+ }
2035
+ };
2036
+ Subscription3.EMPTY = function() {
2037
+ var empty = new Subscription3();
2038
+ empty.closed = true;
2039
+ return empty;
2040
+ }();
2041
+ return Subscription3;
2042
+ }();
2043
+ var EMPTY_SUBSCRIPTION2 = Subscription2.EMPTY;
2044
+ function isSubscription2(value) {
2045
+ return value instanceof Subscription2 || value && "closed" in value && isFunction2(value.remove) && isFunction2(value.add) && isFunction2(value.unsubscribe);
2046
+ }
2047
+ function execFinalizer2(finalizer) {
2048
+ if (isFunction2(finalizer)) {
2049
+ finalizer();
2050
+ } else {
2051
+ finalizer.unsubscribe();
2052
+ }
2053
+ }
2054
+
2055
+ // ../../node_modules/rxjs/dist/esm5/internal/config.js
2056
+ var config2 = {
2057
+ onUnhandledError: null,
2058
+ onStoppedNotification: null,
2059
+ Promise: void 0,
2060
+ useDeprecatedSynchronousErrorHandling: false,
2061
+ useDeprecatedNextContext: false
2062
+ };
2063
+
2064
+ // ../../node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
2065
+ var timeoutProvider2 = {
2066
+ setTimeout: function(handler, timeout) {
2067
+ var args = [];
2068
+ for (var _i = 2; _i < arguments.length; _i++) {
2069
+ args[_i - 2] = arguments[_i];
2070
+ }
2071
+ var delegate = timeoutProvider2.delegate;
2072
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
2073
+ return delegate.setTimeout.apply(delegate, __spreadArray2([handler, timeout], __read2(args)));
2074
+ }
2075
+ return setTimeout.apply(void 0, __spreadArray2([handler, timeout], __read2(args)));
2076
+ },
2077
+ clearTimeout: function(handle) {
2078
+ var delegate = timeoutProvider2.delegate;
2079
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
2080
+ },
2081
+ delegate: void 0
2082
+ };
2083
+
2084
+ // ../../node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
2085
+ function reportUnhandledError2(err) {
2086
+ timeoutProvider2.setTimeout(function() {
2087
+ var onUnhandledError = config2.onUnhandledError;
2088
+ if (onUnhandledError) {
2089
+ onUnhandledError(err);
2090
+ } else {
2091
+ throw err;
2092
+ }
2093
+ });
2094
+ }
2095
+
2096
+ // ../../node_modules/rxjs/dist/esm5/internal/util/noop.js
2097
+ function noop2() {
2098
+ }
2099
+
2100
+ // ../../node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
2101
+ var COMPLETE_NOTIFICATION2 = function() {
2102
+ return createNotification2("C", void 0, void 0);
2103
+ }();
2104
+ function errorNotification2(error) {
2105
+ return createNotification2("E", void 0, error);
2106
+ }
2107
+ function nextNotification2(value) {
2108
+ return createNotification2("N", value, void 0);
2109
+ }
2110
+ function createNotification2(kind, value, error) {
2111
+ return {
2112
+ kind,
2113
+ value,
2114
+ error
2115
+ };
2116
+ }
2117
+
2118
+ // ../../node_modules/rxjs/dist/esm5/internal/util/errorContext.js
2119
+ var context2 = null;
2120
+ function errorContext2(cb) {
2121
+ if (config2.useDeprecatedSynchronousErrorHandling) {
2122
+ var isRoot = !context2;
2123
+ if (isRoot) {
2124
+ context2 = { errorThrown: false, error: null };
2125
+ }
2126
+ cb();
2127
+ if (isRoot) {
2128
+ var _a = context2, errorThrown = _a.errorThrown, error = _a.error;
2129
+ context2 = null;
2130
+ if (errorThrown) {
2131
+ throw error;
2132
+ }
2133
+ }
2134
+ } else {
2135
+ cb();
2136
+ }
2137
+ }
2138
+ function captureError2(err) {
2139
+ if (config2.useDeprecatedSynchronousErrorHandling && context2) {
2140
+ context2.errorThrown = true;
2141
+ context2.error = err;
2142
+ }
2143
+ }
2144
+
2145
+ // ../../node_modules/rxjs/dist/esm5/internal/Subscriber.js
2146
+ var Subscriber2 = function(_super) {
2147
+ __extends2(Subscriber3, _super);
2148
+ function Subscriber3(destination) {
2149
+ var _this = _super.call(this) || this;
2150
+ _this.isStopped = false;
2151
+ if (destination) {
2152
+ _this.destination = destination;
2153
+ if (isSubscription2(destination)) {
2154
+ destination.add(_this);
2155
+ }
2156
+ } else {
2157
+ _this.destination = EMPTY_OBSERVER2;
2158
+ }
2159
+ return _this;
2160
+ }
2161
+ Subscriber3.create = function(next, error, complete) {
2162
+ return new SafeSubscriber2(next, error, complete);
2163
+ };
2164
+ Subscriber3.prototype.next = function(value) {
2165
+ if (this.isStopped) {
2166
+ handleStoppedNotification2(nextNotification2(value), this);
2167
+ } else {
2168
+ this._next(value);
2169
+ }
2170
+ };
2171
+ Subscriber3.prototype.error = function(err) {
2172
+ if (this.isStopped) {
2173
+ handleStoppedNotification2(errorNotification2(err), this);
2174
+ } else {
2175
+ this.isStopped = true;
2176
+ this._error(err);
2177
+ }
2178
+ };
2179
+ Subscriber3.prototype.complete = function() {
2180
+ if (this.isStopped) {
2181
+ handleStoppedNotification2(COMPLETE_NOTIFICATION2, this);
2182
+ } else {
2183
+ this.isStopped = true;
2184
+ this._complete();
2185
+ }
2186
+ };
2187
+ Subscriber3.prototype.unsubscribe = function() {
2188
+ if (!this.closed) {
2189
+ this.isStopped = true;
2190
+ _super.prototype.unsubscribe.call(this);
2191
+ this.destination = null;
2192
+ }
2193
+ };
2194
+ Subscriber3.prototype._next = function(value) {
2195
+ this.destination.next(value);
2196
+ };
2197
+ Subscriber3.prototype._error = function(err) {
2198
+ try {
2199
+ this.destination.error(err);
2200
+ } finally {
2201
+ this.unsubscribe();
2202
+ }
2203
+ };
2204
+ Subscriber3.prototype._complete = function() {
2205
+ try {
2206
+ this.destination.complete();
2207
+ } finally {
2208
+ this.unsubscribe();
2209
+ }
2210
+ };
2211
+ return Subscriber3;
2212
+ }(Subscription2);
2213
+ var _bind2 = Function.prototype.bind;
2214
+ function bind2(fn, thisArg) {
2215
+ return _bind2.call(fn, thisArg);
2216
+ }
2217
+ var ConsumerObserver2 = function() {
2218
+ function ConsumerObserver3(partialObserver) {
2219
+ this.partialObserver = partialObserver;
2220
+ }
2221
+ ConsumerObserver3.prototype.next = function(value) {
2222
+ var partialObserver = this.partialObserver;
2223
+ if (partialObserver.next) {
2224
+ try {
2225
+ partialObserver.next(value);
2226
+ } catch (error) {
2227
+ handleUnhandledError2(error);
2228
+ }
2229
+ }
2230
+ };
2231
+ ConsumerObserver3.prototype.error = function(err) {
2232
+ var partialObserver = this.partialObserver;
2233
+ if (partialObserver.error) {
2234
+ try {
2235
+ partialObserver.error(err);
2236
+ } catch (error) {
2237
+ handleUnhandledError2(error);
2238
+ }
2239
+ } else {
2240
+ handleUnhandledError2(err);
2241
+ }
2242
+ };
2243
+ ConsumerObserver3.prototype.complete = function() {
2244
+ var partialObserver = this.partialObserver;
2245
+ if (partialObserver.complete) {
2246
+ try {
2247
+ partialObserver.complete();
2248
+ } catch (error) {
2249
+ handleUnhandledError2(error);
2250
+ }
2251
+ }
2252
+ };
2253
+ return ConsumerObserver3;
2254
+ }();
2255
+ var SafeSubscriber2 = function(_super) {
2256
+ __extends2(SafeSubscriber3, _super);
2257
+ function SafeSubscriber3(observerOrNext, error, complete) {
2258
+ var _this = _super.call(this) || this;
2259
+ var partialObserver;
2260
+ if (isFunction2(observerOrNext) || !observerOrNext) {
2261
+ partialObserver = {
2262
+ next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
2263
+ error: error !== null && error !== void 0 ? error : void 0,
2264
+ complete: complete !== null && complete !== void 0 ? complete : void 0
2265
+ };
2266
+ } else {
2267
+ var context_1;
2268
+ if (_this && config2.useDeprecatedNextContext) {
2269
+ context_1 = Object.create(observerOrNext);
2270
+ context_1.unsubscribe = function() {
2271
+ return _this.unsubscribe();
2272
+ };
2273
+ partialObserver = {
2274
+ next: observerOrNext.next && bind2(observerOrNext.next, context_1),
2275
+ error: observerOrNext.error && bind2(observerOrNext.error, context_1),
2276
+ complete: observerOrNext.complete && bind2(observerOrNext.complete, context_1)
2277
+ };
2278
+ } else {
2279
+ partialObserver = observerOrNext;
2280
+ }
2281
+ }
2282
+ _this.destination = new ConsumerObserver2(partialObserver);
2283
+ return _this;
2284
+ }
2285
+ return SafeSubscriber3;
2286
+ }(Subscriber2);
2287
+ function handleUnhandledError2(error) {
2288
+ if (config2.useDeprecatedSynchronousErrorHandling) {
2289
+ captureError2(error);
2290
+ } else {
2291
+ reportUnhandledError2(error);
2292
+ }
2293
+ }
2294
+ function defaultErrorHandler2(err) {
2295
+ throw err;
2296
+ }
2297
+ function handleStoppedNotification2(notification, subscriber) {
2298
+ var onStoppedNotification = config2.onStoppedNotification;
2299
+ onStoppedNotification && timeoutProvider2.setTimeout(function() {
2300
+ return onStoppedNotification(notification, subscriber);
2301
+ });
2302
+ }
2303
+ var EMPTY_OBSERVER2 = {
2304
+ closed: true,
2305
+ next: noop2,
2306
+ error: defaultErrorHandler2,
2307
+ complete: noop2
2308
+ };
2309
+
2310
+ // ../../node_modules/rxjs/dist/esm5/internal/symbol/observable.js
2311
+ var observable2 = function() {
2312
+ return typeof Symbol === "function" && Symbol.observable || "@@observable";
2313
+ }();
2314
+
2315
+ // ../../node_modules/rxjs/dist/esm5/internal/util/identity.js
2316
+ function identity2(x) {
2317
+ return x;
2318
+ }
2319
+
2320
+ // ../../node_modules/rxjs/dist/esm5/internal/util/pipe.js
2321
+ function pipeFromArray2(fns) {
2322
+ if (fns.length === 0) {
2323
+ return identity2;
2324
+ }
2325
+ if (fns.length === 1) {
2326
+ return fns[0];
2327
+ }
2328
+ return function piped(input) {
2329
+ return fns.reduce(function(prev, fn) {
2330
+ return fn(prev);
2331
+ }, input);
2332
+ };
2333
+ }
2334
+
2335
+ // ../../node_modules/rxjs/dist/esm5/internal/Observable.js
2336
+ var Observable2 = function() {
2337
+ function Observable3(subscribe) {
2338
+ if (subscribe) {
2339
+ this._subscribe = subscribe;
2340
+ }
2341
+ }
2342
+ Observable3.prototype.lift = function(operator) {
2343
+ var observable3 = new Observable3();
2344
+ observable3.source = this;
2345
+ observable3.operator = operator;
2346
+ return observable3;
2347
+ };
2348
+ Observable3.prototype.subscribe = function(observerOrNext, error, complete) {
2349
+ var _this = this;
2350
+ var subscriber = isSubscriber2(observerOrNext) ? observerOrNext : new SafeSubscriber2(observerOrNext, error, complete);
2351
+ errorContext2(function() {
2352
+ var _a = _this, operator = _a.operator, source = _a.source;
2353
+ subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
2354
+ });
2355
+ return subscriber;
2356
+ };
2357
+ Observable3.prototype._trySubscribe = function(sink) {
2358
+ try {
2359
+ return this._subscribe(sink);
2360
+ } catch (err) {
2361
+ sink.error(err);
2362
+ }
2363
+ };
2364
+ Observable3.prototype.forEach = function(next, promiseCtor) {
2365
+ var _this = this;
2366
+ promiseCtor = getPromiseCtor2(promiseCtor);
2367
+ return new promiseCtor(function(resolve, reject) {
2368
+ var subscriber = new SafeSubscriber2({
2369
+ next: function(value) {
2370
+ try {
2371
+ next(value);
2372
+ } catch (err) {
2373
+ reject(err);
2374
+ subscriber.unsubscribe();
2375
+ }
2376
+ },
2377
+ error: reject,
2378
+ complete: resolve
2379
+ });
2380
+ _this.subscribe(subscriber);
2381
+ });
2382
+ };
2383
+ Observable3.prototype._subscribe = function(subscriber) {
2384
+ var _a;
2385
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
2386
+ };
2387
+ Observable3.prototype[observable2] = function() {
2388
+ return this;
2389
+ };
2390
+ Observable3.prototype.pipe = function() {
2391
+ var operations = [];
2392
+ for (var _i = 0; _i < arguments.length; _i++) {
2393
+ operations[_i] = arguments[_i];
2394
+ }
2395
+ return pipeFromArray2(operations)(this);
2396
+ };
2397
+ Observable3.prototype.toPromise = function(promiseCtor) {
2398
+ var _this = this;
2399
+ promiseCtor = getPromiseCtor2(promiseCtor);
2400
+ return new promiseCtor(function(resolve, reject) {
2401
+ var value;
2402
+ _this.subscribe(function(x) {
2403
+ return value = x;
2404
+ }, function(err) {
2405
+ return reject(err);
2406
+ }, function() {
2407
+ return resolve(value);
2408
+ });
2409
+ });
2410
+ };
2411
+ Observable3.create = function(subscribe) {
2412
+ return new Observable3(subscribe);
2413
+ };
2414
+ return Observable3;
2415
+ }();
2416
+ function getPromiseCtor2(promiseCtor) {
2417
+ var _a;
2418
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config2.Promise) !== null && _a !== void 0 ? _a : Promise;
2419
+ }
2420
+ function isObserver2(value) {
2421
+ return value && isFunction2(value.next) && isFunction2(value.error) && isFunction2(value.complete);
2422
+ }
2423
+ function isSubscriber2(value) {
2424
+ return value && value instanceof Subscriber2 || isObserver2(value) && isSubscription2(value);
2425
+ }
2426
+
2427
+ // ../../node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js
2428
+ var ObjectUnsubscribedError2 = createErrorClass2(function(_super) {
2429
+ return function ObjectUnsubscribedErrorImpl() {
2430
+ _super(this);
2431
+ this.name = "ObjectUnsubscribedError";
2432
+ this.message = "object unsubscribed";
2433
+ };
2434
+ });
2435
+
2436
+ // ../../node_modules/rxjs/dist/esm5/internal/Subject.js
2437
+ var Subject2 = function(_super) {
2438
+ __extends2(Subject3, _super);
2439
+ function Subject3() {
2440
+ var _this = _super.call(this) || this;
2441
+ _this.closed = false;
2442
+ _this.currentObservers = null;
2443
+ _this.observers = [];
2444
+ _this.isStopped = false;
2445
+ _this.hasError = false;
2446
+ _this.thrownError = null;
2447
+ return _this;
2448
+ }
2449
+ Subject3.prototype.lift = function(operator) {
2450
+ var subject = new AnonymousSubject2(this, this);
2451
+ subject.operator = operator;
2452
+ return subject;
2453
+ };
2454
+ Subject3.prototype._throwIfClosed = function() {
2455
+ if (this.closed) {
2456
+ throw new ObjectUnsubscribedError2();
2457
+ }
2458
+ };
2459
+ Subject3.prototype.next = function(value) {
2460
+ var _this = this;
2461
+ errorContext2(function() {
2462
+ var e_1, _a;
2463
+ _this._throwIfClosed();
2464
+ if (!_this.isStopped) {
2465
+ if (!_this.currentObservers) {
2466
+ _this.currentObservers = Array.from(_this.observers);
2467
+ }
2468
+ try {
2469
+ for (var _b = __values2(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
2470
+ var observer = _c.value;
2471
+ observer.next(value);
2472
+ }
2473
+ } catch (e_1_1) {
2474
+ e_1 = { error: e_1_1 };
2475
+ } finally {
2476
+ try {
2477
+ if (_c && !_c.done && (_a = _b.return))
2478
+ _a.call(_b);
2479
+ } finally {
2480
+ if (e_1)
2481
+ throw e_1.error;
2482
+ }
2483
+ }
2484
+ }
2485
+ });
2486
+ };
2487
+ Subject3.prototype.error = function(err) {
2488
+ var _this = this;
2489
+ errorContext2(function() {
2490
+ _this._throwIfClosed();
2491
+ if (!_this.isStopped) {
2492
+ _this.hasError = _this.isStopped = true;
2493
+ _this.thrownError = err;
2494
+ var observers = _this.observers;
2495
+ while (observers.length) {
2496
+ observers.shift().error(err);
2497
+ }
2498
+ }
2499
+ });
2500
+ };
2501
+ Subject3.prototype.complete = function() {
2502
+ var _this = this;
2503
+ errorContext2(function() {
2504
+ _this._throwIfClosed();
2505
+ if (!_this.isStopped) {
2506
+ _this.isStopped = true;
2507
+ var observers = _this.observers;
2508
+ while (observers.length) {
2509
+ observers.shift().complete();
2510
+ }
2511
+ }
2512
+ });
2513
+ };
2514
+ Subject3.prototype.unsubscribe = function() {
2515
+ this.isStopped = this.closed = true;
2516
+ this.observers = this.currentObservers = null;
2517
+ };
2518
+ Object.defineProperty(Subject3.prototype, "observed", {
2519
+ get: function() {
2520
+ var _a;
2521
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
2522
+ },
2523
+ enumerable: false,
2524
+ configurable: true
2525
+ });
2526
+ Subject3.prototype._trySubscribe = function(subscriber) {
2527
+ this._throwIfClosed();
2528
+ return _super.prototype._trySubscribe.call(this, subscriber);
2529
+ };
2530
+ Subject3.prototype._subscribe = function(subscriber) {
2531
+ this._throwIfClosed();
2532
+ this._checkFinalizedStatuses(subscriber);
2533
+ return this._innerSubscribe(subscriber);
2534
+ };
2535
+ Subject3.prototype._innerSubscribe = function(subscriber) {
2536
+ var _this = this;
2537
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
2538
+ if (hasError || isStopped) {
2539
+ return EMPTY_SUBSCRIPTION2;
2540
+ }
2541
+ this.currentObservers = null;
2542
+ observers.push(subscriber);
2543
+ return new Subscription2(function() {
2544
+ _this.currentObservers = null;
2545
+ arrRemove2(observers, subscriber);
2546
+ });
2547
+ };
2548
+ Subject3.prototype._checkFinalizedStatuses = function(subscriber) {
2549
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
2550
+ if (hasError) {
2551
+ subscriber.error(thrownError);
2552
+ } else if (isStopped) {
2553
+ subscriber.complete();
2554
+ }
2555
+ };
2556
+ Subject3.prototype.asObservable = function() {
2557
+ var observable3 = new Observable2();
2558
+ observable3.source = this;
2559
+ return observable3;
2560
+ };
2561
+ Subject3.create = function(destination, source) {
2562
+ return new AnonymousSubject2(destination, source);
2563
+ };
2564
+ return Subject3;
2565
+ }(Observable2);
2566
+ var AnonymousSubject2 = function(_super) {
2567
+ __extends2(AnonymousSubject3, _super);
2568
+ function AnonymousSubject3(destination, source) {
2569
+ var _this = _super.call(this) || this;
2570
+ _this.destination = destination;
2571
+ _this.source = source;
2572
+ return _this;
2573
+ }
2574
+ AnonymousSubject3.prototype.next = function(value) {
2575
+ var _a, _b;
2576
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
2577
+ };
2578
+ AnonymousSubject3.prototype.error = function(err) {
2579
+ var _a, _b;
2580
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
2581
+ };
2582
+ AnonymousSubject3.prototype.complete = function() {
2583
+ var _a, _b;
2584
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
2585
+ };
2586
+ AnonymousSubject3.prototype._subscribe = function(subscriber) {
2587
+ var _a, _b;
2588
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION2;
2589
+ };
2590
+ return AnonymousSubject3;
2591
+ }(Subject2);
2592
+
2593
+ // ../../node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js
2594
+ var dateTimestampProvider2 = {
2595
+ now: function() {
2596
+ return (dateTimestampProvider2.delegate || Date).now();
2597
+ },
2598
+ delegate: void 0
2599
+ };
2600
+
2601
+ // ../../node_modules/rxjs/dist/esm5/internal/ReplaySubject.js
2602
+ var ReplaySubject2 = function(_super) {
2603
+ __extends2(ReplaySubject3, _super);
2604
+ function ReplaySubject3(_bufferSize, _windowTime, _timestampProvider) {
2605
+ if (_bufferSize === void 0) {
2606
+ _bufferSize = Infinity;
2607
+ }
2608
+ if (_windowTime === void 0) {
2609
+ _windowTime = Infinity;
2610
+ }
2611
+ if (_timestampProvider === void 0) {
2612
+ _timestampProvider = dateTimestampProvider2;
2613
+ }
2614
+ var _this = _super.call(this) || this;
2615
+ _this._bufferSize = _bufferSize;
2616
+ _this._windowTime = _windowTime;
2617
+ _this._timestampProvider = _timestampProvider;
2618
+ _this._buffer = [];
2619
+ _this._infiniteTimeWindow = true;
2620
+ _this._infiniteTimeWindow = _windowTime === Infinity;
2621
+ _this._bufferSize = Math.max(1, _bufferSize);
2622
+ _this._windowTime = Math.max(1, _windowTime);
2623
+ return _this;
2624
+ }
2625
+ ReplaySubject3.prototype.next = function(value) {
2626
+ var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
2627
+ if (!isStopped) {
2628
+ _buffer.push(value);
2629
+ !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
2630
+ }
2631
+ this._trimBuffer();
2632
+ _super.prototype.next.call(this, value);
2633
+ };
2634
+ ReplaySubject3.prototype._subscribe = function(subscriber) {
2635
+ this._throwIfClosed();
2636
+ this._trimBuffer();
2637
+ var subscription = this._innerSubscribe(subscriber);
2638
+ var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
2639
+ var copy = _buffer.slice();
2640
+ for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
2641
+ subscriber.next(copy[i]);
2642
+ }
2643
+ this._checkFinalizedStatuses(subscriber);
2644
+ return subscription;
2645
+ };
2646
+ ReplaySubject3.prototype._trimBuffer = function() {
2647
+ var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
2648
+ var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
2649
+ _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
2650
+ if (!_infiniteTimeWindow) {
2651
+ var now = _timestampProvider.now();
2652
+ var last = 0;
2653
+ for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
2654
+ last = i;
2655
+ }
2656
+ last && _buffer.splice(0, last + 1);
2657
+ }
2658
+ };
2659
+ return ReplaySubject3;
2660
+ }(Subject2);
2661
+
2662
+ // service-worker.ts
2663
+ var openChannels = /* @__PURE__ */ new Map();
2664
+ var sourceMap = /* @__PURE__ */ new Map();
2665
+ var tosMap = /* @__PURE__ */ new Map();
2666
+ var isAvailable = (key, map2) => {
2667
+ const iter = map2.keys();
2668
+ let matchingKey;
2669
+ let { done = false, value } = iter.next();
2670
+ while (!done && matchingKey === void 0) {
2671
+ if (value !== void 0 && key.startsWith(value)) {
2672
+ matchingKey = value;
2673
+ done = true;
2674
+ }
2675
+ const { value: nextValue, done: nextDone = false } = iter.next();
2676
+ done = nextDone;
2677
+ value = nextValue;
2678
+ }
2679
+ return matchingKey;
2680
+ };
2681
+ var isWindowClient = (source) => source !== null && "id" in source;
2682
+ var errorCatcher = (clientId) => (error) => console.error(`[SW]: error on ${clientId} - ${String(error)}`);
2683
+ var getReceiver = adapters.fromServiceWorkerToReceiver(self, { errorCatcher });
2684
+ var makeListener = (clientId) => {
2685
+ return function listener(_message) {
2686
+ const workerMessageData = _message;
2687
+ switch (workerMessageData.type) {
2688
+ case "set-source-map": {
2689
+ const { content } = workerMessageData;
2690
+ const clientMaps = Object.entries(content).reduce((maps, [key, value]) => {
2691
+ const { clientSourceMap, clientTosMap } = maps;
2692
+ const { headers = {} } = value;
2693
+ if (Object.keys(headers).length > 0) {
2694
+ clientTosMap.set(encodeURI(value.to), headers);
2695
+ }
2696
+ clientSourceMap.set(encodeURI(key), value);
2697
+ return maps;
2698
+ }, { clientSourceMap: /* @__PURE__ */ new Map(), clientTosMap: /* @__PURE__ */ new Map() });
2699
+ sourceMap.set(clientId, clientMaps.clientSourceMap);
2700
+ tosMap.set(clientId, clientMaps.clientTosMap);
2701
+ break;
2702
+ }
2703
+ case "unload-client": {
2704
+ sourceMap.delete(clientId);
2705
+ tosMap.delete(clientId);
2706
+ openChannels.delete(clientId);
2707
+ this.disconnect();
2708
+ break;
2709
+ }
2710
+ default:
2711
+ break;
2712
+ }
2713
+ };
2714
+ };
2715
+ var createChannel = (clientId) => {
2716
+ const listenerToSubscription = /* @__PURE__ */ new Map();
2717
+ const buffer = new ReplaySubject2();
2718
+ const sender = {
2719
+ addEventListener(_, listener) {
2720
+ listenerToSubscription.set(listener, buffer.subscribe((msg) => listener(msg)));
2721
+ },
2722
+ removeEventListener(_, listener) {
2723
+ listenerToSubscription.get(listener)?.unsubscribe();
2042
2724
  listenerToSubscription.delete(listener);
2043
2725
  }
2044
2726
  };
2045
2727
  return {
2046
2728
  buffer,
2047
- channel: new src_default(makeListener(clientId), sender, getReceiver(clientId))
2729
+ channel: createPostChannel(makeListener(clientId), { from: sender, instance: "service-worker", to: getReceiver(clientId) })
2048
2730
  };
2049
2731
  };
2050
2732
  var getCachedOpenChannel = (clientId) => {
@@ -2103,10 +2785,13 @@
2103
2785
  }
2104
2786
  const channel = openChannels.get(clientId)?.channel;
2105
2787
  if (channel !== void 0 && true) {
2106
- const style = { background: channel.colors.bg, color: channel.colors.fg };
2107
- console.groupCollapsed(`%c Fetch from Service Worker `, Object.entries(style).map(([styleKey, styleValue]) => `${styleKey}: ${styleValue}`).join("; "));
2108
- console.info(`sw is fetching %c ${finalUrl}`, "background: lightgreen; color: darkgreen");
2109
- console.groupEnd();
2788
+ channel.then((ch) => {
2789
+ const style = { background: ch.colors.bg, color: ch.colors.fg };
2790
+ console.groupCollapsed(`%c Fetch from Service Worker `, Object.entries(style).map(([styleKey, styleValue]) => `${styleKey}: ${styleValue}`).join("; "));
2791
+ console.info(`sw is fetching %c ${finalUrl}`, "background: lightgreen; color: darkgreen");
2792
+ console.groupEnd();
2793
+ }).catch(() => {
2794
+ });
2110
2795
  }
2111
2796
  event.respondWith(
2112
2797
  self.fetch(finalUrl, { ...event.request, headers }).catch((error) => {
@@ -2116,3 +2801,22 @@
2116
2801
  );
2117
2802
  });
2118
2803
  })();
2804
+ /*! Bundled license information:
2805
+
2806
+ @micro-lc/post-channel/dist/es/index.js:
2807
+ (*!
2808
+ Copyright 2023 Mia srl
2809
+
2810
+ Licensed under the Apache License, Version 2.0 (the "License");
2811
+ you may not use this file except in compliance with the License.
2812
+ You may obtain a copy of the License at
2813
+
2814
+ http://www.apache.org/licenses/LICENSE-2.0
2815
+
2816
+ Unless required by applicable law or agreed to in writing, software
2817
+ distributed under the License is distributed on an "AS IS" BASIS,
2818
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2819
+ See the License for the specific language governing permissions and
2820
+ limitations under the License.
2821
+ *)
2822
+ */