@liforma/client 0.4.1 → 0.4.2

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 (98) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/next/index.js +676 -565
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/next/createLiformaSessionRouteHandler.d.ts +0 -1
  5. package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -1
  6. package/dist/next/react/ExperienceThumbnail.d.ts +1 -0
  7. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  8. package/dist/next/thumbnail/styles.d.ts.map +1 -1
  9. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  10. package/dist/next/thumbnail/types.d.ts +2 -0
  11. package/dist/next/thumbnail/types.d.ts.map +1 -1
  12. package/dist/next/v2/api/mintPublicSession.d.ts +2 -2
  13. package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -1
  14. package/dist/next/v2/api/sessionEndpointRequest.d.ts +2 -2
  15. package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  16. package/dist/next/v2/embed/iframeHost.d.ts +1 -3
  17. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  18. package/dist/next/v2/errors/LiformaError.d.ts +23 -0
  19. package/dist/next/v2/errors/LiformaError.d.ts.map +1 -0
  20. package/dist/next/v2/experience.d.ts +7 -9
  21. package/dist/next/v2/experience.d.ts.map +1 -1
  22. package/dist/next/v2/experienceEvents.d.ts +21 -15
  23. package/dist/next/v2/experienceEvents.d.ts.map +1 -1
  24. package/dist/next/v2/types/sessionLaunch.d.ts +28 -5
  25. package/dist/next/v2/types/sessionLaunch.d.ts.map +1 -1
  26. package/dist/next/v2/types/sessionManifest.d.ts +8 -0
  27. package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
  28. package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
  29. package/dist/npm/index.js +585 -472
  30. package/dist/npm/index.js.map +1 -1
  31. package/dist/npm/thumbnail/styles.d.ts.map +1 -1
  32. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  33. package/dist/npm/thumbnail/types.d.ts +2 -0
  34. package/dist/npm/thumbnail/types.d.ts.map +1 -1
  35. package/dist/npm/v2/api/mintPublicSession.d.ts +2 -2
  36. package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -1
  37. package/dist/npm/v2/api/sessionEndpointRequest.d.ts +2 -2
  38. package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  39. package/dist/npm/v2/embed/iframeHost.d.ts +1 -3
  40. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  41. package/dist/npm/v2/errors/LiformaError.d.ts +23 -0
  42. package/dist/npm/v2/errors/LiformaError.d.ts.map +1 -0
  43. package/dist/npm/v2/experience.d.ts +7 -9
  44. package/dist/npm/v2/experience.d.ts.map +1 -1
  45. package/dist/npm/v2/experienceEvents.d.ts +21 -15
  46. package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
  47. package/dist/npm/v2/index.d.ts +4 -2
  48. package/dist/npm/v2/index.d.ts.map +1 -1
  49. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  50. package/dist/npm/v2/liforma-experience-widget.d.ts.map +1 -1
  51. package/dist/npm/v2/npm.d.ts +5 -3
  52. package/dist/npm/v2/npm.d.ts.map +1 -1
  53. package/dist/npm/v2/types/index.d.ts +2 -2
  54. package/dist/npm/v2/types/index.d.ts.map +1 -1
  55. package/dist/npm/v2/types/sessionLaunch.d.ts +28 -5
  56. package/dist/npm/v2/types/sessionLaunch.d.ts.map +1 -1
  57. package/dist/npm/v2/types/sessionManifest.d.ts +8 -0
  58. package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
  59. package/dist/npm/v2/types/sessionManifestSchema.d.ts +7 -0
  60. package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
  61. package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
  62. package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
  63. package/dist/react/component/experienceComponentRuntime.d.ts +0 -2
  64. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  65. package/dist/react/component/experienceComponentTypes.d.ts +1 -5
  66. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  67. package/dist/react/index.js +775 -665
  68. package/dist/react/index.js.map +1 -1
  69. package/dist/react/react/Experience.d.ts.map +1 -1
  70. package/dist/react/react/ExperienceThumbnail.d.ts +1 -0
  71. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  72. package/dist/react/thumbnail/styles.d.ts.map +1 -1
  73. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  74. package/dist/react/thumbnail/types.d.ts +2 -0
  75. package/dist/react/thumbnail/types.d.ts.map +1 -1
  76. package/dist/react/v2/api/mintPublicSession.d.ts +2 -2
  77. package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -1
  78. package/dist/react/v2/api/sessionEndpointRequest.d.ts +2 -2
  79. package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  80. package/dist/react/v2/embed/iframeHost.d.ts +1 -3
  81. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  82. package/dist/react/v2/errors/LiformaError.d.ts +23 -0
  83. package/dist/react/v2/errors/LiformaError.d.ts.map +1 -0
  84. package/dist/react/v2/experience.d.ts +7 -9
  85. package/dist/react/v2/experience.d.ts.map +1 -1
  86. package/dist/react/v2/experienceEvents.d.ts +21 -15
  87. package/dist/react/v2/experienceEvents.d.ts.map +1 -1
  88. package/dist/react/v2/types/sessionLaunch.d.ts +28 -5
  89. package/dist/react/v2/types/sessionLaunch.d.ts.map +1 -1
  90. package/dist/react/v2/types/sessionManifest.d.ts +8 -0
  91. package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
  92. package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
  93. package/dist/sdk/v2/client.js +36 -13
  94. package/dist/sdk/v2/client.js.map +1 -1
  95. package/dist/svelte/Experience.svelte +0 -6
  96. package/dist/svelte/ExperienceThumbnail.svelte +8 -1
  97. package/dist/svelte/ExperienceThumbnail.svelte.d.ts +1 -0
  98. package/package.json +3 -1
@@ -39,12 +39,9 @@ function g(e) {
39
39
  return e === void 0 || e === "auto" || e === "manual" || e === "off";
40
40
  }
41
41
  function _(e) {
42
- return e === void 0 || e === "managed" || e === "custom" || e === "manual";
43
- }
44
- function v(e) {
45
42
  return e === 400 || e === 401 || e === 403 || e === 404 || e === 429 ? e : 502;
46
43
  }
