@acrobits/ipc-sdk 0.10.1 → 0.11.2-alpha.2

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.
Files changed (37) hide show
  1. package/docs/assets/hierarchy.js +1 -0
  2. package/docs/assets/icons.js +17 -14
  3. package/docs/assets/icons.svg +1 -1
  4. package/docs/assets/main.js +5 -4
  5. package/docs/assets/navigation.js +1 -1
  6. package/docs/assets/search.js +1 -1
  7. package/docs/assets/style.css +1446 -1225
  8. package/docs/classes/IPCManager.html +91 -71
  9. package/docs/enums/IPCEvents.html +10 -8
  10. package/docs/hierarchy.html +1 -1
  11. package/docs/index.html +10 -8
  12. package/docs/interfaces/DetailedContactURI.html +6 -6
  13. package/docs/interfaces/ILogger.html +7 -7
  14. package/docs/modules.html +1 -17
  15. package/docs/types/BaseContactItem.html +14 -0
  16. package/docs/types/CloudUsernameContactItem.html +6 -0
  17. package/docs/types/ContactItem.html +2 -2
  18. package/docs/types/ContactLabel.html +2 -2
  19. package/docs/types/ContactType.html +2 -2
  20. package/docs/types/ContactURI.html +5 -4
  21. package/docs/types/DetailedContactItem.html +23 -0
  22. package/docs/types/HostType.html +2 -2
  23. package/docs/types/IPCContext.html +3 -3
  24. package/docs/types/IpcProtocolVersion.html +2 -2
  25. package/docs/types/UnsubscribeCallback.html +2 -2
  26. package/docs/types/UriContactItem.html +3 -0
  27. package/lib/index.d.ts +238 -34
  28. package/lib/ipc-sdk.js +1230 -824
  29. package/lib/ipc-sdk.js.map +1 -1
  30. package/lib/ipc-sdk.umd.cjs +4 -4
  31. package/lib/ipc-sdk.umd.cjs.map +1 -1
  32. package/lib/tsdoc-metadata.json +1 -1
  33. package/package.json +9 -9
  34. package/docs/interfaces/BaseContactItem.html +0 -8
  35. package/docs/interfaces/CloudUsernameContactItem.html +0 -10
  36. package/docs/interfaces/DetailedContactItem.html +0 -17
  37. package/docs/interfaces/UriContactItem.html +0 -10
