@liforma/client 0.4.1 → 0.4.3

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 (135) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/next/index.js +920 -701
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/next/createLiformaSessionRouteHandler.d.ts +0 -1
  5. package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -1
  6. package/dist/next/react/ExperienceThumbnail.d.ts +1 -0
  7. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  8. package/dist/next/react/ExperienceWidget.d.ts +4 -0
  9. package/dist/next/react/ExperienceWidget.d.ts.map +1 -1
  10. package/dist/next/thumbnail/index.d.ts +1 -0
  11. package/dist/next/thumbnail/index.d.ts.map +1 -1
  12. package/dist/next/thumbnail/styles.d.ts.map +1 -1
  13. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  14. package/dist/next/thumbnail/types.d.ts +3 -0
  15. package/dist/next/thumbnail/types.d.ts.map +1 -1
  16. package/dist/next/v2/api/mintPublicSession.d.ts +2 -2
  17. package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -1
  18. package/dist/next/v2/api/sessionEndpointRequest.d.ts +2 -2
  19. package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  20. package/dist/next/v2/embed/iframeHost.d.ts +28 -4
  21. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  22. package/dist/next/v2/embed/protocol.d.ts +61 -1
  23. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  24. package/dist/next/v2/errors/LiformaError.d.ts +23 -0
  25. package/dist/next/v2/errors/LiformaError.d.ts.map +1 -0
  26. package/dist/next/v2/experience.d.ts +21 -9
  27. package/dist/next/v2/experience.d.ts.map +1 -1
  28. package/dist/next/v2/experienceEvents.d.ts +46 -15
  29. package/dist/next/v2/experienceEvents.d.ts.map +1 -1
  30. package/dist/next/v2/shims/embedBaseUrl.d.ts +1 -1
  31. package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
  32. package/dist/next/v2/types/sessionInteraction.d.ts +3 -1
  33. package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
  34. package/dist/next/v2/types/sessionLaunch.d.ts +28 -5
  35. package/dist/next/v2/types/sessionLaunch.d.ts.map +1 -1
  36. package/dist/next/v2/types/sessionManifest.d.ts +8 -0
  37. package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
  38. package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
  39. package/dist/next/widget/types.d.ts +7 -0
  40. package/dist/next/widget/types.d.ts.map +1 -1
  41. package/dist/npm/index.js +851 -636
  42. package/dist/npm/index.js.map +1 -1
  43. package/dist/npm/thumbnail/index.d.ts +1 -0
  44. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  45. package/dist/npm/thumbnail/styles.d.ts.map +1 -1
  46. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  47. package/dist/npm/thumbnail/types.d.ts +3 -0
  48. package/dist/npm/thumbnail/types.d.ts.map +1 -1
  49. package/dist/npm/v2/api/mintPublicSession.d.ts +2 -2
  50. package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -1
  51. package/dist/npm/v2/api/sessionEndpointRequest.d.ts +2 -2
  52. package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  53. package/dist/npm/v2/embed/iframeHost.d.ts +28 -4
  54. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  55. package/dist/npm/v2/embed/protocol.d.ts +61 -1
  56. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  57. package/dist/npm/v2/errors/LiformaError.d.ts +23 -0
  58. package/dist/npm/v2/errors/LiformaError.d.ts.map +1 -0
  59. package/dist/npm/v2/experience.d.ts +21 -9
  60. package/dist/npm/v2/experience.d.ts.map +1 -1
  61. package/dist/npm/v2/experienceEvents.d.ts +46 -15
  62. package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
  63. package/dist/npm/v2/index.d.ts +4 -2
  64. package/dist/npm/v2/index.d.ts.map +1 -1
  65. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  66. package/dist/npm/v2/liforma-experience-widget.d.ts.map +1 -1
  67. package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
  68. package/dist/npm/v2/npm.d.ts +7 -4
  69. package/dist/npm/v2/npm.d.ts.map +1 -1
  70. package/dist/npm/v2/shims/embedBaseUrl.d.ts +1 -1
  71. package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
  72. package/dist/npm/v2/types/index.d.ts +2 -2
  73. package/dist/npm/v2/types/index.d.ts.map +1 -1
  74. package/dist/npm/v2/types/sessionInteraction.d.ts +3 -1
  75. package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
  76. package/dist/npm/v2/types/sessionLaunch.d.ts +28 -5
  77. package/dist/npm/v2/types/sessionLaunch.d.ts.map +1 -1
  78. package/dist/npm/v2/types/sessionManifest.d.ts +8 -0
  79. package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
  80. package/dist/npm/v2/types/sessionManifestSchema.d.ts +8 -1
  81. package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
  82. package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
  83. package/dist/npm/widget/types.d.ts +7 -0
  84. package/dist/npm/widget/types.d.ts.map +1 -1
  85. package/dist/react/component/experienceComponentRuntime.d.ts +4 -2
  86. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  87. package/dist/react/component/experienceComponentTypes.d.ts +18 -6
  88. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  89. package/dist/react/index.js +995 -760
  90. package/dist/react/index.js.map +1 -1
  91. package/dist/react/react/Experience.d.ts.map +1 -1
  92. package/dist/react/react/ExperienceThumbnail.d.ts +1 -0
  93. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  94. package/dist/react/react/ExperienceWidget.d.ts +4 -0
  95. package/dist/react/react/ExperienceWidget.d.ts.map +1 -1
  96. package/dist/react/thumbnail/index.d.ts +1 -0
  97. package/dist/react/thumbnail/index.d.ts.map +1 -1
  98. package/dist/react/thumbnail/styles.d.ts.map +1 -1
  99. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  100. package/dist/react/thumbnail/types.d.ts +3 -0
  101. package/dist/react/thumbnail/types.d.ts.map +1 -1
  102. package/dist/react/v2/api/mintPublicSession.d.ts +2 -2
  103. package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -1
  104. package/dist/react/v2/api/sessionEndpointRequest.d.ts +2 -2
  105. package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  106. package/dist/react/v2/embed/iframeHost.d.ts +28 -4
  107. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  108. package/dist/react/v2/embed/protocol.d.ts +61 -1
  109. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  110. package/dist/react/v2/errors/LiformaError.d.ts +23 -0
  111. package/dist/react/v2/errors/LiformaError.d.ts.map +1 -0
  112. package/dist/react/v2/experience.d.ts +21 -9
  113. package/dist/react/v2/experience.d.ts.map +1 -1
  114. package/dist/react/v2/experienceEvents.d.ts +46 -15
  115. package/dist/react/v2/experienceEvents.d.ts.map +1 -1
  116. package/dist/react/v2/shims/embedBaseUrl.d.ts +1 -1
  117. package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
  118. package/dist/react/v2/types/sessionInteraction.d.ts +3 -1
  119. package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
  120. package/dist/react/v2/types/sessionLaunch.d.ts +28 -5
  121. package/dist/react/v2/types/sessionLaunch.d.ts.map +1 -1
  122. package/dist/react/v2/types/sessionManifest.d.ts +8 -0
  123. package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
  124. package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
  125. package/dist/react/widget/types.d.ts +7 -0
  126. package/dist/react/widget/types.d.ts.map +1 -1
  127. package/dist/sdk/v2/client.js +61 -13
  128. package/dist/sdk/v2/client.js.map +1 -1
  129. package/dist/svelte/Experience.svelte +29 -6
  130. package/dist/svelte/Experience.svelte.d.ts +2 -0
  131. package/dist/svelte/ExperienceThumbnail.svelte +9 -1
  132. package/dist/svelte/ExperienceThumbnail.svelte.d.ts +1 -0
  133. package/dist/svelte/ExperienceWidget.svelte +12 -1
  134. package/dist/svelte/ExperienceWidget.svelte.d.ts +3 -0
  135. package/package.json +16 -2
@@ -39,10 +39,10 @@ function _(e) {
39
39
  language: e.language,
40
40
  locationId: e.locationId,
41
41
  avatarId: e.avatarId,
42
+ castSize: e.castSize,
42
43
  embedBaseUrl: e.embedBaseUrl,
43
44
  debug: e.debug,
44
45
  mode: e.mode,
45
- responseMode: e.responseMode,
46
46
  speechInputMode: e.speechInputMode,
47
47
  speechOnly: e.speechOnly,
48
48
  conversationProcessor: e.conversationProcessor
@@ -55,10 +55,10 @@ function _(e) {
55
55
  language: e.language,
56
56
  locationId: e.locationId,
57
57
  avatarId: e.avatarId,
58
+ castSize: e.castSize,
58
59
  embedBaseUrl: e.embedBaseUrl,
59
60
  debug: e.debug,
60
61
  mode: e.mode,
61
- responseMode: e.responseMode,
62
62
  speechInputMode: e.speechInputMode,
63
63
  speechOnly: e.speechOnly,
64
64
  conversationProcessor: e.conversationProcessor
@@ -74,12 +74,12 @@ function v(e) {
74
74
  e.locale ?? e.language,
75
75
  e.secondaryLocale ?? e.learningLocale,
76
76
  e.mode,
77
- e.responseMode,
78
77
  e.speechInputMode,
79
78
  e.conversationProcessor ? g(e.conversationProcessor) : 0,
80
79
  e.speechOnly,
81
80
  e.avatarId,
82
81
  e.locationId,
82
+ e.castSize,
83
83
  e.embedBaseUrl,
84
84
  e.debug
85
85
  ]);
@@ -95,14 +95,14 @@ function S() {
95
95
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
96
96
  } catch {}
97
97
  }
