@acrobits/ipc-sdk 0.11.2-alpha.7 → 0.12.0-alpha.9

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/lib/ipc-sdk.js CHANGED
@@ -1,7 +1,7 @@
1
- var Pe = Object.defineProperty;
2
- var Ae = (s, t, e) => t in s ? Pe(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var M = (s, t, e) => (Ae(s, typeof t != "symbol" ? t + "" : t, e), e);
4
- var S = /* @__PURE__ */ ((s) => (s.BadgeQuery = "BADGE QUERY", s.Lifecycle = "LIFECYCLE", s.PushToken = "PUSH TOKEN", s.RequestLogs = "REQUEST LOGS", s))(S || {}), B = function(s, t) {
1
+ var Ae = Object.defineProperty;
2
+ var Pe = (s, t, e) => t in s ? Ae(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var I = (s, t, e) => (Pe(s, typeof t != "symbol" ? t + "" : t, e), e);
4
+ var C = /* @__PURE__ */ ((s) => (s.BadgeQuery = "BADGE QUERY", s.Lifecycle = "LIFECYCLE", s.PushToken = "PUSH TOKEN", s.RequestLogs = "REQUEST LOGS", s))(C || {}), B = function(s, t) {
5
5
  return B = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
6
6
  e.__proto__ = r;
7
7
  } || function(e, r) {
@@ -18,7 +18,7 @@ function U(s, t) {
18
18
  }
19
19
  s.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
20
20
  }
21
- function Q(s) {
21
+ function G(s) {
22
22
  var t = typeof Symbol == "function" && Symbol.iterator, e = t && s[t], r = 0;
23
23
  if (e)
24
24
  return e.call(s);
@@ -38,8 +38,8 @@ function $(s, t) {
38
38
  try {
39
39
  for (; (t === void 0 || t-- > 0) && !(n = r.next()).done; )
40
40
  i.push(n.value);
41
- } catch (c) {
42
- o = { error: c };
41
+ } catch (a) {
42
+ o = { error: a };
43
43
  } finally {
44
44
  try {
45
45
  n && !n.done && (e = r.return) && e.call(r);
@@ -56,7 +56,7 @@ function k(s, t, e) {
56
56
  (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
57
57
  return s.concat(i || Array.prototype.slice.call(t));
58
58
  }
59
- function C(s) {
59
+ function S(s) {
60
60
  return typeof s == "function";
61
61
  }
62
62
  function X(s) {
@@ -74,7 +74,7 @@ var V = X(function(s) {
74
74
  `) : "", this.name = "UnsubscriptionError", this.errors = e;
75
75
  };
76
76
  });
77
- function D(s, t) {
77
+ function N(s, t) {
78
78
  if (s) {
79
79
  var e = s.indexOf(t);
80
80
  0 <= e && s.splice(e, 1);
@@ -92,15 +92,15 @@ var x = function() {
92
92
  if (o)
93
93
  if (this._parentage = null, Array.isArray(o))
94
94
  try {
95
- for (var c = Q(o), a = c.next(); !a.done; a = c.next()) {
96
- var u = a.value;
97
- u.remove(this);
95
+ for (var a = G(o), c = a.next(); !c.done; c = a.next()) {
96
+ var l = c.value;
97
+ l.remove(this);
98
98
  }
99
99
  } catch (v) {
100
100
  t = { error: v };
101
101
  } finally {
102
102
  try {
103
- a && !a.done && (e = c.return) && e.call(c);
103
+ c && !c.done && (e = a.return) && e.call(a);
104
104
  } finally {
105
105
  if (t)
106
106
  throw t.error;
@@ -108,21 +108,21 @@ var x = function() {
108
108
  }
109
109
  else
110
110
  o.remove(this);
111
- var h = this.initialTeardown;
112
- if (C(h))
111
+ var d = this.initialTeardown;
112
+ if (S(d))
113
113
  try {
114
- h();
114
+ d();
115
115
  } catch (v) {
116
116
  i = v instanceof V ? v.errors : [v];
117
117
  }
118
- var l = this._finalizers;
119
- if (l) {
118
+ var u = this._finalizers;
119
+ if (u) {
120
120
  this._finalizers = null;
121
121
  try {
122
- for (var b = Q(l), p = b.next(); !p.done; p = b.next()) {
122
+ for (var b = G(u), p = b.next(); !p.done; p = b.next()) {
123
123
  var F = p.value;
124
124
  try {
125
- se(F);
125
+ ne(F);
126
126
  } catch (v) {
127
127
  i = i ?? [], v instanceof V ? i = k(k([], $(i)), $(v.errors)) : i.push(v);
128
128
  }
@@ -145,7 +145,7 @@ var x = function() {
145
145
  var e;
146
146
  if (t && t !== this)
147
147
  if (this.closed)
148
- se(t);
148
+ ne(t);
149
149
  else {
150
150
  if (t instanceof s) {
151
151
  if (t.closed || t._hasParent(this))
@@ -162,20 +162,20 @@ var x = function() {
162
162
  this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
163
163
  }, s.prototype._removeParent = function(t) {
164
164
  var e = this._parentage;
165
- e === t ? this._parentage = null : Array.isArray(e) && D(e, t);
165
+ e === t ? this._parentage = null : Array.isArray(e) && N(e, t);
166
166
  }, s.prototype.remove = function(t) {
167
167
  var e = this._finalizers;
168
- e && D(e, t), t instanceof s && t._removeParent(this);
168
+ e && N(e, t), t instanceof s && t._removeParent(this);
169
169
  }, s.EMPTY = function() {
170
170
  var t = new s();
171
171
  return t.closed = !0, t;
172
172
  }(), s;
173
173
  }(), ve = x.EMPTY;
174
174
  function be(s) {
175
- return s instanceof x || s && "closed" in s && C(s.remove) && C(s.add) && C(s.unsubscribe);
175
+ return s instanceof x || s && "closed" in s && S(s.remove) && S(s.add) && S(s.unsubscribe);
176
176
  }
177
- function se(s) {
178
- C(s) ? s() : s.unsubscribe();
177
+ function ne(s) {
178
+ S(s) ? s() : s.unsubscribe();
179
179
  }
180
180
  var we = {
181
181
  onUnhandledError: null,
@@ -183,24 +183,24 @@ var we = {
183
183
  Promise: void 0,
184
184
  useDeprecatedSynchronousErrorHandling: !1,
185
185
  useDeprecatedNextContext: !1
186
- }, Se = {
186
+ }, Ce = {
187
187
  setTimeout: function(s, t) {
188
188
  for (var e = [], r = 2; r < arguments.length; r++)
189
189
  e[r - 2] = arguments[r];
190
190
  return setTimeout.apply(void 0, k([s, t], $(e)));
191
191
  },
192
192
  clearTimeout: function(s) {
193
- var t = Se.delegate;
193
+ var t = Ce.delegate;
194
194
  return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(s);
195
195
  },
196
196
  delegate: void 0
197
197
  };
198
198
  function _e(s) {
199
- Se.setTimeout(function() {
199
+ Ce.setTimeout(function() {
200
200
  throw s;
201
201
  });
202
202
  }
203
- function ne() {
203
+ function se() {
204
204
  }
205
205
  function O(s) {
206
206
  s();
@@ -212,7 +212,7 @@ var Z = function(s) {
212
212
  return r.isStopped = !1, e ? (r.destination = e, be(e) && e.add(r)) : r.destination = ke, r;
213
213
  }
214
214
  return t.create = function(e, r, n) {
215
- return new N(e, r, n);
215
+ return new D(e, r, n);
216
216
  }, t.prototype.next = function(e) {
217
217
  this.isStopped || this._next(e);
218
218
  }, t.prototype.error = function(e) {
@@ -250,7 +250,7 @@ var Oe = function() {
250
250
  try {
251
251
  e.next(t);
252
252
  } catch (r) {
253
- A(r);
253
+ P(r);
254
254
  }
255
255
  }, s.prototype.error = function(t) {
256
256
  var e = this.partialObserver;
@@ -258,44 +258,44 @@ var Oe = function() {
258
258
  try {
259
259
  e.error(t);
260
260
  } catch (r) {
261
- A(r);
261
+ P(r);
262
262
  }
263
263
  else
264
- A(t);
264
+ P(t);
265
265
  }, s.prototype.complete = function() {
266
266
  var t = this.partialObserver;
267
267
  if (t.complete)
268
268
  try {
269
269
  t.complete();
270
270
  } catch (e) {
271
- A(e);
271
+ P(e);
272
272
  }
273
273
  }, s;
274
- }(), N = function(s) {
274
+ }(), D = function(s) {
275
275
  U(t, s);
276
276
  function t(e, r, n) {
277
277
  var i = s.call(this) || this, o;
278
- if (C(e) || !e)
278
+ if (S(e) || !e)
279
279
  o = {
280
280
  next: e ?? void 0,
281
281
  error: r ?? void 0,
282
282
  complete: n ?? void 0
283
283
  };
284
284
  else {
285
- var c;
286
- i && we.useDeprecatedNextContext ? (c = Object.create(e), c.unsubscribe = function() {
285
+ var a;
286
+ i && we.useDeprecatedNextContext ? (a = Object.create(e), a.unsubscribe = function() {
287
287
  return i.unsubscribe();
288
288
  }, o = {
289
- next: e.next && H(e.next, c),
290
- error: e.error && H(e.error, c),
291
- complete: e.complete && H(e.complete, c)
289
+ next: e.next && H(e.next, a),
290
+ error: e.error && H(e.error, a),
291
+ complete: e.complete && H(e.complete, a)
292
292
  }) : o = e;
293
293
  }
294
294
  return i.destination = new Oe(o), i;
295
295
  }
296
296
  return t;
297
297
  }(Z);
298
- function A(s) {
298
+ function P(s) {
299
299
  _e(s);
300
300
  }
301
301
  function $e(s) {
@@ -303,23 +303,23 @@ function $e(s) {
303
303
  }
304
304
  var ke = {
305
305
  closed: !0,
306
- next: ne,
306
+ next: se,
307
307
  error: $e,
308
- complete: ne
309
- }, De = function() {
308
+ complete: se
309
+ }, Ne = function() {
310
310
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
311
311
  }();
312
- function Ce(s) {
312
+ function Se(s) {
313
313
  return s;
314
314
  }
315
- function Ne(s) {
316
- return s.length === 0 ? Ce : s.length === 1 ? s[0] : function(e) {
315
+ function De(s) {
316
+ return s.length === 0 ? Se : s.length === 1 ? s[0] : function(e) {
317
317
  return s.reduce(function(r, n) {
318
318
  return n(r);
319
319
  }, e);
320
320
  };
321
321
  }
322
- var G = function() {
322
+ var Q = function() {
323
323
  function s(t) {
324
324
  t && (this._subscribe = t);
325
325
  }
@@ -327,10 +327,10 @@ var G = function() {
327
327
  var e = new s();
328
328
  return e.source = this, e.operator = t, e;
329
329
  }, s.prototype.subscribe = function(t, e, r) {
330
- var n = this, i = Ve(t) ? t : new N(t, e, r);
330
+ var n = this, i = Ve(t) ? t : new D(t, e, r);
331
331
  return O(function() {
332
- var o = n, c = o.operator, a = o.source;
333
- i.add(c ? c.call(i, a) : a ? n._subscribe(i) : n._trySubscribe(i));
332
+ var o = n, a = o.operator, c = o.source;
333
+ i.add(a ? a.call(i, c) : c ? n._subscribe(i) : n._trySubscribe(i));
334
334
  }), i;
335
335
  }, s.prototype._trySubscribe = function(t) {
336
336
  try {
@@ -341,12 +341,12 @@ var G = function() {
341
341
  }, s.prototype.forEach = function(t, e) {
342
342
  var r = this;
343
343
  return e = ie(e), new e(function(n, i) {
344
- var o = new N({
345
- next: function(c) {
344
+ var o = new D({
345
+ next: function(a) {
346
346
  try {
347
- t(c);
348
- } catch (a) {
349
- i(a), o.unsubscribe();
347
+ t(a);
348
+ } catch (c) {
349
+ i(c), o.unsubscribe();
350
350
  }
351
351
  },
352
352
  error: i,
@@ -357,12 +357,12 @@ var G = function() {
357
357
  }, s.prototype._subscribe = function(t) {
358
358
  var e;
359
359
  return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
360
- }, s.prototype[De] = function() {
360
+ }, s.prototype[Ne] = function() {
361
361
  return this;
362
362
  }, s.prototype.pipe = function() {
363
363
  for (var t = [], e = 0; e < arguments.length; e++)
364
364
  t[e] = arguments[e];
365
- return Ne(t)(this);
365
+ return De(t)(this);
366
366
  }, s.prototype.toPromise = function(t) {
367
367
  var e = this;
368
368
  return t = ie(t), new t(function(r, n) {
@@ -384,13 +384,13 @@ function ie(s) {
384
384
  return (t = s ?? we.Promise) !== null && t !== void 0 ? t : Promise;
385
385
  }
386
386
  function Fe(s) {
387
- return s && C(s.next) && C(s.error) && C(s.complete);
387
+ return s && S(s.next) && S(s.error) && S(s.complete);
388
388
  }
389
389
  function Ve(s) {
390
390
  return s && s instanceof Z || Fe(s) && be(s);
391
391
  }
392
392
  function He(s) {
393
- return C(s == null ? void 0 : s.lift);
393
+ return S(s == null ? void 0 : s.lift);
394
394
  }
395
395
  function Ee(s) {
396
396
  return function(t) {
@@ -405,36 +405,36 @@ function Ee(s) {
405
405
  throw new TypeError("Unable to lift unknown Observable type");
406
406
  };
407
407
  }
408
- function Me(s, t, e, r, n) {
409
- return new je(s, t, e, r, n);
408
+ function Ie(s, t, e, r, n) {
409
+ return new qe(s, t, e, r, n);
410
410
  }
411
- var je = function(s) {
411
+ var qe = function(s) {
412
412
  U(t, s);
413
- function t(e, r, n, i, o, c) {
414
- var a = s.call(this, e) || this;
415
- return a.onFinalize = o, a.shouldUnsubscribe = c, a._next = r ? function(u) {
413
+ function t(e, r, n, i, o, a) {
414
+ var c = s.call(this, e) || this;
415
+ return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(l) {
416
416
  try {
417
- r(u);
418
- } catch (h) {
419
- e.error(h);
417
+ r(l);
418
+ } catch (d) {
419
+ e.error(d);
420
420
  }
421
- } : s.prototype._next, a._error = i ? function(u) {
421
+ } : s.prototype._next, c._error = i ? function(l) {
422
422
  try {
423
- i(u);
424
- } catch (h) {
425
- e.error(h);
423
+ i(l);
424
+ } catch (d) {
425
+ e.error(d);
426
426
  } finally {
427
427
  this.unsubscribe();
428
428
  }
429
- } : s.prototype._error, a._complete = n ? function() {
429
+ } : s.prototype._error, c._complete = n ? function() {
430
430
  try {
431
431
  n();
432
- } catch (u) {
433
- e.error(u);
432
+ } catch (l) {
433
+ e.error(l);
434
434
  } finally {
435
435
  this.unsubscribe();
436
436
  }
437
- } : s.prototype._complete, a;
437
+ } : s.prototype._complete, c;
438
438
  }
439
439
  return t.prototype.unsubscribe = function() {
440
440
  var e;
@@ -443,11 +443,11 @@ var je = function(s) {
443
443
  s.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
444
444
  }
445
445
  }, t;
446
- }(Z), qe = X(function(s) {
446
+ }(Z), je = X(function(s) {
447
447
  return function() {
448
448
  s(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
449
449
  };
450
- }), Ie = function(s) {
450
+ }), Me = function(s) {
451
451
  U(t, s);
452
452
  function t() {
453
453
  var e = s.call(this) || this;
@@ -458,7 +458,7 @@ var je = function(s) {
458
458
  return r.operator = e, r;
459
459
  }, t.prototype._throwIfClosed = function() {
460
460
  if (this.closed)
461
- throw new qe();
461
+ throw new je();
462
462
  }, t.prototype.next = function(e) {
463
463
  var r = this;
464
464
  O(function() {
@@ -466,15 +466,15 @@ var je = function(s) {
466
466
  if (r._throwIfClosed(), !r.isStopped) {
467
467
  r.currentObservers || (r.currentObservers = Array.from(r.observers));
468
468
  try {
469
- for (var o = Q(r.currentObservers), c = o.next(); !c.done; c = o.next()) {
470
- var a = c.value;
471
- a.next(e);
469
+ for (var o = G(r.currentObservers), a = o.next(); !a.done; a = o.next()) {
470
+ var c = a.value;
471
+ c.next(e);
472
472
  }
473
- } catch (u) {
474
- n = { error: u };
473
+ } catch (l) {
474
+ n = { error: l };
475
475
  } finally {
476
476
  try {
477
- c && !c.done && (i = o.return) && i.call(o);
477
+ a && !a.done && (i = o.return) && i.call(o);
478
478
  } finally {
479
479
  if (n)
480
480
  throw n.error;
@@ -514,20 +514,20 @@ var je = function(s) {
514
514
  }, t.prototype._subscribe = function(e) {
515
515
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
516
516
  }, t.prototype._innerSubscribe = function(e) {
517
- var r = this, n = this, i = n.hasError, o = n.isStopped, c = n.observers;
518
- return i || o ? ve : (this.currentObservers = null, c.push(e), new x(function() {
519
- r.currentObservers = null, D(c, e);
517
+ var r = this, n = this, i = n.hasError, o = n.isStopped, a = n.observers;
518
+ return i || o ? ve : (this.currentObservers = null, a.push(e), new x(function() {
519
+ r.currentObservers = null, N(a, e);
520
520
  }));
521
521
  }, t.prototype._checkFinalizedStatuses = function(e) {
522
522
  var r = this, n = r.hasError, i = r.thrownError, o = r.isStopped;
523
523
  n ? e.error(i) : o && e.complete();
524
524
  }, t.prototype.asObservable = function() {
525
- var e = new G();
525
+ var e = new Q();
526
526
  return e.source = this, e;
527
527
  }, t.create = function(e, r) {
528
528
  return new oe(e, r);
529
529
  }, t;
530
- }(G), oe = function(s) {
530
+ }(Q), oe = function(s) {
531
531
  U(t, s);
532
532
  function t(e, r) {
533
533
  var n = s.call(this) || this;
@@ -546,12 +546,12 @@ var je = function(s) {
546
546
  var r, n;
547
547
  return (n = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && n !== void 0 ? n : ve;
548
548
  }, t;
549
- }(Ie), Be = {
549
+ }(Me), Be = {
550
550
  now: function() {
551
551
  return Date.now();
552
552
  },
553
553
  delegate: void 0
554
- }, Qe = function(s) {
554
+ }, Ge = function(s) {
555
555
  U(t, s);
556
556
  function t(e, r) {
557
557
  return s.call(this) || this;
@@ -570,7 +570,7 @@ var je = function(s) {
570
570
  return ((t == null ? void 0 : t.clearInterval) || clearInterval)(s);
571
571
  },
572
572
  delegate: void 0
573
- }, Ge = function(s) {
573
+ }, Qe = function(s) {
574
574
  U(t, s);
575
575
  function t(e, r) {
576
576
  var n = s.call(this, e, r) || this;
@@ -609,10 +609,10 @@ var je = function(s) {
609
609
  }, t.prototype.unsubscribe = function() {
610
610
  if (!this.closed) {
611
611
  var e = this, r = e.id, n = e.scheduler, i = n.actions;
612
- this.work = this.state = this.scheduler = null, this.pending = !1, D(i, this), r != null && (this.id = this.recycleAsyncId(n, r, null)), this.delay = null, s.prototype.unsubscribe.call(this);
612
+ this.work = this.state = this.scheduler = null, this.pending = !1, N(i, this), r != null && (this.id = this.recycleAsyncId(n, r, null)), this.delay = null, s.prototype.unsubscribe.call(this);
613
613
  }
614
614
  }, t;
615
- }(Qe), ce = function() {
615
+ }(Ge), ce = function() {
616
616
  function s(t, e) {
617
617
  e === void 0 && (e = s.now), this.schedulerActionCtor = t, this.now = e;
618
618
  }
@@ -644,9 +644,9 @@ var je = function(s) {
644
644
  throw n;
645
645
  }
646
646
  }, t;
647
- }(ce), ze = new Ye(Ge), Je = ze;
647
+ }(ce), ze = new Ye(Qe), Je = ze;
648
648
  function We(s) {
649
- return s && C(s.schedule);
649
+ return s && S(s.schedule);
650
650
  }
651
651
  var Ke = X(function(s) {
652
652
  return function() {
@@ -656,7 +656,7 @@ var Ke = X(function(s) {
656
656
  function T(s, t) {
657
657
  var e = typeof t == "object";
658
658
  return new Promise(function(r, n) {
659
- var i = new N({
659
+ var i = new D({
660
660
  next: function(o) {
661
661
  r(o), i.unsubscribe();
662
662
  },
@@ -674,7 +674,7 @@ function Xe(s) {
674
674
  function _(s, t) {
675
675
  return Ee(function(e, r) {
676
676
  var n = 0;
677
- e.subscribe(Me(r, function(i) {
677
+ e.subscribe(Ie(r, function(i) {
678
678
  r.next(s.call(t, i, n++));
679
679
  }));
680
680
  });
@@ -682,7 +682,7 @@ function _(s, t) {
682
682
  function Ze(s, t, e) {
683
683
  s === void 0 && (s = 0), e === void 0 && (e = Je);
684
684
  var r = -1;
685
- return t != null && (We(t) ? e = t : r = t), new G(function(n) {
685
+ return t != null && (We(t) ? e = t : r = t), new Q(function(n) {
686
686
  var i = Xe(s) ? +s - e.now() : s;
687
687
  i < 0 && (i = 0);
688
688
  var o = 0;
@@ -692,33 +692,33 @@ function Ze(s, t, e) {
692
692
  });
693
693
  }
694
694
  function et(s, t, e) {
695
- var r = C(s) || t || e ? { next: s, error: t, complete: e } : s;
695
+ var r = S(s) || t || e ? { next: s, error: t, complete: e } : s;
696
696
  return r ? Ee(function(n, i) {
697
697
  var o;
698
698
  (o = r.subscribe) === null || o === void 0 || o.call(r);
699
- var c = !0;
700
- n.subscribe(Me(i, function(a) {
701
- var u;
702
- (u = r.next) === null || u === void 0 || u.call(r, a), i.next(a);
699
+ var a = !0;
700
+ n.subscribe(Ie(i, function(c) {
701
+ var l;
702
+ (l = r.next) === null || l === void 0 || l.call(r, c), i.next(c);
703
703
  }, function() {
704
- var a;
705
- c = !1, (a = r.complete) === null || a === void 0 || a.call(r), i.complete();
706
- }, function(a) {
707
- var u;
708
- c = !1, (u = r.error) === null || u === void 0 || u.call(r, a), i.error(a);
704
+ var c;
705
+ a = !1, (c = r.complete) === null || c === void 0 || c.call(r), i.complete();
706
+ }, function(c) {
707
+ var l;
708
+ a = !1, (l = r.error) === null || l === void 0 || l.call(r, c), i.error(c);
709
709
  }, function() {
710
- var a, u;
711
- c && ((a = r.unsubscribe) === null || a === void 0 || a.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r);
710
+ var c, l;
711
+ a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (l = r.finalize) === null || l === void 0 || l.call(r);
712
712
  }));
713
- }) : Ce;
713
+ }) : Se;
714
714
  }
715
- var tt = Object.defineProperty, rt = (s, t, e) => t in s ? tt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, I = (s, t, e) => (rt(s, typeof t != "symbol" ? t + "" : t, e), e);
716
- class d extends Error {
715
+ var tt = Object.defineProperty, rt = (s, t, e) => t in s ? tt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, M = (s, t, e) => (rt(s, typeof t != "symbol" ? t + "" : t, e), e);
716
+ class h extends Error {
717
717
  constructor(t) {
718
- super(`Incorrect context (${t}). Cannot perform the requested operation.`), I(this, "context"), this.context = t;
718
+ super(`Incorrect context (${t}). Cannot perform the requested operation.`), M(this, "context"), this.context = t;
719
719
  }
720
720
  }
721
- class y extends Error {
721
+ class m extends Error {
722
722
  constructor(t, e, r) {
723
723
  super(`Invalid parameter (${t}). ${r}`), this.param = t, this.value = e, this.reason = r;
724
724
  }
@@ -730,17 +730,17 @@ class ae extends Error {
730
730
  ), this.streamId = t, this.expectedStreamId = e;
731
731
  }
732
732
  }
733
- class st extends Error {
733
+ class nt extends Error {
734
734
  constructor(t) {
735
735
  super(`Invalid version format: ${t}`);
736
736
  }
737
737
  }
738
- class ue extends Error {
738
+ class le extends Error {
739
739
  constructor(t) {
740
740
  super(`${t} needs to be initialized before it can be used.`);
741
741
  }
742
742
  }
743
- class le extends Error {
743
+ class ue extends Error {
744
744
  constructor(t, e) {
745
745
  let r = `Unsupported Protocol ${Array.isArray(t) ? "versions" : "version"}: (${t}).`;
746
746
  e && (r += ` Minimum version supported is ${e}.`), super(r), this.version = t;
@@ -749,12 +749,12 @@ class le extends Error {
749
749
  function E(s) {
750
750
  return typeof s == "function";
751
751
  }
752
- function nt(s) {
752
+ function st(s) {
753
753
  return E(s == null ? void 0 : s.lift);
754
754
  }
755
755
  function R(s) {
756
756
  return function(t) {
757
- if (nt(t))
757
+ if (st(t))
758
758
  return t.lift(function(e) {
759
759
  try {
760
760
  return s(e, this);
@@ -802,8 +802,8 @@ function J(s, t) {
802
802
  try {
803
803
  for (; (t === void 0 || t-- > 0) && !(n = r.next()).done; )
804
804
  i.push(n.value);
805
- } catch (c) {
806
- o = { error: c };
805
+ } catch (a) {
806
+ o = { error: a };
807
807
  } finally {
808
808
  try {
809
809
  n && !n.done && (e = r.return) && e.call(r);
@@ -826,7 +826,7 @@ function it(s) {
826
826
  }, e = s(t);
827
827
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
828
828
  }
829
- var j = it(function(s) {
829
+ var q = it(function(s) {
830
830
  return function(t) {
831
831
  s(this), this.message = t ? t.length + ` errors occurred during unsubscription:
832
832
  ` + t.map(function(e, r) {
@@ -853,15 +853,15 @@ var te = function() {
853
853
  if (o)
854
854
  if (this._parentage = null, Array.isArray(o))
855
855
  try {
856
- for (var c = he(o), a = c.next(); !a.done; a = c.next()) {
857
- var u = a.value;
858
- u.remove(this);
856
+ for (var a = he(o), c = a.next(); !c.done; c = a.next()) {
857
+ var l = c.value;
858
+ l.remove(this);
859
859
  }
860
860
  } catch (v) {
861
861
  t = { error: v };
862
862
  } finally {
863
863
  try {
864
- a && !a.done && (e = c.return) && e.call(c);
864
+ c && !c.done && (e = a.return) && e.call(a);
865
865
  } finally {
866
866
  if (t)
867
867
  throw t.error;
@@ -869,23 +869,23 @@ var te = function() {
869
869
  }
870
870
  else
871
871
  o.remove(this);
872
- var h = this.initialTeardown;
873
- if (E(h))
872
+ var d = this.initialTeardown;
873
+ if (E(d))
874
874
  try {
875
- h();
875
+ d();
876
876
  } catch (v) {
877
- i = v instanceof j ? v.errors : [v];
877
+ i = v instanceof q ? v.errors : [v];
878
878
  }
879
- var l = this._finalizers;
880
- if (l) {
879
+ var u = this._finalizers;
880
+ if (u) {
881
881
  this._finalizers = null;
882
882
  try {
883
- for (var b = he(l), p = b.next(); !p.done; p = b.next()) {
883
+ for (var b = he(u), p = b.next(); !p.done; p = b.next()) {
884
884
  var F = p.value;
885
885
  try {
886
886
  pe(F);
887
887
  } catch (v) {
888
- i = i ?? [], v instanceof j ? i = W(W([], J(i)), J(v.errors)) : i.push(v);
888
+ i = i ?? [], v instanceof q ? i = W(W([], J(i)), J(v.errors)) : i.push(v);
889
889
  }
890
890
  }
891
891
  } catch (v) {
@@ -900,7 +900,7 @@ var te = function() {
900
900
  }
901
901
  }
902
902
  if (i)
903
- throw new j(i);
903
+ throw new q(i);
904
904
  }
905
905
  }, s.prototype.add = function(t) {
906
906
  var e;
@@ -997,11 +997,11 @@ var re = function(s) {
997
997
  this.unsubscribe();
998
998
  }
999
999
  }, t;
1000
- }(te), ut = Function.prototype.bind;
1001
- function q(s, t) {
1002
- return ut.call(s, t);
1000
+ }(te), lt = Function.prototype.bind;
1001
+ function j(s, t) {
1002
+ return lt.call(s, t);
1003
1003
  }
1004
- var lt = function() {
1004
+ var ut = function() {
1005
1005
  function s(t) {
1006
1006
  this.partialObserver = t;
1007
1007
  }
@@ -1043,16 +1043,16 @@ var lt = function() {
1043
1043
  complete: n ?? void 0
1044
1044
  };
1045
1045
  else {
1046
- var c;
1047
- i && Te.useDeprecatedNextContext ? (c = Object.create(e), c.unsubscribe = function() {
1046
+ var a;
1047
+ i && Te.useDeprecatedNextContext ? (a = Object.create(e), a.unsubscribe = function() {
1048
1048
  return i.unsubscribe();
1049
1049
  }, o = {
1050
- next: e.next && q(e.next, c),
1051
- error: e.error && q(e.error, c),
1052
- complete: e.complete && q(e.complete, c)
1050
+ next: e.next && j(e.next, a),
1051
+ error: e.error && j(e.error, a),
1052
+ complete: e.complete && j(e.complete, a)
1053
1053
  }) : o = e;
1054
1054
  }
1055
- return i.destination = new lt(o), i;
1055
+ return i.destination = new ut(o), i;
1056
1056
  }
1057
1057
  return t;
1058
1058
  }(re);
@@ -1088,10 +1088,10 @@ var gt = function() {
1088
1088
  var e = new s();
1089
1089
  return e.source = this, e.operator = t, e;
1090
1090
  }, s.prototype.subscribe = function(t, e, r) {
1091
- var n = this, i = yt(t) ? t : new K(t, e, r);
1091
+ var n = this, i = mt(t) ? t : new K(t, e, r);
1092
1092
  return at(function() {
1093
- var o = n, c = o.operator, a = o.source;
1094
- i.add(c ? c.call(i, a) : a ? n._subscribe(i) : n._trySubscribe(i));
1093
+ var o = n, a = o.operator, c = o.source;
1094
+ i.add(a ? a.call(i, c) : c ? n._subscribe(i) : n._trySubscribe(i));
1095
1095
  }), i;
1096
1096
  }, s.prototype._trySubscribe = function(t) {
1097
1097
  try {
@@ -1103,11 +1103,11 @@ var gt = function() {
1103
1103
  var r = this;
1104
1104
  return e = ge(e), new e(function(n, i) {
1105
1105
  var o = new K({
1106
- next: function(c) {
1106
+ next: function(a) {
1107
1107
  try {
1108
- t(c);
1109
- } catch (a) {
1110
- i(a), o.unsubscribe();
1108
+ t(a);
1109
+ } catch (c) {
1110
+ i(c), o.unsubscribe();
1111
1111
  }
1112
1112
  },
1113
1113
  error: i,
@@ -1144,42 +1144,42 @@ function ge(s) {
1144
1144
  var t;
1145
1145
  return (t = s ?? Te.Promise) !== null && t !== void 0 ? t : Promise;
1146
1146
  }
1147
- function mt(s) {
1147
+ function yt(s) {
1148
1148
  return s && E(s.next) && E(s.error) && E(s.complete);
1149
1149
  }
1150
- function yt(s) {
1151
- return s && s instanceof re || mt(s) && Ue(s);
1150
+ function mt(s) {
1151
+ return s && s instanceof re || yt(s) && Ue(s);
1152
1152
  }
1153
- function P(s, t, e, r, n) {
1153
+ function A(s, t, e, r, n) {
1154
1154
  return new vt(s, t, e, r, n);
1155
1155
  }
1156
1156
  var vt = function(s) {
1157
1157
  ee(t, s);
1158
- function t(e, r, n, i, o, c) {
1159
- var a = s.call(this, e) || this;
1160
- return a.onFinalize = o, a.shouldUnsubscribe = c, a._next = r ? function(u) {
1158
+ function t(e, r, n, i, o, a) {
1159
+ var c = s.call(this, e) || this;
1160
+ return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(l) {
1161
1161
  try {
1162
- r(u);
1163
- } catch (h) {
1164
- e.error(h);
1162
+ r(l);
1163
+ } catch (d) {
1164
+ e.error(d);
1165
1165
  }
1166
- } : s.prototype._next, a._error = i ? function(u) {
1166
+ } : s.prototype._next, c._error = i ? function(l) {
1167
1167
  try {
1168
- i(u);
1169
- } catch (h) {
1170
- e.error(h);
1168
+ i(l);
1169
+ } catch (d) {
1170
+ e.error(d);
1171
1171
  } finally {
1172
1172
  this.unsubscribe();
1173
1173
  }
1174
- } : s.prototype._error, a._complete = n ? function() {
1174
+ } : s.prototype._error, c._complete = n ? function() {
1175
1175
  try {
1176
1176
  n();
1177
- } catch (u) {
1178
- e.error(u);
1177
+ } catch (l) {
1178
+ e.error(l);
1179
1179
  } finally {
1180
1180
  this.unsubscribe();
1181
1181
  }
1182
- } : s.prototype._complete, a;
1182
+ } : s.prototype._complete, c;
1183
1183
  }
1184
1184
  return t.prototype.unsubscribe = function() {
1185
1185
  var e;
@@ -1192,7 +1192,7 @@ var vt = function(s) {
1192
1192
  function f(s, t) {
1193
1193
  return R(function(e, r) {
1194
1194
  var n = 0;
1195
- e.subscribe(P(r, function(i) {
1195
+ e.subscribe(A(r, function(i) {
1196
1196
  r.next(s.call(t, i, n++));
1197
1197
  }));
1198
1198
  });
@@ -1205,15 +1205,15 @@ function w(s) {
1205
1205
  return bt;
1206
1206
  } : R(function(t, e) {
1207
1207
  var r = 0;
1208
- t.subscribe(P(e, function(n) {
1208
+ t.subscribe(A(e, function(n) {
1209
1209
  ++r <= s && (e.next(n), s <= r && e.complete());
1210
1210
  }));
1211
1211
  });
1212
1212
  }
1213
- function m(s, t) {
1213
+ function y(s, t) {
1214
1214
  return R(function(e, r) {
1215
1215
  var n = 0;
1216
- e.subscribe(P(r, function(i) {
1216
+ e.subscribe(A(r, function(i) {
1217
1217
  return s.call(t, i, n++) && r.next(i);
1218
1218
  }));
1219
1219
  });
@@ -1221,7 +1221,7 @@ function m(s, t) {
1221
1221
  function wt(s, t) {
1222
1222
  return t === void 0 && (t = !1), R(function(e, r) {
1223
1223
  var n = 0;
1224
- e.subscribe(P(r, function(i) {
1224
+ e.subscribe(A(r, function(i) {
1225
1225
  var o = s(i, n++);
1226
1226
  (o || t) && r.next(i), !o && r.complete();
1227
1227
  }));
@@ -1232,44 +1232,44 @@ function g(s, t, e) {
1232
1232
  return r ? R(function(n, i) {
1233
1233
  var o;
1234
1234
  (o = r.subscribe) === null || o === void 0 || o.call(r);
1235
- var c = !0;
1236
- n.subscribe(P(i, function(a) {
1237
- var u;
1238
- (u = r.next) === null || u === void 0 || u.call(r, a), i.next(a);
1235
+ var a = !0;
1236
+ n.subscribe(A(i, function(c) {
1237
+ var l;
1238
+ (l = r.next) === null || l === void 0 || l.call(r, c), i.next(c);
1239
1239
  }, function() {
1240
- var a;
1241
- c = !1, (a = r.complete) === null || a === void 0 || a.call(r), i.complete();
1242
- }, function(a) {
1243
- var u;
1244
- c = !1, (u = r.error) === null || u === void 0 || u.call(r, a), i.error(a);
1240
+ var c;
1241
+ a = !1, (c = r.complete) === null || c === void 0 || c.call(r), i.complete();
1242
+ }, function(c) {
1243
+ var l;
1244
+ a = !1, (l = r.error) === null || l === void 0 || l.call(r, c), i.error(c);
1245
1245
  }, function() {
1246
- var a, u;
1247
- c && ((a = r.unsubscribe) === null || a === void 0 || a.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r);
1246
+ var c, l;
1247
+ a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (l = r.finalize) === null || l === void 0 || l.call(r);
1248
1248
  }));
1249
1249
  }) : xe;
1250
1250
  }
1251
- const St = /^(\d+)\.(\d+)$/;
1252
- function Ct(s) {
1251
+ const Ct = /^(\d+)\.(\d+)$/;
1252
+ function St(s) {
1253
1253
  if (typeof s == "string") {
1254
- const t = s.match(St);
1254
+ const t = s.match(Ct);
1255
1255
  if (t)
1256
1256
  return `${t[1]}.${t[2]}`;
1257
1257
  }
1258
- throw new st(s);
1258
+ throw new nt(s);
1259
1259
  }
1260
- function me(s) {
1261
- const t = Ct(s), [e, r] = t.split("."), [n, i] = [parseInt(e), parseInt(r)];
1260
+ function ye(s) {
1261
+ const t = St(s), [e, r] = t.split("."), [n, i] = [parseInt(e), parseInt(r)];
1262
1262
  return [n, i];
1263
1263
  }
1264
1264
  function Re(s, t) {
1265
- const [e, r] = me(s), [n, i] = me(t);
1265
+ const [e, r] = ye(s), [n, i] = ye(t);
1266
1266
  return e < n ? -1 : e > n ? 1 : r < i ? -1 : r > i ? 1 : 0;
1267
1267
  }
1268
1268
  function Et(s, t) {
1269
1269
  return Re(s, t) >= 0;
1270
1270
  }
1271
- const ye = "2.0";
1272
- class Mt {
1271
+ const me = "2.0";
1272
+ class It {
1273
1273
  /**
1274
1274
  * Create a new instance of the {@link IpcHelper | IPC Protocol Helper}.
1275
1275
  *
@@ -1280,8 +1280,8 @@ class Mt {
1280
1280
  * @param logService - An instance of a logging service or utility
1281
1281
  */
1282
1282
  constructor(t, e) {
1283
- if (I(this, "negotiatedProtocolVersion"), I(this, "currentContext"), I(this, "incomingMessages$"), I(this, "inIframe", !1), I(this, "embeddedResult"), I(this, "iframePort1"), I(this, "iframePort2"), this.supportedVersions = t, this.logService = e, this.incomingMessages$ = new Ie(), this.supportedVersions = t.filter((r) => Et(r, ye)), !this.supportedVersions.length)
1284
- throw new le(t, ye);
1283
+ if (M(this, "negotiatedProtocolVersion"), M(this, "currentContext"), M(this, "incomingMessages$"), M(this, "inIframe", !1), M(this, "embeddedResult"), M(this, "iframePort1"), M(this, "iframePort2"), this.supportedVersions = t, this.logService = e, this.incomingMessages$ = new Me(), this.supportedVersions = t.filter((r) => Et(r, me)), !this.supportedVersions.length)
1284
+ throw new ue(t, me);
1285
1285
  this.negotiatedProtocolVersion = this.supportedVersions[0], this.embeddedResult = null, this.iframePort2 = null;
1286
1286
  }
1287
1287
  get parent() {
@@ -1303,11 +1303,11 @@ class Mt {
1303
1303
  var t, e, r, n;
1304
1304
  if (this.inIframe) {
1305
1305
  if (!this.iframePort2)
1306
- throw new ue("port2");
1306
+ throw new le("port2");
1307
1307
  return this.iframePort2;
1308
1308
  } else {
1309
1309
  if (!((e = (t = window.Acrobits) == null ? void 0 : t.messageChannel) != null && e.port2))
1310
- throw new ue("port2");
1310
+ throw new le("port2");
1311
1311
  return (n = (r = window.Acrobits) == null ? void 0 : r.messageChannel) == null ? void 0 : n.port2;
1312
1312
  }
1313
1313
  }
@@ -1330,16 +1330,16 @@ class Mt {
1330
1330
  */
1331
1331
  openBridge() {
1332
1332
  if (!this.isEmbedded())
1333
- throw new d(this.currentContext);
1333
+ throw new h(this.currentContext);
1334
1334
  const t = "HELLO", e = this.createMessage(t);
1335
1335
  e.protocolVersions = this.supportedVersions, this.logCreated(t, e);
1336
1336
  const r = this.incomingMessages$.pipe(
1337
- m((n) => n.type === t && n.replyTo === e.id),
1337
+ y((n) => n.type === t && n.replyTo === e.id),
1338
1338
  f((n) => n),
1339
1339
  g(this.logReceived()),
1340
1340
  f((n) => {
1341
1341
  if (!this.supportedVersions.includes(n.protocolVersion))
1342
- throw new le(n.protocolVersion, this.supportedVersions[0]);
1342
+ throw new ue(n.protocolVersion, this.supportedVersions[0]);
1343
1343
  return n.displayName || (n.displayName = n.cloudUsername), n;
1344
1344
  }),
1345
1345
  g((n) => {
@@ -1362,11 +1362,11 @@ class Mt {
1362
1362
  */
1363
1363
  requestSSOToken() {
1364
1364
  if (!this.isEmbedded())
1365
- throw new d(this.currentContext);
1365
+ throw new h(this.currentContext);
1366
1366
  const t = "TOKEN", e = this.createMessage(t);
1367
1367
  this.logCreated(t, e);
1368
1368
  const r = this.incomingMessages$.pipe(
1369
- m((n) => n.type === t && n.replyTo === e.id),
1369
+ y((n) => n.type === t && n.replyTo === e.id),
1370
1370
  f((n) => n),
1371
1371
  g(this.logReceived()),
1372
1372
  w(1)
@@ -1388,18 +1388,18 @@ class Mt {
1388
1388
  */
1389
1389
  sendJoiningRoomMessage(t) {
1390
1390
  if (!this.isEmbedded())
1391
- throw new d(this.currentContext);
1391
+ throw new h(this.currentContext);
1392
1392
  const {
1393
1393
  roomName: e,
1394
1394
  roomInvite: r,
1395
1395
  displayName: n,
1396
1396
  jwtToken: i,
1397
1397
  serverUrl: o,
1398
- region: c,
1399
- joinMicMuted: a,
1400
- joinWithoutCamera: u
1401
- } = t, h = "JOINING ROOM", l = this.createMessage(h, !1);
1402
- l.roomName = e, l.jwtToken = i, l.serverUrl = o, l.region = c, l.roomInvite = r, l.joinMicMuted = a ?? !1, l.joinWithoutCamera = u ?? !1, l.displayName = n, this.logCreated(h, l), this.port2.postMessage(l), this.logSent(h, l);
1398
+ region: a,
1399
+ joinMicMuted: c,
1400
+ joinWithoutCamera: l
1401
+ } = t, d = "JOINING ROOM", u = this.createMessage(d, !1);
1402
+ u.roomName = e, u.jwtToken = i, u.serverUrl = o, u.region = a, u.roomInvite = r, u.joinMicMuted = c ?? !1, u.joinWithoutCamera = l ?? !1, u.displayName = n, this.logCreated(d, u), this.port2.postMessage(u), this.logSent(d, u);
1403
1403
  }
1404
1404
  /**
1405
1405
  * Sends a {@link LeavingRoomMessage} lifecycle message to the Host app.
@@ -1414,7 +1414,7 @@ class Mt {
1414
1414
  */
1415
1415
  sendLeavingRoomMessage(t) {
1416
1416
  if (!this.isEmbedded())
1417
- throw new d(this.currentContext);
1417
+ throw new h(this.currentContext);
1418
1418
  const e = "LEAVING ROOM", r = this.createMessage(e, !1);
1419
1419
  r.roomName = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
1420
1420
  }
@@ -1446,10 +1446,10 @@ class Mt {
1446
1446
  */
1447
1447
  onJoinRoomMessage() {
1448
1448
  if (!this.isEmbedded())
1449
- throw new d(this.currentContext);
1449
+ throw new h(this.currentContext);
1450
1450
  const t = "JOIN ROOM";
1451
1451
  return this.incomingMessages$.pipe(
1452
- m((e) => e.type === t && e.target === "client"),
1452
+ y((e) => e.type === t && e.target === "client"),
1453
1453
  f((e) => e),
1454
1454
  g(this.logReceived()),
1455
1455
  f((e) => e)
@@ -1482,10 +1482,10 @@ class Mt {
1482
1482
  */
1483
1483
  onLeaveRoomMessage() {
1484
1484
  if (!this.isEmbedded())
1485
- throw new d(this.currentContext);
1485
+ throw new h(this.currentContext);
1486
1486
  const t = "LEAVE ROOM";
1487
1487
  return this.incomingMessages$.pipe(
1488
- m((e) => e.type === t && e.target === "client"),
1488
+ y((e) => e.type === t && e.target === "client"),
1489
1489
  f((e) => e),
1490
1490
  g(this.logReceived()),
1491
1491
  f((e) => e)
@@ -1519,10 +1519,10 @@ class Mt {
1519
1519
  */
1520
1520
  onConfigMessage() {
1521
1521
  if (!this.isEmbedded())
1522
- throw new d(this.currentContext);
1522
+ throw new h(this.currentContext);
1523
1523
  const t = "CONFIG";
1524
1524
  return this.incomingMessages$.pipe(
1525
- m((e) => e.type === t && e.target === "client"),
1525
+ y((e) => e.type === t && e.target === "client"),
1526
1526
  f((e) => e),
1527
1527
  g(this.logReceived()),
1528
1528
  f((e) => ({
@@ -1542,11 +1542,11 @@ class Mt {
1542
1542
  }
1543
1543
  sendScreenshareSourceMessage(t) {
1544
1544
  if (!this.isEmbedded())
1545
- throw new d(this.currentContext);
1545
+ throw new h(this.currentContext);
1546
1546
  const e = "SCREENSHARE SOURCE", r = this.createMessage(e);
1547
1547
  r.sourceTypes = t, this.logCreated(e, r);
1548
1548
  const n = this.incomingMessages$.pipe(
1549
- m((i) => i.type === e && i.replyTo === r.id),
1549
+ y((i) => i.type === e && i.replyTo === r.id),
1550
1550
  f((i) => i),
1551
1551
  g(this.logReceived()),
1552
1552
  f((i) => i),
@@ -1556,14 +1556,14 @@ class Mt {
1556
1556
  }
1557
1557
  layoutChange(t, e, r) {
1558
1558
  if (!this.isEmbedded())
1559
- throw new d(this.currentContext);
1559
+ throw new h(this.currentContext);
1560
1560
  const n = "LAYOUT CHANGE";
1561
1561
  let i, o;
1562
1562
  if (e && r ? (i = this.createMessage(n, !1, r), i.result = e) : (i = this.createMessage(n), o = this.incomingMessages$.pipe(
1563
- m((c) => c.type === n && c.replyTo === i.id),
1564
- f((c) => c),
1563
+ y((a) => a.type === n && a.replyTo === i.id),
1564
+ f((a) => a),
1565
1565
  g(this.logReceived()),
1566
- f((c) => c),
1566
+ f((a) => a),
1567
1567
  w(1)
1568
1568
  ), this.logService.debug(`Created ${n} Reply handler`)), i.layout = t, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i), o)
1569
1569
  return o;
@@ -1601,10 +1601,10 @@ class Mt {
1601
1601
  */
1602
1602
  onLayoutChangeMessage() {
1603
1603
  if (!this.isEmbedded())
1604
- throw new d(this.currentContext);
1604
+ throw new h(this.currentContext);
1605
1605
  const t = "LAYOUT CHANGE";
1606
1606
  return this.incomingMessages$.pipe(
1607
- m((e) => e.type === t && e.target === "client" && e.replyTo === null),
1607
+ y((e) => e.type === t && e.target === "client" && e.replyTo === null),
1608
1608
  f((e) => e),
1609
1609
  g(this.logReceived()),
1610
1610
  f((e) => e)
@@ -1612,12 +1612,12 @@ class Mt {
1612
1612
  }
1613
1613
  requestOAuthToken(t) {
1614
1614
  if (!this.isEmbedded())
1615
- throw new d(this.currentContext);
1615
+ throw new h(this.currentContext);
1616
1616
  Array.isArray(t) || (t = [t]);
1617
1617
  const e = "OAUTH TOKEN", r = this.createMessage(e);
1618
1618
  r.providerTypes = t, this.logCreated(e, r);
1619
1619
  const n = this.incomingMessages$.pipe(
1620
- m((i) => i.type === e && i.replyTo === r.id),
1620
+ y((i) => i.type === e && i.replyTo === r.id),
1621
1621
  f((i) => i),
1622
1622
  g(this.logReceived()),
1623
1623
  w(1)
@@ -1626,22 +1626,22 @@ class Mt {
1626
1626
  }
1627
1627
  openUrl(t, e) {
1628
1628
  if (!this.isEmbedded())
1629
- throw new d(this.currentContext);
1629
+ throw new h(this.currentContext);
1630
1630
  const r = "OPEN URL", n = this.createMessage(r, !1);
1631
1631
  n.url = t, n.data = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
1632
1632
  }
1633
1633
  selectContacts(t, e, r, n) {
1634
1634
  if (!this.isEmbedded())
1635
- throw new d(this.currentContext);
1635
+ throw new h(this.currentContext);
1636
1636
  if (this.negotiatedProtocolVersion === "2.0") {
1637
1637
  if (e === void 0 || typeof e == "object")
1638
- throw new y(
1638
+ throw new m(
1639
1639
  "streamType",
1640
1640
  e,
1641
1641
  "streamType is missing or invalid"
1642
1642
  );
1643
1643
  if (r === void 0 || typeof r == "object" || typeof r == "number")
1644
- throw new y(
1644
+ throw new m(
1645
1645
  "contactType",
1646
1646
  r,
1647
1647
  "contactType is missing or invalid"
@@ -1654,9 +1654,9 @@ class Mt {
1654
1654
  );
1655
1655
  }
1656
1656
  if (typeof e < "u" && typeof e != "object")
1657
- throw new y("options", e, "options is invalid");
1657
+ throw new m("options", e, "options is invalid");
1658
1658
  if (typeof r < "u" && !Array.isArray(r))
1659
- throw new y(
1659
+ throw new m(
1660
1660
  "currentContacts",
1661
1661
  r,
1662
1662
  "currentContacts is invalid"
@@ -1665,121 +1665,149 @@ class Mt {
1665
1665
  }
1666
1666
  selectContactsV2_0(t, e, r, n) {
1667
1667
  if (!this.isEmbedded())
1668
- throw new d(this.currentContext);
1669
- n && n.length > 0 && (n = n.map((a) => a.type === "cloudUsername" && a.contactUser ? {
1670
- ...a,
1671
- cloudId: a.cloudId || a.contactUser.cloudId,
1672
- networkId: a.networkId || a.contactUser.networkId,
1673
- cloudUsername: a.cloudUsername || a.contactUser.cloudUsername
1674
- } : a));
1668
+ throw new h(this.currentContext);
1669
+ n && n.length > 0 && (n = n.map((c) => c.type === "cloudUsername" && c.contactUser ? {
1670
+ ...c,
1671
+ cloudId: c.cloudId || c.contactUser.cloudId,
1672
+ networkId: c.networkId || c.contactUser.networkId,
1673
+ cloudUsername: c.cloudUsername || c.contactUser.cloudUsername
1674
+ } : c));
1675
1675
  const i = "SELECT CONTACTS", o = this.createMessage(i, !0);
1676
1676
  o.streamId = t, o.streamType = e, o.contactType = r, o.resultTypes = [r], o.currentContacts = n, this.logCreated(i, o);
1677
- const c = this.incomingMessages$.pipe(
1678
- m((a) => a.type === i && a.replyTo === o.id),
1677
+ const a = this.incomingMessages$.pipe(
1678
+ y((c) => c.type === i && c.replyTo === o.id),
1679
1679
  g(this.logReceived()),
1680
- f((a) => {
1681
- const u = a;
1682
- if (u.result === "success") {
1683
- if (u.streamId !== t)
1684
- throw new ae(u.streamId, t);
1685
- e === "direct" && u.contacts.length > 1 && (u.contacts = [u.contacts[0]]);
1680
+ f((c) => {
1681
+ const l = c;
1682
+ if (l.result === "success") {
1683
+ if (l.streamId !== t)
1684
+ throw new ae(l.streamId, t);
1685
+ e === "direct" && l.contacts.length > 1 && (l.contacts = [l.contacts[0]]);
1686
1686
  }
1687
- return u;
1687
+ return l;
1688
1688
  }),
1689
1689
  w(1)
1690
1690
  );
1691
- return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), c;
1691
+ return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), a;
1692
1692
  }
1693
1693
  selectContactsV2_1(t, e, r) {
1694
1694
  if (!this.isEmbedded())
1695
- throw new d(this.currentContext);
1695
+ throw new h(this.currentContext);
1696
1696
  const n = {
1697
1697
  allowMultipleSelection: (e == null ? void 0 : e.allowMultipleSelection) ?? !1,
1698
+ filterToSelectedType: (e == null ? void 0 : e.filterToSelectedType) ?? !1,
1698
1699
  resultTypes: (e == null ? void 0 : e.resultTypes) ?? ["cloudUsername"],
1699
1700
  streamName: e == null ? void 0 : e.streamName
1700
1701
  };
1702
+ if (n.filterToSelectedType) {
1703
+ if (!n.allowMultipleSelection)
1704
+ throw new m(
1705
+ "filterToSelectedType",
1706
+ n.filterToSelectedType,
1707
+ "filterToSelectedType can only be set when allowMultipleSelection is true"
1708
+ );
1709
+ if (n.resultTypes.length === 1 && this.logService.warn(
1710
+ "[IPC] [SelectContacts] filterToSelectedType is redundant when resultTypes contains only one type"
1711
+ ), r && r.length > 0) {
1712
+ const c = r[0].type;
1713
+ if (r.some((l) => l.type !== c))
1714
+ throw new m(
1715
+ "currentContacts",
1716
+ r,
1717
+ "When filterToSelectedType is true, all items in currentContacts must be of the same type"
1718
+ );
1719
+ }
1720
+ }
1701
1721
  if (r && r.length > 0)
1702
- for (const a of r) {
1703
- if (a.contactId === void 0)
1704
- throw new y(
1722
+ for (const c of r) {
1723
+ if (c.contactId === void 0)
1724
+ throw new m(
1705
1725
  "currentContacts",
1706
1726
  r,
1707
1727
  "ContactItem contactId is required since v2.1 on all contacts"
1708
1728
  );
1709
- if (a.type === "cloudUsername") {
1710
- if (!a.contactUser)
1711
- throw new y(
1729
+ if (c.type === "cloudUsername") {
1730
+ if (!c.contactUser)
1731
+ throw new m(
1712
1732
  "currentContacts",
1713
- a,
1733
+ c,
1714
1734
  "CloudUsername contact must include contactUser since v2.1"
1715
1735
  );
1716
- if (!a.contactUser.cloudId || !a.contactUser.networkId || !a.contactUser.cloudUsername)
1717
- throw new y(
1736
+ if (!c.contactUser.cloudId || !c.contactUser.networkId || !c.contactUser.cloudUsername)
1737
+ throw new m(
1718
1738
  "currentContacts",
1719
- a,
1739
+ c,
1720
1740
  "CloudContact must define cloudUsername, cloudId, and networkId since v2.1"
1721
1741
  );
1722
1742
  }
1723
1743
  }
1724
1744
  const i = "SELECT CONTACTS", o = this.createMessage(i, !0);
1725
- o.streamId = t, o.streamName = n.streamName, o.resultTypes = n.resultTypes, o.currentContacts = r, o.allowMultipleSelection = n.allowMultipleSelection, this.logCreated(i, o);
1726
- const c = this.incomingMessages$.pipe(
1727
- m((a) => a.type === i && a.replyTo === o.id),
1745
+ o.streamId = t, o.streamName = n.streamName, o.resultTypes = n.resultTypes, o.currentContacts = r, o.allowMultipleSelection = n.allowMultipleSelection, o.filterToSelectedType = n.filterToSelectedType, this.logCreated(i, o);
1746
+ const a = this.incomingMessages$.pipe(
1747
+ y((c) => c.type === i && c.replyTo === o.id),
1728
1748
  g(this.logReceived()),
1729
- f((a) => {
1730
- const u = a;
1731
- if (u.result === "success") {
1732
- if (u.streamId !== t)
1733
- throw new ae(u.streamId, t);
1734
- const h = u.contacts.length;
1735
- u.contacts = u.contacts.filter(
1736
- (l) => n.resultTypes.includes(l.type)
1737
- ), u.contacts.length !== h && this.logService.debug(
1738
- `[IPC] [SelectContactsReply] Filtered ${h - u.contacts.length} contacts from reply`
1739
- ), !n.allowMultipleSelection && u.contacts.length > 1 && (u.contacts = [u.contacts[0]]);
1740
- for (const l of u.contacts) {
1741
- if (l.type === "cloudUsername") {
1742
- if (!l.contactUser)
1749
+ f((c) => {
1750
+ const l = c;
1751
+ if (l.result === "success") {
1752
+ if (l.streamId !== t)
1753
+ throw new ae(l.streamId, t);
1754
+ const d = l.contacts.length;
1755
+ if (l.contacts = l.contacts.filter(
1756
+ (u) => n.resultTypes.includes(u.type)
1757
+ ), l.contacts.length !== d && this.logService.debug(
1758
+ `[IPC] [SelectContactsReply] Filtered ${d - l.contacts.length} contacts from reply`
1759
+ ), !n.allowMultipleSelection && l.contacts.length > 1 && (l.contacts = [l.contacts[0]]), n.filterToSelectedType && l.contacts.length > 1) {
1760
+ const u = l.contacts[0].type;
1761
+ if (l.contacts.some(
1762
+ (b) => b.type !== u
1763
+ ))
1764
+ throw new Error(
1765
+ `When filterToSelectedType is true, all contacts in the reply must be of the same type. Expected all contacts to be of type '${u}', but received mixed types.`
1766
+ );
1767
+ }
1768
+ for (const u of l.contacts) {
1769
+ if (u.type === "cloudUsername") {
1770
+ if (!u.contactUser)
1743
1771
  throw new Error(
1744
1772
  `CloudUsername contact must include contactUser since v2.1. ContactItem: ${JSON.stringify(
1745
- l
1773
+ u
1746
1774
  )}`
1747
1775
  );
1748
- if (!l.contactUser.cloudId || !l.contactUser.networkId || !l.contactUser.cloudUsername)
1776
+ if (!u.contactUser.cloudId || !u.contactUser.networkId || !u.contactUser.cloudUsername)
1749
1777
  throw new Error(
1750
1778
  `CloudContact must define cloudUsername, cloudId, and networkId since v2.1. ContactItem: ${JSON.stringify(
1751
- l
1779
+ u
1752
1780
  )}`
1753
1781
  );
1754
1782
  }
1755
- this.negotiatedProtocolVersion === "2.2" && (l.type === "number" && l.numbers.length > 1 ? l.numbers = [l.numbers[0]] : l.type === "email" && l.emails.length > 1 && (l.emails = [l.emails[0]]));
1783
+ this.negotiatedProtocolVersion === "2.2" && (u.type === "number" && u.numbers.length > 1 ? u.numbers = [u.numbers[0]] : u.type === "email" && u.emails.length > 1 && (u.emails = [u.emails[0]]));
1756
1784
  }
1757
1785
  }
1758
- return u;
1786
+ return l;
1759
1787
  }),
1760
1788
  w(1)
1761
1789
  );
1762
- return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), c;
1790
+ return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), a;
1763
1791
  }
1764
1792
  matchContacts(t) {
1765
1793
  if (!this.isEmbedded())
1766
- throw new d(this.currentContext);
1794
+ throw new h(this.currentContext);
1767
1795
  if (!Array.isArray(t))
1768
- throw new y("contacts", t, "contacts is not an array");
1796
+ throw new m("contacts", t, "contacts is not an array");
1769
1797
  if (!t.length)
1770
- throw new y("contacts", t, "At least one contact is required");
1798
+ throw new m("contacts", t, "At least one contact is required");
1771
1799
  const e = this.createMessage("MATCH CONTACTS");
1772
1800
  if (this.compareVersion("2.1") >= 0) {
1773
1801
  for (const n of t)
1774
1802
  if (n.type === "cloudUsername") {
1775
1803
  if (!n.contactUser)
1776
- throw new y(
1804
+ throw new m(
1777
1805
  "contacts",
1778
1806
  n,
1779
1807
  "CloudUsername contact must include contactUser"
1780
1808
  );
1781
1809
  if (!n.contactUser.cloudUsername || !n.contactUser.cloudId || !n.contactUser.networkId)
1782
- throw new y(
1810
+ throw new m(
1783
1811
  "contacts",
1784
1812
  n,
1785
1813
  "CloudContact must define cloudUsername, cloudId, and networkId"
@@ -1793,7 +1821,7 @@ class Mt {
1793
1821
  }
1794
1822
  this.logCreated(e.type, e);
1795
1823
  const r = this.incomingMessages$.pipe(
1796
- m((n) => n.type === e.type && n.replyTo === e.id),
1824
+ y((n) => n.type === e.type && n.replyTo === e.id),
1797
1825
  g(this.logReceived()),
1798
1826
  f((n) => {
1799
1827
  const i = n;
@@ -1802,29 +1830,29 @@ class Mt {
1802
1830
  throw new Error(
1803
1831
  "MatchContactsMessageReply should return a Record<string, DetailedContactItem> of contacts when using IPC Protocol v2.1+"
1804
1832
  );
1805
- for (const [o, c] of Object.entries(i.contacts)) {
1806
- if (c == null) {
1833
+ for (const [o, a] of Object.entries(i.contacts)) {
1834
+ if (a == null) {
1807
1835
  this.logService.debug(
1808
1836
  `[IPC] [MatchContactsReply] Received null or undefined contact for ${o}`
1809
1837
  );
1810
1838
  continue;
1811
1839
  }
1812
- if (c.contactId === void 0)
1840
+ if (a.contactId === void 0)
1813
1841
  throw new Error(
1814
1842
  `ContactItem 'contactId' is required since v2.1. ContactItem: ${JSON.stringify(
1815
- c
1843
+ a
1816
1844
  )}`
1817
1845
  );
1818
- if (!c.contactUser && (!c.uri || c.uri.length === 0) && (!c.numbers || c.numbers.length === 0))
1846
+ if (!a.contactUser && (!a.uri || a.uri.length === 0) && (!a.numbers || a.numbers.length === 0))
1819
1847
  throw new Error(
1820
1848
  `DetailedContactItem must define at least one contact method (contactUser, uri, or numbers). ContactItem: ${JSON.stringify(
1821
- c
1849
+ a
1822
1850
  )}`
1823
1851
  );
1824
- if (c.contactUser && (!c.contactUser.cloudId || !c.contactUser.networkId || !c.contactUser.cloudUsername))
1852
+ if (a.contactUser && (!a.contactUser.cloudId || !a.contactUser.networkId || !a.contactUser.cloudUsername))
1825
1853
  throw new Error(
1826
1854
  `When contactUser is defined, cloudId, networkId, and cloudUsername must also be defined. ContactItem: ${JSON.stringify(
1827
- c
1855
+ a
1828
1856
  )}`
1829
1857
  );
1830
1858
  }
@@ -1838,14 +1866,14 @@ class Mt {
1838
1866
  "The number of contacts in the reply does not match the number of contacts in the request"
1839
1867
  );
1840
1868
  for (const o of i.contacts) {
1841
- const c = o;
1842
- if (c.type === "cloudUsername" && !("cloudUsername" in c))
1869
+ const a = o;
1870
+ if (a.type === "cloudUsername" && !("cloudUsername" in a))
1843
1871
  throw new Error(
1844
1872
  `CloudUsernameDetailedContactItem must define cloudUsername. ContactItem: ${JSON.stringify(
1845
1873
  o
1846
1874
  )}`
1847
1875
  );
1848
- if (c.type === "uri" && (!("uri" in c) || !Array.isArray(c.uri)))
1876
+ if (a.type === "uri" && (!("uri" in a) || !Array.isArray(a.uri)))
1849
1877
  throw new Error(
1850
1878
  `UriDetailedContactItem must define uri as an array. ContactItem: ${JSON.stringify(
1851
1879
  o
@@ -1887,14 +1915,56 @@ class Mt {
1887
1915
  */
1888
1916
  onPushMessageMessage() {
1889
1917
  if (!this.isEmbedded())
1890
- throw new d(this.currentContext);
1918
+ throw new h(this.currentContext);
1891
1919
  const t = "PUSH MESSAGE";
1892
1920
  return this.incomingMessages$.pipe(
1893
- m((e) => e.type === t && e.target === "client"),
1921
+ y((e) => e.type === t && e.target === "client"),
1894
1922
  f((e) => e),
1895
1923
  g(this.logReceived())
1896
1924
  );
1897
1925
  }
1926
+ /**
1927
+ * Setup listener for {@link DirectChannelCreateAndNavigateMessage}, which can be sent by a Host app to
1928
+ * instruct the Client to create (if needed) and navigate to a direct channel.
1929
+ *
1930
+ * @remarks
1931
+ * The Host app does not expect a reply to this message.
1932
+ *
1933
+ * @returns An observable that emits whenever {@link DirectChannelCreateAndNavigateMessage} is received so it
1934
+ * can be subscribed to indefinitely.
1935
+ */
1936
+ onDirectChannelCreateAndNavigateMessage() {
1937
+ if (!this.isEmbedded())
1938
+ throw new h(this.currentContext);
1939
+ const t = "DIRECT CHANNEL CREATE AND NAVIGATE";
1940
+ return this.incomingMessages$.pipe(
1941
+ y(
1942
+ (e) => e.type === t && e.target === "client" && e.replyTo === null && e.expectReply === !1
1943
+ ),
1944
+ g(this.logReceived())
1945
+ );
1946
+ }
1947
+ /**
1948
+ * Setup listener for {@link NavigateToRouteMessage}, which can be sent by a Host app to instruct the
1949
+ * Client application to navigate to a specific in-app route.
1950
+ *
1951
+ * @remarks
1952
+ * The Host app does not expect a reply to this message.
1953
+ *
1954
+ * @returns An observable that emits whenever {@link NavigateToRouteMessage} is received so it can be
1955
+ * subscribed to indefinitely.
1956
+ */
1957
+ onNavigateToRouteMessage() {
1958
+ if (!this.isEmbedded())
1959
+ throw new h(this.currentContext);
1960
+ const t = "NAVIGATE TO ROUTE";
1961
+ return this.incomingMessages$.pipe(
1962
+ y(
1963
+ (e) => e.type === t && e.target === "client" && e.replyTo === null && e.expectReply === !1
1964
+ ),
1965
+ g(this.logReceived())
1966
+ );
1967
+ }
1898
1968
  /**
1899
1969
  * Sends a {@link PushTokenMessage} to the Host app, to request the Push Token for the current
1900
1970
  * device.
@@ -1906,11 +1976,11 @@ class Mt {
1906
1976
  */
1907
1977
  requestPushToken() {
1908
1978
  if (!this.isEmbedded())
1909
- throw new d(this.currentContext);
1979
+ throw new h(this.currentContext);
1910
1980
  const t = "PUSH TOKEN", e = this.createMessage(t);
1911
1981
  this.logCreated(t, e);
1912
1982
  const r = this.incomingMessages$.pipe(
1913
- m((n) => n.type === t && n.replyTo === e.id),
1983
+ y((n) => n.type === t && n.replyTo === e.id),
1914
1984
  g(this.logReceived()),
1915
1985
  f((n) => n),
1916
1986
  w(1)
@@ -1946,10 +2016,10 @@ class Mt {
1946
2016
  */
1947
2017
  onPushTokenMessage() {
1948
2018
  if (!this.isEmbedded())
1949
- throw new d(this.currentContext);
2019
+ throw new h(this.currentContext);
1950
2020
  const t = "PUSH TOKEN";
1951
2021
  return this.incomingMessages$.pipe(
1952
- m(
2022
+ y(
1953
2023
  (e) => e.type === t && e.target === "client" && e.replyTo === null && e.expectReply === !1
1954
2024
  ),
1955
2025
  f((e) => {
@@ -1961,6 +2031,66 @@ class Mt {
1961
2031
  g(this.logReceived())
1962
2032
  );
1963
2033
  }
2034
+ /**
2035
+ * Request current call information from the `Host` app.
2036
+ *
2037
+ * @remarks
2038
+ * The Host app should reply with a {@link CallInfoMessageReply} containing the current call
2039
+ * information.
2040
+ *
2041
+ * @returns Observable with a {@link CallInfoMessageReply} instance containing the call info.
2042
+ */
2043
+ requestCallInfo() {
2044
+ if (!this.isEmbedded())
2045
+ throw new h(this.currentContext);
2046
+ const t = "CALL INFO", e = this.createMessage(t);
2047
+ this.logCreated(t, e);
2048
+ const r = this.incomingMessages$.pipe(
2049
+ y((n) => n.type === t && n.replyTo === e.id),
2050
+ g(this.logReceived()),
2051
+ f((n) => n),
2052
+ w(1)
2053
+ );
2054
+ return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
2055
+ }
2056
+ /**
2057
+ * Setup a listener for {@link CallInfoMessageReply}, which can be sent by a Host app to notify
2058
+ * of call information changes.
2059
+ *
2060
+ * @remarks
2061
+ * The Host app should send this message whenever call properties change. The Client app can
2062
+ * use this to update its call state accordingly.
2063
+ *
2064
+ * The Host app does not expect a reply to this message.
2065
+ *
2066
+ * @example
2067
+ * Here is an example of how a listener can be setup:
2068
+ *
2069
+ * ```ts
2070
+ * const ipcHelper = new IpcHelper(['2.0'], console);
2071
+ *
2072
+ * const callInfoSubscription = ipcHelper.onCallInfoMessage().subscribe((msg) => {
2073
+ * // your logic for handling call info updates goes here
2074
+ * });
2075
+ *
2076
+ * // don't forget to unsubscribe when you're cleaning up
2077
+ * callInfoSubscription.unsubscribe();
2078
+ * ```
2079
+ *
2080
+ * @returns An observable that emits whenever {@link CallInfoMessageReply} is received so it can
2081
+ * be subscribed to indefinitely.
2082
+ */
2083
+ onCallInfoMessage() {
2084
+ if (!this.isEmbedded())
2085
+ throw new h(this.currentContext);
2086
+ const t = "CALL INFO";
2087
+ return this.incomingMessages$.pipe(
2088
+ y(
2089
+ (e) => e.type === t && e.target === "client" && e.replyTo === null
2090
+ ),
2091
+ g(this.logReceived())
2092
+ );
2093
+ }
1964
2094
  /**
1965
2095
  * Setup listener for {@link BadgeQueryMessage}, which can be sent by a `Host` app to request the
1966
2096
  * current badge counter from the `Client` app.
@@ -1970,10 +2100,10 @@ class Mt {
1970
2100
  */
1971
2101
  onBadgeQueryMessage() {
1972
2102
  if (!this.isEmbedded())
1973
- throw new d(this.currentContext);
2103
+ throw new h(this.currentContext);
1974
2104
  const t = "BADGE QUERY";
1975
2105
  return this.incomingMessages$.pipe(
1976
- m((e) => e.type === t && e.target === "client"),
2106
+ y((e) => e.type === t && e.target === "client"),
1977
2107
  f((e) => e),
1978
2108
  g(this.logReceived())
1979
2109
  );
@@ -1992,7 +2122,7 @@ class Mt {
1992
2122
  */
1993
2123
  sendBadgeUpdateMessage(t, e, r) {
1994
2124
  if (!this.isEmbedded())
1995
- throw new d(this.currentContext);
2125
+ throw new h(this.currentContext);
1996
2126
  const n = "BADGE UPDATE", i = this.createMessage(n, !1, r);
1997
2127
  i.count = t, i.activity = e ?? !1, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i);
1998
2128
  }
@@ -2011,7 +2141,7 @@ class Mt {
2011
2141
  */
2012
2142
  sendLifecycleMessage(t, e) {
2013
2143
  if (!this.isEmbedded())
2014
- throw new d(this.currentContext);
2144
+ throw new h(this.currentContext);
2015
2145
  const r = "LIFECYCLE", n = this.createMessage(r, !1);
2016
2146
  n.eventName = t, n.payload = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2017
2147
  }
@@ -2028,10 +2158,10 @@ class Mt {
2028
2158
  */
2029
2159
  onLifecycleMessage() {
2030
2160
  if (!this.isEmbedded())
2031
- throw new d(this.currentContext);
2161
+ throw new h(this.currentContext);
2032
2162
  const t = "LIFECYCLE";
2033
2163
  return this.incomingMessages$.pipe(
2034
- m((e) => e.type === t && e.target === "client"),
2164
+ y((e) => e.type === t && e.target === "client"),
2035
2165
  f((e) => e),
2036
2166
  g(this.logReceived())
2037
2167
  );
@@ -2050,7 +2180,7 @@ class Mt {
2050
2180
  */
2051
2181
  sendLogMessage(t, e) {
2052
2182
  if (!this.isEmbedded())
2053
- throw new d(this.currentContext);
2183
+ throw new h(this.currentContext);
2054
2184
  const r = "LOG", n = this.createMessage(r, !1);
2055
2185
  n.level = t, n.message = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2056
2186
  }
@@ -2068,10 +2198,10 @@ class Mt {
2068
2198
  */
2069
2199
  onRequestLogsMessage() {
2070
2200
  if (!this.isEmbedded())
2071
- throw new d(this.currentContext);
2201
+ throw new h(this.currentContext);
2072
2202
  const t = "REQUEST LOGS";
2073
2203
  return this.incomingMessages$.pipe(
2074
- m((e) => e.type === t && e.target === "client"),
2204
+ y((e) => e.type === t && e.target === "client"),
2075
2205
  f((e) => e),
2076
2206
  g(this.logReceived())
2077
2207
  );
@@ -2088,9 +2218,9 @@ class Mt {
2088
2218
  */
2089
2219
  sendRequestLogsMessageReply(t, e, r, n, i) {
2090
2220
  if (!this.isEmbedded())
2091
- throw new d(this.currentContext);
2092
- const o = "REQUEST LOGS", c = this.createMessage(o, !1, i);
2093
- c.fileId = t, c.fileHash = e, c.fileSize = r, c.format = n, this.logCreated(o, c), this.port2.postMessage(c), this.logSent(o, c);
2221
+ throw new h(this.currentContext);
2222
+ const o = "REQUEST LOGS", a = this.createMessage(o, !1, i);
2223
+ a.fileId = t, a.fileHash = e, a.fileSize = r, a.format = n, this.logCreated(o, a), this.port2.postMessage(a), this.logSent(o, a);
2094
2224
  }
2095
2225
  /**
2096
2226
  * Send a {@link ViewTransitionMessage} to the `Host` app, notifying it of a view transition
@@ -2107,7 +2237,7 @@ class Mt {
2107
2237
  */
2108
2238
  sendViewTransitionMessage(t, e) {
2109
2239
  if (!this.isEmbedded())
2110
- throw new d(this.currentContext);
2240
+ throw new h(this.currentContext);
2111
2241
  const r = "VIEW TRANSITION", n = this.createMessage(r, !1);
2112
2242
  n.transitionType = t, n.targetView = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2113
2243
  }
@@ -2154,29 +2284,29 @@ class Mt {
2154
2284
  */
2155
2285
  sendFileRequestMessage(t, e, r, n, i) {
2156
2286
  if (!this.isEmbedded())
2157
- throw new d(this.currentContext);
2158
- const o = "FILE REQUEST", c = this.createMessage(o);
2159
- if (c.fileId = t, c.fileHash = e.toLowerCase(), c.intent = r, c.maxChunkSizeInBytes = i, r === "attachment") {
2287
+ throw new h(this.currentContext);
2288
+ const o = "FILE REQUEST", a = this.createMessage(o);
2289
+ if (a.fileId = t, a.fileHash = e.toLowerCase(), a.intent = r, a.maxChunkSizeInBytes = i, r === "attachment") {
2160
2290
  if (!n)
2161
- throw new y(
2291
+ throw new m(
2162
2292
  "streamId",
2163
2293
  n,
2164
2294
  "streamId is required for attachment intent"
2165
2295
  );
2166
- c.streamId = n;
2296
+ a.streamId = n;
2167
2297
  }
2168
- this.logCreated(o, c);
2169
- let a = 0;
2170
- const u = this.incomingMessages$.pipe(
2171
- m(
2172
- (h) => h.type === o && h.replyTo === c.id
2298
+ this.logCreated(o, a);
2299
+ let c = 0;
2300
+ const l = this.incomingMessages$.pipe(
2301
+ y(
2302
+ (d) => d.type === o && d.replyTo === a.id
2173
2303
  ),
2174
2304
  g(this.logReceived()),
2175
- g(() => a++),
2176
- f((h) => (h.result === "success" && (h.chunkHash = h.chunkHash.toLowerCase(), h.fileHash = h.fileHash.toLowerCase()), h)),
2177
- wt((h) => h.result === "success" && a < h.totalChunks, !0)
2305
+ g(() => c++),
2306
+ f((d) => (d.result === "success" && (d.chunkHash = d.chunkHash.toLowerCase(), d.fileHash = d.fileHash.toLowerCase()), d)),
2307
+ wt((d) => d.result === "success" && c < d.totalChunks, !0)
2178
2308
  );
2179
- return this.port2.postMessage(c), this.logSent(o, c), u;
2309
+ return this.port2.postMessage(a), this.logSent(o, a), l;
2180
2310
  }
2181
2311
  /**
2182
2312
  * Sends a {@link FileRequestMessageReply} to the Host app, to reply to a
@@ -2199,7 +2329,7 @@ class Mt {
2199
2329
  */
2200
2330
  sendFileRequestMessageReply(t, e) {
2201
2331
  if (!this.isEmbedded())
2202
- throw new d(this.currentContext);
2332
+ throw new h(this.currentContext);
2203
2333
  const r = "FILE REQUEST", n = Object.assign(
2204
2334
  e,
2205
2335
  this.createMessage(r, !1, t.id)
@@ -2220,10 +2350,10 @@ class Mt {
2220
2350
  */
2221
2351
  onFileRequestMessage() {
2222
2352
  if (!this.isEmbedded())
2223
- throw new d(this.currentContext);
2353
+ throw new h(this.currentContext);
2224
2354
  const t = "FILE REQUEST";
2225
2355
  return this.incomingMessages$.pipe(
2226
- m(
2356
+ y(
2227
2357
  (e) => e.type === t && e.target === "client" && e.replyTo === null
2228
2358
  ),
2229
2359
  f((e) => (e.fileHash = e.fileHash.toLowerCase(), e)),
@@ -2254,36 +2384,36 @@ class Mt {
2254
2384
  */
2255
2385
  sendFileSelectionMessage(t = "attachment", e, r, n, i, o) {
2256
2386
  if (!this.isEmbedded())
2257
- throw new d(this.currentContext);
2258
- const c = "FILE SELECTION", a = this.createMessage(c);
2259
- if (a.intent = t, a.maxCount = n, a.maxFileSizeInBytes = i, a.mimeTypes = o, t === "attachment") {
2387
+ throw new h(this.currentContext);
2388
+ const a = "FILE SELECTION", c = this.createMessage(a);
2389
+ if (c.intent = t, c.maxCount = n, c.maxFileSizeInBytes = i, c.mimeTypes = o, t === "attachment") {
2260
2390
  if (!e)
2261
- throw new y(
2391
+ throw new m(
2262
2392
  "streamId",
2263
2393
  e,
2264
2394
  "streamId is required for attachment intent"
2265
2395
  );
2266
2396
  if (!r)
2267
- throw new y(
2397
+ throw new m(
2268
2398
  "correlationId",
2269
2399
  r,
2270
2400
  "correlationId is required for attachment intent"
2271
2401
  );
2272
- a.streamId = e, a.correlationId = r;
2402
+ c.streamId = e, c.correlationId = r;
2273
2403
  }
2274
- this.logCreated(c, a);
2275
- const u = this.incomingMessages$.pipe(
2276
- m(
2277
- (h) => h.type === c && h.replyTo === a.id
2404
+ this.logCreated(a, c);
2405
+ const l = this.incomingMessages$.pipe(
2406
+ y(
2407
+ (d) => d.type === a && d.replyTo === c.id
2278
2408
  ),
2279
- f((h) => {
2280
- var l;
2281
- return h.result === "success" && (h.files = (l = h.files) == null ? void 0 : l.map((b) => (b.original.fileHash = b.original.fileHash.toLowerCase(), b.preview && (b.preview.fileHash = b.preview.fileHash.toLowerCase()), b))), h;
2409
+ f((d) => {
2410
+ var u;
2411
+ return d.result === "success" && (d.files = (u = d.files) == null ? void 0 : u.map((b) => (b.original.fileHash = b.original.fileHash.toLowerCase(), b.preview && (b.preview.fileHash = b.preview.fileHash.toLowerCase()), b))), d;
2282
2412
  }),
2283
2413
  g(this.logReceived()),
2284
2414
  w(1)
2285
2415
  );
2286
- return this.port2.postMessage(a), this.logSent(c, a), u;
2416
+ return this.port2.postMessage(c), this.logSent(a, c), l;
2287
2417
  }
2288
2418
  /**
2289
2419
  * Sends a {@link FileDownloadProgressQueryMessage} to the Host app, to query the progress of a
@@ -2306,18 +2436,18 @@ class Mt {
2306
2436
  */
2307
2437
  sendFileDownloadProgressQueryMessage(t, e, r) {
2308
2438
  if (!this.isEmbedded())
2309
- throw new d(this.currentContext);
2439
+ throw new h(this.currentContext);
2310
2440
  const n = "FILE DOWNLOAD PROGRESS QUERY", i = this.createMessage(
2311
2441
  n,
2312
2442
  !0
2313
2443
  );
2314
2444
  i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(n, i);
2315
2445
  const o = this.incomingMessages$.pipe(
2316
- m(
2317
- (c) => c.type === "FILE DOWNLOAD PROGRESS UPDATE" && c.replyTo === i.id
2446
+ y(
2447
+ (a) => a.type === "FILE DOWNLOAD PROGRESS UPDATE" && a.replyTo === i.id
2318
2448
  ),
2319
- g((c) => this.logReceived(c)),
2320
- f((c) => (c.fileHash && (c.fileHash = c.fileHash.toLowerCase()), c)),
2449
+ g((a) => this.logReceived(a)),
2450
+ f((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
2321
2451
  w(1)
2322
2452
  );
2323
2453
  return this.port2.postMessage(i), this.logSent(n, i), o;
@@ -2331,10 +2461,10 @@ class Mt {
2331
2461
  */
2332
2462
  onFileDownloadProgressUpdateMessage() {
2333
2463
  if (!this.isEmbedded())
2334
- throw new d(this.currentContext);
2464
+ throw new h(this.currentContext);
2335
2465
  const t = "FILE DOWNLOAD PROGRESS UPDATE";
2336
2466
  return this.incomingMessages$.pipe(
2337
- m(
2467
+ y(
2338
2468
  (e) => e.type === t && e.target === "client" && e.replyTo === null
2339
2469
  ),
2340
2470
  f((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
@@ -2357,18 +2487,18 @@ class Mt {
2357
2487
  */
2358
2488
  sendFileUploadProgressQueryMessage(t, e, r) {
2359
2489
  if (!this.isEmbedded())
2360
- throw new d(this.currentContext);
2490
+ throw new h(this.currentContext);
2361
2491
  const n = "FILE UPLOAD PROGRESS QUERY", i = this.createMessage(
2362
2492
  n,
2363
2493
  !0
2364
2494
  );
2365
2495
  i.fileHash = t.toLowerCase(), i.fileId = e, i.correlationId = r, this.logCreated(n, i);
2366
2496
  const o = this.incomingMessages$.pipe(
2367
- m(
2368
- (c) => c.type === "FILE UPLOAD PROGRESS UPDATE" && c.replyTo === i.id
2497
+ y(
2498
+ (a) => a.type === "FILE UPLOAD PROGRESS UPDATE" && a.replyTo === i.id
2369
2499
  ),
2370
2500
  g(this.logReceived()),
2371
- f((c) => (c.fileHash && (c.fileHash = c.fileHash.toLowerCase()), c)),
2501
+ f((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
2372
2502
  w(1)
2373
2503
  );
2374
2504
  return this.port2.postMessage(i), this.logSent(n, i), o;
@@ -2386,10 +2516,10 @@ class Mt {
2386
2516
  */
2387
2517
  onFileUploadProgressUpdateMessage() {
2388
2518
  if (!this.isEmbedded())
2389
- throw new d(this.currentContext);
2519
+ throw new h(this.currentContext);
2390
2520
  const t = "FILE UPLOAD PROGRESS UPDATE";
2391
2521
  return this.incomingMessages$.pipe(
2392
- m(
2522
+ y(
2393
2523
  (e) => e.type === t && e.target === "client" && e.replyTo === null
2394
2524
  ),
2395
2525
  f((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
@@ -2421,39 +2551,39 @@ class Mt {
2421
2551
  * @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
2422
2552
  * result of the request. Emits once.
2423
2553
  */
2424
- sendFileDownloadMessage(t, e, r, n, i, o, c, a, u) {
2554
+ sendFileDownloadMessage(t, e, r, n, i, o, a, c, l) {
2425
2555
  if (!this.isEmbedded())
2426
- throw new d(this.currentContext);
2427
- if (a && this.compareVersion("2.1") < 0)
2428
- a.type === "cloudUsername" && a.contactUser && (a = {
2429
- ...a,
2430
- cloudId: a.cloudId || a.contactUser.cloudId,
2431
- networkId: a.networkId || a.contactUser.networkId,
2432
- cloudUsername: a.cloudUsername || a.contactUser.cloudUsername
2556
+ throw new h(this.currentContext);
2557
+ if (c && this.compareVersion("2.1") < 0)
2558
+ c.type === "cloudUsername" && c.contactUser && (c = {
2559
+ ...c,
2560
+ cloudId: c.cloudId || c.contactUser.cloudId,
2561
+ networkId: c.networkId || c.contactUser.networkId,
2562
+ cloudUsername: c.cloudUsername || c.contactUser.cloudUsername
2433
2563
  });
2434
- else if (a && this.compareVersion("2.1") >= 0 && a.type === "cloudUsername") {
2435
- if (!a.contactUser)
2436
- throw new y(
2564
+ else if (c && this.compareVersion("2.1") >= 0 && c.type === "cloudUsername") {
2565
+ if (!c.contactUser)
2566
+ throw new m(
2437
2567
  "sender",
2438
- a,
2568
+ c,
2439
2569
  "CloudUsername contact must include contactUser since v2.1"
2440
2570
  );
2441
- if (!a.contactUser.cloudId || !a.contactUser.networkId || !a.contactUser.cloudUsername)
2442
- throw new y(
2571
+ if (!c.contactUser.cloudId || !c.contactUser.networkId || !c.contactUser.cloudUsername)
2572
+ throw new m(
2443
2573
  "sender",
2444
- a,
2574
+ c,
2445
2575
  "CloudContact must define cloudUsername, cloudId, and networkId since v2.1"
2446
2576
  );
2447
2577
  }
2448
- const h = "FILE DOWNLOAD", l = this.createMessage(h, !0);
2449
- l.url = t, l.key = e, l.fileHash = r.toLowerCase(), l.mimeType = n, l.fileName = i, l.streamId = o, l.correlationId = c, l.sender = a, l.intent = u ?? "download", this.logCreated(h, l);
2578
+ const d = "FILE DOWNLOAD", u = this.createMessage(d, !0);
2579
+ u.url = t, u.key = e, u.fileHash = r.toLowerCase(), u.mimeType = n, u.fileName = i, u.streamId = o, u.correlationId = a, u.sender = c, u.intent = l ?? "download", this.logCreated(d, u);
2450
2580
  const b = this.incomingMessages$.pipe(
2451
- m((p) => p.type === h && p.replyTo === l.id),
2581
+ y((p) => p.type === d && p.replyTo === u.id),
2452
2582
  g(this.logReceived()),
2453
2583
  f((p) => p),
2454
2584
  w(1)
2455
2585
  );
2456
- return this.port2.postMessage(l), this.logSent(h, l), b;
2586
+ return this.port2.postMessage(u), this.logSent(d, u), b;
2457
2587
  }
2458
2588
  /**
2459
2589
  * Sends a {@link CancelFileDownloadMessage} to the Host app, to cancel downloading of a file
@@ -2465,7 +2595,7 @@ class Mt {
2465
2595
  */
2466
2596
  sendCancelFileDownloadMessage(t, e, r) {
2467
2597
  if (!this.isEmbedded())
2468
- throw new d(this.currentContext);
2598
+ throw new h(this.currentContext);
2469
2599
  const n = "CANCEL FILE DOWNLOAD", i = this.createMessage(n, !1);
2470
2600
  i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i);
2471
2601
  }
@@ -2486,11 +2616,11 @@ class Mt {
2486
2616
  */
2487
2617
  sendFileRemoveMessage(t, e) {
2488
2618
  if (!this.isEmbedded())
2489
- throw new d(this.currentContext);
2619
+ throw new h(this.currentContext);
2490
2620
  const r = "FILE REMOVE", n = this.createMessage(r, !0);
2491
2621
  n.hash = t.toLowerCase(), n.streamId = e, this.logCreated(r, n);
2492
2622
  const i = this.incomingMessages$.pipe(
2493
- m((o) => o.type === r && o.replyTo === n.id),
2623
+ y((o) => o.type === r && o.replyTo === n.id),
2494
2624
  g(this.logReceived()),
2495
2625
  f((o) => o),
2496
2626
  w(1)
@@ -2512,7 +2642,7 @@ class Mt {
2512
2642
  */
2513
2643
  sendAppResetMessage() {
2514
2644
  if (!this.isEmbedded())
2515
- throw new d(this.currentContext);
2645
+ throw new h(this.currentContext);
2516
2646
  const t = "APP RESET", e = this.createMessage(t, !1);
2517
2647
  this.logCreated(t, e), this.port2.postMessage(e), this.logSent(t, e);
2518
2648
  }
@@ -2536,7 +2666,7 @@ class Mt {
2536
2666
  */
2537
2667
  sendMessageSentMessage(t, e) {
2538
2668
  if (!this.isEmbedded())
2539
- throw new d(this.currentContext);
2669
+ throw new h(this.currentContext);
2540
2670
  const r = "MESSAGE SENT", n = this.createMessage(r, !1);
2541
2671
  n.streamId = t, n.correlationId = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2542
2672
  }
@@ -2558,13 +2688,13 @@ class Mt {
2558
2688
  * @returns An observable which emits a {@link SendMessageMessageReply} instance containing the
2559
2689
  * result of the request. Emits once.
2560
2690
  */
2561
- sendSendMessageMessage(t, e, r, n = "TEXT", i, o, c, a = !0, u) {
2691
+ sendSendMessageMessage(t, e, r, n = "TEXT", i, o, a, c = !0, l) {
2562
2692
  if (!this.isEmbedded())
2563
- throw new d(this.currentContext);
2564
- const h = "SEND MESSAGE", l = this.createMessage(h, !0);
2565
- if (l.streamId = t, l.correlationId = e, l.body = r, l.messageType = n, i && i.length > 0)
2693
+ throw new h(this.currentContext);
2694
+ const d = "SEND MESSAGE", u = this.createMessage(d, !0);
2695
+ if (u.streamId = t, u.correlationId = e, u.body = r, u.messageType = n, i && i.length > 0)
2566
2696
  if (this.compareVersion("2.1") < 0)
2567
- l.mentions = i.map((p) => p.contactUser ? {
2697
+ u.mentions = i.map((p) => p.contactUser ? {
2568
2698
  ...p,
2569
2699
  cloudId: p.cloudId || p.contactUser.cloudId,
2570
2700
  networkId: p.networkId || p.contactUser.networkId,
@@ -2573,30 +2703,30 @@ class Mt {
2573
2703
  else {
2574
2704
  for (const p of i) {
2575
2705
  if (p.type === "cloudUsername" && !p.contactUser)
2576
- throw new y(
2706
+ throw new m(
2577
2707
  "mentions",
2578
2708
  p,
2579
2709
  "CloudUsername mention must include contactUser"
2580
2710
  );
2581
2711
  if (p.contactUser && (!p.contactUser.cloudId || !p.contactUser.networkId || !p.contactUser.cloudUsername))
2582
- throw new y(
2712
+ throw new m(
2583
2713
  "mentions",
2584
2714
  p,
2585
2715
  "CloudContact must define cloudUsername, cloudId, and networkId"
2586
2716
  );
2587
2717
  }
2588
- l.mentions = i;
2718
+ u.mentions = i;
2589
2719
  }
2590
2720
  else
2591
- l.mentions = [];
2592
- l.attachments = (o == null ? void 0 : o.map((p) => p.toLowerCase())) ?? [], l.relatedMessageId = c, l.setCursors = a, l.threadId = u, this.logCreated(h, l);
2721
+ u.mentions = [];
2722
+ u.attachments = (o == null ? void 0 : o.map((p) => p.toLowerCase())) ?? [], u.relatedMessageId = a, u.setCursors = c, u.threadId = l, this.logCreated(d, u);
2593
2723
  const b = this.incomingMessages$.pipe(
2594
- m((p) => p.type === h && p.replyTo === l.id),
2724
+ y((p) => p.type === d && p.replyTo === u.id),
2595
2725
  g(this.logReceived()),
2596
2726
  f((p) => p),
2597
2727
  w(1)
2598
2728
  );
2599
- return this.port2.postMessage(l), this.logSent(h, l), b;
2729
+ return this.port2.postMessage(u), this.logSent(d, u), b;
2600
2730
  }
2601
2731
  /**
2602
2732
  * Sends a {@link CancelSendMessageMessage} to the Host app, to cancel a message that was being
@@ -2609,7 +2739,7 @@ class Mt {
2609
2739
  */
2610
2740
  sendCancelSendMessageMessage(t, e) {
2611
2741
  if (!this.isEmbedded())
2612
- throw new d(this.currentContext);
2742
+ throw new h(this.currentContext);
2613
2743
  const r = "CANCEL SEND MESSAGE", n = this.createMessage(r, !1);
2614
2744
  n.streamId = t, n.correlationId = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2615
2745
  }
@@ -2622,7 +2752,7 @@ class Mt {
2622
2752
  */
2623
2753
  sendMessageDeletedMessage(t, e) {
2624
2754
  if (!this.isEmbedded())
2625
- throw new d(this.currentContext);
2755
+ throw new h(this.currentContext);
2626
2756
  const r = "MESSAGE DELETED", n = this.createMessage(r, !1);
2627
2757
  n.correlationId = t, n.streamId = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2628
2758
  }
@@ -2641,11 +2771,11 @@ class Mt {
2641
2771
  */
2642
2772
  sendSendMessageStatusQueryMessage(t, e) {
2643
2773
  if (!this.isEmbedded())
2644
- throw new d(this.currentContext);
2774
+ throw new h(this.currentContext);
2645
2775
  const r = "SEND MESSAGE STATUS QUERY", n = this.createMessage(r, !0);
2646
2776
  n.correlationId = t, n.streamId = e, this.logCreated(r, n);
2647
2777
  const i = this.incomingMessages$.pipe(
2648
- m(
2778
+ y(
2649
2779
  (o) => o.type === "SEND MESSAGE STATUS UPDATE" && o.replyTo === n.id
2650
2780
  ),
2651
2781
  g(this.logReceived()),
@@ -2663,10 +2793,10 @@ class Mt {
2663
2793
  */
2664
2794
  onSendMessageStatusUpdateMessage() {
2665
2795
  if (!this.isEmbedded())
2666
- throw new d(this.currentContext);
2796
+ throw new h(this.currentContext);
2667
2797
  const t = "SEND MESSAGE STATUS UPDATE";
2668
2798
  return this.incomingMessages$.pipe(
2669
- m((e) => e.type === t && e.target === "client" && e.replyTo === null),
2799
+ y((e) => e.type === t && e.target === "client" && e.replyTo === null),
2670
2800
  f((e) => e),
2671
2801
  g(this.logReceived())
2672
2802
  );
@@ -2681,7 +2811,7 @@ class Mt {
2681
2811
  */
2682
2812
  sendSipCallMessage(t) {
2683
2813
  if (!this.isEmbedded())
2684
- throw new d(this.currentContext);
2814
+ throw new h(this.currentContext);
2685
2815
  if (this.compareVersion("2.1") < 0)
2686
2816
  t.type === "cloudUsername" && t.contactUser && (t = {
2687
2817
  ...t,
@@ -2691,13 +2821,13 @@ class Mt {
2691
2821
  });
2692
2822
  else if (t.type === "cloudUsername") {
2693
2823
  if (!t.contactUser)
2694
- throw new y(
2824
+ throw new m(
2695
2825
  "contact",
2696
2826
  t,
2697
2827
  "CloudUsername contact must include contactUser since v2.1"
2698
2828
  );
2699
2829
  if (!t.contactUser.cloudId || !t.contactUser.networkId || !t.contactUser.cloudUsername)
2700
- throw new y(
2830
+ throw new m(
2701
2831
  "contact",
2702
2832
  t,
2703
2833
  "CloudContact must define cloudUsername, cloudId, and networkId since v2.1"
@@ -2708,7 +2838,7 @@ class Mt {
2708
2838
  }
2709
2839
  sendCustomFunctionMessage(t, e) {
2710
2840
  if (!this.isEmbedded())
2711
- throw new d(this.currentContext);
2841
+ throw new h(this.currentContext);
2712
2842
  const r = "CUSTOM FUNCTION", n = this.createMessage(r, !1);
2713
2843
  n.customFunctionId = t, n.context = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2714
2844
  }
@@ -2726,7 +2856,7 @@ class Mt {
2726
2856
  */
2727
2857
  sendSubscribeButtonsMessage(t) {
2728
2858
  if (!this.isEmbedded())
2729
- throw new d(this.currentContext);
2859
+ throw new h(this.currentContext);
2730
2860
  const e = "SUBSCRIBE BUTTONS", r = this.createMessage(e, !1);
2731
2861
  r.subscribe = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
2732
2862
  }
@@ -2757,10 +2887,10 @@ class Mt {
2757
2887
  */
2758
2888
  onButtonsMessage() {
2759
2889
  if (!this.isEmbedded())
2760
- throw new d(this.currentContext);
2890
+ throw new h(this.currentContext);
2761
2891
  const t = "BUTTONS";
2762
2892
  return this.incomingMessages$.pipe(
2763
- m((e) => e.type === t && e.target === "client"),
2893
+ y((e) => e.type === t && e.target === "client"),
2764
2894
  f((e) => e),
2765
2895
  g(this.logReceived())
2766
2896
  );
@@ -2810,7 +2940,7 @@ class Mt {
2810
2940
  r
2811
2941
  );
2812
2942
  if (t) {
2813
- It(t) && (t = { ...t, data: "..." }), e(t);
2943
+ Mt(t) && (t = { ...t, data: "..." }), e(t);
2814
2944
  return;
2815
2945
  } else
2816
2946
  return e;
@@ -2854,7 +2984,7 @@ class Mt {
2854
2984
  return n.join("");
2855
2985
  }
2856
2986
  }
2857
- function It(s) {
2987
+ function Mt(s) {
2858
2988
  return s.type === "FILE REQUEST" && s.replyTo !== null;
2859
2989
  }
2860
2990
  const Ut = ["2.0", "2.1"];
@@ -2873,23 +3003,23 @@ class xt {
2873
3003
  /**
2874
3004
  * The type of the `Host` app the `Client` is embedded in.
2875
3005
  */
2876
- M(this, "host");
3006
+ I(this, "host");
2877
3007
  /**
2878
3008
  * The cloud ID of the `Host` app the `Client` is embedded in.
2879
3009
  */
2880
- M(this, "cloudId");
3010
+ I(this, "cloudId");
2881
3011
  /**
2882
3012
  * The cloud username of the logged in user.
2883
3013
  */
2884
- M(this, "cloudUsername");
3014
+ I(this, "cloudUsername");
2885
3015
  /**
2886
3016
  * The display name of the logged in user.
2887
3017
  */
2888
- M(this, "displayName");
2889
- M(this, "logger");
2890
- M(this, "helper");
2891
- M(this, "listeners");
2892
- this.logger = t ?? console, this.helper = new Mt(Ut, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(S.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(S.Lifecycle, /* @__PURE__ */ new Set()), this.listeners.set(S.PushToken, /* @__PURE__ */ new Set()), this.listeners.set(S.RequestLogs, /* @__PURE__ */ new Set());
3018
+ I(this, "displayName");
3019
+ I(this, "logger");
3020
+ I(this, "helper");
3021
+ I(this, "listeners");
3022
+ this.logger = t ?? console, this.helper = new It(Ut, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(C.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(C.Lifecycle, /* @__PURE__ */ new Set()), this.listeners.set(C.PushToken, /* @__PURE__ */ new Set()), this.listeners.set(C.RequestLogs, /* @__PURE__ */ new Set());
2893
3023
  }
2894
3024
  /**
2895
3025
  * Returns whether the app is running inside a native WebView (`host` context) or as a
@@ -2931,23 +3061,23 @@ class xt {
2931
3061
  this.helper.onBadgeQueryMessage().subscribe((e) => {
2932
3062
  var r;
2933
3063
  this.logger.debug("Received Badge Query: ", e);
2934
- for (const n of ((r = this.listeners.get(S.BadgeQuery)) == null ? void 0 : r.values()) ?? [])
3064
+ for (const n of ((r = this.listeners.get(C.BadgeQuery)) == null ? void 0 : r.values()) ?? [])
2935
3065
  n();
2936
3066
  }), this.helper.onLifecycleMessage().subscribe((e) => {
2937
3067
  var r;
2938
3068
  this.logger.debug("Received Lifecycle Event: ", e);
2939
- for (const n of ((r = this.listeners.get(S.Lifecycle)) == null ? void 0 : r.values()) ?? [])
3069
+ for (const n of ((r = this.listeners.get(C.Lifecycle)) == null ? void 0 : r.values()) ?? [])
2940
3070
  n(e.eventName, e.payload);
2941
3071
  }), this.helper.onPushTokenMessage().subscribe((e) => {
2942
3072
  var r;
2943
3073
  this.logger.debug("Received Push Token: ", e);
2944
- for (const n of ((r = this.listeners.get(S.PushToken)) == null ? void 0 : r.values()) ?? [])
3074
+ for (const n of ((r = this.listeners.get(C.PushToken)) == null ? void 0 : r.values()) ?? [])
2945
3075
  n(e.pushToken, e.appId, e.selector);
2946
3076
  }), this.helper.onRequestLogsMessage().subscribe((e) => {
2947
3077
  var r;
2948
3078
  if (this.logger.debug("Received Request Logs Message: ", e), e.responseType === "file")
2949
3079
  throw this.logger.error("File response type not supported"), new Error("File response type not supported");
2950
- for (const n of ((r = this.listeners.get(S.RequestLogs)) == null ? void 0 : r.values()) ?? [])
3080
+ for (const n of ((r = this.listeners.get(C.RequestLogs)) == null ? void 0 : r.values()) ?? [])
2951
3081
  n(e.skipCompression);
2952
3082
  }), this.cloudId = t.cloudId, this.cloudUsername = t.cloudUsername, this.displayName = t.displayName, this.host = t.host;
2953
3083
  }),
@@ -2961,9 +3091,9 @@ class xt {
2961
3091
  let i;
2962
3092
  if (this.negotiatedVersion === "2.0") {
2963
3093
  if (typeof e != "string")
2964
- throw new y("mode", e, 'mode must be "single" or "multi"');
3094
+ throw new m("mode", e, 'mode must be "single" or "multi"');
2965
3095
  if (n === "number")
2966
- throw new y(
3096
+ throw new m(
2967
3097
  "contactType",
2968
3098
  n,
2969
3099
  'contactType cannot be "number" for version 2.0 of the IPC protocol'
@@ -2976,7 +3106,7 @@ class xt {
2976
3106
  );
2977
3107
  } else {
2978
3108
  if (typeof e != "object")
2979
- throw new y("options", e, "options must be an object");
3109
+ throw new m("options", e, "options must be an object");
2980
3110
  i = this.selectContacts_V2_1(t, e);
2981
3111
  }
2982
3112
  return T(
@@ -2993,7 +3123,7 @@ class xt {
2993
3123
  selectContacts_V2_0(t, e, r, n) {
2994
3124
  if (this.logger.debug("Selecting Contacts: ", ...arguments), e === "multi") {
2995
3125
  if (!r || !Array.isArray(r))
2996
- throw new y(
3126
+ throw new m(
2997
3127
  "currentContacts",
2998
3128
  r,
2999
3129
  "currentContacts is required for group streams"
@@ -3008,19 +3138,35 @@ class xt {
3008
3138
  return n || (n = "cloudUsername"), this.helper.selectContacts(t.toString(), "direct", n);
3009
3139
  }
3010
3140
  selectContacts_V2_1(t, e) {
3011
- if (this.logger.debug("Selecting Contacts: ", e), e.mode === "multi" && (!e.currentContacts || !Array.isArray(e.currentContacts)))
3012
- throw new y(
3141
+ this.logger.debug("Selecting Contacts: ", e);
3142
+ const r = t.toString(), n = e.resultTypes ?? ["cloudUsername"];
3143
+ if (e.mode === "single")
3144
+ return this.helper.selectContacts(r, {
3145
+ allowMultipleSelection: !1,
3146
+ resultTypes: n
3147
+ });
3148
+ if (!e.currentContacts || !Array.isArray(e.currentContacts))
3149
+ throw new m(
3013
3150
  "currentContacts",
3014
3151
  e.currentContacts,
3015
3152
  "currentContacts is required for group streams"
3016
3153
  );
3017
- return this.helper.selectContacts(
3018
- t.toString(),
3154
+ return e.filterToSelectedType ? this.helper.selectContacts(
3155
+ r,
3156
+ {
3157
+ allowMultipleSelection: !0,
3158
+ filterToSelectedType: !0,
3159
+ resultTypes: n
3160
+ },
3161
+ e.currentContacts
3162
+ ) : this.helper.selectContacts(
3163
+ r,
3019
3164
  {
3020
- allowMultipleSelection: e.mode === "multi",
3021
- resultTypes: e.resultTypes ?? ["cloudUsername"]
3165
+ allowMultipleSelection: !0,
3166
+ filterToSelectedType: !1,
3167
+ resultTypes: n
3022
3168
  },
3023
- e.mode === "multi" ? e.currentContacts : void 0
3169
+ e.currentContacts
3024
3170
  );
3025
3171
  }
3026
3172
  /**
@@ -3110,9 +3256,9 @@ class xt {
3110
3256
  */
3111
3257
  onBadgeQueryRequest(t) {
3112
3258
  var e;
3113
- return this.logger.debug("Registering for Badge Query"), (e = this.listeners.get(S.BadgeQuery)) == null || e.add(t), () => {
3259
+ return this.logger.debug("Registering for Badge Query"), (e = this.listeners.get(C.BadgeQuery)) == null || e.add(t), () => {
3114
3260
  var r;
3115
- return (r = this.listeners.get(S.BadgeQuery)) == null ? void 0 : r.delete(t);
3261
+ return (r = this.listeners.get(C.BadgeQuery)) == null ? void 0 : r.delete(t);
3116
3262
  };
3117
3263
  }
3118
3264
  /**
@@ -3129,9 +3275,9 @@ class xt {
3129
3275
  */
3130
3276
  onLifecycleEvent(t) {
3131
3277
  var e;
3132
- return this.logger.debug("Registering for Lifecycle Event"), (e = this.listeners.get(S.Lifecycle)) == null || e.add(t), () => {
3278
+ return this.logger.debug("Registering for Lifecycle Event"), (e = this.listeners.get(C.Lifecycle)) == null || e.add(t), () => {
3133
3279
  var r;
3134
- return (r = this.listeners.get(S.Lifecycle)) == null ? void 0 : r.delete(t);
3280
+ return (r = this.listeners.get(C.Lifecycle)) == null ? void 0 : r.delete(t);
3135
3281
  };
3136
3282
  }
3137
3283
  /**
@@ -3147,9 +3293,9 @@ class xt {
3147
3293
  */
3148
3294
  onPushToken(t) {
3149
3295
  var e;
3150
- return this.logger.debug("Registering for Push Token"), (e = this.listeners.get(S.PushToken)) == null || e.add(t), () => {
3296
+ return this.logger.debug("Registering for Push Token"), (e = this.listeners.get(C.PushToken)) == null || e.add(t), () => {
3151
3297
  var r;
3152
- return (r = this.listeners.get(S.PushToken)) == null ? void 0 : r.delete(t);
3298
+ return (r = this.listeners.get(C.PushToken)) == null ? void 0 : r.delete(t);
3153
3299
  };
3154
3300
  }
3155
3301
  /**
@@ -3169,9 +3315,9 @@ class xt {
3169
3315
  */
3170
3316
  onRequestLogsMessage(t) {
3171
3317
  var e;
3172
- return this.logger.debug("Registering for Request Logs Message"), (e = this.listeners.get(S.RequestLogs)) == null || e.add(t), () => {
3318
+ return this.logger.debug("Registering for Request Logs Message"), (e = this.listeners.get(C.RequestLogs)) == null || e.add(t), () => {
3173
3319
  var r;
3174
- return (r = this.listeners.get(S.RequestLogs)) == null ? void 0 : r.delete(t);
3320
+ return (r = this.listeners.get(C.RequestLogs)) == null ? void 0 : r.delete(t);
3175
3321
  };
3176
3322
  }
3177
3323
  evaluateContext(t) {
@@ -3182,6 +3328,6 @@ class xt {
3182
3328
  }
3183
3329
  }
3184
3330
  export {
3185
- S as IPCEvents,
3331
+ C as IPCEvents,
3186
3332
  xt as IPCManager
3187
3333
  };