package/lib/ipc-sdk.js CHANGED
@@ -1,172 +1,181 @@
1
- var Pe = Object.defineProperty;
2
- var _e = (n, t, e) => t in n ? Pe(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var M = (n, t, e) => _e(n, typeof t != "symbol" ? t + "" : t, e);
4
- var w = /* @__PURE__ */ ((n) => (n.BadgeQuery = "BADGE QUERY", n.Lifecycle = "LIFECYCLE", n.PushToken = "PUSH TOKEN", n))(w || {}), q = function(n, t) {
5
- return q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
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 M = (s, t, e) => (Pe(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) {
5
+ return B = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
6
6
  e.__proto__ = r;
7
7
  } || function(e, r) {
8
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
9
- }, q(n, t);
8
+ for (var n in r)
9
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
10
+ }, B(s, t);
10
11
  };
11
- function x(n, t) {
12
+ function U(s, t) {
12
13
  if (typeof t != "function" && t !== null)
13
14
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
14
- q(n, t);
15
+ B(s, t);
15
16
  function e() {
16
- this.constructor = n;
17
+ this.constructor = s;
17
18
  }
18
- n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
19
+ s.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
19
20
  }
20
- function G(n) {
21
- var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
22
- if (e) return e.call(n);
23
- if (n && typeof n.length == "number") return {
24
- next: function() {
25
- return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
26
- }
27
- };
21
+ function Q(s) {
22
+ var t = typeof Symbol == "function" && Symbol.iterator, e = t && s[t], r = 0;
23
+ if (e)
24
+ return e.call(s);
25
+ if (s && typeof s.length == "number")
26
+ return {
27
+ next: function() {
28
+ return s && r >= s.length && (s = void 0), { value: s && s[r++], done: !s };
29
+ }
30
+ };
28
31
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
29
32
  }
30
- function $(n, t) {
31
- var e = typeof Symbol == "function" && n[Symbol.iterator];
32
- if (!e) return n;
33
- var r = e.call(n), s, i = [], o;
33
+ function $(s, t) {
34
+ var e = typeof Symbol == "function" && s[Symbol.iterator];
35
+ if (!e)
36
+ return s;
37
+ var r = e.call(s), n, i = [], o;
34
38
  try {
35
- for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) i.push(s.value);
36
- } catch (a) {
37
- o = { error: a };
39
+ for (; (t === void 0 || t-- > 0) && !(n = r.next()).done; )
40
+ i.push(n.value);
41
+ } catch (c) {
42
+ o = { error: c };
38
43
  } finally {
39
44
  try {
40
- s && !s.done && (e = r.return) && e.call(r);
45
+ n && !n.done && (e = r.return) && e.call(r);
41
46
  } finally {
42
- if (o) throw o.error;
47
+ if (o)
48
+ throw o.error;
43
49
  }
44
50
  }
45
51
  return i;
46
52
  }
47
- function D(n, t, e) {
48
- if (e || arguments.length === 2) for (var r = 0, s = t.length, i; r < s; r++)
49
- (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
50
- return n.concat(i || Array.prototype.slice.call(t));
53
+ function k(s, t, e) {
54
+ if (e || arguments.length === 2)
55
+ for (var r = 0, n = t.length, i; r < n; r++)
56
+ (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
57
+ return s.concat(i || Array.prototype.slice.call(t));
51
58
  }
52
- function S(n) {
53
- return typeof n == "function";
59
+ function C(s) {
60
+ return typeof s == "function";
54
61
  }
55
- function X(n) {
62
+ function X(s) {
56
63
  var t = function(r) {
57
64
  Error.call(r), r.stack = new Error().stack;
58
- }, e = n(t);
65
+ }, e = s(t);
59
66
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
60
67
  }
61
- var k = X(function(n) {
68
+ var V = X(function(s) {
62
69
  return function(e) {
63
- n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
64
- ` + e.map(function(r, s) {
65
- return s + 1 + ") " + r.toString();
70
+ s(this), this.message = e ? e.length + ` errors occurred during unsubscription:
71
+ ` + e.map(function(r, n) {
72
+ return n + 1 + ") " + r.toString();
66
73
  }).join(`
67
74
  `) : "", this.name = "UnsubscriptionError", this.errors = e;
68
75
  };
69
76
  });
70
- function F(n, t) {
71
- if (n) {
72
- var e = n.indexOf(t);
73
- 0 <= e && n.splice(e, 1);
77
+ function D(s, t) {
78
+ if (s) {
79
+ var e = s.indexOf(t);
80
+ 0 <= e && s.splice(e, 1);
74
81
  }
75
82
  }
76
- var R = function() {
77
- function n(t) {
83
+ var x = function() {
84
+ function s(t) {
78
85
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
79
86
  }
80
- return n.prototype.unsubscribe = function() {
81
- var t, e, r, s, i;
87
+ return s.prototype.unsubscribe = function() {
88
+ var t, e, r, n, i;
82
89
  if (!this.closed) {
83
90
  this.closed = !0;
84
91
  var o = this._parentage;
85
92
  if (o)
86
93
  if (this._parentage = null, Array.isArray(o))
87
94
  try {
88
- for (var a = G(o), c = a.next(); !c.done; c = a.next()) {
89
- var u = c.value;
95
+ for (var c = Q(o), a = c.next(); !a.done; a = c.next()) {
96
+ var u = a.value;
90
97
  u.remove(this);
91
98
  }
92
- } catch (y) {
93
- t = { error: y };
99
+ } catch (v) {
100
+ t = { error: v };
94
101
  } finally {
95
102
  try {
96
- c && !c.done && (e = a.return) && e.call(a);
103
+ a && !a.done && (e = c.return) && e.call(c);
97
104
  } finally {
98
- if (t) throw t.error;
105
+ if (t)
106
+ throw t.error;
99
107
  }
100
108
  }
101
109
  else
102
110
  o.remove(this);
103
- var l = this.initialTeardown;
104
- if (S(l))
111
+ var h = this.initialTeardown;
112
+ if (C(h))
105
113
  try {
106
- l();
107
- } catch (y) {
108
- i = y instanceof k ? y.errors : [y];
114
+ h();
115
+ } catch (v) {
116
+ i = v instanceof V ? v.errors : [v];
109
117
  }
110
- var h = this._finalizers;
111
- if (h) {
118
+ var l = this._finalizers;
119
+ if (l) {
112
120
  this._finalizers = null;
113
121
  try {
114
- for (var b = G(h), v = b.next(); !v.done; v = b.next()) {
115
- var N = v.value;
122
+ for (var b = Q(l), p = b.next(); !p.done; p = b.next()) {
123
+ var F = p.value;
116
124
  try {
117
- se(N);
118
- } catch (y) {
119
- i = i ?? [], y instanceof k ? i = D(D([], $(i)), $(y.errors)) : i.push(y);
125
+ se(F);
126
+ } catch (v) {
127
+ i = i ?? [], v instanceof V ? i = k(k([], $(i)), $(v.errors)) : i.push(v);
120
128
  }
121
129
  }
122
- } catch (y) {
123
- r = { error: y };
130
+ } catch (v) {
131
+ r = { error: v };
124
132
  } finally {
125
133
  try {
126
- v && !v.done && (s = b.return) && s.call(b);
134
+ p && !p.done && (n = b.return) && n.call(b);
127
135
  } finally {
128
- if (r) throw r.error;
136
+ if (r)
137
+ throw r.error;
129
138
  }
130
139
  }
131
140
  }
132
141
  if (i)
133
- throw new k(i);
142
+ throw new V(i);
134
143
  }
135
- }, n.prototype.add = function(t) {
144
+ }, s.prototype.add = function(t) {
136
145
  var e;
137
146
  if (t && t !== this)
138
147
  if (this.closed)
139
148
  se(t);
140
149
  else {
141
- if (t instanceof n) {
150
+ if (t instanceof s) {
142
151
  if (t.closed || t._hasParent(this))
143
152
  return;
144
153
  t._addParent(this);
145
154
  }
146
155
  (this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(t);
147
156
  }
148
- }, n.prototype._hasParent = function(t) {
157
+ }, s.prototype._hasParent = function(t) {
149
158
  var e = this._parentage;
150
159
  return e === t || Array.isArray(e) && e.includes(t);
151
- }, n.prototype._addParent = function(t) {
160
+ }, s.prototype._addParent = function(t) {
152
161
  var e = this._parentage;
153
162
  this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
154
- }, n.prototype._removeParent = function(t) {
163
+ }, s.prototype._removeParent = function(t) {
155
164
  var e = this._parentage;
156
- e === t ? this._parentage = null : Array.isArray(e) && F(e, t);
157
- }, n.prototype.remove = function(t) {
165
+ e === t ? this._parentage = null : Array.isArray(e) && D(e, t);
166
+ }, s.prototype.remove = function(t) {
158
167
  var e = this._finalizers;
159
- e && F(e, t), t instanceof n && t._removeParent(this);
160
- }, n.EMPTY = function() {
161
- var t = new n();
168
+ e && D(e, t), t instanceof s && t._removeParent(this);
169
+ }, s.EMPTY = function() {
170
+ var t = new s();
162
171
  return t.closed = !0, t;
163
- }(), n;
164
- }(), be = R.EMPTY;
165
- function me(n) {
166
- return n instanceof R || n && "closed" in n && S(n.remove) && S(n.add) && S(n.unsubscribe);
172
+ }(), s;
173
+ }(), ve = x.EMPTY;
174
+ function be(s) {
175
+ return s instanceof x || s && "closed" in s && C(s.remove) && C(s.add) && C(s.unsubscribe);
167
176
  }
168
- function se(n) {
169
- S(n) ? n() : n.unsubscribe();
177
+ function se(s) {
178
+ C(s) ? s() : s.unsubscribe();
170
179
  }
171
180
  var we = {
172
181
  onUnhandledError: null,
@@ -175,35 +184,35 @@ var we = {
175
184
  useDeprecatedSynchronousErrorHandling: !1,
176
185
  useDeprecatedNextContext: !1
177
186
  }, Se = {
178
- setTimeout: function(n, t) {
187
+ setTimeout: function(s, t) {
179
188
  for (var e = [], r = 2; r < arguments.length; r++)
180
189
  e[r - 2] = arguments[r];
181
- return setTimeout.apply(void 0, D([n, t], $(e)));
190
+ return setTimeout.apply(void 0, k([s, t], $(e)));
182
191
  },
183
- clearTimeout: function(n) {
192
+ clearTimeout: function(s) {
184
193
  var t = Se.delegate;
185
- return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(n);
194
+ return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(s);
186
195
  },
187
196
  delegate: void 0
188
197
  };
189
- function Ae(n) {
198
+ function _e(s) {
190
199
  Se.setTimeout(function() {
191
- throw n;
200
+ throw s;
192
201
  });
193
202
  }
194
- function ie() {
203
+ function ne() {
195
204
  }
196
- function U(n) {
197
- n();
205
+ function O(s) {
206
+ s();
198
207
  }
199
- var Z = function(n) {
200
- x(t, n);
208
+ var Z = function(s) {
209
+ U(t, s);
201
210
  function t(e) {
202
- var r = n.call(this) || this;
203
- return r.isStopped = !1, e ? (r.destination = e, me(e) && e.add(r)) : r.destination = $e, r;
211
+ var r = s.call(this) || this;
212
+ return r.isStopped = !1, e ? (r.destination = e, be(e) && e.add(r)) : r.destination = ke, r;
204
213
  }
205
- return t.create = function(e, r, s) {
206
- return new H(e, r, s);
214
+ return t.create = function(e, r, n) {
215
+ return new N(e, r, n);
207
216
  }, t.prototype.next = function(e) {
208
217
  this.isStopped || this._next(e);
209
218
  }, t.prototype.error = function(e) {
@@ -211,7 +220,7 @@ var Z = function(n) {
211
220
  }, t.prototype.complete = function() {
212
221
  this.isStopped || (this.isStopped = !0, this._complete());
213
222
  }, t.prototype.unsubscribe = function() {
214
- this.closed || (this.isStopped = !0, n.prototype.unsubscribe.call(this), this.destination = null);
223
+ this.closed || (this.isStopped = !0, s.prototype.unsubscribe.call(this), this.destination = null);
215
224
  }, t.prototype._next = function(e) {
216
225
  this.destination.next(e);
217
226
  }, t.prototype._error = function(e) {
@@ -227,168 +236,168 @@ var Z = function(n) {
227
236
  this.unsubscribe();
228
237
  }
229
238
  }, t;
230
- }(R), Oe = Function.prototype.bind;
231
- function V(n, t) {
232
- return Oe.call(n, t);
239
+ }(x), Le = Function.prototype.bind;
240
+ function H(s, t) {
241
+ return Le.call(s, t);
233
242
  }
234
- var Le = function() {
235
- function n(t) {
243
+ var Oe = function() {
244
+ function s(t) {
236
245
  this.partialObserver = t;
237
246
  }
238
- return n.prototype.next = function(t) {
247
+ return s.prototype.next = function(t) {
239
248
  var e = this.partialObserver;
240
249
  if (e.next)
241
250
  try {
242
251
  e.next(t);
243
252
  } catch (r) {
244
- A(r);
253
+ P(r);
245
254
  }
246
- }, n.prototype.error = function(t) {
255
+ }, s.prototype.error = function(t) {
247
256
  var e = this.partialObserver;
248
257
  if (e.error)
249
258
  try {
250
259
  e.error(t);
251
260
  } catch (r) {
252
- A(r);
261
+ P(r);
253
262
  }
254
263
  else
255
- A(t);
256
- }, n.prototype.complete = function() {
264
+ P(t);
265
+ }, s.prototype.complete = function() {
257
266
  var t = this.partialObserver;
258
267
  if (t.complete)
259
268
  try {
260
269
  t.complete();
261
270
  } catch (e) {
262
- A(e);
271
+ P(e);
263
272
  }
264
- }, n;
265
- }(), H = function(n) {
266
- x(t, n);
267
- function t(e, r, s) {
268
- var i = n.call(this) || this, o;
269
- if (S(e) || !e)
273
+ }, s;
274
+ }(), N = function(s) {
275
+ U(t, s);
276
+ function t(e, r, n) {
277
+ var i = s.call(this) || this, o;
278
+ if (C(e) || !e)
270
279
  o = {
271
280
  next: e ?? void 0,
272
281
  error: r ?? void 0,
273
- complete: s ?? void 0
282
+ complete: n ?? void 0
274
283
  };
275
284
  else {
276
- var a;
277
- i && we.useDeprecatedNextContext ? (a = Object.create(e), a.unsubscribe = function() {
285
+ var c;
286
+ i && we.useDeprecatedNextContext ? (c = Object.create(e), c.unsubscribe = function() {
278
287
  return i.unsubscribe();
279
288
  }, o = {
280
- next: e.next && V(e.next, a),
281
- error: e.error && V(e.error, a),
282
- complete: e.complete && V(e.complete, a)
289
+ next: e.next && H(e.next, c),
290
+ error: e.error && H(e.error, c),
291
+ complete: e.complete && H(e.complete, c)
283
292
  }) : o = e;
284
293
  }
285
- return i.destination = new Le(o), i;
294
+ return i.destination = new Oe(o), i;
286
295
  }
287
296
  return t;
288
297
  }(Z);
289
- function A(n) {
290
- Ae(n);
298
+ function P(s) {
299
+ _e(s);
291
300
  }
292
- function Ue(n) {
293
- throw n;
301
+ function $e(s) {
302
+ throw s;
294
303
  }
295
- var $e = {
304
+ var ke = {
296
305
  closed: !0,
297
- next: ie,
298
- error: Ue,
299
- complete: ie
306
+ next: ne,
307
+ error: $e,
308
+ complete: ne
300
309
  }, De = function() {
301
310
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
302
311
  }();
303
- function Ee(n) {
304
- return n;
312
+ function Ce(s) {
313
+ return s;
305
314
  }
306
- function Fe(n) {
307
- return n.length === 0 ? Ee : n.length === 1 ? n[0] : function(e) {
308
- return n.reduce(function(r, s) {
309
- return s(r);
315
+ function Ne(s) {
316
+ return s.length === 0 ? Ce : s.length === 1 ? s[0] : function(e) {
317
+ return s.reduce(function(r, n) {
318
+ return n(r);
310
319
  }, e);
311
320
  };
312
321
  }
313
- var B = function() {
314
- function n(t) {
322
+ var G = function() {
323
+ function s(t) {
315
324
  t && (this._subscribe = t);
316
325
  }
317
- return n.prototype.lift = function(t) {
318
- var e = new n();
326
+ return s.prototype.lift = function(t) {
327
+ var e = new s();
319
328
  return e.source = this, e.operator = t, e;
320
- }, n.prototype.subscribe = function(t, e, r) {
321
- var s = this, i = Ne(t) ? t : new H(t, e, r);
322
- return U(function() {
323
- var o = s, a = o.operator, c = o.source;
324
- i.add(a ? a.call(i, c) : c ? s._subscribe(i) : s._trySubscribe(i));
329
+ }, s.prototype.subscribe = function(t, e, r) {
330
+ var n = this, i = Ve(t) ? t : new N(t, e, r);
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));
325
334
  }), i;
326
- }, n.prototype._trySubscribe = function(t) {
335
+ }, s.prototype._trySubscribe = function(t) {
327
336
  try {
328
337
  return this._subscribe(t);
329
338
  } catch (e) {
330
339
  t.error(e);
331
340
  }
332
- }, n.prototype.forEach = function(t, e) {
341
+ }, s.prototype.forEach = function(t, e) {
333
342
  var r = this;
334
- return e = oe(e), new e(function(s, i) {
335
- var o = new H({
336
- next: function(a) {
343
+ return e = ie(e), new e(function(n, i) {
344
+ var o = new N({
345
+ next: function(c) {
337
346
  try {
338
- t(a);
339
- } catch (c) {
340
- i(c), o.unsubscribe();
347
+ t(c);
348
+ } catch (a) {
349
+ i(a), o.unsubscribe();
341
350
  }
342
351
  },
343
352
  error: i,
344
- complete: s
353
+ complete: n
345
354
  });
346
355
  r.subscribe(o);
347
356
  });
348
- }, n.prototype._subscribe = function(t) {
357
+ }, s.prototype._subscribe = function(t) {
349
358
  var e;
350
359
  return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
351
- }, n.prototype[De] = function() {
360
+ }, s.prototype[De] = function() {
352
361
  return this;
353
- }, n.prototype.pipe = function() {
362
+ }, s.prototype.pipe = function() {
354
363
  for (var t = [], e = 0; e < arguments.length; e++)
355
364
  t[e] = arguments[e];
356
- return Fe(t)(this);
357
- }, n.prototype.toPromise = function(t) {
365
+ return Ne(t)(this);
366
+ }, s.prototype.toPromise = function(t) {
358
367
  var e = this;
359
- return t = oe(t), new t(function(r, s) {
368
+ return t = ie(t), new t(function(r, n) {
360
369
  var i;
361
370
  e.subscribe(function(o) {
362
371
  return i = o;
363
372
  }, function(o) {
364
- return s(o);
373
+ return n(o);
365
374
  }, function() {
366
375
  return r(i);
367
376
  });
368
377
  });
369
- }, n.create = function(t) {
370
- return new n(t);
371
- }, n;
378
+ }, s.create = function(t) {
379
+ return new s(t);
380
+ }, s;
372
381
  }();
373
- function oe(n) {
382
+ function ie(s) {
374
383
  var t;
375
- return (t = n ?? we.Promise) !== null && t !== void 0 ? t : Promise;
384
+ return (t = s ?? we.Promise) !== null && t !== void 0 ? t : Promise;
376
385
  }
377
- function He(n) {
378
- return n && S(n.next) && S(n.error) && S(n.complete);
386
+ function Fe(s) {
387
+ return s && C(s.next) && C(s.error) && C(s.complete);
379
388
  }
380
- function Ne(n) {
381
- return n && n instanceof Z || He(n) && me(n);
389
+ function Ve(s) {
390
+ return s && s instanceof Z || Fe(s) && be(s);
382
391
  }
383
- function ke(n) {
384
- return S(n == null ? void 0 : n.lift);
392
+ function He(s) {
393
+ return C(s == null ? void 0 : s.lift);
385
394
  }
386
- function Me(n) {
395
+ function Ee(s) {
387
396
  return function(t) {
388
- if (ke(t))
397
+ if (He(t))
389
398
  return t.lift(function(e) {
390
399
  try {
391
- return n(e, this);
400
+ return s(e, this);
392
401
  } catch (r) {
393
402
  this.error(r);
394
403
  }
@@ -396,94 +405,95 @@ function Me(n) {
396
405
  throw new TypeError("Unable to lift unknown Observable type");
397
406
  };
398
407
  }
399
- function Ce(n, t, e, r, s) {
400
- return new Ve(n, t, e, r, s);
408
+ function Me(s, t, e, r, n) {
409
+ return new je(s, t, e, r, n);
401
410
  }
402
- var Ve = function(n) {
403
- x(t, n);
404
- function t(e, r, s, i, o, a) {
405
- var c = n.call(this, e) || this;
406
- return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) {
411
+ var je = function(s) {
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) {
407
416
  try {
408
417
  r(u);
409
- } catch (l) {
410
- e.error(l);
418
+ } catch (h) {
419
+ e.error(h);
411
420
  }
412
- } : n.prototype._next, c._error = i ? function(u) {
421
+ } : s.prototype._next, a._error = i ? function(u) {
413
422
  try {
414
423
  i(u);
415
- } catch (l) {
416
- e.error(l);
424
+ } catch (h) {
425
+ e.error(h);
417
426
  } finally {
418
427
  this.unsubscribe();
419
428
  }
420
- } : n.prototype._error, c._complete = s ? function() {
429
+ } : s.prototype._error, a._complete = n ? function() {
421
430
  try {
422
- s();
431
+ n();
423
432
  } catch (u) {
424
433
  e.error(u);
425
434
  } finally {
426
435
  this.unsubscribe();
427
436
  }
428
- } : n.prototype._complete, c;
437
+ } : s.prototype._complete, a;
429
438
  }
430
439
  return t.prototype.unsubscribe = function() {
431
440
  var e;
432
441
  if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
433
442
  var r = this.closed;
434
- n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
443
+ s.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
435
444
  }
436
445
  }, t;
437
- }(Z), je = X(function(n) {
446
+ }(Z), qe = X(function(s) {
438
447
  return function() {
439
- n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
448
+ s(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
440
449
  };
441
- }), xe = function(n) {
442
- x(t, n);
450
+ }), Ie = function(s) {
451
+ U(t, s);
443
452
  function t() {
444
- var e = n.call(this) || this;
453
+ var e = s.call(this) || this;
445
454
  return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
446
455
  }
447
456
  return t.prototype.lift = function(e) {
448
- var r = new ae(this, this);
457
+ var r = new oe(this, this);
449
458
  return r.operator = e, r;
450
459
  }, t.prototype._throwIfClosed = function() {
451
460
  if (this.closed)
452
- throw new je();
461
+ throw new qe();
453
462
  }, t.prototype.next = function(e) {
454
463
  var r = this;
455
- U(function() {
456
- var s, i;
464
+ O(function() {
465
+ var n, i;
457
466
  if (r._throwIfClosed(), !r.isStopped) {
458
467
  r.currentObservers || (r.currentObservers = Array.from(r.observers));
459
468
  try {
460
- for (var o = G(r.currentObservers), a = o.next(); !a.done; a = o.next()) {
461
- var c = a.value;
462
- c.next(e);
469
+ for (var o = Q(r.currentObservers), c = o.next(); !c.done; c = o.next()) {
470
+ var a = c.value;
471
+ a.next(e);
463
472
  }
464
473
  } catch (u) {
465
- s = { error: u };
474
+ n = { error: u };
466
475
  } finally {
467
476
  try {
468
- a && !a.done && (i = o.return) && i.call(o);
477
+ c && !c.done && (i = o.return) && i.call(o);
469
478
  } finally {
470
- if (s) throw s.error;
479
+ if (n)
480
+ throw n.error;
471
481
  }
472
482
  }
473
483
  }
474
484
  });
475
485
  }, t.prototype.error = function(e) {
476
486
  var r = this;
477
- U(function() {
487
+ O(function() {
478
488
  if (r._throwIfClosed(), !r.isStopped) {
479
489
  r.hasError = r.isStopped = !0, r.thrownError = e;
480
- for (var s = r.observers; s.length; )
481
- s.shift().error(e);
490
+ for (var n = r.observers; n.length; )
491
+ n.shift().error(e);
482
492
  }
483
493
  });
484
494
  }, t.prototype.complete = function() {
485
495
  var e = this;
486
- U(function() {
496
+ O(function() {
487
497
  if (e._throwIfClosed(), !e.isStopped) {
488
498
  e.isStopped = !0;
489
499
  for (var r = e.observers; r.length; )
@@ -500,121 +510,121 @@ var Ve = function(n) {
500
510
  enumerable: !1,
501
511
  configurable: !0
502
512
  }), t.prototype._trySubscribe = function(e) {
503
- return this._throwIfClosed(), n.prototype._trySubscribe.call(this, e);
513
+ return this._throwIfClosed(), s.prototype._trySubscribe.call(this, e);
504
514
  }, t.prototype._subscribe = function(e) {
505
515
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
506
516
  }, t.prototype._innerSubscribe = function(e) {
507
- var r = this, s = this, i = s.hasError, o = s.isStopped, a = s.observers;
508
- return i || o ? be : (this.currentObservers = null, a.push(e), new R(function() {
509
- r.currentObservers = null, F(a, 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);
510
520
  }));
511
521
  }, t.prototype._checkFinalizedStatuses = function(e) {
512
- var r = this, s = r.hasError, i = r.thrownError, o = r.isStopped;
513
- s ? e.error(i) : o && e.complete();
522
+ var r = this, n = r.hasError, i = r.thrownError, o = r.isStopped;
523
+ n ? e.error(i) : o && e.complete();
514
524
  }, t.prototype.asObservable = function() {
515
- var e = new B();
525
+ var e = new G();
516
526
  return e.source = this, e;
517
527
  }, t.create = function(e, r) {
518
- return new ae(e, r);
528
+ return new oe(e, r);
519
529
  }, t;
520
- }(B), ae = function(n) {
521
- x(t, n);
530
+ }(G), oe = function(s) {
531
+ U(t, s);
522
532
  function t(e, r) {
523
- var s = n.call(this) || this;
524
- return s.destination = e, s.source = r, s;
533
+ var n = s.call(this) || this;
534
+ return n.destination = e, n.source = r, n;
525
535
  }
526
536
  return t.prototype.next = function(e) {
527
- var r, s;
528
- (s = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || s === void 0 || s.call(r, e);
537
+ var r, n;
538
+ (n = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || n === void 0 || n.call(r, e);
529
539
  }, t.prototype.error = function(e) {
530
- var r, s;
531
- (s = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || s === void 0 || s.call(r, e);
540
+ var r, n;
541
+ (n = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || n === void 0 || n.call(r, e);
532
542
  }, t.prototype.complete = function() {
533
543
  var e, r;
534
544
  (r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
535
545
  }, t.prototype._subscribe = function(e) {
536
- var r, s;
537
- return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : be;
546
+ var r, n;
547
+ return (n = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && n !== void 0 ? n : ve;
538
548
  }, t;
539
- }(xe), Qe = {
549
+ }(Ie), Be = {
540
550
  now: function() {
541
551
  return Date.now();
542
552
  },
543
553
  delegate: void 0
544
- }, qe = function(n) {
545
- x(t, n);
554
+ }, Qe = function(s) {
555
+ U(t, s);
546
556
  function t(e, r) {
547
- return n.call(this) || this;
557
+ return s.call(this) || this;
548
558
  }
549
559
  return t.prototype.schedule = function(e, r) {
550
560
  return this;
551
561
  }, t;
552
- }(R), Y = {
553
- setInterval: function(n, t) {
562
+ }(x), Y = {
563
+ setInterval: function(s, t) {
554
564
  for (var e = [], r = 2; r < arguments.length; r++)
555
565
  e[r - 2] = arguments[r];
556
- return setInterval.apply(void 0, D([n, t], $(e)));
566
+ return setInterval.apply(void 0, k([s, t], $(e)));
557
567
  },
558
- clearInterval: function(n) {
568
+ clearInterval: function(s) {
559
569
  var t = Y.delegate;
560
- return ((t == null ? void 0 : t.clearInterval) || clearInterval)(n);
570
+ return ((t == null ? void 0 : t.clearInterval) || clearInterval)(s);
561
571
  },
562
572
  delegate: void 0
563
- }, Ge = function(n) {
564
- x(t, n);
573
+ }, Ge = function(s) {
574
+ U(t, s);
565
575
  function t(e, r) {
566
- var s = n.call(this, e, r) || this;
567
- return s.scheduler = e, s.work = r, s.pending = !1, s;
576
+ var n = s.call(this, e, r) || this;
577
+ return n.scheduler = e, n.work = r, n.pending = !1, n;
568
578
  }
569
579
  return t.prototype.schedule = function(e, r) {
570
- var s;
580
+ var n;
571
581
  if (r === void 0 && (r = 0), this.closed)
572
582
  return this;
573
583
  this.state = e;
574
584
  var i = this.id, o = this.scheduler;
575
- return i != null && (this.id = this.recycleAsyncId(o, i, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(o, this.id, r), this;
576
- }, t.prototype.requestAsyncId = function(e, r, s) {
577
- return s === void 0 && (s = 0), Y.setInterval(e.flush.bind(e, this), s);
578
- }, t.prototype.recycleAsyncId = function(e, r, s) {
579
- if (s === void 0 && (s = 0), s != null && this.delay === s && this.pending === !1)
585
+ return i != null && (this.id = this.recycleAsyncId(o, i, r)), this.pending = !0, this.delay = r, this.id = (n = this.id) !== null && n !== void 0 ? n : this.requestAsyncId(o, this.id, r), this;
586
+ }, t.prototype.requestAsyncId = function(e, r, n) {
587
+ return n === void 0 && (n = 0), Y.setInterval(e.flush.bind(e, this), n);
588
+ }, t.prototype.recycleAsyncId = function(e, r, n) {
589
+ if (n === void 0 && (n = 0), n != null && this.delay === n && this.pending === !1)
580
590
  return r;
581
591
  r != null && Y.clearInterval(r);
582
592
  }, t.prototype.execute = function(e, r) {
583
593
  if (this.closed)
584
594
  return new Error("executing a cancelled action");
585
595
  this.pending = !1;
586
- var s = this._execute(e, r);
587
- if (s)
588
- return s;
596
+ var n = this._execute(e, r);
597
+ if (n)
598
+ return n;
589
599
  this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
590
600
  }, t.prototype._execute = function(e, r) {
591
- var s = !1, i;
601
+ var n = !1, i;
592
602
  try {
593
603
  this.work(e);
594
604
  } catch (o) {
595
- s = !0, i = o || new Error("Scheduled action threw falsy error");
605
+ n = !0, i = o || new Error("Scheduled action threw falsy error");
596
606
  }
597
- if (s)
607
+ if (n)
598
608
  return this.unsubscribe(), i;
599
609
  }, t.prototype.unsubscribe = function() {
600
610
  if (!this.closed) {
601
- var e = this, r = e.id, s = e.scheduler, i = s.actions;
602
- this.work = this.state = this.scheduler = null, this.pending = !1, F(i, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
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);
603
613
  }
604
614
  }, t;
605
- }(qe), ce = function() {
606
- function n(t, e) {
607
- e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
615
+ }(Qe), ce = function() {
616
+ function s(t, e) {
617
+ e === void 0 && (e = s.now), this.schedulerActionCtor = t, this.now = e;
608
618
  }
609
- return n.prototype.schedule = function(t, e, r) {
619
+ return s.prototype.schedule = function(t, e, r) {
610
620
  return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
611
- }, n.now = Qe.now, n;
612
- }(), Be = function(n) {
613
- x(t, n);
621
+ }, s.now = Be.now, s;
622
+ }(), Ye = function(s) {
623
+ U(t, s);
614
624
  function t(e, r) {
615
625
  r === void 0 && (r = ce.now);
616
- var s = n.call(this, e, r) || this;
617
- return s.actions = [], s._active = !1, s;
626
+ var n = s.call(this, e, r) || this;
627
+ return n.actions = [], n._active = !1, n;
618
628
  }
619
629
  return t.prototype.flush = function(e) {
620
630
  var r = this.actions;
@@ -622,99 +632,105 @@ var Ve = function(n) {
622
632
  r.push(e);
623
633
  return;
624
634
  }
625
- var s;
635
+ var n;
626
636
  this._active = !0;
627
637
  do
628
- if (s = e.execute(e.state, e.delay))
638
+ if (n = e.execute(e.state, e.delay))
629
639
  break;
630
640
  while (e = r.shift());
631
- if (this._active = !1, s) {
641
+ if (this._active = !1, n) {
632
642
  for (; e = r.shift(); )
633
643
  e.unsubscribe();
634
- throw s;
644
+ throw n;
635
645
  }
636
646
  }, t;
637
- }(ce), Ye = new Be(Ge), ze = Ye, We = X(function(n) {
647
+ }(ce), ze = new Ye(Ge), Je = ze;
648
+ function We(s) {
649
+ return s && C(s.schedule);
650
+ }
651
+ var Ke = X(function(s) {
638
652
  return function() {
639
- n(this), this.name = "EmptyError", this.message = "no elements in sequence";
653
+ s(this), this.name = "EmptyError", this.message = "no elements in sequence";
640
654
  };
641
655
  });
642
- function T(n, t) {
656
+ function T(s, t) {
643
657
  var e = typeof t == "object";
644
- return new Promise(function(r, s) {
645
- var i = new H({
658
+ return new Promise(function(r, n) {
659
+ var i = new N({
646
660
  next: function(o) {
647
661
  r(o), i.unsubscribe();
648
662
  },
649
- error: s,
663
+ error: n,
650
664
  complete: function() {
651
- e ? r(t.defaultValue) : s(new We());
665
+ e ? r(t.defaultValue) : n(new Ke());
652
666
  }
653
667
  });
654
- n.subscribe(i);
668
+ s.subscribe(i);
655
669
  });
656
670
  }
657
- function Ke(n) {
658
- return n instanceof Date && !isNaN(n);
671
+ function Xe(s) {
672
+ return s instanceof Date && !isNaN(s);
659
673
  }
660
- function O(n, t) {
661
- return Me(function(e, r) {
662
- var s = 0;
663
- e.subscribe(Ce(r, function(i) {
664
- r.next(n.call(t, i, s++));
674
+ function _(s, t) {
675
+ return Ee(function(e, r) {
676
+ var n = 0;
677
+ e.subscribe(Me(r, function(i) {
678
+ r.next(s.call(t, i, n++));
665
679
  }));
666
680
  });
667
681
  }
668
- function Je(n, t, e) {
669
- return e === void 0 && (e = ze), new B(function(r) {
670
- var s = Ke(n) ? +n - e.now() : n;
671
- s < 0 && (s = 0);
672
- var i = 0;
682
+ function Ze(s, t, e) {
683
+ s === void 0 && (s = 0), e === void 0 && (e = Je);
684
+ var r = -1;
685
+ return t != null && (We(t) ? e = t : r = t), new G(function(n) {
686
+ var i = Xe(s) ? +s - e.now() : s;
687
+ i < 0 && (i = 0);
688
+ var o = 0;
673
689
  return e.schedule(function() {
674
- r.closed || (r.next(i++), r.complete());
675
- }, s);
690
+ n.closed || (n.next(o++), 0 <= r ? this.schedule(void 0, r) : n.complete());
691
+ }, i);
676
692
  });
677
693
  }
678
- function Xe(n, t, e) {
679
- var r = S(n) || t || e ? { next: n, error: t, complete: e } : n;
680
- return r ? Me(function(s, i) {
694
+ function et(s, t, e) {
695
+ var r = C(s) || t || e ? { next: s, error: t, complete: e } : s;
696
+ return r ? Ee(function(n, i) {
681
697
  var o;
682
698
  (o = r.subscribe) === null || o === void 0 || o.call(r);
683
- var a = !0;
684
- s.subscribe(Ce(i, function(c) {
699
+ var c = !0;
700
+ n.subscribe(Me(i, function(a) {
685
701
  var u;
686
- (u = r.next) === null || u === void 0 || u.call(r, c), i.next(c);
702
+ (u = r.next) === null || u === void 0 || u.call(r, a), i.next(a);
687
703
  }, function() {
688
- var c;
689
- a = !1, (c = r.complete) === null || c === void 0 || c.call(r), i.complete();
690
- }, function(c) {
704
+ var a;
705
+ c = !1, (a = r.complete) === null || a === void 0 || a.call(r), i.complete();
706
+ }, function(a) {
691
707
  var u;
692
- a = !1, (u = r.error) === null || u === void 0 || u.call(r, c), i.error(c);
708
+ c = !1, (u = r.error) === null || u === void 0 || u.call(r, a), i.error(a);
693
709
  }, function() {
694
- var c, u;
695
- a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r);
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);
696
712
  }));
697
- }) : Ee;
713
+ }) : Ce;
698
714
  }
699
- var Ze = Object.defineProperty, et = (n, t, e) => t in n ? Ze(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, C = (n, t, e) => et(n, typeof t != "symbol" ? t + "" : t, e);
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);
700
716
  class d extends Error {
701
717
  constructor(t) {
702
- super(`Incorrect context (${t}). Cannot perform the requested operation.`), C(this, "context"), this.context = t;
718
+ super(`Incorrect context (${t}). Cannot perform the requested operation.`), I(this, "context"), this.context = t;
703
719
  }
704
720
  }
705
- class I extends Error {
721
+ class y extends Error {
706
722
  constructor(t, e, r) {
707
723
  super(`Invalid parameter (${t}). ${r}`), this.param = t, this.value = e, this.reason = r;
708
724
  }
709
725
  }
710
- class tt extends Error {
726
+ class ae extends Error {
711
727
  constructor(t, e) {
712
728
  super(
713
729
  `'streamId' value of "${t}" is different from what we expected ("${e}")`
714
730
  ), this.streamId = t, this.expectedStreamId = e;
715
731
  }
716
732
  }
717
- class rt extends Error {
733
+ class st extends Error {
718
734
  constructor(t) {
719
735
  super(`Invalid version format: ${t}`);
720
736
  }
@@ -730,18 +746,18 @@ class le extends Error {
730
746
  e && (r += ` Minimum version supported is ${e}.`), super(r), this.version = t;
731
747
  }
732
748
  }
733
- function E(n) {
734
- return typeof n == "function";
749
+ function E(s) {
750
+ return typeof s == "function";
735
751
  }
736
- function nt(n) {
737
- return E(n == null ? void 0 : n.lift);
752
+ function nt(s) {
753
+ return E(s == null ? void 0 : s.lift);
738
754
  }
739
- function P(n) {
755
+ function R(s) {
740
756
  return function(t) {
741
757
  if (nt(t))
742
758
  return t.lift(function(e) {
743
759
  try {
744
- return n(e, this);
760
+ return s(e, this);
745
761
  } catch (r) {
746
762
  this.error(r);
747
763
  }
@@ -749,170 +765,179 @@ function P(n) {
749
765
  throw new TypeError("Unable to lift unknown Observable type");
750
766
  };
751
767
  }
752
- var z = function(n, t) {
768
+ var z = function(s, t) {
753
769
  return z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
754
770
  e.__proto__ = r;
755
771
  } || function(e, r) {
756
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
757
- }, z(n, t);
772
+ for (var n in r)
773
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
774
+ }, z(s, t);
758
775
  };
759
- function ee(n, t) {
776
+ function ee(s, t) {
760
777
  if (typeof t != "function" && t !== null)
761
778
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
762
- z(n, t);
779
+ z(s, t);
763
780
  function e() {
764
- this.constructor = n;
781
+ this.constructor = s;
765
782
  }
766
- n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
783
+ s.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
767
784
  }
768
- function he(n) {
769
- var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
770
- if (e) return e.call(n);
771
- if (n && typeof n.length == "number") return {
772
- next: function() {
773
- return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
774
- }
775
- };
785
+ function he(s) {
786
+ var t = typeof Symbol == "function" && Symbol.iterator, e = t && s[t], r = 0;
787
+ if (e)
788
+ return e.call(s);
789
+ if (s && typeof s.length == "number")
790
+ return {
791
+ next: function() {
792
+ return s && r >= s.length && (s = void 0), { value: s && s[r++], done: !s };
793
+ }
794
+ };
776
795
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
777
796
  }
778
- function W(n, t) {
779
- var e = typeof Symbol == "function" && n[Symbol.iterator];
780
- if (!e) return n;
781
- var r = e.call(n), s, i = [], o;
797
+ function J(s, t) {
798
+ var e = typeof Symbol == "function" && s[Symbol.iterator];
799
+ if (!e)
800
+ return s;
801
+ var r = e.call(s), n, i = [], o;
782
802
  try {
783
- for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) i.push(s.value);
784
- } catch (a) {
785
- o = { error: a };
803
+ for (; (t === void 0 || t-- > 0) && !(n = r.next()).done; )
804
+ i.push(n.value);
805
+ } catch (c) {
806
+ o = { error: c };
786
807
  } finally {
787
808
  try {
788
- s && !s.done && (e = r.return) && e.call(r);
809
+ n && !n.done && (e = r.return) && e.call(r);
789
810
  } finally {
790
- if (o) throw o.error;
811
+ if (o)
812
+ throw o.error;
791
813
  }
792
814
  }
793
815
  return i;
794
816
  }
795
- function K(n, t, e) {
796
- if (arguments.length === 2) for (var r = 0, s = t.length, i; r < s; r++)
797
- (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
798
- return n.concat(i || Array.prototype.slice.call(t));
817
+ function W(s, t, e) {
818
+ if (e || arguments.length === 2)
819
+ for (var r = 0, n = t.length, i; r < n; r++)
820
+ (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
821
+ return s.concat(i || Array.prototype.slice.call(t));
799
822
  }
800
- function st(n) {
823
+ function it(s) {
801
824
  var t = function(r) {
802
825
  Error.call(r), r.stack = new Error().stack;
803
- }, e = n(t);
826
+ }, e = s(t);
804
827
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
805
828
  }
806
- var j = st(function(n) {
829
+ var j = it(function(s) {
807
830
  return function(t) {
808
- n(this), this.message = t ? t.length + ` errors occurred during unsubscription:
831
+ s(this), this.message = t ? t.length + ` errors occurred during unsubscription:
809
832
  ` + t.map(function(e, r) {
810
833
  return r + 1 + ") " + e.toString();
811
834
  }).join(`
812
835
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
813
836
  };
814
837
  });
815
- function de(n, t) {
816
- if (n) {
817
- var e = n.indexOf(t);
818
- 0 <= e && n.splice(e, 1);
838
+ function de(s, t) {
839
+ if (s) {
840
+ var e = s.indexOf(t);
841
+ 0 <= e && s.splice(e, 1);
819
842
  }
820
843
  }
821
844
  var te = function() {
822
- function n(t) {
845
+ function s(t) {
823
846
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
824
847
  }
825
- return n.prototype.unsubscribe = function() {
826
- var t, e, r, s, i;
848
+ return s.prototype.unsubscribe = function() {
849
+ var t, e, r, n, i;
827
850
  if (!this.closed) {
828
851
  this.closed = !0;
829
852
  var o = this._parentage;
830
853
  if (o)
831
854
  if (this._parentage = null, Array.isArray(o))
832
855
  try {
833
- for (var a = he(o), c = a.next(); !c.done; c = a.next()) {
834
- var u = c.value;
856
+ for (var c = he(o), a = c.next(); !a.done; a = c.next()) {
857
+ var u = a.value;
835
858
  u.remove(this);
836
859
  }
837
- } catch (y) {
838
- t = { error: y };
860
+ } catch (v) {
861
+ t = { error: v };
839
862
  } finally {
840
863
  try {
841
- c && !c.done && (e = a.return) && e.call(a);
864
+ a && !a.done && (e = c.return) && e.call(c);
842
865
  } finally {
843
- if (t) throw t.error;
866
+ if (t)
867
+ throw t.error;
844
868
  }
845
869
  }
846
870
  else
847
871
  o.remove(this);
848
- var l = this.initialTeardown;
849
- if (E(l))
872
+ var h = this.initialTeardown;
873
+ if (E(h))
850
874
  try {
851
- l();
852
- } catch (y) {
853
- i = y instanceof j ? y.errors : [y];
875
+ h();
876
+ } catch (v) {
877
+ i = v instanceof j ? v.errors : [v];
854
878
  }
855
- var h = this._finalizers;
856
- if (h) {
879
+ var l = this._finalizers;
880
+ if (l) {
857
881
  this._finalizers = null;
858
882
  try {
859
- for (var b = he(h), v = b.next(); !v.done; v = b.next()) {
860
- var N = v.value;
883
+ for (var b = he(l), p = b.next(); !p.done; p = b.next()) {
884
+ var F = p.value;
861
885
  try {
862
- pe(N);
863
- } catch (y) {
864
- i = i ?? [], y instanceof j ? i = K(K([], W(i)), W(y.errors)) : i.push(y);
886
+ pe(F);
887
+ } catch (v) {
888
+ i = i ?? [], v instanceof j ? i = W(W([], J(i)), J(v.errors)) : i.push(v);
865
889
  }
866
890
  }
867
- } catch (y) {
868
- r = { error: y };
891
+ } catch (v) {
892
+ r = { error: v };
869
893
  } finally {
870
894
  try {
871
- v && !v.done && (s = b.return) && s.call(b);
895
+ p && !p.done && (n = b.return) && n.call(b);
872
896
  } finally {
873
- if (r) throw r.error;
897
+ if (r)
898
+ throw r.error;
874
899
  }
875
900
  }
876
901
  }
877
902
  if (i)
878
903
  throw new j(i);
879
904
  }
880
- }, n.prototype.add = function(t) {
905
+ }, s.prototype.add = function(t) {
881
906
  var e;
882
907
  if (t && t !== this)
883
908
  if (this.closed)
884
909
  pe(t);
885
910
  else {
886
- if (t instanceof n) {
911
+ if (t instanceof s) {
887
912
  if (t.closed || t._hasParent(this))
888
913
  return;
889
914
  t._addParent(this);
890
915
  }
891
916
  (this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(t);
892
917
  }
893
- }, n.prototype._hasParent = function(t) {
918
+ }, s.prototype._hasParent = function(t) {
894
919
  var e = this._parentage;
895
920
  return e === t || Array.isArray(e) && e.includes(t);
896
- }, n.prototype._addParent = function(t) {
921
+ }, s.prototype._addParent = function(t) {
897
922
  var e = this._parentage;
898
923
  this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
899
- }, n.prototype._removeParent = function(t) {
924
+ }, s.prototype._removeParent = function(t) {
900
925
  var e = this._parentage;
901
926
  e === t ? this._parentage = null : Array.isArray(e) && de(e, t);
902
- }, n.prototype.remove = function(t) {
927
+ }, s.prototype.remove = function(t) {
903
928
  var e = this._finalizers;
904
- e && de(e, t), t instanceof n && t._removeParent(this);
905
- }, n.EMPTY = function() {
906
- var t = new n();
929
+ e && de(e, t), t instanceof s && t._removeParent(this);
930
+ }, s.EMPTY = function() {
931
+ var t = new s();
907
932
  return t.closed = !0, t;
908
- }(), n;
933
+ }(), s;
909
934
  }();
910
935
  te.EMPTY;
911
- function Ie(n) {
912
- return n instanceof te || n && "closed" in n && E(n.remove) && E(n.add) && E(n.unsubscribe);
936
+ function Ue(s) {
937
+ return s instanceof te || s && "closed" in s && E(s.remove) && E(s.add) && E(s.unsubscribe);
913
938
  }
914
- function pe(n) {
915
- E(n) ? n() : n.unsubscribe();
939
+ function pe(s) {
940
+ E(s) ? s() : s.unsubscribe();
916
941
  }
917
942
  var Te = {
918
943
  onUnhandledError: null,
@@ -920,35 +945,35 @@ var Te = {
920
945
  Promise: void 0,
921
946
  useDeprecatedSynchronousErrorHandling: !1,
922
947
  useDeprecatedNextContext: !1
923
- }, it = {
924
- setTimeout: function(n, t) {
948
+ }, ot = {
949
+ setTimeout: function(s, t) {
925
950
  for (var e = [], r = 2; r < arguments.length; r++)
926
951
  e[r - 2] = arguments[r];
927
- return setTimeout.apply(void 0, K([n, t], W(e)));
952
+ return setTimeout.apply(void 0, W([s, t], J(e)));
928
953
  },
929
- clearTimeout: function(n) {
930
- return clearTimeout(n);
954
+ clearTimeout: function(s) {
955
+ return clearTimeout(s);
931
956
  },
932
957
  delegate: void 0
933
958
  };
934
- function ot(n) {
935
- it.setTimeout(function() {
936
- throw n;
959
+ function ct(s) {
960
+ ot.setTimeout(function() {
961
+ throw s;
937
962
  });
938
963
  }
939
964
  function fe() {
940
965
  }
941
- function at(n) {
942
- n();
966
+ function at(s) {
967
+ s();
943
968
  }
944
- var re = function(n) {
945
- ee(t, n);
969
+ var re = function(s) {
970
+ ee(t, s);
946
971
  function t(e) {
947
- var r = n.call(this) || this;
948
- return r.isStopped = !1, e ? (r.destination = e, Ie(e) && e.add(r)) : r.destination = ht, r;
972
+ var r = s.call(this) || this;
973
+ return r.isStopped = !1, e ? (r.destination = e, Ue(e) && e.add(r)) : r.destination = dt, r;
949
974
  }
950
- return t.create = function(e, r, s) {
951
- return new J(e, r, s);
975
+ return t.create = function(e, r, n) {
976
+ return new K(e, r, n);
952
977
  }, t.prototype.next = function(e) {
953
978
  this.isStopped || this._next(e);
954
979
  }, t.prototype.error = function(e) {
@@ -956,7 +981,7 @@ var re = function(n) {
956
981
  }, t.prototype.complete = function() {
957
982
  this.isStopped || (this.isStopped = !0, this._complete());
958
983
  }, t.prototype.unsubscribe = function() {
959
- this.closed || (this.isStopped = !0, n.prototype.unsubscribe.call(this), this.destination = null);
984
+ this.closed || (this.isStopped = !0, s.prototype.unsubscribe.call(this), this.destination = null);
960
985
  }, t.prototype._next = function(e) {
961
986
  this.destination.next(e);
962
987
  }, t.prototype._error = function(e) {
@@ -972,15 +997,15 @@ var re = function(n) {
972
997
  this.unsubscribe();
973
998
  }
974
999
  }, t;
975
- }(te), ct = Function.prototype.bind;
976
- function Q(n, t) {
977
- return ct.call(n, t);
1000
+ }(te), ut = Function.prototype.bind;
1001
+ function q(s, t) {
1002
+ return ut.call(s, t);
978
1003
  }
979
- var ut = function() {
980
- function n(t) {
1004
+ var lt = function() {
1005
+ function s(t) {
981
1006
  this.partialObserver = t;
982
1007
  }
983
- return n.prototype.next = function(t) {
1008
+ return s.prototype.next = function(t) {
984
1009
  var e = this.partialObserver;
985
1010
  if (e.next)
986
1011
  try {
@@ -988,7 +1013,7 @@ var ut = function() {
988
1013
  } catch (r) {
989
1014
  L(r);
990
1015
  }
991
- }, n.prototype.error = function(t) {
1016
+ }, s.prototype.error = function(t) {
992
1017
  var e = this.partialObserver;
993
1018
  if (e.error)
994
1019
  try {
@@ -998,7 +1023,7 @@ var ut = function() {
998
1023
  }
999
1024
  else
1000
1025
  L(t);
1001
- }, n.prototype.complete = function() {
1026
+ }, s.prototype.complete = function() {
1002
1027
  var t = this.partialObserver;
1003
1028
  if (t.complete)
1004
1029
  try {
@@ -1006,248 +1031,245 @@ var ut = function() {
1006
1031
  } catch (e) {
1007
1032
  L(e);
1008
1033
  }
1009
- }, n;
1010
- }(), J = function(n) {
1011
- ee(t, n);
1012
- function t(e, r, s) {
1013
- var i = n.call(this) || this, o;
1034
+ }, s;
1035
+ }(), K = function(s) {
1036
+ ee(t, s);
1037
+ function t(e, r, n) {
1038
+ var i = s.call(this) || this, o;
1014
1039
  if (E(e) || !e)
1015
1040
  o = {
1016
1041
  next: e ?? void 0,
1017
1042
  error: r ?? void 0,
1018
- complete: s ?? void 0
1043
+ complete: n ?? void 0
1019
1044
  };
1020
1045
  else {
1021
- var a;
1022
- i && Te.useDeprecatedNextContext ? (a = Object.create(e), a.unsubscribe = function() {
1046
+ var c;
1047
+ i && Te.useDeprecatedNextContext ? (c = Object.create(e), c.unsubscribe = function() {
1023
1048
  return i.unsubscribe();
1024
1049
  }, o = {
1025
- next: e.next && Q(e.next, a),
1026
- error: e.error && Q(e.error, a),
1027
- complete: e.complete && Q(e.complete, a)
1050
+ next: e.next && q(e.next, c),
1051
+ error: e.error && q(e.error, c),
1052
+ complete: e.complete && q(e.complete, c)
1028
1053
  }) : o = e;
1029
1054
  }
1030
- return i.destination = new ut(o), i;
1055
+ return i.destination = new lt(o), i;
1031
1056
  }
1032
1057
  return t;
1033
1058
  }(re);
1034
- function L(n) {
1035
- ot(n);
1059
+ function L(s) {
1060
+ ct(s);
1036
1061
  }
1037
- function lt(n) {
1038
- throw n;
1062
+ function ht(s) {
1063
+ throw s;
1039
1064
  }
1040
- var ht = {
1065
+ var dt = {
1041
1066
  closed: !0,
1042
1067
  next: fe,
1043
- error: lt,
1068
+ error: ht,
1044
1069
  complete: fe
1045
- }, dt = function() {
1070
+ }, pt = function() {
1046
1071
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
1047
1072
  }();
1048
- function Re(n) {
1049
- return n;
1073
+ function xe(s) {
1074
+ return s;
1050
1075
  }
1051
- function pt(n) {
1052
- return n.length === 0 ? Re : n.length === 1 ? n[0] : function(t) {
1053
- return n.reduce(function(e, r) {
1076
+ function ft(s) {
1077
+ return s.length === 0 ? xe : s.length === 1 ? s[0] : function(t) {
1078
+ return s.reduce(function(e, r) {
1054
1079
  return r(e);
1055
1080
  }, t);
1056
1081
  };
1057
1082
  }
1058
- var ft = function() {
1059
- function n(t) {
1083
+ var gt = function() {
1084
+ function s(t) {
1060
1085
  t && (this._subscribe = t);
1061
1086
  }
1062
- return n.prototype.lift = function(t) {
1063
- var e = new n();
1087
+ return s.prototype.lift = function(t) {
1088
+ var e = new s();
1064
1089
  return e.source = this, e.operator = t, e;
1065
- }, n.prototype.subscribe = function(t, e, r) {
1066
- var s = this, i = vt(t) ? t : new J(t, e, r);
1090
+ }, s.prototype.subscribe = function(t, e, r) {
1091
+ var n = this, i = yt(t) ? t : new K(t, e, r);
1067
1092
  return at(function() {
1068
- var o = s, a = o.operator, c = o.source;
1069
- i.add(a ? a.call(i, c) : c ? s._subscribe(i) : s._trySubscribe(i));
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));
1070
1095
  }), i;
1071
- }, n.prototype._trySubscribe = function(t) {
1096
+ }, s.prototype._trySubscribe = function(t) {
1072
1097
  try {
1073
1098
  return this._subscribe(t);
1074
1099
  } catch (e) {
1075
1100
  t.error(e);
1076
1101
  }
1077
- }, n.prototype.forEach = function(t, e) {
1102
+ }, s.prototype.forEach = function(t, e) {
1078
1103
  var r = this;
1079
- return e = ge(e), new e(function(s, i) {
1080
- var o = new J({
1081
- next: function(a) {
1104
+ return e = ge(e), new e(function(n, i) {
1105
+ var o = new K({
1106
+ next: function(c) {
1082
1107
  try {
1083
- t(a);
1084
- } catch (c) {
1085
- i(c), o.unsubscribe();
1108
+ t(c);
1109
+ } catch (a) {
1110
+ i(a), o.unsubscribe();
1086
1111
  }
1087
1112
  },
1088
1113
  error: i,
1089
- complete: s
1114
+ complete: n
1090
1115
  });
1091
1116
  r.subscribe(o);
1092
1117
  });
1093
- }, n.prototype._subscribe = function(t) {
1118
+ }, s.prototype._subscribe = function(t) {
1094
1119
  var e;
1095
1120
  return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
1096
- }, n.prototype[dt] = function() {
1121
+ }, s.prototype[pt] = function() {
1097
1122
  return this;
1098
- }, n.prototype.pipe = function() {
1123
+ }, s.prototype.pipe = function() {
1099
1124
  for (var t = [], e = 0; e < arguments.length; e++)
1100
1125
  t[e] = arguments[e];
1101
- return pt(t)(this);
1102
- }, n.prototype.toPromise = function(t) {
1126
+ return ft(t)(this);
1127
+ }, s.prototype.toPromise = function(t) {
1103
1128
  var e = this;
1104
- return t = ge(t), new t(function(r, s) {
1129
+ return t = ge(t), new t(function(r, n) {
1105
1130
  var i;
1106
1131
  e.subscribe(function(o) {
1107
1132
  return i = o;
1108
1133
  }, function(o) {
1109
- return s(o);
1134
+ return n(o);
1110
1135
  }, function() {
1111
1136
  return r(i);
1112
1137
  });
1113
1138
  });
1114
- }, n.create = function(t) {
1115
- return new n(t);
1116
- }, n;
1139
+ }, s.create = function(t) {
1140
+ return new s(t);
1141
+ }, s;
1117
1142
  }();
1118
- function ge(n) {
1143
+ function ge(s) {
1119
1144
  var t;
1120
- return (t = n ?? Te.Promise) !== null && t !== void 0 ? t : Promise;
1145
+ return (t = s ?? Te.Promise) !== null && t !== void 0 ? t : Promise;
1121
1146
  }
1122
- function gt(n) {
1123
- return n && E(n.next) && E(n.error) && E(n.complete);
1147
+ function mt(s) {
1148
+ return s && E(s.next) && E(s.error) && E(s.complete);
1124
1149
  }
1125
- function vt(n) {
1126
- return n && n instanceof re || gt(n) && Ie(n);
1150
+ function yt(s) {
1151
+ return s && s instanceof re || mt(s) && Ue(s);
1127
1152
  }
1128
- function _(n, t, e, r, s) {
1129
- return new yt(n, t, e, r, s);
1153
+ function A(s, t, e, r, n) {
1154
+ return new vt(s, t, e, r, n);
1130
1155
  }
1131
- var yt = function(n) {
1132
- ee(t, n);
1133
- function t(e, r, s, i, o, a) {
1134
- var c = n.call(this, e) || this;
1135
- return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = r ? function(u) {
1156
+ var vt = function(s) {
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) {
1136
1161
  try {
1137
1162
  r(u);
1138
- } catch (l) {
1139
- e.error(l);
1163
+ } catch (h) {
1164
+ e.error(h);
1140
1165
  }
1141
- } : n.prototype._next, c._error = i ? function(u) {
1166
+ } : s.prototype._next, a._error = i ? function(u) {
1142
1167
  try {
1143
1168
  i(u);
1144
- } catch (l) {
1145
- e.error(l);
1169
+ } catch (h) {
1170
+ e.error(h);
1146
1171
  } finally {
1147
1172
  this.unsubscribe();
1148
1173
  }
1149
- } : n.prototype._error, c._complete = s ? function() {
1174
+ } : s.prototype._error, a._complete = n ? function() {
1150
1175
  try {
1151
- s();
1176
+ n();
1152
1177
  } catch (u) {
1153
1178
  e.error(u);
1154
1179
  } finally {
1155
1180
  this.unsubscribe();
1156
1181
  }
1157
- } : n.prototype._complete, c;
1182
+ } : s.prototype._complete, a;
1158
1183
  }
1159
1184
  return t.prototype.unsubscribe = function() {
1160
1185
  var e;
1161
1186
  if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1162
1187
  var r = this.closed;
1163
- n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
1188
+ s.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
1164
1189
  }
1165
1190
  }, t;
1166
1191
  }(re);
1167
- function p(n, t) {
1168
- return P(function(e, r) {
1169
- var s = 0;
1170
- e.subscribe(_(r, function(i) {
1171
- r.next(n.call(t, i, s++));
1192
+ function f(s, t) {
1193
+ return R(function(e, r) {
1194
+ var n = 0;
1195
+ e.subscribe(A(r, function(i) {
1196
+ r.next(s.call(t, i, n++));
1172
1197
  }));
1173
1198
  });
1174
1199
  }
1175
- var bt = new ft(function(n) {
1176
- return n.complete();
1200
+ var bt = new gt(function(s) {
1201
+ return s.complete();
1177
1202
  });
1178
- function m(n) {
1179
- return n <= 0 ? function() {
1203
+ function w(s) {
1204
+ return s <= 0 ? function() {
1180
1205
  return bt;
1181
- } : P(function(t, e) {
1206
+ } : R(function(t, e) {
1182
1207
  var r = 0;
1183
- t.subscribe(_(e, function(s) {
1184
- ++r <= n && (e.next(s), n <= r && e.complete());
1208
+ t.subscribe(A(e, function(n) {
1209
+ ++r <= s && (e.next(n), s <= r && e.complete());
1185
1210
  }));
1186
1211
  });
1187
1212
  }
1188
- function g(n, t) {
1189
- return P(function(e, r) {
1190
- var s = 0;
1191
- e.subscribe(_(r, function(i) {
1192
- return n.call(t, i, s++) && r.next(i);
1213
+ function m(s, t) {
1214
+ return R(function(e, r) {
1215
+ var n = 0;
1216
+ e.subscribe(A(r, function(i) {
1217
+ return s.call(t, i, n++) && r.next(i);
1193
1218
  }));
1194
1219
  });
1195
1220
  }
1196
- function mt(n, t) {
1197
- return P(function(e, r) {
1198
- var s = 0;
1199
- e.subscribe(_(r, function(i) {
1200
- var o = n(i, s++);
1221
+ function wt(s, t) {
1222
+ return t === void 0 && (t = !1), R(function(e, r) {
1223
+ var n = 0;
1224
+ e.subscribe(A(r, function(i) {
1225
+ var o = s(i, n++);
1201
1226
  (o || t) && r.next(i), !o && r.complete();
1202
1227
  }));
1203
1228
  });
1204
1229
  }
1205
- function f(n, t, e) {
1206
- var r = E(n) || t || e ? { next: n, error: t, complete: e } : n;
1207
- return r ? P(function(s, i) {
1230
+ function g(s, t, e) {
1231
+ var r = E(s) || t || e ? { next: s, error: t, complete: e } : s;
1232
+ return r ? R(function(n, i) {
1208
1233
  var o;
1209
1234
  (o = r.subscribe) === null || o === void 0 || o.call(r);
1210
- var a = !0;
1211
- s.subscribe(_(i, function(c) {
1235
+ var c = !0;
1236
+ n.subscribe(A(i, function(a) {
1212
1237
  var u;
1213
- (u = r.next) === null || u === void 0 || u.call(r, c), i.next(c);
1238
+ (u = r.next) === null || u === void 0 || u.call(r, a), i.next(a);
1214
1239
  }, function() {
1215
- var c;
1216
- a = !1, (c = r.complete) === null || c === void 0 || c.call(r), i.complete();
1217
- }, function(c) {
1240
+ var a;
1241
+ c = !1, (a = r.complete) === null || a === void 0 || a.call(r), i.complete();
1242
+ }, function(a) {
1218
1243
  var u;
1219
- a = !1, (u = r.error) === null || u === void 0 || u.call(r, c), i.error(c);
1244
+ c = !1, (u = r.error) === null || u === void 0 || u.call(r, a), i.error(a);
1220
1245
  }, function() {
1221
- var c, u;
1222
- a && ((c = r.unsubscribe) === null || c === void 0 || c.call(r)), (u = r.finalize) === null || u === void 0 || u.call(r);
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);
1223
1248
  }));
1224
- }) : Re;
1249
+ }) : xe;
1225
1250
  }
1226
- const wt = /^(\d+)\.(\d+)$/;
1227
- function St(n) {
1228
- if (typeof n == "string") {
1229
- const t = n.match(wt);
1251
+ const St = /^(\d+)\.(\d+)$/;
1252
+ function Ct(s) {
1253
+ if (typeof s == "string") {
1254
+ const t = s.match(St);
1230
1255
  if (t)
1231
1256
  return `${t[1]}.${t[2]}`;
1232
1257
  }
1233
- throw new rt(n);
1234
- }
1235
- function ve(n) {
1236
- const t = St(n), [e, r] = t.split("."), [s, i] = [parseInt(e), parseInt(r)];
1237
- return [s, i];
1258
+ throw new st(s);
1238
1259
  }
1239
- function ne(n, t) {
1240
- const [e, r] = ve(n), [s, i] = ve(t);
1241
- return e < s ? -1 : e > s ? 1 : r < i ? -1 : r > i ? 1 : 0;
1260
+ function me(s) {
1261
+ const t = Ct(s), [e, r] = t.split("."), [n, i] = [parseInt(e), parseInt(r)];
1262
+ return [n, i];
1242
1263
  }
1243
- function Et(n, t) {
1244
- return ne(n, t) === 1;
1264
+ function Re(s, t) {
1265
+ const [e, r] = me(s), [n, i] = me(t);
1266
+ return e < n ? -1 : e > n ? 1 : r < i ? -1 : r > i ? 1 : 0;
1245
1267
  }
1246
- function Mt(n, t) {
1247
- return ne(n, t) >= 0;
1268
+ function Et(s, t) {
1269
+ return Re(s, t) >= 0;
1248
1270
  }
1249
1271
  const ye = "2.0";
1250
- class Ct {
1272
+ class Mt {
1251
1273
  /**
1252
1274
  * Create a new instance of the {@link IpcHelper | IPC Protocol Helper}.
1253
1275
  *
@@ -1258,7 +1280,7 @@ class Ct {
1258
1280
  * @param logService - An instance of a logging service or utility
1259
1281
  */
1260
1282
  constructor(t, e) {
1261
- 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 xe(), this.supportedVersions = t.filter((r) => Mt(r, ye)), !this.supportedVersions.length)
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)
1262
1284
  throw new le(t, ye);
1263
1285
  this.negotiatedProtocolVersion = this.supportedVersions[0], this.embeddedResult = null, this.iframePort2 = null;
1264
1286
  }
@@ -1278,7 +1300,7 @@ class Ct {
1278
1300
  return this.inIframe ? this.iframePort1 : (e = (t = window.Acrobits) == null ? void 0 : t.messageChannel) == null ? void 0 : e.port1;
1279
1301
  }
1280
1302
  get port2() {
1281
- var t, e, r, s;
1303
+ var t, e, r, n;
1282
1304
  if (this.inIframe) {
1283
1305
  if (!this.iframePort2)
1284
1306
  throw new ue("port2");
@@ -1286,7 +1308,7 @@ class Ct {
1286
1308
  } else {
1287
1309
  if (!((e = (t = window.Acrobits) == null ? void 0 : t.messageChannel) != null && e.port2))
1288
1310
  throw new ue("port2");
1289
- return (s = (r = window.Acrobits) == null ? void 0 : r.messageChannel) == null ? void 0 : s.port2;
1311
+ return (n = (r = window.Acrobits) == null ? void 0 : r.messageChannel) == null ? void 0 : n.port2;
1290
1312
  }
1291
1313
  }
1292
1314
  /**
@@ -1295,9 +1317,9 @@ class Ct {
1295
1317
  * @returns Observable with the {@link AppContext} the app is running under. Emits once.
1296
1318
  */
1297
1319
  determineContext() {
1298
- return Je(1e3).pipe(
1299
- p(() => (this.isEmbedded() ? this.currentContext = "user" : this.currentContext = "guest", this.currentContext)),
1300
- m(1)
1320
+ return Ze(1e3).pipe(
1321
+ f(() => (this.isEmbedded() ? this.currentContext = "user" : this.currentContext = "guest", this.currentContext)),
1322
+ w(1)
1301
1323
  );
1302
1324
  }
1303
1325
  /**
@@ -1312,20 +1334,20 @@ class Ct {
1312
1334
  const t = "HELLO", e = this.createMessage(t);
1313
1335
  e.protocolVersions = this.supportedVersions, this.logCreated(t, e);
1314
1336
  const r = this.incomingMessages$.pipe(
1315
- g((s) => s.type === t && s.replyTo === e.id),
1316
- p((s) => s),
1317
- f(this.logReceived()),
1318
- p((s) => {
1319
- if (this.supportedVersions.some((i) => Et(i, s.protocolVersion)))
1320
- throw new le(s.protocolVersion, this.supportedVersions[0]);
1321
- return s.displayName || (s.displayName = s.cloudUsername), s;
1337
+ m((n) => n.type === t && n.replyTo === e.id),
1338
+ f((n) => n),
1339
+ g(this.logReceived()),
1340
+ f((n) => {
1341
+ if (!this.supportedVersions.includes(n.protocolVersion))
1342
+ throw new le(n.protocolVersion, this.supportedVersions[0]);
1343
+ return n.displayName || (n.displayName = n.cloudUsername), n;
1322
1344
  }),
1323
- f((s) => {
1324
- this.negotiatedProtocolVersion = s.protocolVersion, this.logService.info(
1345
+ g((n) => {
1346
+ this.negotiatedProtocolVersion = n.protocolVersion, this.logService.info(
1325
1347
  `[IPC] Negotiated IPC Protocol Version: ${this.negotiatedProtocolVersion}`
1326
1348
  );
1327
1349
  }),
1328
- m(1)
1350
+ w(1)
1329
1351
  );
1330
1352
  return this.logService.debug(`Created ${t} Reply handler`), this.inIframe ? this.createIframeChannel().then(() => this.finishIpcSetup(e)) : this.finishIpcSetup(e), r;
1331
1353
  }
@@ -1342,10 +1364,10 @@ class Ct {
1342
1364
  const t = "TOKEN", e = this.createMessage(t);
1343
1365
  this.logCreated(t, e);
1344
1366
  const r = this.incomingMessages$.pipe(
1345
- g((s) => s.type === t && s.replyTo === e.id),
1346
- p((s) => s),
1347
- f(this.logReceived()),
1348
- m(1)
1367
+ m((n) => n.type === t && n.replyTo === e.id),
1368
+ f((n) => n),
1369
+ g(this.logReceived()),
1370
+ w(1)
1349
1371
  );
1350
1372
  return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
1351
1373
  }
@@ -1368,14 +1390,14 @@ class Ct {
1368
1390
  const {
1369
1391
  roomName: e,
1370
1392
  roomInvite: r,
1371
- displayName: s,
1393
+ displayName: n,
1372
1394
  jwtToken: i,
1373
1395
  serverUrl: o,
1374
- region: a,
1375
- joinMicMuted: c,
1396
+ region: c,
1397
+ joinMicMuted: a,
1376
1398
  joinWithoutCamera: u
1377
- } = t, l = "JOINING ROOM", h = this.createMessage(l, !1);
1378
- h.roomName = e, h.jwtToken = i, h.serverUrl = o, h.region = a, h.roomInvite = r, h.joinMicMuted = c ?? !1, h.joinWithoutCamera = u ?? !1, h.displayName = s, this.logCreated(l, h), this.port2.postMessage(h), this.logSent(l, h);
1399
+ } = t, h = "JOINING ROOM", l = this.createMessage(h, !1);
1400
+ 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);
1379
1401
  }
1380
1402
  /**
1381
1403
  * Sends a {@link LeavingRoomMessage} lifecycle message to the Host app.
@@ -1425,10 +1447,10 @@ class Ct {
1425
1447
  throw new d(this.currentContext);
1426
1448
  const t = "JOIN ROOM";
1427
1449
  return this.incomingMessages$.pipe(
1428
- g((e) => e.type === t && e.target === "client"),
1429
- p((e) => e),
1430
- f(this.logReceived()),
1431
- p((e) => e)
1450
+ m((e) => e.type === t && e.target === "client"),
1451
+ f((e) => e),
1452
+ g(this.logReceived()),
1453
+ f((e) => e)
1432
1454
  );
1433
1455
  }
1434
1456
  /**
@@ -1461,10 +1483,10 @@ class Ct {
1461
1483
  throw new d(this.currentContext);
1462
1484
  const t = "LEAVE ROOM";
1463
1485
  return this.incomingMessages$.pipe(
1464
- g((e) => e.type === t && e.target === "client"),
1465
- p((e) => e),
1466
- f(this.logReceived()),
1467
- p((e) => e)
1486
+ m((e) => e.type === t && e.target === "client"),
1487
+ f((e) => e),
1488
+ g(this.logReceived()),
1489
+ f((e) => e)
1468
1490
  );
1469
1491
  }
1470
1492
  /**
@@ -1498,10 +1520,10 @@ class Ct {
1498
1520
  throw new d(this.currentContext);
1499
1521
  const t = "CONFIG";
1500
1522
  return this.incomingMessages$.pipe(
1501
- g((e) => e.type === t && e.target === "client"),
1502
- p((e) => e),
1503
- f(this.logReceived()),
1504
- p((e) => ({
1523
+ m((e) => e.type === t && e.target === "client"),
1524
+ f((e) => e),
1525
+ g(this.logReceived()),
1526
+ f((e) => ({
1505
1527
  preferredCameraType: e.preferredCameraType,
1506
1528
  preferredMicType: e.preferredMicType,
1507
1529
  preferredOutputType: e.preferredOutputType,
@@ -1520,27 +1542,27 @@ class Ct {
1520
1542
  throw new d(this.currentContext);
1521
1543
  const e = "SCREENSHARE SOURCE", r = this.createMessage(e);
1522
1544
  r.sourceTypes = t, this.logCreated(e, r);
1523
- const s = this.incomingMessages$.pipe(
1524
- g((i) => i.type === e && i.replyTo === r.id),
1525
- p((i) => i),
1526
- f(this.logReceived()),
1527
- p((i) => i),
1528
- m(1)
1545
+ const n = this.incomingMessages$.pipe(
1546
+ m((i) => i.type === e && i.replyTo === r.id),
1547
+ f((i) => i),
1548
+ g(this.logReceived()),
1549
+ f((i) => i),
1550
+ w(1)
1529
1551
  );
1530
- return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), s;
1552
+ return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), n;
1531
1553
  }
1532
1554
  layoutChange(t, e, r) {
1533
1555
  if (!this.isEmbedded())
1534
1556
  throw new d(this.currentContext);
1535
- const s = "LAYOUT CHANGE";
1557
+ const n = "LAYOUT CHANGE";
1536
1558
  let i, o;
1537
- if (e && r ? (i = this.createMessage(s, !1, r), i.result = e) : (i = this.createMessage(s), o = this.incomingMessages$.pipe(
1538
- g((a) => a.type === s && a.replyTo === i.id),
1539
- p((a) => a),
1540
- f(this.logReceived()),
1541
- p((a) => a),
1542
- m(1)
1543
- ), this.logService.debug(`Created ${s} Reply handler`)), i.layout = t, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i), o)
1559
+ if (e && r ? (i = this.createMessage(n, !1, r), i.result = e) : (i = this.createMessage(n), o = this.incomingMessages$.pipe(
1560
+ m((c) => c.type === n && c.replyTo === i.id),
1561
+ f((c) => c),
1562
+ g(this.logReceived()),
1563
+ f((c) => c),
1564
+ w(1)
1565
+ ), this.logService.debug(`Created ${n} Reply handler`)), i.layout = t, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i), o)
1544
1566
  return o;
1545
1567
  }
1546
1568
  /**
@@ -1579,10 +1601,10 @@ class Ct {
1579
1601
  throw new d(this.currentContext);
1580
1602
  const t = "LAYOUT CHANGE";
1581
1603
  return this.incomingMessages$.pipe(
1582
- g((e) => e.type === t && e.target === "client" && e.replyTo === null),
1583
- p((e) => e),
1584
- f(this.logReceived()),
1585
- p((e) => e)
1604
+ m((e) => e.type === t && e.target === "client" && e.replyTo === null),
1605
+ f((e) => e),
1606
+ g(this.logReceived()),
1607
+ f((e) => e)
1586
1608
  );
1587
1609
  }
1588
1610
  requestOAuthToken(t) {
@@ -1591,76 +1613,245 @@ class Ct {
1591
1613
  Array.isArray(t) || (t = [t]);
1592
1614
  const e = "OAUTH TOKEN", r = this.createMessage(e);
1593
1615
  r.providerTypes = t, this.logCreated(e, r);
1594
- const s = this.incomingMessages$.pipe(
1595
- g((i) => i.type === e && i.replyTo === r.id),
1596
- p((i) => i),
1597
- f(this.logReceived()),
1598
- m(1)
1616
+ const n = this.incomingMessages$.pipe(
1617
+ m((i) => i.type === e && i.replyTo === r.id),
1618
+ f((i) => i),
1619
+ g(this.logReceived()),
1620
+ w(1)
1599
1621
  );
1600
- return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), s;
1622
+ return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), n;
1601
1623
  }
1602
1624
  openUrl(t, e) {
1603
1625
  if (!this.isEmbedded())
1604
1626
  throw new d(this.currentContext);
1605
- const r = "OPEN URL", s = this.createMessage(r, !1);
1606
- s.url = t, s.data = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
1627
+ const r = "OPEN URL", n = this.createMessage(r, !1);
1628
+ n.url = t, n.data = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
1607
1629
  }
1608
- selectContacts(t, e, r, s) {
1630
+ selectContacts(t, e, r, n) {
1609
1631
  if (!this.isEmbedded())
1610
1632
  throw new d(this.currentContext);
1611
- if (e === "group" && s === void 0)
1612
- throw new I(
1613
- "currentContacts",
1614
- s,
1615
- "currentContacts is required for group streams"
1633
+ if (this.negotiatedProtocolVersion === "2.0") {
1634
+ if (e === void 0 || typeof e == "object")
1635
+ throw new y(
1636
+ "streamType",
1637
+ e,
1638
+ "streamType is missing or invalid"
1639
+ );
1640
+ if (r === void 0 || typeof r == "object" || typeof r == "number")
1641
+ throw new y(
1642
+ "contactType",
1643
+ r,
1644
+ "contactType is missing or invalid"
1645
+ );
1646
+ return this.selectContactsV2_0(
1647
+ t,
1648
+ e,
1649
+ r,
1650
+ n
1616
1651
  );
1617
- if (e === "direct" && s !== void 0)
1618
- throw new I(
1652
+ }
1653
+ if (typeof e < "u" && typeof e != "object")
1654
+ throw new y("options", e, "options is invalid");
1655
+ if (typeof r < "u" && !Array.isArray(r))
1656
+ throw new y(
1619
1657
  "currentContacts",
1620
- s,
1621
- "currentContacts should not be passed for direct streams"
1658
+ r,
1659
+ "currentContacts is invalid"
1622
1660
  );
1661
+ return this.selectContactsV2_1(t, e, r);
1662
+ }
1663
+ selectContactsV2_0(t, e, r, n) {
1664
+ if (!this.isEmbedded())
1665
+ throw new d(this.currentContext);
1666
+ n && n.length > 0 && (n = n.map((a) => a.type === "cloudUsername" && a.contactUser ? {
1667
+ ...a,
1668
+ cloudId: a.cloudId || a.contactUser.cloudId,
1669
+ networkId: a.networkId || a.contactUser.networkId,
1670
+ cloudUsername: a.cloudUsername || a.contactUser.cloudUsername
1671
+ } : a));
1623
1672
  const i = "SELECT CONTACTS", o = this.createMessage(i, !0);
1624
- o.streamType = e, o.streamId = t, o.contactType = r, o.currentContacts = s, this.logCreated(i, o);
1625
- const a = this.incomingMessages$.pipe(
1626
- g((c) => c.type === i && c.replyTo === o.id),
1627
- f(this.logReceived()),
1628
- // validate if `streamId` is the same as we sent
1629
- p((c) => {
1630
- const u = c;
1673
+ o.streamId = t, o.streamType = e, o.contactType = r, o.resultTypes = [r], o.currentContacts = n, this.logCreated(i, o);
1674
+ const c = this.incomingMessages$.pipe(
1675
+ m((a) => a.type === i && a.replyTo === o.id),
1676
+ g(this.logReceived()),
1677
+ f((a) => {
1678
+ const u = a;
1631
1679
  if (u.result === "success") {
1632
1680
  if (u.streamId !== t)
1633
- throw new tt(u.streamId, t);
1681
+ throw new ae(u.streamId, t);
1634
1682
  e === "direct" && u.contacts.length > 1 && (u.contacts = [u.contacts[0]]);
1635
1683
  }
1636
1684
  return u;
1637
1685
  }),
1638
- m(1)
1686
+ w(1)
1639
1687
  );
1640
- return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), a;
1688
+ return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), c;
1689
+ }
1690
+ selectContactsV2_1(t, e, r) {
1691
+ if (!this.isEmbedded())
1692
+ throw new d(this.currentContext);
1693
+ const n = {
1694
+ allowMultipleSelection: (e == null ? void 0 : e.allowMultipleSelection) ?? !1,
1695
+ resultTypes: (e == null ? void 0 : e.resultTypes) ?? ["cloudUsername"]
1696
+ };
1697
+ if (r && r.length > 0)
1698
+ for (const a of r) {
1699
+ if (a.contactId === void 0)
1700
+ throw new y(
1701
+ "currentContacts",
1702
+ r,
1703
+ "ContactItem contactId is required since v2.1 on all contacts"
1704
+ );
1705
+ if (a.type === "cloudUsername") {
1706
+ if (!a.contactUser)
1707
+ throw new y(
1708
+ "currentContacts",
1709
+ a,
1710
+ "CloudUsername contact must include contactUser since v2.1"
1711
+ );
1712
+ if (!a.contactUser.cloudId || !a.contactUser.networkId || !a.contactUser.cloudUsername)
1713
+ throw new y(
1714
+ "currentContacts",
1715
+ a,
1716
+ "CloudContact must define cloudUsername, cloudId, and networkId since v2.1"
1717
+ );
1718
+ }
1719
+ }
1720
+ const i = "SELECT CONTACTS", o = this.createMessage(i, !0);
1721
+ o.streamId = t, o.resultTypes = n.resultTypes, o.currentContacts = r, o.allowMultipleSelection = n.allowMultipleSelection, this.logCreated(i, o);
1722
+ const c = this.incomingMessages$.pipe(
1723
+ m((a) => a.type === i && a.replyTo === o.id),
1724
+ g(this.logReceived()),
1725
+ f((a) => {
1726
+ const u = a;
1727
+ if (u.result === "success") {
1728
+ if (u.streamId !== t)
1729
+ throw new ae(u.streamId, t);
1730
+ const h = u.contacts.length;
1731
+ u.contacts = u.contacts.filter(
1732
+ (l) => n.resultTypes.includes(l.type)
1733
+ ), u.contacts.length !== h && this.logService.debug(
1734
+ `[IPC] [SelectContactsReply] Filtered ${h - u.contacts.length} contacts from reply`
1735
+ ), !n.allowMultipleSelection && u.contacts.length > 1 && (u.contacts = [u.contacts[0]]);
1736
+ for (const l of u.contacts)
1737
+ if (l.type === "cloudUsername") {
1738
+ if (!l.contactUser)
1739
+ throw new Error(
1740
+ `CloudUsername contact must include contactUser since v2.1. ContactItem: ${JSON.stringify(
1741
+ l
1742
+ )}`
1743
+ );
1744
+ if (!l.contactUser.cloudId || !l.contactUser.networkId || !l.contactUser.cloudUsername)
1745
+ throw new Error(
1746
+ `CloudContact must define cloudUsername, cloudId, and networkId since v2.1. ContactItem: ${JSON.stringify(
1747
+ l
1748
+ )}`
1749
+ );
1750
+ }
1751
+ }
1752
+ return u;
1753
+ }),
1754
+ w(1)
1755
+ );
1756
+ return this.logService.debug(`Created ${i} Reply handler`), this.port2.postMessage(o), this.logSent(i, o), c;
1641
1757
  }
1642
- /**
1643
- * Request detailed contact information for the given Cloud usernames.
1644
- *
1645
- * @param contacts - Cloud usernames for which we need detailed contact information
1646
- *
1647
- * @returns Observable with a {@link MatchContactsMessageReply} instance containing the requested
1648
- * {@link ContactItem} information. Emits once.
1649
- */
1650
1758
  matchContacts(t) {
1651
1759
  if (!this.isEmbedded())
1652
1760
  throw new d(this.currentContext);
1761
+ if (!Array.isArray(t))
1762
+ throw new y("contacts", t, "contacts is not an array");
1653
1763
  if (!t.length)
1654
- throw new I("contacts", t, "At least one contact is required");
1655
- const e = "MATCH CONTACTS", r = this.createMessage(e);
1656
- r.contacts = [...t], this.logCreated(e, r);
1657
- const s = this.incomingMessages$.pipe(
1658
- g((i) => i.type === e && i.replyTo === r.id),
1659
- f(this.logReceived()),
1660
- p((i) => i),
1661
- m(1)
1764
+ throw new y("contacts", t, "At least one contact is required");
1765
+ const e = this.createMessage("MATCH CONTACTS");
1766
+ if (this.compareVersion("2.1") >= 0) {
1767
+ for (const n of t)
1768
+ if (n.type === "cloudUsername") {
1769
+ if (!n.contactUser)
1770
+ throw new y(
1771
+ "contacts",
1772
+ n,
1773
+ "CloudUsername contact must include contactUser"
1774
+ );
1775
+ if (!n.contactUser.cloudUsername || !n.contactUser.cloudId || !n.contactUser.networkId)
1776
+ throw new y(
1777
+ "contacts",
1778
+ n,
1779
+ "CloudContact must define cloudUsername, cloudId, and networkId"
1780
+ );
1781
+ }
1782
+ e.contacts = [...t];
1783
+ } else {
1784
+ for (const n of t)
1785
+ n.type === "cloudUsername" && n.contactUser && (n.cloudId = n.contactUser.cloudId, n.networkId = n.contactUser.networkId, n.cloudUsername = n.contactUser.cloudUsername);
1786
+ e.contacts = [...t];
1787
+ }
1788
+ this.logCreated(e.type, e);
1789
+ const r = this.incomingMessages$.pipe(
1790
+ m((n) => n.type === e.type && n.replyTo === e.id),
1791
+ g(this.logReceived()),
1792
+ f((n) => {
1793
+ const i = n;
1794
+ if (this.compareVersion("2.1") >= 0) {
1795
+ if (Array.isArray(i.contacts))
1796
+ throw new Error(
1797
+ "MatchContactsMessageReply should return a Record<string, DetailedContactItem> of contacts when using IPC Protocol v2.1+"
1798
+ );
1799
+ for (const [o, c] of Object.entries(i.contacts)) {
1800
+ if (c == null) {
1801
+ this.logService.debug(
1802
+ `[IPC] [MatchContactsReply] Received null or undefined contact for ${o}`
1803
+ );
1804
+ continue;
1805
+ }
1806
+ if (c.contactId === void 0)
1807
+ throw new Error(
1808
+ `ContactItem 'contactId' is required since v2.1. ContactItem: ${JSON.stringify(
1809
+ c
1810
+ )}`
1811
+ );
1812
+ if (!c.contactUser && (!c.uri || c.uri.length === 0) && (!c.numbers || c.numbers.length === 0))
1813
+ throw new Error(
1814
+ `DetailedContactItem must define at least one contact method (contactUser, uri, or numbers). ContactItem: ${JSON.stringify(
1815
+ c
1816
+ )}`
1817
+ );
1818
+ if (c.contactUser && (!c.contactUser.cloudId || !c.contactUser.networkId || !c.contactUser.cloudUsername))
1819
+ throw new Error(
1820
+ `When contactUser is defined, cloudId, networkId, and cloudUsername must also be defined. ContactItem: ${JSON.stringify(
1821
+ c
1822
+ )}`
1823
+ );
1824
+ }
1825
+ } else {
1826
+ if (!Array.isArray(i.contacts))
1827
+ throw new Error(
1828
+ "MatchContactsMessageReply should return an array of contacts when using IPC Protocol v2.0"
1829
+ );
1830
+ if (i.contacts.length !== e.contacts.length)
1831
+ throw new Error(
1832
+ "The number of contacts in the reply does not match the number of contacts in the request"
1833
+ );
1834
+ for (const o of i.contacts) {
1835
+ const c = o;
1836
+ if (c.type === "cloudUsername" && !("cloudUsername" in c))
1837
+ throw new Error(
1838
+ `CloudUsernameDetailedContactItem must define cloudUsername. ContactItem: ${JSON.stringify(
1839
+ o
1840
+ )}`
1841
+ );
1842
+ if (c.type === "uri" && (!("uri" in c) || !Array.isArray(c.uri)))
1843
+ throw new Error(
1844
+ `UriDetailedContactItem must define uri as an array. ContactItem: ${JSON.stringify(
1845
+ o
1846
+ )}`
1847
+ );
1848
+ }
1849
+ }
1850
+ return i;
1851
+ }),
1852
+ w(1)
1662
1853
  );
1663
- return this.logService.debug(`Created ${e} Reply handler`), this.port2.postMessage(r), this.logSent(e, r), s;
1854
+ return this.logService.debug(`Created ${e.type} Reply handler`), this.port2.postMessage(e), this.logSent(e.type, e), r;
1664
1855
  }
1665
1856
  /**
1666
1857
  * Setup listener for {@link PushMessageMessage}, which can be sent by a Host app to forward an
@@ -1693,9 +1884,9 @@ class Ct {
1693
1884
  throw new d(this.currentContext);
1694
1885
  const t = "PUSH MESSAGE";
1695
1886
  return this.incomingMessages$.pipe(
1696
- g((e) => e.type === t && e.target === "client"),
1697
- p((e) => e),
1698
- f(this.logReceived())
1887
+ m((e) => e.type === t && e.target === "client"),
1888
+ f((e) => e),
1889
+ g(this.logReceived())
1699
1890
  );
1700
1891
  }
1701
1892
  /**
@@ -1713,10 +1904,10 @@ class Ct {
1713
1904
  const t = "PUSH TOKEN", e = this.createMessage(t);
1714
1905
  this.logCreated(t, e);
1715
1906
  const r = this.incomingMessages$.pipe(
1716
- g((s) => s.type === t && s.replyTo === e.id),
1717
- f(this.logReceived()),
1718
- p((s) => s),
1719
- m(1)
1907
+ m((n) => n.type === t && n.replyTo === e.id),
1908
+ g(this.logReceived()),
1909
+ f((n) => n),
1910
+ w(1)
1720
1911
  );
1721
1912
  return this.logService.debug(`Created ${t} Reply handler`), this.port2.postMessage(e), this.logSent(t, e), r;
1722
1913
  }
@@ -1752,16 +1943,16 @@ class Ct {
1752
1943
  throw new d(this.currentContext);
1753
1944
  const t = "PUSH TOKEN";
1754
1945
  return this.incomingMessages$.pipe(
1755
- g(
1946
+ m(
1756
1947
  (e) => e.type === t && e.target === "client" && e.replyTo === null && e.expectReply === !1
1757
1948
  ),
1758
- p((e) => {
1949
+ f((e) => {
1759
1950
  if (e.pushToken && e.selector && e.appId)
1760
1951
  return e;
1761
1952
  throw new Error("PushTokenMessage is missing required PushTokenPayload fields");
1762
1953
  }),
1763
- f((e) => e.pushToken),
1764
- f(this.logReceived())
1954
+ g((e) => e.pushToken),
1955
+ g(this.logReceived())
1765
1956
  );
1766
1957
  }
1767
1958
  /**
@@ -1776,9 +1967,9 @@ class Ct {
1776
1967
  throw new d(this.currentContext);
1777
1968
  const t = "BADGE QUERY";
1778
1969
  return this.incomingMessages$.pipe(
1779
- g((e) => e.type === t && e.target === "client"),
1780
- p((e) => e),
1781
- f(this.logReceived())
1970
+ m((e) => e.type === t && e.target === "client"),
1971
+ f((e) => e),
1972
+ g(this.logReceived())
1782
1973
  );
1783
1974
  }
1784
1975
  /**
@@ -1796,8 +1987,8 @@ class Ct {
1796
1987
  sendBadgeUpdateMessage(t, e, r) {
1797
1988
  if (!this.isEmbedded())
1798
1989
  throw new d(this.currentContext);
1799
- const s = "BADGE UPDATE", i = this.createMessage(s, !1, r);
1800
- i.count = t, i.activity = e ?? !1, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i);
1990
+ const n = "BADGE UPDATE", i = this.createMessage(n, !1, r);
1991
+ i.count = t, i.activity = e ?? !1, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i);
1801
1992
  }
1802
1993
  /**
1803
1994
  * Sends a {@link LifecycleMessage} to the Host app, to notify it of a lifecycle event.
@@ -1815,8 +2006,8 @@ class Ct {
1815
2006
  sendLifecycleMessage(t, e) {
1816
2007
  if (!this.isEmbedded())
1817
2008
  throw new d(this.currentContext);
1818
- const r = "LIFECYCLE", s = this.createMessage(r, !1);
1819
- s.eventName = t, s.payload = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2009
+ const r = "LIFECYCLE", n = this.createMessage(r, !1);
2010
+ n.eventName = t, n.payload = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
1820
2011
  }
1821
2012
  /**
1822
2013
  * Setup listener for {@link LifecycleMessage}, which can be sent by a `Host` app to notify the
@@ -1834,9 +2025,9 @@ class Ct {
1834
2025
  throw new d(this.currentContext);
1835
2026
  const t = "LIFECYCLE";
1836
2027
  return this.incomingMessages$.pipe(
1837
- g((e) => e.type === t && e.target === "client"),
1838
- p((e) => e),
1839
- f(this.logReceived())
2028
+ m((e) => e.type === t && e.target === "client"),
2029
+ f((e) => e),
2030
+ g(this.logReceived())
1840
2031
  );
1841
2032
  }
1842
2033
  /**
@@ -1854,8 +2045,8 @@ class Ct {
1854
2045
  sendLogMessage(t, e) {
1855
2046
  if (!this.isEmbedded())
1856
2047
  throw new d(this.currentContext);
1857
- const r = "LOG", s = this.createMessage(r, !1);
1858
- s.level = t, s.message = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2048
+ const r = "LOG", n = this.createMessage(r, !1);
2049
+ n.level = t, n.message = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
1859
2050
  }
1860
2051
  /**
1861
2052
  * Setup listener for {@link RequestLogsMessage}, which can be sent by a `Host` app to request
@@ -1874,9 +2065,9 @@ class Ct {
1874
2065
  throw new d(this.currentContext);
1875
2066
  const t = "REQUEST LOGS";
1876
2067
  return this.incomingMessages$.pipe(
1877
- g((e) => e.type === t && e.target === "client"),
1878
- p((e) => e),
1879
- f(this.logReceived())
2068
+ m((e) => e.type === t && e.target === "client"),
2069
+ f((e) => e),
2070
+ g(this.logReceived())
1880
2071
  );
1881
2072
  }
1882
2073
  /**
@@ -1889,11 +2080,11 @@ class Ct {
1889
2080
  * @param format - Format of the file. Can be either `gzip` or `text`
1890
2081
  * @param replyTo - The message ID to which the reply should be sent
1891
2082
  */
1892
- sendRequestLogsMessageReply(t, e, r, s, i) {
2083
+ sendRequestLogsMessageReply(t, e, r, n, i) {
1893
2084
  if (!this.isEmbedded())
1894
2085
  throw new d(this.currentContext);
1895
- const o = "REQUEST LOGS", a = this.createMessage(o, !1, i);
1896
- a.fileId = t, a.fileHash = e, a.fileSize = r, a.format = s, this.logCreated(o, a), this.port2.postMessage(a), this.logSent(o, a);
2086
+ const o = "REQUEST LOGS", c = this.createMessage(o, !1, i);
2087
+ c.fileId = t, c.fileHash = e, c.fileSize = r, c.format = n, this.logCreated(o, c), this.port2.postMessage(c), this.logSent(o, c);
1897
2088
  }
1898
2089
  /**
1899
2090
  * Send a {@link ViewTransitionMessage} to the `Host` app, notifying it of a view transition
@@ -1911,8 +2102,8 @@ class Ct {
1911
2102
  sendViewTransitionMessage(t, e) {
1912
2103
  if (!this.isEmbedded())
1913
2104
  throw new d(this.currentContext);
1914
- const r = "VIEW TRANSITION", s = this.createMessage(r, !1);
1915
- s.transitionType = t, s.targetView = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2105
+ const r = "VIEW TRANSITION", n = this.createMessage(r, !1);
2106
+ n.transitionType = t, n.targetView = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
1916
2107
  }
1917
2108
  /**
1918
2109
  * Sends a {@link FileRequestMessage} to the Host app, to request a file by it's SHA256 hash.
@@ -1955,31 +2146,31 @@ class Ct {
1955
2146
  * @returns An observable that either emits once if the result is `error` or `not found` or
1956
2147
  * emits as many times as the number of chunks in the file if the result is `success`.
1957
2148
  */
1958
- sendFileRequestMessage(t, e, r, s, i) {
2149
+ sendFileRequestMessage(t, e, r, n, i) {
1959
2150
  if (!this.isEmbedded())
1960
2151
  throw new d(this.currentContext);
1961
- const o = "FILE REQUEST", a = this.createMessage(o);
1962
- if (a.fileId = t, a.fileHash = e.toLowerCase(), a.intent = r, a.maxChunkSizeInBytes = i, r === "attachment") {
1963
- if (!s)
1964
- throw new I(
2152
+ const o = "FILE REQUEST", c = this.createMessage(o);
2153
+ if (c.fileId = t, c.fileHash = e.toLowerCase(), c.intent = r, c.maxChunkSizeInBytes = i, r === "attachment") {
2154
+ if (!n)
2155
+ throw new y(
1965
2156
  "streamId",
1966
- s,
2157
+ n,
1967
2158
  "streamId is required for attachment intent"
1968
2159
  );
1969
- a.streamId = s;
2160
+ c.streamId = n;
1970
2161
  }
1971
- this.logCreated(o, a);
1972
- let c = 0;
2162
+ this.logCreated(o, c);
2163
+ let a = 0;
1973
2164
  const u = this.incomingMessages$.pipe(
1974
- g(
1975
- (l) => l.type === o && l.replyTo === a.id
2165
+ m(
2166
+ (h) => h.type === o && h.replyTo === c.id
1976
2167
  ),
1977
- f(this.logReceived()),
1978
- f(() => c++),
1979
- p((l) => (l.result === "success" && (l.chunkHash = l.chunkHash.toLowerCase(), l.fileHash = l.fileHash.toLowerCase()), l)),
1980
- mt((l) => l.result === "success" && c < l.totalChunks, !0)
2168
+ g(this.logReceived()),
2169
+ g(() => a++),
2170
+ f((h) => (h.result === "success" && (h.chunkHash = h.chunkHash.toLowerCase(), h.fileHash = h.fileHash.toLowerCase()), h)),
2171
+ wt((h) => h.result === "success" && a < h.totalChunks, !0)
1981
2172
  );
1982
- return this.port2.postMessage(a), this.logSent(o, a), u;
2173
+ return this.port2.postMessage(c), this.logSent(o, c), u;
1983
2174
  }
1984
2175
  /**
1985
2176
  * Sends a {@link FileRequestMessageReply} to the Host app, to reply to a
@@ -2003,11 +2194,11 @@ class Ct {
2003
2194
  sendFileRequestMessageReply(t, e) {
2004
2195
  if (!this.isEmbedded())
2005
2196
  throw new d(this.currentContext);
2006
- const r = "FILE REQUEST", s = Object.assign(
2197
+ const r = "FILE REQUEST", n = Object.assign(
2007
2198
  e,
2008
2199
  this.createMessage(r, !1, t.id)
2009
2200
  );
2010
- this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2201
+ this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2011
2202
  }
2012
2203
  /**
2013
2204
  * Setup a listener for {@link FileRequestMessage}, which can be sent by a Host app to request a
@@ -2026,11 +2217,11 @@ class Ct {
2026
2217
  throw new d(this.currentContext);
2027
2218
  const t = "FILE REQUEST";
2028
2219
  return this.incomingMessages$.pipe(
2029
- g(
2220
+ m(
2030
2221
  (e) => e.type === t && e.target === "client" && e.replyTo === null
2031
2222
  ),
2032
- p((e) => (e.fileHash = e.fileHash.toLowerCase(), e)),
2033
- f(this.logReceived())
2223
+ f((e) => (e.fileHash = e.fileHash.toLowerCase(), e)),
2224
+ g(this.logReceived())
2034
2225
  );
2035
2226
  }
2036
2227
  /**
@@ -2055,38 +2246,38 @@ class Ct {
2055
2246
  *
2056
2247
  * @returns This method returns void.
2057
2248
  */
2058
- sendFileSelectionMessage(t = "attachment", e, r, s, i, o) {
2249
+ sendFileSelectionMessage(t = "attachment", e, r, n, i, o) {
2059
2250
  if (!this.isEmbedded())
2060
2251
  throw new d(this.currentContext);
2061
- const a = "FILE SELECTION", c = this.createMessage(a);
2062
- if (c.intent = t, c.maxCount = s, c.maxFileSizeInBytes = i, c.mimeTypes = o, t === "attachment") {
2252
+ const c = "FILE SELECTION", a = this.createMessage(c);
2253
+ if (a.intent = t, a.maxCount = n, a.maxFileSizeInBytes = i, a.mimeTypes = o, t === "attachment") {
2063
2254
  if (!e)
2064
- throw new I(
2255
+ throw new y(
2065
2256
  "streamId",
2066
2257
  e,
2067
2258
  "streamId is required for attachment intent"
2068
2259
  );
2069
2260
  if (!r)
2070
- throw new I(
2261
+ throw new y(
2071
2262
  "correlationId",
2072
2263
  r,
2073
2264
  "correlationId is required for attachment intent"
2074
2265
  );
2075
- c.streamId = e, c.correlationId = r;
2266
+ a.streamId = e, a.correlationId = r;
2076
2267
  }
2077
- this.logCreated(a, c);
2268
+ this.logCreated(c, a);
2078
2269
  const u = this.incomingMessages$.pipe(
2079
- g(
2080
- (l) => l.type === a && l.replyTo === c.id
2270
+ m(
2271
+ (h) => h.type === c && h.replyTo === a.id
2081
2272
  ),
2082
- p((l) => {
2083
- var h;
2084
- return l.result === "success" && (l.files = (h = l.files) == null ? void 0 : h.map((b) => (b.original.fileHash = b.original.fileHash.toLowerCase(), b.preview && (b.preview.fileHash = b.preview.fileHash.toLowerCase()), b))), l;
2273
+ f((h) => {
2274
+ var l;
2275
+ 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;
2085
2276
  }),
2086
- f(this.logReceived()),
2087
- m(1)
2277
+ g(this.logReceived()),
2278
+ w(1)
2088
2279
  );
2089
- return this.port2.postMessage(c), this.logSent(a, c), u;
2280
+ return this.port2.postMessage(a), this.logSent(c, a), u;
2090
2281
  }
2091
2282
  /**
2092
2283
  * Sends a {@link FileDownloadProgressQueryMessage} to the Host app, to query the progress of a
@@ -2110,20 +2301,20 @@ class Ct {
2110
2301
  sendFileDownloadProgressQueryMessage(t, e, r) {
2111
2302
  if (!this.isEmbedded())
2112
2303
  throw new d(this.currentContext);
2113
- const s = "FILE DOWNLOAD PROGRESS QUERY", i = this.createMessage(
2114
- s,
2304
+ const n = "FILE DOWNLOAD PROGRESS QUERY", i = this.createMessage(
2305
+ n,
2115
2306
  !0
2116
2307
  );
2117
- i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(s, i);
2308
+ i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(n, i);
2118
2309
  const o = this.incomingMessages$.pipe(
2119
- g(
2120
- (a) => a.type === "FILE DOWNLOAD PROGRESS UPDATE" && a.replyTo === i.id
2310
+ m(
2311
+ (c) => c.type === "FILE DOWNLOAD PROGRESS UPDATE" && c.replyTo === i.id
2121
2312
  ),
2122
- f((a) => this.logReceived(a)),
2123
- p((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
2124
- m(1)
2313
+ g((c) => this.logReceived(c)),
2314
+ f((c) => (c.fileHash && (c.fileHash = c.fileHash.toLowerCase()), c)),
2315
+ w(1)
2125
2316
  );
2126
- return this.port2.postMessage(i), this.logSent(s, i), o;
2317
+ return this.port2.postMessage(i), this.logSent(n, i), o;
2127
2318
  }
2128
2319
  /**
2129
2320
  * Setup listener for {@link FileDownloadProgressQueryMessage}, which can be sent by a `Host` app
@@ -2137,11 +2328,11 @@ class Ct {
2137
2328
  throw new d(this.currentContext);
2138
2329
  const t = "FILE DOWNLOAD PROGRESS UPDATE";
2139
2330
  return this.incomingMessages$.pipe(
2140
- g(
2331
+ m(
2141
2332
  (e) => e.type === t && e.target === "client" && e.replyTo === null
2142
2333
  ),
2143
- p((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
2144
- f(this.logReceived())
2334
+ f((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
2335
+ g(this.logReceived())
2145
2336
  );
2146
2337
  }
2147
2338
  /**
@@ -2161,20 +2352,20 @@ class Ct {
2161
2352
  sendFileUploadProgressQueryMessage(t, e, r) {
2162
2353
  if (!this.isEmbedded())
2163
2354
  throw new d(this.currentContext);
2164
- const s = "FILE UPLOAD PROGRESS QUERY", i = this.createMessage(
2165
- s,
2355
+ const n = "FILE UPLOAD PROGRESS QUERY", i = this.createMessage(
2356
+ n,
2166
2357
  !0
2167
2358
  );
2168
- i.fileHash = t.toLowerCase(), i.fileId = e, i.correlationId = r, this.logCreated(s, i);
2359
+ i.fileHash = t.toLowerCase(), i.fileId = e, i.correlationId = r, this.logCreated(n, i);
2169
2360
  const o = this.incomingMessages$.pipe(
2170
- g(
2171
- (a) => a.type === "FILE UPLOAD PROGRESS UPDATE" && a.replyTo === i.id
2361
+ m(
2362
+ (c) => c.type === "FILE UPLOAD PROGRESS UPDATE" && c.replyTo === i.id
2172
2363
  ),
2173
- f(this.logReceived()),
2174
- p((a) => (a.fileHash && (a.fileHash = a.fileHash.toLowerCase()), a)),
2175
- m(1)
2364
+ g(this.logReceived()),
2365
+ f((c) => (c.fileHash && (c.fileHash = c.fileHash.toLowerCase()), c)),
2366
+ w(1)
2176
2367
  );
2177
- return this.port2.postMessage(i), this.logSent(s, i), o;
2368
+ return this.port2.postMessage(i), this.logSent(n, i), o;
2178
2369
  }
2179
2370
  /**
2180
2371
  * Setup listener for {@link FileUploadProgressQueryMessage}, which can be sent by a `Host` app to
@@ -2192,11 +2383,11 @@ class Ct {
2192
2383
  throw new d(this.currentContext);
2193
2384
  const t = "FILE UPLOAD PROGRESS UPDATE";
2194
2385
  return this.incomingMessages$.pipe(
2195
- g(
2386
+ m(
2196
2387
  (e) => e.type === t && e.target === "client" && e.replyTo === null
2197
2388
  ),
2198
- p((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
2199
- f(this.logReceived())
2389
+ f((e) => (e.fileHash && (e.fileHash = e.fileHash.toLowerCase()), e)),
2390
+ g(this.logReceived())
2200
2391
  );
2201
2392
  }
2202
2393
  /**
@@ -2224,18 +2415,39 @@ class Ct {
2224
2415
  * @returns An observable which emits a {@link FileDownloadMessageReply} instance containing the
2225
2416
  * result of the request. Emits once.
2226
2417
  */
2227
- sendFileDownloadMessage(t, e, r, s, i, o, a, c, u) {
2418
+ sendFileDownloadMessage(t, e, r, n, i, o, c, a, u) {
2228
2419
  if (!this.isEmbedded())
2229
2420
  throw new d(this.currentContext);
2230
- const l = "FILE DOWNLOAD", h = this.createMessage(l, !0);
2231
- h.url = t, h.key = e, h.fileHash = r.toLowerCase(), h.mimeType = s, h.fileName = i, h.streamId = o, h.correlationId = a, h.sender = c, h.intent = u ?? "download", this.logCreated(l, h);
2421
+ if (a && this.compareVersion("2.1") < 0)
2422
+ a.type === "cloudUsername" && a.contactUser && (a = {
2423
+ ...a,
2424
+ cloudId: a.cloudId || a.contactUser.cloudId,
2425
+ networkId: a.networkId || a.contactUser.networkId,
2426
+ cloudUsername: a.cloudUsername || a.contactUser.cloudUsername
2427
+ });
2428
+ else if (a && this.compareVersion("2.1") >= 0 && a.type === "cloudUsername") {
2429
+ if (!a.contactUser)
2430
+ throw new y(
2431
+ "sender",
2432
+ a,
2433
+ "CloudUsername contact must include contactUser since v2.1"
2434
+ );
2435
+ if (!a.contactUser.cloudId || !a.contactUser.networkId || !a.contactUser.cloudUsername)
2436
+ throw new y(
2437
+ "sender",
2438
+ a,
2439
+ "CloudContact must define cloudUsername, cloudId, and networkId since v2.1"
2440
+ );
2441
+ }
2442
+ const h = "FILE DOWNLOAD", l = this.createMessage(h, !0);
2443
+ 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);
2232
2444
  const b = this.incomingMessages$.pipe(
2233
- g((v) => v.type === l && v.replyTo === h.id),
2234
- f(this.logReceived()),
2235
- p((v) => v),
2236
- m(1)
2445
+ m((p) => p.type === h && p.replyTo === l.id),
2446
+ g(this.logReceived()),
2447
+ f((p) => p),
2448
+ w(1)
2237
2449
  );
2238
- return this.port2.postMessage(h), this.logSent(l, h), b;
2450
+ return this.port2.postMessage(l), this.logSent(h, l), b;
2239
2451
  }
2240
2452
  /**
2241
2453
  * Sends a {@link CancelFileDownloadMessage} to the Host app, to cancel downloading of a file
@@ -2248,8 +2460,8 @@ class Ct {
2248
2460
  sendCancelFileDownloadMessage(t, e, r) {
2249
2461
  if (!this.isEmbedded())
2250
2462
  throw new d(this.currentContext);
2251
- const s = "CANCEL FILE DOWNLOAD", i = this.createMessage(s, !1);
2252
- i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(s, i), this.port2.postMessage(i), this.logSent(s, i);
2463
+ const n = "CANCEL FILE DOWNLOAD", i = this.createMessage(n, !1);
2464
+ i.fileHash = t.toLowerCase(), i.url = e, i.correlationId = r, this.logCreated(n, i), this.port2.postMessage(i), this.logSent(n, i);
2253
2465
  }
2254
2466
  /**
2255
2467
  * Sends a {@link FileRemoveMessage} to the Host app, to request removal of a file from the
@@ -2269,15 +2481,15 @@ class Ct {
2269
2481
  sendFileRemoveMessage(t, e) {
2270
2482
  if (!this.isEmbedded())
2271
2483
  throw new d(this.currentContext);
2272
- const r = "FILE REMOVE", s = this.createMessage(r, !0);
2273
- s.hash = t.toLowerCase(), s.streamId = e, this.logCreated(r, s);
2484
+ const r = "FILE REMOVE", n = this.createMessage(r, !0);
2485
+ n.hash = t.toLowerCase(), n.streamId = e, this.logCreated(r, n);
2274
2486
  const i = this.incomingMessages$.pipe(
2275
- g((o) => o.type === r && o.replyTo === s.id),
2276
- f(this.logReceived()),
2277
- p((o) => o),
2278
- m(1)
2487
+ m((o) => o.type === r && o.replyTo === n.id),
2488
+ g(this.logReceived()),
2489
+ f((o) => o),
2490
+ w(1)
2279
2491
  );
2280
- return this.port2.postMessage(s), this.logSent(r, s), i;
2492
+ return this.port2.postMessage(n), this.logSent(r, n), i;
2281
2493
  }
2282
2494
  /**
2283
2495
  * Sends a {@link AppResetMessage} to the Host app, to request logging out the user and resetting
@@ -2319,8 +2531,8 @@ class Ct {
2319
2531
  sendMessageSentMessage(t, e) {
2320
2532
  if (!this.isEmbedded())
2321
2533
  throw new d(this.currentContext);
2322
- const r = "MESSAGE SENT", s = this.createMessage(r, !1);
2323
- s.streamId = t, s.correlationId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2534
+ const r = "MESSAGE SENT", n = this.createMessage(r, !1);
2535
+ n.streamId = t, n.correlationId = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2324
2536
  }
2325
2537
  /**
2326
2538
  * Sends a {@link SendMessageMessage} to the Host app, to send a message to the specified stream.
@@ -2340,18 +2552,45 @@ class Ct {
2340
2552
  * @returns An observable which emits a {@link SendMessageMessageReply} instance containing the
2341
2553
  * result of the request. Emits once.
2342
2554
  */
2343
- sendSendMessageMessage(t, e, r, s = "TEXT", i, o, a, c = !0, u) {
2555
+ sendSendMessageMessage(t, e, r, n = "TEXT", i, o, c, a = !0, u) {
2344
2556
  if (!this.isEmbedded())
2345
2557
  throw new d(this.currentContext);
2346
- const l = "SEND MESSAGE", h = this.createMessage(l, !0);
2347
- h.streamId = t, h.correlationId = e, h.body = r, h.messageType = s, h.mentions = i ?? [], h.attachments = (o == null ? void 0 : o.map((v) => v.toLowerCase())) ?? [], h.relatedMessageId = a, h.setCursors = c, h.threadId = u, this.logCreated(l, h);
2558
+ const h = "SEND MESSAGE", l = this.createMessage(h, !0);
2559
+ if (l.streamId = t, l.correlationId = e, l.body = r, l.messageType = n, i && i.length > 0)
2560
+ if (this.compareVersion("2.1") < 0)
2561
+ l.mentions = i.map((p) => p.contactUser ? {
2562
+ ...p,
2563
+ cloudId: p.cloudId || p.contactUser.cloudId,
2564
+ networkId: p.networkId || p.contactUser.networkId,
2565
+ cloudUsername: p.cloudUsername || p.contactUser.cloudUsername
2566
+ } : p);
2567
+ else {
2568
+ for (const p of i) {
2569
+ if (p.type === "cloudUsername" && !p.contactUser)
2570
+ throw new y(
2571
+ "mentions",
2572
+ p,
2573
+ "CloudUsername mention must include contactUser"
2574
+ );
2575
+ if (p.contactUser && (!p.contactUser.cloudId || !p.contactUser.networkId || !p.contactUser.cloudUsername))
2576
+ throw new y(
2577
+ "mentions",
2578
+ p,
2579
+ "CloudContact must define cloudUsername, cloudId, and networkId"
2580
+ );
2581
+ }
2582
+ l.mentions = i;
2583
+ }
2584
+ else
2585
+ l.mentions = [];
2586
+ l.attachments = (o == null ? void 0 : o.map((p) => p.toLowerCase())) ?? [], l.relatedMessageId = c, l.setCursors = a, l.threadId = u, this.logCreated(h, l);
2348
2587
  const b = this.incomingMessages$.pipe(
2349
- g((v) => v.type === l && v.replyTo === h.id),
2350
- f(this.logReceived()),
2351
- p((v) => v),
2352
- m(1)
2588
+ m((p) => p.type === h && p.replyTo === l.id),
2589
+ g(this.logReceived()),
2590
+ f((p) => p),
2591
+ w(1)
2353
2592
  );
2354
- return this.port2.postMessage(h), this.logSent(l, h), b;
2593
+ return this.port2.postMessage(l), this.logSent(h, l), b;
2355
2594
  }
2356
2595
  /**
2357
2596
  * Sends a {@link CancelSendMessageMessage} to the Host app, to cancel a message that was being
@@ -2365,8 +2604,8 @@ class Ct {
2365
2604
  sendCancelSendMessageMessage(t, e) {
2366
2605
  if (!this.isEmbedded())
2367
2606
  throw new d(this.currentContext);
2368
- const r = "CANCEL SEND MESSAGE", s = this.createMessage(r, !1);
2369
- s.streamId = t, s.correlationId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2607
+ const r = "CANCEL SEND MESSAGE", n = this.createMessage(r, !1);
2608
+ n.streamId = t, n.correlationId = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2370
2609
  }
2371
2610
  /**
2372
2611
  * Sends a {@link MessageDeletedMessage} to the Host app, to notify deletion of a message from the
@@ -2378,8 +2617,8 @@ class Ct {
2378
2617
  sendMessageDeletedMessage(t, e) {
2379
2618
  if (!this.isEmbedded())
2380
2619
  throw new d(this.currentContext);
2381
- const r = "MESSAGE DELETED", s = this.createMessage(r, !1);
2382
- s.correlationId = t, s.streamId = e, this.logCreated(r, s), this.port2.postMessage(s), this.logSent(r, s);
2620
+ const r = "MESSAGE DELETED", n = this.createMessage(r, !1);
2621
+ n.correlationId = t, n.streamId = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2383
2622
  }
2384
2623
  /**
2385
2624
  * Sends a {@link SendMessageStatusQueryMessage} to the Host app, to query the status of a message
@@ -2397,17 +2636,17 @@ class Ct {
2397
2636
  sendSendMessageStatusQueryMessage(t, e) {
2398
2637
  if (!this.isEmbedded())
2399
2638
  throw new d(this.currentContext);
2400
- const r = "SEND MESSAGE STATUS QUERY", s = this.createMessage(r, !0);
2401
- s.correlationId = t, s.streamId = e, this.logCreated(r, s);
2639
+ const r = "SEND MESSAGE STATUS QUERY", n = this.createMessage(r, !0);
2640
+ n.correlationId = t, n.streamId = e, this.logCreated(r, n);
2402
2641
  const i = this.incomingMessages$.pipe(
2403
- g(
2404
- (o) => o.type === "SEND MESSAGE STATUS UPDATE" && o.replyTo === s.id
2642
+ m(
2643
+ (o) => o.type === "SEND MESSAGE STATUS UPDATE" && o.replyTo === n.id
2405
2644
  ),
2406
- f(this.logReceived()),
2407
- p((o) => o),
2408
- m(1)
2645
+ g(this.logReceived()),
2646
+ f((o) => o),
2647
+ w(1)
2409
2648
  );
2410
- return this.port2.postMessage(s), this.logSent(r, s), i;
2649
+ return this.port2.postMessage(n), this.logSent(r, n), i;
2411
2650
  }
2412
2651
  /**
2413
2652
  * Setup a listener for {@link SendMessageStatusUpdateMessage}, which can be sent by a Host app to
@@ -2421,23 +2660,105 @@ class Ct {
2421
2660
  throw new d(this.currentContext);
2422
2661
  const t = "SEND MESSAGE STATUS UPDATE";
2423
2662
  return this.incomingMessages$.pipe(
2424
- g((e) => e.type === t && e.target === "client" && e.replyTo === null),
2425
- p((e) => e),
2426
- f(this.logReceived())
2663
+ m((e) => e.type === t && e.target === "client" && e.replyTo === null),
2664
+ f((e) => e),
2665
+ g(this.logReceived())
2427
2666
  );
2428
2667
  }
2429
2668
  /**
2430
- * Sends a {@link SipCallMessage} to the Host app to initiate a SIP call between the current user
2431
- * and the callee.
2669
+ * Send a SIP call message to the Host app.
2670
+ *
2671
+ * @remarks
2672
+ * This message is used to initiate a SIP call to the specified contact.
2432
2673
  *
2433
2674
  * @param contact - The {@link ContactItem} for the callee.
2434
2675
  */
2435
2676
  sendSipCallMessage(t) {
2436
2677
  if (!this.isEmbedded())
2437
2678
  throw new d(this.currentContext);
2679
+ if (this.compareVersion("2.1") < 0)
2680
+ t.type === "cloudUsername" && t.contactUser && (t = {
2681
+ ...t,
2682
+ cloudId: t.cloudId || t.contactUser.cloudId,
2683
+ networkId: t.networkId || t.contactUser.networkId,
2684
+ cloudUsername: t.cloudUsername || t.contactUser.cloudUsername
2685
+ });
2686
+ else if (t.type === "cloudUsername") {
2687
+ if (!t.contactUser)
2688
+ throw new y(
2689
+ "contact",
2690
+ t,
2691
+ "CloudUsername contact must include contactUser since v2.1"
2692
+ );
2693
+ if (!t.contactUser.cloudId || !t.contactUser.networkId || !t.contactUser.cloudUsername)
2694
+ throw new y(
2695
+ "contact",
2696
+ t,
2697
+ "CloudContact must define cloudUsername, cloudId, and networkId since v2.1"
2698
+ );
2699
+ }
2438
2700
  const e = "SIP CALL", r = this.createMessage(e, !1);
2439
2701
  r.contact = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
2440
2702
  }
2703
+ sendCustomFunctionMessage(t, e) {
2704
+ if (!this.isEmbedded())
2705
+ throw new d(this.currentContext);
2706
+ const r = "CUSTOM FUNCTION", n = this.createMessage(r, !1);
2707
+ n.customFunctionId = t, n.context = e, this.logCreated(r, n), this.port2.postMessage(n), this.logSent(r, n);
2708
+ }
2709
+ /**
2710
+ * Sends a {@link SubscribeButtonsMessage} to the Host app to subscribe to button updates for
2711
+ * specific locations.
2712
+ *
2713
+ * @remarks
2714
+ * The host will respond with BUTTONS messages containing the current button configurations
2715
+ * for the subscribed locations.
2716
+ *
2717
+ * @param subscribe - Subscription configuration for different button locations
2718
+ *
2719
+ * @returns This method returns void.
2720
+ */
2721
+ sendSubscribeButtonsMessage(t) {
2722
+ if (!this.isEmbedded())
2723
+ throw new d(this.currentContext);
2724
+ const e = "SUBSCRIBE BUTTONS", r = this.createMessage(e, !1);
2725
+ r.subscribe = t, this.logCreated(e, r), this.port2.postMessage(r), this.logSent(e, r);
2726
+ }
2727
+ /**
2728
+ * Setup listener for {@link ButtonsMessage}, which can be sent by a Host app to provide button
2729
+ * configurations for subscribed locations.
2730
+ *
2731
+ * @remarks
2732
+ * This message is sent in response to a SUBSCRIBE BUTTONS message or when button configurations
2733
+ * change for subscribed locations.
2734
+ *
2735
+ * @example
2736
+ * Here is an example of how a listener can be setup:
2737
+ *
2738
+ * ```ts
2739
+ * const ipcHelper = new IpcHelper(['2.2'], console);
2740
+ *
2741
+ * const buttonsSubscription = ipcHelper.onButtonsMessage().subscribe((msg) => {
2742
+ * // your logic for handling the button configurations goes here
2743
+ * });
2744
+ *
2745
+ * // don't forget to unsubscribe when you're cleaning up
2746
+ * buttonsSubscription.unsubscribe();
2747
+ * ```
2748
+ *
2749
+ * @returns An Observable that emits whenever {@link ButtonsMessage} is received so it can be
2750
+ * subscribed to indefinitely.
2751
+ */
2752
+ onButtonsMessage() {
2753
+ if (!this.isEmbedded())
2754
+ throw new d(this.currentContext);
2755
+ const t = "BUTTONS";
2756
+ return this.incomingMessages$.pipe(
2757
+ m((e) => e.type === t && e.target === "client"),
2758
+ f((e) => e),
2759
+ g(this.logReceived())
2760
+ );
2761
+ }
2441
2762
  /**
2442
2763
  * Checks if the client app is either embedded in an iframe or in a native webview.
2443
2764
  *
@@ -2475,7 +2796,7 @@ class Ct {
2475
2796
  * version.
2476
2797
  */
2477
2798
  compareVersion(t) {
2478
- return ne(this.negotiatedProtocolVersion, t);
2799
+ return Re(this.negotiatedProtocolVersion, t);
2479
2800
  }
2480
2801
  logReceived(t) {
2481
2802
  const e = (r) => this.logService.debug(
@@ -2483,7 +2804,7 @@ class Ct {
2483
2804
  r
2484
2805
  );
2485
2806
  if (t) {
2486
- xt(t) && (t = { ...t, data: "..." }), e(t);
2807
+ It(t) && (t = { ...t, data: "..." }), e(t);
2487
2808
  return;
2488
2809
  } else
2489
2810
  return e;
@@ -2520,18 +2841,18 @@ class Ct {
2520
2841
  }
2521
2842
  generateId(t = 8, e = !1) {
2522
2843
  let r = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
2523
- const s = [];
2844
+ const n = [];
2524
2845
  e && (r = r.substr(0, r.indexOf("Q")));
2525
2846
  for (let i = 0; i < t; i++)
2526
- s.push(r[Math.floor(Math.random() * r.length)]);
2527
- return s.join("");
2847
+ n.push(r[Math.floor(Math.random() * r.length)]);
2848
+ return n.join("");
2528
2849
  }
2529
2850
  }
2530
- function xt(n) {
2531
- return n.type === "FILE REQUEST" && n.replyTo !== null;
2851
+ function It(s) {
2852
+ return s.type === "FILE REQUEST" && s.replyTo !== null;
2532
2853
  }
2533
- const It = ["2.0"];
2534
- class Rt {
2854
+ const Ut = ["2.0", "2.1"];
2855
+ class xt {
2535
2856
  /**
2536
2857
  * A class that manages the IPC communication between the `Client` and the `Host`.
2537
2858
  *
@@ -2562,7 +2883,7 @@ class Rt {
2562
2883
  M(this, "logger");
2563
2884
  M(this, "helper");
2564
2885
  M(this, "listeners");
2565
- this.logger = t ?? console, this.helper = new Ct(It, this.logger), this.listeners = /* @__PURE__ */ new Map(), this.listeners.set(w.BadgeQuery, /* @__PURE__ */ new Set()), this.listeners.set(w.Lifecycle, /* @__PURE__ */ new Set()), this.listeners.set(w.PushToken, /* @__PURE__ */ new Set());
2886
+ 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());
2566
2887
  }
2567
2888
  /**
2568
2889
  * Returns whether the app is running inside a native WebView (`host` context) or as a
@@ -2600,50 +2921,61 @@ class Rt {
2600
2921
  initiateConnection() {
2601
2922
  return T(
2602
2923
  this.helper.openBridge().pipe(
2603
- Xe((t) => {
2924
+ et((t) => {
2604
2925
  this.helper.onBadgeQueryMessage().subscribe((e) => {
2605
2926
  var r;
2606
2927
  this.logger.debug("Received Badge Query: ", e);
2607
- for (const s of ((r = this.listeners.get(w.BadgeQuery)) == null ? void 0 : r.values()) ?? [])
2608
- s();
2928
+ for (const n of ((r = this.listeners.get(S.BadgeQuery)) == null ? void 0 : r.values()) ?? [])
2929
+ n();
2609
2930
  }), this.helper.onLifecycleMessage().subscribe((e) => {
2610
2931
  var r;
2611
2932
  this.logger.debug("Received Lifecycle Event: ", e);
2612
- for (const s of ((r = this.listeners.get(w.Lifecycle)) == null ? void 0 : r.values()) ?? [])
2613
- s(e.eventName, e.payload);
2933
+ for (const n of ((r = this.listeners.get(S.Lifecycle)) == null ? void 0 : r.values()) ?? [])
2934
+ n(e.eventName, e.payload);
2614
2935
  }), this.helper.onPushTokenMessage().subscribe((e) => {
2615
2936
  var r;
2616
2937
  this.logger.debug("Received Push Token: ", e);
2617
- for (const s of ((r = this.listeners.get(w.PushToken)) == null ? void 0 : r.values()) ?? [])
2618
- s(e.pushToken, e.appId, e.selector);
2938
+ for (const n of ((r = this.listeners.get(S.PushToken)) == null ? void 0 : r.values()) ?? [])
2939
+ n(e.pushToken, e.appId, e.selector);
2940
+ }), this.helper.onRequestLogsMessage().subscribe((e) => {
2941
+ var r;
2942
+ if (this.logger.debug("Received Request Logs Message: ", e), e.responseType === "file")
2943
+ throw this.logger.error("File response type not supported"), new Error("File response type not supported");
2944
+ for (const n of ((r = this.listeners.get(S.RequestLogs)) == null ? void 0 : r.values()) ?? [])
2945
+ n(e.skipCompression);
2619
2946
  }), this.cloudId = t.cloudId, this.cloudUsername = t.cloudUsername, this.displayName = t.displayName, this.host = t.host;
2620
2947
  }),
2621
- O(() => {
2948
+ _(() => {
2622
2949
  })
2623
2950
  )
2624
2951
  );
2625
2952
  }
2626
- selectContacts(t, e, r, s) {
2953
+ selectContacts(t, e, r, n) {
2627
2954
  this.logger.debug("Selecting Contacts: ", ...arguments);
2628
2955
  let i;
2629
- if (e === "multi") {
2630
- if (!r || !Array.isArray(r))
2631
- throw new I(
2632
- "currentContacts",
2633
- r,
2634
- "currentContacts is required for group streams"
2956
+ if (this.negotiatedVersion === "2.0") {
2957
+ if (typeof e != "string")
2958
+ throw new y("mode", e, 'mode must be "single" or "multi"');
2959
+ if (n === "number")
2960
+ throw new y(
2961
+ "contactType",
2962
+ n,
2963
+ 'contactType cannot be "number" for version 2.0 of the IPC protocol'
2635
2964
  );
2636
- s || (s = "cloudUsername"), i = this.helper.selectContacts(
2637
- t.toString(),
2638
- "group",
2639
- s,
2640
- r
2965
+ i = this.selectContacts_V2_0(
2966
+ t,
2967
+ e ?? "single",
2968
+ e === "multi" ? r : void 0,
2969
+ e === "multi" ? n : r
2641
2970
  );
2642
- } else
2643
- r ? s = r : s = "cloudUsername", i = this.helper.selectContacts(t.toString(), "direct", s);
2971
+ } else {
2972
+ if (typeof e != "object")
2973
+ throw new y("options", e, "options must be an object");
2974
+ i = this.selectContacts_V2_1(t, e);
2975
+ }
2644
2976
  return T(
2645
2977
  i.pipe(
2646
- O((o) => o.result === "error" ? {
2978
+ _((o) => o.result === "error" ? {
2647
2979
  result: "error",
2648
2980
  errorMessage: o.errorMessage
2649
2981
  } : o.result === "cancelled" ? {
@@ -2652,6 +2984,39 @@ class Rt {
2652
2984
  )
2653
2985
  );
2654
2986
  }
2987
+ selectContacts_V2_0(t, e, r, n) {
2988
+ if (this.logger.debug("Selecting Contacts: ", ...arguments), e === "multi") {
2989
+ if (!r || !Array.isArray(r))
2990
+ throw new y(
2991
+ "currentContacts",
2992
+ r,
2993
+ "currentContacts is required for group streams"
2994
+ );
2995
+ return n || (n = "cloudUsername"), this.helper.selectContacts(
2996
+ t.toString(),
2997
+ "group",
2998
+ n,
2999
+ r
3000
+ );
3001
+ } else
3002
+ return n || (n = "cloudUsername"), this.helper.selectContacts(t.toString(), "direct", n);
3003
+ }
3004
+ selectContacts_V2_1(t, e) {
3005
+ if (this.logger.debug("Selecting Contacts: ", e), e.mode === "multi" && (!e.currentContacts || !Array.isArray(e.currentContacts)))
3006
+ throw new y(
3007
+ "currentContacts",
3008
+ e.currentContacts,
3009
+ "currentContacts is required for group streams"
3010
+ );
3011
+ return this.helper.selectContacts(
3012
+ t.toString(),
3013
+ {
3014
+ allowMultipleSelection: e.mode === "multi",
3015
+ resultTypes: e.resultTypes ?? ["cloudUsername"]
3016
+ },
3017
+ e.mode === "multi" ? e.currentContacts : void 0
3018
+ );
3019
+ }
2655
3020
  /**
2656
3021
  * Matches batch of {@link ContactItem} objects against the Host's contact list to fetch detailed
2657
3022
  * contact information.
@@ -2662,7 +3027,7 @@ class Rt {
2662
3027
  * Host's contact list.
2663
3028
  */
2664
3029
  matchContacts(t) {
2665
- return this.logger.debug("Match Contacts: ", t), T(this.helper.matchContacts(t).pipe(O((e) => e.contacts)));
3030
+ return this.logger.debug("Match Contacts: ", t), T(this.helper.matchContacts(t).pipe(_((e) => e.contacts)));
2666
3031
  }
2667
3032
  /**
2668
3033
  * Requests the `Host` app to provide the Push Token for the current device.
@@ -2670,7 +3035,7 @@ class Rt {
2670
3035
  * @returns A promise with the Push Token as `string`.
2671
3036
  */
2672
3037
  requestPushToken() {
2673
- return this.logger.debug("Requesting Push Token"), T(this.helper.requestPushToken().pipe(O((t) => t.pushToken)));
3038
+ return this.logger.debug("Requesting Push Token"), T(this.helper.requestPushToken().pipe(_((t) => t.pushToken)));
2674
3039
  }
2675
3040
  /**
2676
3041
  * Sends the current badge count to the `Host` app.
@@ -2697,6 +3062,25 @@ class Rt {
2697
3062
  * @remarks
2698
3063
  * Any additional data to be posted alongside the URL is included with the `data` parameter.
2699
3064
  *
3065
+ * @example
3066
+ *
3067
+ * ```ts
3068
+ * // import the IPCManager
3069
+ * import { IPCManager } from '@acrobits/ipc-sdk';
3070
+ *
3071
+ * // create an instance of IPCManager
3072
+ * const manager = new IPCManager();
3073
+ *
3074
+ * // open the URL with additional data
3075
+ * const url = 'https://example.com';
3076
+ * const data = {
3077
+ * name: 'John Doe',
3078
+ * age: 30
3079
+ * };
3080
+ *
3081
+ * manager.openUrl(url, data);
3082
+ * ```
3083
+ *
2700
3084
  * @param url - URL to open in the external browser
2701
3085
  * @param data - _Optional_. Any additional data to be sent along with the URL
2702
3086
  */
@@ -2720,9 +3104,9 @@ class Rt {
2720
3104
  */
2721
3105
  onBadgeQueryRequest(t) {
2722
3106
  var e;
2723
- return this.logger.debug("Registering for Badge Query"), (e = this.listeners.get(w.BadgeQuery)) == null || e.add(t), () => {
3107
+ return this.logger.debug("Registering for Badge Query"), (e = this.listeners.get(S.BadgeQuery)) == null || e.add(t), () => {
2724
3108
  var r;
2725
- return (r = this.listeners.get(w.BadgeQuery)) == null ? void 0 : r.delete(t);
3109
+ return (r = this.listeners.get(S.BadgeQuery)) == null ? void 0 : r.delete(t);
2726
3110
  };
2727
3111
  }
2728
3112
  /**
@@ -2739,9 +3123,9 @@ class Rt {
2739
3123
  */
2740
3124
  onLifecycleEvent(t) {
2741
3125
  var e;
2742
- return this.logger.debug("Registering for Lifecycle Event"), (e = this.listeners.get(w.Lifecycle)) == null || e.add(t), () => {
3126
+ return this.logger.debug("Registering for Lifecycle Event"), (e = this.listeners.get(S.Lifecycle)) == null || e.add(t), () => {
2743
3127
  var r;
2744
- return (r = this.listeners.get(w.Lifecycle)) == null ? void 0 : r.delete(t);
3128
+ return (r = this.listeners.get(S.Lifecycle)) == null ? void 0 : r.delete(t);
2745
3129
  };
2746
3130
  }
2747
3131
  /**
@@ -2757,9 +3141,31 @@ class Rt {
2757
3141
  */
2758
3142
  onPushToken(t) {
2759
3143
  var e;
2760
- return this.logger.debug("Registering for Push Token"), (e = this.listeners.get(w.PushToken)) == null || e.add(t), () => {
3144
+ return this.logger.debug("Registering for Push Token"), (e = this.listeners.get(S.PushToken)) == null || e.add(t), () => {
3145
+ var r;
3146
+ return (r = this.listeners.get(S.PushToken)) == null ? void 0 : r.delete(t);
3147
+ };
3148
+ }
3149
+ /**
3150
+ * Registers a callback to be invoked when a {@link IPCEvents.RequestLogs} event is received.
3151
+ *
3152
+ * @remarks
3153
+ * The Host app can request logs from the Client app by sending a RequestLogs event. The callback
3154
+ * will receive a skipCompression parameter indicating whether the logs should be compressed or not.
3155
+ *
3156
+ * When skipCompression is true, the logs should be sent uncompressed. When false or undefined,
3157
+ * the logs should be compressed before sending.
3158
+ *
3159
+ * @param callback - A callback function to be invoked when a {@link IPCEvents.RequestLogs} event
3160
+ * is received. The callback receives an optional skipCompression parameter.
3161
+ *
3162
+ * @returns An unsubscribe callback to remove the listener.
3163
+ */
3164
+ onRequestLogsMessage(t) {
3165
+ var e;
3166
+ return this.logger.debug("Registering for Request Logs Message"), (e = this.listeners.get(S.RequestLogs)) == null || e.add(t), () => {
2761
3167
  var r;
2762
- return (r = this.listeners.get(w.PushToken)) == null ? void 0 : r.delete(t);
3168
+ return (r = this.listeners.get(S.RequestLogs)) == null ? void 0 : r.delete(t);
2763
3169
  };
2764
3170
  }
2765
3171
  evaluateContext(t) {
@@ -2770,6 +3176,6 @@ class Rt {
2770
3176
  }
2771
3177
  }
2772
3178
  export {
2773
- w as IPCEvents,
2774
- Rt as IPCManager
3179
+ S as IPCEvents,
3180
+ xt as IPCManager
2775
3181
  };