98
- function C(e) {
98
+ function ee(e) {
99
99
  return y.exec(e)?.[1];
100
100
  }
101
- function w(e) {
101
+ function C(e) {
102
102
  return b.exec(e)?.[1];
103
103
  }
104
- function T(e, t) {
105
- let n = x(e).trim() || "Unknown error", r = t?.experienceId?.trim() || C(n) || void 0, i = t?.origin?.trim() || w(n) || S() || void 0;
104
+ function w(e, t) {
105
+ let n = x(e).trim() || "Unknown error", r = t?.experienceId?.trim() || ee(n) || void 0, i = t?.origin?.trim() || C(n) || S() || void 0;
106
106
  return /No playable experience found/i.test(n) || /^Experience is not available\.?$/i.test(n) || /^Unknown experience\.?$/i.test(n) || /experience_unavailable/i.test(n) ? {
107
107
  kind: "not_found",
108
108
  title: "The application tried to load an avatar experience that doesn’t exist.",
@@ -135,7 +135,7 @@ function T(e, t) {
135
135
  }
136
136
  //#endregion
137
137
  //#region src/component/experienceComponentRuntime.ts
138
- function E() {
138
+ function T() {
139
139
  let e, t, n = new Promise((n, r) => {
140
140
  e = n, t = r;
141
141
  });
@@ -145,29 +145,29 @@ function E() {
145
145
  reject: t
146
146
  };
147
147
  }
148
- function D() {
148
+ function E() {
149
149
  return new DOMException("Aborted", "AbortError");
150
150
  }
151
- function O(e) {
151
+ function D(e) {
152
152
  return e instanceof DOMException || e instanceof Error ? e : Error(String(e));
153
153
  }
154
- function k(e) {
154
+ function O(e) {
155
155
  return e instanceof DOMException && e.name === "AbortError";
156
156
  }
157
- function A(e) {
157
+ function k(e) {
158
158
  !e.instance || e.instanceDestroyed || (e.instanceDestroyed = !0, e.instance.destroy());
159
159
  }
160
- function j(e, t, n, r) {
160
+ function A(e, t, n, r) {
161
161
  e.unsubscribers.push(t.on(n, r));
162
162
  }
163
- function M(e, t, n) {
164
- j(e, t, "ready", (t) => {
163
+ function j(e, t, n) {
164
+ A(e, t, "ready", (t) => {
165
165
  e.destroyed || (e.ready.resolve(t), n().onReady?.(t));
166
- }), j(e, t, "started", (t) => {
166
+ }), A(e, t, "started", (t) => {
167
167
  e.destroyed || (e.started.resolve(t), n().onStarted?.(t));
168
- }), j(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), j(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), j(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), j(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), j(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), j(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), j(e, t, "message", (e) => n().onMessage?.(e)), j(e, t, "listeningState", (e) => n().onListeningState?.(e)), j(e, t, "activityChange", (e) => n().onActivityChange?.(e)), j(e, t, "modeChange", (e) => n().onModeChange?.(e)), j(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
168
+ }), A(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), A(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), A(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), A(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), A(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), A(e, t, "characterFocusChanged", (e) => n().onCharacterFocusChanged?.(e)), A(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), A(e, t, "message", (e) => n().onMessage?.(e)), A(e, t, "listeningState", (e) => n().onListeningState?.(e)), A(e, t, "activityChange", (e) => n().onActivityChange?.(e)), A(e, t, "feedback", (e) => n().onFeedback?.(e)), A(e, t, "feedbackFailed", (e) => n().onFeedbackFailed?.(e)), A(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
169
169
  }
170
- function N(e = () => ({}), t = () => ({})) {
170
+ function M(e = () => ({}), t = () => ({})) {
171
171
  let n = 0, r = null;
172
172
  function i(e) {
173
173
  if (e) {
@@ -182,22 +182,22 @@ function N(e = () => ({}), t = () => ({})) {
182
182
  }
183
183
  }
184
184
  function a(e, t, n, a, o = !1, s) {
185
- let c = O(e);
186
- return !k(c) && r === t && !t.destroyed && (o && a?.(T(c, { experienceId: i(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), n.onError?.(c))), c;
185
+ let c = D(e);
186
+ return !O(c) && r === t && !t.destroyed && (o && a?.(w(c, { experienceId: i(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), n.onError?.(c))), c;
187
187
  }
188
188
  function o() {
189
- if (!r || r.destroyed) throw D();
189
+ if (!r || r.destroyed) throw E();
190
190
  return r;
191
191
  }
192
192
  function s(e) {
193
- if (e.destroyed || r !== e) throw D();
193
+ if (e.destroyed || r !== e) throw E();
194
194
  }
195
195
  function u() {
196
196
  return {
197
197
  id: ++n,
198
- session: E(),
199
- ready: E(),
200
- started: E(),
198
+ session: T(),
199
+ ready: T(),
200
+ started: T(),
201
201
  unsubscribers: [],
202
202
  reportedErrors: /* @__PURE__ */ new Set(),
203
203
  instance: null,
@@ -208,23 +208,24 @@ function N(e = () => ({}), t = () => ({})) {
208
208
  function d(e) {
209
209
  if (e.destroyed) return;
210
210
  e.destroyed = !0;
211
- let t = D();
211
+ let t = E();
212
212
  e.session.reject(t), e.ready.reject(t), e.started.reject(t);
213
213
  for (let t of e.unsubscribers.splice(0)) t();
214
- A(e), r === e && (r = null);
214
+ k(e), r === e && (r = null);
215
215
  }
216
216
  async function f(e, n, i, o, u, d) {
217
217
  try {
218
218
  let a = await c.startSession(i);
219
219
  if (e.instance = a, e.destroyed || r !== e) {
220
- A(e);
220
+ k(e);
221
221
  return;
222
222
  }
223
- M(e, a, o);
223
+ j(e, a, o);
224
224
  let d = t(), f = d.returnUrl?.trim() || u?.trim(), p = await a.attach({
225
225
  container: n,
226
226
  fit: d.fit,
227
227
  startButton: d.startButton,
228
+ showFeedback: d.showFeedback,
228
229
  closeButton: d.closeButton,
229
230
  returnUrl: f,
230
231
  showClose: !!(o().onClose || f || d.closeButton === !0 || d.closeButton && typeof d.closeButton == "object" && d.closeButton.visible !== !1),
@@ -246,7 +247,7 @@ function N(e = () => ({}), t = () => ({})) {
246
247
  });
247
248
  } catch (t) {
248
249
  let n = a(t, e, o(), d, !0, i);
249
- e.session.reject(n), e.ready.reject(n), e.started.reject(n), A(e);
250
+ e.session.reject(n), e.ready.reject(n), e.started.reject(n), k(e);
250
251
  }
251
252
  }
252
253
  function p(t, n, i, o) {
@@ -276,17 +277,17 @@ function N(e = () => ({}), t = () => ({})) {
276
277
  }
277
278
  //#endregion
278
279
  //#region src/svelte/experienceLoadErrorStyles.ts
279
- var P = "liforma-experience-load-error-styles";
280
- function F() {
280
+ var N = "liforma-experience-load-error-styles";
281
+ function P() {
281
282
  if (typeof document > "u" || document.getElementById("liforma-experience-load-error-styles")) return;
282
283
  let e = document.createElement("style");
283
- e.id = P, e.textContent = I, document.head.append(e);
284
+ e.id = N, e.textContent = F, document.head.append(e);
284
285
  }
285
- 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 word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
286
+ var F = "\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 word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
286
287
  //#endregion
287
288
  //#region src/svelte/experienceLoadErrorOverlay.ts
288
- function ee(e, t) {
289
- F();
289
+ function te(e, t) {
290
+ P();
290
291
  let n = t, r = !1, i = document.createElement("div");
291
292
  i.className = "liforma-loading-screen liforma-loading-screen-absolute", i.setAttribute("role", "alert"), i.setAttribute("aria-live", "assertive");
292
293
  let a = document.createElement("div");
@@ -316,86 +317,95 @@ function ee(e, t) {
316
317
  }
317
318
  //#endregion
318
319
  //#region src/react/Experience.tsx
319
- var L = e(function(e, a) {
320
- let { returnUrl: c, fit: l, startButton: u, closeButton: p, onReady: m, onStarted: h, onUserTranscript: g, onUserSpeechStarted: y, onUserSpeechEnded: b, onCharacterSpeechStarted: x, onCharacterSpeechEnded: S, onConversationUpdate: C, onMessage: w, onListeningState: T, onActivityChange: E, onModeChange: k, onConversationProcessorError: A, onPlayerStatusChange: j, onStateUpdate: M, onClose: P, onError: F } = e, I = o({}), L = o({
320
+ var ne = e(function(e, a) {
321
+ let { returnUrl: c, fit: l, startButton: u, showFeedback: p, closeButton: m, onReady: h, onStarted: g, onUserTranscript: y, onUserSpeechStarted: b, onUserSpeechEnded: x, onCharacterSpeechStarted: S, onCharacterSpeechEnded: ee, onCharacterFocusChanged: C, onConversationUpdate: w, onMessage: T, onListeningState: O, onActivityChange: k, onFeedback: A, onFeedbackFailed: j, onConversationProcessorError: N, onPlayerStatusChange: P, onStateUpdate: F, onClose: ne, onError: re } = e, I = o({}), ie = o({
321
322
  fit: l,
322
323
  startButton: u,
323
- closeButton: p,
324
+ showFeedback: p,
325
+ closeButton: m,
324
326
  returnUrl: c
325
- }), R = o(N(() => I.current, () => L.current)), z = o(null), [B, te] = s(!1), [V, H] = s(null), U = o(null), ne = o(null), re = v(e);
326
- L.current = {
327
+ }), L = o(M(() => I.current, () => ie.current)), R = o(null), [z, B] = s(!1), [V, ae] = s(null), oe = o(null), se = o(null), ce = v(e);
328
+ ie.current = {
327
329
  fit: l,
328
330
  startButton: u,
329
- closeButton: p,
331
+ showFeedback: p,
332
+ closeButton: m,
330
333
  returnUrl: c
331
334
  }, I.current = {
332
- onReady: m,
333
- onStarted: h,
334
- onUserTranscript: g,
335
- onUserSpeechStarted: y,
336
- onUserSpeechEnded: b,
337
- onCharacterSpeechStarted: x,
338
- onCharacterSpeechEnded: S,
339
- onConversationUpdate: C,
340
- onMessage: w,
341
- onListeningState: T,
342
- onActivityChange: E,
343
- onModeChange: k,
344
- onConversationProcessorError: A,
345
- onPlayerStatusChange: j,
346
- onStateUpdate: M,
347
- onClose: P,
348
- onError: F
335
+ onReady: h,
336
+ onStarted: g,
337
+ onUserTranscript: y,
338
+ onUserSpeechStarted: b,
339
+ onUserSpeechEnded: x,
340
+ onCharacterSpeechStarted: S,
341
+ onCharacterSpeechEnded: ee,
342
+ onCharacterFocusChanged: C,
343
+ onConversationUpdate: w,
344
+ onMessage: T,
345
+ onListeningState: O,
346
+ onActivityChange: k,
347
+ onFeedback: A,
348
+ onFeedbackFailed: j,
349
+ onConversationProcessorError: N,
350
+ onPlayerStatusChange: P,
351
+ onStateUpdate: F,
352
+ onClose: ne,
353
+ onError: re
349
354
  };
350
- let ie = t((e) => {
351
- U.current = e, te(e !== null);
355
+ let H = t((e) => {
356
+ oe.current = e, B(e !== null);
352
357
  }, []);
353
358
  return r(a, () => ({
354
359
  ready: () => {
355
- let e = z.current;
356
- return !e || e.destroyed ? Promise.reject(D()) : e.ready.promise;
360
+ let e = R.current;
361
+ return !e || e.destroyed ? Promise.reject(E()) : e.ready.promise;
357
362
  },
358
363
  started: () => {
359
- let e = z.current;
360
- return !e || e.destroyed ? Promise.reject(D()) : e.started.promise;
364
+ let e = R.current;
365
+ return !e || e.destroyed ? Promise.reject(E()) : e.started.promise;
361
366
  },
362
367
  speech: {
363
- speak: (e) => R.current.withSession((t) => t.speech.speak(e)),
364
- play: (e) => R.current.withSession((t) => t.speech.play(e)),
368
+ speak: (e) => L.current.withSession((t) => t.speech.speak(e)),
369
+ play: (e) => L.current.withSession((t) => t.speech.play(e)),
365
370
  createUtterance: (e) => {
366
- let t = R.current.getActiveInstance();
371
+ let t = L.current.getActiveInstance();
367
372
  if (!t) throw Error("Session has not started. Wait for the player start button and the started event before using speech APIs.");
368
373
  return t.speech.createUtterance(e);
369
374
  },
370
- interrupt: (e) => R.current.withSession((t) => t.speech.interrupt(e))
375
+ interrupt: (e) => L.current.withSession((t) => t.speech.interrupt(e))
371
376
  },
372
- startListening: () => R.current.withSession((e) => e.startListening()),
373
- stopListening: () => R.current.withSession((e) => e.stopListening()),
374
- listenOnce: (e) => R.current.withSession((t) => t.listenOnce(e)),
375
- getSession: () => R.current.getActiveInstance()?.getSession() ?? null,
376
- getManifest: () => R.current.getActiveInstance()?.getManifest() ?? null,
377
- getConversation: () => R.current.getActiveInstance()?.getConversation() ?? [],
378
- end: () => R.current.withSession((e) => e.end())
377
+ startListening: () => L.current.withSession((e) => e.startListening()),
378
+ stopListening: () => L.current.withSession((e) => e.stopListening()),
379
+ listenOnce: (e) => L.current.withSession((t) => t.listenOnce(e)),
380
+ getSession: () => L.current.getActiveInstance()?.getSession() ?? null,
381
+ getManifest: () => L.current.getActiveInstance()?.getManifest() ?? null,
382
+ getConversation: () => L.current.getActiveInstance()?.getConversation() ?? [],
383
+ focusCharacter: (e) => L.current.withSession((t) => t.focusCharacter(e)),
384
+ setFit: (e) => L.current.withSession((t) => t.setFit(e)),
385
+ end: () => L.current.withSession((e) => e.end())
379
386
  }), []), i(() => {
380
- if (!B || !U.current) return;
381
- let t = U.current, n = R.current, r;
387
+ if (!z || !oe.current) return;
388
+ let t = oe.current, n = L.current, r;
382
389
  try {
383
390
  r = { options: _(e) };
384
391
  } catch (e) {
385
- r = { error: O(e) };
392
+ r = { error: D(e) };
386
393
  }
387
- let i = n.activateGeneration(t, r, c, H);
388
- return z.current = i, () => {
389
- n.cancelGeneration(i), z.current === i && (z.current = null);
394
+ let i = n.activateGeneration(t, r, c, ae);
395
+ return R.current = i, () => {
396
+ n.cancelGeneration(i), R.current === i && (R.current = null);
390
397
  };
391
398
  }, [
392
- B,
393
- re,
399
+ z,
400
+ ce,
394
401
  c
395
402
  ]), n(() => {
396
- let e = ne.current;
403
+ let e = L.current.getActiveInstance();
404
+ e && e.setFit(l ?? "full");
405
+ }, [l]), n(() => {
406
+ let e = se.current;
397
407
  if (!e || (e.replaceChildren(), !V)) return;
398
- let t = ee(e, V);
408
+ let t = te(e, V);
399
409
  return () => t.remove();
400
410
  }, [V]), /* @__PURE__ */ f("div", {
401
411
  className: "liforma-experience-shell",
@@ -406,7 +416,7 @@ var L = e(function(e, a) {
406
416
  minHeight: "inherit"
407
417
  },
408
418
  children: [/* @__PURE__ */ d("div", {
409
- ref: ne,
419
+ ref: se,
410
420
  className: "liforma-experience-error-host",
411
421
  "aria-hidden": V ? void 0 : !0,
412
422
  style: {
@@ -416,7 +426,7 @@ var L = e(function(e, a) {
416
426
  pointerEvents: V ? "auto" : "none"
417
427
  }
418
428
  }), /* @__PURE__ */ d("div", {
419
- ref: ie,
429
+ ref: H,
420
430
  className: "liforma-experience-host",
421
431
  style: {
422
432
  position: "absolute",
@@ -425,27 +435,35 @@ var L = e(function(e, a) {
425
435
  }
426
436
  })]
427
437
  });
428
- }), R = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, z = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
429
- function B(e) {
438
+ });
439
+ //#endregion
440
+ //#region src/thumbnail/types.ts
441
+ function re(e) {
442
+ return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
443
+ }
444
+ //#endregion
445
+ //#region src/thumbnail/toGalleryThumbUrl.ts
446
+ var I = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, ie = /_CH(\.webp)/i, L = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
447
+ function R(e) {
430
448
  let t = e.trim();
431
449
  if (!t) return t;
432
- let n = t.replace(R, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
433
- return n = n.replace(z, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
450
+ let n = t.replace(I, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
451
+ return n = n.replace(ie, "_neutral$1"), n = n.replace(L, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
434
452
  }
435
- function te(e) {
453
+ function z(e) {
436
454
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
437
455
  if (!t) return null;
438
456
  let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
439
457
  return {
440
- avatarImage: B(t),
441
- ...n ? { backgroundImage: B(n) } : {},
442
- ...r ? { foregroundImage: B(r) } : {},
443
- ...i ? { fallbackImage: B(i) } : {}
458
+ avatarImage: R(t),
459
+ ...n ? { backgroundImage: R(n) } : {},
460
+ ...r ? { foregroundImage: R(r) } : {},
461
+ ...i ? { fallbackImage: R(i) } : {}
444
462
  };
445
463
  }
446
464
  //#endregion
447
465
  //#region src/shims/localStack.ts
448
- function V() {
466
+ function B() {
449
467
  if (globalThis.__LIFORMA_STACK === "local") return !0;
450
468
  if (typeof location > "u") return !1;
451
469
  try {
@@ -456,83 +474,83 @@ function V() {
456
474
  }
457
475
  //#endregion
458
476
  //#region src/thumbnail/hostedLaunchUrl.ts
459
- var H = "https://player.liforma.ai", U = "http://localhost:3002";
460
- function ne(e) {
477
+ var V = "https://player.liforma.ai", ae = "http://localhost:3002";
478
+ function oe(e) {
461
479
  return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
462
480
  }
463
- function re(e) {
481
+ function se(e) {
464
482
  let t = e?.trim();
465
- return t ? t.replace(/\/$/, "") : V() ? U : H;
483
+ return t ? t.replace(/\/$/, "") : B() ? ae : V;
466
484
  }
467
- function ie(e) {
468
- let t = e.experienceId.trim(), n = re(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
485
+ function ce(e) {
486
+ let t = e.experienceId.trim(), n = se(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
469
487
  return i && r.searchParams.set("returnUrl", i), r.toString();
470
488
  }
471
- function ae(e) {
489
+ function H(e) {
472
490
  let t = e.href?.trim();
473
491
  if (t) return t;
474
492
  let n = e.experienceId?.trim();
475
493
  if (!n) return;
476
494
  let r = e.returnUrl?.trim();
477
- return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ie({
495
+ return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ce({
478
496
  experienceId: n,
479
497
  ...r ? { returnUrl: r } : {},
480
498
  playerBaseUrl: e.playerBaseUrl
481
499
  });
482
500
  }
483
- function oe() {
501
+ function le() {
484
502
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
485
503
  }
486
- var W = 0, se = [];
487
- function ce() {
488
- return oe() ? 4 : Infinity;
504
+ var U = 0, ue = [];
505
+ function de() {
506
+ return le() ? 4 : Infinity;
489
507
  }
490
- function le() {
491
- return oe() ? 160 : 0;
508
+ function W() {
509
+ return le() ? 160 : 0;
492
510
  }
493
- function ue() {
494
- let e = ce();
495
- for (; W < e && se.length > 0;) {
496
- let e = se.shift();
511
+ function fe() {
512
+ let e = de();
513
+ for (; U < e && ue.length > 0;) {
514
+ let e = ue.shift();
497
515
  if (!e || e.cancelled) continue;
498
- W += 1, e.start();
499
- let t = le();
516
+ U += 1, e.start();
517
+ let t = W();
500
518
  if (t <= 0) {
501
- W = Math.max(0, W - 1);
519
+ U = Math.max(0, U - 1);
502
520
  continue;
503
521
  }
504
522
  window.setTimeout(() => {
505
- W = Math.max(0, W - 1), ue();
523
+ U = Math.max(0, U - 1), fe();
506
524
  }, t);
507
525
  }
508
526
  }
509
- function G(e) {
510
- if (!oe()) return e(), () => {};
527
+ function pe(e) {
528
+ if (!le()) return e(), () => {};
511
529
  let t = {
512
530
  start: e,
513
531
  cancelled: !1
514
532
  };
515
- return se.push(t), ue(), () => {
533
+ return ue.push(t), fe(), () => {
516
534
  t.cancelled = !0;
517
535
  };
518
536
  }
519
537
  //#endregion
520
538
  //#region src/thumbnail/lazyLoad.ts
521
- function de() {
522
- return oe() ? "96px 0px" : "280px 0px";
539
+ function me() {
540
+ return le() ? "96px 0px" : "280px 0px";
523
541
  }
524
- function fe(e) {
542
+ function he(e) {
525
543
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
526
544
  return Number.isFinite(n) ? Math.abs(n) : 280;
527
545
  }
528
- function pe(e, t) {
546
+ function ge(e, t) {
529
547
  if (typeof window > "u") return !1;
530
548
  let n = e.getBoundingClientRect();
531
549
  return n.bottom >= -t && n.top <= window.innerHeight + t;
532
550
  }
533
- function me(e, t) {
534
- let { onVisibleChange: n } = t, r = t.rootMargin ?? de(), i = fe(r), a = !1, o = !1, s = null, c = () => {
535
- o || (s?.(), s = G(() => {
551
+ function _e(e, t) {
552
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? me(), i = he(r), a = !1, o = !1, s = null, c = () => {
553
+ o || (s?.(), s = pe(() => {
536
554
  s = null, o = !0, n(!0);
537
555
  }));
538
556
  }, l = (e) => {
@@ -554,55 +572,55 @@ function me(e, t) {
554
572
  rootMargin: r,
555
573
  threshold: 0
556
574
  });
557
- return u.observe(e), pe(e, i) && l(!0), () => {
575
+ return u.observe(e), ge(e, i) && l(!0), () => {
558
576
  s?.(), s = null, u.disconnect();
559
577
  };
560
578
  }
561
579
  //#endregion
562
580
  //#region src/thumbnail/scrollParallax.ts
563
- function he() {
581
+ function ve() {
564
582
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
565
583
  }
566
- function K(e, t) {
584
+ function ye(e, t) {
567
585
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
568
586
  }
569
- var q = /* @__PURE__ */ new Set(), ge = !1, J = 0;
570
- function _e() {
571
- if (J = 0, q.size === 0 || typeof window > "u") return;
587
+ var G = /* @__PURE__ */ new Set(), be = !1, K = 0;
588
+ function xe() {
589
+ if (K = 0, G.size === 0 || typeof window > "u") return;
572
590
  let e = window.innerHeight;
573
- for (let t of q) {
591
+ for (let t of G) {
574
592
  if (t.pointerActive?.()) continue;
575
593
  let n = t.element.getBoundingClientRect();
576
- n.bottom < -64 || n.top > e + 64 || t.onParallax(K(n, e));
594
+ n.bottom < -64 || n.top > e + 64 || t.onParallax(ye(n, e));
577
595
  }
578
596
  }
579
- function ve() {
580
- J === 0 && (J = requestAnimationFrame(_e));
597
+ function Se() {
598
+ K === 0 && (K = requestAnimationFrame(xe));
581
599
  }
582
- function ye() {
583
- ge || typeof window > "u" || (ge = !0, window.addEventListener("scroll", ve, { passive: !0 }), window.addEventListener("resize", ve, { passive: !0 }));
600
+ function q() {
601
+ be || typeof window > "u" || (be = !0, window.addEventListener("scroll", Se, { passive: !0 }), window.addEventListener("resize", Se, { passive: !0 }));
584
602
  }
585
- function be() {
586
- q.size > 0 || !ge || typeof window > "u" || (ge = !1, J !== 0 && (cancelAnimationFrame(J), J = 0), window.removeEventListener("scroll", ve), window.removeEventListener("resize", ve));
603
+ function Ce() {
604
+ G.size > 0 || !be || typeof window > "u" || (be = !1, K !== 0 && (cancelAnimationFrame(K), K = 0), window.removeEventListener("scroll", Se), window.removeEventListener("resize", Se));
587
605
  }
588
- function xe(e, t) {
589
- if (!he()) return () => {};
606
+ function we(e, t) {
607
+ if (!ve()) return () => {};
590
608
  let n = {
591
609
  element: e,
592
610
  onParallax: t.onParallax,
593
611
  pointerActive: t.pointerActive
594
612
  };
595
- return q.add(n), ye(), n.pointerActive?.() || t.onParallax(K(e.getBoundingClientRect(), window.innerHeight)), () => {
596
- q.delete(n), be();
613
+ return G.add(n), q(), n.pointerActive?.() || t.onParallax(ye(e.getBoundingClientRect(), window.innerHeight)), () => {
614
+ G.delete(n), Ce();
597
615
  };
598
616
  }
599
617
  //#endregion
600
618
  //#region src/thumbnail/attachThumbnailParallax.ts
601
- function Se(e) {
619
+ function Te(e) {
602
620
  let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
603
621
  let a = r || i;
604
622
  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));
605
- }, s = xe(e, {
623
+ }, s = we(e, {
606
624
  onParallax: (e) => {
607
625
  i = !0, a || (t = e, n = 0, o());
608
626
  },
@@ -615,7 +633,7 @@ function Se(e) {
615
633
  a = !0, e.pointerType === "mouse" && (r = !0), o();
616
634
  }, u = () => {
617
635
  let s = a;
618
- a = !1, r = !1, i && s ? (t = K(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
636
+ a = !1, r = !1, i && s ? (t = ye(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
619
637
  }, d = (e) => {
620
638
  e.pointerType === "mouse" && (r = !0, o());
621
639
  }, f = () => {
@@ -627,23 +645,23 @@ function Se(e) {
627
645
  }
628
646
  //#endregion
629
647
  //#region src/thumbnail/styles.ts
630
- var Ce = ".liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: 50% 30%;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--scene .liforma-et__avatar {\n object-fit: contain;\n object-position: center bottom;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax:not(.liforma-et--scene) {\n --liforma-et-avatar-scale: 1.05;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", we = !1;
631
- function Te(e) {
632
- if (typeof document > "u" || we) return;
648
+ var Ee = ".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}", De = !1;
649
+ function Oe(e) {
650
+ if (typeof document > "u" || De) return;
633
651
  if (document.querySelector("style[data-liforma-et]")) {
634
- we = !0;
652
+ De = !0;
635
653
  return;
636
654
  }
637
655
  let t = document.createElement("style");
638
- t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), we = !0;
656
+ t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), De = !0;
639
657
  }
640
658
  //#endregion
641
659
  //#region src/react/ExperienceThumbnail.tsx
642
- function Y(e, t) {
660
+ function ke(e, t) {
643
661
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
644
662
  }
645
- function Ee(e) {
646
- 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, lazy: x = !0, className: S = "", fallbackImage: C } = e, w = a(() => te({
663
+ function Ae(e) {
664
+ 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: ee = "", fallbackImage: C } = e, w = a(() => z({
647
665
  galleryThumb: t,
648
666
  avatarImage: r,
649
667
  backgroundImage: i,
@@ -655,15 +673,15 @@ function Ee(e) {
655
673
  i,
656
674
  c,
657
675
  C
658
- ]), T = ne({
676
+ ]), T = oe({
659
677
  href: m,
660
678
  hasClickHandler: typeof _ == "function",
661
679
  experienceId: p
662
- }), E = T === "anchor" && !m?.trim() && !!p?.trim(), D = !!w?.backgroundImage, O = b !== !1, k = o(null), A = o(!1), [j, M] = s(!x), [N, P] = s(!1), [F, I] = s(!1), [ee, L] = s(0), [R, z] = s(0), [B, V] = s(!1), [H, U] = s(!1), [re, ie] = s(!1), [oe, W] = s(!1), [se, ce] = s(), le = w ? B && w.fallbackImage ? w.fallbackImage : w.avatarImage : "";
680
+ }), E = T === "anchor" && !m?.trim() && !!p?.trim(), D = !!w?.backgroundImage, O = b !== !1, k = o(null), A = o(!1), [j, M] = s(!S), [N, P] = s(!1), [F, te] = s(!1), [ne, I] = s(0), [ie, L] = s(0), [R, B] = s(!1), [V, ae] = s(!1), [se, ce] = s(!1), [le, U] = s(!1), [ue, de] = s(), W = w ? R && w.fallbackImage ? w.fallbackImage : w.avatarImage : "";
663
681
  n(() => {
664
- Te(Ce);
682
+ Oe(Ee);
665
683
  }, []), n(() => {
666
- ce(ae({
684
+ de(H({
667
685
  href: m,
668
686
  experienceId: p,
669
687
  returnUrl: v,
@@ -677,32 +695,32 @@ function Ee(e) {
677
695
  y,
678
696
  E
679
697
  ]), n(() => {
680
- U(!1), ie(!1), W(!1), V(!1);
698
+ ae(!1), ce(!1), U(!1), B(!1);
681
699
  }, [
682
700
  w?.backgroundImage,
683
701
  w?.foregroundImage,
684
- le
702
+ W
685
703
  ]), n(() => {
686
704
  let e = k.current;
687
705
  if (e) {
688
- if (!x) {
706
+ if (!S) {
689
707
  M(!0);
690
708
  return;
691
709
  }
692
- return me(e, { onVisibleChange: (e) => {
710
+ return _e(e, { onVisibleChange: (e) => {
693
711
  e && M(!0);
694
712
  } });
695
713
  }
696
714
  }, [
697
- x,
715
+ S,
698
716
  w,
699
717
  T,
700
- se
718
+ ue
701
719
  ]), n(() => {
702
720
  let e = k.current;
703
- if (!(!e || !O)) return xe(e, {
721
+ if (!(!e || !O)) return we(e, {
704
722
  onParallax: (e) => {
705
- I(!0), A.current || (L(e), z(0));
723
+ te(!0), A.current || (I(e), L(0));
706
724
  },
707
725
  pointerActive: () => A.current
708
726
  });
@@ -710,25 +728,25 @@ function Ee(e) {
710
728
  O,
711
729
  w,
712
730
  T,
713
- se
731
+ ue
714
732
  ]);
715
- let ue = (e) => {
733
+ let fe = (e) => {
716
734
  if (!O || F) return;
717
735
  let t = e.currentTarget.getBoundingClientRect();
718
- t.width <= 0 || t.height <= 0 || (L(((e.clientX - t.left) / t.width - .5) * 2), z(((e.clientY - t.top) / t.height - .5) * 2));
719
- }, G = (e) => {
736
+ t.width <= 0 || t.height <= 0 || (I(((e.clientX - t.left) / t.width - .5) * 2), L(((e.clientY - t.top) / t.height - .5) * 2));
737
+ }, pe = (e) => {
720
738
  let t = A.current;
721
- A.current = !1, P(!1), F && t ? (L(K(e.getBoundingClientRect(), window.innerHeight)), z(0)) : F || (L(0), z(0));
722
- }, de = (e) => {
739
+ A.current = !1, P(!1), F && t ? (I(ye(e.getBoundingClientRect(), window.innerHeight)), L(0)) : F || (I(0), L(0));
740
+ }, me = (e) => {
723
741
  if (!O) return;
724
742
  A.current = !0, e.pointerType === "mouse" && P(!0);
725
743
  let t = e.currentTarget, n = () => {
726
- G(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
744
+ pe(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
727
745
  };
728
746
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
729
- }, fe = (e) => {
747
+ }, he = (e) => {
730
748
  if (_?.(e), !e.defaultPrevented && E && !v?.trim()) {
731
- let t = ae({
749
+ let t = H({
732
750
  experienceId: p,
733
751
  playerBaseUrl: y,
734
752
  useCurrentPageAsReturnUrl: !0
@@ -737,133 +755,134 @@ function Ee(e) {
737
755
  }
738
756
  };
739
757
  if (!w) return null;
740
- let pe = O && (N || F), he = j && (re || H || oe), q = [
758
+ let ge = O && (N || F), ve = j && (se || V || le), G = [
741
759
  "liforma-et",
742
760
  D ? "liforma-et--scene" : "",
743
- pe ? "liforma-et--parallax" : "",
761
+ re(x),
762
+ ge ? "liforma-et--parallax" : "",
744
763
  F ? "liforma-et--scroll-parallax" : "",
745
- j && !he ? "liforma-et--loading" : "",
746
- he ? "liforma-et--revealed" : "",
747
- S
748
- ].filter(Boolean).join(" "), ge = {
749
- "--liforma-et-parallax-x": ee,
750
- "--liforma-et-parallax-y": R
751
- }, J = (e, t) => {
764
+ j && !ve ? "liforma-et--loading" : "",
765
+ ve ? "liforma-et--revealed" : "",
766
+ ee
767
+ ].filter(Boolean).join(" "), be = {
768
+ "--liforma-et-parallax-x": ne,
769
+ "--liforma-et-parallax-y": ie
770
+ }, K = (e, t) => {
752
771
  e.complete && t(!0);
753
- }, _e = /* @__PURE__ */ f(u, { children: [
772
+ }, xe = /* @__PURE__ */ f(u, { children: [
754
773
  /* @__PURE__ */ d("span", {
755
774
  className: "liforma-et__placeholder",
756
775
  "aria-hidden": "true"
757
776
  }),
758
777
  j && w.backgroundImage ? /* @__PURE__ */ d("img", {
759
- className: Y("liforma-et__background", H),
778
+ className: ke("liforma-et__background", V),
760
779
  src: w.backgroundImage,
761
780
  alt: "",
762
781
  decoding: "async",
763
782
  ref: (e) => {
764
- e && J(e, U);
783
+ e && K(e, ae);
765
784
  },
766
- onLoad: () => U(!0),
767
- onError: () => U(!0)
785
+ onLoad: () => ae(!0),
786
+ onError: () => ae(!0)
768
787
  }) : null,
769
- j && le ? /* @__PURE__ */ d("img", {
770
- className: Y("liforma-et__avatar", re),
771
- src: le,
788
+ j && W ? /* @__PURE__ */ d("img", {
789
+ className: ke("liforma-et__avatar", se),
790
+ src: W,
772
791
  alt: "",
773
792
  decoding: "async",
774
793
  ref: (e) => {
775
- e && J(e, ie);
794
+ e && K(e, ce);
776
795
  },
777
- onLoad: () => ie(!0),
796
+ onLoad: () => ce(!0),
778
797
  onError: () => {
779
- w.fallbackImage ? V(!0) : ie(!0);
798
+ w.fallbackImage ? B(!0) : ce(!0);
780
799
  }
781
800
  }) : null,
782
801
  j && w.foregroundImage ? /* @__PURE__ */ d("img", {
783
- className: Y("liforma-et__foreground", oe),
802
+ className: ke("liforma-et__foreground", le),
784
803
  src: w.foregroundImage,
785
804
  alt: "",
786
805
  decoding: "async",
787
806
  ref: (e) => {
788
- e && J(e, W);
807
+ e && K(e, U);
789
808
  },
790
- onLoad: () => W(!0),
791
- onError: () => W(!0)
809
+ onLoad: () => U(!0),
810
+ onError: () => U(!0)
792
811
  }) : null
793
- ] }), ve = {
794
- onPointerDown: de,
795
- onPointerUp: (e) => G(e.currentTarget),
796
- onPointerCancel: (e) => G(e.currentTarget),
812
+ ] }), Se = {
813
+ onPointerDown: me,
814
+ onPointerUp: (e) => pe(e.currentTarget),
815
+ onPointerCancel: (e) => pe(e.currentTarget),
797
816
  onPointerEnter: (e) => {
798
817
  O && e.pointerType === "mouse" && P(!0);
799
818
  },
800
- onPointerMove: ue,
819
+ onPointerMove: fe,
801
820
  onPointerLeave: () => {
802
- A.current || (P(!1), F || (L(0), z(0)));
821
+ A.current || (P(!1), F || (I(0), L(0)));
803
822
  }
804
- }, ye = (e) => {
823
+ }, q = (e) => {
805
824
  k.current = e;
806
825
  };
807
- return T === "anchor" && se ? /* @__PURE__ */ d("a", {
808
- ref: ye,
809
- className: q,
810
- style: ge,
811
- href: se,
826
+ return T === "anchor" && ue ? /* @__PURE__ */ d("a", {
827
+ ref: q,
828
+ className: G,
829
+ style: be,
830
+ href: ue,
812
831
  target: h,
813
832
  rel: g,
814
833
  "aria-label": l,
815
- onClick: fe,
816
- ...ve,
817
- children: _e
834
+ onClick: he,
835
+ ...Se,
836
+ children: xe
818
837
  }) : T === "button" ? /* @__PURE__ */ d("button", {
819
838
  type: "button",
820
- ref: ye,
821
- className: q,
822
- style: ge,
839
+ ref: q,
840
+ className: G,
841
+ style: be,
823
842
  "aria-label": l,
824
- onClick: fe,
825
- ...ve,
826
- children: _e
843
+ onClick: he,
844
+ ...Se,
845
+ children: xe
827
846
  }) : /* @__PURE__ */ d("div", {
828
- ref: ye,
829
- className: q,
830
- style: ge,
847
+ ref: q,
848
+ className: G,
849
+ style: be,
831
850
  role: l ? "img" : void 0,
832
851
  "aria-label": l || void 0,
833
852
  "aria-hidden": l ? void 0 : !0,
834
- ...ve,
835
- children: _e
853
+ ...Se,
854
+ children: xe
836
855
  });
837
856
  }
838
857
  //#endregion
839
858
  //#region src/widget/styles.ts
840
- var De = "\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", Oe = "liforma-experience-widget-styles";
841
- function ke(e = De) {
859
+ var je = "\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", Me = "liforma-experience-widget-styles";
860
+ function Ne(e = je) {
842
861
  if (typeof document > "u") return;
843
- let t = document.getElementById(Oe);
862
+ let t = document.getElementById(Me);
844
863
  if (t) {
845
864
  t.textContent = e;
846
865
  return;
847
866
  }
848
867
  let n = document.createElement("style");
849
- n.id = Oe, n.textContent = e, document.head.append(n);
868
+ n.id = Me, n.textContent = e, document.head.append(n);
850
869
  }
851
870
  //#endregion
852
871
  //#region src/shims/apiBaseUrl.ts
853
- var Ae = "https://api.liforma.ai", je = "http://localhost:3001";
854
- function Me() {
872
+ var Pe = "https://api.liforma.ai", Fe = "http://localhost:3001";
873
+ function Ie() {
855
874
  let e = globalThis.__LIFORMA_API_BASE_URL;
856
875
  if (e?.trim()) return e.trim().replace(/\/$/, "");
857
876
  if (typeof document > "u") return null;
858
877
  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();
859
878
  return t ? t.replace(/\/$/, "") : null;
860
879
  }
861
- function Ne() {
862
- return Me() || (V() ? je : Ae);
880
+ function Le() {
881
+ return Ie() || (B() ? Fe : Pe);
863
882
  }
864
883
  //#endregion
865
884
  //#region src/v2/api/fetchExperiencePreview.ts
866
- function Pe(e) {
885
+ function Re(e) {
867
886
  if (!e || typeof e != "object") return null;
868
887
  let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
869
888
  return n ? {
@@ -872,10 +891,10 @@ function Pe(e) {
872
891
  ...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
873
892
  } : null;
874
893
  }
875
- async function Fe(e, t) {
894
+ async function ze(e, t) {
876
895
  let n = e.trim();
877
896
  if (!n) throw Error("Experience preview requires experienceId.");
878
- let r = (t?.apiBaseUrl ?? Ne()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
897
+ let r = (t?.apiBaseUrl ?? Le()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
879
898
  method: "GET",
880
899
  headers: { Accept: "application/json" },
881
900
  signal: t?.signal
@@ -895,7 +914,7 @@ async function Fe(e, t) {
895
914
  throw Error("Experience preview returned invalid JSON.");
896
915
  }
897
916
  if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
898
- let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Pe(o.galleryThumb);
917
+ let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Re(o.galleryThumb);
899
918
  if (!l) throw Error("Experience preview is missing gallery thumb images.");
900
919
  return {
901
920
  experienceId: s || n,
@@ -904,20 +923,47 @@ async function Fe(e, t) {
904
923
  };
905
924
  }
906
925
  //#endregion
926
+ //#region src/v2/errors/LiformaError.ts
927
+ var J = class extends Error {
928
+ code;
929
+ requestId;
930
+ status;
931
+ details;
932
+ constructor(e, t) {
933
+ 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;
934
+ }
935
+ };
936
+ function Be(e) {
937
+ if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
938
+ }
939
+ function Ve(e, t, n) {
940
+ let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
941
+ try {
942
+ i = JSON.parse(t);
943
+ } catch {}
944
+ let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = Be(a) ?? Be(i) ?? {};
945
+ return new J(u, {
946
+ code: l,
947
+ requestId: d,
948
+ status: e,
949
+ details: Object.keys(h).length > 0 ? h : void 0
950
+ });
951
+ }
952
+ //#endregion
907
953
  //#region src/v2/api/sessionEndpointRequest.ts
908
- function Ie(e) {
954
+ function He(e) {
909
955
  let t = e.locale?.trim();
910
956
  if (t) return t;
911
957
  let n = e.language?.trim();
912
958
  if (n) return n;
913
959
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
914
960
  }
915
- function Le(e) {
961
+ function Ue(e) {
916
962
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
917
963
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
918
964
  return t || n || void 0;
919
965
  }
920
- function Re(e, t) {
966
+ function We(e, t) {
921
967
  let n = e.trim();
922
968
  if (!n) throw Error("sessionEndpoint must not be empty.");
923
969
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -925,7 +971,7 @@ function Re(e, t) {
925
971
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
926
972
  let i = t.experienceId.trim();
927
973
  if (!i) throw Error("sessionEndpoint requires experienceId.");
928
- let a = Ie(t), o = Le(t);
974
+ let a = He(t), o = Ue(t), s = t.idempotencyKey?.trim();
929
975
  return {
930
976
  url: r.toString(),
931
977
  init: {
@@ -933,14 +979,14 @@ function Re(e, t) {
933
979
  credentials: "same-origin",
934
980
  headers: {
935
981
  Accept: "application/json",
936
- "Content-Type": "application/json"
982
+ "Content-Type": "application/json",
983
+ ...s ? { "Idempotency-Key": s } : {}
937
984
  },
938
985
  body: JSON.stringify({
939
986
  experienceId: i,
940
987
  ...a ? { locale: a } : {},
941
988
  ...o ? { secondaryLocale: o } : {},
942
989
  ...t.mode ? { mode: t.mode } : {},
943
- ...t.responseMode ? { responseMode: t.responseMode } : {},
944
990
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
945
991
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly }
946
992
  })
@@ -949,24 +995,44 @@ function Re(e, t) {
949
995
  }
950
996
  //#endregion
951
997
  //#region src/v2/types/sessionLaunch.ts
952
- function ze(e) {
998
+ function Y(e) {
953
999
  return !!e && typeof e == "object" && !Array.isArray(e);
954
1000
  }
955
- function Be(e) {
1001
+ function X(e) {
956
1002
  return typeof e == "boolean";
957
1003
  }
958
- function Ve(e) {
959
- return !ze(e) || !Be(e.avatar) || !Be(e.speechInput) || !Be(e.speechOutput) || !Be(e.tools) || !Be(e.externalAudio) ? null : {
960
- avatar: e.avatar,
961
- speechInput: e.speechInput,
962
- speechOutput: e.speechOutput,
963
- tools: e.tools,
964
- externalAudio: e.externalAudio
1004
+ function Ge(e) {
1005
+ if (!Y(e)) return null;
1006
+ let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
1007
+ return !Y(t) || !Y(n) || !Y(r) || !Y(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
1008
+ speech: {
1009
+ input: t.input,
1010
+ output: t.output,
1011
+ externalAudio: t.externalAudio
1012
+ },
1013
+ conversation: { managed: n.managed },
1014
+ avatar: { enabled: r.enabled },
1015
+ tools: { enabled: i.enabled }
965
1016
  };
966
1017
  }
967
- function He(e) {
968
- if (!ze(e)) throw Error("Session Launch response is missing session.");
969
- 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 = Ve(e.capabilities);
1018
+ function Ke(e) {
1019
+ return !Y(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
1020
+ speech: {
1021
+ input: e.speechInput,
1022
+ output: e.speechOutput,
1023
+ externalAudio: e.externalAudio
1024
+ },
1025
+ conversation: { managed: !0 },
1026
+ avatar: { enabled: e.avatar },
1027
+ tools: { enabled: e.tools }
1028
+ };
1029
+ }
1030
+ function qe(e) {
1031
+ return Ge(e) ?? Ke(e);
1032
+ }
1033
+ function Je(e) {
1034
+ if (!Y(e)) throw Error("Session Launch response is missing session.");
1035
+ let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = qe(e.capabilities), l = Ye(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;
970
1036
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
971
1037
  return {
972
1038
  id: t,
@@ -976,76 +1042,123 @@ function He(e) {
976
1042
  locale: a,
977
1043
  ...o ? { secondaryLocale: o } : {},
978
1044
  mode: s,
979
- capabilities: c
1045
+ capabilities: c,
1046
+ ...l ? { localeVoiceFallbacks: l } : {},
1047
+ ...u ? { status: u } : {},
1048
+ ...d ? { createdAt: d } : {}
980
1049
  };
981
1050
  }
982
- function Ue(e) {
983
- if (!ze(e)) throw Error("Session Launch response must be a JSON object.");
1051
+ function Ye(e) {
1052
+ if (!Array.isArray(e) || e.length === 0) return;
1053
+ let t = [];
1054
+ for (let n of e) {
1055
+ if (!Y(n)) continue;
1056
+ 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() : "";
1057
+ !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
1058
+ axis: e,
1059
+ requested: r,
1060
+ resolved: i,
1061
+ reason: "voice_unsupported"
1062
+ });
1063
+ }
1064
+ return t.length > 0 ? t : void 0;
1065
+ }
1066
+ function Xe(e) {
1067
+ let t = e.localeVoiceFallbacks;
1068
+ if (t?.length) for (let e of t) {
1069
+ let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
1070
+ console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
1071
+ }
1072
+ }
1073
+ function Ze(e) {
1074
+ if (!Y(e)) throw Error("Session Launch response must be a JSON object.");
984
1075
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
985
1076
  if (!t) throw Error("Session Launch response is missing launch.");
986
- return {
987
- session: He(e.session),
1077
+ let n = Je(e.session);
1078
+ return Xe(n), {
1079
+ session: n,
988
1080
  launch: t
989
1081
  };
990
1082
  }
991
1083
  //#endregion
992
1084
  //#region src/v2/api/mintPublicSession.ts
993
- function We() {
1085
+ function Qe() {
994
1086
  try {
995
1087
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
996
1088
  } catch {}
997
1089
  }
998
- function Ge(e, t, n) {
999
- let r;
1000
- try {
1001
- r = JSON.parse(n);
1002
- } catch {}
1003
- let i = We(), a = r?.message?.trim(), o = r?.code;
1004
- if (o === "origin_not_allowed" || /^Origin not allowed/i.test(a ?? "") && i) {
1005
- if (a && a.includes(e) && a.includes("allowed origin")) return a;
1006
- let t = r?.origin ?? i ?? "(unknown origin)";
1007
- return `Your origin ${t} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${t} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`;
1090
+ function $e(e) {
1091
+ return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
1092
+ }
1093
+ function et(e, t) {
1094
+ let n = Qe(), r = $e(t.code), i = t.message.trim(), a = t.details ?? {};
1095
+ if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
1096
+ if (i.includes(e) && i.includes("allowed origin")) return t;
1097
+ let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
1098
+ return new J(`Your origin ${r} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${r} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`, {
1099
+ code: "ORIGIN_NOT_ALLOWED",
1100
+ requestId: t.requestId,
1101
+ status: t.status,
1102
+ details: a
1103
+ });
1008
1104
  }
1009
- return o === "browser_embeds_disabled" || /^Browser embeds are not enabled/i.test(a ?? "") ? a && a.includes("Allow public client-only embeds") ? a : `Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.` : o === "experience_unavailable" || /^Experience is not available\.?$/i.test(a ?? "") || /^Unknown experience\.?$/i.test(a ?? "") ? a && a.includes("No playable experience found") ? a : `No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.` : a || n.trim().slice(0, 500) || `Browser session mint failed (${t})`;
1105
+ return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new J(`Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.`, {
1106
+ code: "BROWSER_EMBEDS_DISABLED",
1107
+ requestId: t.requestId,
1108
+ status: t.status,
1109
+ details: a
1110
+ }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new J(`No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.`, {
1111
+ code: "EXPERIENCE_UNAVAILABLE",
1112
+ requestId: t.requestId,
1113
+ status: t.status,
1114
+ details: a
1115
+ }) : t;
1010
1116
  }
1011
- function Ke(e) {
1117
+ function tt(e) {
1012
1118
  let t = e?.locale?.trim();
1013
1119
  if (t) return t;
1014
1120
  let n = e?.language?.trim();
1015
1121
  if (n) return n;
1016
1122
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
1017
1123
  }
1018
- function qe(e) {
1124
+ function nt(e) {
1019
1125
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
1020
- if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
1126
+ if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
1021
1127
  return t || n || void 0;
1022
1128
  }
1023
- function Je(e, t) {
1024
- let n = { experienceId: e }, r = Ke(t);
1129
+ function rt(e, t) {
1130
+ let n = { experienceId: e }, r = tt(t);
1025
1131
  r && (n.locale = r);
1026
- let i = qe(t);
1027
- return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.responseMode && (n.responseMode = t.responseMode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
1132
+ let i = nt(t);
1133
+ return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
1028
1134
  }
1029
- async function Ye(e, t) {
1030
- let n = Ne(), r = await fetch(`${n}/v1/browser-sessions`, {
1135
+ async function it(e, t) {
1136
+ let n = Le(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
1031
1137
  method: "POST",
1032
- headers: { "Content-Type": "application/json" },
1033
- body: JSON.stringify(Je(e, t))
1138
+ headers: {
1139
+ "Content-Type": "application/json",
1140
+ ...r ? { "Idempotency-Key": r } : {}
1141
+ },
1142
+ body: JSON.stringify(rt(e, t))
1034
1143
  });
1035
- if (!r.ok) {
1036
- let t = await r.text();
1037
- throw Error(Ge(e, r.status, t));
1144
+ if (!i.ok) {
1145
+ let t = await i.text();
1146
+ throw et(e, Ve(i.status, t, i.headers));
1038
1147
  }
1039
- let i;
1148
+ let a;
1040
1149
  try {
1041
- i = await r.json();
1150
+ a = await i.json();
1042
1151
  } catch {
1043
- throw Error("Browser session mint returned invalid JSON.");
1152
+ throw new J("Browser session mint returned invalid JSON.", {
1153
+ code: "INVALID_RESPONSE",
1154
+ status: i.status,
1155
+ requestId: i.headers.get("Liforma-Request-Id") ?? void 0
1156
+ });
1044
1157
  }
1045
- return Ue(i);
1158
+ return Ze(a);
1046
1159
  }
1047
- async function Xe(e, t) {
1048
- let n = Re(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1160
+ async function at(e, t) {
1161
+ let n = We(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1049
1162
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
1050
1163
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
1051
1164
  try {
@@ -1057,28 +1170,32 @@ async function Xe(e, t) {
1057
1170
  globalThis.clearTimeout(a), t.signal?.removeEventListener("abort", i);
1058
1171
  }
1059
1172
  if (!o.ok) {
1060
- let e = await o.text(), t = e.slice(0, 500) || `Session endpoint failed (${o.status})`;
1061
- try {
1062
- let n = JSON.parse(e);
1063
- n.message && (t = n.message);
1064
- } catch {}
1065
- throw Error(t);
1173
+ let e = await o.text();
1174
+ throw Ve(o.status, e, o.headers);
1066
1175
  }
1067
- if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw Error("Session endpoint must return a JSON Session Launch response.");
1176
+ if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
1177
+ code: "INVALID_RESPONSE",
1178
+ status: o.status,
1179
+ requestId: o.headers.get("Liforma-Request-Id") ?? void 0
1180
+ });
1068
1181
  let s;
1069
1182
  try {
1070
1183
  s = await o.json();
1071
1184
  } catch {
1072
- throw Error("Session endpoint returned invalid JSON.");
1185
+ throw new J("Session endpoint returned invalid JSON.", {
1186
+ code: "INVALID_RESPONSE",
1187
+ status: o.status,
1188
+ requestId: o.headers.get("Liforma-Request-Id") ?? void 0
1189
+ });
1073
1190
  }
1074
- return Ue(s);
1191
+ return Ze(s);
1075
1192
  }
1076
1193
  //#endregion
1077
1194
  //#region src/v2/conversationProcessor.ts
1078
- function Ze(e) {
1195
+ function ot(e) {
1079
1196
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
1080
1197
  }
1081
- function Qe(e) {
1198
+ function st(e) {
1082
1199
  if (typeof e == "string") {
1083
1200
  let t = e.trim();
1084
1201
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -1092,24 +1209,24 @@ function Qe(e) {
1092
1209
  ...e.behavior ? { behavior: e.behavior } : {}
1093
1210
  };
1094
1211
  }
1095
- async function $e(e, t) {
1212
+ async function ct(e, t) {
1096
1213
  let n = await e(t);
1097
- return Ze(n) ? {
1214
+ return ot(n) ? {
1098
1215
  kind: "stream",
1099
1216
  stream: n
1100
1217
  } : {
1101
1218
  kind: "complete",
1102
- speech: Qe(n)
1219
+ speech: st(n)
1103
1220
  };
1104
1221
  }
1105
1222
  //#endregion
1106
1223
  //#region src/v2/embed/playerReachability.ts
1107
- var et = "3002";
1108
- function tt(e) {
1224
+ var lt = "3002";
1225
+ function ut(e) {
1109
1226
  let t = new URL(e);
1110
- 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 || et}. 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.`;
1227
+ 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 || lt}. 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.`;
1111
1228
  }
1112
- async function nt(e, t) {
1229
+ async function dt(e, t) {
1113
1230
  try {
1114
1231
  await fetch(e, {
1115
1232
  method: "GET",
@@ -1117,35 +1234,39 @@ async function nt(e, t) {
1117
1234
  signal: AbortSignal.timeout(8e3)
1118
1235
  });
1119
1236
  } catch {
1120
- throw Error(tt(t));
1237
+ throw Error(ut(t));
1121
1238
  }
1122
1239
  }
1123
- function rt(e, t, n, r) {
1240
+ function ft(e, t, n, r) {
1124
1241
  try {
1125
1242
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
1126
1243
  } catch (e) {
1127
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(tt(n), { cause: e }) : e;
1244
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(ut(n), { cause: e }) : e;
1128
1245
  }
1129
1246
  }
1130
- var it = new Set([1, 2]);
1131
- function at(e) {
1132
- return typeof e == "number" && it.has(e);
1247
+ var pt = new Set([1, 2]);
1248
+ function mt(e) {
1249
+ return typeof e == "number" && pt.has(e);
1133
1250
  }
1134
- var ot = new Set([
1251
+ var ht = new Set([
1135
1252
  "close",
1136
1253
  "stateUpdate",
1137
1254
  "commandResult",
1138
1255
  "userTranscript",
1139
1256
  "characterSpeechStarted",
1140
1257
  "characterSpeechEnded",
1258
+ "characterFocusChanged",
1141
1259
  "conversationUpdate",
1142
1260
  "listeningState",
1143
1261
  "userSpeechStarted",
1144
1262
  "userSpeechEnded",
1145
1263
  "modeChange",
1146
1264
  "activityChange",
1265
+ "feedback",
1266
+ "feedbackFailed",
1147
1267
  "message",
1148
1268
  "started",
1269
+ "embedReady",
1149
1270
  "widgetReady",
1150
1271
  "widgetExpand",
1151
1272
  "widgetCollapse",
@@ -1154,11 +1275,11 @@ var ot = new Set([
1154
1275
  "widgetDragMove",
1155
1276
  "widgetDragEnd"
1156
1277
  ]);
1157
- function st(e) {
1278
+ function gt(e) {
1158
1279
  if (!e || typeof e != "object") return null;
1159
1280
  let t = e;
1160
- if (!at(t.schemaVersion) || !t.type || !ot.has(t.type)) return null;
1161
- if (t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
1281
+ if (!mt(t.schemaVersion) || !t.type || !ht.has(t.type)) return null;
1282
+ if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
1162
1283
  if (t.type === "widgetAudioSettings") {
1163
1284
  let e = t.payload;
1164
1285
  return !e || typeof e != "object" || typeof e.open != "boolean" ? null : t;
@@ -1173,35 +1294,38 @@ function st(e) {
1173
1294
  let { pointerId: n, dx: r, dy: i } = e;
1174
1295
  return typeof n != "number" || !Number.isFinite(n) || typeof r != "number" || !Number.isFinite(r) || typeof i != "number" || !Number.isFinite(i) ? null : t;
1175
1296
  }
1176
- return !t.payload || typeof t.payload != "object" ? null : t;
1297
+ let n = t.payload;
1298
+ return !n || typeof n != "object" ? null : t;
1177
1299
  }
1178
- function ct(e, t, n) {
1300
+ function _t(e, t, n) {
1179
1301
  let r = e.trim();
1180
1302
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
1303
+ let i = n?.startButton, a = n?.showFeedback;
1181
1304
  return {
1182
1305
  type: "launch",
1183
1306
  schemaVersion: 2,
1184
1307
  payload: {
1185
1308
  launch: r,
1186
1309
  ...t === void 0 ? {} : { session: t },
1187
- ...n ? { startButton: n } : {}
1310
+ ...i ? { startButton: i } : {},
1311
+ ...a === void 0 ? {} : { showFeedback: a }
1188
1312
  }
1189
1313
  };
1190
1314
  }
1191
- function lt() {
1315
+ function vt() {
1192
1316
  return {
1193
1317
  type: "parentHello",
1194
1318
  schemaVersion: 2
1195
1319
  };
1196
1320
  }
1197
- function ut(e) {
1321
+ function yt(e) {
1198
1322
  return {
1199
1323
  type: "widgetSetChrome",
1200
1324
  schemaVersion: 2,
1201
1325
  payload: { mode: e }
1202
1326
  };
1203
1327
  }
1204
- function dt() {
1328
+ function bt() {
1205
1329
  return {
1206
1330
  type: "widgetToggleAudioSettings",
1207
1331
  schemaVersion: 2,
@@ -1210,30 +1334,50 @@ function dt() {
1210
1334
  }
1211
1335
  //#endregion
1212
1336
  //#region src/v2/embed/iframeHost.ts
1213
- function ft(e) {
1337
+ function xt(e) {
1214
1338
  return e;
1215
1339
  }
1216
- function X() {
1340
+ function Z() {
1217
1341
  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)}`;
1218
1342
  }
1219
- var pt = 3e4;
1220
- function mt(e) {
1343
+ var St = 3e4;
1344
+ function Ct(e) {
1221
1345
  let t = e.container;
1222
1346
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
1223
1347
  let n = document.createElement("iframe");
1224
1348
  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");
1225
- let r = !1, i = /* @__PURE__ */ new Map(), a = new Promise((t, r) => {
1226
- let i = () => {
1227
- o(), nt(e.src, e.playerOrigin).then(t, r);
1228
- }, a = () => {
1229
- o(), r(Error(tt(e.playerOrigin)));
1230
- }, o = () => {
1231
- n.removeEventListener("load", i), n.removeEventListener("error", a);
1349
+ let r = !1, i = /* @__PURE__ */ new Map(), a = null, o = 0, s = 0, c = [], l = null, u = null, d = new Promise((e, t) => {
1350
+ l = e, u = t;
1351
+ }), f = () => {
1352
+ for (let e of c) window.clearTimeout(e);
1353
+ c.length = 0;
1354
+ }, p = (t) => {
1355
+ if (r) return;
1356
+ let i = Date.now();
1357
+ if (s > 0 && i - s < 250) return;
1358
+ s = i, f();
1359
+ let a = _t(t.launch, t.session, t.chrome), o = () => {
1360
+ if (r) return;
1361
+ let t = n.contentWindow;
1362
+ t && ft(t, a, e.playerOrigin);
1232
1363
  };
1233
- n.addEventListener("load", i), n.addEventListener("error", a);
1234
- }), o = (t) => {
1364
+ o();
1365
+ for (let e = 1; e <= 12; e += 1) c.push(window.setTimeout(o, e * 75));
1366
+ }, m = () => {
1367
+ r || !a || p(a);
1368
+ }, h = () => {
1369
+ if (o += 1, o === 1) {
1370
+ dt(e.src, e.playerOrigin).then(() => l?.(), (e) => u?.(e instanceof Error ? e : Error(String(e))));
1371
+ return;
1372
+ }
1373
+ s = 0, m();
1374
+ }, g = () => {
1375
+ o > 0 || u?.(Error(ut(e.playerOrigin)));
1376
+ };
1377
+ n.addEventListener("load", h), n.addEventListener("error", g);
1378
+ let _ = (t) => {
1235
1379
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
1236
- let a = st(t.data);
1380
+ let a = gt(t.data);
1237
1381
  if (a) switch (a.type) {
1238
1382
  case "close":
1239
1383
  e.onClose?.(a.payload);
@@ -1256,6 +1400,9 @@ function mt(e) {
1256
1400
  case "characterSpeechEnded":
1257
1401
  e.onCharacterSpeechEnded?.(a.payload);
1258
1402
  break;
1403
+ case "characterFocusChanged":
1404
+ e.onCharacterFocusChanged?.(a.payload);
1405
+ break;
1259
1406
  case "conversationUpdate":
1260
1407
  e.onConversationUpdate?.(a.payload.conversation);
1261
1408
  break;
@@ -1269,10 +1416,16 @@ function mt(e) {
1269
1416
  e.onUserSpeechEnded?.(a.payload);
1270
1417
  break;
1271
1418
  case "modeChange":
1272
- e.onActivityChange?.(ft(a.payload.mode)), e.onModeChange?.(a.payload.mode);
1419
+ e.onActivityChange?.(xt(a.payload.mode));
1273
1420
  break;
1274
1421
  case "activityChange":
1275
- e.onActivityChange?.(a.payload.activity), (a.payload.activity === "listening" || a.payload.activity === "thinking" || a.payload.activity === "speaking") && e.onModeChange?.(a.payload.activity);
1422
+ e.onActivityChange?.(a.payload.activity);
1423
+ break;
1424
+ case "feedback":
1425
+ e.onFeedback?.(a.payload);
1426
+ break;
1427
+ case "feedbackFailed":
1428
+ e.onFeedbackFailed?.(a.payload);
1276
1429
  break;
1277
1430
  case "message":
1278
1431
  e.onMessage?.(a.payload);
@@ -1280,6 +1433,9 @@ function mt(e) {
1280
1433
  case "started":
1281
1434
  e.onStarted?.(a.payload);
1282
1435
  break;
1436
+ case "embedReady":
1437
+ m();
1438
+ break;
1283
1439
  case "widgetReady":
1284
1440
  e.onWidgetReady?.();
1285
1441
  break;
@@ -1303,42 +1459,39 @@ function mt(e) {
1303
1459
  break;
1304
1460
  }
1305
1461
  };
1306
- if (window.addEventListener("message", o), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
1462
+ if (window.addEventListener("message", _), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
1307
1463
  let e = getComputedStyle(t).minHeight;
1308
1464
  (e === "0px" || e === "auto") && (t.style.minHeight = "480px");
1309
1465
  }
1310
- let s = (t, i) => {
1466
+ let v = (t, i) => {
1311
1467
  if (r) return;
1312
1468
  let a = n.contentWindow;
1313
- if (!a) throw Error(tt(e.playerOrigin));
1314
- rt(a, t, e.playerOrigin, i);
1315
- }, c = (e, t = 12e4, n) => {
1316
- let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : X();
1469
+ if (!a) throw Error(ut(e.playerOrigin));
1470
+ ft(a, t, e.playerOrigin, i);
1471
+ }, y = (e, t = 12e4, n) => {
1472
+ let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
1317
1473
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((a, o) => {
1318
1474
  i.set(r, {
1319
1475
  resolve: (e) => a(e),
1320
1476
  reject: o
1321
- }), s(e, n), setTimeout(() => {
1477
+ }), v(e, n), setTimeout(() => {
1322
1478
  i.has(r) && (i.delete(r), o(/* @__PURE__ */ Error("Timed out waiting for player command result.")));
1323
1479
  }, t);
1324
1480
  });
1325
1481
  };
1326
1482
  return {
1327
1483
  waitForLoad() {
1328
- return a;
1484
+ return d;
1329
1485
  },
1330
1486
  postParentHello() {
1331
- s(lt());
1487
+ v(vt());
1332
1488
  },
1333
- postLaunch(t, i, a) {
1334
- if (r) return;
1335
- let o = n.contentWindow;
1336
- if (!o) throw Error("Liforma embed iframe is not ready.");
1337
- let s = ct(t, i, a), c = () => {
1338
- r || rt(o, s, e.playerOrigin);
1339
- };
1340
- c();
1341
- for (let e = 1; e <= 12; e += 1) window.setTimeout(c, e * 75);
1489
+ postLaunch(e, t, n) {
1490
+ r || (a = {
1491
+ launch: e,
1492
+ session: t,
1493
+ chrome: n
1494
+ }, s = 0, p(a));
1342
1495
  },
1343
1496
  postManifest(e) {
1344
1497
  if (typeof e == "string") {
@@ -1353,17 +1506,17 @@ function mt(e) {
1353
1506
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1354
1507
  },
1355
1508
  postWidgetSetChrome(e) {
1356
- s(ut(e));
1509
+ v(yt(e));
1357
1510
  },
1358
1511
  postWidgetToggleAudioSettings() {
1359
- s(dt());
1512
+ v(bt());
1360
1513
  },
1361
1514
  speak(e) {
1362
- return c({
1515
+ return y({
1363
1516
  type: "speak",
1364
1517
  schemaVersion: 2,
1365
1518
  payload: {
1366
- correlationId: X(),
1519
+ correlationId: Z(),
1367
1520
  text: e.text,
1368
1521
  ...e.characterId ? { characterId: e.characterId } : {},
1369
1522
  ...e.behavior ? { behavior: e.behavior } : {}
@@ -1371,31 +1524,31 @@ function mt(e) {
1371
1524
  });
1372
1525
  },
1373
1526
  startListening() {
1374
- return c({
1527
+ return y({
1375
1528
  type: "startListening",
1376
1529
  schemaVersion: 2,
1377
- payload: { correlationId: X() }
1530
+ payload: { correlationId: Z() }
1378
1531
  });
1379
1532
  },
1380
1533
  stopListening() {
1381
- return c({
1534
+ return y({
1382
1535
  type: "stopListening",
1383
1536
  schemaVersion: 2,
1384
- payload: { correlationId: X() }
1537
+ payload: { correlationId: Z() }
1385
1538
  });
1386
1539
  },
1387
1540
  listenOnce(e) {
1388
- return c({
1541
+ return y({
1389
1542
  type: "listenOnce",
1390
1543
  schemaVersion: 2,
1391
1544
  payload: {
1392
- correlationId: X(),
1545
+ correlationId: Z(),
1393
1546
  ...e?.timeoutMs === void 0 ? {} : { timeoutMs: e.timeoutMs }
1394
1547
  }
1395
1548
  });
1396
1549
  },
1397
1550
  async speakProcessorStream(e, t) {
1398
- let n = X(), r = X(), i = (await c({
1551
+ let n = Z(), r = Z(), i = (await y({
1399
1552
  type: "speakStreamStart",
1400
1553
  schemaVersion: 2,
1401
1554
  payload: {
@@ -1407,7 +1560,7 @@ function mt(e) {
1407
1560
  try {
1408
1561
  for await (let n of e) {
1409
1562
  if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
1410
- n && s({
1563
+ n && v({
1411
1564
  type: "speakStreamChunk",
1412
1565
  schemaVersion: 2,
1413
1566
  payload: {
@@ -1417,7 +1570,7 @@ function mt(e) {
1417
1570
  });
1418
1571
  }
1419
1572
  if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
1420
- return await c({
1573
+ return await y({
1421
1574
  type: "speakStreamEnd",
1422
1575
  schemaVersion: 2,
1423
1576
  payload: {
@@ -1427,7 +1580,7 @@ function mt(e) {
1427
1580
  });
1428
1581
  } catch (e) {
1429
1582
  try {
1430
- await c({
1583
+ await y({
1431
1584
  type: "speakStreamEnd",
1432
1585
  schemaVersion: 2,
1433
1586
  payload: {
@@ -1440,8 +1593,8 @@ function mt(e) {
1440
1593
  }
1441
1594
  },
1442
1595
  speechPlay(e) {
1443
- let t = X(), n = [];
1444
- return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), c({
1596
+ let t = Z(), n = [];
1597
+ return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), y({
1445
1598
  type: "speechPlay",
1446
1599
  schemaVersion: 2,
1447
1600
  payload: {
@@ -1455,11 +1608,11 @@ function mt(e) {
1455
1608
  }, 12e4, n);
1456
1609
  },
1457
1610
  speechUtteranceBegin(e) {
1458
- return c({
1611
+ return y({
1459
1612
  type: "speechUtteranceBegin",
1460
1613
  schemaVersion: 2,
1461
1614
  payload: {
1462
- correlationId: X(),
1615
+ correlationId: Z(),
1463
1616
  utteranceId: e.utteranceId,
1464
1617
  format: e.format,
1465
1618
  queue: e.queue,
@@ -1469,34 +1622,34 @@ function mt(e) {
1469
1622
  });
1470
1623
  },
1471
1624
  speechUtteranceWrite(e) {
1472
- return c({
1625
+ return y({
1473
1626
  type: "speechUtteranceWrite",
1474
1627
  schemaVersion: 2,
1475
1628
  payload: {
1476
- correlationId: X(),
1629
+ correlationId: Z(),
1477
1630
  utteranceId: e.utteranceId,
1478
1631
  audio: e.audio,
1479
1632
  byteLength: e.byteLength
1480
1633
  }
1481
- }, pt, [e.audio]);
1634
+ }, St, [e.audio]);
1482
1635
  },
1483
1636
  speechUtteranceSetTranscript(e) {
1484
- return c({
1637
+ return y({
1485
1638
  type: "speechUtteranceSetTranscript",
1486
1639
  schemaVersion: 2,
1487
1640
  payload: {
1488
- correlationId: X(),
1641
+ correlationId: Z(),
1489
1642
  utteranceId: e.utteranceId,
1490
1643
  transcript: e.transcript
1491
1644
  }
1492
1645
  });
1493
1646
  },
1494
1647
  speechUtteranceClose(e) {
1495
- return c({
1648
+ return y({
1496
1649
  type: "speechUtteranceClose",
1497
1650
  schemaVersion: 2,
1498
1651
  payload: {
1499
- correlationId: X(),
1652
+ correlationId: Z(),
1500
1653
  utteranceId: e.utteranceId,
1501
1654
  ...e.transcript === void 0 ? {} : { transcript: e.transcript },
1502
1655
  ...e.history ? { history: e.history } : {}
@@ -1504,44 +1657,64 @@ function mt(e) {
1504
1657
  });
1505
1658
  },
1506
1659
  speechUtteranceCancel(e) {
1507
- return c({
1660
+ return y({
1508
1661
  type: "speechUtteranceCancel",
1509
1662
  schemaVersion: 2,
1510
1663
  payload: {
1511
- correlationId: X(),
1664
+ correlationId: Z(),
1512
1665
  utteranceId: e.utteranceId
1513
1666
  }
1514
1667
  });
1515
1668
  },
1516
1669
  speechInterrupt(e) {
1517
- return c({
1670
+ return y({
1518
1671
  type: "speechInterrupt",
1519
1672
  schemaVersion: 2,
1520
1673
  payload: {
1521
- correlationId: X(),
1674
+ correlationId: Z(),
1522
1675
  ...e
1523
1676
  }
1524
1677
  });
1525
1678
  },
1526
1679
  getConversation() {
1527
- return c({
1680
+ return y({
1528
1681
  type: "getConversation",
1529
1682
  schemaVersion: 2,
1530
- payload: { correlationId: X() }
1683
+ payload: { correlationId: Z() }
1684
+ });
1685
+ },
1686
+ focusCharacter(e) {
1687
+ return y({
1688
+ type: "focusCharacter",
1689
+ schemaVersion: 2,
1690
+ payload: {
1691
+ correlationId: Z(),
1692
+ characterId: e
1693
+ }
1694
+ });
1695
+ },
1696
+ setFit(e) {
1697
+ return y({
1698
+ type: "setFit",
1699
+ schemaVersion: 2,
1700
+ payload: {
1701
+ correlationId: Z(),
1702
+ fit: e
1703
+ }
1531
1704
  });
1532
1705
  },
1533
1706
  destroy() {
1534
1707
  if (!r) {
1535
1708
  r = !0;
1536
1709
  for (let e of i.values()) e.reject(/* @__PURE__ */ Error("Iframe host destroyed."));
1537
- i.clear(), window.removeEventListener("message", o), n.remove();
1710
+ i.clear(), f(), a = null, n.removeEventListener("load", h), n.removeEventListener("error", g), window.removeEventListener("message", _), n.remove();
1538
1711
  }
1539
1712
  }
1540
1713
  };
1541
1714
  }
1542
1715
  //#endregion
1543
1716
  //#region src/v2/embed/readyGate.ts
1544
- function ht(e) {
1717
+ function wt(e) {
1545
1718
  let t, n = !1, r = !1, i = () => {
1546
1719
  r || !n || t === void 0 || (r = !0, e(t));
1547
1720
  };
@@ -1556,35 +1729,47 @@ function ht(e) {
1556
1729
  }
1557
1730
  //#endregion
1558
1731
  //#region src/v2/shims/embedBaseUrl.ts
1559
- var gt = "https://player.liforma.ai/embed", _t = "http://localhost:3002/embed";
1560
- function vt() {
1732
+ var Tt = "https://player.liforma.ai/embed", Et = "http://localhost:3002/embed";
1733
+ function Dt() {
1561
1734
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1562
1735
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1563
1736
  if (typeof document > "u") return null;
1564
1737
  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();
1565
1738
  return t ? t.replace(/\/$/, "") : null;
1566
1739
  }
1567
- function yt() {
1568
- let e = vt();
1569
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : V() ? _t : gt;
1740
+ function Ot() {
1741
+ let e = Dt();
1742
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : B() ? Et : Tt;
1570
1743
  }
1571
- function bt(e, t, n, r, i, a, o) {
1572
- let s = (e ?? yt()).replace(/\/$/, ""), c = s.endsWith("/embed") ? s : `${s}/embed`, l = new URL(c), u = n?.trim();
1573
- u && l.searchParams.set("locationId", u);
1574
- let d = r?.trim();
1575
- return d && l.searchParams.set("avatarId", d), i === "face" && l.searchParams.set("fit", "face"), a === "widget" && l.searchParams.set("ui", "widget"), o && l.searchParams.set("close", "1"), t && l.searchParams.set("debug", "true"), xt(l.toString());
1744
+ function kt(e, t, n, r, i, a, o, s) {
1745
+ let c = (e ?? Ot()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1746
+ d && u.searchParams.set("locationId", d);
1747
+ let f = r?.trim();
1748
+ 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)), At(u.toString());
1576
1749
  }
1577
- function xt(e) {
1750
+ function At(e) {
1578
1751
  if (typeof location > "u") return e;
1579
1752
  let t = new URL(e);
1580
1753
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1581
1754
  }
1582
- function St(e) {
1755
+ function jt(e) {
1583
1756
  return new URL(e).origin;
1584
1757
  }
1585
1758
  //#endregion
1586
1759
  //#region src/v2/experienceEvents.ts
1587
- function Ct() {
1760
+ function Mt() {
1761
+ 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)}`;
1762
+ }
1763
+ function Nt(e, t, n) {
1764
+ return {
1765
+ id: Mt(),
1766
+ type: e,
1767
+ sessionId: t,
1768
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1769
+ data: n
1770
+ };
1771
+ }
1772
+ function Pt() {
1588
1773
  return {
1589
1774
  ready: /* @__PURE__ */ new Set(),
1590
1775
  started: /* @__PURE__ */ new Set(),
@@ -1593,47 +1778,49 @@ function Ct() {
1593
1778
  userSpeechEnded: /* @__PURE__ */ new Set(),
1594
1779
  characterSpeechStarted: /* @__PURE__ */ new Set(),
1595
1780
  characterSpeechEnded: /* @__PURE__ */ new Set(),
1781
+ characterFocusChanged: /* @__PURE__ */ new Set(),
1596
1782
  conversationUpdate: /* @__PURE__ */ new Set(),
1597
1783
  message: /* @__PURE__ */ new Set(),
1598
1784
  listeningState: /* @__PURE__ */ new Set(),
1599
1785
  activityChange: /* @__PURE__ */ new Set(),
1600
- modeChange: /* @__PURE__ */ new Set(),
1786
+ feedback: /* @__PURE__ */ new Set(),
1787
+ feedbackFailed: /* @__PURE__ */ new Set(),
1601
1788
  conversationProcessorError: /* @__PURE__ */ new Set()
1602
1789
  };
1603
1790
  }
1604
- function wt(e, t, n) {
1791
+ function Ft(e, t, n) {
1605
1792
  return e[t].add(n), () => e[t].delete(n);
1606
1793
  }
1607
- function Z(e, t, n) {
1794
+ function It(e, t, n) {
1608
1795
  for (let r of e[t]) r(n);
1609
1796
  }
1610
- function Tt(e) {
1797
+ function Lt(e) {
1611
1798
  for (let t of Object.keys(e)) e[t].clear();
1612
1799
  }
1613
1800
  //#endregion
1614
1801
  //#region src/v2/speech/types.ts
1615
- function Et(e) {
1802
+ function Rt(e) {
1616
1803
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1617
1804
  }
1618
- function Dt(e) {
1805
+ function zt(e) {
1619
1806
  return "url" in e && typeof e.url == "string";
1620
1807
  }
1621
- function Ot(e) {
1808
+ function Bt(e) {
1622
1809
  if (!("track" in e)) return !1;
1623
1810
  let t = e.track;
1624
1811
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1625
1812
  }
1626
- function kt(e) {
1627
- return !Et(e) && !Dt(e) && !Ot(e) && "encoding" in e && typeof e.encoding == "string";
1813
+ function Vt(e) {
1814
+ return !Rt(e) && !zt(e) && !Bt(e) && "encoding" in e && typeof e.encoding == "string";
1628
1815
  }
1629
- var At = [
1816
+ var Ht = [
1630
1817
  8e3,
1631
1818
  16e3,
1632
1819
  22050,
1633
1820
  24e3,
1634
1821
  44100,
1635
1822
  48e3
1636
- ], jt = {
1823
+ ], Ut = {
1637
1824
  MAX_CHUNK_BYTES: 64 * 1024,
1638
1825
  RECOMMENDED_CHUNK_MS_MIN: 20,
1639
1826
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -1644,14 +1831,14 @@ var At = [
1644
1831
  MAX_UTTERANCE_DURATION_MS: 9e4,
1645
1832
  MAX_PENDING_WRITES: 8,
1646
1833
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1647
- }, Mt = class extends Error {
1834
+ }, Wt = class extends Error {
1648
1835
  operation;
1649
1836
  requiredCapability;
1650
1837
  name = "UnsupportedSpeechOperationError";
1651
1838
  constructor(e, t) {
1652
1839
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1653
1840
  }
1654
- }, Nt = class extends Error {
1841
+ }, Gt = class extends Error {
1655
1842
  name = "SpeechUtteranceClosedError";
1656
1843
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1657
1844
  super(e);
@@ -1661,72 +1848,72 @@ var At = [
1661
1848
  constructor(e, t) {
1662
1849
  super(e, t);
1663
1850
  }
1664
- }, Pt = class extends Error {
1851
+ }, Kt = class extends Error {
1665
1852
  name = "SpeechBufferTimeoutError";
1666
1853
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1667
1854
  super(e);
1668
1855
  }
1669
1856
  };
1670
- function Ft(e = "none") {
1857
+ function qt(e = "none") {
1671
1858
  return {
1672
1859
  mode: e,
1673
1860
  trackedDurationMs: 0,
1674
1861
  fallbackDurationMs: 0
1675
1862
  };
1676
1863
  }
1677
- function It(e) {
1678
- return At.includes(e);
1864
+ function Jt(e) {
1865
+ return Ht.includes(e);
1679
1866
  }
1680
- function Lt(e) {
1867
+ function Yt(e) {
1681
1868
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
1682
1869
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
1683
- if (!It(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1870
+ if (!Jt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1684
1871
  }
1685
- function Rt(e) {
1686
- if (Et(e)) {
1687
- Lt(e.format);
1872
+ function Xt(e) {
1873
+ if (Rt(e)) {
1874
+ Yt(e.format);
1688
1875
  return;
1689
1876
  }
1690
- if (Dt(e)) {
1877
+ if (zt(e)) {
1691
1878
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
1692
- if (e.sampleRate !== void 0 && !It(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1879
+ if (e.sampleRate !== void 0 && !Jt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1693
1880
  return;
1694
1881
  }
1695
- if (Ot(e)) {
1882
+ if (Bt(e)) {
1696
1883
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
1697
- if (e.sampleRate !== void 0 && !It(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1884
+ if (e.sampleRate !== void 0 && !Jt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1698
1885
  return;
1699
1886
  }
1700
- if (kt(e)) {
1887
+ if (Vt(e)) {
1701
1888
  let t = e.encoding.trim().toLowerCase();
1702
1889
  if (!t) throw new Q("Encoded audio MIME type is required.");
1703
1890
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1704
- if (e.sampleRate !== void 0 && !It(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1891
+ if (e.sampleRate !== void 0 && !Jt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1705
1892
  return;
1706
1893
  }
1707
1894
  throw new Q("Unsupported speech.play audio shape.");
1708
1895
  }
1709
- function zt(e) {
1710
- if (e.format) return Lt(e.format), e.format;
1896
+ function Zt(e) {
1897
+ if (e.format) return Yt(e.format), e.format;
1711
1898
  if (e.track) {
1712
1899
  let t = {
1713
1900
  encoding: "pcm_s16le",
1714
1901
  sampleRate: e.sampleRate ?? 24e3,
1715
1902
  channels: 1
1716
1903
  };
1717
- return Lt(t), t;
1904
+ return Yt(t), t;
1718
1905
  }
1719
1906
  throw new Q("createUtterance requires format or track.");
1720
1907
  }
1721
- function Bt(e) {
1908
+ function Qt(e) {
1722
1909
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1723
1910
  }
1724
- function Vt(e) {
1911
+ function $t(e) {
1725
1912
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1726
1913
  }
1727
1914
  //#endregion
1728
1915
  //#region src/byo/pcm.ts
1729
- function Ht(e) {
1916
+ function en(e) {
1730
1917
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1731
1918
  for (let t = 0; t < e.length; t++) {
1732
1919
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1736,11 +1923,11 @@ function Ht(e) {
1736
1923
  }
1737
1924
  //#endregion
1738
1925
  //#region src/byo/resample.ts
1739
- function Ut(e, t, n, r, i) {
1926
+ function tn(e, t, n, r, i) {
1740
1927
  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;
1741
1928
  return ((a * i + o) * i + s) * i + c;
1742
1929
  }
1743
- function Wt(e, t) {
1930
+ function nn(e, t) {
1744
1931
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1745
1932
  if (e === t) return {
1746
1933
  fromRate: e,
@@ -1763,7 +1950,7 @@ function Wt(e, t) {
1763
1950
  let a = [];
1764
1951
  for (; i + 2 < r.length - 1;) {
1765
1952
  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);
1766
- a.push(Ut(r[o], r[e], r[s], r[c], t)), i += n;
1953
+ a.push(tn(r[o], r[e], r[s], r[c], t)), i += n;
1767
1954
  }
1768
1955
  let o = Math.max(0, Math.floor(i) - 1);
1769
1956
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1775,7 +1962,7 @@ function Wt(e, t) {
1775
1962
  }
1776
1963
  //#endregion
1777
1964
  //#region src/byo/audioCapture.ts
1778
- var Gt = "liforma-pcm-capture", Kt = `
1965
+ var rn = "liforma-pcm-capture", an = `
1779
1966
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1780
1967
  process(inputs) {
1781
1968
  const ch = inputs[0] && inputs[0][0];
@@ -1787,29 +1974,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1787
1974
  return true;
1788
1975
  }
1789
1976
  }
1790
- registerProcessor('${Gt}', LiformaPcmCaptureProcessor);
1791
- `, qt = null;
1792
- function Jt() {
1793
- return qt ||= URL.createObjectURL(new Blob([Kt], { type: "application/javascript" })), qt;
1977
+ registerProcessor('${rn}', LiformaPcmCaptureProcessor);
1978
+ `, on = null;
1979
+ function sn() {
1980
+ return on ||= URL.createObjectURL(new Blob([an], { type: "application/javascript" })), on;
1794
1981
  }
1795
- function Yt() {
1982
+ function cn() {
1796
1983
  return window.AudioContext || window.webkitAudioContext || null;
1797
1984
  }
1798
- async function Xt(e) {
1799
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Yt();
1985
+ async function ln(e) {
1986
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = cn();
1800
1987
  if (!o) throw Error("Web Audio is required for audio capture");
1801
1988
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1802
1989
  l.gain.value = 0;
1803
- let u = s.sampleRate, d = Wt(u, n), f = !1, p = !1, m = (e) => {
1990
+ let u = s.sampleRate, d = nn(u, n), f = !1, p = !1, m = (e) => {
1804
1991
  if (f || i && !i()) return;
1805
1992
  let t = d.push(e);
1806
- t.length !== 0 && r(Ht(t));
1993
+ t.length !== 0 && r(en(t));
1807
1994
  }, h = () => void 0;
1808
1995
  return await (async () => {
1809
1996
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1810
1997
  try {
1811
- await s.audioWorklet.addModule(Jt());
1812
- let e = new AudioWorkletNode(s, Gt, {
1998
+ await s.audioWorklet.addModule(sn());
1999
+ let e = new AudioWorkletNode(s, rn, {
1813
2000
  numberOfInputs: 1,
1814
2001
  numberOfOutputs: 1,
1815
2002
  outputChannelCount: [1]
@@ -1859,7 +2046,7 @@ async function Xt(e) {
1859
2046
  }
1860
2047
  //#endregion
1861
2048
  //#region src/v2/speech/captureMediaStreamTrack.ts
1862
- async function Zt(e) {
2049
+ async function un(e) {
1863
2050
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1864
2051
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
1865
2052
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -1868,18 +2055,18 @@ async function Zt(e) {
1868
2055
  s || (s = !0, c?.stop(), c = null);
1869
2056
  };
1870
2057
  try {
1871
- c = await Xt({
2058
+ c = await ln({
1872
2059
  mediaStream: a,
1873
2060
  targetSampleRate: r,
1874
2061
  shouldSend: () => !s && !i?.aborted,
1875
2062
  onPcm: (e) => {
1876
2063
  if (s || i?.aborted) return;
1877
- let t = Bt(e);
2064
+ let t = Qt(e);
1878
2065
  o = o.then(async () => {
1879
2066
  if (s || i?.aborted) return;
1880
2067
  let e = 0;
1881
2068
  for (; e < t.byteLength;) {
1882
- let r = Math.min(e + jt.MAX_CHUNK_BYTES, t.byteLength);
2069
+ let r = Math.min(e + Ut.MAX_CHUNK_BYTES, t.byteLength);
1883
2070
  if ((r - e) % 2 == 1 && --r, r <= e) break;
1884
2071
  let i = t.subarray(e, r);
1885
2072
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -1903,10 +2090,10 @@ async function Zt(e) {
1903
2090
  }
1904
2091
  //#endregion
1905
2092
  //#region src/v2/speech/speechController.ts
1906
- async function Qt(e, t) {
1907
- if (Ot(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1908
- if (Et(e)) {
1909
- let t = Bt(e.data);
2093
+ async function dn(e, t) {
2094
+ if (Bt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2095
+ if (Rt(e)) {
2096
+ let t = Qt(e.data);
1910
2097
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
1911
2098
  return {
1912
2099
  kind: "pcm",
@@ -1914,17 +2101,17 @@ async function Qt(e, t) {
1914
2101
  format: e.format
1915
2102
  };
1916
2103
  }
1917
- if (Dt(e)) return {
2104
+ if (zt(e)) return {
1918
2105
  kind: "url",
1919
2106
  url: e.url.trim(),
1920
2107
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1921
2108
  };
1922
- if (!kt(e)) throw new Q("Unsupported speech.play audio shape.");
2109
+ if (!Vt(e)) throw new Q("Unsupported speech.play audio shape.");
1923
2110
  let n;
1924
2111
  if (typeof Blob < "u" && e.data instanceof Blob) {
1925
2112
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1926
2113
  n = new Uint8Array(await e.data.arrayBuffer());
1927
- } else n = Bt(e.data);
2114
+ } else n = Qt(e.data);
1928
2115
  return {
1929
2116
  kind: "encoded",
1930
2117
  data: n.slice().buffer,
@@ -1932,10 +2119,10 @@ async function Qt(e, t) {
1932
2119
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1933
2120
  };
1934
2121
  }
1935
- function $t() {
2122
+ function fn() {
1936
2123
  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)}`;
1937
2124
  }
1938
- function en(e, t = "completed") {
2125
+ function pn(e, t = "completed") {
1939
2126
  return {
1940
2127
  utteranceId: e.speechId,
1941
2128
  characterId: e.characterId,
@@ -1949,13 +2136,13 @@ function en(e, t = "completed") {
1949
2136
  }
1950
2137
  };
1951
2138
  }
1952
- function tn(e) {
2139
+ function mn(e) {
1953
2140
  return e instanceof Error ? e : new Q(String(e));
1954
2141
  }
1955
- function nn(e) {
2142
+ function hn(e) {
1956
2143
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
1957
2144
  }
1958
- var rn = class {
2145
+ var gn = class {
1959
2146
  id;
1960
2147
  characterId;
1961
2148
  result;
@@ -1984,29 +2171,29 @@ var rn = class {
1984
2171
  queue: e.queue,
1985
2172
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
1986
2173
  }).catch((e) => {
1987
- throw this.fail(tn(e)), tn(e);
2174
+ throw this.fail(mn(e)), mn(e);
1988
2175
  }), this.signal?.addEventListener("abort", () => {
1989
2176
  this.cancel();
1990
2177
  }, { once: !0 });
1991
2178
  }
1992
2179
  async write(e, t) {
1993
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Nt();
1994
- let n = Bt(e);
2180
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Gt();
2181
+ let n = Qt(e);
1995
2182
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
1996
- if (n.byteLength > jt.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${jt.MAX_CHUNK_BYTES}).`);
2183
+ if (n.byteLength > Ut.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${Ut.MAX_CHUNK_BYTES}).`);
1997
2184
  if (n.byteLength === 0) return;
1998
- let r = t?.timeoutMs ?? jt.DEFAULT_WRITE_TIMEOUT_MS;
2185
+ let r = t?.timeoutMs ?? Ut.DEFAULT_WRITE_TIMEOUT_MS;
1999
2186
  await this.acquireWriteSlot(r);
2000
2187
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
2001
- if (this.bufferedMs + i > jt.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2188
+ if (this.bufferedMs + i > Ut.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2002
2189
  let a = async () => {
2003
- if (this.closed || this.settled) throw new Nt();
2190
+ if (this.closed || this.settled) throw new Gt();
2004
2191
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
2005
2192
  utteranceId: this.id,
2006
2193
  audio: t.buffer,
2007
2194
  byteLength: t.byteLength
2008
2195
  }), a = await Promise.race([i, new Promise((e, t) => {
2009
- setTimeout(() => t(new Pt()), r);
2196
+ setTimeout(() => t(new Kt()), r);
2010
2197
  })]);
2011
2198
  this.bufferedMs = Math.max(0, a.bufferedMs);
2012
2199
  }, o = this.writeChain.then(a, a);
@@ -2018,7 +2205,7 @@ var rn = class {
2018
2205
  }
2019
2206
  }
2020
2207
  async setTranscript(e) {
2021
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Nt();
2208
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Gt();
2022
2209
  await this.requireHost().speechUtteranceSetTranscript({
2023
2210
  utteranceId: this.id,
2024
2211
  transcript: e
@@ -2035,7 +2222,7 @@ var rn = class {
2035
2222
  });
2036
2223
  return this.resolve(t), t;
2037
2224
  } catch (e) {
2038
- let t = tn(e);
2225
+ let t = mn(e);
2039
2226
  throw this.fail(t), t;
2040
2227
  }
2041
2228
  }
@@ -2053,11 +2240,11 @@ var rn = class {
2053
2240
  characterId: this.characterId,
2054
2241
  status: "cancelled",
2055
2242
  durationMs: 0,
2056
- animation: Ft("none")
2243
+ animation: qt("none")
2057
2244
  };
2058
2245
  return this.resolve(t), t;
2059
2246
  } catch (e) {
2060
- let t = tn(e);
2247
+ let t = mn(e);
2061
2248
  throw this.fail(t), t;
2062
2249
  }
2063
2250
  }
@@ -2070,19 +2257,19 @@ var rn = class {
2070
2257
  return e;
2071
2258
  }
2072
2259
  resolve(e) {
2073
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Nt()));
2260
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Gt()));
2074
2261
  }
2075
2262
  fail(e) {
2076
2263
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
2077
2264
  }
2078
2265
  async acquireWriteSlot(e) {
2079
- if (this.pendingWriteCount < jt.MAX_PENDING_WRITES) {
2266
+ if (this.pendingWriteCount < Ut.MAX_PENDING_WRITES) {
2080
2267
  this.pendingWriteCount += 1;
2081
2268
  return;
2082
2269
  }
2083
2270
  await new Promise((t, n) => {
2084
2271
  let r = setTimeout(() => {
2085
- n(new Pt());
2272
+ n(new Kt());
2086
2273
  }, e);
2087
2274
  this.pendingWriteWaiters.push({
2088
2275
  resolve: () => {
@@ -2101,13 +2288,13 @@ var rn = class {
2101
2288
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2102
2289
  }
2103
2290
  };
2104
- function an(e) {
2291
+ function _n(e) {
2105
2292
  let t = null, n = (t, n) => {
2106
- if (!e.getCapabilities()[n]) throw new Mt(t, n);
2293
+ if (!e.getCapabilities()[n]) throw new Wt(t, n);
2107
2294
  }, r = {
2108
2295
  async speak(r) {
2109
2296
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2110
- let i = Vt(r.queue ?? "append");
2297
+ let i = $t(r.queue ?? "append");
2111
2298
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2112
2299
  let a = e.getIframeHost();
2113
2300
  if (!a) throw new Q("Speech session is not attached.");
@@ -2127,41 +2314,41 @@ function an(e) {
2127
2314
  return;
2128
2315
  }
2129
2316
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2130
- t.removeEventListener("abort", s), n(en(e, "completed"));
2317
+ t.removeEventListener("abort", s), n(pn(e, "completed"));
2131
2318
  }, (a) => {
2132
- if (t.removeEventListener("abort", s), nn(a)) {
2319
+ if (t.removeEventListener("abort", s), hn(a)) {
2133
2320
  n({
2134
2321
  utteranceId: "utt_interrupted",
2135
2322
  characterId: r.characterId ?? e.getActiveCharacterId(),
2136
2323
  status: "interrupted",
2137
2324
  durationMs: 0,
2138
2325
  transcript: r.text,
2139
- animation: Ft("none")
2326
+ animation: qt("none")
2140
2327
  });
2141
2328
  return;
2142
2329
  }
2143
- i(tn(a));
2330
+ i(mn(a));
2144
2331
  });
2145
2332
  });
2146
2333
  }
2147
2334
  try {
2148
- return en(await o, "completed");
2335
+ return pn(await o, "completed");
2149
2336
  } catch (t) {
2150
- if (nn(t)) return {
2337
+ if (hn(t)) return {
2151
2338
  utteranceId: "utt_interrupted",
2152
2339
  characterId: r.characterId ?? e.getActiveCharacterId(),
2153
2340
  status: "interrupted",
2154
2341
  durationMs: 0,
2155
2342
  transcript: r.text,
2156
- animation: Ft("none")
2343
+ animation: qt("none")
2157
2344
  };
2158
- throw tn(t);
2345
+ throw mn(t);
2159
2346
  }
2160
2347
  },
2161
2348
  async play(i) {
2162
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Rt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2349
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Xt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2163
2350
  let a = i.queue ?? "append";
2164
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Ot(i.audio)) {
2351
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Bt(i.audio)) {
2165
2352
  let e = i.audio.sampleRate ?? 24e3;
2166
2353
  return r.createUtterance({
2167
2354
  format: {
@@ -2177,7 +2364,7 @@ function an(e) {
2177
2364
  }
2178
2365
  let o = e.getIframeHost();
2179
2366
  if (!o) throw new Q("Speech session is not attached.");
2180
- let s = await Qt(i.audio, i.signal);
2367
+ let s = await dn(i.audio, i.signal);
2181
2368
  return o.speechPlay({
2182
2369
  source: s,
2183
2370
  characterId: i.characterId,
@@ -2189,13 +2376,13 @@ function an(e) {
2189
2376
  },
2190
2377
  createUtterance(r) {
2191
2378
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2192
- let i = zt(r);
2379
+ let i = Zt(r);
2193
2380
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2194
2381
  let a = r.queue ?? "replace-active";
2195
2382
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2196
2383
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2197
- let o = new rn({
2198
- id: $t(),
2384
+ let o = new gn({
2385
+ id: fn(),
2199
2386
  characterId: r.characterId ?? e.getActiveCharacterId(),
2200
2387
  format: i,
2201
2388
  queue: a,
@@ -2207,7 +2394,7 @@ function an(e) {
2207
2394
  t === o && (t = null);
2208
2395
  }), r.track && (async () => {
2209
2396
  try {
2210
- if (await Zt({
2397
+ if (await un({
2211
2398
  track: r.track,
2212
2399
  utterance: o,
2213
2400
  sampleRate: i.sampleRate,
@@ -2234,11 +2421,17 @@ function an(e) {
2234
2421
  return r;
2235
2422
  }
2236
2423
  //#endregion
2424
+ //#region src/v2/types/sessionInteraction.ts
2425
+ function vn(e) {
2426
+ let t = e?.trim();
2427
+ return t === "full" || t === "face" || t === "medium" ? t : void 0;
2428
+ }
2429
+ //#endregion
2237
2430
  //#region src/v2/experience.ts
2238
- function on(e) {
2431
+ function yn(e) {
2239
2432
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2240
2433
  }
2241
- var sn = class e {
2434
+ var bn = class e {
2242
2435
  bootstrap;
2243
2436
  conversationProcessor;
2244
2437
  iframeHost = null;
@@ -2251,17 +2444,18 @@ var sn = class e {
2251
2444
  attachReturnUrl = null;
2252
2445
  closed = !1;
2253
2446
  attached = !1;
2447
+ pendingFit = null;
2254
2448
  closeHandlers = [];
2255
- eventRegistry = Ct();
2256
- readyEvent = null;
2257
- startedEvent = null;
2449
+ eventRegistry = Pt();
2450
+ readyEnvelope = null;
2451
+ startedEnvelope = null;
2258
2452
  conversationCache = [];
2259
2453
  speech;
2260
2454
  constructor(e) {
2261
- 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({
2455
+ 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 = _n({
2262
2456
  getIframeHost: () => this.iframeHost,
2263
2457
  assertSessionStarted: () => this.assertSessionStarted(),
2264
- getCapabilities: () => cn(this.resolvedSession),
2458
+ getCapabilities: () => xn(this.resolvedSession),
2265
2459
  getActiveCharacterId: () => "character_unknown",
2266
2460
  onProcessorInterrupt: () => {
2267
2461
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2295,10 +2489,10 @@ var sn = class e {
2295
2489
  language: t.language,
2296
2490
  locationId: t.locationId,
2297
2491
  avatarId: t.avatarId,
2492
+ castSize: t.castSize,
2298
2493
  embedBaseUrl: t.embedBaseUrl,
2299
2494
  debug: t.debug,
2300
2495
  mode: t.mode,
2301
- responseMode: t.responseMode,
2302
2496
  speechInputMode: t.speechInputMode,
2303
2497
  speechOnly: t.speechOnly,
2304
2498
  ui: t.ui,
@@ -2315,10 +2509,10 @@ var sn = class e {
2315
2509
  language: t.language,
2316
2510
  locationId: t.locationId,
2317
2511
  avatarId: t.avatarId,
2512
+ castSize: t.castSize,
2318
2513
  embedBaseUrl: t.embedBaseUrl,
2319
2514
  debug: t.debug,
2320
2515
  mode: t.mode,
2321
- responseMode: t.responseMode,
2322
2516
  speechInputMode: t.speechInputMode,
2323
2517
  speechOnly: t.speechOnly,
2324
2518
  ui: t.ui,
@@ -2335,8 +2529,8 @@ var sn = class e {
2335
2529
  return null;
2336
2530
  }
2337
2531
  on(e, t) {
2338
- let n = wt(this.eventRegistry, e, t);
2339
- return e === "ready" && this.readyEvent && queueMicrotask(() => t(this.readyEvent)), e === "started" && this.startedEvent && queueMicrotask(() => t(this.startedEvent)), n;
2532
+ let n = Ft(this.eventRegistry, e, t);
2533
+ return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
2340
2534
  }
2341
2535
  async attach(e) {
2342
2536
  if (this.closed) throw Error("Session has ended.");
@@ -2349,13 +2543,13 @@ var sn = class e {
2349
2543
  if (this.closed) throw Error("Session has ended.");
2350
2544
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2351
2545
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2352
- let t = this.bootstrap.embedBaseUrl ?? yt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = bt(t, n, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.locationId, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, on(e)), a = St(i), o = null, s = new Promise((e) => {
2546
+ let t = this.bootstrap.embedBaseUrl ?? Ot(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = kt(t, n, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.locationId, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, yn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = jt(i), o = null, s = new Promise((e) => {
2353
2547
  o = e;
2354
2548
  }), c = null, l = new Promise((e) => {
2355
2549
  c = e;
2356
- }), u = ht((e) => {
2357
- this.readyEvent || (this.readyEvent = { session: e }, Z(this.eventRegistry, "ready", this.readyEvent));
2358
- }), d = this.bootstrap.onUserTranscript, f = mt({
2550
+ }), u = wt((e) => {
2551
+ this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2552
+ }), d = this.bootstrap.onUserTranscript, f = Ct({
2359
2553
  container: e.container,
2360
2554
  src: i,
2361
2555
  playerOrigin: a,
@@ -2371,34 +2565,43 @@ var sn = class e {
2371
2565
  e.onPlayerStatusChange?.(t), e.onStateUpdate?.(t), t === "loading" && o && (o(), o = null), t === "ready" && c && (c(), c = null), t === "ready" && u.markReady();
2372
2566
  },
2373
2567
  onUserTranscript: (e) => {
2374
- Z(this.eventRegistry, "userTranscript", e), d?.(e), this.queueProcessorTurn(e);
2568
+ this.emitWrapped("userTranscript", e), d?.(e), this.queueProcessorTurn(e);
2375
2569
  },
2376
2570
  onUserSpeechStarted: (e) => {
2377
- Z(this.eventRegistry, "userSpeechStarted", e);
2571
+ this.emitWrapped("userSpeechStarted", e);
2378
2572
  },
2379
2573
  onUserSpeechEnded: (e) => {
2380
- Z(this.eventRegistry, "userSpeechEnded", e);
2574
+ this.emitWrapped("userSpeechEnded", e);
2381
2575
  },
2382
2576
  onCharacterSpeechStarted: (e) => {
2383
- Z(this.eventRegistry, "characterSpeechStarted", e);
2577
+ this.emitWrapped("characterSpeechStarted", e);
2384
2578
  },
2385
2579
  onCharacterSpeechEnded: (e) => {
2386
- Z(this.eventRegistry, "characterSpeechEnded", e);
2580
+ this.emitWrapped("characterSpeechEnded", e);
2581
+ },
2582
+ onCharacterFocusChanged: (e) => {
2583
+ this.emitWrapped("characterFocusChanged", e);
2387
2584
  },
2388
2585
  onListeningState: (e) => {
2389
- Z(this.eventRegistry, "listeningState", e);
2586
+ this.emitWrapped("listeningState", e);
2390
2587
  },
2391
2588
  onActivityChange: (e) => {
2392
- Z(this.eventRegistry, "activityChange", e), (e === "listening" || e === "thinking" || e === "speaking") && Z(this.eventRegistry, "modeChange", e);
2589
+ this.emitWrapped("activityChange", e);
2590
+ },
2591
+ onFeedback: (e) => {
2592
+ this.emitWrapped("feedback", e);
2593
+ },
2594
+ onFeedbackFailed: (e) => {
2595
+ this.emitWrapped("feedbackFailed", e);
2393
2596
  },
2394
2597
  onMessage: (e) => {
2395
- Z(this.eventRegistry, "message", e);
2598
+ this.emitWrapped("message", e);
2396
2599
  },
2397
2600
  onStarted: (e) => {
2398
- this.startedEvent || (this.startedEvent = e, Z(this.eventRegistry, "started", e), this.bootstrap.onStart?.(e));
2601
+ this.startedEnvelope || (this.startedEnvelope = this.emitWrapped("started", e), this.bootstrap.onStart?.(e));
2399
2602
  },
2400
2603
  onConversationUpdate: (e) => {
2401
- this.conversationCache = e, Z(this.eventRegistry, "conversationUpdate", e);
2604
+ this.conversationCache = e, this.emitWrapped("conversationUpdate", e);
2402
2605
  },
2403
2606
  onWidgetReady: () => e.onWidgetReady?.(),
2404
2607
  onWidgetExpand: () => e.onWidgetExpand?.(),
@@ -2409,24 +2612,22 @@ var sn = class e {
2409
2612
  onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
2410
2613
  });
2411
2614
  this.iframeHost = f;
2412
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Xe(this.bootstrap.sessionEndpoint, {
2615
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), at(this.bootstrap.sessionEndpoint, {
2413
2616
  experienceId: this.bootstrap.experienceId,
2414
2617
  locale: this.bootstrap.locale,
2415
2618
  secondaryLocale: this.bootstrap.secondaryLocale,
2416
2619
  learningLocale: this.bootstrap.learningLocale,
2417
2620
  language: this.bootstrap.language,
2418
2621
  mode: p.mode,
2419
- responseMode: p.responseMode,
2420
2622
  speechInputMode: p.speechInputMode,
2421
2623
  speechOnly: this.bootstrap.speechOnly,
2422
2624
  signal: this.endpointAbortController.signal
2423
- })) : this.bootstrap.kind === "public" ? Ye(this.bootstrap.experienceId, {
2625
+ })) : this.bootstrap.kind === "public" ? it(this.bootstrap.experienceId, {
2424
2626
  locale: this.bootstrap.locale,
2425
2627
  secondaryLocale: this.bootstrap.secondaryLocale,
2426
2628
  learningLocale: this.bootstrap.learningLocale,
2427
2629
  language: this.bootstrap.language,
2428
2630
  mode: p.mode,
2429
- responseMode: p.responseMode,
2430
2631
  speechInputMode: p.speechInputMode,
2431
2632
  speechOnly: this.bootstrap.speechOnly
2432
2633
  }) : Promise.resolve(this.bootstrap.session ? {
@@ -2443,11 +2644,17 @@ var sn = class e {
2443
2644
  f.postParentHello();
2444
2645
  let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2445
2646
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2446
- return this.launchToken = g, _ ? (this.resolvedSession = _, f.postLaunch(g, _, e.startButton), u.setValue(_)) : f.postLaunch(g, void 0, e.startButton), await Promise.race([s, new Promise((e, t) => {
2647
+ return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Xe(_), f.postLaunch(g, _, {
2648
+ startButton: e.startButton,
2649
+ showFeedback: e.showFeedback
2650
+ }), u.setValue(_)) : f.postLaunch(g, void 0, {
2651
+ startButton: e.startButton,
2652
+ showFeedback: e.showFeedback
2653
+ }), await Promise.race([s, new Promise((e, t) => {
2447
2654
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
2448
2655
  })]), await Promise.race([l, new Promise((e, t) => {
2449
2656
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
2450
- })]), this.attached = !0, this.createPlayerFacade();
2657
+ })]), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
2451
2658
  }
2452
2659
  async startListening() {
2453
2660
  this.assertSessionStarted(), await this.iframeHost.startListening();
@@ -2467,6 +2674,15 @@ var sn = class e {
2467
2674
  toggleAudioSettings() {
2468
2675
  this.iframeHost?.postWidgetToggleAudioSettings();
2469
2676
  }
2677
+ async focusCharacter(e) {
2678
+ this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2679
+ }
2680
+ async setFit(e) {
2681
+ let t = vn(e);
2682
+ if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2683
+ if (this.closed) throw Error("Session has ended.");
2684
+ this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
2685
+ }
2470
2686
  getLastTurn() {
2471
2687
  if (this.conversationCache.length === 0) return [];
2472
2688
  let e = this.conversationCache[this.conversationCache.length - 1].turnId;
@@ -2476,17 +2692,21 @@ var sn = class e {
2476
2692
  this.close();
2477
2693
  }
2478
2694
  destroy() {
2479
- 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, Tt(this.eventRegistry), this.readyEvent = null, this.startedEvent = null, this.closeHandlers.length = 0, this.attached = !1);
2695
+ 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, Lt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2480
2696
  }
2481
2697
  resolveMintInteraction() {
2482
- if (this.bootstrap.kind === "launch") return {};
2483
- let e = this.conversationProcessor !== null;
2484
- return {
2698
+ return this.bootstrap.kind === "launch" ? {} : {
2485
2699
  mode: this.bootstrap.mode,
2486
- responseMode: e ? "custom" : this.bootstrap.responseMode,
2487
2700
  speechInputMode: this.bootstrap.speechInputMode
2488
2701
  };
2489
2702
  }
2703
+ getSessionId() {
2704
+ return this.resolvedSession?.id ?? "";
2705
+ }
2706
+ emitWrapped(e, t) {
2707
+ let n = Nt(e, this.getSessionId(), t);
2708
+ return It(this.eventRegistry, e, n), n;
2709
+ }
2490
2710
  queueProcessorTurn(e) {
2491
2711
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
2492
2712
  let t = this.conversationProcessor;
@@ -2494,7 +2714,7 @@ var sn = class e {
2494
2714
  let n = this.processorAbortController.signal;
2495
2715
  this.processorChain = this.processorChain.then(async () => {
2496
2716
  if (!n.aborted) try {
2497
- let r = await $e(t, {
2717
+ let r = await ct(t, {
2498
2718
  utteranceId: e.utteranceId,
2499
2719
  text: e.text,
2500
2720
  conversation: this.conversationCache,
@@ -2514,7 +2734,7 @@ var sn = class e {
2514
2734
  } catch (t) {
2515
2735
  if (n.aborted) return;
2516
2736
  let r = t instanceof Error ? t.message : String(t);
2517
- Z(this.eventRegistry, "conversationProcessorError", {
2737
+ this.emitWrapped("conversationProcessorError", {
2518
2738
  utteranceId: e.utteranceId,
2519
2739
  message: r
2520
2740
  });
@@ -2525,7 +2745,7 @@ var sn = class e {
2525
2745
  if (!this.attached || !this.iframeHost) throw Error("Call Experience.attach() before using speech APIs.");
2526
2746
  }
2527
2747
  assertSessionStarted() {
2528
- if (this.assertAttached(), !this.startedEvent) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
2748
+ if (this.assertAttached(), !this.startedEnvelope) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
2529
2749
  }
2530
2750
  close() {
2531
2751
  this.closed || (this.closed = !0, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, this.attached = !1);
@@ -2544,10 +2764,10 @@ var sn = class e {
2544
2764
  };
2545
2765
  }
2546
2766
  };
2547
- function cn(e) {
2767
+ function xn(e) {
2548
2768
  return e ? {
2549
- textSpeech: e.capabilities.speechOutput,
2550
- externalSpeechAudio: e.capabilities.externalAudio
2769
+ textSpeech: e.capabilities.speech.output,
2770
+ externalSpeechAudio: e.capabilities.speech.externalAudio
2551
2771
  } : {
2552
2772
  textSpeech: !0,
2553
2773
  externalSpeechAudio: !0
@@ -2555,41 +2775,41 @@ function cn(e) {
2555
2775
  }
2556
2776
  //#endregion
2557
2777
  //#region src/widget/dockGeometry.ts
2558
- var ln = "(min-width: 768px)", un = 24, dn = .5, fn = 1200, pn = .85, mn = 9 / 16;
2559
- function hn() {
2778
+ var Sn = "(min-width: 768px)", Cn = 24, wn = .5, Tn = 1200, En = .85, Dn = 9 / 16;
2779
+ function On() {
2560
2780
  if (typeof window > "u") return 800;
2561
2781
  let e = window.screen?.availHeight;
2562
2782
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2563
2783
  }
2564
- function gn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = un, r = typeof window < "u" ? hn() : 800) {
2565
- let i = Math.max(160, Math.min(t - n * 2, t * pn)), a = Math.max(120, e - n * 2), o = Math.min(r * dn, fn, i), s = o * mn;
2566
- return s > a && (s = a, o = s / mn, o > i && (o = i, s = o * mn)), {
2784
+ function kn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Cn, r = typeof window < "u" ? On() : 800) {
2785
+ let i = Math.max(160, Math.min(t - n * 2, t * En)), a = Math.max(120, e - n * 2), o = Math.min(r * wn, Tn, i), s = o * Dn;
2786
+ return s > a && (s = a, o = s / Dn, o > i && (o = i, s = o * Dn)), {
2567
2787
  width: Math.round(s),
2568
2788
  height: Math.round(o)
2569
2789
  };
2570
2790
  }
2571
- function _n(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = un) {
2791
+ function An(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Cn) {
2572
2792
  return {
2573
2793
  left: Math.max(r, t - e.width - r),
2574
2794
  top: Math.max(r, n - e.height - r)
2575
2795
  };
2576
2796
  }
2577
- function vn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = un) {
2797
+ function jn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Cn) {
2578
2798
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2579
2799
  return {
2580
2800
  left: Math.min(Math.max(a, e), o),
2581
2801
  top: Math.min(Math.max(a, t), s)
2582
2802
  };
2583
2803
  }
2584
- function yn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2585
- return e(ln).matches;
2804
+ function Mn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2805
+ return e(Sn).matches;
2586
2806
  }
2587
2807
  //#endregion
2588
2808
  //#region src/widget/mountExperienceWidget.ts
2589
- function bn(e) {
2809
+ function Nn(e) {
2590
2810
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2591
2811
  }
2592
- function xn(e) {
2812
+ function Pn(e) {
2593
2813
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2594
2814
  let t = typeof e == "string" ? e.trim() : "";
2595
2815
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2597,10 +2817,10 @@ function xn(e) {
2597
2817
  function $(e) {
2598
2818
  return e === "expanded" || e === "docked";
2599
2819
  }
2600
- var Sn = "<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>", Cn = "<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>", wn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Tn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2601
- function En(e, t, n) {
2602
- Te(Ce);
2603
- let r = te({
2820
+ var Fn = "<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>", In = "<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>", Ln = "<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>", Rn = "<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>";
2821
+ function zn(e, t, n) {
2822
+ Oe(Ee);
2823
+ let r = z({
2604
2824
  galleryThumb: t.galleryThumb,
2605
2825
  avatarImage: t.avatarImage,
2606
2826
  backgroundImage: t.backgroundImage,
@@ -2626,9 +2846,9 @@ function En(e, t, n) {
2626
2846
  let e = document.createElement("img");
2627
2847
  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);
2628
2848
  }
2629
- return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Se(i);
2849
+ return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Te(i);
2630
2850
  }
2631
- function Dn(e) {
2851
+ function Bn(e) {
2632
2852
  return e.startButton ? {
2633
2853
  ...e.startButton,
2634
2854
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2640,7 +2860,7 @@ function Dn(e) {
2640
2860
  variant: "primary"
2641
2861
  };
2642
2862
  }
2643
- function On(e) {
2863
+ function Vn(e) {
2644
2864
  let t = !1, n = () => {
2645
2865
  t || e();
2646
2866
  }, r = () => {
@@ -2660,12 +2880,12 @@ function On(e) {
2660
2880
  t = !0, window.removeEventListener("load", r), i?.();
2661
2881
  };
2662
2882
  }
2663
- function kn(e, t) {
2664
- ke(De);
2883
+ function Hn(e, t) {
2884
+ Ne(je);
2665
2885
  let n = t.experienceId?.trim();
2666
2886
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2667
- let r = t.prefetch ?? "onExpand", i = bn(t.position), a = document.createElement("div");
2668
- a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", xn(t.offset));
2887
+ let r = t.prefetch ?? "onExpand", i = Nn(t.position), a = document.createElement("div");
2888
+ 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", Pn(t.offset));
2669
2889
  let o = document.createElement("button");
2670
2890
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2671
2891
  let s = document.createElement("div");
@@ -2685,138 +2905,138 @@ function kn(e, t) {
2685
2905
  let m = document.createElement("span");
2686
2906
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2687
2907
  let h = document.createElement("button");
2688
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = wn, h.setAttribute("aria-label", "Reduce");
2908
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Ln, h.setAttribute("aria-label", "Reduce");
2689
2909
  let g = document.createElement("button");
2690
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Sn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2910
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Fn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2691
2911
  let _ = document.createElement("button");
2692
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Cn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2912
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = In, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2693
2913
  let v = document.createElement("div");
2694
2914
  v.className = "liforma-ew__stage";
2695
2915
  let y = document.createElement("div");
2696
2916
  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);
2697
- 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, L = 0, R = null, z = !1, B = new AbortController(), te = t.parallax !== !1, V = () => {
2917
+ let b = null, x = !1, S = !1, ee = !1, C = !1, w = !1, T = !1, E = !1, D = 0, O = "", k = null, A = null, j = null, M = null, N = null, P = null, F = null, te = 0, ne = 0, re = null, I = !1, ie = new AbortController(), L = t.parallax !== !1, R = () => {
2698
2918
  let e = a.dataset.state;
2699
2919
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
2700
- }, H = () => {
2701
- M !== null && (clearTimeout(M), M = null);
2702
- }, U = () => {
2703
- N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
2704
- }, ne = () => {
2920
+ }, z = () => {
2921
+ j !== null && (clearTimeout(j), j = null);
2922
+ }, B = () => {
2923
+ M !== null && (clearTimeout(M), M = null), a.classList.remove("liforma-ew--layout-settling");
2924
+ }, V = () => {
2705
2925
  for (let e of [
2706
2926
  f,
2707
2927
  l,
2708
2928
  p
2709
2929
  ]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
2710
2930
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
2711
- }, re = (e, t, n, r) => {
2931
+ }, ae = (e, t, n, r) => {
2712
2932
  let i = (i) => {
2713
2933
  i.style.left = `${e}px`, i.style.top = `${t}px`, i.style.width = `${n}px`, i.style.height = `${r}px`, i.style.right = "auto", i.style.bottom = "auto";
2714
2934
  };
2715
2935
  i(f), i(l);
2716
2936
  let a = p.offsetWidth || 120;
2717
2937
  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";
2718
- }, ie = (e, t) => {
2719
- if (V() !== "docked") return;
2720
- let n = gn(), r = vn(e - ee, t - L, n);
2721
- P = r.left, F = r.top, re(r.left, r.top, n.width, n.height);
2722
- }, ae = (e, t) => {
2723
- if (V() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2724
- let n = gn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = vn(r + e, i + t, n);
2725
- P = a.left, F = a.top, re(a.left, a.top, n.width, n.height);
2726
- }, oe = (e) => {
2727
- R === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), ie(e.clientX, e.clientY)));
2728
- }, W = (e) => {
2729
- if (I === null || e && e.pointerId !== I) return;
2730
- let t = R;
2731
- I = null, R = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && z && (z = !1, window.removeEventListener("pointermove", oe), window.removeEventListener("pointerup", W), window.removeEventListener("pointercancel", W));
2732
- }, se = (e, t, n) => {
2733
- if (S || V() !== "docked" || !yn() || I !== null) return;
2734
- I = n, R = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2735
- let r = f.getBoundingClientRect();
2736
- ee = e - r.left, L = t - r.top, z || (z = !0, window.addEventListener("pointermove", oe), window.addEventListener("pointerup", W), window.addEventListener("pointercancel", W));
2938
+ }, oe = (e, t) => {
2939
+ if (R() !== "docked") return;
2940
+ let n = kn(), r = jn(e - te, t - ne, n);
2941
+ N = r.left, P = r.top, ae(r.left, r.top, n.width, n.height);
2942
+ }, se = (e, t) => {
2943
+ if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2944
+ let n = kn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = jn(r + e, i + t, n);
2945
+ N = a.left, P = a.top, ae(a.left, a.top, n.width, n.height);
2737
2946
  }, ce = (e) => {
2738
- if (S || V() !== "docked" || !yn() || I !== null) return;
2739
- I = e.pointerId, R = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2947
+ re === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
2948
+ }, H = (e) => {
2949
+ if (F === null || e && e.pointerId !== F) return;
2950
+ let t = re;
2951
+ F = null, re = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && I && (I = !1, window.removeEventListener("pointermove", ce), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H));
2952
+ }, le = (e, t, n) => {
2953
+ if (S || R() !== "docked" || !Mn() || F !== null) return;
2954
+ F = n, re = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2955
+ let r = f.getBoundingClientRect();
2956
+ te = e - r.left, ne = t - r.top, I || (I = !0, window.addEventListener("pointermove", ce), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
2957
+ }, U = (e) => {
2958
+ if (S || R() !== "docked" || !Mn() || F !== null) return;
2959
+ F = e.pointerId, re = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2740
2960
  let t = f.getBoundingClientRect();
2741
- P = t.left, F = t.top;
2742
- }, le = (e) => {
2743
- R === "player" && (I === null || e.pointerId !== I || ae(e.dx, e.dy));
2961
+ N = t.left, P = t.top;
2744
2962
  }, ue = (e) => {
2745
- R === "player" && (I === null || e.pointerId !== I || W());
2746
- }, G = () => {
2747
- let e = yn(), t = V();
2963
+ re === "player" && (F === null || e.pointerId !== F || se(e.dx, e.dy));
2964
+ }, de = (e) => {
2965
+ re === "player" && (F === null || e.pointerId !== F || H());
2966
+ }, W = () => {
2967
+ let e = Mn(), t = R();
2748
2968
  if (!e || t !== "expanded" && t !== "docked") {
2749
2969
  h.hidden = !0;
2750
2970
  return;
2751
2971
  }
2752
- h.hidden = !1, t === "docked" ? (h.innerHTML = Tn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = wn, h.setAttribute("aria-label", "Reduce"));
2753
- }, de = (e) => {
2754
- let t = gn(), n = e && P !== null && F !== null ? vn(P, F, t) : _n(t);
2755
- n = vn(n.left, n.top, t), P = n.left, F = n.top, re(n.left, n.top, t.width, t.height), G();
2756
- }, fe = () => {
2972
+ h.hidden = !1, t === "docked" ? (h.innerHTML = Rn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Ln, h.setAttribute("aria-label", "Reduce"));
2973
+ }, fe = (e) => {
2974
+ let t = kn(), n = e && N !== null && P !== null ? jn(N, P, t) : An(t);
2975
+ n = jn(n.left, n.top, t), N = n.left, P = n.top, ae(n.left, n.top, t.width, t.height), W();
2976
+ }, pe = () => {
2757
2977
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2758
2978
  requestAnimationFrame(() => {
2759
2979
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
2760
2980
  });
2761
2981
  });
2762
- }, pe = (e) => {
2763
- if (U(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
2982
+ }, me = (e) => {
2983
+ if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !E) {
2764
2984
  a.classList.remove("liforma-ew--layout-settling");
2765
2985
  return;
2766
2986
  }
2767
- N = setTimeout(() => {
2768
- if (N = null, S || !$(a.dataset.state)) {
2987
+ M = setTimeout(() => {
2988
+ if (M = null, S || !$(a.dataset.state)) {
2769
2989
  a.classList.remove("liforma-ew--layout-settling");
2770
2990
  return;
2771
2991
  }
2772
- a.classList.remove("liforma-ew--layout-settling"), fe();
2992
+ a.classList.remove("liforma-ew--layout-settling"), pe();
2773
2993
  }, 220);
2774
- }, me = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2775
- H(), M = setTimeout(() => {
2776
- M = null, a.classList.remove("liforma-ew--session-concealing"), e();
2994
+ }, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2995
+ z(), j = setTimeout(() => {
2996
+ j = null, a.classList.remove("liforma-ew--session-concealing"), e();
2777
2997
  }, 280);
2778
- })), he = {
2998
+ })), ge = {
2779
2999
  galleryThumb: t.galleryThumb,
2780
3000
  avatarImage: t.avatarImage,
2781
3001
  backgroundImage: t.backgroundImage,
2782
3002
  foregroundImage: t.foregroundImage,
2783
3003
  fallbackImage: t.fallbackImage
2784
- }, K = (e) => {
3004
+ }, _e = (e) => {
2785
3005
  if (!e) {
2786
3006
  y.hidden = !0, y.textContent = "";
2787
3007
  return;
2788
3008
  }
2789
3009
  y.hidden = !1, y.textContent = e;
2790
- }, q = (e) => {
3010
+ }, ve = (e) => {
2791
3011
  if (!e) {
2792
3012
  c.hidden = !0, c.textContent = "";
2793
3013
  return;
2794
3014
  }
2795
3015
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
2796
- }, ge = () => {
2797
- C = !0, o.disabled = !1, q(null), r === "onExpand" && t.onPrefetchReady?.();
2798
- }, J = () => {
2799
- w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2800
- }, _e = (e) => {
2801
- A?.(), A = null;
2802
- let t = En(s, e, { parallax: te });
2803
- return t ? (A = t, !0) : !1;
2804
- }, ve = () => {
2805
- if (_e(he)) {
2806
- ge();
3016
+ }, ye = () => {
3017
+ ee = !0, o.disabled = !1, ve(null), r === "onExpand" && t.onPrefetchReady?.();
3018
+ }, G = () => {
3019
+ C = !0, a.dataset.warm = "true", l.hidden = !1, E || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
3020
+ }, be = (e) => {
3021
+ k?.(), k = null;
3022
+ let t = zn(s, e, { parallax: L });
3023
+ return t ? (k = t, !0) : !1;
3024
+ }, K = () => {
3025
+ if (be(ge)) {
3026
+ ye();
2807
3027
  return;
2808
3028
  }
2809
- q("Loading…"), Fe(n, { signal: B.signal }).then((e) => {
3029
+ ve("Loading…"), ze(n, { signal: ie.signal }).then((e) => {
2810
3030
  if (!S) {
2811
- if (!_e({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
2812
- ge();
3031
+ if (!be({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3032
+ ye();
2813
3033
  }
2814
3034
  }).catch((e) => {
2815
- if (S || B.signal.aborted) return;
3035
+ if (S || ie.signal.aborted) return;
2816
3036
  let n = e instanceof Error ? e : Error(String(e));
2817
- q("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3037
+ ve("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
2818
3038
  });
2819
- }, ye = () => ({
3039
+ }, xe = () => ({
2820
3040
  experienceId: n,
2821
3041
  ui: "widget",
2822
3042
  ...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
@@ -2826,234 +3046,243 @@ function kn(e, t) {
2826
3046
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
2827
3047
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
2828
3048
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
2829
- }), be = () => ({
3049
+ }), Se = () => ({
2830
3050
  ...t.fit ? { fit: t.fit } : {},
2831
- startButton: Dn(t)
2832
- }), xe = (e = !0) => {
2833
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ne(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), G(), e && t.onExpanded?.();
2834
- }, Se = () => {
2835
- 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");
2836
- }, Ce = (e) => {
3051
+ startButton: Bn(t),
3052
+ ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
3053
+ }), q = (e = !0) => {
3054
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), V(), a.dataset.state = "expanded", _e(null), typeof document < "u" && (O = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
3055
+ }, Ce = () => {
3056
+ 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 = O), fe(!0), W(), b?.setWidgetChrome("docked");
3057
+ }, we = (e) => {
2837
3058
  e.on("started", () => {
2838
- S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && fe());
3059
+ S || (E = !0, a.dataset.live = "true", _e(null), t.onStarted?.(), $(a.dataset.state) && pe());
3060
+ }), e.on("feedback", (e) => {
3061
+ S || t.onFeedback?.(e);
3062
+ }), e.on("feedbackFailed", (e) => {
3063
+ S || t.onFeedbackFailed?.(e);
2839
3064
  });
2840
- }, we = () => {
2841
- U(), u.hidden = !0, p.hidden = !0, ne(), 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();
2842
3065
  }, Te = () => {
2843
- H(), U(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3066
+ B(), u.hidden = !0, p.hidden = !0, V(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), ee && (o.disabled = !1), _e(null), typeof document < "u" && (document.body.style.overflow = O), W();
3067
+ }, Ee = () => {
3068
+ z(), B(), D += 1, x = !1, C = !1, w = !1, T = !1, E = !1;
2844
3069
  let e = b;
2845
3070
  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");
2846
- }, Y = () => {
3071
+ }, De = () => {
2847
3072
  if (!S && $(a.dataset.state)) {
2848
- if (W(), x = !1, b && E) {
3073
+ if (H(), x = !1, b && T) {
2849
3074
  let e = b;
2850
3075
  (async () => {
2851
- 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 && J(), t.onCollapsed?.(), t.onClose?.());
3076
+ E && (await he(), S || b !== e) || (C && e.setWidgetChrome("collapsed"), Te(), E ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : C && G(), t.onCollapsed?.(), t.onClose?.());
2852
3077
  })();
2853
3078
  return;
2854
3079
  }
2855
- Te(), we(), t.onCollapsed?.(), t.onClose?.();
3080
+ Ee(), Te(), t.onCollapsed?.(), t.onClose?.();
2856
3081
  }
2857
- }, Ee = () => {
2858
- S || yn() && V() === "expanded" && pe(() => {
2859
- Se();
2860
- });
2861
3082
  }, Oe = () => {
2862
- S || V() === "docked" && (W(), pe(() => {
2863
- ne(), xe(!1), b?.setWidgetChrome("expanded");
3083
+ S || Mn() && R() === "expanded" && me(() => {
3084
+ Ce();
3085
+ });
3086
+ }, ke = () => {
3087
+ S || R() === "docked" && (H(), me(() => {
3088
+ V(), q(!1), b?.setWidgetChrome("expanded");
2864
3089
  }));
2865
3090
  }, Ae = () => {
2866
- !b || !D || (H(), a.classList.remove("liforma-ew--session-revealed"), xe(), b.setWidgetChrome("expanded"), x = !1, fe());
2867
- }, je = () => {
2868
- !b || !E || D || (H(), a.classList.remove("liforma-ew--session-revealed"), xe(), x = !1, w && b.setWidgetChrome("expanded"));
2869
- }, Me = (e) => {
2870
- S || e !== O && !D || (H(), a.classList.remove("liforma-ew--session-revealed"), xe(), x = !1, b?.setWidgetChrome("expanded"), D && fe());
2871
- }, Ne = () => {
2872
- if (S || T || w || b || $(a.dataset.state)) return;
2873
- T = !0;
2874
- let e = O;
3091
+ !b || !E || (z(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, pe());
3092
+ }, Me = () => {
3093
+ !b || !T || E || (z(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, C || b.setWidgetChrome("expanded"));
3094
+ }, Pe = (e) => {
3095
+ S || e !== D && !E || (z(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, E && pe());
3096
+ }, Fe = () => {
3097
+ if (S || w || C || b || $(a.dataset.state)) return;
3098
+ w = !0;
3099
+ let e = D;
2875
3100
  l.hidden = !1, (async () => {
2876
3101
  try {
2877
- let t = await sn.startSession(ye());
2878
- if (S || e !== O) {
3102
+ let t = await bn.startSession(xe());
3103
+ if (S || e !== D) {
2879
3104
  t.destroy();
2880
3105
  return;
2881
3106
  }
2882
- b = t, Ce(t);
3107
+ b = t, we(t);
2883
3108
  let n = await t.attach({
2884
3109
  container: l,
2885
- ...be(),
3110
+ ...Se(),
2886
3111
  onWidgetReady: () => {
2887
- S || e !== O || (T = !1, E = !0, J());
3112
+ S || e !== D || (w = !1, T = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : G());
2888
3113
  },
2889
3114
  onWidgetExpand: () => {
2890
- Me(e);
3115
+ Pe(e);
2891
3116
  },
2892
3117
  onWidgetAudioSettings: (e) => {
2893
- S || Re(e);
3118
+ S || J(e);
2894
3119
  },
2895
3120
  onWidgetDragStart: (e) => {
2896
- S || ce(e);
3121
+ S || U(e);
2897
3122
  },
2898
3123
  onWidgetDragMove: (e) => {
2899
- S || le(e);
3124
+ S || ue(e);
2900
3125
  },
2901
3126
  onWidgetDragEnd: (e) => {
2902
- S || ue(e);
3127
+ S || de(e);
2903
3128
  },
2904
3129
  onPlayerStatusChange: (e) => {
2905
- S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
3130
+ S || e === "error" && $(a.dataset.state) && _e("Could not load the experience.");
2906
3131
  }
2907
3132
  });
2908
- if (S || e !== O) {
3133
+ if (S || e !== D) {
2909
3134
  t.destroy(), b === t && (b = null);
2910
3135
  return;
2911
3136
  }
2912
- E = !0, n.on("close", () => {
2913
- S || Y();
3137
+ n.on("close", () => {
3138
+ S || De();
2914
3139
  });
2915
3140
  } catch (n) {
2916
- if (S || e !== O) return;
2917
- T = !1, l.hidden = !0, l.replaceChildren(), b = null;
3141
+ if (S || e !== D) return;
3142
+ w = !1, l.hidden = !0, l.replaceChildren(), b = null;
2918
3143
  let r = n instanceof Error ? n : Error(String(n));
2919
3144
  t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
2920
3145
  }
2921
3146
  })();
2922
- }, Pe = () => {
2923
- if (S || x || !C || $(a.dataset.state)) return;
2924
- if (b && D) {
3147
+ }, Ie = () => {
3148
+ if (S || x || !ee || $(a.dataset.state)) return;
3149
+ if (b && E) {
2925
3150
  Ae();
2926
3151
  return;
2927
3152
  }
2928
- if (b && E) {
2929
- je();
3153
+ if (b && T) {
3154
+ Me();
2930
3155
  return;
2931
3156
  }
2932
- let e = ++O;
2933
- 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 () => {
3157
+ let e = ++D;
3158
+ x = !0, C = !1, w = !1, T = !1, E = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
2934
3159
  try {
2935
- xe();
2936
- let t = await sn.startSession(ye());
2937
- if (S || e !== O) {
3160
+ q();
3161
+ let t = await bn.startSession(xe());
3162
+ if (S || e !== D) {
2938
3163
  t.destroy();
2939
3164
  return;
2940
3165
  }
2941
- b = t, Ce(t);
3166
+ b = t, we(t);
2942
3167
  let n = await t.attach({
2943
3168
  container: v,
2944
- ...be(),
3169
+ ...Se(),
2945
3170
  onWidgetAudioSettings: (e) => {
2946
- S || Re(e);
3171
+ S || J(e);
2947
3172
  },
2948
3173
  onWidgetDragStart: (e) => {
2949
- S || ce(e);
3174
+ S || U(e);
2950
3175
  },
2951
3176
  onWidgetDragMove: (e) => {
2952
- S || le(e);
3177
+ S || ue(e);
2953
3178
  },
2954
3179
  onWidgetDragEnd: (e) => {
2955
- S || ue(e);
3180
+ S || de(e);
2956
3181
  },
2957
3182
  onPlayerStatusChange: (e) => {
2958
- S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
3183
+ S || (e === "error" ? _e("Could not load the experience.") : $(a.dataset.state) && _e(null));
2959
3184
  }
2960
3185
  });
2961
- if (S || e !== O) {
3186
+ if (S || e !== D) {
2962
3187
  t.destroy(), b === t && (b = null);
2963
3188
  return;
2964
3189
  }
2965
- E = !0, n.on("close", () => {
2966
- S || Y();
3190
+ T = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
3191
+ S || De();
2967
3192
  });
2968
3193
  } catch (n) {
2969
- if (S || e !== O) return;
3194
+ if (S || e !== D) return;
2970
3195
  let r = n instanceof Error ? n : Error(String(n));
2971
- K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3196
+ _e(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
2972
3197
  } finally {
2973
- e === O && (x = !1);
3198
+ e === D && (x = !1);
2974
3199
  }
2975
3200
  })();
2976
- }, Ie = () => {
3201
+ }, Le = () => {
2977
3202
  if (!(S || $(a.dataset.state))) {
2978
- if (b && D) {
3203
+ if (b && E) {
2979
3204
  Ae();
2980
3205
  return;
2981
3206
  }
2982
- if (b && E) {
2983
- je();
3207
+ if (b && T) {
3208
+ Me();
3209
+ return;
3210
+ }
3211
+ if (w || b) {
3212
+ q();
2984
3213
  return;
2985
3214
  }
2986
- Pe();
3215
+ Ie();
2987
3216
  }
2988
- }, Le = (e) => {
2989
- if (e.stopPropagation(), V() === "expanded") {
2990
- Ee();
3217
+ }, Re = (e) => {
3218
+ if (e.stopPropagation(), R() === "expanded") {
3219
+ Oe();
2991
3220
  return;
2992
3221
  }
2993
- V() === "docked" && Oe();
2994
- }, Re = (e) => {
3222
+ R() === "docked" && ke();
3223
+ }, J = (e) => {
2995
3224
  g.setAttribute("aria-pressed", e ? "true" : "false");
2996
- }, ze = (e) => {
2997
- e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
2998
3225
  }, Be = (e) => {
2999
- V() === "docked" && yn() && (e.target?.closest("button") || (e.preventDefault(), se(e.clientX, e.clientY, e.pointerId)));
3226
+ e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
3000
3227
  }, Ve = (e) => {
3001
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Y());
3002
- }, He = () => {
3228
+ R() === "docked" && Mn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
3229
+ }, He = (e) => {
3230
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), De());
3231
+ }, Ue = () => {
3003
3232
  if (!S) {
3004
- if (V() === "docked") {
3005
- if (!yn()) {
3006
- Oe();
3233
+ if (R() === "docked") {
3234
+ if (!Mn()) {
3235
+ ke();
3007
3236
  return;
3008
3237
  }
3009
- D ? pe(() => {
3010
- de(!0);
3011
- }) : de(!0);
3238
+ E ? me(() => {
3239
+ fe(!0);
3240
+ }) : fe(!0);
3012
3241
  return;
3013
3242
  }
3014
- G();
3243
+ W();
3015
3244
  }
3016
- }, Ue = typeof window < "u" ? window.matchMedia(ln) : null, We = () => {
3245
+ }, We = typeof window < "u" ? window.matchMedia(Sn) : null, Y = () => {
3017
3246
  if (!S) {
3018
- if (V() === "docked" && !yn()) {
3019
- Oe();
3247
+ if (R() === "docked" && !Mn()) {
3248
+ ke();
3020
3249
  return;
3021
3250
  }
3022
- G();
3251
+ W();
3023
3252
  }
3024
3253
  };
3025
- return o.addEventListener("click", Ie), d.addEventListener("click", Y), _.addEventListener("click", (e) => {
3026
- e.stopPropagation(), Y();
3027
- }), h.addEventListener("click", Le), g.addEventListener("click", ze), p.addEventListener("pointerdown", Be), window.addEventListener("keydown", Ve), window.addEventListener("resize", He), Ue?.addEventListener("change", We), ve(), G(), r === "eager" ? queueMicrotask(() => {
3028
- S || Ne();
3029
- }) : r === "idle" && (j = On(() => {
3030
- S || Ne();
3254
+ return o.addEventListener("click", Le), d.addEventListener("click", De), _.addEventListener("click", (e) => {
3255
+ e.stopPropagation(), De();
3256
+ }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Y), K(), W(), r === "eager" ? queueMicrotask(() => {
3257
+ S || Fe();
3258
+ }) : r === "idle" && (A = Vn(() => {
3259
+ S || Fe();
3031
3260
  })), {
3032
3261
  root: a,
3033
- expand: Ie,
3034
- collapse: Y,
3035
- dock: Ee,
3036
- maximize: Oe,
3262
+ expand: Le,
3263
+ collapse: De,
3264
+ dock: Oe,
3265
+ maximize: ke,
3037
3266
  prefetch() {
3038
3267
  if (r === "onExpand") {
3039
- Ne();
3268
+ Fe();
3040
3269
  return;
3041
3270
  }
3042
- Ne();
3271
+ Fe();
3043
3272
  },
3044
3273
  destroy() {
3045
- S || (S = !0, W(), j?.(), j = null, B.abort(), A?.(), A = null, window.removeEventListener("keydown", Ve), window.removeEventListener("resize", He), Ue?.removeEventListener("change", We), Te(), we(), e.replaceChildren());
3274
+ S || (S = !0, H(), A?.(), A = null, ie.abort(), k?.(), k = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Y), Ee(), Te(), e.replaceChildren());
3046
3275
  }
3047
3276
  };
3048
3277
  }
3049
3278
  //#endregion
3050
3279
  //#region src/react/ExperienceWidget.tsx
3051
- function An(e) {
3052
- 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, className: D = "", onExpanded: O, onCollapsed: k, onStarted: A, onClose: j, onError: M, onPrefetchReady: N } = e, P = m === "bottom-right" || m === "bottom-left";
3280
+ function Un(e) {
3281
+ 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: ee, expandedMaxHeight: C, startButtonLabel: w, startButton: T, showFeedback: E, className: D = "", onExpanded: O, onCollapsed: k, onStarted: A, onClose: j, onError: M, onPrefetchReady: N, onFeedback: P, onFeedbackFailed: F } = e, te = m === "bottom-right" || m === "bottom-left";
3053
3282
  return n(() => {
3054
3283
  let e = t.current;
3055
3284
  if (!e || !r.trim()) return;
3056
- let n = kn(e, {
3285
+ let n = Hn(e, {
3057
3286
  experienceId: r,
3058
3287
  alt: i,
3059
3288
  galleryThumb: a,
@@ -3072,10 +3301,13 @@ function An(e) {
3072
3301
  speechOnly: b,
3073
3302
  fit: x,
3074
3303
  embedBaseUrl: S,
3075
- expandedMaxWidth: C,
3076
- expandedMaxHeight: w,
3077
- startButtonLabel: T,
3078
- startButton: E,
3304
+ expandedMaxWidth: ee,
3305
+ expandedMaxHeight: C,
3306
+ startButtonLabel: w,
3307
+ startButton: T,
3308
+ showFeedback: E,
3309
+ onFeedback: P,
3310
+ onFeedbackFailed: F,
3079
3311
  onExpanded: O,
3080
3312
  onCollapsed: k,
3081
3313
  onStarted: A,
@@ -3103,10 +3335,13 @@ function An(e) {
3103
3335
  b,
3104
3336
  x,
3105
3337
  S,
3338
+ ee,
3106
3339
  C,
3107
3340
  w,
3108
3341
  T,
3109
3342
  E,
3343
+ P,
3344
+ F,
3110
3345
  O,
3111
3346
  k,
3112
3347
  A,
@@ -3116,7 +3351,7 @@ function An(e) {
3116
3351
  ]), /* @__PURE__ */ d("div", {
3117
3352
  ref: t,
3118
3353
  className: D,
3119
- style: P ? { display: "contents" } : {
3354
+ style: te ? { display: "contents" } : {
3120
3355
  width: "100%",
3121
3356
  height: "100%",
3122
3357
  minHeight: "inherit"
@@ -3124,6 +3359,6 @@ function An(e) {
3124
3359
  });
3125
3360
  }
3126
3361
  //#endregion
3127
- export { L as Experience, Ee as ExperienceThumbnail, An as ExperienceWidget };
3362
+ export { ne as Experience, Ae as ExperienceThumbnail, Un as ExperienceWidget };
3128
3363
 
3129
3364
  //# sourceMappingURL=index.js.map