@liforma/client 0.4.14 → 0.4.16

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 (80) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/next/index.js +625 -602
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  5. package/dist/next/thumbnail/avatarPlate.d.ts +11 -0
  6. package/dist/next/thumbnail/avatarPlate.d.ts.map +1 -0
  7. package/dist/next/thumbnail/avatarPlate.test.d.ts +2 -0
  8. package/dist/next/thumbnail/avatarPlate.test.d.ts.map +1 -0
  9. package/dist/next/thumbnail/expandAssetUrl.d.ts +3 -2
  10. package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -1
  11. package/dist/next/thumbnail/index.d.ts +2 -0
  12. package/dist/next/thumbnail/index.d.ts.map +1 -1
  13. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  14. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  15. package/dist/next/thumbnail.js +211 -200
  16. package/dist/next/thumbnail.js.map +1 -1
  17. package/dist/next/v2/embed/protocol.d.ts +7 -7
  18. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  19. package/dist/next/v2/experience.d.ts +8 -5
  20. package/dist/next/v2/experience.d.ts.map +1 -1
  21. package/dist/next/v2/types/sessionLaunch.d.ts +6 -0
  22. package/dist/next/v2/types/sessionLaunch.d.ts.map +1 -1
  23. package/dist/npm/index.js +506 -490
  24. package/dist/npm/index.js.map +1 -1
  25. package/dist/npm/thumbnail/avatarPlate.d.ts +11 -0
  26. package/dist/npm/thumbnail/avatarPlate.d.ts.map +1 -0
  27. package/dist/npm/thumbnail/expandAssetUrl.d.ts +3 -2
  28. package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -1
  29. package/dist/npm/thumbnail/index.d.ts +2 -0
  30. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  31. package/dist/npm/thumbnail/index.js +123 -110
  32. package/dist/npm/thumbnail/index.js.map +1 -1
  33. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  34. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  35. package/dist/npm/v2/embed/protocol.d.ts +7 -7
  36. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  37. package/dist/npm/v2/experience.d.ts +8 -5
  38. package/dist/npm/v2/experience.d.ts.map +1 -1
  39. package/dist/npm/v2/index.d.ts +1 -1
  40. package/dist/npm/v2/index.d.ts.map +1 -1
  41. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  42. package/dist/npm/v2/npm.d.ts +1 -1
  43. package/dist/npm/v2/npm.d.ts.map +1 -1
  44. package/dist/npm/v2/types/index.d.ts +1 -1
  45. package/dist/npm/v2/types/index.d.ts.map +1 -1
  46. package/dist/npm/v2/types/sessionLaunch.d.ts +6 -0
  47. package/dist/npm/v2/types/sessionLaunch.d.ts.map +1 -1
  48. package/dist/react/component/experienceComponentRuntime.d.ts +3 -1
  49. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  50. package/dist/react/component/experienceComponentTypes.d.ts +6 -4
  51. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  52. package/dist/react/index.js +733 -704
  53. package/dist/react/index.js.map +1 -1
  54. package/dist/react/react/Experience.d.ts.map +1 -1
  55. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  56. package/dist/react/thumbnail/avatarPlate.d.ts +11 -0
  57. package/dist/react/thumbnail/avatarPlate.d.ts.map +1 -0
  58. package/dist/react/thumbnail/avatarPlate.test.d.ts +2 -0
  59. package/dist/react/thumbnail/avatarPlate.test.d.ts.map +1 -0
  60. package/dist/react/thumbnail/expandAssetUrl.d.ts +3 -2
  61. package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -1
  62. package/dist/react/thumbnail/index.d.ts +2 -0
  63. package/dist/react/thumbnail/index.d.ts.map +1 -1
  64. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  65. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  66. package/dist/react/thumbnail.js +211 -200
  67. package/dist/react/thumbnail.js.map +1 -1
  68. package/dist/react/v2/embed/protocol.d.ts +7 -7
  69. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  70. package/dist/react/v2/experience.d.ts +8 -5
  71. package/dist/react/v2/experience.d.ts.map +1 -1
  72. package/dist/react/v2/types/sessionLaunch.d.ts +6 -0
  73. package/dist/react/v2/types/sessionLaunch.d.ts.map +1 -1
  74. package/dist/sdk/v2/client.js +3 -3
  75. package/dist/sdk/v2/client.js.map +1 -1
  76. package/dist/sdk/v2/thumbnail.js +2 -2
  77. package/dist/sdk/v2/thumbnail.js.map +1 -1
  78. package/dist/svelte/Experience.svelte +4 -0
  79. package/dist/svelte/ExperienceThumbnail.svelte +3 -0
  80. package/package.json +1 -1
@@ -106,16 +106,28 @@ function y(e) {
106
106
  return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
107
107
  }
108
108
  //#endregion
109
- //#region src/thumbnail/locationPlate.ts
110
- var b = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
109
+ //#region src/thumbnail/avatarPlate.ts
110
+ var b = /(\/avatars\/[^/]+\/)(\d+)(\/)/i;
111
111
  function x(e, t) {
112
- return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
112
+ if (!Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1) return "256";
113
+ let n = Math.max(e, t);
114
+ return n > 512 ? "1024" : n > 280 ? "512" : "256";
113
115
  }
114
116
  function S(e, t) {
115
117
  let n = e.trim();
116
- return n && n.replace(b, (e, n, r, i, a) => `${n}${t}${i}${a}`);
118
+ return n && n.replace(b, (e, n, r, i) => `${n}${t}${i}`);
119
+ }
120
+ //#endregion
121
+ //#region src/thumbnail/locationPlate.ts
122
+ var C = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
123
+ function w(e, t) {
124
+ return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
125
+ }
126
+ function T(e, t) {
127
+ let n = e.trim();
128
+ return n && n.replace(C, (e, n, r, i, a) => `${n}${t}${i}${a}`);
117
129
  }
