@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,12 +39,9 @@ function g(e) {
39
39
  return e === void 0 || e === "auto" || e === "manual" || e === "off";
40
40
  }
41
41
  function _(e) {
42
- return e === void 0 || e === "managed" || e === "custom" || e === "manual";
43
- }
44
- function v(e) {
45
42
  return e === 400 || e === 401 || e === 403 || e === 404 || e === 429 ? e : 502;
46
43
  }
47
- function y(e = {}) {
44
+ function v(e = {}) {
48
45
  let t = e.getApiKey ?? l, n = e.getApiBaseUrl ?? u, r = e.fetch ?? fetch;
49
46
  return async (i) => {
50
47
  if (!e.authorize && e.allowUnauthenticated !== !0) return c({ message: "Session route requires authorize() or allowUnauthenticated: true. Open mint proxies are not allowed by default." }, 403);
@@ -55,24 +52,24 @@ function y(e = {}) {
55
52
  if (l?.locale !== void 0 && !p(l.locale) || l?.language !== void 0 && l?.locale === void 0 && !m(l.language)) return c({ message: "Invalid locale." }, 400);
56
53
  if (!h(l?.mode)) return c({ message: "Invalid mode." }, 400);
57
54
  if (!g(l?.speechInputMode)) return c({ message: "Invalid speechInputMode." }, 400);
58
- if (!_(l?.responseMode)) return c({ message: "Invalid responseMode." }, 400);
59
55
  if (e.authorize) {
60
56
  let t = await e.authorize(i, l ?? {});
61
57
  if (t instanceof Response) return t;
62
58
  }
63
- let y = { experienceId: u }, b = l?.locale?.trim() || l?.language?.trim();
64
- b && (y.locale = b), l?.mode && (y.mode = l.mode), l?.responseMode && (y.responseMode = l.responseMode), l?.speechInputMode && (y.speechInputMode = l.speechInputMode), l?.speechOnly === !0 && (y.speechOnly = !0), l?.speechOnly === !1 && (y.speechOnly = !1), l?.processorId?.trim() && (y.processorId = l.processorId.trim());
65
- let x = await r(`${o}/v1/sessions`, {
59
+ let v = { experienceId: u }, y = l?.locale?.trim() || l?.language?.trim();
60
+ y && (v.locale = y), l?.mode && (v.mode = l.mode), l?.speechInputMode && (v.speechInputMode = l.speechInputMode), l?.speechOnly === !0 && (v.speechOnly = !0), l?.speechOnly === !1 && (v.speechOnly = !1), l?.processorId?.trim() && (v.processorId = l.processorId.trim());
61
+ let b = i.headers.get("Idempotency-Key")?.trim(), x = await r(`${o}/v1/sessions`, {
66
62
  method: "POST",
67
63
  headers: {
68
64
  Authorization: `Bearer ${a}`,
69
65
  "Content-Type": "application/json",
70
- Accept: "application/json"
66
+ Accept: "application/json",
67
+ ...b ? { "Idempotency-Key": b } : {}
71
68
  },
72
- body: JSON.stringify(y)
69
+ body: JSON.stringify(v)
73
70
  });
74
71
  if (!x.ok) {
75
- let e = v(x.status), t = "Could not start session.";
72
+ let e = _(x.status), t = "Could not start session.";
76
73
  try {
77
74
  let e = await x.json();
78
75
  typeof e.message == "string" && e.message.trim() && (t = e.message);
@@ -90,28 +87,33 @@ function y(e = {}) {
90
87
  };
91
88
  }
92
89
  //#endregion
90
+ //#region src/thumbnail/types.ts
91
+ function y(e) {
92
+ return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
93
+ }
94
+ //#endregion
93
95
  //#region src/thumbnail/toGalleryThumbUrl.ts
94
- var b = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, x = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
95
- function S(e) {
96
+ var b = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, x = /_CH(\.webp)/i, S = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
97
+ function C(e) {
96
98
  let t = e.trim();
97
99
  if (!t) return t;
98
100
  let n = t.replace(b, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
99
- return n = n.replace(x, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
101
+ return n = n.replace(x, "_neutral$1"), n = n.replace(S, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
100
102
  }
101
- function ee(e) {
103
+ function w(e) {
102
104
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
103
105
  if (!t) return null;
104
106
  let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
105
107
  return {
106
- avatarImage: S(t),
107
- ...n ? { backgroundImage: S(n) } : {},
108
- ...r ? { foregroundImage: S(r) } : {},
109
- ...i ? { fallbackImage: S(i) } : {}
108
+ avatarImage: C(t),
109
+ ...n ? { backgroundImage: C(n) } : {},
110
+ ...r ? { foregroundImage: C(r) } : {},
111
+ ...i ? { fallbackImage: C(i) } : {}
110
112
  };
111
113
  }
112
114
  //#endregion
113
115
  //#region src/shims/localStack.ts
114
- function C() {
116
+ function T() {
115
117
  if (globalThis.__LIFORMA_STACK === "local") return !0;
116
118
  if (typeof location > "u") return !1;
117
119
  try {
@@ -122,83 +124,83 @@ function C() {
122
124
  }
123
125
  //#endregion
124
126
  //#region src/thumbnail/hostedLaunchUrl.ts
125
- var w = "https://player.liforma.ai", T = "http://localhost:3002";
126
- function E(e) {
127
+ var E = "https://player.liforma.ai", D = "http://localhost:3002";
128
+ function O(e) {
127
129
  return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
128
130
  }
129
- function D(e) {
131
+ function k(e) {
130
132
  let t = e?.trim();
131
- return t ? t.replace(/\/$/, "") : C() ? T : w;
133
+ return t ? t.replace(/\/$/, "") : T() ? D : E;
132
134
  }
133
- function O(e) {
134
- let t = e.experienceId.trim(), n = D(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
135
+ function A(e) {
136
+ let t = e.experienceId.trim(), n = k(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
135
137
  return i && r.searchParams.set("returnUrl", i), r.toString();
136
138
  }
137
- function k(e) {
139
+ function ee(e) {
138
140
  let t = e.href?.trim();
139
141
  if (t) return t;
140
142
  let n = e.experienceId?.trim();
141
143
  if (!n) return;
142
144
  let r = e.returnUrl?.trim();
143
- return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), O({
145
+ return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), A({
144
146
  experienceId: n,
145
147
  ...r ? { returnUrl: r } : {},
146
148
  playerBaseUrl: e.playerBaseUrl
147
149
  });
148
150
  }
149
- function A() {
151
+ function j() {
150
152
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
151
153
  }
152
- var j = 0, M = [];
153
- function N() {
154
- return A() ? 4 : Infinity;
155
- }
154
+ var M = 0, N = [];
156
155
  function P() {
157
- return A() ? 160 : 0;
156
+ return j() ? 4 : Infinity;
158
157
  }
159
158
  function F() {
160
- let e = N();
161
- for (; j < e && M.length > 0;) {
162
- let e = M.shift();
159
+ return j() ? 160 : 0;
160
+ }
161
+ function te() {
162
+ let e = P();
163
+ for (; M < e && N.length > 0;) {
164
+ let e = N.shift();
163
165
  if (!e || e.cancelled) continue;
164
- j += 1, e.start();
165
- let t = P();
166
+ M += 1, e.start();
167
+ let t = F();
166
168
  if (t <= 0) {
167
- j = Math.max(0, j - 1);
169
+ M = Math.max(0, M - 1);
168
170
  continue;
169
171
  }
170
172
  window.setTimeout(() => {
171
- j = Math.max(0, j - 1), F();
173
+ M = Math.max(0, M - 1), te();
172
174
  }, t);
173
175
  }
174
176
  }
175
- function I(e) {
176
- if (!A()) return e(), () => {};
177
+ function ne(e) {
178
+ if (!j()) return e(), () => {};
177
179
  let t = {
178
180
  start: e,
179
181
  cancelled: !1
180
182
  };
181
- return M.push(t), F(), () => {
183
+ return N.push(t), te(), () => {
182
184
  t.cancelled = !0;
183
185
  };
184
186
  }
185
187
  //#endregion
186
188
  //#region src/thumbnail/lazyLoad.ts
187
- function L() {
188
- return A() ? "96px 0px" : "280px 0px";
189
+ function I() {
190
+ return j() ? "96px 0px" : "280px 0px";
189
191
  }
190
- function R(e) {
192
+ function L(e) {
191
193
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
192
194
  return Number.isFinite(n) ? Math.abs(n) : 280;
193
195
  }
194
- function te(e, t) {
196
+ function re(e, t) {
195
197
  if (typeof window > "u") return !1;
196
198
  let n = e.getBoundingClientRect();
197
199
  return n.bottom >= -t && n.top <= window.innerHeight + t;
198
200
  }
199
- function ne(e, t) {
200
- let { onVisibleChange: n } = t, r = t.rootMargin ?? L(), i = R(r), a = !1, o = !1, s = null, c = () => {
201
- o || (s?.(), s = I(() => {
201
+ function ie(e, t) {
202
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? I(), i = L(r), a = !1, o = !1, s = null, c = () => {
203
+ o || (s?.(), s = ne(() => {
202
204
  s = null, o = !0, n(!0);
203
205
  }));
204
206
  }, l = (e) => {
@@ -220,21 +222,21 @@ function ne(e, t) {
220
222
  rootMargin: r,
221
223
  threshold: 0
222
224
  });
223
- return u.observe(e), te(e, i) && l(!0), () => {
225
+ return u.observe(e), re(e, i) && l(!0), () => {
224
226
  s?.(), s = null, u.disconnect();
225
227
  };
226
228
  }
227
229
  //#endregion
228
230
  //#region src/thumbnail/scrollParallax.ts
229
- function re() {
231
+ function R() {
230
232
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
231
233
  }
232
234
  function z(e, t) {
233
235
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
234
236
  }
235
- var B = /* @__PURE__ */ new Set(), V = !1, H = 0;
236
- function ie() {
237
- if (H = 0, B.size === 0 || typeof window > "u") return;
237
+ var B = /* @__PURE__ */ new Set(), ae = !1, V = 0;
238
+ function oe() {
239
+ if (V = 0, B.size === 0 || typeof window > "u") return;
238
240
  let e = window.innerHeight;
239
241
  for (let t of B) {
240
242
  if (t.pointerActive?.()) continue;
@@ -242,33 +244,33 @@ function ie() {
242
244
  n.bottom < -64 || n.top > e + 64 || t.onParallax(z(n, e));
243
245
  }
244
246
  }
245
- function ae() {
246
- H === 0 && (H = requestAnimationFrame(ie));
247
+ function se() {
248
+ V === 0 && (V = requestAnimationFrame(oe));
247
249
  }
248
- function oe() {
249
- V || typeof window > "u" || (V = !0, window.addEventListener("scroll", ae, { passive: !0 }), window.addEventListener("resize", ae, { passive: !0 }));
250
+ function ce() {
251
+ ae || typeof window > "u" || (ae = !0, window.addEventListener("scroll", se, { passive: !0 }), window.addEventListener("resize", se, { passive: !0 }));
250
252
  }
251
- function se() {
252
- B.size > 0 || !V || typeof window > "u" || (V = !1, H !== 0 && (cancelAnimationFrame(H), H = 0), window.removeEventListener("scroll", ae), window.removeEventListener("resize", ae));
253
+ function H() {
254
+ B.size > 0 || !ae || typeof window > "u" || (ae = !1, V !== 0 && (cancelAnimationFrame(V), V = 0), window.removeEventListener("scroll", se), window.removeEventListener("resize", se));
253
255
  }
254
- function U(e, t) {
255
- if (!re()) return () => {};
256
+ function le(e, t) {
257
+ if (!R()) return () => {};
256
258
  let n = {
257
259
  element: e,
258
260
  onParallax: t.onParallax,
259
261
  pointerActive: t.pointerActive
260
262
  };
261
- return B.add(n), oe(), n.pointerActive?.() || t.onParallax(z(e.getBoundingClientRect(), window.innerHeight)), () => {
262
- B.delete(n), se();
263
+ return B.add(n), ce(), n.pointerActive?.() || t.onParallax(z(e.getBoundingClientRect(), window.innerHeight)), () => {
264
+ B.delete(n), H();
263
265
  };
264
266
  }
265
267
  //#endregion
266
268
  //#region src/thumbnail/attachThumbnailParallax.ts
267
- function ce(e) {
269
+ function ue(e) {
268
270
  let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
269
271
  let a = r || i;
270
272
  e.classList.toggle("liforma-et--parallax", a), e.classList.toggle("liforma-et--scroll-parallax", i), e.style.setProperty("--liforma-et-parallax-x", String(t)), e.style.setProperty("--liforma-et-parallax-y", String(n));
271
- }, s = U(e, {
273
+ }, s = le(e, {
272
274
  onParallax: (e) => {
273
275
  i = !0, a || (t = e, n = 0, o());
274
276
  },
@@ -293,243 +295,244 @@ function ce(e) {
293
295
  }
294
296
  //#endregion
295
297
  //#region src/thumbnail/styles.ts
296
- var le = ".liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: 50% 30%;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--scene .liforma-et__avatar {\n object-fit: contain;\n object-position: center bottom;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax:not(.liforma-et--scene) {\n --liforma-et-avatar-scale: 1.05;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", ue = !1;
297
- function de(e) {
298
- if (typeof document > "u" || ue) return;
298
+ var de = ".liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", U = !1;
299
+ function W(e) {
300
+ if (typeof document > "u" || U) return;
299
301
  if (document.querySelector("style[data-liforma-et]")) {
300
- ue = !0;
302
+ U = !0;
301
303
  return;
302
304
  }
303
305
  let t = document.createElement("style");
304
- t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), ue = !0;
306
+ t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), U = !0;
305
307
  }
306
308
  //#endregion
307
309
  //#region src/react/ExperienceThumbnail.tsx
308
- function W(e, t) {
310
+ function fe(e, t) {
309
311
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
310
312
  }
311
- function G(s) {
312
- let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, lazy: x = !0, className: S = "", fallbackImage: C } = s, w = t(() => ee({
313
+ function pe(s) {
314
+ let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: x = !0, fit: S = "full", lazy: C = !0, className: T = "", fallbackImage: E } = s, D = t(() => w({
313
315
  galleryThumb: c,
314
316
  avatarImage: l,
315
317
  backgroundImage: u,
316
318
  foregroundImage: d,
317
- fallbackImage: C
319
+ fallbackImage: E
318
320
  }), [
319
321
  c,
320
322
  l,
321
323
  u,
322
324
  d,
323
- C
324
- ]), T = E({
325
+ E
326
+ ]), k = O({
325
327
  href: m,
326
328
  hasClickHandler: typeof _ == "function",
327
329
  experienceId: p
328
- }), D = T === "anchor" && !m?.trim() && !!p?.trim(), O = !!w?.backgroundImage, A = b !== !1, j = n(null), M = n(!1), [N, P] = r(!x), [F, I] = r(!1), [L, R] = r(!1), [te, re] = r(0), [B, V] = r(0), [H, ie] = r(!1), [ae, oe] = r(!1), [se, ce] = r(!1), [ue, G] = r(!1), [fe, K] = r(), pe = w ? H && w.fallbackImage ? w.fallbackImage : w.avatarImage : "";
330
+ }), A = k === "anchor" && !m?.trim() && !!p?.trim(), j = !!D?.backgroundImage, M = x !== !1, N = n(null), P = n(!1), [F, te] = r(!C), [ne, I] = r(!1), [L, re] = r(!1), [R, B] = r(0), [ae, V] = r(0), [oe, se] = r(!1), [ce, H] = r(!1), [ue, U] = r(!1), [pe, me] = r(!1), [G, he] = r(), ge = D ? oe && D.fallbackImage ? D.fallbackImage : D.avatarImage : "";
329
331
  e(() => {
330
- de(le);
332
+ W(de);
331
333
  }, []), e(() => {
332
- K(k({
334
+ he(ee({
333
335
  href: m,
334
336
  experienceId: p,
335
337
  returnUrl: v,
336
- playerBaseUrl: y,
337
- useCurrentPageAsReturnUrl: D && !v?.trim()
338
+ playerBaseUrl: b,
339
+ useCurrentPageAsReturnUrl: A && !v?.trim()
338
340
  }));
339
341
  }, [
340
342
  m,
341
343
  p,
342
344
  v,
343
- y,
344
- D
345
+ b,
346
+ A
345
347
  ]), e(() => {
346
- oe(!1), ce(!1), G(!1), ie(!1);
348
+ H(!1), U(!1), me(!1), se(!1);
347
349
  }, [
348
- w?.backgroundImage,
349
- w?.foregroundImage,
350
- pe
350
+ D?.backgroundImage,
351
+ D?.foregroundImage,
352
+ ge
351
353
  ]), e(() => {
352
- let e = j.current;
354
+ let e = N.current;
353
355
  if (e) {
354
- if (!x) {
355
- P(!0);
356
+ if (!C) {
357
+ te(!0);
356
358
  return;
357
359
  }
358
- return ne(e, { onVisibleChange: (e) => {
359
- e && P(!0);
360
+ return ie(e, { onVisibleChange: (e) => {
361
+ e && te(!0);
360
362
  } });
361
363
  }
362
364
  }, [
363
- x,
364
- w,
365
- T,
366
- fe
365
+ C,
366
+ D,
367
+ k,
368
+ G
367
369
  ]), e(() => {
368
- let e = j.current;
369
- if (!(!e || !A)) return U(e, {
370
+ let e = N.current;
371
+ if (!(!e || !M)) return le(e, {
370
372
  onParallax: (e) => {
371
- R(!0), M.current || (re(e), V(0));
373
+ re(!0), P.current || (B(e), V(0));
372
374
  },
373
- pointerActive: () => M.current
375
+ pointerActive: () => P.current
374
376
  });
375
377
  }, [
376
- A,
377
- w,
378
- T,
379
- fe
378
+ M,
379
+ D,
380
+ k,
381
+ G
380
382
  ]);
381
- let me = (e) => {
382
- if (!A || L) return;
383
+ let _e = (e) => {
384
+ if (!M || L) return;
383
385
  let t = e.currentTarget.getBoundingClientRect();
384
- t.width <= 0 || t.height <= 0 || (re(((e.clientX - t.left) / t.width - .5) * 2), V(((e.clientY - t.top) / t.height - .5) * 2));
385
- }, he = (e) => {
386
- let t = M.current;
387
- M.current = !1, I(!1), L && t ? (re(z(e.getBoundingClientRect(), window.innerHeight)), V(0)) : L || (re(0), V(0));
388
- }, ge = (e) => {
389
- if (!A) return;
390
- M.current = !0, e.pointerType === "mouse" && I(!0);
386
+ t.width <= 0 || t.height <= 0 || (B(((e.clientX - t.left) / t.width - .5) * 2), V(((e.clientY - t.top) / t.height - .5) * 2));
387
+ }, K = (e) => {
388
+ let t = P.current;
389
+ P.current = !1, I(!1), L && t ? (B(z(e.getBoundingClientRect(), window.innerHeight)), V(0)) : L || (B(0), V(0));
390
+ }, ve = (e) => {
391
+ if (!M) return;
392
+ P.current = !0, e.pointerType === "mouse" && I(!0);
391
393
  let t = e.currentTarget, n = () => {
392
- he(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
394
+ K(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
393
395
  };
394
396
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
395
- }, q = (e) => {
396
- if (_?.(e), !e.defaultPrevented && D && !v?.trim()) {
397
- let t = k({
397
+ }, ye = (e) => {
398
+ if (_?.(e), !e.defaultPrevented && A && !v?.trim()) {
399
+ let t = ee({
398
400
  experienceId: p,
399
- playerBaseUrl: y,
401
+ playerBaseUrl: b,
400
402
  useCurrentPageAsReturnUrl: !0
401
403
  });
402
404
  t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
403
405
  }
404
406
  };
405
- if (!w) return null;
406
- let _e = A && (F || L), ve = N && (se || ae || ue), ye = [
407
+ if (!D) return null;
408
+ let be = M && (ne || L), q = F && (ue || ce || pe), xe = [
407
409
  "liforma-et",
408
- O ? "liforma-et--scene" : "",
409
- _e ? "liforma-et--parallax" : "",
410
+ j ? "liforma-et--scene" : "",
411
+ y(S),
412
+ be ? "liforma-et--parallax" : "",
410
413
  L ? "liforma-et--scroll-parallax" : "",
411
- N && !ve ? "liforma-et--loading" : "",
412
- ve ? "liforma-et--revealed" : "",
413
- S
414
- ].filter(Boolean).join(" "), be = {
415
- "--liforma-et-parallax-x": te,
416
- "--liforma-et-parallax-y": B
417
- }, xe = (e, t) => {
414
+ F && !q ? "liforma-et--loading" : "",
415
+ q ? "liforma-et--revealed" : "",
416
+ T
417
+ ].filter(Boolean).join(" "), Se = {
418
+ "--liforma-et-parallax-x": R,
419
+ "--liforma-et-parallax-y": ae
420
+ }, Ce = (e, t) => {
418
421
  e.complete && t(!0);
419
- }, Se = /* @__PURE__ */ o(i, { children: [
422
+ }, we = /* @__PURE__ */ o(i, { children: [
420
423
  /* @__PURE__ */ a("span", {
421
424
  className: "liforma-et__placeholder",
422
425
  "aria-hidden": "true"
423
426
  }),
424
- N && w.backgroundImage ? /* @__PURE__ */ a("img", {
425
- className: W("liforma-et__background", ae),
426
- src: w.backgroundImage,
427
+ F && D.backgroundImage ? /* @__PURE__ */ a("img", {
428
+ className: fe("liforma-et__background", ce),
429
+ src: D.backgroundImage,
427
430
  alt: "",
428
431
  decoding: "async",
429
432
  ref: (e) => {
430
- e && xe(e, oe);
433
+ e && Ce(e, H);
431
434
  },
432
- onLoad: () => oe(!0),
433
- onError: () => oe(!0)
435
+ onLoad: () => H(!0),
436
+ onError: () => H(!0)
434
437
  }) : null,
435
- N && pe ? /* @__PURE__ */ a("img", {
436
- className: W("liforma-et__avatar", se),
437
- src: pe,
438
+ F && ge ? /* @__PURE__ */ a("img", {
439
+ className: fe("liforma-et__avatar", ue),
440
+ src: ge,
438
441
  alt: "",
439
442
  decoding: "async",
440
443
  ref: (e) => {
441
- e && xe(e, ce);
444
+ e && Ce(e, U);
442
445
  },
443
- onLoad: () => ce(!0),
446
+ onLoad: () => U(!0),
444
447
  onError: () => {
445
- w.fallbackImage ? ie(!0) : ce(!0);
448
+ D.fallbackImage ? se(!0) : U(!0);
446
449
  }
447
450
  }) : null,
448
- N && w.foregroundImage ? /* @__PURE__ */ a("img", {
449
- className: W("liforma-et__foreground", ue),
450
- src: w.foregroundImage,
451
+ F && D.foregroundImage ? /* @__PURE__ */ a("img", {
452
+ className: fe("liforma-et__foreground", pe),
453
+ src: D.foregroundImage,
451
454
  alt: "",
452
455
  decoding: "async",
453
456
  ref: (e) => {
454
- e && xe(e, G);
457
+ e && Ce(e, me);
455
458
  },
456
- onLoad: () => G(!0),
457
- onError: () => G(!0)
459
+ onLoad: () => me(!0),
460
+ onError: () => me(!0)
458
461
  }) : null
459
462
  ] }), J = {
460
- onPointerDown: ge,
461
- onPointerUp: (e) => he(e.currentTarget),
462
- onPointerCancel: (e) => he(e.currentTarget),
463
+ onPointerDown: ve,
464
+ onPointerUp: (e) => K(e.currentTarget),
465
+ onPointerCancel: (e) => K(e.currentTarget),
463
466
  onPointerEnter: (e) => {
464
- A && e.pointerType === "mouse" && I(!0);
467
+ M && e.pointerType === "mouse" && I(!0);
465
468
  },
466
- onPointerMove: me,
469
+ onPointerMove: _e,
467
470
  onPointerLeave: () => {
468
- M.current || (I(!1), L || (re(0), V(0)));
471
+ P.current || (I(!1), L || (B(0), V(0)));
469
472
  }
470
- }, Ce = (e) => {
471
- j.current = e;
473
+ }, Y = (e) => {
474
+ N.current = e;
472
475
  };
473
- return T === "anchor" && fe ? /* @__PURE__ */ a("a", {
474
- ref: Ce,
475
- className: ye,
476
- style: be,
477
- href: fe,
476
+ return k === "anchor" && G ? /* @__PURE__ */ a("a", {
477
+ ref: Y,
478
+ className: xe,
479
+ style: Se,
480
+ href: G,
478
481
  target: h,
479
482
  rel: g,
480
483
  "aria-label": f,
481
- onClick: q,
484
+ onClick: ye,
482
485
  ...J,
483
- children: Se
484
- }) : T === "button" ? /* @__PURE__ */ a("button", {
486
+ children: we
487
+ }) : k === "button" ? /* @__PURE__ */ a("button", {
485
488
  type: "button",
486
- ref: Ce,
487
- className: ye,
488
- style: be,
489
+ ref: Y,
490
+ className: xe,
491
+ style: Se,
489
492
  "aria-label": f,
490
- onClick: q,
493
+ onClick: ye,
491
494
  ...J,
492
- children: Se
495
+ children: we
493
496
  }) : /* @__PURE__ */ a("div", {
494
- ref: Ce,
495
- className: ye,
496
- style: be,
497
+ ref: Y,
498
+ className: xe,
499
+ style: Se,
497
500
  role: f ? "img" : void 0,
498
501
  "aria-label": f || void 0,
499
502
  "aria-hidden": f ? void 0 : !0,
500
503
  ...J,
501
- children: Se
504
+ children: we
502
505
  });
503
506
  }
504
507
  //#endregion
505
508
  //#region src/widget/styles.ts
506
- var fe = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", K = "liforma-experience-widget-styles";
507
- function pe(e = fe) {
509
+ var me = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", G = "liforma-experience-widget-styles";
510
+ function he(e = me) {
508
511
  if (typeof document > "u") return;
509
- let t = document.getElementById(K);
512
+ let t = document.getElementById(G);
510
513
  if (t) {
511
514
  t.textContent = e;
512
515
  return;
513
516
  }
514
517
  let n = document.createElement("style");
515
- n.id = K, n.textContent = e, document.head.append(n);
518
+ n.id = G, n.textContent = e, document.head.append(n);
516
519
  }
517
520
  //#endregion
518
521
  //#region src/shims/apiBaseUrl.ts
519
- var me = "https://api.liforma.ai", he = "http://localhost:3001";
520
- function ge() {
522
+ var ge = "https://api.liforma.ai", _e = "http://localhost:3001";
523
+ function K() {
521
524
  let e = globalThis.__LIFORMA_API_BASE_URL;
522
525
  if (e?.trim()) return e.trim().replace(/\/$/, "");
523
526
  if (typeof document > "u") return null;
524
527
  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();
525
528
  return t ? t.replace(/\/$/, "") : null;
526
529
  }
527
- function q() {
528
- return ge() || (C() ? he : me);
530
+ function ve() {
531
+ return K() || (T() ? _e : ge);
529
532
  }
530
533
  //#endregion
531
534
  //#region src/v2/api/fetchExperiencePreview.ts
532
- function _e(e) {
535
+ function ye(e) {
533
536
  if (!e || typeof e != "object") return null;
534
537
  let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
535
538
  return n ? {
@@ -538,10 +541,10 @@ function _e(e) {
538
541
  ...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
539
542
  } : null;
540
543
  }
541
- async function ve(e, t) {
544
+ async function be(e, t) {
542
545
  let n = e.trim();
543
546
  if (!n) throw Error("Experience preview requires experienceId.");
544
- let r = (t?.apiBaseUrl ?? q()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
547
+ let r = (t?.apiBaseUrl ?? ve()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
545
548
  method: "GET",
546
549
  headers: { Accept: "application/json" },
547
550
  signal: t?.signal
@@ -561,7 +564,7 @@ async function ve(e, t) {
561
564
  throw Error("Experience preview returned invalid JSON.");
562
565
  }
563
566
  if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
564
- let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = _e(o.galleryThumb);
567
+ let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = ye(o.galleryThumb);
565
568
  if (!l) throw Error("Experience preview is missing gallery thumb images.");
566
569
  return {
567
570
  experienceId: s || n,
@@ -570,20 +573,47 @@ async function ve(e, t) {
570
573
  };
571
574
  }
572
575
  //#endregion
576
+ //#region src/v2/errors/LiformaError.ts
577
+ var q = class extends Error {
578
+ code;
579
+ requestId;
580
+ status;
581
+ details;
582
+ constructor(e, t) {
583
+ 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;
584
+ }
585
+ };
586
+ function xe(e) {
587
+ if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
588
+ }
589
+ function Se(e, t, n) {
590
+ let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
591
+ try {
592
+ i = JSON.parse(t);
593
+ } catch {}
594
+ 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 } = xe(a) ?? xe(i) ?? {};
595
+ return new q(u, {
596
+ code: l,
597
+ requestId: d,
598
+ status: e,
599
+ details: Object.keys(h).length > 0 ? h : void 0
600
+ });
601
+ }
602
+ //#endregion
573
603
  //#region src/v2/api/sessionEndpointRequest.ts
574
- function ye(e) {
604
+ function Ce(e) {
575
605
  let t = e.locale?.trim();
576
606
  if (t) return t;
577
607
  let n = e.language?.trim();
578
608
  if (n) return n;
579
609
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
580
610
  }
581
- function be(e) {
611
+ function we(e) {
582
612
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
583
613
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
584
614
  return t || n || void 0;
585
615
  }
586
- function xe(e, t) {
616
+ function J(e, t) {
587
617
  let n = e.trim();
588
618
  if (!n) throw Error("sessionEndpoint must not be empty.");
589
619
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -591,7 +621,7 @@ function xe(e, t) {
591
621
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
592
622
  let i = t.experienceId.trim();
593
623
  if (!i) throw Error("sessionEndpoint requires experienceId.");
594
- let a = ye(t), o = be(t);
624
+ let a = Ce(t), o = we(t), s = t.idempotencyKey?.trim();
595
625
  return {
596
626
  url: r.toString(),
597
627
  init: {
@@ -599,14 +629,14 @@ function xe(e, t) {
599
629
  credentials: "same-origin",
600
630
  headers: {
601
631
  Accept: "application/json",
602
- "Content-Type": "application/json"
632
+ "Content-Type": "application/json",
633
+ ...s ? { "Idempotency-Key": s } : {}
603
634
  },
604
635
  body: JSON.stringify({
605
636
  experienceId: i,
606
637
  ...a ? { locale: a } : {},
607
638
  ...o ? { secondaryLocale: o } : {},
608
639
  ...t.mode ? { mode: t.mode } : {},
609
- ...t.responseMode ? { responseMode: t.responseMode } : {},
610
640
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
611
641
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly }
612
642
  })
@@ -615,24 +645,44 @@ function xe(e, t) {
615
645
  }
616
646
  //#endregion
617
647
  //#region src/v2/types/sessionLaunch.ts
618
- function Se(e) {
648
+ function Y(e) {
619
649
  return !!e && typeof e == "object" && !Array.isArray(e);
620
650
  }
621
- function J(e) {
651
+ function X(e) {
622
652
  return typeof e == "boolean";
623
653
  }
624
- function Ce(e) {
625
- return !Se(e) || !J(e.avatar) || !J(e.speechInput) || !J(e.speechOutput) || !J(e.tools) || !J(e.externalAudio) ? null : {
626
- avatar: e.avatar,
627
- speechInput: e.speechInput,
628
- speechOutput: e.speechOutput,
629
- tools: e.tools,
630
- externalAudio: e.externalAudio
654
+ function Te(e) {
655
+ if (!Y(e)) return null;
656
+ let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
657
+ 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 : {
658
+ speech: {
659
+ input: t.input,
660
+ output: t.output,
661
+ externalAudio: t.externalAudio
662
+ },
663
+ conversation: { managed: n.managed },
664
+ avatar: { enabled: r.enabled },
665
+ tools: { enabled: i.enabled }
631
666
  };
632
667
  }
633
- function we(e) {
634
- if (!Se(e)) throw Error("Session Launch response is missing session.");
635
- let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = Ce(e.capabilities);
668
+ function Ee(e) {
669
+ return !Y(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
670
+ speech: {
671
+ input: e.speechInput,
672
+ output: e.speechOutput,
673
+ externalAudio: e.externalAudio
674
+ },
675
+ conversation: { managed: !0 },
676
+ avatar: { enabled: e.avatar },
677
+ tools: { enabled: e.tools }
678
+ };
679
+ }
680
+ function De(e) {
681
+ return Te(e) ?? Ee(e);
682
+ }
683
+ function Oe(e) {
684
+ if (!Y(e)) throw Error("Session Launch response is missing session.");
685
+ 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 = De(e.capabilities), l = ke(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
636
686
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
637
687
  return {
638
688
  id: t,
@@ -642,76 +692,123 @@ function we(e) {
642
692
  locale: a,
643
693
  ...o ? { secondaryLocale: o } : {},
644
694
  mode: s,
645
- capabilities: c
695
+ capabilities: c,
696
+ ...l ? { localeVoiceFallbacks: l } : {},
697
+ ...u ? { status: u } : {},
698
+ ...d ? { createdAt: d } : {}
646
699
  };
647
700
  }
648
- function Te(e) {
649
- if (!Se(e)) throw Error("Session Launch response must be a JSON object.");
701
+ function ke(e) {
702
+ if (!Array.isArray(e) || e.length === 0) return;
703
+ let t = [];
704
+ for (let n of e) {
705
+ if (!Y(n)) continue;
706
+ 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() : "";
707
+ !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
708
+ axis: e,
709
+ requested: r,
710
+ resolved: i,
711
+ reason: "voice_unsupported"
712
+ });
713
+ }
714
+ return t.length > 0 ? t : void 0;
715
+ }
716
+ function Ae(e) {
717
+ let t = e.localeVoiceFallbacks;
718
+ if (t?.length) for (let e of t) {
719
+ let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
720
+ console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
721
+ }
722
+ }
723
+ function je(e) {
724
+ if (!Y(e)) throw Error("Session Launch response must be a JSON object.");
650
725
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
651
726
  if (!t) throw Error("Session Launch response is missing launch.");
652
- return {
653
- session: we(e.session),
727
+ let n = Oe(e.session);
728
+ return Ae(n), {
729
+ session: n,
654
730
  launch: t
655
731
  };
656
732
  }
657
733
  //#endregion
658
734
  //#region src/v2/api/mintPublicSession.ts
659
- function Ee() {
735
+ function Me() {
660
736
  try {
661
737
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
662
738
  } catch {}
663
739
  }
664
- function De(e, t, n) {
665
- let r;
666
- try {
667
- r = JSON.parse(n);
668
- } catch {}
669
- let i = Ee(), a = r?.message?.trim(), o = r?.code;
670
- if (o === "origin_not_allowed" || /^Origin not allowed/i.test(a ?? "") && i) {
671
- if (a && a.includes(e) && a.includes("allowed origin")) return a;
672
- let t = r?.origin ?? i ?? "(unknown origin)";
673
- return `Your origin ${t} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${t} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`;
740
+ function Ne(e) {
741
+ return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
742
+ }
743
+ function Pe(e, t) {
744
+ let n = Me(), r = Ne(t.code), i = t.message.trim(), a = t.details ?? {};
745
+ if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
746
+ if (i.includes(e) && i.includes("allowed origin")) return t;
747
+ let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
748
+ return new q(`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.`, {
749
+ code: "ORIGIN_NOT_ALLOWED",
750
+ requestId: t.requestId,
751
+ status: t.status,
752
+ details: a
753
+ });
674
754
  }
675
- return o === "browser_embeds_disabled" || /^Browser embeds are not enabled/i.test(a ?? "") ? a && a.includes("Allow public client-only embeds") ? a : `Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.` : o === "experience_unavailable" || /^Experience is not available\.?$/i.test(a ?? "") || /^Unknown experience\.?$/i.test(a ?? "") ? a && a.includes("No playable experience found") ? a : `No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.` : a || n.trim().slice(0, 500) || `Browser session mint failed (${t})`;
676
- }
677
- function Oe(e) {
755
+ return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new q(`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”.`, {
756
+ code: "BROWSER_EMBEDS_DISABLED",
757
+ requestId: t.requestId,
758
+ status: t.status,
759
+ details: a
760
+ }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new q(`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.`, {
761
+ code: "EXPERIENCE_UNAVAILABLE",
762
+ requestId: t.requestId,
763
+ status: t.status,
764
+ details: a
765
+ }) : t;
766
+ }
767
+ function Fe(e) {
678
768
  let t = e?.locale?.trim();
679
769
  if (t) return t;
680
770
  let n = e?.language?.trim();
681
771
  if (n) return n;
682
772
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
683
773
  }
684
- function Y(e) {
774
+ function Ie(e) {
685
775
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
686
- if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
776
+ if (t && n && t !== n) throw new q("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
687
777
  return t || n || void 0;
688
778
  }
689
- function ke(e, t) {
690
- let n = { experienceId: e }, r = Oe(t);
779
+ function Le(e, t) {
780
+ let n = { experienceId: e }, r = Fe(t);
691
781
  r && (n.locale = r);
692
- let i = Y(t);
693
- return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.responseMode && (n.responseMode = t.responseMode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
782
+ let i = Ie(t);
783
+ return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
694
784
  }
695
- async function Ae(e, t) {
696
- let n = q(), r = await fetch(`${n}/v1/browser-sessions`, {
785
+ async function Re(e, t) {
786
+ let n = ve(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
697
787
  method: "POST",
698
- headers: { "Content-Type": "application/json" },
699
- body: JSON.stringify(ke(e, t))
788
+ headers: {
789
+ "Content-Type": "application/json",
790
+ ...r ? { "Idempotency-Key": r } : {}
791
+ },
792
+ body: JSON.stringify(Le(e, t))
700
793
  });
701
- if (!r.ok) {
702
- let t = await r.text();
703
- throw Error(De(e, r.status, t));
794
+ if (!i.ok) {
795
+ let t = await i.text();
796
+ throw Pe(e, Se(i.status, t, i.headers));
704
797
  }
705
- let i;
798
+ let a;
706
799
  try {
707
- i = await r.json();
800
+ a = await i.json();
708
801
  } catch {
709
- throw Error("Browser session mint returned invalid JSON.");
802
+ throw new q("Browser session mint returned invalid JSON.", {
803
+ code: "INVALID_RESPONSE",
804
+ status: i.status,
805
+ requestId: i.headers.get("Liforma-Request-Id") ?? void 0
806
+ });
710
807
  }
711
- return Te(i);
808
+ return je(a);
712
809
  }
713
- async function je(e, t) {
714
- let n = xe(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
810
+ async function ze(e, t) {
811
+ let n = J(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
715
812
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
716
813
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
717
814
  try {
@@ -723,28 +820,32 @@ async function je(e, t) {
723
820
  globalThis.clearTimeout(a), t.signal?.removeEventListener("abort", i);
724
821
  }
725
822
  if (!o.ok) {
726
- let e = await o.text(), t = e.slice(0, 500) || `Session endpoint failed (${o.status})`;
727
- try {
728
- let n = JSON.parse(e);
729
- n.message && (t = n.message);
730
- } catch {}
731
- throw Error(t);
823
+ let e = await o.text();
824
+ throw Se(o.status, e, o.headers);
732
825
  }
733
- if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw Error("Session endpoint must return a JSON Session Launch response.");
826
+ if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new q("Session endpoint must return a JSON Session Launch response.", {
827
+ code: "INVALID_RESPONSE",
828
+ status: o.status,
829
+ requestId: o.headers.get("Liforma-Request-Id") ?? void 0
830
+ });
734
831
  let s;
735
832
  try {
736
833
  s = await o.json();
737
834
  } catch {
738
- throw Error("Session endpoint returned invalid JSON.");
835
+ throw new q("Session endpoint returned invalid JSON.", {
836
+ code: "INVALID_RESPONSE",
837
+ status: o.status,
838
+ requestId: o.headers.get("Liforma-Request-Id") ?? void 0
839
+ });
739
840
  }
740
- return Te(s);
841
+ return je(s);
741
842
  }
742
843
  //#endregion
743
844
  //#region src/v2/conversationProcessor.ts
744
- function Me(e) {
845
+ function Be(e) {
745
846
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
746
847
  }
747
- function Ne(e) {
848
+ function Ve(e) {
748
849
  if (typeof e == "string") {
749
850
  let t = e.trim();
750
851
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -758,24 +859,24 @@ function Ne(e) {
758
859
  ...e.behavior ? { behavior: e.behavior } : {}
759
860
  };
760
861
  }
761
- async function Pe(e, t) {
862
+ async function He(e, t) {
762
863
  let n = await e(t);
763
- return Me(n) ? {
864
+ return Be(n) ? {
764
865
  kind: "stream",
765
866
  stream: n
766
867
  } : {
767
868
  kind: "complete",
768
- speech: Ne(n)
869
+ speech: Ve(n)
769
870
  };
770
871
  }
771
872
  //#endregion
772
873
  //#region src/v2/embed/playerReachability.ts
773
- var Fe = "3002";
774
- function Ie(e) {
874
+ var Ue = "3002";
875
+ function We(e) {
775
876
  let t = new URL(e);
776
- return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || Fe}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
877
+ 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 || Ue}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
777
878
  }
778
- async function Le(e, t) {
879
+ async function Ge(e, t) {
779
880
  try {
780
881
  await fetch(e, {
781
882
  method: "GET",
@@ -783,35 +884,39 @@ async function Le(e, t) {
783
884
  signal: AbortSignal.timeout(8e3)
784
885
  });
785
886
  } catch {
786
- throw Error(Ie(t));
887
+ throw Error(We(t));
787
888
  }
788
889
  }
789
- function Re(e, t, n, r) {
890
+ function Ke(e, t, n, r) {
790
891
  try {
791
892
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
792
893
  } catch (e) {
793
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ie(n), { cause: e }) : e;
894
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(We(n), { cause: e }) : e;
794
895
  }
795
896
  }
796
- var ze = new Set([1, 2]);
797
- function Be(e) {
798
- return typeof e == "number" && ze.has(e);
897
+ var qe = new Set([1, 2]);
898
+ function Je(e) {
899
+ return typeof e == "number" && qe.has(e);
799
900
  }
800
- var Ve = new Set([
901
+ var Ye = new Set([
801
902
  "close",
802
903
  "stateUpdate",
803
904
  "commandResult",
804
905
  "userTranscript",
805
906
  "characterSpeechStarted",
806
907
  "characterSpeechEnded",
908
+ "characterFocusChanged",
807
909
  "conversationUpdate",
808
910
  "listeningState",
809
911
  "userSpeechStarted",
810
912
  "userSpeechEnded",
811
913
  "modeChange",
812
914
  "activityChange",
915
+ "feedback",
916
+ "feedbackFailed",
813
917
  "message",
814
918
  "started",
919
+ "embedReady",
815
920
  "widgetReady",
816
921
  "widgetExpand",
817
922
  "widgetCollapse",
@@ -820,11 +925,11 @@ var Ve = new Set([
820
925
  "widgetDragMove",
821
926
  "widgetDragEnd"
822
927
  ]);
823
- function He(e) {
928
+ function Xe(e) {
824
929
  if (!e || typeof e != "object") return null;
825
930
  let t = e;
826
- if (!Be(t.schemaVersion) || !t.type || !Ve.has(t.type)) return null;
827
- if (t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
931
+ if (!Je(t.schemaVersion) || !t.type || !Ye.has(t.type)) return null;
932
+ if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
828
933
  if (t.type === "widgetAudioSettings") {
829
934
  let e = t.payload;
830
935
  return !e || typeof e != "object" || typeof e.open != "boolean" ? null : t;
@@ -839,35 +944,38 @@ function He(e) {
839
944
  let { pointerId: n, dx: r, dy: i } = e;
840
945
  return typeof n != "number" || !Number.isFinite(n) || typeof r != "number" || !Number.isFinite(r) || typeof i != "number" || !Number.isFinite(i) ? null : t;
841
946
  }
842
- return !t.payload || typeof t.payload != "object" ? null : t;
947
+ let n = t.payload;
948
+ return !n || typeof n != "object" ? null : t;
843
949
  }
844
- function Ue(e, t, n) {
950
+ function Ze(e, t, n) {
845
951
  let r = e.trim();
846
952
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
953
+ let i = n?.startButton, a = n?.showFeedback;
847
954
  return {
848
955
  type: "launch",
849
956
  schemaVersion: 2,
850
957
  payload: {
851
958
  launch: r,
852
959
  ...t === void 0 ? {} : { session: t },
853
- ...n ? { startButton: n } : {}
960
+ ...i ? { startButton: i } : {},
961
+ ...a === void 0 ? {} : { showFeedback: a }
854
962
  }
855
963
  };
856
964
  }
857
- function We() {
965
+ function Qe() {
858
966
  return {
859
967
  type: "parentHello",
860
968
  schemaVersion: 2
861
969
  };
862
970
  }
863
- function Ge(e) {
971
+ function $e(e) {
864
972
  return {
865
973
  type: "widgetSetChrome",
866
974
  schemaVersion: 2,
867
975
  payload: { mode: e }
868
976
  };
869
977
  }
870
- function Ke() {
978
+ function et() {
871
979
  return {
872
980
  type: "widgetToggleAudioSettings",
873
981
  schemaVersion: 2,
@@ -876,30 +984,50 @@ function Ke() {
876
984
  }
877
985
  //#endregion
878
986
  //#region src/v2/embed/iframeHost.ts
879
- function qe(e) {
987
+ function tt(e) {
880
988
  return e;
881
989
  }
882
- function X() {
990
+ function Z() {
883
991
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `cmd_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `cmd_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
884
992
  }
885
- var Je = 3e4;
886
- function Ye(e) {
993
+ var nt = 3e4;
994
+ function rt(e) {
887
995
  let t = e.container;
888
996
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
889
997
  let n = document.createElement("iframe");
890
998
  n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true");
891
- let r = !1, i = /* @__PURE__ */ new Map(), a = new Promise((t, r) => {
892
- let i = () => {
893
- o(), Le(e.src, e.playerOrigin).then(t, r);
894
- }, a = () => {
895
- o(), r(Error(Ie(e.playerOrigin)));
896
- }, o = () => {
897
- n.removeEventListener("load", i), n.removeEventListener("error", a);
999
+ let r = !1, i = /* @__PURE__ */ new Map(), a = null, o = 0, s = 0, c = [], l = null, u = null, d = new Promise((e, t) => {
1000
+ l = e, u = t;
1001
+ }), f = () => {
1002
+ for (let e of c) window.clearTimeout(e);
1003
+ c.length = 0;
1004
+ }, p = (t) => {
1005
+ if (r) return;
1006
+ let i = Date.now();
1007
+ if (s > 0 && i - s < 250) return;
1008
+ s = i, f();
1009
+ let a = Ze(t.launch, t.session, t.chrome), o = () => {
1010
+ if (r) return;
1011
+ let t = n.contentWindow;
1012
+ t && Ke(t, a, e.playerOrigin);
898
1013
  };
899
- n.addEventListener("load", i), n.addEventListener("error", a);
900
- }), o = (t) => {
1014
+ o();
1015
+ for (let e = 1; e <= 12; e += 1) c.push(window.setTimeout(o, e * 75));
1016
+ }, m = () => {
1017
+ r || !a || p(a);
1018
+ }, h = () => {
1019
+ if (o += 1, o === 1) {
1020
+ Ge(e.src, e.playerOrigin).then(() => l?.(), (e) => u?.(e instanceof Error ? e : Error(String(e))));
1021
+ return;
1022
+ }
1023
+ s = 0, m();
1024
+ }, g = () => {
1025
+ o > 0 || u?.(Error(We(e.playerOrigin)));
1026
+ };
1027
+ n.addEventListener("load", h), n.addEventListener("error", g);
1028
+ let _ = (t) => {
901
1029
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
902
- let a = He(t.data);
1030
+ let a = Xe(t.data);
903
1031
  if (a) switch (a.type) {
904
1032
  case "close":
905
1033
  e.onClose?.(a.payload);
@@ -922,6 +1050,9 @@ function Ye(e) {
922
1050
  case "characterSpeechEnded":
923
1051
  e.onCharacterSpeechEnded?.(a.payload);
924
1052
  break;
1053
+ case "characterFocusChanged":
1054
+ e.onCharacterFocusChanged?.(a.payload);
1055
+ break;
925
1056
  case "conversationUpdate":
926
1057
  e.onConversationUpdate?.(a.payload.conversation);
927
1058
  break;
@@ -935,10 +1066,16 @@ function Ye(e) {
935
1066
  e.onUserSpeechEnded?.(a.payload);
936
1067
  break;
937
1068
  case "modeChange":
938
- e.onActivityChange?.(qe(a.payload.mode)), e.onModeChange?.(a.payload.mode);
1069
+ e.onActivityChange?.(tt(a.payload.mode));
939
1070
  break;
940
1071
  case "activityChange":
941
- e.onActivityChange?.(a.payload.activity), (a.payload.activity === "listening" || a.payload.activity === "thinking" || a.payload.activity === "speaking") && e.onModeChange?.(a.payload.activity);
1072
+ e.onActivityChange?.(a.payload.activity);
1073
+ break;
1074
+ case "feedback":
1075
+ e.onFeedback?.(a.payload);
1076
+ break;
1077
+ case "feedbackFailed":
1078
+ e.onFeedbackFailed?.(a.payload);
942
1079
  break;
943
1080
  case "message":
944
1081
  e.onMessage?.(a.payload);
@@ -946,6 +1083,9 @@ function Ye(e) {
946
1083
  case "started":
947
1084
  e.onStarted?.(a.payload);
948
1085
  break;
1086
+ case "embedReady":
1087
+ m();
1088
+ break;
949
1089
  case "widgetReady":
950
1090
  e.onWidgetReady?.();
951
1091
  break;
@@ -969,42 +1109,39 @@ function Ye(e) {
969
1109
  break;
970
1110
  }
971
1111
  };
972
- if (window.addEventListener("message", o), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
1112
+ if (window.addEventListener("message", _), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
973
1113
  let e = getComputedStyle(t).minHeight;
974
1114
  (e === "0px" || e === "auto") && (t.style.minHeight = "480px");
975
1115
  }
976
- let s = (t, i) => {
1116
+ let v = (t, i) => {
977
1117
  if (r) return;
978
1118
  let a = n.contentWindow;
979
- if (!a) throw Error(Ie(e.playerOrigin));
980
- Re(a, t, e.playerOrigin, i);
981
- }, c = (e, t = 12e4, n) => {
982
- let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : X();
1119
+ if (!a) throw Error(We(e.playerOrigin));
1120
+ Ke(a, t, e.playerOrigin, i);
1121
+ }, y = (e, t = 12e4, n) => {
1122
+ let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
983
1123
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((a, o) => {
984
1124
  i.set(r, {
985
1125
  resolve: (e) => a(e),
986
1126
  reject: o
987
- }), s(e, n), setTimeout(() => {
1127
+ }), v(e, n), setTimeout(() => {
988
1128
  i.has(r) && (i.delete(r), o(/* @__PURE__ */ Error("Timed out waiting for player command result.")));
989
1129
  }, t);
990
1130
  });
991
1131
  };
992
1132
  return {
993
1133
  waitForLoad() {
994
- return a;
1134
+ return d;
995
1135
  },
996
1136
  postParentHello() {
997
- s(We());
1137
+ v(Qe());
998
1138
  },
999
- postLaunch(t, i, a) {
1000
- if (r) return;
1001
- let o = n.contentWindow;
1002
- if (!o) throw Error("Liforma embed iframe is not ready.");
1003
- let s = Ue(t, i, a), c = () => {
1004
- r || Re(o, s, e.playerOrigin);
1005
- };
1006
- c();
1007
- for (let e = 1; e <= 12; e += 1) window.setTimeout(c, e * 75);
1139
+ postLaunch(e, t, n) {
1140
+ r || (a = {
1141
+ launch: e,
1142
+ session: t,
1143
+ chrome: n
1144
+ }, s = 0, p(a));
1008
1145
  },
1009
1146
  postManifest(e) {
1010
1147
  if (typeof e == "string") {
@@ -1019,17 +1156,17 @@ function Ye(e) {
1019
1156
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1020
1157
  },
1021
1158
  postWidgetSetChrome(e) {
1022
- s(Ge(e));
1159
+ v($e(e));
1023
1160
  },
1024
1161
  postWidgetToggleAudioSettings() {
1025
- s(Ke());
1162
+ v(et());
1026
1163
  },
1027
1164
  speak(e) {
1028
- return c({
1165
+ return y({
1029
1166
  type: "speak",
1030
1167
  schemaVersion: 2,
1031
1168
  payload: {
1032
- correlationId: X(),
1169
+ correlationId: Z(),
1033
1170
  text: e.text,
1034
1171
  ...e.characterId ? { characterId: e.characterId } : {},
1035
1172
  ...e.behavior ? { behavior: e.behavior } : {}
@@ -1037,31 +1174,31 @@ function Ye(e) {
1037
1174
  });
1038
1175
  },
1039
1176
  startListening() {
1040
- return c({
1177
+ return y({
1041
1178
  type: "startListening",
1042
1179
  schemaVersion: 2,
1043
- payload: { correlationId: X() }
1180
+ payload: { correlationId: Z() }
1044
1181
  });
1045
1182
  },
1046
1183
  stopListening() {
1047
- return c({
1184
+ return y({
1048
1185
  type: "stopListening",
1049
1186
  schemaVersion: 2,
1050
- payload: { correlationId: X() }
1187
+ payload: { correlationId: Z() }
1051
1188
  });
1052
1189
  },
1053
1190
  listenOnce(e) {
1054
- return c({
1191
+ return y({
1055
1192
  type: "listenOnce",
1056
1193
  schemaVersion: 2,
1057
1194
  payload: {
1058
- correlationId: X(),
1195
+ correlationId: Z(),
1059
1196
  ...e?.timeoutMs === void 0 ? {} : { timeoutMs: e.timeoutMs }
1060
1197
  }
1061
1198
  });
1062
1199
  },
1063
1200
  async speakProcessorStream(e, t) {
1064
- let n = X(), r = X(), i = (await c({
1201
+ let n = Z(), r = Z(), i = (await y({
1065
1202
  type: "speakStreamStart",
1066
1203
  schemaVersion: 2,
1067
1204
  payload: {
@@ -1073,7 +1210,7 @@ function Ye(e) {
1073
1210
  try {
1074
1211
  for await (let n of e) {
1075
1212
  if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
1076
- n && s({
1213
+ n && v({
1077
1214
  type: "speakStreamChunk",
1078
1215
  schemaVersion: 2,
1079
1216
  payload: {
@@ -1083,7 +1220,7 @@ function Ye(e) {
1083
1220
  });
1084
1221
  }
1085
1222
  if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
1086
- return await c({
1223
+ return await y({
1087
1224
  type: "speakStreamEnd",
1088
1225
  schemaVersion: 2,
1089
1226
  payload: {
@@ -1093,7 +1230,7 @@ function Ye(e) {
1093
1230
  });
1094
1231
  } catch (e) {
1095
1232
  try {
1096
- await c({
1233
+ await y({
1097
1234
  type: "speakStreamEnd",
1098
1235
  schemaVersion: 2,
1099
1236
  payload: {
@@ -1106,8 +1243,8 @@ function Ye(e) {
1106
1243
  }
1107
1244
  },
1108
1245
  speechPlay(e) {
1109
- let t = X(), n = [];
1110
- return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), c({
1246
+ let t = Z(), n = [];
1247
+ return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), y({
1111
1248
  type: "speechPlay",
1112
1249
  schemaVersion: 2,
1113
1250
  payload: {
@@ -1121,11 +1258,11 @@ function Ye(e) {
1121
1258
  }, 12e4, n);
1122
1259
  },
1123
1260
  speechUtteranceBegin(e) {
1124
- return c({
1261
+ return y({
1125
1262
  type: "speechUtteranceBegin",
1126
1263
  schemaVersion: 2,
1127
1264
  payload: {
1128
- correlationId: X(),
1265
+ correlationId: Z(),
1129
1266
  utteranceId: e.utteranceId,
1130
1267
  format: e.format,
1131
1268
  queue: e.queue,
@@ -1135,34 +1272,34 @@ function Ye(e) {
1135
1272
  });
1136
1273
  },
1137
1274
  speechUtteranceWrite(e) {
1138
- return c({
1275
+ return y({
1139
1276
  type: "speechUtteranceWrite",
1140
1277
  schemaVersion: 2,
1141
1278
  payload: {
1142
- correlationId: X(),
1279
+ correlationId: Z(),
1143
1280
  utteranceId: e.utteranceId,
1144
1281
  audio: e.audio,
1145
1282
  byteLength: e.byteLength
1146
1283
  }
1147
- }, Je, [e.audio]);
1284
+ }, nt, [e.audio]);
1148
1285
  },
1149
1286
  speechUtteranceSetTranscript(e) {
1150
- return c({
1287
+ return y({
1151
1288
  type: "speechUtteranceSetTranscript",
1152
1289
  schemaVersion: 2,
1153
1290
  payload: {
1154
- correlationId: X(),
1291
+ correlationId: Z(),
1155
1292
  utteranceId: e.utteranceId,
1156
1293
  transcript: e.transcript
1157
1294
  }
1158
1295
  });
1159
1296
  },
1160
1297
  speechUtteranceClose(e) {
1161
- return c({
1298
+ return y({
1162
1299
  type: "speechUtteranceClose",
1163
1300
  schemaVersion: 2,
1164
1301
  payload: {
1165
- correlationId: X(),
1302
+ correlationId: Z(),
1166
1303
  utteranceId: e.utteranceId,
1167
1304
  ...e.transcript === void 0 ? {} : { transcript: e.transcript },
1168
1305
  ...e.history ? { history: e.history } : {}
@@ -1170,44 +1307,64 @@ function Ye(e) {
1170
1307
  });
1171
1308
  },
1172
1309
  speechUtteranceCancel(e) {
1173
- return c({
1310
+ return y({
1174
1311
  type: "speechUtteranceCancel",
1175
1312
  schemaVersion: 2,
1176
1313
  payload: {
1177
- correlationId: X(),
1314
+ correlationId: Z(),
1178
1315
  utteranceId: e.utteranceId
1179
1316
  }
1180
1317
  });
1181
1318
  },
1182
1319
  speechInterrupt(e) {
1183
- return c({
1320
+ return y({
1184
1321
  type: "speechInterrupt",
1185
1322
  schemaVersion: 2,
1186
1323
  payload: {
1187
- correlationId: X(),
1324
+ correlationId: Z(),
1188
1325
  ...e
1189
1326
  }
1190
1327
  });
1191
1328
  },
1192
1329
  getConversation() {
1193
- return c({
1330
+ return y({
1194
1331
  type: "getConversation",
1195
1332
  schemaVersion: 2,
1196
- payload: { correlationId: X() }
1333
+ payload: { correlationId: Z() }
1334
+ });
1335
+ },
1336
+ focusCharacter(e) {
1337
+ return y({
1338
+ type: "focusCharacter",
1339
+ schemaVersion: 2,
1340
+ payload: {
1341
+ correlationId: Z(),
1342
+ characterId: e
1343
+ }
1344
+ });
1345
+ },
1346
+ setFit(e) {
1347
+ return y({
1348
+ type: "setFit",
1349
+ schemaVersion: 2,
1350
+ payload: {
1351
+ correlationId: Z(),
1352
+ fit: e
1353
+ }
1197
1354
  });
1198
1355
  },
1199
1356
  destroy() {
1200
1357
  if (!r) {
1201
1358
  r = !0;
1202
1359
  for (let e of i.values()) e.reject(/* @__PURE__ */ Error("Iframe host destroyed."));
1203
- i.clear(), window.removeEventListener("message", o), n.remove();
1360
+ i.clear(), f(), a = null, n.removeEventListener("load", h), n.removeEventListener("error", g), window.removeEventListener("message", _), n.remove();
1204
1361
  }
1205
1362
  }
1206
1363
  };
1207
1364
  }
1208
1365
  //#endregion
1209
1366
  //#region src/v2/embed/readyGate.ts
1210
- function Xe(e) {
1367
+ function it(e) {
1211
1368
  let t, n = !1, r = !1, i = () => {
1212
1369
  r || !n || t === void 0 || (r = !0, e(t));
1213
1370
  };
@@ -1222,35 +1379,47 @@ function Xe(e) {
1222
1379
  }
1223
1380
  //#endregion
1224
1381
  //#region src/v2/shims/embedBaseUrl.ts
1225
- var Ze = "https://player.liforma.ai/embed", Qe = "http://localhost:3002/embed";
1226
- function $e() {
1382
+ var at = "https://player.liforma.ai/embed", ot = "http://localhost:3002/embed";
1383
+ function st() {
1227
1384
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1228
1385
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1229
1386
  if (typeof document > "u") return null;
1230
1387
  let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-player-embed-url")?.trim();
1231
1388
  return t ? t.replace(/\/$/, "") : null;
1232
1389
  }
1233
- function et() {
1234
- let e = $e();
1235
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : C() ? Qe : Ze;
1390
+ function ct() {
1391
+ let e = st();
1392
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : T() ? ot : at;
1236
1393
  }
1237
- function tt(e, t, n, r, i, a, o) {
1238
- let s = (e ?? et()).replace(/\/$/, ""), c = s.endsWith("/embed") ? s : `${s}/embed`, l = new URL(c), u = n?.trim();
1239
- u && l.searchParams.set("locationId", u);
1240
- let d = r?.trim();
1241
- return d && l.searchParams.set("avatarId", d), i === "face" && l.searchParams.set("fit", "face"), a === "widget" && l.searchParams.set("ui", "widget"), o && l.searchParams.set("close", "1"), t && l.searchParams.set("debug", "true"), nt(l.toString());
1394
+ function lt(e, t, n, r, i, a, o, s) {
1395
+ let c = (e ?? ct()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1396
+ d && u.searchParams.set("locationId", d);
1397
+ let f = r?.trim();
1398
+ return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), ut(u.toString());
1242
1399
  }
1243
- function nt(e) {
1400
+ function ut(e) {
1244
1401
  if (typeof location > "u") return e;
1245
1402
  let t = new URL(e);
1246
1403
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1247
1404
  }
1248
- function rt(e) {
1405
+ function dt(e) {
1249
1406
  return new URL(e).origin;
1250
1407
  }
1251
1408
  //#endregion
1252
1409
  //#region src/v2/experienceEvents.ts
1253
- function it() {
1410
+ function ft() {
1411
+ 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)}`;
1412
+ }
1413
+ function pt(e, t, n) {
1414
+ return {
1415
+ id: ft(),
1416
+ type: e,
1417
+ sessionId: t,
1418
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1419
+ data: n
1420
+ };
1421
+ }
1422
+ function mt() {
1254
1423
  return {
1255
1424
  ready: /* @__PURE__ */ new Set(),
1256
1425
  started: /* @__PURE__ */ new Set(),
@@ -1259,47 +1428,49 @@ function it() {
1259
1428
  userSpeechEnded: /* @__PURE__ */ new Set(),
1260
1429
  characterSpeechStarted: /* @__PURE__ */ new Set(),
1261
1430
  characterSpeechEnded: /* @__PURE__ */ new Set(),
1431
+ characterFocusChanged: /* @__PURE__ */ new Set(),
1262
1432
  conversationUpdate: /* @__PURE__ */ new Set(),
1263
1433
  message: /* @__PURE__ */ new Set(),
1264
1434
  listeningState: /* @__PURE__ */ new Set(),
1265
1435
  activityChange: /* @__PURE__ */ new Set(),
1266
- modeChange: /* @__PURE__ */ new Set(),
1436
+ feedback: /* @__PURE__ */ new Set(),
1437
+ feedbackFailed: /* @__PURE__ */ new Set(),
1267
1438
  conversationProcessorError: /* @__PURE__ */ new Set()
1268
1439
  };
1269
1440
  }
1270
- function at(e, t, n) {
1441
+ function ht(e, t, n) {
1271
1442
  return e[t].add(n), () => e[t].delete(n);
1272
1443
  }
1273
- function Z(e, t, n) {
1444
+ function gt(e, t, n) {
1274
1445
  for (let r of e[t]) r(n);
1275
1446
  }
1276
- function ot(e) {
1447
+ function _t(e) {
1277
1448
  for (let t of Object.keys(e)) e[t].clear();
1278
1449
  }
1279
1450
  //#endregion
1280
1451
  //#region src/v2/speech/types.ts
1281
- function st(e) {
1452
+ function vt(e) {
1282
1453
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1283
1454
  }
1284
- function ct(e) {
1455
+ function yt(e) {
1285
1456
  return "url" in e && typeof e.url == "string";
1286
1457
  }
1287
- function lt(e) {
1458
+ function bt(e) {
1288
1459
  if (!("track" in e)) return !1;
1289
1460
  let t = e.track;
1290
1461
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1291
1462
  }
1292
- function ut(e) {
1293
- return !st(e) && !ct(e) && !lt(e) && "encoding" in e && typeof e.encoding == "string";
1463
+ function xt(e) {
1464
+ return !vt(e) && !yt(e) && !bt(e) && "encoding" in e && typeof e.encoding == "string";
1294
1465
  }
1295
- var dt = [
1466
+ var St = [
1296
1467
  8e3,
1297
1468
  16e3,
1298
1469
  22050,
1299
1470
  24e3,
1300
1471
  44100,
1301
1472
  48e3
1302
- ], ft = {
1473
+ ], Ct = {
1303
1474
  MAX_CHUNK_BYTES: 64 * 1024,
1304
1475
  RECOMMENDED_CHUNK_MS_MIN: 20,
1305
1476
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -1310,14 +1481,14 @@ var dt = [
1310
1481
  MAX_UTTERANCE_DURATION_MS: 9e4,
1311
1482
  MAX_PENDING_WRITES: 8,
1312
1483
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1313
- }, pt = class extends Error {
1484
+ }, wt = class extends Error {
1314
1485
  operation;
1315
1486
  requiredCapability;
1316
1487
  name = "UnsupportedSpeechOperationError";
1317
1488
  constructor(e, t) {
1318
1489
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1319
1490
  }
1320
- }, mt = class extends Error {
1491
+ }, Tt = class extends Error {
1321
1492
  name = "SpeechUtteranceClosedError";
1322
1493
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1323
1494
  super(e);
@@ -1327,72 +1498,72 @@ var dt = [
1327
1498
  constructor(e, t) {
1328
1499
  super(e, t);
1329
1500
  }
1330
- }, ht = class extends Error {
1501
+ }, Et = class extends Error {
1331
1502
  name = "SpeechBufferTimeoutError";
1332
1503
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1333
1504
  super(e);
1334
1505
  }
1335
1506
  };
1336
- function gt(e = "none") {
1507
+ function Dt(e = "none") {
1337
1508
  return {
1338
1509
  mode: e,
1339
1510
  trackedDurationMs: 0,
1340
1511
  fallbackDurationMs: 0
1341
1512
  };
1342
1513
  }
1343
- function _t(e) {
1344
- return dt.includes(e);
1514
+ function Ot(e) {
1515
+ return St.includes(e);
1345
1516
  }
1346
- function vt(e) {
1517
+ function kt(e) {
1347
1518
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
1348
1519
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
1349
- if (!_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1520
+ if (!Ot(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1350
1521
  }
1351
- function yt(e) {
1352
- if (st(e)) {
1353
- vt(e.format);
1522
+ function At(e) {
1523
+ if (vt(e)) {
1524
+ kt(e.format);
1354
1525
  return;
1355
1526
  }
1356
- if (ct(e)) {
1527
+ if (yt(e)) {
1357
1528
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
1358
- if (e.sampleRate !== void 0 && !_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1529
+ if (e.sampleRate !== void 0 && !Ot(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1359
1530
  return;
1360
1531
  }
1361
- if (lt(e)) {
1532
+ if (bt(e)) {
1362
1533
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
1363
- if (e.sampleRate !== void 0 && !_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1534
+ if (e.sampleRate !== void 0 && !Ot(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1364
1535
  return;
1365
1536
  }
1366
- if (ut(e)) {
1537
+ if (xt(e)) {
1367
1538
  let t = e.encoding.trim().toLowerCase();
1368
1539
  if (!t) throw new Q("Encoded audio MIME type is required.");
1369
1540
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1370
- if (e.sampleRate !== void 0 && !_t(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1541
+ if (e.sampleRate !== void 0 && !Ot(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1371
1542
  return;
1372
1543
  }
1373
1544
  throw new Q("Unsupported speech.play audio shape.");
1374
1545
  }
1375
- function bt(e) {
1376
- if (e.format) return vt(e.format), e.format;
1546
+ function jt(e) {
1547
+ if (e.format) return kt(e.format), e.format;
1377
1548
  if (e.track) {
1378
1549
  let t = {
1379
1550
  encoding: "pcm_s16le",
1380
1551
  sampleRate: e.sampleRate ?? 24e3,
1381
1552
  channels: 1
1382
1553
  };
1383
- return vt(t), t;
1554
+ return kt(t), t;
1384
1555
  }
1385
1556
  throw new Q("createUtterance requires format or track.");
1386
1557
  }
1387
- function xt(e) {
1558
+ function Mt(e) {
1388
1559
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1389
1560
  }
1390
- function St(e) {
1561
+ function Nt(e) {
1391
1562
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1392
1563
  }
1393
1564
  //#endregion
1394
1565
  //#region src/byo/pcm.ts
1395
- function Ct(e) {
1566
+ function Pt(e) {
1396
1567
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1397
1568
  for (let t = 0; t < e.length; t++) {
1398
1569
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1402,11 +1573,11 @@ function Ct(e) {
1402
1573
  }
1403
1574
  //#endregion
1404
1575
  //#region src/byo/resample.ts
1405
- function wt(e, t, n, r, i) {
1576
+ function Ft(e, t, n, r, i) {
1406
1577
  let a = -.5 * e + 1.5 * t - 1.5 * n + .5 * r, o = e - 2.5 * t + 2 * n - .5 * r, s = -.5 * e + .5 * n, c = t;
1407
1578
  return ((a * i + o) * i + s) * i + c;
1408
1579
  }
1409
- function Tt(e, t) {
1580
+ function It(e, t) {
1410
1581
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1411
1582
  if (e === t) return {
1412
1583
  fromRate: e,
@@ -1429,7 +1600,7 @@ function Tt(e, t) {
1429
1600
  let a = [];
1430
1601
  for (; i + 2 < r.length - 1;) {
1431
1602
  let e = Math.floor(i), t = i - e, o = Math.max(0, e - 1), s = Math.min(r.length - 1, e + 1), c = Math.min(r.length - 1, e + 2);
1432
- a.push(wt(r[o], r[e], r[s], r[c], t)), i += n;
1603
+ a.push(Ft(r[o], r[e], r[s], r[c], t)), i += n;
1433
1604
  }
1434
1605
  let o = Math.max(0, Math.floor(i) - 1);
1435
1606
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1441,7 +1612,7 @@ function Tt(e, t) {
1441
1612
  }
1442
1613
  //#endregion
1443
1614
  //#region src/byo/audioCapture.ts
1444
- var Et = "liforma-pcm-capture", Dt = `
1615
+ var Lt = "liforma-pcm-capture", Rt = `
1445
1616
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1446
1617
  process(inputs) {
1447
1618
  const ch = inputs[0] && inputs[0][0];
@@ -1453,29 +1624,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1453
1624
  return true;
1454
1625
  }
1455
1626
  }
1456
- registerProcessor('${Et}', LiformaPcmCaptureProcessor);
1457
- `, Ot = null;
1458
- function kt() {
1459
- return Ot ||= URL.createObjectURL(new Blob([Dt], { type: "application/javascript" })), Ot;
1627
+ registerProcessor('${Lt}', LiformaPcmCaptureProcessor);
1628
+ `, zt = null;
1629
+ function Bt() {
1630
+ return zt ||= URL.createObjectURL(new Blob([Rt], { type: "application/javascript" })), zt;
1460
1631
  }
1461
- function At() {
1632
+ function Vt() {
1462
1633
  return window.AudioContext || window.webkitAudioContext || null;
1463
1634
  }
1464
- async function jt(e) {
1465
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = At();
1635
+ async function Ht(e) {
1636
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Vt();
1466
1637
  if (!o) throw Error("Web Audio is required for audio capture");
1467
1638
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1468
1639
  l.gain.value = 0;
1469
- let u = s.sampleRate, d = Tt(u, n), f = !1, p = !1, m = (e) => {
1640
+ let u = s.sampleRate, d = It(u, n), f = !1, p = !1, m = (e) => {
1470
1641
  if (f || i && !i()) return;
1471
1642
  let t = d.push(e);
1472
- t.length !== 0 && r(Ct(t));
1643
+ t.length !== 0 && r(Pt(t));
1473
1644
  }, h = () => void 0;
1474
1645
  return await (async () => {
1475
1646
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1476
1647
  try {
1477
- await s.audioWorklet.addModule(kt());
1478
- let e = new AudioWorkletNode(s, Et, {
1648
+ await s.audioWorklet.addModule(Bt());
1649
+ let e = new AudioWorkletNode(s, Lt, {
1479
1650
  numberOfInputs: 1,
1480
1651
  numberOfOutputs: 1,
1481
1652
  outputChannelCount: [1]
@@ -1525,7 +1696,7 @@ async function jt(e) {
1525
1696
  }
1526
1697
  //#endregion
1527
1698
  //#region src/v2/speech/captureMediaStreamTrack.ts
1528
- async function Mt(e) {
1699
+ async function Ut(e) {
1529
1700
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1530
1701
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
1531
1702
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -1534,18 +1705,18 @@ async function Mt(e) {
1534
1705
  s || (s = !0, c?.stop(), c = null);
1535
1706
  };
1536
1707
  try {
1537
- c = await jt({
1708
+ c = await Ht({
1538
1709
  mediaStream: a,
1539
1710
  targetSampleRate: r,
1540
1711
  shouldSend: () => !s && !i?.aborted,
1541
1712
  onPcm: (e) => {
1542
1713
  if (s || i?.aborted) return;
1543
- let t = xt(e);
1714
+ let t = Mt(e);
1544
1715
  o = o.then(async () => {
1545
1716
  if (s || i?.aborted) return;
1546
1717
  let e = 0;
1547
1718
  for (; e < t.byteLength;) {
1548
- let r = Math.min(e + ft.MAX_CHUNK_BYTES, t.byteLength);
1719
+ let r = Math.min(e + Ct.MAX_CHUNK_BYTES, t.byteLength);
1549
1720
  if ((r - e) % 2 == 1 && --r, r <= e) break;
1550
1721
  let i = t.subarray(e, r);
1551
1722
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -1569,10 +1740,10 @@ async function Mt(e) {
1569
1740
  }
1570
1741
  //#endregion
1571
1742
  //#region src/v2/speech/speechController.ts
1572
- async function Nt(e, t) {
1573
- if (lt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1574
- if (st(e)) {
1575
- let t = xt(e.data);
1743
+ async function Wt(e, t) {
1744
+ if (bt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1745
+ if (vt(e)) {
1746
+ let t = Mt(e.data);
1576
1747
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
1577
1748
  return {
1578
1749
  kind: "pcm",
@@ -1580,17 +1751,17 @@ async function Nt(e, t) {
1580
1751
  format: e.format
1581
1752
  };
1582
1753
  }
1583
- if (ct(e)) return {
1754
+ if (yt(e)) return {
1584
1755
  kind: "url",
1585
1756
  url: e.url.trim(),
1586
1757
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1587
1758
  };
1588
- if (!ut(e)) throw new Q("Unsupported speech.play audio shape.");
1759
+ if (!xt(e)) throw new Q("Unsupported speech.play audio shape.");
1589
1760
  let n;
1590
1761
  if (typeof Blob < "u" && e.data instanceof Blob) {
1591
1762
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1592
1763
  n = new Uint8Array(await e.data.arrayBuffer());
1593
- } else n = xt(e.data);
1764
+ } else n = Mt(e.data);
1594
1765
  return {
1595
1766
  kind: "encoded",
1596
1767
  data: n.slice().buffer,
@@ -1598,10 +1769,10 @@ async function Nt(e, t) {
1598
1769
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1599
1770
  };
1600
1771
  }
1601
- function Pt() {
1772
+ function Gt() {
1602
1773
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `utt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `utt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
1603
1774
  }
1604
- function Ft(e, t = "completed") {
1775
+ function Kt(e, t = "completed") {
1605
1776
  return {
1606
1777
  utteranceId: e.speechId,
1607
1778
  characterId: e.characterId,
@@ -1615,13 +1786,13 @@ function Ft(e, t = "completed") {
1615
1786
  }
1616
1787
  };
1617
1788
  }
1618
- function It(e) {
1789
+ function qt(e) {
1619
1790
  return e instanceof Error ? e : new Q(String(e));
1620
1791
  }
1621
- function Lt(e) {
1792
+ function Jt(e) {
1622
1793
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
1623
1794
  }
1624
- var Rt = class {
1795
+ var Yt = class {
1625
1796
  id;
1626
1797
  characterId;
1627
1798
  result;
@@ -1650,29 +1821,29 @@ var Rt = class {
1650
1821
  queue: e.queue,
1651
1822
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
1652
1823
  }).catch((e) => {
1653
- throw this.fail(It(e)), It(e);
1824
+ throw this.fail(qt(e)), qt(e);
1654
1825
  }), this.signal?.addEventListener("abort", () => {
1655
1826
  this.cancel();
1656
1827
  }, { once: !0 });
1657
1828
  }
1658
1829
  async write(e, t) {
1659
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new mt();
1660
- let n = xt(e);
1830
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Tt();
1831
+ let n = Mt(e);
1661
1832
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
1662
- if (n.byteLength > ft.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${ft.MAX_CHUNK_BYTES}).`);
1833
+ if (n.byteLength > Ct.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${Ct.MAX_CHUNK_BYTES}).`);
1663
1834
  if (n.byteLength === 0) return;
1664
- let r = t?.timeoutMs ?? ft.DEFAULT_WRITE_TIMEOUT_MS;
1835
+ let r = t?.timeoutMs ?? Ct.DEFAULT_WRITE_TIMEOUT_MS;
1665
1836
  await this.acquireWriteSlot(r);
1666
1837
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
1667
- if (this.bufferedMs + i > ft.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1838
+ if (this.bufferedMs + i > Ct.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1668
1839
  let a = async () => {
1669
- if (this.closed || this.settled) throw new mt();
1840
+ if (this.closed || this.settled) throw new Tt();
1670
1841
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
1671
1842
  utteranceId: this.id,
1672
1843
  audio: t.buffer,
1673
1844
  byteLength: t.byteLength
1674
1845
  }), a = await Promise.race([i, new Promise((e, t) => {
1675
- setTimeout(() => t(new ht()), r);
1846
+ setTimeout(() => t(new Et()), r);
1676
1847
  })]);
1677
1848
  this.bufferedMs = Math.max(0, a.bufferedMs);
1678
1849
  }, o = this.writeChain.then(a, a);
@@ -1684,7 +1855,7 @@ var Rt = class {
1684
1855
  }
1685
1856
  }
1686
1857
  async setTranscript(e) {
1687
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new mt();
1858
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Tt();
1688
1859
  await this.requireHost().speechUtteranceSetTranscript({
1689
1860
  utteranceId: this.id,
1690
1861
  transcript: e
@@ -1701,7 +1872,7 @@ var Rt = class {
1701
1872
  });
1702
1873
  return this.resolve(t), t;
1703
1874
  } catch (e) {
1704
- let t = It(e);
1875
+ let t = qt(e);
1705
1876
  throw this.fail(t), t;
1706
1877
  }
1707
1878
  }
@@ -1719,11 +1890,11 @@ var Rt = class {
1719
1890
  characterId: this.characterId,
1720
1891
  status: "cancelled",
1721
1892
  durationMs: 0,
1722
- animation: gt("none")
1893
+ animation: Dt("none")
1723
1894
  };
1724
1895
  return this.resolve(t), t;
1725
1896
  } catch (e) {
1726
- let t = It(e);
1897
+ let t = qt(e);
1727
1898
  throw this.fail(t), t;
1728
1899
  }
1729
1900
  }
@@ -1736,19 +1907,19 @@ var Rt = class {
1736
1907
  return e;
1737
1908
  }
1738
1909
  resolve(e) {
1739
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new mt()));
1910
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Tt()));
1740
1911
  }
1741
1912
  fail(e) {
1742
1913
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
1743
1914
  }
1744
1915
  async acquireWriteSlot(e) {
1745
- if (this.pendingWriteCount < ft.MAX_PENDING_WRITES) {
1916
+ if (this.pendingWriteCount < Ct.MAX_PENDING_WRITES) {
1746
1917
  this.pendingWriteCount += 1;
1747
1918
  return;
1748
1919
  }
1749
1920
  await new Promise((t, n) => {
1750
1921
  let r = setTimeout(() => {
1751
- n(new ht());
1922
+ n(new Et());
1752
1923
  }, e);
1753
1924
  this.pendingWriteWaiters.push({
1754
1925
  resolve: () => {
@@ -1767,13 +1938,13 @@ var Rt = class {
1767
1938
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
1768
1939
  }
1769
1940
  };
1770
- function zt(e) {
1941
+ function Xt(e) {
1771
1942
  let t = null, n = (t, n) => {
1772
- if (!e.getCapabilities()[n]) throw new pt(t, n);
1943
+ if (!e.getCapabilities()[n]) throw new wt(t, n);
1773
1944
  }, r = {
1774
1945
  async speak(r) {
1775
1946
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
1776
- let i = St(r.queue ?? "append");
1947
+ let i = Nt(r.queue ?? "append");
1777
1948
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
1778
1949
  let a = e.getIframeHost();
1779
1950
  if (!a) throw new Q("Speech session is not attached.");
@@ -1793,41 +1964,41 @@ function zt(e) {
1793
1964
  return;
1794
1965
  }
1795
1966
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
1796
- t.removeEventListener("abort", s), n(Ft(e, "completed"));
1967
+ t.removeEventListener("abort", s), n(Kt(e, "completed"));
1797
1968
  }, (a) => {
1798
- if (t.removeEventListener("abort", s), Lt(a)) {
1969
+ if (t.removeEventListener("abort", s), Jt(a)) {
1799
1970
  n({
1800
1971
  utteranceId: "utt_interrupted",
1801
1972
  characterId: r.characterId ?? e.getActiveCharacterId(),
1802
1973
  status: "interrupted",
1803
1974
  durationMs: 0,
1804
1975
  transcript: r.text,
1805
- animation: gt("none")
1976
+ animation: Dt("none")
1806
1977
  });
1807
1978
  return;
1808
1979
  }
1809
- i(It(a));
1980
+ i(qt(a));
1810
1981
  });
1811
1982
  });
1812
1983
  }
1813
1984
  try {
1814
- return Ft(await o, "completed");
1985
+ return Kt(await o, "completed");
1815
1986
  } catch (t) {
1816
- if (Lt(t)) return {
1987
+ if (Jt(t)) return {
1817
1988
  utteranceId: "utt_interrupted",
1818
1989
  characterId: r.characterId ?? e.getActiveCharacterId(),
1819
1990
  status: "interrupted",
1820
1991
  durationMs: 0,
1821
1992
  transcript: r.text,
1822
- animation: gt("none")
1993
+ animation: Dt("none")
1823
1994
  };
1824
- throw It(t);
1995
+ throw qt(t);
1825
1996
  }
1826
1997
  },
1827
1998
  async play(i) {
1828
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), yt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
1999
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), At(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
1829
2000
  let a = i.queue ?? "append";
1830
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), lt(i.audio)) {
2001
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), bt(i.audio)) {
1831
2002
  let e = i.audio.sampleRate ?? 24e3;
1832
2003
  return r.createUtterance({
1833
2004
  format: {
@@ -1843,7 +2014,7 @@ function zt(e) {
1843
2014
  }
1844
2015
  let o = e.getIframeHost();
1845
2016
  if (!o) throw new Q("Speech session is not attached.");
1846
- let s = await Nt(i.audio, i.signal);
2017
+ let s = await Wt(i.audio, i.signal);
1847
2018
  return o.speechPlay({
1848
2019
  source: s,
1849
2020
  characterId: i.characterId,
@@ -1855,13 +2026,13 @@ function zt(e) {
1855
2026
  },
1856
2027
  createUtterance(r) {
1857
2028
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
1858
- let i = bt(r);
2029
+ let i = jt(r);
1859
2030
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
1860
2031
  let a = r.queue ?? "replace-active";
1861
2032
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
1862
2033
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
1863
- let o = new Rt({
1864
- id: Pt(),
2034
+ let o = new Yt({
2035
+ id: Gt(),
1865
2036
  characterId: r.characterId ?? e.getActiveCharacterId(),
1866
2037
  format: i,
1867
2038
  queue: a,
@@ -1873,7 +2044,7 @@ function zt(e) {
1873
2044
  t === o && (t = null);
1874
2045
  }), r.track && (async () => {
1875
2046
  try {
1876
- if (await Mt({
2047
+ if (await Ut({
1877
2048
  track: r.track,
1878
2049
  utterance: o,
1879
2050
  sampleRate: i.sampleRate,
@@ -1900,11 +2071,17 @@ function zt(e) {
1900
2071
  return r;
1901
2072
  }
1902
2073
  //#endregion
2074
+ //#region src/v2/types/sessionInteraction.ts
2075
+ function Zt(e) {
2076
+ let t = e?.trim();
2077
+ return t === "full" || t === "face" || t === "medium" ? t : void 0;
2078
+ }
2079
+ //#endregion
1903
2080
  //#region src/v2/experience.ts
1904
- function Bt(e) {
2081
+ function Qt(e) {
1905
2082
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
1906
2083
  }
1907
- var Vt = class e {
2084
+ var $t = class e {
1908
2085
  bootstrap;
1909
2086
  conversationProcessor;
1910
2087
  iframeHost = null;
@@ -1917,17 +2094,18 @@ var Vt = class e {
1917
2094
  attachReturnUrl = null;
1918
2095
  closed = !1;
1919
2096
  attached = !1;
2097
+ pendingFit = null;
1920
2098
  closeHandlers = [];
1921
- eventRegistry = it();
1922
- readyEvent = null;
1923
- startedEvent = null;
2099
+ eventRegistry = mt();
2100
+ readyEnvelope = null;
2101
+ startedEnvelope = null;
1924
2102
  conversationCache = [];
1925
2103
  speech;
1926
2104
  constructor(e) {
1927
- this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = zt({
2105
+ 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 = Xt({
1928
2106
  getIframeHost: () => this.iframeHost,
1929
2107
  assertSessionStarted: () => this.assertSessionStarted(),
1930
- getCapabilities: () => Ht(this.resolvedSession),
2108
+ getCapabilities: () => en(this.resolvedSession),
1931
2109
  getActiveCharacterId: () => "character_unknown",
1932
2110
  onProcessorInterrupt: () => {
1933
2111
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -1961,10 +2139,10 @@ var Vt = class e {
1961
2139
  language: t.language,
1962
2140
  locationId: t.locationId,
1963
2141
  avatarId: t.avatarId,
2142
+ castSize: t.castSize,
1964
2143
  embedBaseUrl: t.embedBaseUrl,
1965
2144
  debug: t.debug,
1966
2145
  mode: t.mode,
1967
- responseMode: t.responseMode,
1968
2146
  speechInputMode: t.speechInputMode,
1969
2147
  speechOnly: t.speechOnly,
1970
2148
  ui: t.ui,
@@ -1981,10 +2159,10 @@ var Vt = class e {
1981
2159
  language: t.language,
1982
2160
  locationId: t.locationId,
1983
2161
  avatarId: t.avatarId,
2162
+ castSize: t.castSize,
1984
2163
  embedBaseUrl: t.embedBaseUrl,
1985
2164
  debug: t.debug,
1986
2165
  mode: t.mode,
1987
- responseMode: t.responseMode,
1988
2166
  speechInputMode: t.speechInputMode,
1989
2167
  speechOnly: t.speechOnly,
1990
2168
  ui: t.ui,
@@ -2001,8 +2179,8 @@ var Vt = class e {
2001
2179
  return null;
2002
2180
  }
2003
2181
  on(e, t) {
2004
- let n = at(this.eventRegistry, e, t);
2005
- return e === "ready" && this.readyEvent && queueMicrotask(() => t(this.readyEvent)), e === "started" && this.startedEvent && queueMicrotask(() => t(this.startedEvent)), n;
2182
+ let n = ht(this.eventRegistry, e, t);
2183
+ return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
2006
2184
  }
2007
2185
  async attach(e) {
2008
2186
  if (this.closed) throw Error("Session has ended.");
@@ -2015,13 +2193,13 @@ var Vt = class e {
2015
2193
  if (this.closed) throw Error("Session has ended.");
2016
2194
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2017
2195
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2018
- let t = this.bootstrap.embedBaseUrl ?? et(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = tt(t, n, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.locationId, r || this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Bt(e)), a = rt(i), o = null, s = new Promise((e) => {
2196
+ let t = this.bootstrap.embedBaseUrl ?? ct(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = lt(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, Qt(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = dt(i), o = null, s = new Promise((e) => {
2019
2197
  o = e;
2020
2198
  }), c = null, l = new Promise((e) => {
2021
2199
  c = e;
2022
- }), u = Xe((e) => {
2023
- this.readyEvent || (this.readyEvent = { session: e }, Z(this.eventRegistry, "ready", this.readyEvent));
2024
- }), d = this.bootstrap.onUserTranscript, f = Ye({
2200
+ }), u = it((e) => {
2201
+ this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2202
+ }), d = this.bootstrap.onUserTranscript, f = rt({
2025
2203
  container: e.container,
2026
2204
  src: i,
2027
2205
  playerOrigin: a,
@@ -2037,34 +2215,43 @@ var Vt = class e {
2037
2215
  e.onPlayerStatusChange?.(t), e.onStateUpdate?.(t), t === "loading" && o && (o(), o = null), t === "ready" && c && (c(), c = null), t === "ready" && u.markReady();
2038
2216
  },
2039
2217
  onUserTranscript: (e) => {
2040
- Z(this.eventRegistry, "userTranscript", e), d?.(e), this.queueProcessorTurn(e);
2218
+ this.emitWrapped("userTranscript", e), d?.(e), this.queueProcessorTurn(e);
2041
2219
  },
2042
2220
  onUserSpeechStarted: (e) => {
2043
- Z(this.eventRegistry, "userSpeechStarted", e);
2221
+ this.emitWrapped("userSpeechStarted", e);
2044
2222
  },
2045
2223
  onUserSpeechEnded: (e) => {
2046
- Z(this.eventRegistry, "userSpeechEnded", e);
2224
+ this.emitWrapped("userSpeechEnded", e);
2047
2225
  },
2048
2226
  onCharacterSpeechStarted: (e) => {
2049
- Z(this.eventRegistry, "characterSpeechStarted", e);
2227
+ this.emitWrapped("characterSpeechStarted", e);
2050
2228
  },
2051
2229
  onCharacterSpeechEnded: (e) => {
2052
- Z(this.eventRegistry, "characterSpeechEnded", e);
2230
+ this.emitWrapped("characterSpeechEnded", e);
2231
+ },
2232
+ onCharacterFocusChanged: (e) => {
2233
+ this.emitWrapped("characterFocusChanged", e);
2053
2234
  },
2054
2235
  onListeningState: (e) => {
2055
- Z(this.eventRegistry, "listeningState", e);
2236
+ this.emitWrapped("listeningState", e);
2056
2237
  },
2057
2238
  onActivityChange: (e) => {
2058
- Z(this.eventRegistry, "activityChange", e), (e === "listening" || e === "thinking" || e === "speaking") && Z(this.eventRegistry, "modeChange", e);
2239
+ this.emitWrapped("activityChange", e);
2240
+ },
2241
+ onFeedback: (e) => {
2242
+ this.emitWrapped("feedback", e);
2243
+ },
2244
+ onFeedbackFailed: (e) => {
2245
+ this.emitWrapped("feedbackFailed", e);
2059
2246
  },
2060
2247
  onMessage: (e) => {
2061
- Z(this.eventRegistry, "message", e);
2248
+ this.emitWrapped("message", e);
2062
2249
  },
2063
2250
  onStarted: (e) => {
2064
- this.startedEvent || (this.startedEvent = e, Z(this.eventRegistry, "started", e), this.bootstrap.onStart?.(e));
2251
+ this.startedEnvelope || (this.startedEnvelope = this.emitWrapped("started", e), this.bootstrap.onStart?.(e));
2065
2252
  },
2066
2253
  onConversationUpdate: (e) => {
2067
- this.conversationCache = e, Z(this.eventRegistry, "conversationUpdate", e);
2254
+ this.conversationCache = e, this.emitWrapped("conversationUpdate", e);
2068
2255
  },
2069
2256
  onWidgetReady: () => e.onWidgetReady?.(),
2070
2257
  onWidgetExpand: () => e.onWidgetExpand?.(),
@@ -2075,24 +2262,22 @@ var Vt = class e {
2075
2262
  onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
2076
2263
  });
2077
2264
  this.iframeHost = f;
2078
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), je(this.bootstrap.sessionEndpoint, {
2265
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ze(this.bootstrap.sessionEndpoint, {
2079
2266
  experienceId: this.bootstrap.experienceId,
2080
2267
  locale: this.bootstrap.locale,
2081
2268
  secondaryLocale: this.bootstrap.secondaryLocale,
2082
2269
  learningLocale: this.bootstrap.learningLocale,
2083
2270
  language: this.bootstrap.language,
2084
2271
  mode: p.mode,
2085
- responseMode: p.responseMode,
2086
2272
  speechInputMode: p.speechInputMode,
2087
2273
  speechOnly: this.bootstrap.speechOnly,
2088
2274
  signal: this.endpointAbortController.signal
2089
- })) : this.bootstrap.kind === "public" ? Ae(this.bootstrap.experienceId, {
2275
+ })) : this.bootstrap.kind === "public" ? Re(this.bootstrap.experienceId, {
2090
2276
  locale: this.bootstrap.locale,
2091
2277
  secondaryLocale: this.bootstrap.secondaryLocale,
2092
2278
  learningLocale: this.bootstrap.learningLocale,
2093
2279
  language: this.bootstrap.language,
2094
2280
  mode: p.mode,
2095
- responseMode: p.responseMode,
2096
2281
  speechInputMode: p.speechInputMode,
2097
2282
  speechOnly: this.bootstrap.speechOnly
2098
2283
  }) : Promise.resolve(this.bootstrap.session ? {
@@ -2109,11 +2294,17 @@ var Vt = class e {
2109
2294
  f.postParentHello();
2110
2295
  let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2111
2296
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2112
- return this.launchToken = g, _ ? (this.resolvedSession = _, f.postLaunch(g, _, e.startButton), u.setValue(_)) : f.postLaunch(g, void 0, e.startButton), await Promise.race([s, new Promise((e, t) => {
2297
+ return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Ae(_), f.postLaunch(g, _, {
2298
+ startButton: e.startButton,
2299
+ showFeedback: e.showFeedback
2300
+ }), u.setValue(_)) : f.postLaunch(g, void 0, {
2301
+ startButton: e.startButton,
2302
+ showFeedback: e.showFeedback
2303
+ }), await Promise.race([s, new Promise((e, t) => {
2113
2304
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
2114
2305
  })]), await Promise.race([l, new Promise((e, t) => {
2115
2306
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
2116
- })]), this.attached = !0, this.createPlayerFacade();
2307
+ })]), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
2117
2308
  }
2118
2309
  async startListening() {
2119
2310
  this.assertSessionStarted(), await this.iframeHost.startListening();
@@ -2133,6 +2324,15 @@ var Vt = class e {
2133
2324
  toggleAudioSettings() {
2134
2325
  this.iframeHost?.postWidgetToggleAudioSettings();
2135
2326
  }
2327
+ async focusCharacter(e) {
2328
+ this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2329
+ }
2330
+ async setFit(e) {
2331
+ let t = Zt(e);
2332
+ if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2333
+ if (this.closed) throw Error("Session has ended.");
2334
+ this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
2335
+ }
2136
2336
  getLastTurn() {
2137
2337
  if (this.conversationCache.length === 0) return [];
2138
2338
  let e = this.conversationCache[this.conversationCache.length - 1].turnId;
@@ -2142,17 +2342,21 @@ var Vt = class e {
2142
2342
  this.close();
2143
2343
  }
2144
2344
  destroy() {
2145
- this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, ot(this.eventRegistry), this.readyEvent = null, this.startedEvent = null, this.closeHandlers.length = 0, this.attached = !1);
2345
+ this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, _t(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2146
2346
  }
2147
2347
  resolveMintInteraction() {
2148
- if (this.bootstrap.kind === "launch") return {};
2149
- let e = this.conversationProcessor !== null;
2150
- return {
2348
+ return this.bootstrap.kind === "launch" ? {} : {
2151
2349
  mode: this.bootstrap.mode,
2152
- responseMode: e ? "custom" : this.bootstrap.responseMode,
2153
2350
  speechInputMode: this.bootstrap.speechInputMode
2154
2351
  };
2155
2352
  }
2353
+ getSessionId() {
2354
+ return this.resolvedSession?.id ?? "";
2355
+ }
2356
+ emitWrapped(e, t) {
2357
+ let n = pt(e, this.getSessionId(), t);
2358
+ return gt(this.eventRegistry, e, n), n;
2359
+ }
2156
2360
  queueProcessorTurn(e) {
2157
2361
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
2158
2362
  let t = this.conversationProcessor;
@@ -2160,7 +2364,7 @@ var Vt = class e {
2160
2364
  let n = this.processorAbortController.signal;
2161
2365
  this.processorChain = this.processorChain.then(async () => {
2162
2366
  if (!n.aborted) try {
2163
- let r = await Pe(t, {
2367
+ let r = await He(t, {
2164
2368
  utteranceId: e.utteranceId,
2165
2369
  text: e.text,
2166
2370
  conversation: this.conversationCache,
@@ -2180,7 +2384,7 @@ var Vt = class e {
2180
2384
  } catch (t) {
2181
2385
  if (n.aborted) return;
2182
2386
  let r = t instanceof Error ? t.message : String(t);
2183
- Z(this.eventRegistry, "conversationProcessorError", {
2387
+ this.emitWrapped("conversationProcessorError", {
2184
2388
  utteranceId: e.utteranceId,
2185
2389
  message: r
2186
2390
  });
@@ -2191,7 +2395,7 @@ var Vt = class e {
2191
2395
  if (!this.attached || !this.iframeHost) throw Error("Call Experience.attach() before using speech APIs.");
2192
2396
  }
2193
2397
  assertSessionStarted() {
2194
- if (this.assertAttached(), !this.startedEvent) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
2398
+ if (this.assertAttached(), !this.startedEnvelope) throw Error("Session has not started. Wait for the player start button and the started event before using speak() or listening APIs.");
2195
2399
  }
2196
2400
  close() {
2197
2401
  this.closed || (this.closed = !0, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, this.attached = !1);
@@ -2210,10 +2414,10 @@ var Vt = class e {
2210
2414
  };
2211
2415
  }
2212
2416
  };
2213
- function Ht(e) {
2417
+ function en(e) {
2214
2418
  return e ? {
2215
- textSpeech: e.capabilities.speechOutput,
2216
- externalSpeechAudio: e.capabilities.externalAudio
2419
+ textSpeech: e.capabilities.speech.output,
2420
+ externalSpeechAudio: e.capabilities.speech.externalAudio
2217
2421
  } : {
2218
2422
  textSpeech: !0,
2219
2423
  externalSpeechAudio: !0
@@ -2221,41 +2425,41 @@ function Ht(e) {
2221
2425
  }
2222
2426
  //#endregion
2223
2427
  //#region src/widget/dockGeometry.ts
2224
- var Ut = "(min-width: 768px)", Wt = 24, Gt = .5, Kt = 1200, qt = .85, Jt = 9 / 16;
2225
- function Yt() {
2428
+ var tn = "(min-width: 768px)", nn = 24, rn = .5, an = 1200, on = .85, sn = 9 / 16;
2429
+ function cn() {
2226
2430
  if (typeof window > "u") return 800;
2227
2431
  let e = window.screen?.availHeight;
2228
2432
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2229
2433
  }
2230
- function Xt(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Wt, r = typeof window < "u" ? Yt() : 800) {
2231
- let i = Math.max(160, Math.min(t - n * 2, t * qt)), a = Math.max(120, e - n * 2), o = Math.min(r * Gt, Kt, i), s = o * Jt;
2232
- return s > a && (s = a, o = s / Jt, o > i && (o = i, s = o * Jt)), {
2434
+ function ln(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = nn, r = typeof window < "u" ? cn() : 800) {
2435
+ let i = Math.max(160, Math.min(t - n * 2, t * on)), a = Math.max(120, e - n * 2), o = Math.min(r * rn, an, i), s = o * sn;
2436
+ return s > a && (s = a, o = s / sn, o > i && (o = i, s = o * sn)), {
2233
2437
  width: Math.round(s),
2234
2438
  height: Math.round(o)
2235
2439
  };
2236
2440
  }
2237
- function Zt(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Wt) {
2441
+ function un(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = nn) {
2238
2442
  return {
2239
2443
  left: Math.max(r, t - e.width - r),
2240
2444
  top: Math.max(r, n - e.height - r)
2241
2445
  };
2242
2446
  }
2243
- function Qt(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Wt) {
2447
+ function dn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = nn) {
2244
2448
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2245
2449
  return {
2246
2450
  left: Math.min(Math.max(a, e), o),
2247
2451
  top: Math.min(Math.max(a, t), s)
2248
2452
  };
2249
2453
  }
2250
- function $t(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2251
- return e(Ut).matches;
2454
+ function fn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2455
+ return e(tn).matches;
2252
2456
  }
2253
2457
  //#endregion
2254
2458
  //#region src/widget/mountExperienceWidget.ts
2255
- function en(e) {
2459
+ function pn(e) {
2256
2460
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2257
2461
  }
2258
- function tn(e) {
2462
+ function mn(e) {
2259
2463
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2260
2464
  let t = typeof e == "string" ? e.trim() : "";
2261
2465
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2263,10 +2467,10 @@ function tn(e) {
2263
2467
  function $(e) {
2264
2468
  return e === "expanded" || e === "docked";
2265
2469
  }
2266
- var nn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", rn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", an = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", on = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2267
- function sn(e, t, n) {
2268
- de(le);
2269
- let r = ee({
2470
+ var hn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"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>", gn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", _n = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", vn = "<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>";
2471
+ function yn(e, t, n) {
2472
+ W(de);
2473
+ let r = w({
2270
2474
  galleryThumb: t.galleryThumb,
2271
2475
  avatarImage: t.avatarImage,
2272
2476
  backgroundImage: t.backgroundImage,
@@ -2292,9 +2496,9 @@ function sn(e, t, n) {
2292
2496
  let e = document.createElement("img");
2293
2497
  e.className = "liforma-et__foreground liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.foregroundImage, e.addEventListener("load", () => o(e), { once: !0 }), i.append(e);
2294
2498
  }
2295
- return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ce(i);
2499
+ return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ue(i);
2296
2500
  }
2297
- function cn(e) {
2501
+ function bn(e) {
2298
2502
  return e.startButton ? {
2299
2503
  ...e.startButton,
2300
2504
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2306,7 +2510,7 @@ function cn(e) {
2306
2510
  variant: "primary"
2307
2511
  };
2308
2512
  }
2309
- function ln(e) {
2513
+ function xn(e) {
2310
2514
  let t = !1, n = () => {
2311
2515
  t || e();
2312
2516
  }, r = () => {
@@ -2326,12 +2530,12 @@ function ln(e) {
2326
2530
  t = !0, window.removeEventListener("load", r), i?.();
2327
2531
  };
2328
2532
  }
2329
- function un(e, t) {
2330
- pe(fe);
2533
+ function Sn(e, t) {
2534
+ he(me);
2331
2535
  let n = t.experienceId?.trim();
2332
2536
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2333
- let r = t.prefetch ?? "onExpand", i = en(t.position), a = document.createElement("div");
2334
- a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", tn(t.offset));
2537
+ let r = t.prefetch ?? "onExpand", i = pn(t.position), a = document.createElement("div");
2538
+ 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", mn(t.offset));
2335
2539
  let o = document.createElement("button");
2336
2540
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2337
2541
  let s = document.createElement("div");
@@ -2351,82 +2555,82 @@ function un(e, t) {
2351
2555
  let m = document.createElement("span");
2352
2556
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2353
2557
  let h = document.createElement("button");
2354
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = an, h.setAttribute("aria-label", "Reduce");
2558
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = _n, h.setAttribute("aria-label", "Reduce");
2355
2559
  let g = document.createElement("button");
2356
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = nn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2560
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = hn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2357
2561
  let _ = document.createElement("button");
2358
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = rn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2562
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = gn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2359
2563
  let v = document.createElement("div");
2360
2564
  v.className = "liforma-ew__stage";
2361
2565
  let y = document.createElement("div");
2362
2566
  y.className = "liforma-ew__status", y.hidden = !0, f.append(v, y), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
2363
- let b = null, x = !1, S = !1, ee = !1, C = !1, w = !1, T = !1, E = !1, D = 0, O = "", k = null, A = null, j = null, M = null, N = null, P = null, F = null, I = 0, L = 0, R = null, te = !1, ne = new AbortController(), re = t.parallax !== !1, z = () => {
2567
+ let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, ee = null, j = null, M = null, N = null, P = null, F = null, te = 0, ne = 0, I = null, L = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
2364
2568
  let e = a.dataset.state;
2365
2569
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
2366
- }, B = () => {
2570
+ }, z = () => {
2367
2571
  j !== null && (clearTimeout(j), j = null);
2368
- }, V = () => {
2572
+ }, B = () => {
2369
2573
  M !== null && (clearTimeout(M), M = null), a.classList.remove("liforma-ew--layout-settling");
2370
- }, H = () => {
2574
+ }, ae = () => {
2371
2575
  for (let e of [
2372
2576
  f,
2373
2577
  l,
2374
2578
  p
2375
2579
  ]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
2376
2580
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
2377
- }, ie = (e, t, n, r) => {
2581
+ }, V = (e, t, n, r) => {
2378
2582
  let i = (i) => {
2379
2583
  i.style.left = `${e}px`, i.style.top = `${t}px`, i.style.width = `${n}px`, i.style.height = `${r}px`, i.style.right = "auto", i.style.bottom = "auto";
2380
2584
  };
2381
2585
  i(f), i(l);
2382
2586
  let a = p.offsetWidth || 120;
2383
2587
  p.style.left = `${e + n - a - 10}px`, p.style.top = `${t + 10}px`, p.style.right = "auto", p.style.bottom = "auto", p.style.width = "auto", p.style.height = "auto";
2384
- }, ae = (e, t) => {
2385
- if (z() !== "docked") return;
2386
- let n = Xt(), r = Qt(e - I, t - L, n);
2387
- N = r.left, P = r.top, ie(r.left, r.top, n.width, n.height);
2388
2588
  }, oe = (e, t) => {
2389
- if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2390
- let n = Xt(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Qt(r + e, i + t, n);
2391
- N = a.left, P = a.top, ie(a.left, a.top, n.width, n.height);
2392
- }, se = (e) => {
2393
- R === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), ae(e.clientX, e.clientY)));
2394
- }, U = (e) => {
2589
+ if (R() !== "docked") return;
2590
+ let n = ln(), r = dn(e - te, t - ne, n);
2591
+ N = r.left, P = r.top, V(r.left, r.top, n.width, n.height);
2592
+ }, se = (e, t) => {
2593
+ if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2594
+ let n = ln(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = dn(r + e, i + t, n);
2595
+ N = a.left, P = a.top, V(a.left, a.top, n.width, n.height);
2596
+ }, ce = (e) => {
2597
+ I === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
2598
+ }, H = (e) => {
2395
2599
  if (F === null || e && e.pointerId !== F) return;
2396
- let t = R;
2397
- F = null, R = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && te && (te = !1, window.removeEventListener("pointermove", se), window.removeEventListener("pointerup", U), window.removeEventListener("pointercancel", U));
2398
- }, ce = (e, t, n) => {
2399
- if (S || z() !== "docked" || !$t() || F !== null) return;
2400
- F = n, R = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2600
+ let t = I;
2601
+ F = null, I = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && L && (L = !1, window.removeEventListener("pointermove", ce), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H));
2602
+ }, le = (e, t, n) => {
2603
+ if (S || R() !== "docked" || !fn() || F !== null) return;
2604
+ F = n, I = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2401
2605
  let r = f.getBoundingClientRect();
2402
- I = e - r.left, L = t - r.top, te || (te = !0, window.addEventListener("pointermove", se), window.addEventListener("pointerup", U), window.addEventListener("pointercancel", U));
2403
- }, le = (e) => {
2404
- if (S || z() !== "docked" || !$t() || F !== null) return;
2405
- F = e.pointerId, R = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2606
+ te = e - r.left, ne = t - r.top, L || (L = !0, window.addEventListener("pointermove", ce), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
2607
+ }, ue = (e) => {
2608
+ if (S || R() !== "docked" || !fn() || F !== null) return;
2609
+ F = e.pointerId, I = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2406
2610
  let t = f.getBoundingClientRect();
2407
2611
  N = t.left, P = t.top;
2408
- }, ue = (e) => {
2409
- R === "player" && (F === null || e.pointerId !== F || oe(e.dx, e.dy));
2410
2612
  }, de = (e) => {
2411
- R === "player" && (F === null || e.pointerId !== F || U());
2613
+ I === "player" && (F === null || e.pointerId !== F || se(e.dx, e.dy));
2614
+ }, U = (e) => {
2615
+ I === "player" && (F === null || e.pointerId !== F || H());
2412
2616
  }, W = () => {
2413
- let e = $t(), t = z();
2617
+ let e = fn(), t = R();
2414
2618
  if (!e || t !== "expanded" && t !== "docked") {
2415
2619
  h.hidden = !0;
2416
2620
  return;
2417
2621
  }
2418
- h.hidden = !1, t === "docked" ? (h.innerHTML = on, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = an, h.setAttribute("aria-label", "Reduce"));
2419
- }, G = (e) => {
2420
- let t = Xt(), n = e && N !== null && P !== null ? Qt(N, P, t) : Zt(t);
2421
- n = Qt(n.left, n.top, t), N = n.left, P = n.top, ie(n.left, n.top, t.width, t.height), W();
2422
- }, K = () => {
2622
+ h.hidden = !1, t === "docked" ? (h.innerHTML = vn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = _n, h.setAttribute("aria-label", "Reduce"));
2623
+ }, fe = (e) => {
2624
+ let t = ln(), n = e && N !== null && P !== null ? dn(N, P, t) : un(t);
2625
+ n = dn(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
2626
+ }, pe = () => {
2423
2627
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2424
2628
  requestAnimationFrame(() => {
2425
2629
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
2426
2630
  });
2427
2631
  });
2428
- }, me = (e) => {
2429
- if (V(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !E) {
2632
+ }, G = (e) => {
2633
+ if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
2430
2634
  a.classList.remove("liforma-ew--layout-settling");
2431
2635
  return;
2432
2636
  }
@@ -2435,54 +2639,54 @@ function un(e, t) {
2435
2639
  a.classList.remove("liforma-ew--layout-settling");
2436
2640
  return;
2437
2641
  }
2438
- a.classList.remove("liforma-ew--layout-settling"), K();
2642
+ a.classList.remove("liforma-ew--layout-settling"), pe();
2439
2643
  }, 220);
2440
- }, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2441
- B(), j = setTimeout(() => {
2644
+ }, ge = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2645
+ z(), j = setTimeout(() => {
2442
2646
  j = null, a.classList.remove("liforma-ew--session-concealing"), e();
2443
2647
  }, 280);
2444
- })), ge = {
2648
+ })), _e = {
2445
2649
  galleryThumb: t.galleryThumb,
2446
2650
  avatarImage: t.avatarImage,
2447
2651
  backgroundImage: t.backgroundImage,
2448
2652
  foregroundImage: t.foregroundImage,
2449
2653
  fallbackImage: t.fallbackImage
2450
- }, q = (e) => {
2654
+ }, K = (e) => {
2451
2655
  if (!e) {
2452
2656
  y.hidden = !0, y.textContent = "";
2453
2657
  return;
2454
2658
  }
2455
2659
  y.hidden = !1, y.textContent = e;
2456
- }, _e = (e) => {
2660
+ }, ve = (e) => {
2457
2661
  if (!e) {
2458
2662
  c.hidden = !0, c.textContent = "";
2459
2663
  return;
2460
2664
  }
2461
2665
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
2462
2666
  }, ye = () => {
2463
- ee = !0, o.disabled = !1, _e(null), r === "onExpand" && t.onPrefetchReady?.();
2464
- }, be = () => {
2465
- C = !0, a.dataset.warm = "true", l.hidden = !1, E || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2667
+ C = !0, o.disabled = !1, ve(null), r === "onExpand" && t.onPrefetchReady?.();
2668
+ }, q = () => {
2669
+ w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2466
2670
  }, xe = (e) => {
2467
- k?.(), k = null;
2468
- let t = sn(s, e, { parallax: re });
2469
- return t ? (k = t, !0) : !1;
2671
+ A?.(), A = null;
2672
+ let t = yn(s, e, { parallax: ie });
2673
+ return t ? (A = t, !0) : !1;
2470
2674
  }, Se = () => {
2471
- if (xe(ge)) {
2675
+ if (xe(_e)) {
2472
2676
  ye();
2473
2677
  return;
2474
2678
  }
2475
- _e("Loading…"), ve(n, { signal: ne.signal }).then((e) => {
2679
+ ve("Loading…"), be(n, { signal: re.signal }).then((e) => {
2476
2680
  if (!S) {
2477
2681
  if (!xe({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
2478
2682
  ye();
2479
2683
  }
2480
2684
  }).catch((e) => {
2481
- if (S || ne.signal.aborted) return;
2685
+ if (S || re.signal.aborted) return;
2482
2686
  let n = e instanceof Error ? e : Error(String(e));
2483
- _e("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
2687
+ ve("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
2484
2688
  });
2485
- }, J = () => ({
2689
+ }, Ce = () => ({
2486
2690
  experienceId: n,
2487
2691
  ui: "widget",
2488
2692
  ...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
@@ -2492,234 +2696,243 @@ function un(e, t) {
2492
2696
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
2493
2697
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
2494
2698
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
2495
- }), Ce = () => ({
2699
+ }), we = () => ({
2496
2700
  ...t.fit ? { fit: t.fit } : {},
2497
- startButton: cn(t)
2498
- }), we = (e = !0) => {
2499
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), H(), a.dataset.state = "expanded", q(null), typeof document < "u" && (O = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
2500
- }, Te = () => {
2501
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", q(null), typeof document < "u" && (document.body.style.overflow = O), G(!0), W(), b?.setWidgetChrome("docked");
2502
- }, Ee = (e) => {
2701
+ startButton: bn(t),
2702
+ ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
2703
+ }), J = (e = !0) => {
2704
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
2705
+ }, Y = () => {
2706
+ 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), fe(!0), W(), b?.setWidgetChrome("docked");
2707
+ }, X = (e) => {
2503
2708
  e.on("started", () => {
2504
- S || (E = !0, a.dataset.live = "true", q(null), t.onStarted?.(), $(a.dataset.state) && K());
2709
+ S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && pe());
2710
+ }), e.on("feedback", (e) => {
2711
+ S || t.onFeedback?.(e);
2712
+ }), e.on("feedbackFailed", (e) => {
2713
+ S || t.onFeedbackFailed?.(e);
2505
2714
  });
2506
- }, De = () => {
2507
- V(), u.hidden = !0, p.hidden = !0, H(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), ee && (o.disabled = !1), q(null), typeof document < "u" && (document.body.style.overflow = O), W();
2508
- }, Oe = () => {
2509
- B(), V(), D += 1, x = !1, C = !1, w = !1, T = !1, E = !1;
2715
+ }, Te = () => {
2716
+ B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), W();
2717
+ }, Ee = () => {
2718
+ z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
2510
2719
  let e = b;
2511
2720
  b = null, e?.destroy(), v.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
2512
- }, Y = () => {
2721
+ }, De = () => {
2513
2722
  if (!S && $(a.dataset.state)) {
2514
- if (U(), x = !1, b && T) {
2723
+ if (H(), x = !1, b && E) {
2515
2724
  let e = b;
2516
2725
  (async () => {
2517
- E && (await he(), S || b !== e) || (C && e.setWidgetChrome("collapsed"), De(), E ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : C && be(), t.onCollapsed?.(), t.onClose?.());
2726
+ D && (await ge(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Te(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && q(), t.onCollapsed?.(), t.onClose?.());
2518
2727
  })();
2519
2728
  return;
2520
2729
  }
2521
- Oe(), De(), t.onCollapsed?.(), t.onClose?.();
2730
+ Ee(), Te(), t.onCollapsed?.(), t.onClose?.();
2522
2731
  }
2523
- }, ke = () => {
2524
- S || $t() && z() === "expanded" && me(() => {
2525
- Te();
2732
+ }, Oe = () => {
2733
+ S || fn() && R() === "expanded" && G(() => {
2734
+ Y();
2526
2735
  });
2527
- }, Ae = () => {
2528
- S || z() === "docked" && (U(), me(() => {
2529
- H(), we(!1), b?.setWidgetChrome("expanded");
2736
+ }, ke = () => {
2737
+ S || R() === "docked" && (H(), G(() => {
2738
+ ae(), J(!1), b?.setWidgetChrome("expanded");
2530
2739
  }));
2740
+ }, Ae = () => {
2741
+ !b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), J(), b.setWidgetChrome("expanded"), x = !1, pe());
2531
2742
  }, je = () => {
2532
- !b || !E || (B(), a.classList.remove("liforma-ew--session-revealed"), we(), b.setWidgetChrome("expanded"), x = !1, K());
2533
- }, Me = () => {
2534
- !b || !T || E || (B(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, C && b.setWidgetChrome("expanded"));
2535
- }, Ne = (e) => {
2536
- S || e !== D && !E || (B(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, b?.setWidgetChrome("expanded"), E && K());
2537
- }, Pe = () => {
2538
- if (S || w || C || b || $(a.dataset.state)) return;
2539
- w = !0;
2540
- let e = D;
2743
+ !b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), J(), x = !1, w || b.setWidgetChrome("expanded"));
2744
+ }, Me = (e) => {
2745
+ S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), J(), x = !1, D && pe());
2746
+ }, Ne = () => {
2747
+ if (S || T || w || b || $(a.dataset.state)) return;
2748
+ T = !0;
2749
+ let e = O;
2541
2750
  l.hidden = !1, (async () => {
2542
2751
  try {
2543
- let t = await Vt.startSession(J());
2544
- if (S || e !== D) {
2752
+ let t = await $t.startSession(Ce());
2753
+ if (S || e !== O) {
2545
2754
  t.destroy();
2546
2755
  return;
2547
2756
  }
2548
- b = t, Ee(t);
2757
+ b = t, X(t);
2549
2758
  let n = await t.attach({
2550
2759
  container: l,
2551
- ...Ce(),
2760
+ ...we(),
2552
2761
  onWidgetReady: () => {
2553
- S || e !== D || (w = !1, T = !0, be());
2762
+ S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : q());
2554
2763
  },
2555
2764
  onWidgetExpand: () => {
2556
- Ne(e);
2765
+ Me(e);
2557
2766
  },
2558
2767
  onWidgetAudioSettings: (e) => {
2559
- S || Re(e);
2768
+ S || Le(e);
2560
2769
  },
2561
2770
  onWidgetDragStart: (e) => {
2562
- S || le(e);
2771
+ S || ue(e);
2563
2772
  },
2564
2773
  onWidgetDragMove: (e) => {
2565
- S || ue(e);
2774
+ S || de(e);
2566
2775
  },
2567
2776
  onWidgetDragEnd: (e) => {
2568
- S || de(e);
2777
+ S || U(e);
2569
2778
  },
2570
2779
  onPlayerStatusChange: (e) => {
2571
- S || e === "error" && $(a.dataset.state) && q("Could not load the experience.");
2780
+ S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
2572
2781
  }
2573
2782
  });
2574
- if (S || e !== D) {
2783
+ if (S || e !== O) {
2575
2784
  t.destroy(), b === t && (b = null);
2576
2785
  return;
2577
2786
  }
2578
- T = !0, n.on("close", () => {
2579
- S || Y();
2787
+ n.on("close", () => {
2788
+ S || De();
2580
2789
  });
2581
2790
  } catch (n) {
2582
- if (S || e !== D) return;
2583
- w = !1, l.hidden = !0, l.replaceChildren(), b = null;
2791
+ if (S || e !== O) return;
2792
+ T = !1, l.hidden = !0, l.replaceChildren(), b = null;
2584
2793
  let r = n instanceof Error ? n : Error(String(n));
2585
2794
  t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
2586
2795
  }
2587
2796
  })();
2588
- }, Fe = () => {
2589
- if (S || x || !ee || $(a.dataset.state)) return;
2590
- if (b && E) {
2591
- je();
2797
+ }, Pe = () => {
2798
+ if (S || x || !C || $(a.dataset.state)) return;
2799
+ if (b && D) {
2800
+ Ae();
2592
2801
  return;
2593
2802
  }
2594
- if (b && T) {
2595
- Me();
2803
+ if (b && E) {
2804
+ je();
2596
2805
  return;
2597
2806
  }
2598
- let e = ++D;
2599
- 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 () => {
2807
+ let e = ++O;
2808
+ 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 () => {
2600
2809
  try {
2601
- we();
2602
- let t = await Vt.startSession(J());
2603
- if (S || e !== D) {
2810
+ J();
2811
+ let t = await $t.startSession(Ce());
2812
+ if (S || e !== O) {
2604
2813
  t.destroy();
2605
2814
  return;
2606
2815
  }
2607
- b = t, Ee(t);
2816
+ b = t, X(t);
2608
2817
  let n = await t.attach({
2609
2818
  container: v,
2610
- ...Ce(),
2819
+ ...we(),
2611
2820
  onWidgetAudioSettings: (e) => {
2612
- S || Re(e);
2821
+ S || Le(e);
2613
2822
  },
2614
2823
  onWidgetDragStart: (e) => {
2615
- S || le(e);
2824
+ S || ue(e);
2616
2825
  },
2617
2826
  onWidgetDragMove: (e) => {
2618
- S || ue(e);
2827
+ S || de(e);
2619
2828
  },
2620
2829
  onWidgetDragEnd: (e) => {
2621
- S || de(e);
2830
+ S || U(e);
2622
2831
  },
2623
2832
  onPlayerStatusChange: (e) => {
2624
- S || (e === "error" ? q("Could not load the experience.") : $(a.dataset.state) && q(null));
2833
+ S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
2625
2834
  }
2626
2835
  });
2627
- if (S || e !== D) {
2836
+ if (S || e !== O) {
2628
2837
  t.destroy(), b === t && (b = null);
2629
2838
  return;
2630
2839
  }
2631
- T = !0, n.on("close", () => {
2632
- S || Y();
2840
+ E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
2841
+ S || De();
2633
2842
  });
2634
2843
  } catch (n) {
2635
- if (S || e !== D) return;
2844
+ if (S || e !== O) return;
2636
2845
  let r = n instanceof Error ? n : Error(String(n));
2637
- q(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
2846
+ K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
2638
2847
  } finally {
2639
- e === D && (x = !1);
2848
+ e === O && (x = !1);
2640
2849
  }
2641
2850
  })();
2642
- }, Ie = () => {
2851
+ }, Fe = () => {
2643
2852
  if (!(S || $(a.dataset.state))) {
2853
+ if (b && D) {
2854
+ Ae();
2855
+ return;
2856
+ }
2644
2857
  if (b && E) {
2645
2858
  je();
2646
2859
  return;
2647
2860
  }
2648
- if (b && T) {
2649
- Me();
2861
+ if (T || b) {
2862
+ J();
2650
2863
  return;
2651
2864
  }
2652
- Fe();
2865
+ Pe();
2653
2866
  }
2654
- }, Le = (e) => {
2655
- if (e.stopPropagation(), z() === "expanded") {
2656
- ke();
2867
+ }, Ie = (e) => {
2868
+ if (e.stopPropagation(), R() === "expanded") {
2869
+ Oe();
2657
2870
  return;
2658
2871
  }
2659
- z() === "docked" && Ae();
2660
- }, Re = (e) => {
2872
+ R() === "docked" && ke();
2873
+ }, Le = (e) => {
2661
2874
  g.setAttribute("aria-pressed", e ? "true" : "false");
2662
- }, ze = (e) => {
2875
+ }, Re = (e) => {
2663
2876
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
2877
+ }, ze = (e) => {
2878
+ R() === "docked" && fn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
2664
2879
  }, Be = (e) => {
2665
- z() === "docked" && $t() && (e.target?.closest("button") || (e.preventDefault(), ce(e.clientX, e.clientY, e.pointerId)));
2666
- }, Ve = (e) => {
2667
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Y());
2668
- }, He = () => {
2880
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), De());
2881
+ }, Ve = () => {
2669
2882
  if (!S) {
2670
- if (z() === "docked") {
2671
- if (!$t()) {
2672
- Ae();
2883
+ if (R() === "docked") {
2884
+ if (!fn()) {
2885
+ ke();
2673
2886
  return;
2674
2887
  }
2675
- E ? me(() => {
2676
- G(!0);
2677
- }) : G(!0);
2888
+ D ? G(() => {
2889
+ fe(!0);
2890
+ }) : fe(!0);
2678
2891
  return;
2679
2892
  }
2680
2893
  W();
2681
2894
  }
2682
- }, Ue = typeof window < "u" ? window.matchMedia(Ut) : null, We = () => {
2895
+ }, He = typeof window < "u" ? window.matchMedia(tn) : null, Ue = () => {
2683
2896
  if (!S) {
2684
- if (z() === "docked" && !$t()) {
2685
- Ae();
2897
+ if (R() === "docked" && !fn()) {
2898
+ ke();
2686
2899
  return;
2687
2900
  }
2688
2901
  W();
2689
2902
  }
2690
2903
  };
2691
- return o.addEventListener("click", Ie), d.addEventListener("click", Y), _.addEventListener("click", (e) => {
2692
- e.stopPropagation(), Y();
2693
- }), h.addEventListener("click", Le), g.addEventListener("click", ze), p.addEventListener("pointerdown", Be), window.addEventListener("keydown", Ve), window.addEventListener("resize", He), Ue?.addEventListener("change", We), Se(), W(), r === "eager" ? queueMicrotask(() => {
2694
- S || Pe();
2695
- }) : r === "idle" && (A = ln(() => {
2696
- S || Pe();
2904
+ return o.addEventListener("click", Fe), d.addEventListener("click", De), _.addEventListener("click", (e) => {
2905
+ e.stopPropagation(), De();
2906
+ }), h.addEventListener("click", Ie), g.addEventListener("click", Re), p.addEventListener("pointerdown", ze), window.addEventListener("keydown", Be), window.addEventListener("resize", Ve), He?.addEventListener("change", Ue), Se(), W(), r === "eager" ? queueMicrotask(() => {
2907
+ S || Ne();
2908
+ }) : r === "idle" && (ee = xn(() => {
2909
+ S || Ne();
2697
2910
  })), {
2698
2911
  root: a,
2699
- expand: Ie,
2700
- collapse: Y,
2701
- dock: ke,
2702
- maximize: Ae,
2912
+ expand: Fe,
2913
+ collapse: De,
2914
+ dock: Oe,
2915
+ maximize: ke,
2703
2916
  prefetch() {
2704
2917
  if (r === "onExpand") {
2705
- Pe();
2918
+ Ne();
2706
2919
  return;
2707
2920
  }
2708
- Pe();
2921
+ Ne();
2709
2922
  },
2710
2923
  destroy() {
2711
- S || (S = !0, U(), A?.(), A = null, ne.abort(), k?.(), k = null, window.removeEventListener("keydown", Ve), window.removeEventListener("resize", He), Ue?.removeEventListener("change", We), Oe(), De(), e.replaceChildren());
2924
+ S || (S = !0, H(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", Be), window.removeEventListener("resize", Ve), He?.removeEventListener("change", Ue), Ee(), Te(), e.replaceChildren());
2712
2925
  }
2713
2926
  };
2714
2927
  }
2715
2928
  //#endregion
2716
2929
  //#region src/react/ExperienceWidget.tsx
2717
- function dn(t) {
2718
- let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, language: _, mode: v, speechInputMode: y, speechOnly: b, fit: x, embedBaseUrl: S, expandedMaxWidth: ee, expandedMaxHeight: C, startButtonLabel: w, startButton: T, className: E = "", onExpanded: D, onCollapsed: O, onStarted: k, onClose: A, onError: j, onPrefetchReady: M } = t, N = m === "bottom-right" || m === "bottom-left";
2930
+ function Cn(t) {
2931
+ let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, language: _, mode: v, speechInputMode: y, speechOnly: b, fit: x, embedBaseUrl: S, expandedMaxWidth: C, expandedMaxHeight: w, startButtonLabel: T, startButton: E, showFeedback: D, className: O = "", onExpanded: k, onCollapsed: A, onStarted: ee, onClose: j, onError: M, onPrefetchReady: N, onFeedback: P, onFeedbackFailed: F } = t, te = m === "bottom-right" || m === "bottom-left";
2719
2932
  return e(() => {
2720
2933
  let e = r.current;
2721
2934
  if (!e || !i.trim()) return;
2722
- let t = un(e, {
2935
+ let t = Sn(e, {
2723
2936
  experienceId: i,
2724
2937
  alt: o,
2725
2938
  galleryThumb: s,
@@ -2738,16 +2951,19 @@ function dn(t) {
2738
2951
  speechOnly: b,
2739
2952
  fit: x,
2740
2953
  embedBaseUrl: S,
2741
- expandedMaxWidth: ee,
2742
- expandedMaxHeight: C,
2743
- startButtonLabel: w,
2744
- startButton: T,
2745
- onExpanded: D,
2746
- onCollapsed: O,
2747
- onStarted: k,
2748
- onClose: A,
2749
- onError: j,
2750
- onPrefetchReady: M
2954
+ expandedMaxWidth: C,
2955
+ expandedMaxHeight: w,
2956
+ startButtonLabel: T,
2957
+ startButton: E,
2958
+ showFeedback: D,
2959
+ onFeedback: P,
2960
+ onFeedbackFailed: F,
2961
+ onExpanded: k,
2962
+ onCollapsed: A,
2963
+ onStarted: ee,
2964
+ onClose: j,
2965
+ onError: M,
2966
+ onPrefetchReady: N
2751
2967
  });
2752
2968
  return () => t.destroy();
2753
2969
  }, [
@@ -2769,20 +2985,23 @@ function dn(t) {
2769
2985
  b,
2770
2986
  x,
2771
2987
  S,
2772
- ee,
2773
2988
  C,
2774
2989
  w,
2775
2990
  T,
2991
+ E,
2776
2992
  D,
2777
- O,
2993
+ P,
2994
+ F,
2778
2995
  k,
2779
2996
  A,
2997
+ ee,
2780
2998
  j,
2781
- M
2999
+ M,
3000
+ N
2782
3001
  ]), /* @__PURE__ */ a("div", {
2783
3002
  ref: r,
2784
- className: E,
2785
- style: N ? { display: "contents" } : {
3003
+ className: O,
3004
+ style: te ? { display: "contents" } : {
2786
3005
  width: "100%",
2787
3006
  height: "100%",
2788
3007
  minHeight: "inherit"
@@ -2790,6 +3009,6 @@ function dn(t) {
2790
3009
  });
2791
3010
  }
2792
3011
  //#endregion
2793
- export { G as ExperienceThumbnail, dn as ExperienceWidget, y as createLiformaSessionRouteHandler };
3012
+ export { pe as ExperienceThumbnail, Cn as ExperienceWidget, v as createLiformaSessionRouteHandler };
2794
3013
 
2795
3014
  //# sourceMappingURL=index.js.map