@liforma/client 0.4.10 → 0.4.11

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 (117) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/next/index.js +754 -618
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/react/ExperienceThumbnail.d.ts +2 -0
  5. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  6. package/dist/next/react/ExperienceWidget.d.ts +3 -0
  7. package/dist/next/react/ExperienceWidget.d.ts.map +1 -1
  8. package/dist/next/thumbnail/expandAssetUrl.d.ts +17 -0
  9. package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -0
  10. package/dist/next/thumbnail/expandAssetUrl.test.d.ts +2 -0
  11. package/dist/next/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
  12. package/dist/next/thumbnail/index.d.ts +3 -0
  13. package/dist/next/thumbnail/index.d.ts.map +1 -1
  14. package/dist/next/thumbnail/locationPlate.d.ts +13 -0
  15. package/dist/next/thumbnail/locationPlate.d.ts.map +1 -0
  16. package/dist/next/thumbnail/locationPlate.test.d.ts +2 -0
  17. package/dist/next/thumbnail/locationPlate.test.d.ts.map +1 -0
  18. package/dist/next/thumbnail/styles.d.ts.map +1 -1
  19. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +12 -2
  20. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  21. package/dist/next/thumbnail/types.d.ts +7 -1
  22. package/dist/next/thumbnail/types.d.ts.map +1 -1
  23. package/dist/next/thumbnail.js +273 -192
  24. package/dist/next/thumbnail.js.map +1 -1
  25. package/dist/next/v2/embed/iframeHost.d.ts +3 -0
  26. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  27. package/dist/next/v2/embed/protocol.d.ts +21 -0
  28. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  29. package/dist/next/v2/experience.d.ts +20 -0
  30. package/dist/next/v2/experience.d.ts.map +1 -1
  31. package/dist/next/v2/shims/embedBaseUrl.d.ts +15 -1
  32. package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
  33. package/dist/next/v2/types/stage.d.ts +8 -0
  34. package/dist/next/v2/types/stage.d.ts.map +1 -0
  35. package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
  36. package/dist/npm/index.js +557 -449
  37. package/dist/npm/index.js.map +1 -1
  38. package/dist/npm/thumbnail/expandAssetUrl.d.ts +17 -0
  39. package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -0
  40. package/dist/npm/thumbnail/index.d.ts +3 -0
  41. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  42. package/dist/npm/thumbnail/index.js +151 -75
  43. package/dist/npm/thumbnail/index.js.map +1 -1
  44. package/dist/npm/thumbnail/locationPlate.d.ts +13 -0
  45. package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -0
  46. package/dist/npm/thumbnail/styles.d.ts.map +1 -1
  47. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +12 -2
  48. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  49. package/dist/npm/thumbnail/types.d.ts +7 -1
  50. package/dist/npm/thumbnail/types.d.ts.map +1 -1
  51. package/dist/npm/v2/embed/iframeHost.d.ts +3 -0
  52. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  53. package/dist/npm/v2/embed/protocol.d.ts +21 -0
  54. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  55. package/dist/npm/v2/experience.d.ts +20 -0
  56. package/dist/npm/v2/experience.d.ts.map +1 -1
  57. package/dist/npm/v2/index.d.ts +1 -0
  58. package/dist/npm/v2/index.d.ts.map +1 -1
  59. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  60. package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
  61. package/dist/npm/v2/npm.d.ts +1 -0
  62. package/dist/npm/v2/npm.d.ts.map +1 -1
  63. package/dist/npm/v2/shims/embedBaseUrl.d.ts +15 -1
  64. package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
  65. package/dist/npm/v2/types/stage.d.ts +8 -0
  66. package/dist/npm/v2/types/stage.d.ts.map +1 -0
  67. package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
  68. package/dist/react/component/experienceComponentRuntime.d.ts +3 -0
  69. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  70. package/dist/react/component/experienceComponentTypes.d.ts +13 -1
  71. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  72. package/dist/react/index.js +870 -712
  73. package/dist/react/index.js.map +1 -1
  74. package/dist/react/react/Experience.d.ts.map +1 -1
  75. package/dist/react/react/ExperienceThumbnail.d.ts +2 -0
  76. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  77. package/dist/react/react/ExperienceWidget.d.ts +3 -0
  78. package/dist/react/react/ExperienceWidget.d.ts.map +1 -1
  79. package/dist/react/thumbnail/expandAssetUrl.d.ts +17 -0
  80. package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -0
  81. package/dist/react/thumbnail/expandAssetUrl.test.d.ts +2 -0
  82. package/dist/react/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
  83. package/dist/react/thumbnail/index.d.ts +3 -0
  84. package/dist/react/thumbnail/index.d.ts.map +1 -1
  85. package/dist/react/thumbnail/locationPlate.d.ts +13 -0
  86. package/dist/react/thumbnail/locationPlate.d.ts.map +1 -0
  87. package/dist/react/thumbnail/locationPlate.test.d.ts +2 -0
  88. package/dist/react/thumbnail/locationPlate.test.d.ts.map +1 -0
  89. package/dist/react/thumbnail/styles.d.ts.map +1 -1
  90. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +12 -2
  91. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  92. package/dist/react/thumbnail/types.d.ts +7 -1
  93. package/dist/react/thumbnail/types.d.ts.map +1 -1
  94. package/dist/react/thumbnail.js +273 -192
  95. package/dist/react/thumbnail.js.map +1 -1
  96. package/dist/react/v2/embed/iframeHost.d.ts +3 -0
  97. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  98. package/dist/react/v2/embed/protocol.d.ts +21 -0
  99. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  100. package/dist/react/v2/experience.d.ts +20 -0
  101. package/dist/react/v2/experience.d.ts.map +1 -1
  102. package/dist/react/v2/shims/embedBaseUrl.d.ts +15 -1
  103. package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
  104. package/dist/react/v2/types/stage.d.ts +8 -0
  105. package/dist/react/v2/types/stage.d.ts.map +1 -0
  106. package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
  107. package/dist/sdk/v2/client.js +2 -2
  108. package/dist/sdk/v2/client.js.map +1 -1
  109. package/dist/sdk/v2/thumbnail.js +9 -2
  110. package/dist/sdk/v2/thumbnail.js.map +1 -1
  111. package/dist/svelte/Experience.svelte +41 -0
  112. package/dist/svelte/Experience.svelte.d.ts +3 -0
  113. package/dist/svelte/ExperienceThumbnail.svelte +24 -2
  114. package/dist/svelte/ExperienceThumbnail.svelte.d.ts +2 -0
  115. package/dist/svelte/ExperienceWidget.svelte +9 -0
  116. package/dist/svelte/ExperienceWidget.svelte.d.ts +3 -0
  117. package/package.json +1 -1
