@vanira/sdk 0.0.85 → 0.0.86

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.
@@ -81,7 +81,7 @@ class dd {
81
81
  };
82
82
  }
83
83
  }
84
- const Fs = "https://api.vanira.io", W = {
84
+ const Fs = "https://api.vanira.io", F = {
85
85
  Form: "vanira_form",
86
86
  Calendar: "vanira_calendar",
87
87
  Navigate: "vanira_navigate",
@@ -103,8 +103,11 @@ const Fs = "https://api.vanira.io", W = {
103
103
  PointAt: "vanira_point_at",
104
104
  DrawOnScreen: "vanira_draw_on_screen",
105
105
  ClearScreenDraw: "vanira_clear_screen_draw",
106
- HighlightOnScreen: "vanira_highlight_on_screen"
107
- }, ld = Object.values(W), ud = new Set(ld);
106
+ HighlightOnScreen: "vanira_highlight_on_screen",
107
+ KycDocumentCapture: "vanira_kyc_document_capture",
108
+ KycSelfieCapture: "vanira_kyc_selfie_capture",
109
+ KycSignatureCapture: "vanira_kyc_signature_capture"
110
+ }, ld = Object.values(F), ud = new Set(ld);
108
111
  function br(i) {
109
112
  return !!i && ud.has(i);
110
113
  }
@@ -118,39 +121,54 @@ function Ga(i) {
118
121
  return i && typeof i == "object" ? i : {};
119
122
  }
120
123
  const yr = {
121
- type_on_whiteboard: W.TypeText,
122
- write_on_whiteboard: W.TypeText,
123
- write_on_white_board: W.TypeText,
124
- dom_typing_simulation: W.TypeText,
125
- write_latex_text: W.WriteLatexText,
126
- write_latex_on_board: W.WriteLatexText,
127
- latex_on_whiteboard: W.WriteLatexText,
128
- erase_text: W.EraseText,
129
- dom_erase: W.EraseText,
130
- open_live_camera: W.LiveVision,
131
- live_vision: W.LiveVision,
132
- close_live_camera: W.CloseLiveCamera,
133
- stop_live_camera: W.CloseLiveCamera,
134
- open_live_screen: W.LiveScreen,
135
- close_live_screen: W.CloseLiveScreen,
136
- screen_vision: W.ScreenVision,
137
- capture_screen_vision: W.ScreenVision,
138
- capture_screen: W.ScreenVision,
139
- tab_screenshot: W.ScreenVision,
140
- capture_tab: W.ScreenVision,
141
- capture_tab_screenshot: W.ScreenVision,
142
- screenshot_tab: W.ScreenVision,
143
- point_at: W.PointAt,
144
- point_at_screen: W.PointAt,
145
- draw_on_screen: W.DrawOnScreen,
146
- screen_draw: W.DrawOnScreen,
147
- clear_screen_draw: W.ClearScreenDraw,
148
- clear_screen_annotations: W.ClearScreenDraw,
149
- highlight_on_screen: W.HighlightOnScreen,
150
- highlight_element_on_screen: W.HighlightOnScreen,
151
- highlight_screen_element: W.HighlightOnScreen
124
+ type_on_whiteboard: F.TypeText,
125
+ write_on_whiteboard: F.TypeText,
126
+ write_on_white_board: F.TypeText,
127
+ dom_typing_simulation: F.TypeText,
128
+ write_latex_text: F.WriteLatexText,
129
+ write_latex_on_board: F.WriteLatexText,
130
+ latex_on_whiteboard: F.WriteLatexText,
131
+ erase_text: F.EraseText,
132
+ dom_erase: F.EraseText,
133
+ open_live_camera: F.LiveVision,
134
+ live_vision: F.LiveVision,
135
+ close_live_camera: F.CloseLiveCamera,
136
+ stop_live_camera: F.CloseLiveCamera,
137
+ open_live_screen: F.LiveScreen,
138
+ close_live_screen: F.CloseLiveScreen,
139
+ screen_vision: F.ScreenVision,
140
+ capture_screen_vision: F.ScreenVision,
141
+ capture_screen: F.ScreenVision,
142
+ tab_screenshot: F.ScreenVision,
143
+ capture_tab: F.ScreenVision,
144
+ capture_tab_screenshot: F.ScreenVision,
145
+ screenshot_tab: F.ScreenVision,
146
+ point_at: F.PointAt,
147
+ point_at_screen: F.PointAt,
148
+ draw_on_screen: F.DrawOnScreen,
149
+ screen_draw: F.DrawOnScreen,
150
+ clear_screen_draw: F.ClearScreenDraw,
151
+ clear_screen_annotations: F.ClearScreenDraw,
152
+ highlight_on_screen: F.HighlightOnScreen,
153
+ highlight_element_on_screen: F.HighlightOnScreen,
154
+ highlight_screen_element: F.HighlightOnScreen,
155
+ kyc_document_capture: F.KycDocumentCapture,
156
+ capture_id_document: F.KycDocumentCapture,
157
+ document_capture: F.KycDocumentCapture,
158
+ capture_kyc_document: F.KycDocumentCapture,
159
+ kyc_selfie_capture: F.KycSelfieCapture,
160
+ capture_selfie: F.KycSelfieCapture,
161
+ selfie_capture: F.KycSelfieCapture,
162
+ capture_kyc_selfie: F.KycSelfieCapture,
163
+ kyc_signature_capture: F.KycSignatureCapture,
164
+ capture_kyc_signature: F.KycSignatureCapture,
165
+ signature_capture: F.KycSignatureCapture
152
166
  }, kr = {
153
- vanira_tab_screenshot: W.ScreenVision
167
+ vanira_tab_screenshot: F.ScreenVision,
168
+ vanira_document_capture: F.KycDocumentCapture,
169
+ vanira_selfie_capture: F.KycSelfieCapture,
170
+ vanira_signature_capture: F.KycSignatureCapture,
171
+ vanira_kyc_signature: F.KycSignatureCapture
154
172
  };
155
173
  function hd(i, e) {
156
174
  const t = i.latex_text ?? (e == null ? void 0 : e.latex_text);
@@ -181,16 +199,16 @@ function fd(i, e) {
181
199
  function md(i, e, t) {
182
200
  const n = Ga(e);
183
201
  let s = fd(i, n);
184
- if (s === W.Form && Tr(n, i) && !pd(n, i))
185
- return W.TypeText;
202
+ if (s === F.Form && Tr(n, i) && !pd(n, i))
203
+ return F.TypeText;
186
204
  if (s) return s;
187
205
  const r = String(t ?? "").trim().toLowerCase();
188
206
  if (r && yr[r])
189
207
  return yr[r];
190
208
  if (hd(n, i))
191
- return W.WriteLatexText;
209
+ return F.WriteLatexText;
192
210
  if (Tr(n, i))
193
- return W.TypeText;
211
+ return F.TypeText;
194
212
  }
195
213
  const Qn = "vanira_latest_call_id", ds = "vanira_prospect_id";
196
214
  function Xn(i) {
@@ -845,7 +863,7 @@ const st = class st {
845
863
  name: "open_live_camera",
846
864
  tool_call_id: `lv_${crypto.randomUUID()}`,
847
865
  execution_mode: "fire_and_forget",
848
- client_fields: { preset_id: W.LiveVision },
866
+ client_fields: { preset_id: F.LiveVision },
849
867
  arguments: {
850
868
  mode: "live",
851
869
  scope: t,
@@ -6568,15 +6586,15 @@ function gu() {
6568
6586
  var k = this, S, L, v, y = "loglevel";
6569
6587
  typeof m == "string" ? y += ":" + m : typeof m == "symbol" && (y = void 0);
6570
6588
  function C(A) {
6571
- var F = (s[A] || "silent").toUpperCase();
6589
+ var B = (s[A] || "silent").toUpperCase();
6572
6590
  if (!(typeof window === t || !y)) {
6573
6591
  try {
6574
- window.localStorage[y] = F;
6592
+ window.localStorage[y] = B;
6575
6593
  return;
6576
6594
  } catch {
6577
6595
  }
6578
6596
  try {
6579
- window.document.cookie = encodeURIComponent(y) + "=" + F + ";";
6597
+ window.document.cookie = encodeURIComponent(y) + "=" + B + ";";
6580
6598
  } catch {
6581
6599
  }
6582
6600
  }
@@ -6590,8 +6608,8 @@ function gu() {
6590
6608
  }
6591
6609
  if (typeof A === t)
6592
6610
  try {
6593
- var F = window.document.cookie, j = encodeURIComponent(y), Z = F.indexOf(j + "=");
6594
- Z !== -1 && (A = /^([^;]+)/.exec(F.slice(Z + j.length + 1))[1]);
6611
+ var B = window.document.cookie, W = encodeURIComponent(y), Z = B.indexOf(W + "=");
6612
+ Z !== -1 && (A = /^([^;]+)/.exec(B.slice(Z + W.length + 1))[1]);
6595
6613
  } catch {
6596
6614
  }
6597
6615
  return k.levels[A] === void 0 && (A = void 0), A;
@@ -6609,10 +6627,10 @@ function gu() {
6609
6627
  }
6610
6628
  }
6611
6629
  }
6612
- function B(A) {
6613
- var F = A;
6614
- if (typeof F == "string" && k.levels[F.toUpperCase()] !== void 0 && (F = k.levels[F.toUpperCase()]), typeof F == "number" && F >= 0 && F <= k.levels.SILENT)
6615
- return F;
6630
+ function V(A) {
6631
+ var B = A;
6632
+ if (typeof B == "string" && k.levels[B.toUpperCase()] !== void 0 && (B = k.levels[B.toUpperCase()]), typeof B == "number" && B >= 0 && B <= k.levels.SILENT)
6633
+ return B;
6616
6634
  throw new TypeError("log.setLevel() called with invalid level: " + A);
6617
6635
  }
6618
6636
  k.name = m, k.levels = {
@@ -6624,10 +6642,10 @@ function gu() {
6624
6642
  SILENT: 5
6625
6643
  }, k.methodFactory = T || h, k.getLevel = function() {
6626
6644
  return v ?? L ?? S;
6627
- }, k.setLevel = function(A, F) {
6628
- return v = B(A), F !== !1 && C(v), l.call(k);
6645
+ }, k.setLevel = function(A, B) {
6646
+ return v = V(A), B !== !1 && C(v), l.call(k);
6629
6647
  }, k.setDefaultLevel = function(A) {
6630
- L = B(A), I() || k.setLevel(A, !1);
6648
+ L = V(A), I() || k.setLevel(A, !1);
6631
6649
  }, k.resetLevel = function() {
6632
6650
  v = null, x(), l.call(k);
6633
6651
  }, k.enableAll = function(A) {
@@ -6635,12 +6653,12 @@ function gu() {
6635
6653
  }, k.disableAll = function(A) {
6636
6654
  k.setLevel(k.levels.SILENT, A);
6637
6655
  }, k.rebuild = function() {
6638
- if (a !== k && (S = B(a.getLevel())), l.call(k), a === k)
6656
+ if (a !== k && (S = V(a.getLevel())), l.call(k), a === k)
6639
6657
  for (var A in r)
6640
6658
  r[A].rebuild();
6641
- }, S = B(a ? a.getLevel() : "WARN");
6659
+ }, S = V(a ? a.getLevel() : "WARN");
6642
6660
  var D = I();
6643
- D != null && (v = B(D)), l.call(k);
6661
+ D != null && (v = V(D)), l.call(k);
6644
6662
  }
6645
6663
  a = new p(), a.getLogger = function(T) {
6646
6664
  if (typeof T != "symbol" && typeof T != "string" || T === "")
@@ -6665,12 +6683,12 @@ var pe;
6665
6683
  (function(i) {
6666
6684
  i.Default = "livekit", i.Room = "livekit-room", i.TokenSource = "livekit-token-source", i.Participant = "livekit-participant", i.Track = "livekit-track", i.Publication = "livekit-track-publication", i.Engine = "livekit-engine", i.Signal = "livekit-signal", i.PCManager = "livekit-pc-manager", i.PCTransport = "livekit-pc-transport", i.E2EE = "lk-e2ee", i.DataTracks = "livekit-data-tracks";
6667
6685
  })(pe || (pe = {}));
6668
- let V = _i.getLogger(pe.Default);
6686
+ let q = _i.getLogger(pe.Default);
6669
6687
  Object.values(pe).map((i) => _i.getLogger(i));
6670
- V.setDefaultLevel(gs.info);
6688
+ q.setDefaultLevel(gs.info);
6671
6689
  function Re(i, e) {
6672
6690
  const t = _i.getLogger(i);
6673
- return t.setDefaultLevel(V.getLevel()), e ? vu(t, e) : t;
6691
+ return t.setDefaultLevel(q.getLevel()), e ? vu(t, e) : t;
6674
6692
  }
6675
6693
  function vu(i, e) {
6676
6694
  const t = (s) => (r, a) => {
@@ -6858,8 +6876,8 @@ function _u() {
6858
6876
  return d(this);
6859
6877
  }, r.prototype.emit = function(y) {
6860
6878
  for (var C = [], I = 1; I < arguments.length; I++) C.push(arguments[I]);
6861
- var x = y === "error", B = this._events;
6862
- if (B !== void 0) x = x && B.error === void 0;
6879
+ var x = y === "error", V = this._events;
6880
+ if (V !== void 0) x = x && V.error === void 0;
6863
6881
  else if (!x) return !1;
6864
6882
  if (x) {
6865
6883
  var D;
@@ -6868,19 +6886,19 @@ function _u() {
6868
6886
  var A = new Error("Unhandled error." + (D ? " (" + D.message + ")" : ""));
6869
6887
  throw A.context = D, A;
6870
6888
  }
6871
- var F = B[y];
6872
- if (F === void 0) return !1;
6873
- if (typeof F == "function")
6874
- e(F, this, C);
6889
+ var B = V[y];
6890
+ if (B === void 0) return !1;
6891
+ if (typeof B == "function")
6892
+ e(B, this, C);
6875
6893
  else
6876
- for (var j = F.length, Z = g(F, j), I = 0; I < j; ++I) e(Z[I], this, C);
6894
+ for (var W = B.length, Z = g(B, W), I = 0; I < W; ++I) e(Z[I], this, C);
6877
6895
  return !0;
6878
6896
  };
6879
6897
  function c(v, y, C, I) {
6880
- var x, B, D;
6881
- if (o(C), B = v._events, B === void 0 ? (B = v._events = /* @__PURE__ */ Object.create(null), v._eventsCount = 0) : (B.newListener !== void 0 && (v.emit("newListener", y, C.listener ? C.listener : C), B = v._events), D = B[y]), D === void 0)
6882
- D = B[y] = C, ++v._eventsCount;
6883
- else if (typeof D == "function" ? D = B[y] = I ? [C, D] : [D, C] : I ? D.unshift(C) : D.push(C), x = d(v), x > 0 && D.length > x && !D.warned) {
6898
+ var x, V, D;
6899
+ if (o(C), V = v._events, V === void 0 ? (V = v._events = /* @__PURE__ */ Object.create(null), v._eventsCount = 0) : (V.newListener !== void 0 && (v.emit("newListener", y, C.listener ? C.listener : C), V = v._events), D = V[y]), D === void 0)
6900
+ D = V[y] = C, ++v._eventsCount;
6901
+ else if (typeof D == "function" ? D = V[y] = I ? [C, D] : [D, C] : I ? D.unshift(C) : D.push(C), x = d(v), x > 0 && D.length > x && !D.warned) {
6884
6902
  D.warned = !0;
6885
6903
  var A = new Error("Possible EventEmitter memory leak detected. " + D.length + " " + String(y) + " listeners added. Use emitter.setMaxListeners() to increase limit");
6886
6904
  A.name = "MaxListenersExceededWarning", A.emitter = v, A.type = y, A.count = D.length;
@@ -6911,19 +6929,19 @@ function _u() {
6911
6929
  }, r.prototype.prependOnceListener = function(y, C) {
6912
6930
  return o(C), this.prependListener(y, u(this, y, C)), this;
6913
6931
  }, r.prototype.removeListener = function(y, C) {
6914
- var I, x, B, D, A;
6932
+ var I, x, V, D, A;
6915
6933
  if (o(C), x = this._events, x === void 0) return this;
6916
6934
  if (I = x[y], I === void 0) return this;
6917
6935
  if (I === C || I.listener === C)
6918
6936
  --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete x[y], x.removeListener && this.emit("removeListener", y, I.listener || C));
6919
6937
  else if (typeof I != "function") {
6920
- for (B = -1, D = I.length - 1; D >= 0; D--)
6938
+ for (V = -1, D = I.length - 1; D >= 0; D--)
6921
6939
  if (I[D] === C || I[D].listener === C) {
6922
- A = I[D].listener, B = D;
6940
+ A = I[D].listener, V = D;
6923
6941
  break;
6924
6942
  }
6925
- if (B < 0) return this;
6926
- B === 0 ? I.shift() : m(I, B), I.length === 1 && (x[y] = I[0]), x.removeListener !== void 0 && this.emit("removeListener", y, A || C);
6943
+ if (V < 0) return this;
6944
+ V === 0 ? I.shift() : m(I, V), I.length === 1 && (x[y] = I[0]), x.removeListener !== void 0 && this.emit("removeListener", y, A || C);
6927
6945
  }
6928
6946
  return this;
6929
6947
  }, r.prototype.off = r.prototype.removeListener, r.prototype.removeAllListeners = function(y) {
@@ -6932,9 +6950,9 @@ function _u() {
6932
6950
  if (I.removeListener === void 0)
6933
6951
  return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : I[y] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete I[y]), this;
6934
6952
  if (arguments.length === 0) {
6935
- var B = Object.keys(I), D;
6936
- for (x = 0; x < B.length; ++x)
6937
- D = B[x], D !== "removeListener" && this.removeAllListeners(D);
6953
+ var V = Object.keys(I), D;
6954
+ for (x = 0; x < V.length; ++x)
6955
+ D = V[x], D !== "removeListener" && this.removeAllListeners(D);
6938
6956
  return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
6939
6957
  }
6940
6958
  if (C = I[y], typeof C == "function")
@@ -6987,12 +7005,12 @@ function _u() {
6987
7005
  function k(v, y) {
6988
7006
  return new Promise(function(C, I) {
6989
7007
  function x(D) {
6990
- v.removeListener(y, B), I(D);
7008
+ v.removeListener(y, V), I(D);
6991
7009
  }
6992
- function B() {
7010
+ function V() {
6993
7011
  typeof v.removeListener == "function" && v.removeListener("error", x), C([].slice.call(arguments));
6994
7012
  }
6995
- L(v, y, B, {
7013
+ L(v, y, V, {
6996
7014
  once: !0
6997
7015
  }), y !== "error" && S(v, x, {
6998
7016
  once: !0
@@ -7006,8 +7024,8 @@ function _u() {
7006
7024
  if (typeof v.on == "function")
7007
7025
  I.once ? v.once(y, C) : v.on(y, C);
7008
7026
  else if (typeof v.addEventListener == "function")
7009
- v.addEventListener(y, function x(B) {
7010
- I.once && v.removeEventListener(y, x), C(B);
7027
+ v.addEventListener(y, function x(V) {
7028
+ I.once && v.removeEventListener(y, x), C(V);
7011
7029
  });
7012
7030
  else
7013
7031
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof v);
@@ -8998,7 +9016,7 @@ class _ extends Ie.EventEmitter {
8998
9016
  constructor(e, t) {
8999
9017
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
9000
9018
  var s;
9001
- super(), this.attachedElements = [], this.isMuted = !1, this._streamState = _.StreamState.Active, this.isInBackground = !1, this._currentBitrate = 0, this.log = V, this.appVisibilityChangedListener = () => {
9019
+ super(), this.attachedElements = [], this.isMuted = !1, this._streamState = _.StreamState.Active, this.isInBackground = !1, this._currentBitrate = 0, this.log = q, this.appVisibilityChangedListener = () => {
9002
9020
  this.backgroundTimeout && clearTimeout(this.backgroundTimeout), document.visibilityState === "hidden" ? this.backgroundTimeout = setTimeout(() => this.handleAppVisibilityChanged(), Zu) : this.handleAppVisibilityChanged();
9003
9021
  }, this.log = Re((s = n.loggerName) !== null && s !== void 0 ? s : pe.Track), this.loggerContextCb = n.loggerContextCb, this.setMaxListeners(100), this.kind = t, this._mediaStreamTrack = e, this._mediaStreamID = e.id, this.source = _.Source.Unknown;
9004
9022
  }
@@ -9030,7 +9048,7 @@ class _ extends Ie.EventEmitter {
9030
9048
  return e.play().then(() => {
9031
9049
  this.emit(s ? R.AudioPlaybackStarted : R.VideoPlaybackStarted);
9032
9050
  }).catch((r) => {
9033
- r.name === "NotAllowedError" ? this.emit(s ? R.AudioPlaybackFailed : R.VideoPlaybackFailed, r) : r.name === "AbortError" ? V.debug("".concat(s ? "audio" : "video", " playback aborted, likely due to new play request")) : V.warn("could not playback ".concat(s ? "audio" : "video"), r), s && e && n.some((a) => a.kind === "video") && r.name === "NotAllowedError" && (e.muted = !0, e.play().catch(() => {
9051
+ r.name === "NotAllowedError" ? this.emit(s ? R.AudioPlaybackFailed : R.VideoPlaybackFailed, r) : r.name === "AbortError" ? q.debug("".concat(s ? "audio" : "video", " playback aborted, likely due to new play request")) : q.warn("could not playback ".concat(s ? "audio" : "video"), r), s && e && n.some((a) => a.kind === "video") && r.name === "NotAllowedError" && (e.muted = !0, e.play().catch(() => {
9034
9052
  }));
9035
9053
  }), this.emit(R.ElementAttached, e), e;
9036
9054
  }
@@ -9595,7 +9613,7 @@ class xf extends Ie.EventEmitter {
9595
9613
  constructor() {
9596
9614
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
9597
9615
  super(), this.latestManuallySetKeyIndex = 0, this.onKeyRatcheted = (t, n, s) => {
9598
- V.debug("key ratcheted event received", {
9616
+ q.debug("key ratcheted event received", {
9599
9617
  ratchetResult: t,
9600
9618
  participantId: n,
9601
9619
  keyIndex: s
@@ -10013,7 +10031,7 @@ class xh extends Ie.EventEmitter {
10013
10031
  const a = n.data, o = a.kind, d = a.data;
10014
10032
  switch (o) {
10015
10033
  case "error":
10016
- if (V.error(d.error.message), d.uuid) {
10034
+ if (q.error(d.error.message), d.uuid) {
10017
10035
  const u = this.decryptDataRequests.get(d.uuid);
10018
10036
  if (u != null && u.reject) {
10019
10037
  u.reject(d.error);
@@ -10060,7 +10078,7 @@ class xh extends Ie.EventEmitter {
10060
10078
  break;
10061
10079
  }
10062
10080
  }, this.onWorkerError = (n) => {
10063
- V.error("e2ee worker encountered an error:", {
10081
+ q.error("e2ee worker encountered an error:", {
10064
10082
  error: n.error
10065
10083
  }), this.emit(mt.EncryptionError, n.error, void 0);
10066
10084
  }, this.keyProvider = e.keyProvider, this.worker = e.worker, this.encryptionEnabled = !1, this.dataChannelEncryptionEnabled = t;
@@ -10077,7 +10095,7 @@ class xh extends Ie.EventEmitter {
10077
10095
  setup(e) {
10078
10096
  if (!Rh())
10079
10097
  throw new Zs("tried to setup end-to-end encryption on an unsupported browser");
10080
- if (V.info("setting up e2ee"), e !== this.room) {
10098
+ if (q.info("setting up e2ee"), e !== this.room) {
10081
10099
  this.room = e, this.setupEventListeners(e, this.keyProvider);
10082
10100
  const t = {
10083
10101
  kind: "init",
@@ -10086,7 +10104,7 @@ class xh extends Ie.EventEmitter {
10086
10104
  loglevel: bu.getLevel()
10087
10105
  }
10088
10106
  };
10089
- this.worker && (V.info("initializing worker", {
10107
+ this.worker && (q.info("initializing worker", {
10090
10108
  worker: this.worker
10091
10109
  }), this.worker.onmessage = this.onWorkerMessage, this.worker.onerror = this.onWorkerError, this.worker.postMessage(t));
10092
10110
  }
@@ -10095,13 +10113,13 @@ class xh extends Ie.EventEmitter {
10095
10113
  * @internal
10096
10114
  */
10097
10115
  setParticipantCryptorEnabled(e, t) {
10098
- V.debug("set e2ee to ".concat(e, " for participant ").concat(t)), this.postEnable(e, t);
10116
+ q.debug("set e2ee to ".concat(e, " for participant ").concat(t)), this.postEnable(e, t);
10099
10117
  }
10100
10118
  /**
10101
10119
  * @internal
10102
10120
  */
10103
10121
  setSifTrailer(e) {
10104
- !e || e.length === 0 ? V.warn("ignoring server sent trailer as it's empty") : this.postSifTrailer(e);
10122
+ !e || e.length === 0 ? q.warn("ignoring server sent trailer as it's empty") : this.postSifTrailer(e);
10105
10123
  }
10106
10124
  handleFrameMetadata(e, t, n, s) {
10107
10125
  if (this.room) {
@@ -10275,7 +10293,7 @@ class xh extends Ie.EventEmitter {
10275
10293
  setupE2EESender(e, t) {
10276
10294
  var n, s, r;
10277
10295
  if (!Jt(e) || !t) {
10278
- t || V.warn("early return because sender is not ready");
10296
+ t || q.warn("early return because sender is not ready");
10279
10297
  return;
10280
10298
  }
10281
10299
  this.handleSender(t, e.mediaStreamID, void 0, dt(e) ? (s = (n = e.publishOptions) === null || n === void 0 ? void 0 : n.frameMetadata) !== null && s !== void 0 ? s : (r = e.publishOptions) === null || r === void 0 ? void 0 : r.packetTrailer : void 0);
@@ -10345,7 +10363,7 @@ class xh extends Ie.EventEmitter {
10345
10363
  if (!(!((r = this.room) === null || r === void 0) && r.localParticipant.identity) || this.room.localParticipant.identity === "")
10346
10364
  throw TypeError("local identity needs to be known in order to set up encrypted sender");
10347
10365
  if (Ds()) {
10348
- V.info("initialize script transform");
10366
+ q.info("initialize script transform");
10349
10367
  const a = {
10350
10368
  kind: "encode",
10351
10369
  participantIdentity: this.room.localParticipant.identity,
@@ -10356,7 +10374,7 @@ class xh extends Ie.EventEmitter {
10356
10374
  };
10357
10375
  e.transform = new RTCRtpScriptTransform(this.worker, a);
10358
10376
  } else {
10359
- V.info("initialize encoded streams");
10377
+ q.info("initialize encoded streams");
10360
10378
  const a = e.createEncodedStreams(), o = {
10361
10379
  kind: "encode",
10362
10380
  data: {
@@ -10404,7 +10422,7 @@ class Uh {
10404
10422
  s && s.storeMetadata(n.data.rtpTimestamp, n.data.ssrc, n.data.metadata);
10405
10423
  }
10406
10424
  }, this.onWorkerError = (t) => {
10407
- V.error("frame metadata worker encountered an error:", {
10425
+ q.error("frame metadata worker encountered an error:", {
10408
10426
  error: t.error
10409
10427
  });
10410
10428
  }, this.worker = e == null ? void 0 : e.worker;
@@ -10433,7 +10451,7 @@ class Uh {
10433
10451
  if (!In(this.worker ? {
10434
10452
  worker: this.worker
10435
10453
  } : void 0) && !(!((s = this.room) === null || s === void 0) && s.hasE2EESetup)) {
10436
- V.warn("frame metadata transform not supported; skipping extraction");
10454
+ q.warn("frame metadata transform not supported; skipping extraction");
10437
10455
  return;
10438
10456
  }
10439
10457
  const d = new Nh(), c = e.mediaStreamID;
@@ -10478,14 +10496,14 @@ class Uh {
10478
10496
  return;
10479
10497
  }
10480
10498
  if (!("createEncodedStreams" in e)) {
10481
- V.warn("createEncodedStreams not supported");
10499
+ q.warn("createEncodedStreams not supported");
10482
10500
  return;
10483
10501
  }
10484
10502
  let a;
10485
10503
  try {
10486
10504
  a = e.createEncodedStreams();
10487
10505
  } catch (d) {
10488
- V.warn("failed to create encoded streams", {
10506
+ q.warn("failed to create encoded streams", {
10489
10507
  error: d
10490
10508
  });
10491
10509
  return;
@@ -10560,11 +10578,11 @@ class ue {
10560
10578
  return function* () {
10561
10579
  var r;
10562
10580
  if (((r = ue.userMediaPromiseMap) === null || r === void 0 ? void 0 : r.size) > 0) {
10563
- V.debug("awaiting getUserMedia promise");
10581
+ q.debug("awaiting getUserMedia promise");
10564
10582
  try {
10565
10583
  t ? yield ue.userMediaPromiseMap.get(t) : yield Promise.all(ue.userMediaPromiseMap.values());
10566
10584
  } catch {
10567
- V.warn("error waiting for media permissons");
10585
+ q.warn("error waiting for media permissons");
10568
10586
  }
10569
10587
  }
10570
10588
  let a = yield navigator.mediaDevices.enumerateDevices();
@@ -10595,12 +10613,12 @@ class ue {
10595
10613
  return t;
10596
10614
  const s = yield this.getDevices(e), r = s.find((o) => o.deviceId === es);
10597
10615
  if (!r) {
10598
- V.warn("could not reliably determine default device");
10616
+ q.warn("could not reliably determine default device");
10599
10617
  return;
10600
10618
  }
10601
10619
  const a = s.find((o) => o.deviceId !== es && o.groupId === (n ?? r.groupId));
10602
10620
  if (!a) {
10603
- V.warn("could not reliably determine default device");
10621
+ q.warn("could not reliably determine default device");
10604
10622
  return;
10605
10623
  }
10606
10624
  return a == null ? void 0 : a.deviceId;
@@ -10887,7 +10905,7 @@ class Wh {
10887
10905
  const Hh = ["syncState", "trickle", "offer", "answer", "simulate", "leave"];
10888
10906
  function Kh(i) {
10889
10907
  const e = Hh.indexOf(i.case) >= 0;
10890
- return V.trace("request allowed to bypass queue:", {
10908
+ return q.trace("request allowed to bypass queue:", {
10891
10909
  canPass: e,
10892
10910
  req: i
10893
10911
  }), e;
@@ -10913,7 +10931,7 @@ class dr {
10913
10931
  constructor() {
10914
10932
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
10915
10933
  var n;
10916
- this.rtt = 0, this.state = Y.DISCONNECTED, this.log = V, this._requestId = 0, this.useV0SignalPath = !1, this.resetCallbacks = () => {
10934
+ this.rtt = 0, this.state = Y.DISCONNECTED, this.log = q, this._requestId = 0, this.useV0SignalPath = !1, this.resetCallbacks = () => {
10917
10935
  this.onAnswer = void 0, this.onLeave = void 0, this.onLocalTrackPublished = void 0, this.onLocalTrackUnpublished = void 0, this.onNegotiateRequested = void 0, this.onOffer = void 0, this.onRemoteMuteChanged = void 0, this.onSubscribedQualityUpdate = void 0, this.onTokenRefresh = void 0, this.onTrickle = void 0, this.onClose = void 0, this.onMediaSectionsRequirement = void 0;
10918
10936
  }, this.loggerContextCb = t.loggerContextCb, this.log = Re((n = t.loggerName) !== null && n !== void 0 ? n : pe.Signal, () => this.logContext), this.useJSON = e, this.requestQueue = new jh(), this.queuedRequests = [], this.closingLock = new ge(), this.connectionLock = new ge(), this.state = Y.DISCONNECTED;
10919
10937
  }
@@ -10959,18 +10977,18 @@ class dr {
10959
10977
  if (y)
10960
10978
  return;
10961
10979
  y = !0;
10962
- const F = A instanceof Event ? A.currentTarget : A, j = _h(F, "Abort handler called");
10963
- this.streamWriter && !this.isDisconnected ? this.sendLeave().then(() => this.close(j)).catch((Z) => {
10980
+ const B = A instanceof Event ? A.currentTarget : A, W = _h(B, "Abort handler called");
10981
+ this.streamWriter && !this.isDisconnected ? this.sendLeave().then(() => this.close(W)).catch((Z) => {
10964
10982
  this.log.error(Z), this.close();
10965
- }) : this.close(), I(), S(U.cancelled(j));
10983
+ }) : this.close(), I(), S(U.cancelled(W));
10966
10984
  });
10967
10985
  d == null || d.addEventListener("abort", C);
10968
10986
  const I = () => {
10969
10987
  clearTimeout(x), d == null || d.removeEventListener("abort", C);
10970
10988
  }, x = setTimeout(() => {
10971
10989
  C(U.timeout("room connection has timed out (signal)"));
10972
- }, o.websocketTimeout), B = (A, F) => {
10973
- this.handleSignalConnected(A, x, F);
10990
+ }, o.websocketTimeout), V = (A, B) => {
10991
+ this.handleSignalConnected(A, x, B);
10974
10992
  }, D = new URL(m);
10975
10993
  if (D.searchParams.has("access_token") && D.searchParams.set("access_token", "<redacted>"), this.ws) {
10976
10994
  const A = performance.now();
@@ -11003,12 +11021,12 @@ class dr {
11003
11021
  }));
11004
11022
  if (clearTimeout(x), !A)
11005
11023
  return;
11006
- const F = A.readable.getReader();
11024
+ const B = A.readable.getReader();
11007
11025
  this.streamWriter = A.writable.getWriter();
11008
- const j = yield F.read();
11009
- if (F.releaseLock(), !j.value)
11026
+ const W = yield B.read();
11027
+ if (B.releaseLock(), !W.value)
11010
11028
  throw U.internal("no message received as first message");
11011
- const Z = oa(j.value), Je = this.validateFirstMessage(Z, (L = o.reconnect) !== null && L !== void 0 ? L : !1);
11029
+ const Z = oa(W.value), Je = this.validateFirstMessage(Z, (L = o.reconnect) !== null && L !== void 0 ? L : !1);
11012
11030
  if (!Je.isValid) {
11013
11031
  S(Je.error);
11014
11032
  return;
@@ -11018,7 +11036,7 @@ class dr {
11018
11036
  interval: this.pingIntervalDuration
11019
11037
  }), this.onJoined && this.onJoined(Z.message.value));
11020
11038
  const rn = Je.shouldProcessFirstMessage ? Z : void 0;
11021
- B(A, rn), k(Je.response);
11039
+ V(A, rn), k(Je.response);
11022
11040
  } catch (A) {
11023
11041
  S(A);
11024
11042
  } finally {
@@ -12198,7 +12216,7 @@ class va extends Ie.EventEmitter {
12198
12216
  constructor(e) {
12199
12217
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12200
12218
  var n;
12201
- super(), this.log = V, this.ddExtID = 0, this.latestOfferId = 0, this.latestAcknowledgedOfferId = 0, this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate = !1, this.trackBitrates = [], this.remoteStereoMids = [], this.remoteNackMids = [], this.negotiate = sr((s) => f(this, void 0, void 0, function* () {
12219
+ super(), this.log = q, this.ddExtID = 0, this.latestOfferId = 0, this.latestAcknowledgedOfferId = 0, this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate = !1, this.trackBitrates = [], this.remoteStereoMids = [], this.remoteNackMids = [], this.negotiate = sr((s) => f(this, void 0, void 0, function* () {
12202
12220
  this.emit(gt.NegotiationStarted);
12203
12221
  try {
12204
12222
  yield this.createAndSendOffer();
@@ -12623,7 +12641,7 @@ class ya {
12623
12641
  }
12624
12642
  constructor(e, t, n) {
12625
12643
  var s;
12626
- this.peerConnectionTimeout = hr.peerConnectionTimeout, this.log = V, this.updateState = () => {
12644
+ this.peerConnectionTimeout = hr.peerConnectionTimeout, this.log = q, this.updateState = () => {
12627
12645
  var r, a;
12628
12646
  const o = this.state, d = this.requiredTransports.map((c) => c.getConnectionState());
12629
12647
  d.every((c) => c === "connected") ? this.state = ie.CONNECTED : d.some((c) => c === "failed") ? this.state = ie.FAILED : d.some((c) => c === "connecting") ? this.state = ie.CONNECTING : d.every((c) => c === "closed") ? this.state = ie.CLOSED : d.some((c) => c === "closed") ? this.state = ie.CLOSING : d.every((c) => c === "new") && (this.state = ie.NEW), o !== this.state && (this.log.debug("pc state change: from ".concat(ie[o], " to ").concat(ie[this.state]), this.logContext), (r = this.onStateChange) === null || r === void 0 || r.call(this, this.state, this.publisher.getConnectionState(), (a = this.subscriber) === null || a === void 0 ? void 0 : a.getConnectionState()));
@@ -13417,7 +13435,7 @@ function hi(i, e, t, n) {
13417
13435
  const o = n == null ? void 0 : n.simulcast, d = n == null ? void 0 : n.scalabilityMode, c = n == null ? void 0 : n.videoCodec;
13418
13436
  if (!a && !o && !d || !e || !t)
13419
13437
  return [{}];
13420
- a || (a = vp(i, e, t, c), V.debug("using video encoding", a));
13438
+ a || (a = vp(i, e, t, c), q.debug("using video encoding", a));
13421
13439
  const l = a.maxFramerate, u = new $(e, t, a.maxBitrate, a.maxFramerate, a.priority);
13422
13440
  if (d && qe(c)) {
13423
13441
  const T = new Fc(d), k = [];
@@ -13444,7 +13462,7 @@ function hi(i, e, t, n) {
13444
13462
  /* @ts-ignore */
13445
13463
  scalabilityMode: d
13446
13464
  });
13447
- return u.encoding.priority && (k[0].priority = u.encoding.priority, k[0].networkPriority = u.encoding.priority), V.debug("using svc encoding", {
13465
+ return u.encoding.priority && (k[0].priority = u.encoding.priority, k[0].networkPriority = u.encoding.priority), q.debug("using svc encoding", {
13448
13466
  encodings: k
13449
13467
  }), k;
13450
13468
  }
@@ -13471,7 +13489,7 @@ function Uc(i, e, t) {
13471
13489
  var n, s, r, a;
13472
13490
  if (!t.backupCodec || t.backupCodec === !0 || t.backupCodec.codec === t.videoCodec)
13473
13491
  return;
13474
- e !== t.backupCodec.codec && V.warn("requested a different codec than specified as backup", {
13492
+ e !== t.backupCodec.codec && q.warn("requested a different codec than specified as backup", {
13475
13493
  serverRequested: e,
13476
13494
  backup: t.backupCodec.codec
13477
13495
  }), t.videoCodec = e, t.videoEncoding = t.backupCodec.encoding;
@@ -13532,7 +13550,7 @@ function ss(i, e, t, n) {
13532
13550
  let a = !0;
13533
13551
  s.forEach((o) => {
13534
13552
  var d;
13535
- o.maxFramerate != r && (a && (a = !1, V.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")), V.info('Setting framerate of encoding "'.concat((d = o.rid) !== null && d !== void 0 ? d : "", '" to ').concat(r)), o.maxFramerate = r);
13553
+ o.maxFramerate != r && (a && (a = !1, q.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")), q.info('Setting framerate of encoding "'.concat((d = o.rid) !== null && d !== void 0 ? d : "", '" to ').concat(r)), o.maxFramerate = r);
13536
13554
  });
13537
13555
  }
13538
13556
  return s;
@@ -14107,10 +14125,10 @@ var Ae;
14107
14125
  (function(i) {
14108
14126
  i[i.New = 0] = "New", i[i.Connected = 1] = "Connected", i[i.Disconnected = 2] = "Disconnected", i[i.Reconnecting = 3] = "Reconnecting", i[i.Closed = 4] = "Closed";
14109
14127
  })(Ae || (Ae = {}));
14110
- var q;
14128
+ var j;
14111
14129
  (function(i) {
14112
14130
  i[i.RELIABLE = 0] = "RELIABLE", i[i.LOSSY = 1] = "LOSSY", i[i.DATA_TRACK_LOSSY = 2] = "DATA_TRACK_LOSSY";
14113
- })(q || (q = {}));
14131
+ })(j || (j = {}));
14114
14132
  const Pa = 64e3;
14115
14133
  class Pp extends Ie.EventEmitter {
14116
14134
  get isClosed() {
@@ -14124,7 +14142,7 @@ class Pp extends Ie.EventEmitter {
14124
14142
  }
14125
14143
  constructor(e) {
14126
14144
  var t;
14127
- super(), this.options = e, this.rtcConfig = {}, this.peerConnectionTimeout = hr.peerConnectionTimeout, this.fullReconnectOnNext = !1, this.latestRemoteOfferId = 0, this.subscriberPrimary = !1, this.pcState = Ae.New, this._isClosed = !0, this._isNewlyCreated = !0, this.pendingTrackResolvers = {}, this.reconnectAttempts = 0, this.reconnectStart = 0, this.attemptingReconnect = !1, this.joinAttempts = 0, this.maxJoinAttempts = 1, this.shouldFailNext = !1, this.shouldFailOnV1Path = !1, this.log = V, this.reliableDataSequence = 1, this.reliableMessageBuffer = new ha(), this.reliableReceivedState = new $h(Sp), this.lossyDataStatCurrentBytes = 0, this.lossyDataStatByterate = 0, this.lossyDataDropCount = 0, this.midToTrackId = {}, this.isWaitingForNetworkReconnect = !1, this.bufferStatusLowClosingFuture = new he(), this.handleDataChannel = (n) => f(this, [n], void 0, function(s) {
14145
+ super(), this.options = e, this.rtcConfig = {}, this.peerConnectionTimeout = hr.peerConnectionTimeout, this.fullReconnectOnNext = !1, this.latestRemoteOfferId = 0, this.subscriberPrimary = !1, this.pcState = Ae.New, this._isClosed = !0, this._isNewlyCreated = !0, this.pendingTrackResolvers = {}, this.reconnectAttempts = 0, this.reconnectStart = 0, this.attemptingReconnect = !1, this.joinAttempts = 0, this.maxJoinAttempts = 1, this.shouldFailNext = !1, this.shouldFailOnV1Path = !1, this.log = q, this.reliableDataSequence = 1, this.reliableMessageBuffer = new ha(), this.reliableReceivedState = new $h(Sp), this.lossyDataStatCurrentBytes = 0, this.lossyDataStatByterate = 0, this.lossyDataDropCount = 0, this.midToTrackId = {}, this.isWaitingForNetworkReconnect = !1, this.bufferStatusLowClosingFuture = new he(), this.handleDataChannel = (n) => f(this, [n], void 0, function(s) {
14128
14146
  var r = this;
14129
14147
  let a = s.channel;
14130
14148
  return function* () {
@@ -14211,7 +14229,7 @@ class Pp extends Ie.EventEmitter {
14211
14229
  });
14212
14230
  }, this.handleDataChannelClose = (n) => () => {
14213
14231
  var s;
14214
- !this._isClosed && ((s = this.pcManager) === null || s === void 0 ? void 0 : s.publisher.getConnectionState()) === "connected" && this.log.error("publisher data channel '".concat(q[n], "' closed unexpectedly"), this.logContext);
14232
+ !this._isClosed && ((s = this.pcManager) === null || s === void 0 ? void 0 : s.publisher.getConnectionState()) === "connected" && this.log.error("publisher data channel '".concat(j[n], "' closed unexpectedly"), this.logContext);
14215
14233
  }, this.handleBufferedAmountLow = (n) => {
14216
14234
  this.updateAndEmitDCBufferStatus(n);
14217
14235
  }, this.handleDisconnect = (n, s) => {
@@ -14239,7 +14257,7 @@ class Pp extends Ie.EventEmitter {
14239
14257
  };
14240
14258
  this.once(P.Restarted, r), this.once(P.Disconnected, a);
14241
14259
  }), this.updateAndEmitDCBufferStatus = (n) => {
14242
- if (n === q.RELIABLE) {
14260
+ if (n === j.RELIABLE) {
14243
14261
  const r = this.dataChannelForKind(n);
14244
14262
  r && this.reliableMessageBuffer.alignBufferedAmount(r.bufferedAmount);
14245
14263
  }
@@ -14277,7 +14295,7 @@ class Pp extends Ie.EventEmitter {
14277
14295
  }), this.log = Re((t = e.loggerName) !== null && t !== void 0 ? t : pe.Engine, () => this.logContext), this.loggerOptions = {
14278
14296
  loggerName: e.loggerName,
14279
14297
  loggerContextCb: () => this.logContext
14280
- }, this.client = new dr(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new ge(), this.dataProcessLock = new ge(), this.dcBufferStatus = /* @__PURE__ */ new Map([[q.RELIABLE, !0], [q.LOSSY, !0], [q.DATA_TRACK_LOSSY, !0]]), this.client.onParticipantUpdate = (n) => this.emit(P.ParticipantUpdate, n), this.client.onConnectionQuality = (n) => this.emit(P.ConnectionQualityUpdate, n), this.client.onRoomUpdate = (n) => this.emit(P.RoomUpdate, n), this.client.onSubscriptionError = (n) => this.emit(P.SubscriptionError, n), this.client.onSubscriptionPermissionUpdate = (n) => this.emit(P.SubscriptionPermissionUpdate, n), this.client.onSpeakersChanged = (n) => this.emit(P.SpeakersChanged, n), this.client.onStreamStateUpdate = (n) => this.emit(P.StreamStateChanged, n), this.client.onRequestResponse = (n) => this.emit(P.SignalRequestResponse, n), this.client.onParticipantUpdate = (n) => this.emit(P.ParticipantUpdate, n), this.client.onJoined = (n) => this.emit(P.Joined, n), this.on(P.Closing, () => {
14298
+ }, this.client = new dr(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new ge(), this.dataProcessLock = new ge(), this.dcBufferStatus = /* @__PURE__ */ new Map([[j.RELIABLE, !0], [j.LOSSY, !0], [j.DATA_TRACK_LOSSY, !0]]), this.client.onParticipantUpdate = (n) => this.emit(P.ParticipantUpdate, n), this.client.onConnectionQuality = (n) => this.emit(P.ConnectionQualityUpdate, n), this.client.onRoomUpdate = (n) => this.emit(P.RoomUpdate, n), this.client.onSubscriptionError = (n) => this.emit(P.SubscriptionError, n), this.client.onSubscriptionPermissionUpdate = (n) => this.emit(P.SubscriptionPermissionUpdate, n), this.client.onSpeakersChanged = (n) => this.emit(P.SpeakersChanged, n), this.client.onStreamStateUpdate = (n) => this.emit(P.StreamStateChanged, n), this.client.onRequestResponse = (n) => this.emit(P.SignalRequestResponse, n), this.client.onParticipantUpdate = (n) => this.emit(P.ParticipantUpdate, n), this.client.onJoined = (n) => this.emit(P.Joined, n), this.on(P.Closing, () => {
14281
14299
  var n, s;
14282
14300
  (s = (n = this.bufferStatusLowClosingFuture).reject) === null || s === void 0 || s.call(n, new ne("engine closed"));
14283
14301
  }), this.bufferStatusLowClosingFuture.promise.catch(() => {
@@ -14571,9 +14589,9 @@ class Pp extends Ie.EventEmitter {
14571
14589
  }), this.dataTrackDC = this.pcManager.createPublisherDataChannel(Ea, {
14572
14590
  ordered: !1,
14573
14591
  maxRetransmits: 0
14574
- }), this.lossyDC.onmessage = this.handleDataMessage, this.reliableDC.onmessage = this.handleDataMessage, this.dataTrackDC.onmessage = this.handleDataTrackMessage, this.lossyDC.onerror = this.handleDataError, this.reliableDC.onerror = this.handleDataError, this.dataTrackDC.onerror = this.handleDataError, this.lossyDC.onclose = this.handleDataChannelClose(q.LOSSY), this.reliableDC.onclose = this.handleDataChannelClose(q.RELIABLE), this.dataTrackDC.onclose = this.handleDataChannelClose(q.DATA_TRACK_LOSSY), this.lossyDC.bufferedAmountLowThreshold = 65535, this.reliableDC.bufferedAmountLowThreshold = 65535, this.dataTrackDC.bufferedAmountLowThreshold = 65535, this.lossyDC.onbufferedamountlow = () => this.handleBufferedAmountLow(q.LOSSY), this.reliableDC.onbufferedamountlow = () => this.handleBufferedAmountLow(q.RELIABLE), this.dataTrackDC.onbufferedamountlow = () => this.handleBufferedAmountLow(q.DATA_TRACK_LOSSY), this.cleanupLossyDataStats(), this.lossyDataStatInterval = setInterval(() => {
14592
+ }), this.lossyDC.onmessage = this.handleDataMessage, this.reliableDC.onmessage = this.handleDataMessage, this.dataTrackDC.onmessage = this.handleDataTrackMessage, this.lossyDC.onerror = this.handleDataError, this.reliableDC.onerror = this.handleDataError, this.dataTrackDC.onerror = this.handleDataError, this.lossyDC.onclose = this.handleDataChannelClose(j.LOSSY), this.reliableDC.onclose = this.handleDataChannelClose(j.RELIABLE), this.dataTrackDC.onclose = this.handleDataChannelClose(j.DATA_TRACK_LOSSY), this.lossyDC.bufferedAmountLowThreshold = 65535, this.reliableDC.bufferedAmountLowThreshold = 65535, this.dataTrackDC.bufferedAmountLowThreshold = 65535, this.lossyDC.onbufferedamountlow = () => this.handleBufferedAmountLow(j.LOSSY), this.reliableDC.onbufferedamountlow = () => this.handleBufferedAmountLow(j.RELIABLE), this.dataTrackDC.onbufferedamountlow = () => this.handleBufferedAmountLow(j.DATA_TRACK_LOSSY), this.cleanupLossyDataStats(), this.lossyDataStatInterval = setInterval(() => {
14575
14593
  this.lossyDataStatByterate = this.lossyDataStatCurrentBytes, this.lossyDataStatCurrentBytes = 0;
14576
- const e = this.dataChannelForKind(q.LOSSY);
14594
+ const e = this.dataChannelForKind(j.LOSSY);
14577
14595
  if (e) {
14578
14596
  const t = this.lossyDataStatByterate / 10;
14579
14597
  e.bufferedAmountLowThreshold = Math.min(Math.max(t, Cp), _p);
@@ -14795,7 +14813,7 @@ class Pp extends Ie.EventEmitter {
14795
14813
  })
14796
14814
  }
14797
14815
  });
14798
- yield this.sendDataPacket(n, q.RELIABLE);
14816
+ yield this.sendDataPacket(n, j.RELIABLE);
14799
14817
  });
14800
14818
  }
14801
14819
  /* @internal */
@@ -14816,15 +14834,15 @@ class Pp extends Ie.EventEmitter {
14816
14834
  };
14817
14835
  }
14818
14836
  }
14819
- t === q.RELIABLE && (e.sequence = this.reliableDataSequence, this.reliableDataSequence += 1);
14837
+ t === j.RELIABLE && (e.sequence = this.reliableDataSequence, this.reliableDataSequence += 1);
14820
14838
  const r = e.toBinary(), a = Math.min((s = (n = this.pcManager) === null || n === void 0 ? void 0 : n.getMaxPublisherMessageSize()) !== null && s !== void 0 ? s : Pa, Pa);
14821
14839
  if (typeof a < "u" && a !== 0 && r.byteLength > a)
14822
14840
  throw new qu("cannot publish data packet larger than ".concat(a, " bytes (got ").concat(r.byteLength, ")"));
14823
14841
  switch (t) {
14824
- case q.LOSSY:
14825
- case q.DATA_TRACK_LOSSY:
14842
+ case j.LOSSY:
14843
+ case j.DATA_TRACK_LOSSY:
14826
14844
  return this.sendLossyBytes(r, t);
14827
- case q.RELIABLE:
14845
+ case j.RELIABLE:
14828
14846
  const o = this.dataChannelForKind(t);
14829
14847
  if (o) {
14830
14848
  if (yield this.waitForBufferStatusLow(t), this.reliableMessageBuffer.push({
@@ -14867,11 +14885,11 @@ class Pp extends Ie.EventEmitter {
14867
14885
  }
14868
14886
  resendReliableMessagesForResume(e) {
14869
14887
  return f(this, void 0, void 0, function* () {
14870
- yield this.ensurePublisherConnected(q.RELIABLE);
14871
- const t = this.dataChannelForKind(q.RELIABLE);
14888
+ yield this.ensurePublisherConnected(j.RELIABLE);
14889
+ const t = this.dataChannelForKind(j.RELIABLE);
14872
14890
  t && (this.reliableMessageBuffer.popToSequence(e), this.reliableMessageBuffer.getAll().forEach((n) => {
14873
14891
  t.send(n.data);
14874
- })), this.updateAndEmitDCBufferStatus(q.RELIABLE);
14892
+ })), this.updateAndEmitDCBufferStatus(j.RELIABLE);
14875
14893
  });
14876
14894
  }
14877
14895
  waitForBufferStatusLow(e) {
@@ -14961,11 +14979,11 @@ class Pp extends Ie.EventEmitter {
14961
14979
  }
14962
14980
  dataChannelForKind(e, t) {
14963
14981
  switch (e) {
14964
- case q.RELIABLE:
14982
+ case j.RELIABLE:
14965
14983
  return t ? this.reliableDCSub : this.reliableDC;
14966
- case q.LOSSY:
14984
+ case j.LOSSY:
14967
14985
  return t ? this.lossyDCSub : this.lossyDC;
14968
- case q.DATA_TRACK_LOSSY:
14986
+ case j.DATA_TRACK_LOSSY:
14969
14987
  return t ? this.dataTrackDCSub : this.dataTrackDC;
14970
14988
  }
14971
14989
  }
@@ -15027,7 +15045,7 @@ class Pp extends Ie.EventEmitter {
15027
15045
  target: s
15028
15046
  }));
15029
15047
  };
15030
- return t(this.dataChannelForKind(q.LOSSY), Be.PUBLISHER), t(this.dataChannelForKind(q.RELIABLE), Be.PUBLISHER), t(this.dataChannelForKind(q.LOSSY, !0), Be.SUBSCRIBER), t(this.dataChannelForKind(q.RELIABLE, !0), Be.SUBSCRIBER), e;
15048
+ return t(this.dataChannelForKind(j.LOSSY), Be.PUBLISHER), t(this.dataChannelForKind(j.RELIABLE), Be.PUBLISHER), t(this.dataChannelForKind(j.LOSSY, !0), Be.SUBSCRIBER), t(this.dataChannelForKind(j.RELIABLE, !0), Be.SUBSCRIBER), e;
15031
15049
  }
15032
15050
  clearReconnectTimeout() {
15033
15051
  this.reconnectTimeout && ce.clearTimeout(this.reconnectTimeout);
@@ -15094,10 +15112,10 @@ class G {
15094
15112
  G.updateCachedRegionSettings(e, t, r);
15095
15113
  } catch (r) {
15096
15114
  if (r instanceof U && r.reason === Q.NotAllowed) {
15097
- V.debug("token is not valid, cancelling auto region refresh");
15115
+ q.debug("token is not valid, cancelling auto region refresh");
15098
15116
  return;
15099
15117
  }
15100
- V.debug("auto refetching of region settings failed", {
15118
+ q.debug("auto refetching of region settings failed", {
15101
15119
  error: r
15102
15120
  }), G.scheduleRefetch(e, t, n);
15103
15121
  }
@@ -15115,7 +15133,7 @@ class G {
15115
15133
  let t = G.connectionTrackers.get(e);
15116
15134
  t && (t.cleanupTimeout && clearTimeout(t.cleanupTimeout), t.cleanupTimeout = setTimeout(() => {
15117
15135
  const n = G.connectionTrackers.get(e);
15118
- n && n.connectionCount === 0 && (V.debug("stopping region refetch after disconnect delay", {
15136
+ n && n.connectionCount === 0 && (q.debug("stopping region refetch after disconnect delay", {
15119
15137
  hostname: e
15120
15138
  }), G.stopRefetch(e)), n && (n.cleanupTimeout = void 0);
15121
15139
  }, Rp));
@@ -15165,7 +15183,7 @@ class G {
15165
15183
  const n = t.regionSettings.regions.filter((s) => !this.attemptedRegions.find((r) => r.url === s.url));
15166
15184
  if (n.length > 0) {
15167
15185
  const s = n[0];
15168
- return this.attemptedRegions.push(s), V.debug("next region: ".concat(s.region)), s.url;
15186
+ return this.attemptedRegions.push(s), q.debug("next region: ".concat(s.region)), s.url;
15169
15187
  } else
15170
15188
  return null;
15171
15189
  });
@@ -15416,7 +15434,7 @@ class Dp extends Vc {
15416
15434
  }
15417
15435
  class Ap {
15418
15436
  constructor() {
15419
- this.log = V, this.byteStreamControllers = /* @__PURE__ */ new Map(), this.textStreamControllers = /* @__PURE__ */ new Map(), this.byteStreamHandlers = /* @__PURE__ */ new Map(), this.textStreamHandlers = /* @__PURE__ */ new Map(), this.isConnected = !1, this.bufferedPackets = [];
15437
+ this.log = q, this.byteStreamControllers = /* @__PURE__ */ new Map(), this.textStreamControllers = /* @__PURE__ */ new Map(), this.byteStreamHandlers = /* @__PURE__ */ new Map(), this.textStreamHandlers = /* @__PURE__ */ new Map(), this.isConnected = !1, this.bufferedPackets = [];
15420
15438
  }
15421
15439
  setConnected(e) {
15422
15440
  this.isConnected = e, e && this.flushBufferedPackets();
@@ -15654,7 +15672,7 @@ class Lp {
15654
15672
  value: o
15655
15673
  }
15656
15674
  });
15657
- yield this.engine.sendDataPacket(c, q.RELIABLE);
15675
+ yield this.engine.sendDataPacket(c, j.RELIABLE);
15658
15676
  let l = 0;
15659
15677
  const u = this.engine, h = new WritableStream({
15660
15678
  // Implement the sink
@@ -15672,7 +15690,7 @@ class Lp {
15672
15690
  value: k
15673
15691
  }
15674
15692
  });
15675
- yield u.sendDataPacket(S, q.RELIABLE), l += 1;
15693
+ yield u.sendDataPacket(S, j.RELIABLE), l += 1;
15676
15694
  }
15677
15695
  });
15678
15696
  },
@@ -15687,7 +15705,7 @@ class Lp {
15687
15705
  value: m
15688
15706
  }
15689
15707
  });
15690
- yield u.sendDataPacket(T, q.RELIABLE);
15708
+ yield u.sendDataPacket(T, j.RELIABLE);
15691
15709
  });
15692
15710
  },
15693
15711
  abort(m) {
@@ -15761,7 +15779,7 @@ class Lp {
15761
15779
  value: l
15762
15780
  }
15763
15781
  });
15764
- yield this.engine.sendDataPacket(u, q.RELIABLE);
15782
+ yield this.engine.sendDataPacket(u, j.RELIABLE);
15765
15783
  let h = 0;
15766
15784
  const p = new ge(), g = this.engine, m = this.log, T = new WritableStream({
15767
15785
  write(S) {
@@ -15781,7 +15799,7 @@ class Lp {
15781
15799
  })
15782
15800
  }
15783
15801
  });
15784
- yield g.sendDataPacket(C, q.RELIABLE), h += 1, v += y.byteLength;
15802
+ yield g.sendDataPacket(C, j.RELIABLE), h += 1, v += y.byteLength;
15785
15803
  }
15786
15804
  } finally {
15787
15805
  L();
@@ -15799,7 +15817,7 @@ class Lp {
15799
15817
  value: S
15800
15818
  }
15801
15819
  });
15802
- yield g.sendDataPacket(L, q.RELIABLE);
15820
+ yield g.sendDataPacket(L, j.RELIABLE);
15803
15821
  });
15804
15822
  },
15805
15823
  abort(S) {
@@ -16989,7 +17007,7 @@ class An extends xe {
16989
17007
  class Mi {
16990
17008
  /** @internal */
16991
17009
  constructor(e, t) {
16992
- this.trackSymbol = Gc, this.isLocal = !0, this.typeSymbol = Jc, this.handle = null, this.log = V, this.flushedFuture = new he(), this.isFlushed = !0, this.handleManagerReset = () => {
17010
+ this.trackSymbol = Gc, this.isLocal = !0, this.typeSymbol = Jc, this.handle = null, this.log = q, this.flushedFuture = new he(), this.isFlushed = !0, this.handleManagerReset = () => {
16993
17011
  var n, s;
16994
17012
  (s = (n = this.flushedFuture).resolve) === null || s === void 0 || s.call(n), this.manager.off("packetsFlushedChange", this.handleManagerPacketsFlushedChange), this.manager.off("reset", this.handleManagerReset);
16995
17013
  }, this.handleManagerPacketsFlushedChange = (n) => {
@@ -17084,7 +17102,7 @@ class Mi {
17084
17102
  unpublish() {
17085
17103
  return f(this, void 0, void 0, function* () {
17086
17104
  if (!this.handle) {
17087
- V.warn('Data track "'.concat(this.options.name, '" is not published, so unpublishing has no effect.'));
17105
+ q.warn('Data track "'.concat(this.options.name, '" is not published, so unpublishing has no effect.'));
17088
17106
  return;
17089
17107
  }
17090
17108
  try {
@@ -17877,7 +17895,7 @@ class $p extends Ac {
17877
17895
  class rt extends Ie.EventEmitter {
17878
17896
  constructor(e, t, n, s) {
17879
17897
  var r;
17880
- super(), this.metadataMuted = !1, this.encryption = X.NONE, this.log = V, this.handleMuted = () => {
17898
+ super(), this.metadataMuted = !1, this.encryption = X.NONE, this.log = q, this.handleMuted = () => {
17881
17899
  this.emit(R.Muted);
17882
17900
  }, this.handleUnmuted = () => {
17883
17901
  this.emit(R.Unmuted);
@@ -18128,7 +18146,7 @@ class Zc extends Ie.EventEmitter {
18128
18146
  constructor(e, t, n, s, r, a) {
18129
18147
  let o = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : Cn.STANDARD;
18130
18148
  var d;
18131
- super(), this.audioLevel = 0, this.isSpeaking = !1, this._connectionQuality = ft.Unknown, this.log = V, this.loggerOptions = a, this.log = Re((d = a == null ? void 0 : a.loggerName) !== null && d !== void 0 ? d : pe.Participant, () => this.logContext), this.setMaxListeners(100), this.sid = e, this.identity = t, this.name = n, this.metadata = s, this.audioTrackPublications = /* @__PURE__ */ new Map(), this.videoTrackPublications = /* @__PURE__ */ new Map(), this.trackPublications = /* @__PURE__ */ new Map(), this._kind = o, this._attributes = r ?? {};
18149
+ super(), this.audioLevel = 0, this.isSpeaking = !1, this._connectionQuality = ft.Unknown, this.log = q, this.loggerOptions = a, this.log = Re((d = a == null ? void 0 : a.loggerName) !== null && d !== void 0 ? d : pe.Participant, () => this.logContext), this.setMaxListeners(100), this.sid = e, this.identity = t, this.name = n, this.metadata = s, this.audioTrackPublications = /* @__PURE__ */ new Map(), this.videoTrackPublications = /* @__PURE__ */ new Map(), this.trackPublications = /* @__PURE__ */ new Map(), this._kind = o, this._attributes = r ?? {};
18132
18150
  }
18133
18151
  getTrackPublications() {
18134
18152
  return Array.from(this.trackPublications.values());
@@ -18867,10 +18885,10 @@ class ef extends Zc {
18867
18885
  try {
18868
18886
  D = yield e.waitForDimensions();
18869
18887
  } catch {
18870
- const F = (o = (a = this.roomOptions.videoCaptureDefaults) === null || a === void 0 ? void 0 : a.resolution) !== null && o !== void 0 ? o : wn.h720.resolution;
18888
+ const B = (o = (a = this.roomOptions.videoCaptureDefaults) === null || a === void 0 ? void 0 : a.resolution) !== null && o !== void 0 ? o : wn.h720.resolution;
18871
18889
  D = {
18872
- width: F.width,
18873
- height: F.height
18890
+ width: B.width,
18891
+ height: B.height
18874
18892
  }, this.log.error("could not determine track dimensions, using defaults", Object.assign(Object.assign({}, H(e)), {
18875
18893
  dims: D
18876
18894
  }));
@@ -18893,23 +18911,23 @@ class ef extends Zc {
18893
18911
  if (!this.engine || this.engine.isClosed)
18894
18912
  throw new ne("cannot publish track when not connected");
18895
18913
  const C = () => f(this, void 0, void 0, function* () {
18896
- var D, A, F;
18914
+ var D, A, B;
18897
18915
  if (!this.engine.pcManager)
18898
18916
  throw new ne("pcManager is not ready");
18899
18917
  if (e.sender = yield this.engine.createSender(e, t, y), ze(e) && (e.publishOptions = t), this.emit(M.LocalSenderCreated, e.sender, e), ze(e) && ((D = t.degradationPreference) !== null && D !== void 0 || (t.degradationPreference = yp(e)), e.setDegradationPreference(t.degradationPreference)), y)
18900
18918
  if (Lt() && e.kind === _.Kind.Audio) {
18901
- let j;
18919
+ let W;
18902
18920
  for (const Z of this.engine.pcManager.publisher.getTransceivers())
18903
18921
  if (Z.sender === e.sender) {
18904
- j = Z;
18922
+ W = Z;
18905
18923
  break;
18906
18924
  }
18907
- j && this.engine.pcManager.publisher.setTrackCodecBitrate({
18908
- transceiver: j,
18925
+ W && this.engine.pcManager.publisher.setTrackCodecBitrate({
18926
+ transceiver: W,
18909
18927
  codec: "opus",
18910
18928
  maxbr: !((A = y[0]) === null || A === void 0) && A.maxBitrate ? y[0].maxBitrate / 1e3 : 0
18911
18929
  });
18912
- } else e.codec && qe(e.codec) && (!((F = y[0]) === null || F === void 0) && F.maxBitrate) && this.engine.pcManager.publisher.setTrackCodecBitrate({
18930
+ } else e.codec && qe(e.codec) && (!((B = y[0]) === null || B === void 0) && B.maxBitrate) && this.engine.pcManager.publisher.setTrackCodecBitrate({
18913
18931
  cid: v.cid,
18914
18932
  codec: e.codec,
18915
18933
  maxbr: y[0].maxBitrate / 1e3
@@ -18918,11 +18936,11 @@ class ef extends Zc {
18918
18936
  });
18919
18937
  let I;
18920
18938
  const x = new Promise((D, A) => f(this, void 0, void 0, function* () {
18921
- var F;
18939
+ var B;
18922
18940
  try {
18923
18941
  I = yield this.engine.addTrack(v), D(I);
18924
- } catch (j) {
18925
- if (e.sender && (!((F = this.engine.pcManager) === null || F === void 0) && F.publisher)) {
18942
+ } catch (W) {
18943
+ if (e.sender && (!((B = this.engine.pcManager) === null || B === void 0) && B.publisher)) {
18926
18944
  try {
18927
18945
  this.engine.pcManager.publisher.removeTrack(e.sender);
18928
18946
  } catch (Z) {
@@ -18934,7 +18952,7 @@ class ef extends Zc {
18934
18952
  }));
18935
18953
  });
18936
18954
  }
18937
- A(j);
18955
+ A(W);
18938
18956
  }
18939
18957
  }));
18940
18958
  if (this.enabledPublishVideoCodecs.length > 0 && L.length === 0)
@@ -18952,27 +18970,27 @@ class ef extends Zc {
18952
18970
  }
18953
18971
  yield C();
18954
18972
  }
18955
- const B = new Us(e.kind, I, e, {
18973
+ const V = new Us(e.kind, I, e, {
18956
18974
  loggerName: this.roomOptions.loggerName,
18957
18975
  loggerContextCb: () => this.logContext
18958
18976
  });
18959
- if (B.on(R.CpuConstrained, (D) => this.onTrackCpuConstrained(D, B)), B.options = t, e.sid = I.sid, ze(e) && (e.publishOptions = t, v.width && v.height && (e.lastEncodedDimensions = {
18977
+ if (V.on(R.CpuConstrained, (D) => this.onTrackCpuConstrained(D, V)), V.options = t, e.sid = I.sid, ze(e) && (e.publishOptions = t, v.width && v.height && (e.lastEncodedDimensions = {
18960
18978
  width: v.width,
18961
18979
  height: v.height
18962
18980
  })), this.log.debug("publishing ".concat(e.kind, " with encodings"), {
18963
18981
  encodings: y,
18964
18982
  trackInfo: I
18965
- }), ze(e) ? e.startMonitor(this.engine.client) : nt(e) && e.startMonitor(), this.addTrackPublication(B), this.emit(M.LocalTrackPublished, B), nt(e) && I.audioFeatures.includes(le.TF_PRECONNECT_BUFFER)) {
18983
+ }), ze(e) ? e.startMonitor(this.engine.client) : nt(e) && e.startMonitor(), this.addTrackPublication(V), this.emit(M.LocalTrackPublished, V), nt(e) && I.audioFeatures.includes(le.TF_PRECONNECT_BUFFER)) {
18966
18984
  const D = e.getPreConnectBuffer(), A = e.getPreConnectBufferMimeType();
18967
- this.on(M.LocalTrackSubscribed, (F) => {
18968
- if (F.trackSid === I.sid) {
18985
+ this.on(M.LocalTrackSubscribed, (B) => {
18986
+ if (B.trackSid === I.sid) {
18969
18987
  if (!e.hasPreConnectBuffer) {
18970
18988
  this.log.warn("subscribe event came to late, buffer already closed");
18971
18989
  return;
18972
18990
  }
18973
18991
  this.log.debug("finished recording preconnect buffer", H(e)), e.stopPreConnectBuffer();
18974
18992
  }
18975
- }), D && new Promise((j, Z) => f(this, void 0, void 0, function* () {
18993
+ }), D && new Promise((W, Z) => f(this, void 0, void 0, function* () {
18976
18994
  var Je, rn, ye, ut, Oi, xi;
18977
18995
  try {
18978
18996
  this.log.debug("waiting for agent", H(e));
@@ -18986,7 +19004,7 @@ class ef extends Zc {
18986
19004
  topic: "lk.agent.pre-connect-audio-buffer",
18987
19005
  destinationIdentities: [td.identity],
18988
19006
  attributes: {
18989
- trackId: B.trackSid,
19007
+ trackId: V.trackSid,
18990
19008
  sampleRate: String((Oi = S.sampleRate) !== null && Oi !== void 0 ? Oi : "48000"),
18991
19009
  channels: String((xi = S.channelCount) !== null && xi !== void 0 ? xi : "1")
18992
19010
  }
@@ -19008,19 +19026,19 @@ class ef extends Zc {
19008
19026
  if (rn) throw rn.error;
19009
19027
  }
19010
19028
  }
19011
- yield vr.close(), j();
19029
+ yield vr.close(), W();
19012
19030
  } catch (Fi) {
19013
19031
  Z(Fi);
19014
19032
  }
19015
19033
  })).then(() => {
19016
19034
  this.log.debug("preconnect buffer sent successfully", H(e));
19017
- }).catch((j) => {
19035
+ }).catch((W) => {
19018
19036
  this.log.error("error sending preconnect buffer", Object.assign(Object.assign({}, H(e)), {
19019
- error: j
19037
+ error: W
19020
19038
  }));
19021
19039
  });
19022
19040
  }
19023
- return B;
19041
+ return V;
19024
19042
  });
19025
19043
  }
19026
19044
  canPublishFrameMetadata() {
@@ -19183,7 +19201,7 @@ class ef extends Zc {
19183
19201
  var n = this;
19184
19202
  let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
19185
19203
  return function* () {
19186
- const r = s.reliable ? q.RELIABLE : q.LOSSY, a = s.reliable ? yt.RELIABLE : yt.LOSSY, o = s.destinationIdentities, d = s.topic;
19204
+ const r = s.reliable ? j.RELIABLE : j.LOSSY, a = s.reliable ? yt.RELIABLE : yt.LOSSY, o = s.destinationIdentities, d = s.topic;
19187
19205
  let c = new js({
19188
19206
  participantIdentity: n.identity,
19189
19207
  payload: t,
@@ -19219,7 +19237,7 @@ class ef extends Zc {
19219
19237
  })
19220
19238
  }
19221
19239
  });
19222
- yield this.engine.sendDataPacket(n, q.RELIABLE);
19240
+ yield this.engine.sendDataPacket(n, j.RELIABLE);
19223
19241
  });
19224
19242
  }
19225
19243
  /** @deprecated Consider migrating to {@link sendText} */
@@ -19238,7 +19256,7 @@ class ef extends Zc {
19238
19256
  }))
19239
19257
  }
19240
19258
  });
19241
- return yield this.engine.sendDataPacket(s, q.RELIABLE), this.emit(M.ChatMessage, n), n;
19259
+ return yield this.engine.sendDataPacket(s, j.RELIABLE), this.emit(M.ChatMessage, n), n;
19242
19260
  });
19243
19261
  }
19244
19262
  /** @deprecated Consider migrating to {@link sendText} */
@@ -19256,7 +19274,7 @@ class ef extends Zc {
19256
19274
  }))
19257
19275
  }
19258
19276
  });
19259
- return yield this.engine.sendDataPacket(s, q.RELIABLE), this.emit(M.ChatMessage, n), n;
19277
+ return yield this.engine.sendDataPacket(s, j.RELIABLE), this.emit(M.ChatMessage, n), n;
19260
19278
  });
19261
19279
  }
19262
19280
  /**
@@ -19809,7 +19827,7 @@ class sn extends Ie.EventEmitter {
19809
19827
  */
19810
19828
  constructor(e) {
19811
19829
  var t, n, s, r, a, o, d;
19812
- if (super(), t = this, this.state = J.Disconnected, this.activeSpeakers = [], this.isE2EEEnabled = !1, this.audioEnabled = !0, this.e2eeStateMutex = new ge(), this.isVideoPlaybackBlocked = !1, this.log = V, this.bufferedEvents = [], this.isResuming = !1, this.connect = (c, l, u) => f(this, void 0, void 0, function* () {
19830
+ if (super(), t = this, this.state = J.Disconnected, this.activeSpeakers = [], this.isE2EEEnabled = !1, this.audioEnabled = !0, this.e2eeStateMutex = new ge(), this.isVideoPlaybackBlocked = !1, this.log = q, this.bufferedEvents = [], this.isResuming = !1, this.connect = (c, l, u) => f(this, void 0, void 0, function* () {
19813
19831
  var h;
19814
19832
  if (!sh())
19815
19833
  throw Ge() ? Error("WebRTC isn't detected, have you called registerGlobals?") : Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");
@@ -20186,18 +20204,18 @@ class sn extends Ie.EventEmitter {
20186
20204
  this.emit(E.LocalDataTrackUnpublished, c.sid);
20187
20205
  }).on("packetAvailable", (c) => {
20188
20206
  let l = c.handle, u = c.bytes;
20189
- this.engine.sendLossyBytes(u, q.DATA_TRACK_LOSSY, "wait").finally(() => this.outgoingDataTrackManager.handlePacketSendComplete(l));
20207
+ this.engine.sendLossyBytes(u, j.DATA_TRACK_LOSSY, "wait").finally(() => this.outgoingDataTrackManager.handlePacketSendComplete(l));
20190
20208
  }), this.registerRpcDataStreamHandler(), this.rpcClientManager = new Jp(this.log, this.outgoingDataStreamManager, this.getRemoteParticipantClientProtocol, () => {
20191
20209
  var c, l;
20192
20210
  return (l = (c = this.engine.latestJoinResponse) === null || c === void 0 ? void 0 : c.serverInfo) === null || l === void 0 ? void 0 : l.version;
20193
20211
  }), this.rpcClientManager.on("sendDataPacket", (c) => {
20194
20212
  let l = c.packet;
20195
20213
  var u;
20196
- (u = this.engine) === null || u === void 0 || u.sendDataPacket(l, q.RELIABLE);
20214
+ (u = this.engine) === null || u === void 0 || u.sendDataPacket(l, j.RELIABLE);
20197
20215
  }), this.rpcServerManager = new zp(this.log, this.outgoingDataStreamManager, this.getRemoteParticipantClientProtocol), this.rpcServerManager.on("sendDataPacket", (c) => {
20198
20216
  let l = c.packet;
20199
20217
  var u;
20200
- (u = this.engine) === null || u === void 0 || u.sendDataPacket(l, q.RELIABLE);
20218
+ (u = this.engine) === null || u === void 0 || u.sendDataPacket(l, j.RELIABLE);
20201
20219
  }), this.disconnectLock = new ge(), this.localParticipant = new ef("", "", this.engine, this.options, this.outgoingDataStreamManager, this.outgoingDataTrackManager, this.rpcClientManager, this.rpcServerManager), this.setupFrameMetadata(), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.incomingDataTrackManager.updateE2eeManager((s = this.e2eeManager) !== null && s !== void 0 ? s : null), this.outgoingDataTrackManager.updateE2eeManager((r = this.e2eeManager) !== null && r !== void 0 ? r : null), this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", At(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", At(this.options.audioCaptureDefaults.deviceId)), !((a = this.options.audioOutput) === null || a === void 0) && a.deviceId && this.switchActiveDevice("audiooutput", At(this.options.audioOutput.deviceId)).catch((c) => this.log.warn("Could not set audio output: ".concat(c.message))), Pe()) {
20202
20220
  const c = new AbortController();
20203
20221
  let l;
@@ -21412,7 +21430,7 @@ class uf extends Ct {
21412
21430
  });
21413
21431
  });
21414
21432
  try {
21415
- yield this.connect(), V.info("now the room is connected");
21433
+ yield this.connect(), q.info("now the room is connected");
21416
21434
  } catch (n) {
21417
21435
  throw this.appendWarning("ports need to be open on firewall in order to connect."), n;
21418
21436
  }
@@ -22026,25 +22044,25 @@ class Ff {
22026
22044
  const { done: I, value: x } = await k.read();
22027
22045
  if (I) break;
22028
22046
  v += S.decode(x, { stream: !0 });
22029
- const B = v.split(`
22047
+ const V = v.split(`
22030
22048
  `);
22031
- v = B.pop() || "";
22032
- for (const D of B) {
22049
+ v = V.pop() || "";
22050
+ for (const D of V) {
22033
22051
  const A = D.trim();
22034
22052
  if (A && A.startsWith("data: ")) {
22035
- const F = A.slice(6);
22036
- if (F === "[DONE]") {
22053
+ const B = A.slice(6);
22054
+ if (B === "[DONE]") {
22037
22055
  o(y, C);
22038
22056
  return;
22039
22057
  }
22040
22058
  try {
22041
- const j = JSON.parse(F);
22042
- if (j.type === "metadata") {
22043
- (j.chat_id || j.inbox_id) && (y = j.chat_id || j.inbox_id), j.conversation_id && (C = j.conversation_id);
22059
+ const W = JSON.parse(B);
22060
+ if (W.type === "metadata") {
22061
+ (W.chat_id || W.inbox_id) && (y = W.chat_id || W.inbox_id), W.conversation_id && (C = W.conversation_id);
22044
22062
  continue;
22045
22063
  }
22046
- const Z = (p = (h = (u = j.choices) == null ? void 0 : u[0]) == null ? void 0 : h.delta) == null ? void 0 : p.content;
22047
- Z && (L += Z, r(L)), j.widget && a(j.widget), j.chat_id && !y && (y = j.chat_id), j.conversation_id && !C && (C = j.conversation_id);
22064
+ const Z = (p = (h = (u = W.choices) == null ? void 0 : u[0]) == null ? void 0 : h.delta) == null ? void 0 : p.content;
22065
+ Z && (L += Z, r(L)), W.widget && a(W.widget), W.chat_id && !y && (y = W.chat_id), W.conversation_id && !C && (C = W.conversation_id);
22048
22066
  } catch {
22049
22067
  }
22050
22068
  }