@acrobits/ipc-sdk 0.2.0 → 0.2.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ipc-sdk.js CHANGED
@@ -1,18 +1,18 @@
1
- var Pe = Object.defineProperty;
2
- var Re = (n, t, e) => t in n ? Pe(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var _ = (n, t, e) => (Re(n, typeof t != "symbol" ? t + "" : t, e), e);
4
- var E = /* @__PURE__ */ ((n) => (n.BadgeQuery = "BADGE QUERY", n.HostInForeground = "HOST IN FOREGROUND", n))(E || {}), Q = function(n, t) {
5
- return Q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
1
+ var Ae = Object.defineProperty;
2
+ var Re = (n, t, e) => t in n ? Ae(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var M = (n, t, e) => (Re(n, typeof t != "symbol" ? t + "" : t, e), e);
4
+ var E = /* @__PURE__ */ ((n) => (n.BadgeQuery = "BADGE QUERY", n.HostInForeground = "HOST IN FOREGROUND", n))(E || {}), z = function(n, t) {
5
+ return z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
6
6
  e.__proto__ = r;
7
7
  } || function(e, r) {
8
8
  for (var i in r)
9
9
  Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
10
- }, Q(n, t);
10
+ }, z(n, t);
11
11
  };
12
12
  function x(n, t) {
13
13
  if (typeof t != "function" && t !== null)
14
14
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
15
- Q(n, t);
15
+ z(n, t);
16
16
  function e() {
17
17
  this.constructor = n;
18
18
  }
@@ -30,7 +30,7 @@ function G(n) {
30
30
  };
31
31
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
32
32
  }
33
- function M(n, t) {
33
+ function _(n, t) {
34
34
  var e = typeof Symbol == "function" && n[Symbol.iterator];
35
35
  if (!e)
36
36
  return n;
@@ -65,7 +65,7 @@ function Z(n) {
65
65
  }, e = n(t);
66
66
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
67
67
  }
68
- var N = Z(function(n) {
68
+ var H = Z(function(n) {
69
69
  return function(e) {
70
70
  n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
71
71
  ` + e.map(function(r, i) {
@@ -80,7 +80,7 @@ function L(n, t) {
80
80
  0 <= e && n.splice(e, 1);
81
81
  }
82
82
  }
83
- var A = function() {
83
+ var T = function() {
84
84
  function n(t) {
85
85
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
86
86
  }
@@ -108,30 +108,30 @@ var A = function() {
108
108
  }
109
109
  else
110
110
  s.remove(this);
111
- var f = this.initialTeardown;
112
- if (b(f))
111
+ var g = this.initialTeardown;
112
+ if (b(g))
113
113
  try {
114
- f();
114
+ g();
115
115
  } catch (d) {
116
- o = d instanceof N ? d.errors : [d];
116
+ o = d instanceof H ? d.errors : [d];
117
117
  }
118
- var g = this._finalizers;
119
- if (g) {
118
+ var v = this._finalizers;
119
+ if (v) {
120
120
  this._finalizers = null;
121
121
  try {
122
- for (var w = G(g), y = w.next(); !y.done; y = w.next()) {
122
+ for (var S = G(v), y = S.next(); !y.done; y = S.next()) {
123
123
  var D = y.value;
124
124
  try {
125
125
  oe(D);
126
126
  } catch (d) {
127
- o = o ?? [], d instanceof N ? o = I(I([], M(o)), M(d.errors)) : o.push(d);
127
+ o = o ?? [], d instanceof H ? o = I(I([], _(o)), _(d.errors)) : o.push(d);
128
128
  }
129
129
  }
130
130
  } catch (d) {
131
131
  r = { error: d };
132
132
  } finally {
133
133
  try {
134
- y && !y.done && (i = w.return) && i.call(w);
134
+ y && !y.done && (i = S.return) && i.call(S);
135
135
  } finally {
136
136
  if (r)
137
137
  throw r.error;
@@ -139,7 +139,7 @@ var A = function() {
139
139
  }
140
140
  }
141
141
  if (o)
142
- throw new N(o);
142
+ throw new H(o);
143
143
  }
144
144
  }, n.prototype.add = function(t) {
145
145
  var e;
@@ -170,9 +170,9 @@ var A = function() {
170
170
  var t = new n();
171
171
  return t.closed = !0, t;
172
172
  }(), n;
173
- }(), me = A.EMPTY;
173
+ }(), me = T.EMPTY;
174
174
  function we(n) {
175
- return n instanceof A || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
175
+ return n instanceof T || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
176
176
  }
177
177
  function oe(n) {
178
178
  b(n) ? n() : n.unsubscribe();
@@ -183,21 +183,21 @@ var Se = {
183
183
  Promise: void 0,
184
184
  useDeprecatedSynchronousErrorHandling: !1,
185
185
  useDeprecatedNextContext: !1
186
- }, z = {
186
+ }, Q = {
187
187
  setTimeout: function(n, t) {
188
188
  for (var e = [], r = 2; r < arguments.length; r++)
189
189
  e[r - 2] = arguments[r];
190
- var i = z.delegate;
191
- return i != null && i.setTimeout ? i.setTimeout.apply(i, I([n, t], M(e))) : setTimeout.apply(void 0, I([n, t], M(e)));
190
+ var i = Q.delegate;
191
+ return i != null && i.setTimeout ? i.setTimeout.apply(i, I([n, t], _(e))) : setTimeout.apply(void 0, I([n, t], _(e)));
192
192
  },
193
193
  clearTimeout: function(n) {
194
- var t = z.delegate;
194
+ var t = Q.delegate;
195
195
  return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(n);
196
196
  },
197
197
  delegate: void 0
198
198
  };
199
- function Te(n) {
200
- z.setTimeout(function() {
199
+ function Pe(n) {
200
+ Q.setTimeout(function() {
201
201
  throw n;
202
202
  });
203
203
  }
@@ -210,10 +210,10 @@ var ee = function(n) {
210
210
  x(t, n);
211
211
  function t(e) {
212
212
  var r = n.call(this) || this;
213
- return r.isStopped = !1, e ? (r.destination = e, we(e) && e.add(r)) : r.destination = Ve, r;
213
+ return r.isStopped = !1, e ? (r.destination = e, we(e) && e.add(r)) : r.destination = Fe, r;
214
214
  }
215
215
  return t.create = function(e, r, i) {
216
- return new V(e, r, i);
216
+ return new F(e, r, i);
217
217
  }, t.prototype.next = function(e) {
218
218
  this.isStopped || this._next(e);
219
219
  }, t.prototype.error = function(e) {
@@ -237,7 +237,7 @@ var ee = function(n) {
237
237
  this.unsubscribe();
238
238
  }
239
239
  }, t;
240
- }(A), Ue = Function.prototype.bind;
240
+ }(T), Ue = Function.prototype.bind;
241
241
  function k(n, t) {
242
242
  return Ue.call(n, t);
243
243
  }
@@ -251,7 +251,7 @@ var $e = function() {
251
251
  try {
252
252
  e.next(t);
253
253
  } catch (r) {
254
- P(r);
254
+ A(r);
255
255
  }
256
256
  }, n.prototype.error = function(t) {
257
257
  var e = this.partialObserver;
@@ -259,20 +259,20 @@ var $e = function() {
259
259
  try {
260
260
  e.error(t);
261
261
  } catch (r) {
262
- P(r);
262
+ A(r);
263
263
  }
264
264
  else
265
- P(t);
265
+ A(t);
266
266
  }, n.prototype.complete = function() {
267
267
  var t = this.partialObserver;
268
268
  if (t.complete)
269
269
  try {
270
270
  t.complete();
271
271
  } catch (e) {
272
- P(e);
272
+ A(e);
273
273
  }
274
274
  }, n;
275
- }(), V = function(n) {
275
+ }(), F = function(n) {
276
276
  x(t, n);
277
277
  function t(e, r, i) {
278
278
  var o = n.call(this) || this, s;
@@ -296,24 +296,24 @@ var $e = function() {
296
296
  }
297
297
  return t;
298
298
  }(ee);
299
- function P(n) {
300
- Te(n);
299
+ function A(n) {
300
+ Pe(n);
301
301
  }
302
302
  function Le(n) {
303
303
  throw n;
304
304
  }
305
- var Ve = {
305
+ var Fe = {
306
306
  closed: !0,
307
307
  next: se,
308
308
  error: Le,
309
309
  complete: se
310
- }, je = function() {
310
+ }, Ve = function() {
311
311
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
312
312
  }();
313
313
  function Ee(n) {
314
314
  return n;
315
315
  }
316
- function Fe(n) {
316
+ function je(n) {
317
317
  return n.length === 0 ? Ee : n.length === 1 ? n[0] : function(e) {
318
318
  return n.reduce(function(r, i) {
319
319
  return i(r);
@@ -328,7 +328,7 @@ var Y = function() {
328
328
  var e = new n();
329
329
  return e.source = this, e.operator = t, e;
330
330
  }, n.prototype.subscribe = function(t, e, r) {
331
- var i = this, o = De(t) ? t : new V(t, e, r);
331
+ var i = this, o = De(t) ? t : new F(t, e, r);
332
332
  return U(function() {
333
333
  var s = i, c = s.operator, u = s.source;
334
334
  o.add(c ? c.call(o, u) : u ? i._subscribe(o) : i._trySubscribe(o));
@@ -342,7 +342,7 @@ var Y = function() {
342
342
  }, n.prototype.forEach = function(t, e) {
343
343
  var r = this;
344
344
  return e = ue(e), new e(function(i, o) {
345
- var s = new V({
345
+ var s = new F({
346
346
  next: function(c) {
347
347
  try {
348
348
  t(c);
@@ -358,12 +358,12 @@ var Y = function() {
358
358
  }, n.prototype._subscribe = function(t) {
359
359
  var e;
360
360
  return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
361
- }, n.prototype[je] = function() {
361
+ }, n.prototype[Ve] = function() {
362
362
  return this;
363
363
  }, n.prototype.pipe = function() {
364
364
  for (var t = [], e = 0; e < arguments.length; e++)
365
365
  t[e] = arguments[e];
366
- return Fe(t)(this);
366
+ return je(t)(this);
367
367
  }, n.prototype.toPromise = function(t) {
368
368
  var e = this;
369
369
  return t = ue(t), new t(function(r, i) {
@@ -384,18 +384,18 @@ function ue(n) {
384
384
  var t;
385
385
  return (t = n ?? Se.Promise) !== null && t !== void 0 ? t : Promise;
386
386
  }
387
- function He(n) {
387
+ function Ne(n) {
388
388
  return n && b(n.next) && b(n.error) && b(n.complete);
389
389
  }
390
390
  function De(n) {
391
- return n && n instanceof ee || He(n) && we(n);
391
+ return n && n instanceof ee || Ne(n) && we(n);
392
392
  }
393
- function Ne(n) {
393
+ function He(n) {
394
394
  return b(n == null ? void 0 : n.lift);
395
395
  }
396
396
  function Ce(n) {
397
397
  return function(t) {
398
- if (Ne(t))
398
+ if (He(t))
399
399
  return t.lift(function(e) {
400
400
  try {
401
401
  return n(e, this);
@@ -416,14 +416,14 @@ var ke = function(n) {
416
416
  return u.onFinalize = s, u.shouldUnsubscribe = c, u._next = r ? function(a) {
417
417
  try {
418
418
  r(a);
419
- } catch (f) {
420
- e.error(f);
419
+ } catch (g) {
420
+ e.error(g);
421
421
  }
422
422
  } : n.prototype._next, u._error = o ? function(a) {
423
423
  try {
424
424
  o(a);
425
- } catch (f) {
426
- e.error(f);
425
+ } catch (g) {
426
+ e.error(g);
427
427
  } finally {
428
428
  this.unsubscribe();
429
429
  }
@@ -448,7 +448,7 @@ var ke = function(n) {
448
448
  return function() {
449
449
  n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
450
450
  };
451
- }), _e = function(n) {
451
+ }), Me = function(n) {
452
452
  x(t, n);
453
453
  function t() {
454
454
  var e = n.call(this) || this;
@@ -516,7 +516,7 @@ var ke = function(n) {
516
516
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
517
517
  }, t.prototype._innerSubscribe = function(e) {
518
518
  var r = this, i = this, o = i.hasError, s = i.isStopped, c = i.observers;
519
- return o || s ? me : (this.currentObservers = null, c.push(e), new A(function() {
519
+ return o || s ? me : (this.currentObservers = null, c.push(e), new T(function() {
520
520
  r.currentObservers = null, L(c, e);
521
521
  }));
522
522
  }, t.prototype._checkFinalizedStatuses = function(e) {
@@ -547,9 +547,9 @@ var ke = function(n) {
547
547
  var r, i;
548
548
  return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && i !== void 0 ? i : me;
549
549
  }, t;
550
- }(_e), Me = {
550
+ }(Me), _e = {
551
551
  now: function() {
552
- return (Me.delegate || Date).now();
552
+ return (_e.delegate || Date).now();
553
553
  },
554
554
  delegate: void 0
555
555
  }, qe = function(n) {
@@ -560,19 +560,19 @@ var ke = function(n) {
560
560
  return t.prototype.schedule = function(e, r) {
561
561
  return this;
562
562
  }, t;
563
- }(A), j = {
563
+ }(T), V = {
564
564
  setInterval: function(n, t) {
565
565
  for (var e = [], r = 2; r < arguments.length; r++)
566
566
  e[r - 2] = arguments[r];
567
- var i = j.delegate;
568
- return i != null && i.setInterval ? i.setInterval.apply(i, I([n, t], M(e))) : setInterval.apply(void 0, I([n, t], M(e)));
567
+ var i = V.delegate;
568
+ return i != null && i.setInterval ? i.setInterval.apply(i, I([n, t], _(e))) : setInterval.apply(void 0, I([n, t], _(e)));
569
569
  },
570
570
  clearInterval: function(n) {
571
- var t = j.delegate;
571
+ var t = V.delegate;
572
572
  return ((t == null ? void 0 : t.clearInterval) || clearInterval)(n);
573
573
  },
574
574
  delegate: void 0
575
- }, Qe = function(n) {
575
+ }, ze = function(n) {
576
576
  x(t, n);
577
577
  function t(e, r) {
578
578
  var i = n.call(this, e, r) || this;
@@ -586,11 +586,11 @@ var ke = function(n) {
586
586
  var o = this.id, s = this.scheduler;
587
587
  return o != null && (this.id = this.recycleAsyncId(s, o, r)), this.pending = !0, this.delay = r, this.id = (i = this.id) !== null && i !== void 0 ? i : this.requestAsyncId(s, this.id, r), this;
588
588
  }, t.prototype.requestAsyncId = function(e, r, i) {
589
- return i === void 0 && (i = 0), j.setInterval(e.flush.bind(e, this), i);
589
+ return i === void 0 && (i = 0), V.setInterval(e.flush.bind(e, this), i);
590
590
  }, t.prototype.recycleAsyncId = function(e, r, i) {
591
591
  if (i === void 0 && (i = 0), i != null && this.delay === i && this.pending === !1)
592
592
  return r;
593
- r != null && j.clearInterval(r);
593
+ r != null && V.clearInterval(r);
594
594
  }, t.prototype.execute = function(e, r) {
595
595
  if (this.closed)
596
596
  return new Error("executing a cancelled action");
@@ -620,7 +620,7 @@ var ke = function(n) {
620
620
  }
621
621
  return n.prototype.schedule = function(t, e, r) {
622
622
  return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
623
- }, n.now = Me.now, n;
623
+ }, n.now = _e.now, n;
624
624
  }(), Ge = function(n) {
625
625
  x(t, n);
626
626
  function t(e, r) {
@@ -646,7 +646,7 @@ var ke = function(n) {
646
646
  throw i;
647
647
  }
648
648
  }, t;
649
- }(ae), ze = new Ge(Qe), Ye = ze;
649
+ }(ae), Qe = new Ge(ze), Ye = Qe;
650
650
  function Je(n) {
651
651
  return n && b(n.schedule);
652
652
  }
@@ -658,7 +658,7 @@ var We = Z(function(n) {
658
658
  function O(n, t) {
659
659
  var e = typeof t == "object";
660
660
  return new Promise(function(r, i) {
661
- var o = new V({
661
+ var o = new F({
662
662
  next: function(s) {
663
663
  r(s), o.unsubscribe();
664
664
  },
@@ -715,7 +715,7 @@ function Ze(n, t, e) {
715
715
  }) : Ee;
716
716
  }
717
717
  var et = Object.defineProperty, tt = (n, t, e) => t in n ? et(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, C = (n, t, e) => (tt(n, typeof t != "symbol" ? t + "" : t, e), e);
718
- class h extends Error {
718
+ class l extends Error {
719
719
  constructor(t) {
720
720
  super(`Incorrect context (${t}). Cannot perform the requested operation.`), C(this, "context"), this.context = t;
721
721
  }
@@ -748,13 +748,13 @@ class he extends Error {
748
748
  e && (r += ` Minimum version supported is ${e}.`), super(r), this.version = t;
749
749
  }
750
750
  }
751
- function m(n) {
751
+ function w(n) {
752
752
  return typeof n == "function";
753
753
  }
754
754
  function it(n) {
755
- return m(n == null ? void 0 : n.lift);
755
+ return w(n == null ? void 0 : n.lift);
756
756
  }
757
- function F(n) {
757
+ function j(n) {
758
758
  return function(t) {
759
759
  if (it(t))
760
760
  return t.lift(function(e) {
@@ -871,18 +871,18 @@ var re = function() {
871
871
  }
872
872
  else
873
873
  s.remove(this);
874
- var f = this.initialTeardown;
875
- if (m(f))
874
+ var g = this.initialTeardown;
875
+ if (w(g))
876
876
  try {
877
- f();
877
+ g();
878
878
  } catch (d) {
879
879
  o = d instanceof B ? d.errors : [d];
880
880
  }
881
- var g = this._finalizers;
882
- if (g) {
881
+ var v = this._finalizers;
882
+ if (v) {
883
883
  this._finalizers = null;
884
884
  try {
885
- for (var w = de(g), y = w.next(); !y.done; y = w.next()) {
885
+ for (var S = de(v), y = S.next(); !y.done; y = S.next()) {
886
886
  var D = y.value;
887
887
  try {
888
888
  fe(D);
@@ -894,7 +894,7 @@ var re = function() {
894
894
  r = { error: d };
895
895
  } finally {
896
896
  try {
897
- y && !y.done && (i = w.return) && i.call(w);
897
+ y && !y.done && (i = S.return) && i.call(S);
898
898
  } finally {
899
899
  if (r)
900
900
  throw r.error;
@@ -936,10 +936,10 @@ var re = function() {
936
936
  }();
937
937
  re.EMPTY;
938
938
  function Ie(n) {
939
- return n instanceof re || n && "closed" in n && m(n.remove) && m(n.add) && m(n.unsubscribe);
939
+ return n instanceof re || n && "closed" in n && w(n.remove) && w(n.add) && w(n.unsubscribe);
940
940
  }
941
941
  function fe(n) {
942
- m(n) ? n() : n.unsubscribe();
942
+ w(n) ? n() : n.unsubscribe();
943
943
  }
944
944
  var Oe = {
945
945
  onUnhandledError: null,
@@ -1013,7 +1013,7 @@ var lt = function() {
1013
1013
  try {
1014
1014
  e.next(t);
1015
1015
  } catch (r) {
1016
- T(r);
1016
+ P(r);
1017
1017
  }
1018
1018
  }, n.prototype.error = function(t) {
1019
1019
  var e = this.partialObserver;
@@ -1021,24 +1021,24 @@ var lt = function() {
1021
1021
  try {
1022
1022
  e.error(t);
1023
1023
  } catch (r) {
1024
- T(r);
1024
+ P(r);
1025
1025
  }
1026
1026
  else
1027
- T(t);
1027
+ P(t);
1028
1028
  }, n.prototype.complete = function() {
1029
1029
  var t = this.partialObserver;
1030
1030
  if (t.complete)
1031
1031
  try {
1032
1032
  t.complete();
1033
1033
  } catch (e) {
1034
- T(e);
1034
+ P(e);
1035
1035
  }
1036
1036
  }, n;
1037
1037
  }(), X = function(n) {
1038
1038
  te(t, n);
1039
1039
  function t(e, r, i) {
1040
1040
  var o = n.call(this) || this, s;
1041
- if (m(e) || !e)
1041
+ if (w(e) || !e)
1042
1042
  s = {
1043
1043
  next: e ?? void 0,
1044
1044
  error: r ?? void 0,
@@ -1058,7 +1058,7 @@ var lt = function() {
1058
1058
  }
1059
1059
  return t;
1060
1060
  }(ne);
1061
- function T(n) {
1061
+ function P(n) {
1062
1062
  ut(n);
1063
1063
  }
1064
1064
  function ht(n) {
@@ -1072,11 +1072,11 @@ var dt = {
1072
1072
  }, pt = function() {
1073
1073
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
1074
1074
  }();
1075
- function Ae(n) {
1075
+ function Te(n) {
1076
1076
  return n;
1077
1077
  }
1078
1078
  function ft(n) {
1079
- return n.length === 0 ? Ae : n.length === 1 ? n[0] : function(t) {
1079
+ return n.length === 0 ? Te : n.length === 1 ? n[0] : function(t) {
1080
1080
  return n.reduce(function(e, r) {
1081
1081
  return r(e);
1082
1082
  }, t);
@@ -1147,12 +1147,12 @@ function ve(n) {
1147
1147
  return (t = n ?? Oe.Promise) !== null && t !== void 0 ? t : Promise;
1148
1148
  }
1149
1149
  function vt(n) {
1150
- return n && m(n.next) && m(n.error) && m(n.complete);
1150
+ return n && w(n.next) && w(n.error) && w(n.complete);
1151
1151
  }
1152
1152
  function bt(n) {
1153
1153
  return n && n instanceof ne || vt(n) && Ie(n);
1154
1154
  }
1155
- function H(n, t, e, r, i) {
1155
+ function N(n, t, e, r, i) {
1156
1156
  return new yt(n, t, e, r, i);
1157
1157
  }
1158
1158
  var yt = function(n) {
@@ -1162,14 +1162,14 @@ var yt = function(n) {
1162
1162
  return u.onFinalize = s, u.shouldUnsubscribe = c, u._next = r ? function(a) {
1163
1163
  try {
1164
1164
  r(a);
1165
- } catch (f) {
1166
- e.error(f);
1165
+ } catch (g) {
1166
+ e.error(g);
1167
1167
  }
1168
1168
  } : n.prototype._next, u._error = o ? function(a) {
1169
1169
  try {
1170
1170
  o(a);
1171
- } catch (f) {
1172
- e.error(f);
1171
+ } catch (g) {
1172
+ e.error(g);
1173
1173
  } finally {
1174
1174
  this.unsubscribe();
1175
1175
  }
@@ -1191,10 +1191,10 @@ var yt = function(n) {
1191
1191
  }
1192
1192
  }, t;
1193
1193
  }(ne);
1194
- function l(n, t) {
1195
- return F(function(e, r) {
1194
+ function h(n, t) {
1195
+ return j(function(e, r) {
1196
1196
  var i = 0;
1197
- e.subscribe(H(r, function(o) {
1197
+ e.subscribe(N(r, function(o) {
1198
1198
  r.next(n.call(t, o, i++));
1199
1199
  }));
1200
1200
  });
@@ -1202,31 +1202,31 @@ function l(n, t) {
1202
1202
  var mt = new gt(function(n) {
1203
1203
  return n.complete();
1204
1204
  });
1205
- function S(n) {
1205
+ function m(n) {
1206
1206
  return n <= 0 ? function() {
1207
1207
  return mt;
1208
- } : F(function(t, e) {
1208
+ } : j(function(t, e) {
1209
1209
  var r = 0;
1210
- t.subscribe(H(e, function(i) {
1210
+ t.subscribe(N(e, function(i) {
1211
1211
  ++r <= n && (e.next(i), n <= r && e.complete());
1212
1212
  }));
1213
1213
  });
1214
1214
  }
1215
- function v(n, t) {
1216
- return F(function(e, r) {
1215
+ function f(n, t) {
1216
+ return j(function(e, r) {
1217
1217
  var i = 0;
1218
- e.subscribe(H(r, function(o) {
1218
+ e.subscribe(N(r, function(o) {
1219
1219
  return n.call(t, o, i++) && r.next(o);
1220
1220
  }));
1221
1221
  });
1222
1222
  }
1223
1223
  function p(n, t, e) {
1224
- var r = m(n) || t || e ? { next: n, error: t, complete: e } : n;
1225
- return r ? F(function(i, o) {
1224
+ var r = w(n) || t || e ? { next: n, error: t, complete: e } : n;
1225
+ return r ? j(function(i, o) {
1226
1226
  var s;
1227
1227
  (s = r.subscribe) === null || s === void 0 || s.call(r);
1228
1228
  var c = !0;
1229
- i.subscribe(H(o, function(u) {
1229
+ i.subscribe(N(o, function(u) {
1230
1230
  var a;
1231
1231
  (a = r.next) === null || a === void 0 || a.call(r, u), o.next(u);
1232
1232
  }, function() {
@@ -1239,7 +1239,7 @@ function p(n, t, e) {
1239
1239
  var u, a;
1240
1240
  c && ((u = r.unsubscribe) === null || u === void 0 || u.call(r)), (a = r.finalize) === null || a === void 0 || a.call(r);
1241
1241
  }));
1242
- }) : Ae;
1242
+ }) : Te;
1243
1243
  }
1244
1244
  const wt = /^(\d+)\.(\d+)$/;
1245
1245
  function St(n) {
@@ -1276,7 +1276,7 @@ class xt {
1276
1276
  * @param logService - An instance of a logging service or utility
1277
1277
  */
1278
1278
  constructor(t, e) {
1279
- if (C(this, "negotiatedProtocolVersion"), C(this, "currentContext"), C(this, "incomingMessages$"), C(this, "inIframe", !1), C(this, "embeddedResult"), C(this, "iframePort1"), C(this, "iframePort2"), this.supportedVersions = t, this.logService = e, this.incomingMessages$ = new _e(), this.supportedVersions = t.filter((r) => Ct(r, ye)), !this.supportedVersions.length)
1279
+ if (C(this, "negotiatedProtocolVersion"), C(this, "currentContext"), C(this, "incomingMessages$"), C(this, "inIframe", !1), C(this, "embeddedResult"), C(this, "iframePort1"), C(this, "iframePort2"), this.supportedVersions = t, this.logService = e, this.incomingMessages$ = new Me(), this.supportedVersions = t.filter((r) => Ct(r, ye)), !this.supportedVersions.length)
1280
1280
  throw new he(t, ye);
1281
1281
  this.negotiatedProtocolVersion = this.supportedVersions[0], this.embeddedResult = null, this.iframePort2 = null;
1282
1282
  }
@@ -1314,8 +1314,8 @@ class xt {
1314
1314
  */
1315
1315
  determineContext() {
1316
1316
  return Xe(1e3).pipe(
1317
- l(() => (this.isEmbedded() ? this.currentContext = "user" : this.currentContext = "guest", this.currentContext)),
1318
- S(1)
1317
+ h(() => (this.isEmbedded() ? this.currentContext = "user" : this.currentContext = "guest", this.currentContext)),
1318
+ m(1)
1319
1319
  );
1320
1320
  }
1321
1321
  /**
@@ -1326,14 +1326,14 @@ class xt {
1326
1326
  */
1327
1327
  openBridge() {
1328
1328
  if (!this.isEmbedded())
1329
- throw new h(this.currentContext);
1329
+ throw new l(this.currentContext);
1330
1330
  const t = "HELLO", e = this.createMessage(t);
1331
1331
  e.protocolVersions = this.supportedVersions, this.logCreated(t, e);
1332
1332
  const r = this.incomingMessages$.pipe(
1333
- v((i) => i.type === t && i.replyTo === e.id),
1334
- l((i) => i),
1333
+ f((i) => i.type === t && i.replyTo === e.id),
1334
+ h((i) => i),
1335
1335
  p(this.logReceived(t)),
1336
- l((i) => {
1336
+ h((i) => {
1337
1337
  if (this.supportedVersions.some((o) => Et(o, i.protocolVersion)))
1338
1338
  throw new he(i.protocolVersion, this.supportedVersions[0]);
1339
1339
  return i;
@@ -1343,7 +1343,7 @@ class xt {
1343
1343
  `[IPC] Negotiated IPC Protocol Version: ${this.negotiatedProtocolVersion}`
1344
1344
  );
1345
1345
  }),
1346
- S(1)
1346
+ m(1)
1347
1347
  );
1348
1348
  return this.logService.debug(`Created ${t} Reply handler`), this.inIframe ? this.createIframeChannel().then(() => this.finishIpcSetup(e)) : this.finishIpcSetup(e), r;
1349
1349
  }
@@ -1356,14 +1356,14 @@ class xt {
1356
1356
  */
1357
1357
  requestSSOToken() {
1358
1358
  if (!this.isEmbedded())
1359
- throw new h(this.currentContext);
1359
+ throw new l(this.currentContext);
1360
1360
  const t = "TOKEN", e = this.createMessage(t);
1361
1361
  this.logCreated(t, e);
1362
1362
  const r = this.incomingMessages$.pipe(
1363
- v((i) => i.type === t && i.replyTo === e.id),
1364
- l((i) => i),
1363
+ f((i) => i.type === t && i.replyTo === e.id),
1364
+ h((i) => i),
1365
1365
  p(this.logReceived(t)),
1366
- S(1)
1366
+ m(1)
1367
1367
  );
1368
1368
  return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
1369
1369
  }
@@ -1382,7 +1382,7 @@ class xt {
1382
1382
  */
1383
1383
  sendJoiningRoomMessage(t) {
1384
1384
  if (!this.isEmbedded())
1385
- throw new h(this.currentContext);
1385
+ throw new l(this.currentContext);
1386
1386
  const {
1387
1387
  roomName: e,
1388
1388
  roomInvite: r,
@@ -1392,8 +1392,8 @@ class xt {
1392
1392
  region: c,
1393
1393
  joinMicMuted: u,
1394
1394
  joinWithoutCamera: a
1395
- } = t, f = "JOINING ROOM", g = this.createMessage(f, !1);
1396
- g.roomName = e, g.jwtToken = o, g.serverUrl = s, g.region = c, g.roomInvite = r, g.joinMicMuted = u ?? !1, g.joinWithoutCamera = a ?? !1, g.displayName = i, this.logCreated(f, g), this.port2.postMessage(g), this.logSent(f, g);
1395
+ } = t, g = "JOINING ROOM", v = this.createMessage(g, !1);
1396
+ v.roomName = e, v.jwtToken = o, v.serverUrl = s, v.region = c, v.roomInvite = r, v.joinMicMuted = u ?? !1, v.joinWithoutCamera = a ?? !1, v.displayName = i, this.logCreated(g, v), this.port2.postMessage(v), this.logSent(g, v);
1397
1397
  }
1398
1398
  /**
1399
1399
  * Sends a {@link LeavingRoomMessage} lifecycle message to the Host app.
@@ -1408,7 +1408,7 @@ class xt {
1408
1408
  */
1409
1409
  sendLeavingRoomMessage(t) {
1410
1410
  if (!this.isEmbedded())
1411
- throw new h(this.currentContext);
1411
+ throw new l(this.currentContext);
1412
1412
  const e = "LEAVING ROOM", r = this.createMessage(e, !1);
1413
1413
  r.roomName = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
1414
1414
  }
@@ -1440,13 +1440,13 @@ class xt {
1440
1440
  */
1441
1441
  onJoinRoomMessage() {
1442
1442
  if (!this.isEmbedded())
1443
- throw new h(this.currentContext);
1443
+ throw new l(this.currentContext);
1444
1444
  const t = "JOIN ROOM";
1445
1445
  return this.incomingMessages$.pipe(
1446
- v((e) => e.type === t && e.target === "client"),
1447
- l((e) => e),
1446
+ f((e) => e.type === t && e.target === "client"),
1447
+ h((e) => e),
1448
1448
  p(this.logReceived(t)),
1449
- l((e) => e)
1449
+ h((e) => e)
1450
1450
  );
1451
1451
  }
1452
1452
  /**
@@ -1476,13 +1476,13 @@ class xt {
1476
1476
  */
1477
1477
  onLeaveRoomMessage() {
1478
1478
  if (!this.isEmbedded())
1479
- throw new h(this.currentContext);
1479
+ throw new l(this.currentContext);
1480
1480
  const t = "LEAVE ROOM";
1481
1481
  return this.incomingMessages$.pipe(
1482
- v((e) => e.type === t && e.target === "client"),
1483
- l((e) => e),
1482
+ f((e) => e.type === t && e.target === "client"),
1483
+ h((e) => e),
1484
1484
  p(this.logReceived(t)),
1485
- l((e) => e)
1485
+ h((e) => e)
1486
1486
  );
1487
1487
  }
1488
1488
  /**
@@ -1513,13 +1513,13 @@ class xt {
1513
1513
  */
1514
1514
  onConfigMessage() {
1515
1515
  if (!this.isEmbedded())
1516
- throw new h(this.currentContext);
1516
+ throw new l(this.currentContext);
1517
1517
  const t = "CONFIG";
1518
1518
  return this.incomingMessages$.pipe(
1519
- v((e) => e.type === t && e.target === "client"),
1520
- l((e) => e),
1519
+ f((e) => e.type === t && e.target === "client"),
1520
+ h((e) => e),
1521
1521
  p(this.logReceived(t)),
1522
- l((e) => ({
1522
+ h((e) => ({
1523
1523
  preferredCameraType: e.preferredCameraType,
1524
1524
  preferredMicType: e.preferredMicType,
1525
1525
  preferredOutputType: e.preferredOutputType,
@@ -1535,29 +1535,29 @@ class xt {
1535
1535
  }
1536
1536
  sendScreenshareSourceMessage(t) {
1537
1537
  if (!this.isEmbedded())
1538
- throw new h(this.currentContext);
1538
+ throw new l(this.currentContext);
1539
1539
  const e = "SCREENSHARE SOURCE", r = this.createMessage(e);
1540
1540
  r.sourceTypes = t, this.logCreated(e, r);
1541
1541
  const i = this.incomingMessages$.pipe(
1542
- v((o) => o.type === e && o.replyTo === r.id),
1543
- l((o) => o),
1542
+ f((o) => o.type === e && o.replyTo === r.id),
1543
+ h((o) => o),
1544
1544
  p(this.logReceived(e)),
1545
- l((o) => o),
1546
- S(1)
1545
+ h((o) => o),
1546
+ m(1)
1547
1547
  );
1548
1548
  return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), i;
1549
1549
  }
1550
1550
  layoutChange(t, e, r) {
1551
1551
  if (!this.isEmbedded())
1552
- throw new h(this.currentContext);
1552
+ throw new l(this.currentContext);
1553
1553
  const i = "LAYOUT CHANGE";
1554
1554
  let o, s;
1555
1555
  if (e && r ? (o = this.createMessage(i, !1, r), o.result = e) : (o = this.createMessage(i), s = this.incomingMessages$.pipe(
1556
- v((c) => c.type === i && c.replyTo === o.id),
1557
- l((c) => c),
1556
+ f((c) => c.type === i && c.replyTo === o.id),
1557
+ h((c) => c),
1558
1558
  p(this.logReceived(i)),
1559
- l((c) => c),
1560
- S(1)
1559
+ h((c) => c),
1560
+ m(1)
1561
1561
  ), this.logService.debug(`Created ${i} Reply handler`)), o.layout = t, this.logCreated(i, o), this.port2.postMessage(o), this.logSent(i, o), s)
1562
1562
  return s;
1563
1563
  }
@@ -1594,38 +1594,38 @@ class xt {
1594
1594
  */
1595
1595
  onLayoutChangeMessage() {
1596
1596
  if (!this.isEmbedded())
1597
- throw new h(this.currentContext);
1597
+ throw new l(this.currentContext);
1598
1598
  const t = "LAYOUT CHANGE";
1599
1599
  return this.incomingMessages$.pipe(
1600
- v((e) => e.type === t && e.target === "client" && e.replyTo === null),
1601
- l((e) => e),
1600
+ f((e) => e.type === t && e.target === "client" && e.replyTo === null),
1601
+ h((e) => e),
1602
1602
  p(this.logReceived(t)),
1603
- l((e) => e)
1603
+ h((e) => e)
1604
1604
  );
1605
1605
  }
1606
1606
  requestOAuthToken(t) {
1607
1607
  if (!this.isEmbedded())
1608
- throw new h(this.currentContext);
1608
+ throw new l(this.currentContext);
1609
1609
  Array.isArray(t) || (t = [t]);
1610
1610
  const e = "OAUTH TOKEN", r = this.createMessage(e);
1611
1611
  r.providerTypes = t, this.logCreated(e, r);
1612
1612
  const i = this.incomingMessages$.pipe(
1613
- v((o) => o.type === e && o.replyTo === r.id),
1614
- l((o) => o),
1613
+ f((o) => o.type === e && o.replyTo === r.id),
1614
+ h((o) => o),
1615
1615
  p(this.logReceived(e)),
1616
- S(1)
1616
+ m(1)
1617
1617
  );
1618
1618
  return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), i;
1619
1619
  }
1620
1620
  openUrl(t, e) {
1621
1621
  if (!this.isEmbedded())
1622
- throw new h(this.currentContext);
1622
+ throw new l(this.currentContext);
1623
1623
  const r = "OPEN URL", i = this.createMessage(r, !1);
1624
1624
  i.url = t, i.data = e, this.logCreated(r, i), this.port2.postMessage(i), this.logSent(r, i);
1625
1625
  }
1626
1626
  selectContacts(t, e, r, i) {
1627
1627
  if (!this.isEmbedded())
1628
- throw new h(this.currentContext);
1628
+ throw new l(this.currentContext);
1629
1629
  if (e === "group" && i === void 0)
1630
1630
  throw new $(
1631
1631
  "currentContacts",
@@ -1641,16 +1641,16 @@ class xt {
1641
1641
  const o = "SELECT CONTACTS", s = this.createMessage(o, !0);
1642
1642
  s.streamType = e, s.streamId = t, s.contactType = r, s.currentContacts = i, this.logCreated(o, s);
1643
1643
  const c = this.incomingMessages$.pipe(
1644
- v((u) => u.type === o && u.replyTo === s.id),
1644
+ f((u) => u.type === o && u.replyTo === s.id),
1645
1645
  p(this.logReceived(o)),
1646
1646
  // validate if `streamId` is the same as we sent
1647
- l((u) => {
1647
+ h((u) => {
1648
1648
  const a = u;
1649
1649
  if (a.streamId !== t)
1650
1650
  throw new rt(a.streamId, t);
1651
1651
  return e === "direct" && a.contacts.length > 1 && (a.contacts = [a.contacts[0]]), a;
1652
1652
  }),
1653
- S(1)
1653
+ m(1)
1654
1654
  );
1655
1655
  return this.logService.debug(`Created ${o} Reply handler`), this.port2.postMessage(s), this.logSent(o, s), c;
1656
1656
  }
@@ -1664,16 +1664,16 @@ class xt {
1664
1664
  */
1665
1665
  matchContacts(t) {
1666
1666
  if (!this.isEmbedded())
1667
- throw new h(this.currentContext);
1667
+ throw new l(this.currentContext);
1668
1668
  if (!t.length)
1669
1669
  throw new $("contacts", t, "At least one contact is required");
1670
1670
  const e = "MATCH CONTACTS", r = this.createMessage(e);
1671
1671
  r.contacts = [...t], this.logCreated(e, r);
1672
1672
  const i = this.incomingMessages$.pipe(
1673
- v((o) => o.type === e && o.replyTo === r.id),
1673
+ f((o) => o.type === e && o.replyTo === r.id),
1674
1674
  p(this.logReceived(e)),
1675
- l((o) => o),
1676
- S(1)
1675
+ h((o) => o),
1676
+ m(1)
1677
1677
  );
1678
1678
  return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), i;
1679
1679
  }
@@ -1705,11 +1705,11 @@ class xt {
1705
1705
  */
1706
1706
  onPushMessageMessage() {
1707
1707
  if (!this.isEmbedded())
1708
- throw new h(this.currentContext);
1708
+ throw new l(this.currentContext);
1709
1709
  const t = "PUSH MESSAGE";
1710
1710
  return this.incomingMessages$.pipe(
1711
- v((e) => e.type === t && e.target === "client"),
1712
- l((e) => e),
1711
+ f((e) => e.type === t && e.target === "client"),
1712
+ h((e) => e),
1713
1713
  p(this.logReceived(t))
1714
1714
  );
1715
1715
  }
@@ -1724,14 +1724,14 @@ class xt {
1724
1724
  */
1725
1725
  requestPushToken() {
1726
1726
  if (!this.isEmbedded())
1727
- throw new h(this.currentContext);
1727
+ throw new l(this.currentContext);
1728
1728
  const t = "PUSH TOKEN", e = this.createMessage(t);
1729
1729
  this.logCreated(t, e);
1730
1730
  const r = this.incomingMessages$.pipe(
1731
- v((i) => i.type === t && i.replyTo === e.id),
1731
+ f((i) => i.type === t && i.replyTo === e.id),
1732
1732
  p(this.logReceived(t)),
1733
- l((i) => i),
1734
- S(1)
1733
+ h((i) => i),
1734
+ m(1)
1735
1735
  );
1736
1736
  return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
1737
1737
  }
@@ -1744,11 +1744,11 @@ class xt {
1744
1744
  */
1745
1745
  onBadgeQueryMessage() {
1746
1746
  if (!this.isEmbedded())
1747
- throw new h(this.currentContext);
1747
+ throw new l(this.currentContext);
1748
1748
  const t = "BADGE QUERY";
1749
1749
  return this.incomingMessages$.pipe(
1750
- v((e) => e.type === t && e.target === "client"),
1751
- l((e) => e),
1750
+ f((e) => e.type === t && e.target === "client"),
1751
+ h((e) => e),
1752
1752
  p(this.logReceived(t))
1753
1753
  );
1754
1754
  }
@@ -1765,7 +1765,7 @@ class xt {
1765
1765
  */
1766
1766
  sendBadgeUpdateMessage(t, e) {
1767
1767
  if (!this.isEmbedded())
1768
- throw new h(this.currentContext);
1768
+ throw new l(this.currentContext);
1769
1769
  const r = "BADGE UPDATE", i = this.createMessage(r, !1, e);
1770
1770
  i.count = t, this.logCreated(r, i), this.port2.postMessage(i), this.logSent(r, i);
1771
1771
  }
@@ -1782,11 +1782,11 @@ class xt {
1782
1782
  */
1783
1783
  onHostInForegroundMessage() {
1784
1784
  if (!this.isEmbedded())
1785
- throw new h(this.currentContext);
1785
+ throw new l(this.currentContext);
1786
1786
  const t = "HOST IN FOREGROUND";
1787
1787
  return this.incomingMessages$.pipe(
1788
- v((e) => e.type === t && e.target === "client"),
1789
- l((e) => e),
1788
+ f((e) => e.type === t && e.target === "client"),
1789
+ h((e) => e),
1790
1790
  p(this.logReceived(t))
1791
1791
  );
1792
1792
  }
@@ -1805,7 +1805,7 @@ class xt {
1805
1805
  */
1806
1806
  sendLifecycleMessage(t, e) {
1807
1807
  if (!this.isEmbedded())
1808
- throw new h(this.currentContext);
1808
+ throw new l(this.currentContext);
1809
1809
  const r = "LIFECYCLE", i = this.createMessage(r, !1);
1810
1810
  i.eventName = t, i.payload = e, this.logCreated(r, i), this.port2.postMessage(i), this.logSent(r, i);
1811
1811
  }
@@ -1822,11 +1822,11 @@ class xt {
1822
1822
  */
1823
1823
  onLifecycleMessage() {
1824
1824
  if (!this.isEmbedded())
1825
- throw new h(this.currentContext);
1825
+ throw new l(this.currentContext);
1826
1826
  const t = "LIFECYCLE";
1827
1827
  return this.incomingMessages$.pipe(
1828
- v((e) => e.type === t && e.target === "client"),
1829
- l((e) => e),
1828
+ f((e) => e.type === t && e.target === "client"),
1829
+ h((e) => e),
1830
1830
  p(this.logReceived(t))
1831
1831
  );
1832
1832
  }
@@ -1844,7 +1844,7 @@ class xt {
1844
1844
  */
1845
1845
  sendLogMessage(t, e) {
1846
1846
  if (!this.isEmbedded())
1847
- throw new h(this.currentContext);
1847
+ throw new l(this.currentContext);
1848
1848
  const r = "LOG", i = this.createMessage(r, !1);
1849
1849
  i.level = t, i.message = e, this.logCreated(r, i), this.port2.postMessage(i), this.logSent(r, i);
1850
1850
  }
@@ -1862,11 +1862,11 @@ class xt {
1862
1862
  */
1863
1863
  onRequestLogsMessage() {
1864
1864
  if (!this.isEmbedded())
1865
- throw new h(this.currentContext);
1865
+ throw new l(this.currentContext);
1866
1866
  const t = "REQUEST LOGS";
1867
1867
  return this.incomingMessages$.pipe(
1868
- v((e) => e.type === t && e.target === "client"),
1869
- l((e) => e),
1868
+ f((e) => e.type === t && e.target === "client"),
1869
+ h((e) => e),
1870
1870
  p(this.logReceived(t))
1871
1871
  );
1872
1872
  }
@@ -1885,10 +1885,125 @@ class xt {
1885
1885
  */
1886
1886
  sendViewTransitionMessage(t, e) {
1887
1887
  if (!this.isEmbedded())
1888
- throw new h(this.currentContext);
1888
+ throw new l(this.currentContext);
1889
1889
  const r = "VIEW TRANSITION", i = this.createMessage(r, !1);
1890
1890
  i.transitionType = t, i.targetView = e, this.logCreated(r, i), this.port2.postMessage(i), this.logSent(r, i);
1891
1891
  }
1892
+ /**
1893
+ * Send a {@link FileTransferMessage} to the `Host` app, to transfer a file.
1894
+ *
1895
+ * @remarks
1896
+ * The file data can be either `base64` encoded string or a raw byte array `buffer` encoded as an
1897
+ * ArrayBuffer. An SHA256 hash of the file is also sent to the `Host` app to verify the file
1898
+ * integrity.
1899
+ *
1900
+ * @param payload - The {@link FileTransferPayload} to send to the host app.
1901
+ *
1902
+ * @returns This method returns void.
1903
+ */
1904
+ fileTransfer(t) {
1905
+ if (!this.isEmbedded())
1906
+ throw new l(this.currentContext);
1907
+ const e = "FILE TRANSFER", r = this.createMessage(e, !1);
1908
+ r.mimeType = t.mimeType, r.fileName = t.fileName, r.fileSize = t.fileSize, r.fileHash = t.fileHash, r.dataType = t.dataType, r.fileId = t.fileId, r.data = t.data, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
1909
+ }
1910
+ /**
1911
+ * Setup listener for {@link FileTransferMessage}, which can be sent by a `Host` app to transfer
1912
+ * a file to the `Client` app.
1913
+ *
1914
+ * @remarks
1915
+ * The `Host` app can send the file as a `base64` encoded string or a raw byte array `buffer` in
1916
+ * an ArrayBuffer. An SHA256 hash of the file is also sent to the `Client` app to verify the file
1917
+ * integrity.
1918
+ *
1919
+ * @returns An observable that emits whenever {@link FileTransferMessage} is received so it can
1920
+ * be subscribed to indefinitely.
1921
+ */
1922
+ onFileTransferMessage() {
1923
+ if (!this.isEmbedded())
1924
+ throw new l(this.currentContext);
1925
+ const t = "FILE TRANSFER";
1926
+ return this.incomingMessages$.pipe(
1927
+ f((e) => e.type === t && e.target === "client"),
1928
+ h((e) => e),
1929
+ p(this.logReceived(t))
1930
+ );
1931
+ }
1932
+ /**
1933
+ * Sends a {@link FileSelectionMessage} to the Host app, to request the user to select on or
1934
+ * more files.
1935
+ *
1936
+ * @remarks
1937
+ * The `Host` app should reply with a {@link FileSelectionMessageReply} containing the number of
1938
+ * files the user selected along with the file identifiers.
1939
+ *
1940
+ * The file identifiers can be used to corelate files being transferred via the
1941
+ * {@link FileTransferMessage} afterwards.
1942
+ *
1943
+ * @param maxCount - _Optional_. The maximum number of files the user can select. Defaults to
1944
+ * unlimited.
1945
+ * @param mimeTypes - _Optional_. The MIME type of the files to select. Defaults to `*\/*`.
1946
+ *
1947
+ * @returns This method returns void.
1948
+ */
1949
+ sendFileSelectionMessage(t, e) {
1950
+ if (!this.isEmbedded())
1951
+ throw new l(this.currentContext);
1952
+ const r = "FILE SELECTION", i = this.createMessage(r);
1953
+ i.maxCount = t, i.mimeTypes = e, this.logCreated(r, i);
1954
+ const o = this.incomingMessages$.pipe(
1955
+ f((s) => s.type === r && s.replyTo === i.id),
1956
+ p(this.logReceived(r)),
1957
+ h((s) => s),
1958
+ m(1)
1959
+ );
1960
+ return this.port2.postMessage(i), this.logSent(r, i), o;
1961
+ }
1962
+ /**
1963
+ * Sends a {@link FileDownloadMessage} to the Host app, to request the download of a file.
1964
+ *
1965
+ * @remarks
1966
+ * The file at the specified `url` is encrypted using the provided `key` and the Host app needs
1967
+ * to decrypt it.
1968
+ *
1969
+ * The reply does not include the file itself. The file will be transferred via the
1970
+ * {@link FileTransferMessage} afterwards if required.
1971
+ *
1972
+ * @param url - The URL to download the file from
1973
+ * @param key - The decryption key for the file stream
1974
+ * @param fileName - The name of the file to download
1975
+ * @param mimeType - The MIME type of the file to download
1976
+ * @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
1977
+ * file ID and the file size in bytes. Emits once.
1978
+ */
1979
+ sendFileDownloadMessage(t, e, r, i) {
1980
+ if (!this.isEmbedded())
1981
+ throw new l(this.currentContext);
1982
+ const o = "FILE DOWNLOAD", s = this.createMessage(o);
1983
+ s.url = t, s.key = e, s.fileName = r, s.mimeType = i, this.logCreated(o, s);
1984
+ const c = this.incomingMessages$.pipe(
1985
+ f((u) => u.type === o && u.replyTo === s.id),
1986
+ p(this.logReceived(o)),
1987
+ h((u) => u),
1988
+ m(1)
1989
+ );
1990
+ return this.port2.postMessage(s), this.logSent(o, s), c;
1991
+ }
1992
+ sendFileUploadMessage() {
1993
+ throw new Error("Not implemented");
1994
+ }
1995
+ /**
1996
+ * Sends a {@link FileOpenMessage} to the Host app, to request opening a previously downloaded
1997
+ * or selected file.
1998
+ *
1999
+ * @param fileId - The ID of the file to open.
2000
+ */
2001
+ sendFileOpenMessage(t) {
2002
+ if (!this.isEmbedded())
2003
+ throw new l(this.currentContext);
2004
+ const e = "FILE OPEN", r = this.createMessage(e, !1);
2005
+ r.fileId = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
2006
+ }
1892
2007
  /**
1893
2008
  * Checks if the client app is either embedded in an iframe or in a native webview.
1894
2009
  *
@@ -1971,7 +2086,7 @@ class xt {
1971
2086
  return i.join("");
1972
2087
  }
1973
2088
  }
1974
- const _t = ["2.0"];
2089
+ const Mt = ["2.0"];
1975
2090
  class It {
1976
2091
  /**
1977
2092
  * A class that manages the IPC communication between the `Client` and the `Host`.
@@ -1987,15 +2102,15 @@ class It {
1987
2102
  /**
1988
2103
  * The type of the `Host` app the `Client` is embedded in.
1989
2104
  */
1990
- _(this, "host");
2105
+ M(this, "host");
1991
2106
  /**
1992
2107
  * The cloud ID of the `Host` app the `Client` is embedded in.
1993
2108
  */
1994
- _(this, "cloudId");
1995
- _(this, "logger");
1996
- _(this, "helper");
1997
- _(this, "listeners");
1998
- this.logger = t ?? console, this.helper = new xt(_t, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(E.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(E.HostInForeground, /* @__PURE__ */ new Set());
2109
+ M(this, "cloudId");
2110
+ M(this, "logger");
2111
+ M(this, "helper");
2112
+ M(this, "listeners");
2113
+ this.logger = t ?? console, this.helper = new xt(Mt, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(E.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(E.HostInForeground, /* @__PURE__ */ new Set());
1999
2114
  }
2000
2115
  /**
2001
2116
  * Returns whether the app is running inside a native WebView (`host` context) or as a