47
- function y(e = {}) {
44
+ function v(e = {}) {
48
45
  let t = e.getApiKey ?? l, n = e.getApiBaseUrl ?? u, r = e.fetch ?? fetch;
49
46
  return async (i) => {
50
47
  if (!e.authorize && e.allowUnauthenticated !== !0) return c({ message: "Session route requires authorize() or allowUnauthenticated: true. Open mint proxies are not allowed by default." }, 403);
@@ -55,24 +52,24 @@ function y(e = {}) {
55
52
  if (l?.locale !== void 0 && !p(l.locale) || l?.language !== void 0 && l?.locale === void 0 && !m(l.language)) return c({ message: "Invalid locale." }, 400);
56
53
  if (!h(l?.mode)) return c({ message: "Invalid mode." }, 400);
57
54
  if (!g(l?.speechInputMode)) return c({ message: "Invalid speechInputMode." }, 400);
58
- if (!_(l?.responseMode)) return c({ message: "Invalid responseMode." }, 400);
59
55
  if (e.authorize) {
60
56
  let t = await e.authorize(i, l ?? {});
61
57
  if (t instanceof Response) return t;
62
58
  }
63
- let y = { experienceId: u }, b = l?.locale?.trim() || l?.language?.trim();
64
- b && (y.locale = b), l?.mode && (y.mode = l.mode), l?.responseMode && (y.responseMode = l.responseMode), l?.speechInputMode && (y.speechInputMode = l.speechInputMode), l?.speechOnly === !0 && (y.speechOnly = !0), l?.speechOnly === !1 && (y.speechOnly = !1), l?.processorId?.trim() && (y.processorId = l.processorId.trim());
65
- let x = await r(`${o}/v1/sessions`, {
59
+ let v = { experienceId: u }, y = l?.locale?.trim() || l?.language?.trim();
60
+ y && (v.locale = y), l?.mode && (v.mode = l.mode), l?.speechInputMode && (v.speechInputMode = l.speechInputMode), l?.speechOnly === !0 && (v.speechOnly = !0), l?.speechOnly === !1 && (v.speechOnly = !1), l?.processorId?.trim() && (v.processorId = l.processorId.trim());
61
+ let b = i.headers.get("Idempotency-Key")?.trim(), x = await r(`${o}/v1/sessions`, {
66
62
  method: "POST",
67
63
  headers: {
68
64
  Authorization: `Bearer ${a}`,
69
65
  "Content-Type": "application/json",
70
- Accept: "application/json"
66
+ Accept: "application/json",
67
+ ...b ? { "Idempotency-Key": b } : {}
71
68
  },
72
- body: JSON.stringify(y)
69
+ body: JSON.stringify(v)
73
70
  });
74
71
  if (!x.ok) {
75
- let e = v(x.status), t = "Could not start session.";
72
+ let e = _(x.status), t = "Could not start session.";
76
73
  try {
77
74
  let e = await x.json();
78
75
  typeof e.message == "string" && e.message.trim() && (t = e.message);
@@ -91,12 +88,12 @@ function y(e = {}) {
91
88
  }
92
89
  //#endregion
93
90
  //#region src/thumbnail/toGalleryThumbUrl.ts
94
- var b = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, x = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
91
+ var y = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, b = /_CH(\.webp)/i, x = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
95
92
  function S(e) {
96
93
  let t = e.trim();
97
94
  if (!t) return t;
98
- let n = t.replace(b, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
99
- return n = n.replace(x, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
95
+ let n = t.replace(y, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
96
+ return n = n.replace(b, "_neutral$1"), n = n.replace(x, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
100
97
  }
101
98
  function ee(e) {
102
99
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
@@ -172,7 +169,7 @@ function F() {
172
169
  }, t);
173
170
  }
174
171
  }
175
- function I(e) {
172
+ function te(e) {
176
173
  if (!A()) return e(), () => {};
177
174
  let t = {
178
175
  start: e,
@@ -184,21 +181,21 @@ function I(e) {
184
181
  }
185
182
  //#endregion
186
183
  //#region src/thumbnail/lazyLoad.ts
187
- function L() {
184
+ function I() {
188
185
  return A() ? "96px 0px" : "280px 0px";
189
186
  }
190
- function R(e) {
187
+ function L(e) {
191
188
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
192
189
  return Number.isFinite(n) ? Math.abs(n) : 280;
193
190
  }
194
- function te(e, t) {
191
+ function ne(e, t) {
195
192
  if (typeof window > "u") return !1;
196
193
  let n = e.getBoundingClientRect();
197
194
  return n.bottom >= -t && n.top <= window.innerHeight + t;
198
195
  }
199
- function ne(e, t) {
200
- let { onVisibleChange: n } = t, r = t.rootMargin ?? L(), i = R(r), a = !1, o = !1, s = null, c = () => {
201
- o || (s?.(), s = I(() => {
196
+ function re(e, t) {
197
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? I(), i = L(r), a = !1, o = !1, s = null, c = () => {
198
+ o || (s?.(), s = te(() => {
202
199
  s = null, o = !0, n(!0);
203
200
  }));
204
201
  }, l = (e) => {
@@ -220,55 +217,55 @@ function ne(e, t) {
220
217
  rootMargin: r,
221
218
  threshold: 0
222
219
  });
223
- return u.observe(e), te(e, i) && l(!0), () => {
220
+ return u.observe(e), ne(e, i) && l(!0), () => {
224
221
  s?.(), s = null, u.disconnect();
225
222
  };
226
223
  }
227
224
  //#endregion
228
225
  //#region src/thumbnail/scrollParallax.ts
229
- function re() {
226
+ function ie() {
230
227
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
231
228
  }
232
- function z(e, t) {
229
+ function R(e, t) {
233
230
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
234
231
  }
235
- var B = /* @__PURE__ */ new Set(), V = !1, H = 0;
236
- function ie() {
237
- if (H = 0, B.size === 0 || typeof window > "u") return;
232
+ var z = /* @__PURE__ */ new Set(), B = !1, V = 0;
233
+ function ae() {
234
+ if (V = 0, z.size === 0 || typeof window > "u") return;
238
235
  let e = window.innerHeight;
239
- for (let t of B) {
236
+ for (let t of z) {
240
237
  if (t.pointerActive?.()) continue;
241
238
  let n = t.element.getBoundingClientRect();
242
- n.bottom < -64 || n.top > e + 64 || t.onParallax(z(n, e));
239
+ n.bottom < -64 || n.top > e + 64 || t.onParallax(R(n, e));
243
240
  }
244
241
  }
245
- function ae() {
246
- H === 0 && (H = requestAnimationFrame(ie));
247
- }
248
242
  function oe() {
249
- V || typeof window > "u" || (V = !0, window.addEventListener("scroll", ae, { passive: !0 }), window.addEventListener("resize", ae, { passive: !0 }));
243
+ V === 0 && (V = requestAnimationFrame(ae));
250
244
  }
251
245
  function se() {
252
- B.size > 0 || !V || typeof window > "u" || (V = !1, H !== 0 && (cancelAnimationFrame(H), H = 0), window.removeEventListener("scroll", ae), window.removeEventListener("resize", ae));
246
+ B || typeof window > "u" || (B = !0, window.addEventListener("scroll", oe, { passive: !0 }), window.addEventListener("resize", oe, { passive: !0 }));
247
+ }
248
+ function ce() {
249
+ z.size > 0 || !B || typeof window > "u" || (B = !1, V !== 0 && (cancelAnimationFrame(V), V = 0), window.removeEventListener("scroll", oe), window.removeEventListener("resize", oe));
253
250
  }
254
- function U(e, t) {
255
- if (!re()) return () => {};
251
+ function H(e, t) {
252
+ if (!ie()) return () => {};
256
253
  let n = {
257
254
  element: e,
258
255
  onParallax: t.onParallax,
259
256
  pointerActive: t.pointerActive
260
257
  };
261
- return B.add(n), oe(), n.pointerActive?.() || t.onParallax(z(e.getBoundingClientRect(), window.innerHeight)), () => {
262
- B.delete(n), se();
258
+ return z.add(n), se(), n.pointerActive?.() || t.onParallax(R(e.getBoundingClientRect(), window.innerHeight)), () => {
259
+ z.delete(n), ce();
263
260
  };
264
261
  }
265
262
  //#endregion
266
263
  //#region src/thumbnail/attachThumbnailParallax.ts
267
- function ce(e) {
264
+ function le(e) {
268
265
  let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
269
266
  let a = r || i;
270
267
  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));
271
- }, s = U(e, {
268
+ }, s = H(e, {
272
269
  onParallax: (e) => {
273
270
  i = !0, a || (t = e, n = 0, o());
274
271
  },
@@ -281,7 +278,7 @@ function ce(e) {
281
278
  a = !0, e.pointerType === "mouse" && (r = !0), o();
282
279
  }, u = () => {
283
280
  let s = a;
284
- a = !1, r = !1, i && s ? (t = z(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
281
+ a = !1, r = !1, i && s ? (t = R(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
285
282
  }, d = (e) => {
286
283
  e.pointerType === "mouse" && (r = !0, o());
287
284
  }, f = () => {
@@ -293,107 +290,107 @@ function ce(e) {
293
290
  }
294
291
  //#endregion
295
292
  //#region src/thumbnail/styles.ts
296
- var le = ".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.65rem;\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: cover;\n object-position: 50% 30%;\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.liforma-et--scene .liforma-et__avatar {\n object-fit: contain;\n object-position: center bottom;\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:not(.liforma-et--scene) {\n --liforma-et-avatar-scale: 1.05;\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__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", ue = !1;
293
+ var ue = ".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.65rem;\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.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--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}", U = !1;
297
294
  function de(e) {
298
- if (typeof document > "u" || ue) return;
295
+ if (typeof document > "u" || U) return;
299
296
  if (document.querySelector("style[data-liforma-et]")) {
300
- ue = !0;
297
+ U = !0;
301
298
  return;
302
299
  }
303
300
  let t = document.createElement("style");
304
- t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), ue = !0;
301
+ t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), U = !0;
305
302
  }
306
303
  //#endregion
307
304
  //#region src/react/ExperienceThumbnail.tsx
308
305
  function W(e, t) {
309
306
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
310
307
  }
311
- function G(s) {
312
- let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, lazy: x = !0, className: S = "", fallbackImage: C } = s, w = t(() => ee({
308
+ function fe(s) {
309
+ let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w } = s, T = t(() => ee({
313
310
  galleryThumb: c,
314
311
  avatarImage: l,
315
312
  backgroundImage: u,
316
313
  foregroundImage: d,
317
- fallbackImage: C
314
+ fallbackImage: w
318
315
  }), [
319
316
  c,
320
317
  l,
321
318
  u,
322
319
  d,
323
- C
324
- ]), T = E({
320
+ w
321
+ ]), D = E({
325
322
  href: m,
326
323
  hasClickHandler: typeof _ == "function",
327
324
  experienceId: p
328
- }), D = T === "anchor" && !m?.trim() && !!p?.trim(), O = !!w?.backgroundImage, A = b !== !1, j = n(null), M = n(!1), [N, P] = r(!x), [F, I] = r(!1), [L, R] = r(!1), [te, re] = r(0), [B, V] = r(0), [H, ie] = r(!1), [ae, oe] = r(!1), [se, ce] = r(!1), [ue, G] = r(!1), [fe, K] = r(), pe = w ? H && w.fallbackImage ? w.fallbackImage : w.avatarImage : "";
325
+ }), O = D === "anchor" && !m?.trim() && !!p?.trim(), A = !!T?.backgroundImage, j = b !== !1, M = n(null), N = n(!1), [P, F] = r(!S), [te, I] = r(!1), [L, ne] = r(!1), [ie, z] = r(0), [B, V] = r(0), [ae, oe] = r(!1), [se, ce] = r(!1), [le, U] = r(!1), [fe, pe] = r(!1), [G, me] = r(), K = T ? ae && T.fallbackImage ? T.fallbackImage : T.avatarImage : "";
329
326
  e(() => {
330
- de(le);
327
+ de(ue);
331
328
  }, []), e(() => {
332
- K(k({
329
+ me(k({
333
330
  href: m,
334
331
  experienceId: p,
335
332
  returnUrl: v,
336
333
  playerBaseUrl: y,
337
- useCurrentPageAsReturnUrl: D && !v?.trim()
334
+ useCurrentPageAsReturnUrl: O && !v?.trim()
338
335
  }));
339
336
  }, [
340
337
  m,
341
338
  p,
342
339
  v,
343
340
  y,
344
- D
341
+ O
345
342
  ]), e(() => {
346
- oe(!1), ce(!1), G(!1), ie(!1);
343
+ ce(!1), U(!1), pe(!1), oe(!1);
347
344
  }, [
348
- w?.backgroundImage,
349
- w?.foregroundImage,
350
- pe
345
+ T?.backgroundImage,
346
+ T?.foregroundImage,
347
+ K
351
348
  ]), e(() => {
352
- let e = j.current;
349
+ let e = M.current;
353
350
  if (e) {
354
- if (!x) {
355
- P(!0);
351
+ if (!S) {
352
+ F(!0);
356
353
  return;
357
354
  }
358
- return ne(e, { onVisibleChange: (e) => {
359
- e && P(!0);
355
+ return re(e, { onVisibleChange: (e) => {
356
+ e && F(!0);
360
357
  } });
361
358
  }
362
359
  }, [
363
- x,
364
- w,
360
+ S,
365
361
  T,
366
- fe
362
+ D,
363
+ G
367
364
  ]), e(() => {
368
- let e = j.current;
369
- if (!(!e || !A)) return U(e, {
365
+ let e = M.current;
366
+ if (!(!e || !j)) return H(e, {
370
367
  onParallax: (e) => {
371
- R(!0), M.current || (re(e), V(0));
368
+ ne(!0), N.current || (z(e), V(0));
372
369
  },
373
- pointerActive: () => M.current
370
+ pointerActive: () => N.current
374
371
  });
375
372
  }, [
376
- A,
377
- w,
373
+ j,
378
374
  T,
379
- fe
375
+ D,
376
+ G
380
377
  ]);
381
- let me = (e) => {
382
- if (!A || L) return;
378
+ let he = (e) => {
379
+ if (!j || L) return;
383
380
  let t = e.currentTarget.getBoundingClientRect();
384
- t.width <= 0 || t.height <= 0 || (re(((e.clientX - t.left) / t.width - .5) * 2), V(((e.clientY - t.top) / t.height - .5) * 2));
385
- }, he = (e) => {
386
- let t = M.current;
387
- M.current = !1, I(!1), L && t ? (re(z(e.getBoundingClientRect(), window.innerHeight)), V(0)) : L || (re(0), V(0));
381
+ t.width <= 0 || t.height <= 0 || (z(((e.clientX - t.left) / t.width - .5) * 2), V(((e.clientY - t.top) / t.height - .5) * 2));
388
382
  }, ge = (e) => {
389
- if (!A) return;
390
- M.current = !0, e.pointerType === "mouse" && I(!0);
383
+ let t = N.current;
384
+ N.current = !1, I(!1), L && t ? (z(R(e.getBoundingClientRect(), window.innerHeight)), V(0)) : L || (z(0), V(0));
385
+ }, q = (e) => {
386
+ if (!j) return;
387
+ N.current = !0, e.pointerType === "mouse" && I(!0);
391
388
  let t = e.currentTarget, n = () => {
392
- he(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
389
+ ge(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
393
390
  };
394
391
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
395
- }, q = (e) => {
396
- if (_?.(e), !e.defaultPrevented && D && !v?.trim()) {
392
+ }, _e = (e) => {
393
+ if (_?.(e), !e.defaultPrevented && O && !v?.trim()) {
397
394
  let t = k({
398
395
  experienceId: p,
399
396
  playerBaseUrl: y,
@@ -402,17 +399,18 @@ function G(s) {
402
399
  t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
403
400
  }
404
401
  };
405
- if (!w) return null;
406
- let _e = A && (F || L), ve = N && (se || ae || ue), ye = [
402
+ if (!T) return null;
403
+ let ve = j && (te || L), J = P && (le || se || fe), ye = [
407
404
  "liforma-et",
408
- O ? "liforma-et--scene" : "",
409
- _e ? "liforma-et--parallax" : "",
405
+ A ? "liforma-et--scene" : "",
406
+ x === "face" ? "liforma-et--fit-face" : "",
407
+ ve ? "liforma-et--parallax" : "",
410
408
  L ? "liforma-et--scroll-parallax" : "",
411
- N && !ve ? "liforma-et--loading" : "",
412
- ve ? "liforma-et--revealed" : "",
413
- S
409
+ P && !J ? "liforma-et--loading" : "",
410
+ J ? "liforma-et--revealed" : "",
411
+ C
414
412
  ].filter(Boolean).join(" "), be = {
415
- "--liforma-et-parallax-x": te,
413
+ "--liforma-et-parallax-x": ie,
416
414
  "--liforma-et-parallax-y": B
417
415
  }, xe = (e, t) => {
418
416
  e.complete && t(!0);
@@ -421,102 +419,102 @@ function G(s) {
421
419
  className: "liforma-et__placeholder",
422
420
  "aria-hidden": "true"
423
421
  }),
424
- N && w.backgroundImage ? /* @__PURE__ */ a("img", {
425
- className: W("liforma-et__background", ae),
426
- src: w.backgroundImage,
422
+ P && T.backgroundImage ? /* @__PURE__ */ a("img", {
423
+ className: W("liforma-et__background", se),
424
+ src: T.backgroundImage,
427
425
  alt: "",
428
426
  decoding: "async",
429
427
  ref: (e) => {
430
- e && xe(e, oe);
428
+ e && xe(e, ce);
431
429
  },
432
- onLoad: () => oe(!0),
433
- onError: () => oe(!0)
430
+ onLoad: () => ce(!0),
431
+ onError: () => ce(!0)
434
432
  }) : null,
435
- N && pe ? /* @__PURE__ */ a("img", {
436
- className: W("liforma-et__avatar", se),
437
- src: pe,
433
+ P && K ? /* @__PURE__ */ a("img", {
434
+ className: W("liforma-et__avatar", le),
435
+ src: K,
438
436
  alt: "",
439
437
  decoding: "async",
440
438
  ref: (e) => {
441
- e && xe(e, ce);
439
+ e && xe(e, U);
442
440
  },
443
- onLoad: () => ce(!0),
441
+ onLoad: () => U(!0),
444
442
  onError: () => {
445
- w.fallbackImage ? ie(!0) : ce(!0);
443
+ T.fallbackImage ? oe(!0) : U(!0);
446
444
  }
447
445
  }) : null,
448
- N && w.foregroundImage ? /* @__PURE__ */ a("img", {
449
- className: W("liforma-et__foreground", ue),
450
- src: w.foregroundImage,
446
+ P && T.foregroundImage ? /* @__PURE__ */ a("img", {
447
+ className: W("liforma-et__foreground", fe),
448
+ src: T.foregroundImage,
451
449
  alt: "",
452
450
  decoding: "async",
453
451
  ref: (e) => {
454
- e && xe(e, G);
452
+ e && xe(e, pe);
455
453
  },
456
- onLoad: () => G(!0),
457
- onError: () => G(!0)
454
+ onLoad: () => pe(!0),
455
+ onError: () => pe(!0)
458
456
  }) : null
459
- ] }), J = {
460
- onPointerDown: ge,
461
- onPointerUp: (e) => he(e.currentTarget),
462
- onPointerCancel: (e) => he(e.currentTarget),
457
+ ] }), Ce = {
458
+ onPointerDown: q,
459
+ onPointerUp: (e) => ge(e.currentTarget),
460
+ onPointerCancel: (e) => ge(e.currentTarget),
463
461
  onPointerEnter: (e) => {
464
- A && e.pointerType === "mouse" && I(!0);
462
+ j && e.pointerType === "mouse" && I(!0);
465
463
  },
466
- onPointerMove: me,
464
+ onPointerMove: he,
467
465
  onPointerLeave: () => {
468
- M.current || (I(!1), L || (re(0), V(0)));
466
+ N.current || (I(!1), L || (z(0), V(0)));
469
467
  }
470
- }, Ce = (e) => {
471
- j.current = e;
468
+ }, Y = (e) => {
469
+ M.current = e;
472
470
  };
473
- return T === "anchor" && fe ? /* @__PURE__ */ a("a", {
474
- ref: Ce,
471
+ return D === "anchor" && G ? /* @__PURE__ */ a("a", {
472
+ ref: Y,
475
473
  className: ye,
476
474
  style: be,
477
- href: fe,
475
+ href: G,
478
476
  target: h,
479
477
  rel: g,
480
478
  "aria-label": f,
481
- onClick: q,
482
- ...J,
479
+ onClick: _e,
480
+ ...Ce,
483
481
  children: Se
484
- }) : T === "button" ? /* @__PURE__ */ a("button", {
482
+ }) : D === "button" ? /* @__PURE__ */ a("button", {
485
483
  type: "button",
486
- ref: Ce,
484
+ ref: Y,
487
485
  className: ye,
488
486
  style: be,
489
487
  "aria-label": f,
490
- onClick: q,
491
- ...J,
488
+ onClick: _e,
489
+ ...Ce,
492
490
  children: Se
493
491
  }) : /* @__PURE__ */ a("div", {
494
- ref: Ce,
492
+ ref: Y,
495
493
  className: ye,
496
494
  style: be,
497
495
  role: f ? "img" : void 0,
498
496
  "aria-label": f || void 0,
499
497
  "aria-hidden": f ? void 0 : !0,
500
- ...J,
498
+ ...Ce,
501
499
  children: Se
502
500
  });
503
501
  }
504
502
  //#endregion
505
503
  //#region src/widget/styles.ts
506
- var fe = "\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", K = "liforma-experience-widget-styles";
507
- function pe(e = fe) {
504
+ 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", G = "liforma-experience-widget-styles";
505
+ function me(e = pe) {
508
506
  if (typeof document > "u") return;
509
- let t = document.getElementById(K);
507
+ let t = document.getElementById(G);
510
508
  if (t) {
511
509
  t.textContent = e;
512
510
  return;
513
511
  }
514
512
  let n = document.createElement("style");
515
- n.id = K, n.textContent = e, document.head.append(n);
513
+ n.id = G, n.textContent = e, document.head.append(n);
516
514
  }
517
515
  //#endregion
518
516
  //#region src/shims/apiBaseUrl.ts
519
- var me = "https://api.liforma.ai", he = "http://localhost:3001";
517
+ var K = "https://api.liforma.ai", he = "http://localhost:3001";
520
518
  function ge() {
521
519
  let e = globalThis.__LIFORMA_API_BASE_URL;
522
520
  if (e?.trim()) return e.trim().replace(/\/$/, "");
@@ -525,7 +523,7 @@ function ge() {
525
523
  return t ? t.replace(/\/$/, "") : null;
526
524
  }
527
525
  function q() {
528
- return ge() || (C() ? he : me);
526
+ return ge() || (C() ? he : K);
529
527
  }
530
528
  //#endregion
531
529
  //#region src/v2/api/fetchExperiencePreview.ts
@@ -570,20 +568,47 @@ async function ve(e, t) {
570
568
  };
571
569
  }
572
570
  //#endregion
573
- //#region src/v2/api/sessionEndpointRequest.ts
571
+ //#region src/v2/errors/LiformaError.ts
572
+ var J = class extends Error {
573
+ code;
574
+ requestId;
575
+ status;
576
+ details;
577
+ constructor(e, t) {
578
+ 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;
579
+ }
580
+ };
574
581
  function ye(e) {
582
+ if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
583
+ }
584
+ function be(e, t, n) {
585
+ let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
586
+ try {
587
+ i = JSON.parse(t);
588
+ } catch {}
589
+ 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 } = ye(a) ?? ye(i) ?? {};
590
+ return new J(u, {
591
+ code: l,
592
+ requestId: d,
593
+ status: e,
594
+ details: Object.keys(h).length > 0 ? h : void 0
595
+ });
596
+ }
597
+ //#endregion
598
+ //#region src/v2/api/sessionEndpointRequest.ts
599
+ function xe(e) {
575
600
  let t = e.locale?.trim();
576
601
  if (t) return t;
577
602
  let n = e.language?.trim();
578
603
  if (n) return n;
579
604
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
580
605
  }
581
- function be(e) {
606
+ function Se(e) {
582
607
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
583
608
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
584
609
  return t || n || void 0;
585
610
  }
586
- function xe(e, t) {
611
+ function Ce(e, t) {
587
612
  let n = e.trim();
588
613
  if (!n) throw Error("sessionEndpoint must not be empty.");
589
614
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -591,7 +616,7 @@ function xe(e, t) {
591
616
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
592
617
  let i = t.experienceId.trim();
593
618
  if (!i) throw Error("sessionEndpoint requires experienceId.");
594
- let a = ye(t), o = be(t);
619
+ let a = xe(t), o = Se(t), s = t.idempotencyKey?.trim();
595
620
  return {
596
621
  url: r.toString(),
597
622
  init: {
@@ -599,14 +624,14 @@ function xe(e, t) {
599
624
  credentials: "same-origin",
600
625
  headers: {
601
626
  Accept: "application/json",
602
- "Content-Type": "application/json"
627
+ "Content-Type": "application/json",
628
+ ...s ? { "Idempotency-Key": s } : {}
603
629
  },
604
630
  body: JSON.stringify({
605
631
  experienceId: i,
606
632
  ...a ? { locale: a } : {},
607
633
  ...o ? { secondaryLocale: o } : {},
608
634
  ...t.mode ? { mode: t.mode } : {},
609
- ...t.responseMode ? { responseMode: t.responseMode } : {},
610
635
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
611
636
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly }
612
637
  })
@@ -615,24 +640,44 @@ function xe(e, t) {
615
640
  }
616
641
  //#endregion
617
642
  //#region src/v2/types/sessionLaunch.ts
618
- function Se(e) {
643
+ function Y(e) {
619
644
  return !!e && typeof e == "object" && !Array.isArray(e);
620
645
  }
621
- function J(e) {
646
+ function X(e) {
622
647
  return typeof e == "boolean";
623
648
  }
624
- function Ce(e) {
625
- return !Se(e) || !J(e.avatar) || !J(e.speechInput) || !J(e.speechOutput) || !J(e.tools) || !J(e.externalAudio) ? null : {
626
- avatar: e.avatar,
627
- speechInput: e.speechInput,
628
- speechOutput: e.speechOutput,
629
- tools: e.tools,
630
- externalAudio: e.externalAudio
649
+ function we(e) {
650
+ if (!Y(e)) return null;
651
+ let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
652
+ return !Y(t) || !Y(n) || !Y(r) || !Y(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
653
+ speech: {
654
+ input: t.input,
655
+ output: t.output,
656
+ externalAudio: t.externalAudio
657
+ },
658
+ conversation: { managed: n.managed },
659
+ avatar: { enabled: r.enabled },
660
+ tools: { enabled: i.enabled }
631
661
  };
632
662
  }
633
- function we(e) {
634
- if (!Se(e)) throw Error("Session Launch response is missing session.");
635
- 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 = Ce(e.capabilities);
663
+ function Te(e) {
664
+ return !Y(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
665
+ speech: {
666
+ input: e.speechInput,
667
+ output: e.speechOutput,
668
+ externalAudio: e.externalAudio
669
+ },
670
+ conversation: { managed: !0 },
671
+ avatar: { enabled: e.avatar },
672
+ tools: { enabled: e.tools }
673
+ };
674
+ }
675
+ function Ee(e) {
676
+ return we(e) ?? Te(e);
677
+ }
678
+ function De(e) {
679
+ if (!Y(e)) throw Error("Session Launch response is missing session.");
680
+ 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 = Ee(e.capabilities), l = Oe(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;
636
681
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
637
682
  return {
638
683
  id: t,
@@ -642,76 +687,123 @@ function we(e) {
642
687
  locale: a,
643
688
  ...o ? { secondaryLocale: o } : {},
644
689
  mode: s,
645
- capabilities: c
690
+ capabilities: c,
691
+ ...l ? { localeVoiceFallbacks: l } : {},
692
+ ...u ? { status: u } : {},
693
+ ...d ? { createdAt: d } : {}
646
694
  };
647
695
  }
648
- function Te(e) {
649
- if (!Se(e)) throw Error("Session Launch response must be a JSON object.");
696
+ function Oe(e) {
697
+ if (!Array.isArray(e) || e.length === 0) return;
698
+ let t = [];
699
+ for (let n of e) {
700
+ if (!Y(n)) continue;
701
+ 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() : "";
702
+ !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
703
+ axis: e,
704
+ requested: r,
705
+ resolved: i,
706
+ reason: "voice_unsupported"
707
+ });
708
+ }
709
+ return t.length > 0 ? t : void 0;
710
+ }
711
+ function ke(e) {
712
+ let t = e.localeVoiceFallbacks;
713
+ if (t?.length) for (let e of t) {
714
+ let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
715
+ console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
716
+ }
717
+ }
718
+ function Ae(e) {
719
+ if (!Y(e)) throw Error("Session Launch response must be a JSON object.");
650
720
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
651
721
  if (!t) throw Error("Session Launch response is missing launch.");
652
- return {
653
- session: we(e.session),
722
+ let n = De(e.session);
723
+ return ke(n), {
724
+ session: n,
654
725
  launch: t
655
726
  };
656
727
  }
657
728
  //#endregion
658
729
  //#region src/v2/api/mintPublicSession.ts
659
- function Ee() {
730
+ function je() {
660
731
  try {
661
732
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
662
733
  } catch {}
663
734
  }
664
- function De(e, t, n) {
665
- let r;
666
- try {
667
- r = JSON.parse(n);
668
- } catch {}
669
- let i = Ee(), a = r?.message?.trim(), o = r?.code;
670
- if (o === "origin_not_allowed" || /^Origin not allowed/i.test(a ?? "") && i) {
671
- if (a && a.includes(e) && a.includes("allowed origin")) return a;
672
- let t = r?.origin ?? i ?? "(unknown origin)";
673
- return `Your origin ${t} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${t} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`;
735
+ function Me(e) {
736
+ return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
737
+ }
738
+ function Ne(e, t) {
739
+ let n = je(), r = Me(t.code), i = t.message.trim(), a = t.details ?? {};
740
+ if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
741
+ if (i.includes(e) && i.includes("allowed origin")) return t;
742
+ let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
743
+ return new J(`Your origin ${r} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${r} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`, {
744
+ code: "ORIGIN_NOT_ALLOWED",
745
+ requestId: t.requestId,
746
+ status: t.status,
747
+ details: a
748
+ });
674
749
  }
675
- return o === "browser_embeds_disabled" || /^Browser embeds are not enabled/i.test(a ?? "") ? a && a.includes("Allow public client-only embeds") ? a : `Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.` : o === "experience_unavailable" || /^Experience is not available\.?$/i.test(a ?? "") || /^Unknown experience\.?$/i.test(a ?? "") ? a && a.includes("No playable experience found") ? a : `No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.` : a || n.trim().slice(0, 500) || `Browser session mint failed (${t})`;
676
- }
677
- function Oe(e) {
750
+ return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new J(`Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.`, {
751
+ code: "BROWSER_EMBEDS_DISABLED",
752
+ requestId: t.requestId,
753
+ status: t.status,
754
+ details: a
755
+ }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new J(`No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.`, {
756
+ code: "EXPERIENCE_UNAVAILABLE",
757
+ requestId: t.requestId,
758
+ status: t.status,
759
+ details: a
760
+ }) : t;
761
+ }
762
+ function Pe(e) {
678
763
  let t = e?.locale?.trim();
679
764
  if (t) return t;
680
765
  let n = e?.language?.trim();
681
766
  if (n) return n;
682
767
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
683
768
  }
684
- function Y(e) {
769
+ function Fe(e) {
685
770
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
686
- if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
771
+ if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
687
772
  return t || n || void 0;
688
773
  }
689
- function ke(e, t) {
690
- let n = { experienceId: e }, r = Oe(t);
774
+ function Ie(e, t) {
775
+ let n = { experienceId: e }, r = Pe(t);
691
776
  r && (n.locale = r);
692
- let i = Y(t);
693
- return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.responseMode && (n.responseMode = t.responseMode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
777
+ let i = Fe(t);
778
+ return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
694
779
  }
695
- async function Ae(e, t) {
696
- let n = q(), r = await fetch(`${n}/v1/browser-sessions`, {
780
+ async function Le(e, t) {
781
+ let n = q(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
697
782
  method: "POST",
698
- headers: { "Content-Type": "application/json" },
699
- body: JSON.stringify(ke(e, t))
783
+ headers: {
784
+ "Content-Type": "application/json",
785
+ ...r ? { "Idempotency-Key": r } : {}
786
+ },
787
+ body: JSON.stringify(Ie(e, t))
700
788
  });
701
- if (!r.ok) {
702
- let t = await r.text();
703
- throw Error(De(e, r.status, t));
789
+ if (!i.ok) {
790
+ let t = await i.text();
791
+ throw Ne(e, be(i.status, t, i.headers));
704
792
  }
705
- let i;
793
+ let a;
706
794
  try {
707
- i = await r.json();
795
+ a = await i.json();
708
796
  } catch {
709
- throw Error("Browser session mint returned invalid JSON.");
797
+ throw new J("Browser session mint returned invalid JSON.", {
798
+ code: "INVALID_RESPONSE",
799
+ status: i.status,
800
+ requestId: i.headers.get("Liforma-Request-Id") ?? void 0
801
+ });
710
802
  }
711
- return Te(i);
803
+ return Ae(a);
712
804
  }
713
- async function je(e, t) {
714
- let n = xe(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
805
+ async function Re(e, t) {
806
+ let n = Ce(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
715
807
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
716
808
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
717
809
  try {
@@ -723,28 +815,32 @@ async function je(e, t) {
723
815
  globalThis.clearTimeout(a), t.signal?.removeEventListener("abort", i);
724
816
  }
725
817
  if (!o.ok) {
726
- let e = await o.text(), t = e.slice(0, 500) || `Session endpoint failed (${o.status})`;
727
- try {
728
- let n = JSON.parse(e);
729
- n.message && (t = n.message);
730
- } catch {}
731
- throw Error(t);
818
+ let e = await o.text();
819
+ throw be(o.status, e, o.headers);
732
820
  }
733
- if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw Error("Session endpoint must return a JSON Session Launch response.");
821
+ if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
822
+ code: "INVALID_RESPONSE",
823
+ status: o.status,
824
+ requestId: o.headers.get("Liforma-Request-Id") ?? void 0
825
+ });
734
826
  let s;
735
827
  try {
736
828
  s = await o.json();
737
829
  } catch {
738
- throw Error("Session endpoint returned invalid JSON.");
830
+ throw new J("Session endpoint returned invalid JSON.", {
831
+ code: "INVALID_RESPONSE",
832
+ status: o.status,
833
+ requestId: o.headers.get("Liforma-Request-Id") ?? void 0
834
+ });
739
835
  }
740
- return Te(s);
836
+ return Ae(s);
741
837
  }
742
838
  //#endregion
743
839
  //#region src/v2/conversationProcessor.ts
744
- function Me(e) {
840
+ function ze(e) {
745
841
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
746
842
  }
747
- function Ne(e) {
843
+ function Be(e) {
748
844
  if (typeof e == "string") {
749
845
  let t = e.trim();
750
846
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -758,24 +854,24 @@ function Ne(e) {
758
854
  ...e.behavior ? { behavior: e.behavior } : {}
759
855
  };
760
856
  }
761
- async function Pe(e, t) {
857
+ async function Ve(e, t) {
762
858
  let n = await e(t);
763
- return Me(n) ? {
859
+ return ze(n) ? {
764
860
  kind: "stream",
765
861
  stream: n
766
862
  } : {
767
863
  kind: "complete",
768
- speech: Ne(n)
864
+ speech: Be(n)
769
865
  };
770
866
  }
771
867
  //#endregion
772
868
  //#region src/v2/embed/playerReachability.ts
773
- var Fe = "3002";
774
- function Ie(e) {
869
+ var He = "3002";
870
+ function Ue(e) {
775
871
  let t = new URL(e);
776
- 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 || Fe}. 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.`;
872
+ 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 || He}. 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.`;
777
873
  }
778
- async function Le(e, t) {
874
+ async function We(e, t) {
779
875
  try {
780
876
  await fetch(e, {
781
877
  method: "GET",
@@ -783,21 +879,21 @@ async function Le(e, t) {
783
879
  signal: AbortSignal.timeout(8e3)
784
880
  });
785
881
  } catch {
786
- throw Error(Ie(t));
882
+ throw Error(Ue(t));
787
883
  }
788
884
  }
789
- function Re(e, t, n, r) {
885
+ function Ge(e, t, n, r) {
790
886
  try {
791
887
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
792
888
  } catch (e) {
793
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ie(n), { cause: e }) : e;
889
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ue(n), { cause: e }) : e;
794
890
  }
795
891
  }
796
- var ze = new Set([1, 2]);
797
- function Be(e) {
798
- return typeof e == "number" && ze.has(e);
892
+ var Ke = new Set([1, 2]);
893
+ function qe(e) {
894
+ return typeof e == "number" && Ke.has(e);
799
895
  }
800
- var Ve = new Set([
896
+ var Je = new Set([
801
897
  "close",
802
898
  "stateUpdate",
803
899
  "commandResult",
@@ -820,10 +916,10 @@ var Ve = new Set([
820
916
  "widgetDragMove",
821
917
  "widgetDragEnd"
822
918
  ]);
823
- function He(e) {
919
+ function Ye(e) {
824
920
  if (!e || typeof e != "object") return null;
825
921
  let t = e;
826
- if (!Be(t.schemaVersion) || !t.type || !Ve.has(t.type)) return null;
922
+ if (!qe(t.schemaVersion) || !t.type || !Je.has(t.type)) return null;
827
923
  if (t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
828
924
  if (t.type === "widgetAudioSettings") {
829
925
  let e = t.payload;
@@ -841,7 +937,7 @@ function He(e) {
841
937
  }
842
938
  return !t.payload || typeof t.payload != "object" ? null : t;
843
939
  }
844
- function Ue(e, t, n) {
940
+ function Xe(e, t, n) {
845
941
  let r = e.trim();
846
942
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
847
943
  return {
@@ -854,20 +950,20 @@ function Ue(e, t, n) {
854
950
  }
855
951
  };
856
952
  }
857
- function We() {
953
+ function Ze() {
858
954
  return {
859
955
  type: "parentHello",
860
956
  schemaVersion: 2
861
957
  };
862
958
  }
863
- function Ge(e) {
959
+ function Qe(e) {
864
960
  return {
865
961
  type: "widgetSetChrome",
866
962
  schemaVersion: 2,
867
963
  payload: { mode: e }
868
964
  };
869
965
  }
870
- function Ke() {
966
+ function $e() {
871
967
  return {
872
968
  type: "widgetToggleAudioSettings",
873
969
  schemaVersion: 2,
@@ -876,30 +972,30 @@ function Ke() {
876
972
  }
877
973
  //#endregion
878
974
  //#region src/v2/embed/iframeHost.ts
879
- function qe(e) {
975
+ function et(e) {
880
976
  return e;
881
977
  }
882
- function X() {
978
+ function Z() {
883
979
  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)}`;
884
980
  }
885
- var Je = 3e4;
886
- function Ye(e) {
981
+ var tt = 3e4;
982
+ function nt(e) {
887
983
  let t = e.container;
888
984
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
889
985
  let n = document.createElement("iframe");
890
986
  n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), 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");
891
987
  let r = !1, i = /* @__PURE__ */ new Map(), a = new Promise((t, r) => {
892
988
  let i = () => {
893
- o(), Le(e.src, e.playerOrigin).then(t, r);
989
+ o(), We(e.src, e.playerOrigin).then(t, r);
894
990
  }, a = () => {
895
- o(), r(Error(Ie(e.playerOrigin)));
991
+ o(), r(Error(Ue(e.playerOrigin)));
896
992
  }, o = () => {
897
993
  n.removeEventListener("load", i), n.removeEventListener("error", a);
898
994
  };
899
995
  n.addEventListener("load", i), n.addEventListener("error", a);
900
996
  }), o = (t) => {
901
997
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
902
- let a = He(t.data);
998
+ let a = Ye(t.data);
903
999
  if (a) switch (a.type) {
904
1000
  case "close":
905
1001
  e.onClose?.(a.payload);
@@ -935,10 +1031,10 @@ function Ye(e) {
935
1031
  e.onUserSpeechEnded?.(a.payload);
936
1032
  break;
937
1033
  case "modeChange":
938
- e.onActivityChange?.(qe(a.payload.mode)), e.onModeChange?.(a.payload.mode);
1034
+ e.onActivityChange?.(et(a.payload.mode));
939
1035
  break;
940
1036
  case "activityChange":
941
- e.onActivityChange?.(a.payload.activity), (a.payload.activity === "listening" || a.payload.activity === "thinking" || a.payload.activity === "speaking") && e.onModeChange?.(a.payload.activity);
1037
+ e.onActivityChange?.(a.payload.activity);
942
1038
  break;
943
1039
  case "message":
944
1040
  e.onMessage?.(a.payload);
@@ -976,10 +1072,10 @@ function Ye(e) {
976
1072
  let s = (t, i) => {
977
1073
  if (r) return;
978
1074
  let a = n.contentWindow;
979
- if (!a) throw Error(Ie(e.playerOrigin));
980
- Re(a, t, e.playerOrigin, i);
1075
+ if (!a) throw Error(Ue(e.playerOrigin));
1076
+ Ge(a, t, e.playerOrigin, i);
981
1077
  }, c = (e, t = 12e4, n) => {
982
- let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : X();
1078
+ let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
983
1079
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((a, o) => {
984
1080
  i.set(r, {
985
1081
  resolve: (e) => a(e),
@@ -994,14 +1090,14 @@ function Ye(e) {
994
1090
  return a;
995
1091
  },
996
1092
  postParentHello() {
997
- s(We());
1093
+ s(Ze());
998
1094
  },
999
1095
  postLaunch(t, i, a) {
1000
1096
  if (r) return;
1001
1097
  let o = n.contentWindow;
1002
1098
  if (!o) throw Error("Liforma embed iframe is not ready.");
1003
- let s = Ue(t, i, a), c = () => {
1004
- r || Re(o, s, e.playerOrigin);
1099
+ let s = Xe(t, i, a), c = () => {
1100
+ r || Ge(o, s, e.playerOrigin);
1005
1101
  };
1006
1102
  c();
1007
1103
  for (let e = 1; e <= 12; e += 1) window.setTimeout(c, e * 75);
@@ -1019,17 +1115,17 @@ function Ye(e) {
1019
1115
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1020
1116
  },
1021
1117
  postWidgetSetChrome(e) {
1022
- s(Ge(e));
1118
+ s(Qe(e));
1023
1119
  },
1024
1120
  postWidgetToggleAudioSettings() {
1025
- s(Ke());
1121
+ s($e());
1026
1122
  },
1027
1123
  speak(e) {
1028
1124
  return c({
1029
1125
  type: "speak",
1030
1126
  schemaVersion: 2,
1031
1127
  payload: {
1032
- correlationId: X(),
1128
+ correlationId: Z(),
1033
1129
  text: e.text,
1034
1130
  ...e.characterId ? { characterId: e.characterId } : {},
1035
1131
  ...e.behavior ? { behavior: e.behavior } : {}
@@ -1040,14 +1136,14 @@ function Ye(e) {
1040
1136
  return c({
1041
1137
  type: "startListening",
1042
1138
  schemaVersion: 2,
1043
- payload: { correlationId: X() }
1139
+ payload: { correlationId: Z() }
1044
1140
  });
1045
1141
  },
1046
1142
  stopListening() {
1047
1143
  return c({
1048
1144
  type: "stopListening",
1049
1145
  schemaVersion: 2,
1050
- payload: { correlationId: X() }
1146
+ payload: { correlationId: Z() }
1051
1147
  });
1052
1148
  },
1053
1149
  listenOnce(e) {
@@ -1055,13 +1151,13 @@ function Ye(e) {
1055
1151
  type: "listenOnce",
1056
1152
  schemaVersion: 2,
1057
1153
  payload: {
1058
- correlationId: X(),
1154
+ correlationId: Z(),
1059
1155
  ...e?.timeoutMs === void 0 ? {} : { timeoutMs: e.timeoutMs }
1060
1156
  }
1061
1157
  });
1062
1158
  },
1063
1159
  async speakProcessorStream(e, t) {
1064
- let n = X(), r = X(), i = (await c({
1160
+ let n = Z(), r = Z(), i = (await c({
1065
1161
  type: "speakStreamStart",
1066
1162
  schemaVersion: 2,
1067
1163
  payload: {
@@ -1106,7 +1202,7 @@ function Ye(e) {
1106
1202
  }
1107
1203
  },
1108
1204
  speechPlay(e) {
1109
- let t = X(), n = [];
1205
+ let t = Z(), n = [];
1110
1206
  return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), c({
1111
1207
  type: "speechPlay",
1112
1208
  schemaVersion: 2,
@@ -1125,7 +1221,7 @@ function Ye(e) {
1125
1221
  type: "speechUtteranceBegin",
1126
1222
  schemaVersion: 2,
1127
1223
  payload: {
1128
- correlationId: X(),
1224
+ correlationId: Z(),
1129
1225
  utteranceId: e.utteranceId,
1130
1226
  format: e.format,
1131
1227
  queue: e.queue,
@@ -1139,19 +1235,19 @@ function Ye(e) {
1139
1235
  type: "speechUtteranceWrite",
1140
1236
  schemaVersion: 2,
1141
1237
  payload: {
1142
- correlationId: X(),
1238
+ correlationId: Z(),
1143
1239
  utteranceId: e.utteranceId,
1144
1240
  audio: e.audio,
1145
1241
  byteLength: e.byteLength
1146
1242
  }
1147
- }, Je, [e.audio]);
1243
+ }, tt, [e.audio]);
1148
1244
  },
1149
1245
  speechUtteranceSetTranscript(e) {
1150
1246
  return c({
1151
1247
  type: "speechUtteranceSetTranscript",
1152
1248
  schemaVersion: 2,
1153
1249
  payload: {
1154
- correlationId: X(),
1250
+ correlationId: Z(),
1155
1251
  utteranceId: e.utteranceId,
1156
1252
  transcript: e.transcript
1157
1253
  }
@@ -1162,7 +1258,7 @@ function Ye(e) {
1162
1258
  type: "speechUtteranceClose",
1163
1259
  schemaVersion: 2,
1164
1260
  payload: {
1165
- correlationId: X(),
1261
+ correlationId: Z(),
1166
1262
  utteranceId: e.utteranceId,
1167
1263
  ...e.transcript === void 0 ? {} : { transcript: e.transcript },
1168
1264
  ...e.history ? { history: e.history } : {}
@@ -1174,7 +1270,7 @@ function Ye(e) {
1174
1270
  type: "speechUtteranceCancel",
1175
1271
  schemaVersion: 2,
1176
1272
  payload: {
1177
- correlationId: X(),
1273
+ correlationId: Z(),
1178
1274
  utteranceId: e.utteranceId
1179
1275
  }
1180
1276
  });
@@ -1184,7 +1280,7 @@ function Ye(e) {
1184
1280
  type: "speechInterrupt",
1185
1281
  schemaVersion: 2,
1186
1282
  payload: {
1187
- correlationId: X(),
1283
+ correlationId: Z(),
1188
1284
  ...e
1189
1285
  }
1190
1286
  });
@@ -1193,7 +1289,7 @@ function Ye(e) {
1193
1289
  return c({
1194
1290
  type: "getConversation",
1195
1291
  schemaVersion: 2,
1196
- payload: { correlationId: X() }
1292
+ payload: { correlationId: Z() }
1197
1293
  });
1198
1294
  },
1199
1295
  destroy() {
@@ -1207,7 +1303,7 @@ function Ye(e) {
1207
1303
  }
1208
1304
  //#endregion
1209
1305
  //#region src/v2/embed/readyGate.ts
1210
- function Xe(e) {
1306
+ function rt(e) {
1211
1307
  let t, n = !1, r = !1, i = () => {
1212
1308
  r || !n || t === void 0 || (r = !0, e(t));
1213
1309
  };
@@ -1222,35 +1318,47 @@ function Xe(e) {
1222
1318
  }
1223
1319
  //#endregion
1224
1320
  //#region src/v2/shims/embedBaseUrl.ts
1225
- var Ze = "https://player.liforma.ai/embed", Qe = "http://localhost:3002/embed";
1226
- function $e() {
1321
+ var it = "https://player.liforma.ai/embed", at = "http://localhost:3002/embed";
1322
+ function ot() {
1227
1323
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1228
1324
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1229
1325
  if (typeof document > "u") return null;
1230
1326
  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();
1231
1327
  return t ? t.replace(/\/$/, "") : null;
1232
1328
  }
1233
- function et() {
1234
- let e = $e();
1235
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : C() ? Qe : Ze;
1329
+ function st() {
1330
+ let e = ot();
1331
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : C() ? at : it;
1236
1332
  }
1237
- function tt(e, t, n, r, i, a, o) {
1238
- let s = (e ?? et()).replace(/\/$/, ""), c = s.endsWith("/embed") ? s : `${s}/embed`, l = new URL(c), u = n?.trim();
1333
+ function ct(e, t, n, r, i, a, o) {
1334
+ let s = (e ?? st()).replace(/\/$/, ""), c = s.endsWith("/embed") ? s : `${s}/embed`, l = new URL(c), u = n?.trim();
1239
1335
  u && l.searchParams.set("locationId", u);
1240
1336
  let d = r?.trim();
1241
- return d && l.searchParams.set("avatarId", d), i === "face" && l.searchParams.set("fit", "face"), a === "widget" && l.searchParams.set("ui", "widget"), o && l.searchParams.set("close", "1"), t && l.searchParams.set("debug", "true"), nt(l.toString());
1337
+ return d && l.searchParams.set("avatarId", d), i === "face" && l.searchParams.set("fit", "face"), a === "widget" && l.searchParams.set("ui", "widget"), o && l.searchParams.set("close", "1"), t && l.searchParams.set("debug", "true"), lt(l.toString());
1242
1338
  }
1243
- function nt(e) {
1339
+ function lt(e) {
1244
1340
  if (typeof location > "u") return e;
1245
1341
  let t = new URL(e);
1246
1342
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1247
1343
  }
1248
- function rt(e) {
1344
+ function ut(e) {
1249
1345
  return new URL(e).origin;
1250
1346
  }
1251
1347
  //#endregion
1252
1348
  //#region src/v2/experienceEvents.ts
1253
- function it() {
1349
+ function dt() {
1350
+ 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)}`;
1351
+ }
1352
+ function ft(e, t, n) {
1353
+ return {
1354
+ id: dt(),
1355
+ type: e,
1356
+ sessionId: t,
1357
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1358
+ data: n
1359
+ };
1360
+ }
1361
+ function pt() {
1254
1362
  return {
1255
1363
  ready: /* @__PURE__ */ new Set(),
1256
1364
  started: /* @__PURE__ */ new Set(),
@@ -1263,43 +1371,42 @@ function it() {
1263
1371
  message: /* @__PURE__ */ new Set(),
1264
1372
  listeningState: /* @__PURE__ */ new Set(),
1265
1373
  activityChange: /* @__PURE__ */ new Set(),
1266
- modeChange: /* @__PURE__ */ new Set(),
1267
1374
  conversationProcessorError: /* @__PURE__ */ new Set()
1268
1375
  };
1269
1376
  }
1270
- function at(e, t, n) {
1377
+ function mt(e, t, n) {
1271
1378
  return e[t].add(n), () => e[t].delete(n);
1272
1379
  }
1273
- function Z(e, t, n) {
1380
+ function ht(e, t, n) {
1274
1381
  for (let r of e[t]) r(n);
1275
1382
  }
1276
- function ot(e) {
1383
+ function gt(e) {
1277
1384
  for (let t of Object.keys(e)) e[t].clear();
1278
1385
  }
1279
1386
  //#endregion
1280
1387
  //#region src/v2/speech/types.ts
1281
- function st(e) {
1388
+ function _t(e) {
1282
1389
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1283
1390
  }
1284
- function ct(e) {
1391
+ function vt(e) {
1285
1392
  return "url" in e && typeof e.url == "string";
1286
1393
  }
1287
- function lt(e) {
1394
+ function yt(e) {
1288
1395
  if (!("track" in e)) return !1;
1289
1396
  let t = e.track;
1290
1397
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1291
1398
  }
1292
- function ut(e) {
1293
- return !st(e) && !ct(e) && !lt(e) && "encoding" in e && typeof e.encoding == "string";
1399
+ function bt(e) {
1400
+ return !_t(e) && !vt(e) && !yt(e) && "encoding" in e && typeof e.encoding == "string";
1294
1401
  }
1295
- var dt = [
1402
+ var xt = [
1296
1403
  8e3,
1297
1404
  16e3,
1298
1405
  22050,
1299
1406
  24e3,
1300
1407
  44100,
1301
1408
  48e3
1302
- ], ft = {
1409
+ ], St = {
1303
1410
  MAX_CHUNK_BYTES: 64 * 1024,
1304
1411
  RECOMMENDED_CHUNK_MS_MIN: 20,
1305
1412
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -1310,14 +1417,14 @@ var dt = [
1310
1417
  MAX_UTTERANCE_DURATION_MS: 9e4,
1311
1418
  MAX_PENDING_WRITES: 8,
1312
1419
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1313
- }, pt = class extends Error {
1420
+ }, Ct = class extends Error {
1314
1421
  operation;
1315
1422
  requiredCapability;
1316
1423
  name = "UnsupportedSpeechOperationError";
1317
1424
  constructor(e, t) {
1318
1425
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1319
1426
  }
1320
- }, mt = class extends Error {
1427
+ }, wt = class extends Error {
1321
1428
  name = "SpeechUtteranceClosedError";
1322
1429
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1323
1430
  super(e);
@@ -1327,72 +1434,72 @@ var dt = [
1327
1434
  constructor(e, t) {
1328
1435
  super(e, t);
1329
1436
  }
1330
- }, ht = class extends Error {
1437
+ }, Tt = class extends Error {
1331
1438
  name = "SpeechBufferTimeoutError";
1332
1439
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1333
1440
  super(e);
1334
1441
  }
1335
1442
  };
1336
- function gt(e = "none") {
1443
+ function Et(e = "none") {
1337
1444
  return {
1338
1445
  mode: e,
1339
1446
  trackedDurationMs: 0,
1340
1447
  fallbackDurationMs: 0
1341
1448
  };
1342
1449
  }
1343
- function _t(e) {
1344
- return dt.includes(e);
1450
+ function Dt(e) {
1451
+ return xt.includes(e);
1345
1452
  }
1346
- function vt(e) {
1453
+ function Ot(e) {
1347
1454
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
1348
1455
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
1349
- if (!_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1456
+ if (!Dt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1350
1457
  }
1351
- function yt(e) {
1352
- if (st(e)) {
1353
- vt(e.format);
1458
+ function kt(e) {
1459
+ if (_t(e)) {
1460
+ Ot(e.format);
1354
1461
  return;
1355
1462
  }
1356
- if (ct(e)) {
1463
+ if (vt(e)) {
1357
1464
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
1358
- if (e.sampleRate !== void 0 && !_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1465
+ if (e.sampleRate !== void 0 && !Dt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1359
1466
  return;
1360
1467
  }
1361
- if (lt(e)) {
1468
+ if (yt(e)) {
1362
1469
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
1363
- if (e.sampleRate !== void 0 && !_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1470
+ if (e.sampleRate !== void 0 && !Dt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1364
1471
  return;
1365
1472
  }
1366
- if (ut(e)) {
1473
+ if (bt(e)) {
1367
1474
  let t = e.encoding.trim().toLowerCase();
1368
1475
  if (!t) throw new Q("Encoded audio MIME type is required.");
1369
1476
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1370
- if (e.sampleRate !== void 0 && !_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1477
+ if (e.sampleRate !== void 0 && !Dt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1371
1478
  return;
1372
1479
  }
1373
1480
  throw new Q("Unsupported speech.play audio shape.");
1374
1481
  }
1375
- function bt(e) {
1376
- if (e.format) return vt(e.format), e.format;
1482
+ function At(e) {
1483
+ if (e.format) return Ot(e.format), e.format;
1377
1484
  if (e.track) {
1378
1485
  let t = {
1379
1486
  encoding: "pcm_s16le",
1380
1487
  sampleRate: e.sampleRate ?? 24e3,
1381
1488
  channels: 1
1382
1489
  };
1383
- return vt(t), t;
1490
+ return Ot(t), t;
1384
1491
  }
1385
1492
  throw new Q("createUtterance requires format or track.");
1386
1493
  }
1387
- function xt(e) {
1494
+ function jt(e) {
1388
1495
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1389
1496
  }
1390
- function St(e) {
1497
+ function Mt(e) {
1391
1498
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1392
1499
  }
1393
1500
  //#endregion
1394
1501
  //#region src/byo/pcm.ts
1395
- function Ct(e) {
1502
+ function Nt(e) {
1396
1503
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1397
1504
  for (let t = 0; t < e.length; t++) {
1398
1505
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1402,11 +1509,11 @@ function Ct(e) {
1402
1509
  }
1403
1510
  //#endregion
1404
1511
  //#region src/byo/resample.ts
1405
- function wt(e, t, n, r, i) {
1512
+ function Pt(e, t, n, r, i) {
1406
1513
  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;
1407
1514
  return ((a * i + o) * i + s) * i + c;
1408
1515
  }
1409
- function Tt(e, t) {
1516
+ function Ft(e, t) {
1410
1517
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1411
1518
  if (e === t) return {
1412
1519
  fromRate: e,
@@ -1429,7 +1536,7 @@ function Tt(e, t) {
1429
1536
  let a = [];
1430
1537
  for (; i + 2 < r.length - 1;) {
1431
1538
  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);
1432
- a.push(wt(r[o], r[e], r[s], r[c], t)), i += n;
1539
+ a.push(Pt(r[o], r[e], r[s], r[c], t)), i += n;
1433
1540
  }
1434
1541
  let o = Math.max(0, Math.floor(i) - 1);
1435
1542
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1441,7 +1548,7 @@ function Tt(e, t) {
1441
1548
  }
1442
1549
  //#endregion
1443
1550
  //#region src/byo/audioCapture.ts
1444
- var Et = "liforma-pcm-capture", Dt = `
1551
+ var It = "liforma-pcm-capture", Lt = `
1445
1552
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1446
1553
  process(inputs) {
1447
1554
  const ch = inputs[0] && inputs[0][0];
@@ -1453,29 +1560,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1453
1560
  return true;
1454
1561
  }
1455
1562
  }
1456
- registerProcessor('${Et}', LiformaPcmCaptureProcessor);
1457
- `, Ot = null;
1458
- function kt() {
1459
- return Ot ||= URL.createObjectURL(new Blob([Dt], { type: "application/javascript" })), Ot;
1563
+ registerProcessor('${It}', LiformaPcmCaptureProcessor);
1564
+ `, Rt = null;
1565
+ function zt() {
1566
+ return Rt ||= URL.createObjectURL(new Blob([Lt], { type: "application/javascript" })), Rt;
1460
1567
  }
1461
- function At() {
1568
+ function Bt() {
1462
1569
  return window.AudioContext || window.webkitAudioContext || null;
1463
1570
  }
1464
- async function jt(e) {
1465
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = At();
1571
+ async function Vt(e) {
1572
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Bt();
1466
1573
  if (!o) throw Error("Web Audio is required for audio capture");
1467
1574
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1468
1575
  l.gain.value = 0;
1469
- let u = s.sampleRate, d = Tt(u, n), f = !1, p = !1, m = (e) => {
1576
+ let u = s.sampleRate, d = Ft(u, n), f = !1, p = !1, m = (e) => {
1470
1577
  if (f || i && !i()) return;
1471
1578
  let t = d.push(e);
1472
- t.length !== 0 && r(Ct(t));
1579
+ t.length !== 0 && r(Nt(t));
1473
1580
  }, h = () => void 0;
1474
1581
  return await (async () => {
1475
1582
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1476
1583
  try {
1477
- await s.audioWorklet.addModule(kt());
1478
- let e = new AudioWorkletNode(s, Et, {
1584
+ await s.audioWorklet.addModule(zt());
1585
+ let e = new AudioWorkletNode(s, It, {
1479
1586
  numberOfInputs: 1,
1480
1587
  numberOfOutputs: 1,
1481
1588
  outputChannelCount: [1]
@@ -1525,7 +1632,7 @@ async function jt(e) {
1525
1632
  }
1526
1633
  //#endregion
1527
1634
  //#region src/v2/speech/captureMediaStreamTrack.ts
1528
- async function Mt(e) {
1635
+ async function Ht(e) {
1529
1636
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1530
1637
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
1531
1638
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -1534,18 +1641,18 @@ async function Mt(e) {
1534
1641
  s || (s = !0, c?.stop(), c = null);
1535
1642
  };
1536
1643
  try {
1537
- c = await jt({
1644
+ c = await Vt({
1538
1645
  mediaStream: a,
1539
1646
  targetSampleRate: r,
1540
1647
  shouldSend: () => !s && !i?.aborted,
1541
1648
  onPcm: (e) => {
1542
1649
  if (s || i?.aborted) return;
1543
- let t = xt(e);
1650
+ let t = jt(e);
1544
1651
  o = o.then(async () => {
1545
1652
  if (s || i?.aborted) return;
1546
1653
  let e = 0;
1547
1654
  for (; e < t.byteLength;) {
1548
- let r = Math.min(e + ft.MAX_CHUNK_BYTES, t.byteLength);
1655
+ let r = Math.min(e + St.MAX_CHUNK_BYTES, t.byteLength);
1549
1656
  if ((r - e) % 2 == 1 && --r, r <= e) break;
1550
1657
  let i = t.subarray(e, r);
1551
1658
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -1569,10 +1676,10 @@ async function Mt(e) {
1569
1676
  }
1570
1677
  //#endregion
1571
1678
  //#region src/v2/speech/speechController.ts
1572
- async function Nt(e, t) {
1573
- if (lt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1574
- if (st(e)) {
1575
- let t = xt(e.data);
1679
+ async function Ut(e, t) {
1680
+ if (yt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1681
+ if (_t(e)) {
1682
+ let t = jt(e.data);
1576
1683
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
1577
1684
  return {
1578
1685
  kind: "pcm",
@@ -1580,17 +1687,17 @@ async function Nt(e, t) {
1580
1687
  format: e.format
1581
1688
  };
1582
1689
  }
1583
- if (ct(e)) return {
1690
+ if (vt(e)) return {
1584
1691
  kind: "url",
1585
1692
  url: e.url.trim(),
1586
1693
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1587
1694
  };
1588
- if (!ut(e)) throw new Q("Unsupported speech.play audio shape.");
1695
+ if (!bt(e)) throw new Q("Unsupported speech.play audio shape.");
1589
1696
  let n;
1590
1697
  if (typeof Blob < "u" && e.data instanceof Blob) {
1591
1698
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1592
1699
  n = new Uint8Array(await e.data.arrayBuffer());
1593
- } else n = xt(e.data);
1700
+ } else n = jt(e.data);
1594
1701
  return {
1595
1702
  kind: "encoded",
1596
1703
  data: n.slice().buffer,
@@ -1598,10 +1705,10 @@ async function Nt(e, t) {
1598
1705
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1599
1706
  };
1600
1707
  }
1601
- function Pt() {
1708
+ function Wt() {
1602
1709
  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)}`;
1603
1710
  }
1604
- function Ft(e, t = "completed") {
1711
+ function Gt(e, t = "completed") {
1605
1712
  return {
1606
1713
  utteranceId: e.speechId,
1607
1714
  characterId: e.characterId,
@@ -1615,13 +1722,13 @@ function Ft(e, t = "completed") {
1615
1722
  }
1616
1723
  };
1617
1724
  }
1618
- function It(e) {
1725
+ function Kt(e) {
1619
1726
  return e instanceof Error ? e : new Q(String(e));
1620
1727
  }
1621
- function Lt(e) {
1728
+ function qt(e) {
1622
1729
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
1623
1730
  }
1624
- var Rt = class {
1731
+ var Jt = class {
1625
1732
  id;
1626
1733
  characterId;
1627
1734
  result;
@@ -1650,29 +1757,29 @@ var Rt = class {
1650
1757
  queue: e.queue,
1651
1758
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
1652
1759
  }).catch((e) => {
1653
- throw this.fail(It(e)), It(e);
1760
+ throw this.fail(Kt(e)), Kt(e);
1654
1761
  }), this.signal?.addEventListener("abort", () => {
1655
1762
  this.cancel();
1656
1763
  }, { once: !0 });
1657
1764
  }
1658
1765
  async write(e, t) {
1659
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new mt();
1660
- let n = xt(e);
1766
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new wt();
1767
+ let n = jt(e);
1661
1768
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
1662
- if (n.byteLength > ft.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${ft.MAX_CHUNK_BYTES}).`);
1769
+ if (n.byteLength > St.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${St.MAX_CHUNK_BYTES}).`);
1663
1770
  if (n.byteLength === 0) return;
1664
- let r = t?.timeoutMs ?? ft.DEFAULT_WRITE_TIMEOUT_MS;
1771
+ let r = t?.timeoutMs ?? St.DEFAULT_WRITE_TIMEOUT_MS;
1665
1772
  await this.acquireWriteSlot(r);
1666
1773
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
1667
- if (this.bufferedMs + i > ft.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1774
+ if (this.bufferedMs + i > St.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1668
1775
  let a = async () => {
1669
- if (this.closed || this.settled) throw new mt();
1776
+ if (this.closed || this.settled) throw new wt();
1670
1777
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
1671
1778
  utteranceId: this.id,
1672
1779
  audio: t.buffer,
1673
1780
  byteLength: t.byteLength
1674
1781
  }), a = await Promise.race([i, new Promise((e, t) => {
1675
- setTimeout(() => t(new ht()), r);
1782
+ setTimeout(() => t(new Tt()), r);
1676
1783
  })]);
1677
1784
  this.bufferedMs = Math.max(0, a.bufferedMs);
1678
1785
  }, o = this.writeChain.then(a, a);
@@ -1684,7 +1791,7 @@ var Rt = class {
1684
1791
  }
1685
1792
  }
1686
1793
  async setTranscript(e) {
1687
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new mt();
1794
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new wt();
1688
1795
  await this.requireHost().speechUtteranceSetTranscript({
1689
1796
  utteranceId: this.id,
1690
1797
  transcript: e
@@ -1701,7 +1808,7 @@ var Rt = class {
1701
1808
  });
1702
1809
  return this.resolve(t), t;
1703
1810
  } catch (e) {
1704
- let t = It(e);
1811
+ let t = Kt(e);
1705
1812
  throw this.fail(t), t;
1706
1813
  }
1707
1814
  }
@@ -1719,11 +1826,11 @@ var Rt = class {
1719
1826
  characterId: this.characterId,
1720
1827
  status: "cancelled",
1721
1828
  durationMs: 0,
1722
- animation: gt("none")
1829
+ animation: Et("none")
1723
1830
  };
1724
1831
  return this.resolve(t), t;
1725
1832
  } catch (e) {
1726
- let t = It(e);
1833
+ let t = Kt(e);
1727
1834
  throw this.fail(t), t;
1728
1835
  }
1729
1836
  }
@@ -1736,19 +1843,19 @@ var Rt = class {
1736
1843
  return e;
1737
1844
  }
1738
1845
  resolve(e) {
1739
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new mt()));
1846
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new wt()));
1740
1847
  }
1741
1848
  fail(e) {
1742
1849
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
1743
1850
  }
1744
1851
  async acquireWriteSlot(e) {
1745
- if (this.pendingWriteCount < ft.MAX_PENDING_WRITES) {
1852
+ if (this.pendingWriteCount < St.MAX_PENDING_WRITES) {
1746
1853
  this.pendingWriteCount += 1;
1747
1854
  return;
1748
1855
  }
1749
1856
  await new Promise((t, n) => {
1750
1857
  let r = setTimeout(() => {
1751
- n(new ht());
1858
+ n(new Tt());
1752
1859
  }, e);
1753
1860
  this.pendingWriteWaiters.push({
1754
1861
  resolve: () => {
@@ -1767,13 +1874,13 @@ var Rt = class {
1767
1874
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
1768
1875
  }
1769
1876
  };
1770
- function zt(e) {
1877
+ function Yt(e) {
1771
1878
  let t = null, n = (t, n) => {
1772
- if (!e.getCapabilities()[n]) throw new pt(t, n);
1879
+ if (!e.getCapabilities()[n]) throw new Ct(t, n);
1773
1880
  }, r = {
1774
1881
  async speak(r) {
1775
1882
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
1776
- let i = St(r.queue ?? "append");
1883
+ let i = Mt(r.queue ?? "append");
1777
1884
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
1778
1885
  let a = e.getIframeHost();
1779
1886
  if (!a) throw new Q("Speech session is not attached.");
@@ -1793,41 +1900,41 @@ function zt(e) {
1793
1900
  return;
1794
1901
  }
1795
1902
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
1796
- t.removeEventListener("abort", s), n(Ft(e, "completed"));
1903
+ t.removeEventListener("abort", s), n(Gt(e, "completed"));
1797
1904
  }, (a) => {
1798
- if (t.removeEventListener("abort", s), Lt(a)) {
1905
+ if (t.removeEventListener("abort", s), qt(a)) {
1799
1906
  n({
1800
1907
  utteranceId: "utt_interrupted",
1801
1908
  characterId: r.characterId ?? e.getActiveCharacterId(),
1802
1909
  status: "interrupted",
1803
1910
  durationMs: 0,
1804
1911
  transcript: r.text,
1805
- animation: gt("none")
1912
+ animation: Et("none")
1806
1913
  });
1807
1914
  return;
1808
1915
  }
1809
- i(It(a));
1916
+ i(Kt(a));
1810
1917
  });
1811
1918
  });
1812
1919
  }
1813
1920
  try {
1814
- return Ft(await o, "completed");
1921
+ return Gt(await o, "completed");
1815
1922
  } catch (t) {
1816
- if (Lt(t)) return {
1923
+ if (qt(t)) return {
1817
1924
  utteranceId: "utt_interrupted",
1818
1925
  characterId: r.characterId ?? e.getActiveCharacterId(),
1819
1926
  status: "interrupted",
1820
1927
  durationMs: 0,
1821
1928
  transcript: r.text,
1822
- animation: gt("none")
1929
+ animation: Et("none")
1823
1930
  };
1824
- throw It(t);
1931
+ throw Kt(t);
1825
1932
  }
1826
1933
  },
1827
1934
  async play(i) {
1828
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), yt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
1935
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), kt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
1829
1936
  let a = i.queue ?? "append";
1830
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), lt(i.audio)) {
1937
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), yt(i.audio)) {
1831
1938
  let e = i.audio.sampleRate ?? 24e3;
1832
1939
  return r.createUtterance({
1833
1940
  format: {
@@ -1843,7 +1950,7 @@ function zt(e) {
1843
1950
  }
1844
1951
  let o = e.getIframeHost();
1845
1952
  if (!o) throw new Q("Speech session is not attached.");
1846
- let s = await Nt(i.audio, i.signal);
1953
+ let s = await Ut(i.audio, i.signal);
1847
1954
  return o.speechPlay({
1848
1955
  source: s,
1849
1956
  characterId: i.characterId,
@@ -1855,13 +1962,13 @@ function zt(e) {
1855
1962
  },
1856
1963
  createUtterance(r) {
1857
1964
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
1858
- let i = bt(r);
1965
+ let i = At(r);
1859
1966
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
1860
1967
  let a = r.queue ?? "replace-active";
1861
1968
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
1862
1969
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
1863
- let o = new Rt({
1864
- id: Pt(),
1970
+ let o = new Jt({
1971
+ id: Wt(),
1865
1972
  characterId: r.characterId ?? e.getActiveCharacterId(),
1866
1973
  format: i,
1867
1974
  queue: a,
@@ -1873,7 +1980,7 @@ function zt(e) {
1873
1980
  t === o && (t = null);
1874
1981
  }), r.track && (async () => {
1875
1982
  try {
1876
- if (await Mt({
1983
+ if (await Ht({
1877
1984
  track: r.track,
1878
1985
  utterance: o,
1879
1986
  sampleRate: i.sampleRate,
@@ -1901,10 +2008,10 @@ function zt(e) {
1901
2008
  }
1902
2009
  //#endregion
1903
2010
  //#region src/v2/experience.ts
1904
- function Bt(e) {
2011
+ function Xt(e) {
1905
2012
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
1906
2013
  }
1907
- var Vt = class e {
2014
+ var Zt = class e {
1908
2015
  bootstrap;
1909
2016
  conversationProcessor;
1910
2017
  iframeHost = null;
@@ -1918,16 +2025,16 @@ var Vt = class e {
1918
2025
  closed = !1;
1919
2026
  attached = !1;
1920
2027
  closeHandlers = [];
1921
- eventRegistry = it();
1922
- readyEvent = null;
1923
- startedEvent = null;
2028
+ eventRegistry = pt();
2029
+ readyEnvelope = null;
2030
+ startedEnvelope = null;
1924
2031
  conversationCache = [];
1925
2032
  speech;
1926
2033
  constructor(e) {
1927
- 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 = zt({
2034
+ 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 = Yt({
1928
2035
  getIframeHost: () => this.iframeHost,
1929
2036
  assertSessionStarted: () => this.assertSessionStarted(),
1930
- getCapabilities: () => Ht(this.resolvedSession),
2037
+ getCapabilities: () => Qt(this.resolvedSession),
1931
2038
  getActiveCharacterId: () => "character_unknown",
1932
2039
  onProcessorInterrupt: () => {
1933
2040
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -1964,7 +2071,6 @@ var Vt = class e {
1964
2071
  embedBaseUrl: t.embedBaseUrl,
1965
2072
  debug: t.debug,
1966
2073
  mode: t.mode,
1967
- responseMode: t.responseMode,
1968
2074
  speechInputMode: t.speechInputMode,
1969
2075
  speechOnly: t.speechOnly,
1970
2076
  ui: t.ui,
@@ -1984,7 +2090,6 @@ var Vt = class e {
1984
2090
  embedBaseUrl: t.embedBaseUrl,
1985
2091
  debug: t.debug,
1986
2092
  mode: t.mode,
1987
- responseMode: t.responseMode,
1988
2093
  speechInputMode: t.speechInputMode,
1989
2094
  speechOnly: t.speechOnly,
1990
2095
  ui: t.ui,
@@ -2001,8 +2106,8 @@ var Vt = class e {
2001
2106
  return null;
2002
2107
  }
2003
2108
  on(e, t) {
2004
- let n = at(this.eventRegistry, e, t);
2005
- return e === "ready" && this.readyEvent && queueMicrotask(() => t(this.readyEvent)), e === "started" && this.startedEvent && queueMicrotask(() => t(this.startedEvent)), n;
2109
+ let n = mt(this.eventRegistry, e, t);
2110
+ return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
2006
2111
  }
2007
2112
  async attach(e) {
2008
2113
  if (this.closed) throw Error("Session has ended.");
@@ -2015,13 +2120,13 @@ var Vt = class e {
2015
2120
  if (this.closed) throw Error("Session has ended.");
2016
2121
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2017
2122
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2018
- let t = this.bootstrap.embedBaseUrl ?? et(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = tt(t, n, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.locationId, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Bt(e)), a = rt(i), o = null, s = new Promise((e) => {
2123
+ let t = this.bootstrap.embedBaseUrl ?? st(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = ct(t, n, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.locationId, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Xt(e)), a = ut(i), o = null, s = new Promise((e) => {
2019
2124
  o = e;
2020
2125
  }), c = null, l = new Promise((e) => {
2021
2126
  c = e;
2022
- }), u = Xe((e) => {
2023
- this.readyEvent || (this.readyEvent = { session: e }, Z(this.eventRegistry, "ready", this.readyEvent));
2024
- }), d = this.bootstrap.onUserTranscript, f = Ye({
2127
+ }), u = rt((e) => {
2128
+ this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2129
+ }), d = this.bootstrap.onUserTranscript, f = nt({
2025
2130
  container: e.container,
2026
2131
  src: i,
2027
2132
  playerOrigin: a,
@@ -2037,34 +2142,34 @@ var Vt = class e {
2037
2142
  e.onPlayerStatusChange?.(t), e.onStateUpdate?.(t), t === "loading" && o && (o(), o = null), t === "ready" && c && (c(), c = null), t === "ready" && u.markReady();
2038
2143
  },
2039
2144
  onUserTranscript: (e) => {
2040
- Z(this.eventRegistry, "userTranscript", e), d?.(e), this.queueProcessorTurn(e);
2145
+ this.emitWrapped("userTranscript", e), d?.(e), this.queueProcessorTurn(e);
2041
2146
  },
2042
2147
  onUserSpeechStarted: (e) => {
2043
- Z(this.eventRegistry, "userSpeechStarted", e);
2148
+ this.emitWrapped("userSpeechStarted", e);
2044
2149
  },
2045
2150
  onUserSpeechEnded: (e) => {
2046
- Z(this.eventRegistry, "userSpeechEnded", e);
2151
+ this.emitWrapped("userSpeechEnded", e);
2047
2152
  },
2048
2153
  onCharacterSpeechStarted: (e) => {
2049
- Z(this.eventRegistry, "characterSpeechStarted", e);
2154
+ this.emitWrapped("characterSpeechStarted", e);
2050
2155
  },
2051
2156
  onCharacterSpeechEnded: (e) => {
2052
- Z(this.eventRegistry, "characterSpeechEnded", e);
2157
+ this.emitWrapped("characterSpeechEnded", e);
2053
2158
  },
2054
2159
  onListeningState: (e) => {
2055
- Z(this.eventRegistry, "listeningState", e);
2160
+ this.emitWrapped("listeningState", e);
2056
2161
  },
2057
2162
  onActivityChange: (e) => {
2058
- Z(this.eventRegistry, "activityChange", e), (e === "listening" || e === "thinking" || e === "speaking") && Z(this.eventRegistry, "modeChange", e);
2163
+ this.emitWrapped("activityChange", e);
2059
2164
  },
2060
2165
  onMessage: (e) => {
2061
- Z(this.eventRegistry, "message", e);
2166
+ this.emitWrapped("message", e);
2062
2167
  },
2063
2168
  onStarted: (e) => {
2064
- this.startedEvent || (this.startedEvent = e, Z(this.eventRegistry, "started", e), this.bootstrap.onStart?.(e));
2169
+ this.startedEnvelope || (this.startedEnvelope = this.emitWrapped("started", e), this.bootstrap.onStart?.(e));
2065
2170
  },
2066
2171
  onConversationUpdate: (e) => {
2067
- this.conversationCache = e, Z(this.eventRegistry, "conversationUpdate", e);
2172
+ this.conversationCache = e, this.emitWrapped("conversationUpdate", e);
2068
2173
  },
2069
2174
  onWidgetReady: () => e.onWidgetReady?.(),
2070
2175
  onWidgetExpand: () => e.onWidgetExpand?.(),
@@ -2075,24 +2180,22 @@ var Vt = class e {
2075
2180
  onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
2076
2181
  });
2077
2182
  this.iframeHost = f;
2078
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), je(this.bootstrap.sessionEndpoint, {
2183
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Re(this.bootstrap.sessionEndpoint, {
2079
2184
  experienceId: this.bootstrap.experienceId,
2080
2185
  locale: this.bootstrap.locale,
2081
2186
  secondaryLocale: this.bootstrap.secondaryLocale,
2082
2187
  learningLocale: this.bootstrap.learningLocale,
2083
2188
  language: this.bootstrap.language,
2084
2189
  mode: p.mode,
2085
- responseMode: p.responseMode,
2086
2190
  speechInputMode: p.speechInputMode,
2087
2191
  speechOnly: this.bootstrap.speechOnly,
2088
2192
  signal: this.endpointAbortController.signal
2089
- })) : this.bootstrap.kind === "public" ? Ae(this.bootstrap.experienceId, {
2193
+ })) : this.bootstrap.kind === "public" ? Le(this.bootstrap.experienceId, {
2090
2194
  locale: this.bootstrap.locale,
2091
2195
  secondaryLocale: this.bootstrap.secondaryLocale,
2092
2196
  learningLocale: this.bootstrap.learningLocale,
2093
2197
  language: this.bootstrap.language,
2094
2198
  mode: p.mode,
2095
- responseMode: p.responseMode,
2096
2199
  speechInputMode: p.speechInputMode,
2097
2200
  speechOnly: this.bootstrap.speechOnly
2098
2201
  }) : Promise.resolve(this.bootstrap.session ? {
@@ -2109,7 +2212,7 @@ var Vt = class e {
2109
2212
  f.postParentHello();
2110
2213
  let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2111
2214
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2112
- return this.launchToken = g, _ ? (this.resolvedSession = _, f.postLaunch(g, _, e.startButton), u.setValue(_)) : f.postLaunch(g, void 0, e.startButton), await Promise.race([s, new Promise((e, t) => {
2215
+ return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && ke(_), f.postLaunch(g, _, e.startButton), u.setValue(_)) : f.postLaunch(g, void 0, e.startButton), await Promise.race([s, new Promise((e, t) => {
2113
2216
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
2114
2217
  })]), await Promise.race([l, new Promise((e, t) => {
2115
2218
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
@@ -2142,17 +2245,21 @@ var Vt = class e {
2142
2245
  this.close();
2143
2246
  }
2144
2247
  destroy() {
2145
- 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, ot(this.eventRegistry), this.readyEvent = null, this.startedEvent = null, this.closeHandlers.length = 0, this.attached = !1);
2248
+ 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, gt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2146
2249
  }
2147
2250
  resolveMintInteraction() {
2148
- if (this.bootstrap.kind === "launch") return {};
2149
- let e = this.conversationProcessor !== null;
2150
- return {
2251
+ return this.bootstrap.kind === "launch" ? {} : {
2151
2252
  mode: this.bootstrap.mode,
2152
- responseMode: e ? "custom" : this.bootstrap.responseMode,
2153
2253
  speechInputMode: this.bootstrap.speechInputMode
2154
2254
  };
2155
2255
  }
2256
+ getSessionId() {
2257
+ return this.resolvedSession?.id ?? "";
2258
+ }
2259
+ emitWrapped(e, t) {
2260
+ let n = ft(e, this.getSessionId(), t);
2261
+ return ht(this.eventRegistry, e, n), n;
2262
+ }
2156
2263
  queueProcessorTurn(e) {
2157
2264
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
2158
2265
  let t = this.conversationProcessor;
@@ -2160,7 +2267,7 @@ var Vt = class e {
2160
2267
  let n = this.processorAbortController.signal;
2161
2268
  this.processorChain = this.processorChain.then(async () => {
2162
2269
  if (!n.aborted) try {
2163
- let r = await Pe(t, {
2270
+ let r = await Ve(t, {
2164
2271
  utteranceId: e.utteranceId,
2165
2272
  text: e.text,
2166
2273
  conversation: this.conversationCache,
@@ -2180,7 +2287,7 @@ var Vt = class e {
2180
2287
  } catch (t) {
2181
2288
  if (n.aborted) return;
2182
2289
  let r = t instanceof Error ? t.message : String(t);
2183
- Z(this.eventRegistry, "conversationProcessorError", {
2290
+ this.emitWrapped("conversationProcessorError", {
2184
2291
  utteranceId: e.utteranceId,
2185
2292
  message: r
2186
2293
  });
@@ -2191,7 +2298,7 @@ var Vt = class e {
2191
2298
  if (!this.attached || !this.iframeHost) throw Error("Call Experience.attach() before using speech APIs.");
2192
2299
  }
2193
2300
  assertSessionStarted() {
2194
- if (this.assertAttached(), !this.startedEvent) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
2301
+ if (this.assertAttached(), !this.startedEnvelope) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
2195
2302
  }
2196
2303
  close() {
2197
2304
  this.closed || (this.closed = !0, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, this.attached = !1);
@@ -2210,10 +2317,10 @@ var Vt = class e {
2210
2317
  };
2211
2318
  }
2212
2319
  };
2213
- function Ht(e) {
2320
+ function Qt(e) {
2214
2321
  return e ? {
2215
- textSpeech: e.capabilities.speechOutput,
2216
- externalSpeechAudio: e.capabilities.externalAudio
2322
+ textSpeech: e.capabilities.speech.output,
2323
+ externalSpeechAudio: e.capabilities.speech.externalAudio
2217
2324
  } : {
2218
2325
  textSpeech: !0,
2219
2326
  externalSpeechAudio: !0
@@ -2221,41 +2328,41 @@ function Ht(e) {
2221
2328
  }
2222
2329
  //#endregion
2223
2330
  //#region src/widget/dockGeometry.ts
2224
- var Ut = "(min-width: 768px)", Wt = 24, Gt = .5, Kt = 1200, qt = .85, Jt = 9 / 16;
2225
- function Yt() {
2331
+ var $t = "(min-width: 768px)", en = 24, tn = .5, nn = 1200, rn = .85, an = 9 / 16;
2332
+ function on() {
2226
2333
  if (typeof window > "u") return 800;
2227
2334
  let e = window.screen?.availHeight;
2228
2335
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2229
2336
  }
2230
- function Xt(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Wt, r = typeof window < "u" ? Yt() : 800) {
2231
- let i = Math.max(160, Math.min(t - n * 2, t * qt)), a = Math.max(120, e - n * 2), o = Math.min(r * Gt, Kt, i), s = o * Jt;
2232
- return s > a && (s = a, o = s / Jt, o > i && (o = i, s = o * Jt)), {
2337
+ function sn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = en, r = typeof window < "u" ? on() : 800) {
2338
+ let i = Math.max(160, Math.min(t - n * 2, t * rn)), a = Math.max(120, e - n * 2), o = Math.min(r * tn, nn, i), s = o * an;
2339
+ return s > a && (s = a, o = s / an, o > i && (o = i, s = o * an)), {
2233
2340
  width: Math.round(s),
2234
2341
  height: Math.round(o)
2235
2342
  };
2236
2343
  }
2237
- function Zt(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Wt) {
2344
+ function cn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = en) {
2238
2345
  return {
2239
2346
  left: Math.max(r, t - e.width - r),
2240
2347
  top: Math.max(r, n - e.height - r)
2241
2348
  };
2242
2349
  }
2243
- function Qt(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Wt) {
2350
+ function ln(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = en) {
2244
2351
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2245
2352
  return {
2246
2353
  left: Math.min(Math.max(a, e), o),
2247
2354
  top: Math.min(Math.max(a, t), s)
2248
2355
  };
2249
2356
  }
2250
- function $t(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2251
- return e(Ut).matches;
2357
+ function un(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2358
+ return e($t).matches;
2252
2359
  }
2253
2360
  //#endregion
2254
2361
  //#region src/widget/mountExperienceWidget.ts
2255
- function en(e) {
2362
+ function dn(e) {
2256
2363
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2257
2364
  }
2258
- function tn(e) {
2365
+ function fn(e) {
2259
2366
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2260
2367
  let t = typeof e == "string" ? e.trim() : "";
2261
2368
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2263,9 +2370,9 @@ function tn(e) {
2263
2370
  function $(e) {
2264
2371
  return e === "expanded" || e === "docked";
2265
2372
  }
2266
- var nn = "<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>", rn = "<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>", an = "<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>", on = "<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>";
2267
- function sn(e, t, n) {
2268
- de(le);
2373
+ var pn = "<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>", mn = "<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>", hn = "<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>", gn = "<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>";
2374
+ function _n(e, t, n) {
2375
+ de(ue);
2269
2376
  let r = ee({
2270
2377
  galleryThumb: t.galleryThumb,
2271
2378
  avatarImage: t.avatarImage,
@@ -2292,9 +2399,9 @@ function sn(e, t, n) {
2292
2399
  let e = document.createElement("img");
2293
2400
  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);
2294
2401
  }
2295
- return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ce(i);
2402
+ return e.replaceChildren(i), n?.parallax === !1 ? () => {} : le(i);
2296
2403
  }
2297
- function cn(e) {
2404
+ function vn(e) {
2298
2405
  return e.startButton ? {
2299
2406
  ...e.startButton,
2300
2407
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2306,7 +2413,7 @@ function cn(e) {
2306
2413
  variant: "primary"
2307
2414
  };
2308
2415
  }
2309
- function ln(e) {
2416
+ function yn(e) {
2310
2417
  let t = !1, n = () => {
2311
2418
  t || e();
2312
2419
  }, r = () => {
@@ -2326,12 +2433,12 @@ function ln(e) {
2326
2433
  t = !0, window.removeEventListener("load", r), i?.();
2327
2434
  };
2328
2435
  }
2329
- function un(e, t) {
2330
- pe(fe);
2436
+ function bn(e, t) {
2437
+ me(pe);
2331
2438
  let n = t.experienceId?.trim();
2332
2439
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2333
- let r = t.prefetch ?? "onExpand", i = en(t.position), a = document.createElement("div");
2334
- 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", tn(t.offset));
2440
+ let r = t.prefetch ?? "onExpand", i = dn(t.position), a = document.createElement("div");
2441
+ 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", fn(t.offset));
2335
2442
  let o = document.createElement("button");
2336
2443
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2337
2444
  let s = document.createElement("div");
@@ -2351,82 +2458,82 @@ function un(e, t) {
2351
2458
  let m = document.createElement("span");
2352
2459
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2353
2460
  let h = document.createElement("button");
2354
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = an, h.setAttribute("aria-label", "Reduce");
2461
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = hn, h.setAttribute("aria-label", "Reduce");
2355
2462
  let g = document.createElement("button");
2356
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = nn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2463
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = pn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2357
2464
  let _ = document.createElement("button");
2358
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = rn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2465
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = mn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2359
2466
  let v = document.createElement("div");
2360
2467
  v.className = "liforma-ew__stage";
2361
2468
  let y = document.createElement("div");
2362
2469
  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);
2363
- let b = null, x = !1, S = !1, ee = !1, C = !1, w = !1, T = !1, E = !1, D = 0, O = "", k = null, A = null, j = null, M = null, N = null, P = null, F = null, I = 0, L = 0, R = null, te = !1, ne = new AbortController(), re = t.parallax !== !1, z = () => {
2470
+ let b = null, x = !1, S = !1, ee = !1, C = !1, w = !1, T = !1, E = !1, D = 0, O = "", k = null, A = null, j = null, M = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
2364
2471
  let e = a.dataset.state;
2365
2472
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
2366
- }, B = () => {
2473
+ }, z = () => {
2367
2474
  j !== null && (clearTimeout(j), j = null);
2368
- }, V = () => {
2475
+ }, B = () => {
2369
2476
  M !== null && (clearTimeout(M), M = null), a.classList.remove("liforma-ew--layout-settling");
2370
- }, H = () => {
2477
+ }, V = () => {
2371
2478
  for (let e of [
2372
2479
  f,
2373
2480
  l,
2374
2481
  p
2375
2482
  ]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
2376
2483
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
2377
- }, ie = (e, t, n, r) => {
2484
+ }, ae = (e, t, n, r) => {
2378
2485
  let i = (i) => {
2379
2486
  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";
2380
2487
  };
2381
2488
  i(f), i(l);
2382
2489
  let a = p.offsetWidth || 120;
2383
2490
  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";
2384
- }, ae = (e, t) => {
2385
- if (z() !== "docked") return;
2386
- let n = Xt(), r = Qt(e - I, t - L, n);
2387
- N = r.left, P = r.top, ie(r.left, r.top, n.width, n.height);
2388
2491
  }, oe = (e, t) => {
2389
- if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2390
- let n = Xt(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Qt(r + e, i + t, n);
2391
- N = a.left, P = a.top, ie(a.left, a.top, n.width, n.height);
2392
- }, se = (e) => {
2393
- R === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), ae(e.clientX, e.clientY)));
2394
- }, U = (e) => {
2492
+ if (R() !== "docked") return;
2493
+ let n = sn(), r = ln(e - te, t - I, n);
2494
+ N = r.left, P = r.top, ae(r.left, r.top, n.width, n.height);
2495
+ }, se = (e, t) => {
2496
+ if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2497
+ let n = sn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = ln(r + e, i + t, n);
2498
+ N = a.left, P = a.top, ae(a.left, a.top, n.width, n.height);
2499
+ }, ce = (e) => {
2500
+ L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
2501
+ }, H = (e) => {
2395
2502
  if (F === null || e && e.pointerId !== F) return;
2396
- let t = R;
2397
- F = null, R = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && te && (te = !1, window.removeEventListener("pointermove", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
2398
- }, ce = (e, t, n) => {
2399
- if (S || z() !== "docked" || !$t() || F !== null) return;
2400
- F = n, R = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2503
+ let t = L;
2504
+ 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", ce), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H));
2505
+ }, le = (e, t, n) => {
2506
+ if (S || R() !== "docked" || !un() || F !== null) return;
2507
+ F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2401
2508
  let r = f.getBoundingClientRect();
2402
- I = e - r.left, L = t - r.top, te || (te = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
2403
- }, le = (e) => {
2404
- if (S || z() !== "docked" || !$t() || F !== null) return;
2405
- F = e.pointerId, R = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2509
+ te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", ce), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
2510
+ }, ue = (e) => {
2511
+ if (S || R() !== "docked" || !un() || F !== null) return;
2512
+ F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2406
2513
  let t = f.getBoundingClientRect();
2407
2514
  N = t.left, P = t.top;
2408
- }, ue = (e) => {
2409
- R === "player" && (F === null || e.pointerId !== F || oe(e.dx, e.dy));
2515
+ }, U = (e) => {
2516
+ L === "player" && (F === null || e.pointerId !== F || se(e.dx, e.dy));
2410
2517
  }, de = (e) => {
2411
- R === "player" && (F === null || e.pointerId !== F || U());
2518
+ L === "player" && (F === null || e.pointerId !== F || H());
2412
2519
  }, W = () => {
2413
- let e = $t(), t = z();
2520
+ let e = un(), t = R();
2414
2521
  if (!e || t !== "expanded" && t !== "docked") {
2415
2522
  h.hidden = !0;
2416
2523
  return;
2417
2524
  }
2418
- h.hidden = !1, t === "docked" ? (h.innerHTML = on, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = an, h.setAttribute("aria-label", "Reduce"));
2419
- }, G = (e) => {
2420
- let t = Xt(), n = e && N !== null && P !== null ? Qt(N, P, t) : Zt(t);
2421
- n = Qt(n.left, n.top, t), N = n.left, P = n.top, ie(n.left, n.top, t.width, t.height), W();
2422
- }, K = () => {
2525
+ h.hidden = !1, t === "docked" ? (h.innerHTML = gn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = hn, h.setAttribute("aria-label", "Reduce"));
2526
+ }, fe = (e) => {
2527
+ let t = sn(), n = e && N !== null && P !== null ? ln(N, P, t) : cn(t);
2528
+ n = ln(n.left, n.top, t), N = n.left, P = n.top, ae(n.left, n.top, t.width, t.height), W();
2529
+ }, G = () => {
2423
2530
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2424
2531
  requestAnimationFrame(() => {
2425
2532
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
2426
2533
  });
2427
2534
  });
2428
- }, me = (e) => {
2429
- if (V(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !E) {
2535
+ }, K = (e) => {
2536
+ if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !E) {
2430
2537
  a.classList.remove("liforma-ew--layout-settling");
2431
2538
  return;
2432
2539
  }
@@ -2435,10 +2542,10 @@ function un(e, t) {
2435
2542
  a.classList.remove("liforma-ew--layout-settling");
2436
2543
  return;
2437
2544
  }
2438
- a.classList.remove("liforma-ew--layout-settling"), K();
2545
+ a.classList.remove("liforma-ew--layout-settling"), G();
2439
2546
  }, 220);
2440
2547
  }, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2441
- B(), j = setTimeout(() => {
2548
+ z(), j = setTimeout(() => {
2442
2549
  j = null, a.classList.remove("liforma-ew--session-concealing"), e();
2443
2550
  }, 280);
2444
2551
  })), ge = {
@@ -2459,30 +2566,30 @@ function un(e, t) {
2459
2566
  return;
2460
2567
  }
2461
2568
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
2462
- }, ye = () => {
2569
+ }, J = () => {
2463
2570
  ee = !0, o.disabled = !1, _e(null), r === "onExpand" && t.onPrefetchReady?.();
2464
- }, be = () => {
2571
+ }, ye = () => {
2465
2572
  C = !0, a.dataset.warm = "true", l.hidden = !1, E || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2466
- }, xe = (e) => {
2573
+ }, be = (e) => {
2467
2574
  k?.(), k = null;
2468
- let t = sn(s, e, { parallax: re });
2575
+ let t = _n(s, e, { parallax: ie });
2469
2576
  return t ? (k = t, !0) : !1;
2470
- }, Se = () => {
2471
- if (xe(ge)) {
2472
- ye();
2577
+ }, xe = () => {
2578
+ if (be(ge)) {
2579
+ J();
2473
2580
  return;
2474
2581
  }
2475
- _e("Loading…"), ve(n, { signal: ne.signal }).then((e) => {
2582
+ _e("Loading…"), ve(n, { signal: re.signal }).then((e) => {
2476
2583
  if (!S) {
2477
- if (!xe({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
2478
- ye();
2584
+ if (!be({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
2585
+ J();
2479
2586
  }
2480
2587
  }).catch((e) => {
2481
- if (S || ne.signal.aborted) return;
2588
+ if (S || re.signal.aborted) return;
2482
2589
  let n = e instanceof Error ? e : Error(String(e));
2483
2590
  _e("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
2484
2591
  });
2485
- }, J = () => ({
2592
+ }, Se = () => ({
2486
2593
  experienceId: n,
2487
2594
  ui: "widget",
2488
2595
  ...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
@@ -2494,75 +2601,75 @@ function un(e, t) {
2494
2601
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
2495
2602
  }), Ce = () => ({
2496
2603
  ...t.fit ? { fit: t.fit } : {},
2497
- startButton: cn(t)
2498
- }), we = (e = !0) => {
2499
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), H(), a.dataset.state = "expanded", q(null), typeof document < "u" && (O = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
2500
- }, Te = () => {
2501
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", q(null), typeof document < "u" && (document.body.style.overflow = O), G(!0), W(), b?.setWidgetChrome("docked");
2502
- }, Ee = (e) => {
2604
+ startButton: vn(t)
2605
+ }), Y = (e = !0) => {
2606
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), V(), a.dataset.state = "expanded", q(null), typeof document < "u" && (O = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
2607
+ }, X = () => {
2608
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", q(null), typeof document < "u" && (document.body.style.overflow = O), fe(!0), W(), b?.setWidgetChrome("docked");
2609
+ }, we = (e) => {
2503
2610
  e.on("started", () => {
2504
- S || (E = !0, a.dataset.live = "true", q(null), t.onStarted?.(), $(a.dataset.state) && K());
2611
+ S || (E = !0, a.dataset.live = "true", q(null), t.onStarted?.(), $(a.dataset.state) && G());
2505
2612
  });
2506
- }, De = () => {
2507
- V(), u.hidden = !0, p.hidden = !0, H(), 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"), ee && (o.disabled = !1), q(null), typeof document < "u" && (document.body.style.overflow = O), W();
2508
- }, Oe = () => {
2509
- B(), V(), D += 1, x = !1, C = !1, w = !1, T = !1, E = !1;
2613
+ }, Te = () => {
2614
+ B(), 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"), ee && (o.disabled = !1), q(null), typeof document < "u" && (document.body.style.overflow = O), W();
2615
+ }, Ee = () => {
2616
+ z(), B(), D += 1, x = !1, C = !1, w = !1, T = !1, E = !1;
2510
2617
  let e = b;
2511
2618
  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");
2512
- }, Y = () => {
2619
+ }, De = () => {
2513
2620
  if (!S && $(a.dataset.state)) {
2514
- if (U(), x = !1, b && T) {
2621
+ if (H(), x = !1, b && T) {
2515
2622
  let e = b;
2516
2623
  (async () => {
2517
- E && (await he(), S || b !== e) || (C && e.setWidgetChrome("collapsed"), De(), E ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : C && be(), t.onCollapsed?.(), t.onClose?.());
2624
+ E && (await he(), S || b !== e) || (C && e.setWidgetChrome("collapsed"), Te(), E ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : C && ye(), t.onCollapsed?.(), t.onClose?.());
2518
2625
  })();
2519
2626
  return;
2520
2627
  }
2521
- Oe(), De(), t.onCollapsed?.(), t.onClose?.();
2628
+ Ee(), Te(), t.onCollapsed?.(), t.onClose?.();
2522
2629
  }
2523
- }, ke = () => {
2524
- S || $t() && z() === "expanded" && me(() => {
2525
- Te();
2630
+ }, Oe = () => {
2631
+ S || un() && R() === "expanded" && K(() => {
2632
+ X();
2526
2633
  });
2527
- }, Ae = () => {
2528
- S || z() === "docked" && (U(), me(() => {
2529
- H(), we(!1), b?.setWidgetChrome("expanded");
2634
+ }, ke = () => {
2635
+ S || R() === "docked" && (H(), K(() => {
2636
+ V(), Y(!1), b?.setWidgetChrome("expanded");
2530
2637
  }));
2638
+ }, Ae = () => {
2639
+ !b || !E || (z(), a.classList.remove("liforma-ew--session-revealed"), Y(), b.setWidgetChrome("expanded"), x = !1, G());
2531
2640
  }, je = () => {
2532
- !b || !E || (B(), a.classList.remove("liforma-ew--session-revealed"), we(), b.setWidgetChrome("expanded"), x = !1, K());
2533
- }, Me = () => {
2534
- !b || !T || E || (B(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, C && b.setWidgetChrome("expanded"));
2535
- }, Ne = (e) => {
2536
- S || e !== D && !E || (B(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, b?.setWidgetChrome("expanded"), E && K());
2537
- }, Pe = () => {
2641
+ !b || !T || E || (z(), a.classList.remove("liforma-ew--session-revealed"), Y(), x = !1, C || b.setWidgetChrome("expanded"));
2642
+ }, Me = (e) => {
2643
+ S || e !== D && !E || (z(), a.classList.remove("liforma-ew--session-revealed"), Y(), x = !1, E && G());
2644
+ }, Ne = () => {
2538
2645
  if (S || w || C || b || $(a.dataset.state)) return;
2539
2646
  w = !0;
2540
2647
  let e = D;
2541
2648
  l.hidden = !1, (async () => {
2542
2649
  try {
2543
- let t = await Vt.startSession(J());
2650
+ let t = await Zt.startSession(Se());
2544
2651
  if (S || e !== D) {
2545
2652
  t.destroy();
2546
2653
  return;
2547
2654
  }
2548
- b = t, Ee(t);
2655
+ b = t, we(t);
2549
2656
  let n = await t.attach({
2550
2657
  container: l,
2551
2658
  ...Ce(),
2552
2659
  onWidgetReady: () => {
2553
- S || e !== D || (w = !1, T = !0, be());
2660
+ S || e !== D || (w = !1, T = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ye());
2554
2661
  },
2555
2662
  onWidgetExpand: () => {
2556
- Ne(e);
2663
+ Me(e);
2557
2664
  },
2558
2665
  onWidgetAudioSettings: (e) => {
2559
- S || Re(e);
2666
+ S || Le(e);
2560
2667
  },
2561
2668
  onWidgetDragStart: (e) => {
2562
- S || le(e);
2669
+ S || ue(e);
2563
2670
  },
2564
2671
  onWidgetDragMove: (e) => {
2565
- S || ue(e);
2672
+ S || U(e);
2566
2673
  },
2567
2674
  onWidgetDragEnd: (e) => {
2568
2675
  S || de(e);
@@ -2575,8 +2682,8 @@ function un(e, t) {
2575
2682
  t.destroy(), b === t && (b = null);
2576
2683
  return;
2577
2684
  }
2578
- T = !0, n.on("close", () => {
2579
- S || Y();
2685
+ n.on("close", () => {
2686
+ S || De();
2580
2687
  });
2581
2688
  } catch (n) {
2582
2689
  if (S || e !== D) return;
@@ -2585,37 +2692,37 @@ function un(e, t) {
2585
2692
  t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
2586
2693
  }
2587
2694
  })();
2588
- }, Fe = () => {
2695
+ }, Pe = () => {
2589
2696
  if (S || x || !ee || $(a.dataset.state)) return;
2590
2697
  if (b && E) {
2591
- je();
2698
+ Ae();
2592
2699
  return;
2593
2700
  }
2594
2701
  if (b && T) {
2595
- Me();
2702
+ je();
2596
2703
  return;
2597
2704
  }
2598
2705
  let e = ++D;
2599
2706
  x = !0, C = !1, w = !1, T = !1, E = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
2600
2707
  try {
2601
- we();
2602
- let t = await Vt.startSession(J());
2708
+ Y();
2709
+ let t = await Zt.startSession(Se());
2603
2710
  if (S || e !== D) {
2604
2711
  t.destroy();
2605
2712
  return;
2606
2713
  }
2607
- b = t, Ee(t);
2714
+ b = t, we(t);
2608
2715
  let n = await t.attach({
2609
2716
  container: v,
2610
2717
  ...Ce(),
2611
2718
  onWidgetAudioSettings: (e) => {
2612
- S || Re(e);
2719
+ S || Le(e);
2613
2720
  },
2614
2721
  onWidgetDragStart: (e) => {
2615
- S || le(e);
2722
+ S || ue(e);
2616
2723
  },
2617
2724
  onWidgetDragMove: (e) => {
2618
- S || ue(e);
2725
+ S || U(e);
2619
2726
  },
2620
2727
  onWidgetDragEnd: (e) => {
2621
2728
  S || de(e);
@@ -2628,8 +2735,8 @@ function un(e, t) {
2628
2735
  t.destroy(), b === t && (b = null);
2629
2736
  return;
2630
2737
  }
2631
- T = !0, n.on("close", () => {
2632
- S || Y();
2738
+ T = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
2739
+ S || De();
2633
2740
  });
2634
2741
  } catch (n) {
2635
2742
  if (S || e !== D) return;
@@ -2639,87 +2746,91 @@ function un(e, t) {
2639
2746
  e === D && (x = !1);
2640
2747
  }
2641
2748
  })();
2642
- }, Ie = () => {
2749
+ }, Fe = () => {
2643
2750
  if (!(S || $(a.dataset.state))) {
2644
2751
  if (b && E) {
2645
- je();
2752
+ Ae();
2646
2753
  return;
2647
2754
  }
2648
2755
  if (b && T) {
2649
- Me();
2756
+ je();
2757
+ return;
2758
+ }
2759
+ if (w || b) {
2760
+ Y();
2650
2761
  return;
2651
2762
  }
2652
- Fe();
2763
+ Pe();
2653
2764
  }
2654
- }, Le = (e) => {
2655
- if (e.stopPropagation(), z() === "expanded") {
2656
- ke();
2765
+ }, Ie = (e) => {
2766
+ if (e.stopPropagation(), R() === "expanded") {
2767
+ Oe();
2657
2768
  return;
2658
2769
  }
2659
- z() === "docked" && Ae();
2660
- }, Re = (e) => {
2770
+ R() === "docked" && ke();
2771
+ }, Le = (e) => {
2661
2772
  g.setAttribute("aria-pressed", e ? "true" : "false");
2662
- }, ze = (e) => {
2773
+ }, Re = (e) => {
2663
2774
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
2775
+ }, ze = (e) => {
2776
+ R() === "docked" && un() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
2664
2777
  }, Be = (e) => {
2665
- z() === "docked" && $t() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
2666
- }, Ve = (e) => {
2667
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Y());
2668
- }, He = () => {
2778
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), De());
2779
+ }, Ve = () => {
2669
2780
  if (!S) {
2670
- if (z() === "docked") {
2671
- if (!$t()) {
2672
- Ae();
2781
+ if (R() === "docked") {
2782
+ if (!un()) {
2783
+ ke();
2673
2784
  return;
2674
2785
  }
2675
- E ? me(() => {
2676
- G(!0);
2677
- }) : G(!0);
2786
+ E ? K(() => {
2787
+ fe(!0);
2788
+ }) : fe(!0);
2678
2789
  return;
2679
2790
  }
2680
2791
  W();
2681
2792
  }
2682
- }, Ue = typeof window < "u" ? window.matchMedia(Ut) : null, We = () => {
2793
+ }, He = typeof window < "u" ? window.matchMedia($t) : null, Ue = () => {
2683
2794
  if (!S) {
2684
- if (z() === "docked" && !$t()) {
2685
- Ae();
2795
+ if (R() === "docked" && !un()) {
2796
+ ke();
2686
2797
  return;
2687
2798
  }
2688
2799
  W();
2689
2800
  }
2690
2801
  };
2691
- return o.addEventListener("click", Ie), d.addEventListener("click", Y), _.addEventListener("click", (e) => {
2692
- e.stopPropagation(), Y();
2693
- }), h.addEventListener("click", Le), g.addEventListener("click", ze), p.addEventListener("pointerdown", Be), window.addEventListener("keydown", Ve), window.addEventListener("resize", He), Ue?.addEventListener("change", We), Se(), W(), r === "eager" ? queueMicrotask(() => {
2694
- S || Pe();
2695
- }) : r === "idle" && (A = ln(() => {
2696
- S || Pe();
2802
+ return o.addEventListener("click", Fe), d.addEventListener("click", De), _.addEventListener("click", (e) => {
2803
+ e.stopPropagation(), De();
2804
+ }), h.addEventListener("click", Ie), g.addEventListener("click", Re), p.addEventListener("pointerdown", ze), window.addEventListener("keydown", Be), window.addEventListener("resize", Ve), He?.addEventListener("change", Ue), xe(), W(), r === "eager" ? queueMicrotask(() => {
2805
+ S || Ne();
2806
+ }) : r === "idle" && (A = yn(() => {
2807
+ S || Ne();
2697
2808
  })), {
2698
2809
  root: a,
2699
- expand: Ie,
2700
- collapse: Y,
2701
- dock: ke,
2702
- maximize: Ae,
2810
+ expand: Fe,
2811
+ collapse: De,
2812
+ dock: Oe,
2813
+ maximize: ke,
2703
2814
  prefetch() {
2704
2815
  if (r === "onExpand") {
2705
- Pe();
2816
+ Ne();
2706
2817
  return;
2707
2818
  }
2708
- Pe();
2819
+ Ne();
2709
2820
  },
2710
2821
  destroy() {
2711
- S || (S = !0, U(), A?.(), A = null, ne.abort(), k?.(), k = null, window.removeEventListener("keydown", Ve), window.removeEventListener("resize", He), Ue?.removeEventListener("change", We), Oe(), De(), e.replaceChildren());
2822
+ S || (S = !0, H(), A?.(), A = null, re.abort(), k?.(), k = null, window.removeEventListener("keydown", Be), window.removeEventListener("resize", Ve), He?.removeEventListener("change", Ue), Ee(), Te(), e.replaceChildren());
2712
2823
  }
2713
2824
  };
2714
2825
  }
2715
2826
  //#endregion
2716
2827
  //#region src/react/ExperienceWidget.tsx
2717
- function dn(t) {
2828
+ function xn(t) {
2718
2829
  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, language: _, mode: v, speechInputMode: y, speechOnly: b, fit: x, embedBaseUrl: S, expandedMaxWidth: ee, expandedMaxHeight: C, startButtonLabel: w, startButton: T, className: E = "", onExpanded: D, onCollapsed: O, onStarted: k, onClose: A, onError: j, onPrefetchReady: M } = t, N = m === "bottom-right" || m === "bottom-left";
2719
2830
  return e(() => {
2720
2831
  let e = r.current;
2721
2832
  if (!e || !i.trim()) return;
2722
- let t = un(e, {
2833
+ let t = bn(e, {
2723
2834
  experienceId: i,
2724
2835
  alt: o,
2725
2836
  galleryThumb: s,
@@ -2790,6 +2901,6 @@ function dn(t) {
2790
2901
  });
2791
2902
  }
2792
2903
  //#endregion
2793
- export { G as ExperienceThumbnail, dn as ExperienceWidget, y as createLiformaSessionRouteHandler };
2904
+ export { fe as ExperienceThumbnail, xn as ExperienceWidget, v as createLiformaSessionRouteHandler };
2794
2905
 
2795
2906
  //# sourceMappingURL=index.js.map