@formant/data-sdk 0.0.144 → 0.0.145

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.
@@ -1,6 +1,6 @@
1
- var ln = Object.defineProperty;
2
- var un = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var Ae = (e, t, n) => (un(e, typeof t != "symbol" ? t + "" : t, n), n);
1
+ var sn = Object.defineProperty;
2
+ var ln = (e, t, n) => t in e ? sn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Re = (e, t, n) => (ln(e, typeof t != "symbol" ? t + "" : t, n), n);
4
4
  import * as dateFns from "date-fns";
5
5
  import { startOfMinute, addMinutes, roundToNearestMinutes, addSeconds } from "date-fns";
6
6
  const global$1 = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {};
@@ -900,14 +900,7 @@ function isFastBuffer(e) {
900
900
  function isSlowBuffer(e) {
901
901
  return typeof e.readFloatLE == "function" && typeof e.slice == "function" && isFastBuffer(e.slice(0, 0));
902
902
  }
903
- var distExports = {}, dist = {
904
- get exports() {
905
- return distExports;
906
- },
907
- set exports(e) {
908
- distExports = e;
909
- }
910
- };
903
+ var dist = { exports: {} };
911
904
  /*! For license information please see index.js.LICENSE.txt */
912
905
  (function(module, exports) {
913
906
  (function(e, t) {
@@ -1008,8 +1001,8 @@ var distExports = {}, dist = {
1008
1001
  }(0, ve, Ce) ? function(Ie, Te, Oe) {
1009
1002
  var Pe = /* @__PURE__ */ new Date(0);
1010
1003
  Pe.setUTCFullYear(Ie, 0, 4);
1011
- var qe = Pe.getUTCDay() || 7, tt = 7 * (Te - 1) + Oe + 1 - qe;
1012
- return Pe.setUTCDate(Pe.getUTCDate() + tt), Pe;
1004
+ var Ze = Pe.getUTCDay() || 7, et = 7 * (Te - 1) + Oe + 1 - Ze;
1005
+ return Pe.setUTCDate(Pe.getUTCDate() + et), Pe;
1013
1006
  }(k, ve, Ce) : /* @__PURE__ */ new Date(NaN);
1014
1007
  var Se = /* @__PURE__ */ new Date(0);
1015
1008
  return function(Ie, Te, Oe) {
@@ -1581,8 +1574,8 @@ ${P(re)}`), fe;
1581
1574
  var Oe = Te.length;
1582
1575
  if (Oe <= 4096)
1583
1576
  return String.fromCharCode.apply(String, Te);
1584
- for (var Pe = "", qe = 0; qe < Oe; )
1585
- Pe += String.fromCharCode.apply(String, Te.slice(qe, qe += 4096));
1577
+ for (var Pe = "", Ze = 0; Ze < Oe; )
1578
+ Pe += String.fromCharCode.apply(String, Te.slice(Ze, Ze += 4096));
1586
1579
  return Pe;
1587
1580
  }(J);
1588
1581
  }
@@ -4138,10 +4131,10 @@ Found: `.concat(j.toString().split(`
4138
4131
  }
4139
4132
  J = Ie;
4140
4133
  }
4141
- var Pe, qe = {};
4142
- function tt(x) {
4134
+ var Pe, Ze = {};
4135
+ function et(x) {
4143
4136
  return function(Z, te) {
4144
- var ae = qe;
4137
+ var ae = Ze;
4145
4138
  return Object.prototype.hasOwnProperty.call(ae, Z) ? ae[Z] : ae[Z] = te(Z);
4146
4139
  }(x, function() {
4147
4140
  for (var Z = 0, te = Q(String(J)).split("."), ae = Q(String(x)).split("."), ge = Math.max(te.length, ae.length), me = 0; Z == 0 && me < ge; me++) {
@@ -4156,20 +4149,20 @@ Found: `.concat(j.toString().split(`
4156
4149
  });
4157
4150
  }
4158
4151
  if (f.document && se) {
4159
- var et = Se();
4160
- Pe = et || parseInt(J, 10) || void 0;
4152
+ var Qe = Se();
4153
+ Pe = Qe || parseInt(J, 10) || void 0;
4161
4154
  } else
4162
4155
  Pe = void 0;
4163
- var bt = Pe;
4164
- function lt() {
4156
+ var yt = Pe;
4157
+ function st() {
4165
4158
  this.F = this.F;
4166
4159
  }
4167
- lt.prototype.F = !1;
4168
- var _t, It = Object.freeze || function(x) {
4160
+ st.prototype.F = !1;
4161
+ var bt, Ot = Object.freeze || function(x) {
4169
4162
  return x;
4170
4163
  };
4171
- (_t = !se) || (_t = 9 <= Number(bt));
4172
- var Et = _t, ke = se && !tt("9"), Nt = function() {
4164
+ (bt = !se) || (bt = 9 <= Number(yt));
4165
+ var St = bt, ke = se && !et("9"), Mt = function() {
4173
4166
  if (!f.addEventListener || !Object.defineProperty)
4174
4167
  return !1;
4175
4168
  var x = !1, Z = Object.defineProperty({}, "passive", { get: function() {
@@ -4181,11 +4174,11 @@ Found: `.concat(j.toString().split(`
4181
4174
  }
4182
4175
  return x;
4183
4176
  }();
4184
- function nt(x, Z) {
4177
+ function tt(x, Z) {
4185
4178
  this.type = x, this.a = this.target = Z, this.defaultPrevented = !1;
4186
4179
  }
4187
- function it(x, Z) {
4188
- if (nt.call(this, x ? x.type : ""), this.relatedTarget = this.a = this.target = null, this.button = this.screenY = this.screenX = this.clientY = this.clientX = 0, this.key = "", this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1, this.pointerId = 0, this.pointerType = "", this.c = null, x) {
4180
+ function rt(x, Z) {
4181
+ if (tt.call(this, x ? x.type : ""), this.relatedTarget = this.a = this.target = null, this.button = this.screenY = this.screenX = this.clientY = this.clientX = 0, this.key = "", this.metaKey = this.shiftKey = this.altKey = this.ctrlKey = !1, this.pointerId = 0, this.pointerType = "", this.c = null, x) {
4189
4182
  var te = this.type = x.type, ae = x.changedTouches && x.changedTouches.length ? x.changedTouches[0] : null;
4190
4183
  if (this.target = x.target || x.srcElement, this.a = Z, Z = x.relatedTarget) {
4191
4184
  if (ve) {
@@ -4202,15 +4195,15 @@ Found: `.concat(j.toString().split(`
4202
4195
  }
4203
4196
  } else
4204
4197
  te == "mouseover" ? Z = x.fromElement : te == "mouseout" && (Z = x.toElement);
4205
- this.relatedTarget = Z, ae ? (this.clientX = ae.clientX !== void 0 ? ae.clientX : ae.pageX, this.clientY = ae.clientY !== void 0 ? ae.clientY : ae.pageY, this.screenX = ae.screenX || 0, this.screenY = ae.screenY || 0) : (this.clientX = x.clientX !== void 0 ? x.clientX : x.pageX, this.clientY = x.clientY !== void 0 ? x.clientY : x.pageY, this.screenX = x.screenX || 0, this.screenY = x.screenY || 0), this.button = x.button, this.key = x.key || "", this.ctrlKey = x.ctrlKey, this.altKey = x.altKey, this.shiftKey = x.shiftKey, this.metaKey = x.metaKey, this.pointerId = x.pointerId || 0, this.pointerType = typeof x.pointerType == "string" ? x.pointerType : jt[x.pointerType] || "", this.c = x, x.defaultPrevented && this.b();
4198
+ this.relatedTarget = Z, ae ? (this.clientX = ae.clientX !== void 0 ? ae.clientX : ae.pageX, this.clientY = ae.clientY !== void 0 ? ae.clientY : ae.pageY, this.screenX = ae.screenX || 0, this.screenY = ae.screenY || 0) : (this.clientX = x.clientX !== void 0 ? x.clientX : x.pageX, this.clientY = x.clientY !== void 0 ? x.clientY : x.pageY, this.screenX = x.screenX || 0, this.screenY = x.screenY || 0), this.button = x.button, this.key = x.key || "", this.ctrlKey = x.ctrlKey, this.altKey = x.altKey, this.shiftKey = x.shiftKey, this.metaKey = x.metaKey, this.pointerId = x.pointerId || 0, this.pointerType = typeof x.pointerType == "string" ? x.pointerType : Nt[x.pointerType] || "", this.c = x, x.defaultPrevented && this.b();
4206
4199
  }
4207
4200
  }
4208
- nt.prototype.b = function() {
4201
+ tt.prototype.b = function() {
4209
4202
  this.defaultPrevented = !0;
4210
- }, F(it, nt);
4211
- var jt = It({ 2: "touch", 3: "pen", 4: "mouse" });
4212
- it.prototype.b = function() {
4213
- it.S.b.call(this);
4203
+ }, F(rt, tt);
4204
+ var Nt = Ot({ 2: "touch", 3: "pen", 4: "mouse" });
4205
+ rt.prototype.b = function() {
4206
+ rt.S.b.call(this);
4214
4207
  var x = this.c;
4215
4208
  if (x.preventDefault)
4216
4209
  x.preventDefault();
@@ -4220,21 +4213,21 @@ Found: `.concat(j.toString().split(`
4220
4213
  } catch {
4221
4214
  }
4222
4215
  };
4223
- var pt = "closure_listenable_" + (1e6 * Math.random() | 0), Ct = 0;
4224
- function ut(x, Z, te, ae, ge) {
4225
- this.listener = x, this.proxy = null, this.src = Z, this.type = te, this.capture = !!ae, this.A = ge, this.key = ++Ct, this.s = this.v = !1;
4216
+ var dt = "closure_listenable_" + (1e6 * Math.random() | 0), It = 0;
4217
+ function lt(x, Z, te, ae, ge) {
4218
+ this.listener = x, this.proxy = null, this.src = Z, this.type = te, this.capture = !!ae, this.A = ge, this.key = ++It, this.s = this.v = !1;
4226
4219
  }
4227
- function Tt(x) {
4220
+ function Et(x) {
4228
4221
  x.s = !0, x.listener = null, x.proxy = null, x.src = null, x.A = null;
4229
4222
  }
4230
4223
  function Ue(x) {
4231
4224
  this.src = x, this.a = {}, this.b = 0;
4232
4225
  }
4233
- function Rt(x, Z) {
4226
+ function Tt(x, Z) {
4234
4227
  var te = Z.type;
4235
4228
  if (te in x.a) {
4236
4229
  var ae, ge = x.a[te], me = U(ge, Z);
4237
- (ae = 0 <= me) && Array.prototype.splice.call(ge, me, 1), ae && (Tt(Z), x.a[te].length == 0 && (delete x.a[te], x.b--));
4230
+ (ae = 0 <= me) && Array.prototype.splice.call(ge, me, 1), ae && (Et(Z), x.a[te].length == 0 && (delete x.a[te], x.b--));
4238
4231
  }
4239
4232
  }
4240
4233
  function pe(x, Z, te, ae) {
@@ -4249,7 +4242,7 @@ Found: `.concat(j.toString().split(`
4249
4242
  var me = x.toString();
4250
4243
  (x = this.a[me]) || (x = this.a[me] = [], this.b++);
4251
4244
  var ue = pe(x, Z, ae, ge);
4252
- return -1 < ue ? (Z = x[ue], te || (Z.v = !1)) : ((Z = new ut(Z, this.src, me, !!ae, ge)).v = te, x.push(Z)), Z;
4245
+ return -1 < ue ? (Z = x[ue], te || (Z.v = !1)) : ((Z = new lt(Z, this.src, me, !!ae, ge)).v = te, x.push(Z)), Z;
4253
4246
  };
4254
4247
  var D = "closure_lm_" + (1e6 * Math.random() | 0), H = {};
4255
4248
  function X(x, Z, te, ae, ge) {
@@ -4259,13 +4252,13 @@ Found: `.concat(j.toString().split(`
4259
4252
  for (var Le = 0; Le < we.length; Le++)
4260
4253
  ue(he, we[Le], _e, Ee, De);
4261
4254
  else
4262
- _e = Me(_e), he && he[pt] ? he.f.add(String(we), _e, !0, g(Ee) ? !!Ee.capture : !!Ee, De) : ie(he, we, _e, !0, Ee, De);
4255
+ _e = Me(_e), he && he[dt] ? he.f.add(String(we), _e, !0, g(Ee) ? !!Ee.capture : !!Ee, De) : ie(he, we, _e, !0, Ee, De);
4263
4256
  })(x, Z, te, ae, ge);
4264
4257
  else if (Array.isArray(Z))
4265
4258
  for (var me = 0; me < Z.length; me++)
4266
4259
  X(x, Z[me], te, ae, ge);
4267
4260
  else
4268
- te = Me(te), x && x[pt] ? x.f.add(String(Z), te, !1, g(ae) ? !!ae.capture : !!ae, ge) : ie(x, Z, te, !1, ae, ge);
4261
+ te = Me(te), x && x[dt] ? x.f.add(String(Z), te, !1, g(ae) ? !!ae.capture : !!ae, ge) : ie(x, Z, te, !1, ae, ge);
4269
4262
  }
4270
4263
  function ie(x, Z, te, ae, ge, me) {
4271
4264
  if (!Z)
@@ -4273,7 +4266,7 @@ Found: `.concat(j.toString().split(`
4273
4266
  var ue = g(ge) ? !!ge.capture : !!ge, he = le(x);
4274
4267
  if (he || (x[D] = he = new Ue(x)), !(te = he.add(Z, te, ae, ue, me)).proxy)
4275
4268
  if (ae = function() {
4276
- var we = ce, _e = Et ? function(Ee) {
4269
+ var we = ce, _e = St ? function(Ee) {
4277
4270
  return we.call(_e.src, _e.listener, Ee);
4278
4271
  } : function(Ee) {
4279
4272
  if (!(Ee = we.call(_e.src, _e.listener, Ee)))
@@ -4281,7 +4274,7 @@ Found: `.concat(j.toString().split(`
4281
4274
  };
4282
4275
  return _e;
4283
4276
  }(), te.proxy = ae, ae.src = x, ae.listener = te, x.addEventListener)
4284
- Nt || (ge = ue), ge === void 0 && (ge = !1), x.addEventListener(Z.toString(), ae, ge);
4277
+ Mt || (ge = ue), ge === void 0 && (ge = !1), x.addEventListener(Z.toString(), ae, ge);
4285
4278
  else if (x.attachEvent)
4286
4279
  x.attachEvent(de(Z.toString()), ae);
4287
4280
  else {
@@ -4293,11 +4286,11 @@ Found: `.concat(j.toString().split(`
4293
4286
  function oe(x) {
4294
4287
  if (typeof x != "number" && x && !x.s) {
4295
4288
  var Z = x.src;
4296
- if (Z && Z[pt])
4297
- Rt(Z.f, x);
4289
+ if (Z && Z[dt])
4290
+ Tt(Z.f, x);
4298
4291
  else {
4299
4292
  var te = x.type, ae = x.proxy;
4300
- Z.removeEventListener ? Z.removeEventListener(te, ae, x.capture) : Z.detachEvent ? Z.detachEvent(de(te), ae) : Z.addListener && Z.removeListener && Z.removeListener(ae), (te = le(Z)) ? (Rt(te, x), te.b == 0 && (te.src = null, Z[D] = null)) : Tt(x);
4293
+ Z.removeEventListener ? Z.removeEventListener(te, ae, x.capture) : Z.detachEvent ? Z.detachEvent(de(te), ae) : Z.addListener && Z.removeListener && Z.removeListener(ae), (te = le(Z)) ? (Tt(te, x), te.b == 0 && (te.src = null, Z[D] = null)) : Et(x);
4301
4294
  }
4302
4295
  }
4303
4296
  }
@@ -4320,9 +4313,9 @@ Found: `.concat(j.toString().split(`
4320
4313
  function ce(x, Z) {
4321
4314
  if (x.s)
4322
4315
  return !0;
4323
- if (!Et) {
4316
+ if (!St) {
4324
4317
  var te = Z || E("window.event");
4325
- Z = new it(te, this);
4318
+ Z = new rt(te, this);
4326
4319
  var ae = !0;
4327
4320
  if (!(0 > te.keyCode || te.returnValue != null)) {
4328
4321
  e: {
@@ -4348,26 +4341,26 @@ Found: `.concat(j.toString().split(`
4348
4341
  }
4349
4342
  return ae;
4350
4343
  }
4351
- return be(x, new it(Z, this));
4344
+ return be(x, new rt(Z, this));
4352
4345
  }
4353
4346
  function le(x) {
4354
4347
  return (x = x[D]) instanceof Ue ? x : null;
4355
4348
  }
4356
- var Re = "__closure_events_fn_" + (1e9 * Math.random() >>> 0);
4349
+ var Ae = "__closure_events_fn_" + (1e9 * Math.random() >>> 0);
4357
4350
  function Me(x) {
4358
- return h(x) == "function" ? x : (x[Re] || (x[Re] = function(Z) {
4351
+ return h(x) == "function" ? x : (x[Ae] || (x[Ae] = function(Z) {
4359
4352
  return x.handleEvent(Z);
4360
- }), x[Re]);
4353
+ }), x[Ae]);
4361
4354
  }
4362
4355
  function je() {
4363
- lt.call(this), this.f = new Ue(this), this.N = this;
4356
+ st.call(this), this.f = new Ue(this), this.N = this;
4364
4357
  }
4365
4358
  function Fe(x, Z) {
4366
4359
  x = x.N;
4367
4360
  var te = Z.type || Z;
4368
4361
  if (typeof Z == "string")
4369
- Z = new nt(Z, x);
4370
- else if (Z instanceof nt)
4362
+ Z = new tt(Z, x);
4363
+ else if (Z instanceof tt)
4371
4364
  Z.target = Z.target || x;
4372
4365
  else {
4373
4366
  var ae = Z;
@@ -4378,23 +4371,23 @@ Found: `.concat(j.toString().split(`
4378
4371
  for (var _e = 0; _e < S.length; _e++)
4379
4372
  ue = S[_e], Object.prototype.hasOwnProperty.call(he, ue) && (ge[ue] = he[ue]);
4380
4373
  }
4381
- })(Z = new nt(te, x), ae);
4374
+ })(Z = new tt(te, x), ae);
4382
4375
  }
4383
- Ke(x = Z.a = x, te, !0, Z), Ke(x, te, !1, Z);
4376
+ Ye(x = Z.a = x, te, !0, Z), Ye(x, te, !1, Z);
4384
4377
  }
4385
- function Ke(x, Z, te, ae) {
4378
+ function Ye(x, Z, te, ae) {
4386
4379
  if (Z = x.f.a[String(Z)]) {
4387
4380
  Z = Z.concat();
4388
4381
  for (var ge = !0, me = 0; me < Z.length; ++me) {
4389
4382
  var ue = Z[me];
4390
4383
  if (ue && !ue.s && ue.capture == te) {
4391
4384
  var he = ue.listener, we = ue.A || ue.src;
4392
- ue.v && Rt(x.f, ue), ge = he.call(we, ae) !== !1 && ge;
4385
+ ue.v && Tt(x.f, ue), ge = he.call(we, ae) !== !1 && ge;
4393
4386
  }
4394
4387
  }
4395
4388
  }
4396
4389
  }
4397
- function $e(x, Z, te) {
4390
+ function Ge(x, Z, te) {
4398
4391
  if (h(x) == "function")
4399
4392
  te && (x = j(x, te));
4400
4393
  else {
@@ -4404,10 +4397,10 @@ Found: `.concat(j.toString().split(`
4404
4397
  }
4405
4398
  return 2147483647 < Number(Z) ? -1 : f.setTimeout(x, Z || 0);
4406
4399
  }
4407
- function Ye(x, Z, te) {
4400
+ function qe(x, Z, te) {
4408
4401
  this.reset(x, Z, te, void 0, void 0);
4409
4402
  }
4410
- F(je, lt), je.prototype[pt] = !0, je.prototype.addEventListener = function(x, Z, te, ae) {
4403
+ F(je, st), je.prototype[dt] = !0, je.prototype.addEventListener = function(x, Z, te, ae) {
4411
4404
  X(this, x, Z, te, ae);
4412
4405
  }, je.prototype.removeEventListener = function(x, Z, te, ae) {
4413
4406
  (function ge(me, ue, he, we, _e) {
@@ -4415,47 +4408,47 @@ Found: `.concat(j.toString().split(`
4415
4408
  for (var Ee = 0; Ee < ue.length; Ee++)
4416
4409
  ge(me, ue[Ee], he, we, _e);
4417
4410
  else
4418
- we = g(we) ? !!we.capture : !!we, he = Me(he), me && me[pt] ? (me = me.f, (ue = String(ue).toString()) in me.a && -1 < (he = pe(Ee = me.a[ue], he, we, _e)) && (Tt(Ee[he]), Array.prototype.splice.call(Ee, he, 1), Ee.length == 0 && (delete me.a[ue], me.b--))) : me && (me = le(me)) && (ue = me.a[ue.toString()], me = -1, ue && (me = pe(ue, he, we, _e)), (he = -1 < me ? ue[me] : null) && oe(he));
4411
+ we = g(we) ? !!we.capture : !!we, he = Me(he), me && me[dt] ? (me = me.f, (ue = String(ue).toString()) in me.a && -1 < (he = pe(Ee = me.a[ue], he, we, _e)) && (Et(Ee[he]), Array.prototype.splice.call(Ee, he, 1), Ee.length == 0 && (delete me.a[ue], me.b--))) : me && (me = le(me)) && (ue = me.a[ue.toString()], me = -1, ue && (me = pe(ue, he, we, _e)), (he = -1 < me ? ue[me] : null) && oe(he));
4419
4412
  })(this, x, Z, te, ae);
4420
- }, Ye.prototype.a = null;
4413
+ }, qe.prototype.a = null;
4421
4414
  function xe(x) {
4422
4415
  this.f = x, this.b = this.c = this.a = null;
4423
4416
  }
4424
4417
  function Be(x, Z) {
4425
4418
  this.name = x, this.value = Z;
4426
4419
  }
4427
- Ye.prototype.reset = function(x, Z, te, ae, ge) {
4420
+ qe.prototype.reset = function(x, Z, te, ae, ge) {
4428
4421
  delete this.a;
4429
4422
  }, Be.prototype.toString = function() {
4430
4423
  return this.name;
4431
4424
  };
4432
- var Ge = new Be("SEVERE", 1e3), Ze = new Be("CONFIG", 700), Xe = new Be("FINE", 500);
4433
- function Je(x) {
4434
- return x.c ? x.c : x.a ? Je(x.a) : (function(Z, te) {
4425
+ var Ve = new Be("SEVERE", 1e3), $e = new Be("CONFIG", 700), Ke = new Be("FINE", 500);
4426
+ function Xe(x) {
4427
+ return x.c ? x.c : x.a ? Xe(x.a) : (function(Z, te) {
4435
4428
  throw new _("Failure" + (Z ? ": " + Z : ""), Array.prototype.slice.call(arguments, 1));
4436
4429
  }("Root logger has no level set."), null);
4437
4430
  }
4438
4431
  xe.prototype.log = function(x, Z, te) {
4439
- if (x.value >= Je(this).value)
4440
- for (h(Z) == "function" && (Z = Z()), x = new Ye(x, String(Z), this.f), te && (x.a = te), te = this; te; )
4432
+ if (x.value >= Xe(this).value)
4433
+ for (h(Z) == "function" && (Z = Z()), x = new qe(x, String(Z), this.f), te && (x.a = te), te = this; te; )
4441
4434
  te = te.a;
4442
4435
  };
4443
- var at, ot = {}, ct = null;
4444
- function Qe(x, Z) {
4445
- x && x.log(Xe, Z, void 0);
4436
+ var ot, it = {}, ut = null;
4437
+ function Je(x, Z) {
4438
+ x && x.log(Ke, Z, void 0);
4446
4439
  }
4447
- function Mt() {
4440
+ function Ct() {
4448
4441
  }
4449
- function Bt(x) {
4442
+ function Dt(x) {
4450
4443
  var Z;
4451
- return (Z = x.a) || (Z = {}, Ft(x) && (Z[0] = !0, Z[1] = !0), Z = x.a = Z), Z;
4444
+ return (Z = x.a) || (Z = {}, Ut(x) && (Z[0] = !0, Z[1] = !0), Z = x.a = Z), Z;
4452
4445
  }
4453
- function kt() {
4446
+ function Bt() {
4454
4447
  }
4455
- function Ut(x) {
4456
- return (x = Ft(x)) ? new ActiveXObject(x) : new XMLHttpRequest();
4448
+ function kt(x) {
4449
+ return (x = Ut(x)) ? new ActiveXObject(x) : new XMLHttpRequest();
4457
4450
  }
4458
- function Ft(x) {
4451
+ function Ut(x) {
4459
4452
  if (!x.b && typeof XMLHttpRequest > "u" && typeof ActiveXObject < "u") {
4460
4453
  for (var Z = ["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], te = 0; te < Z.length; te++) {
4461
4454
  var ae = Z[te];
@@ -4468,7 +4461,7 @@ Found: `.concat(j.toString().split(`
4468
4461
  }
4469
4462
  return x.b;
4470
4463
  }
4471
- function mt(x, Z) {
4464
+ function pt(x, Z) {
4472
4465
  this.b = {}, this.a = [], this.c = 0;
4473
4466
  var te = arguments.length;
4474
4467
  if (1 < te) {
@@ -4477,75 +4470,75 @@ Found: `.concat(j.toString().split(`
4477
4470
  for (var ae = 0; ae < te; ae += 2)
4478
4471
  this.set(arguments[ae], arguments[ae + 1]);
4479
4472
  } else
4480
- x && zt(this, x);
4473
+ x && Ft(this, x);
4481
4474
  }
4482
- function xt(x) {
4475
+ function jt(x) {
4483
4476
  if (x.c != x.a.length) {
4484
4477
  for (var Z = 0, te = 0; Z < x.a.length; ) {
4485
4478
  var ae = x.a[Z];
4486
- vt(x.b, ae) && (x.a[te++] = ae), Z++;
4479
+ _t(x.b, ae) && (x.a[te++] = ae), Z++;
4487
4480
  }
4488
4481
  x.a.length = te;
4489
4482
  }
4490
4483
  if (x.c != x.a.length) {
4491
4484
  var ge = {};
4492
4485
  for (te = Z = 0; Z < x.a.length; )
4493
- vt(ge, ae = x.a[Z]) || (x.a[te++] = ae, ge[ae] = 1), Z++;
4486
+ _t(ge, ae = x.a[Z]) || (x.a[te++] = ae, ge[ae] = 1), Z++;
4494
4487
  x.a.length = te;
4495
4488
  }
4496
4489
  }
4497
- function zt(x, Z) {
4498
- if (Z instanceof mt)
4490
+ function Ft(x, Z) {
4491
+ if (Z instanceof pt)
4499
4492
  for (var te = Z.f(), ae = 0; ae < te.length; ae++)
4500
4493
  x.set(te[ae], Z.get(te[ae]));
4501
4494
  else
4502
4495
  for (te in Z)
4503
4496
  x.set(te, Z[te]);
4504
4497
  }
4505
- function vt(x, Z) {
4498
+ function _t(x, Z) {
4506
4499
  return Object.prototype.hasOwnProperty.call(x, Z);
4507
4500
  }
4508
- Mt.prototype.a = null, F(kt, Mt), at = new kt(), mt.prototype.f = function() {
4509
- return xt(this), this.a.concat();
4510
- }, mt.prototype.get = function(x, Z) {
4511
- return vt(this.b, x) ? this.b[x] : Z;
4512
- }, mt.prototype.set = function(x, Z) {
4513
- vt(this.b, x) || (this.c++, this.a.push(x)), this.b[x] = Z;
4514
- }, mt.prototype.forEach = function(x, Z) {
4501
+ Ct.prototype.a = null, F(Bt, Ct), ot = new Bt(), pt.prototype.f = function() {
4502
+ return jt(this), this.a.concat();
4503
+ }, pt.prototype.get = function(x, Z) {
4504
+ return _t(this.b, x) ? this.b[x] : Z;
4505
+ }, pt.prototype.set = function(x, Z) {
4506
+ _t(this.b, x) || (this.c++, this.a.push(x)), this.b[x] = Z;
4507
+ }, pt.prototype.forEach = function(x, Z) {
4515
4508
  for (var te = this.f(), ae = 0; ae < te.length; ae++) {
4516
4509
  var ge = te[ae], me = this.get(ge);
4517
4510
  x.call(Z, me, ge, this);
4518
4511
  }
4519
4512
  };
4520
- var Xt = /^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;
4521
- function dt(x) {
4522
- je.call(this), this.headers = new mt(), this.D = x || null, this.c = !1, this.C = this.a = null, this.J = this.o = "", this.g = 0, this.i = "", this.h = this.I = this.m = this.G = !1, this.l = 0, this.u = null, this.j = Wt, this.B = this.H = !1;
4513
+ var Kt = /^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;
4514
+ function ht(x) {
4515
+ je.call(this), this.headers = new pt(), this.D = x || null, this.c = !1, this.C = this.a = null, this.J = this.o = "", this.g = 0, this.i = "", this.h = this.I = this.m = this.G = !1, this.l = 0, this.u = null, this.j = zt, this.B = this.H = !1;
4523
4516
  }
4524
- F(dt, je);
4525
- var Wt = "", Jt = dt.prototype, Qt = function x(Z) {
4517
+ F(ht, je);
4518
+ var zt = "", Xt = ht.prototype, Jt = function x(Z) {
4526
4519
  var te;
4527
- if (ct || (ct = new xe(""), ot[""] = ct, ct.c = Ze), !(te = ot[Z])) {
4520
+ if (ut || (ut = new xe(""), it[""] = ut, ut.c = $e), !(te = it[Z])) {
4528
4521
  te = new xe(Z);
4529
4522
  var ae = Z.lastIndexOf("."), ge = Z.substr(ae + 1);
4530
- (ae = x(Z.substr(0, ae))).b || (ae.b = {}), ae.b[ge] = te, te.a = ae, ot[Z] = te;
4523
+ (ae = x(Z.substr(0, ae))).b || (ae.b = {}), ae.b[ge] = te, te.a = ae, it[Z] = te;
4531
4524
  }
4532
4525
  return te;
4533
4526
  }("goog.net.XhrIo");
4534
- Jt.b = Qt;
4535
- var en = /^https?$/i, tn = ["POST", "PUT"];
4536
- function nn(x, Z, te) {
4527
+ Xt.b = Jt;
4528
+ var Qt = /^https?$/i, en = ["POST", "PUT"];
4529
+ function tn(x, Z, te) {
4537
4530
  if (x.a)
4538
4531
  throw Error("[goog.net.XhrIo] Object is active with another request=" + x.o + "; newUri=" + Z);
4539
- x.o = Z, x.i = "", x.g = 0, x.J = "POST", x.G = !1, x.c = !0, x.a = x.D ? Ut(x.D) : Ut(at), x.C = x.D ? Bt(x.D) : Bt(at), x.a.onreadystatechange = j(x.K, x);
4532
+ x.o = Z, x.i = "", x.g = 0, x.J = "POST", x.G = !1, x.c = !0, x.a = x.D ? kt(x.D) : kt(ot), x.C = x.D ? Dt(x.D) : Dt(ot), x.a.onreadystatechange = j(x.K, x);
4540
4533
  try {
4541
- Qe(x.b, ht(x, "Opening Xhr")), x.I = !0, x.a.open("POST", String(Z), !0), x.I = !1;
4534
+ Je(x.b, ft(x, "Opening Xhr")), x.I = !0, x.a.open("POST", String(Z), !0), x.I = !1;
4542
4535
  } catch (me) {
4543
- return Qe(x.b, ht(x, "Error opening Xhr: " + me.message)), void Ht(x, me);
4536
+ return Je(x.b, ft(x, "Error opening Xhr: " + me.message)), void Wt(x, me);
4544
4537
  }
4545
4538
  Z = te || "";
4546
4539
  var ae = function(me) {
4547
4540
  e: {
4548
- for (var ue = rn, he = me.length, we = typeof me == "string" ? me.split("") : me, _e = 0; _e < he; _e++)
4541
+ for (var ue = nn, he = me.length, we = typeof me == "string" ? me.split("") : me, _e = 0; _e < he; _e++)
4549
4542
  if (_e in we && ue.call(void 0, we[_e], _e, me)) {
4550
4543
  ue = _e;
4551
4544
  break e;
@@ -4553,35 +4546,35 @@ Found: `.concat(j.toString().split(`
4553
4546
  ue = -1;
4554
4547
  }
4555
4548
  return 0 > ue ? null : typeof me == "string" ? me.charAt(ue) : me[ue];
4556
- }((te = new mt(x.headers)).f()), ge = f.FormData && Z instanceof f.FormData;
4557
- !(0 <= U(tn, "POST")) || ae || ge || te.set("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"), te.forEach(function(me, ue) {
4549
+ }((te = new pt(x.headers)).f()), ge = f.FormData && Z instanceof f.FormData;
4550
+ !(0 <= U(en, "POST")) || ae || ge || te.set("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"), te.forEach(function(me, ue) {
4558
4551
  this.a.setRequestHeader(ue, me);
4559
4552
  }, x), x.j && (x.a.responseType = x.j), "withCredentials" in x.a && x.a.withCredentials !== x.H && (x.a.withCredentials = x.H);
4560
4553
  try {
4561
- $t(x), 0 < x.l && (x.B = function(me) {
4562
- return se && tt(9) && typeof me.timeout == "number" && me.ontimeout !== void 0;
4563
- }(x.a), Qe(x.b, ht(x, "Will abort after " + x.l + "ms if incomplete, xhr2 " + x.B)), x.B ? (x.a.timeout = x.l, x.a.ontimeout = j(x.L, x)) : x.u = $e(x.L, x.l, x)), Qe(x.b, ht(x, "Sending request")), x.m = !0, x.a.send(Z), x.m = !1;
4554
+ Gt(x), 0 < x.l && (x.B = function(me) {
4555
+ return se && et(9) && typeof me.timeout == "number" && me.ontimeout !== void 0;
4556
+ }(x.a), Je(x.b, ft(x, "Will abort after " + x.l + "ms if incomplete, xhr2 " + x.B)), x.B ? (x.a.timeout = x.l, x.a.ontimeout = j(x.L, x)) : x.u = Ge(x.L, x.l, x)), Je(x.b, ft(x, "Sending request")), x.m = !0, x.a.send(Z), x.m = !1;
4564
4557
  } catch (me) {
4565
- Qe(x.b, ht(x, "Send error: " + me.message)), Ht(x, me);
4558
+ Je(x.b, ft(x, "Send error: " + me.message)), Wt(x, me);
4566
4559
  }
4567
4560
  }
4568
- function rn(x) {
4561
+ function nn(x) {
4569
4562
  return x.toLowerCase() == "content-type";
4570
4563
  }
4571
- function Ht(x, Z) {
4572
- x.c = !1, x.a && (x.h = !0, x.a.abort(), x.h = !1), x.i = Z, x.g = 5, Vt(x), Lt(x);
4564
+ function Wt(x, Z) {
4565
+ x.c = !1, x.a && (x.h = !0, x.a.abort(), x.h = !1), x.i = Z, x.g = 5, Ht(x), xt(x);
4573
4566
  }
4574
- function Vt(x) {
4567
+ function Ht(x) {
4575
4568
  x.G || (x.G = !0, Fe(x, "complete"), Fe(x, "error"));
4576
4569
  }
4577
- function Gt(x) {
4570
+ function Vt(x) {
4578
4571
  if (x.c && u !== void 0) {
4579
- if (x.C[1] && yt(x) == 4 && x.getStatus() == 2)
4580
- Qe(x.b, ht(x, "Local request error detected and ignored"));
4581
- else if (x.m && yt(x) == 4)
4582
- $e(x.K, 0, x);
4583
- else if (Fe(x, "readystatechange"), yt(x) == 4) {
4584
- Qe(x.b, ht(x, "Request complete")), x.c = !1;
4572
+ if (x.C[1] && mt(x) == 4 && x.getStatus() == 2)
4573
+ Je(x.b, ft(x, "Local request error detected and ignored"));
4574
+ else if (x.m && mt(x) == 4)
4575
+ Ge(x.K, 0, x);
4576
+ else if (Fe(x, "readystatechange"), mt(x) == 4) {
4577
+ Je(x.b, ft(x, "Request complete")), x.c = !1;
4585
4578
  try {
4586
4579
  var Z, te = x.getStatus();
4587
4580
  e:
@@ -4601,12 +4594,12 @@ Found: `.concat(j.toString().split(`
4601
4594
  if (!(Z = ae)) {
4602
4595
  var ge;
4603
4596
  if (ge = te === 0) {
4604
- var me = String(x.o).match(Xt)[1] || null;
4597
+ var me = String(x.o).match(Kt)[1] || null;
4605
4598
  if (!me && f.self && f.self.location) {
4606
4599
  var ue = f.self.location.protocol;
4607
4600
  me = ue.substr(0, ue.length - 1);
4608
4601
  }
4609
- ge = !en.test(me ? me.toLowerCase() : "");
4602
+ ge = !Qt.test(me ? me.toLowerCase() : "");
4610
4603
  }
4611
4604
  Z = ge;
4612
4605
  }
@@ -4615,67 +4608,67 @@ Found: `.concat(j.toString().split(`
4615
4608
  else {
4616
4609
  x.g = 6;
4617
4610
  try {
4618
- var he = 2 < yt(x) ? x.a.statusText : "";
4611
+ var he = 2 < mt(x) ? x.a.statusText : "";
4619
4612
  } catch (we) {
4620
- Qe(x.b, "Can not get status: " + we.message), he = "";
4613
+ Je(x.b, "Can not get status: " + we.message), he = "";
4621
4614
  }
4622
- x.i = he + " [" + x.getStatus() + "]", Vt(x);
4615
+ x.i = he + " [" + x.getStatus() + "]", Ht(x);
4623
4616
  }
4624
4617
  } finally {
4625
- Lt(x);
4618
+ xt(x);
4626
4619
  }
4627
4620
  }
4628
4621
  }
4629
4622
  }
4630
- function Lt(x) {
4623
+ function xt(x) {
4631
4624
  if (x.a) {
4632
- $t(x);
4625
+ Gt(x);
4633
4626
  var Z = x.a, te = x.C[0] ? w : null;
4634
4627
  x.a = null, x.C = null, Fe(x, "ready");
4635
4628
  try {
4636
4629
  Z.onreadystatechange = te;
4637
4630
  } catch (ae) {
4638
- (x = x.b) && x.log(Ge, "Problem encountered resetting onreadystatechange: " + ae.message, void 0);
4631
+ (x = x.b) && x.log(Ve, "Problem encountered resetting onreadystatechange: " + ae.message, void 0);
4639
4632
  }
4640
4633
  }
4641
4634
  }
4642
- function $t(x) {
4635
+ function Gt(x) {
4643
4636
  x.a && x.B && (x.a.ontimeout = null), x.u && (f.clearTimeout(x.u), x.u = null);
4644
4637
  }
4645
- function yt(x) {
4638
+ function mt(x) {
4646
4639
  return x.a ? x.a.readyState : 0;
4647
4640
  }
4648
- function Zt(x, Z) {
4649
- if (x.a && yt(x) == 4)
4641
+ function $t(x, Z) {
4642
+ if (x.a && mt(x) == 4)
4650
4643
  return (x = x.a.getResponseHeader(Z)) === null ? void 0 : x;
4651
4644
  }
4652
- function ht(x, Z) {
4645
+ function ft(x, Z) {
4653
4646
  return Z + " [" + x.J + " " + x.o + " " + x.getStatus() + "]";
4654
4647
  }
4655
- dt.prototype.L = function() {
4656
- u !== void 0 && this.a && (this.i = "Timed out after " + this.l + "ms, aborting", this.g = 8, Qe(this.b, ht(this, this.i)), Fe(this, "timeout"), this.abort(8));
4657
- }, dt.prototype.abort = function(x) {
4658
- this.a && this.c && (Qe(this.b, ht(this, "Aborting")), this.c = !1, this.h = !0, this.a.abort(), this.h = !1, this.g = x || 7, Fe(this, "complete"), Fe(this, "abort"), Lt(this));
4659
- }, dt.prototype.K = function() {
4660
- this.F || (this.I || this.m || this.h ? Gt(this) : this.O());
4661
- }, dt.prototype.O = function() {
4662
- Gt(this);
4663
- }, dt.prototype.getStatus = function() {
4648
+ ht.prototype.L = function() {
4649
+ u !== void 0 && this.a && (this.i = "Timed out after " + this.l + "ms, aborting", this.g = 8, Je(this.b, ft(this, this.i)), Fe(this, "timeout"), this.abort(8));
4650
+ }, ht.prototype.abort = function(x) {
4651
+ this.a && this.c && (Je(this.b, ft(this, "Aborting")), this.c = !1, this.h = !0, this.a.abort(), this.h = !1, this.g = x || 7, Fe(this, "complete"), Fe(this, "abort"), xt(this));
4652
+ }, ht.prototype.K = function() {
4653
+ this.F || (this.I || this.m || this.h ? Vt(this) : this.O());
4654
+ }, ht.prototype.O = function() {
4655
+ Vt(this);
4656
+ }, ht.prototype.getStatus = function() {
4664
4657
  try {
4665
- return 2 < yt(this) ? this.a.status : -1;
4658
+ return 2 < mt(this) ? this.a.status : -1;
4666
4659
  } catch {
4667
4660
  return -1;
4668
4661
  }
4669
4662
  };
4670
- var qt = {}, At = null;
4671
- function an(x) {
4663
+ var Zt = {}, Rt = null;
4664
+ function rn(x) {
4672
4665
  var Z = x.length, te = 3 * Z / 4;
4673
4666
  te % 3 ? te = Math.floor(te) : ee("=.", x[Z - 1]) && (te = ee("=.", x[Z - 2]) ? te - 2 : te - 1);
4674
4667
  var ae = new Uint8Array(te), ge = 0;
4675
4668
  return function(me, ue) {
4676
4669
  function he(We) {
4677
4670
  for (; we < me.length; ) {
4678
- var ze = me.charAt(we++), He = At[ze];
4671
+ var ze = me.charAt(we++), He = Rt[ze];
4679
4672
  if (He != null)
4680
4673
  return He;
4681
4674
  if (!/^[\s\xa0]*$/.test(ze))
@@ -4683,7 +4676,7 @@ Found: `.concat(j.toString().split(`
4683
4676
  }
4684
4677
  return We;
4685
4678
  }
4686
- Yt();
4679
+ qt();
4687
4680
  for (var we = 0; ; ) {
4688
4681
  var _e = he(-1), Ee = he(0), De = he(64), Le = he(64);
4689
4682
  if (Le === 64 && _e === -1)
@@ -4694,21 +4687,21 @@ Found: `.concat(j.toString().split(`
4694
4687
  ae[ge++] = me;
4695
4688
  }), ae.subarray(0, ge);
4696
4689
  }
4697
- function Yt() {
4698
- if (!At) {
4699
- At = {};
4690
+ function qt() {
4691
+ if (!Rt) {
4692
+ Rt = {};
4700
4693
  for (var x = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""), Z = ["+/=", "+/", "-_=", "-_.", "-_"], te = 0; 5 > te; te++) {
4701
4694
  var ae = x.concat(Z[te].split(""));
4702
- qt[te] = ae;
4695
+ Zt[te] = ae;
4703
4696
  for (var ge = 0; ge < ae.length; ge++) {
4704
4697
  var me = ae[ge];
4705
- At[me] === void 0 && (At[me] = ge);
4698
+ Rt[me] === void 0 && (Rt[me] = ge);
4706
4699
  }
4707
4700
  }
4708
4701
  }
4709
4702
  }
4710
- var sn = ["content-type", "grpc-status", "grpc-message"];
4711
- function gt(x) {
4703
+ var an = ["content-type", "grpc-status", "grpc-message"];
4704
+ function ct(x) {
4712
4705
  this.a = x.T, this.l = null, this.b = [], this.h = [], this.g = [], this.f = [], this.c = [], this.j = !1, this.i = 0, this.m = new L();
4713
4706
  var Z = this;
4714
4707
  X(this.a, "readystatechange", function() {
@@ -4719,14 +4712,14 @@ Found: `.concat(j.toString().split(`
4719
4712
  try {
4720
4713
  var ae = te.a ? te.a.responseText : "";
4721
4714
  } catch (_e) {
4722
- Qe(te.b, "Can not get responseText: " + _e.message), ae = "";
4715
+ Je(te.b, "Can not get responseText: " + _e.message), ae = "";
4723
4716
  }
4724
4717
  if (ae = (te = ae || "").length - te.length % 4, (te = te.substr(Z.i, ae - Z.i)).length == 0)
4725
4718
  return;
4726
- Z.i = ae, te = an(te);
4719
+ Z.i = ae, te = rn(te);
4727
4720
  } else {
4728
4721
  if (te.lastIndexOf("application/grpc", 0) != 0)
4729
- return void wt(Z, { code: 2, message: "Unknown Content-type received.", metadata: {} });
4722
+ return void vt(Z, { code: 2, message: "Unknown Content-type received.", metadata: {} });
4730
4723
  te = new Uint8Array(function(_e) {
4731
4724
  try {
4732
4725
  if (!_e.a)
@@ -4734,7 +4727,7 @@ Found: `.concat(j.toString().split(`
4734
4727
  if ("response" in _e.a)
4735
4728
  return _e.a.response;
4736
4729
  switch (_e.j) {
4737
- case Wt:
4730
+ case zt:
4738
4731
  case "text":
4739
4732
  return _e.a.responseText;
4740
4733
  case "arraybuffer":
@@ -4742,49 +4735,49 @@ Found: `.concat(j.toString().split(`
4742
4735
  return _e.a.mozResponseArrayBuffer;
4743
4736
  }
4744
4737
  var Ee = _e.b;
4745
- return Ee && Ee.log(Ge, "Response type " + _e.j + " is not supported on this browser", void 0), null;
4738
+ return Ee && Ee.log(Ve, "Response type " + _e.j + " is not supported on this browser", void 0), null;
4746
4739
  } catch (De) {
4747
- return Qe(_e.b, "Can not get response: " + De.message), null;
4740
+ return Je(_e.b, "Can not get response: " + De.message), null;
4748
4741
  }
4749
4742
  }(Z.a));
4750
4743
  }
4751
4744
  ae = null;
4752
4745
  try {
4753
4746
  ae = function(_e, Ee) {
4754
- function De(St) {
4755
- Ne.f++, Ne.a = (Ne.a << 8) + St, Ne.f == 4 && (Ne.b = N, Ne.g = 0, typeof Uint8Array < "u" ? Ne.c = new Uint8Array(Ne.a) : Ne.c = Array(Ne.a), Ne.a == 0 && We());
4747
+ function De(wt) {
4748
+ Ne.f++, Ne.a = (Ne.a << 8) + wt, Ne.f == 4 && (Ne.b = N, Ne.g = 0, typeof Uint8Array < "u" ? Ne.c = new Uint8Array(Ne.a) : Ne.c = Array(Ne.a), Ne.a == 0 && We());
4756
4749
  }
4757
- function Le(St) {
4758
- Ne.c[Ne.g++] = St, Ne.g == Ne.a && We();
4750
+ function Le(wt) {
4751
+ Ne.c[Ne.g++] = wt, Ne.g == Ne.a && We();
4759
4752
  }
4760
4753
  function We() {
4761
- var St = {};
4762
- St[Ne.h] = Ne.c, Ne.i.push(St), Ne.b = W;
4754
+ var wt = {};
4755
+ wt[Ne.h] = Ne.c, Ne.i.push(wt), Ne.b = W;
4763
4756
  }
4764
- var ze, He, Ne = _e, ft = 0;
4765
- for (ze = Ee instanceof Uint8Array || Ee instanceof Array ? Ee : new Uint8Array(Ee); ft < ze.length; ) {
4757
+ var ze, He, Ne = _e, gt = 0;
4758
+ for (ze = Ee instanceof Uint8Array || Ee instanceof Array ? Ee : new Uint8Array(Ee); gt < ze.length; ) {
4766
4759
  switch (Ne.b) {
4767
4760
  case P:
4768
- p(Ne, ze, ft, "stream already broken");
4761
+ p(Ne, ze, gt, "stream already broken");
4769
4762
  break;
4770
4763
  case W:
4771
- (He = ze[ft]) == z || He == O ? Ne.h = He : p(Ne, ze, ft, "invalid frame byte"), Ne.b = B, Ne.a = 0, Ne.f = 0;
4764
+ (He = ze[gt]) == z || He == O ? Ne.h = He : p(Ne, ze, gt, "invalid frame byte"), Ne.b = B, Ne.a = 0, Ne.f = 0;
4772
4765
  break;
4773
4766
  case B:
4774
- De(ze[ft]);
4767
+ De(ze[gt]);
4775
4768
  break;
4776
4769
  case N:
4777
- Le(ze[ft]);
4770
+ Le(ze[gt]);
4778
4771
  break;
4779
4772
  default:
4780
4773
  throw Error("unexpected parser state: " + Ne.b);
4781
4774
  }
4782
- Ne.l++, ft++;
4775
+ Ne.l++, gt++;
4783
4776
  }
4784
4777
  return _e = Ne.i, Ne.i = [], 0 < _e.length ? _e : null;
4785
4778
  }(Z.m, te);
4786
4779
  } catch {
4787
- wt(Z, { code: 2, message: "Error in parsing response body", metadata: {} });
4780
+ vt(Z, { code: 2, message: "Error in parsing response body", metadata: {} });
4788
4781
  }
4789
4782
  if (ae)
4790
4783
  for (te = 0; te < ae.length; te++) {
@@ -4799,7 +4792,7 @@ Found: `.concat(j.toString().split(`
4799
4792
  ge.b[he](ue);
4800
4793
  }
4801
4794
  } catch {
4802
- wt(Z, { code: 2, message: "Error in response deserializer function.", metadata: {} });
4795
+ vt(Z, { code: 2, message: "Error in response deserializer function.", metadata: {} });
4803
4796
  }
4804
4797
  }
4805
4798
  if (O in ae[te] && 0 < ae[te][O].length) {
@@ -4810,14 +4803,14 @@ Found: `.concat(j.toString().split(`
4810
4803
  var we = ge[he].indexOf(":");
4811
4804
  ue[ge[he].substring(0, we).trim()] = ge[he].substring(we + 1).trim();
4812
4805
  }
4813
- ge = ue, ue = 0, he = "", "grpc-status" in ge && (ue = ge["grpc-status"], delete ge["grpc-status"]), "grpc-message" in ge && (he = ge["grpc-message"], delete ge["grpc-message"]), wt(Z, { code: Number(ue), message: he, metadata: ge });
4806
+ ge = ue, ue = 0, he = "", "grpc-status" in ge && (ue = ge["grpc-status"], delete ge["grpc-status"]), "grpc-message" in ge && (he = ge["grpc-message"], delete ge["grpc-message"]), vt(Z, { code: Number(ue), message: he, metadata: ge });
4814
4807
  }
4815
4808
  }
4816
4809
  }
4817
4810
  }), X(this.a, "complete", function() {
4818
4811
  var te = Z.a.g, ae = "", ge = {}, me = function(he) {
4819
4812
  var we = {};
4820
- he = (he.a && yt(he) == 4 && he.a.getAllResponseHeaders() || "").split(`\r
4813
+ he = (he.a && mt(he) == 4 && he.a.getAllResponseHeaders() || "").split(`\r
4821
4814
  `);
4822
4815
  for (var _e = 0; _e < he.length; _e++)
4823
4816
  if (!/^[\s\xa0]*$/.test(he[_e])) {
@@ -4838,7 +4831,7 @@ Found: `.concat(j.toString().split(`
4838
4831
  });
4839
4832
  }(Z.a);
4840
4833
  if (Object.keys(me).forEach(function(he) {
4841
- sn.includes(he) || (ge[he] = me[he]);
4834
+ an.includes(he) || (ge[he] = me[he]);
4842
4835
  }), function(he, we) {
4843
4836
  for (var _e = 0; _e < he.g.length; _e++)
4844
4837
  he.g[_e](we);
@@ -4887,39 +4880,39 @@ Found: `.concat(j.toString().split(`
4887
4880
  default:
4888
4881
  ue = 14;
4889
4882
  }
4890
- ue == 10 && Z.j || wt(Z, { code: ue, message: m(te), metadata: {} });
4883
+ ue == 10 && Z.j || vt(Z, { code: ue, message: m(te), metadata: {} });
4891
4884
  } else
4892
- te = !1, "grpc-status" in me && (ue = Zt(Z.a, "grpc-status"), "grpc-message" in me && (ae = Zt(Z.a, "grpc-message")), Number(ue) != 0 && (wt(Z, { code: Number(ue), message: ae, metadata: me }), te = !0)), te || function(he) {
4885
+ te = !1, "grpc-status" in me && (ue = $t(Z.a, "grpc-status"), "grpc-message" in me && (ae = $t(Z.a, "grpc-message")), Number(ue) != 0 && (vt(Z, { code: Number(ue), message: ae, metadata: me }), te = !0)), te || function(he) {
4893
4886
  for (var we = 0; we < he.c.length; we++)
4894
4887
  he.c[we]();
4895
4888
  }(Z);
4896
4889
  });
4897
4890
  }
4898
- function Ot(x, Z) {
4891
+ function At(x, Z) {
4899
4892
  -1 < (Z = x.indexOf(Z)) && x.splice(Z, 1);
4900
4893
  }
4901
- function wt(x, Z) {
4894
+ function vt(x, Z) {
4902
4895
  if (Z.code != 0)
4903
4896
  for (var te = { code: Z.code, message: decodeURIComponent(Z.message || ""), metadata: Z.metadata }, ae = 0; ae < x.f.length; ae++)
4904
4897
  x.f[ae](te);
4905
4898
  for (Z = { code: Z.code, details: decodeURIComponent(Z.message || ""), metadata: Z.metadata }, te = 0; te < x.h.length; te++)
4906
4899
  x.h[te](Z);
4907
4900
  }
4908
- function rt(x) {
4901
+ function nt(x) {
4909
4902
  this.a = E("format", x) || "text", this.f = E("suppressCorsPreflight", x) || !1, this.c = E("withCredentials", x) || !1, this.b = E("streamInterceptors", x) || [], this.g = E("unaryInterceptors", x) || [];
4910
4903
  }
4911
- function Pt(x, Z, te) {
4904
+ function Lt(x, Z, te) {
4912
4905
  var ae = Z.getMethodDescriptor(), ge = te + ae.name;
4913
- (te = new dt()).H = x.c;
4914
- var me = new gt({ T: te });
4915
- if (me.l = ae.b, zt(te.headers, Z.getMetadata()), x.a == "text" ? (te.headers.set("Content-Type", "application/grpc-web-text"), te.headers.set("Accept", "application/grpc-web-text")) : te.headers.set("Content-Type", "application/grpc-web+proto"), te.headers.set("X-User-Agent", "grpc-web-javascript/0.1"), te.headers.set("X-Grpc-Web", "1"), vt(te.headers.b, "deadline")) {
4906
+ (te = new ht()).H = x.c;
4907
+ var me = new ct({ T: te });
4908
+ if (me.l = ae.b, Ft(te.headers, Z.getMetadata()), x.a == "text" ? (te.headers.set("Content-Type", "application/grpc-web-text"), te.headers.set("Accept", "application/grpc-web-text")) : te.headers.set("Content-Type", "application/grpc-web+proto"), te.headers.set("X-User-Agent", "grpc-web-javascript/0.1"), te.headers.set("X-Grpc-Web", "1"), _t(te.headers.b, "deadline")) {
4916
4909
  var ue = te.headers.get("deadline");
4917
4910
  ue = Math.round(ue - (/* @__PURE__ */ new Date()).getTime());
4918
4911
  var he = te.headers;
4919
- vt(he.b, "deadline") && (delete he.b.deadline, he.c--, he.a.length > 2 * he.c && xt(he)), 1 / 0 === ue && (ue = 0), 0 < ue && te.headers.set("grpc-timeout", ue + "m");
4912
+ _t(he.b, "deadline") && (delete he.b.deadline, he.c--, he.a.length > 2 * he.c && jt(he)), 1 / 0 === ue && (ue = 0), 0 < ue && te.headers.set("grpc-timeout", ue + "m");
4920
4913
  }
4921
4914
  if (x.f) {
4922
- xt(he = te.headers), ue = {};
4915
+ jt(he = te.headers), ue = {};
4923
4916
  for (var we = 0; we < he.a.length; we++) {
4924
4917
  var _e = he.a[we];
4925
4918
  ue[_e] = he.b[_e];
@@ -4935,8 +4928,8 @@ Found: `.concat(j.toString().split(`
4935
4928
  Ee || (ue = function(We) {
4936
4929
  var ze = "";
4937
4930
  return function(He, Ne) {
4938
- for (var ft in He)
4939
- Ne.call(void 0, He[ft], ft, He);
4931
+ for (var gt in He)
4932
+ Ne.call(void 0, He[gt], gt, He);
4940
4933
  }(We, function(He, Ne) {
4941
4934
  ze += Ne, ze += ":", ze += He, ze += `\r
4942
4935
  `;
@@ -4947,7 +4940,7 @@ Found: `.concat(j.toString().split(`
4947
4940
  Ee[he] = ae % 256, ae >>>= 8;
4948
4941
  if (ue.set(new Uint8Array(Ee), 1), ue.set(Z, 5), Z = ue, x.a == "text") {
4949
4942
  var De;
4950
- for (x = Z, De === void 0 && (De = 0), Yt(), De = qt[De], Z = [], ae = 0; ae < x.length; ae += 3) {
4943
+ for (x = Z, De === void 0 && (De = 0), qt(), De = Zt[De], Z = [], ae = 0; ae < x.length; ae += 3) {
4951
4944
  _e = x[ae];
4952
4945
  var Le = (Ee = ae + 1 < x.length) ? x[ae + 1] : 0;
4953
4946
  he = _e >> 2, _e = (3 & _e) << 4 | Le >> 4, Le = (15 & Le) << 2 | (we = (ue = ae + 2 < x.length) ? x[ae + 2] : 0) >> 6, we &= 63, ue || (we = 64, Ee || (Le = 64)), Z.push(De[he], De[_e], De[Le] || "", De[we] || "");
@@ -4955,9 +4948,9 @@ Found: `.concat(j.toString().split(`
4955
4948
  Z = Z.join("");
4956
4949
  } else
4957
4950
  x.a == "binary" && (te.j = "arraybuffer");
4958
- return nn(te, ge, Z), me;
4951
+ return tn(te, ge, Z), me;
4959
4952
  }
4960
- function Kt(x, Z, te) {
4953
+ function Yt(x, Z, te) {
4961
4954
  var ae = null, ge = !1;
4962
4955
  x.on("data", function(me) {
4963
4956
  ae = me;
@@ -4971,7 +4964,7 @@ Found: `.concat(j.toString().split(`
4971
4964
  ge || (ae == null ? Z({ code: 2, message: "Incomplete response" }) : Z(null, ae)), te && Z(null, null);
4972
4965
  });
4973
4966
  }
4974
- function Dt(x, Z) {
4967
+ function Pt(x, Z) {
4975
4968
  var te = x;
4976
4969
  return Z.forEach(function(ae) {
4977
4970
  var ge = te;
@@ -4980,45 +4973,45 @@ Found: `.concat(j.toString().split(`
4980
4973
  };
4981
4974
  }), te;
4982
4975
  }
4983
- gt.prototype.on = function(x, Z) {
4976
+ ct.prototype.on = function(x, Z) {
4984
4977
  return x == "data" ? this.b.push(Z) : x == "status" ? this.h.push(Z) : x == "metadata" ? this.g.push(Z) : x == "end" ? this.c.push(Z) : x == "error" && this.f.push(Z), this;
4985
- }, gt.prototype.removeListener = function(x, Z) {
4986
- return x == "data" ? Ot(this.b, Z) : x == "status" ? Ot(this.h, Z) : x == "metadata" ? Ot(this.g, Z) : x == "end" ? Ot(this.c, Z) : x == "error" && Ot(this.f, Z), this;
4987
- }, gt.prototype.cancel = function() {
4978
+ }, ct.prototype.removeListener = function(x, Z) {
4979
+ return x == "data" ? At(this.b, Z) : x == "status" ? At(this.h, Z) : x == "metadata" ? At(this.g, Z) : x == "end" ? At(this.c, Z) : x == "error" && At(this.f, Z), this;
4980
+ }, ct.prototype.cancel = function() {
4988
4981
  this.j = !0, this.a.abort();
4989
- }, gt.prototype.cancel = gt.prototype.cancel, gt.prototype.removeListener = gt.prototype.removeListener, gt.prototype.on = gt.prototype.on, rt.prototype.P = function(x, Z, te, ae, ge) {
4982
+ }, ct.prototype.cancel = ct.prototype.cancel, ct.prototype.removeListener = ct.prototype.removeListener, ct.prototype.on = ct.prototype.on, nt.prototype.P = function(x, Z, te, ae, ge) {
4990
4983
  var me = this;
4991
4984
  ae = q(x, Z, "unary", ae);
4992
4985
  var ue = x.substr(0, x.length - ae.name.length);
4993
- return Kt(x = Dt(function(he) {
4994
- return Pt(me, he, ue);
4986
+ return Yt(x = Pt(function(he) {
4987
+ return Lt(me, he, ue);
4995
4988
  }, this.b).call(this, $(ae, Z, te)), ge, !1), new y(x);
4996
- }, rt.prototype.M = function(x, Z, te, ae) {
4989
+ }, nt.prototype.M = function(x, Z, te, ae) {
4997
4990
  var ge = this;
4998
4991
  ae = q(x, Z, "unary", ae);
4999
4992
  var me = x.substr(0, x.length - ae.name.length);
5000
- return Dt(function(ue) {
4993
+ return Pt(function(ue) {
5001
4994
  return new Promise(function(he, we) {
5002
4995
  var _e, Ee, De;
5003
- Kt(Pt(ge, ue, me), function(Le, We, ze, He) {
4996
+ Yt(Lt(ge, ue, me), function(Le, We, ze, He) {
5004
4997
  Le ? we(Le) : We ? De = We : ze ? Ee = ze : He ? _e = He : (Le = ue.getMethodDescriptor(), he(new d(De, Le, We = (We = _e) === void 0 ? {} : We, Ee === void 0 ? null : Ee)));
5005
4998
  }, !0);
5006
4999
  });
5007
5000
  }, this.g).call(this, $(ae, Z, te)).then(function(ue) {
5008
5001
  return ue.getResponseMessage();
5009
5002
  });
5010
- }, rt.prototype.unaryCall = function(x, Z, te, ae) {
5003
+ }, nt.prototype.unaryCall = function(x, Z, te, ae) {
5011
5004
  return this.M(x, Z, te, ae);
5012
- }, rt.prototype.R = function(x, Z, te, ae) {
5005
+ }, nt.prototype.R = function(x, Z, te, ae) {
5013
5006
  var ge = this;
5014
5007
  ae = q(x, Z, "server_streaming", ae);
5015
5008
  var me = x.substr(0, x.length - ae.name.length);
5016
- return Dt(function(ue) {
5017
- return Pt(ge, ue, me);
5009
+ return Pt(function(ue) {
5010
+ return Lt(ge, ue, me);
5018
5011
  }, this.b).call(this, $(ae, Z, te));
5019
- }, rt.prototype.serverStreaming = rt.prototype.R, rt.prototype.unaryCall = rt.prototype.unaryCall, rt.prototype.thenableCall = rt.prototype.M, rt.prototype.rpcCall = rt.prototype.P, e.exports.AbstractClientBase = { MethodInfo: function(x, Z, te, ae, ge) {
5012
+ }, nt.prototype.serverStreaming = nt.prototype.R, nt.prototype.unaryCall = nt.prototype.unaryCall, nt.prototype.thenableCall = nt.prototype.M, nt.prototype.rpcCall = nt.prototype.P, e.exports.AbstractClientBase = { MethodInfo: function(x, Z, te, ae, ge) {
5020
5013
  this.name = ae, this.b = ge, this.f = x, this.a = Z, this.c = te;
5021
- } }, e.exports.GrpcWebClientBase = rt, e.exports.StatusCode = { OK: 0, CANCELLED: 1, UNKNOWN: 2, INVALID_ARGUMENT: 3, DEADLINE_EXCEEDED: 4, NOT_FOUND: 5, ALREADY_EXISTS: 6, PERMISSION_DENIED: 7, UNAUTHENTICATED: 16, RESOURCE_EXHAUSTED: 8, FAILED_PRECONDITION: 9, ABORTED: 10, OUT_OF_RANGE: 11, UNIMPLEMENTED: 12, INTERNAL: 13, UNAVAILABLE: 14, DATA_LOSS: 15 }, e.exports.MethodDescriptor = C, e.exports.MethodType = { UNARY: "unary", SERVER_STREAMING: "server_streaming" };
5014
+ } }, e.exports.GrpcWebClientBase = nt, e.exports.StatusCode = { OK: 0, CANCELLED: 1, UNKNOWN: 2, INVALID_ARGUMENT: 3, DEADLINE_EXCEEDED: 4, NOT_FOUND: 5, ALREADY_EXISTS: 6, PERMISSION_DENIED: 7, UNAUTHENTICATED: 16, RESOURCE_EXHAUSTED: 8, FAILED_PRECONDITION: 9, ABORTED: 10, OUT_OF_RANGE: 11, UNIMPLEMENTED: 12, INTERNAL: 13, UNAVAILABLE: 14, DATA_LOSS: 15 }, e.exports.MethodDescriptor = C, e.exports.MethodType = { UNARY: "unary", SERVER_STREAMING: "server_streaming" };
5022
5015
  }).call(this, n(6));
5023
5016
  }, function(e, t, n) {
5024
5017
  Object.defineProperty(t, "__esModule", { value: !0 }), t.isAsyncIterable = t.isAsyncGenerator = t.isAsync = void 0;
@@ -15555,18 +15548,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
15555
15548
  V = p.heap[1], p.heap[1] = p.heap[p.heap_len--], L(p, ne, 1), Q = p.heap[1], p.heap[--p.heap_max] = V, p.heap[--p.heap_max] = Q, ne[2 * ee] = ne[2 * V] + ne[2 * Q], p.depth[ee] = (p.depth[V] >= p.depth[Q] ? p.depth[V] : p.depth[Q]) + 1, ne[2 * V + 1] = ne[2 * Q + 1] = ee, p.heap[1] = ee++, L(p, ne, 1);
15556
15549
  while (p.heap_len >= 2);
15557
15550
  p.heap[--p.heap_max] = p.heap[1], function(k, J) {
15558
- var K, re, se, fe, ve, Ce, Se = J.dyn_tree, Ie = J.max_code, Te = J.stat_desc.static_tree, Oe = J.stat_desc.has_stree, Pe = J.stat_desc.extra_bits, qe = J.stat_desc.extra_base, tt = J.stat_desc.max_length, et = 0;
15551
+ var K, re, se, fe, ve, Ce, Se = J.dyn_tree, Ie = J.max_code, Te = J.stat_desc.static_tree, Oe = J.stat_desc.has_stree, Pe = J.stat_desc.extra_bits, Ze = J.stat_desc.extra_base, et = J.stat_desc.max_length, Qe = 0;
15559
15552
  for (fe = 0; fe <= 15; fe++)
15560
15553
  k.bl_count[fe] = 0;
15561
15554
  for (Se[2 * k.heap[k.heap_max] + 1] = 0, K = k.heap_max + 1; K < 573; K++)
15562
- (fe = Se[2 * Se[2 * (re = k.heap[K]) + 1] + 1] + 1) > tt && (fe = tt, et++), Se[2 * re + 1] = fe, re > Ie || (k.bl_count[fe]++, ve = 0, re >= qe && (ve = Pe[re - qe]), Ce = Se[2 * re], k.opt_len += Ce * (fe + ve), Oe && (k.static_len += Ce * (Te[2 * re + 1] + ve)));
15563
- if (et !== 0) {
15555
+ (fe = Se[2 * Se[2 * (re = k.heap[K]) + 1] + 1] + 1) > et && (fe = et, Qe++), Se[2 * re + 1] = fe, re > Ie || (k.bl_count[fe]++, ve = 0, re >= Ze && (ve = Pe[re - Ze]), Ce = Se[2 * re], k.opt_len += Ce * (fe + ve), Oe && (k.static_len += Ce * (Te[2 * re + 1] + ve)));
15556
+ if (Qe !== 0) {
15564
15557
  do {
15565
- for (fe = tt - 1; k.bl_count[fe] === 0; )
15558
+ for (fe = et - 1; k.bl_count[fe] === 0; )
15566
15559
  fe--;
15567
- k.bl_count[fe]--, k.bl_count[fe + 1] += 2, k.bl_count[tt]--, et -= 2;
15568
- } while (et > 0);
15569
- for (fe = tt; fe !== 0; fe--)
15560
+ k.bl_count[fe]--, k.bl_count[fe + 1] += 2, k.bl_count[et]--, Qe -= 2;
15561
+ } while (Qe > 0);
15562
+ for (fe = et; fe !== 0; fe--)
15570
15563
  for (re = k.bl_count[fe]; re !== 0; )
15571
15564
  (se = k.heap[--K]) > Ie || (Se[2 * se + 1] !== fe && (k.opt_len += (fe - Se[2 * se + 1]) * Se[2 * se], Se[2 * se + 1] = fe), re--);
15572
15565
  }
@@ -17804,9 +17797,9 @@ Found: ${s.toString().split(`
17804
17797
  }), n.d(t, "IRtcStreamPayload", function() {
17805
17798
  }), n.d(t, "IStreamControl", function() {
17806
17799
  }), n.d(t, "RtcClient", function() {
17807
- return Nt;
17800
+ return Mt;
17808
17801
  }), n.d(t, "RtcClientV1", function() {
17809
- return Rt;
17802
+ return Tt;
17810
17803
  }), n.d(t, "createRtcStreamMessage", function() {
17811
17804
  return Pe;
17812
17805
  });
@@ -17828,8 +17821,8 @@ Found: ${s.toString().split(`
17828
17821
  }
17829
17822
  function be(ce) {
17830
17823
  var le;
17831
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
17832
- Re(le);
17824
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
17825
+ Ae(le);
17833
17826
  })).then(de, ye);
17834
17827
  }
17835
17828
  be((X = X.apply(pe, D || [])).next());
@@ -17920,8 +17913,8 @@ Found: ${s.toString().split(`
17920
17913
  }
17921
17914
  function be(ce) {
17922
17915
  var le;
17923
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
17924
- Re(le);
17916
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
17917
+ Ae(le);
17925
17918
  })).then(de, ye);
17926
17919
  }
17927
17920
  be((X = X.apply(pe, D || [])).next());
@@ -17997,8 +17990,8 @@ Found: ${s.toString().split(`
17997
17990
  }
17998
17991
  function be(ce) {
17999
17992
  var le;
18000
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18001
- Re(le);
17993
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
17994
+ Ae(le);
18002
17995
  })).then(de, ye);
18003
17996
  }
18004
17997
  be((X = X.apply(pe, D || [])).next());
@@ -18040,8 +18033,8 @@ Found: ${s.toString().split(`
18040
18033
  }
18041
18034
  function be(ce) {
18042
18035
  var le;
18043
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18044
- Re(le);
18036
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18037
+ Ae(le);
18045
18038
  })).then(de, ye);
18046
18039
  }
18047
18040
  be((X = X.apply(pe, D || [])).next());
@@ -18087,8 +18080,8 @@ Found: ${s.toString().split(`
18087
18080
  }
18088
18081
  function be(ce) {
18089
18082
  var le;
18090
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18091
- Re(le);
18083
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18084
+ Ae(le);
18092
18085
  })).then(de, ye);
18093
18086
  }
18094
18087
  be((X = X.apply(pe, D || [])).next());
@@ -18195,8 +18188,8 @@ Found: ${s.toString().split(`
18195
18188
  }
18196
18189
  function be(ce) {
18197
18190
  var le;
18198
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18199
- Re(le);
18191
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18192
+ Ae(le);
18200
18193
  })).then(de, ye);
18201
18194
  }
18202
18195
  be((X = X.apply(pe, D || [])).next());
@@ -18275,8 +18268,8 @@ Found: ${s.toString().split(`
18275
18268
  }
18276
18269
  function be(ce) {
18277
18270
  var le;
18278
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18279
- Re(le);
18271
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18272
+ Ae(le);
18280
18273
  })).then(de, ye);
18281
18274
  }
18282
18275
  be((X = X.apply(pe, D || [])).next());
@@ -18316,8 +18309,8 @@ Found: ${s.toString().split(`
18316
18309
  }
18317
18310
  function be(ce) {
18318
18311
  var le;
18319
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18320
- Re(le);
18312
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18313
+ Ae(le);
18321
18314
  })).then(de, ye);
18322
18315
  }
18323
18316
  be((X = X.apply(pe, D || [])).next());
@@ -18351,8 +18344,8 @@ Found: ${s.toString().split(`
18351
18344
  }
18352
18345
  function be(ce) {
18353
18346
  var le;
18354
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18355
- Re(le);
18347
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18348
+ Ae(le);
18356
18349
  })).then(de, ye);
18357
18350
  }
18358
18351
  be((X = X.apply(pe, D || [])).next());
@@ -18407,25 +18400,25 @@ Found: ${s.toString().split(`
18407
18400
  const H = Array.from(pe.values()), X = H.filter(fe), ie = X.length > 0, oe = Math.max(...X.map((ce) => ce.received));
18408
18401
  let de;
18409
18402
  if (ie) {
18410
- const ce = H.length, le = X.length, Re = X.map((xe) => xe.received - xe.sent), { standardDeviation: Me, mean: je, jitter: Fe } = function(xe) {
18403
+ const ce = H.length, le = X.length, Ae = X.map((xe) => xe.received - xe.sent), { standardDeviation: Me, mean: je, jitter: Fe } = function(xe) {
18411
18404
  const Be = xe.length;
18412
18405
  if (Be === 0)
18413
18406
  return { mean: NaN, standardDeviation: -1, jitter: NaN };
18414
- const Ge = xe.reduce((Je, at) => Je + at, 0) / Be, Ze = Math.sqrt(xe.map((Je) => Math.pow(Je - Ge, 2)).reduce((Je, at) => Je + at) / Be);
18407
+ const Ve = xe.reduce((Xe, ot) => Xe + ot, 0) / Be, $e = Math.sqrt(xe.map((Xe) => Math.pow(Xe - Ve, 2)).reduce((Xe, ot) => Xe + ot) / Be);
18415
18408
  if (Be === 1)
18416
- return { mean: Ge, standardDeviation: Ze, jitter: NaN };
18417
- let Xe = 0;
18418
- for (let Je = 1; Je < Be; Je++)
18419
- Xe += Math.abs(xe[Je] - xe[Je - 1]);
18420
- return { mean: Ge, standardDeviation: Ze, jitter: Xe / (Be - 1) };
18421
- }(Re), Ke = H.filter((xe) => xe.sent < oe - Ce), $e = Ke.filter(ve), Ye = $e.length === 0 ? 0 : $e.length / Ke.length;
18422
- de = { pingsSent: ce, pongsReceived: le, average: je, standardDeviation: Me, jitter: Fe, max: Math.max(...Re), min: Math.min(...Re), loss: Ye };
18409
+ return { mean: Ve, standardDeviation: $e, jitter: NaN };
18410
+ let Ke = 0;
18411
+ for (let Xe = 1; Xe < Be; Xe++)
18412
+ Ke += Math.abs(xe[Xe] - xe[Xe - 1]);
18413
+ return { mean: Ve, standardDeviation: $e, jitter: Ke / (Be - 1) };
18414
+ }(Ae), Ye = H.filter((xe) => xe.sent < oe - Ce), Ge = Ye.filter(ve), qe = Ge.length === 0 ? 0 : Ge.length / Ye.length;
18415
+ de = { pingsSent: ce, pongsReceived: le, average: je, standardDeviation: Me, jitter: Fe, max: Math.max(...Ae), min: Math.min(...Ae), loss: qe };
18423
18416
  } else
18424
18417
  de = null;
18425
18418
  const { temporalNow: ye = Date.now() } = D, be = (ie ? oe : ye) - 4 * Ce;
18426
18419
  return Array.from(pe.entries()).forEach((ce) => {
18427
- const [le, Re] = ce;
18428
- Re.sent < be && pe.delete(le);
18420
+ const [le, Ae] = ce;
18421
+ Ae.sent < be && pe.delete(le);
18429
18422
  }), de;
18430
18423
  }
18431
18424
  function Ie({ entityId: pe, streamName: D, streamType: H }) {
@@ -18449,8 +18442,8 @@ Found: ${s.toString().split(`
18449
18442
  }
18450
18443
  function be(ce) {
18451
18444
  var le;
18452
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18453
- Re(le);
18445
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18446
+ Ae(le);
18454
18447
  })).then(de, ye);
18455
18448
  }
18456
18449
  be((X = X.apply(pe, D || [])).next());
@@ -18491,8 +18484,8 @@ Found: ${s.toString().split(`
18491
18484
  const { sessionId: D } = this, H = yield this.connection.peerConnection.getStats(), X = {};
18492
18485
  H.forEach((ce) => X[ce.id] = ce), g.a.debug("rtc-stats", Object.assign(Object.assign({}, X), { sessionId: D }));
18493
18486
  const { localSent: ie, localReceived: oe, remoteSent: de, remoteReceived: ye } = this.counts, be = [.../* @__PURE__ */ new Set([...ie.keys(), ...oe.keys()])].reduce((ce, le) => {
18494
- const Re = ie.get(le), Me = oe.get(le), je = de.get(le), Fe = ye.get(le);
18495
- return Object.assign(Object.assign({}, ce), { [`local-${le}-sent`]: Re, [`local-${le}-received`]: Me, [`remote-${le}-sent`]: je, [`remote-${le}-received`]: Fe });
18487
+ const Ae = ie.get(le), Me = oe.get(le), je = de.get(le), Fe = ye.get(le);
18488
+ return Object.assign(Object.assign({}, ce), { [`local-${le}-sent`]: Ae, [`local-${le}-received`]: Me, [`remote-${le}-sent`]: je, [`remote-${le}-received`]: Fe });
18496
18489
  }, { sessionId: D });
18497
18490
  g.a.debug("rtc-message-report", Object.assign({ deviceId: this.connection.getRemoteDeviceId() }, be));
18498
18491
  });
@@ -18501,10 +18494,10 @@ Found: ${s.toString().split(`
18501
18494
  function Pe(pe, D, H) {
18502
18495
  return { header: { stream: pe, created: Date.now(), frameId: H || "" }, payload: D };
18503
18496
  }
18504
- function qe(pe) {
18497
+ function Ze(pe) {
18505
18498
  return (/* @__PURE__ */ new Set(["disconnected", "failed", "closed"])).has(pe.iceConnectionState);
18506
18499
  }
18507
- function tt(pe) {
18500
+ function et(pe) {
18508
18501
  switch (pe.header.stream.streamType) {
18509
18502
  case "twist": {
18510
18503
  const { twist: D } = pe.payload;
@@ -18539,7 +18532,7 @@ Found: ${s.toString().split(`
18539
18532
  return pe;
18540
18533
  }
18541
18534
  }
18542
- var et = function(pe, D, H, X) {
18535
+ var Qe = function(pe, D, H, X) {
18543
18536
  return new (H || (H = Promise))(function(ie, oe) {
18544
18537
  function de(ce) {
18545
18538
  try {
@@ -18557,14 +18550,14 @@ Found: ${s.toString().split(`
18557
18550
  }
18558
18551
  function be(ce) {
18559
18552
  var le;
18560
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18561
- Re(le);
18553
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18554
+ Ae(le);
18562
18555
  })).then(de, ye);
18563
18556
  }
18564
18557
  be((X = X.apply(pe, D || [])).next());
18565
18558
  });
18566
18559
  };
18567
- class bt {
18560
+ class yt {
18568
18561
  constructor(D, H, X) {
18569
18562
  this.peerConnection = D, this.config = H, this.dataChannelNotifier = X, this.connectTimeoutMs = 20 * c.a.second, this.iceGatheringTimeoutMs = 15 * c.a.second, this.pingUpdateTimeoutMs = 1 * c.a.second, this.pingV2UpdateTimeoutMs = 250 * c.a.millisecond, this.pingV2MetricsGatherTimeoutMs = 1 * c.a.second, this.streamsInfoUpdateTimeoutMs = 2 * c.a.second, this.reassemblyTimeoutMs = 500 * c.a.millisecond, this.reassemblyTableCleanupMs = 1 * c.a.second, this.heartbeatTimeoutMs = 20 * c.a.millisecond, this.streamLatestTimestamp = /* @__PURE__ */ new Map(), this.reassemblyTable = /* @__PURE__ */ new Map(), this.reassemblyTableLastTimestamp = /* @__PURE__ */ new Map(), this.closeCalled = !1, this.gotOffer = !1, this.hasIceCandidate = !1, this.pingV2Map = /* @__PURE__ */ new Map(), this.sendPingV2 = () => {
18570
18563
  const { latestTryOnceStreamChannel: oe } = this;
@@ -18617,7 +18610,7 @@ Found: ${s.toString().split(`
18617
18610
  }, this.heartbeatTimeoutMs);
18618
18611
  }
18619
18612
  handleSignal(D) {
18620
- return et(this, void 0, void 0, function* () {
18613
+ return Qe(this, void 0, void 0, function* () {
18621
18614
  const { peerConnection: H } = this, { track: X } = this.config.baseConfig, ie = (() => {
18622
18615
  try {
18623
18616
  return JSON.parse(D.getPayload());
@@ -18670,10 +18663,10 @@ Found: ${s.toString().split(`
18670
18663
  return (D == null ? void 0 : D.readyState) === "open" && (H == null ? void 0 : H.readyState) === "open" && (X == null ? void 0 : X.readyState) === "open" && (ie == null ? void 0 : ie.readyState) === "open";
18671
18664
  }
18672
18665
  close() {
18673
- return et(this, void 0, void 0, function* () {
18666
+ return Qe(this, void 0, void 0, function* () {
18674
18667
  if (this.closeCalled)
18675
18668
  return;
18676
- this.closeCalled = !0, this.sessionMetrics && (yield this.sessionMetrics.uploadMetrics()), lt(this.pingUpdateTimeout), lt(this.pingV2UpdateTimeout), lt(this.pingV2MetricsGatherTimeout), lt(this.reassemblyTableCleanupTimeout), lt(this.streamsInfoUpdateTimeout), lt(this.heartbeatTimeout);
18669
+ this.closeCalled = !0, this.sessionMetrics && (yield this.sessionMetrics.uploadMetrics()), st(this.pingUpdateTimeout), st(this.pingV2UpdateTimeout), st(this.pingV2MetricsGatherTimeout), st(this.reassemblyTableCleanupTimeout), st(this.streamsInfoUpdateTimeout), st(this.heartbeatTimeout);
18677
18670
  const { peerConnection: D, reliableStreamChannel: H, latestTtlStreamChannel: X, latestTryOnceStreamChannel: ie, latestReliableStreamChannel: oe } = this;
18678
18671
  D.close(), H == null || H.close(), X == null || X.close(), ie == null || ie.close(), oe == null || oe.close();
18679
18672
  });
@@ -18716,7 +18709,7 @@ Found: ${s.toString().split(`
18716
18709
  return (D = this.sessionMetrics) === null || D === void 0 ? void 0 : D.counts;
18717
18710
  }
18718
18711
  getConnectionStatsInfo() {
18719
- return et(this, void 0, void 0, function* () {
18712
+ return Qe(this, void 0, void 0, function* () {
18720
18713
  const { peerConnection: D } = this;
18721
18714
  if (!D)
18722
18715
  return;
@@ -18739,26 +18732,26 @@ Found: ${s.toString().split(`
18739
18732
  }
18740
18733
  getOffer() {
18741
18734
  var D, H, X;
18742
- return et(this, void 0, void 0, function* () {
18735
+ return Qe(this, void 0, void 0, function* () {
18743
18736
  const { gotOffer: ie } = this, { peerConnection: oe, config: de } = this;
18744
18737
  if (this.config.baseConfig.isLan)
18745
18738
  throw new Error('"getOffer" method can only be called with internet connections. LAN connections should call the "getLanOffer" method.');
18746
18739
  const ye = (D = this.config.remoteConfig) === null || D === void 0 ? void 0 : D.sessionId;
18747
18740
  if (ie)
18748
18741
  return void g.a.debug("Failed to generate offer because gotOffer was already called.");
18749
- if (this.gotOffer = !0, qe(this.peerConnection))
18742
+ if (this.gotOffer = !0, Ze(this.peerConnection))
18750
18743
  return void g.a.debug("Failed to generate offer because the peer connection was inactive.");
18751
18744
  const be = de.baseConfig.track;
18752
18745
  oe.onicecandidate = () => {
18753
18746
  this.hasIceCandidate = !0;
18754
- }, oe.oniceconnectionstatechange = () => et(this, void 0, void 0, function* () {
18747
+ }, oe.oniceconnectionstatechange = () => Qe(this, void 0, void 0, function* () {
18755
18748
  const je = oe.iceConnectionState;
18756
18749
  if (je === "connected" || je === "completed") {
18757
- const Fe = yield this.getConnectionStatsInfo(), Ke = Fe ? function($e) {
18758
- const Ye = $e.localCandidate.candidateType, xe = $e.remoteCandidate.candidateType;
18759
- return Ye === "host" && xe === "host" ? "local" : Ye === "relay" || xe === "relay" ? "TURN" : "STUN";
18750
+ const Fe = yield this.getConnectionStatsInfo(), Ye = Fe ? function(Ge) {
18751
+ const qe = Ge.localCandidate.candidateType, xe = Ge.remoteCandidate.candidateType;
18752
+ return qe === "host" && xe === "host" ? "local" : qe === "relay" || xe === "relay" ? "TURN" : "STUN";
18760
18753
  }(Fe) : void 0;
18761
- g.a.info(`ICE connection state changed to ${je}`, { sessionId: ye, connectionStatsInfo: Fe, iceMode: Ke }), be == null || be("ICE connection state change", { iceConnectionState: je, sessionId: ye, connectionStatsInfo: Fe, iceMode: Ke });
18754
+ g.a.info(`ICE connection state changed to ${je}`, { sessionId: ye, connectionStatsInfo: Fe, iceMode: Ye }), be == null || be("ICE connection state change", { iceConnectionState: je, sessionId: ye, connectionStatsInfo: Fe, iceMode: Ye });
18762
18755
  }
18763
18756
  }), yield oe.setLocalDescription(yield oe.createOffer());
18764
18757
  const ce = (/* @__PURE__ */ new Date()).getTime();
@@ -18779,18 +18772,18 @@ Found: ${s.toString().split(`
18779
18772
  const le = (H = this.peerConnection.getConfiguration().iceServers) !== null && H !== void 0 ? H : [];
18780
18773
  for (const je of le)
18781
18774
  "credentialType" in je && (je.credentialType = void 0);
18782
- const Re = JSON.stringify(le), Me = new ee.Signal();
18783
- return Me.setPayload(JSON.stringify(oe.localDescription)), Me.setSenderId(this.config.baseConfig.localPeerId), Me.setReceiverId(this.config.baseConfig.remotePeerId), Me.setIceServers(Re), Me.setIceTransportPolicy((X = this.peerConnection.getConfiguration().iceTransportPolicy) !== null && X !== void 0 ? X : "all"), this.config.baseConfig.sessionType !== void 0 ? Me.setSessionType(this.config.baseConfig.sessionType) : Me.setSessionType(ee.SessionType.TELEOP), g.a.debug("Sending offer signal with description", { description: Me.getPayload() }), Me;
18775
+ const Ae = JSON.stringify(le), Me = new ee.Signal();
18776
+ return Me.setPayload(JSON.stringify(oe.localDescription)), Me.setSenderId(this.config.baseConfig.localPeerId), Me.setReceiverId(this.config.baseConfig.remotePeerId), Me.setIceServers(Ae), Me.setIceTransportPolicy((X = this.peerConnection.getConfiguration().iceTransportPolicy) !== null && X !== void 0 ? X : "all"), this.config.baseConfig.sessionType !== void 0 ? Me.setSessionType(this.config.baseConfig.sessionType) : Me.setSessionType(ee.SessionType.TELEOP), g.a.debug("Sending offer signal with description", { description: Me.getPayload() }), Me;
18784
18777
  });
18785
18778
  }
18786
18779
  getLanOffer() {
18787
- return et(this, void 0, void 0, function* () {
18780
+ return Qe(this, void 0, void 0, function* () {
18788
18781
  const { peerConnection: D, gotOffer: H } = this;
18789
18782
  if (!this.config.baseConfig.isLan)
18790
18783
  throw new Error('"getLanOffer" method can only be used with LAN connections. Internet connections should call the "getOffer" method.');
18791
18784
  if (H)
18792
18785
  return void g.a.debug("Failed to generate offer because gotOffer was already called.");
18793
- if (this.gotOffer = !0, qe(this.peerConnection))
18786
+ if (this.gotOffer = !0, Ze(this.peerConnection))
18794
18787
  return void g.a.debug("Failed to generate offer because the peer connection was inactive.");
18795
18788
  yield D.setLocalDescription(yield D.createOffer());
18796
18789
  const X = (/* @__PURE__ */ new Date()).getTime();
@@ -18808,7 +18801,7 @@ Found: ${s.toString().split(`
18808
18801
  });
18809
18802
  }
18810
18803
  handleLanAnswer(D) {
18811
- return et(this, void 0, void 0, function* () {
18804
+ return Qe(this, void 0, void 0, function* () {
18812
18805
  const { peerConnection: H } = this;
18813
18806
  if (!this.config.baseConfig.isLan)
18814
18807
  throw new Error('"handleLanAnswer" method can only be used with LAN connections. Internet connections should call the "handleSignal" method.');
@@ -18865,7 +18858,7 @@ Found: ${s.toString().split(`
18865
18858
  }
18866
18859
  receiveChannelMessage(D, H) {
18867
18860
  const { config: X } = this, { remotePeerId: ie } = this.config.baseConfig;
18868
- this.lastMessageTimestamp = (/* @__PURE__ */ new Date()).getTime(), H = tt(H), this.sessionMetrics && this.sessionMetrics.incrementLocalReceived(H), this.handleSystemMessage(D, H) || (D === this.latestTryOnceStreamChannel || D === this.latestTtlStreamChannel || D === this.latestReliableStreamChannel) && !this.isLatestMessage(H) || X.baseConfig.receive(ie, H);
18861
+ this.lastMessageTimestamp = (/* @__PURE__ */ new Date()).getTime(), H = et(H), this.sessionMetrics && this.sessionMetrics.incrementLocalReceived(H), this.handleSystemMessage(D, H) || (D === this.latestTryOnceStreamChannel || D === this.latestTtlStreamChannel || D === this.latestReliableStreamChannel) && !this.isLatestMessage(H) || X.baseConfig.receive(ie, H);
18869
18862
  }
18870
18863
  receiveChannelMessageChunk(D, H) {
18871
18864
  const X = this.reassemblyTable.get(H.id) || [];
@@ -18941,10 +18934,10 @@ Found: ${s.toString().split(`
18941
18934
  return X && this.streamLatestTimestamp.set(H, D.header.created), X;
18942
18935
  }
18943
18936
  }
18944
- function lt(pe) {
18937
+ function st(pe) {
18945
18938
  pe && clearInterval(pe);
18946
18939
  }
18947
- function _t() {
18940
+ function bt() {
18948
18941
  g.a.debug("forceGarbageCollection() triggered"), queueMicrotask(() => {
18949
18942
  let pe = document.createElement("img");
18950
18943
  pe.src = window.URL.createObjectURL(new Blob([new ArrayBuffer(5e7)])), pe.onerror = function() {
@@ -18952,14 +18945,14 @@ Found: ${s.toString().split(`
18952
18945
  };
18953
18946
  });
18954
18947
  }
18955
- function It(pe) {
18948
+ function Ot(pe) {
18956
18949
  try {
18957
18950
  return pe instanceof Error ? `${pe.name}: ${pe.message}` : typeof pe == "object" ? JSON.stringify(pe) : String(pe);
18958
18951
  } catch {
18959
18952
  return "Unknown error";
18960
18953
  }
18961
18954
  }
18962
- function Et(pe) {
18955
+ function St(pe) {
18963
18956
  var D, H;
18964
18957
  return { userId: (D = pe.getUserId()) === null || D === void 0 ? void 0 : D.getValue(), deviceId: (H = pe.getDeviceId()) === null || H === void 0 ? void 0 : H.getValue(), organizationId: pe.getOrganizationId(), id: pe.getPeerId(), capabilities: [], capabilitySet: {} };
18965
18958
  }
@@ -18981,14 +18974,14 @@ Found: ${s.toString().split(`
18981
18974
  }
18982
18975
  function be(ce) {
18983
18976
  var le;
18984
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
18985
- Re(le);
18977
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
18978
+ Ae(le);
18986
18979
  })).then(de, ye);
18987
18980
  }
18988
18981
  be((X = X.apply(pe, D || [])).next());
18989
18982
  });
18990
18983
  };
18991
- class Nt {
18984
+ class Mt {
18992
18985
  constructor(D) {
18993
18986
  this.config = D, this.grpcCallDeadline = 5 * c.a.second, this.refreshIntervalDelayMs = 2 * c.a.second, this.iceServersTtl = 30 * c.a.minute, this.connections = [], this.localConnections = [], this.isConnectionInitiator = /* @__PURE__ */ new Map(), this.isOutgoingConnection = /* @__PURE__ */ new Map(), this.peerDataChannelListeners = [], this.rtcInstancesConstructed = 0;
18994
18987
  const { refreshIntervalDelayMs: H } = this;
@@ -19012,7 +19005,7 @@ Found: ${s.toString().split(`
19012
19005
  return ke(this, void 0, void 0, function* () {
19013
19006
  for (; !this.localPeer; )
19014
19007
  yield Object(u.a)(0.1 * c.a.second);
19015
- return Et(this.localPeer);
19008
+ return St(this.localPeer);
19016
19009
  });
19017
19010
  }
19018
19011
  connect(D, H) {
@@ -19028,24 +19021,24 @@ Found: ${s.toString().split(`
19028
19021
  if (this.isOutgoingConnection.get(D))
19029
19022
  return void g.a.warn("Connect called for peer with an existing outgoing connection offer.");
19030
19023
  this.isOutgoingConnection.set(D, !0);
19031
- const Re = function(xe, Be, Ge) {
19032
- const { rtcIceTransportPolicies: Ze, rtcIceServerProtocol: Xe, useAllServers: Je } = Be || {}, at = xe.map((ot) => Object.assign(Object.assign({}, ot), { urls: ot.urls.filter((ct) => {
19033
- const Qe = (Ze === void 0 || Ze.some((Mt) => V(ct, Mt))) && (Xe === void 0 || Q(ct, Xe));
19034
- return Qe || g.a.debug(`Ignoring ICE server: ${ct}`, { organizationId: Ge }), Qe;
19035
- }) })).filter(({ urls: ot }) => ot.filter((ct) => ct).length > 0);
19036
- return Je ? at : [U(at, "stun"), U(at, "turn")].filter((ot) => ot !== void 0).map((ot) => p(ot));
19024
+ const Ae = function(xe, Be, Ve) {
19025
+ const { rtcIceTransportPolicies: $e, rtcIceServerProtocol: Ke, useAllServers: Xe } = Be || {}, ot = xe.map((it) => Object.assign(Object.assign({}, it), { urls: it.urls.filter((ut) => {
19026
+ const Je = ($e === void 0 || $e.some((Ct) => V(ut, Ct))) && (Ke === void 0 || Q(ut, Ke));
19027
+ return Je || g.a.debug(`Ignoring ICE server: ${ut}`, { organizationId: Ve }), Je;
19028
+ }) })).filter(({ urls: it }) => it.filter((ut) => ut).length > 0);
19029
+ return Xe ? ot : [U(ot, "stun"), U(ot, "turn")].filter((it) => it !== void 0).map((it) => p(it));
19037
19030
  }(le, H);
19038
- g.a.debug("Received ICE servers:", le), g.a.debug("Using ICE servers:", Re);
19039
- const Me = new bt(yield this.createRTCPeerConnection(Re), { baseConfig: { isOffer: !0, isLan: !1, receive: (xe, Be) => this.config.receive(xe, Be), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (xe, Be) => {
19040
- var Ge, Ze;
19041
- return (Ze = (Ge = this.config).onStreamsInfoUpdate) === null || Ze === void 0 ? void 0 : Ze.call(Ge, xe, Be);
19031
+ g.a.debug("Received ICE servers:", le), g.a.debug("Using ICE servers:", Ae);
19032
+ const Me = new yt(yield this.createRTCPeerConnection(Ae), { baseConfig: { isOffer: !0, isLan: !1, receive: (xe, Be) => this.config.receive(xe, Be), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (xe, Be) => {
19033
+ var Ve, $e;
19034
+ return ($e = (Ve = this.config).onStreamsInfoUpdate) === null || $e === void 0 ? void 0 : $e.call(Ve, xe, Be);
19042
19035
  } : void 0, track: this.config.lanOnlyMode ? void 0 : this.config.track, localUserId: (X = be.getUserId()) === null || X === void 0 ? void 0 : X.getValue(), localPeerId: be.getPeerId(), remotePeerId: D, sessionType: this.config.sessionType }, remoteConfig: {} }, (xe) => this.onCustomDataChannel(D, xe)), je = yield Me.getOffer();
19043
19036
  if (!je)
19044
19037
  return g.a.error("Failed to generate offer."), void this.isOutgoingConnection.delete(D);
19045
19038
  g.a.debug("Sending offer."), de == null || de("Sending offer", je);
19046
19039
  const Fe = new ee.SendSignalRequest();
19047
19040
  Fe.setSignal(je);
19048
- const Ke = yield (() => ke(this, void 0, void 0, function* () {
19041
+ const Ye = yield (() => ke(this, void 0, void 0, function* () {
19049
19042
  try {
19050
19043
  return yield S.withDeadline(ye.sendSignal(Fe, yield this.getMetadata({})), this.grpcCallDeadline);
19051
19044
  } catch (xe) {
@@ -19055,16 +19048,16 @@ Found: ${s.toString().split(`
19055
19048
  if (!this.isOutgoingConnection.get(D))
19056
19049
  return void g.a.debug("No offer set after receiving offer signal response.");
19057
19050
  g.a.debug("Offer sent.");
19058
- const $e = (ie = Ke == null ? void 0 : Ke.getSessionId()) === null || ie === void 0 ? void 0 : ie.getValue(), Ye = (oe = Ke == null ? void 0 : Ke.getSessionCreatedTimestamp()) === null || oe === void 0 ? void 0 : oe.getValue();
19059
- return $e && Ye ? (Me.setSessionId($e), Me.setSessionCreatedTimestamp(Ye), this.isOutgoingConnection.delete(D), this.connections.push(Me), this.isConnectionInitiator.set(Me, !0), this.setupHandlers(Me), $e) : (g.a.warn("No session ID or no session created timestamp on send signal response."), void this.isOutgoingConnection.delete(D));
19051
+ const Ge = (ie = Ye == null ? void 0 : Ye.getSessionId()) === null || ie === void 0 ? void 0 : ie.getValue(), qe = (oe = Ye == null ? void 0 : Ye.getSessionCreatedTimestamp()) === null || oe === void 0 ? void 0 : oe.getValue();
19052
+ return Ge && qe ? (Me.setSessionId(Ge), Me.setSessionCreatedTimestamp(qe), this.isOutgoingConnection.delete(D), this.connections.push(Me), this.isConnectionInitiator.set(Me, !0), this.setupHandlers(Me), Ge) : (g.a.warn("No session ID or no session created timestamp on send signal response."), void this.isOutgoingConnection.delete(D));
19060
19053
  });
19061
19054
  }
19062
19055
  connectLan(D) {
19063
19056
  var H, X;
19064
19057
  return ke(this, void 0, void 0, function* () {
19065
- const ie = new P(D), oe = new bt(yield this.createRTCPeerConnection([]), { baseConfig: { isOffer: !0, isLan: !0, receive: (ce, le) => this.config.receive(ce, le), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (ce, le) => {
19066
- var Re, Me;
19067
- return (Me = (Re = this.config).onStreamsInfoUpdate) === null || Me === void 0 ? void 0 : Me.call(Re, ce, le);
19058
+ const ie = new P(D), oe = new yt(yield this.createRTCPeerConnection([]), { baseConfig: { isOffer: !0, isLan: !0, receive: (ce, le) => this.config.receive(ce, le), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (ce, le) => {
19059
+ var Ae, Me;
19060
+ return (Me = (Ae = this.config).onStreamsInfoUpdate) === null || Me === void 0 ? void 0 : Me.call(Ae, ce, le);
19068
19061
  } : void 0, track: this.config.lanOnlyMode ? void 0 : this.config.track, localUserId: (X = (H = this.localPeer) === null || H === void 0 ? void 0 : H.getUserId()) === null || X === void 0 ? void 0 : X.getValue(), localPeerId: "lan_client", remotePeerId: D } }, (ce) => this.onCustomDataChannel(D, ce)), de = yield oe.getLanOffer();
19069
19062
  if (!de)
19070
19063
  return g.a.warn("Could not generate LAN offer"), !1;
@@ -19131,7 +19124,7 @@ Found: ${s.toString().split(`
19131
19124
  var de, ye;
19132
19125
  return (ye = (de = oe.getPeerCreatedTimestamp()) === null || de === void 0 ? void 0 : de.getValue()) !== null && ye !== void 0 ? ye : 0;
19133
19126
  };
19134
- return X.sort((oe, de) => ie(de) - ie(oe)).map((oe) => Et(oe));
19127
+ return X.sort((oe, de) => ie(de) - ie(oe)).map((oe) => St(oe));
19135
19128
  });
19136
19129
  }
19137
19130
  getSessions() {
@@ -19212,7 +19205,7 @@ Found: ${s.toString().split(`
19212
19205
  } catch (ie) {
19213
19206
  const oe = ie;
19214
19207
  g.a.debug("createPeer failed", { error: oe });
19215
- const de = It(oe);
19208
+ const de = Ot(oe);
19216
19209
  throw new Error(`Was not able to create peer: ${de}`);
19217
19210
  }
19218
19211
  }))(), X = H == null ? void 0 : H.getPeer();
@@ -19237,35 +19230,35 @@ Found: ${s.toString().split(`
19237
19230
  return D.receiveSignalStream(oe, yield this.getMetadata({ hasDeadline: !1 }));
19238
19231
  } catch (ye) {
19239
19232
  g.a.debug("createReceiveSignalStream failed", { error: ye });
19240
- const be = It(ye);
19233
+ const be = Ot(ye);
19241
19234
  throw new Error(`Unable to create receive signal stream: ${be}`);
19242
19235
  }
19243
19236
  }))();
19244
19237
  if (!de)
19245
19238
  throw new Error("Response did not provide stream.");
19246
19239
  return de.on("data", (ye) => ke(this, void 0, void 0, function* () {
19247
- var be, ce, le, Re;
19248
- const Me = ye.getSignal(), je = (be = Me == null ? void 0 : Me.getSessionId()) === null || be === void 0 ? void 0 : be.getValue(), Fe = Me == null ? void 0 : Me.getSenderId(), Ke = Me == null ? void 0 : Me.getReceiverId(), $e = (ce = Me == null ? void 0 : Me.getSessionCreatedTimestamp()) === null || ce === void 0 ? void 0 : ce.getValue();
19249
- if (!(Me && je && Fe && Ke && $e))
19240
+ var be, ce, le, Ae;
19241
+ const Me = ye.getSignal(), je = (be = Me == null ? void 0 : Me.getSessionId()) === null || be === void 0 ? void 0 : be.getValue(), Fe = Me == null ? void 0 : Me.getSenderId(), Ye = Me == null ? void 0 : Me.getReceiverId(), Ge = (ce = Me == null ? void 0 : Me.getSessionCreatedTimestamp()) === null || ce === void 0 ? void 0 : ce.getValue();
19242
+ if (!(Me && je && Fe && Ye && Ge))
19250
19243
  return void g.a.warn("Received signal with missing information.");
19251
- const Ye = this.getActiveConnection(Fe);
19252
- if (Ye)
19253
- if (Ye.getSessionId() !== je) {
19254
- if (g.a.debug("Received signal: different session for a peer we're already connected to."), (Ye.getSessionCreatedTimestamp() || 0) > $e)
19244
+ const qe = this.getActiveConnection(Fe);
19245
+ if (qe)
19246
+ if (qe.getSessionId() !== je) {
19247
+ if (g.a.debug("Received signal: different session for a peer we're already connected to."), (qe.getSessionCreatedTimestamp() || 0) > Ge)
19255
19248
  return;
19256
- const xe = new bt(yield this.createRTCPeerConnection(X), { baseConfig: { isOffer: !1, isLan: !1, receive: (Be, Ge) => this.config.receive(Be, Ge), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (Be, Ge) => {
19257
- var Ze, Xe;
19258
- return (Xe = (Ze = this.config).onStreamsInfoUpdate) === null || Xe === void 0 ? void 0 : Xe.call(Ze, Be, Ge);
19259
- } : void 0, track: this.config.lanOnlyMode ? void 0 : this.config.track, localPeerId: H.getPeerId(), localUserId: (Re = H.getUserId()) === null || Re === void 0 ? void 0 : Re.getValue(), remotePeerId: Fe }, remoteConfig: { sessionId: je, sessionCreatedTimestamp: $e } }, (Be) => this.onCustomDataChannel(Fe, Be));
19249
+ const xe = new yt(yield this.createRTCPeerConnection(X), { baseConfig: { isOffer: !1, isLan: !1, receive: (Be, Ve) => this.config.receive(Be, Ve), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (Be, Ve) => {
19250
+ var $e, Ke;
19251
+ return (Ke = ($e = this.config).onStreamsInfoUpdate) === null || Ke === void 0 ? void 0 : Ke.call($e, Be, Ve);
19252
+ } : void 0, track: this.config.lanOnlyMode ? void 0 : this.config.track, localPeerId: H.getPeerId(), localUserId: (Ae = H.getUserId()) === null || Ae === void 0 ? void 0 : Ae.getValue(), remotePeerId: Fe }, remoteConfig: { sessionId: je, sessionCreatedTimestamp: Ge } }, (Be) => this.onCustomDataChannel(Fe, Be));
19260
19253
  yield xe.handleSignal(Me), this.connections.push(xe);
19261
19254
  } else
19262
- g.a.debug("Received signal: for an existing connection."), yield Ye.handleSignal(Me);
19255
+ g.a.debug("Received signal: for an existing connection."), yield qe.handleSignal(Me);
19263
19256
  else {
19264
19257
  g.a.debug("Received signal: new connection.");
19265
- const xe = new bt(yield this.createRTCPeerConnection(X), { baseConfig: { isOffer: !1, isLan: !1, receive: (Be, Ge) => this.config.receive(Be, Ge), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (Be, Ge) => {
19266
- var Ze, Xe;
19267
- return (Xe = (Ze = this.config).onStreamsInfoUpdate) === null || Xe === void 0 ? void 0 : Xe.call(Ze, Be, Ge);
19268
- } : void 0, track: this.config.lanOnlyMode ? void 0 : this.config.track, localPeerId: H.getPeerId(), localUserId: (le = H.getUserId()) === null || le === void 0 ? void 0 : le.getValue(), remotePeerId: Fe }, remoteConfig: { sessionId: je, sessionCreatedTimestamp: $e } }, (Be) => this.onCustomDataChannel(Fe, Be));
19258
+ const xe = new yt(yield this.createRTCPeerConnection(X), { baseConfig: { isOffer: !1, isLan: !1, receive: (Be, Ve) => this.config.receive(Be, Ve), onStreamsInfoUpdate: this.config.onStreamsInfoUpdate ? (Be, Ve) => {
19259
+ var $e, Ke;
19260
+ return (Ke = ($e = this.config).onStreamsInfoUpdate) === null || Ke === void 0 ? void 0 : Ke.call($e, Be, Ve);
19261
+ } : void 0, track: this.config.lanOnlyMode ? void 0 : this.config.track, localPeerId: H.getPeerId(), localUserId: (le = H.getUserId()) === null || le === void 0 ? void 0 : le.getValue(), remotePeerId: Fe }, remoteConfig: { sessionId: je, sessionCreatedTimestamp: Ge } }, (Be) => this.onCustomDataChannel(Fe, Be));
19269
19262
  yield xe.handleSignal(Me), this.connections.push(xe);
19270
19263
  }
19271
19264
  })), de.on("end", () => {
@@ -19296,7 +19289,7 @@ Found: ${s.toString().split(`
19296
19289
  const { userAgent: ie } = navigator;
19297
19290
  return ie.includes("Firefox/") ? "Firefox" : ie.includes("Edg/") ? "Edge" : ie.includes("Chrome/") ? "Chrome" : ie.includes("Safari/") ? "Safari" : ie.includes("MSIE/") || ie.includes("Trident/") ? "IE" : "Other";
19298
19291
  }() !== "Chrome" ? new Error("WebRTC is not enabled. Please try again with the latest version of Google Chrome.") : new Error("WebRTC is not enabled. Please ensure WebRTC is not disabled by ad blocking software.");
19299
- this.rtcInstancesConstructed++, this.rtcInstancesConstructed % 20 || _t();
19292
+ this.rtcInstancesConstructed++, this.rtcInstancesConstructed % 20 || bt();
19300
19293
  try {
19301
19294
  return new X({ iceServers: D });
19302
19295
  } catch (ie) {
@@ -19389,7 +19382,7 @@ Found: ${s.toString().split(`
19389
19382
  });
19390
19383
  }
19391
19384
  }
19392
- var nt = n(10), it = n(11), jt = function(pe, D, H, X) {
19385
+ var tt = n(10), rt = n(11), Nt = function(pe, D, H, X) {
19393
19386
  return new (H || (H = Promise))(function(ie, oe) {
19394
19387
  function de(ce) {
19395
19388
  try {
@@ -19407,14 +19400,14 @@ Found: ${s.toString().split(`
19407
19400
  }
19408
19401
  function be(ce) {
19409
19402
  var le;
19410
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
19411
- Re(le);
19403
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
19404
+ Ae(le);
19412
19405
  })).then(de, ye);
19413
19406
  }
19414
19407
  be((X = X.apply(pe, D || [])).next());
19415
19408
  });
19416
19409
  };
19417
- class pt {
19410
+ class dt {
19418
19411
  constructor(D, H) {
19419
19412
  this.sessionId = D, this.connection = H, this.sentMessagesCounts = /* @__PURE__ */ new Map(), this.receivedMessagesCounts = /* @__PURE__ */ new Map(), this.sessionId = D, this.connection = H;
19420
19413
  }
@@ -19427,7 +19420,7 @@ Found: ${s.toString().split(`
19427
19420
  this.receivedMessagesCounts.set(H, (this.receivedMessagesCounts.get(H) || 0) + 1);
19428
19421
  }
19429
19422
  uploadMetrics() {
19430
- return jt(this, void 0, void 0, function* () {
19423
+ return Nt(this, void 0, void 0, function* () {
19431
19424
  const { sessionId: D } = this, H = yield this.connection.peerConnection.getStats(), X = {};
19432
19425
  H.forEach((oe) => X[oe.id] = oe), g.a.debug("rtc-stats", Object.assign(Object.assign({}, X), { sessionId: D }));
19433
19426
  const ie = [...new Set(Array.from(this.sentMessagesCounts.keys()).concat(Array.from(this.receivedMessagesCounts.keys())))].reduce((oe, de) => {
@@ -19438,10 +19431,10 @@ Found: ${s.toString().split(`
19438
19431
  });
19439
19432
  }
19440
19433
  }
19441
- function Ct(pe, D) {
19434
+ function It(pe, D) {
19442
19435
  return Ie(pe) === Ie(D);
19443
19436
  }
19444
- var ut = function(pe, D, H, X) {
19437
+ var lt = function(pe, D, H, X) {
19445
19438
  return new (H || (H = Promise))(function(ie, oe) {
19446
19439
  function de(ce) {
19447
19440
  try {
@@ -19459,14 +19452,14 @@ Found: ${s.toString().split(`
19459
19452
  }
19460
19453
  function be(ce) {
19461
19454
  var le;
19462
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
19463
- Re(le);
19455
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
19456
+ Ae(le);
19464
19457
  })).then(de, ye);
19465
19458
  }
19466
19459
  be((X = X.apply(pe, D || [])).next());
19467
19460
  });
19468
19461
  };
19469
- class Tt {
19462
+ class Et {
19470
19463
  constructor(D, H) {
19471
19464
  this.peerConnection = D, this.config = H, this.connectTimeoutMs = 10 * c.a.second, this.gatherIceTimeoutMs = 5 * c.a.second, this.pingUpdateTimeoutMs = 2 * c.a.second, this.streamLatestTimestamp = /* @__PURE__ */ new Map(), this.closeCalled = !1, this.connectCalled = !1, this.sentOffer = !1, this.receivedIceCandidate = !1;
19472
19465
  const { isOffer: X } = H;
@@ -19485,16 +19478,16 @@ Found: ${s.toString().split(`
19485
19478
  this.latestTryOnceStreamChannel = ie.channel;
19486
19479
  }
19487
19480
  this.setupChannel(ie.channel);
19488
- }, this.sessionMetrics = new pt(this.getSessionId(), this);
19481
+ }, this.sessionMetrics = new dt(this.getSessionId(), this);
19489
19482
  }
19490
19483
  connect() {
19491
- return ut(this, void 0, void 0, function* () {
19484
+ return lt(this, void 0, void 0, function* () {
19492
19485
  if (this.connectCalled)
19493
19486
  return;
19494
19487
  this.connectCalled = !0, this.pingUpdateTimeout = setInterval(() => {
19495
19488
  const { reliableStreamChannel: ie } = this;
19496
19489
  ie && this.sendSystemMessage(ie, { type: "ping" });
19497
- }, this.pingUpdateTimeoutMs), this.connectTimeout = setTimeout(() => ut(this, void 0, void 0, function* () {
19490
+ }, this.pingUpdateTimeoutMs), this.connectTimeout = setTimeout(() => lt(this, void 0, void 0, function* () {
19498
19491
  this.isReady() || (g.a.warn("RTC connect timed out, closing connection"), yield this.close());
19499
19492
  }), this.connectTimeoutMs);
19500
19493
  const { peerConnection: D, config: { isOffer: H, sessionId: X } } = this;
@@ -19502,11 +19495,11 @@ Found: ${s.toString().split(`
19502
19495
  const ie = yield D.createOffer();
19503
19496
  yield D.setLocalDescription(ie);
19504
19497
  }
19505
- H && (this.gatherIceTimeout = setTimeout(() => ut(this, void 0, void 0, function* () {
19498
+ H && (this.gatherIceTimeout = setTimeout(() => lt(this, void 0, void 0, function* () {
19506
19499
  this.sentOffer || (g.a.warn("ICE gathering timed out"), this.receivedIceCandidate ? (g.a.warn("Attempting to connect with partial ICE candidate pool"), yield this.sendOffer()) : yield this.close());
19507
- }), this.gatherIceTimeoutMs), D.onicecandidate = (ie) => ut(this, void 0, void 0, function* () {
19500
+ }), this.gatherIceTimeoutMs), D.onicecandidate = (ie) => lt(this, void 0, void 0, function* () {
19508
19501
  ie.candidate ? this.receivedIceCandidate = !0 : yield this.sendOffer();
19509
- }), D.onicegatheringstatechange = () => ut(this, void 0, void 0, function* () {
19502
+ }), D.onicegatheringstatechange = () => lt(this, void 0, void 0, function* () {
19510
19503
  D.iceGatheringState === "complete" && (yield this.sendOffer());
19511
19504
  }), D.onnegotiationneeded = () => {
19512
19505
  g.a.debug("Negotiation needed", { sessionId: X });
@@ -19514,7 +19507,7 @@ Found: ${s.toString().split(`
19514
19507
  });
19515
19508
  }
19516
19509
  handleSignal(D) {
19517
- return ut(this, void 0, void 0, function* () {
19510
+ return lt(this, void 0, void 0, function* () {
19518
19511
  const { peerConnection: H, config: { sessionId: X, sendSignal: ie } } = this, { description: oe } = JSON.parse(D.payload);
19519
19512
  if (g.a.debug("Handling signal", { sessionId: X, description: JSON.stringify(oe) }), oe)
19520
19513
  if (H.signalingState !== "stable" || H.connectionState !== "connected")
@@ -19555,10 +19548,10 @@ Found: ${s.toString().split(`
19555
19548
  if (this.isClosed())
19556
19549
  return !1;
19557
19550
  const oe = /* @__PURE__ */ new Set(["closing", "closed"]), de = (ye) => ye && oe.has(ye.readyState);
19558
- return qe(D) || de(H) || de(X) || de(ie);
19551
+ return Ze(D) || de(H) || de(X) || de(ie);
19559
19552
  }
19560
19553
  close() {
19561
- return ut(this, void 0, void 0, function* () {
19554
+ return lt(this, void 0, void 0, function* () {
19562
19555
  this.closeCalled || (this.closeCalled = !0, yield this.sessionMetrics.uploadMetrics(), this.pingUpdateTimeout && clearInterval(this.pingUpdateTimeout), this.connectTimeout && clearTimeout(this.connectTimeout), this.gatherIceTimeout && clearTimeout(this.gatherIceTimeout), this.peerConnection.close());
19563
19556
  });
19564
19557
  }
@@ -19578,8 +19571,8 @@ Found: ${s.toString().split(`
19578
19571
  this.latestTtlStreamChannel = D.createDataChannel("stream.latest-ttl", k), this.reliableStreamChannel = D.createDataChannel("stream.reliable", J), this.latestReliableStreamChannel = D.createDataChannel("stream.latest-reliable", K), this.latestTryOnceStreamChannel = D.createDataChannel("stream.latest-try-once", re), this.setupChannel(this.latestTtlStreamChannel), this.setupChannel(this.reliableStreamChannel), this.setupChannel(this.latestReliableStreamChannel), this.setupChannel(this.latestTryOnceStreamChannel);
19579
19572
  }
19580
19573
  sendOffer() {
19581
- return ut(this, void 0, void 0, function* () {
19582
- if (this.sentOffer || (this.sentOffer = !0, qe(this.peerConnection)))
19574
+ return lt(this, void 0, void 0, function* () {
19575
+ if (this.sentOffer || (this.sentOffer = !0, Ze(this.peerConnection)))
19583
19576
  return;
19584
19577
  const { peerConnection: D, config: { sendSignal: H } } = this, X = yield D.createOffer();
19585
19578
  yield D.setLocalDescription(X);
@@ -19625,7 +19618,7 @@ Found: ${s.toString().split(`
19625
19618
  } catch (ie) {
19626
19619
  return void g.a.warn("Received unparseable RTC message", { error: ie, channel: D.label });
19627
19620
  }
19628
- if (this.lastMessageTimestamp = (/* @__PURE__ */ new Date()).getTime(), X = tt(X), this.sessionMetrics.incrementMessageReceived(X), !this.handleSystemMessage(D, X)) {
19621
+ if (this.lastMessageTimestamp = (/* @__PURE__ */ new Date()).getTime(), X = et(X), this.sessionMetrics.incrementMessageReceived(X), !this.handleSystemMessage(D, X)) {
19629
19622
  if (!this.hasCapabilities(X))
19630
19623
  return void g.a.warn("Received RTC message that was not within the capability scope of the connection.");
19631
19624
  (D === this.latestTryOnceStreamChannel || D === this.latestTtlStreamChannel || D === this.latestReliableStreamChannel) && !this.isLatestMessage(X) || this.config.receive(this.config.remotePeer.id, X);
@@ -19672,7 +19665,7 @@ Found: ${s.toString().split(`
19672
19665
  }
19673
19666
  hasCapabilities(D) {
19674
19667
  var H, X;
19675
- const { localPeer: ie, remotePeer: oe } = this.config, de = (H = ie.capabilitySet.streaming) === null || H === void 0 ? void 0 : H.streams, ye = de && de.some((le) => le.receive && Ct(le.stream, D.header.stream)), be = (X = oe.capabilitySet.streaming) === null || X === void 0 ? void 0 : X.streams, ce = be && be.some((le) => le.send && Ct(le.stream, D.header.stream));
19668
+ const { localPeer: ie, remotePeer: oe } = this.config, de = (H = ie.capabilitySet.streaming) === null || H === void 0 ? void 0 : H.streams, ye = de && de.some((le) => le.receive && It(le.stream, D.header.stream)), be = (X = oe.capabilitySet.streaming) === null || X === void 0 ? void 0 : X.streams, ce = be && be.some((le) => le.send && It(le.stream, D.header.stream));
19676
19669
  return ye || ce;
19677
19670
  }
19678
19671
  isLatestMessage(D) {
@@ -19698,14 +19691,14 @@ Found: ${s.toString().split(`
19698
19691
  }
19699
19692
  function be(ce) {
19700
19693
  var le;
19701
- ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Re) {
19702
- Re(le);
19694
+ ce.done ? ie(ce.value) : (le = ce.value, le instanceof H ? le : new H(function(Ae) {
19695
+ Ae(le);
19703
19696
  })).then(de, ye);
19704
19697
  }
19705
19698
  be((X = X.apply(pe, D || [])).next());
19706
19699
  });
19707
19700
  };
19708
- class Rt {
19701
+ class Tt {
19709
19702
  constructor(D) {
19710
19703
  this.config = D, this.connections = [], this.connectingSessions = /* @__PURE__ */ new Map(), this.rtcInstancesConstructed = 0, this.updateInterval = d({ func: () => Ue(this, void 0, void 0, function* () {
19711
19704
  try {
@@ -19732,7 +19725,7 @@ Found: ${s.toString().split(`
19732
19725
  try {
19733
19726
  X = yield this.config.signalingClient.createSession(yield this.config.getToken(), { offerPeerId: H.id, answerPeerId: D });
19734
19727
  } catch (ie) {
19735
- Object(it.a)(ie, nt.a, (oe) => oe.statusCode === 404), g.a.warn("Attempted to connect to peer that does not exist.");
19728
+ Object(rt.a)(ie, tt.a, (oe) => oe.statusCode === 404), g.a.warn("Attempted to connect to peer that does not exist.");
19736
19729
  }
19737
19730
  if (X)
19738
19731
  for (this.connectingSessions.set(X.id, (/* @__PURE__ */ new Date()).getTime()), yield this.connectToSession(X); ; )
@@ -19796,7 +19789,7 @@ Found: ${s.toString().split(`
19796
19789
  try {
19797
19790
  yield this.config.signalingClient.deleteSession(yield this.config.getToken(), D.getSessionId());
19798
19791
  } catch (H) {
19799
- Object(it.a)(H, nt.a, (X) => X.statusCode === 404);
19792
+ Object(rt.a)(H, tt.a, (X) => X.statusCode === 404);
19800
19793
  }
19801
19794
  });
19802
19795
  }
@@ -19814,7 +19807,7 @@ Found: ${s.toString().split(`
19814
19807
  createRTCPeerConnection(D = {}) {
19815
19808
  return Ue(this, void 0, void 0, function* () {
19816
19809
  const H = this.config.alternateRTCPeerConnection || RTCPeerConnection;
19817
- this.rtcInstancesConstructed++, this.rtcInstancesConstructed % 20 || _t();
19810
+ this.rtcInstancesConstructed++, this.rtcInstancesConstructed % 20 || bt();
19818
19811
  try {
19819
19812
  return new H(Object.assign({ iceServers: yield this.config.signalingClient.getIceServers(yield this.config.getToken()) }, D));
19820
19813
  } catch (X) {
@@ -19845,7 +19838,7 @@ Found: ${s.toString().split(`
19845
19838
  try {
19846
19839
  yield this.config.signalingClient.refreshPeer(yield this.config.getToken(), D.id);
19847
19840
  } catch (H) {
19848
- Object(it.a)(H, nt.a, (X) => X.statusCode === 404), g.a.warn("Peer expired, creating new peer", { peerId: D.id }), yield this.reset();
19841
+ Object(rt.a)(H, tt.a, (X) => X.statusCode === 404), g.a.warn("Peer expired, creating new peer", { peerId: D.id }), yield this.reset();
19849
19842
  }
19850
19843
  yield this.handleSessions(yield this.getSessions());
19851
19844
  });
@@ -19877,7 +19870,7 @@ Found: ${s.toString().split(`
19877
19870
  try {
19878
19871
  yield this.config.signalingClient.refreshSession(yield this.config.getToken(), D.id);
19879
19872
  } catch (oe) {
19880
- Object(it.a)(oe, nt.a, (de) => de.statusCode === 404), g.a.debug("Refresh session not found", { sessionId: D.id });
19873
+ Object(rt.a)(oe, tt.a, (de) => de.statusCode === 404), g.a.debug("Refresh session not found", { sessionId: D.id });
19881
19874
  }
19882
19875
  else if (H.isActive())
19883
19876
  try {
@@ -19894,7 +19887,7 @@ Found: ${s.toString().split(`
19894
19887
  }
19895
19888
  connectToSession(D) {
19896
19889
  return Ue(this, void 0, void 0, function* () {
19897
- const H = yield this.getLocalPeer(), X = D.offer.peer.id === H.id, ie = yield this.createRTCPeerConnection(), oe = new Tt(ie, { localPeer: X ? D.offer.peer : D.answer.peer, remotePeer: X ? D.answer.peer : D.offer.peer, sessionId: D.id, isOffer: X, sendSignal: (de) => this.sendSignal(D.id, de), receive: (de, ye) => this.config.receive(de, ye) });
19890
+ const H = yield this.getLocalPeer(), X = D.offer.peer.id === H.id, ie = yield this.createRTCPeerConnection(), oe = new Et(ie, { localPeer: X ? D.offer.peer : D.answer.peer, remotePeer: X ? D.answer.peer : D.offer.peer, sessionId: D.id, isOffer: X, sendSignal: (de) => this.sendSignal(D.id, de), receive: (de, ye) => this.config.receive(de, ye) });
19898
19891
  if (this.connections.find((de) => de.getSessionId() === D.id))
19899
19892
  return g.a.warn("connectToSession called on a session that already has a connection.", { sessionId: D.id }), void (yield oe.close());
19900
19893
  this.setupHandlers(oe), this.connections.push(oe);
@@ -19912,7 +19905,7 @@ Found: ${s.toString().split(`
19912
19905
  if (ie === void 0)
19913
19906
  return;
19914
19907
  const oe = H.connectionState;
19915
- switch (qe(H) && this.connectingSessions.delete(X), oe) {
19908
+ switch (Ze(H) && this.connectingSessions.delete(X), oe) {
19916
19909
  case "connected": {
19917
19910
  this.connectingSessions.delete(X);
19918
19911
  const de = (/* @__PURE__ */ new Date()).getTime() - ie;
@@ -19930,7 +19923,7 @@ Found: ${s.toString().split(`
19930
19923
  try {
19931
19924
  H = yield this.config.signalingClient.takeSignals(yield this.config.getToken(), D.getSessionId());
19932
19925
  } catch (X) {
19933
- Object(it.a)(X, nt.a, (ie) => ie.statusCode === 404);
19926
+ Object(rt.a)(X, tt.a, (ie) => ie.statusCode === 404);
19934
19927
  }
19935
19928
  for (const X of H)
19936
19929
  yield D.handleSignal(X);
@@ -19941,7 +19934,7 @@ Found: ${s.toString().split(`
19941
19934
  try {
19942
19935
  yield this.config.signalingClient.addSignals(yield this.config.getToken(), D, { signals: [H] });
19943
19936
  } catch (X) {
19944
- Object(it.a)(X, nt.a, (ie) => ie.statusCode === 404);
19937
+ Object(rt.a)(X, tt.a, (ie) => ie.statusCode === 404);
19945
19938
  }
19946
19939
  });
19947
19940
  }
@@ -20017,6 +20010,7 @@ Found: ${s.toString().split(`
20017
20010
  }]);
20018
20011
  });
20019
20012
  })(dist);
20013
+ var distExports = dist.exports;
20020
20014
  function defined(e, t) {
20021
20015
  if (e !== void 0)
20022
20016
  return e;
@@ -20061,10 +20055,10 @@ class StoreCache {
20061
20055
  capacity: t,
20062
20056
  timeout: n
20063
20057
  } = {}) {
20064
- Ae(this, "entries", /* @__PURE__ */ new Map());
20065
- Ae(this, "metadata", /* @__PURE__ */ new Map());
20066
- Ae(this, "capacity");
20067
- Ae(this, "timeout");
20058
+ Re(this, "entries", /* @__PURE__ */ new Map());
20059
+ Re(this, "metadata", /* @__PURE__ */ new Map());
20060
+ Re(this, "capacity");
20061
+ Re(this, "timeout");
20068
20062
  this.capacity = t || 1e4, this.timeout = n || duration.minute;
20069
20063
  }
20070
20064
  get(t, n) {
@@ -20112,11 +20106,11 @@ class StoreCache {
20112
20106
  }
20113
20107
  class QueryStore {
20114
20108
  constructor() {
20115
- Ae(this, "queryStoreCache", new StoreCache({
20109
+ Re(this, "queryStoreCache", new StoreCache({
20116
20110
  capacity: 1e4,
20117
20111
  timeout: 20 * duration.second
20118
20112
  }));
20119
- Ae(this, "liveQueryStoreCache", new StoreCache({
20113
+ Re(this, "liveQueryStoreCache", new StoreCache({
20120
20114
  capacity: 1e4,
20121
20115
  timeout: 200 * duration.millisecond
20122
20116
  }));
@@ -20331,11 +20325,67 @@ class App {
20331
20325
  window.addEventListener("message", s);
20332
20326
  });
20333
20327
  }
20328
+ static async getDate(t, n) {
20329
+ return new Promise((r) => {
20330
+ this.sendAppMessage({
20331
+ type: "request_date",
20332
+ minTime: t,
20333
+ maxTime: n
20334
+ });
20335
+ const i = (s) => {
20336
+ const l = s.data;
20337
+ l.type === "date_response" && r(l.data), window.removeEventListener("message", i);
20338
+ };
20339
+ window.addEventListener("message", i);
20340
+ });
20341
+ }
20334
20342
  }
20335
- const Ve = class {
20336
- static async login(t, n) {
20343
+ class AuthenticationStore {
20344
+ constructor({
20345
+ apiUrl: t,
20346
+ refreshAuthToken: n,
20347
+ addAccessTokenRefreshListener: r
20348
+ }) {
20349
+ Re(this, "_refreshToken");
20350
+ Re(this, "_isShareToken", !1);
20351
+ Re(this, "_currentOrganization");
20352
+ Re(this, "_currentUser");
20353
+ Re(this, "_defaultDeviceId");
20354
+ Re(this, "_token");
20355
+ Re(this, "_waitingForAuth", /* @__PURE__ */ new Set());
20356
+ Re(this, "_refreshTimer");
20357
+ Re(this, "_apiUrl");
20358
+ Re(this, "_refreshAuthToken");
20359
+ Re(this, "_addAccessTokenRefreshListener");
20360
+ this._apiUrl = t, this._refreshAuthToken = n, this._addAccessTokenRefreshListener = r;
20361
+ }
20362
+ get token() {
20363
+ return this._token;
20364
+ }
20365
+ get currentUser() {
20366
+ return this._currentUser;
20367
+ }
20368
+ get currentOrganization() {
20369
+ return this._currentOrganization;
20370
+ }
20371
+ get defaultDeviceId() {
20372
+ return this._defaultDeviceId;
20373
+ }
20374
+ /**
20375
+ * @deprecated Do not use directly. This will be removed in future versions of the API
20376
+ */
20377
+ get refreshToken() {
20378
+ return this._refreshToken;
20379
+ }
20380
+ /**
20381
+ * @deprecated Do not use directly. This will be removed in future versions of the API
20382
+ */
20383
+ get isShareToken() {
20384
+ return this._isShareToken;
20385
+ }
20386
+ async login(t, n) {
20337
20387
  try {
20338
- const r = await fetch(`${FORMANT_API_URL}/v1/admin/auth/login`, {
20388
+ const r = await fetch(`${this._apiUrl}/v1/admin/auth/login`, {
20339
20389
  method: "POST",
20340
20390
  body: JSON.stringify({ email: t, password: n }),
20341
20391
  headers: {
@@ -20344,77 +20394,76 @@ const Ve = class {
20344
20394
  }), i = await r.json();
20345
20395
  if (r.status !== 200)
20346
20396
  throw new Error(i.message);
20347
- return await Ve.loginWithToken(
20397
+ return await this.loginWithToken(
20348
20398
  i.authentication.accessToken,
20349
20399
  i.authentication.refreshToken
20350
20400
  ), i.authentication;
20351
20401
  } catch (r) {
20352
- return Ve.waitingForAuth.forEach((i) => i(!1)), Ve.waitingForAuth = [], Promise.reject(r);
20402
+ return console.error("login() failed", { err: r }), this._waitingForAuth.forEach((i) => i(!1)), this._waitingForAuth.clear(), Promise.reject(r);
20353
20403
  }
20354
20404
  }
20355
- static async loginWithToken(t, n) {
20405
+ async loginWithToken(t, n) {
20406
+ var i;
20356
20407
  const r = JSON.parse(atob(t.split(".")[1]));
20357
20408
  try {
20358
- let i;
20359
- if (Ve.isShareToken = r["formant:claims"] && r["formant:claims"].type == "share", r["formant:claims"] && (Ve.currentOrganization = r["formant:claims"].organizationId), r["custom:organization_id"] && (Ve.currentOrganization = r["custom:organization_id"]), Ve.isShareToken || (i = r.sub), r["formant:claims"] && r["formant:claims"].userId && (i = r["formant:claims"].userId), i) {
20360
- const s = await fetch(
20361
- `${FORMANT_API_URL}/v1/admin/users/${i}`,
20362
- {
20363
- method: "GET",
20364
- headers: {
20365
- "Content-Type": "application/json",
20366
- Authorization: "Bearer " + t
20367
- }
20368
- }
20369
- ), l = await s.json();
20370
- if (s.status !== 200)
20371
- throw new Error(l.message);
20372
- Ve.currentUser = l;
20373
- }
20374
- Ve.token = t, Ve.waitingForAuth.forEach((s) => s(!0));
20375
- } catch (i) {
20376
- console.error(i), Ve.waitingForAuth.forEach((s) => s(!1));
20409
+ let s;
20410
+ if (this._isShareToken = r["formant:claims"] && r["formant:claims"].type == "share", r["formant:claims"] && (this._currentOrganization = r["formant:claims"].organizationId), r["custom:organization_id"] && (this._currentOrganization = r["custom:organization_id"]), this._isShareToken || (s = r.sub), r["formant:claims"] && r["formant:claims"].userId && (s = r["formant:claims"].userId), s && ((i = this._currentUser) == null ? void 0 : i.id) !== s) {
20411
+ const l = await fetch(`${this._apiUrl}/v1/admin/users/${s}`, {
20412
+ method: "GET",
20413
+ headers: {
20414
+ "Content-Type": "application/json",
20415
+ Authorization: "Bearer " + t
20416
+ }
20417
+ }), o = await l.json();
20418
+ if (l.status !== 200)
20419
+ throw new Error(o.message);
20420
+ this._currentUser = o;
20421
+ }
20422
+ this._token = t, this._waitingForAuth.forEach((l) => l(!0));
20423
+ } catch (s) {
20424
+ console.error("loginWithToken() failed", { err: s }), this._waitingForAuth.forEach((l) => l(!1));
20425
+ } finally {
20426
+ this._waitingForAuth.clear();
20377
20427
  }
20378
- Ve.waitingForAuth = [], n && (Ve.refreshToken = n, setInterval(async () => {
20379
- if (Ve.refreshToken) {
20380
- const s = await (await fetch(
20381
- `${FORMANT_API_URL}/v1/admin/auth/refresh`,
20382
- {
20383
- method: "POST",
20384
- headers: {
20385
- "Content-Type": "application/json"
20386
- },
20387
- body: JSON.stringify({
20388
- refreshToken: Ve.refreshToken
20389
- })
20390
- }
20391
- )).json();
20392
- Ve.token = s.authentication.accessToken;
20428
+ n && (this._refreshToken = n, setInterval(async () => {
20429
+ if (this._refreshToken) {
20430
+ const l = await (await fetch(`${this._apiUrl}/v1/admin/auth/refresh`, {
20431
+ method: "POST",
20432
+ headers: {
20433
+ "Content-Type": "application/json"
20434
+ },
20435
+ body: JSON.stringify({
20436
+ refreshToken: this._refreshToken
20437
+ })
20438
+ })).json();
20439
+ this._token = l.authentication.accessToken;
20393
20440
  }
20394
20441
  }, 1e3 * 60 * 60));
20395
20442
  }
20396
- static isAuthenticated() {
20397
- return Ve.token !== void 0;
20443
+ isAuthenticated() {
20444
+ return this._token !== void 0;
20398
20445
  }
20399
- static getCurrentUser() {
20400
- return Ve.currentUser;
20446
+ /**
20447
+ * @deprecated use currentUser property instead.
20448
+ */
20449
+ getCurrentUser() {
20450
+ return this._currentUser;
20401
20451
  }
20402
- static async waitTilAuthenticated() {
20403
- return Ve.token !== void 0 ? !0 : new Promise((t) => {
20404
- Ve.waitingForAuth.push(function(n) {
20405
- t(n);
20406
- });
20452
+ async waitTilAuthenticated() {
20453
+ return this.token !== void 0 ? !0 : new Promise((t) => {
20454
+ this._waitingForAuth.add(t);
20407
20455
  });
20408
20456
  }
20409
- static async listenForRefresh() {
20410
- App.addAccessTokenRefreshListener((t) => {
20411
- this.loginWithToken(t);
20412
- }), setInterval(async () => {
20413
- App.refreshAuthToken();
20414
- }, 1e3 * 60 * 60);
20457
+ async listenForRefresh() {
20458
+ const n = () => {
20459
+ this._refreshTimer = void 0, this._refreshAuthToken();
20460
+ };
20461
+ this._addAccessTokenRefreshListener((r) => {
20462
+ this._refreshTimer && clearTimeout(this._refreshTimer), this._refreshTimer = setTimeout(n, 36e5), this.loginWithToken(r);
20463
+ }), this._refreshTimer = setTimeout(n, 36e5);
20415
20464
  }
20416
- static async forgotPassword(t) {
20417
- await fetch(`${FORMANT_API_URL}/v1/admin/auth/forgot-password`, {
20465
+ async forgotPassword(t) {
20466
+ await fetch(`${this._apiUrl}/v1/admin/auth/forgot-password`, {
20418
20467
  method: "POST",
20419
20468
  body: JSON.stringify({ email: t }),
20420
20469
  headers: {
@@ -20425,15 +20474,15 @@ const Ve = class {
20425
20474
  /**
20426
20475
  * @example
20427
20476
  * // Body
20428
- * await Authentication.confirmForgotPassword({
20477
+ * await this.confirmForgotPassword({
20429
20478
  * email: "joe@gmail.com"
20430
20479
  * confirmationCode: "1",
20431
20480
  * newPassword: "NewPassword"
20432
20481
  * });
20433
20482
  */
20434
- static async confirmForgotPassword(t) {
20483
+ async confirmForgotPassword(t) {
20435
20484
  return (await fetch(
20436
- `${FORMANT_API_URL}/v1/admin/auth/confirm-forgot-password`,
20485
+ `${this._apiUrl}/v1/admin/auth/confirm-forgot-password`,
20437
20486
  {
20438
20487
  method: "POST",
20439
20488
  body: JSON.stringify(t),
@@ -20443,9 +20492,9 @@ const Ve = class {
20443
20492
  }
20444
20493
  )).ok;
20445
20494
  }
20446
- static async respondToNewPasswordRequiredChallenge(t) {
20495
+ async respondToNewPasswordRequiredChallenge(t) {
20447
20496
  return await (await fetch(
20448
- `${FORMANT_API_URL}/v1/admin/auth/respond-to-new-password-required-challenge`,
20497
+ `${this._apiUrl}/v1/admin/auth/respond-to-new-password-required-challenge`,
20449
20498
  {
20450
20499
  method: "POST",
20451
20500
  body: JSON.stringify(t),
@@ -20455,20 +20504,17 @@ const Ve = class {
20455
20504
  }
20456
20505
  )).json();
20457
20506
  }
20458
- static async loginWithGoogle(t) {
20459
- return await (await fetch(
20460
- `${FORMANT_API_URL}/v1/admin/auth/login-google`,
20461
- {
20462
- method: "POST",
20463
- body: JSON.stringify(t),
20464
- headers: {
20465
- "Content-Type": "application/json"
20466
- }
20507
+ async loginWithGoogle(t) {
20508
+ return await (await fetch(`${this._apiUrl}/v1/admin/auth/login-google`, {
20509
+ method: "POST",
20510
+ body: JSON.stringify(t),
20511
+ headers: {
20512
+ "Content-Type": "application/json"
20467
20513
  }
20468
- )).json();
20514
+ })).json();
20469
20515
  }
20470
- static async refresh(t) {
20471
- const r = await (await fetch(`${FORMANT_API_URL}/v1/admin/auth/refresh`, {
20516
+ async refresh(t) {
20517
+ const r = await (await fetch(`${this._apiUrl}/v1/admin/auth/refresh`, {
20472
20518
  method: "POST",
20473
20519
  headers: {
20474
20520
  "Content-Type": "application/json"
@@ -20477,27 +20523,27 @@ const Ve = class {
20477
20523
  refreshToken: t
20478
20524
  })
20479
20525
  })).json();
20480
- await Ve.loginWithToken(
20481
- r.authentication.accessToken,
20482
- t
20483
- );
20526
+ await this.loginWithToken(r.authentication.accessToken, t);
20484
20527
  }
20485
- };
20486
- let Authentication = Ve;
20487
- Ae(Authentication, "token"), Ae(Authentication, "refreshToken"), Ae(Authentication, "currentUser"), Ae(Authentication, "currentOrganization"), Ae(Authentication, "isShareToken", !1), Ae(Authentication, "defaultDeviceId"), Ae(Authentication, "waitingForAuth", []);
20528
+ }
20529
+ const Authentication = new AuthenticationStore({
20530
+ apiUrl: FORMANT_API_URL,
20531
+ refreshAuthToken: App.refreshAuthToken,
20532
+ addAccessTokenRefreshListener: App.addAccessTokenRefreshListener
20533
+ });
20488
20534
  function delay(e) {
20489
20535
  return new Promise((t) => setTimeout(t, e));
20490
20536
  }
20491
20537
  class DataChannel {
20492
20538
  constructor(t) {
20493
- Ae(this, "ready", !1);
20494
- Ae(this, "listeners", []);
20495
- Ae(this, "openListeners", []);
20496
- Ae(this, "closeListeners", []);
20497
- Ae(this, "errorListeners", []);
20498
- Ae(this, "binaryListeners", []);
20499
- Ae(this, "error");
20500
- Ae(this, "decoder", new TextDecoder());
20539
+ Re(this, "ready", !1);
20540
+ Re(this, "listeners", []);
20541
+ Re(this, "openListeners", []);
20542
+ Re(this, "closeListeners", []);
20543
+ Re(this, "errorListeners", []);
20544
+ Re(this, "binaryListeners", []);
20545
+ Re(this, "error");
20546
+ Re(this, "decoder", new TextDecoder());
20501
20547
  this.dataChannel = t, this.dataChannel.binaryType = "arraybuffer", this.dataChannel.onopen = () => {
20502
20548
  this.ready = !0, this.openListeners.forEach((n) => n());
20503
20549
  }, this.dataChannel.onclose = () => {
@@ -20573,7 +20619,7 @@ class DataChannel {
20573
20619
  }
20574
20620
  class CaptureStream {
20575
20621
  constructor(t) {
20576
- Ae(this, "token");
20622
+ Re(this, "token");
20577
20623
  this.captureSession = t;
20578
20624
  }
20579
20625
  async ingestJSON(t) {
@@ -20603,8 +20649,8 @@ class CaptureStream {
20603
20649
  }
20604
20650
  class Manipulator {
20605
20651
  constructor(t, n) {
20606
- Ae(this, "currentListeners", []);
20607
- Ae(this, "onRealtimeMessage", (t, n) => {
20652
+ Re(this, "currentListeners", []);
20653
+ Re(this, "onRealtimeMessage", (t, n) => {
20608
20654
  n.payload.jointState && this.currentListeners.forEach((r) => {
20609
20655
  n.payload.jointState && r(n.payload.jointState);
20610
20656
  });
@@ -20627,8 +20673,8 @@ class Manipulator {
20627
20673
  }
20628
20674
  class RequestDataChannel {
20629
20675
  constructor(t, n, r) {
20630
- Ae(this, "channel");
20631
- Ae(this, "requestIdToResponseMap", /* @__PURE__ */ new Map());
20676
+ Re(this, "channel");
20677
+ Re(this, "requestIdToResponseMap", /* @__PURE__ */ new Map());
20632
20678
  this.device = t, this.channel_name = n, this.timeout = r;
20633
20679
  }
20634
20680
  addOpenListener(t) {
@@ -20659,8 +20705,8 @@ class RequestDataChannel {
20659
20705
  class BinaryRequestDataChannel extends RequestDataChannel {
20660
20706
  constructor() {
20661
20707
  super(...arguments);
20662
- Ae(this, "RESPONSE_SUCCESS_BYTE", 0);
20663
- Ae(this, "decoder", new TextDecoder());
20708
+ Re(this, "RESPONSE_SUCCESS_BYTE", 0);
20709
+ Re(this, "decoder", new TextDecoder());
20664
20710
  }
20665
20711
  /*
20666
20712
  Request binary payload layout:
@@ -21001,11 +21047,11 @@ const urlParams$1 = new URLSearchParams(window.location.search), rtcClientVersio
21001
21047
  class Device extends EventEmitter {
21002
21048
  constructor(n, r, i) {
21003
21049
  super();
21004
- Ae(this, "rtcClient");
21005
- Ae(this, "remoteDevicePeerId");
21006
- Ae(this, "realtimeListeners", []);
21007
- Ae(this, "connectionMonitorInterval");
21008
- Ae(this, "handleMessage", (n, r) => {
21050
+ Re(this, "rtcClient");
21051
+ Re(this, "remoteDevicePeerId");
21052
+ Re(this, "realtimeListeners", []);
21053
+ Re(this, "connectionMonitorInterval");
21054
+ Re(this, "handleMessage", (n, r) => {
21009
21055
  this.realtimeListeners.forEach((i) => i(n, r));
21010
21056
  });
21011
21057
  this.id = n, this.name = r, this.organizationId = i;
@@ -21073,11 +21119,7 @@ class Device extends EventEmitter {
21073
21119
  throw new Error(`Realtime connection hasn't been started for ${this.id}`);
21074
21120
  }
21075
21121
  async startRealtimeConnection(n) {
21076
- if (this.rtcClient)
21077
- throw new Error(
21078
- `Already created realtime connection to device ${this.id}`
21079
- );
21080
- {
21122
+ if (!this.rtcClient || this.connectionMonitorInterval === void 0) {
21081
21123
  let r;
21082
21124
  if (rtcClientVersion === "1" ? r = new distExports.RtcClientV1({
21083
21125
  signalingClient: new distExports.RtcSignalingClient(
@@ -21109,12 +21151,25 @@ class Device extends EventEmitter {
21109
21151
  for (this.remoteDevicePeerId = s.id, await r.connect(this.remoteDevicePeerId); r.getConnectionStatus(this.remoteDevicePeerId) !== "connected"; )
21110
21152
  await delay(100);
21111
21153
  this.rtcClient = r, this.emit("connect"), this.initConnectionMonitoring();
21112
- }
21154
+ } else
21155
+ throw new Error(
21156
+ `Already created realtime connection to device ${this.id}`
21157
+ );
21113
21158
  }
21114
21159
  initConnectionMonitoring() {
21115
21160
  this.connectionMonitorInterval = setInterval(async () => {
21116
- this.isV2Signaling(this.rtcClient) && (!this.rtcClient || !this.remoteDevicePeerId || await this.rtcClient.getConnectionStatsInfo(this.remoteDevicePeerId) === void 0) && (this.emit("disconnect"), this.stopRealtimeConnection().catch((n) => {
21117
- console.error(n);
21161
+ if (!this.isV2Signaling(this.rtcClient))
21162
+ return;
21163
+ const r = this.rtcClient.getConnections().find(
21164
+ (s) => s.getRemotePeerId() === this.remoteDevicePeerId && s.isActive()
21165
+ );
21166
+ let i = !1;
21167
+ r === void 0 || !r.isReady() ? (console.debug(`${(/* @__PURE__ */ new Date()).toISOString()} :: data channel closed`), i = !0) : console.debug(
21168
+ `${(/* @__PURE__ */ new Date()).toISOString()} :: data channel appears active`
21169
+ ), (!this.rtcClient || !this.remoteDevicePeerId || await this.rtcClient.getConnectionStatsInfo(
21170
+ this.remoteDevicePeerId
21171
+ ) === void 0 || i) && (this.emit("disconnect"), this.stopRealtimeConnection().catch((s) => {
21172
+ console.error(s);
21118
21173
  }));
21119
21174
  }, 1e3);
21120
21175
  }
@@ -21282,7 +21337,7 @@ class Device extends EventEmitter {
21282
21337
  }
21283
21338
  async stopRealtimeConnection() {
21284
21339
  if (this.rtcClient)
21285
- this.stopConnectionMonitoring(), await this.rtcClient.disconnect(this.id), this.rtcClient = void 0;
21340
+ this.stopConnectionMonitoring(), await this.rtcClient.disconnect(this.id);
21286
21341
  else
21287
21342
  throw new Error(`Realtime connection hasn't been started for ${this.id}`);
21288
21343
  }
@@ -21343,16 +21398,13 @@ class Device extends EventEmitter {
21343
21398
  });
21344
21399
  }
21345
21400
  async getCommand(n) {
21346
- return await fetch(
21347
- `${FORMANT_API_URL}/v1/admin/commands/${n}`,
21348
- {
21349
- method: "GET",
21350
- headers: {
21351
- "Content-Type": "application/json",
21352
- Authorization: "Bearer " + Authentication.token
21353
- }
21401
+ return await fetch(`${FORMANT_API_URL}/v1/admin/commands/${n}`, {
21402
+ method: "GET",
21403
+ headers: {
21404
+ "Content-Type": "application/json",
21405
+ Authorization: "Bearer " + Authentication.token
21354
21406
  }
21355
- );
21407
+ });
21356
21408
  }
21357
21409
  async createCustomDataChannel(n, r) {
21358
21410
  if (rtcClientVersion === "1")
@@ -21490,11 +21542,11 @@ class Device extends EventEmitter {
21490
21542
  }
21491
21543
  class PeerDevice {
21492
21544
  constructor(t) {
21493
- Ae(this, "rtcClient");
21494
- Ae(this, "remoteDevicePeerId");
21495
- Ae(this, "realtimeListeners", []);
21496
- Ae(this, "id");
21497
- Ae(this, "handleMessage", (t, n) => {
21545
+ Re(this, "rtcClient");
21546
+ Re(this, "remoteDevicePeerId");
21547
+ Re(this, "realtimeListeners", []);
21548
+ Re(this, "id");
21549
+ Re(this, "handleMessage", (t, n) => {
21498
21550
  this.realtimeListeners.forEach((r) => r(t, n));
21499
21551
  });
21500
21552
  this.peerUrl = t;
@@ -21694,14 +21746,14 @@ class PeerDevice {
21694
21746
  return new BinaryRequestDataChannel(this, t, n);
21695
21747
  }
21696
21748
  }
21697
- const st = class {
21749
+ const at = class {
21698
21750
  static async setDefaultDevice(t) {
21699
- st.defaultDeviceId = t;
21751
+ at.defaultDeviceId = t;
21700
21752
  }
21701
21753
  static async getCurrentDevice() {
21702
21754
  if (!Authentication.token)
21703
21755
  throw new Error("Not authenticated");
21704
- if (!st.defaultDeviceId)
21756
+ if (!at.defaultDeviceId)
21705
21757
  throw new Error("No known default device");
21706
21758
  const i = (await (await fetch(
21707
21759
  `${FORMANT_API_URL}/v1/admin/device-details/query`,
@@ -21713,13 +21765,13 @@ const st = class {
21713
21765
  }
21714
21766
  }
21715
21767
  )).json()).items.find(
21716
- (l) => l.id === st.defaultDeviceId
21768
+ (l) => l.id === at.defaultDeviceId
21717
21769
  ).name, s = new Device(
21718
- st.defaultDeviceId,
21770
+ at.defaultDeviceId,
21719
21771
  i,
21720
21772
  defined(Authentication.currentOrganization)
21721
21773
  );
21722
- return st.knownContext.push(new WeakRef(s)), s;
21774
+ return at.knownContext.push(new WeakRef(s)), s;
21723
21775
  }
21724
21776
  static async getPeerDevice(t) {
21725
21777
  const n = new PeerDevice(t);
@@ -21738,7 +21790,7 @@ const st = class {
21738
21790
  }
21739
21791
  }
21740
21792
  )).json(), i = r.name, s = new Device(t, i, r.organizationId);
21741
- return st.knownContext.push(new WeakRef(s)), s;
21793
+ return at.knownContext.push(new WeakRef(s)), s;
21742
21794
  }
21743
21795
  static async getDevices() {
21744
21796
  if (!Authentication.token)
@@ -21782,7 +21834,7 @@ const st = class {
21782
21834
  Authorization: "Bearer " + Authentication.token
21783
21835
  }
21784
21836
  })).json()).items;
21785
- return (await st.getDevices()).filter((s) => r.includes(s.id));
21837
+ return (await at.getDevices()).filter((s) => r.includes(s.id));
21786
21838
  }
21787
21839
  static async getPeers() {
21788
21840
  if (!Authentication.token)
@@ -21822,7 +21874,7 @@ const st = class {
21822
21874
  })).json()).items.map(
21823
21875
  (s) => s.deviceId
21824
21876
  );
21825
- return (await st.getDevices()).filter((s) => r.includes(s.id));
21877
+ return (await at.getDevices()).filter((s) => r.includes(s.id));
21826
21878
  }
21827
21879
  static async getLatestTelemetry(t) {
21828
21880
  let n = t;
@@ -22059,7 +22111,7 @@ const st = class {
22059
22111
  ), w = formatTimeFrameText(
22060
22112
  f.toLocaleDateString(),
22061
22113
  E.toLocaleDateString()
22062
- ), h = await st.queryEvents({
22114
+ ), h = await at.queryEvents({
22063
22115
  ...s,
22064
22116
  eventTypes: t,
22065
22117
  start: new Date(f).toISOString(),
@@ -22299,8 +22351,8 @@ const st = class {
22299
22351
  })}`;
22300
22352
  }
22301
22353
  };
22302
- let Fleet = st;
22303
- Ae(Fleet, "defaultDeviceId"), Ae(Fleet, "knownContext", []);
22354
+ let Fleet = at;
22355
+ Re(Fleet, "defaultDeviceId"), Re(Fleet, "knownContext", []);
22304
22356
  class KeyValue {
22305
22357
  static async set(t, n) {
22306
22358
  try {
@@ -25372,15 +25424,15 @@ function browser() {
25372
25424
  const rtcAudioChunkStreamType = "audio-chunk";
25373
25425
  class AudioPlayer {
25374
25426
  constructor(t, n) {
25375
- Ae(this, "muted", !1);
25376
- Ae(this, "hasReceivedData", !1);
25377
- Ae(this, "audioContext");
25378
- Ae(this, "chunks", []);
25379
- Ae(this, "isPlaying", !1);
25380
- Ae(this, "startTime", 0);
25381
- Ae(this, "lastChunkOffset", 0);
25382
- Ae(this, "bufferSize", 3);
25383
- Ae(this, "receive", async (t) => {
25427
+ Re(this, "muted", !1);
25428
+ Re(this, "hasReceivedData", !1);
25429
+ Re(this, "audioContext");
25430
+ Re(this, "chunks", []);
25431
+ Re(this, "isPlaying", !1);
25432
+ Re(this, "startTime", 0);
25433
+ Re(this, "lastChunkOffset", 0);
25434
+ Re(this, "bufferSize", 3);
25435
+ Re(this, "receive", async (t) => {
25384
25436
  var l;
25385
25437
  const n = (l = t.payload.audioChunk) == null ? void 0 : l.chunk_data;
25386
25438
  if (!n)
@@ -25402,7 +25454,7 @@ class AudioPlayer {
25402
25454
  ), this.changeAudioWireFormat("wav");
25403
25455
  }
25404
25456
  });
25405
- Ae(this, "scheduleChunk", (t) => {
25457
+ Re(this, "scheduleChunk", (t) => {
25406
25458
  const { audioContext: n } = this;
25407
25459
  if (!n)
25408
25460
  return;