118
- function C(e, t) {
130
+ function E(e, t) {
119
131
  let n = () => {
120
132
  t(e.clientWidth, e.clientHeight);
121
133
  };
@@ -123,17 +135,17 @@ function C(e, t) {
123
135
  let r = new ResizeObserver(n);
124
136
  return r.observe(e), () => r.disconnect();
125
137
  }
126
- var w = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
127
- function T(e) {
138
+ var D = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
139
+ function O(e) {
128
140
  return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
129
141
  }
130
- function E(e) {
142
+ function k(e) {
131
143
  return /^https?:\/\//i.test(e) || e.startsWith("//");
132
144
  }
133
- function D(e) {
145
+ function A(e) {
134
146
  return e.startsWith("//") ? `https:${e}` : e;
135
147
  }
136
- function O(e) {
148
+ function j(e) {
137
149
  let t = e.indexOf("?");
138
150
  return t === -1 ? {
139
151
  pathname: e,
@@ -143,61 +155,58 @@ function O(e) {
143
155
  search: e.slice(t)
144
156
  };
145
157
  }
146
- function k(e, t, n = "") {
158
+ function M(e, t, n = "") {
147
159
  return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
148
160
  }
149
- function A(e, t, n) {
161
+ function N(e, t, n) {
150
162
  let r = e.trim();
151
163
  if (!r) return r;
152
- let i = T(n);
153
- if (E(r)) return S(D(r), t);
154
- let { pathname: a, search: o } = O(r.replace(/\\/g, "/")), s = a;
164
+ let i = O(n);
165
+ if (k(r)) return T(A(r), t);
166
+ let { pathname: a, search: o } = j(r.replace(/\\/g, "/")), s = a;
155
167
  if (!s.startsWith("/")) s = `/locations/${s.replace(/^locations\//i, "")}`;
156
- else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? k(i, s, o) : r;
157
- if (/\.webp$/i.test(s) && !w.test(s.replace(/\.webp$/i, ""))) return k(i, s, o);
168
+ else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? M(i, s, o) : r;
169
+ if (/\.webp$/i.test(s) && !D.test(s.replace(/\.webp$/i, ""))) return M(i, s, o);
158
170
  let c = s.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
159
- return c = c.replace(w, ""), `${i}/locations/${c}-${t}.webp${o}`;
171
+ return c = c.replace(D, ""), `${i}/locations/${c}-${t}.webp${o}`;
160
172
  }
161
- function j(e, t) {
162
- let n = e.trim();
163
- if (!n) return n;
164
- let r = T(t);
165
- if (E(n)) return D(n);
166
- let { pathname: i, search: a } = O(n.replace(/\\/g, "/")), o = i;
167
- if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
168
- else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
169
- else return n;
170
- if (!/^\/avatars\//i.test(o)) return n;
171
- let s = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
172
- return s && !s.includes("/") && !a ? `${r}/avatars/${s}/256/${s}_neutral.webp` : k(r, o, a);
173
+ function P(e, t, n = "256") {
174
+ let r = e.trim();
175
+ if (!r) return r;
176
+ let i = O(t), a = n;
177
+ if (k(r)) return S(A(r), a);
178
+ let { pathname: o, search: s } = j(r.replace(/\\/g, "/")), c = o;
179
+ if (!c.startsWith("/")) if (/^avatars\//i.test(c)) c = `/${c}`;
180
+ else if (/^[^/]+$/.test(c) && !s) return `${i}/avatars/${c}/${a}/${c}_neutral.webp`;
181
+ else return r;
182
+ if (!/^\/avatars\//i.test(c)) return r;
183
+ let l = c.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
184
+ return l && !l.includes("/") && !s ? `${i}/avatars/${l}/${a}/${l}_neutral.webp` : S(M(i, c, s), a);
173
185
  }
174
186
  //#endregion
175
187
  //#region src/thumbnail/toGalleryThumbUrl.ts
176
- var M = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, ee = /_CH(\.webp)/i;
177
- function N(e) {
188
+ var F = /_CH(\.webp)/i;
189
+ function I(e) {
178
190
  return /\/locations\//i.test(e) || /^locations\//i.test(e) ? !0 : /^https?:\/\//i.test(e) || e.startsWith("//") || /^\/?avatars\//i.test(e) || e.startsWith("/") ? !1 : e.includes("/");
179
191
  }
180
- function P(e, t = "256x256", n) {
181
- let r = e.trim();
182
- if (!r) return r;
183
- if (N(r)) return A(r, t, n);
184
- let i = j(r, n);
185
- return i = i.replace(M, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(ee, "_neutral$1");
192
+ function ee(e, t = "256x256", n, r = "256") {
193
+ let i = e.trim();
194
+ return i && (I(i) ? N(i, t, n) : P(i, n, r).replace(F, "_neutral$1"));
186
195
  }
187
- function F(e) {
196
+ function te(e) {
188
197
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
189
198
  if (!t) return null;
190
- let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = T(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : P(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : A(e, a, o);
199
+ let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = e.avatarPlateSize ?? "256", s = O(e.cdnBaseUrl), c = e.normalize !== !1, l = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : ee(e, a, s, o), u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : N(e, a, s);
191
200
  return {
192
- avatarImage: c(t),
193
- ...n ? { backgroundImage: l(n) } : {},
194
- ...r ? { foregroundImage: l(r) } : {},
195
- ...i ? { fallbackImage: c(i) } : {}
201
+ avatarImage: l(t),
202
+ ...n ? { backgroundImage: u(n) } : {},
203
+ ...r ? { foregroundImage: u(r) } : {},
204
+ ...i ? { fallbackImage: l(i) } : {}
196
205
  };
197
206
  }
198
207
  //#endregion
199
208
  //#region src/shims/localStack.ts
200
- function te() {
209
+ function L() {
201
210
  if (globalThis.__LIFORMA_STACK === "local") return !0;
202
211
  if (typeof location > "u") return !1;
203
212
  try {
@@ -208,70 +217,70 @@ function te() {
208
217
  }
209
218
  //#endregion
210
219
  //#region src/thumbnail/hostedLaunchUrl.ts
211
- var I = "https://player.liforma.ai", L = "http://localhost:3002";
220
+ var R = "https://player.liforma.ai", z = "http://localhost:3002";
212
221
  function ne(e) {
213
222
  return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
214
223
  }
215
- function re(e) {
224
+ function B(e) {
216
225
  let t = e?.trim();
217
- return t ? t.replace(/\/$/, "") : te() ? L : I;
226
+ return t ? t.replace(/\/$/, "") : L() ? z : R;
218
227
  }
219
- function ie(e) {
220
- let t = e.experienceId.trim(), n = re(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
228
+ function re(e) {
229
+ let t = e.experienceId.trim(), n = B(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
221
230
  return i && r.searchParams.set("returnUrl", i), r.toString();
222
231
  }
223
- function R(e) {
232
+ function ie(e) {
224
233
  let t = e.href?.trim();
225
234
  if (t) return t;
226
235
  let n = e.experienceId?.trim();
227
236
  if (!n) return;
228
237
  let r = e.returnUrl?.trim();
229
- return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ie({
238
+ return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), re({
230
239
  experienceId: n,
231
240
  ...r ? { returnUrl: r } : {},
232
241
  playerBaseUrl: e.playerBaseUrl
233
242
  });
234
243
  }
235
- function z() {
244
+ function V() {
236
245
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
237
246
  }
238
- var B = 0, ae = [];
247
+ var H = 0, ae = [];
239
248
  function oe() {
240
- return z() ? 4 : Infinity;
249
+ return V() ? 4 : Infinity;
241
250
  }
242
251
  function se() {
243
- return z() ? 160 : 0;
252
+ return V() ? 160 : 0;
244
253
  }
245
- function ce() {
254
+ function U() {
246
255
  let e = oe();
247
- for (; B < e && ae.length > 0;) {
256
+ for (; H < e && ae.length > 0;) {
248
257
  let e = ae.shift();
249
258
  if (!e || e.cancelled) continue;
250
- B += 1, e.start();
259
+ H += 1, e.start();
251
260
  let t = se();
252
261
  if (t <= 0) {
253
- B = Math.max(0, B - 1);
262
+ H = Math.max(0, H - 1);
254
263
  continue;
255
264
  }
256
265
  window.setTimeout(() => {
257
- B = Math.max(0, B - 1), ce();
266
+ H = Math.max(0, H - 1), U();
258
267
  }, t);
259
268
  }
260
269
  }
261
- function le(e) {
262
- if (!z()) return e(), () => {};
270
+ function ce(e) {
271
+ if (!V()) return e(), () => {};
263
272
  let t = {
264
273
  start: e,
265
274
  cancelled: !1
266
275
  };
267
- return ae.push(t), ce(), () => {
276
+ return ae.push(t), U(), () => {
268
277
  t.cancelled = !0;
269
278
  };
270
279
  }
271
280
  //#endregion
272
281
  //#region src/thumbnail/lazyLoad.ts
273
- function V() {
274
- return z() ? "96px 0px" : "280px 0px";
282
+ function le() {
283
+ return V() ? "96px 0px" : "280px 0px";
275
284
  }
276
285
  function ue(e) {
277
286
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
@@ -283,8 +292,8 @@ function de(e, t) {
283
292
  return n.bottom >= -t && n.top <= window.innerHeight + t;
284
293
  }
285
294
  function fe(e, t) {
286
- let { onVisibleChange: n } = t, r = t.rootMargin ?? V(), i = ue(r), a = !1, o = !1, s = null, c = () => {
287
- o || (s?.(), s = le(() => {
295
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? le(), i = ue(r), a = !1, o = !1, s = null, c = () => {
296
+ o || (s?.(), s = ce(() => {
288
297
  s = null, o = !0, n(!0);
289
298
  }));
290
299
  }, l = (e) => {
@@ -315,46 +324,46 @@ function fe(e, t) {
315
324
  function pe() {
316
325
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
317
326
  }
318
- function H(e, t) {
327
+ function me(e, t) {
319
328
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
320
329
  }
321
- var me = /* @__PURE__ */ new Set(), U = !1, W = 0;
322
- function he() {
323
- if (W = 0, me.size === 0 || typeof window > "u") return;
330
+ var W = /* @__PURE__ */ new Set(), he = !1, ge = 0;
331
+ function G() {
332
+ if (ge = 0, W.size === 0 || typeof window > "u") return;
324
333
  let e = window.innerHeight;
325
- for (let t of me) {
334
+ for (let t of W) {
326
335
  if (t.pointerActive?.()) continue;
327
336
  let n = t.element.getBoundingClientRect();
328
- n.bottom < -64 || n.top > e + 64 || t.onParallax(H(n, e));
337
+ n.bottom < -64 || n.top > e + 64 || t.onParallax(me(n, e));
329
338
  }
330
339
  }
331
- function G() {
332
- W === 0 && (W = requestAnimationFrame(he));
333
- }
334
340
  function K() {
335
- U || typeof window > "u" || (U = !0, window.addEventListener("scroll", G, { passive: !0 }), window.addEventListener("resize", G, { passive: !0 }));
341
+ ge === 0 && (ge = requestAnimationFrame(G));
342
+ }
343
+ function _e() {
344
+ he || typeof window > "u" || (he = !0, window.addEventListener("scroll", K, { passive: !0 }), window.addEventListener("resize", K, { passive: !0 }));
336
345
  }
337
- function ge() {
338
- me.size > 0 || !U || typeof window > "u" || (U = !1, W !== 0 && (cancelAnimationFrame(W), W = 0), window.removeEventListener("scroll", G), window.removeEventListener("resize", G));
346
+ function ve() {
347
+ W.size > 0 || !he || typeof window > "u" || (he = !1, ge !== 0 && (cancelAnimationFrame(ge), ge = 0), window.removeEventListener("scroll", K), window.removeEventListener("resize", K));
339
348
  }
340
- function _e(e, t) {
349
+ function ye(e, t) {
341
350
  if (!pe()) return () => {};
342
351
  let n = {
343
352
  element: e,
344
353
  onParallax: t.onParallax,
345
354
  pointerActive: t.pointerActive
346
355
  };
347
- return me.add(n), K(), n.pointerActive?.() || t.onParallax(H(e.getBoundingClientRect(), window.innerHeight)), () => {
348
- me.delete(n), ge();
356
+ return W.add(n), _e(), n.pointerActive?.() || t.onParallax(me(e.getBoundingClientRect(), window.innerHeight)), () => {
357
+ W.delete(n), ve();
349
358
  };
350
359
  }
351
360
  //#endregion
352
361
  //#region src/thumbnail/attachThumbnailParallax.ts
353
- function ve(e) {
362
+ function be(e) {
354
363
  let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
355
364
  let a = r || i;
356
365
  e.classList.toggle("liforma-et--parallax", a), e.classList.toggle("liforma-et--scroll-parallax", i), e.style.setProperty("--liforma-et-parallax-x", String(t)), e.style.setProperty("--liforma-et-parallax-y", String(n));
357
- }, s = _e(e, {
366
+ }, s = ye(e, {
358
367
  onParallax: (e) => {
359
368
  i = !0, a || (t = e, n = 0, o());
360
369
  },
@@ -367,7 +376,7 @@ function ve(e) {
367
376
  a = !0, e.pointerType === "mouse" && (r = !0), o();
368
377
  }, u = () => {
369
378
  let s = a;
370
- a = !1, r = !1, i && s ? (t = H(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
379
+ a = !1, r = !1, i && s ? (t = me(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
371
380
  }, d = (e) => {
372
381
  e.pointerType === "mouse" && (r = !0, o());
373
382
  }, f = () => {
@@ -379,111 +388,113 @@ function ve(e) {
379
388
  }
380
389
  //#endregion
381
390
  //#region src/thumbnail/styles.ts
382
- var ye = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", be = !1;
383
- function xe(e) {
384
- if (typeof document > "u" || be) return;
391
+ var xe = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", Se = !1;
392
+ function Ce(e) {
393
+ if (typeof document > "u" || Se) return;
385
394
  if (document.querySelector("style[data-liforma-et]")) {
386
- be = !0;
395
+ Se = !0;
387
396
  return;
388
397
  }
389
398
  let t = document.createElement("style");
390
- t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), be = !0;
399
+ t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), Se = !0;
391
400
  }
392
401
  //#endregion
393
402
  //#region src/thumbnail/plateDelivery.ts
394
- var Se = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Ce = null;
395
- function we(e) {
403
+ var we = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Te = null;
404
+ function Ee(e) {
396
405
  let t = e.trim();
397
406
  if (!t || t.startsWith("blob:") || t.startsWith("data:")) return !1;
398
407
  let n = t.split(/[?#]/)[0] ?? t, r = /\/avatars\//i.test(n), i = /\/locations\//i.test(n);
399
408
  return !r && !i || /\.depth\.webp$/i.test(n) ? !1 : /\.webp$/i.test(n);
400
409
  }
401
- function Te(e) {
402
- if (!we(e)) return null;
410
+ function De(e) {
411
+ if (!Ee(e)) return null;
403
412
  let t = e.search(/[?#]/);
404
413
  if (t < 0) return e.replace(/\.webp$/i, ".avif");
405
414
  let n = e.slice(0, t), r = e.slice(t);
406
415
  return `${n.replace(/\.webp$/i, ".avif")}${r}`;
407
416
  }
408
- function Ee() {
409
- return typeof Image > "u" ? Promise.resolve(!1) : (Ce ||= new Promise((e) => {
417
+ function Oe() {
418
+ return typeof Image > "u" ? Promise.resolve(!1) : (Te ||= new Promise((e) => {
410
419
  let t = new Image();
411
- t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = Se;
412
- }), Ce);
420
+ t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = we;
421
+ }), Te);
413
422
  }
414
- function De(e, t) {
415
- return t ? Te(e) ?? e : e;
423
+ function ke(e, t) {
424
+ return t ? De(e) ?? e : e;
416
425
  }
417
- function Oe(e) {
426
+ function Ae(e) {
418
427
  let t = e.trim(), n = t.search(/[?#]/), r = n < 0 ? t : t.slice(0, n);
419
428
  if (!/\.avif$/i.test(r)) return null;
420
429
  let i = r.replace(/\.avif$/i, ".webp");
421
430
  return n < 0 ? i : `${i}${t.slice(n)}`;
422
431
  }
423
- function ke(e) {
432
+ function je(e) {
424
433
  let t = e.trim();
425
434
  return /-400x225\.(webp|avif)(?:$|[?#])/i.test(t) ? t.replace(/-400x225\.(webp|avif)/i, "-800x450.$1") : null;
426
435
  }
427
436
  //#endregion
428
437
  //#region src/react/ExperienceThumbnail.tsx
429
- function Ae(e, t) {
438
+ function Me(e, t) {
430
439
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
431
440
  }
432
- function je(s) {
433
- let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: w = "full", lazy: T = !0, className: E = "", fallbackImage: D, normalizeUrls: O = !0, cdnBaseUrl: k } = s, A = n(null), j = n(!1), [M, ee] = r(0), [N, P] = r(0), te = x(M, N), I = t(() => F({
441
+ function Ne(s) {
442
+ let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: C = "full", lazy: T = !0, className: D = "", fallbackImage: O, normalizeUrls: k = !0, cdnBaseUrl: A } = s, j = n(null), M = n(!1), [N, P] = r(0), [F, I] = r(0), ee = w(N, F), L = x(N, F), R = t(() => te({
434
443
  galleryThumb: c,
435
444
  avatarImage: l,
436
445
  backgroundImage: u,
437
446
  foregroundImage: d,
438
- fallbackImage: D,
439
- normalize: O,
440
- locationPlateSize: te,
441
- cdnBaseUrl: k
447
+ fallbackImage: O,
448
+ normalize: k,
449
+ locationPlateSize: ee,
450
+ avatarPlateSize: L,
451
+ cdnBaseUrl: A
442
452
  }), [
443
453
  c,
444
454
  l,
445
455
  u,
446
456
  d,
447
- D,
448
457
  O,
449
- te,
450
- k
451
- ]), L = ne({
458
+ k,
459
+ ee,
460
+ L,
461
+ A
462
+ ]), z = ne({
452
463
  href: m,
453
464
  hasClickHandler: typeof _ == "function",
454
465
  experienceId: p
455
- }), re = L === "anchor" && !m?.trim() && !!p?.trim(), ie = !!I?.backgroundImage, z = S !== !1, [B, ae] = r(!T), [oe, se] = r(!1), [ce, le] = r(!1), [V, ue] = r(!1), [de, pe] = r(!1), [me, U] = r(!1), [W, he] = r(!1), [G, K] = r(!1), [ge, ve] = r(0), [be, Se] = r(0), [Ce, we] = r(!1), [Te, je] = r(!1), [Me, Ne] = r(!1), [Pe, Fe] = r(!1), [q, Ie] = r(), Le = I ? Ce && I.fallbackImage ? I.fallbackImage : I.avatarImage : "";
466
+ }), B = z === "anchor" && !m?.trim() && !!p?.trim(), re = !!R?.backgroundImage, V = S !== !1, [H, ae] = r(!T), [oe, se] = r(!1), [U, ce] = r(!1), [le, ue] = r(!1), [de, pe] = r(!1), [W, he] = r(!1), [ge, G] = r(!1), [K, _e] = r(!1), [ve, be] = r(0), [Se, we] = r(0), [Te, Ee] = r(!1), [De, Ne] = r(!1), [Pe, q] = r(!1), [Fe, Ie] = r(!1), [Le, Re] = r(), ze = R ? Te && R.fallbackImage ? R.fallbackImage : R.avatarImage : "";
456
467
  e(() => {
457
- xe(ye), Ee().then((e) => {
458
- se(e), le(!0);
468
+ Ce(xe), Oe().then((e) => {
469
+ se(e), ce(!0);
459
470
  });
460
471
  }, []), e(() => {
461
- Ie(R({
472
+ Re(ie({
462
473
  href: m,
463
474
  experienceId: p,
464
475
  returnUrl: v,
465
476
  playerBaseUrl: b,
466
- useCurrentPageAsReturnUrl: re && !v?.trim()
477
+ useCurrentPageAsReturnUrl: B && !v?.trim()
467
478
  }));
468
479
  }, [
469
480
  m,
470
481
  p,
471
482
  v,
472
483
  b,
473
- re
484
+ B
474
485
  ]), e(() => {
475
- je(!1), Ne(!1), Fe(!1), we(!1), ue(!1), pe(!1), U(!1);
486
+ Ne(!1), q(!1), Ie(!1), Ee(!1), ue(!1), pe(!1), he(!1);
476
487
  }, [
477
- I?.backgroundImage,
478
- I?.foregroundImage,
479
- Le
488
+ R?.backgroundImage,
489
+ R?.foregroundImage,
490
+ ze
480
491
  ]), e(() => {
481
- let e = A.current;
482
- if (e) return C(e, (e, t) => {
483
- ee(e), P(t);
492
+ let e = j.current;
493
+ if (e) return E(e, (e, t) => {
494
+ P(e), I(t);
484
495
  });
485
- }, [L, q]), e(() => {
486
- let e = A.current;
496
+ }, [z, Le]), e(() => {
497
+ let e = j.current;
487
498
  if (e) {
488
499
  if (!T) {
489
500
  ae(!0);
@@ -495,40 +506,40 @@ function je(s) {
495
506
  }
496
507
  }, [
497
508
  T,
498
- I,
499
- L,
500
- q
509
+ R,
510
+ z,
511
+ Le
501
512
  ]), e(() => {
502
- let e = A.current;
503
- if (!(!e || !z)) return _e(e, {
513
+ let e = j.current;
514
+ if (!(!e || !V)) return ye(e, {
504
515
  onParallax: (e) => {
505
- K(!0), j.current || (ve(e), Se(0));
516
+ _e(!0), M.current || (be(e), we(0));
506
517
  },
507
- pointerActive: () => j.current
518
+ pointerActive: () => M.current
508
519
  });
509
520
  }, [
521
+ V,
522
+ R,
510
523
  z,
511
- I,
512
- L,
513
- q
524
+ Le
514
525
  ]);
515
- let Re = (e) => {
516
- if (!z || G) return;
526
+ let Be = (e) => {
527
+ if (!V || K) return;
517
528
  let t = e.currentTarget.getBoundingClientRect();
518
- t.width <= 0 || t.height <= 0 || (ve(((e.clientX - t.left) / t.width - .5) * 2), Se(((e.clientY - t.top) / t.height - .5) * 2));
519
- }, ze = (e) => {
520
- let t = j.current;
521
- j.current = !1, he(!1), G && t ? (ve(H(e.getBoundingClientRect(), window.innerHeight)), Se(0)) : G || (ve(0), Se(0));
529
+ t.width <= 0 || t.height <= 0 || (be(((e.clientX - t.left) / t.width - .5) * 2), we(((e.clientY - t.top) / t.height - .5) * 2));
530
+ }, Ve = (e) => {
531
+ let t = M.current;
532
+ M.current = !1, G(!1), K && t ? (be(me(e.getBoundingClientRect(), window.innerHeight)), we(0)) : K || (be(0), we(0));
522
533
  }, J = (e) => {
523
- if (!z) return;
524
- j.current = !0, e.pointerType === "mouse" && he(!0);
534
+ if (!V) return;
535
+ M.current = !0, e.pointerType === "mouse" && G(!0);
525
536
  let t = e.currentTarget, n = () => {
526
- ze(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
537
+ Ve(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
527
538
  };
528
539
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
529
- }, Be = (e) => {
530
- if (_?.(e), !e.defaultPrevented && re && !v?.trim()) {
531
- let t = R({
540
+ }, He = (e) => {
541
+ if (_?.(e), !e.defaultPrevented && B && !v?.trim()) {
542
+ let t = ie({
532
543
  experienceId: p,
533
544
  playerBaseUrl: b,
534
545
  useCurrentPageAsReturnUrl: !0
@@ -536,154 +547,154 @@ function je(s) {
536
547
  t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
537
548
  }
538
549
  };
539
- if (!I) return null;
540
- let Ve = z && (W || G), He = B && ce && (Me || Te || Pe), Ue = [
550
+ if (!R) return null;
551
+ let Ue = V && (ge || K), We = H && U && (Pe || De || Fe), Ge = [
541
552
  "liforma-et",
542
- ie ? "liforma-et--scene" : "",
543
- y(w),
544
- Ve ? "liforma-et--parallax" : "",
545
- G ? "liforma-et--scroll-parallax" : "",
546
- B && !He ? "liforma-et--loading" : "",
547
- He ? "liforma-et--revealed" : "",
548
- E
553
+ re ? "liforma-et--scene" : "",
554
+ y(C),
555
+ Ue ? "liforma-et--parallax" : "",
556
+ K ? "liforma-et--scroll-parallax" : "",
557
+ H && !We ? "liforma-et--loading" : "",
558
+ We ? "liforma-et--revealed" : "",
559
+ D
549
560
  ].filter(Boolean).join(" "), Y = {
550
- "--liforma-et-parallax-x": ge,
551
- "--liforma-et-parallax-y": be
552
- }, We = (e, t) => {
561
+ "--liforma-et-parallax-x": ve,
562
+ "--liforma-et-parallax-y": Se
563
+ }, Ke = (e, t) => {
553
564
  e.complete && t(!0);
554
- }, Ge = /* @__PURE__ */ o(i, { children: [
565
+ }, qe = /* @__PURE__ */ o(i, { children: [
555
566
  /* @__PURE__ */ a("span", {
556
567
  className: "liforma-et__placeholder",
557
568
  "aria-hidden": "true"
558
569
  }),
559
- B && ce && I.backgroundImage ? /* @__PURE__ */ a("img", {
560
- className: Ae("liforma-et__background", Te),
561
- src: De(I.backgroundImage, oe),
570
+ H && U && R.backgroundImage ? /* @__PURE__ */ a("img", {
571
+ className: Me("liforma-et__background", De),
572
+ src: ke(R.backgroundImage, oe),
562
573
  alt: "",
563
574
  decoding: "async",
564
575
  ref: (e) => {
565
- e && We(e, je);
576
+ e && Ke(e, Ne);
566
577
  },
567
- onLoad: () => je(!0),
578
+ onLoad: () => Ne(!0),
568
579
  onError: (e) => {
569
- let t = e.currentTarget, n = ke(t.src);
570
- if (n && !V) {
580
+ let t = e.currentTarget, n = je(t.src);
581
+ if (n && !le) {
571
582
  ue(!0), t.src = n;
572
583
  return;
573
584
  }
574
- je(!0);
585
+ Ne(!0);
575
586
  }
576
587
  }) : null,
577
- B && ce && Le ? /* @__PURE__ */ a("img", {
578
- className: Ae("liforma-et__avatar", Me),
579
- src: De(Le, oe),
588
+ H && U && ze ? /* @__PURE__ */ a("img", {
589
+ className: Me("liforma-et__avatar", Pe),
590
+ src: ke(ze, oe),
580
591
  alt: "",
581
592
  decoding: "async",
582
593
  ref: (e) => {
583
- e && We(e, Ne);
594
+ e && Ke(e, q);
584
595
  },
585
- onLoad: () => Ne(!0),
596
+ onLoad: () => q(!0),
586
597
  onError: (e) => {
587
- let t = e.currentTarget, n = Oe(t.src);
588
- if (n && !me) {
589
- U(!0), t.src = n;
598
+ let t = e.currentTarget, n = Ae(t.src);
599
+ if (n && !W) {
600
+ he(!0), t.src = n;
590
601
  return;
591
602
  }
592
- I.fallbackImage ? we(!0) : Ne(!0);
603
+ R.fallbackImage ? Ee(!0) : q(!0);
593
604
  }
594
605
  }) : null,
595
- B && ce && I.foregroundImage ? /* @__PURE__ */ a("img", {
596
- className: Ae("liforma-et__foreground", Pe),
597
- src: De(I.foregroundImage, oe),
606
+ H && U && R.foregroundImage ? /* @__PURE__ */ a("img", {
607
+ className: Me("liforma-et__foreground", Fe),
608
+ src: ke(R.foregroundImage, oe),
598
609
  alt: "",
599
610
  decoding: "async",
600
611
  ref: (e) => {
601
- e && We(e, Fe);
612
+ e && Ke(e, Ie);
602
613
  },
603
- onLoad: () => Fe(!0),
614
+ onLoad: () => Ie(!0),
604
615
  onError: (e) => {
605
- let t = e.currentTarget, n = ke(t.src);
616
+ let t = e.currentTarget, n = je(t.src);
606
617
  if (n && !de) {
607
618
  pe(!0), t.src = n;
608
619
  return;
609
620
  }
610
- Fe(!0);
621
+ Ie(!0);
611
622
  }
612
623
  }) : null
613
- ] }), Ke = {
624
+ ] }), Je = {
614
625
  onPointerDown: J,
615
- onPointerUp: (e) => ze(e.currentTarget),
616
- onPointerCancel: (e) => ze(e.currentTarget),
626
+ onPointerUp: (e) => Ve(e.currentTarget),
627
+ onPointerCancel: (e) => Ve(e.currentTarget),
617
628
  onPointerEnter: (e) => {
618
- z && e.pointerType === "mouse" && he(!0);
629
+ V && e.pointerType === "mouse" && G(!0);
619
630
  },
620
- onPointerMove: Re,
631
+ onPointerMove: Be,
621
632
  onPointerLeave: () => {
622
- j.current || (he(!1), G || (ve(0), Se(0)));
633
+ M.current || (G(!1), K || (be(0), we(0)));
623
634
  }
624
- }, qe = (e) => {
625
- A.current = e;
635
+ }, Ye = (e) => {
636
+ j.current = e;
626
637
  };
627
- return L === "anchor" && q ? /* @__PURE__ */ a("a", {
628
- ref: qe,
629
- className: Ue,
638
+ return z === "anchor" && Le ? /* @__PURE__ */ a("a", {
639
+ ref: Ye,
640
+ className: Ge,
630
641
  style: Y,
631
- href: q,
642
+ href: Le,
632
643
  target: h,
633
644
  rel: g,
634
645
  "aria-label": f,
635
- onClick: Be,
636
- ...Ke,
637
- children: Ge
638
- }) : L === "button" ? /* @__PURE__ */ a("button", {
646
+ onClick: He,
647
+ ...Je,
648
+ children: qe
649
+ }) : z === "button" ? /* @__PURE__ */ a("button", {
639
650
  type: "button",
640
- ref: qe,
641
- className: Ue,
651
+ ref: Ye,
652
+ className: Ge,
642
653
  style: Y,
643
654
  "aria-label": f,
644
- onClick: Be,
645
- ...Ke,
646
- children: Ge
655
+ onClick: He,
656
+ ...Je,
657
+ children: qe
647
658
  }) : /* @__PURE__ */ a("div", {
648
- ref: qe,
649
- className: Ue,
659
+ ref: Ye,
660
+ className: Ge,
650
661
  style: Y,
651
662
  role: f ? "img" : void 0,
652
663
  "aria-label": f || void 0,
653
664
  "aria-hidden": f ? void 0 : !0,
654
- ...Ke,
655
- children: Ge
665
+ ...Je,
666
+ children: qe
656
667
  });
657
668
  }
658
669
  //#endregion
659
670
  //#region src/widget/styles.ts
660
- var Me = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", Ne = "liforma-experience-widget-styles";
661
- function Pe(e = Me) {
671
+ var Pe = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", q = "liforma-experience-widget-styles";
672
+ function Fe(e = Pe) {
662
673
  if (typeof document > "u") return;
663
- let t = document.getElementById(Ne);
674
+ let t = document.getElementById(q);
664
675
  if (t) {
665
676
  t.textContent = e;
666
677
  return;
667
678
  }
668
679
  let n = document.createElement("style");
669
- n.id = Ne, n.textContent = e, document.head.append(n);
680
+ n.id = q, n.textContent = e, document.head.append(n);
670
681
  }
671
682
  //#endregion
672
683
  //#region src/shims/apiBaseUrl.ts
673
- var Fe = "https://api.liforma.ai", q = "http://localhost:3001";
674
- function Ie() {
684
+ var Ie = "https://api.liforma.ai", Le = "http://localhost:3001";
685
+ function Re() {
675
686
  let e = globalThis.__LIFORMA_API_BASE_URL;
676
687
  if (e?.trim()) return e.trim().replace(/\/$/, "");
677
688
  if (typeof document > "u") return null;
678
689
  let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-api-base-url")?.trim();
679
690
  return t ? t.replace(/\/$/, "") : null;
680
691
  }
681
- function Le() {
682
- return Ie() || (te() ? q : Fe);
692
+ function ze() {
693
+ return Re() || (L() ? Le : Ie);
683
694
  }
684
695
  //#endregion
685
696
  //#region src/v2/api/fetchExperiencePreview.ts
686
- function Re(e) {
697
+ function Be(e) {
687
698
  if (!e || typeof e != "object") return null;
688
699
  let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
689
700
  return n ? {
@@ -692,10 +703,10 @@ function Re(e) {
692
703
  ...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
693
704
  } : null;
694
705
  }
695
- async function ze(e, t) {
706
+ async function Ve(e, t) {
696
707
  let n = e.trim();
697
708
  if (!n) throw Error("Experience preview requires experienceId.");
698
- let r = (t?.apiBaseUrl ?? Le()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
709
+ let r = (t?.apiBaseUrl ?? ze()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
699
710
  method: "GET",
700
711
  headers: { Accept: "application/json" },
701
712
  signal: t?.signal
@@ -715,7 +726,7 @@ async function ze(e, t) {
715
726
  throw Error("Experience preview returned invalid JSON.");
716
727
  }
717
728
  if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
718
- let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Re(o.galleryThumb);
729
+ let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Be(o.galleryThumb);
719
730
  if (!l) throw Error("Experience preview is missing gallery thumb images.");
720
731
  return {
721
732
  experienceId: s || n,
@@ -734,15 +745,15 @@ var J = class extends Error {
734
745
  super(e, t?.cause === void 0 ? void 0 : { cause: t.cause }), this.name = "LiformaError", this.code = t?.code?.trim() || "UNKNOWN", this.requestId = t?.requestId?.trim() || void 0, this.status = t?.status, this.details = t?.details;
735
746
  }
736
747
  };
737
- function Be(e) {
748
+ function He(e) {
738
749
  if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
739
750
  }
740
- function Ve(e, t, n) {
751
+ function Ue(e, t, n) {
741
752
  let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
742
753
  try {
743
754
  i = JSON.parse(t);
744
755
  } catch {}
745
- let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = Be(a) ?? Be(i) ?? {};
756
+ let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = He(a) ?? He(i) ?? {};
746
757
  return new J(u, {
747
758
  code: l,
748
759
  requestId: d,
@@ -752,13 +763,13 @@ function Ve(e, t, n) {
752
763
  }
753
764
  //#endregion
754
765
  //#region src/v2/api/captureAttribution.ts
755
- var He = 128, Ue = /[\u0000-\u001f\u007f]/g;
766
+ var We = 128, Ge = /[\u0000-\u001f\u007f]/g;
756
767
  function Y(e) {
757
768
  if (!e) return;
758
- let t = e.replace(Ue, "").trim();
759
- if (t) return t.slice(0, He);
769
+ let t = e.replace(Ge, "").trim();
770
+ if (t) return t.slice(0, We);
760
771
  }
761
- function We(e) {
772
+ function Ke(e) {
762
773
  let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
763
774
  return {
764
775
  ...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
@@ -768,7 +779,7 @@ function We(e) {
768
779
  ...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
769
780
  };
770
781
  }
771
- function Ge(e) {
782
+ function qe(e) {
772
783
  if (e === !1) return;
773
784
  if (e && typeof e == "object") {
774
785
  let t = {
@@ -782,7 +793,7 @@ function Ge(e) {
782
793
  return Object.keys(t).length ? t : void 0;
783
794
  }
784
795
  if (typeof window > "u") return;
785
- let t = We(window.location?.search), n = Y(document.referrer || void 0), r = {
796
+ let t = Ke(window.location?.search), n = Y(document.referrer || void 0), r = {
786
797
  ...t,
787
798
  ...n ? { referrer: n } : {}
788
799
  };
@@ -790,19 +801,19 @@ function Ge(e) {
790
801
  }
791
802
  //#endregion
792
803
  //#region src/v2/api/sessionEndpointRequest.ts
793
- function Ke(e) {
804
+ function Je(e) {
794
805
  let t = e.locale?.trim();
795
806
  if (t) return t;
796
807
  let n = e.language?.trim();
797
808
  if (n) return n;
798
809
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
799
810
  }
800
- function qe(e) {
811
+ function Ye(e) {
801
812
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
802
813
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
803
814
  return t || n || void 0;
804
815
  }
805
- function Je(e, t) {
816
+ function Xe(e, t) {
806
817
  let n = e.trim();
807
818
  if (!n) throw Error("sessionEndpoint must not be empty.");
808
819
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -810,7 +821,7 @@ function Je(e, t) {
810
821
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
811
822
  let i = t.experienceId.trim();
812
823
  if (!i) throw Error("sessionEndpoint requires experienceId.");
813
- let a = Ke(t), o = qe(t), s = t.idempotencyKey?.trim();
824
+ let a = Je(t), o = Ye(t), s = t.idempotencyKey?.trim();
814
825
  return {
815
826
  url: r.toString(),
816
827
  init: {
@@ -829,7 +840,7 @@ function Je(e, t) {
829
840
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
830
841
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
831
842
  ...(() => {
832
- let e = Ge(t.attribution);
843
+ let e = qe(t.attribution);
833
844
  return e ? { attribution: e } : {};
834
845
  })(),
835
846
  ...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
@@ -839,16 +850,19 @@ function Je(e, t) {
839
850
  }
840
851
  //#endregion
841
852
  //#region src/v2/types/sessionLaunch.ts
842
- function Ye(e) {
853
+ function Ze(e, t) {
854
+ return t === void 0 ? {} : { [e]: t };
855
+ }
856
+ function Qe(e) {
843
857
  return !!e && typeof e == "object" && !Array.isArray(e);
844
858
  }
845
859
  function X(e) {
846
860
  return typeof e == "boolean";
847
861
  }
848
- function Xe(e) {
849
- if (!Ye(e)) return null;
862
+ function $e(e) {
863
+ if (!Qe(e)) return null;
850
864
  let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
851
- return !Ye(t) || !Ye(n) || !Ye(r) || !Ye(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
865
+ return !Qe(t) || !Qe(n) || !Qe(r) || !Qe(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
852
866
  speech: {
853
867
  input: t.input,
854
868
  output: t.output,
@@ -859,8 +873,8 @@ function Xe(e) {
859
873
  tools: { enabled: i.enabled }
860
874
  };
861
875
  }
862
- function Ze(e) {
863
- return !Ye(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
876
+ function et(e) {
877
+ return !Qe(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
864
878
  speech: {
865
879
  input: e.speechInput,
866
880
  output: e.speechOutput,
@@ -871,12 +885,12 @@ function Ze(e) {
871
885
  tools: { enabled: e.tools }
872
886
  };
873
887
  }
874
- function Qe(e) {
875
- return Xe(e) ?? Ze(e);
888
+ function tt(e) {
889
+ return $e(e) ?? et(e);
876
890
  }
877
- function $e(e) {
878
- if (!Ye(e)) throw Error("Session Launch response is missing session.");
879
- let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = Qe(e.capabilities), l = et(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
891
+ function nt(e) {
892
+ if (!Qe(e)) throw Error("Session Launch response is missing session.");
893
+ let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = tt(e.capabilities), l = rt(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
880
894
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
881
895
  return {
882
896
  id: t,
@@ -892,11 +906,11 @@ function $e(e) {
892
906
  ...d ? { createdAt: d } : {}
893
907
  };
894
908
  }
895
- function et(e) {
909
+ function rt(e) {
896
910
  if (!Array.isArray(e) || e.length === 0) return;
897
911
  let t = [];
898
912
  for (let n of e) {
899
- if (!Ye(n)) continue;
913
+ if (!Qe(n)) continue;
900
914
  let e = n.axis === "locale" || n.axis === "secondaryLocale" ? n.axis : null, r = typeof n.requested == "string" ? n.requested.trim() : "", i = typeof n.resolved == "string" ? n.resolved.trim() : "";
901
915
  !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
902
916
  axis: e,
@@ -907,35 +921,35 @@ function et(e) {
907
921
  }
908
922
  return t.length > 0 ? t : void 0;
909
923
  }
910
- function tt(e) {
924
+ function it(e) {
911
925
  let t = e.localeVoiceFallbacks;
912
926
  if (t?.length) for (let e of t) {
913
927
  let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
914
928
  console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
915
929
  }
916
930
  }
917
- function nt(e) {
918
- if (!Ye(e)) throw Error("Session Launch response must be a JSON object.");
931
+ function at(e) {
932
+ if (!Qe(e)) throw Error("Session Launch response must be a JSON object.");
919
933
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
920
934
  if (!t) throw Error("Session Launch response is missing launch.");
921
- let n = $e(e.session);
922
- return tt(n), {
935
+ let n = nt(e.session);
936
+ return it(n), {
923
937
  session: n,
924
938
  launch: t
925
939
  };
926
940
  }
927
941
  //#endregion
928
942
  //#region src/v2/api/mintPublicSession.ts
929
- function rt() {
943
+ function ot() {
930
944
  try {
931
945
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
932
946
  } catch {}
933
947
  }
934
- function it(e) {
948
+ function st(e) {
935
949
  return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
936
950
  }
937
- function at(e, t) {
938
- let n = rt(), r = it(t.code), i = t.message.trim(), a = t.details ?? {};
951
+ function ct(e, t) {
952
+ let n = ot(), r = st(t.code), i = t.message.trim(), a = t.details ?? {};
939
953
  if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
940
954
  if (i.includes(e) && i.includes("allowed origin")) return t;
941
955
  let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
@@ -958,38 +972,38 @@ function at(e, t) {
958
972
  details: a
959
973
  }) : t;
960
974
  }
961
- function ot(e) {
975
+ function lt(e) {
962
976
  let t = e?.locale?.trim();
963
977
  if (t) return t;
964
978
  let n = e?.language?.trim();
965
979
  if (n) return n;
966
980
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
967
981
  }
968
- function st(e) {
982
+ function ut(e) {
969
983
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
970
984
  if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
971
985
  return t || n || void 0;
972
986
  }
973
- function ct(e, t) {
974
- let n = { experienceId: e }, r = ot(t);
987
+ function dt(e, t) {
988
+ let n = { experienceId: e }, r = lt(t);
975
989
  r && (n.locale = r);
976
- let i = st(t);
990
+ let i = ut(t);
977
991
  i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
978
- let a = Ge(t?.attribution);
992
+ let a = qe(t?.attribution);
979
993
  return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
980
994
  }
981
- async function lt(e, t) {
982
- let n = Le(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
995
+ async function ft(e, t) {
996
+ let n = ze(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
983
997
  method: "POST",
984
998
  headers: {
985
999
  "Content-Type": "application/json",
986
1000
  ...r ? { "Idempotency-Key": r } : {}
987
1001
  },
988
- body: JSON.stringify(ct(e, t))
1002
+ body: JSON.stringify(dt(e, t))
989
1003
  });
990
1004
  if (!i.ok) {
991
1005
  let t = await i.text();
992
- throw at(e, Ve(i.status, t, i.headers));
1006
+ throw ct(e, Ue(i.status, t, i.headers));
993
1007
  }
994
1008
  let a;
995
1009
  try {
@@ -1001,10 +1015,10 @@ async function lt(e, t) {
1001
1015
  requestId: i.headers.get("Liforma-Request-Id") ?? void 0
1002
1016
  });
1003
1017
  }
1004
- return nt(a);
1018
+ return at(a);
1005
1019
  }
1006
- async function ut(e, t) {
1007
- let n = Je(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1020
+ async function pt(e, t) {
1021
+ let n = Xe(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1008
1022
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
1009
1023
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
1010
1024
  try {
@@ -1017,7 +1031,7 @@ async function ut(e, t) {
1017
1031
  }
1018
1032
  if (!o.ok) {
1019
1033
  let e = await o.text();
1020
- throw Ve(o.status, e, o.headers);
1034
+ throw Ue(o.status, e, o.headers);
1021
1035
  }
1022
1036
  if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
1023
1037
  code: "INVALID_RESPONSE",
@@ -1034,14 +1048,14 @@ async function ut(e, t) {
1034
1048
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
1035
1049
  });
1036
1050
  }
1037
- return nt(s);
1051
+ return at(s);
1038
1052
  }
1039
1053
  //#endregion
1040
1054
  //#region src/v2/conversationProcessor.ts
1041
- function dt(e) {
1055
+ function mt(e) {
1042
1056
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
1043
1057
  }
1044
- function ft(e) {
1058
+ function ht(e) {
1045
1059
  if (typeof e == "string") {
1046
1060
  let t = e.trim();
1047
1061
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -1055,24 +1069,24 @@ function ft(e) {
1055
1069
  ...e.behavior ? { behavior: e.behavior } : {}
1056
1070
  };
1057
1071
  }
1058
- async function pt(e, t) {
1072
+ async function gt(e, t) {
1059
1073
  let n = await e(t);
1060
- return dt(n) ? {
1074
+ return mt(n) ? {
1061
1075
  kind: "stream",
1062
1076
  stream: n
1063
1077
  } : {
1064
1078
  kind: "complete",
1065
- speech: ft(n)
1079
+ speech: ht(n)
1066
1080
  };
1067
1081
  }
1068
1082
  //#endregion
1069
1083
  //#region src/v2/embed/playerReachability.ts
1070
- var mt = "3002";
1071
- function ht(e) {
1084
+ var _t = "3002";
1085
+ function vt(e) {
1072
1086
  let t = new URL(e);
1073
- return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || mt}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
1087
+ return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || _t}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
1074
1088
  }
1075
- async function gt(e, t) {
1089
+ async function yt(e, t) {
1076
1090
  try {
1077
1091
  await fetch(e, {
1078
1092
  method: "GET",
@@ -1080,25 +1094,25 @@ async function gt(e, t) {
1080
1094
  signal: AbortSignal.timeout(8e3)
1081
1095
  });
1082
1096
  } catch {
1083
- throw Error(ht(t));
1097
+ throw Error(vt(t));
1084
1098
  }
1085
1099
  }
1086
- function _t(e, t, n, r) {
1100
+ function bt(e, t, n, r) {
1087
1101
  try {
1088
1102
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
1089
1103
  } catch (e) {
1090
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(ht(n), { cause: e }) : e;
1104
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(vt(n), { cause: e }) : e;
1091
1105
  }
1092
1106
  }
1093
- var vt = new Set([1, 2]);
1094
- function yt(e) {
1095
- return typeof e == "number" && vt.has(e);
1107
+ var xt = new Set([1, 2]);
1108
+ function St(e) {
1109
+ return typeof e == "number" && xt.has(e);
1096
1110
  }
1097
- var bt = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
1098
- function xt(e) {
1111
+ var Ct = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
1112
+ function wt(e) {
1099
1113
  if (!e || typeof e != "object") return null;
1100
1114
  let t = e;
1101
- if (!yt(t.schemaVersion) || !t.type || !bt.has(t.type)) return null;
1115
+ if (!St(t.schemaVersion) || !t.type || !Ct.has(t.type)) return null;
1102
1116
  if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
1103
1117
  if (t.type === "fullWindow" || t.type === "theatre") {
1104
1118
  let e = t.payload;
@@ -1121,10 +1135,13 @@ function xt(e) {
1121
1135
  let n = t.payload;
1122
1136
  return !n || typeof n != "object" ? null : t;
1123
1137
  }
1124
- function St(e, t, n) {
1138
+ function Tt(e, t) {
1139
+ return t === void 0 ? {} : { [e]: t };
1140
+ }
1141
+ function Et(e, t, n) {
1125
1142
  let r = e.trim();
1126
1143
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
1127
- let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatreButton, l = n?.theatre;
1144
+ let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatre;
1128
1145
  return {
1129
1146
  type: "launch",
1130
1147
  schemaVersion: 2,
@@ -1135,32 +1152,34 @@ function St(e, t, n) {
1135
1152
  ...a ? { theme: a } : {},
1136
1153
  ...o === void 0 ? {} : { showFeedback: o },
1137
1154
  ...s ? { interaction: s } : {},
1138
- ...c ? { theatreButton: !0 } : {},
1139
- ...l === void 0 ? {} : { theatre: l }
1155
+ ...Tt("settingsButton", n?.settingsButton),
1156
+ ...Tt("theatreButton", n?.theatreButton),
1157
+ ...Tt("fullscreenButton", n?.fullscreenButton),
1158
+ ...c === void 0 ? {} : { theatre: c }
1140
1159
  }
1141
1160
  };
1142
1161
  }
1143
- function Ct() {
1162
+ function Dt() {
1144
1163
  return {
1145
1164
  type: "parentHello",
1146
1165
  schemaVersion: 2
1147
1166
  };
1148
1167
  }
1149
- function wt(e) {
1168
+ function Ot(e) {
1150
1169
  return {
1151
1170
  type: "widgetSetChrome",
1152
1171
  schemaVersion: 2,
1153
1172
  payload: { mode: e }
1154
1173
  };
1155
1174
  }
1156
- function Tt() {
1175
+ function kt() {
1157
1176
  return {
1158
1177
  type: "widgetToggleAudioSettings",
1159
1178
  schemaVersion: 2,
1160
1179
  payload: {}
1161
1180
  };
1162
1181
  }
1163
- function Et(e) {
1182
+ function At(e) {
1164
1183
  return {
1165
1184
  type: "setTheatre",
1166
1185
  schemaVersion: 2,
@@ -1169,8 +1188,8 @@ function Et(e) {
1169
1188
  }
1170
1189
  //#endregion
1171
1190
  //#region src/v2/embed/fullWindowHost.ts
1172
- var Dt = "2147483000";
1173
- function Ot(e) {
1191
+ var jt = "2147483000";
1192
+ function Mt(e) {
1174
1193
  let { style: t } = e;
1175
1194
  return {
1176
1195
  position: t.position,
@@ -1188,11 +1207,11 @@ function Ot(e) {
1188
1207
  maxHeight: t.maxHeight
1189
1208
  };
1190
1209
  }
1191
- function kt(e) {
1210
+ function Nt(e) {
1192
1211
  let { style: t } = e;
1193
- t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = Dt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1212
+ t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = jt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1194
1213
  }
1195
- function At(e, t) {
1214
+ function Pt(e, t) {
1196
1215
  if (delete e.dataset.liformaFullWindow, !t) {
1197
1216
  e.style.position = "", e.style.top = "", e.style.right = "", e.style.bottom = "", e.style.left = "", e.style.inset = "", e.style.width = "", e.style.height = "", e.style.zIndex = "", e.style.margin = "", e.style.borderRadius = "", e.style.maxWidth = "", e.style.maxHeight = "";
1198
1217
  return;
@@ -1202,20 +1221,20 @@ function At(e, t) {
1202
1221
  }
1203
1222
  //#endregion
1204
1223
  //#region src/v2/embed/iframeHost.ts
1205
- function jt(e) {
1224
+ function Ft(e) {
1206
1225
  return e;
1207
1226
  }
1208
1227
  function Z() {
1209
1228
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `cmd_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `cmd_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
1210
1229
  }
1211
- var Mt = 3e4;
1212
- function Nt(e) {
1230
+ var It = 3e4;
1231
+ function Lt(e) {
1213
1232
  let t = e.container;
1214
1233
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
1215
1234
  let n = document.createElement("iframe");
1216
1235
  n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true"), n.setAttribute("fetchpriority", "high"), "fetchPriority" in n && (n.fetchPriority = "high");
1217
1236
  let r = !1, i = !1, a = null, o = null, s = (r) => {
1218
- i !== r && (i = r, r ? (a = Ot(n), o = document.body.style.overflow, document.body.append(n), kt(n), document.body.style.overflow = "hidden") : (t.append(n), At(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
1237
+ i !== r && (i = r, r ? (a = Mt(n), o = document.body.style.overflow, document.body.append(n), Nt(n), document.body.style.overflow = "hidden") : (t.append(n), Pt(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
1219
1238
  }, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
1220
1239
  p = e, m = t;
1221
1240
  }), g = () => {
@@ -1226,10 +1245,10 @@ function Nt(e) {
1226
1245
  let i = Date.now();
1227
1246
  if (d > 0 && i - d < 250) return;
1228
1247
  d = i, g();
1229
- let a = St(t.launch, t.session, t.chrome), o = () => {
1248
+ let a = Et(t.launch, t.session, t.chrome), o = () => {
1230
1249
  if (r) return;
1231
1250
  let t = n.contentWindow;
1232
- t && _t(t, a, e.playerOrigin);
1251
+ t && bt(t, a, e.playerOrigin);
1233
1252
  };
1234
1253
  o();
1235
1254
  for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
@@ -1237,17 +1256,17 @@ function Nt(e) {
1237
1256
  r || !l || _(l);
1238
1257
  }, y = () => {
1239
1258
  if (u += 1, u === 1) {
1240
- gt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1259
+ yt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1241
1260
  return;
1242
1261
  }
1243
1262
  d = 0, v();
1244
1263
  }, b = () => {
1245
- u > 0 || m?.(Error(ht(e.playerOrigin)));
1264
+ u > 0 || m?.(Error(vt(e.playerOrigin)));
1246
1265
  };
1247
1266
  n.addEventListener("load", y), n.addEventListener("error", b);
1248
1267
  let x = (t) => {
1249
1268
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
1250
- let i = xt(t.data);
1269
+ let i = wt(t.data);
1251
1270
  if (i) switch (i.type) {
1252
1271
  case "close":
1253
1272
  e.onClose?.(i.payload);
@@ -1286,7 +1305,7 @@ function Nt(e) {
1286
1305
  e.onUserSpeechEnded?.(i.payload);
1287
1306
  break;
1288
1307
  case "modeChange":
1289
- e.onActivityChange?.(jt(i.payload.mode));
1308
+ e.onActivityChange?.(Ft(i.payload.mode));
1290
1309
  break;
1291
1310
  case "activityChange":
1292
1311
  e.onActivityChange?.(i.payload.activity);
@@ -1345,8 +1364,8 @@ function Nt(e) {
1345
1364
  let S = (t, i) => {
1346
1365
  if (r) return;
1347
1366
  let a = n.contentWindow;
1348
- if (!a) throw Error(ht(e.playerOrigin));
1349
- _t(a, t, e.playerOrigin, i);
1367
+ if (!a) throw Error(vt(e.playerOrigin));
1368
+ bt(a, t, e.playerOrigin, i);
1350
1369
  }, C = (e, t = 12e4, n) => {
1351
1370
  let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
1352
1371
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
@@ -1363,7 +1382,7 @@ function Nt(e) {
1363
1382
  return h;
1364
1383
  },
1365
1384
  postParentHello() {
1366
- S(Ct());
1385
+ S(Dt());
1367
1386
  },
1368
1387
  postLaunch(e, t, n) {
1369
1388
  r || (l = {
@@ -1385,13 +1404,13 @@ function Nt(e) {
1385
1404
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1386
1405
  },
1387
1406
  postWidgetSetChrome(e) {
1388
- S(wt(e));
1407
+ S(Ot(e));
1389
1408
  },
1390
1409
  postWidgetToggleAudioSettings() {
1391
- S(Tt());
1410
+ S(kt());
1392
1411
  },
1393
1412
  postSetTheatre(e) {
1394
- S(Et(e));
1413
+ S(At(e));
1395
1414
  },
1396
1415
  speak(e) {
1397
1416
  return C({
@@ -1513,7 +1532,7 @@ function Nt(e) {
1513
1532
  audio: e.audio,
1514
1533
  byteLength: e.byteLength
1515
1534
  }
1516
- }, Mt, [e.audio]);
1535
+ }, It, [e.audio]);
1517
1536
  },
1518
1537
  speechUtteranceSetTranscript(e) {
1519
1538
  return C({
@@ -1675,7 +1694,7 @@ function Nt(e) {
1675
1694
  }
1676
1695
  //#endregion
1677
1696
  //#region src/v2/embed/readyGate.ts
1678
- function Pt(e) {
1697
+ function Rt(e) {
1679
1698
  let t, n = !1, r = !1, i = () => {
1680
1699
  r || !n || t === void 0 || (r = !0, e(t));
1681
1700
  };
@@ -1690,9 +1709,9 @@ function Pt(e) {
1690
1709
  }
1691
1710
  //#endregion
1692
1711
  //#region src/v2/sdkRelease.ts
1693
- var Ft = `sdk@${{
1712
+ var zt = `sdk@${{
1694
1713
  name: "@liforma/client",
1695
- version: "0.4.14",
1714
+ version: "0.4.16",
1696
1715
  type: "module",
1697
1716
  description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
1698
1717
  license: "MIT",
@@ -1914,54 +1933,54 @@ var Ft = `sdk@${{
1914
1933
  vitest: "^4.1.10",
1915
1934
  wrangler: "^4.101.0"
1916
1935
  }
1917
- }.version}`, It = "https://player.liforma.ai/embed", Lt = "http://localhost:3002/embed";
1918
- function Rt() {
1936
+ }.version}`, Bt = "https://player.liforma.ai/embed", Vt = "http://localhost:3002/embed";
1937
+ function Ht() {
1919
1938
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1920
1939
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1921
1940
  if (typeof document > "u") return null;
1922
1941
  let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-player-embed-url")?.trim();
1923
1942
  return t ? t.replace(/\/$/, "") : null;
1924
1943
  }
1925
- function zt() {
1926
- let e = Rt();
1927
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : te() ? Lt : It;
1944
+ function Ut() {
1945
+ let e = Ht();
1946
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : L() ? Vt : Bt;
1928
1947
  }
1929
- function Bt(e, t) {
1948
+ function Wt(e, t) {
1930
1949
  return e?.trim() || t?.trim() || void 0;
1931
1950
  }
1932
- function Vt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1933
- let p = (e ?? zt()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
1951
+ function Gt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1952
+ let p = (e ?? Ut()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
1934
1953
  g && h.searchParams.set("backdropId", g);
1935
1954
  let _ = r?.trim();
1936
1955
  _ && h.searchParams.set("avatarId", _);
1937
1956
  let v = d?.trim();
1938
1957
  v && h.searchParams.set("previewBg", v);
1939
1958
  let y = f?.trim();
1940
- return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), Ht(h.toString());
1959
+ return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), Kt(h.toString());
1941
1960
  }
1942
- function Ht(e) {
1961
+ function Kt(e) {
1943
1962
  if (typeof location > "u") return e;
1944
1963
  let t = new URL(e);
1945
1964
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1946
1965
  }
1947
- function Ut(e) {
1966
+ function qt(e) {
1948
1967
  return new URL(e).origin;
1949
1968
  }
1950
1969
  //#endregion
1951
1970
  //#region src/v2/experienceEvents.ts
1952
- function Wt() {
1971
+ function Jt() {
1953
1972
  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)}`;
1954
1973
  }
1955
- function Gt(e, t, n) {
1974
+ function Yt(e, t, n) {
1956
1975
  return {
1957
- id: Wt(),
1976
+ id: Jt(),
1958
1977
  type: e,
1959
1978
  sessionId: t,
1960
1979
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1961
1980
  data: n
1962
1981
  };
1963
1982
  }
1964
- function Kt() {
1983
+ function Xt() {
1965
1984
  return {
1966
1985
  ready: /* @__PURE__ */ new Set(),
1967
1986
  started: /* @__PURE__ */ new Set(),
@@ -1982,39 +2001,39 @@ function Kt() {
1982
2001
  conversationProcessorError: /* @__PURE__ */ new Set()
1983
2002
  };
1984
2003
  }
1985
- function qt(e, t, n) {
2004
+ function Zt(e, t, n) {
1986
2005
  return e[t].add(n), () => e[t].delete(n);
1987
2006
  }
1988
- function Jt(e, t, n) {
2007
+ function Qt(e, t, n) {
1989
2008
  for (let r of e[t]) r(n);
1990
2009
  }
1991
- function Yt(e) {
2010
+ function $t(e) {
1992
2011
  for (let t of Object.keys(e)) e[t].clear();
1993
2012
  }
1994
2013
  //#endregion
1995
2014
  //#region src/v2/speech/types.ts
1996
- function Xt(e) {
2015
+ function en(e) {
1997
2016
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1998
2017
  }
1999
- function Zt(e) {
2018
+ function tn(e) {
2000
2019
  return "url" in e && typeof e.url == "string";
2001
2020
  }
2002
- function Qt(e) {
2021
+ function nn(e) {
2003
2022
  if (!("track" in e)) return !1;
2004
2023
  let t = e.track;
2005
2024
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
2006
2025
  }
2007
- function $t(e) {
2008
- return !Xt(e) && !Zt(e) && !Qt(e) && "encoding" in e && typeof e.encoding == "string";
2026
+ function rn(e) {
2027
+ return !en(e) && !tn(e) && !nn(e) && "encoding" in e && typeof e.encoding == "string";
2009
2028
  }
2010
- var en = [
2029
+ var an = [
2011
2030
  8e3,
2012
2031
  16e3,
2013
2032
  22050,
2014
2033
  24e3,
2015
2034
  44100,
2016
2035
  48e3
2017
- ], tn = {
2036
+ ], on = {
2018
2037
  MAX_CHUNK_BYTES: 64 * 1024,
2019
2038
  RECOMMENDED_CHUNK_MS_MIN: 20,
2020
2039
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -2025,14 +2044,14 @@ var en = [
2025
2044
  MAX_UTTERANCE_DURATION_MS: 9e4,
2026
2045
  MAX_PENDING_WRITES: 8,
2027
2046
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
2028
- }, nn = class extends Error {
2047
+ }, sn = class extends Error {
2029
2048
  operation;
2030
2049
  requiredCapability;
2031
2050
  name = "UnsupportedSpeechOperationError";
2032
2051
  constructor(e, t) {
2033
2052
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
2034
2053
  }
2035
- }, rn = class extends Error {
2054
+ }, cn = class extends Error {
2036
2055
  name = "SpeechUtteranceClosedError";
2037
2056
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
2038
2057
  super(e);
@@ -2042,72 +2061,72 @@ var en = [
2042
2061
  constructor(e, t) {
2043
2062
  super(e, t);
2044
2063
  }
2045
- }, an = class extends Error {
2064
+ }, ln = class extends Error {
2046
2065
  name = "SpeechBufferTimeoutError";
2047
2066
  constructor(e = "Timed out waiting for speech buffer capacity.") {
2048
2067
  super(e);
2049
2068
  }
2050
2069
  };
2051
- function on(e = "none") {
2070
+ function un(e = "none") {
2052
2071
  return {
2053
2072
  mode: e,
2054
2073
  trackedDurationMs: 0,
2055
2074
  fallbackDurationMs: 0
2056
2075
  };
2057
2076
  }
2058
- function sn(e) {
2059
- return en.includes(e);
2077
+ function dn(e) {
2078
+ return an.includes(e);
2060
2079
  }
2061
- function cn(e) {
2080
+ function fn(e) {
2062
2081
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
2063
2082
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
2064
- if (!sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2083
+ if (!dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2065
2084
  }
2066
- function ln(e) {
2067
- if (Xt(e)) {
2068
- cn(e.format);
2085
+ function pn(e) {
2086
+ if (en(e)) {
2087
+ fn(e.format);
2069
2088
  return;
2070
2089
  }
2071
- if (Zt(e)) {
2090
+ if (tn(e)) {
2072
2091
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
2073
- if (e.sampleRate !== void 0 && !sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2092
+ if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2074
2093
  return;
2075
2094
  }
2076
- if (Qt(e)) {
2095
+ if (nn(e)) {
2077
2096
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
2078
- if (e.sampleRate !== void 0 && !sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2097
+ if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2079
2098
  return;
2080
2099
  }
2081
- if ($t(e)) {
2100
+ if (rn(e)) {
2082
2101
  let t = e.encoding.trim().toLowerCase();
2083
2102
  if (!t) throw new Q("Encoded audio MIME type is required.");
2084
2103
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
2085
- if (e.sampleRate !== void 0 && !sn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2104
+ if (e.sampleRate !== void 0 && !dn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2086
2105
  return;
2087
2106
  }
2088
2107
  throw new Q("Unsupported speech.play audio shape.");
2089
2108
  }
2090
- function un(e) {
2091
- if (e.format) return cn(e.format), e.format;
2109
+ function mn(e) {
2110
+ if (e.format) return fn(e.format), e.format;
2092
2111
  if (e.track) {
2093
2112
  let t = {
2094
2113
  encoding: "pcm_s16le",
2095
2114
  sampleRate: e.sampleRate ?? 24e3,
2096
2115
  channels: 1
2097
2116
  };
2098
- return cn(t), t;
2117
+ return fn(t), t;
2099
2118
  }
2100
2119
  throw new Q("createUtterance requires format or track.");
2101
2120
  }
2102
- function dn(e) {
2121
+ function hn(e) {
2103
2122
  return e instanceof Uint8Array ? e : new Uint8Array(e);
2104
2123
  }
2105
- function fn(e) {
2124
+ function gn(e) {
2106
2125
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
2107
2126
  }
2108
2127
  //#endregion
2109
2128
  //#region src/byo/pcm.ts
2110
- function pn(e) {
2129
+ function _n(e) {
2111
2130
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
2112
2131
  for (let t = 0; t < e.length; t++) {
2113
2132
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -2117,11 +2136,11 @@ function pn(e) {
2117
2136
  }
2118
2137
  //#endregion
2119
2138
  //#region src/byo/resample.ts
2120
- function mn(e, t, n, r, i) {
2139
+ function vn(e, t, n, r, i) {
2121
2140
  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;
2122
2141
  return ((a * i + o) * i + s) * i + c;
2123
2142
  }
2124
- function hn(e, t) {
2143
+ function yn(e, t) {
2125
2144
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
2126
2145
  if (e === t) return {
2127
2146
  fromRate: e,
@@ -2144,7 +2163,7 @@ function hn(e, t) {
2144
2163
  let a = [];
2145
2164
  for (; i + 2 < r.length - 1;) {
2146
2165
  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);
2147
- a.push(mn(r[o], r[e], r[s], r[c], t)), i += n;
2166
+ a.push(vn(r[o], r[e], r[s], r[c], t)), i += n;
2148
2167
  }
2149
2168
  let o = Math.max(0, Math.floor(i) - 1);
2150
2169
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -2156,7 +2175,7 @@ function hn(e, t) {
2156
2175
  }
2157
2176
  //#endregion
2158
2177
  //#region src/byo/audioCapture.ts
2159
- var gn = "liforma-pcm-capture", _n = `
2178
+ var bn = "liforma-pcm-capture", xn = `
2160
2179
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2161
2180
  process(inputs) {
2162
2181
  const ch = inputs[0] && inputs[0][0];
@@ -2168,29 +2187,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2168
2187
  return true;
2169
2188
  }
2170
2189
  }
2171
- registerProcessor('${gn}', LiformaPcmCaptureProcessor);
2172
- `, vn = null;
2173
- function yn() {
2174
- return vn ||= URL.createObjectURL(new Blob([_n], { type: "application/javascript" })), vn;
2190
+ registerProcessor('${bn}', LiformaPcmCaptureProcessor);
2191
+ `, Sn = null;
2192
+ function Cn() {
2193
+ return Sn ||= URL.createObjectURL(new Blob([xn], { type: "application/javascript" })), Sn;
2175
2194
  }
2176
- function bn() {
2195
+ function wn() {
2177
2196
  return window.AudioContext || window.webkitAudioContext || null;
2178
2197
  }
2179
- async function xn(e) {
2180
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = bn();
2198
+ async function Tn(e) {
2199
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = wn();
2181
2200
  if (!o) throw Error("Web Audio is required for audio capture");
2182
2201
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
2183
2202
  l.gain.value = 0;
2184
- let u = s.sampleRate, d = hn(u, n), f = !1, p = !1, m = (e) => {
2203
+ let u = s.sampleRate, d = yn(u, n), f = !1, p = !1, m = (e) => {
2185
2204
  if (f || i && !i()) return;
2186
2205
  let t = d.push(e);
2187
- t.length !== 0 && r(pn(t));
2206
+ t.length !== 0 && r(_n(t));
2188
2207
  }, h = () => void 0;
2189
2208
  return await (async () => {
2190
2209
  if (typeof s.audioWorklet?.addModule != "function") return !1;
2191
2210
  try {
2192
- await s.audioWorklet.addModule(yn());
2193
- let e = new AudioWorkletNode(s, gn, {
2211
+ await s.audioWorklet.addModule(Cn());
2212
+ let e = new AudioWorkletNode(s, bn, {
2194
2213
  numberOfInputs: 1,
2195
2214
  numberOfOutputs: 1,
2196
2215
  outputChannelCount: [1]
@@ -2240,7 +2259,7 @@ async function xn(e) {
2240
2259
  }
2241
2260
  //#endregion
2242
2261
  //#region src/v2/speech/captureMediaStreamTrack.ts
2243
- async function Sn(e) {
2262
+ async function En(e) {
2244
2263
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
2245
2264
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
2246
2265
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -2249,18 +2268,18 @@ async function Sn(e) {
2249
2268
  s || (s = !0, c?.stop(), c = null);
2250
2269
  };
2251
2270
  try {
2252
- c = await xn({
2271
+ c = await Tn({
2253
2272
  mediaStream: a,
2254
2273
  targetSampleRate: r,
2255
2274
  shouldSend: () => !s && !i?.aborted,
2256
2275
  onPcm: (e) => {
2257
2276
  if (s || i?.aborted) return;
2258
- let t = dn(e);
2277
+ let t = hn(e);
2259
2278
  o = o.then(async () => {
2260
2279
  if (s || i?.aborted) return;
2261
2280
  let e = 0;
2262
2281
  for (; e < t.byteLength;) {
2263
- let r = Math.min(e + tn.MAX_CHUNK_BYTES, t.byteLength);
2282
+ let r = Math.min(e + on.MAX_CHUNK_BYTES, t.byteLength);
2264
2283
  if ((r - e) % 2 == 1 && --r, r <= e) break;
2265
2284
  let i = t.subarray(e, r);
2266
2285
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -2284,10 +2303,10 @@ async function Sn(e) {
2284
2303
  }
2285
2304
  //#endregion
2286
2305
  //#region src/v2/speech/speechController.ts
2287
- async function Cn(e, t) {
2288
- if (Qt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2289
- if (Xt(e)) {
2290
- let t = dn(e.data);
2306
+ async function Dn(e, t) {
2307
+ if (nn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2308
+ if (en(e)) {
2309
+ let t = hn(e.data);
2291
2310
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
2292
2311
  return {
2293
2312
  kind: "pcm",
@@ -2295,17 +2314,17 @@ async function Cn(e, t) {
2295
2314
  format: e.format
2296
2315
  };
2297
2316
  }
2298
- if (Zt(e)) return {
2317
+ if (tn(e)) return {
2299
2318
  kind: "url",
2300
2319
  url: e.url.trim(),
2301
2320
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2302
2321
  };
2303
- if (!$t(e)) throw new Q("Unsupported speech.play audio shape.");
2322
+ if (!rn(e)) throw new Q("Unsupported speech.play audio shape.");
2304
2323
  let n;
2305
2324
  if (typeof Blob < "u" && e.data instanceof Blob) {
2306
2325
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
2307
2326
  n = new Uint8Array(await e.data.arrayBuffer());
2308
- } else n = dn(e.data);
2327
+ } else n = hn(e.data);
2309
2328
  return {
2310
2329
  kind: "encoded",
2311
2330
  data: n.slice().buffer,
@@ -2313,10 +2332,10 @@ async function Cn(e, t) {
2313
2332
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2314
2333
  };
2315
2334
  }
2316
- function wn() {
2335
+ function On() {
2317
2336
  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)}`;
2318
2337
  }
2319
- function Tn(e, t = "completed") {
2338
+ function kn(e, t = "completed") {
2320
2339
  return {
2321
2340
  utteranceId: e.speechId,
2322
2341
  characterId: e.characterId,
@@ -2330,13 +2349,13 @@ function Tn(e, t = "completed") {
2330
2349
  }
2331
2350
  };
2332
2351
  }
2333
- function En(e) {
2352
+ function An(e) {
2334
2353
  return e instanceof Error ? e : new Q(String(e));
2335
2354
  }
2336
- function Dn(e) {
2355
+ function jn(e) {
2337
2356
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
2338
2357
  }
2339
- var On = class {
2358
+ var Mn = class {
2340
2359
  id;
2341
2360
  characterId;
2342
2361
  result;
@@ -2365,29 +2384,29 @@ var On = class {
2365
2384
  queue: e.queue,
2366
2385
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
2367
2386
  }).catch((e) => {
2368
- throw this.fail(En(e)), En(e);
2387
+ throw this.fail(An(e)), An(e);
2369
2388
  }), this.signal?.addEventListener("abort", () => {
2370
2389
  this.cancel();
2371
2390
  }, { once: !0 });
2372
2391
  }
2373
2392
  async write(e, t) {
2374
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new rn();
2375
- let n = dn(e);
2393
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new cn();
2394
+ let n = hn(e);
2376
2395
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
2377
- if (n.byteLength > tn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${tn.MAX_CHUNK_BYTES}).`);
2396
+ if (n.byteLength > on.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${on.MAX_CHUNK_BYTES}).`);
2378
2397
  if (n.byteLength === 0) return;
2379
- let r = t?.timeoutMs ?? tn.DEFAULT_WRITE_TIMEOUT_MS;
2398
+ let r = t?.timeoutMs ?? on.DEFAULT_WRITE_TIMEOUT_MS;
2380
2399
  await this.acquireWriteSlot(r);
2381
2400
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
2382
- if (this.bufferedMs + i > tn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2401
+ if (this.bufferedMs + i > on.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2383
2402
  let a = async () => {
2384
- if (this.closed || this.settled) throw new rn();
2403
+ if (this.closed || this.settled) throw new cn();
2385
2404
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
2386
2405
  utteranceId: this.id,
2387
2406
  audio: t.buffer,
2388
2407
  byteLength: t.byteLength
2389
2408
  }), a = await Promise.race([i, new Promise((e, t) => {
2390
- setTimeout(() => t(new an()), r);
2409
+ setTimeout(() => t(new ln()), r);
2391
2410
  })]);
2392
2411
  this.bufferedMs = Math.max(0, a.bufferedMs);
2393
2412
  }, o = this.writeChain.then(a, a);
@@ -2399,7 +2418,7 @@ var On = class {
2399
2418
  }
2400
2419
  }
2401
2420
  async setTranscript(e) {
2402
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new rn();
2421
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new cn();
2403
2422
  await this.requireHost().speechUtteranceSetTranscript({
2404
2423
  utteranceId: this.id,
2405
2424
  transcript: e
@@ -2416,7 +2435,7 @@ var On = class {
2416
2435
  });
2417
2436
  return this.resolve(t), t;
2418
2437
  } catch (e) {
2419
- let t = En(e);
2438
+ let t = An(e);
2420
2439
  throw this.fail(t), t;
2421
2440
  }
2422
2441
  }
@@ -2434,11 +2453,11 @@ var On = class {
2434
2453
  characterId: this.characterId,
2435
2454
  status: "cancelled",
2436
2455
  durationMs: 0,
2437
- animation: on("none")
2456
+ animation: un("none")
2438
2457
  };
2439
2458
  return this.resolve(t), t;
2440
2459
  } catch (e) {
2441
- let t = En(e);
2460
+ let t = An(e);
2442
2461
  throw this.fail(t), t;
2443
2462
  }
2444
2463
  }
@@ -2451,19 +2470,19 @@ var On = class {
2451
2470
  return e;
2452
2471
  }
2453
2472
  resolve(e) {
2454
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new rn()));
2473
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new cn()));
2455
2474
  }
2456
2475
  fail(e) {
2457
2476
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
2458
2477
  }
2459
2478
  async acquireWriteSlot(e) {
2460
- if (this.pendingWriteCount < tn.MAX_PENDING_WRITES) {
2479
+ if (this.pendingWriteCount < on.MAX_PENDING_WRITES) {
2461
2480
  this.pendingWriteCount += 1;
2462
2481
  return;
2463
2482
  }
2464
2483
  await new Promise((t, n) => {
2465
2484
  let r = setTimeout(() => {
2466
- n(new an());
2485
+ n(new ln());
2467
2486
  }, e);
2468
2487
  this.pendingWriteWaiters.push({
2469
2488
  resolve: () => {
@@ -2482,13 +2501,13 @@ var On = class {
2482
2501
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2483
2502
  }
2484
2503
  };
2485
- function kn(e) {
2504
+ function Nn(e) {
2486
2505
  let t = null, n = (t, n) => {
2487
- if (!e.getCapabilities()[n]) throw new nn(t, n);
2506
+ if (!e.getCapabilities()[n]) throw new sn(t, n);
2488
2507
  }, r = {
2489
2508
  async speak(r) {
2490
2509
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2491
- let i = fn(r.queue ?? "append");
2510
+ let i = gn(r.queue ?? "append");
2492
2511
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2493
2512
  let a = e.getIframeHost();
2494
2513
  if (!a) throw new Q("Speech session is not attached.");
@@ -2508,41 +2527,41 @@ function kn(e) {
2508
2527
  return;
2509
2528
  }
2510
2529
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2511
- t.removeEventListener("abort", s), n(Tn(e, "completed"));
2530
+ t.removeEventListener("abort", s), n(kn(e, "completed"));
2512
2531
  }, (a) => {
2513
- if (t.removeEventListener("abort", s), Dn(a)) {
2532
+ if (t.removeEventListener("abort", s), jn(a)) {
2514
2533
  n({
2515
2534
  utteranceId: "utt_interrupted",
2516
2535
  characterId: r.characterId ?? e.getActiveCharacterId(),
2517
2536
  status: "interrupted",
2518
2537
  durationMs: 0,
2519
2538
  transcript: r.text,
2520
- animation: on("none")
2539
+ animation: un("none")
2521
2540
  });
2522
2541
  return;
2523
2542
  }
2524
- i(En(a));
2543
+ i(An(a));
2525
2544
  });
2526
2545
  });
2527
2546
  }
2528
2547
  try {
2529
- return Tn(await o, "completed");
2548
+ return kn(await o, "completed");
2530
2549
  } catch (t) {
2531
- if (Dn(t)) return {
2550
+ if (jn(t)) return {
2532
2551
  utteranceId: "utt_interrupted",
2533
2552
  characterId: r.characterId ?? e.getActiveCharacterId(),
2534
2553
  status: "interrupted",
2535
2554
  durationMs: 0,
2536
2555
  transcript: r.text,
2537
- animation: on("none")
2556
+ animation: un("none")
2538
2557
  };
2539
- throw En(t);
2558
+ throw An(t);
2540
2559
  }
2541
2560
  },
2542
2561
  async play(i) {
2543
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), ln(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2562
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), pn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2544
2563
  let a = i.queue ?? "append";
2545
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Qt(i.audio)) {
2564
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), nn(i.audio)) {
2546
2565
  let e = i.audio.sampleRate ?? 24e3;
2547
2566
  return r.createUtterance({
2548
2567
  format: {
@@ -2558,7 +2577,7 @@ function kn(e) {
2558
2577
  }
2559
2578
  let o = e.getIframeHost();
2560
2579
  if (!o) throw new Q("Speech session is not attached.");
2561
- let s = await Cn(i.audio, i.signal);
2580
+ let s = await Dn(i.audio, i.signal);
2562
2581
  return o.speechPlay({
2563
2582
  source: s,
2564
2583
  characterId: i.characterId,
@@ -2570,13 +2589,13 @@ function kn(e) {
2570
2589
  },
2571
2590
  createUtterance(r) {
2572
2591
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2573
- let i = un(r);
2592
+ let i = mn(r);
2574
2593
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2575
2594
  let a = r.queue ?? "replace-active";
2576
2595
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2577
2596
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2578
- let o = new On({
2579
- id: wn(),
2597
+ let o = new Mn({
2598
+ id: On(),
2580
2599
  characterId: r.characterId ?? e.getActiveCharacterId(),
2581
2600
  format: i,
2582
2601
  queue: a,
@@ -2588,7 +2607,7 @@ function kn(e) {
2588
2607
  t === o && (t = null);
2589
2608
  }), r.track && (async () => {
2590
2609
  try {
2591
- if (await Sn({
2610
+ if (await En({
2592
2611
  track: r.track,
2593
2612
  utterance: o,
2594
2613
  sampleRate: i.sampleRate,
@@ -2616,16 +2635,16 @@ function kn(e) {
2616
2635
  }
2617
2636
  //#endregion
2618
2637
  //#region src/v2/types/sessionInteraction.ts
2619
- function An(e) {
2638
+ function Pn(e) {
2620
2639
  let t = e?.trim();
2621
2640
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2622
2641
  }
2623
2642
  //#endregion
2624
2643
  //#region src/v2/experience.ts
2625
- function jn(e) {
2644
+ function Fn(e) {
2626
2645
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2627
2646
  }
2628
- var Mn = class e {
2647
+ var In = class e {
2629
2648
  bootstrap;
2630
2649
  conversationProcessor;
2631
2650
  iframeHost = null;
@@ -2645,17 +2664,17 @@ var Mn = class e {
2645
2664
  pendingTheatre = null;
2646
2665
  lastInteraction = null;
2647
2666
  closeHandlers = [];
2648
- eventRegistry = Kt();
2667
+ eventRegistry = Xt();
2649
2668
  readyEnvelope = null;
2650
2669
  startedEnvelope = null;
2651
2670
  sessionMintedEnvelope = null;
2652
2671
  conversationCache = [];
2653
2672
  speech;
2654
2673
  constructor(e) {
2655
- 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 = kn({
2674
+ 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 = Nn({
2656
2675
  getIframeHost: () => this.iframeHost,
2657
2676
  assertSessionStarted: () => this.assertSessionStarted(),
2658
- getCapabilities: () => Nn(this.resolvedSession),
2677
+ getCapabilities: () => Ln(this.resolvedSession),
2659
2678
  getActiveCharacterId: () => "character_unknown",
2660
2679
  onProcessorInterrupt: () => {
2661
2680
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2744,7 +2763,7 @@ var Mn = class e {
2744
2763
  return null;
2745
2764
  }
2746
2765
  on(e, t) {
2747
- let n = qt(this.eventRegistry, e, t);
2766
+ let n = Zt(this.eventRegistry, e, t);
2748
2767
  return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
2749
2768
  }
2750
2769
  async attach(e) {
@@ -2758,13 +2777,13 @@ var Mn = class e {
2758
2777
  if (this.closed) throw Error("Session has ended.");
2759
2778
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2760
2779
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2761
- let t = this.bootstrap.embedBaseUrl ?? zt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Vt(t, n, r ? void 0 : Bt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, jn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = Ut(i), o = null, s = new Promise((e) => {
2780
+ let t = this.bootstrap.embedBaseUrl ?? Ut(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Gt(t, n, r ? void 0 : Wt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Fn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = qt(i), o = null, s = new Promise((e) => {
2762
2781
  o = e;
2763
2782
  }), c = null, l = new Promise((e) => {
2764
2783
  c = e;
2765
- }), u = Pt((e) => {
2784
+ }), u = Rt((e) => {
2766
2785
  this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2767
- }), d = this.bootstrap.onUserTranscript, f = Nt({
2786
+ }), d = this.bootstrap.onUserTranscript, f = Lt({
2768
2787
  container: e.container,
2769
2788
  src: i,
2770
2789
  playerOrigin: a,
@@ -2831,7 +2850,7 @@ var Mn = class e {
2831
2850
  onTheatreChange: (t) => e.onTheatreChange?.(t)
2832
2851
  });
2833
2852
  this.iframeHost = f;
2834
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ut(this.bootstrap.sessionEndpoint, {
2853
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), pt(this.bootstrap.sessionEndpoint, {
2835
2854
  experienceId: this.bootstrap.experienceId,
2836
2855
  locale: this.bootstrap.locale,
2837
2856
  secondaryLocale: this.bootstrap.secondaryLocale,
@@ -2843,7 +2862,7 @@ var Mn = class e {
2843
2862
  attribution: this.bootstrap.attribution,
2844
2863
  alreadyConverted: this.bootstrap.alreadyConverted,
2845
2864
  signal: this.endpointAbortController.signal
2846
- })) : this.bootstrap.kind === "public" ? lt(this.bootstrap.experienceId, {
2865
+ })) : this.bootstrap.kind === "public" ? ft(this.bootstrap.experienceId, {
2847
2866
  locale: this.bootstrap.locale,
2848
2867
  secondaryLocale: this.bootstrap.secondaryLocale,
2849
2868
  learningLocale: this.bootstrap.learningLocale,
@@ -2867,7 +2886,7 @@ var Mn = class e {
2867
2886
  operation: "attach",
2868
2887
  message: e instanceof Error ? e.message : String(e),
2869
2888
  stack: e instanceof Error ? e.stack : void 0,
2870
- release: Ft
2889
+ release: zt
2871
2890
  });
2872
2891
  } catch {}
2873
2892
  throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
@@ -2879,19 +2898,23 @@ var Mn = class e {
2879
2898
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2880
2899
  this.launchToken = g;
2881
2900
  let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2882
- return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && tt(_), f.postLaunch(g, _, {
2901
+ return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && it(_), f.postLaunch(g, _, {
2883
2902
  startButton: e.startButton,
2884
2903
  theme: e.theme,
2885
2904
  showFeedback: e.showFeedback,
2886
2905
  interaction: e.interaction,
2887
- ...e.theatreButton ? { theatreButton: !0 } : {},
2906
+ ...Ze("settingsButton", e.settingsButton),
2907
+ ...Ze("theatreButton", e.theatreButton),
2908
+ ...Ze("fullscreenButton", e.fullscreenButton),
2888
2909
  ...e.theatre === void 0 ? {} : { theatre: e.theatre }
2889
2910
  }), u.setValue(_)) : f.postLaunch(g, void 0, {
2890
2911
  startButton: e.startButton,
2891
2912
  theme: e.theme,
2892
2913
  showFeedback: e.showFeedback,
2893
2914
  interaction: e.interaction,
2894
- ...e.theatreButton ? { theatreButton: !0 } : {},
2915
+ ...Ze("settingsButton", e.settingsButton),
2916
+ ...Ze("theatreButton", e.theatreButton),
2917
+ ...Ze("fullscreenButton", e.fullscreenButton),
2895
2918
  ...e.theatre === void 0 ? {} : { theatre: e.theatre }
2896
2919
  }), await Promise.race([s, new Promise((e, t) => {
2897
2920
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
@@ -2903,7 +2926,7 @@ var Mn = class e {
2903
2926
  operation: "attach",
2904
2927
  message: e instanceof Error ? e.message : String(e),
2905
2928
  stack: e instanceof Error ? e.stack : void 0,
2906
- release: Ft
2929
+ release: zt
2907
2930
  });
2908
2931
  } catch {}
2909
2932
  throw e;
@@ -2917,7 +2940,7 @@ var Mn = class e {
2917
2940
  operation: "attach",
2918
2941
  message: e instanceof Error ? e.message : String(e),
2919
2942
  stack: e instanceof Error ? e.stack : void 0,
2920
- release: Ft
2943
+ release: zt
2921
2944
  });
2922
2945
  } catch {}
2923
2946
  throw e;
@@ -2949,7 +2972,7 @@ var Mn = class e {
2949
2972
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2950
2973
  }
2951
2974
  async setFit(e) {
2952
- let t = An(e);
2975
+ let t = Pn(e);
2953
2976
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2954
2977
  if (this.closed) throw Error("Session has ended.");
2955
2978
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
@@ -2999,7 +3022,7 @@ var Mn = class e {
2999
3022
  this.close();
3000
3023
  }
3001
3024
  destroy() {
3002
- 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, Yt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
3025
+ 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, $t(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
3003
3026
  }
3004
3027
  resolveMintInteraction() {
3005
3028
  return this.bootstrap.kind === "launch" ? {} : {
@@ -3011,8 +3034,8 @@ var Mn = class e {
3011
3034
  return this.resolvedSession?.id ?? "";
3012
3035
  }
3013
3036
  emitWrapped(e, t) {
3014
- let n = Gt(e, this.getSessionId(), t);
3015
- return Jt(this.eventRegistry, e, n), n;
3037
+ let n = Yt(e, this.getSessionId(), t);
3038
+ return Qt(this.eventRegistry, e, n), n;
3016
3039
  }
3017
3040
  queueProcessorTurn(e) {
3018
3041
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -3021,7 +3044,7 @@ var Mn = class e {
3021
3044
  let n = this.processorAbortController.signal;
3022
3045
  this.processorChain = this.processorChain.then(async () => {
3023
3046
  if (!n.aborted) try {
3024
- let r = await pt(t, {
3047
+ let r = await gt(t, {
3025
3048
  utteranceId: e.utteranceId,
3026
3049
  text: e.text,
3027
3050
  conversation: this.conversationCache,
@@ -3071,7 +3094,7 @@ var Mn = class e {
3071
3094
  };
3072
3095
  }
3073
3096
  };
3074
- function Nn(e) {
3097
+ function Ln(e) {
3075
3098
  return e ? {
3076
3099
  textSpeech: e.capabilities.speech.output,
3077
3100
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -3082,41 +3105,41 @@ function Nn(e) {
3082
3105
  }
3083
3106
  //#endregion
3084
3107
  //#region src/widget/dockGeometry.ts
3085
- var Pn = "(min-width: 768px)", Fn = 24, In = .5, Ln = 1200, Rn = .85, zn = 9 / 16;
3086
- function Bn() {
3108
+ var Rn = "(min-width: 768px)", zn = 24, Bn = .5, Vn = 1200, Hn = .85, Un = 9 / 16;
3109
+ function Wn() {
3087
3110
  if (typeof window > "u") return 800;
3088
3111
  let e = window.screen?.availHeight;
3089
3112
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
3090
3113
  }
3091
- function Vn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Fn, r = typeof window < "u" ? Bn() : 800) {
3092
- let i = Math.max(160, Math.min(t - n * 2, t * Rn)), a = Math.max(120, e - n * 2), o = Math.min(r * In, Ln, i), s = o * zn;
3093
- return s > a && (s = a, o = s / zn, o > i && (o = i, s = o * zn)), {
3114
+ function Gn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = zn, r = typeof window < "u" ? Wn() : 800) {
3115
+ let i = Math.max(160, Math.min(t - n * 2, t * Hn)), a = Math.max(120, e - n * 2), o = Math.min(r * Bn, Vn, i), s = o * Un;
3116
+ return s > a && (s = a, o = s / Un, o > i && (o = i, s = o * Un)), {
3094
3117
  width: Math.round(s),
3095
3118
  height: Math.round(o)
3096
3119
  };
3097
3120
  }
3098
- function Hn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Fn) {
3121
+ function Kn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = zn) {
3099
3122
  return {
3100
3123
  left: Math.max(r, t - e.width - r),
3101
3124
  top: Math.max(r, n - e.height - r)
3102
3125
  };
3103
3126
  }
3104
- function Un(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Fn) {
3127
+ function qn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = zn) {
3105
3128
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
3106
3129
  return {
3107
3130
  left: Math.min(Math.max(a, e), o),
3108
3131
  top: Math.min(Math.max(a, t), s)
3109
3132
  };
3110
3133
  }
3111
- function Wn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3112
- return e(Pn).matches;
3134
+ function Jn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3135
+ return e(Rn).matches;
3113
3136
  }
3114
3137
  //#endregion
3115
3138
  //#region src/widget/mountExperienceWidget.ts
3116
- function Gn(e) {
3139
+ function Yn(e) {
3117
3140
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
3118
3141
  }
3119
- function Kn(e) {
3142
+ function Xn(e) {
3120
3143
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
3121
3144
  let t = typeof e == "string" ? e.trim() : "";
3122
3145
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -3124,10 +3147,10 @@ function Kn(e) {
3124
3147
  function $(e) {
3125
3148
  return e === "expanded" || e === "docked";
3126
3149
  }
3127
- var qn = "<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>", Jn = "<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>", Yn = "<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>", Xn = "<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>";
3128
- function Zn(e, t, n) {
3129
- xe(ye);
3130
- let r = F({
3150
+ var Zn = "<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>", Qn = "<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>", $n = "<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>", er = "<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>";
3151
+ function tr(e, t, n) {
3152
+ Ce(xe);
3153
+ let r = te({
3131
3154
  galleryThumb: t.galleryThumb,
3132
3155
  avatarImage: t.avatarImage,
3133
3156
  backgroundImage: t.backgroundImage,
@@ -3153,9 +3176,9 @@ function Zn(e, t, n) {
3153
3176
  let e = document.createElement("img");
3154
3177
  e.className = "liforma-et__foreground liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.foregroundImage, e.addEventListener("load", () => o(e), { once: !0 }), i.append(e);
3155
3178
  }
3156
- return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ve(i);
3179
+ return e.replaceChildren(i), n?.parallax === !1 ? () => {} : be(i);
3157
3180
  }
3158
- function Qn(e) {
3181
+ function nr(e) {
3159
3182
  return e.startButton ? {
3160
3183
  ...e.startButton,
3161
3184
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -3167,7 +3190,7 @@ function Qn(e) {
3167
3190
  variant: "primary"
3168
3191
  };
3169
3192
  }
3170
- function $n(e) {
3193
+ function rr(e) {
3171
3194
  let t = !1, n = () => {
3172
3195
  t || e();
3173
3196
  }, r = () => {
@@ -3187,12 +3210,12 @@ function $n(e) {
3187
3210
  t = !0, window.removeEventListener("load", r), i?.();
3188
3211
  };
3189
3212
  }
3190
- function er(e, t) {
3191
- Pe(Me);
3213
+ function ir(e, t) {
3214
+ Fe(Pe);
3192
3215
  let n = t.experienceId?.trim();
3193
3216
  if (!n) throw Error("ExperienceWidget requires experienceId.");
3194
- let r = t.prefetch ?? "onExpand", i = Gn(t.position), a = document.createElement("div");
3195
- 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", Kn(t.offset));
3217
+ let r = t.prefetch ?? "onExpand", i = Yn(t.position), a = document.createElement("div");
3218
+ 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", Xn(t.offset));
3196
3219
  let o = document.createElement("button");
3197
3220
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
3198
3221
  let s = document.createElement("div");
@@ -3212,136 +3235,136 @@ function er(e, t) {
3212
3235
  let m = document.createElement("span");
3213
3236
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
3214
3237
  let h = document.createElement("button");
3215
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Yn, h.setAttribute("aria-label", "Reduce");
3238
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = $n, h.setAttribute("aria-label", "Reduce");
3216
3239
  let g = document.createElement("button");
3217
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = qn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
3240
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Zn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
3218
3241
  let _ = document.createElement("button");
3219
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Jn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3242
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Qn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3220
3243
  let v = document.createElement("div");
3221
3244
  v.className = "liforma-ew__stage";
3222
3245
  let y = document.createElement("div");
3223
3246
  y.className = "liforma-ew__status", y.hidden = !0, f.append(v, y), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
3224
- let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, ee = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
3247
+ let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, N = null, P = null, F = null, I = null, ee = 0, te = 0, L = null, R = !1, z = new AbortController(), ne = t.parallax !== !1, B = () => {
3225
3248
  let e = a.dataset.state;
3226
3249
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
3227
- }, z = () => {
3250
+ }, re = () => {
3228
3251
  M !== null && (clearTimeout(M), M = null);
3229
- }, B = () => {
3230
- ee !== null && (clearTimeout(ee), ee = null), a.classList.remove("liforma-ew--layout-settling");
3231
- }, ae = () => {
3252
+ }, ie = () => {
3253
+ N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
3254
+ }, V = () => {
3232
3255
  for (let e of [
3233
3256
  f,
3234
3257
  l,
3235
3258
  p
3236
3259
  ]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
3237
3260
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
3238
- }, oe = (e, t, n, r) => {
3261
+ }, H = (e, t, n, r) => {
3239
3262
  let i = (i) => {
3240
3263
  i.style.left = `${e}px`, i.style.top = `${t}px`, i.style.width = `${n}px`, i.style.height = `${r}px`, i.style.right = "auto", i.style.bottom = "auto";
3241
3264
  };
3242
3265
  i(f), i(l);
3243
3266
  let a = p.offsetWidth || 120;
3244
3267
  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";
3245
- }, se = (e, t) => {
3246
- if (R() !== "docked") return;
3247
- let n = Vn(), r = Un(e - te, t - I, n);
3248
- N = r.left, P = r.top, oe(r.left, r.top, n.width, n.height);
3249
- }, ce = (e, t) => {
3250
- if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
3251
- let n = Vn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Un(r + e, i + t, n);
3252
- N = a.left, P = a.top, oe(a.left, a.top, n.width, n.height);
3253
- }, le = (e) => {
3254
- L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), se(e.clientX, e.clientY)));
3255
- }, V = (e) => {
3256
- if (F === null || e && e.pointerId !== F) return;
3268
+ }, ae = (e, t) => {
3269
+ if (B() !== "docked") return;
3270
+ let n = Gn(), r = qn(e - ee, t - te, n);
3271
+ P = r.left, F = r.top, H(r.left, r.top, n.width, n.height);
3272
+ }, oe = (e, t) => {
3273
+ if (B() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
3274
+ let n = Gn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = qn(r + e, i + t, n);
3275
+ P = a.left, F = a.top, H(a.left, a.top, n.width, n.height);
3276
+ }, se = (e) => {
3277
+ L === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), ae(e.clientX, e.clientY)));
3278
+ }, U = (e) => {
3279
+ if (I === null || e && e.pointerId !== I) return;
3257
3280
  let t = L;
3258
- F = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && ne && (ne = !1, window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
3259
- }, ue = (e, t, n) => {
3260
- if (S || R() !== "docked" || !Wn() || F !== null) return;
3261
- F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3281
+ I = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && R && (R = !1, window.removeEventListener("pointermove", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
3282
+ }, ce = (e, t, n) => {
3283
+ if (S || B() !== "docked" || !Jn() || I !== null) return;
3284
+ I = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3262
3285
  let r = f.getBoundingClientRect();
3263
- te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", le), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
3264
- }, de = (e) => {
3265
- if (S || R() !== "docked" || !Wn() || F !== null) return;
3266
- F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3286
+ ee = e - r.left, te = t - r.top, R || (R = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
3287
+ }, le = (e) => {
3288
+ if (S || B() !== "docked" || !Jn() || I !== null) return;
3289
+ I = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3267
3290
  let t = f.getBoundingClientRect();
3268
- N = t.left, P = t.top;
3269
- }, fe = (e) => {
3270
- L === "player" && (F === null || e.pointerId !== F || ce(e.dx, e.dy));
3271
- }, pe = (e) => {
3272
- L === "player" && (F === null || e.pointerId !== F || V());
3273
- }, H = () => {
3274
- let e = Wn(), t = R();
3291
+ P = t.left, F = t.top;
3292
+ }, ue = (e) => {
3293
+ L === "player" && (I === null || e.pointerId !== I || oe(e.dx, e.dy));
3294
+ }, de = (e) => {
3295
+ L === "player" && (I === null || e.pointerId !== I || U());
3296
+ }, fe = () => {
3297
+ let e = Jn(), t = B();
3275
3298
  if (!e || t !== "expanded" && t !== "docked") {
3276
3299
  h.hidden = !0;
3277
3300
  return;
3278
3301
  }
3279
- h.hidden = !1, t === "docked" ? (h.innerHTML = Xn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Yn, h.setAttribute("aria-label", "Reduce"));
3280
- }, me = (e) => {
3281
- let t = Vn(), n = e && N !== null && P !== null ? Un(N, P, t) : Hn(t);
3282
- n = Un(n.left, n.top, t), N = n.left, P = n.top, oe(n.left, n.top, t.width, t.height), H();
3283
- }, U = () => {
3302
+ h.hidden = !1, t === "docked" ? (h.innerHTML = er, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = $n, h.setAttribute("aria-label", "Reduce"));
3303
+ }, pe = (e) => {
3304
+ let t = Gn(), n = e && P !== null && F !== null ? qn(P, F, t) : Kn(t);
3305
+ n = qn(n.left, n.top, t), P = n.left, F = n.top, H(n.left, n.top, t.width, t.height), fe();
3306
+ }, me = () => {
3284
3307
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
3285
3308
  requestAnimationFrame(() => {
3286
3309
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
3287
3310
  });
3288
3311
  });
3289
3312
  }, W = (e) => {
3290
- if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3313
+ if (ie(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3291
3314
  a.classList.remove("liforma-ew--layout-settling");
3292
3315
  return;
3293
3316
  }
3294
- ee = setTimeout(() => {
3295
- if (ee = null, S || !$(a.dataset.state)) {
3317
+ N = setTimeout(() => {
3318
+ if (N = null, S || !$(a.dataset.state)) {
3296
3319
  a.classList.remove("liforma-ew--layout-settling");
3297
3320
  return;
3298
3321
  }
3299
- a.classList.remove("liforma-ew--layout-settling"), U();
3322
+ a.classList.remove("liforma-ew--layout-settling"), me();
3300
3323
  }, 220);
3301
3324
  }, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
3302
- z(), M = setTimeout(() => {
3325
+ re(), M = setTimeout(() => {
3303
3326
  M = null, a.classList.remove("liforma-ew--session-concealing"), e();
3304
3327
  }, 280);
3305
- })), G = {
3328
+ })), ge = {
3306
3329
  galleryThumb: t.galleryThumb,
3307
3330
  avatarImage: t.avatarImage,
3308
3331
  backgroundImage: t.backgroundImage,
3309
3332
  foregroundImage: t.foregroundImage,
3310
3333
  fallbackImage: t.fallbackImage
3311
- }, K = (e) => {
3334
+ }, G = (e) => {
3312
3335
  if (!e) {
3313
3336
  y.hidden = !0, y.textContent = "";
3314
3337
  return;
3315
3338
  }
3316
3339
  y.hidden = !1, y.textContent = e;
3317
- }, ge = (e) => {
3340
+ }, K = (e) => {
3318
3341
  if (!e) {
3319
3342
  c.hidden = !0, c.textContent = "";
3320
3343
  return;
3321
3344
  }
3322
3345
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
3323
3346
  }, _e = () => {
3324
- C = !0, o.disabled = !1, ge(null), r === "onExpand" && t.onPrefetchReady?.();
3347
+ C = !0, o.disabled = !1, K(null), r === "onExpand" && t.onPrefetchReady?.();
3325
3348
  }, ve = () => {
3326
3349
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
3327
3350
  }, ye = (e) => {
3328
3351
  A?.(), A = null;
3329
- let t = Zn(s, e, { parallax: ie });
3352
+ let t = tr(s, e, { parallax: ne });
3330
3353
  return t ? (A = t, !0) : !1;
3331
3354
  }, be = () => {
3332
- if (ye(G)) {
3355
+ if (ye(ge)) {
3333
3356
  _e();
3334
3357
  return;
3335
3358
  }
3336
- ge("Loading…"), ze(n, { signal: re.signal }).then((e) => {
3359
+ K("Loading…"), Ve(n, { signal: z.signal }).then((e) => {
3337
3360
  if (!S) {
3338
3361
  if (!ye({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3339
3362
  _e();
3340
3363
  }
3341
3364
  }).catch((e) => {
3342
- if (S || re.signal.aborted) return;
3365
+ if (S || z.signal.aborted) return;
3343
3366
  let n = e instanceof Error ? e : Error(String(e));
3344
- ge("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3367
+ K("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3345
3368
  });
3346
3369
  }, xe = () => ({
3347
3370
  experienceId: n,
@@ -3358,30 +3381,30 @@ function er(e, t) {
3358
3381
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
3359
3382
  }), Se = () => ({
3360
3383
  ...t.fit ? { fit: t.fit } : {},
3361
- startButton: Qn(t),
3384
+ startButton: nr(t),
3362
3385
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
3363
3386
  ...t.interaction ? { interaction: t.interaction } : {}
3364
3387
  }), Ce = (e = !0) => {
3365
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
3388
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), V(), a.dataset.state = "expanded", G(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), fe(), e && t.onExpanded?.();
3366
3389
  }, we = () => {
3367
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", K(null), typeof document < "u" && (document.body.style.overflow = k), me(!0), H(), b?.setWidgetChrome("docked");
3390
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", G(null), typeof document < "u" && (document.body.style.overflow = k), pe(!0), fe(), b?.setWidgetChrome("docked");
3368
3391
  }, Te = (e) => {
3369
3392
  e.on("started", () => {
3370
- S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && U());
3393
+ S || (D = !0, a.dataset.live = "true", G(null), t.onStarted?.(), $(a.dataset.state) && me());
3371
3394
  }), e.on("feedback", (e) => {
3372
3395
  S || t.onFeedback?.(e);
3373
3396
  }), e.on("feedbackFailed", (e) => {
3374
3397
  S || t.onFeedbackFailed?.(e);
3375
3398
  });
3376
3399
  }, Ee = () => {
3377
- B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), H();
3400
+ ie(), u.hidden = !0, p.hidden = !0, V(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), G(null), typeof document < "u" && (document.body.style.overflow = k), fe();
3378
3401
  }, De = () => {
3379
- z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3402
+ re(), ie(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3380
3403
  let e = b;
3381
3404
  b = null, e?.destroy(), v.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
3382
3405
  }, Oe = () => {
3383
3406
  if (!S && $(a.dataset.state)) {
3384
- if (V(), x = !1, b && E) {
3407
+ if (U(), x = !1, b && E) {
3385
3408
  let e = b;
3386
3409
  (async () => {
3387
3410
  D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Ee(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && ve(), t.onCollapsed?.(), t.onClose?.());
@@ -3391,26 +3414,26 @@ function er(e, t) {
3391
3414
  De(), Ee(), t.onCollapsed?.(), t.onClose?.();
3392
3415
  }
3393
3416
  }, ke = () => {
3394
- S || Wn() && R() === "expanded" && W(() => {
3417
+ S || Jn() && B() === "expanded" && W(() => {
3395
3418
  we();
3396
3419
  });
3397
3420
  }, Ae = () => {
3398
- S || R() === "docked" && (V(), W(() => {
3399
- ae(), Ce(!1), b?.setWidgetChrome("expanded");
3421
+ S || B() === "docked" && (U(), W(() => {
3422
+ V(), Ce(!1), b?.setWidgetChrome("expanded");
3400
3423
  }));
3401
3424
  }, je = () => {
3402
- !b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, U());
3403
- }, Ne = () => {
3404
- !b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
3405
- }, Fe = (e) => {
3406
- S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && U());
3425
+ !b || !D || (re(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, me());
3426
+ }, Me = () => {
3427
+ !b || !E || D || (re(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
3428
+ }, Ne = (e) => {
3429
+ S || e !== O && !D || (re(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && me());
3407
3430
  }, q = () => {
3408
3431
  if (S || T || w || b || $(a.dataset.state)) return;
3409
3432
  T = !0;
3410
3433
  let e = O;
3411
3434
  l.hidden = !1, (async () => {
3412
3435
  try {
3413
- let t = await Mn.startSession(xe());
3436
+ let t = await In.startSession(xe());
3414
3437
  if (S || e !== O) {
3415
3438
  t.destroy();
3416
3439
  return;
@@ -3423,22 +3446,22 @@ function er(e, t) {
3423
3446
  S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ve());
3424
3447
  },
3425
3448
  onWidgetExpand: () => {
3426
- Fe(e);
3449
+ Ne(e);
3427
3450
  },
3428
3451
  onWidgetAudioSettings: (e) => {
3429
- S || J(e);
3452
+ S || ze(e);
3430
3453
  },
3431
3454
  onWidgetDragStart: (e) => {
3432
- S || de(e);
3455
+ S || le(e);
3433
3456
  },
3434
3457
  onWidgetDragMove: (e) => {
3435
- S || fe(e);
3458
+ S || ue(e);
3436
3459
  },
3437
3460
  onWidgetDragEnd: (e) => {
3438
- S || pe(e);
3461
+ S || de(e);
3439
3462
  },
3440
3463
  onPlayerStatusChange: (e) => {
3441
- S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
3464
+ S || e === "error" && $(a.dataset.state) && G("Could not load the experience.");
3442
3465
  }
3443
3466
  });
3444
3467
  if (S || e !== O) {
@@ -3462,14 +3485,14 @@ function er(e, t) {
3462
3485
  return;
3463
3486
  }
3464
3487
  if (b && E) {
3465
- Ne();
3488
+ Me();
3466
3489
  return;
3467
3490
  }
3468
3491
  let e = ++O;
3469
3492
  x = !0, w = !1, T = !1, E = !1, D = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
3470
3493
  try {
3471
3494
  Ce();
3472
- let t = await Mn.startSession(xe());
3495
+ let t = await In.startSession(xe());
3473
3496
  if (S || e !== O) {
3474
3497
  t.destroy();
3475
3498
  return;
@@ -3479,19 +3502,19 @@ function er(e, t) {
3479
3502
  container: v,
3480
3503
  ...Se(),
3481
3504
  onWidgetAudioSettings: (e) => {
3482
- S || J(e);
3505
+ S || ze(e);
3483
3506
  },
3484
3507
  onWidgetDragStart: (e) => {
3485
- S || de(e);
3508
+ S || le(e);
3486
3509
  },
3487
3510
  onWidgetDragMove: (e) => {
3488
- S || fe(e);
3511
+ S || ue(e);
3489
3512
  },
3490
3513
  onWidgetDragEnd: (e) => {
3491
- S || pe(e);
3514
+ S || de(e);
3492
3515
  },
3493
3516
  onPlayerStatusChange: (e) => {
3494
- S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
3517
+ S || (e === "error" ? G("Could not load the experience.") : $(a.dataset.state) && G(null));
3495
3518
  }
3496
3519
  });
3497
3520
  if (S || e !== O) {
@@ -3504,7 +3527,7 @@ function er(e, t) {
3504
3527
  } catch (n) {
3505
3528
  if (S || e !== O) return;
3506
3529
  let r = n instanceof Error ? n : Error(String(n));
3507
- K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3530
+ G(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3508
3531
  } finally {
3509
3532
  e === O && (x = !1);
3510
3533
  }
@@ -3516,7 +3539,7 @@ function er(e, t) {
3516
3539
  return;
3517
3540
  }
3518
3541
  if (b && E) {
3519
- Ne();
3542
+ Me();
3520
3543
  return;
3521
3544
  }
3522
3545
  if (T || b) {
@@ -3526,47 +3549,47 @@ function er(e, t) {
3526
3549
  Ie();
3527
3550
  }
3528
3551
  }, Re = (e) => {
3529
- if (e.stopPropagation(), R() === "expanded") {
3552
+ if (e.stopPropagation(), B() === "expanded") {
3530
3553
  ke();
3531
3554
  return;
3532
3555
  }
3533
- R() === "docked" && Ae();
3534
- }, J = (e) => {
3556
+ B() === "docked" && Ae();
3557
+ }, ze = (e) => {
3535
3558
  g.setAttribute("aria-pressed", e ? "true" : "false");
3536
3559
  }, Be = (e) => {
3537
3560
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
3538
- }, Ve = (e) => {
3539
- R() === "docked" && Wn() && (e.target?.closest("button") || (e.preventDefault(), ue(e.clientX, e.clientY, e.pointerId)));
3561
+ }, J = (e) => {
3562
+ B() === "docked" && Jn() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
3540
3563
  }, He = (e) => {
3541
3564
  e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Oe());
3542
3565
  }, Ue = () => {
3543
3566
  if (!S) {
3544
- if (R() === "docked") {
3545
- if (!Wn()) {
3567
+ if (B() === "docked") {
3568
+ if (!Jn()) {
3546
3569
  Ae();
3547
3570
  return;
3548
3571
  }
3549
3572
  D ? W(() => {
3550
- me(!0);
3551
- }) : me(!0);
3573
+ pe(!0);
3574
+ }) : pe(!0);
3552
3575
  return;
3553
3576
  }
3554
- H();
3577
+ fe();
3555
3578
  }
3556
- }, Y = typeof window < "u" ? window.matchMedia(Pn) : null, We = () => {
3579
+ }, We = typeof window < "u" ? window.matchMedia(Rn) : null, Ge = () => {
3557
3580
  if (!S) {
3558
- if (R() === "docked" && !Wn()) {
3581
+ if (B() === "docked" && !Jn()) {
3559
3582
  Ae();
3560
3583
  return;
3561
3584
  }
3562
- H();
3585
+ fe();
3563
3586
  }
3564
3587
  };
3565
3588
  return o.addEventListener("click", Le), d.addEventListener("click", Oe), _.addEventListener("click", (e) => {
3566
3589
  e.stopPropagation(), Oe();
3567
- }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), Y?.addEventListener("change", We), be(), H(), r === "eager" ? queueMicrotask(() => {
3590
+ }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", J), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), be(), fe(), r === "eager" ? queueMicrotask(() => {
3568
3591
  S || q();
3569
- }) : r === "idle" && (j = $n(() => {
3592
+ }) : r === "idle" && (j = rr(() => {
3570
3593
  S || q();
3571
3594
  })), {
3572
3595
  root: a,
@@ -3582,18 +3605,18 @@ function er(e, t) {
3582
3605
  q();
3583
3606
  },
3584
3607
  destroy() {
3585
- S || (S = !0, V(), j?.(), j = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), Y?.removeEventListener("change", We), De(), Ee(), e.replaceChildren());
3608
+ S || (S = !0, U(), j?.(), j = null, z.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), De(), Ee(), e.replaceChildren());
3586
3609
  }
3587
3610
  };
3588
3611
  }
3589
3612
  //#endregion
3590
3613
  //#region src/react/ExperienceWidget.tsx
3591
- function tr(t) {
3592
- let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed: ee, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = t, ne = m === "bottom-right" || m === "bottom-left";
3614
+ function ar(t) {
3615
+ let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed: N, onStarted: P, onClose: F, onError: I, onPrefetchReady: ee, onFeedback: te, onFeedbackFailed: L } = t, R = m === "bottom-right" || m === "bottom-left";
3593
3616
  return e(() => {
3594
3617
  let e = r.current;
3595
3618
  if (!e || !i.trim()) return;
3596
- let t = er(e, {
3619
+ let t = ir(e, {
3597
3620
  experienceId: i,
3598
3621
  alt: o,
3599
3622
  galleryThumb: s,
@@ -3620,14 +3643,14 @@ function tr(t) {
3620
3643
  startButtonLabel: O,
3621
3644
  startButton: k,
3622
3645
  showFeedback: A,
3623
- onFeedback: I,
3646
+ onFeedback: te,
3624
3647
  onFeedbackFailed: L,
3625
3648
  onExpanded: M,
3626
- onCollapsed: ee,
3627
- onStarted: N,
3628
- onClose: P,
3629
- onError: F,
3630
- onPrefetchReady: te
3649
+ onCollapsed: N,
3650
+ onStarted: P,
3651
+ onClose: F,
3652
+ onError: I,
3653
+ onPrefetchReady: ee
3631
3654
  });
3632
3655
  return () => t.destroy();
3633
3656
  }, [
@@ -3657,18 +3680,18 @@ function tr(t) {
3657
3680
  O,
3658
3681
  k,
3659
3682
  A,
3660
- I,
3683
+ te,
3661
3684
  L,
3662
3685
  M,
3663
- ee,
3664
3686
  N,
3665
3687
  P,
3666
3688
  F,
3667
- te
3689
+ I,
3690
+ ee
3668
3691
  ]), /* @__PURE__ */ a("div", {
3669
3692
  ref: r,
3670
3693
  className: j,
3671
- style: ne ? { display: "contents" } : {
3694
+ style: R ? { display: "contents" } : {
3672
3695
  width: "100%",
3673
3696
  height: "100%",
3674
3697
  minHeight: "inherit"
@@ -3677,11 +3700,11 @@ function tr(t) {
3677
3700
  }
3678
3701
  //#endregion
3679
3702
  //#region src/next/index.ts
3680
- function nr(e = {}) {
3703
+ function or(e = {}) {
3681
3704
  let t = v(e);
3682
3705
  return { POST: ({ request: e }) => t(e) };
3683
3706
  }
3684
3707
  //#endregion
3685
- export { je as ExperienceThumbnail, tr as ExperienceWidget, v as createLiformaSessionRouteHandler, nr as createLiformaSvelteKitSessionHandler };
3708
+ export { Ne as ExperienceThumbnail, ar as ExperienceWidget, v as createLiformaSessionRouteHandler, or as createLiformaSvelteKitSessionHandler };
3686
3709
 
3687
3710
  //# sourceMappingURL=index.js.map