cogito-client 1.0.73 → 1.0.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ var $a = Object.defineProperty, Za = (n, e, t) => e in n ? $a(n, e, {
17
17
  writable: !0,
18
18
  value: t
19
19
  }) : n[e] = t, is = (n, e, t) => Za(n, typeof e != "symbol" ? e + "" : e, t);
20
- class fe {
20
+ class me {
21
21
  constructor() {
22
22
  is(this, "_locking"), is(this, "_locks"), this._locking = Promise.resolve(), this._locks = 0;
23
23
  }
@@ -2829,7 +2829,7 @@ const Ko = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
2829
2829
  }, {
2830
2830
  no: 3,
2831
2831
  name: "ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"
2832
- }]), he = /* @__PURE__ */ p.makeMessageType("livekit.DataPacket", () => [{
2832
+ }]), fe = /* @__PURE__ */ p.makeMessageType("livekit.DataPacket", () => [{
2833
2833
  no: 1,
2834
2834
  name: "kind",
2835
2835
  kind: "enum",
@@ -7051,13 +7051,13 @@ class Is extends Be {
7051
7051
  super(15, e), this.name = "SignalRequestError", this.reason = t, this.reasonName = typeof t == "string" ? t : Bn[t];
7052
7052
  }
7053
7053
  }
7054
- var ue;
7054
+ var he;
7055
7055
  (function(n) {
7056
7056
  n[n.AlreadyOpened = 0] = "AlreadyOpened", n[n.AbnormalEnd = 1] = "AbnormalEnd", n[n.DecodeFailed = 2] = "DecodeFailed", n[n.LengthExceeded = 3] = "LengthExceeded", n[n.Incomplete = 4] = "Incomplete", n[n.HandlerAlreadyRegistered = 7] = "HandlerAlreadyRegistered", n[n.EncryptionTypeMismatch = 8] = "EncryptionTypeMismatch";
7057
- })(ue || (ue = {}));
7057
+ })(he || (he = {}));
7058
7058
  class Ee extends Be {
7059
7059
  constructor(e, t) {
7060
- super(16, e), this.name = "DataStreamError", this.reason = t, this.reasonName = ue[t];
7060
+ super(16, e), this.name = "DataStreamError", this.reason = t, this.reasonName = he[t];
7061
7061
  }
7062
7062
  }
7063
7063
  class vt extends Be {
@@ -8510,7 +8510,7 @@ var Jt;
8510
8510
  })(Jt || (Jt = {}));
8511
8511
  class Wd {
8512
8512
  constructor() {
8513
- this.pendingTasks = /* @__PURE__ */ new Map(), this.taskMutex = new fe(), this.nextTaskIndex = 0;
8513
+ this.pendingTasks = /* @__PURE__ */ new Map(), this.taskMutex = new me(), this.nextTaskIndex = 0;
8514
8514
  }
8515
8515
  run(e) {
8516
8516
  return f(this, void 0, void 0, function* () {
@@ -8642,7 +8642,7 @@ class Jn {
8642
8642
  var i;
8643
8643
  this.rtt = 0, this.state = J.DISCONNECTED, this.log = F, this._requestId = 0, this.useV0SignalPath = !1, this.resetCallbacks = () => {
8644
8644
  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;
8645
- }, this.log = ze((i = t.loggerName) !== null && i !== void 0 ? i : xe.Signal), this.loggerContextCb = t.loggerContextCb, this.useJSON = e, this.requestQueue = new Wd(), this.queuedRequests = [], this.closingLock = new fe(), this.connectionLock = new fe(), this.state = J.DISCONNECTED;
8645
+ }, this.log = ze((i = t.loggerName) !== null && i !== void 0 ? i : xe.Signal), this.loggerContextCb = t.loggerContextCb, this.useJSON = e, this.requestQueue = new Wd(), this.queuedRequests = [], this.closingLock = new me(), this.connectionLock = new me(), this.state = J.DISCONNECTED;
8646
8646
  }
8647
8647
  get logContext() {
8648
8648
  var e, t;
@@ -9901,7 +9901,7 @@ class Qs extends je.EventEmitter {
9901
9901
  }
9902
9902
  }), tl), this.close = () => {
9903
9903
  this._pc && (this._pc.close(), this._pc.onconnectionstatechange = null, this._pc.oniceconnectionstatechange = null, this._pc.onicegatheringstatechange = null, this._pc.ondatachannel = null, this._pc.onnegotiationneeded = null, this._pc.onsignalingstatechange = null, this._pc.onicecandidate = null, this._pc.ondatachannel = null, this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.oniceconnectionstatechange = null, this._pc = null);
9904
- }, this.log = ze((i = t.loggerName) !== null && i !== void 0 ? i : xe.PCTransport), this.loggerOptions = t, this.config = e, this._pc = this.createPC(), this.offerLock = new fe();
9904
+ }, this.log = ze((i = t.loggerName) !== null && i !== void 0 ? i : xe.PCTransport), this.loggerOptions = t, this.config = e, this._pc = this.createPC(), this.offerLock = new me();
9905
9905
  }
