@liforma/client 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/next/index.js +169 -161
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/v2/experience.d.ts +8 -0
  5. package/dist/next/v2/experience.d.ts.map +1 -1
  6. package/dist/next/v2/experienceEvents.d.ts +5 -0
  7. package/dist/next/v2/experienceEvents.d.ts.map +1 -1
  8. package/dist/next/v2/shims/embedBaseUrl.d.ts +3 -2
  9. package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
  10. package/dist/next/v2/types/sessionManifest.d.ts +12 -0
  11. package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
  12. package/dist/npm/index.js +153 -145
  13. package/dist/npm/index.js.map +1 -1
  14. package/dist/npm/v2/experience.d.ts +8 -0
  15. package/dist/npm/v2/experience.d.ts.map +1 -1
  16. package/dist/npm/v2/experienceEvents.d.ts +5 -0
  17. package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
  18. package/dist/npm/v2/shims/embedBaseUrl.d.ts +3 -2
  19. package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
  20. package/dist/npm/v2/speechOnlyManifest.d.ts.map +1 -1
  21. package/dist/npm/v2/types/sessionManifest.d.ts +12 -0
  22. package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
  23. package/dist/npm/v2/types/sessionManifestSchema.d.ts +19 -0
  24. package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
  25. package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
  26. package/dist/react/component/experienceComponentTypes.d.ts +2 -0
  27. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  28. package/dist/react/index.js +320 -306
  29. package/dist/react/index.js.map +1 -1
  30. package/dist/react/v2/experience.d.ts +8 -0
  31. package/dist/react/v2/experience.d.ts.map +1 -1
  32. package/dist/react/v2/experienceEvents.d.ts +5 -0
  33. package/dist/react/v2/experienceEvents.d.ts.map +1 -1
  34. package/dist/react/v2/shims/embedBaseUrl.d.ts +3 -2
  35. package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
  36. package/dist/react/v2/types/sessionManifest.d.ts +12 -0
  37. package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
  38. package/dist/sdk/v2/client.js +6 -6
  39. package/dist/sdk/v2/client.js.map +1 -1
  40. package/dist/svelte/Experience.svelte +7 -0
  41. package/package.json +1 -1
package/dist/npm/index.js CHANGED
@@ -1140,35 +1140,38 @@ function qe() {
1140
1140
  let e = Ke();
1141
1141
  return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ? Ge : We;
1142
1142
  }
1143
- function Je(e, t, n, r, i, a, o, s) {
1143
+ function Je(e, t) {
1144
+ return e?.trim() || t?.trim() || void 0;
1145
+ }
1146
+ function Ye(e, t, n, r, i, a, o, s) {
1144
1147
  let c = (e ?? qe()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1145
- d && u.searchParams.set("locationId", d);
1148
+ d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
1146
1149
  let f = r?.trim();
1147
- return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), Ye(u.toString());
1150
+ return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), Xe(u.toString());
1148
1151
  }