@@ -175,23 +175,23 @@ function k() {
175
175
  function A(e) {
176
176
  return e instanceof DOMException || e instanceof Error ? e : Error(String(e));
177
177
  }
178
- function j(e) {
178
+ function ee(e) {
179
179
  return e instanceof DOMException && e.name === "AbortError";
180
180
  }
181
- function M(e) {
181
+ function j(e) {
182
182
  !e.instance || e.instanceDestroyed || (e.instanceDestroyed = !0, e.instance.destroy());
183
183
  }
184
- function N(e, t, n, r) {
184
+ function M(e, t, n, r) {
185
185
  e.unsubscribers.push(t.on(n, r));
186
186
  }
187
- function P(e, t, n) {
188
- N(e, t, "ready", (t) => {
187
+ function N(e, t, n) {
188
+ M(e, t, "ready", (t) => {
189
189
  e.destroyed || (e.ready.resolve(t), n().onReady?.(t));
190
- }), N(e, t, "started", (t) => {
190
+ }), M(e, t, "started", (t) => {
191
191
  e.destroyed || (e.started.resolve(t), n().onStarted?.(t));
192
- }), N(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), N(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), N(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), N(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), N(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), N(e, t, "characterFocusChanged", (e) => n().onCharacterFocusChanged?.(e)), N(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), N(e, t, "message", (e) => n().onMessage?.(e)), N(e, t, "listeningState", (e) => n().onListeningState?.(e)), N(e, t, "activityChange", (e) => n().onActivityChange?.(e)), N(e, t, "feedback", (e) => n().onFeedback?.(e)), N(e, t, "feedbackFailed", (e) => n().onFeedbackFailed?.(e)), N(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
192
+ }), M(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), M(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), M(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), M(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), M(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), M(e, t, "characterFocusChanged", (e) => n().onCharacterFocusChanged?.(e)), M(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), M(e, t, "message", (e) => n().onMessage?.(e)), M(e, t, "listeningState", (e) => n().onListeningState?.(e)), M(e, t, "activityChange", (e) => n().onActivityChange?.(e)), M(e, t, "feedback", (e) => n().onFeedback?.(e)), M(e, t, "feedbackFailed", (e) => n().onFeedbackFailed?.(e)), M(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
193
193
  }
194
- function F(e = () => ({}), t = () => ({})) {
194
+ function P(e = () => ({}), t = () => ({})) {
195
195
  let n = 0, r = null;
196
196
  function i(e) {
197
197
  if (e) {
@@ -207,7 +207,7 @@ function F(e = () => ({}), t = () => ({})) {
207
207
  }
208
208
  function a(e, t, n, a, o = !1, s) {
209
209
  let c = A(e);
210
- return !j(c) && r === t && !t.destroyed && (o && a?.(D(c, { experienceId: i(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), n.onError?.(c))), c;
210
+ return !ee(c) && r === t && !t.destroyed && (o && a?.(D(c, { experienceId: i(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), n.onError?.(c))), c;
211
211
  }
212
212
  function o() {
213
213
  if (!r || r.destroyed) throw k();
@@ -235,19 +235,22 @@ function F(e = () => ({}), t = () => ({})) {
235
235
  let t = k();
236
236
  e.session.reject(t), e.ready.reject(t), e.started.reject(t);
237
237
  for (let t of e.unsubscribers.splice(0)) t();
238
- M(e), r === e && (r = null);
238
+ j(e), r === e && (r = null);
239
239
  }
240
240
  async function f(e, n, i, o, u, d) {
241
241
  try {
242
242
  let a = await c.startSession(i);
243
243
  if (e.instance = a, e.destroyed || r !== e) {
244
- M(e);
244
+ j(e);
245
245
  return;
246
246
  }
247
- P(e, a, o);
247
+ N(e, a, o);
248
248
  let d = t(), f = d.returnUrl?.trim() || u?.trim(), p = await a.attach({
249
249
  container: n,
250
250
  fit: d.fit,
251
+ stage: d.stage,
252
+ pipBackground: d.pipBackground,
253
+ pipShadow: d.pipShadow,
251
254
  startButton: d.startButton,
252
255
  theme: d.theme,
253
256
  showFeedback: d.showFeedback,
@@ -273,7 +276,7 @@ function F(e = () => ({}), t = () => ({})) {
273
276
  });
274
277
  } catch (t) {
275
278
  let n = a(t, e, o(), d, !0, i);
276
- e.session.reject(n), e.ready.reject(n), e.started.reject(n), M(e);
279
+ e.session.reject(n), e.ready.reject(n), e.started.reject(n), j(e);
277
280
  }
278
281
  }
279
282
  function p(t, n, i, o) {
@@ -303,17 +306,17 @@ function F(e = () => ({}), t = () => ({})) {
303
306
  }
304
307
  //#endregion
305
308
  //#region src/svelte/experienceLoadErrorStyles.ts
306
- var I = "liforma-experience-load-error-styles";
307
- function ee() {
309
+ var F = "liforma-experience-load-error-styles";
310
+ function te() {
308
311
  if (typeof document > "u" || document.getElementById("liforma-experience-load-error-styles")) return;
309
312
  let e = document.createElement("style");
310
- e.id = I, e.textContent = te, document.head.append(e);
313
+ e.id = F, e.textContent = I, document.head.append(e);
311
314
  }
312
- var te = "\n .liforma-loading-screen {\n inset: 0;\n z-index: 20;\n box-sizing: border-box;\n overflow-x: clip;\n width: 100%;\n height: 100%;\n max-width: 100vw;\n background:\n radial-gradient(circle at 50% 60%, rgba(79, 126, 196, 0.18), transparent 38%),\n #030508;\n font-family: system-ui, -apple-system, sans-serif;\n color: #e8f0ff;\n text-align: center;\n }\n .liforma-loading-screen-absolute {\n position: absolute;\n }\n .liforma-loading-card {\n position: absolute;\n left: 50%;\n top: 60%;\n transform: translate(-50%, -50%);\n width: min(22rem, calc(100% - 2.5rem));\n max-width: calc(100% - max(1.25rem, env(safe-area-inset-left, 0px)) - max(1.25rem, env(safe-area-inset-right, 0px)));\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n }\n .liforma-loading-card-error {\n display: block;\n text-align: center;\n padding: 1rem 1.05rem;\n border-radius: 14px;\n border: 1px solid rgba(255, 154, 154, 0.28);\n background:\n linear-gradient(180deg, rgba(21, 29, 42, 0.92), rgba(9, 13, 20, 0.92));\n }\n .liforma-loading-kicker {\n margin: 0 0 0.18rem;\n color: #8ba4c5;\n font-size: 0.68rem;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.08em;\n }\n .liforma-loading-error {\n margin: 0;\n max-width: 28rem;\n color: #ffb4b4;\n font-size: 0.92rem;\n line-height: 1.4;\n }\n .liforma-loading-error-title {\n margin: 0;\n color: #f6ebe8;\n font-size: 0.98rem;\n font-weight: 650;\n line-height: 1.35;\n }\n .liforma-loading-error-advanced {\n margin: 0.85rem 0 0;\n padding: 0;\n border: 0;\n background: transparent;\n color: #9eb7d8;\n font: inherit;\n font-size: 0.78rem;\n font-weight: 650;\n letter-spacing: 0.02em;\n text-decoration: underline;\n text-underline-offset: 0.18em;\n cursor: pointer;\n }\n .liforma-loading-error-advanced:hover,\n .liforma-loading-error-advanced:focus-visible {\n color: #d7e6ff;\n outline: none;\n }\n .liforma-loading-error-detail {\n margin: 0.7rem 0 0;\n padding: 0.65rem 0.7rem;\n border-radius: 10px;\n border: 1px solid rgba(158, 191, 255, 0.16);\n background: rgba(3, 5, 8, 0.45);\n color: #c6d4e8;\n font-size: 0.78rem;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n line-height: 1.4;\n text-align: left;\n white-space: pre-wrap;\n word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
315
+ var I = "\n .liforma-loading-screen {\n inset: 0;\n z-index: 20;\n box-sizing: border-box;\n overflow-x: clip;\n width: 100%;\n height: 100%;\n max-width: 100vw;\n background:\n radial-gradient(circle at 50% 60%, rgba(79, 126, 196, 0.18), transparent 38%),\n #030508;\n font-family: system-ui, -apple-system, sans-serif;\n color: #e8f0ff;\n text-align: center;\n }\n .liforma-loading-screen-absolute {\n position: absolute;\n }\n .liforma-loading-card {\n position: absolute;\n left: 50%;\n top: 60%;\n transform: translate(-50%, -50%);\n width: min(22rem, calc(100% - 2.5rem));\n max-width: calc(100% - max(1.25rem, env(safe-area-inset-left, 0px)) - max(1.25rem, env(safe-area-inset-right, 0px)));\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n }\n .liforma-loading-card-error {\n display: block;\n text-align: center;\n padding: 1rem 1.05rem;\n border-radius: 14px;\n border: 1px solid rgba(255, 154, 154, 0.28);\n background:\n linear-gradient(180deg, rgba(21, 29, 42, 0.92), rgba(9, 13, 20, 0.92));\n }\n .liforma-loading-kicker {\n margin: 0 0 0.18rem;\n color: #8ba4c5;\n font-size: 0.68rem;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.08em;\n }\n .liforma-loading-error {\n margin: 0;\n max-width: 28rem;\n color: #ffb4b4;\n font-size: 0.92rem;\n line-height: 1.4;\n }\n .liforma-loading-error-title {\n margin: 0;\n color: #f6ebe8;\n font-size: 0.98rem;\n font-weight: 650;\n line-height: 1.35;\n }\n .liforma-loading-error-advanced {\n margin: 0.85rem 0 0;\n padding: 0;\n border: 0;\n background: transparent;\n color: #9eb7d8;\n font: inherit;\n font-size: 0.78rem;\n font-weight: 650;\n letter-spacing: 0.02em;\n text-decoration: underline;\n text-underline-offset: 0.18em;\n cursor: pointer;\n }\n .liforma-loading-error-advanced:hover,\n .liforma-loading-error-advanced:focus-visible {\n color: #d7e6ff;\n outline: none;\n }\n .liforma-loading-error-detail {\n margin: 0.7rem 0 0;\n padding: 0.65rem 0.7rem;\n border-radius: 10px;\n border: 1px solid rgba(158, 191, 255, 0.16);\n background: rgba(3, 5, 8, 0.45);\n color: #c6d4e8;\n font-size: 0.78rem;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n line-height: 1.4;\n text-align: left;\n white-space: pre-wrap;\n word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
313
316
  //#endregion
314
317
  //#region src/svelte/experienceLoadErrorOverlay.ts
315
318
  function L(e, t) {
316
- ee();
319
+ te();
317
320
  let n = t, r = !1, i = document.createElement("div");
318
321
  i.className = "liforma-loading-screen liforma-loading-screen-absolute", i.setAttribute("role", "alert"), i.setAttribute("aria-live", "assertive");
319
322
  let a = document.createElement("div");
@@ -344,102 +347,121 @@ function L(e, t) {
344
347
  //#endregion
345
348
  //#region src/react/Experience.tsx
346
349
  var ne = e(function(e, a) {
347
- let { returnUrl: c, fit: l, startButton: u, theme: p, showFeedback: m, interaction: h, closeButton: g, onReady: y, onStarted: b, onUserTranscript: x, onUserSpeechStarted: S, onUserSpeechEnded: C, onCharacterSpeechStarted: w, onCharacterSpeechEnded: T, onCharacterFocusChanged: E, onConversationUpdate: D, onMessage: O, onListeningState: j, onActivityChange: M, onFeedback: N, onFeedbackFailed: P, onConversationProcessorError: I, onPlayerStatusChange: ee, onStateUpdate: te, onClose: ne, onError: re } = e, ie = o({}), R = o({
350
+ let { returnUrl: c, fit: l, stage: u, pipBackground: p, pipShadow: m, startButton: h, theme: g, showFeedback: y, interaction: b, closeButton: x, onReady: S, onStarted: C, onUserTranscript: w, onUserSpeechStarted: T, onUserSpeechEnded: E, onCharacterSpeechStarted: D, onCharacterSpeechEnded: O, onCharacterFocusChanged: ee, onConversationUpdate: j, onMessage: M, onListeningState: N, onActivityChange: F, onFeedback: te, onFeedbackFailed: I, onConversationProcessorError: ne, onPlayerStatusChange: re, onStateUpdate: ie, onClose: R, onError: z } = e, ae = o({}), B = o({
348
351
  fit: l,
349
- startButton: u,
350
- theme: p,
351
- showFeedback: m,
352
- interaction: h,
353
- closeButton: g,
352
+ stage: u,
353
+ pipBackground: p,
354
+ pipShadow: m,
355
+ startButton: h,
356
+ theme: g,
357
+ showFeedback: y,
358
+ interaction: b,
359
+ closeButton: x,
354
360
  returnUrl: c
355
- }), z = o(F(() => ie.current, () => R.current)), B = o(null), [ae, V] = s(!1), [H, oe] = s(null), se = o(null), U = o(null), ce = v(e);
356
- R.current = {
361
+ }), V = o(P(() => ae.current, () => B.current)), oe = o(null), [H, se] = s(!1), [U, ce] = s(null), le = o(null), ue = o(null), de = v(e);
362
+ B.current = {
357
363
  fit: l,
358
- startButton: u,
359
- theme: p,
360
- showFeedback: m,
361
- interaction: h,
362
- closeButton: g,
364
+ stage: u,
365
+ pipBackground: p,
366
+ pipShadow: m,
367
+ startButton: h,
368
+ theme: g,
369
+ showFeedback: y,
370
+ interaction: b,
371
+ closeButton: x,
363
372
  returnUrl: c
364
- }, ie.current = {
365
- onReady: y,
366
- onStarted: b,
367
- onUserTranscript: x,
368
- onUserSpeechStarted: S,
369
- onUserSpeechEnded: C,
370
- onCharacterSpeechStarted: w,
371
- onCharacterSpeechEnded: T,
372
- onCharacterFocusChanged: E,
373
- onConversationUpdate: D,
374
- onMessage: O,
375
- onListeningState: j,
376
- onActivityChange: M,
377
- onFeedback: N,
378
- onFeedbackFailed: P,
379
- onConversationProcessorError: I,
380
- onPlayerStatusChange: ee,
381
- onStateUpdate: te,
382
- onClose: ne,
383
- onError: re
384
- };
385
- let le = t((e) => {
386
- se.current = e, V(e !== null);
373
+ }, ae.current = {
374
+ onReady: S,
375
+ onStarted: C,
376
+ onUserTranscript: w,
377
+ onUserSpeechStarted: T,
378
+ onUserSpeechEnded: E,
379
+ onCharacterSpeechStarted: D,
380
+ onCharacterSpeechEnded: O,
381
+ onCharacterFocusChanged: ee,
382
+ onConversationUpdate: j,
383
+ onMessage: M,
384
+ onListeningState: N,
385
+ onActivityChange: F,
386
+ onFeedback: te,
387
+ onFeedbackFailed: I,
388
+ onConversationProcessorError: ne,
389
+ onPlayerStatusChange: re,
390
+ onStateUpdate: ie,
391
+ onClose: R,
392
+ onError: z
393
+ };
394
+ let W = t((e) => {
395
+ le.current = e, se(e !== null);
387
396
  }, []);
388
397
  return r(a, () => ({
389
398
  ready: () => {
390
- let e = B.current;
399
+ let e = oe.current;
391
400
  return !e || e.destroyed ? Promise.reject(k()) : e.ready.promise;
392
401
  },
393
402
  started: () => {
394
- let e = B.current;
403
+ let e = oe.current;
395
404
  return !e || e.destroyed ? Promise.reject(k()) : e.started.promise;
396
405
  },
397
406
  speech: {
398
- speak: (e) => z.current.withSession((t) => t.speech.speak(e)),
399
- play: (e) => z.current.withSession((t) => t.speech.play(e)),
407
+ speak: (e) => V.current.withSession((t) => t.speech.speak(e)),
408
+ play: (e) => V.current.withSession((t) => t.speech.play(e)),
400
409
  createUtterance: (e) => {
401
- let t = z.current.getActiveInstance();
410
+ let t = V.current.getActiveInstance();
402
411
  if (!t) throw Error("Session has not started. Wait for the player start button and the started event before using speech APIs.");
403
412
  return t.speech.createUtterance(e);
404
413
  },
405
- interrupt: (e) => z.current.withSession((t) => t.speech.interrupt(e))
414
+ interrupt: (e) => V.current.withSession((t) => t.speech.interrupt(e))
406
415
  },
407
- startListening: () => z.current.withSession((e) => e.startListening()),
408
- stopListening: () => z.current.withSession((e) => e.stopListening()),
409
- listenOnce: (e) => z.current.withSession((t) => t.listenOnce(e)),
410
- getSession: () => z.current.getActiveInstance()?.getSession() ?? null,
411
- getManifest: () => z.current.getActiveInstance()?.getManifest() ?? null,
412
- getConversation: () => z.current.getActiveInstance()?.getConversation() ?? [],
413
- focusCharacter: (e) => z.current.withSession((t) => t.focusCharacter(e)),
414
- setFit: (e) => z.current.withSession((t) => t.setFit(e)),
415
- conversion: (e) => z.current.withSession((t) => t.conversion(e)),
416
- engage: () => z.current.withSession((e) => e.engage()),
417
- end: () => z.current.withSession((e) => e.end())
416
+ startListening: () => V.current.withSession((e) => e.startListening()),
417
+ stopListening: () => V.current.withSession((e) => e.stopListening()),
418
+ listenOnce: (e) => V.current.withSession((t) => t.listenOnce(e)),
419
+ getSession: () => V.current.getActiveInstance()?.getSession() ?? null,
420
+ getManifest: () => V.current.getActiveInstance()?.getManifest() ?? null,
421
+ getConversation: () => V.current.getActiveInstance()?.getConversation() ?? [],
422
+ focusCharacter: (e) => V.current.withSession((t) => t.focusCharacter(e)),
423
+ setFit: (e) => V.current.withSession((t) => t.setFit(e)),
424
+ setStage: (e) => V.current.withSession((t) => t.setStage(e)),
425
+ setPipBackground: (e) => V.current.withSession((t) => t.setPipBackground(e)),
426
+ setPipShadow: (e) => V.current.withSession((t) => t.setPipShadow(e)),
427
+ conversion: (e) => V.current.withSession((t) => t.conversion(e)),
428
+ engage: () => V.current.withSession((e) => e.engage()),
429
+ end: () => V.current.withSession((e) => e.end())
418
430
  }), []), i(() => {
419
- if (!ae || !se.current) return;
420
- let t = se.current, n = z.current, r;
431
+ if (!H || !le.current) return;
432
+ let t = le.current, n = V.current, r;
421
433
  try {
422
434
  r = { options: _(e) };
423
435
  } catch (e) {
424
436
  r = { error: A(e) };
425
437
  }
426
- let i = n.activateGeneration(t, r, c, oe);
427
- return B.current = i, () => {
428
- n.cancelGeneration(i), B.current === i && (B.current = null);
438
+ let i = n.activateGeneration(t, r, c, ce);
439
+ return oe.current = i, () => {
440
+ n.cancelGeneration(i), oe.current === i && (oe.current = null);
429
441
  };
430
442
  }, [
431
- ae,
432
- ce,
443
+ H,
444
+ de,
433
445
  c
434
446
  ]), n(() => {
435
- let e = z.current.getActiveInstance();
447
+ let e = V.current.getActiveInstance();
436
448
  e && e.setFit(l ?? "full");
437
449
  }, [l]), n(() => {
438
- let e = U.current;
439
- if (!e || (e.replaceChildren(), !H)) return;
440
- let t = L(e, H);
450
+ let e = V.current.getActiveInstance();
451
+ e && e.setStage(u ?? "fill");
452
+ }, [u]), n(() => {
453
+ let e = V.current.getActiveInstance();
454
+ e && e.setPipBackground(p ?? "none");
455
+ }, [p]), n(() => {
456
+ if (m === void 0) return;
457
+ let e = V.current.getActiveInstance();
458
+ e && e.setPipShadow(m);
459
+ }, [m]), n(() => {
460
+ let e = ue.current;
461
+ if (!e || (e.replaceChildren(), !U)) return;
462
+ let t = L(e, U);
441
463
  return () => t.remove();
442
- }, [H]), /* @__PURE__ */ f("div", {
464
+ }, [U]), /* @__PURE__ */ f("div", {
443
465
  className: "liforma-experience-shell",
444
466
  style: {
445
467
  position: "relative",
@@ -448,17 +470,17 @@ var ne = e(function(e, a) {
448
470
  minHeight: "inherit"
449
471
  },
450
472
  children: [/* @__PURE__ */ d("div", {
451
- ref: U,
473
+ ref: ue,
452
474
  className: "liforma-experience-error-host",
453
- "aria-hidden": H ? void 0 : !0,
475
+ "aria-hidden": U ? void 0 : !0,
454
476
  style: {
455
477
  position: "absolute",
456
478
  inset: 0,
457
479
  zIndex: 20,
458
- pointerEvents: H ? "auto" : "none"
480
+ pointerEvents: U ? "auto" : "none"
459
481
  }
460
482
  }), /* @__PURE__ */ d("div", {
461
- ref: le,
483
+ ref: W,
462
484
  className: "liforma-experience-host",
463
485
  style: {
464
486
  position: "absolute",
@@ -474,28 +496,98 @@ function re(e) {
474
496
  return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
475
497
  }
476
498
  //#endregion
499
+ //#region src/thumbnail/locationPlate.ts
500
+ var ie = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
501
+ function R(e, t) {
502
+ return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : e > 800 || t > 450 ? "1672x941" : "800x450";
503
+ }
504
+ function z(e, t) {
505
+ let n = e.trim();
506
+ return n && n.replace(ie, (e, n, r, i, a) => `${n}${t}${i}${a}`);
507
+ }
508
+ function ae(e, t) {
509
+ let n = () => {
510
+ t(e.clientWidth, e.clientHeight);
511
+ };
512
+ if (n(), typeof ResizeObserver > "u") return () => {};
513
+ let r = new ResizeObserver(n);
514
+ return r.observe(e), () => r.disconnect();
515
+ }
516
+ var B = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
517
+ function V(e) {
518
+ return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
519
+ }
520
+ function oe(e) {
521
+ return /^https?:\/\//i.test(e) || e.startsWith("//");
522
+ }
523
+ function H(e) {
524
+ return e.startsWith("//") ? `https:${e}` : e;
525
+ }
526
+ function se(e) {
527
+ let t = e.indexOf("?");
528
+ return t === -1 ? {
529
+ pathname: e,
530
+ search: ""
531
+ } : {
532
+ pathname: e.slice(0, t),
533
+ search: e.slice(t)
534
+ };
535
+ }
536
+ function U(e, t, n = "") {
537
+ return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
538
+ }
539
+ function ce(e, t, n) {
540
+ let r = e.trim();
541
+ if (!r) return r;
542
+ let i = V(n);
543
+ if (oe(r)) return z(H(r), t);
544
+ let { pathname: a, search: o } = se(r.replace(/\\/g, "/")), s = a;
545
+ if (!s.startsWith("/")) s = `/locations/${s.replace(/^locations\//i, "")}`;
546
+ else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? U(i, s, o) : r;
547
+ if (/\.webp$/i.test(s) && !B.test(s.replace(/\.webp$/i, ""))) return U(i, s, o);
548
+ let c = s.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
549
+ return c = c.replace(B, ""), `${i}/locations/${c}-${t}.webp${o}`;
550
+ }
551
+ function le(e, t) {
552
+ let n = e.trim();
553
+ if (!n) return n;
554
+ let r = V(t);
555
+ if (oe(n)) return H(n);
556
+ let { pathname: i, search: a } = se(n.replace(/\\/g, "/")), o = i;
557
+ if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
558
+ else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
559
+ else return n;
560
+ if (!/^\/avatars\//i.test(o)) return n;
561
+ let s = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
562
+ return s && !s.includes("/") && !a ? `${r}/avatars/${s}/256/${s}_neutral.webp` : U(r, o, a);
563
+ }
564
+ //#endregion
477
565
  //#region src/thumbnail/toGalleryThumbUrl.ts
478
- var ie = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, R = /_CH(\.webp)/i, z = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
479
- function B(e) {
480
- let t = e.trim();
481
- if (!t) return t;
482
- let n = t.replace(ie, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
483
- return n = n.replace(R, "_neutral$1"), n = n.replace(z, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
484
- }
485
- function ae(e) {
566
+ var ue = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, de = /_CH(\.webp)/i;
567
+ function W(e) {
568
+ return /\/locations\//i.test(e) || /^locations\//i.test(e) ? !0 : /^https?:\/\//i.test(e) || e.startsWith("//") || /^\/?avatars\//i.test(e) || e.startsWith("/") ? !1 : e.includes("/");
569
+ }
570
+ function fe(e, t = "256x256", n) {
571
+ let r = e.trim();
572
+ if (!r) return r;
573
+ if (W(r)) return ce(r, t, n);
574
+ let i = le(r, n);
575
+ return i = i.replace(ue, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(de, "_neutral$1");
576
+ }
577
+ function pe(e) {
486
578
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
487
579
  if (!t) return null;
488
- let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
580
+ let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = V(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : fe(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : ce(e, a, o);
489
581
  return {
490
- avatarImage: B(t),
491
- ...n ? { backgroundImage: B(n) } : {},
492
- ...r ? { foregroundImage: B(r) } : {},
493
- ...i ? { fallbackImage: B(i) } : {}
582
+ avatarImage: c(t),
583
+ ...n ? { backgroundImage: l(n) } : {},
584
+ ...r ? { foregroundImage: l(r) } : {},
585
+ ...i ? { fallbackImage: c(i) } : {}
494
586
  };
495
587
  }
496
588
  //#endregion
497
589
  //#region src/shims/localStack.ts
498
- function V() {
590
+ function me() {
499
591
  if (globalThis.__LIFORMA_STACK === "local") return !0;
500
592
  if (typeof location > "u") return !1;
501
593
  try {
@@ -506,83 +598,83 @@ function V() {
506
598
  }
507
599
  //#endregion
508
600
  //#region src/thumbnail/hostedLaunchUrl.ts
509
- var H = "https://player.liforma.ai", oe = "http://localhost:3002";
510
- function se(e) {
601
+ var he = "https://player.liforma.ai", ge = "http://localhost:3002";
602
+ function _e(e) {
511
603
  return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
512
604
  }
513
- function U(e) {
605
+ function ve(e) {
514
606
  let t = e?.trim();
515
- return t ? t.replace(/\/$/, "") : V() ? oe : H;
607
+ return t ? t.replace(/\/$/, "") : me() ? ge : he;
516
608
  }
517
- function ce(e) {
518
- let t = e.experienceId.trim(), n = U(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
609
+ function ye(e) {
610
+ let t = e.experienceId.trim(), n = ve(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
519
611
  return i && r.searchParams.set("returnUrl", i), r.toString();
520
612
  }
521
- function le(e) {
613
+ function be(e) {
522
614
  let t = e.href?.trim();
523
615
  if (t) return t;
524
616
  let n = e.experienceId?.trim();
525
617
  if (!n) return;
526
618
  let r = e.returnUrl?.trim();
527
- return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ce({
619
+ return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ye({
528
620
  experienceId: n,
529
621
  ...r ? { returnUrl: r } : {},
530
622
  playerBaseUrl: e.playerBaseUrl
531
623
  });
532
624
  }
533
- function W() {
625
+ function xe() {
534
626
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
535
627
  }
536
- var ue = 0, G = [];
537
- function de() {
538
- return W() ? 4 : Infinity;
628
+ var G = 0, Se = [];
629
+ function Ce() {
630
+ return xe() ? 4 : Infinity;
539
631
  }
540
- function fe() {
541
- return W() ? 160 : 0;
632
+ function we() {
633
+ return xe() ? 160 : 0;
542
634
  }
543
- function pe() {
544
- let e = de();
545
- for (; ue < e && G.length > 0;) {
546
- let e = G.shift();
635
+ function Te() {
636
+ let e = Ce();
637
+ for (; G < e && Se.length > 0;) {
638
+ let e = Se.shift();
547
639
  if (!e || e.cancelled) continue;
548
- ue += 1, e.start();
549
- let t = fe();
640
+ G += 1, e.start();
641
+ let t = we();
550
642
  if (t <= 0) {
551
- ue = Math.max(0, ue - 1);
643
+ G = Math.max(0, G - 1);
552
644
  continue;
553
645
  }
554
646
  window.setTimeout(() => {
555
- ue = Math.max(0, ue - 1), pe();
647
+ G = Math.max(0, G - 1), Te();
556
648
  }, t);
557
649
  }
558
650
  }
559
- function me(e) {
560
- if (!W()) return e(), () => {};
651
+ function Ee(e) {
652
+ if (!xe()) return e(), () => {};
561
653
  let t = {
562
654
  start: e,
563
655
  cancelled: !1
564
656
  };
565
- return G.push(t), pe(), () => {
657
+ return Se.push(t), Te(), () => {
566
658
  t.cancelled = !0;
567
659
  };
568
660
  }
569
661
  //#endregion
570
662
  //#region src/thumbnail/lazyLoad.ts
571
- function he() {
572
- return W() ? "96px 0px" : "280px 0px";
663
+ function De() {
664
+ return xe() ? "96px 0px" : "280px 0px";
573
665
  }
574
- function K(e) {
666
+ function Oe(e) {
575
667
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
576
668
  return Number.isFinite(n) ? Math.abs(n) : 280;
577
669
  }
578
- function ge(e, t) {
670
+ function K(e, t) {
579
671
  if (typeof window > "u") return !1;
580
672
  let n = e.getBoundingClientRect();
581
673
  return n.bottom >= -t && n.top <= window.innerHeight + t;
582
674
  }
583
- function _e(e, t) {
584
- let { onVisibleChange: n } = t, r = t.rootMargin ?? he(), i = K(r), a = !1, o = !1, s = null, c = () => {
585
- o || (s?.(), s = me(() => {
675
+ function ke(e, t) {
676
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? De(), i = Oe(r), a = !1, o = !1, s = null, c = () => {
677
+ o || (s?.(), s = Ee(() => {
586
678
  s = null, o = !0, n(!0);
587
679
  }));
588
680
  }, l = (e) => {
@@ -604,55 +696,55 @@ function _e(e, t) {
604
696
  rootMargin: r,
605
697
  threshold: 0
606
698
  });
607
- return u.observe(e), ge(e, i) && l(!0), () => {
699
+ return u.observe(e), K(e, i) && l(!0), () => {
608
700
  s?.(), s = null, u.disconnect();
609
701
  };
610
702
  }
611
703
  //#endregion
612
704
  //#region src/thumbnail/scrollParallax.ts
613
- function ve() {
705
+ function Ae() {
614
706
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
615
707
  }
616
- function ye(e, t) {
708
+ function je(e, t) {
617
709
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
618
710
  }
619
- var be = /* @__PURE__ */ new Set(), xe = !1, q = 0;
620
- function J() {
621
- if (q = 0, be.size === 0 || typeof window > "u") return;
711
+ var q = /* @__PURE__ */ new Set(), Me = !1, J = 0;
712
+ function Ne() {
713
+ if (J = 0, q.size === 0 || typeof window > "u") return;
622
714
  let e = window.innerHeight;
623
- for (let t of be) {
715
+ for (let t of q) {
624
716
  if (t.pointerActive?.()) continue;
625
717
  let n = t.element.getBoundingClientRect();
626
- n.bottom < -64 || n.top > e + 64 || t.onParallax(ye(n, e));
718
+ n.bottom < -64 || n.top > e + 64 || t.onParallax(je(n, e));
627
719
  }
628
720
  }
629
- function Se() {
630
- q === 0 && (q = requestAnimationFrame(J));
721
+ function Pe() {
722
+ J === 0 && (J = requestAnimationFrame(Ne));
631
723
  }
632
- function Ce() {
633
- xe || typeof window > "u" || (xe = !0, window.addEventListener("scroll", Se, { passive: !0 }), window.addEventListener("resize", Se, { passive: !0 }));
724
+ function Fe() {
725
+ Me || typeof window > "u" || (Me = !0, window.addEventListener("scroll", Pe, { passive: !0 }), window.addEventListener("resize", Pe, { passive: !0 }));
634
726
  }
635
- function we() {
636
- be.size > 0 || !xe || typeof window > "u" || (xe = !1, q !== 0 && (cancelAnimationFrame(q), q = 0), window.removeEventListener("scroll", Se), window.removeEventListener("resize", Se));
727
+ function Ie() {
728
+ q.size > 0 || !Me || typeof window > "u" || (Me = !1, J !== 0 && (cancelAnimationFrame(J), J = 0), window.removeEventListener("scroll", Pe), window.removeEventListener("resize", Pe));
637
729
  }
638
- function Te(e, t) {
639
- if (!ve()) return () => {};
730
+ function Le(e, t) {
731
+ if (!Ae()) return () => {};
640
732
  let n = {
641
733
  element: e,
642
734
  onParallax: t.onParallax,
643
735
  pointerActive: t.pointerActive
644
736
  };
645
- return be.add(n), Ce(), n.pointerActive?.() || t.onParallax(ye(e.getBoundingClientRect(), window.innerHeight)), () => {
646
- be.delete(n), we();
737
+ return q.add(n), Fe(), n.pointerActive?.() || t.onParallax(je(e.getBoundingClientRect(), window.innerHeight)), () => {
738
+ q.delete(n), Ie();
647
739
  };
648
740
  }
649
741
  //#endregion
650
742
  //#region src/thumbnail/attachThumbnailParallax.ts
651
- function Ee(e) {
743
+ function Re(e) {
652
744
  let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
653
745
  let a = r || i;
654
746
  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));
655
- }, s = Te(e, {
747
+ }, s = Le(e, {
656
748
  onParallax: (e) => {
657
749
  i = !0, a || (t = e, n = 0, o());
658
750
  },
@@ -665,7 +757,7 @@ function Ee(e) {
665
757
  a = !0, e.pointerType === "mouse" && (r = !0), o();
666
758
  }, u = () => {
667
759
  let s = a;
668
- a = !1, r = !1, i && s ? (t = ye(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
760
+ a = !1, r = !1, i && s ? (t = je(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
669
761
  }, d = (e) => {
670
762
  e.pointerType === "mouse" && (r = !0, o());
671
763
  }, f = () => {
@@ -677,108 +769,119 @@ function Ee(e) {
677
769
  }
678
770
  //#endregion
679
771
  //#region src/thumbnail/styles.ts
680
- var De = ".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/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", Oe = !1;
681
- function ke(e) {
682
- if (typeof document > "u" || Oe) return;
772
+ var ze = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.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/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", Be = !1;
773
+ function Ve(e) {
774
+ if (typeof document > "u" || Be) return;
683
775
  if (document.querySelector("style[data-liforma-et]")) {
684
- Oe = !0;
776
+ Be = !0;
685
777
  return;
686
778
  }
687
779
  let t = document.createElement("style");
688
- t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), Oe = !0;
780
+ t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), Be = !0;
689
781
  }
690
782
  //#endregion
691
783
  //#region src/react/ExperienceThumbnail.tsx
692
- function Ae(e, t) {
784
+ function He(e, t) {
693
785
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
694
786
  }
695
- function je(e) {
696
- let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, 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 } = e, T = a(() => ae({
787
+ function Ue(e) {
788
+ let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, 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, normalizeUrls: T = !0, cdnBaseUrl: E } = e, D = o(null), O = o(!1), [k, A] = s(0), [ee, j] = s(0), M = R(k, ee), N = a(() => pe({
697
789
  galleryThumb: t,
698
790
  avatarImage: r,
699
791
  backgroundImage: i,
700
792
  foregroundImage: c,
701
- fallbackImage: w
793
+ fallbackImage: w,
794
+ normalize: T,
795
+ locationPlateSize: M,
796
+ cdnBaseUrl: E
702
797
  }), [
703
798
  t,
704
799
  r,
705
800
  i,
706
801
  c,
707
- w
708
- ]), E = se({
802
+ w,
803
+ T,
804
+ M,
805
+ E
806
+ ]), P = _e({
709
807
  href: m,
710
808
  hasClickHandler: typeof _ == "function",
711
809
  experienceId: p
712
- }), D = E === "anchor" && !m?.trim() && !!p?.trim(), O = !!T?.backgroundImage, k = b !== !1, A = o(null), j = o(!1), [M, N] = s(!S), [P, F] = s(!1), [I, ee] = s(!1), [te, L] = s(0), [ne, ie] = s(0), [R, z] = s(!1), [B, V] = s(!1), [H, oe] = s(!1), [U, ce] = s(!1), [W, ue] = s(), G = T ? R && T.fallbackImage ? T.fallbackImage : T.avatarImage : "";
810
+ }), F = P === "anchor" && !m?.trim() && !!p?.trim(), te = !!N?.backgroundImage, I = b !== !1, [L, ne] = s(!S), [ie, z] = s(!1), [B, V] = s(!1), [oe, H] = s(0), [se, U] = s(0), [ce, le] = s(!1), [ue, de] = s(!1), [W, fe] = s(!1), [me, he] = s(!1), [ge, ve] = s(), ye = N ? ce && N.fallbackImage ? N.fallbackImage : N.avatarImage : "";
713
811
  n(() => {
714
- ke(De);
812
+ Ve(ze);
715
813
  }, []), n(() => {
716
- ue(le({
814
+ ve(be({
717
815
  href: m,
718
816
  experienceId: p,
719
817
  returnUrl: v,
720
818
  playerBaseUrl: y,
721
- useCurrentPageAsReturnUrl: D && !v?.trim()
819
+ useCurrentPageAsReturnUrl: F && !v?.trim()
722
820
  }));
723
821
  }, [
724
822
  m,
725
823
  p,
726
824
  v,
727
825
  y,
728
- D
826
+ F
729
827
  ]), n(() => {
730
- V(!1), oe(!1), ce(!1), z(!1);
828
+ de(!1), fe(!1), he(!1), le(!1);
731
829
  }, [
732
- T?.backgroundImage,
733
- T?.foregroundImage,
734
- G
830
+ N?.backgroundImage,
831
+ N?.foregroundImage,
832
+ ye
735
833
  ]), n(() => {
736
- let e = A.current;
834
+ let e = D.current;
835
+ if (e) return ae(e, (e, t) => {
836
+ A(e), j(t);
837
+ });
838
+ }, [P, ge]), n(() => {
839
+ let e = D.current;
737
840
  if (e) {
738
841
  if (!S) {
739
- N(!0);
842
+ ne(!0);
740
843
  return;
741
844
  }
742
- return _e(e, { onVisibleChange: (e) => {
743
- e && N(!0);
845
+ return ke(e, { onVisibleChange: (e) => {
846
+ e && ne(!0);
744
847
  } });
745
848
  }
746
849
  }, [
747
850
  S,
748
- T,
749
- E,
750
- W
851
+ N,
852
+ P,
853
+ ge
751
854
  ]), n(() => {
752
- let e = A.current;
753
- if (!(!e || !k)) return Te(e, {
855
+ let e = D.current;
856
+ if (!(!e || !I)) return Le(e, {
754
857
  onParallax: (e) => {
755
- ee(!0), j.current || (L(e), ie(0));
858
+ V(!0), O.current || (H(e), U(0));
756
859
  },
757
- pointerActive: () => j.current
860
+ pointerActive: () => O.current
758
861
  });
759
862
  }, [
760
- k,
761
- T,
762
- E,
763
- W
863
+ I,
864
+ N,
865
+ P,
866
+ ge
764
867
  ]);
765
- let de = (e) => {
766
- if (!k || I) return;
868
+ let xe = (e) => {
869
+ if (!I || B) return;
767
870
  let t = e.currentTarget.getBoundingClientRect();
768
- t.width <= 0 || t.height <= 0 || (L(((e.clientX - t.left) / t.width - .5) * 2), ie(((e.clientY - t.top) / t.height - .5) * 2));
769
- }, fe = (e) => {
770
- let t = j.current;
771
- j.current = !1, F(!1), I && t ? (L(ye(e.getBoundingClientRect(), window.innerHeight)), ie(0)) : I || (L(0), ie(0));
772
- }, pe = (e) => {
773
- if (!k) return;
774
- j.current = !0, e.pointerType === "mouse" && F(!0);
871
+ t.width <= 0 || t.height <= 0 || (H(((e.clientX - t.left) / t.width - .5) * 2), U(((e.clientY - t.top) / t.height - .5) * 2));
872
+ }, G = (e) => {
873
+ let t = O.current;
874
+ O.current = !1, z(!1), B && t ? (H(je(e.getBoundingClientRect(), window.innerHeight)), U(0)) : B || (H(0), U(0));
875
+ }, Se = (e) => {
876
+ if (!I) return;
877
+ O.current = !0, e.pointerType === "mouse" && z(!0);
775
878
  let t = e.currentTarget, n = () => {
776
- fe(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
879
+ G(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
777
880
  };
778
881
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
779
- }, me = (e) => {
780
- if (_?.(e), !e.defaultPrevented && D && !v?.trim()) {
781
- let t = le({
882
+ }, Ce = (e) => {
883
+ if (_?.(e), !e.defaultPrevented && F && !v?.trim()) {
884
+ let t = be({
782
885
  experienceId: p,
783
886
  playerBaseUrl: y,
784
887
  useCurrentPageAsReturnUrl: !0
@@ -786,135 +889,135 @@ function je(e) {
786
889
  t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
787
890
  }
788
891
  };
789
- if (!T) return null;
790
- let he = k && (P || I), K = M && (H || B || U), ge = [
892
+ if (!N) return null;
893
+ let we = I && (ie || B), Te = L && (W || ue || me), Ee = [
791
894
  "liforma-et",
792
- O ? "liforma-et--scene" : "",
895
+ te ? "liforma-et--scene" : "",
793
896
  re(x),
794
- he ? "liforma-et--parallax" : "",
795
- I ? "liforma-et--scroll-parallax" : "",
796
- M && !K ? "liforma-et--loading" : "",
797
- K ? "liforma-et--revealed" : "",
897
+ we ? "liforma-et--parallax" : "",
898
+ B ? "liforma-et--scroll-parallax" : "",
899
+ L && !Te ? "liforma-et--loading" : "",
900
+ Te ? "liforma-et--revealed" : "",
798
901
  C
799
- ].filter(Boolean).join(" "), ve = {
800
- "--liforma-et-parallax-x": te,
801
- "--liforma-et-parallax-y": ne
802
- }, be = (e, t) => {
902
+ ].filter(Boolean).join(" "), De = {
903
+ "--liforma-et-parallax-x": oe,
904
+ "--liforma-et-parallax-y": se
905
+ }, Oe = (e, t) => {
803
906
  e.complete && t(!0);
804
- }, xe = /* @__PURE__ */ f(u, { children: [
907
+ }, K = /* @__PURE__ */ f(u, { children: [
805
908
  /* @__PURE__ */ d("span", {
806
909
  className: "liforma-et__placeholder",
807
910
  "aria-hidden": "true"
808
911
  }),
809
- M && T.backgroundImage ? /* @__PURE__ */ d("img", {
810
- className: Ae("liforma-et__background", B),
811
- src: T.backgroundImage,
912
+ L && N.backgroundImage ? /* @__PURE__ */ d("img", {
913
+ className: He("liforma-et__background", ue),
914
+ src: N.backgroundImage,
812
915
  alt: "",
813
916
  decoding: "async",
814
917
  ref: (e) => {
815
- e && be(e, V);
918
+ e && Oe(e, de);
816
919
  },
817
- onLoad: () => V(!0),
818
- onError: () => V(!0)
920
+ onLoad: () => de(!0),
921
+ onError: () => de(!0)
819
922
  }) : null,
820
- M && G ? /* @__PURE__ */ d("img", {
821
- className: Ae("liforma-et__avatar", H),
822
- src: G,
923
+ L && ye ? /* @__PURE__ */ d("img", {
924
+ className: He("liforma-et__avatar", W),
925
+ src: ye,
823
926
  alt: "",
824
927
  decoding: "async",
825
928
  ref: (e) => {
826
- e && be(e, oe);
929
+ e && Oe(e, fe);
827
930
  },
828
- onLoad: () => oe(!0),
931
+ onLoad: () => fe(!0),
829
932
  onError: () => {
830
- T.fallbackImage ? z(!0) : oe(!0);
933
+ N.fallbackImage ? le(!0) : fe(!0);
831
934
  }
832
935
  }) : null,
833
- M && T.foregroundImage ? /* @__PURE__ */ d("img", {
834
- className: Ae("liforma-et__foreground", U),
835
- src: T.foregroundImage,
936
+ L && N.foregroundImage ? /* @__PURE__ */ d("img", {
937
+ className: He("liforma-et__foreground", me),
938
+ src: N.foregroundImage,
836
939
  alt: "",
837
940
  decoding: "async",
838
941
  ref: (e) => {
839
- e && be(e, ce);
942
+ e && Oe(e, he);
840
943
  },
841
- onLoad: () => ce(!0),
842
- onError: () => ce(!0)
944
+ onLoad: () => he(!0),
945
+ onError: () => he(!0)
843
946
  }) : null
844
- ] }), q = {
845
- onPointerDown: pe,
846
- onPointerUp: (e) => fe(e.currentTarget),
847
- onPointerCancel: (e) => fe(e.currentTarget),
947
+ ] }), Ae = {
948
+ onPointerDown: Se,
949
+ onPointerUp: (e) => G(e.currentTarget),
950
+ onPointerCancel: (e) => G(e.currentTarget),
848
951
  onPointerEnter: (e) => {
849
- k && e.pointerType === "mouse" && F(!0);
952
+ I && e.pointerType === "mouse" && z(!0);
850
953
  },
851
- onPointerMove: de,
954
+ onPointerMove: xe,
852
955
  onPointerLeave: () => {
853
- j.current || (F(!1), I || (L(0), ie(0)));
956
+ O.current || (z(!1), B || (H(0), U(0)));
854
957
  }
855
- }, J = (e) => {
856
- A.current = e;
857
- };
858
- return E === "anchor" && W ? /* @__PURE__ */ d("a", {
859
- ref: J,
860
- className: ge,
861
- style: ve,
862
- href: W,
958
+ }, q = (e) => {
959
+ D.current = e;
960
+ };
961
+ return P === "anchor" && ge ? /* @__PURE__ */ d("a", {
962
+ ref: q,
963
+ className: Ee,
964
+ style: De,
965
+ href: ge,
863
966
  target: h,
864
967
  rel: g,
865
968
  "aria-label": l,
866
- onClick: me,
867
- ...q,
868
- children: xe
869
- }) : E === "button" ? /* @__PURE__ */ d("button", {
969
+ onClick: Ce,
970
+ ...Ae,
971
+ children: K
972
+ }) : P === "button" ? /* @__PURE__ */ d("button", {
870
973
  type: "button",
871
- ref: J,
872
- className: ge,
873
- style: ve,
974
+ ref: q,
975
+ className: Ee,
976
+ style: De,
874
977
  "aria-label": l,
875
- onClick: me,
876
- ...q,
877
- children: xe
978
+ onClick: Ce,
979
+ ...Ae,
980
+ children: K
878
981
  }) : /* @__PURE__ */ d("div", {
879
- ref: J,
880
- className: ge,
881
- style: ve,
982
+ ref: q,
983
+ className: Ee,
984
+ style: De,
882
985
  role: l ? "img" : void 0,
883
986
  "aria-label": l || void 0,
884
987
  "aria-hidden": l ? void 0 : !0,
885
- ...q,
886
- children: xe
988
+ ...Ae,
989
+ children: K
887
990
  });
888
991
  }
889
992
  //#endregion
890
993
  //#region src/widget/styles.ts
891
- var Me = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", Ne = "liforma-experience-widget-styles";
892
- function Pe(e = Me) {
994
+ var We = "\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", Ge = "liforma-experience-widget-styles";
995
+ function Ke(e = We) {
893
996
  if (typeof document > "u") return;
894
- let t = document.getElementById(Ne);
997
+ let t = document.getElementById(Ge);
895
998
  if (t) {
896
999
  t.textContent = e;
897
1000
  return;
898
1001
  }
899
1002
  let n = document.createElement("style");
900
- n.id = Ne, n.textContent = e, document.head.append(n);
1003
+ n.id = Ge, n.textContent = e, document.head.append(n);
901
1004
  }
902
1005
  //#endregion
903
1006
  //#region src/shims/apiBaseUrl.ts
904
- var Fe = "https://api.liforma.ai", Ie = "http://localhost:3001";
905
- function Le() {
1007
+ var qe = "https://api.liforma.ai", Je = "http://localhost:3001";
1008
+ function Ye() {
906
1009
  let e = globalThis.__LIFORMA_API_BASE_URL;
907
1010
  if (e?.trim()) return e.trim().replace(/\/$/, "");
908
1011
  if (typeof document > "u") return null;
909
1012
  let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-api-base-url")?.trim();
910
1013
  return t ? t.replace(/\/$/, "") : null;
911
1014
  }
912
- function Re() {
913
- return Le() || (V() ? Ie : Fe);
1015
+ function Xe() {
1016
+ return Ye() || (me() ? Je : qe);
914
1017
  }
915
1018
  //#endregion
916
1019
  //#region src/v2/api/fetchExperiencePreview.ts
917
- function ze(e) {
1020
+ function Ze(e) {
918
1021
  if (!e || typeof e != "object") return null;
919
1022
  let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
920
1023
  return n ? {
@@ -923,10 +1026,10 @@ function ze(e) {
923
1026
  ...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
924
1027
  } : null;
925
1028
  }
926
- async function Be(e, t) {
1029
+ async function Qe(e, t) {
927
1030
  let n = e.trim();
928
1031
  if (!n) throw Error("Experience preview requires experienceId.");
929
- let r = (t?.apiBaseUrl ?? Re()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
1032
+ let r = (t?.apiBaseUrl ?? Xe()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
930
1033
  method: "GET",
931
1034
  headers: { Accept: "application/json" },
932
1035
  signal: t?.signal
@@ -946,7 +1049,7 @@ async function Be(e, t) {
946
1049
  throw Error("Experience preview returned invalid JSON.");
947
1050
  }
948
1051
  if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
949
- let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = ze(o.galleryThumb);
1052
+ let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Ze(o.galleryThumb);
950
1053
  if (!l) throw Error("Experience preview is missing gallery thumb images.");
951
1054
  return {
952
1055
  experienceId: s || n,
@@ -956,7 +1059,7 @@ async function Be(e, t) {
956
1059
  }
957
1060
  //#endregion
958
1061
  //#region src/v2/errors/LiformaError.ts
959
- var Ve = class extends Error {
1062
+ var $e = class extends Error {
960
1063
  code;
961
1064
  requestId;
962
1065
  status;
@@ -965,16 +1068,16 @@ var Ve = class extends Error {
965
1068
  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;
966
1069
  }
967
1070
  };
968
- function He(e) {
1071
+ function et(e) {
969
1072
  if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
970
1073
  }
971
- function Ue(e, t, n) {
1074
+ function tt(e, t, n) {
972
1075
  let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
973
1076
  try {
974
1077
  i = JSON.parse(t);
975
1078
  } catch {}
976
- let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = He(a) ?? He(i) ?? {};
977
- return new Ve(u, {
1079
+ 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 } = et(a) ?? et(i) ?? {};
1080
+ return new $e(u, {
978
1081
  code: l,
979
1082
  requestId: d,
980
1083
  status: e,
@@ -983,13 +1086,13 @@ function Ue(e, t, n) {
983
1086
  }
984
1087
  //#endregion
985
1088
  //#region src/v2/api/captureAttribution.ts
986
- var We = 128, Ge = /[\u0000-\u001f\u007f]/g;
1089
+ var nt = 128, rt = /[\u0000-\u001f\u007f]/g;
987
1090
  function Y(e) {
988
1091
  if (!e) return;
989
- let t = e.replace(Ge, "").trim();
990
- if (t) return t.slice(0, We);
1092
+ let t = e.replace(rt, "").trim();
1093
+ if (t) return t.slice(0, nt);
991
1094
  }
992
- function Ke(e) {
1095
+ function it(e) {
993
1096
  let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
994
1097
  return {
995
1098
  ...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
@@ -999,7 +1102,7 @@ function Ke(e) {
999
1102
  ...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
1000
1103
  };
1001
1104
  }
1002
- function qe(e) {
1105
+ function at(e) {
1003
1106
  if (e === !1) return;
1004
1107
  if (e && typeof e == "object") {
1005
1108
  let t = {
@@ -1013,7 +1116,7 @@ function qe(e) {
1013
1116
  return Object.keys(t).length ? t : void 0;
1014
1117
  }
1015
1118
  if (typeof window > "u") return;
1016
- let t = Ke(window.location?.search), n = Y(document.referrer || void 0), r = {
1119
+ let t = it(window.location?.search), n = Y(document.referrer || void 0), r = {
1017
1120
  ...t,
1018
1121
  ...n ? { referrer: n } : {}
1019
1122
  };
@@ -1021,19 +1124,19 @@ function qe(e) {
1021
1124
  }
1022
1125
  //#endregion
1023
1126
  //#region src/v2/api/sessionEndpointRequest.ts
1024
- function Je(e) {
1127
+ function ot(e) {
1025
1128
  let t = e.locale?.trim();
1026
1129
  if (t) return t;
1027
1130
  let n = e.language?.trim();
1028
1131
  if (n) return n;
1029
1132
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
1030
1133
  }
1031
- function Ye(e) {
1134
+ function st(e) {
1032
1135
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
1033
1136
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
1034
1137
  return t || n || void 0;
1035
1138
  }
1036
- function Xe(e, t) {
1139
+ function ct(e, t) {
1037
1140
  let n = e.trim();
1038
1141
  if (!n) throw Error("sessionEndpoint must not be empty.");
1039
1142
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -1041,7 +1144,7 @@ function Xe(e, t) {
1041
1144
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
1042
1145
  let i = t.experienceId.trim();
1043
1146
  if (!i) throw Error("sessionEndpoint requires experienceId.");
1044
- let a = Je(t), o = Ye(t), s = t.idempotencyKey?.trim();
1147
+ let a = ot(t), o = st(t), s = t.idempotencyKey?.trim();
1045
1148
  return {
1046
1149
  url: r.toString(),
1047
1150
  init: {
@@ -1060,7 +1163,7 @@ function Xe(e, t) {
1060
1163
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
1061
1164
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
1062
1165
  ...(() => {
1063
- let e = qe(t.attribution);
1166
+ let e = at(t.attribution);
1064
1167
  return e ? { attribution: e } : {};
1065
1168
  })(),
1066
1169
  ...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
@@ -1070,16 +1173,16 @@ function Xe(e, t) {
1070
1173
  }
1071
1174
  //#endregion
1072
1175
  //#region src/v2/types/sessionLaunch.ts
1073
- function Ze(e) {
1176
+ function lt(e) {
1074
1177
  return !!e && typeof e == "object" && !Array.isArray(e);
1075
1178
  }
1076
1179
  function X(e) {
1077
1180
  return typeof e == "boolean";
1078
1181
  }
1079
- function Qe(e) {
1080
- if (!Ze(e)) return null;
1182
+ function ut(e) {
1183
+ if (!lt(e)) return null;
1081
1184
  let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
1082
- return !Ze(t) || !Ze(n) || !Ze(r) || !Ze(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
1185
+ return !lt(t) || !lt(n) || !lt(r) || !lt(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
1083
1186
  speech: {
1084
1187
  input: t.input,
1085
1188
  output: t.output,
@@ -1090,8 +1193,8 @@ function Qe(e) {
1090
1193
  tools: { enabled: i.enabled }
1091
1194
  };
1092
1195
  }
1093
- function $e(e) {
1094
- return !Ze(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
1196
+ function dt(e) {
1197
+ return !lt(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
1095
1198
  speech: {
1096
1199
  input: e.speechInput,
1097
1200
  output: e.speechOutput,
@@ -1102,12 +1205,12 @@ function $e(e) {
1102
1205
  tools: { enabled: e.tools }
1103
1206
  };
1104
1207
  }
1105
- function et(e) {
1106
- return Qe(e) ?? $e(e);
1208
+ function ft(e) {
1209
+ return ut(e) ?? dt(e);
1107
1210
  }
1108
- function tt(e) {
1109
- if (!Ze(e)) throw Error("Session Launch response is missing session.");
1110
- 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 = et(e.capabilities), l = nt(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;
1211
+ function pt(e) {
1212
+ if (!lt(e)) throw Error("Session Launch response is missing session.");
1213
+ 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 = ft(e.capabilities), l = mt(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;
1111
1214
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
1112
1215
  return {
1113
1216
  id: t,
@@ -1123,11 +1226,11 @@ function tt(e) {
1123
1226
  ...d ? { createdAt: d } : {}
1124
1227
  };
1125
1228
  }
1126
- function nt(e) {
1229
+ function mt(e) {
1127
1230
  if (!Array.isArray(e) || e.length === 0) return;
1128
1231
  let t = [];
1129
1232
  for (let n of e) {
1130
- if (!Ze(n)) continue;
1233
+ if (!lt(n)) continue;
1131
1234
  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() : "";
1132
1235
  !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
1133
1236
  axis: e,
@@ -1138,104 +1241,104 @@ function nt(e) {
1138
1241
  }
1139
1242
  return t.length > 0 ? t : void 0;
1140
1243
  }
1141
- function rt(e) {
1244
+ function ht(e) {
1142
1245
  let t = e.localeVoiceFallbacks;
1143
1246
  if (t?.length) for (let e of t) {
1144
1247
  let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
1145
1248
  console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
1146
1249
  }
1147
1250
  }
1148
- function it(e) {
1149
- if (!Ze(e)) throw Error("Session Launch response must be a JSON object.");
1251
+ function gt(e) {
1252
+ if (!lt(e)) throw Error("Session Launch response must be a JSON object.");
1150
1253
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
1151
1254
  if (!t) throw Error("Session Launch response is missing launch.");
1152
- let n = tt(e.session);
1153
- return rt(n), {
1255
+ let n = pt(e.session);
1256
+ return ht(n), {
1154
1257
  session: n,
1155
1258
  launch: t
1156
1259
  };
1157
1260
  }
1158
1261
  //#endregion
1159
1262
  //#region src/v2/api/mintPublicSession.ts
1160
- function at() {
1263
+ function _t() {
1161
1264
  try {
1162
1265
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
1163
1266
  } catch {}
1164
1267
  }
1165
- function ot(e) {
1268
+ function vt(e) {
1166
1269
  return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
1167
1270
  }
1168
- function st(e, t) {
1169
- let n = at(), r = ot(t.code), i = t.message.trim(), a = t.details ?? {};
1271
+ function yt(e, t) {
1272
+ let n = _t(), r = vt(t.code), i = t.message.trim(), a = t.details ?? {};
1170
1273
  if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
1171
1274
  if (i.includes(e) && i.includes("allowed origin")) return t;
1172
1275
  let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
1173
- return new Ve(`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.`, {
1276
+ return new $e(`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.`, {
1174
1277
  code: "ORIGIN_NOT_ALLOWED",
1175
1278
  requestId: t.requestId,
1176
1279
  status: t.status,
1177
1280
  details: a
1178
1281
  });
1179
1282
  }
1180
- return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new Ve(`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”.`, {
1283
+ return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new $e(`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”.`, {
1181
1284
  code: "BROWSER_EMBEDS_DISABLED",
1182
1285
  requestId: t.requestId,
1183
1286
  status: t.status,
1184
1287
  details: a
1185
- }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new Ve(`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.`, {
1288
+ }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new $e(`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.`, {
1186
1289
  code: "EXPERIENCE_UNAVAILABLE",
1187
1290
  requestId: t.requestId,
1188
1291
  status: t.status,
1189
1292
  details: a
1190
1293
  }) : t;
1191
1294
  }
1192
- function ct(e) {
1295
+ function bt(e) {
1193
1296
  let t = e?.locale?.trim();
1194
1297
  if (t) return t;
1195
1298
  let n = e?.language?.trim();
1196
1299
  if (n) return n;
1197
1300
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
1198
1301
  }
1199
- function lt(e) {
1302
+ function xt(e) {
1200
1303
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
1201
- if (t && n && t !== n) throw new Ve("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
1304
+ if (t && n && t !== n) throw new $e("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
1202
1305
  return t || n || void 0;
1203
1306
  }
1204
- function ut(e, t) {
1205
- let n = { experienceId: e }, r = ct(t);
1307
+ function St(e, t) {
1308
+ let n = { experienceId: e }, r = bt(t);
1206
1309
  r && (n.locale = r);
1207
- let i = lt(t);
1310
+ let i = xt(t);
1208
1311
  i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
1209
- let a = qe(t?.attribution);
1312
+ let a = at(t?.attribution);
1210
1313
  return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
1211
1314
  }
1212
- async function dt(e, t) {
1213
- let n = Re(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
1315
+ async function Ct(e, t) {
1316
+ let n = Xe(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
1214
1317
  method: "POST",
1215
1318
  headers: {
1216
1319
  "Content-Type": "application/json",
1217
1320
  ...r ? { "Idempotency-Key": r } : {}
1218
1321
  },
1219
- body: JSON.stringify(ut(e, t))
1322
+ body: JSON.stringify(St(e, t))
1220
1323
  });
1221
1324
  if (!i.ok) {
1222
1325
  let t = await i.text();
1223
- throw st(e, Ue(i.status, t, i.headers));
1326
+ throw yt(e, tt(i.status, t, i.headers));
1224
1327
  }
1225
1328
  let a;
1226
1329
  try {
1227
1330
  a = await i.json();
1228
1331
  } catch {
1229
- throw new Ve("Browser session mint returned invalid JSON.", {
1332
+ throw new $e("Browser session mint returned invalid JSON.", {
1230
1333
  code: "INVALID_RESPONSE",
1231
1334
  status: i.status,
1232
1335
  requestId: i.headers.get("Liforma-Request-Id") ?? void 0
1233
1336
  });
1234
1337
  }
1235
- return it(a);
1338
+ return gt(a);
1236
1339
  }
1237
- async function ft(e, t) {
1238
- let n = Xe(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1340
+ async function wt(e, t) {
1341
+ let n = ct(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1239
1342
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
1240
1343
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
1241
1344
  try {
@@ -1248,9 +1351,9 @@ async function ft(e, t) {
1248
1351
  }
1249
1352
  if (!o.ok) {
1250
1353
  let e = await o.text();
1251
- throw Ue(o.status, e, o.headers);
1354
+ throw tt(o.status, e, o.headers);
1252
1355
  }
1253
- if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new Ve("Session endpoint must return a JSON Session Launch response.", {
1356
+ if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new $e("Session endpoint must return a JSON Session Launch response.", {
1254
1357
  code: "INVALID_RESPONSE",
1255
1358
  status: o.status,
1256
1359
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
@@ -1259,20 +1362,20 @@ async function ft(e, t) {
1259
1362
  try {
1260
1363
  s = await o.json();
1261
1364
  } catch {
1262
- throw new Ve("Session endpoint returned invalid JSON.", {
1365
+ throw new $e("Session endpoint returned invalid JSON.", {
1263
1366
  code: "INVALID_RESPONSE",
1264
1367
  status: o.status,
1265
1368
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
1266
1369
  });
1267
1370
  }
1268
- return it(s);
1371
+ return gt(s);
1269
1372
  }
1270
1373
  //#endregion
1271
1374
  //#region src/v2/conversationProcessor.ts
1272
- function pt(e) {
1375
+ function Tt(e) {
1273
1376
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
1274
1377
  }
1275
- function mt(e) {
1378
+ function Et(e) {
1276
1379
  if (typeof e == "string") {
1277
1380
  let t = e.trim();
1278
1381
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -1286,24 +1389,24 @@ function mt(e) {
1286
1389
  ...e.behavior ? { behavior: e.behavior } : {}
1287
1390
  };
1288
1391
  }
1289
- async function ht(e, t) {
1392
+ async function Dt(e, t) {
1290
1393
  let n = await e(t);
1291
- return pt(n) ? {
1394
+ return Tt(n) ? {
1292
1395
  kind: "stream",
1293
1396
  stream: n
1294
1397
  } : {
1295
1398
  kind: "complete",
1296
- speech: mt(n)
1399
+ speech: Et(n)
1297
1400
  };
1298
1401
  }
1299
1402
  //#endregion
1300
1403
  //#region src/v2/embed/playerReachability.ts
1301
- var gt = "3002";
1302
- function _t(e) {
1404
+ var Ot = "3002";
1405
+ function kt(e) {
1303
1406
  let t = new URL(e);
1304
- 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 || gt}. 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.`;
1407
+ 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 || Ot}. 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.`;
1305
1408
  }
1306
- async function vt(e, t) {
1409
+ async function At(e, t) {
1307
1410
  try {
1308
1411
  await fetch(e, {
1309
1412
  method: "GET",
@@ -1311,25 +1414,25 @@ async function vt(e, t) {
1311
1414
  signal: AbortSignal.timeout(8e3)
1312
1415
  });
1313
1416
  } catch {
1314
- throw Error(_t(t));
1417
+ throw Error(kt(t));
1315
1418
  }
1316
1419
  }
1317
- function yt(e, t, n, r) {
1420
+ function jt(e, t, n, r) {
1318
1421
  try {
1319
1422
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
1320
1423
  } catch (e) {
1321
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(_t(n), { cause: e }) : e;
1424
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(kt(n), { cause: e }) : e;
1322
1425
  }
1323
1426
  }
1324
- var bt = new Set([1, 2]);
1325
- function xt(e) {
1326
- return typeof e == "number" && bt.has(e);
1427
+ var Mt = new Set([1, 2]);
1428
+ function Nt(e) {
1429
+ return typeof e == "number" && Mt.has(e);
1327
1430
  }
1328
- var St = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.interactionChange".split("."));
1329
- function Ct(e) {
1431
+ var Pt = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.interactionChange".split("."));
1432
+ function Ft(e) {
1330
1433
  if (!e || typeof e != "object") return null;
1331
1434
  let t = e;
1332
- if (!xt(t.schemaVersion) || !t.type || !St.has(t.type)) return null;
1435
+ if (!Nt(t.schemaVersion) || !t.type || !Pt.has(t.type)) return null;
1333
1436
  if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
1334
1437
  if (t.type === "fullWindow") {
1335
1438
  let e = t.payload;
@@ -1352,7 +1455,7 @@ function Ct(e) {
1352
1455
  let n = t.payload;
1353
1456
  return !n || typeof n != "object" ? null : t;
1354
1457
  }
1355
- function wt(e, t, n) {
1458
+ function It(e, t, n) {
1356
1459
  let r = e.trim();
1357
1460
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
1358
1461
  let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction;
@@ -1369,20 +1472,20 @@ function wt(e, t, n) {
1369
1472
  }
1370
1473
  };
1371
1474
  }
1372
- function Tt() {
1475
+ function Lt() {
1373
1476
  return {
1374
1477
  type: "parentHello",
1375
1478
  schemaVersion: 2
1376
1479
  };
1377
1480
  }
1378
- function Et(e) {
1481
+ function Rt(e) {
1379
1482
  return {
1380
1483
  type: "widgetSetChrome",
1381
1484
  schemaVersion: 2,
1382
1485
  payload: { mode: e }
1383
1486
  };
1384
1487
  }
1385
- function Dt() {
1488
+ function zt() {
1386
1489
  return {
1387
1490
  type: "widgetToggleAudioSettings",
1388
1491
  schemaVersion: 2,
@@ -1391,8 +1494,8 @@ function Dt() {
1391
1494
  }
1392
1495
  //#endregion
1393
1496
  //#region src/v2/embed/fullWindowHost.ts
1394
- var Ot = "2147483000";
1395
- function kt(e) {
1497
+ var Bt = "2147483000";
1498
+ function Vt(e) {
1396
1499
  let { style: t } = e;
1397
1500
  return {
1398
1501
  position: t.position,
@@ -1410,11 +1513,11 @@ function kt(e) {
1410
1513
  maxHeight: t.maxHeight
1411
1514
  };
1412
1515
  }
1413
- function At(e) {
1516
+ function Ht(e) {
1414
1517
  let { style: t } = e;
1415
- t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = Ot, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1518
+ t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = Bt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1416
1519
  }
1417
- function jt(e, t) {
1520
+ function Ut(e, t) {
1418
1521
  if (delete e.dataset.liformaFullWindow, !t) {
1419
1522
  e.style.position = "", e.style.top = "", e.style.right = "", e.style.bottom = "", e.style.left = "", e.style.inset = "", e.style.width = "", e.style.height = "", e.style.zIndex = "", e.style.margin = "", e.style.borderRadius = "", e.style.maxWidth = "", e.style.maxHeight = "";
1420
1523
  return;
@@ -1424,20 +1527,20 @@ function jt(e, t) {
1424
1527
  }
1425
1528
  //#endregion
1426
1529
  //#region src/v2/embed/iframeHost.ts
1427
- function Mt(e) {
1530
+ function Wt(e) {
1428
1531
  return e;
1429
1532
  }
1430
1533
  function Z() {
1431
1534
  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)}`;
1432
1535
  }
1433
- var Nt = 3e4;
1434
- function Pt(e) {
1536
+ var Gt = 3e4;
1537
+ function Kt(e) {
1435
1538
  let t = e.container;
1436
1539
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
1437
1540
  let n = document.createElement("iframe");
1438
1541
  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");
1439
1542
  let r = !1, i = !1, a = null, o = t.closest(".liforma-experience-shell") instanceof HTMLElement ? t.closest(".liforma-experience-shell") : t, s = (t) => {
1440
- i !== t && (i = t, t ? (a = kt(o), At(o)) : (jt(o, a), a = null), e.onFullWindowChange?.(t));
1543
+ i !== t && (i = t, t ? (a = Vt(o), Ht(o)) : (Ut(o, a), a = null), e.onFullWindowChange?.(t));
1441
1544
  }, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
1442
1545
  p = e, m = t;
1443
1546
  }), g = () => {
@@ -1448,10 +1551,10 @@ function Pt(e) {
1448
1551
  let i = Date.now();
1449
1552
  if (d > 0 && i - d < 250) return;
1450
1553
  d = i, g();
1451
- let a = wt(t.launch, t.session, t.chrome), o = () => {
1554
+ let a = It(t.launch, t.session, t.chrome), o = () => {
1452
1555
  if (r) return;
1453
1556
  let t = n.contentWindow;
1454
- t && yt(t, a, e.playerOrigin);
1557
+ t && jt(t, a, e.playerOrigin);
1455
1558
  };
1456
1559
  o();
1457
1560
  for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
@@ -1459,17 +1562,17 @@ function Pt(e) {
1459
1562
  r || !l || _(l);
1460
1563
  }, y = () => {
1461
1564
  if (u += 1, u === 1) {
1462
- vt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1565
+ At(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1463
1566
  return;
1464
1567
  }
1465
1568
  d = 0, v();
1466
1569
  }, b = () => {
1467
- u > 0 || m?.(Error(_t(e.playerOrigin)));
1570
+ u > 0 || m?.(Error(kt(e.playerOrigin)));
1468
1571
  };
1469
1572
  n.addEventListener("load", y), n.addEventListener("error", b);
1470
1573
  let x = (t) => {
1471
1574
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
1472
- let i = Ct(t.data);
1575
+ let i = Ft(t.data);
1473
1576
  if (i) switch (i.type) {
1474
1577
  case "close":
1475
1578
  e.onClose?.(i.payload);
@@ -1508,7 +1611,7 @@ function Pt(e) {
1508
1611
  e.onUserSpeechEnded?.(i.payload);
1509
1612
  break;
1510
1613
  case "modeChange":
1511
- e.onActivityChange?.(Mt(i.payload.mode));
1614
+ e.onActivityChange?.(Wt(i.payload.mode));
1512
1615
  break;
1513
1616
  case "activityChange":
1514
1617
  e.onActivityChange?.(i.payload.activity);
@@ -1564,8 +1667,8 @@ function Pt(e) {
1564
1667
  let S = (t, i) => {
1565
1668
  if (r) return;
1566
1669
  let a = n.contentWindow;
1567
- if (!a) throw Error(_t(e.playerOrigin));
1568
- yt(a, t, e.playerOrigin, i);
1670
+ if (!a) throw Error(kt(e.playerOrigin));
1671
+ jt(a, t, e.playerOrigin, i);
1569
1672
  }, C = (e, t = 12e4, n) => {
1570
1673
  let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
1571
1674
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
@@ -1582,7 +1685,7 @@ function Pt(e) {
1582
1685
  return h;
1583
1686
  },
1584
1687
  postParentHello() {
1585
- S(Tt());
1688
+ S(Lt());
1586
1689
  },
1587
1690
  postLaunch(e, t, n) {
1588
1691
  r || (l = {
@@ -1604,10 +1707,10 @@ function Pt(e) {
1604
1707
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1605
1708
  },
1606
1709
  postWidgetSetChrome(e) {
1607
- S(Et(e));
1710
+ S(Rt(e));
1608
1711
  },
1609
1712
  postWidgetToggleAudioSettings() {
1610
- S(Dt());
1713
+ S(zt());
1611
1714
  },
1612
1715
  speak(e) {
1613
1716
  return C({
@@ -1729,7 +1832,7 @@ function Pt(e) {
1729
1832
  audio: e.audio,
1730
1833
  byteLength: e.byteLength
1731
1834
  }
1732
- }, Nt, [e.audio]);
1835
+ }, Gt, [e.audio]);
1733
1836
  },
1734
1837
  speechUtteranceSetTranscript(e) {
1735
1838
  return C({
@@ -1801,6 +1904,36 @@ function Pt(e) {
1801
1904
  }
1802
1905
  });
1803
1906
  },
1907
+ setStage(e) {
1908
+ return C({
1909
+ type: "setStage",
1910
+ schemaVersion: 2,
1911
+ payload: {
1912
+ correlationId: Z(),
1913
+ stage: e
1914
+ }
1915
+ });
1916
+ },
1917
+ setPipBackground(e) {
1918
+ return C({
1919
+ type: "setPipBackground",
1920
+ schemaVersion: 2,
1921
+ payload: {
1922
+ correlationId: Z(),
1923
+ pipBackground: e
1924
+ }
1925
+ });
1926
+ },
1927
+ setPipShadow(e) {
1928
+ return C({
1929
+ type: "setPipShadow",
1930
+ schemaVersion: 2,
1931
+ payload: {
1932
+ correlationId: Z(),
1933
+ pipShadow: e
1934
+ }
1935
+ });
1936
+ },
1804
1937
  setInteraction(e) {
1805
1938
  return C({
1806
1939
  type: "setInteraction",
@@ -1861,7 +1994,7 @@ function Pt(e) {
1861
1994
  }
1862
1995
  //#endregion
1863
1996
  //#region src/v2/embed/readyGate.ts
1864
- function Ft(e) {
1997
+ function qt(e) {
1865
1998
  let t, n = !1, r = !1, i = () => {
1866
1999
  r || !n || t === void 0 || (r = !0, e(t));
1867
2000
  };
@@ -1876,9 +2009,9 @@ function Ft(e) {
1876
2009
  }
1877
2010
  //#endregion
1878
2011
  //#region src/v2/sdkRelease.ts
1879
- var It = `sdk@${{
2012
+ var Jt = `sdk@${{
1880
2013
  name: "@liforma/client",
1881
- version: "0.4.10",
2014
+ version: "0.4.11",
1882
2015
  type: "module",
1883
2016
  description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
1884
2017
  license: "MIT",
@@ -2097,50 +2230,50 @@ var It = `sdk@${{
2097
2230
  vitest: "^4.1.10",
2098
2231
  wrangler: "^4.101.0"
2099
2232
  }
2100
- }.version}`, Lt = "https://player.liforma.ai/embed", Rt = "http://localhost:3002/embed";
2101
- function zt() {
2233
+ }.version}`, Yt = "https://player.liforma.ai/embed", Xt = "http://localhost:3002/embed";
2234
+ function Zt() {
2102
2235
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
2103
2236
  if (e?.trim()) return e.trim().replace(/\/$/, "");
2104
2237
  if (typeof document > "u") return null;
2105
2238
  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();
2106
2239
  return t ? t.replace(/\/$/, "") : null;
2107
2240
  }
2108
- function Bt() {
2109
- let e = zt();
2110
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : V() ? Rt : Lt;
2241
+ function Qt() {
2242
+ let e = Zt();
2243
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : me() ? Xt : Yt;
2111
2244
  }
2112
- function Vt(e, t) {
2245
+ function $t(e, t) {
2113
2246
  return e?.trim() || t?.trim() || void 0;
2114
2247
  }
2115
- function Ht(e, t, n, r, i, a, o, s) {
2116
- let c = (e ?? Bt()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
2117
- d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
2118
- let f = r?.trim();
2119
- return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), Ut(u.toString());
2248
+ function en(e, t, n, r, i, a, o, s, c, l, u) {
2249
+ let d = (e ?? Qt()).replace(/\/$/, ""), f = d.endsWith("/embed") ? d : `${d}/embed`, p = new URL(f), m = n?.trim();
2250
+ m && p.searchParams.set("backdropId", m);
2251
+ let h = r?.trim();
2252
+ return h && p.searchParams.set("avatarId", h), (i === "face" || i === "medium") && p.searchParams.set("fit", i), c === "pip" && p.searchParams.set("stage", "pip"), l === "set" && p.searchParams.set("pipBackground", "set"), u === !1 && p.searchParams.set("pipShadow", "0"), a === "widget" && p.searchParams.set("ui", "widget"), o && p.searchParams.set("close", "1"), t && p.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && p.searchParams.set("cast", String(s)), tn(p.toString());
2120
2253
  }
2121
- function Ut(e) {
2254
+ function tn(e) {
2122
2255
  if (typeof location > "u") return e;
2123
2256
  let t = new URL(e);
2124
2257
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
2125
2258
  }
2126
- function Wt(e) {
2259
+ function nn(e) {
2127
2260
  return new URL(e).origin;
2128
2261
  }
2129
2262
  //#endregion
2130
2263
  //#region src/v2/experienceEvents.ts
2131
- function Gt() {
2264
+ function rn() {
2132
2265
  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)}`;
2133
2266
  }
2134
- function Kt(e, t, n) {
2267
+ function an(e, t, n) {
2135
2268
  return {
2136
- id: Gt(),
2269
+ id: rn(),
2137
2270
  type: e,
2138
2271
  sessionId: t,
2139
2272
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2140
2273
  data: n
2141
2274
  };
2142
2275
  }
2143
- function qt() {
2276
+ function on() {
2144
2277
  return {
2145
2278
  ready: /* @__PURE__ */ new Set(),
2146
2279
  started: /* @__PURE__ */ new Set(),
@@ -2161,39 +2294,39 @@ function qt() {
2161
2294
  conversationProcessorError: /* @__PURE__ */ new Set()
2162
2295
  };
2163
2296
  }
2164
- function Jt(e, t, n) {
2297
+ function sn(e, t, n) {
2165
2298
  return e[t].add(n), () => e[t].delete(n);
2166
2299
  }
2167
- function Yt(e, t, n) {
2300
+ function cn(e, t, n) {
2168
2301
  for (let r of e[t]) r(n);
2169
2302
  }
2170
- function Xt(e) {
2303
+ function ln(e) {
2171
2304
  for (let t of Object.keys(e)) e[t].clear();
2172
2305
  }
2173
2306
  //#endregion
2174
2307
  //#region src/v2/speech/types.ts
2175
- function Zt(e) {
2308
+ function un(e) {
2176
2309
  return "data" in e && "format" in e && e.format != null && !("track" in e);
2177
2310
  }
2178
- function Qt(e) {
2311
+ function dn(e) {
2179
2312
  return "url" in e && typeof e.url == "string";
2180
2313
  }
2181
- function $t(e) {
2314
+ function fn(e) {
2182
2315
  if (!("track" in e)) return !1;
2183
2316
  let t = e.track;
2184
2317
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
2185
2318
  }
2186
- function en(e) {
2187
- return !Zt(e) && !Qt(e) && !$t(e) && "encoding" in e && typeof e.encoding == "string";
2319
+ function pn(e) {
2320
+ return !un(e) && !dn(e) && !fn(e) && "encoding" in e && typeof e.encoding == "string";
2188
2321
  }
2189
- var tn = [
2322
+ var mn = [
2190
2323
  8e3,
2191
2324
  16e3,
2192
2325
  22050,
2193
2326
  24e3,
2194
2327
  44100,
2195
2328
  48e3
2196
- ], nn = {
2329
+ ], hn = {
2197
2330
  MAX_CHUNK_BYTES: 64 * 1024,
2198
2331
  RECOMMENDED_CHUNK_MS_MIN: 20,
2199
2332
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -2204,14 +2337,14 @@ var tn = [
2204
2337
  MAX_UTTERANCE_DURATION_MS: 9e4,
2205
2338
  MAX_PENDING_WRITES: 8,
2206
2339
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
2207
- }, rn = class extends Error {
2340
+ }, gn = class extends Error {
2208
2341
  operation;
2209
2342
  requiredCapability;
2210
2343
  name = "UnsupportedSpeechOperationError";
2211
2344
  constructor(e, t) {
2212
2345
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
2213
2346
  }
2214
- }, an = class extends Error {
2347
+ }, _n = class extends Error {
2215
2348
  name = "SpeechUtteranceClosedError";
2216
2349
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
2217
2350
  super(e);
@@ -2221,72 +2354,72 @@ var tn = [
2221
2354
  constructor(e, t) {
2222
2355
  super(e, t);
2223
2356
  }
2224
- }, on = class extends Error {
2357
+ }, vn = class extends Error {
2225
2358
  name = "SpeechBufferTimeoutError";
2226
2359
  constructor(e = "Timed out waiting for speech buffer capacity.") {
2227
2360
  super(e);
2228
2361
  }
2229
2362
  };
2230
- function sn(e = "none") {
2363
+ function yn(e = "none") {
2231
2364
  return {
2232
2365
  mode: e,
2233
2366
  trackedDurationMs: 0,
2234
2367
  fallbackDurationMs: 0
2235
2368
  };
2236
2369
  }
2237
- function cn(e) {
2238
- return tn.includes(e);
2370
+ function bn(e) {
2371
+ return mn.includes(e);
2239
2372
  }
2240
- function ln(e) {
2373
+ function xn(e) {
2241
2374
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
2242
2375
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
2243
- if (!cn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2376
+ if (!bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2244
2377
  }
2245
- function un(e) {
2246
- if (Zt(e)) {
2247
- ln(e.format);
2378
+ function Sn(e) {
2379
+ if (un(e)) {
2380
+ xn(e.format);
2248
2381
  return;
2249
2382
  }
2250
- if (Qt(e)) {
2383
+ if (dn(e)) {
2251
2384
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
2252
- if (e.sampleRate !== void 0 && !cn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2385
+ if (e.sampleRate !== void 0 && !bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2253
2386
  return;
2254
2387
  }
2255
- if ($t(e)) {
2388
+ if (fn(e)) {
2256
2389
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
2257
- if (e.sampleRate !== void 0 && !cn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2390
+ if (e.sampleRate !== void 0 && !bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2258
2391
  return;
2259
2392
  }
2260
- if (en(e)) {
2393
+ if (pn(e)) {
2261
2394
  let t = e.encoding.trim().toLowerCase();
2262
2395
  if (!t) throw new Q("Encoded audio MIME type is required.");
2263
2396
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
2264
- if (e.sampleRate !== void 0 && !cn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2397
+ if (e.sampleRate !== void 0 && !bn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2265
2398
  return;
2266
2399
  }
2267
2400
  throw new Q("Unsupported speech.play audio shape.");
2268
2401
  }
2269
- function dn(e) {
2270
- if (e.format) return ln(e.format), e.format;
2402
+ function Cn(e) {
2403
+ if (e.format) return xn(e.format), e.format;
2271
2404
  if (e.track) {
2272
2405
  let t = {
2273
2406
  encoding: "pcm_s16le",
2274
2407
  sampleRate: e.sampleRate ?? 24e3,
2275
2408
  channels: 1
2276
2409
  };
2277
- return ln(t), t;
2410
+ return xn(t), t;
2278
2411
  }
2279
2412
  throw new Q("createUtterance requires format or track.");
2280
2413
  }
2281
- function fn(e) {
2414
+ function wn(e) {
2282
2415
  return e instanceof Uint8Array ? e : new Uint8Array(e);
2283
2416
  }
2284
- function pn(e) {
2417
+ function Tn(e) {
2285
2418
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
2286
2419
  }
2287
2420
  //#endregion
2288
2421
  //#region src/byo/pcm.ts
2289
- function mn(e) {
2422
+ function En(e) {
2290
2423
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
2291
2424
  for (let t = 0; t < e.length; t++) {
2292
2425
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -2296,11 +2429,11 @@ function mn(e) {
2296
2429
  }
2297
2430
  //#endregion
2298
2431
  //#region src/byo/resample.ts
2299
- function hn(e, t, n, r, i) {
2432
+ function Dn(e, t, n, r, i) {
2300
2433
  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;
2301
2434
  return ((a * i + o) * i + s) * i + c;
2302
2435
  }
2303
- function gn(e, t) {
2436
+ function On(e, t) {
2304
2437
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
2305
2438
  if (e === t) return {
2306
2439
  fromRate: e,
@@ -2323,7 +2456,7 @@ function gn(e, t) {
2323
2456
  let a = [];
2324
2457
  for (; i + 2 < r.length - 1;) {
2325
2458
  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);
2326
- a.push(hn(r[o], r[e], r[s], r[c], t)), i += n;
2459
+ a.push(Dn(r[o], r[e], r[s], r[c], t)), i += n;
2327
2460
  }
2328
2461
  let o = Math.max(0, Math.floor(i) - 1);
2329
2462
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -2335,7 +2468,7 @@ function gn(e, t) {
2335
2468
  }
2336
2469
  //#endregion
2337
2470
  //#region src/byo/audioCapture.ts
2338
- var _n = "liforma-pcm-capture", vn = `
2471
+ var kn = "liforma-pcm-capture", An = `
2339
2472
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2340
2473
  process(inputs) {
2341
2474
  const ch = inputs[0] && inputs[0][0];
@@ -2347,29 +2480,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2347
2480
  return true;
2348
2481
  }
2349
2482
  }
2350
- registerProcessor('${_n}', LiformaPcmCaptureProcessor);
2351
- `, yn = null;
2352
- function bn() {
2353
- return yn ||= URL.createObjectURL(new Blob([vn], { type: "application/javascript" })), yn;
2483
+ registerProcessor('${kn}', LiformaPcmCaptureProcessor);
2484
+ `, jn = null;
2485
+ function Mn() {
2486
+ return jn ||= URL.createObjectURL(new Blob([An], { type: "application/javascript" })), jn;
2354
2487
  }
2355
- function xn() {
2488
+ function Nn() {
2356
2489
  return window.AudioContext || window.webkitAudioContext || null;
2357
2490
  }
2358
- async function Sn(e) {
2359
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = xn();
2491
+ async function Pn(e) {
2492
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Nn();
2360
2493
  if (!o) throw Error("Web Audio is required for audio capture");
2361
2494
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
2362
2495
  l.gain.value = 0;
2363
- let u = s.sampleRate, d = gn(u, n), f = !1, p = !1, m = (e) => {
2496
+ let u = s.sampleRate, d = On(u, n), f = !1, p = !1, m = (e) => {
2364
2497
  if (f || i && !i()) return;
2365
2498
  let t = d.push(e);
2366
- t.length !== 0 && r(mn(t));
2499
+ t.length !== 0 && r(En(t));
2367
2500
  }, h = () => void 0;
2368
2501
  return await (async () => {
2369
2502
  if (typeof s.audioWorklet?.addModule != "function") return !1;
2370
2503
  try {
2371
- await s.audioWorklet.addModule(bn());
2372
- let e = new AudioWorkletNode(s, _n, {
2504
+ await s.audioWorklet.addModule(Mn());
2505
+ let e = new AudioWorkletNode(s, kn, {
2373
2506
  numberOfInputs: 1,
2374
2507
  numberOfOutputs: 1,
2375
2508
  outputChannelCount: [1]
@@ -2419,7 +2552,7 @@ async function Sn(e) {
2419
2552
  }
2420
2553
  //#endregion
2421
2554
  //#region src/v2/speech/captureMediaStreamTrack.ts
2422
- async function Cn(e) {
2555
+ async function Fn(e) {
2423
2556
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
2424
2557
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
2425
2558
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -2428,18 +2561,18 @@ async function Cn(e) {
2428
2561
  s || (s = !0, c?.stop(), c = null);
2429
2562
  };
2430
2563
  try {
2431
- c = await Sn({
2564
+ c = await Pn({
2432
2565
  mediaStream: a,
2433
2566
  targetSampleRate: r,
2434
2567
  shouldSend: () => !s && !i?.aborted,
2435
2568
  onPcm: (e) => {
2436
2569
  if (s || i?.aborted) return;
2437
- let t = fn(e);
2570
+ let t = wn(e);
2438
2571
  o = o.then(async () => {
2439
2572
  if (s || i?.aborted) return;
2440
2573
  let e = 0;
2441
2574
  for (; e < t.byteLength;) {
2442
- let r = Math.min(e + nn.MAX_CHUNK_BYTES, t.byteLength);
2575
+ let r = Math.min(e + hn.MAX_CHUNK_BYTES, t.byteLength);
2443
2576
  if ((r - e) % 2 == 1 && --r, r <= e) break;
2444
2577
  let i = t.subarray(e, r);
2445
2578
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -2463,10 +2596,10 @@ async function Cn(e) {
2463
2596
  }
2464
2597
  //#endregion
2465
2598
  //#region src/v2/speech/speechController.ts
2466
- async function wn(e, t) {
2467
- if ($t(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2468
- if (Zt(e)) {
2469
- let t = fn(e.data);
2599
+ async function In(e, t) {
2600
+ if (fn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2601
+ if (un(e)) {
2602
+ let t = wn(e.data);
2470
2603
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
2471
2604
  return {
2472
2605
  kind: "pcm",
@@ -2474,17 +2607,17 @@ async function wn(e, t) {
2474
2607
  format: e.format
2475
2608
  };
2476
2609
  }
2477
- if (Qt(e)) return {
2610
+ if (dn(e)) return {
2478
2611
  kind: "url",
2479
2612
  url: e.url.trim(),
2480
2613
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2481
2614
  };
2482
- if (!en(e)) throw new Q("Unsupported speech.play audio shape.");
2615
+ if (!pn(e)) throw new Q("Unsupported speech.play audio shape.");
2483
2616
  let n;
2484
2617
  if (typeof Blob < "u" && e.data instanceof Blob) {
2485
2618
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
2486
2619
  n = new Uint8Array(await e.data.arrayBuffer());
2487
- } else n = fn(e.data);
2620
+ } else n = wn(e.data);
2488
2621
  return {
2489
2622
  kind: "encoded",
2490
2623
  data: n.slice().buffer,
@@ -2492,10 +2625,10 @@ async function wn(e, t) {
2492
2625
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2493
2626
  };
2494
2627
  }
2495
- function Tn() {
2628
+ function Ln() {
2496
2629
  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)}`;
2497
2630
  }
2498
- function En(e, t = "completed") {
2631
+ function Rn(e, t = "completed") {
2499
2632
  return {
2500
2633
  utteranceId: e.speechId,
2501
2634
  characterId: e.characterId,
@@ -2509,13 +2642,13 @@ function En(e, t = "completed") {
2509
2642
  }
2510
2643
  };
2511
2644
  }
2512
- function Dn(e) {
2645
+ function zn(e) {
2513
2646
  return e instanceof Error ? e : new Q(String(e));
2514
2647
  }
2515
- function On(e) {
2648
+ function Bn(e) {
2516
2649
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
2517
2650
  }
2518
- var kn = class {
2651
+ var Vn = class {
2519
2652
  id;
2520
2653
  characterId;
2521
2654
  result;
@@ -2544,29 +2677,29 @@ var kn = class {
2544
2677
  queue: e.queue,
2545
2678
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
2546
2679
  }).catch((e) => {
2547
- throw this.fail(Dn(e)), Dn(e);
2680
+ throw this.fail(zn(e)), zn(e);
2548
2681
  }), this.signal?.addEventListener("abort", () => {
2549
2682
  this.cancel();
2550
2683
  }, { once: !0 });
2551
2684
  }
2552
2685
  async write(e, t) {
2553
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new an();
2554
- let n = fn(e);
2686
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new _n();
2687
+ let n = wn(e);
2555
2688
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
2556
- if (n.byteLength > nn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${nn.MAX_CHUNK_BYTES}).`);
2689
+ if (n.byteLength > hn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${hn.MAX_CHUNK_BYTES}).`);
2557
2690
  if (n.byteLength === 0) return;
2558
- let r = t?.timeoutMs ?? nn.DEFAULT_WRITE_TIMEOUT_MS;
2691
+ let r = t?.timeoutMs ?? hn.DEFAULT_WRITE_TIMEOUT_MS;
2559
2692
  await this.acquireWriteSlot(r);
2560
2693
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
2561
- if (this.bufferedMs + i > nn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2694
+ if (this.bufferedMs + i > hn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2562
2695
  let a = async () => {
2563
- if (this.closed || this.settled) throw new an();
2696
+ if (this.closed || this.settled) throw new _n();
2564
2697
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
2565
2698
  utteranceId: this.id,
2566
2699
  audio: t.buffer,
2567
2700
  byteLength: t.byteLength
2568
2701
  }), a = await Promise.race([i, new Promise((e, t) => {
2569
- setTimeout(() => t(new on()), r);
2702
+ setTimeout(() => t(new vn()), r);
2570
2703
  })]);
2571
2704
  this.bufferedMs = Math.max(0, a.bufferedMs);
2572
2705
  }, o = this.writeChain.then(a, a);
@@ -2578,7 +2711,7 @@ var kn = class {
2578
2711
  }
2579
2712
  }
2580
2713
  async setTranscript(e) {
2581
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new an();
2714
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new _n();
2582
2715
  await this.requireHost().speechUtteranceSetTranscript({
2583
2716
  utteranceId: this.id,
2584
2717
  transcript: e
@@ -2595,7 +2728,7 @@ var kn = class {
2595
2728
  });
2596
2729
  return this.resolve(t), t;
2597
2730
  } catch (e) {
2598
- let t = Dn(e);
2731
+ let t = zn(e);
2599
2732
  throw this.fail(t), t;
2600
2733
  }
2601
2734
  }
@@ -2613,11 +2746,11 @@ var kn = class {
2613
2746
  characterId: this.characterId,
2614
2747
  status: "cancelled",
2615
2748
  durationMs: 0,
2616
- animation: sn("none")
2749
+ animation: yn("none")
2617
2750
  };
2618
2751
  return this.resolve(t), t;
2619
2752
  } catch (e) {
2620
- let t = Dn(e);
2753
+ let t = zn(e);
2621
2754
  throw this.fail(t), t;
2622
2755
  }
2623
2756
  }
@@ -2630,19 +2763,19 @@ var kn = class {
2630
2763
  return e;
2631
2764
  }
2632
2765
  resolve(e) {
2633
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new an()));
2766
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new _n()));
2634
2767
  }
2635
2768
  fail(e) {
2636
2769
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
2637
2770
  }
2638
2771
  async acquireWriteSlot(e) {
2639
- if (this.pendingWriteCount < nn.MAX_PENDING_WRITES) {
2772
+ if (this.pendingWriteCount < hn.MAX_PENDING_WRITES) {
2640
2773
  this.pendingWriteCount += 1;
2641
2774
  return;
2642
2775
  }
2643
2776
  await new Promise((t, n) => {
2644
2777
  let r = setTimeout(() => {
2645
- n(new on());
2778
+ n(new vn());
2646
2779
  }, e);
2647
2780
  this.pendingWriteWaiters.push({
2648
2781
  resolve: () => {
@@ -2661,13 +2794,13 @@ var kn = class {
2661
2794
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2662
2795
  }
2663
2796
  };
2664
- function An(e) {
2797
+ function Hn(e) {
2665
2798
  let t = null, n = (t, n) => {
2666
- if (!e.getCapabilities()[n]) throw new rn(t, n);
2799
+ if (!e.getCapabilities()[n]) throw new gn(t, n);
2667
2800
  }, r = {
2668
2801
  async speak(r) {
2669
2802
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2670
- let i = pn(r.queue ?? "append");
2803
+ let i = Tn(r.queue ?? "append");
2671
2804
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2672
2805
  let a = e.getIframeHost();
2673
2806
  if (!a) throw new Q("Speech session is not attached.");
@@ -2687,41 +2820,41 @@ function An(e) {
2687
2820
  return;
2688
2821
  }
2689
2822
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2690
- t.removeEventListener("abort", s), n(En(e, "completed"));
2823
+ t.removeEventListener("abort", s), n(Rn(e, "completed"));
2691
2824
  }, (a) => {
2692
- if (t.removeEventListener("abort", s), On(a)) {
2825
+ if (t.removeEventListener("abort", s), Bn(a)) {
2693
2826
  n({
2694
2827
  utteranceId: "utt_interrupted",
2695
2828
  characterId: r.characterId ?? e.getActiveCharacterId(),
2696
2829
  status: "interrupted",
2697
2830
  durationMs: 0,
2698
2831
  transcript: r.text,
2699
- animation: sn("none")
2832
+ animation: yn("none")
2700
2833
  });
2701
2834
  return;
2702
2835
  }
2703
- i(Dn(a));
2836
+ i(zn(a));
2704
2837
  });
2705
2838
  });
2706
2839
  }
2707
2840
  try {
2708
- return En(await o, "completed");
2841
+ return Rn(await o, "completed");
2709
2842
  } catch (t) {
2710
- if (On(t)) return {
2843
+ if (Bn(t)) return {
2711
2844
  utteranceId: "utt_interrupted",
2712
2845
  characterId: r.characterId ?? e.getActiveCharacterId(),
2713
2846
  status: "interrupted",
2714
2847
  durationMs: 0,
2715
2848
  transcript: r.text,
2716
- animation: sn("none")
2849
+ animation: yn("none")
2717
2850
  };
2718
- throw Dn(t);
2851
+ throw zn(t);
2719
2852
  }
2720
2853
  },
2721
2854
  async play(i) {
2722
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), un(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2855
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Sn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2723
2856
  let a = i.queue ?? "append";
2724
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), $t(i.audio)) {
2857
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), fn(i.audio)) {
2725
2858
  let e = i.audio.sampleRate ?? 24e3;
2726
2859
  return r.createUtterance({
2727
2860
  format: {
@@ -2737,7 +2870,7 @@ function An(e) {
2737
2870
  }
2738
2871
  let o = e.getIframeHost();
2739
2872
  if (!o) throw new Q("Speech session is not attached.");
2740
- let s = await wn(i.audio, i.signal);
2873
+ let s = await In(i.audio, i.signal);
2741
2874
  return o.speechPlay({
2742
2875
  source: s,
2743
2876
  characterId: i.characterId,
@@ -2749,13 +2882,13 @@ function An(e) {
2749
2882
  },
2750
2883
  createUtterance(r) {
2751
2884
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2752
- let i = dn(r);
2885
+ let i = Cn(r);
2753
2886
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2754
2887
  let a = r.queue ?? "replace-active";
2755
2888
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2756
2889
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2757
- let o = new kn({
2758
- id: Tn(),
2890
+ let o = new Vn({
2891
+ id: Ln(),
2759
2892
  characterId: r.characterId ?? e.getActiveCharacterId(),
2760
2893
  format: i,
2761
2894
  queue: a,
@@ -2767,7 +2900,7 @@ function An(e) {
2767
2900
  t === o && (t = null);
2768
2901
  }), r.track && (async () => {
2769
2902
  try {
2770
- if (await Cn({
2903
+ if (await Fn({
2771
2904
  track: r.track,
2772
2905
  utterance: o,
2773
2906
  sampleRate: i.sampleRate,
@@ -2795,16 +2928,16 @@ function An(e) {
2795
2928
  }
2796
2929
  //#endregion
2797
2930
  //#region src/v2/types/sessionInteraction.ts
2798
- function jn(e) {
2931
+ function Un(e) {
2799
2932
  let t = e?.trim();
2800
2933
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2801
2934
  }
2802
2935
  //#endregion
2803
2936
  //#region src/v2/experience.ts
2804
- function Mn(e) {
2937
+ function Wn(e) {
2805
2938
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2806
2939
  }
2807
- var Nn = class e {
2940
+ var Gn = class e {
2808
2941
  bootstrap;
2809
2942
  conversationProcessor;
2810
2943
  iframeHost = null;
@@ -2818,19 +2951,22 @@ var Nn = class e {
2818
2951
  closed = !1;
2819
2952
  attached = !1;
2820
2953
  pendingFit = null;
2954
+ pendingStage = null;
2955
+ pendingPipBackground = null;
2956
+ pendingPipShadow = null;
2821
2957
  lastInteraction = null;
2822
2958
  closeHandlers = [];
2823
- eventRegistry = qt();
2959
+ eventRegistry = on();
2824
2960
  readyEnvelope = null;
2825
2961
  startedEnvelope = null;
2826
2962
  sessionMintedEnvelope = null;
2827
2963
  conversationCache = [];
2828
2964
  speech;
2829
2965
  constructor(e) {
2830
- 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 = An({
2966
+ 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 = Hn({
2831
2967
  getIframeHost: () => this.iframeHost,
2832
2968
  assertSessionStarted: () => this.assertSessionStarted(),
2833
- getCapabilities: () => Pn(this.resolvedSession),
2969
+ getCapabilities: () => Kn(this.resolvedSession),
2834
2970
  getActiveCharacterId: () => "character_unknown",
2835
2971
  onProcessorInterrupt: () => {
2836
2972
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2913,7 +3049,7 @@ var Nn = class e {
2913
3049
  return null;
2914
3050
  }
2915
3051
  on(e, t) {
2916
- let n = Jt(this.eventRegistry, e, t);
3052
+ let n = sn(this.eventRegistry, e, t);
2917
3053
  return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
2918
3054
  }
2919
3055
  async attach(e) {
@@ -2927,13 +3063,13 @@ var Nn = class e {
2927
3063
  if (this.closed) throw Error("Session has ended.");
2928
3064
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2929
3065
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2930
- let t = this.bootstrap.embedBaseUrl ?? Bt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Ht(t, n, r ? void 0 : Vt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Mn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = Wt(i), o = null, s = new Promise((e) => {
3066
+ let t = this.bootstrap.embedBaseUrl ?? Qt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = en(t, n, r ? void 0 : $t(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Wn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow), a = nn(i), o = null, s = new Promise((e) => {
2931
3067
  o = e;
2932
3068
  }), c = null, l = new Promise((e) => {
2933
3069
  c = e;
2934
- }), u = Ft((e) => {
3070
+ }), u = qt((e) => {
2935
3071
  this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2936
- }), d = this.bootstrap.onUserTranscript, f = Pt({
3072
+ }), d = this.bootstrap.onUserTranscript, f = Kt({
2937
3073
  container: e.container,
2938
3074
  src: i,
2939
3075
  playerOrigin: a,
@@ -2999,7 +3135,7 @@ var Nn = class e {
2999
3135
  onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
3000
3136
  });
3001
3137
  this.iframeHost = f;
3002
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ft(this.bootstrap.sessionEndpoint, {
3138
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), wt(this.bootstrap.sessionEndpoint, {
3003
3139
  experienceId: this.bootstrap.experienceId,
3004
3140
  locale: this.bootstrap.locale,
3005
3141
  secondaryLocale: this.bootstrap.secondaryLocale,
@@ -3011,7 +3147,7 @@ var Nn = class e {
3011
3147
  attribution: this.bootstrap.attribution,
3012
3148
  alreadyConverted: this.bootstrap.alreadyConverted,
3013
3149
  signal: this.endpointAbortController.signal
3014
- })) : this.bootstrap.kind === "public" ? dt(this.bootstrap.experienceId, {
3150
+ })) : this.bootstrap.kind === "public" ? Ct(this.bootstrap.experienceId, {
3015
3151
  locale: this.bootstrap.locale,
3016
3152
  secondaryLocale: this.bootstrap.secondaryLocale,
3017
3153
  learningLocale: this.bootstrap.learningLocale,
@@ -3035,7 +3171,7 @@ var Nn = class e {
3035
3171
  operation: "attach",
3036
3172
  message: e instanceof Error ? e.message : String(e),
3037
3173
  stack: e instanceof Error ? e.stack : void 0,
3038
- release: It
3174
+ release: Jt
3039
3175
  });
3040
3176
  } catch {}
3041
3177
  throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
@@ -3047,7 +3183,7 @@ var Nn = class e {
3047
3183
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
3048
3184
  this.launchToken = g;
3049
3185
  let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
3050
- return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && rt(_), f.postLaunch(g, _, {
3186
+ return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && ht(_), f.postLaunch(g, _, {
3051
3187
  startButton: e.startButton,
3052
3188
  theme: e.theme,
3053
3189
  showFeedback: e.showFeedback,
@@ -3067,7 +3203,7 @@ var Nn = class e {
3067
3203
  operation: "attach",
3068
3204
  message: e instanceof Error ? e.message : String(e),
3069
3205
  stack: e instanceof Error ? e.stack : void 0,
3070
- release: It
3206
+ release: Jt
3071
3207
  });
3072
3208
  } catch {}
3073
3209
  throw e;
@@ -3081,11 +3217,11 @@ var Nn = class e {
3081
3217
  operation: "attach",
3082
3218
  message: e instanceof Error ? e.message : String(e),
3083
3219
  stack: e instanceof Error ? e.stack : void 0,
3084
- release: It
3220
+ release: Jt
3085
3221
  });
3086
3222
  } catch {}
3087
3223
  throw e;
3088
- }), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
3224
+ }), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.pendingStage && await f.setStage(this.pendingStage), this.pendingPipBackground && await f.setPipBackground(this.pendingPipBackground), this.pendingPipShadow !== null && await f.setPipShadow(this.pendingPipShadow), this.createPlayerFacade();
3089
3225
  }
3090
3226
  async startListening() {
3091
3227
  this.assertSessionStarted(), await this.iframeHost.startListening();
@@ -3109,11 +3245,25 @@ var Nn = class e {
3109
3245
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
3110
3246
  }
3111
3247
  async setFit(e) {
3112
- let t = jn(e);
3248
+ let t = Un(e);
3113
3249
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
3114
3250
  if (this.closed) throw Error("Session has ended.");
3115
3251
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
3116
3252
  }
3253
+ async setStage(e) {
3254
+ if (e !== "fill" && e !== "pip") throw Error("setStage requires \"fill\" or \"pip\".");
3255
+ if (this.closed) throw Error("Session has ended.");
3256
+ this.pendingStage = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setStage(e);
3257
+ }
3258
+ async setPipBackground(e) {
3259
+ if (e !== "none" && e !== "set") throw Error("setPipBackground requires \"none\" or \"set\".");
3260
+ if (this.closed) throw Error("Session has ended.");
3261
+ this.pendingPipBackground = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipBackground(e);
3262
+ }
3263
+ async setPipShadow(e) {
3264
+ if (this.closed) throw Error("Session has ended.");
3265
+ this.pendingPipShadow = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipShadow(e);
3266
+ }
3117
3267
  async setInteraction(e) {
3118
3268
  if (this.closed) throw Error("Session has ended.");
3119
3269
  if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
@@ -3145,7 +3295,7 @@ var Nn = class e {
3145
3295
  this.close();
3146
3296
  }
3147
3297
  destroy() {
3148
- 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, Xt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
3298
+ 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, ln(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
3149
3299
  }
3150
3300
  resolveMintInteraction() {
3151
3301
  return this.bootstrap.kind === "launch" ? {} : {
@@ -3157,8 +3307,8 @@ var Nn = class e {
3157
3307
  return this.resolvedSession?.id ?? "";
3158
3308
  }
3159
3309
  emitWrapped(e, t) {
3160
- let n = Kt(e, this.getSessionId(), t);
3161
- return Yt(this.eventRegistry, e, n), n;
3310
+ let n = an(e, this.getSessionId(), t);
3311
+ return cn(this.eventRegistry, e, n), n;
3162
3312
  }
3163
3313
  queueProcessorTurn(e) {
3164
3314
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -3167,7 +3317,7 @@ var Nn = class e {
3167
3317
  let n = this.processorAbortController.signal;
3168
3318
  this.processorChain = this.processorChain.then(async () => {
3169
3319
  if (!n.aborted) try {
3170
- let r = await ht(t, {
3320
+ let r = await Dt(t, {
3171
3321
  utteranceId: e.utteranceId,
3172
3322
  text: e.text,
3173
3323
  conversation: this.conversationCache,
@@ -3217,7 +3367,7 @@ var Nn = class e {
3217
3367
  };
3218
3368
  }
3219
3369
  };
3220
- function Pn(e) {
3370
+ function Kn(e) {
3221
3371
  return e ? {
3222
3372
  textSpeech: e.capabilities.speech.output,
3223
3373
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -3228,41 +3378,41 @@ function Pn(e) {
3228
3378
  }
3229
3379
  //#endregion
3230
3380
  //#region src/widget/dockGeometry.ts
3231
- var Fn = "(min-width: 768px)", In = 24, Ln = .5, Rn = 1200, zn = .85, Bn = 9 / 16;
3232
- function Vn() {
3381
+ var qn = "(min-width: 768px)", Jn = 24, Yn = .5, Xn = 1200, Zn = .85, Qn = 9 / 16;
3382
+ function $n() {
3233
3383
  if (typeof window > "u") return 800;
3234
3384
  let e = window.screen?.availHeight;
3235
3385
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
3236
3386
  }
3237
- function Hn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = In, r = typeof window < "u" ? Vn() : 800) {
3238
- let i = Math.max(160, Math.min(t - n * 2, t * zn)), a = Math.max(120, e - n * 2), o = Math.min(r * Ln, Rn, i), s = o * Bn;
3239
- return s > a && (s = a, o = s / Bn, o > i && (o = i, s = o * Bn)), {
3387
+ function er(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Jn, r = typeof window < "u" ? $n() : 800) {
3388
+ let i = Math.max(160, Math.min(t - n * 2, t * Zn)), a = Math.max(120, e - n * 2), o = Math.min(r * Yn, Xn, i), s = o * Qn;
3389
+ return s > a && (s = a, o = s / Qn, o > i && (o = i, s = o * Qn)), {
3240
3390
  width: Math.round(s),
3241
3391
  height: Math.round(o)
3242
3392
  };
3243
3393
  }
3244
- function Un(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = In) {
3394
+ function tr(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Jn) {
3245
3395
  return {
3246
3396
  left: Math.max(r, t - e.width - r),
3247
3397
  top: Math.max(r, n - e.height - r)
3248
3398
  };
3249
3399
  }
3250
- function Wn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = In) {
3400
+ function nr(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Jn) {
3251
3401
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
3252
3402
  return {
3253
3403
  left: Math.min(Math.max(a, e), o),
3254
3404
  top: Math.min(Math.max(a, t), s)
3255
3405
  };
3256
3406
  }
3257
- function Gn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3258
- return e(Fn).matches;
3407
+ function rr(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3408
+ return e(qn).matches;
3259
3409
  }
3260
3410
  //#endregion
3261
3411
  //#region src/widget/mountExperienceWidget.ts
3262
- function Kn(e) {
3412
+ function ir(e) {
3263
3413
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
3264
3414
  }
3265
- function qn(e) {
3415
+ function ar(e) {
3266
3416
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
3267
3417
  let t = typeof e == "string" ? e.trim() : "";
3268
3418
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -3270,10 +3420,10 @@ function qn(e) {
3270
3420
  function $(e) {
3271
3421
  return e === "expanded" || e === "docked";
3272
3422
  }
3273
- var Jn = "<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>", Yn = "<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>", Xn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Zn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
3274
- function Qn(e, t, n) {
3275
- ke(De);
3276
- let r = ae({
3423
+ var or = "<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>", sr = "<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>", cr = "<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>", lr = "<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>";
3424
+ function ur(e, t, n) {
3425
+ Ve(ze);
3426
+ let r = pe({
3277
3427
  galleryThumb: t.galleryThumb,
3278
3428
  avatarImage: t.avatarImage,
3279
3429
  backgroundImage: t.backgroundImage,
@@ -3299,9 +3449,9 @@ function Qn(e, t, n) {
3299
3449
  let e = document.createElement("img");
3300
3450
  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);
3301
3451
  }
3302
- return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Ee(i);
3452
+ return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Re(i);
3303
3453
  }
3304
- function $n(e) {
3454
+ function dr(e) {
3305
3455
  return e.startButton ? {
3306
3456
  ...e.startButton,
3307
3457
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -3313,7 +3463,7 @@ function $n(e) {
3313
3463
  variant: "primary"
3314
3464
  };
3315
3465
  }
3316
- function er(e) {
3466
+ function fr(e) {
3317
3467
  let t = !1, n = () => {
3318
3468
  t || e();
3319
3469
  }, r = () => {
@@ -3333,12 +3483,12 @@ function er(e) {
3333
3483
  t = !0, window.removeEventListener("load", r), i?.();
3334
3484
  };
3335
3485
  }
3336
- function tr(e, t) {
3337
- Pe(Me);
3486
+ function pr(e, t) {
3487
+ Ke(We);
3338
3488
  let n = t.experienceId?.trim();
3339
3489
  if (!n) throw Error("ExperienceWidget requires experienceId.");
3340
- let r = t.prefetch ?? "onExpand", i = Kn(t.position), a = document.createElement("div");
3341
- 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", qn(t.offset));
3490
+ let r = t.prefetch ?? "onExpand", i = ir(t.position), a = document.createElement("div");
3491
+ 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", ar(t.offset));
3342
3492
  let o = document.createElement("button");
3343
3493
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
3344
3494
  let s = document.createElement("div");
@@ -3358,23 +3508,23 @@ function tr(e, t) {
3358
3508
  let m = document.createElement("span");
3359
3509
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
3360
3510
  let h = document.createElement("button");
3361
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Xn, h.setAttribute("aria-label", "Reduce");
3511
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = cr, h.setAttribute("aria-label", "Reduce");
3362
3512
  let g = document.createElement("button");
3363
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Jn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
3513
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = or, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
3364
3514
  let _ = document.createElement("button");
3365
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Yn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3515
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = sr, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3366
3516
  let v = document.createElement("div");
3367
3517
  v.className = "liforma-ew__stage";
3368
3518
  let y = document.createElement("div");
3369
3519
  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);
3370
- let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, N = null, P = null, F = null, I = null, ee = 0, te = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
3520
+ let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, ee = 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 = () => {
3371
3521
  let e = a.dataset.state;
3372
3522
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
3373
3523
  }, z = () => {
3374
- M !== null && (clearTimeout(M), M = null);
3375
- }, B = () => {
3376
- N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
3524
+ j !== null && (clearTimeout(j), j = null);
3377
3525
  }, ae = () => {
3526
+ M !== null && (clearTimeout(M), M = null), a.classList.remove("liforma-ew--layout-settling");
3527
+ }, B = () => {
3378
3528
  for (let e of [
3379
3529
  f,
3380
3530
  l,
@@ -3388,201 +3538,203 @@ function tr(e, t) {
3388
3538
  i(f), i(l);
3389
3539
  let a = p.offsetWidth || 120;
3390
3540
  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";
3391
- }, H = (e, t) => {
3392
- if (R() !== "docked") return;
3393
- let n = Hn(), r = Wn(e - ee, t - te, n);
3394
- P = r.left, F = r.top, V(r.left, r.top, n.width, n.height);
3395
3541
  }, oe = (e, t) => {
3542
+ if (R() !== "docked") return;
3543
+ let n = er(), r = nr(e - te, t - I, n);
3544
+ N = r.left, P = r.top, V(r.left, r.top, n.width, n.height);
3545
+ }, H = (e, t) => {
3396
3546
  if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
3397
- let n = Hn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = Wn(r + e, i + t, n);
3398
- P = a.left, F = a.top, V(a.left, a.top, n.width, n.height);
3547
+ let n = er(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = nr(r + e, i + t, n);
3548
+ N = a.left, P = a.top, V(a.left, a.top, n.width, n.height);
3399
3549
  }, se = (e) => {
3400
- L === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), H(e.clientX, e.clientY)));
3550
+ L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
3401
3551
  }, U = (e) => {
3402
- if (I === null || e && e.pointerId !== I) return;
3552
+ if (F === null || e && e.pointerId !== F) return;
3403
3553
  let t = L;
3404
- I = 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", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
3554
+ 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", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
3405
3555
  }, ce = (e, t, n) => {
3406
- if (S || R() !== "docked" || !Gn() || I !== null) return;
3407
- I = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3556
+ if (S || R() !== "docked" || !rr() || F !== null) return;
3557
+ F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3408
3558
  let r = f.getBoundingClientRect();
3409
- ee = e - r.left, te = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
3559
+ te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
3410
3560
  }, le = (e) => {
3411
- if (S || R() !== "docked" || !Gn() || I !== null) return;
3412
- I = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3561
+ if (S || R() !== "docked" || !rr() || F !== null) return;
3562
+ F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3413
3563
  let t = f.getBoundingClientRect();
3414
- P = t.left, F = t.top;
3415
- }, W = (e) => {
3416
- L === "player" && (I === null || e.pointerId !== I || oe(e.dx, e.dy));
3564
+ N = t.left, P = t.top;
3417
3565
  }, ue = (e) => {
3418
- L === "player" && (I === null || e.pointerId !== I || U());
3419
- }, G = () => {
3420
- let e = Gn(), t = R();
3566
+ L === "player" && (F === null || e.pointerId !== F || H(e.dx, e.dy));
3567
+ }, de = (e) => {
3568
+ L === "player" && (F === null || e.pointerId !== F || U());
3569
+ }, W = () => {
3570
+ let e = rr(), t = R();
3421
3571
  if (!e || t !== "expanded" && t !== "docked") {
3422
3572
  h.hidden = !0;
3423
3573
  return;
3424
3574
  }
3425
- h.hidden = !1, t === "docked" ? (h.innerHTML = Zn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Xn, h.setAttribute("aria-label", "Reduce"));
3426
- }, de = (e) => {
3427
- let t = Hn(), n = e && P !== null && F !== null ? Wn(P, F, t) : Un(t);
3428
- n = Wn(n.left, n.top, t), P = n.left, F = n.top, V(n.left, n.top, t.width, t.height), G();
3429
- }, fe = () => {
3575
+ h.hidden = !1, t === "docked" ? (h.innerHTML = lr, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = cr, h.setAttribute("aria-label", "Reduce"));
3576
+ }, fe = (e) => {
3577
+ let t = er(), n = e && N !== null && P !== null ? nr(N, P, t) : tr(t);
3578
+ n = nr(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
3579
+ }, pe = () => {
3430
3580
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
3431
3581
  requestAnimationFrame(() => {
3432
3582
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
3433
3583
  });
3434
3584
  });
3435
- }, pe = (e) => {
3436
- if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3585
+ }, me = (e) => {
3586
+ if (ae(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3437
3587
  a.classList.remove("liforma-ew--layout-settling");
3438
3588
  return;
3439
3589
  }
3440
- N = setTimeout(() => {
3441
- if (N = null, S || !$(a.dataset.state)) {
3590
+ M = setTimeout(() => {
3591
+ if (M = null, S || !$(a.dataset.state)) {
3442
3592
  a.classList.remove("liforma-ew--layout-settling");
3443
3593
  return;
3444
3594
  }
3445
- a.classList.remove("liforma-ew--layout-settling"), fe();
3595
+ a.classList.remove("liforma-ew--layout-settling"), pe();
3446
3596
  }, 220);
3447
- }, me = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
3448
- z(), M = setTimeout(() => {
3449
- M = null, a.classList.remove("liforma-ew--session-concealing"), e();
3597
+ }, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
3598
+ z(), j = setTimeout(() => {
3599
+ j = null, a.classList.remove("liforma-ew--session-concealing"), e();
3450
3600
  }, 280);
3451
- })), he = {
3601
+ })), ge = {
3452
3602
  galleryThumb: t.galleryThumb,
3453
3603
  avatarImage: t.avatarImage,
3454
3604
  backgroundImage: t.backgroundImage,
3455
3605
  foregroundImage: t.foregroundImage,
3456
3606
  fallbackImage: t.fallbackImage
3457
- }, K = (e) => {
3607
+ }, _e = (e) => {
3458
3608
  if (!e) {
3459
3609
  y.hidden = !0, y.textContent = "";
3460
3610
  return;
3461
3611
  }
3462
3612
  y.hidden = !1, y.textContent = e;
3463
- }, ge = (e) => {
3613
+ }, ve = (e) => {
3464
3614
  if (!e) {
3465
3615
  c.hidden = !0, c.textContent = "";
3466
3616
  return;
3467
3617
  }
3468
3618
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
3469
- }, _e = () => {
3470
- C = !0, o.disabled = !1, ge(null), r === "onExpand" && t.onPrefetchReady?.();
3471
- }, ve = () => {
3619
+ }, ye = () => {
3620
+ C = !0, o.disabled = !1, ve(null), r === "onExpand" && t.onPrefetchReady?.();
3621
+ }, be = () => {
3472
3622
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
3473
- }, ye = (e) => {
3623
+ }, xe = (e) => {
3474
3624
  A?.(), A = null;
3475
- let t = Qn(s, e, { parallax: ie });
3625
+ let t = ur(s, e, { parallax: ie });
3476
3626
  return t ? (A = t, !0) : !1;
3477
- }, be = () => {
3478
- if (ye(he)) {
3479
- _e();
3627
+ }, G = () => {
3628
+ if (xe(ge)) {
3629
+ ye();
3480
3630
  return;
3481
3631
  }
3482
- ge("Loading…"), Be(n, { signal: re.signal }).then((e) => {
3632
+ ve("Loading…"), Qe(n, { signal: re.signal }).then((e) => {
3483
3633
  if (!S) {
3484
- if (!ye({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3485
- _e();
3634
+ if (!xe({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3635
+ ye();
3486
3636
  }
3487
3637
  }).catch((e) => {
3488
3638
  if (S || re.signal.aborted) return;
3489
3639
  let n = e instanceof Error ? e : Error(String(e));
3490
- ge("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3640
+ ve("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3491
3641
  });
3492
- }, xe = () => ({
3642
+ }, Se = () => ({
3493
3643
  experienceId: n,
3494
3644
  ui: "widget",
3495
3645
  ...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
3496
3646
  ...t.locale ? { locale: t.locale } : {},
3647
+ ...t.secondaryLocale ? { secondaryLocale: t.secondaryLocale } : {},
3648
+ ...t.learningLocale ? { learningLocale: t.learningLocale } : {},
3497
3649
  ...t.language ? { language: t.language } : {},
3498
3650
  ...t.mode ? { mode: t.mode } : {},
3499
3651
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
3500
3652
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
3501
3653
  ...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
3502
3654
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
3503
- }), q = () => ({
3655
+ }), Ce = () => ({
3504
3656
  ...t.fit ? { fit: t.fit } : {},
3505
- startButton: $n(t),
3657
+ startButton: dr(t),
3506
3658
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
3507
3659
  ...t.interaction ? { interaction: t.interaction } : {}
3508
- }), J = (e = !0) => {
3509
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), G(), e && t.onExpanded?.();
3510
- }, Se = () => {
3511
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", K(null), typeof document < "u" && (document.body.style.overflow = k), de(!0), G(), b?.setWidgetChrome("docked");
3512
- }, Ce = (e) => {
3660
+ }), we = (e = !0) => {
3661
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), B(), a.dataset.state = "expanded", _e(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
3662
+ }, Te = () => {
3663
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", _e(null), typeof document < "u" && (document.body.style.overflow = k), fe(!0), W(), b?.setWidgetChrome("docked");
3664
+ }, Ee = (e) => {
3513
3665
  e.on("started", () => {
3514
- S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && fe());
3666
+ S || (D = !0, a.dataset.live = "true", _e(null), t.onStarted?.(), $(a.dataset.state) && pe());
3515
3667
  }), e.on("feedback", (e) => {
3516
3668
  S || t.onFeedback?.(e);
3517
3669
  }), e.on("feedbackFailed", (e) => {
3518
3670
  S || t.onFeedbackFailed?.(e);
3519
3671
  });
3520
- }, we = () => {
3521
- B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), G();
3522
- }, Te = () => {
3523
- z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3672
+ }, De = () => {
3673
+ ae(), u.hidden = !0, p.hidden = !0, B(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), _e(null), typeof document < "u" && (document.body.style.overflow = k), W();
3674
+ }, Oe = () => {
3675
+ z(), ae(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3524
3676
  let e = b;
3525
3677
  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");
3526
- }, Ee = () => {
3678
+ }, K = () => {
3527
3679
  if (!S && $(a.dataset.state)) {
3528
3680
  if (U(), x = !1, b && E) {
3529
3681
  let e = b;
3530
3682
  (async () => {
3531
- D && (await me(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), we(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && ve(), t.onCollapsed?.(), t.onClose?.());
3683
+ D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), De(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && be(), t.onCollapsed?.(), t.onClose?.());
3532
3684
  })();
3533
3685
  return;
3534
3686
  }
3535
- Te(), we(), t.onCollapsed?.(), t.onClose?.();
3687
+ Oe(), De(), t.onCollapsed?.(), t.onClose?.();
3536
3688
  }
3537
- }, De = () => {
3538
- S || Gn() && R() === "expanded" && pe(() => {
3539
- Se();
3540
- });
3541
- }, Oe = () => {
3542
- S || R() === "docked" && (U(), pe(() => {
3543
- ae(), J(!1), b?.setWidgetChrome("expanded");
3544
- }));
3545
3689
  }, ke = () => {
3546
- !b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), J(), b.setWidgetChrome("expanded"), x = !1, fe());
3690
+ S || rr() && R() === "expanded" && me(() => {
3691
+ Te();
3692
+ });
3547
3693
  }, Ae = () => {
3548
- !b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), J(), x = !1, w || b.setWidgetChrome("expanded"));
3549
- }, je = (e) => {
3550
- S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), J(), x = !1, D && fe());
3551
- }, Ne = () => {
3694
+ S || R() === "docked" && (U(), me(() => {
3695
+ B(), we(!1), b?.setWidgetChrome("expanded");
3696
+ }));
3697
+ }, je = () => {
3698
+ !b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), we(), b.setWidgetChrome("expanded"), x = !1, pe());
3699
+ }, q = () => {
3700
+ !b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, w || b.setWidgetChrome("expanded"));
3701
+ }, Me = (e) => {
3702
+ S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, D && pe());
3703
+ }, J = () => {
3552
3704
  if (S || T || w || b || $(a.dataset.state)) return;
3553
3705
  T = !0;
3554
3706
  let e = O;
3555
3707
  l.hidden = !1, (async () => {
3556
3708
  try {
3557
- let t = await Nn.startSession(xe());
3709
+ let t = await Gn.startSession(Se());
3558
3710
  if (S || e !== O) {
3559
3711
  t.destroy();
3560
3712
  return;
3561
3713
  }
3562
- b = t, Ce(t);
3714
+ b = t, Ee(t);
3563
3715
  let n = await t.attach({
3564
3716
  container: l,
3565
- ...q(),
3717
+ ...Ce(),
3566
3718
  onWidgetReady: () => {
3567
- S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ve());
3719
+ S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : be());
3568
3720
  },
3569
3721
  onWidgetExpand: () => {
3570
- je(e);
3722
+ Me(e);
3571
3723
  },
3572
3724
  onWidgetAudioSettings: (e) => {
3573
- S || Re(e);
3725
+ S || Ie(e);
3574
3726
  },
3575
3727
  onWidgetDragStart: (e) => {
3576
3728
  S || le(e);
3577
3729
  },
3578
3730
  onWidgetDragMove: (e) => {
3579
- S || W(e);
3731
+ S || ue(e);
3580
3732
  },
3581
3733
  onWidgetDragEnd: (e) => {
3582
- S || ue(e);
3734
+ S || de(e);
3583
3735
  },
3584
3736
  onPlayerStatusChange: (e) => {
3585
- S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
3737
+ S || e === "error" && $(a.dataset.state) && _e("Could not load the experience.");
3586
3738
  }
3587
3739
  });
3588
3740
  if (S || e !== O) {
@@ -3590,7 +3742,7 @@ function tr(e, t) {
3590
3742
  return;
3591
3743
  }
3592
3744
  n.on("close", () => {
3593
- S || Ee();
3745
+ S || K();
3594
3746
  });
3595
3747
  } catch (n) {
3596
3748
  if (S || e !== O) return;
@@ -3599,43 +3751,43 @@ function tr(e, t) {
3599
3751
  t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
3600
3752
  }
3601
3753
  })();
3602
- }, Fe = () => {
3754
+ }, Ne = () => {
3603
3755
  if (S || x || !C || $(a.dataset.state)) return;
3604
3756
  if (b && D) {
3605
- ke();
3757
+ je();
3606
3758
  return;
3607
3759
  }
3608
3760
  if (b && E) {
3609
- Ae();
3761
+ q();
3610
3762
  return;
3611
3763
  }
3612
3764
  let e = ++O;
3613
3765
  x = !0, w = !1, T = !1, E = !1, D = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
3614
3766
  try {
3615
- J();
3616
- let t = await Nn.startSession(xe());
3767
+ we();
3768
+ let t = await Gn.startSession(Se());
3617
3769
  if (S || e !== O) {
3618
3770
  t.destroy();
3619
3771
  return;
3620
3772
  }
3621
- b = t, Ce(t);
3773
+ b = t, Ee(t);
3622
3774
  let n = await t.attach({
3623
3775
  container: v,
3624
- ...q(),
3776
+ ...Ce(),
3625
3777
  onWidgetAudioSettings: (e) => {
3626
- S || Re(e);
3778
+ S || Ie(e);
3627
3779
  },
3628
3780
  onWidgetDragStart: (e) => {
3629
3781
  S || le(e);
3630
3782
  },
3631
3783
  onWidgetDragMove: (e) => {
3632
- S || W(e);
3784
+ S || ue(e);
3633
3785
  },
3634
3786
  onWidgetDragEnd: (e) => {
3635
- S || ue(e);
3787
+ S || de(e);
3636
3788
  },
3637
3789
  onPlayerStatusChange: (e) => {
3638
- S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
3790
+ S || (e === "error" ? _e("Could not load the experience.") : $(a.dataset.state) && _e(null));
3639
3791
  }
3640
3792
  });
3641
3793
  if (S || e !== O) {
@@ -3643,101 +3795,101 @@ function tr(e, t) {
3643
3795
  return;
3644
3796
  }
3645
3797
  E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
3646
- S || Ee();
3798
+ S || K();
3647
3799
  });
3648
3800
  } catch (n) {
3649
3801
  if (S || e !== O) return;
3650
3802
  let r = n instanceof Error ? n : Error(String(n));
3651
- K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3803
+ _e(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3652
3804
  } finally {
3653
3805
  e === O && (x = !1);
3654
3806
  }
3655
3807
  })();
3656
- }, Ie = () => {
3808
+ }, Pe = () => {
3657
3809
  if (!(S || $(a.dataset.state))) {
3658
3810
  if (b && D) {
3659
- ke();
3811
+ je();
3660
3812
  return;
3661
3813
  }
3662
3814
  if (b && E) {
3663
- Ae();
3815
+ q();
3664
3816
  return;
3665
3817
  }
3666
3818
  if (T || b) {
3667
- J();
3819
+ we();
3668
3820
  return;
3669
3821
  }
3670
- Fe();
3822
+ Ne();
3671
3823
  }
3672
- }, Le = (e) => {
3824
+ }, Fe = (e) => {
3673
3825
  if (e.stopPropagation(), R() === "expanded") {
3674
- De();
3826
+ ke();
3675
3827
  return;
3676
3828
  }
3677
- R() === "docked" && Oe();
3678
- }, Re = (e) => {
3829
+ R() === "docked" && Ae();
3830
+ }, Ie = (e) => {
3679
3831
  g.setAttribute("aria-pressed", e ? "true" : "false");
3680
- }, ze = (e) => {
3832
+ }, Le = (e) => {
3681
3833
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
3682
- }, Ve = (e) => {
3683
- R() === "docked" && Gn() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
3684
- }, He = (e) => {
3685
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Ee());
3686
- }, Ue = () => {
3834
+ }, Re = (e) => {
3835
+ R() === "docked" && rr() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
3836
+ }, ze = (e) => {
3837
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), K());
3838
+ }, Be = () => {
3687
3839
  if (!S) {
3688
3840
  if (R() === "docked") {
3689
- if (!Gn()) {
3690
- Oe();
3841
+ if (!rr()) {
3842
+ Ae();
3691
3843
  return;
3692
3844
  }
3693
- D ? pe(() => {
3694
- de(!0);
3695
- }) : de(!0);
3845
+ D ? me(() => {
3846
+ fe(!0);
3847
+ }) : fe(!0);
3696
3848
  return;
3697
3849
  }
3698
- G();
3850
+ W();
3699
3851
  }
3700
- }, We = typeof window < "u" ? window.matchMedia(Fn) : null, Ge = () => {
3852
+ }, Ve = typeof window < "u" ? window.matchMedia(qn) : null, He = () => {
3701
3853
  if (!S) {
3702
- if (R() === "docked" && !Gn()) {
3703
- Oe();
3854
+ if (R() === "docked" && !rr()) {
3855
+ Ae();
3704
3856
  return;
3705
3857
  }
3706
- G();
3858
+ W();
3707
3859
  }
3708
3860
  };
3709
- return o.addEventListener("click", Ie), d.addEventListener("click", Ee), _.addEventListener("click", (e) => {
3710
- e.stopPropagation(), Ee();
3711
- }), h.addEventListener("click", Le), g.addEventListener("click", ze), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), be(), G(), r === "eager" ? queueMicrotask(() => {
3712
- S || Ne();
3713
- }) : r === "idle" && (j = er(() => {
3714
- S || Ne();
3861
+ return o.addEventListener("click", Pe), d.addEventListener("click", K), _.addEventListener("click", (e) => {
3862
+ e.stopPropagation(), K();
3863
+ }), h.addEventListener("click", Fe), g.addEventListener("click", Le), p.addEventListener("pointerdown", Re), window.addEventListener("keydown", ze), window.addEventListener("resize", Be), Ve?.addEventListener("change", He), G(), W(), r === "eager" ? queueMicrotask(() => {
3864
+ S || J();
3865
+ }) : r === "idle" && (ee = fr(() => {
3866
+ S || J();
3715
3867
  })), {
3716
3868
  root: a,
3717
- expand: Ie,
3718
- collapse: Ee,
3719
- dock: De,
3720
- maximize: Oe,
3869
+ expand: Pe,
3870
+ collapse: K,
3871
+ dock: ke,
3872
+ maximize: Ae,
3721
3873
  prefetch() {
3722
3874
  if (r === "onExpand") {
3723
- Ne();
3875
+ J();
3724
3876
  return;
3725
3877
  }
3726
- Ne();
3878
+ J();
3727
3879
  },
3728
3880
  destroy() {
3729
- S || (S = !0, U(), j?.(), j = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), Te(), we(), e.replaceChildren());
3881
+ S || (S = !0, U(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", ze), window.removeEventListener("resize", Be), Ve?.removeEventListener("change", He), Oe(), De(), e.replaceChildren());
3730
3882
  }
3731
3883
  };
3732
3884
  }
3733
3885
  //#endregion
3734
3886
  //#region src/react/ExperienceWidget.tsx
3735
- function nr(e) {
3736
- let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, 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: C, expandedMaxHeight: w, startButtonLabel: T, startButton: E, showFeedback: D, className: O = "", onExpanded: k, onCollapsed: A, onStarted: j, onClose: M, onError: N, onPrefetchReady: P, onFeedback: F, onFeedbackFailed: I } = e, ee = m === "bottom-right" || m === "bottom-left";
3887
+ function mr(e) {
3888
+ let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: ee = "", onExpanded: j, onCollapsed: M, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = e, ne = m === "bottom-right" || m === "bottom-left";
3737
3889
  return n(() => {
3738
3890
  let e = t.current;
3739
3891
  if (!e || !r.trim()) return;
3740
- let n = tr(e, {
3892
+ let n = pr(e, {
3741
3893
  experienceId: r,
3742
3894
  alt: i,
3743
3895
  galleryThumb: a,
@@ -3750,25 +3902,28 @@ function nr(e) {
3750
3902
  position: m,
3751
3903
  offset: h,
3752
3904
  sessionEndpoint: g,
3753
- language: _,
3754
- mode: v,
3755
- speechInputMode: y,
3756
- speechOnly: b,
3757
- fit: x,
3758
- embedBaseUrl: S,
3759
- expandedMaxWidth: C,
3760
- expandedMaxHeight: w,
3761
- startButtonLabel: T,
3762
- startButton: E,
3763
- showFeedback: D,
3764
- onFeedback: F,
3765
- onFeedbackFailed: I,
3766
- onExpanded: k,
3767
- onCollapsed: A,
3768
- onStarted: j,
3769
- onClose: M,
3770
- onError: N,
3771
- onPrefetchReady: P
3905
+ locale: _,
3906
+ secondaryLocale: v,
3907
+ learningLocale: y,
3908
+ language: b,
3909
+ mode: x,
3910
+ speechInputMode: S,
3911
+ speechOnly: C,
3912
+ fit: w,
3913
+ embedBaseUrl: T,
3914
+ expandedMaxWidth: E,
3915
+ expandedMaxHeight: D,
3916
+ startButtonLabel: O,
3917
+ startButton: k,
3918
+ showFeedback: A,
3919
+ onFeedback: I,
3920
+ onFeedbackFailed: L,
3921
+ onExpanded: j,
3922
+ onCollapsed: M,
3923
+ onStarted: N,
3924
+ onClose: P,
3925
+ onError: F,
3926
+ onPrefetchReady: te
3772
3927
  });
3773
3928
  return () => n.destroy();
3774
3929
  }, [
@@ -3795,18 +3950,21 @@ function nr(e) {
3795
3950
  T,
3796
3951
  E,
3797
3952
  D,
3798
- F,
3799
- I,
3953
+ O,
3800
3954
  k,
3801
3955
  A,
3956
+ I,
3957
+ L,
3802
3958
  j,
3803
3959
  M,
3804
3960
  N,
3805
- P
3961
+ P,
3962
+ F,
3963
+ te
3806
3964
  ]), /* @__PURE__ */ d("div", {
3807
3965
  ref: t,
3808
- className: O,
3809
- style: ee ? { display: "contents" } : {
3966
+ className: ee,
3967
+ style: ne ? { display: "contents" } : {
3810
3968
  width: "100%",
3811
3969
  height: "100%",
3812
3970
  minHeight: "inherit"
@@ -3814,6 +3972,6 @@ function nr(e) {
3814
3972
  });
3815
3973
  }
3816
3974
  //#endregion
3817
- export { ne as Experience, je as ExperienceThumbnail, nr as ExperienceWidget };
3975
+ export { ne as Experience, Ue as ExperienceThumbnail, mr as ExperienceWidget };
3818
3976
 
3819
3977
  //# sourceMappingURL=index.js.map