9906
9906
  createPC() {
9907
9907
  const e = new RTCPeerConnection(this.config);
@@ -10297,7 +10297,7 @@ class rl {
10297
10297
  }, this.publisher.onOffer = (r, o) => {
10298
10298
  var a;
10299
10299
  (a = this.onPublisherOffer) === null || a === void 0 || a.call(this, r, o);
10300
- }, this.state = X.NEW, this.connectionLock = new fe(), this.remoteOfferLock = new fe();
10300
+ }, this.state = X.NEW, this.connectionLock = new me(), this.remoteOfferLock = new me();
10301
10301
  }
10302
10302
  get logContext() {
10303
10303
  var e, t;
@@ -10566,7 +10566,7 @@ class W {
10566
10566
  W.cache = /* @__PURE__ */ new Map();
10567
10567
  W.settingsTimeouts = /* @__PURE__ */ new Map();
10568
10568
  W.connectionTrackers = /* @__PURE__ */ new Map();
10569
- W.fetchLock = new fe();
10569
+ W.fetchLock = new me();
10570
10570
  function ol(n) {
10571
10571
  return "".concat(n.protocol.replace("ws", "http"), "//").concat(n.host, "/settings");
10572
10572
  }
@@ -10728,7 +10728,7 @@ class qa extends T {
10728
10728
  this.debouncedTrackMuteHandler.cancel("unmute"), yield this.resumeUpstream();
10729
10729
  }), this.handleEnded = () => {
10730
10730
  this.isInBackground && (this.reacquireTrack = !0), this._mediaStreamTrack.removeEventListener("mute", this.handleTrackMuteEvent), this._mediaStreamTrack.removeEventListener("unmute", this.handleTrackUnmuteEvent), this.emit(_.Ended, this);
10731
- }, this.reacquireTrack = !1, this.providedByUser = s, this.muteLock = new fe(), this.pauseUpstreamLock = new fe(), this.trackChangeLock = new fe(), this.trackChangeLock.lock().then((o) => f(this, void 0, void 0, function* () {
10731
+ }, this.reacquireTrack = !1, this.providedByUser = s, this.muteLock = new me(), this.pauseUpstreamLock = new me(), this.trackChangeLock = new me(), this.trackChangeLock.lock().then((o) => f(this, void 0, void 0, function* () {
10732
10732
  try {
10733
10733
  yield this.setMediaStreamTrack(e, !0);
10734
10734
  } finally {
@@ -11460,7 +11460,7 @@ class Ei extends qa {
11460
11460
  }), this._currentBitrate = c;
11461
11461
  }
11462
11462
  this.prevStats = o;
11463
- }), this.senderLock = new fe();
11463
+ }), this.senderLock = new me();
11464
11464
  }
11465
11465
  get isSimulcast() {
11466
11466
  return !!(this.sender && this.sender.getParameters().encodings.length > 1);
@@ -11942,7 +11942,7 @@ class Ol extends je.EventEmitter {
11942
11942
  }));
11943
11943
  return;
11944
11944
  }