1149
- function Ye(e) {
1152
+ function Xe(e) {
1150
1153
  if (typeof location > "u") return e;
1151
1154
  let t = new URL(e);
1152
1155
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1153
1156
  }
1154
- function Xe(e) {
1157
+ function Ze(e) {
1155
1158
  return new URL(e).origin;
1156
1159
  }
1157
1160
  //#endregion
1158
1161
  //#region src/v2/experienceEvents.ts
1159
- function Ze() {
1162
+ function Qe() {
1160
1163
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `evt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `evt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
1161
1164
  }
1162
- function Qe(e, t, n) {
1165
+ function $e(e, t, n) {
1163
1166
  return {
1164
- id: Ze(),
1167
+ id: Qe(),
1165
1168
  type: e,
1166
1169
  sessionId: t,
1167
1170
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1168
1171
  data: n
1169
1172
  };
1170
1173
  }
1171
- function $e() {
1174
+ function et() {
1172
1175
  return {
1173
1176
  ready: /* @__PURE__ */ new Set(),
1174
1177
  started: /* @__PURE__ */ new Set(),
@@ -1187,32 +1190,32 @@ function $e() {
1187
1190
  conversationProcessorError: /* @__PURE__ */ new Set()
1188
1191
  };
1189
1192
  }
1190
- function et(e, t, n) {
1193
+ function tt(e, t, n) {
1191
1194
  return e[t].add(n), () => e[t].delete(n);
1192
1195
  }
1193
- function tt(e, t, n) {
1196
+ function nt(e, t, n) {
1194
1197
  for (let r of e[t]) r(n);
1195
1198
  }
1196
- function nt(e) {
1199
+ function rt(e) {
1197
1200
  for (let t of Object.keys(e)) e[t].clear();
1198
1201
  }
1199
1202
  //#endregion
1200
1203
  //#region src/v2/speech/types.ts
1201
- function rt(e) {
1204
+ function it(e) {
1202
1205
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1203
1206
  }
1204
- function it(e) {
1207
+ function at(e) {
1205
1208
  return "url" in e && typeof e.url == "string";
1206
1209
  }
1207
- function at(e) {
1210
+ function ot(e) {
1208
1211
  if (!("track" in e)) return !1;
1209
1212
  let t = e.track;
1210
1213
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1211
1214
  }
1212
- function ot(e) {
1213
- return !rt(e) && !it(e) && !at(e) && "encoding" in e && typeof e.encoding == "string";
1215
+ function st(e) {
1216
+ return !it(e) && !at(e) && !ot(e) && "encoding" in e && typeof e.encoding == "string";
1214
1217
  }
1215
- var st = [
1218
+ var ct = [
1216
1219
  8e3,
1217
1220
  16e3,
1218
1221
  22050,
@@ -1230,14 +1233,14 @@ var st = [
1230
1233
  MAX_UTTERANCE_DURATION_MS: 9e4,
1231
1234
  MAX_PENDING_WRITES: 8,
1232
1235
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1233
- }, ct = class extends Error {
1236
+ }, lt = class extends Error {
1234
1237
  operation;
1235
1238
  requiredCapability;
1236
1239
  name = "UnsupportedSpeechOperationError";
1237
1240
  constructor(e, t) {
1238
1241
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1239
1242
  }
1240
- }, lt = class extends Error {
1243
+ }, ut = class extends Error {
1241
1244
  name = "SpeechUtteranceClosedError";
1242
1245
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1243
1246
  super(e);
@@ -1247,72 +1250,72 @@ var st = [
1247
1250
  constructor(e, t) {
1248
1251
  super(e, t);
1249
1252
  }
1250
- }, ut = class extends Error {
1253
+ }, dt = class extends Error {
1251
1254
  name = "SpeechBufferTimeoutError";
1252
1255
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1253
1256
  super(e);
1254
1257
  }
1255
1258
  };
1256
- function dt(e = "none") {
1259
+ function ft(e = "none") {
1257
1260
  return {
1258
1261
  mode: e,
1259
1262
  trackedDurationMs: 0,
1260
1263
  fallbackDurationMs: 0
1261
1264
  };
1262
1265
  }
1263
- function ft(e) {
1264
- return st.includes(e);
1265
- }
1266
1266
  function pt(e) {
1267
+ return ct.includes(e);
1268
+ }
1269
+ function mt(e) {
1267
1270
  if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
1268
1271
  if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
1269
- if (!ft(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1272
+ if (!pt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1270
1273
  }
1271
- function mt(e) {
1272
- if (rt(e)) {
1273
- pt(e.format);
1274
+ function ht(e) {
1275
+ if (it(e)) {
1276
+ mt(e.format);
1274
1277
  return;
1275
1278
  }
1276
- if (it(e)) {
1279
+ if (at(e)) {
1277
1280
  if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
1278
- if (e.sampleRate !== void 0 && !ft(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1281
+ if (e.sampleRate !== void 0 && !pt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1279
1282
  return;
1280
1283
  }
1281
- if (at(e)) {
1284
+ if (ot(e)) {
1282
1285
  if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
1283
- if (e.sampleRate !== void 0 && !ft(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1286
+ if (e.sampleRate !== void 0 && !pt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1284
1287
  return;
1285
1288
  }
1286
- if (ot(e)) {
1289
+ if (st(e)) {
1287
1290
  let t = e.encoding.trim().toLowerCase();
1288
1291
  if (!t) throw new Z("Encoded audio MIME type is required.");
1289
1292
  if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1290
- if (e.sampleRate !== void 0 && !ft(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1293
+ if (e.sampleRate !== void 0 && !pt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1291
1294
  return;
1292
1295
  }
1293
1296
  throw new Z("Unsupported speech.play audio shape.");
1294
1297
  }
1295
- function ht(e) {
1296
- if (e.format) return pt(e.format), e.format;
1298
+ function gt(e) {
1299
+ if (e.format) return mt(e.format), e.format;
1297
1300
  if (e.track) {
1298
1301
  let t = {
1299
1302
  encoding: "pcm_s16le",
1300
1303
  sampleRate: e.sampleRate ?? 24e3,
1301
1304
  channels: 1
1302
1305
  };
1303
- return pt(t), t;
1306
+ return mt(t), t;
1304
1307
  }
1305
1308
  throw new Z("createUtterance requires format or track.");
1306
1309
  }
1307
- function gt(e) {
1310
+ function _t(e) {
1308
1311
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1309
1312
  }
1310
- function _t(e) {
1313
+ function vt(e) {
1311
1314
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1312
1315
  }
1313
1316
  //#endregion
1314
1317
  //#region src/byo/pcm.ts
1315
- function vt(e) {
1318
+ function yt(e) {
1316
1319
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1317
1320
  for (let t = 0; t < e.length; t++) {
1318
1321
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1322,11 +1325,11 @@ function vt(e) {
1322
1325
  }
1323
1326
  //#endregion
1324
1327
  //#region src/byo/resample.ts
1325
- function yt(e, t, n, r, i) {
1328
+ function bt(e, t, n, r, i) {
1326
1329
  let a = -.5 * e + 1.5 * t - 1.5 * n + .5 * r, o = e - 2.5 * t + 2 * n - .5 * r, s = -.5 * e + .5 * n, c = t;
1327
1330
  return ((a * i + o) * i + s) * i + c;
1328
1331
  }
1329
- function bt(e, t) {
1332
+ function xt(e, t) {
1330
1333
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1331
1334
  if (e === t) return {
1332
1335
  fromRate: e,
@@ -1349,7 +1352,7 @@ function bt(e, t) {
1349
1352
  let a = [];
1350
1353
  for (; i + 2 < r.length - 1;) {
1351
1354
  let e = Math.floor(i), t = i - e, o = Math.max(0, e - 1), s = Math.min(r.length - 1, e + 1), c = Math.min(r.length - 1, e + 2);
1352
- a.push(yt(r[o], r[e], r[s], r[c], t)), i += n;
1355
+ a.push(bt(r[o], r[e], r[s], r[c], t)), i += n;
1353
1356
  }
1354
1357
  let o = Math.max(0, Math.floor(i) - 1);
1355
1358
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1361,7 +1364,7 @@ function bt(e, t) {
1361
1364
  }
1362
1365
  //#endregion
1363
1366
  //#region src/byo/audioCapture.ts
1364
- var xt = "liforma-pcm-capture", St = `
1367
+ var St = "liforma-pcm-capture", Ct = `
1365
1368
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1366
1369
  process(inputs) {
1367
1370
  const ch = inputs[0] && inputs[0][0];
@@ -1373,29 +1376,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1373
1376
  return true;
1374
1377
  }
1375
1378
  }
1376
- registerProcessor('${xt}', LiformaPcmCaptureProcessor);
1377
- `, Ct = null;
1378
- function wt() {
1379
- return Ct ||= URL.createObjectURL(new Blob([St], { type: "application/javascript" })), Ct;
1380
- }
1379
+ registerProcessor('${St}', LiformaPcmCaptureProcessor);
1380
+ `, wt = null;
1381
1381
  function Tt() {
1382
+ return wt ||= URL.createObjectURL(new Blob([Ct], { type: "application/javascript" })), wt;
1383
+ }
1384
+ function Et() {
1382
1385
  return window.AudioContext || window.webkitAudioContext || null;
1383
1386
  }
1384
- async function Et(e) {
1385
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Tt();
1387
+ async function Dt(e) {
1388
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Et();
1386
1389
  if (!o) throw Error("Web Audio is required for audio capture");
1387
1390
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1388
1391
  l.gain.value = 0;
1389
- let u = s.sampleRate, d = bt(u, n), f = !1, p = !1, m = (e) => {
1392
+ let u = s.sampleRate, d = xt(u, n), f = !1, p = !1, m = (e) => {
1390
1393
  if (f || i && !i()) return;
1391
1394
  let t = d.push(e);
1392
- t.length !== 0 && r(vt(t));
1395
+ t.length !== 0 && r(yt(t));
1393
1396
  }, h = () => void 0;
1394
1397
  return await (async () => {
1395
1398
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1396
1399
  try {
1397
- await s.audioWorklet.addModule(wt());
1398
- let e = new AudioWorkletNode(s, xt, {
1400
+ await s.audioWorklet.addModule(Tt());
1401
+ let e = new AudioWorkletNode(s, St, {
1399
1402
  numberOfInputs: 1,
1400
1403
  numberOfOutputs: 1,
1401
1404
  outputChannelCount: [1]
@@ -1445,7 +1448,7 @@ async function Et(e) {
1445
1448
  }
1446
1449
  //#endregion
1447
1450
  //#region src/v2/speech/captureMediaStreamTrack.ts
1448
- async function Dt(e) {
1451
+ async function Ot(e) {
1449
1452
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1450
1453
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
1451
1454
  if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
@@ -1454,13 +1457,13 @@ async function Dt(e) {
1454
1457
  s || (s = !0, c?.stop(), c = null);
1455
1458
  };
1456
1459
  try {
1457
- c = await Et({
1460
+ c = await Dt({
1458
1461
  mediaStream: a,
1459
1462
  targetSampleRate: r,
1460
1463
  shouldSend: () => !s && !i?.aborted,
1461
1464
  onPcm: (e) => {
1462
1465
  if (s || i?.aborted) return;
1463
- let t = gt(e);
1466
+ let t = _t(e);
1464
1467
  o = o.then(async () => {
1465
1468
  if (s || i?.aborted) return;
1466
1469
  let e = 0;
@@ -1489,10 +1492,10 @@ async function Dt(e) {
1489
1492
  }
1490
1493
  //#endregion
1491
1494
  //#region src/v2/speech/speechController.ts
1492
- async function Ot(e, t) {
1493
- if (at(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
1494
- if (rt(e)) {
1495
- let t = gt(e.data);
1495
+ async function kt(e, t) {
1496
+ if (ot(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
1497
+ if (it(e)) {
1498
+ let t = _t(e.data);
1496
1499
  if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
1497
1500
  return {
1498
1501
  kind: "pcm",
@@ -1500,17 +1503,17 @@ async function Ot(e, t) {
1500
1503
  format: e.format
1501
1504
  };
1502
1505
  }
1503
- if (it(e)) return {
1506
+ if (at(e)) return {
1504
1507
  kind: "url",
1505
1508
  url: e.url.trim(),
1506
1509
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1507
1510
  };
1508
- if (!ot(e)) throw new Z("Unsupported speech.play audio shape.");
1511
+ if (!st(e)) throw new Z("Unsupported speech.play audio shape.");
1509
1512
  let n;
1510
1513
  if (typeof Blob < "u" && e.data instanceof Blob) {
1511
1514
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1512
1515
  n = new Uint8Array(await e.data.arrayBuffer());
1513
- } else n = gt(e.data);
1516
+ } else n = _t(e.data);
1514
1517
  return {
1515
1518
  kind: "encoded",
1516
1519
  data: n.slice().buffer,
@@ -1518,10 +1521,10 @@ async function Ot(e, t) {
1518
1521
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1519
1522
  };
1520
1523
  }
1521
- function kt() {
1524
+ function At() {
1522
1525
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `utt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `utt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
1523
1526
  }
1524
- function At(e, t = "completed") {
1527
+ function jt(e, t = "completed") {
1525
1528
  return {
1526
1529
  utteranceId: e.speechId,
1527
1530
  characterId: e.characterId,
@@ -1535,13 +1538,13 @@ function At(e, t = "completed") {
1535
1538
  }
1536
1539
  };
1537
1540
  }
1538
- function jt(e) {
1541
+ function Mt(e) {
1539
1542
  return e instanceof Error ? e : new Z(String(e));
1540
1543
  }
1541
- function Mt(e) {
1544
+ function Nt(e) {
1542
1545
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
1543
1546
  }
1544
- var Nt = class {
1547
+ var Pt = class {
1545
1548
  id;
1546
1549
  characterId;
1547
1550
  result;
@@ -1570,14 +1573,14 @@ var Nt = class {
1570
1573
  queue: e.queue,
1571
1574
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
1572
1575
  }).catch((e) => {
1573
- throw this.fail(jt(e)), jt(e);
1576
+ throw this.fail(Mt(e)), Mt(e);
1574
1577
  }), this.signal?.addEventListener("abort", () => {
1575
1578
  this.cancel();
1576
1579
  }, { once: !0 });
1577
1580
  }
1578
1581
  async write(e, t) {
1579
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new lt();
1580
- let n = gt(e);
1582
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new ut();
1583
+ let n = _t(e);
1581
1584
  if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
1582
1585
  if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
1583
1586
  if (n.byteLength === 0) return;
@@ -1586,13 +1589,13 @@ var Nt = class {
1586
1589
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
1587
1590
  if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1588
1591
  let a = async () => {
1589
- if (this.closed || this.settled) throw new lt();
1592
+ if (this.closed || this.settled) throw new ut();
1590
1593
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
1591
1594
  utteranceId: this.id,
1592
1595
  audio: t.buffer,
1593
1596
  byteLength: t.byteLength
1594
1597
  }), a = await Promise.race([i, new Promise((e, t) => {
1595
- setTimeout(() => t(new ut()), r);
1598
+ setTimeout(() => t(new dt()), r);
1596
1599
  })]);
1597
1600
  this.bufferedMs = Math.max(0, a.bufferedMs);
1598
1601
  }, o = this.writeChain.then(a, a);
@@ -1604,7 +1607,7 @@ var Nt = class {
1604
1607
  }
1605
1608
  }
1606
1609
  async setTranscript(e) {
1607
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new lt();
1610
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new ut();
1608
1611
  await this.requireHost().speechUtteranceSetTranscript({
1609
1612
  utteranceId: this.id,
1610
1613
  transcript: e
@@ -1621,7 +1624,7 @@ var Nt = class {
1621
1624
  });
1622
1625
  return this.resolve(t), t;
1623
1626
  } catch (e) {
1624
- let t = jt(e);
1627
+ let t = Mt(e);
1625
1628
  throw this.fail(t), t;
1626
1629
  }
1627
1630
  }
@@ -1639,11 +1642,11 @@ var Nt = class {
1639
1642
  characterId: this.characterId,
1640
1643
  status: "cancelled",
1641
1644
  durationMs: 0,
1642
- animation: dt("none")
1645
+ animation: ft("none")
1643
1646
  };
1644
1647
  return this.resolve(t), t;
1645
1648
  } catch (e) {
1646
- let t = jt(e);
1649
+ let t = Mt(e);
1647
1650
  throw this.fail(t), t;
1648
1651
  }
1649
1652
  }
@@ -1656,7 +1659,7 @@ var Nt = class {
1656
1659
  return e;
1657
1660
  }
1658
1661
  resolve(e) {
1659
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new lt()));
1662
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new ut()));
1660
1663
  }
1661
1664
  fail(e) {
1662
1665
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
@@ -1668,7 +1671,7 @@ var Nt = class {
1668
1671
  }
1669
1672
  await new Promise((t, n) => {
1670
1673
  let r = setTimeout(() => {
1671
- n(new ut());
1674
+ n(new dt());
1672
1675
  }, e);
1673
1676
  this.pendingWriteWaiters.push({
1674
1677
  resolve: () => {
@@ -1687,13 +1690,13 @@ var Nt = class {
1687
1690
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
1688
1691
  }
1689
1692
  };
1690
- function Pt(e) {
1693
+ function Ft(e) {
1691
1694
  let t = null, n = (t, n) => {
1692
- if (!e.getCapabilities()[n]) throw new ct(t, n);
1695
+ if (!e.getCapabilities()[n]) throw new lt(t, n);
1693
1696
  }, r = {
1694
1697
  async speak(r) {
1695
1698
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
1696
- let i = _t(r.queue ?? "append");
1699
+ let i = vt(r.queue ?? "append");
1697
1700
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
1698
1701
  let a = e.getIframeHost();
1699
1702
  if (!a) throw new Z("Speech session is not attached.");
@@ -1713,41 +1716,41 @@ function Pt(e) {
1713
1716
  return;
1714
1717
  }
1715
1718
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
1716
- t.removeEventListener("abort", s), n(At(e, "completed"));
1719
+ t.removeEventListener("abort", s), n(jt(e, "completed"));
1717
1720
  }, (a) => {
1718
- if (t.removeEventListener("abort", s), Mt(a)) {
1721
+ if (t.removeEventListener("abort", s), Nt(a)) {
1719
1722
  n({
1720
1723
  utteranceId: "utt_interrupted",
1721
1724
  characterId: r.characterId ?? e.getActiveCharacterId(),
1722
1725
  status: "interrupted",
1723
1726
  durationMs: 0,
1724
1727
  transcript: r.text,
1725
- animation: dt("none")
1728
+ animation: ft("none")
1726
1729
  });
1727
1730
  return;
1728
1731
  }
1729
- i(jt(a));
1732
+ i(Mt(a));
1730
1733
  });
1731
1734
  });
1732
1735
  }
1733
1736
  try {
1734
- return At(await o, "completed");
1737
+ return jt(await o, "completed");
1735
1738
  } catch (t) {
1736
- if (Mt(t)) return {
1739
+ if (Nt(t)) return {
1737
1740
  utteranceId: "utt_interrupted",
1738
1741
  characterId: r.characterId ?? e.getActiveCharacterId(),
1739
1742
  status: "interrupted",
1740
1743
  durationMs: 0,
1741
1744
  transcript: r.text,
1742
- animation: dt("none")
1745
+ animation: ft("none")
1743
1746
  };
1744
- throw jt(t);
1747
+ throw Mt(t);
1745
1748
  }
1746
1749
  },
1747
1750
  async play(i) {
1748
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), mt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
1751
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), ht(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
1749
1752
  let a = i.queue ?? "append";
1750
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), at(i.audio)) {
1753
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), ot(i.audio)) {
1751
1754
  let e = i.audio.sampleRate ?? 24e3;
1752
1755
  return r.createUtterance({
1753
1756
  format: {
@@ -1763,7 +1766,7 @@ function Pt(e) {
1763
1766
  }
1764
1767
  let o = e.getIframeHost();
1765
1768
  if (!o) throw new Z("Speech session is not attached.");
1766
- let s = await Ot(i.audio, i.signal);
1769
+ let s = await kt(i.audio, i.signal);
1767
1770
  return o.speechPlay({
1768
1771
  source: s,
1769
1772
  characterId: i.characterId,
@@ -1775,13 +1778,13 @@ function Pt(e) {
1775
1778
  },
1776
1779
  createUtterance(r) {
1777
1780
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
1778
- let i = ht(r);
1781
+ let i = gt(r);
1779
1782
  if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
1780
1783
  let a = r.queue ?? "replace-active";
1781
1784
  if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
1782
1785
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
1783
- let o = new Nt({
1784
- id: kt(),
1786
+ let o = new Pt({
1787
+ id: At(),
1785
1788
  characterId: r.characterId ?? e.getActiveCharacterId(),
1786
1789
  format: i,
1787
1790
  queue: a,
@@ -1793,7 +1796,7 @@ function Pt(e) {
1793
1796
  t === o && (t = null);
1794
1797
  }), r.track && (async () => {
1795
1798
  try {
1796
- if (await Dt({
1799
+ if (await Ot({
1797
1800
  track: r.track,
1798
1801
  utterance: o,
1799
1802
  sampleRate: i.sampleRate,
@@ -1821,16 +1824,16 @@ function Pt(e) {
1821
1824
  }
1822
1825
  //#endregion
1823
1826
  //#region src/v2/types/sessionInteraction.ts
1824
- function Ft(e) {
1827
+ function It(e) {
1825
1828
  let t = e?.trim();
1826
1829
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
1827
1830
  }
1828
1831
  //#endregion
1829
1832
  //#region src/v2/experience.ts
1830
- function It(e) {
1833
+ function Lt(e) {
1831
1834
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
1832
1835
  }
1833
- var Lt = class e {
1836
+ var Rt = class e {
1834
1837
  bootstrap;
1835
1838
  conversationProcessor;
1836
1839
  iframeHost = null;
@@ -1845,16 +1848,16 @@ var Lt = class e {
1845
1848
  attached = !1;
1846
1849
  pendingFit = null;
1847
1850
  closeHandlers = [];
1848
- eventRegistry = $e();
1851
+ eventRegistry = et();
1849
1852
  readyEnvelope = null;
1850
1853
  startedEnvelope = null;
1851
1854
  conversationCache = [];
1852
1855
  speech;
1853
1856
  constructor(e) {
1854
- this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = Pt({
1857
+ this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = Ft({
1855
1858
  getIframeHost: () => this.iframeHost,
1856
1859
  assertSessionStarted: () => this.assertSessionStarted(),
1857
- getCapabilities: () => Rt(this.resolvedSession),
1860
+ getCapabilities: () => zt(this.resolvedSession),
1858
1861
  getActiveCharacterId: () => "character_unknown",
1859
1862
  onProcessorInterrupt: () => {
1860
1863
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -1869,6 +1872,9 @@ var Lt = class e {
1869
1872
  kind: "launch",
1870
1873
  launch: n,
1871
1874
  session: t.session,
1875
+ backdropId: t.backdropId,
1876
+ locationId: t.locationId,
1877
+ avatarId: t.avatarId,
1872
1878
  embedBaseUrl: t.embedBaseUrl,
1873
1879
  debug: t.debug,
1874
1880
  speechOnly: t.speechOnly,
@@ -1886,6 +1892,7 @@ var Lt = class e {
1886
1892
  secondaryLocale: t.secondaryLocale,
1887
1893
  learningLocale: t.learningLocale,
1888
1894
  language: t.language,
1895
+ backdropId: t.backdropId,
1889
1896
  locationId: t.locationId,
1890
1897
  avatarId: t.avatarId,
1891
1898
  castSize: t.castSize,
@@ -1906,6 +1913,7 @@ var Lt = class e {
1906
1913
  secondaryLocale: t.secondaryLocale,
1907
1914
  learningLocale: t.learningLocale,
1908
1915
  language: t.language,
1916
+ backdropId: t.backdropId,
1909
1917
  locationId: t.locationId,
1910
1918
  avatarId: t.avatarId,
1911
1919
  castSize: t.castSize,
@@ -1928,7 +1936,7 @@ var Lt = class e {
1928
1936
  return null;
1929
1937
  }
1930
1938
  on(e, t) {
1931
- let n = et(this.eventRegistry, e, t);
1939
+ let n = tt(this.eventRegistry, e, t);
1932
1940
  return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
1933
1941
  }
1934
1942
  async attach(e) {
@@ -1942,7 +1950,7 @@ var Lt = class e {
1942
1950
  if (this.closed) throw Error("Session has ended.");
1943
1951
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
1944
1952
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
1945
- let t = this.bootstrap.embedBaseUrl ?? qe(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Je(t, n, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.locationId, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, It(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = Xe(i), o = null, s = new Promise((e) => {
1953
+ let t = this.bootstrap.embedBaseUrl ?? qe(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Ye(t, n, r ? void 0 : Je(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Lt(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = Ze(i), o = null, s = new Promise((e) => {
1946
1954
  o = e;
1947
1955
  }), c = null, l = new Promise((e) => {
1948
1956
  c = e;
@@ -2077,7 +2085,7 @@ var Lt = class e {
2077
2085
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2078
2086
  }
2079
2087
  async setFit(e) {
2080
- let t = Ft(e);
2088
+ let t = It(e);
2081
2089
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2082
2090
  if (this.closed) throw Error("Session has ended.");
2083
2091
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
@@ -2091,7 +2099,7 @@ var Lt = class e {
2091
2099
  this.close();
2092
2100
  }
2093
2101
  destroy() {
2094
- this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, nt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2102
+ this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, rt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2095
2103
  }
2096
2104
  resolveMintInteraction() {
2097
2105
  return this.bootstrap.kind === "launch" ? {} : {
@@ -2103,8 +2111,8 @@ var Lt = class e {
2103
2111
  return this.resolvedSession?.id ?? "";
2104
2112
  }
2105
2113
  emitWrapped(e, t) {
2106
- let n = Qe(e, this.getSessionId(), t);
2107
- return tt(this.eventRegistry, e, n), n;
2114
+ let n = $e(e, this.getSessionId(), t);
2115
+ return nt(this.eventRegistry, e, n), n;
2108
2116
  }
2109
2117
  queueProcessorTurn(e) {
2110
2118
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -2163,7 +2171,7 @@ var Lt = class e {
2163
2171
  };
2164
2172
  }
2165
2173
  };
2166
- function Rt(e) {
2174
+ function zt(e) {
2167
2175
  return e ? {
2168
2176
  textSpeech: e.capabilities.speech.output,
2169
2177
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -2174,26 +2182,26 @@ function Rt(e) {
2174
2182
  }
2175
2183
  //#endregion
2176
2184
  //#region src/widget/dockGeometry.ts
2177
- var zt = "(min-width: 768px)", Bt = 24, Vt = .5, Ht = 1200, Ut = .85, Wt = 9 / 16;
2178
- function Gt() {
2185
+ var Bt = "(min-width: 768px)", Vt = 24, Ht = .5, Ut = 1200, Wt = .85, Gt = 9 / 16;
2186
+ function Kt() {
2179
2187
  if (typeof window > "u") return 800;
2180
2188
  let e = window.screen?.availHeight;
2181
2189
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2182
2190
  }
2183
- function Kt(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Bt, r = typeof window < "u" ? Gt() : 800) {
2184
- let i = Math.max(160, Math.min(t - n * 2, t * Ut)), a = Math.max(120, e - n * 2), o = Math.min(r * Vt, Ht, i), s = o * Wt;
2185
- return s > a && (s = a, o = s / Wt, o > i && (o = i, s = o * Wt)), {
2191
+ function qt(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Vt, r = typeof window < "u" ? Kt() : 800) {
2192
+ let i = Math.max(160, Math.min(t - n * 2, t * Wt)), a = Math.max(120, e - n * 2), o = Math.min(r * Ht, Ut, i), s = o * Gt;
2193
+ return s > a && (s = a, o = s / Gt, o > i && (o = i, s = o * Gt)), {
2186
2194
  width: Math.round(s),
2187
2195
  height: Math.round(o)
2188
2196
  };
2189
2197
  }
2190
- function qt(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Bt) {
2198
+ function Jt(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Vt) {
2191
2199
  return {
2192
2200
  left: Math.max(r, t - e.width - r),
2193
2201
  top: Math.max(r, n - e.height - r)
2194
2202
  };
2195
2203
  }
2196
- function Jt(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Bt) {
2204
+ function Yt(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Vt) {
2197
2205
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2198
2206
  return {
2199
2207
  left: Math.min(Math.max(a, e), o),
@@ -2201,14 +2209,14 @@ function Jt(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
2201
2209
  };
2202
2210
  }
2203
2211
  function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2204
- return e(zt).matches;
2212
+ return e(Bt).matches;
2205
2213
  }
2206
2214
  //#endregion
2207
2215
  //#region src/widget/mountExperienceWidget.ts
2208
- function Yt(e) {
2216
+ function Xt(e) {
2209
2217
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2210
2218
  }
2211
- function Xt(e) {
2219
+ function Zt(e) {
2212
2220
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2213
2221
  let t = typeof e == "string" ? e.trim() : "";
2214
2222
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2216,8 +2224,8 @@ function Xt(e) {
2216
2224
  function $(e) {
2217
2225
  return e === "expanded" || e === "docked";
2218
2226
  }
2219
- var Zt = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", Qt = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", $t = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", en = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2220
- function tn(e, t, n) {
2227
+ var Qt = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", $t = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", en = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", tn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2228
+ function nn(e, t, n) {
2221
2229
  re(I);
2222
2230
  let r = c({
2223
2231
  galleryThumb: t.galleryThumb,
@@ -2247,7 +2255,7 @@ function tn(e, t, n) {
2247
2255
  }
2248
2256
  return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ne(i);
2249
2257
  }
2250
- function nn(e) {
2258
+ function rn(e) {
2251
2259
  return e.startButton ? {
2252
2260
  ...e.startButton,
2253
2261
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2259,7 +2267,7 @@ function nn(e) {
2259
2267
  variant: "primary"
2260
2268
  };
2261
2269
  }
2262
- function rn(e) {
2270
+ function an(e) {
2263
2271
  let t = !1, n = () => {
2264
2272
  t || e();
2265
2273
  }, r = () => {
@@ -2279,12 +2287,12 @@ function rn(e) {
2279
2287
  t = !0, window.removeEventListener("load", r), i?.();
2280
2288
  };
2281
2289
  }
2282
- function an(e, t) {
2290
+ function on(e, t) {
2283
2291
  oe(ie);
2284
2292
  let n = t.experienceId?.trim();
2285
2293
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2286
- let r = t.prefetch ?? "onExpand", i = Yt(t.position), a = document.createElement("div");
2287
- a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", Xt(t.offset));
2294
+ let r = t.prefetch ?? "onExpand", i = Xt(t.position), a = document.createElement("div");
2295
+ a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", Zt(t.offset));
2288
2296
  let o = document.createElement("button");
2289
2297
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2290
2298
  let s = document.createElement("div");
@@ -2304,11 +2312,11 @@ function an(e, t) {
2304
2312
  let m = document.createElement("span");
2305
2313
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2306
2314
  let h = document.createElement("button");
2307
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = $t, h.setAttribute("aria-label", "Reduce");
2315
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = en, h.setAttribute("aria-label", "Reduce");
2308
2316
  let g = document.createElement("button");
2309
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Zt, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2317
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Qt, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2310
2318
  let _ = document.createElement("button");
2311
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Qt, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2319
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = $t, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2312
2320
  let v = document.createElement("div");
2313
2321
  v.className = "liforma-ew__stage";
2314
2322
  let y = document.createElement("div");
@@ -2336,11 +2344,11 @@ function an(e, t) {
2336
2344
  p.style.left = `${e + n - a - 10}px`, p.style.top = `${t + 10}px`, p.style.right = "auto", p.style.bottom = "auto", p.style.width = "auto", p.style.height = "auto";
2337
2345
  }, B = (e, t) => {
2338
2346
  if (R() !== "docked") return;
2339
- let n = Kt(), r = Jt(e - te, t - ne, n);
2347
+ let n = qt(), r = Yt(e - te, t - ne, n);
2340
2348
  N = r.left, P = r.top, le(r.left, r.top, n.width, n.height);
2341
2349
  }, de = (e, t) => {
2342
2350
  if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2343
- let n = Kt(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Jt(r + e, i + t, n);
2351
+ let n = qt(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Yt(r + e, i + t, n);
2344
2352
  N = a.left, P = a.top, le(a.left, a.top, n.width, n.height);
2345
2353
  }, fe = (e) => {
2346
2354
  I === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), B(e.clientX, e.clientY)));
@@ -2368,10 +2376,10 @@ function an(e, t) {
2368
2376
  h.hidden = !0;
2369
2377
  return;
2370
2378
  }
2371
- h.hidden = !1, t === "docked" ? (h.innerHTML = en, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = $t, h.setAttribute("aria-label", "Reduce"));
2379
+ h.hidden = !1, t === "docked" ? (h.innerHTML = tn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = en, h.setAttribute("aria-label", "Reduce"));
2372
2380
  }, he = (e) => {
2373
- let t = Kt(), n = e && N !== null && P !== null ? Jt(N, P, t) : qt(t);
2374
- n = Jt(n.left, n.top, t), N = n.left, P = n.top, le(n.left, n.top, t.width, t.height), W();
2381
+ let t = qt(), n = e && N !== null && P !== null ? Yt(N, P, t) : Jt(t);
2382
+ n = Yt(n.left, n.top, t), N = n.left, P = n.top, le(n.left, n.top, t.width, t.height), W();
2375
2383
  }, ge = () => {
2376
2384
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2377
2385
  requestAnimationFrame(() => {
@@ -2418,7 +2426,7 @@ function an(e, t) {
2418
2426
  C = !0, a.dataset.warm = "true", l.hidden = !1, E || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2419
2427
  }, Ce = (e) => {
2420
2428
  k?.(), k = null;
2421
- let t = tn(s, e, { parallax: ae });
2429
+ let t = nn(s, e, { parallax: ae });
2422
2430
  return t ? (k = t, !0) : !1;
2423
2431
  }, we = () => {
2424
2432
  if (Ce(ye)) {
@@ -2447,7 +2455,7 @@ function an(e, t) {
2447
2455
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
2448
2456
  }), Ee = () => ({
2449
2457
  ...t.fit ? { fit: t.fit } : {},
2450
- startButton: nn(t),
2458
+ startButton: rn(t),
2451
2459
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
2452
2460
  }), K = (e = !0) => {
2453
2461
  o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ce(), a.dataset.state = "expanded", G(null), typeof document < "u" && (O = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
@@ -2498,7 +2506,7 @@ function an(e, t) {
2498
2506
  let e = D;
2499
2507
  l.hidden = !1, (async () => {
2500
2508
  try {
2501
- let t = await Lt.startSession(Te());
2509
+ let t = await Rt.startSession(Te());
2502
2510
  if (S || e !== D) {
2503
2511
  t.destroy();
2504
2512
  return;
@@ -2557,7 +2565,7 @@ function an(e, t) {
2557
2565
  x = !0, C = !1, w = !1, T = !1, E = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
2558
2566
  try {
2559
2567
  K();
2560
- let t = await Lt.startSession(Te());
2568
+ let t = await Rt.startSession(Te());
2561
2569
  if (S || e !== D) {
2562
2570
  t.destroy();
2563
2571
  return;
@@ -2641,7 +2649,7 @@ function an(e, t) {
2641
2649
  }
2642
2650
  W();
2643
2651
  }
2644
- }, Ue = typeof window < "u" ? window.matchMedia(zt) : null, We = () => {
2652
+ }, Ue = typeof window < "u" ? window.matchMedia(Bt) : null, We = () => {
2645
2653
  if (!S) {
2646
2654
  if (R() === "docked" && !Q()) {
2647
2655
  J();
@@ -2654,7 +2662,7 @@ function an(e, t) {
2654
2662
  e.stopPropagation(), q();
2655
2663
  }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Y), window.addEventListener("keydown", Ve), window.addEventListener("resize", He), Ue?.addEventListener("change", We), we(), W(), r === "eager" ? queueMicrotask(() => {
2656
2664
  S || Fe();
2657
- }) : r === "idle" && (A = rn(() => {
2665
+ }) : r === "idle" && (A = an(() => {
2658
2666
  S || Fe();
2659
2667
  })), {
2660
2668
  root: a,
@@ -2675,6 +2683,6 @@ function an(e, t) {
2675
2683
  };
2676
2684
  }
2677
2685
  //#endregion
2678
- export { I as EXPERIENCE_THUMBNAIL_CSS, ie as EXPERIENCE_WIDGET_CSS, Lt as Experience, B as LiformaError, X as SPEECH_LIMITS, ut as SpeechBufferTimeoutError, Z as SpeechRuntimeError, lt as SpeechUtteranceClosedError, ct as UnsupportedSpeechOperationError, E as attachImageReady, T as attachLazyThumb, te as attachScrollLinkedParallax, m as buildHostedLaunchUrl, re as ensureExperienceThumbnailStyles, oe as ensureExperienceWidgetStyles, ue as fetchExperiencePreview, ee as getDefaultLazyRootMargin, O as horizontalParallaxFromViewportY, fe as liformaErrorFromResponse, an as mountExperienceWidget, n as navigateOnExperienceClose, h as resolveThumbnailHref, f as resolveThumbnailInteraction, c as resolveThumbnailLayers, r as thumbnailFitClass, s as toGalleryThumbUrl, ye as warnLocaleVoiceFallbacks };
2686
+ export { I as EXPERIENCE_THUMBNAIL_CSS, ie as EXPERIENCE_WIDGET_CSS, Rt as Experience, B as LiformaError, X as SPEECH_LIMITS, dt as SpeechBufferTimeoutError, Z as SpeechRuntimeError, ut as SpeechUtteranceClosedError, lt as UnsupportedSpeechOperationError, E as attachImageReady, T as attachLazyThumb, te as attachScrollLinkedParallax, m as buildHostedLaunchUrl, re as ensureExperienceThumbnailStyles, oe as ensureExperienceWidgetStyles, ue as fetchExperiencePreview, ee as getDefaultLazyRootMargin, O as horizontalParallaxFromViewportY, fe as liformaErrorFromResponse, on as mountExperienceWidget, n as navigateOnExperienceClose, h as resolveThumbnailHref, f as resolveThumbnailInteraction, c as resolveThumbnailLayers, r as thumbnailFitClass, s as toGalleryThumbUrl, ye as warnLocaleVoiceFallbacks };
2679
2687
 
2680
2688
  //# sourceMappingURL=index.js.map