@w0nna_dev/lina-widget 1.0.9 → 1.1.1

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.
@@ -45,7 +45,7 @@ const Ig = (i) => new Xf(typeof i == "string" ? i : i + "", void 0, wd), Io = (i
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
47
  */
48
- const { is: Lg, defineProperty: Ng, getOwnPropertyDescriptor: Og, getOwnPropertyNames: Ug, getOwnPropertySymbols: Fg, getPrototypeOf: Bg } = Object, Zi = globalThis, ku = Zi.trustedTypes, zg = ku ? ku.emptyScript : "", tc = Zi.reactiveElementPolyfillSupport, Wr = (i, e) => i, fo = { toAttribute(i, e) {
48
+ const { is: Lg, defineProperty: Ng, getOwnPropertyDescriptor: Og, getOwnPropertyNames: Ug, getOwnPropertySymbols: Fg, getPrototypeOf: Bg } = Object, Qi = globalThis, ku = Qi.trustedTypes, zg = ku ? ku.emptyScript : "", tc = Qi.reactiveElementPolyfillSupport, Wr = (i, e) => i, fo = { toAttribute(i, e) {
49
49
  switch (e) {
50
50
  case Boolean:
51
51
  i = i ? zg : null;
@@ -74,7 +74,7 @@ const { is: Lg, defineProperty: Ng, getOwnPropertyDescriptor: Og, getOwnProperty
74
74
  }
75
75
  return t;
76
76
  } }, Ad = (i, e) => !Lg(i, e), Iu = { attribute: !0, type: String, converter: fo, reflect: !1, useDefault: !1, hasChanged: Ad };
77
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), Zi.litPropertyMetadata ?? (Zi.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
77
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), Qi.litPropertyMetadata ?? (Qi.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
78
  let Ys = class extends HTMLElement {
79
79
  static addInitializer(e) {
80
80
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
@@ -278,13 +278,13 @@ let Ys = class extends HTMLElement {
278
278
  firstUpdated(e) {
279
279
  }
280
280
  };
281
- Ys.elementStyles = [], Ys.shadowRootOptions = { mode: "open" }, Ys[Wr("elementProperties")] = /* @__PURE__ */ new Map(), Ys[Wr("finalized")] = /* @__PURE__ */ new Map(), tc == null || tc({ ReactiveElement: Ys }), (Zi.reactiveElementVersions ?? (Zi.reactiveElementVersions = [])).push("2.1.2");
281
+ Ys.elementStyles = [], Ys.shadowRootOptions = { mode: "open" }, Ys[Wr("elementProperties")] = /* @__PURE__ */ new Map(), Ys[Wr("finalized")] = /* @__PURE__ */ new Map(), tc == null || tc({ ReactiveElement: Ys }), (Qi.reactiveElementVersions ?? (Qi.reactiveElementVersions = [])).push("2.1.2");
282
282
  /**
283
283
  * @license
284
284
  * Copyright 2017 Google LLC
285
285
  * SPDX-License-Identifier: BSD-3-Clause
286
286
  */
287
- const qr = globalThis, Du = (i) => i, po = qr.trustedTypes, Lu = po ? po.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, $f = "$lit$", ji = `lit$${Math.random().toFixed(9).slice(2)}$`, Kf = "?" + ji, Vg = `<${Kf}>`, ws = document, Jr = () => ws.createComment(""), Zr = (i) => i === null || typeof i != "object" && typeof i != "function", Rd = Array.isArray, Gg = (i) => Rd(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", nc = `[
287
+ const qr = globalThis, Du = (i) => i, po = qr.trustedTypes, Lu = po ? po.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, $f = "$lit$", Xi = `lit$${Math.random().toFixed(9).slice(2)}$`, Kf = "?" + Xi, Vg = `<${Kf}>`, ws = document, Jr = () => ws.createComment(""), Zr = (i) => i === null || typeof i != "object" && typeof i != "function", Rd = Array.isArray, Gg = (i) => Rd(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", nc = `[
288
288
  \f\r]`, Er = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Nu = /-->/g, Ou = />/g, ds = RegExp(`>|${nc}(?:([^\\s"'>=/]+)(${nc}*=${nc}*(?:[^
289
289
  \f\r"'\`<>=]|("|')|))|$)`, "g"), Uu = /'/g, Fu = /"/g, Yf = /^(?:script|style|textarea|title)$/i, Hg = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), kt = Hg(1), ur = Symbol.for("lit-noChange"), qt = Symbol.for("lit-nothing"), Bu = /* @__PURE__ */ new WeakMap(), Ts = ws.createTreeWalker(ws, 129);
290
290
  function Jf(i, e) {
@@ -299,7 +299,7 @@ const Wg = (i, e) => {
299
299
  let l, d, u = -1, h = 0;
300
300
  for (; h < c.length && (o.lastIndex = h, d = o.exec(c), d !== null); ) h = o.lastIndex, o === Er ? d[1] === "!--" ? o = Nu : d[1] !== void 0 ? o = Ou : d[2] !== void 0 ? (Yf.test(d[2]) && (s = RegExp("</" + d[2], "g")), o = ds) : d[3] !== void 0 && (o = ds) : o === ds ? d[0] === ">" ? (o = s ?? Er, u = -1) : d[1] === void 0 ? u = -2 : (u = o.lastIndex - d[2].length, l = d[1], o = d[3] === void 0 ? ds : d[3] === '"' ? Fu : Uu) : o === Fu || o === Uu ? o = ds : o === Nu || o === Ou ? o = Er : (o = ds, s = void 0);
301
301
  const f = o === ds && i[a + 1].startsWith("/>") ? " " : "";
302
- r += o === Er ? c + Vg : u >= 0 ? (n.push(l), c.slice(0, u) + $f + c.slice(u) + ji + f) : c + ji + (u === -2 ? a : f);
302
+ r += o === Er ? c + Vg : u >= 0 ? (n.push(l), c.slice(0, u) + $f + c.slice(u) + Xi + f) : c + Xi + (u === -2 ? a : f);
303
303
  }
304
304
  return [Jf(i, r + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), n];
305
305
  };
@@ -316,11 +316,11 @@ class Qr {
316
316
  for (; (s = Ts.nextNode()) !== null && c.length < a; ) {
317
317
  if (s.nodeType === 1) {
318
318
  if (s.hasAttributes()) for (const u of s.getAttributeNames()) if (u.endsWith($f)) {
319
- const h = d[o++], f = s.getAttribute(u).split(ji), g = /([.?@])?(.*)/.exec(h);
319
+ const h = d[o++], f = s.getAttribute(u).split(Xi), g = /([.?@])?(.*)/.exec(h);
320
320
  c.push({ type: 1, index: r, name: g[2], strings: f, ctor: g[1] === "." ? jg : g[1] === "?" ? Xg : g[1] === "@" ? $g : Do }), s.removeAttribute(u);
321
- } else u.startsWith(ji) && (c.push({ type: 6, index: r }), s.removeAttribute(u));
321
+ } else u.startsWith(Xi) && (c.push({ type: 6, index: r }), s.removeAttribute(u));
322
322
  if (Yf.test(s.tagName)) {
323
- const u = s.textContent.split(ji), h = u.length - 1;
323
+ const u = s.textContent.split(Xi), h = u.length - 1;
324
324
  if (h > 0) {
325
325
  s.textContent = po ? po.emptyScript : "";
326
326
  for (let f = 0; f < h; f++) s.append(u[f], Jr()), Ts.nextNode(), c.push({ type: 2, index: ++r });
@@ -330,7 +330,7 @@ class Qr {
330
330
  } else if (s.nodeType === 8) if (s.data === Kf) c.push({ type: 2, index: r });
331
331
  else {
332
332
  let u = -1;
333
- for (; (u = s.data.indexOf(ji, u + 1)) !== -1; ) c.push({ type: 7, index: r }), u += ji.length - 1;
333
+ for (; (u = s.data.indexOf(Xi, u + 1)) !== -1; ) c.push({ type: 7, index: r }), u += Xi.length - 1;
334
334
  }
335
335
  r++;
336
336
  }
@@ -521,7 +521,7 @@ const Yg = (i, e, t) => {
521
521
  * SPDX-License-Identifier: BSD-3-Clause
522
522
  */
523
523
  const Ms = globalThis;
524
- let Qi = class extends Ys {
524
+ let es = class extends Ys {
525
525
  constructor() {
526
526
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
527
527
  }
@@ -547,9 +547,9 @@ let Qi = class extends Ys {
547
547
  }
548
548
  };
549
549
  var jf;
550
- Qi._$litElement$ = !0, Qi.finalized = !0, (jf = Ms.litElementHydrateSupport) == null || jf.call(Ms, { LitElement: Qi });
550
+ es._$litElement$ = !0, es.finalized = !0, (jf = Ms.litElementHydrateSupport) == null || jf.call(Ms, { LitElement: es });
551
551
  const sc = Ms.litElementPolyfillSupport;
552
- sc == null || sc({ LitElement: Qi });
552
+ sc == null || sc({ LitElement: es });
553
553
  (Ms.litElementVersions ?? (Ms.litElementVersions = [])).push("4.2.2");
554
554
  /**
555
555
  * @license
@@ -598,7 +598,7 @@ function oe(i) {
598
598
  * Copyright 2017 Google LLC
599
599
  * SPDX-License-Identifier: BSD-3-Clause
600
600
  */
601
- function rs(i) {
601
+ function Ui(i) {
602
602
  return oe({ ...i, state: !0, attribute: !1 });
603
603
  }
604
604
  /**
@@ -1119,11 +1119,11 @@ var Z;
1119
1119
  (function(i) {
1120
1120
  i[i.DOUBLE = 1] = "DOUBLE", i[i.FLOAT = 2] = "FLOAT", i[i.INT64 = 3] = "INT64", i[i.UINT64 = 4] = "UINT64", i[i.INT32 = 5] = "INT32", i[i.FIXED64 = 6] = "FIXED64", i[i.FIXED32 = 7] = "FIXED32", i[i.BOOL = 8] = "BOOL", i[i.STRING = 9] = "STRING", i[i.BYTES = 12] = "BYTES", i[i.UINT32 = 13] = "UINT32", i[i.SFIXED32 = 15] = "SFIXED32", i[i.SFIXED64 = 16] = "SFIXED64", i[i.SINT32 = 17] = "SINT32", i[i.SINT64 = 18] = "SINT64";
1121
1121
  })(Z || (Z = {}));
1122
- var is;
1122
+ var ss;
1123
1123
  (function(i) {
1124
1124
  i[i.BIGINT = 0] = "BIGINT", i[i.STRING = 1] = "STRING";
1125
- })(is || (is = {}));
1126
- function Ui(i, e, t) {
1125
+ })(ss || (ss = {}));
1126
+ function Fi(i, e, t) {
1127
1127
  if (e === t)
1128
1128
  return !0;
1129
1129
  if (i == Z.BYTES) {
@@ -1177,10 +1177,10 @@ function ap(i, e) {
1177
1177
  return e == 0;
1178
1178
  }
1179
1179
  }
1180
- var Bt;
1180
+ var zt;
1181
1181
  (function(i) {
1182
1182
  i[i.Varint = 0] = "Varint", i[i.Bit64 = 1] = "Bit64", i[i.LengthDelimited = 2] = "LengthDelimited", i[i.StartGroup = 3] = "StartGroup", i[i.EndGroup = 4] = "EndGroup", i[i.Bit32 = 5] = "Bit32";
1183
- })(Bt || (Bt = {}));
1183
+ })(zt || (zt = {}));
1184
1184
  class Cv {
1185
1185
  constructor(e) {
1186
1186
  this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
@@ -1361,27 +1361,27 @@ class Ev {
1361
1361
  skip(e, t) {
1362
1362
  let n = this.pos;
1363
1363
  switch (e) {
1364
- case Bt.Varint:
1364
+ case zt.Varint:
1365
1365
  for (; this.buf[this.pos++] & 128; )
1366
1366
  ;
1367
1367
  break;
1368
1368
  // eslint-disable-next-line
1369
1369
  // @ts-ignore TS7029: Fallthrough case in switch
1370
- case Bt.Bit64:
1370
+ case zt.Bit64:
1371
1371
  this.pos += 4;
1372
1372
  // eslint-disable-next-line
1373
1373
  // @ts-ignore TS7029: Fallthrough case in switch
1374
- case Bt.Bit32:
1374
+ case zt.Bit32:
1375
1375
  this.pos += 4;
1376
1376
  break;
1377
- case Bt.LengthDelimited:
1377
+ case zt.LengthDelimited:
1378
1378
  let s = this.uint32();
1379
1379
  this.pos += s;
1380
1380
  break;
1381
- case Bt.StartGroup:
1381
+ case zt.StartGroup:
1382
1382
  for (; ; ) {
1383
1383
  const [r, o] = this.tag();
1384
- if (o === Bt.EndGroup) {
1384
+ if (o === zt.EndGroup) {
1385
1385
  if (t !== void 0 && r !== t)
1386
1386
  throw new Error("invalid end group tag");
1387
1387
  break;
@@ -1777,7 +1777,7 @@ function Dv() {
1777
1777
  return n;
1778
1778
  },
1779
1779
  readScalar(i, e, t) {
1780
- return Xr(i, e, t ?? is.BIGINT, !0);
1780
+ return Xr(i, e, t ?? ss.BIGINT, !0);
1781
1781
  },
1782
1782
  writeScalar(i, e, t) {
1783
1783
  if (e !== void 0 && (t || ap(i, e)))
@@ -1853,7 +1853,7 @@ function Xu(i, e, t, n, s) {
1853
1853
  break;
1854
1854
  case "scalar":
1855
1855
  try {
1856
- o[l] = Xr(t.V.T, c, is.BIGINT, !0);
1856
+ o[l] = Xr(t.V.T, c, ss.BIGINT, !0);
1857
1857
  } catch (u) {
1858
1858
  let h = "cannot decode map value for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(ni(e));
1859
1859
  throw u instanceof Error && u.message.length > 0 && (h += ": ".concat(u.message)), new Error(h);
@@ -1913,7 +1913,7 @@ function Lv(i, e) {
1913
1913
  e = !1;
1914
1914
  break;
1915
1915
  }
1916
- return Xr(i, e, is.BIGINT, !0).toString();
1916
+ return Xr(i, e, ss.BIGINT, !0).toString();
1917
1917
  }
1918
1918
  function Xr(i, e, t, n) {
1919
1919
  if (e === null)
@@ -2130,7 +2130,7 @@ function Fv() {
2130
2130
  readMessage(i, e, t, n, s) {
2131
2131
  const r = i.getType(), o = s ? e.len : e.pos + t;
2132
2132
  let a, c;
2133
- for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == Bt.EndGroup)); ) {
2133
+ for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == zt.EndGroup)); ) {
2134
2134
  const l = r.fields.find(a);
2135
2135
  if (!l) {
2136
2136
  const d = e.skip(c, a);
@@ -2140,7 +2140,7 @@ function Fv() {
2140
2140
  Ju(i, e, l, c, n);
2141
2141
  }
2142
2142
  if (s && // eslint-disable-line @typescript-eslint/strict-boolean-expressions
2143
- (c != Bt.EndGroup || a !== t))
2143
+ (c != zt.EndGroup || a !== t))
2144
2144
  throw new Error("invalid end group tag");
2145
2145
  },
2146
2146
  readField: Ju,
@@ -2174,7 +2174,7 @@ function Ju(i, e, t, n, s) {
2174
2174
  let c = vo;
2175
2175
  if (t.kind == "scalar" && t.L > 0 && (c = zv), r) {
2176
2176
  let h = i[o];
2177
- if (n == Bt.LengthDelimited && a != Z.STRING && a != Z.BYTES) {
2177
+ if (n == zt.LengthDelimited && a != Z.STRING && a != Z.BYTES) {
2178
2178
  let g = e.uint32() + e.pos;
2179
2179
  for (; e.pos < g; )
2180
2180
  h.push(c(e, a));
@@ -2228,10 +2228,10 @@ function Bv(i, e, t) {
2228
2228
  break;
2229
2229
  }
2230
2230
  }
2231
- if (r === void 0 && (r = fr(i.K, is.BIGINT)), typeof r != "string" && typeof r != "number" && (r = r.toString()), o === void 0)
2231
+ if (r === void 0 && (r = fr(i.K, ss.BIGINT)), typeof r != "string" && typeof r != "number" && (r = r.toString()), o === void 0)
2232
2232
  switch (i.V.kind) {
2233
2233
  case "scalar":
2234
- o = fr(i.V.T, is.BIGINT);
2234
+ o = fr(i.V.T, ss.BIGINT);
2235
2235
  break;
2236
2236
  case "enum":
2237
2237
  o = i.V.T.values[0].no;
@@ -2312,7 +2312,7 @@ function Zu(i, e, t, n) {
2312
2312
  }
2313
2313
  }
2314
2314
  function Vv(i, e, t, n, s) {
2315
- i.tag(t.no, Bt.LengthDelimited), i.fork();
2315
+ i.tag(t.no, zt.LengthDelimited), i.fork();
2316
2316
  let r = n;
2317
2317
  switch (t.K) {
2318
2318
  case Z.INT32:
@@ -2334,14 +2334,14 @@ function Vv(i, e, t, n, s) {
2334
2334
  $r(i, Z.INT32, 2, s);
2335
2335
  break;
2336
2336
  case "message":
2337
- Nt(s !== void 0), i.tag(2, Bt.LengthDelimited).bytes(s.toBinary(e));
2337
+ Nt(s !== void 0), i.tag(2, zt.LengthDelimited).bytes(s.toBinary(e));
2338
2338
  break;
2339
2339
  }
2340
2340
  i.join();
2341
2341
  }
2342
2342
  function Qu(i, e, t, n) {
2343
2343
  const s = hp(t.T, n);
2344
- t.delimited ? i.tag(t.no, Bt.StartGroup).raw(s.toBinary(e)).tag(t.no, Bt.EndGroup) : i.tag(t.no, Bt.LengthDelimited).bytes(s.toBinary(e));
2344
+ t.delimited ? i.tag(t.no, zt.StartGroup).raw(s.toBinary(e)).tag(t.no, zt.EndGroup) : i.tag(t.no, zt.LengthDelimited).bytes(s.toBinary(e));
2345
2345
  }
2346
2346
  function $r(i, e, t, n) {
2347
2347
  Nt(n !== void 0);
@@ -2351,28 +2351,28 @@ function $r(i, e, t, n) {
2351
2351
  function Gv(i, e, t, n) {
2352
2352
  if (!n.length)
2353
2353
  return;
2354
- i.tag(t, Bt.LengthDelimited).fork();
2354
+ i.tag(t, zt.LengthDelimited).fork();
2355
2355
  let [, s] = fp(e);
2356
2356
  for (let r = 0; r < n.length; r++)
2357
2357
  i[s](n[r]);
2358
2358
  i.join();
2359
2359
  }
2360
2360
  function fp(i) {
2361
- let e = Bt.Varint;
2361
+ let e = zt.Varint;
2362
2362
  switch (i) {
2363
2363
  case Z.BYTES:
2364
2364
  case Z.STRING:
2365
- e = Bt.LengthDelimited;
2365
+ e = zt.LengthDelimited;
2366
2366
  break;
2367
2367
  case Z.DOUBLE:
2368
2368
  case Z.FIXED64:
2369
2369
  case Z.SFIXED64:
2370
- e = Bt.Bit64;
2370
+ e = zt.Bit64;
2371
2371
  break;
2372
2372
  case Z.FIXED32:
2373
2373
  case Z.SFIXED32:
2374
2374
  case Z.FLOAT:
2375
- e = Bt.Bit32;
2375
+ e = zt.Bit32;
2376
2376
  break;
2377
2377
  }
2378
2378
  const t = Z[i].toLowerCase();
@@ -2447,9 +2447,9 @@ function Hv() {
2447
2447
  case "message":
2448
2448
  return s.every((o, a) => n.T.equals(o, r[a]));
2449
2449
  case "scalar":
2450
- return s.every((o, a) => Ui(n.T, o, r[a]));
2450
+ return s.every((o, a) => Fi(n.T, o, r[a]));
2451
2451
  case "enum":
2452
- return s.every((o, a) => Ui(Z.INT32, o, r[a]));
2452
+ return s.every((o, a) => Fi(Z.INT32, o, r[a]));
2453
2453
  }
2454
2454
  throw new Error("repeated cannot contain ".concat(n.kind));
2455
2455
  }
@@ -2458,9 +2458,9 @@ function Hv() {
2458
2458
  let o = s, a = r;
2459
2459
  return n.T.fieldWrapper && (o !== void 0 && !Ei(o) && (o = n.T.fieldWrapper.wrapField(o)), a !== void 0 && !Ei(a) && (a = n.T.fieldWrapper.wrapField(a))), n.T.equals(o, a);
2460
2460
  case "enum":
2461
- return Ui(Z.INT32, s, r);
2461
+ return Fi(Z.INT32, s, r);
2462
2462
  case "scalar":
2463
- return Ui(n.T, s, r);
2463
+ return Fi(n.T, s, r);
2464
2464
  case "oneof":
2465
2465
  if (s.case !== r.case)
2466
2466
  return !1;
@@ -2471,9 +2471,9 @@ function Hv() {
2471
2471
  case "message":
2472
2472
  return c.T.equals(s.value, r.value);
2473
2473
  case "enum":
2474
- return Ui(Z.INT32, s.value, r.value);
2474
+ return Fi(Z.INT32, s.value, r.value);
2475
2475
  case "scalar":
2476
- return Ui(c.T, s.value, r.value);
2476
+ return Fi(c.T, s.value, r.value);
2477
2477
  }
2478
2478
  throw new Error("oneof cannot contain ".concat(c.kind));
2479
2479
  case "map":
@@ -2483,10 +2483,10 @@ function Hv() {
2483
2483
  const d = n.V.T;
2484
2484
  return l.every((h) => d.equals(s[h], r[h]));
2485
2485
  case "enum":
2486
- return l.every((h) => Ui(Z.INT32, s[h], r[h]));
2486
+ return l.every((h) => Fi(Z.INT32, s[h], r[h]));
2487
2487
  case "scalar":
2488
2488
  const u = n.V.T;
2489
- return l.every((h) => Ui(u, s[h], r[h]));
2489
+ return l.every((h) => Fi(u, s[h], r[h]));
2490
2490
  }
2491
2491
  break;
2492
2492
  }
@@ -2669,7 +2669,7 @@ function Qv(i, e) {
2669
2669
  let l;
2670
2670
  for (const d of typeof i == "function" ? i() : i) {
2671
2671
  const u = d;
2672
- if (u.localName = pp(d.name, d.oneof !== void 0), u.jsonName = (t = d.jsonName) !== null && t !== void 0 ? t : Xv(d.name), u.repeated = (n = d.repeated) !== null && n !== void 0 ? n : !1, d.kind == "scalar" && (u.L = (s = d.L) !== null && s !== void 0 ? s : is.BIGINT), u.delimited = (r = d.delimited) !== null && r !== void 0 ? r : !1, u.req = (o = d.req) !== null && o !== void 0 ? o : !1, u.opt = (a = d.opt) !== null && a !== void 0 ? a : !1, d.packed === void 0 && (u.packed = d.kind == "enum" || d.kind == "scalar" && d.T != Z.BYTES && d.T != Z.STRING), d.oneof !== void 0) {
2672
+ if (u.localName = pp(d.name, d.oneof !== void 0), u.jsonName = (t = d.jsonName) !== null && t !== void 0 ? t : Xv(d.name), u.repeated = (n = d.repeated) !== null && n !== void 0 ? n : !1, d.kind == "scalar" && (u.L = (s = d.L) !== null && s !== void 0 ? s : ss.BIGINT), u.delimited = (r = d.delimited) !== null && r !== void 0 ? r : !1, u.req = (o = d.req) !== null && o !== void 0 ? o : !1, u.opt = (a = d.opt) !== null && a !== void 0 ? a : !1, d.packed === void 0 && (u.packed = d.kind == "enum" || d.kind == "scalar" && d.T != Z.BYTES && d.T != Z.STRING), d.oneof !== void 0) {
2673
2673
  const h = typeof d.oneof == "string" ? d.oneof : d.oneof.name;
2674
2674
  (!l || l.name != h) && (l = new Zv(h)), u.oneof = l, l.addField(u);
2675
2675
  }
@@ -3349,7 +3349,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
3349
3349
  }, {
3350
3350
  no: 1,
3351
3351
  name: "FORWARDED"
3352
- }]), jt = /* @__PURE__ */ z.makeEnum("livekit.Encryption.Type", [{
3352
+ }]), Xt = /* @__PURE__ */ z.makeEnum("livekit.Encryption.Type", [{
3353
3353
  no: 0,
3354
3354
  name: "NONE"
3355
3355
  }, {
@@ -3380,7 +3380,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
3380
3380
  no: 4,
3381
3381
  name: "layers",
3382
3382
  kind: "message",
3383
- T: es,
3383
+ T: ts,
3384
3384
  repeated: !0
3385
3385
  }, {
3386
3386
  no: 5,
@@ -3449,7 +3449,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
3449
3449
  no: 10,
3450
3450
  name: "layers",
3451
3451
  kind: "message",
3452
- T: es,
3452
+ T: ts,
3453
3453
  repeated: !0
3454
3454
  }, {
3455
3455
  no: 11,
@@ -3485,7 +3485,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
3485
3485
  no: 16,
3486
3486
  name: "encryption",
3487
3487
  kind: "enum",
3488
- T: z.getEnumType(jt)
3488
+ T: z.getEnumType(Xt)
3489
3489
  }, {
3490
3490
  no: 17,
3491
3491
  name: "stream",
@@ -3508,7 +3508,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
3508
3508
  name: "backup_codec_policy",
3509
3509
  kind: "enum",
3510
3510
  T: z.getEnumType(vp)
3511
- }]), es = /* @__PURE__ */ z.makeMessageType("livekit.VideoLayer", () => [{
3511
+ }]), ts = /* @__PURE__ */ z.makeMessageType("livekit.VideoLayer", () => [{
3512
3512
  no: 1,
3513
3513
  name: "quality",
3514
3514
  kind: "enum",
@@ -3678,7 +3678,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
3678
3678
  no: 1,
3679
3679
  name: "encryption_type",
3680
3680
  kind: "enum",
3681
- T: z.getEnumType(jt)
3681
+ T: z.getEnumType(Xt)
3682
3682
  }, {
3683
3683
  no: 2,
3684
3684
  name: "iv",
@@ -4311,7 +4311,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4311
4311
  no: 7,
4312
4312
  name: "encryption_type",
4313
4313
  kind: "enum",
4314
- T: z.getEnumType(jt)
4314
+ T: z.getEnumType(Xt)
4315
4315
  }, {
4316
4316
  no: 8,
4317
4317
  name: "attributes",
@@ -4429,13 +4429,13 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4429
4429
  no: 1,
4430
4430
  name: "offer",
4431
4431
  kind: "message",
4432
- T: ss,
4432
+ T: rs,
4433
4433
  oneof: "message"
4434
4434
  }, {
4435
4435
  no: 2,
4436
4436
  name: "answer",
4437
4437
  kind: "message",
4438
- T: ss,
4438
+ T: rs,
4439
4439
  oneof: "message"
4440
4440
  }, {
4441
4441
  no: 3,
@@ -4537,13 +4537,13 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4537
4537
  no: 2,
4538
4538
  name: "answer",
4539
4539
  kind: "message",
4540
- T: ss,
4540
+ T: rs,
4541
4541
  oneof: "message"
4542
4542
  }, {
4543
4543
  no: 3,
4544
4544
  name: "offer",
4545
4545
  kind: "message",
4546
- T: ss,
4546
+ T: rs,
4547
4547
  oneof: "message"
4548
4548
  }, {
4549
4549
  no: 4,
@@ -4693,7 +4693,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4693
4693
  no: 4,
4694
4694
  name: "layers",
4695
4695
  kind: "message",
4696
- T: es,
4696
+ T: ts,
4697
4697
  repeated: !0
4698
4698
  }, {
4699
4699
  no: 5,
@@ -4750,7 +4750,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4750
4750
  no: 9,
4751
4751
  name: "layers",
4752
4752
  kind: "message",
4753
- T: es,
4753
+ T: ts,
4754
4754
  repeated: !0
4755
4755
  }, {
4756
4756
  no: 10,
@@ -4780,7 +4780,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4780
4780
  no: 14,
4781
4781
  name: "encryption",
4782
4782
  kind: "enum",
4783
- T: z.getEnumType(jt)
4783
+ T: z.getEnumType(Xt)
4784
4784
  }, {
4785
4785
  no: 15,
4786
4786
  name: "stream",
@@ -4952,7 +4952,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
4952
4952
  kind: "scalar",
4953
4953
  T: 9
4954
4954
  /* ScalarType.STRING */
4955
- }]), ss = /* @__PURE__ */ z.makeMessageType("livekit.SessionDescription", () => [{
4955
+ }]), rs = /* @__PURE__ */ z.makeMessageType("livekit.SessionDescription", () => [{
4956
4956
  no: 1,
4957
4957
  name: "type",
4958
4958
  kind: "scalar",
@@ -5115,7 +5115,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
5115
5115
  no: 2,
5116
5116
  name: "layers",
5117
5117
  kind: "message",
5118
- T: es,
5118
+ T: ts,
5119
5119
  repeated: !0
5120
5120
  }]), Bd = /* @__PURE__ */ z.makeMessageType("livekit.UpdateParticipantMetadata", () => [{
5121
5121
  no: 1,
@@ -5353,7 +5353,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
5353
5353
  no: 1,
5354
5354
  name: "answer",
5355
5355
  kind: "message",
5356
- T: ss
5356
+ T: rs
5357
5357
  }, {
5358
5358
  no: 2,
5359
5359
  name: "subscription",
@@ -5375,7 +5375,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
5375
5375
  no: 5,
5376
5376
  name: "offer",
5377
5377
  kind: "message",
5378
- T: ss
5378
+ T: rs
5379
5379
  }, {
5380
5380
  no: 6,
5381
5381
  name: "track_sids_disabled",
@@ -5670,7 +5670,7 @@ const e0 = /* @__PURE__ */ z.makeMessageType("livekit.MetricsBatch", () => [{
5670
5670
  no: 6,
5671
5671
  name: "publisher_offer",
5672
5672
  kind: "message",
5673
- T: ss
5673
+ T: rs
5674
5674
  }, {
5675
5675
  no: 7,
5676
5676
  name: "reconnect",
@@ -7763,7 +7763,7 @@ class oy extends fi {
7763
7763
  super(10, e ?? "unsupported server"), this.name = "UnsupportedServer";
7764
7764
  }
7765
7765
  }
7766
- class Ft extends fi {
7766
+ class Bt extends fi {
7767
7767
  constructor(e) {
7768
7768
  super(12, e ?? "unexpected connection state"), this.name = "UnexpectedConnectionState";
7769
7769
  }
@@ -8536,7 +8536,7 @@ class zn {
8536
8536
  function Iy(i) {
8537
8537
  return dy.includes(i);
8538
8538
  }
8539
- function ts(i) {
8539
+ function ns(i) {
8540
8540
  if (typeof i == "string" || typeof i == "number")
8541
8541
  return i;
8542
8542
  if (Array.isArray(i))
@@ -8620,7 +8620,7 @@ function ai(i) {
8620
8620
  function as(i) {
8621
8621
  return !!i && i.kind == J.Kind.Video;
8622
8622
  }
8623
- function Fi(i) {
8623
+ function Bi(i) {
8624
8624
  return rr(i) && as(i);
8625
8625
  }
8626
8626
  function _i(i) {
@@ -8713,18 +8713,18 @@ const Wy = 10, Pr = "lk_e2ee", qy = "LKFrameEncryptionKey", jy = {
8713
8713
  failureTolerance: Wy,
8714
8714
  keyringSize: 16
8715
8715
  };
8716
- var ns;
8716
+ var is;
8717
8717
  (function(i) {
8718
8718
  i.SetKey = "setKey", i.RatchetRequest = "ratchetRequest", i.KeyRatcheted = "keyRatcheted";
8719
- })(ns || (ns = {}));
8719
+ })(is || (is = {}));
8720
8720
  var Ch;
8721
8721
  (function(i) {
8722
8722
  i.KeyRatcheted = "keyRatcheted";
8723
8723
  })(Ch || (Ch = {}));
8724
- var Yi;
8724
+ var Ji;
8725
8725
  (function(i) {
8726
8726
  i.ParticipantEncryptionStatusChanged = "participantEncryptionStatusChanged", i.EncryptionError = "encryptionError";
8727
- })(Yi || (Yi = {}));
8727
+ })(Ji || (Ji = {}));
8728
8728
  var Eh;
8729
8729
  (function(i) {
8730
8730
  i.Error = "cryptorError";
@@ -8755,7 +8755,7 @@ class fw extends hi.EventEmitter {
8755
8755
  participantId: n,
8756
8756
  keyIndex: s
8757
8757
  });
8758
- }, this.keyInfoMap = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, jy), e), this.on(ns.KeyRatcheted, this.onKeyRatcheted);
8758
+ }, this.keyInfoMap = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, jy), e), this.on(is.KeyRatcheted, this.onKeyRatcheted);
8759
8759
  }
8760
8760
  /**
8761
8761
  * callback to invoke once a key has been set for a participant
@@ -8771,7 +8771,7 @@ class fw extends hi.EventEmitter {
8771
8771
  };
8772
8772
  if (!this.options.sharedKey && !t)
8773
8773
  throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");
8774
- this.keyInfoMap.set("".concat(t ?? "shared", "-").concat(n ?? 0), s), this.emit(ns.SetKey, s);
8774
+ this.keyInfoMap.set("".concat(t ?? "shared", "-").concat(n ?? 0), s), this.emit(is.SetKey, s);
8775
8775
  }
8776
8776
  getKeys() {
8777
8777
  return Array.from(this.keyInfoMap.values());
@@ -8780,7 +8780,7 @@ class fw extends hi.EventEmitter {
8780
8780
  return this.options;
8781
8781
  }
8782
8782
  ratchetKey(e, t) {
8783
- this.emit(ns.RatchetRequest, e, t);
8783
+ this.emit(is.RatchetRequest, e, t);
8784
8784
  }
8785
8785
  }
8786
8786
  var Mh;
@@ -8809,7 +8809,7 @@ class Yy extends hi.EventEmitter {
8809
8809
  break;
8810
8810
  }
8811
8811
  }
8812
- this.emit(Yi.EncryptionError, a.error, a.participantIdentity);
8812
+ this.emit(Ji.EncryptionError, a.error, a.participantIdentity);
8813
8813
  break;
8814
8814
  case "initAck":
8815
8815
  a.enabled && this.keyProvider.getKeys().forEach((d) => {
@@ -8820,16 +8820,16 @@ class Yy extends hi.EventEmitter {
8820
8820
  if (a.enabled && this.keyProvider.getKeys().forEach((d) => {
8821
8821
  this.postKey(d);
8822
8822
  }), this.encryptionEnabled !== a.enabled && a.participantIdentity === ((s = this.room) === null || s === void 0 ? void 0 : s.localParticipant.identity))
8823
- this.emit(Yi.ParticipantEncryptionStatusChanged, a.enabled, this.room.localParticipant), this.encryptionEnabled = a.enabled;
8823
+ this.emit(Ji.ParticipantEncryptionStatusChanged, a.enabled, this.room.localParticipant), this.encryptionEnabled = a.enabled;
8824
8824
  else if (a.participantIdentity) {
8825
8825
  const d = (r = this.room) === null || r === void 0 ? void 0 : r.getParticipantByIdentity(a.participantIdentity);
8826
8826
  if (!d)
8827
8827
  throw TypeError("couldn't set encryption status, participant not found".concat(a.participantIdentity));
8828
- this.emit(Yi.ParticipantEncryptionStatusChanged, a.enabled, d);
8828
+ this.emit(Ji.ParticipantEncryptionStatusChanged, a.enabled, d);
8829
8829
  }
8830
8830
  break;
8831
8831
  case "ratchetKey":
8832
- this.keyProvider.emit(ns.KeyRatcheted, a.ratchetResult, a.participantIdentity, a.keyIndex);
8832
+ this.keyProvider.emit(is.KeyRatcheted, a.ratchetResult, a.participantIdentity, a.keyIndex);
8833
8833
  break;
8834
8834
  case "decryptDataResponse":
8835
8835
  const c = this.decryptDataRequests.get(a.uuid);
@@ -8843,7 +8843,7 @@ class Yy extends hi.EventEmitter {
8843
8843
  }, this.onWorkerError = (n) => {
8844
8844
  We.error("e2ee worker encountered an error:", {
8845
8845
  error: n.error
8846
- }), this.emit(Yi.EncryptionError, n.error, void 0);
8846
+ }), this.emit(Ji.EncryptionError, n.error, void 0);
8847
8847
  }, this.keyProvider = e.keyProvider, this.worker = e.worker, this.encryptionEnabled = !1, this.dataChannelEncryptionEnabled = t;
8848
8848
  }
8849
8849
  get isEnabled() {
@@ -8890,10 +8890,10 @@ class Yy extends hi.EventEmitter {
8890
8890
  });
8891
8891
  }
8892
8892
  setupEventListeners(e, t) {
8893
- e.on(te.TrackPublished, (n, s) => this.setParticipantCryptorEnabled(n.trackInfo.encryption !== jt.NONE, s.identity)), e.on(te.ConnectionStateChanged, (n) => {
8893
+ e.on(te.TrackPublished, (n, s) => this.setParticipantCryptorEnabled(n.trackInfo.encryption !== Xt.NONE, s.identity)), e.on(te.ConnectionStateChanged, (n) => {
8894
8894
  n === at.Connected && e.remoteParticipants.forEach((s) => {
8895
8895
  s.trackPublications.forEach((r) => {
8896
- this.setParticipantCryptorEnabled(r.trackInfo.encryption !== jt.NONE, s.identity);
8896
+ this.setParticipantCryptorEnabled(r.trackInfo.encryption !== Xt.NONE, s.identity);
8897
8897
  });
8898
8898
  });
8899
8899
  }).on(te.TrackUnsubscribed, (n, s, r) => {
@@ -8928,7 +8928,7 @@ class Yy extends hi.EventEmitter {
8928
8928
  }
8929
8929
  };
8930
8930
  this.worker.postMessage(s);
8931
- }), t.on(ns.SetKey, (n) => this.postKey(n)).on(ns.RatchetRequest, (n, s) => this.postRatchetRequest(n, s));
8931
+ }), t.on(is.SetKey, (n) => this.postKey(n)).on(is.RatchetRequest, (n, s) => this.postRatchetRequest(n, s));
8932
8932
  }
8933
8933
  encryptData(e) {
8934
8934
  return P(this, void 0, void 0, function* () {
@@ -9863,7 +9863,7 @@ function wh(i) {
9863
9863
  return e;
9864
9864
  }
9865
9865
  function Qs(i, e) {
9866
- return new ss({
9866
+ return new rs({
9867
9867
  sdp: i.sdp,
9868
9868
  type: i.type,
9869
9869
  id: e
@@ -10576,7 +10576,7 @@ function lb() {
10576
10576
  var i = ob(), e = cb(), t = Kd();
10577
10577
  return Vn.grammar = t, Vn.write = e, Vn.parse = i.parse, Vn.parseParams = i.parseParams, Vn.parseFmtpConfig = i.parseFmtpConfig, Vn.parsePayloads = i.parsePayloads, Vn.parseRemoteCandidates = i.parseRemoteCandidates, Vn.parseImageAttributes = i.parseImageAttributes, Vn.parseSimulcastStreamList = i.parseSimulcastStreamList, Vn;
10578
10578
  }
10579
- var qi = lb();
10579
+ var ji = lb();
10580
10580
  function Yd(i, e, t) {
10581
10581
  var n, s, r;
10582
10582
  e === void 0 && (e = 50), t === void 0 && (t = {});
@@ -10696,7 +10696,7 @@ class Dh extends hi.EventEmitter {
10696
10696
  } = hb(e);
10697
10697
  this.remoteStereoMids = r, this.remoteNackMids = o;
10698
10698
  } else if (e.type === "answer") {
10699
- const r = qi.parse((n = e.sdp) !== null && n !== void 0 ? n : "");
10699
+ const r = ji.parse((n = e.sdp) !== null && n !== void 0 ? n : "");
10700
10700
  r.media.forEach((o) => {
10701
10701
  const a = Jd(o.mid);
10702
10702
  o.type === "audio" && this.trackBitrates.some((c) => {
@@ -10716,11 +10716,11 @@ class Dh extends hi.EventEmitter {
10716
10716
  config: "maxaveragebitrate=".concat(c.maxbr * 1e3)
10717
10717
  }), !0;
10718
10718
  });
10719
- }), s = qi.write(r);
10719
+ }), s = ji.write(r);
10720
10720
  }
10721
10721
  return yield this.setMungedSDP(e, s, !0), this.pendingCandidates.forEach((r) => {
10722
10722
  this.pc.addIceCandidate(r);
10723
- }), this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate ? (this.renegotiate = !1, yield this.createAndSendOffer()) : e.type === "answer" && (this.emit(or.NegotiationComplete), e.sdp && qi.parse(e.sdp).media.forEach((o) => {
10723
+ }), this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate ? (this.renegotiate = !1, yield this.createAndSendOffer()) : e.type === "answer" && (this.emit(or.NegotiationComplete), e.sdp && ji.parse(e.sdp).media.forEach((o) => {
10724
10724
  o.type === "video" && this.emit(or.RTPVideoPayloadTypes, o.rtp);
10725
10725
  })), !0;
10726
10726
  });
@@ -10751,7 +10751,7 @@ class Dh extends hi.EventEmitter {
10751
10751
  this.log.debug("original offer", Object.assign({
10752
10752
  sdp: r.sdp
10753
10753
  }, this.logContext));
10754
- const o = qi.parse((t = r.sdp) !== null && t !== void 0 ? t : "");
10754
+ const o = ji.parse((t = r.sdp) !== null && t !== void 0 ? t : "");
10755
10755
  if (o.media.forEach((a) => {
10756
10756
  Nh(a), a.type === "audio" ? Lh(a, ["all"], []) : a.type === "video" && this.trackBitrates.some((c) => {
10757
10757
  if (!a.msid || !c.cid || !a.msid.includes(c.cid))
@@ -10774,7 +10774,7 @@ class Dh extends hi.EventEmitter {
10774
10774
  }));
10775
10775
  return;
10776
10776
  }
10777
- yield this.setMungedSDP(r, qi.write(o)), this.onOffer(r, this.latestOfferId);
10777
+ yield this.setMungedSDP(r, ji.write(o)), this.onOffer(r, this.latestOfferId);
10778
10778
  } finally {
10779
10779
  n();
10780
10780
  }
@@ -10783,10 +10783,10 @@ class Dh extends hi.EventEmitter {
10783
10783
  createAndSetAnswer() {
10784
10784
  return P(this, void 0, void 0, function* () {
10785
10785
  var e;
10786
- const t = yield this.pc.createAnswer(), n = qi.parse((e = t.sdp) !== null && e !== void 0 ? e : "");
10786
+ const t = yield this.pc.createAnswer(), n = ji.parse((e = t.sdp) !== null && e !== void 0 ? e : "");
10787
10787
  return n.media.forEach((s) => {
10788
10788
  Nh(s), s.type === "audio" && Lh(s, this.remoteStereoMids, this.remoteNackMids);
10789
- }), yield this.setMungedSDP(t, qi.write(n)), t;
10789
+ }), yield this.setMungedSDP(t, ji.write(n)), t;
10790
10790
  });
10791
10791
  }
10792
10792
  createDataChannel(e, t) {
@@ -10800,7 +10800,7 @@ class Dh extends hi.EventEmitter {
10800
10800
  }
10801
10801
  addTrack(e) {
10802
10802
  if (!this._pc)
10803
- throw new Ft("PC closed, cannot add track");
10803
+ throw new Bt("PC closed, cannot add track");
10804
10804
  return this._pc.addTrack(e);
10805
10805
  }
10806
10806
  setTrackCodecBitrate(e) {
@@ -10809,7 +10809,7 @@ class Dh extends hi.EventEmitter {
10809
10809
  setConfiguration(e) {
10810
10810
  var t;
10811
10811
  if (!this._pc)
10812
- throw new Ft("PC closed, cannot configure");
10812
+ throw new Bt("PC closed, cannot configure");
10813
10813
  return (t = this._pc) === null || t === void 0 ? void 0 : t.setConfiguration(e);
10814
10814
  }
10815
10815
  canRemoveTrack() {
@@ -10936,7 +10936,7 @@ function Lh(i, e, t) {
10936
10936
  }
10937
10937
  function hb(i) {
10938
10938
  var e;
10939
- const t = [], n = [], s = qi.parse((e = i.sdp) !== null && e !== void 0 ? e : "");
10939
+ const t = [], n = [], s = ji.parse((e = i.sdp) !== null && e !== void 0 ? e : "");
10940
10940
  let r = 0;
10941
10941
  return s.media.forEach((o) => {
10942
10942
  var a;
@@ -11555,7 +11555,7 @@ class Dm extends J {
11555
11555
  }
11556
11556
  setDeviceId(e) {
11557
11557
  return P(this, void 0, void 0, function* () {
11558
- return this._constraints.deviceId === e && this._mediaStreamTrack.getSettings().deviceId === ts(e) || (this._constraints.deviceId = e, this.isMuted) ? !0 : (yield this.restartTrack(), ts(e) === this._mediaStreamTrack.getSettings().deviceId);
11558
+ return this._constraints.deviceId === e && this._mediaStreamTrack.getSettings().deviceId === ns(e) || (this._constraints.deviceId = e, this.isMuted) ? !0 : (yield this.restartTrack(), ns(e) === this._mediaStreamTrack.getSettings().deviceId);
11559
11559
  });
11560
11560
  }
11561
11561
  /**
@@ -11889,7 +11889,7 @@ class Co extends Dm {
11889
11889
  try {
11890
11890
  if (!this.isMuted)
11891
11891
  return this.log.debug("Track already unmuted", this.logContext), this;
11892
- const n = this._constraints.deviceId && this._mediaStreamTrack.getSettings().deviceId !== ts(this._constraints.deviceId);
11892
+ const n = this._constraints.deviceId && this._mediaStreamTrack.getSettings().deviceId !== ns(this._constraints.deviceId);
11893
11893
  return this.source === J.Source.Microphone && (this.stopOnMute || this._mediaStreamTrack.readyState === "ended" || n) && !this.isUserProvided && (this.log.debug("reacquiring mic track", this.logContext), yield this.restartTrack()), yield e.unmute.call(this), this;
11894
11894
  } finally {
11895
11895
  t();
@@ -12156,7 +12156,7 @@ class Lm {
12156
12156
  }
12157
12157
  }
12158
12158
  function Lb(i) {
12159
- return i.source === J.Source.ScreenShare || i.constraints.height && ts(i.constraints.height) >= 1080 ? "maintain-resolution" : "balanced";
12159
+ return i.source === J.Source.ScreenShare || i.constraints.height && ns(i.constraints.height) >= 1080 ? "maintain-resolution" : "balanced";
12160
12160
  }
12161
12161
  const Nb = 5e3;
12162
12162
  class Eo extends Dm {
@@ -12603,7 +12603,7 @@ function Nm(i) {
12603
12603
  }
12604
12604
  function zh(i, e, t, n) {
12605
12605
  if (!t)
12606
- return [new es({
12606
+ return [new ts({
12607
12607
  quality: Ln.HIGH,
12608
12608
  width: i,
12609
12609
  height: e,
@@ -12613,7 +12613,7 @@ function zh(i, e, t, n) {
12613
12613
  if (n) {
12614
12614
  const s = t[0].scalabilityMode, r = new Lm(s), o = [], a = r.suffix == "h" ? 1.5 : 2, c = r.suffix == "h" ? 2 : 3;
12615
12615
  for (let l = 0; l < r.spatial; l += 1)
12616
- o.push(new es({
12616
+ o.push(new ts({
12617
12617
  quality: Math.min(Ln.HIGH, r.spatial - 1) - l,
12618
12618
  width: Math.ceil(i / Math.pow(a, l)),
12619
12619
  height: Math.ceil(e / Math.pow(a, l)),
@@ -12626,7 +12626,7 @@ function zh(i, e, t, n) {
12626
12626
  var r, o, a;
12627
12627
  const c = (r = s.scaleResolutionDownBy) !== null && r !== void 0 ? r : 1;
12628
12628
  let l = Nm((o = s.rid) !== null && o !== void 0 ? o : "");
12629
- return new es({
12629
+ return new ts({
12630
12630
  quality: l,
12631
12631
  width: Math.ceil(i / c),
12632
12632
  height: Math.ceil(e / c),
@@ -12701,7 +12701,7 @@ class zb extends hi.EventEmitter {
12701
12701
  });
12702
12702
  ((a = g.value) === null || a === void 0 ? void 0 : a.case) === "user" && Hh(g, g.value.value), this.emit(ce.DataPacketReceived, g, u.value.value.encryptionType);
12703
12703
  } else
12704
- ((c = u.value) === null || c === void 0 ? void 0 : c.case) === "user" && Hh(u, u.value.value), this.emit(ce.DataPacketReceived, u, jt.NONE);
12704
+ ((c = u.value) === null || c === void 0 ? void 0 : c.case) === "user" && Hh(u, u.value.value), this.emit(ce.DataPacketReceived, u, Xt.NONE);
12705
12705
  } finally {
12706
12706
  l();
12707
12707
  }
@@ -13039,7 +13039,7 @@ class zb extends hi.EventEmitter {
13039
13039
  return yield this.createTransceiverRTCRtpSender(e, t, n);
13040
13040
  if (xl())
13041
13041
  return this.log.warn("using add-track fallback", this.logContext), yield this.createRTCRtpSender(e.mediaStreamTrack);
13042
- throw new Ft("Required webRTC APIs not supported on this device");
13042
+ throw new Bt("Required webRTC APIs not supported on this device");
13043
13043
  });
13044
13044
  }
13045
13045
  createSimulcastSender(e, t, n, s) {
@@ -13048,13 +13048,13 @@ class zb extends hi.EventEmitter {
13048
13048
  return this.createSimulcastTransceiverSender(e, t, n, s);
13049
13049
  if (xl())
13050
13050
  return this.log.debug("using add-track fallback", this.logContext), this.createRTCRtpSender(e.mediaStreamTrack);
13051
- throw new Ft("Cannot stream on this device");
13051
+ throw new Bt("Cannot stream on this device");
13052
13052
  });
13053
13053
  }
13054
13054
  createTransceiverRTCRtpSender(e, t, n) {
13055
13055
  return P(this, void 0, void 0, function* () {
13056
13056
  if (!this.pcManager)
13057
- throw new Ft("publisher is closed");
13057
+ throw new Bt("publisher is closed");
13058
13058
  const s = [];
13059
13059
  e.mediaStream && s.push(e.mediaStream), as(e) && (e.codec = t.videoCodec);
13060
13060
  const r = {
@@ -13067,7 +13067,7 @@ class zb extends hi.EventEmitter {
13067
13067
  createSimulcastTransceiverSender(e, t, n, s) {
13068
13068
  return P(this, void 0, void 0, function* () {
13069
13069
  if (!this.pcManager)
13070
- throw new Ft("publisher is closed");
13070
+ throw new Bt("publisher is closed");
13071
13071
  const r = {
13072
13072
  direction: "sendonly"
13073
13073
  };
@@ -13080,7 +13080,7 @@ class zb extends hi.EventEmitter {
13080
13080
  createRTCRtpSender(e) {
13081
13081
  return P(this, void 0, void 0, function* () {
13082
13082
  if (!this.pcManager)
13083
- throw new Ft("publisher is closed");
13083
+ throw new Bt("publisher is closed");
13084
13084
  return this.pcManager.addPublisherTrack(e);
13085
13085
  });
13086
13086
  }
@@ -13100,7 +13100,7 @@ class zb extends hi.EventEmitter {
13100
13100
  } catch (r) {
13101
13101
  this.reconnectAttempts += 1;
13102
13102
  let o = !0;
13103
- r instanceof Ft ? (this.log.debug("received unrecoverable error", Object.assign(Object.assign({}, this.logContext), {
13103
+ r instanceof Bt ? (this.log.debug("received unrecoverable error", Object.assign(Object.assign({}, this.logContext), {
13104
13104
  error: r
13105
13105
  })), o = !1) : r instanceof Ns || (this.fullReconnectOnNext = !0), o ? this.handleDisconnect("reconnect", vs.RR_UNKNOWN) : (this.log.info("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(Date.now() - this.reconnectStart, "ms. giving up"), this.logContext), this.emit(ce.Disconnected), yield this.close());
13106
13106
  } finally {
@@ -13124,7 +13124,7 @@ class zb extends hi.EventEmitter {
13124
13124
  var t, n, s;
13125
13125
  try {
13126
13126
  if (!this.url || !this.token)
13127
- throw new Ft("could not reconnect, url or token not saved");
13127
+ throw new Bt("could not reconnect, url or token not saved");
13128
13128
  this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts), this.logContext), this.emit(ce.Restarting), this.client.isDisconnected || (yield this.client.sendLeave()), yield this.cleanupPeerConnections(), yield this.cleanupClient();
13129
13129
  let r;
13130
13130
  try {
@@ -13132,7 +13132,7 @@ class zb extends hi.EventEmitter {
13132
13132
  throw this.log.warn("attempted connection restart, without signal options present", this.logContext), new Ns();
13133
13133
  r = yield this.join(e ?? this.url, this.token, this.signalOpts, void 0, !this.options.singlePeerConnection);
13134
13134
  } catch (o) {
13135
- throw o instanceof Le && o.reason === yt.NotAllowed ? new Ft("could not reconnect, token might be expired") : new Ns();
13135
+ throw o instanceof Le && o.reason === yt.NotAllowed ? new Bt("could not reconnect, token might be expired") : new Ns();
13136
13136
  }
13137
13137
  if (this.shouldFailNext)
13138
13138
  throw this.shouldFailNext = !1, new Error("simulated failure");
@@ -13153,9 +13153,9 @@ class zb extends hi.EventEmitter {
13153
13153
  return P(this, void 0, void 0, function* () {
13154
13154
  var t;
13155
13155
  if (!this.url || !this.token)
13156
- throw new Ft("could not reconnect, url or token not saved");
13156
+ throw new Bt("could not reconnect, url or token not saved");
13157
13157
  if (!this.pcManager)
13158
- throw new Ft("publisher and subscriber connections unset");
13158
+ throw new Bt("publisher and subscriber connections unset");
13159
13159
  this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts), this.logContext), this.emit(ce.Resuming);
13160
13160
  let n;
13161
13161
  try {
@@ -13164,7 +13164,7 @@ class zb extends hi.EventEmitter {
13164
13164
  let r = "";
13165
13165
  throw s instanceof Error && (r = s.message, this.log.error(s.message, Object.assign(Object.assign({}, this.logContext), {
13166
13166
  error: s
13167
- }))), s instanceof Le && s.reason === yt.NotAllowed ? new Ft("could not reconnect, token might be expired") : s instanceof Le && s.reason === yt.LeaveRequest ? s : new Ns(r);
13167
+ }))), s instanceof Le && s.reason === yt.NotAllowed ? new Bt("could not reconnect, token might be expired") : s instanceof Le && s.reason === yt.LeaveRequest ? s : new Ns(r);
13168
13168
  }
13169
13169
  if (this.emit(ce.SignalResumed), n) {
13170
13170
  const s = this.makeRTCConfiguration(n);
@@ -13181,7 +13181,7 @@ class zb extends hi.EventEmitter {
13181
13181
  waitForPCInitialConnection(e, t) {
13182
13182
  return P(this, void 0, void 0, function* () {
13183
13183
  if (!this.pcManager)
13184
- throw new Ft("PC manager is closed");
13184
+ throw new Bt("PC manager is closed");
13185
13185
  yield this.pcManager.ensurePCTransportConnection(t, e);
13186
13186
  });
13187
13187
  }
@@ -13190,7 +13190,7 @@ class zb extends hi.EventEmitter {
13190
13190
  this.pcState = Un.Reconnecting, this.log.debug("waiting for peer connection to reconnect", this.logContext);
13191
13191
  try {
13192
13192
  if (yield sn(Ob), !this.pcManager)
13193
- throw new Ft("PC manager is closed");
13193
+ throw new Bt("PC manager is closed");
13194
13194
  yield this.pcManager.ensurePCTransportConnection(void 0, this.peerConnectionTimeout), this.pcState = Un.Connected;
13195
13195
  } catch (e) {
13196
13196
  throw this.pcState = Un.Disconnected, Le.internal("could not establish PC connection, ".concat(e.message));
@@ -13289,7 +13289,7 @@ class zb extends hi.EventEmitter {
13289
13289
  if (this.isBufferStatusLow(e))
13290
13290
  t();
13291
13291
  else {
13292
- const s = () => n(new Ft("engine closed"));
13292
+ const s = () => n(new Bt("engine closed"));
13293
13293
  for (this.once(ce.Closing, s); !this.dcBufferStatus.get(e); )
13294
13294
  yield sn(10);
13295
13295
  this.off(ce.Closing, s), t();
@@ -13306,7 +13306,7 @@ class zb extends hi.EventEmitter {
13306
13306
  return (function* () {
13307
13307
  var r;
13308
13308
  if (!n.pcManager)
13309
- throw new Ft("PC manager is closed");
13309
+ throw new Bt("PC manager is closed");
13310
13310
  const o = s ? n.pcManager.subscriber : n.pcManager.publisher, a = s ? "Subscriber" : "Publisher";
13311
13311
  if (!o)
13312
13312
  throw Le.internal("".concat(a, " connection not set"));
@@ -13909,7 +13909,7 @@ class Xb {
13909
13909
  topic: (n = e == null ? void 0 : e.topic) !== null && n !== void 0 ? n : "",
13910
13910
  size: e == null ? void 0 : e.totalSize,
13911
13911
  attributes: e == null ? void 0 : e.attributes,
13912
- encryptionType: !((s = this.engine.e2eeManager) === null || s === void 0) && s.isDataChannelEncryptionEnabled ? jt.GCM : jt.NONE
13912
+ encryptionType: !((s = this.engine.e2eeManager) === null || s === void 0) && s.isDataChannelEncryptionEnabled ? Xt.GCM : Xt.NONE
13913
13913
  }, a = new _o({
13914
13914
  streamId: r,
13915
13915
  mimeType: o.mimeType,
@@ -14023,7 +14023,7 @@ class Xb {
14023
14023
  attributes: e == null ? void 0 : e.attributes,
14024
14024
  size: e == null ? void 0 : e.totalSize,
14025
14025
  name: (r = e == null ? void 0 : e.name) !== null && r !== void 0 ? r : "unknown",
14026
- encryptionType: !((o = this.engine.e2eeManager) === null || o === void 0) && o.isDataChannelEncryptionEnabled ? jt.GCM : jt.NONE
14026
+ encryptionType: !((o = this.engine.e2eeManager) === null || o === void 0) && o.isDataChannelEncryptionEnabled ? Xt.GCM : Xt.NONE
14027
14027
  }, u = new _o({
14028
14028
  totalLength: ys((a = d.size) !== null && a !== void 0 ? a : 0),
14029
14029
  mimeType: d.mimeType,
@@ -14497,7 +14497,7 @@ function Rl(i, e) {
14497
14497
  class Ti extends hi.EventEmitter {
14498
14498
  constructor(e, t, n, s) {
14499
14499
  var r;
14500
- super(), this.metadataMuted = !1, this.encryption = jt.NONE, this.log = We, this.handleMuted = () => {
14500
+ super(), this.metadataMuted = !1, this.encryption = Xt.NONE, this.log = We, this.handleMuted = () => {
14501
14501
  this.emit(re.Muted);
14502
14502
  }, this.handleUnmuted = () => {
14503
14503
  this.emit(re.Unmuted);
@@ -14521,7 +14521,7 @@ class Ti extends hi.EventEmitter {
14521
14521
  return this.track !== void 0;
14522
14522
  }
14523
14523
  get isEncrypted() {
14524
- return this.encryption !== jt.NONE;
14524
+ return this.encryption !== Xt.NONE;
14525
14525
  }
14526
14526
  /**
14527
14527
  * an [AudioTrack] if this publication holds an audio track
@@ -14677,7 +14677,7 @@ function qo(i, e) {
14677
14677
  const m = f ? l.audio : l.video;
14678
14678
  typeof m != "boolean" && (v = m);
14679
14679
  const p = h.getSettings().deviceId;
14680
- v != null && v.deviceId && ts(v.deviceId) !== p ? v.deviceId = p : v || (v = {
14680
+ v != null && v.deviceId && ns(v.deviceId) !== p ? v.deviceId = p : v || (v = {
14681
14681
  deviceId: p
14682
14682
  });
14683
14683
  const T = Cb(h, v, e);
@@ -14709,22 +14709,22 @@ function Zb(i) {
14709
14709
  }))[0];
14710
14710
  });
14711
14711
  }
14712
- var Xi;
14712
+ var $i;
14713
14713
  (function(i) {
14714
14714
  i.Excellent = "excellent", i.Good = "good", i.Poor = "poor", i.Lost = "lost", i.Unknown = "unknown";
14715
- })(Xi || (Xi = {}));
14715
+ })($i || ($i = {}));
14716
14716
  function Qb(i) {
14717
14717
  switch (i) {
14718
14718
  case zr.EXCELLENT:
14719
- return Xi.Excellent;
14719
+ return $i.Excellent;
14720
14720
  case zr.GOOD:
14721
- return Xi.Good;
14721
+ return $i.Good;
14722
14722
  case zr.POOR:
14723
- return Xi.Poor;
14723
+ return $i.Poor;
14724
14724
  case zr.LOST:
14725
- return Xi.Lost;
14725
+ return $i.Lost;
14726
14726
  default:
14727
- return Xi.Unknown;
14727
+ return $i.Unknown;
14728
14728
  }
14729
14729
  }
14730
14730
  class Bm extends hi.EventEmitter {
@@ -14754,7 +14754,7 @@ class Bm extends hi.EventEmitter {
14754
14754
  constructor(e, t, n, s, r, o) {
14755
14755
  let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : ta.STANDARD;
14756
14756
  var c;
14757
- super(), this.audioLevel = 0, this.isSpeaking = !1, this._connectionQuality = Xi.Unknown, this.log = We, this.log = Ii((c = o == null ? void 0 : o.loggerName) !== null && c !== void 0 ? c : Zn.Participant), this.loggerOptions = o, 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 = a, this._attributes = r ?? {};
14757
+ super(), this.audioLevel = 0, this.isSpeaking = !1, this._connectionQuality = $i.Unknown, this.log = We, this.log = Ii((c = o == null ? void 0 : o.loggerName) !== null && c !== void 0 ? c : Zn.Participant), this.loggerOptions = o, 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 = a, this._attributes = r ?? {};
14758
14758
  }
14759
14759
  getTrackPublications() {
14760
14760
  return Array.from(this.trackPublications.values());
@@ -14897,7 +14897,7 @@ class t_ extends Bm {
14897
14897
  super(e, t, void 0, void 0, void 0, {
14898
14898
  loggerName: s.loggerName,
14899
14899
  loggerContextCb: () => this.engine.logContext
14900
- }), this.pendingPublishing = /* @__PURE__ */ new Set(), this.pendingPublishPromises = /* @__PURE__ */ new Map(), this.participantTrackPermissions = [], this.allParticipantsAllowedToSubscribe = !0, this.encryptionType = jt.NONE, this.enabledPublishVideoCodecs = [], this.pendingAcks = /* @__PURE__ */ new Map(), this.pendingResponses = /* @__PURE__ */ new Map(), this.handleReconnecting = () => {
14900
+ }), this.pendingPublishing = /* @__PURE__ */ new Set(), this.pendingPublishPromises = /* @__PURE__ */ new Map(), this.participantTrackPermissions = [], this.allParticipantsAllowedToSubscribe = !0, this.encryptionType = Xt.NONE, this.enabledPublishVideoCodecs = [], this.pendingAcks = /* @__PURE__ */ new Map(), this.pendingResponses = /* @__PURE__ */ new Map(), this.handleReconnecting = () => {
14901
14901
  this.reconnectFuture || (this.reconnectFuture = new zn());
14902
14902
  }, this.handleReconnected = () => {
14903
14903
  var a, c;
@@ -14997,7 +14997,7 @@ class t_ extends Bm {
14997
14997
  this.log.debug("unpublishing local track due to TrackEnded", Object.assign(Object.assign({}, this.logContext), Ye(a))), this.unpublishTrack(a);
14998
14998
  else if (a.isUserProvided)
14999
14999
  yield a.mute();
15000
- else if (_i(a) || Fi(a))
15000
+ else if (_i(a) || Bi(a))
15001
15001
  try {
15002
15002
  if (En())
15003
15003
  try {
@@ -15027,7 +15027,7 @@ class t_ extends Bm {
15027
15027
  return this.microphoneError;
15028
15028
  }
15029
15029
  get isE2EEEnabled() {
15030
- return this.encryptionType !== jt.NONE;
15030
+ return this.encryptionType !== Xt.NONE;
15031
15031
  }
15032
15032
  getTrackPublication(e) {
15033
15033
  const t = super.getTrackPublication(e);
@@ -15158,7 +15158,7 @@ class t_ extends Bm {
15158
15158
  /** @internal */
15159
15159
  setE2EEEnabled(e) {
15160
15160
  return P(this, void 0, void 0, function* () {
15161
- this.encryptionType = e ? jt.GCM : jt.NONE, yield this.republishAllTracks(void 0, !1);
15161
+ this.encryptionType = e ? Xt.GCM : Xt.NONE, yield this.republishAllTracks(void 0, !1);
15162
15162
  });
15163
15163
  }
15164
15164
  setTrackEnabled(e, t, n, s) {
@@ -15457,13 +15457,13 @@ class t_ extends Bm {
15457
15457
  dims: _
15458
15458
  }));
15459
15459
  }
15460
- E.width = _.width, E.height = _.height, Fi(e) && ($n(v) && (e.source === J.Source.ScreenShare && (t.scalabilityMode = "L1T3", "contentHint" in e.mediaStreamTrack && (e.mediaStreamTrack.contentHint = "motion", this.log.info("forcing contentHint to motion for screenshare with SVC codecs", Object.assign(Object.assign({}, this.logContext), Ye(e))))), t.scalabilityMode = (c = t.scalabilityMode) !== null && c !== void 0 ? c : "L3T3_KEY"), E.simulcastCodecs = [new ll({
15460
+ E.width = _.width, E.height = _.height, Bi(e) && ($n(v) && (e.source === J.Source.ScreenShare && (t.scalabilityMode = "L1T3", "contentHint" in e.mediaStreamTrack && (e.mediaStreamTrack.contentHint = "motion", this.log.info("forcing contentHint to motion for screenshare with SVC codecs", Object.assign(Object.assign({}, this.logContext), Ye(e))))), t.scalabilityMode = (c = t.scalabilityMode) !== null && c !== void 0 ? c : "L3T3_KEY"), E.simulcastCodecs = [new ll({
15461
15461
  codec: v,
15462
15462
  cid: e.mediaStreamTrack.id
15463
15463
  })], t.backupCodec === !0 && (t.backupCodec = {
15464
15464
  codec: Ml
15465
15465
  }), t.backupCodec && v !== t.backupCodec.codec && // TODO remove this once e2ee is supported for backup codecs
15466
- E.encryption === jt.NONE && (this.roomOptions.dynacast || (this.roomOptions.dynacast = !0), E.simulcastCodecs.push(new ll({
15466
+ E.encryption === Xt.NONE && (this.roomOptions.dynacast || (this.roomOptions.dynacast = !0), E.simulcastCodecs.push(new ll({
15467
15467
  codec: t.backupCodec.codec,
15468
15468
  cid: ""
15469
15469
  })))), y = Al(e.source === J.Source.ScreenShare, E.width, E.height, t), E.layers = zh(E.width, E.height, y, $n(t.videoCodec));
@@ -15473,12 +15473,12 @@ class t_ extends Bm {
15473
15473
  networkPriority: (f = (h = t.audioPreset) === null || h === void 0 ? void 0 : h.priority) !== null && f !== void 0 ? f : "high"
15474
15474
  }]);
15475
15475
  if (!this.engine || this.engine.isClosed)
15476
- throw new Ft("cannot publish track when not connected");
15476
+ throw new Bt("cannot publish track when not connected");
15477
15477
  const S = () => P(this, void 0, void 0, function* () {
15478
15478
  var _, x, R;
15479
15479
  if (!this.engine.pcManager)
15480
- throw new Ft("pcManager is not ready");
15481
- if (e.sender = yield this.engine.createSender(e, t, y), this.emit(ue.LocalSenderCreated, e.sender, e), Fi(e) && ((_ = t.degradationPreference) !== null && _ !== void 0 || (t.degradationPreference = Lb(e)), e.setDegradationPreference(t.degradationPreference)), y)
15480
+ throw new Bt("pcManager is not ready");
15481
+ if (e.sender = yield this.engine.createSender(e, t, y), this.emit(ue.LocalSenderCreated, e.sender, e), Bi(e) && ((_ = t.degradationPreference) !== null && _ !== void 0 || (t.degradationPreference = Lb(e)), e.setDegradationPreference(t.degradationPreference)), y)
15482
15482
  if (Rs() && e.kind === J.Kind.Audio) {
15483
15483
  let O;
15484
15484
  for (const F of this.engine.pcManager.publisher.getTransceivers())
@@ -15533,7 +15533,7 @@ class t_ extends Bm {
15533
15533
  if (k.on(re.CpuConstrained, (_) => this.onTrackCpuConstrained(_, k)), k.options = t, e.sid = C.sid, this.log.debug("publishing ".concat(e.kind, " with encodings"), Object.assign(Object.assign({}, this.logContext), {
15534
15534
  encodings: y,
15535
15535
  trackInfo: C
15536
- })), Fi(e) ? e.startMonitor(this.engine.client) : _i(e) && e.startMonitor(), this.addTrackPublication(k), this.emit(ue.LocalTrackPublished, k), _i(e) && C.audioFeatures.includes(Zt.TF_PRECONNECT_BUFFER)) {
15536
+ })), Bi(e) ? e.startMonitor(this.engine.client) : _i(e) && e.startMonitor(), this.addTrackPublication(k), this.emit(ue.LocalTrackPublished, k), _i(e) && C.audioFeatures.includes(Zt.TF_PRECONNECT_BUFFER)) {
15537
15537
  const _ = e.getPreConnectBuffer(), x = e.getPreConnectBufferMimeType();
15538
15538
  this.on(ue.LocalTrackSubscribed, (R) => {
15539
15539
  if (R.trackSid === C.sid) {
@@ -15603,14 +15603,14 @@ class t_ extends Bm {
15603
15603
  publishAdditionalCodecForTrack(e, t, n) {
15604
15604
  return P(this, void 0, void 0, function* () {
15605
15605
  var s;
15606
- if (this.encryptionType !== jt.NONE)
15606
+ if (this.encryptionType !== Xt.NONE)
15607
15607
  return;
15608
15608
  let r;
15609
15609
  if (this.trackPublications.forEach((f) => {
15610
15610
  f.track && f.track === e && (r = f);
15611
15611
  }), !r)
15612
15612
  throw new wi("track is not published");
15613
- if (!Fi(e))
15613
+ if (!Bi(e))
15614
15614
  throw new wi("track is not a video track");
15615
15615
  const o = Object.assign(Object.assign({}, (s = this.roomOptions) === null || s === void 0 ? void 0 : s.publishDefaults), n), a = kb(e, t, o);
15616
15616
  if (!a) {
@@ -15632,7 +15632,7 @@ class t_ extends Bm {
15632
15632
  }]
15633
15633
  });
15634
15634
  if (l.layers = zh(l.width, l.height, a), !this.engine || this.engine.isClosed)
15635
- throw new Ft("cannot publish track when not connected");
15635
+ throw new Bt("cannot publish track when not connected");
15636
15636
  const d = () => P(this, void 0, void 0, function* () {
15637
15637
  yield this.engine.createSimulcastSender(e, c, o, a), yield this.engine.negotiate();
15638
15638
  }), h = (yield Promise.all([this.engine.addTrack(l), d()]))[0];
@@ -15661,7 +15661,7 @@ class t_ extends Bm {
15661
15661
  try {
15662
15662
  for (const l of this.engine.pcManager.publisher.getTransceivers())
15663
15663
  l.sender === c && (l.direction = "inactive", a = !0);
15664
- if (this.engine.removeTrack(c) && (a = !0), Fi(e)) {
15664
+ if (this.engine.removeTrack(c) && (a = !0), Bi(e)) {
15665
15665
  for (const [, l] of e.simulcastCodecs)
15666
15666
  l.sender && (this.engine.removeTrack(l.sender) && (a = !0), l.sender = void 0);
15667
15667
  e.simulcastCodecs.clear();
@@ -15699,7 +15699,7 @@ class t_ extends Bm {
15699
15699
  c.track && (t && (c.options = Object.assign(Object.assign({}, c.options), t)), a.push(c));
15700
15700
  }), yield Promise.all(a.map((c) => P(this, void 0, void 0, function* () {
15701
15701
  const l = c.track;
15702
- yield this.unpublishTrack(l, !1), s && !l.isMuted && l.source !== J.Source.ScreenShare && l.source !== J.Source.ScreenShareAudio && (_i(l) || Fi(l)) && !l.isUserProvided && (this.log.debug("restarting existing track", Object.assign(Object.assign({}, this.logContext), {
15702
+ yield this.unpublishTrack(l, !1), s && !l.isMuted && l.source !== J.Source.ScreenShare && l.source !== J.Source.ScreenShareAudio && (_i(l) || Bi(l)) && !l.isUserProvided && (this.log.debug("restarting existing track", Object.assign(Object.assign({}, this.logContext), {
15703
15703
  track: c.trackSid
15704
15704
  })), yield l.restartTrack()), yield this.publishOrRepublishTrack(l, c.options, !0);
15705
15705
  }))), r();
@@ -15995,7 +15995,7 @@ class t_ extends Bm {
15995
15995
  let t;
15996
15996
  return this.trackPublications.forEach((n) => {
15997
15997
  const s = n.track;
15998
- s && (e instanceof MediaStreamTrack ? (_i(s) || Fi(s)) && s.mediaStreamTrack === e && (t = n) : e === s && (t = n));
15998
+ s && (e instanceof MediaStreamTrack ? (_i(s) || Bi(s)) && s.mediaStreamTrack === e && (t = n) : e === s && (t = n));
15999
15999
  }), t;
16000
16000
  }
16001
16001
  waitForPendingPublicationOfSource(e) {
@@ -16694,7 +16694,7 @@ class mr extends hi.EventEmitter {
16694
16694
  this.emit(te.ParticipantPermissionsChanged, a, this.localParticipant);
16695
16695
  }, this.onLocalChatMessageSent = (a) => {
16696
16696
  this.emit(te.ChatMessage, a, this.localParticipant);
16697
- }, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, pb), e), this.log = Ii((n = this.options.loggerName) !== null && n !== void 0 ? n : Zn.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Rm), e == null ? void 0 : e.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, Pm), e == null ? void 0 : e.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, fb), e == null ? void 0 : e.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Wb(), this.outgoingDataStreamManager = new Xb(this.engine, this.log), this.disconnectLock = new mn(), this.localParticipant = new t_("", "", 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", ts(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", ts(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", ts(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), En()) {
16697
+ }, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, pb), e), this.log = Ii((n = this.options.loggerName) !== null && n !== void 0 ? n : Zn.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Rm), e == null ? void 0 : e.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, Pm), e == null ? void 0 : e.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, fb), e == null ? void 0 : e.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Wb(), this.outgoingDataStreamManager = new Xb(this.engine, this.log), this.disconnectLock = new mn(), this.localParticipant = new t_("", "", 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", ns(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", ns(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", ns(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), En()) {
16698
16698
  const a = new AbortController();
16699
16699
  (o = (r = navigator.mediaDevices) === null || r === void 0 ? void 0 : r.addEventListener) === null || o === void 0 || o.call(r, "devicechange", this.handleDeviceChange, {
16700
16700
  signal: a.signal
@@ -16768,9 +16768,9 @@ class mr extends hi.EventEmitter {
16768
16768
  setupE2EE() {
16769
16769
  var e;
16770
16770
  const t = !!this.options.encryption, n = this.options.encryption || this.options.e2ee;
16771
- n && ("e2eeManager" in n ? (this.e2eeManager = n.e2eeManager, this.e2eeManager.isDataChannelEncryptionEnabled = t) : this.e2eeManager = new Yy(n, t), this.e2eeManager.on(Yi.ParticipantEncryptionStatusChanged, (s, r) => {
16771
+ n && ("e2eeManager" in n ? (this.e2eeManager = n.e2eeManager, this.e2eeManager.isDataChannelEncryptionEnabled = t) : this.e2eeManager = new Yy(n, t), this.e2eeManager.on(Ji.ParticipantEncryptionStatusChanged, (s, r) => {
16772
16772
  Uy(r) && (this.isE2EEEnabled = s), this.emit(te.ParticipantEncryptionStatusChanged, s, r);
16773
- }), this.e2eeManager.on(Yi.EncryptionError, (s, r) => {
16773
+ }), this.e2eeManager.on(Ji.EncryptionError, (s, r) => {
16774
16774
  const o = r ? this.getParticipantByIdentity(r) : void 0;
16775
16775
  this.emit(te.EncryptionError, s, o);
16776
16776
  }), (e = this.e2eeManager) === null || e === void 0 || e.setup(this));
@@ -16801,7 +16801,7 @@ class mr extends hi.EventEmitter {
16801
16801
  s.sid !== "" && (this.engine.off(ce.RoomUpdate, n), e(s.sid));
16802
16802
  };
16803
16803
  this.engine.on(ce.RoomUpdate, n), this.once(te.Disconnected, () => {
16804
- this.engine.off(ce.RoomUpdate, n), t(new Ft("Room disconnected before room server id was available"));
16804
+ this.engine.off(ce.RoomUpdate, n), t(new Bt("Room disconnected before room server id was available"));
16805
16805
  });
16806
16806
  });
16807
16807
  }
@@ -18284,7 +18284,31 @@ class jo extends EventTarget {
18284
18284
  detail: { canPlayback: e.canPlaybackAudio }
18285
18285
  })
18286
18286
  );
18287
- });
18287
+ }), e.on(
18288
+ te.DataReceived,
18289
+ (t, n, s) => {
18290
+ if (!(!n || !(n.identity.includes("agent") || n.identity.includes("voice-assistant") || n.identity.includes("AJ_"))))
18291
+ try {
18292
+ const o = new TextDecoder(), a = JSON.parse(o.decode(t));
18293
+ this.dispatchEvent(
18294
+ new CustomEvent("agent-command", {
18295
+ detail: a
18296
+ })
18297
+ );
18298
+ } catch (o) {
18299
+ console.warn("Failed to parse agent data message:", o);
18300
+ }
18301
+ }
18302
+ ), e.on(
18303
+ te.TrackSubscribed,
18304
+ (t, n, s) => {
18305
+ t.kind === "audio" && (s.identity.includes("agent") || s.identity.includes("voice-assistant") || s.identity.includes("AJ_")) && this.dispatchEvent(
18306
+ new CustomEvent("agent-speaking", {
18307
+ detail: { isSpeaking: !0 }
18308
+ })
18309
+ );
18310
+ }
18311
+ );
18288
18312
  }
18289
18313
  async toggleMicrophone() {
18290
18314
  if (this.room)
@@ -18339,7 +18363,7 @@ class jo extends EventTarget {
18339
18363
  * Copyright 2010-2025 Three.js Authors
18340
18364
  * SPDX-License-Identifier: MIT
18341
18365
  */
18342
- const nu = "182", R_ = 0, qh = 1, P_ = 2, ao = 1, k_ = 2, Gr = 3, Di = 0, ln = 1, Ai = 2, Pi = 0, cr = 1, $i = 2, jh = 3, Xh = 4, I_ = 5, Ss = 100, D_ = 101, L_ = 102, N_ = 103, O_ = 104, U_ = 200, F_ = 201, B_ = 202, z_ = 203, kl = 204, Il = 205, V_ = 206, G_ = 207, H_ = 208, W_ = 209, q_ = 210, j_ = 211, X_ = 212, $_ = 213, K_ = 214, Dl = 0, Ll = 1, Nl = 2, gr = 3, Ol = 4, Ul = 5, Fl = 6, Bl = 7, Vm = 0, Y_ = 1, J_ = 2, oi = 0, Gm = 1, Hm = 2, Wm = 3, qm = 4, jm = 5, Xm = 6, $m = 7, Km = 300, ks = 301, vr = 302, zl = 303, Vl = 304, Xo = 306, Gl = 1e3, Ri = 1001, Hl = 1002, rn = 1003, Z_ = 1004, Sa = 1005, cn = 1006, Ec = 1007, Cs = 1008, Dn = 1009, Ym = 1010, Jm = 1011, aa = 1012, iu = 1013, ui = 1014, si = 1015, Li = 1016, su = 1017, ru = 1018, oa = 1020, Zm = 35902, Qm = 35899, eg = 1021, tg = 1022, Jn = 1023, Ni = 1026, Es = 1027, ng = 1028, au = 1029, yr = 1030, ou = 1031, cu = 1033, oo = 33776, co = 33777, lo = 33778, uo = 33779, Wl = 35840, ql = 35841, jl = 35842, Xl = 35843, $l = 36196, Kl = 37492, Yl = 37496, Jl = 37488, Zl = 37489, Ql = 37490, ed = 37491, td = 37808, nd = 37809, id = 37810, sd = 37811, rd = 37812, ad = 37813, od = 37814, cd = 37815, ld = 37816, dd = 37817, ud = 37818, hd = 37819, fd = 37820, pd = 37821, md = 36492, gd = 36494, vd = 36495, yd = 36283, bd = 36284, _d = 36285, Sd = 36286, Q_ = 3200, eS = 0, tS = 1, Ki = "", Bn = "srgb", br = "srgb-linear", wo = "linear", ut = "srgb", Os = 7680, $h = 519, nS = 512, iS = 513, sS = 514, lu = 515, rS = 516, aS = 517, du = 518, oS = 519, Kh = 35044, Yh = "300 es", ri = 2e3, Ao = 2001;
18366
+ const nu = "182", R_ = 0, qh = 1, P_ = 2, ao = 1, k_ = 2, Gr = 3, Di = 0, ln = 1, Ai = 2, Pi = 0, cr = 1, Ki = 2, jh = 3, Xh = 4, I_ = 5, Ss = 100, D_ = 101, L_ = 102, N_ = 103, O_ = 104, U_ = 200, F_ = 201, B_ = 202, z_ = 203, kl = 204, Il = 205, V_ = 206, G_ = 207, H_ = 208, W_ = 209, q_ = 210, j_ = 211, X_ = 212, $_ = 213, K_ = 214, Dl = 0, Ll = 1, Nl = 2, gr = 3, Ol = 4, Ul = 5, Fl = 6, Bl = 7, Vm = 0, Y_ = 1, J_ = 2, oi = 0, Gm = 1, Hm = 2, Wm = 3, qm = 4, jm = 5, Xm = 6, $m = 7, Km = 300, ks = 301, vr = 302, zl = 303, Vl = 304, Xo = 306, Gl = 1e3, Ri = 1001, Hl = 1002, rn = 1003, Z_ = 1004, Sa = 1005, cn = 1006, Ec = 1007, Cs = 1008, Dn = 1009, Ym = 1010, Jm = 1011, aa = 1012, iu = 1013, ui = 1014, si = 1015, Li = 1016, su = 1017, ru = 1018, oa = 1020, Zm = 35902, Qm = 35899, eg = 1021, tg = 1022, Jn = 1023, Ni = 1026, Es = 1027, ng = 1028, au = 1029, yr = 1030, ou = 1031, cu = 1033, oo = 33776, co = 33777, lo = 33778, uo = 33779, Wl = 35840, ql = 35841, jl = 35842, Xl = 35843, $l = 36196, Kl = 37492, Yl = 37496, Jl = 37488, Zl = 37489, Ql = 37490, ed = 37491, td = 37808, nd = 37809, id = 37810, sd = 37811, rd = 37812, ad = 37813, od = 37814, cd = 37815, ld = 37816, dd = 37817, ud = 37818, hd = 37819, fd = 37820, pd = 37821, md = 36492, gd = 36494, vd = 36495, yd = 36283, bd = 36284, _d = 36285, Sd = 36286, Q_ = 3200, eS = 0, tS = 1, Yi = "", Bn = "srgb", br = "srgb-linear", wo = "linear", ut = "srgb", Os = 7680, $h = 519, nS = 512, iS = 513, sS = 514, lu = 515, rS = 516, aS = 517, du = 518, oS = 519, Kh = 35044, Yh = "300 es", ri = 2e3, Ao = 2001;
18343
18367
  function ig(i) {
18344
18368
  for (let e = i.length - 1; e >= 0; --e)
18345
18369
  if (i[e] >= 65535) return !0;
@@ -20668,7 +20692,7 @@ function uS() {
20668
20692
  return this.spaces[s].primaries;
20669
20693
  },
20670
20694
  getTransfer: function(s) {
20671
- return s === Ki ? wo : this.spaces[s].transfer;
20695
+ return s === Yi ? wo : this.spaces[s].transfer;
20672
20696
  },
20673
20697
  getToneMappingMode: function(s) {
20674
20698
  return this.spaces[s].outputColorSpaceConfig.toneMappingMode || "standard";
@@ -20862,7 +20886,7 @@ class gn extends Sr {
20862
20886
  * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
20863
20887
  * @param {string} [colorSpace=NoColorSpace] - The color space.
20864
20888
  */
20865
- constructor(e = gn.DEFAULT_IMAGE, t = gn.DEFAULT_MAPPING, n = Ri, s = Ri, r = cn, o = Cs, a = Jn, c = Dn, l = gn.DEFAULT_ANISOTROPY, d = Ki) {
20889
+ constructor(e = gn.DEFAULT_IMAGE, t = gn.DEFAULT_MAPPING, n = Ri, s = Ri, r = cn, o = Cs, a = Jn, c = Dn, l = gn.DEFAULT_ANISOTROPY, d = Yi) {
20866
20890
  super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: pS++ }), this.uuid = ha(), this.name = "", this.source = new uu(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = s, this.magFilter = r, this.minFilter = o, this.anisotropy = l, this.format = a, this.internalFormat = null, this.type = c, this.offset = new nt(0, 0), this.repeat = new nt(1, 1), this.center = new nt(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new He(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = d, this.userData = {}, this.updateRanges = [], this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isArrayTexture = !!(e && e.depth && e.depth > 1), this.pmremVersion = 0;
20867
20891
  }
20868
20892
  /**
@@ -22072,37 +22096,37 @@ class pa {
22072
22096
  intersectsTriangle(e) {
22073
22097
  if (this.isEmpty())
22074
22098
  return !1;
22075
- this.getCenter(Dr), Ta.subVectors(this.max, Dr), Fs.subVectors(e.a, Dr), Bs.subVectors(e.b, Dr), zs.subVectors(e.c, Dr), Bi.subVectors(Bs, Fs), zi.subVectors(zs, Bs), us.subVectors(Fs, zs);
22099
+ this.getCenter(Dr), Ta.subVectors(this.max, Dr), Fs.subVectors(e.a, Dr), Bs.subVectors(e.b, Dr), zs.subVectors(e.c, Dr), zi.subVectors(Bs, Fs), Vi.subVectors(zs, Bs), us.subVectors(Fs, zs);
22076
22100
  let t = [
22077
- 0,
22078
- -Bi.z,
22079
- Bi.y,
22080
22101
  0,
22081
22102
  -zi.z,
22082
22103
  zi.y,
22083
22104
  0,
22105
+ -Vi.z,
22106
+ Vi.y,
22107
+ 0,
22084
22108
  -us.z,
22085
22109
  us.y,
22086
- Bi.z,
22087
- 0,
22088
- -Bi.x,
22089
22110
  zi.z,
22090
22111
  0,
22091
22112
  -zi.x,
22113
+ Vi.z,
22114
+ 0,
22115
+ -Vi.x,
22092
22116
  us.z,
22093
22117
  0,
22094
22118
  -us.x,
22095
- -Bi.y,
22096
- Bi.x,
22097
- 0,
22098
22119
  -zi.y,
22099
22120
  zi.x,
22100
22121
  0,
22122
+ -Vi.y,
22123
+ Vi.x,
22124
+ 0,
22101
22125
  -us.y,
22102
22126
  us.x,
22103
22127
  0
22104
22128
  ];
22105
- return !Ic(t, Fs, Bs, zs, Ta) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Ic(t, Fs, Bs, zs, Ta)) ? !1 : (Ca.crossVectors(Bi, zi), t = [Ca.x, Ca.y, Ca.z], Ic(t, Fs, Bs, zs, Ta));
22129
+ return !Ic(t, Fs, Bs, zs, Ta) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Ic(t, Fs, Bs, zs, Ta)) ? !1 : (Ca.crossVectors(zi, Vi), t = [Ca.x, Ca.y, Ca.z], Ic(t, Fs, Bs, zs, Ta));
22106
22130
  }
22107
22131
  /**
22108
22132
  * Clamps the given point within the bounds of this box.
@@ -22214,7 +22238,7 @@ const mi = [
22214
22238
  /* @__PURE__ */ new U(),
22215
22239
  /* @__PURE__ */ new U(),
22216
22240
  /* @__PURE__ */ new U()
22217
- ], Gn = /* @__PURE__ */ new U(), xa = /* @__PURE__ */ new pa(), Fs = /* @__PURE__ */ new U(), Bs = /* @__PURE__ */ new U(), zs = /* @__PURE__ */ new U(), Bi = /* @__PURE__ */ new U(), zi = /* @__PURE__ */ new U(), us = /* @__PURE__ */ new U(), Dr = /* @__PURE__ */ new U(), Ta = /* @__PURE__ */ new U(), Ca = /* @__PURE__ */ new U(), hs = /* @__PURE__ */ new U();
22241
+ ], Gn = /* @__PURE__ */ new U(), xa = /* @__PURE__ */ new pa(), Fs = /* @__PURE__ */ new U(), Bs = /* @__PURE__ */ new U(), zs = /* @__PURE__ */ new U(), zi = /* @__PURE__ */ new U(), Vi = /* @__PURE__ */ new U(), us = /* @__PURE__ */ new U(), Dr = /* @__PURE__ */ new U(), Ta = /* @__PURE__ */ new U(), Ca = /* @__PURE__ */ new U(), hs = /* @__PURE__ */ new U();
22218
22242
  function Ic(i, e, t, n, s) {
22219
22243
  for (let r = 0, o = i.length - 3; r <= o; r += 3) {
22220
22244
  hs.fromArray(i, r);
@@ -22444,7 +22468,7 @@ class ma {
22444
22468
  return this.radius = e.radius, this.center.fromArray(e.center), this;
22445
22469
  }
22446
22470
  }
22447
- const gi = /* @__PURE__ */ new U(), Lc = /* @__PURE__ */ new U(), Ea = /* @__PURE__ */ new U(), Vi = /* @__PURE__ */ new U(), Nc = /* @__PURE__ */ new U(), Ma = /* @__PURE__ */ new U(), Oc = /* @__PURE__ */ new U();
22471
+ const gi = /* @__PURE__ */ new U(), Lc = /* @__PURE__ */ new U(), Ea = /* @__PURE__ */ new U(), Gi = /* @__PURE__ */ new U(), Nc = /* @__PURE__ */ new U(), Ma = /* @__PURE__ */ new U(), Oc = /* @__PURE__ */ new U();
22448
22472
  class hu {
22449
22473
  /**
22450
22474
  * Constructs a new ray.
@@ -22543,8 +22567,8 @@ class hu {
22543
22567
  * @return {number} The squared distance.
22544
22568
  */
22545
22569
  distanceSqToSegment(e, t, n, s) {
22546
- Lc.copy(e).add(t).multiplyScalar(0.5), Ea.copy(t).sub(e).normalize(), Vi.copy(this.origin).sub(Lc);
22547
- const r = e.distanceTo(t) * 0.5, o = -this.direction.dot(Ea), a = Vi.dot(this.direction), c = -Vi.dot(Ea), l = Vi.lengthSq(), d = Math.abs(1 - o * o);
22570
+ Lc.copy(e).add(t).multiplyScalar(0.5), Ea.copy(t).sub(e).normalize(), Gi.copy(this.origin).sub(Lc);
22571
+ const r = e.distanceTo(t) * 0.5, o = -this.direction.dot(Ea), a = Gi.dot(this.direction), c = -Gi.dot(Ea), l = Gi.lengthSq(), d = Math.abs(1 - o * o);
22548
22572
  let u, h, f, g;
22549
22573
  if (d > 0)
22550
22574
  if (u = o * c - a, h = o * a - c, g = r * d, u >= 0)
@@ -22665,14 +22689,14 @@ class hu {
22665
22689
  a = -1, o = -o;
22666
22690
  else
22667
22691
  return null;
22668
- Vi.subVectors(this.origin, e);
22669
- const c = a * this.direction.dot(Ma.crossVectors(Vi, Ma));
22692
+ Gi.subVectors(this.origin, e);
22693
+ const c = a * this.direction.dot(Ma.crossVectors(Gi, Ma));
22670
22694
  if (c < 0)
22671
22695
  return null;
22672
- const l = a * this.direction.dot(Nc.cross(Vi));
22696
+ const l = a * this.direction.dot(Nc.cross(Gi));
22673
22697
  if (l < 0 || c + l > o)
22674
22698
  return null;
22675
- const d = -a * Vi.dot(Oc);
22699
+ const d = -a * Gi.dot(Oc);
22676
22700
  return d < 0 ? null : this.at(d / o, r);
22677
22701
  }
22678
22702
  /**
@@ -22961,7 +22985,7 @@ class Pt {
22961
22985
  */
22962
22986
  lookAt(e, t, n) {
22963
22987
  const s = this.elements;
22964
- return kn.subVectors(e, t), kn.lengthSq() === 0 && (kn.z = 1), kn.normalize(), Gi.crossVectors(n, kn), Gi.lengthSq() === 0 && (Math.abs(n.z) === 1 ? kn.x += 1e-4 : kn.z += 1e-4, kn.normalize(), Gi.crossVectors(n, kn)), Gi.normalize(), wa.crossVectors(kn, Gi), s[0] = Gi.x, s[4] = wa.x, s[8] = kn.x, s[1] = Gi.y, s[5] = wa.y, s[9] = kn.y, s[2] = Gi.z, s[6] = wa.z, s[10] = kn.z, this;
22988
+ return kn.subVectors(e, t), kn.lengthSq() === 0 && (kn.z = 1), kn.normalize(), Hi.crossVectors(n, kn), Hi.lengthSq() === 0 && (Math.abs(n.z) === 1 ? kn.x += 1e-4 : kn.z += 1e-4, kn.normalize(), Hi.crossVectors(n, kn)), Hi.normalize(), wa.crossVectors(kn, Hi), s[0] = Hi.x, s[4] = wa.x, s[8] = kn.x, s[1] = Hi.y, s[5] = wa.y, s[9] = kn.y, s[2] = Hi.z, s[6] = wa.z, s[10] = kn.z, this;
22965
22989
  }
22966
22990
  /**
22967
22991
  * Post-multiplies this matrix by the given 4x4 matrix.
@@ -23416,7 +23440,7 @@ class Pt {
23416
23440
  return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e;
23417
23441
  }
23418
23442
  }
23419
- const Vs = /* @__PURE__ */ new U(), Hn = /* @__PURE__ */ new Pt(), yS = /* @__PURE__ */ new U(0, 0, 0), bS = /* @__PURE__ */ new U(1, 1, 1), Gi = /* @__PURE__ */ new U(), wa = /* @__PURE__ */ new U(), kn = /* @__PURE__ */ new U(), nf = /* @__PURE__ */ new Pt(), sf = /* @__PURE__ */ new fa();
23443
+ const Vs = /* @__PURE__ */ new U(), Hn = /* @__PURE__ */ new Pt(), yS = /* @__PURE__ */ new U(0, 0, 0), bS = /* @__PURE__ */ new U(1, 1, 1), Hi = /* @__PURE__ */ new U(), wa = /* @__PURE__ */ new U(), kn = /* @__PURE__ */ new U(), nf = /* @__PURE__ */ new Pt(), sf = /* @__PURE__ */ new fa();
23420
23444
  class Oi {
23421
23445
  /**
23422
23446
  * Constructs a new euler instance.
@@ -24782,7 +24806,7 @@ const ag = {
24782
24806
  whitesmoke: 16119285,
24783
24807
  yellow: 16776960,
24784
24808
  yellowgreen: 10145074
24785
- }, Hi = { h: 0, s: 0, l: 0 }, Ra = { h: 0, s: 0, l: 0 };
24809
+ }, Wi = { h: 0, s: 0, l: 0 }, Ra = { h: 0, s: 0, l: 0 };
24786
24810
  function qc(i, e, t) {
24787
24811
  return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? i + (e - i) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? i + (e - i) * 6 * (2 / 3 - t) : i;
24788
24812
  }
@@ -25084,7 +25108,7 @@ class Ue {
25084
25108
  * @return {Color} A reference to this color.
25085
25109
  */
25086
25110
  offsetHSL(e, t, n) {
25087
- return this.getHSL(Hi), this.setHSL(Hi.h + e, Hi.s + t, Hi.l + n);
25111
+ return this.getHSL(Wi), this.setHSL(Wi.h + e, Wi.s + t, Wi.l + n);
25088
25112
  }
25089
25113
  /**
25090
25114
  * Adds the RGB values of the given color to the RGB values of this color.
@@ -25178,8 +25202,8 @@ class Ue {
25178
25202
  * @return {Color} A reference to this color.
25179
25203
  */
25180
25204
  lerpHSL(e, t) {
25181
- this.getHSL(Hi), e.getHSL(Ra);
25182
- const n = wc(Hi.h, Ra.h, t), s = wc(Hi.s, Ra.s, t), r = wc(Hi.l, Ra.l, t);
25205
+ this.getHSL(Wi), e.getHSL(Ra);
25206
+ const n = wc(Wi.h, Ra.h, t), s = wc(Wi.s, Ra.s, t), r = wc(Wi.l, Ra.l, t);
25183
25207
  return this.setHSL(n, s, r), this;
25184
25208
  }
25185
25209
  /**
@@ -26657,7 +26681,7 @@ class ug extends en {
26657
26681
  return new this.constructor().copy(this);
26658
26682
  }
26659
26683
  }
26660
- const Wi = /* @__PURE__ */ new U(), pf = /* @__PURE__ */ new nt(), mf = /* @__PURE__ */ new nt();
26684
+ const qi = /* @__PURE__ */ new U(), pf = /* @__PURE__ */ new nt(), mf = /* @__PURE__ */ new nt();
26661
26685
  class Tn extends ug {
26662
26686
  /**
26663
26687
  * Constructs a new perspective camera.
@@ -26732,7 +26756,7 @@ class Tn extends ug {
26732
26756
  * @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector.
26733
26757
  */
26734
26758
  getViewBounds(e, t, n) {
26735
- Wi.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(Wi.x, Wi.y).multiplyScalar(-e / Wi.z), Wi.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), n.set(Wi.x, Wi.y).multiplyScalar(-e / Wi.z);
26759
+ qi.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse), t.set(qi.x, qi.y).multiplyScalar(-e / qi.z), qi.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse), n.set(qi.x, qi.y).multiplyScalar(-e / qi.z);
26736
26760
  }
26737
26761
  /**
26738
26762
  * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
@@ -33367,7 +33391,7 @@ function FC(i) {
33367
33391
  dispose: r
33368
33392
  };
33369
33393
  }
33370
- const Ji = 4, Tf = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], xs = 20, BC = 256, Fr = /* @__PURE__ */ new vu(), Cf = /* @__PURE__ */ new Ue();
33394
+ const Zi = 4, Tf = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], xs = 20, BC = 256, Fr = /* @__PURE__ */ new vu(), Cf = /* @__PURE__ */ new Ue();
33371
33395
  let Qc = null, el = 0, tl = 0, nl = !1;
33372
33396
  const zC = /* @__PURE__ */ new U();
33373
33397
  class Ef {
@@ -33542,7 +33566,7 @@ class Ef {
33542
33566
  _applyGGXFilter(e, t, n) {
33543
33567
  const s = this._renderer, r = this._pingPongRenderTarget, o = this._ggxMaterial, a = this._lodMeshes[n];
33544
33568
  a.material = o;
33545
- const c = o.uniforms, l = n / (this._lodMeshes.length - 1), d = t / (this._lodMeshes.length - 1), u = Math.sqrt(l * l - d * d), h = 0 + l * 1.25, f = u * h, { _lodMax: g } = this, v = this._sizeLods[n], m = 3 * v * (n > g - Ji ? n - g + Ji : 0), p = 4 * (this._cubeSize - v);
33569
+ const c = o.uniforms, l = n / (this._lodMeshes.length - 1), d = t / (this._lodMeshes.length - 1), u = Math.sqrt(l * l - d * d), h = 0 + l * 1.25, f = u * h, { _lodMax: g } = this, v = this._sizeLods[n], m = 3 * v * (n > g - Zi ? n - g + Zi : 0), p = 4 * (this._cubeSize - v);
33546
33570
  c.envMap.value = e.texture, c.roughness.value = f, c.mipInt.value = g - t, Ks(r, m, p, 3 * v, 2 * v), s.setRenderTarget(r), s.render(a, Fr), c.envMap.value = r.texture, c.roughness.value = 0, c.mipInt.value = g - n, Ks(e, m, p, 3 * v, 2 * v), s.setRenderTarget(e), s.render(a, Fr);
33547
33571
  }
33548
33572
  /**
@@ -33601,19 +33625,19 @@ class Ef {
33601
33625
  h.envMap.value = e.texture, h.samples.value = m, h.weights.value = p, h.latitudinal.value = o === "latitudinal", a && (h.poleAxis.value = a);
33602
33626
  const { _lodMax: E } = this;
33603
33627
  h.dTheta.value = g, h.mipInt.value = E - n;
33604
- const y = this._sizeLods[s], S = 3 * y * (s > E - Ji ? s - E + Ji : 0), C = 4 * (this._cubeSize - y);
33628
+ const y = this._sizeLods[s], S = 3 * y * (s > E - Zi ? s - E + Zi : 0), C = 4 * (this._cubeSize - y);
33605
33629
  Ks(t, S, C, 3 * y, 2 * y), c.setRenderTarget(t), c.render(u, Fr);
33606
33630
  }
33607
33631
  }
33608
33632
  function VC(i) {
33609
33633
  const e = [], t = [], n = [];
33610
33634
  let s = i;
33611
- const r = i - Ji + 1 + Tf.length;
33635
+ const r = i - Zi + 1 + Tf.length;
33612
33636
  for (let o = 0; o < r; o++) {
33613
33637
  const a = Math.pow(2, s);
33614
33638
  e.push(a);
33615
33639
  let c = 1 / a;
33616
- o > i - Ji ? c = Tf[o - i + Ji - 1] : o === 0 && (c = 0), t.push(c);
33640
+ o > i - Zi ? c = Tf[o - i + Zi - 1] : o === 0 && (c = 0), t.push(c);
33617
33641
  const l = 1 / (a - 2), d = -l, u = 1 + l, h = [d, d, u, d, u, u, d, d, u, u, d, u], f = 6, g = 6, v = 3, m = 2, p = 1, T = new Float32Array(v * g * f), E = new Float32Array(m * g * f), y = new Float32Array(p * g * f);
33618
33642
  for (let C = 0; C < f; C++) {
33619
33643
  const w = C % 3 * 2 / 3 - 1, k = C > 2 ? 0 : -1, _ = [
@@ -33641,7 +33665,7 @@ function VC(i) {
33641
33665
  y.set(x, p * g * C);
33642
33666
  }
33643
33667
  const S = new vn();
33644
- S.setAttribute("position", new Mn(T, v)), S.setAttribute("uv", new Mn(E, m)), S.setAttribute("faceIndex", new Mn(y, p)), n.push(new An(S, null)), s > Ji && s--;
33668
+ S.setAttribute("position", new Mn(T, v)), S.setAttribute("uv", new Mn(E, m)), S.setAttribute("faceIndex", new Mn(y, p)), n.push(new An(S, null)), s > Zi && s--;
33645
33669
  }
33646
33670
  return { lodMeshes: n, sizeLods: e, sigmas: t };
33647
33671
  }
@@ -34413,13 +34437,13 @@ function Tr(i, e, t) {
34413
34437
  }
34414
34438
  return r;
34415
34439
  }
34416
- function Xt(i, e) {
34440
+ function $t(i, e) {
34417
34441
  if (i.length !== e.length) return !1;
34418
34442
  for (let t = 0, n = i.length; t < n; t++)
34419
34443
  if (i[t] !== e[t]) return !1;
34420
34444
  return !0;
34421
34445
  }
34422
- function $t(i, e) {
34446
+ function Kt(i, e) {
34423
34447
  for (let t = 0, n = e.length; t < n; t++)
34424
34448
  i[t] = e[t];
34425
34449
  }
@@ -34439,8 +34463,8 @@ function eE(i, e) {
34439
34463
  if (e.x !== void 0)
34440
34464
  (t[0] !== e.x || t[1] !== e.y) && (i.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
34441
34465
  else {
34442
- if (Xt(t, e)) return;
34443
- i.uniform2fv(this.addr, e), $t(t, e);
34466
+ if ($t(t, e)) return;
34467
+ i.uniform2fv(this.addr, e), Kt(t, e);
34444
34468
  }
34445
34469
  }
34446
34470
  function tE(i, e) {
@@ -34450,8 +34474,8 @@ function tE(i, e) {
34450
34474
  else if (e.r !== void 0)
34451
34475
  (t[0] !== e.r || t[1] !== e.g || t[2] !== e.b) && (i.uniform3f(this.addr, e.r, e.g, e.b), t[0] = e.r, t[1] = e.g, t[2] = e.b);
34452
34476
  else {
34453
- if (Xt(t, e)) return;
34454
- i.uniform3fv(this.addr, e), $t(t, e);
34477
+ if ($t(t, e)) return;
34478
+ i.uniform3fv(this.addr, e), Kt(t, e);
34455
34479
  }
34456
34480
  }
34457
34481
  function nE(i, e) {
@@ -34459,38 +34483,38 @@ function nE(i, e) {
34459
34483
  if (e.x !== void 0)
34460
34484
  (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (i.uniform4f(this.addr, e.x, e.y, e.z, e.w), t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w);
34461
34485
  else {
34462
- if (Xt(t, e)) return;
34463
- i.uniform4fv(this.addr, e), $t(t, e);
34486
+ if ($t(t, e)) return;
34487
+ i.uniform4fv(this.addr, e), Kt(t, e);
34464
34488
  }
34465
34489
  }
34466
34490
  function iE(i, e) {
34467
34491
  const t = this.cache, n = e.elements;
34468
34492
  if (n === void 0) {
34469
- if (Xt(t, e)) return;
34470
- i.uniformMatrix2fv(this.addr, !1, e), $t(t, e);
34493
+ if ($t(t, e)) return;
34494
+ i.uniformMatrix2fv(this.addr, !1, e), Kt(t, e);
34471
34495
  } else {
34472
- if (Xt(t, n)) return;
34473
- Df.set(n), i.uniformMatrix2fv(this.addr, !1, Df), $t(t, n);
34496
+ if ($t(t, n)) return;
34497
+ Df.set(n), i.uniformMatrix2fv(this.addr, !1, Df), Kt(t, n);
34474
34498
  }
34475
34499
  }
34476
34500
  function sE(i, e) {
34477
34501
  const t = this.cache, n = e.elements;
34478
34502
  if (n === void 0) {
34479
- if (Xt(t, e)) return;
34480
- i.uniformMatrix3fv(this.addr, !1, e), $t(t, e);
34503
+ if ($t(t, e)) return;
34504
+ i.uniformMatrix3fv(this.addr, !1, e), Kt(t, e);
34481
34505
  } else {
34482
- if (Xt(t, n)) return;
34483
- If.set(n), i.uniformMatrix3fv(this.addr, !1, If), $t(t, n);
34506
+ if ($t(t, n)) return;
34507
+ If.set(n), i.uniformMatrix3fv(this.addr, !1, If), Kt(t, n);
34484
34508
  }
34485
34509
  }
34486
34510
  function rE(i, e) {
34487
34511
  const t = this.cache, n = e.elements;
34488
34512
  if (n === void 0) {
34489
- if (Xt(t, e)) return;
34490
- i.uniformMatrix4fv(this.addr, !1, e), $t(t, e);
34513
+ if ($t(t, e)) return;
34514
+ i.uniformMatrix4fv(this.addr, !1, e), Kt(t, e);
34491
34515
  } else {
34492
- if (Xt(t, n)) return;
34493
- kf.set(n), i.uniformMatrix4fv(this.addr, !1, kf), $t(t, n);
34516
+ if ($t(t, n)) return;
34517
+ kf.set(n), i.uniformMatrix4fv(this.addr, !1, kf), Kt(t, n);
34494
34518
  }
34495
34519
  }
34496
34520
  function aE(i, e) {
@@ -34502,8 +34526,8 @@ function oE(i, e) {
34502
34526
  if (e.x !== void 0)
34503
34527
  (t[0] !== e.x || t[1] !== e.y) && (i.uniform2i(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
34504
34528
  else {
34505
- if (Xt(t, e)) return;
34506
- i.uniform2iv(this.addr, e), $t(t, e);
34529
+ if ($t(t, e)) return;
34530
+ i.uniform2iv(this.addr, e), Kt(t, e);
34507
34531
  }
34508
34532
  }
34509
34533
  function cE(i, e) {
@@ -34511,8 +34535,8 @@ function cE(i, e) {
34511
34535
  if (e.x !== void 0)
34512
34536
  (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (i.uniform3i(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
34513
34537
  else {
34514
- if (Xt(t, e)) return;
34515
- i.uniform3iv(this.addr, e), $t(t, e);
34538
+ if ($t(t, e)) return;
34539
+ i.uniform3iv(this.addr, e), Kt(t, e);
34516
34540
  }
34517
34541
  }
34518
34542
  function lE(i, e) {
@@ -34520,8 +34544,8 @@ function lE(i, e) {
34520
34544
  if (e.x !== void 0)
34521
34545
  (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (i.uniform4i(this.addr, e.x, e.y, e.z, e.w), t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w);
34522
34546
  else {
34523
- if (Xt(t, e)) return;
34524
- i.uniform4iv(this.addr, e), $t(t, e);
34547
+ if ($t(t, e)) return;
34548
+ i.uniform4iv(this.addr, e), Kt(t, e);
34525
34549
  }
34526
34550
  }
34527
34551
  function dE(i, e) {
@@ -34533,8 +34557,8 @@ function uE(i, e) {
34533
34557
  if (e.x !== void 0)
34534
34558
  (t[0] !== e.x || t[1] !== e.y) && (i.uniform2ui(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
34535
34559
  else {
34536
- if (Xt(t, e)) return;
34537
- i.uniform2uiv(this.addr, e), $t(t, e);
34560
+ if ($t(t, e)) return;
34561
+ i.uniform2uiv(this.addr, e), Kt(t, e);
34538
34562
  }
34539
34563
  }
34540
34564
  function hE(i, e) {
@@ -34542,8 +34566,8 @@ function hE(i, e) {
34542
34566
  if (e.x !== void 0)
34543
34567
  (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (i.uniform3ui(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
34544
34568
  else {
34545
- if (Xt(t, e)) return;
34546
- i.uniform3uiv(this.addr, e), $t(t, e);
34569
+ if ($t(t, e)) return;
34570
+ i.uniform3uiv(this.addr, e), Kt(t, e);
34547
34571
  }
34548
34572
  }
34549
34573
  function fE(i, e) {
@@ -34551,8 +34575,8 @@ function fE(i, e) {
34551
34575
  if (e.x !== void 0)
34552
34576
  (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (i.uniform4ui(this.addr, e.x, e.y, e.z, e.w), t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w);
34553
34577
  else {
34554
- if (Xt(t, e)) return;
34555
- i.uniform4uiv(this.addr, e), $t(t, e);
34578
+ if ($t(t, e)) return;
34579
+ i.uniform4uiv(this.addr, e), Kt(t, e);
34556
34580
  }
34557
34581
  }
34558
34582
  function pE(i, e, t) {
@@ -34711,7 +34735,7 @@ function DE(i, e) {
34711
34735
  }
34712
34736
  function LE(i, e, t) {
34713
34737
  const n = this.cache, s = e.length, r = Yo(t, s);
34714
- Xt(n, r) || (i.uniform1iv(this.addr, r), $t(n, r));
34738
+ $t(n, r) || (i.uniform1iv(this.addr, r), Kt(n, r));
34715
34739
  let o;
34716
34740
  this.type === i.SAMPLER_2D_SHADOW ? o = Cd : o = bg;
34717
34741
  for (let a = 0; a !== s; ++a)
@@ -34719,19 +34743,19 @@ function LE(i, e, t) {
34719
34743
  }
34720
34744
  function NE(i, e, t) {
34721
34745
  const n = this.cache, s = e.length, r = Yo(t, s);
34722
- Xt(n, r) || (i.uniform1iv(this.addr, r), $t(n, r));
34746
+ $t(n, r) || (i.uniform1iv(this.addr, r), Kt(n, r));
34723
34747
  for (let o = 0; o !== s; ++o)
34724
34748
  t.setTexture3D(e[o] || Sg, r[o]);
34725
34749
  }
34726
34750
  function OE(i, e, t) {
34727
34751
  const n = this.cache, s = e.length, r = Yo(t, s);
34728
- Xt(n, r) || (i.uniform1iv(this.addr, r), $t(n, r));
34752
+ $t(n, r) || (i.uniform1iv(this.addr, r), Kt(n, r));
34729
34753
  for (let o = 0; o !== s; ++o)
34730
34754
  t.setTextureCube(e[o] || xg, r[o]);
34731
34755
  }
34732
34756
  function UE(i, e, t) {
34733
34757
  const n = this.cache, s = e.length, r = Yo(t, s);
34734
- Xt(n, r) || (i.uniform1iv(this.addr, r), $t(n, r));
34758
+ $t(n, r) || (i.uniform1iv(this.addr, r), Kt(n, r));
34735
34759
  for (let o = 0; o !== s; ++o)
34736
34760
  t.setTexture2DArray(e[o] || _g, r[o]);
34737
34761
  }
@@ -36419,7 +36443,7 @@ function LM(i, e) {
36419
36443
  case cr:
36420
36444
  i.blendFuncSeparate(i.ONE, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);
36421
36445
  break;
36422
- case $i:
36446
+ case Ki:
36423
36447
  i.blendFunc(i.ONE, i.ONE);
36424
36448
  break;
36425
36449
  case jh:
@@ -36437,7 +36461,7 @@ function LM(i, e) {
36437
36461
  case cr:
36438
36462
  i.blendFuncSeparate(i.SRC_ALPHA, i.ONE_MINUS_SRC_ALPHA, i.ONE, i.ONE_MINUS_SRC_ALPHA);
36439
36463
  break;
36440
- case $i:
36464
+ case Ki:
36441
36465
  i.blendFuncSeparate(i.SRC_ALPHA, i.ONE, i.ONE, i.ONE);
36442
36466
  break;
36443
36467
  case jh:
@@ -36854,7 +36878,7 @@ function NM(i, e, t, n, s, r, o) {
36854
36878
  const Pe = n.get(j);
36855
36879
  if (j.version !== Pe.__version || Q === !0) {
36856
36880
  t.activeTexture(i.TEXTURE0 + L);
36857
- const he = tt.getPrimaries(tt.workingColorSpace), we = b.colorSpace === Ki ? null : tt.getPrimaries(b.colorSpace), Oe = b.colorSpace === Ki || he === we ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
36881
+ const he = tt.getPrimaries(tt.workingColorSpace), we = b.colorSpace === Yi ? null : tt.getPrimaries(b.colorSpace), Oe = b.colorSpace === Yi || he === we ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
36858
36882
  i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, b.flipY), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.premultiplyAlpha), i.pixelStorei(i.UNPACK_ALIGNMENT, b.unpackAlignment), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, Oe);
36859
36883
  let se = v(b.image, !1, s.maxTextureSize);
36860
36884
  se = xt(b, se);
@@ -36959,7 +36983,7 @@ function NM(i, e, t, n, s, r, o) {
36959
36983
  const j = n.get(Q);
36960
36984
  if (Q.version !== j.__version || X === !0) {
36961
36985
  t.activeTexture(i.TEXTURE0 + L);
36962
- const Pe = tt.getPrimaries(tt.workingColorSpace), he = b.colorSpace === Ki ? null : tt.getPrimaries(b.colorSpace), we = b.colorSpace === Ki || Pe === he ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
36986
+ const Pe = tt.getPrimaries(tt.workingColorSpace), he = b.colorSpace === Yi ? null : tt.getPrimaries(b.colorSpace), we = b.colorSpace === Yi || Pe === he ? i.NONE : i.BROWSER_DEFAULT_WEBGL;
36963
36987
  i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, b.flipY), i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.premultiplyAlpha), i.pixelStorei(i.UNPACK_ALIGNMENT, b.unpackAlignment), i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL, we);
36964
36988
  const Oe = b.isCompressedTexture || b.image[0].isCompressedTexture, se = b.image[0] && b.image[0].isDataTexture, pe = [];
36965
36989
  for (let Y = 0; Y < 6; Y++)
@@ -37211,7 +37235,7 @@ function NM(i, e, t, n, s, r, o) {
37211
37235
  }
37212
37236
  function xt(A, b) {
37213
37237
  const L = A.colorSpace, X = A.format, Q = A.type;
37214
- return A.isCompressedTexture === !0 || A.isVideoTexture === !0 || L !== br && L !== Ki && (tt.getTransfer(L) === ut ? (X !== Jn || Q !== Dn) && Fe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : rt("WebGLTextures: Unsupported texture color space:", L)), b;
37238
+ return A.isCompressedTexture === !0 || A.isVideoTexture === !0 || L !== br && L !== Yi && (tt.getTransfer(L) === ut ? (X !== Jn || Q !== Dn) && Fe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : rt("WebGLTextures: Unsupported texture color space:", L)), b;
37215
37239
  }
37216
37240
  function Ae(A) {
37217
37241
  return typeof HTMLImageElement < "u" && A instanceof HTMLImageElement ? (l.width = A.naturalWidth || A.width, l.height = A.naturalHeight || A.height) : typeof VideoFrame < "u" && A instanceof VideoFrame ? (l.width = A.displayWidth, l.height = A.displayHeight) : (l.width = A.width, l.height = A.height), l;
@@ -37221,7 +37245,7 @@ function NM(i, e, t, n, s, r, o) {
37221
37245
  };
37222
37246
  }
37223
37247
  function OM(i, e) {
37224
- function t(n, s = Ki) {
37248
+ function t(n, s = Yi) {
37225
37249
  let r;
37226
37250
  const o = tt.getTransfer(s);
37227
37251
  if (n === Dn) return i.UNSIGNED_BYTE;
@@ -39483,7 +39507,7 @@ class yu {
39483
39507
  },
39484
39508
  transparent: !0,
39485
39509
  side: ln,
39486
- blending: $i,
39510
+ blending: Ki,
39487
39511
  depthWrite: !1
39488
39512
  }), this.glowMesh = new An(n, this.glowMaterial), this.scene.add(this.glowMesh);
39489
39513
  }
@@ -40057,7 +40081,7 @@ var QM = Object.defineProperty, ew = Object.getOwnPropertyDescriptor, Mt = (i, e
40057
40081
  (o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
40058
40082
  return n && s && QM(e, t, s), s;
40059
40083
  };
40060
- let bt = class extends Qi {
40084
+ let bt = class extends es {
40061
40085
  constructor() {
40062
40086
  super(...arguments), this.callManager = new jo(), this.orbRenderer = null, this.audioAnalyzer = null, this.soundManager = null, this.orbContainerRef = No(), this.animationId = null, this.callStatus = "idle", this.microphoneEnabled = !1, this.buttonStartText = "Try to call", this.buttonConnectingText = "Connecting...", this.size = 370, this.containerPadding = 45, this.theme = "default", this.themeMode = "auto", this.orbColors = {}, this.glowIntensity = 0.8, this.idleGlowMultiplier = 0.4, this.morphStrength = 1, this.noiseScale = 0.8, this.noiseSpeed = 0.15, this.fresnelPower = 2.5, this.rotationSpeed = 0.1, this.audioReactivity = 1, this.audioSmoothing = 0.03, this.idleMorphMultiplier = 0.25, this.colorContrast = 1.5, this.soundEnabled = !0, this.soundVolume = 0.15, this.handleAudioTrack = async (i) => {
40063
40087
  const t = i.detail;
@@ -40498,10 +40522,10 @@ Mt([
40498
40522
  oe({ type: String, attribute: "voice-service-url" })
40499
40523
  ], bt.prototype, "voiceServiceUrl", 2);
40500
40524
  Mt([
40501
- rs()
40525
+ Ui()
40502
40526
  ], bt.prototype, "callStatus", 2);
40503
40527
  Mt([
40504
- rs()
40528
+ Ui()
40505
40529
  ], bt.prototype, "microphoneEnabled", 2);
40506
40530
  Mt([
40507
40531
  oe({ type: String, attribute: "button-start-text" })
@@ -40571,7 +40595,7 @@ var tw = Object.defineProperty, nw = Object.getOwnPropertyDescriptor, wt = (i, e
40571
40595
  (o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
40572
40596
  return n && s && tw(e, t, s), s;
40573
40597
  };
40574
- let _t = class extends Qi {
40598
+ let _t = class extends es {
40575
40599
  constructor() {
40576
40600
  super(...arguments), this.callManager = new jo(), this.orbRenderer = null, this.audioAnalyzer = null, this.soundManager = null, this.orbContainerRef = No(), this.animationId = null, this.callStatus = "idle", this.microphoneEnabled = !1, this.buttonStartText = "Call", this.buttonConnectingText = "Connecting...", this.position = "bottom-right", this.size = 120, this.theme = "default", this.themeMode = "auto", this.orbColors = {}, this.glowIntensity = 0.8, this.idleGlowMultiplier = 0.4, this.morphStrength = 1, this.noiseScale = 0.8, this.noiseSpeed = 0.15, this.fresnelPower = 2.5, this.rotationSpeed = 0.1, this.audioReactivity = 1, this.audioSmoothing = 0.03, this.idleMorphMultiplier = 0.25, this.colorContrast = 1.5, this.soundEnabled = !0, this.soundVolume = 0.15, this.handleAudioTrack = async (i) => {
40577
40601
  const t = i.detail;
@@ -40996,10 +41020,10 @@ wt([
40996
41020
  oe({ type: String, attribute: "voice-service-url" })
40997
41021
  ], _t.prototype, "voiceServiceUrl", 2);
40998
41022
  wt([
40999
- rs()
41023
+ Ui()
41000
41024
  ], _t.prototype, "callStatus", 2);
41001
41025
  wt([
41002
- rs()
41026
+ Ui()
41003
41027
  ], _t.prototype, "microphoneEnabled", 2);
41004
41028
  wt([
41005
41029
  oe({ type: String, attribute: "button-start-text" })
@@ -41069,7 +41093,7 @@ var iw = Object.defineProperty, sw = Object.getOwnPropertyDescriptor, At = (i, e
41069
41093
  (o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
41070
41094
  return n && s && iw(e, t, s), s;
41071
41095
  };
41072
- let St = class extends Qi {
41096
+ let St = class extends es {
41073
41097
  constructor() {
41074
41098
  super(...arguments), this.callManager = new jo(), this.orbRenderer = null, this.audioAnalyzer = null, this.soundManager = null, this.orbContainerRef = No(), this.animationId = null, this.callStatus = "idle", this.microphoneEnabled = !1, this.buttonStartText = "Talk to AI Agent", this.buttonConnectingText = "Connecting...", this.buttonEndText = "End call", this.orbSize = 48, this.theme = "default", this.themeMode = "auto", this.orbColors = {}, this.glowIntensity = 0.8, this.idleGlowMultiplier = 0.4, this.morphStrength = 1, this.noiseScale = 0.8, this.noiseSpeed = 0.15, this.fresnelPower = 2.5, this.rotationSpeed = 0.1, this.audioReactivity = 1, this.audioSmoothing = 0.03, this.idleMorphMultiplier = 0.25, this.colorContrast = 1.5, this.soundEnabled = !0, this.soundVolume = 0.15, this.handleAudioTrack = async (i) => {
41075
41099
  const t = i.detail;
@@ -41416,10 +41440,10 @@ At([
41416
41440
  oe({ type: String, attribute: "voice-service-url" })
41417
41441
  ], St.prototype, "voiceServiceUrl", 2);
41418
41442
  At([
41419
- rs()
41443
+ Ui()
41420
41444
  ], St.prototype, "callStatus", 2);
41421
41445
  At([
41422
- rs()
41446
+ Ui()
41423
41447
  ], St.prototype, "microphoneEnabled", 2);
41424
41448
  At([
41425
41449
  oe({ type: String, attribute: "button-start-text" })
@@ -41503,12 +41527,12 @@ const rw = {
41503
41527
  // State-based colors (used automatically)
41504
41528
  stateIdle: "#a855f7",
41505
41529
  // Purple - same as main orb color
41506
- stateListening: "#facc15",
41507
- // Yellow - listening
41508
- stateThinking: "#f97316",
41509
- // Orange - thinking
41530
+ stateListening: "#f97316",
41531
+ // Orange - user is speaking, agent listening
41532
+ stateThinking: "#facc15",
41533
+ // Yellow - thinking/processing
41510
41534
  stateSpeaking: "#10b981"
41511
- // Muted green - speaking
41535
+ // Muted green - agent speaking
41512
41536
  }, rl = {
41513
41537
  idle: {
41514
41538
  shellOpen: 0,
@@ -41660,7 +41684,7 @@ class aw {
41660
41684
  }
41661
41685
  `,
41662
41686
  transparent: !0,
41663
- blending: $i,
41687
+ blending: Ki,
41664
41688
  depthWrite: !1
41665
41689
  });
41666
41690
  this.coreInner = new An(t, n), this.scene.add(this.coreInner);
@@ -41761,7 +41785,7 @@ class aw {
41761
41785
  }
41762
41786
  `,
41763
41787
  transparent: !0,
41764
- blending: $i,
41788
+ blending: Ki,
41765
41789
  depthWrite: !1
41766
41790
  });
41767
41791
  this.coreOuter = new An(s, r), this.scene.add(this.coreOuter);
@@ -41872,7 +41896,7 @@ class aw {
41872
41896
  }
41873
41897
  `,
41874
41898
  transparent: !0,
41875
- blending: $i,
41899
+ blending: Ki,
41876
41900
  depthWrite: !1,
41877
41901
  side: ln
41878
41902
  });
@@ -41990,7 +42014,7 @@ class aw {
41990
42014
  }
41991
42015
  `,
41992
42016
  transparent: !0,
41993
- blending: $i,
42017
+ blending: Ki,
41994
42018
  depthWrite: !1
41995
42019
  }), u = new BS(c, d);
41996
42020
  u.rotation.x = r.tiltX, u.rotation.z = r.tiltZ, u.ringConfig = r, this.pulseRings.push(u), this.scene.add(u);
@@ -42053,7 +42077,7 @@ class aw {
42053
42077
  }
42054
42078
  `,
42055
42079
  transparent: !0,
42056
- blending: $i,
42080
+ blending: Ki,
42057
42081
  depthWrite: !1
42058
42082
  });
42059
42083
  this.particles = new VS(s, r), this.particleMaterial = r, this.scene.add(this.particles);
@@ -42149,14 +42173,14 @@ class aw {
42149
42173
  this.pulseRings = [], this.particles && (this.particles.geometry.dispose(), this.particles.material.dispose()), this.renderer.dispose(), this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement);
42150
42174
  }
42151
42175
  }
42152
- var ow = Object.defineProperty, cw = Object.getOwnPropertyDescriptor, Kt = (i, e, t, n) => {
42176
+ var ow = Object.defineProperty, cw = Object.getOwnPropertyDescriptor, jt = (i, e, t, n) => {
42153
42177
  for (var s = n > 1 ? void 0 : n ? cw(e, t) : e, r = i.length - 1, o; r >= 0; r--)
42154
42178
  (o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
42155
42179
  return n && s && ow(e, t, s), s;
42156
42180
  };
42157
- let zt = class extends Qi {
42181
+ let Ft = class extends es {
42158
42182
  constructor() {
42159
- super(...arguments), this.orbRenderer = null, this.orbContainerRef = No(), this.audioSimPhase = 0, this.animationId = null, this.callManager = null, this.size = 300, this.headerLogo = "HANC.ai", this.headerTitle = "Lina-Voice AI", this.showBranding = !0, this.version = "v1.0.9", this.agentId = "", this.voiceServiceUrl = "", this.btnStartText = "Start", this.btnEndText = "End", this.colors = {}, this.brandingLogoColor = "rgba(255, 255, 255, 0.9)", this.brandingTitleColor = "rgba(255, 255, 255, 0.6)", this.brandingDividerColor = "rgba(255, 255, 255, 0.3)", this.versionColor = "rgba(255, 255, 255, 0.3)", this.buttonBackground = "linear-gradient(135deg, rgba(139, 92, 246, 0.95) 0%, rgba(124, 58, 237, 0.95) 100%)", this.buttonTextColor = "rgba(255, 255, 255, 0.95)", this.currentState = "idle", this.callStatus = "idle", this._hasMicPermission = null, this.handleCallClick = async () => {
42183
+ super(...arguments), this.orbRenderer = null, this.orbContainerRef = No(), this.audioSimPhase = 0, this.animationId = null, this.callManager = null, this.size = 300, this.headerLogo = "HANC.ai", this.headerTitle = "Lina-Voice AI", this.showBranding = !0, this.version = "v1.1.1", this.agentId = "", this.voiceServiceUrl = "", this.btnStartText = "Start", this.btnEndText = "End", this.colors = {}, this.brandingLogoColor = "rgba(255, 255, 255, 0.9)", this.brandingTitleColor = "rgba(255, 255, 255, 0.6)", this.brandingDividerColor = "rgba(255, 255, 255, 0.3)", this.versionColor = "rgba(255, 255, 255, 0.3)", this.buttonBackground = "linear-gradient(135deg, rgba(139, 92, 246, 0.95) 0%, rgba(124, 58, 237, 0.95) 100%)", this.buttonTextColor = "rgba(255, 255, 255, 0.95)", this.currentState = "idle", this.callStatus = "idle", this.isLoading = !0, this._hasMicPermission = null, this._localAudioContext = null, this._localAudioAnalyser = null, this._localAudioMonitorId = null, this._agentAudioContext = null, this._agentAudioAnalyser = null, this._agentAudioMonitorId = null, this._agentIsSpeaking = !1, this._interruptionTimeout = null, this._lastInterruptionTime = 0, this.handleCallClick = async () => {
42160
42184
  if (this.callStatus === "mic-denied")
42161
42185
  try {
42162
42186
  (await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), this._hasMicPermission = !0, this.callStatus = "idle";
@@ -42190,7 +42214,11 @@ let zt = class extends Qi {
42190
42214
  i && (this.orbRenderer = new aw(i, {
42191
42215
  size: 1,
42192
42216
  colors: this.colors
42193
- }), this.orbRenderer.start(), this.startIdleAnimation());
42217
+ }), this.orbRenderer.start(), this.startIdleAnimation(), requestAnimationFrame(() => {
42218
+ setTimeout(() => {
42219
+ this.isLoading = !1;
42220
+ }, 300);
42221
+ }));
42194
42222
  }
42195
42223
  initializeCallManager() {
42196
42224
  this.callManager || (this.callManager = new jo(), this.voiceServiceUrl && (this.callManager.serviceUrl = this.voiceServiceUrl), this.callManager.addEventListener("status-changed", ((i) => {
@@ -42200,7 +42228,7 @@ let zt = class extends Qi {
42200
42228
  const e = i.detail;
42201
42229
  if (e) {
42202
42230
  const t = new MediaStream([e]);
42203
- this.connectAudioStream(t);
42231
+ this.connectAudioStream(t), this.startAgentAudioMonitoring(e);
42204
42232
  }
42205
42233
  })), this.callManager.addEventListener("microphone-disabled", () => {
42206
42234
  this.callStatus === "active" && (this._hasMicPermission = !1);
@@ -42209,8 +42237,106 @@ let zt = class extends Qi {
42209
42237
  console.error("Call error:", (e = i.detail) == null ? void 0 : e.error), this.callStatus = "error", this.currentState = "idle", (t = this.orbRenderer) == null || t.setState("idle"), setTimeout(() => {
42210
42238
  this.callStatus === "error" && (this.callStatus = "idle");
42211
42239
  }, 3e3);
42240
+ })), this.callManager.addEventListener("agent-command", ((i) => {
42241
+ const e = i.detail;
42242
+ this.handleAgentCommand(e);
42243
+ })), this.callManager.addEventListener("local-audio-track", ((i) => {
42244
+ const e = i.detail;
42245
+ e && this.startLocalAudioMonitoring(e);
42212
42246
  })));
42213
42247
  }
42248
+ /**
42249
+ * Monitor local audio to detect user speaking (for interruption)
42250
+ */
42251
+ startLocalAudioMonitoring(i) {
42252
+ this.stopLocalAudioMonitoring();
42253
+ try {
42254
+ this._localAudioContext = new AudioContext(), this._localAudioAnalyser = this._localAudioContext.createAnalyser(), this._localAudioAnalyser.fftSize = 256;
42255
+ const e = new MediaStream([i]);
42256
+ this._localAudioContext.createMediaStreamSource(e).connect(this._localAudioAnalyser);
42257
+ const n = new Uint8Array(this._localAudioAnalyser.frequencyBinCount), s = 25;
42258
+ let r = 0;
42259
+ const o = 5, a = () => {
42260
+ var d;
42261
+ if (!this._localAudioAnalyser || this.callStatus !== "active") {
42262
+ this.stopLocalAudioMonitoring();
42263
+ return;
42264
+ }
42265
+ this._localAudioAnalyser.getByteFrequencyData(n);
42266
+ let c = 0;
42267
+ for (let u = 0; u < n.length; u++)
42268
+ c += n[u];
42269
+ c / n.length > s ? (r++, r >= o && (this._agentIsSpeaking ? this.handleUserInterruption() : this.currentState !== "listening" && (this.currentState = "listening", (d = this.orbRenderer) == null || d.setState("listening")))) : r = 0, this._localAudioMonitorId = requestAnimationFrame(a);
42270
+ };
42271
+ this._localAudioMonitorId = requestAnimationFrame(a);
42272
+ } catch (e) {
42273
+ console.warn("Failed to start local audio monitoring:", e);
42274
+ }
42275
+ }
42276
+ stopLocalAudioMonitoring() {
42277
+ this._localAudioMonitorId && (cancelAnimationFrame(this._localAudioMonitorId), this._localAudioMonitorId = null), this._localAudioContext && (this._localAudioContext.close(), this._localAudioContext = null), this._localAudioAnalyser = null;
42278
+ }
42279
+ /**
42280
+ * Monitor agent audio to detect when agent is actually speaking
42281
+ */
42282
+ startAgentAudioMonitoring(i) {
42283
+ this.stopAgentAudioMonitoring();
42284
+ try {
42285
+ this._agentAudioContext = new AudioContext(), this._agentAudioAnalyser = this._agentAudioContext.createAnalyser(), this._agentAudioAnalyser.fftSize = 256;
42286
+ const e = new MediaStream([i]);
42287
+ this._agentAudioContext.createMediaStreamSource(e).connect(this._agentAudioAnalyser);
42288
+ const n = new Uint8Array(this._agentAudioAnalyser.frequencyBinCount), s = 15;
42289
+ let r = 0;
42290
+ const o = 15, a = () => {
42291
+ var d;
42292
+ if (!this._agentAudioAnalyser || this.callStatus !== "active") {
42293
+ this.stopAgentAudioMonitoring();
42294
+ return;
42295
+ }
42296
+ this._agentAudioAnalyser.getByteFrequencyData(n);
42297
+ let c = 0;
42298
+ for (let u = 0; u < n.length; u++)
42299
+ c += n[u];
42300
+ c / n.length > s ? (r = 0, this._agentIsSpeaking || (this._agentIsSpeaking = !0, this.currentState !== "speaking" && (this.currentState = "speaking", (d = this.orbRenderer) == null || d.setState("speaking")))) : (r++, r >= o && this._agentIsSpeaking && (this._agentIsSpeaking = !1)), this._agentAudioMonitorId = requestAnimationFrame(a);
42301
+ };
42302
+ this._agentAudioMonitorId = requestAnimationFrame(a);
42303
+ } catch (e) {
42304
+ console.warn("Failed to start agent audio monitoring:", e);
42305
+ }
42306
+ }
42307
+ stopAgentAudioMonitoring() {
42308
+ this._agentAudioMonitorId && (cancelAnimationFrame(this._agentAudioMonitorId), this._agentAudioMonitorId = null), this._agentAudioContext && (this._agentAudioContext.close(), this._agentAudioContext = null), this._agentAudioAnalyser = null;
42309
+ }
42310
+ /**
42311
+ * Handle commands received from the agent via data channel
42312
+ */
42313
+ handleAgentCommand(i) {
42314
+ var e, t, n;
42315
+ switch (console.log("[LinaWidget] Received agent command:", i), i.type) {
42316
+ case "change_color":
42317
+ (e = i.payload) != null && e.color && (this.setColors({ coreGlow: i.payload.color }), this.dispatchEvent(new CustomEvent("color-changed", {
42318
+ detail: { color: i.payload.color },
42319
+ bubbles: !0,
42320
+ composed: !0
42321
+ })));
42322
+ break;
42323
+ case "set_emotion":
42324
+ (t = i.payload) != null && t.emotion && this.setEmotion(i.payload.emotion);
42325
+ break;
42326
+ case "agent_state":
42327
+ (n = i.payload) != null && n.state && (this.setState(i.payload.state), this._agentIsSpeaking = i.payload.state === "speaking");
42328
+ break;
42329
+ }
42330
+ }
42331
+ /**
42332
+ * Handle user interruption - show red pulse temporarily
42333
+ */
42334
+ handleUserInterruption() {
42335
+ const i = Date.now();
42336
+ i - this._lastInterruptionTime < 1e3 || (this._lastInterruptionTime = i, this.setEmotion("interrupted"), this._interruptionTimeout && clearTimeout(this._interruptionTimeout), this._interruptionTimeout = setTimeout(() => {
42337
+ this.getEmotion() === "interrupted" && this.setEmotion("neutral"), this._interruptionTimeout = null;
42338
+ }, 1500));
42339
+ }
42214
42340
  handleCallStatusChange(i) {
42215
42341
  var e, t, n, s;
42216
42342
  switch (i) {
@@ -42235,7 +42361,7 @@ let zt = class extends Qi {
42235
42361
  }
42236
42362
  cleanup() {
42237
42363
  var i, e;
42238
- this.animationId !== null && (cancelAnimationFrame(this.animationId), this.animationId = null), (i = this.callManager) == null || i.hangUp(), (e = this.orbRenderer) == null || e.destroy(), this.orbRenderer = null;
42364
+ this.animationId !== null && (cancelAnimationFrame(this.animationId), this.animationId = null), this.stopLocalAudioMonitoring(), this.stopAgentAudioMonitoring(), this._interruptionTimeout && (clearTimeout(this._interruptionTimeout), this._interruptionTimeout = null), (i = this.callManager) == null || i.hangUp(), (e = this.orbRenderer) == null || e.destroy(), this.orbRenderer = null;
42239
42365
  }
42240
42366
  startIdleAnimation() {
42241
42367
  this.animationId !== null && cancelAnimationFrame(this.animationId);
@@ -42415,7 +42541,12 @@ let zt = class extends Qi {
42415
42541
  class="orb-container"
42416
42542
  style="width: ${this.size}px; height: ${this.size}px;"
42417
42543
  ${Oo(this.orbContainerRef)}
42418
- ></div>
42544
+ >
42545
+ <div class="loading-container ${this.isLoading ? "" : "hidden"}">
42546
+ <div class="loading-spinner"></div>
42547
+ <span class="loading-text">Loading...</span>
42548
+ </div>
42549
+ </div>
42419
42550
 
42420
42551
  <div class="bottom-section">
42421
42552
  <button
@@ -42439,7 +42570,7 @@ let zt = class extends Qi {
42439
42570
  `;
42440
42571
  }
42441
42572
  };
42442
- zt.styles = Io`
42573
+ Ft.styles = Io`
42443
42574
  :host {
42444
42575
  display: inline-block;
42445
42576
  contain: layout style;
@@ -42610,69 +42741,116 @@ zt.styles = Io`
42610
42741
  .call-control-btn.mic-denied svg {
42611
42742
  animation: warning-pulse 2s ease-in-out infinite;
42612
42743
  }
42744
+
42745
+ /* Loading indicator */
42746
+ .loading-container {
42747
+ position: absolute;
42748
+ top: 0;
42749
+ left: 0;
42750
+ right: 0;
42751
+ bottom: 0;
42752
+ display: flex;
42753
+ align-items: center;
42754
+ justify-content: center;
42755
+ background: radial-gradient(circle, rgba(30, 27, 46, 0.9) 0%, rgba(15, 13, 23, 0.95) 100%);
42756
+ border-radius: 50%;
42757
+ z-index: 10;
42758
+ transition: opacity 0.5s ease, visibility 0.5s ease;
42759
+ }
42760
+
42761
+ .loading-container.hidden {
42762
+ opacity: 0;
42763
+ visibility: hidden;
42764
+ pointer-events: none;
42765
+ }
42766
+
42767
+ .loading-spinner {
42768
+ width: 60px;
42769
+ height: 60px;
42770
+ border: 3px solid rgba(168, 85, 247, 0.2);
42771
+ border-top-color: #a855f7;
42772
+ border-radius: 50%;
42773
+ animation: loading-spin 1s linear infinite;
42774
+ }
42775
+
42776
+ @keyframes loading-spin {
42777
+ from { transform: rotate(0deg); }
42778
+ to { transform: rotate(360deg); }
42779
+ }
42780
+
42781
+ .loading-text {
42782
+ position: absolute;
42783
+ bottom: 30%;
42784
+ color: rgba(255, 255, 255, 0.6);
42785
+ font-size: 12px;
42786
+ letter-spacing: 1px;
42787
+ }
42613
42788
  `;
42614
- Kt([
42789
+ jt([
42615
42790
  oe({ type: Number })
42616
- ], zt.prototype, "size", 2);
42617
- Kt([
42791
+ ], Ft.prototype, "size", 2);
42792
+ jt([
42618
42793
  oe({ type: String, attribute: "header-logo" })
42619
- ], zt.prototype, "headerLogo", 2);
42620
- Kt([
42794
+ ], Ft.prototype, "headerLogo", 2);
42795
+ jt([
42621
42796
  oe({ type: String, attribute: "header-title" })
42622
- ], zt.prototype, "headerTitle", 2);
42623
- Kt([
42797
+ ], Ft.prototype, "headerTitle", 2);
42798
+ jt([
42624
42799
  oe({ type: Boolean, attribute: "show-branding" })
42625
- ], zt.prototype, "showBranding", 2);
42626
- Kt([
42800
+ ], Ft.prototype, "showBranding", 2);
42801
+ jt([
42627
42802
  oe({ type: String })
42628
- ], zt.prototype, "version", 2);
42629
- Kt([
42803
+ ], Ft.prototype, "version", 2);
42804
+ jt([
42630
42805
  oe({ type: String, attribute: "agent-id" })
42631
- ], zt.prototype, "agentId", 2);
42632
- Kt([
42806
+ ], Ft.prototype, "agentId", 2);
42807
+ jt([
42633
42808
  oe({ type: String, attribute: "voice-service-url" })
42634
- ], zt.prototype, "voiceServiceUrl", 2);
42635
- Kt([
42809
+ ], Ft.prototype, "voiceServiceUrl", 2);
42810
+ jt([
42636
42811
  oe({ type: String, attribute: "btn-start-text" })
42637
- ], zt.prototype, "btnStartText", 2);
42638
- Kt([
42812
+ ], Ft.prototype, "btnStartText", 2);
42813
+ jt([
42639
42814
  oe({ type: String, attribute: "btn-end-text" })
42640
- ], zt.prototype, "btnEndText", 2);
42641
- Kt([
42815
+ ], Ft.prototype, "btnEndText", 2);
42816
+ jt([
42642
42817
  oe({ type: Object })
42643
- ], zt.prototype, "colors", 2);
42644
- Kt([
42818
+ ], Ft.prototype, "colors", 2);
42819
+ jt([
42645
42820
  oe({ type: String, attribute: "branding-logo-color" })
42646
- ], zt.prototype, "brandingLogoColor", 2);
42647
- Kt([
42821
+ ], Ft.prototype, "brandingLogoColor", 2);
42822
+ jt([
42648
42823
  oe({ type: String, attribute: "branding-title-color" })
42649
- ], zt.prototype, "brandingTitleColor", 2);
42650
- Kt([
42824
+ ], Ft.prototype, "brandingTitleColor", 2);
42825
+ jt([
42651
42826
  oe({ type: String, attribute: "branding-divider-color" })
42652
- ], zt.prototype, "brandingDividerColor", 2);
42653
- Kt([
42827
+ ], Ft.prototype, "brandingDividerColor", 2);
42828
+ jt([
42654
42829
  oe({ type: String, attribute: "version-color" })
42655
- ], zt.prototype, "versionColor", 2);
42656
- Kt([
42830
+ ], Ft.prototype, "versionColor", 2);
42831
+ jt([
42657
42832
  oe({ type: String, attribute: "button-background" })
42658
- ], zt.prototype, "buttonBackground", 2);
42659
- Kt([
42833
+ ], Ft.prototype, "buttonBackground", 2);
42834
+ jt([
42660
42835
  oe({ type: String, attribute: "button-text-color" })
42661
- ], zt.prototype, "buttonTextColor", 2);
42662
- Kt([
42663
- rs()
42664
- ], zt.prototype, "currentState", 2);
42665
- Kt([
42666
- rs()
42667
- ], zt.prototype, "callStatus", 2);
42668
- zt = Kt([
42836
+ ], Ft.prototype, "buttonTextColor", 2);
42837
+ jt([
42838
+ Ui()
42839
+ ], Ft.prototype, "currentState", 2);
42840
+ jt([
42841
+ Ui()
42842
+ ], Ft.prototype, "callStatus", 2);
42843
+ jt([
42844
+ Ui()
42845
+ ], Ft.prototype, "isLoading", 2);
42846
+ Ft = jt([
42669
42847
  Lo("lina-voice-widget")
42670
- ], zt);
42848
+ ], Ft);
42671
42849
  export {
42672
42850
  _t as FloatingCall,
42673
42851
  bt as InlineCall,
42674
42852
  aw as LinaOrbRenderer,
42675
- zt as LinaWidget,
42853
+ Ft as LinaWidget,
42676
42854
  St as PillCall,
42677
42855
  _u as SoundManager,
42678
42856
  ZM as applyTheme,