11945
- const u = he.fromBinary(new Uint8Array(l));
11945
+ const u = fe.fromBinary(new Uint8Array(l));
11946
11946
  if (u.sequence > 0 && u.participantSid !== "") {
11947
11947
  const h = this.reliableReceivedState.get(u.participantSid);
11948
11948
  if (h && u.sequence <= h)
@@ -11956,7 +11956,7 @@ class Ol extends je.EventEmitter {
11956
11956
  this.log.error("Received encrypted packet but E2EE not set up", this.logContext);
11957
11957
  return;
11958
11958
  }
11959
- const h = yield (o = this.e2eeManager) === null || o === void 0 ? void 0 : o.handleEncryptedData(u.value.value.encryptedValue, u.value.value.iv, u.participantIdentity, u.value.value.keyIndex), m = Ir.fromBinary(h.payload), b = new he({
11959
+ const h = yield (o = this.e2eeManager) === null || o === void 0 ? void 0 : o.handleEncryptedData(u.value.value.encryptedValue, u.value.value.iv, u.participantIdentity, u.value.value.keyIndex), m = Ir.fromBinary(h.payload), b = new fe({
11960
11960
  value: m.value,
11961
11961
  participantIdentity: u.participantIdentity,
11962
11962
  participantSid: u.participantSid
@@ -12040,7 +12040,7 @@ class Ol extends je.EventEmitter {
12040
12040
  }), this.log = ze((t = e.loggerName) !== null && t !== void 0 ? t : xe.Engine), this.loggerOptions = {
12041
12041
  loggerName: e.loggerName,
12042
12042
  loggerContextCb: () => this.logContext
12043
- }, this.client = new Jn(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new fe(), this.dataProcessLock = new fe(), this.dcBufferStatus = /* @__PURE__ */ new Map([[B.LOSSY, !0], [B.RELIABLE, !0]]), this.client.onParticipantUpdate = (i) => this.emit(w.ParticipantUpdate, i), this.client.onConnectionQuality = (i) => this.emit(w.ConnectionQualityUpdate, i), this.client.onRoomUpdate = (i) => this.emit(w.RoomUpdate, i), this.client.onSubscriptionError = (i) => this.emit(w.SubscriptionError, i), this.client.onSubscriptionPermissionUpdate = (i) => this.emit(w.SubscriptionPermissionUpdate, i), this.client.onSpeakersChanged = (i) => this.emit(w.SpeakersChanged, i), this.client.onStreamStateUpdate = (i) => this.emit(w.StreamStateChanged, i), this.client.onRequestResponse = (i) => this.emit(w.SignalRequestResponse, i);
12043
+ }, this.client = new Jn(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new me(), this.dataProcessLock = new me(), this.dcBufferStatus = /* @__PURE__ */ new Map([[B.LOSSY, !0], [B.RELIABLE, !0]]), this.client.onParticipantUpdate = (i) => this.emit(w.ParticipantUpdate, i), this.client.onConnectionQuality = (i) => this.emit(w.ConnectionQualityUpdate, i), this.client.onRoomUpdate = (i) => this.emit(w.RoomUpdate, i), this.client.onSubscriptionError = (i) => this.emit(w.SubscriptionError, i), this.client.onSubscriptionPermissionUpdate = (i) => this.emit(w.SubscriptionPermissionUpdate, i), this.client.onSpeakersChanged = (i) => this.emit(w.SpeakersChanged, i), this.client.onStreamStateUpdate = (i) => this.emit(w.StreamStateChanged, i), this.client.onRequestResponse = (i) => this.emit(w.SignalRequestResponse, i);
12044
12044
  }
12045
12045
  /** @internal */
12046
12046
  get logContext() {
@@ -12462,7 +12462,7 @@ class Ol extends je.EventEmitter {
12462
12462
  /** @internal */
12463
12463
  publishRpcResponse(e, t, i, s) {
12464
12464
  return f(this, void 0, void 0, function* () {
12465
- const r = new he({
12465
+ const r = new fe({
12466
12466
  destinationIdentities: [e],
12467
12467
  kind: B.RELIABLE,
12468
12468
  value: {
@@ -12485,7 +12485,7 @@ class Ol extends je.EventEmitter {
12485
12485
  /** @internal */
12486
12486
  publishRpcAck(e, t) {
12487
12487
  return f(this, void 0, void 0, function* () {
12488
- const i = new he({
12488
+ const i = new fe({
12489
12489
  destinationIdentities: [e],
12490
12490
  kind: B.RELIABLE,
12491
12491
  value: {
@@ -12736,9 +12736,9 @@ class Ga {
12736
12736
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
12737
12737
  if (!(typeof this.totalByteSize != "number" || this.totalByteSize === 0)) {
12738
12738
  if (e && this.bytesReceived < this.totalByteSize)
12739
- throw new Ee("Not enough chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, only received ").concat(this.bytesReceived, " bytes"), ue.Incomplete);
12739
+ throw new Ee("Not enough chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, only received ").concat(this.bytesReceived, " bytes"), he.Incomplete);
12740
12740
  if (this.bytesReceived > this.totalByteSize)
12741
- throw new Ee("Extra chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, received ").concat(this.bytesReceived, " bytes"), ue.LengthExceeded);
12741
+ throw new Ee("Extra chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, received ").concat(this.bytesReceived, " bytes"), he.LengthExceeded);
12742
12742
  }
12743
12743
  }
12744
12744
  constructor(e, t, i, s) {
@@ -12906,7 +12906,7 @@ class xl extends Ga {
12906
12906
  try {
12907
12907
  u = t.decode(l.content);
12908
12908
  } catch (h) {
12909
- throw new Ee("Cannot decode datastream chunk ".concat(l.chunkIndex, " as text: ").concat(h), ue.DecodeFailed);
12909
+ throw new Ee("Cannot decode datastream chunk ".concat(l.chunkIndex, " as text: ").concat(h), he.DecodeFailed);
12910
12910
  }
12911
12911
  return {
12912
12912
  done: !1,
@@ -12972,7 +12972,7 @@ class Al {
12972
12972
  }
12973
12973
  registerTextStreamHandler(e, t) {
12974
12974
  if (this.textStreamHandlers.has(e))
12975
- throw new Ee('A text stream handler for topic "'.concat(e, '" has already been set.'), ue.HandlerAlreadyRegistered);
12975
+ throw new Ee('A text stream handler for topic "'.concat(e, '" has already been set.'), he.HandlerAlreadyRegistered);
12976
12976
  this.textStreamHandlers.set(e, t);
12977
12977
  }
12978
12978
  unregisterTextStreamHandler(e) {
@@ -12980,7 +12980,7 @@ class Al {
12980
12980
  }
12981
12981
  registerByteStreamHandler(e, t) {
12982
12982
  if (this.byteStreamHandlers.has(e))
12983
- throw new Ee('A byte stream handler for topic "'.concat(e, '" has already been set.'), ue.HandlerAlreadyRegistered);
12983
+ throw new Ee('A byte stream handler for topic "'.concat(e, '" has already been set.'), he.HandlerAlreadyRegistered);
12984
12984
  this.byteStreamHandlers.set(e, t);
12985
12985
  }
12986
12986
  unregisterByteStreamHandler(e) {
@@ -12993,7 +12993,7 @@ class Al {
12993
12993
  var t, i, s, r;
12994
12994
  const o = Array.from(this.textStreamControllers.entries()).filter((c) => c[1].sendingParticipantIdentity === e), a = Array.from(this.byteStreamControllers.entries()).filter((c) => c[1].sendingParticipantIdentity === e);
12995
12995
  if (o.length > 0 || a.length > 0) {
12996
- const c = new Ee("Participant ".concat(e, " unexpectedly disconnected in the middle of sending data"), ue.AbnormalEnd);
12996
+ const c = new Ee("Participant ".concat(e, " unexpectedly disconnected in the middle of sending data"), he.AbnormalEnd);
12997
12997
  for (const [d, l] of a)
12998
12998
  (i = (t = l.outOfBandFailureRejectingFuture).reject) === null || i === void 0 || i.call(t, c), this.byteStreamControllers.delete(d);
12999
12999
  for (const [d, l] of o)
@@ -13040,7 +13040,7 @@ class Al {
13040
13040
  }, d = new ReadableStream({
13041
13041
  start: (l) => {
13042
13042
  if (o = l, this.textStreamControllers.has(e.streamId))
13043
- throw new Ee("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), ue.AlreadyOpened);
13043
+ throw new Ee("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), he.AlreadyOpened);
13044
13044
  this.byteStreamControllers.set(e.streamId, {
13045
13045
  info: c,
13046
13046
  controller: o,
@@ -13075,7 +13075,7 @@ class Al {
13075
13075
  }, d = new ReadableStream({
13076
13076
  start: (l) => {
13077
13077
  if (o = l, this.textStreamControllers.has(e.streamId))
13078
- throw new Ee("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), ue.AlreadyOpened);
13078
+ throw new Ee("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), he.AlreadyOpened);
13079
13079
  this.textStreamControllers.set(e.streamId, {
13080
13080
  info: c,
13081
13081
  controller: o,
@@ -13093,15 +13093,15 @@ class Al {
13093
13093
  }
13094
13094
  handleStreamChunk(e, t) {
13095
13095
  const i = this.byteStreamControllers.get(e.streamId);
13096
- i && (i.info.encryptionType !== t ? (i.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), ue.EncryptionTypeMismatch)), this.byteStreamControllers.delete(e.streamId)) : e.content.length > 0 && i.controller.enqueue(e));
13096
+ i && (i.info.encryptionType !== t ? (i.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), he.EncryptionTypeMismatch)), this.byteStreamControllers.delete(e.streamId)) : e.content.length > 0 && i.controller.enqueue(e));
13097
13097
  const s = this.textStreamControllers.get(e.streamId);
13098
- s && (s.info.encryptionType !== t ? (s.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), ue.EncryptionTypeMismatch)), this.textStreamControllers.delete(e.streamId)) : e.content.length > 0 && s.controller.enqueue(e));
13098
+ s && (s.info.encryptionType !== t ? (s.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), he.EncryptionTypeMismatch)), this.textStreamControllers.delete(e.streamId)) : e.content.length > 0 && s.controller.enqueue(e));
13099
13099
  }
13100
13100
  handleStreamTrailer(e, t) {
13101
13101
  const i = this.textStreamControllers.get(e.streamId);
13102
- i && (i.info.encryptionType !== t ? i.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), ue.EncryptionTypeMismatch)) : (i.info.attributes = Object.assign(Object.assign({}, i.info.attributes), e.attributes), i.controller.close(), this.textStreamControllers.delete(e.streamId)));
13102
+ i && (i.info.encryptionType !== t ? i.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), he.EncryptionTypeMismatch)) : (i.info.attributes = Object.assign(Object.assign({}, i.info.attributes), e.attributes), i.controller.close(), this.textStreamControllers.delete(e.streamId)));
13103
13103
  const s = this.byteStreamControllers.get(e.streamId);
13104
- s && (s.info.encryptionType !== t ? s.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), ue.EncryptionTypeMismatch)) : (s.info.attributes = Object.assign(Object.assign({}, s.info.attributes), e.attributes), s.controller.close()), this.byteStreamControllers.delete(e.streamId));
13104
+ s && (s.info.encryptionType !== t ? s.controller.error(new Ee("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), he.EncryptionTypeMismatch)) : (s.info.attributes = Object.assign(Object.assign({}, s.info.attributes), e.attributes), s.controller.close()), this.byteStreamControllers.delete(e.streamId));
13105
13105
  }
13106
13106
  }
13107
13107
  class Ja {
@@ -13188,7 +13188,7 @@ class Ul {
13188
13188
  operationType: e?.type === "update" ? sn.UPDATE : sn.CREATE
13189
13189
  })
13190
13190
  }
13191
- }), c = e?.destinationIdentities, d = new he({
13191
+ }), c = e?.destinationIdentities, d = new fe({
13192
13192
  destinationIdentities: c,
13193
13193
  value: {
13194
13194
  case: "streamHeader",
@@ -13206,7 +13206,7 @@ class Ul {
13206
13206
  content: R,
13207
13207
  streamId: r,
13208
13208
  chunkIndex: dt(l)
13209
- }), P = new he({
13209
+ }), P = new fe({
13210
13210
  destinationIdentities: c,
13211
13211
  value: {
13212
13212
  case: "streamChunk",
@@ -13221,7 +13221,7 @@ class Ul {
13221
13221
  return f(this, void 0, void 0, function* () {
13222
13222
  const g = new Ti({
13223
13223
  streamId: r
13224
- }), R = new he({
13224
+ }), R = new fe({
13225
13225
  destinationIdentities: c,
13226
13226
  value: {
13227
13227
  case: "streamTrailer",
@@ -13299,7 +13299,7 @@ class Ul {
13299
13299
  name: l.name
13300
13300
  })
13301
13301
  }
13302
- }), h = new he({
13302
+ }), h = new fe({
13303
13303
  destinationIdentities: d,
13304
13304
  value: {
13305
13305
  case: "streamHeader",
@@ -13308,14 +13308,14 @@ class Ul {
13308
13308
  });
13309
13309
  yield this.engine.sendDataPacket(h, B.RELIABLE);
13310
13310
  let m = 0;
13311
- const b = new fe(), g = this.engine, R = this.log, k = new WritableStream({
13311
+ const b = new me(), g = this.engine, R = this.log, k = new WritableStream({
13312
13312
  write(O) {
13313
13313
  return f(this, void 0, void 0, function* () {
13314
13314
  const v = yield b.lock();
13315
13315
  let y = 0;
13316
13316
  try {
13317
13317
  for (; y < O.byteLength; ) {
13318
- const C = O.slice(y, y + ar), M = new he({
13318
+ const C = O.slice(y, y + ar), M = new fe({
13319
13319
  destinationIdentities: d,
13320
13320
  value: {
13321
13321
  case: "streamChunk",
@@ -13337,7 +13337,7 @@ class Ul {
13337
13337
  return f(this, void 0, void 0, function* () {
13338
13338
  const O = new Ti({
13339
13339
  streamId: c
13340
- }), v = new he({
13340
+ }), v = new fe({
13341
13341
  destinationIdentities: d,
13342
13342
  value: {
13343
13343
  case: "streamTrailer",
@@ -14827,12 +14827,12 @@ class Gl extends za {
14827
14827
  try {
14828
14828
  for (var ae = !0, Se = Je(x), Qe; Qe = yield Se.next(), le = Qe.done, !le; ae = !0) {
14829
14829
  Y = Qe.value, ae = !1;
14830
- const pe = Y;
14831
- yield $t.write(pe);
14830
+ const ue = Y;
14831
+ yield $t.write(ue);
14832
14832
  }
14833
- } catch (pe) {
14833
+ } catch (ue) {
14834
14834
  Ve = {
14835
- error: pe
14835
+ error: ue
14836
14836
  };
14837
14837
  } finally {
14838
14838
  try {
@@ -14993,7 +14993,7 @@ class Gl extends za {
14993
14993
  destinationIdentities: o,
14994
14994
  topic: a
14995
14995
  });
14996
- const d = new he({
14996
+ const d = new fe({
14997
14997
  kind: r,
14998
14998
  value: {
14999
14999
  case: "user",
@@ -15012,7 +15012,7 @@ class Gl extends za {
15012
15012
  */
15013
15013
  publishDtmf(e, t) {
15014
15014
  return f(this, void 0, void 0, function* () {
15015
- const i = new he({
15015
+ const i = new fe({
15016
15016
  kind: B.RELIABLE,
15017
15017
  value: {
15018
15018
  case: "sipDtmf",
@@ -15033,7 +15033,7 @@ class Gl extends za {
15033
15033
  message: e,
15034
15034
  timestamp: Date.now(),
15035
15035
  attachedFiles: t?.attachments
15036
- }, s = new he({
15036
+ }, s = new fe({
15037
15037
  value: {
15038
15038
  case: "chatMessage",
15039
15039
  value: new bi(Object.assign(Object.assign({}, i), {
@@ -15050,7 +15050,7 @@ class Gl extends za {
15050
15050
  const i = Object.assign(Object.assign({}, t), {
15051
15051
  message: e,
15052
15052
  editTimestamp: Date.now()
15053
- }), s = new he({
15053
+ }), s = new fe({
15054
15054
  value: {
15055
15055
  case: "chatMessage",
15056
15056
  value: new bi(Object.assign(Object.assign({}, i), {
@@ -15199,7 +15199,7 @@ class Gl extends za {
15199
15199
  /** @internal */
15200
15200
  publishRpcRequest(e, t, i, s, r) {
15201
15201
  return f(this, void 0, void 0, function* () {
15202
- const o = new he({
15202
+ const o = new fe({
15203
15203
  destinationIdentities: [e],
15204
15204
  kind: B.RELIABLE,
15205
15205
  value: {
@@ -15956,7 +15956,7 @@ class Dt extends je.EventEmitter {
15956
15956
  this.emit(E.ParticipantPermissionsChanged, a, this.localParticipant);
15957
15957
  }, this.onLocalChatMessageSent = (a) => {
15958
15958
  this.emit(E.ChatMessage, a, this.localParticipant);
15959
- }, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, sl), e), this.log = ze((i = this.options.loggerName) !== null && i !== void 0 ? i : xe.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Fa), e?.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, ja), e?.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, nl), e?.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Al(), this.outgoingDataStreamManager = new Ul(this.engine, this.log), this.disconnectLock = new fe(), this.localParticipant = new Gl("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", it(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", it(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", it(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), be()) {
15959
+ }, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, sl), e), this.log = ze((i = this.options.loggerName) !== null && i !== void 0 ? i : xe.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Fa), e?.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, ja), e?.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, nl), e?.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Al(), this.outgoingDataStreamManager = new Ul(this.engine, this.log), this.disconnectLock = new me(), this.localParticipant = new Gl("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", it(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", it(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", it(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), be()) {
15960
15960
  const a = new AbortController();
15961
15961
  (o = (r = navigator.mediaDevices) === null || r === void 0 ? void 0 : r.addEventListener) === null || o === void 0 || o.call(r, "devicechange", this.handleDeviceChange, {
15962
15962
  signal: a.signal
@@ -17243,14 +17243,14 @@ function su(n) {
17243
17243
  }
17244
17244
  new TextEncoder();
17245
17245
  new TextDecoder();
17246
- class me extends Error {
17246
+ class pe extends Error {
17247
17247
  constructor(e, t) {
17248
17248
  var i;
17249
17249
  super(e, t), q(this, "code", "ERR_JOSE_GENERIC"), this.name = this.constructor.name, (i = Error.captureStackTrace) === null || i === void 0 || i.call(Error, this, this.constructor);
17250
17250
  }
17251
17251
  }
17252
- q(me, "code", "ERR_JOSE_GENERIC");
17253
- class ru extends me {
17252
+ q(pe, "code", "ERR_JOSE_GENERIC");
17253
+ class ru extends pe {
17254
17254
  constructor(e, t) {
17255
17255
  let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "unspecified", s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "unspecified";
17256
17256
  super(e, {
@@ -17263,7 +17263,7 @@ class ru extends me {
17263
17263
  }
17264
17264
  }
17265
17265
  q(ru, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
17266
- class au extends me {
17266
+ class au extends pe {
17267
17267
  constructor(e, t) {
17268
17268
  let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "unspecified", s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "unspecified";
17269
17269
  super(e, {
@@ -17276,77 +17276,77 @@ class au extends me {
17276
17276
  }
17277
17277
  }
17278
17278
  q(au, "code", "ERR_JWT_EXPIRED");
17279
- class ou extends me {
17279
+ class ou extends pe {
17280
17280
  constructor() {
17281
17281
  super(...arguments), q(this, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
17282
17282
  }
17283
17283
  }
17284
17284
  q(ou, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
17285
- class cu extends me {
17285
+ class cu extends pe {
17286
17286
  constructor() {
17287
17287
  super(...arguments), q(this, "code", "ERR_JOSE_NOT_SUPPORTED");
17288
17288
  }
17289
17289
  }
17290
17290
  q(cu, "code", "ERR_JOSE_NOT_SUPPORTED");
17291
- class du extends me {
17291
+ class du extends pe {
17292
17292
  constructor() {
17293
17293
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "decryption operation failed", t = arguments.length > 1 ? arguments[1] : void 0;
17294
17294
  super(e, t), q(this, "code", "ERR_JWE_DECRYPTION_FAILED");
17295
17295
  }
17296
17296
  }
17297
17297
  q(du, "code", "ERR_JWE_DECRYPTION_FAILED");
17298
- class lu extends me {
17298
+ class lu extends pe {
17299
17299
  constructor() {
17300
17300
  super(...arguments), q(this, "code", "ERR_JWE_INVALID");
17301
17301
  }
17302
17302
  }
17303
17303
  q(lu, "code", "ERR_JWE_INVALID");
17304
- class uu extends me {
17304
+ class uu extends pe {
17305
17305
  constructor() {
17306
17306
  super(...arguments), q(this, "code", "ERR_JWS_INVALID");
17307
17307
  }
17308
17308
  }
17309
17309
  q(uu, "code", "ERR_JWS_INVALID");
17310
- class hu extends me {
17310
+ class hu extends pe {
17311
17311
  constructor() {
17312
17312
  super(...arguments), q(this, "code", "ERR_JWT_INVALID");
17313
17313
  }
17314
17314
  }
17315
17315
  q(hu, "code", "ERR_JWT_INVALID");
17316
- class fu extends me {
17316
+ class fu extends pe {
17317
17317
  constructor() {
17318
17318
  super(...arguments), q(this, "code", "ERR_JWK_INVALID");
17319
17319
  }
17320
17320
  }
17321
17321
  q(fu, "code", "ERR_JWK_INVALID");
17322
- class mu extends me {
17322
+ class mu extends pe {
17323
17323
  constructor() {
17324
17324
  super(...arguments), q(this, "code", "ERR_JWKS_INVALID");
17325
17325
  }
17326
17326
  }
17327
17327
  q(mu, "code", "ERR_JWKS_INVALID");
17328
- class pu extends me {
17328
+ class pu extends pe {
17329
17329
  constructor() {
17330
17330
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "no applicable key found in the JSON Web Key Set", t = arguments.length > 1 ? arguments[1] : void 0;
17331
17331
  super(e, t), q(this, "code", "ERR_JWKS_NO_MATCHING_KEY");
17332
17332
  }
17333
17333
  }
17334
17334
  q(pu, "code", "ERR_JWKS_NO_MATCHING_KEY");
17335
- class gu extends me {
17335
+ class gu extends pe {
17336
17336
  constructor() {
17337
17337
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "multiple matching keys found in the JSON Web Key Set", t = arguments.length > 1 ? arguments[1] : void 0;
17338
17338
  super(e, t), q(this, Symbol.asyncIterator, void 0), q(this, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
17339
17339
  }
17340
17340
  }
17341
17341
  q(gu, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
17342
- class vu extends me {
17342
+ class vu extends pe {
17343
17343
  constructor() {
17344
17344
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "request timed out", t = arguments.length > 1 ? arguments[1] : void 0;
17345
17345
  super(e, t), q(this, "code", "ERR_JWKS_TIMEOUT");
17346
17346
  }
17347
17347
  }
17348
17348
  q(vu, "code", "ERR_JWKS_TIMEOUT");
17349
- class bu extends me {
17349
+ class bu extends pe {
17350
17350
  constructor() {
17351
17351
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "signature verification failed", t = arguments.length > 1 ? arguments[1] : void 0;
17352
17352
  super(e, t), q(this, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
@@ -17395,20 +17395,20 @@ function Su({ mode: n, server: e, configuration: t, applicationId: i, tenantId:
17395
17395
  if (de !== or) return;
17396
17396
  const $t = new TextDecoder().decode(ae);
17397
17397
  try {
17398
- const pe = JSON.parse($t);
17399
- if (console.log("Received from agent:", pe), pe.type === "session_end")
17400
- alert("Session ended"), y();
17401
- else if (pe.type === "ready")
17402
- pe.messages && pe.messages.length > 0 && a(pe.messages), d("connected"), O.current = !1, v.current === "voice" && k(!0);
17403
- else if (pe.type === "message") {
17404
- const At = pe;
17398
+ const ue = JSON.parse($t);
17399
+ if (console.log("Received from agent:", ue), ue.type === "session_end")
17400
+ alert(ue.message), u(!1), y();
17401
+ else if (ue.type === "ready")
17402
+ ue.messages && ue.messages.length > 0 && a(ue.messages), d("connected"), O.current = !1, v.current === "voice" && k(!0);
17403
+ else if (ue.type === "message") {
17404
+ const At = ue;
17405
17405
  a(function(Zt) {
17406
17406
  const es = Zt.findIndex((Ya) => Ya.id === At.message.id);
17407
17407
  return es >= 0 ? Zt[es] = At.message : Zt.push(At.message), [...Zt];
17408
17408
  }), At.message.role === "assistant" ? g("") : At.message.role === "user" && m(""), u(!1);
17409
17409
  }
17410
- } catch (pe) {
17411
- console.error("Failed to parse agent message:", pe);
17410
+ } catch (ue) {
17411
+ console.error("Failed to parse agent message:", ue);
17412
17412
  }
17413
17413
  };
17414
17414
  Te.on(E.DataReceived, Mt), Te.on(E.TrackSubscribed, (ae, Se, Qe) => {