@liforma/client 0.4.15 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/next/index.js +619 -608
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  5. package/dist/next/thumbnail/avatarPlate.d.ts +11 -0
  6. package/dist/next/thumbnail/avatarPlate.d.ts.map +1 -0
  7. package/dist/next/thumbnail/avatarPlate.test.d.ts +2 -0
  8. package/dist/next/thumbnail/avatarPlate.test.d.ts.map +1 -0
  9. package/dist/next/thumbnail/expandAssetUrl.d.ts +3 -2
  10. package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -1
  11. package/dist/next/thumbnail/index.d.ts +2 -0
  12. package/dist/next/thumbnail/index.d.ts.map +1 -1
  13. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  14. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  15. package/dist/next/thumbnail.js +211 -200
  16. package/dist/next/thumbnail.js.map +1 -1
  17. package/dist/npm/index.js +496 -492
  18. package/dist/npm/index.js.map +1 -1
  19. package/dist/npm/thumbnail/avatarPlate.d.ts +11 -0
  20. package/dist/npm/thumbnail/avatarPlate.d.ts.map +1 -0
  21. package/dist/npm/thumbnail/expandAssetUrl.d.ts +3 -2
  22. package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -1
  23. package/dist/npm/thumbnail/index.d.ts +2 -0
  24. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  25. package/dist/npm/thumbnail/index.js +123 -110
  26. package/dist/npm/thumbnail/index.js.map +1 -1
  27. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  28. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  29. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  30. package/dist/react/index.js +749 -738
  31. package/dist/react/index.js.map +1 -1
  32. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  33. package/dist/react/thumbnail/avatarPlate.d.ts +11 -0
  34. package/dist/react/thumbnail/avatarPlate.d.ts.map +1 -0
  35. package/dist/react/thumbnail/avatarPlate.test.d.ts +2 -0
  36. package/dist/react/thumbnail/avatarPlate.test.d.ts.map +1 -0
  37. package/dist/react/thumbnail/expandAssetUrl.d.ts +3 -2
  38. package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -1
  39. package/dist/react/thumbnail/index.d.ts +2 -0
  40. package/dist/react/thumbnail/index.d.ts.map +1 -1
  41. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +7 -3
  42. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  43. package/dist/react/thumbnail.js +211 -200
  44. package/dist/react/thumbnail.js.map +1 -1
  45. package/dist/sdk/v2/client.js +1 -1
  46. package/dist/sdk/v2/client.js.map +1 -1
  47. package/dist/sdk/v2/thumbnail.js +2 -2
  48. package/dist/sdk/v2/thumbnail.js.map +1 -1
  49. package/dist/svelte/ExperienceThumbnail.svelte +3 -0
  50. package/package.json +1 -1
package/dist/npm/index.js CHANGED
@@ -34,23 +34,30 @@ function r(e) {
34
34
  return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
35
35
  }
36
36
  //#endregion
37
- //#region src/thumbnail/locationPlate.ts
38
- var i = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
37
+ //#region src/thumbnail/avatarPlate.ts
38
+ var i = /(\/avatars\/[^/]+\/)(\d+)(\/)/i;
39
39
  function a(e, t) {
40
40
  let n = e.trim();
41
- return n && n.replace(i, (e, n, r, i, a) => `${n}${t}${i}${a}`);
41
+ return n && n.replace(i, (e, n, r, i) => `${n}${t}${i}`);
42
+ }
43
+ //#endregion
44
+ //#region src/thumbnail/locationPlate.ts
45
+ var o = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
46
+ function s(e, t) {
47
+ let n = e.trim();
48
+ return n && n.replace(o, (e, n, r, i, a) => `${n}${t}${i}${a}`);
42
49
  }
43
- var o = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
44
- function s(e) {
50
+ var c = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
51
+ function l(e) {
45
52
  return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
46
53
  }
47
- function c(e) {
54
+ function u(e) {
48
55
  return /^https?:\/\//i.test(e) || e.startsWith("//");
49
56
  }
50
- function l(e) {
57
+ function d(e) {
51
58
  return e.startsWith("//") ? `https:${e}` : e;
52
59
  }
53
- function u(e) {
60
+ function f(e) {
54
61
  let t = e.indexOf("?");
55
62
  return t === -1 ? {
56
63
  pathname: e,
@@ -60,61 +67,58 @@ function u(e) {
60
67
  search: e.slice(t)
61
68
  };
62
69
  }
63
- function d(e, t, n = "") {
70
+ function p(e, t, n = "") {
64
71
  return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
65
72
  }
66
- function f(e, t, n) {
73
+ function m(e, t, n) {
67
74
  let r = e.trim();
68
75
  if (!r) return r;
69
- let i = s(n);
70
- if (c(r)) return a(l(r), t);
71
- let { pathname: f, search: p } = u(r.replace(/\\/g, "/")), m = f;
76
+ let i = l(n);
77
+ if (u(r)) return s(d(r), t);
78
+ let { pathname: a, search: o } = f(r.replace(/\\/g, "/")), m = a;
72
79
  if (!m.startsWith("/")) m = `/locations/${m.replace(/^locations\//i, "")}`;
73
- else if (!/^\/locations\//i.test(m)) return /^\/avatars\//i.test(m) ? d(i, m, p) : r;
74
- if (/\.webp$/i.test(m) && !o.test(m.replace(/\.webp$/i, ""))) return d(i, m, p);
80
+ else if (!/^\/locations\//i.test(m)) return /^\/avatars\//i.test(m) ? p(i, m, o) : r;
81
+ if (/\.webp$/i.test(m) && !c.test(m.replace(/\.webp$/i, ""))) return p(i, m, o);
75
82
  let h = m.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
76
- return h = h.replace(o, ""), `${i}/locations/${h}-${t}.webp${p}`;
83
+ return h = h.replace(c, ""), `${i}/locations/${h}-${t}.webp${o}`;
77
84
  }
78
- function p(e, t) {
79
- let n = e.trim();
80
- if (!n) return n;
81
- let r = s(t);
82
- if (c(n)) return l(n);
83
- let { pathname: i, search: a } = u(n.replace(/\\/g, "/")), o = i;
84
- if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
85
- else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
86
- else return n;
87
- if (!/^\/avatars\//i.test(o)) return n;
88
- let f = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
89
- return f && !f.includes("/") && !a ? `${r}/avatars/${f}/256/${f}_neutral.webp` : d(r, o, a);
85
+ function h(e, t, n = "256") {
86
+ let r = e.trim();
87
+ if (!r) return r;
88
+ let i = l(t), o = n;
89
+ if (u(r)) return a(d(r), o);
90
+ let { pathname: s, search: c } = f(r.replace(/\\/g, "/")), m = s;
91
+ if (!m.startsWith("/")) if (/^avatars\//i.test(m)) m = `/${m}`;
92
+ else if (/^[^/]+$/.test(m) && !c) return `${i}/avatars/${m}/${o}/${m}_neutral.webp`;
93
+ else return r;
94
+ if (!/^\/avatars\//i.test(m)) return r;
95
+ let h = m.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
96
+ return h && !h.includes("/") && !c ? `${i}/avatars/${h}/${o}/${h}_neutral.webp` : a(p(i, m, c), o);
90
97
  }
91
98
  //#endregion
92
99
  //#region src/thumbnail/toGalleryThumbUrl.ts
93
- var m = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, h = /_CH(\.webp)/i;
94
- function g(e) {
100
+ var g = /_CH(\.webp)/i;
101
+ function _(e) {
95
102
  return /\/locations\//i.test(e) || /^locations\//i.test(e) ? !0 : /^https?:\/\//i.test(e) || e.startsWith("//") || /^\/?avatars\//i.test(e) || e.startsWith("/") ? !1 : e.includes("/");
96
103
  }
97
- function _(e, t = "256x256", n) {
98
- let r = e.trim();
99
- if (!r) return r;
100
- if (g(r)) return f(r, t, n);
101
- let i = p(r, n);
102
- return i = i.replace(m, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(h, "_neutral$1");
104
+ function v(e, t = "256x256", n, r = "256") {
105
+ let i = e.trim();
106
+ return i && (_(i) ? m(i, t, n) : h(i, n, r).replace(g, "_neutral$1"));
103
107
  }
104
- function v(e) {
108
+ function y(e) {
105
109
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
106
110
  if (!t) return null;
107
- let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = s(e.cdnBaseUrl), c = e.normalize !== !1, l = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : _(e, a, o), u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : f(e, a, o);
111
+ let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = e.avatarPlateSize ?? "256", s = l(e.cdnBaseUrl), c = e.normalize !== !1, u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : v(e, a, s, o), d = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : m(e, a, s);
108
112
  return {
109
- avatarImage: l(t),
110
- ...n ? { backgroundImage: u(n) } : {},
111
- ...r ? { foregroundImage: u(r) } : {},
112
- ...i ? { fallbackImage: l(i) } : {}
113
+ avatarImage: u(t),
114
+ ...n ? { backgroundImage: d(n) } : {},
115
+ ...r ? { foregroundImage: d(r) } : {},
116
+ ...i ? { fallbackImage: u(i) } : {}
113
117
  };
114
118
  }
115
119
  //#endregion
116
120
  //#region src/shims/localStack.ts
117
- function y() {
121
+ function b() {
118
122
  if (globalThis.__LIFORMA_STACK === "local") return !0;
119
123
  if (typeof location > "u") return !1;
120
124
  try {
@@ -125,83 +129,83 @@ function y() {
125
129
  }
126
130
  //#endregion
127
131
  //#region src/thumbnail/hostedLaunchUrl.ts
128
- var b = "https://player.liforma.ai", x = "http://localhost:3002";
129
- function S(e) {
132
+ var x = "https://player.liforma.ai", S = "http://localhost:3002";
133
+ function C(e) {
130
134
  return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
131
135
  }
132
- function C(e) {
136
+ function w(e) {
133
137
  let t = e?.trim();
134
- return t ? t.replace(/\/$/, "") : y() ? x : b;
138
+ return t ? t.replace(/\/$/, "") : b() ? S : x;
135
139
  }
136
- function w(e) {
137
- let t = e.experienceId.trim(), n = C(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
140
+ function T(e) {
141
+ let t = e.experienceId.trim(), n = w(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
138
142
  return i && r.searchParams.set("returnUrl", i), r.toString();
139
143
  }
140
- function T(e) {
144
+ function E(e) {
141
145
  let t = e.href?.trim();
142
146
  if (t) return t;
143
147
  let n = e.experienceId?.trim();
144
148
  if (!n) return;
145
149
  let r = e.returnUrl?.trim();
146
- return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), w({
150
+ return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), T({
147
151
  experienceId: n,
148
152
  ...r ? { returnUrl: r } : {},
149
153
  playerBaseUrl: e.playerBaseUrl
150
154
  });
151
155
  }
152
- function E() {
156
+ function D() {
153
157
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
154
158
  }
155
- var D = 0, O = [];
156
- function ee() {
157
- return E() ? 4 : Infinity;
159
+ var O = 0, k = [];
160
+ function A() {
161
+ return D() ? 4 : Infinity;
158
162
  }
159
- function te() {
160
- return E() ? 160 : 0;
163
+ function ee() {
164
+ return D() ? 160 : 0;
161
165
  }
162
- function ne() {
163
- let e = ee();
164
- for (; D < e && O.length > 0;) {
165
- let e = O.shift();
166
+ function j() {
167
+ let e = A();
168
+ for (; O < e && k.length > 0;) {
169
+ let e = k.shift();
166
170
  if (!e || e.cancelled) continue;
167
- D += 1, e.start();
168
- let t = te();
171
+ O += 1, e.start();
172
+ let t = ee();
169
173
  if (t <= 0) {
170
- D = Math.max(0, D - 1);
174
+ O = Math.max(0, O - 1);
171
175
  continue;
172
176
  }
173
177
  window.setTimeout(() => {
174
- D = Math.max(0, D - 1), ne();
178
+ O = Math.max(0, O - 1), j();
175
179
  }, t);
176
180
  }
177
181
  }
178
- function re(e) {
179
- if (!E()) return e(), () => {};
182
+ function te(e) {
183
+ if (!D()) return e(), () => {};
180
184
  let t = {
181
185
  start: e,
182
186
  cancelled: !1
183
187
  };
184
- return O.push(t), ne(), () => {
188
+ return k.push(t), j(), () => {
185
189
  t.cancelled = !0;
186
190
  };
187
191
  }
188
192
  //#endregion
189
193
  //#region src/thumbnail/lazyLoad.ts
190
- function k() {
191
- return E() ? "96px 0px" : "280px 0px";
194
+ function M() {
195
+ return D() ? "96px 0px" : "280px 0px";
192
196
  }
193
- function A(e) {
197
+ function N(e) {
194
198
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
195
199
  return Number.isFinite(n) ? Math.abs(n) : 280;
196
200
  }
197
- function j(e, t) {
201
+ function P(e, t) {
198
202
  if (typeof window > "u") return !1;
199
203
  let n = e.getBoundingClientRect();
200
204
  return n.bottom >= -t && n.top <= window.innerHeight + t;
201
205
  }
202
- function M(e, t) {
203
- let { onVisibleChange: n } = t, r = t.rootMargin ?? k(), i = A(r), a = !1, o = !1, s = null, c = () => {
204
- o || (s?.(), s = re(() => {
206
+ function ne(e, t) {
207
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? M(), i = N(r), a = !1, o = !1, s = null, c = () => {
208
+ o || (s?.(), s = te(() => {
205
209
  s = null, o = !0, n(!0);
206
210
  }));
207
211
  }, l = (e) => {
@@ -223,11 +227,11 @@ function M(e, t) {
223
227
  rootMargin: r,
224
228
  threshold: 0
225
229
  });
226
- return u.observe(e), j(e, i) && l(!0), () => {
230
+ return u.observe(e), P(e, i) && l(!0), () => {
227
231
  s?.(), s = null, u.disconnect();
228
232
  };
229
233
  }
230
- function ie(e, t) {
234
+ function re(e, t) {
231
235
  let n = () => t();
232
236
  return e.complete ? queueMicrotask(n) : (e.addEventListener("load", n, { once: !0 }), e.addEventListener("error", n, { once: !0 })), () => {
233
237
  e.removeEventListener("load", n), e.removeEventListener("error", n);
@@ -235,40 +239,40 @@ function ie(e, t) {
235
239
  }
236
240
  //#endregion
237
241
  //#region src/thumbnail/scrollParallax.ts
238
- function ae() {
242
+ function F() {
239
243
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
240
244
  }
241
- function N(e, t) {
245
+ function I(e, t) {
242
246
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
243
247
  }
244
- var P = /* @__PURE__ */ new Set(), F = !1, I = 0;
245
- function L() {
246
- if (I = 0, P.size === 0 || typeof window > "u") return;
248
+ var L = /* @__PURE__ */ new Set(), ie = !1, R = 0;
249
+ function ae() {
250
+ if (R = 0, L.size === 0 || typeof window > "u") return;
247
251
  let e = window.innerHeight;
248
- for (let t of P) {
252
+ for (let t of L) {
249
253
  if (t.pointerActive?.()) continue;
250
254
  let n = t.element.getBoundingClientRect();
251
- n.bottom < -64 || n.top > e + 64 || t.onParallax(N(n, e));
255
+ n.bottom < -64 || n.top > e + 64 || t.onParallax(I(n, e));
252
256
  }
253
257
  }
254
- function R() {
255
- I === 0 && (I = requestAnimationFrame(L));
258
+ function z() {
259
+ R === 0 && (R = requestAnimationFrame(ae));
256
260
  }
257
261
  function oe() {
258
- F || typeof window > "u" || (F = !0, window.addEventListener("scroll", R, { passive: !0 }), window.addEventListener("resize", R, { passive: !0 }));
262
+ ie || typeof window > "u" || (ie = !0, window.addEventListener("scroll", z, { passive: !0 }), window.addEventListener("resize", z, { passive: !0 }));
259
263
  }
260
264
  function se() {
261
- P.size > 0 || !F || typeof window > "u" || (F = !1, I !== 0 && (cancelAnimationFrame(I), I = 0), window.removeEventListener("scroll", R), window.removeEventListener("resize", R));
265
+ L.size > 0 || !ie || typeof window > "u" || (ie = !1, R !== 0 && (cancelAnimationFrame(R), R = 0), window.removeEventListener("scroll", z), window.removeEventListener("resize", z));
262
266
  }
263
267
  function ce(e, t) {
264
- if (!ae()) return () => {};
268
+ if (!F()) return () => {};
265
269
  let n = {
266
270
  element: e,
267
271
  onParallax: t.onParallax,
268
272
  pointerActive: t.pointerActive
269
273
  };
270
- return P.add(n), oe(), n.pointerActive?.() || t.onParallax(N(e.getBoundingClientRect(), window.innerHeight)), () => {
271
- P.delete(n), se();
274
+ return L.add(n), oe(), n.pointerActive?.() || t.onParallax(I(e.getBoundingClientRect(), window.innerHeight)), () => {
275
+ L.delete(n), se();
272
276
  };
273
277
  }
274
278
  //#endregion
@@ -290,7 +294,7 @@ function le(e) {
290
294
  a = !0, e.pointerType === "mouse" && (r = !0), o();
291
295
  }, u = () => {
292
296
  let s = a;
293
- a = !1, r = !1, i && s ? (t = N(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
297
+ a = !1, r = !1, i && s ? (t = I(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
294
298
  }, d = (e) => {
295
299
  e.pointerType === "mouse" && (r = !0, o());
296
300
  }, f = () => {
@@ -302,15 +306,15 @@ function le(e) {
302
306
  }
303
307
  //#endregion
304
308
  //#region src/thumbnail/styles.ts
305
- var ue = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", de = !1;
306
- function z(e) {
307
- if (typeof document > "u" || de) return;
309
+ var ue = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n}\n\n.liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", B = !1;
310
+ function de(e) {
311
+ if (typeof document > "u" || B) return;
308
312
  if (document.querySelector("style[data-liforma-et]")) {
309
- de = !0;
313
+ B = !0;
310
314
  return;
311
315
  }
312
316
  let t = document.createElement("style");
313
- t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), de = !0;
317
+ t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), B = !0;
314
318
  }
315
319
  //#endregion
316
320
  //#region src/widget/styles.ts
@@ -328,15 +332,15 @@ function me(e = fe) {
328
332
  //#endregion
329
333
  //#region src/shims/apiBaseUrl.ts
330
334
  var he = "https://api.liforma.ai", ge = "http://localhost:3001";
331
- function _e() {
335
+ function V() {
332
336
  let e = globalThis.__LIFORMA_API_BASE_URL;
333
337
  if (e?.trim()) return e.trim().replace(/\/$/, "");
334
338
  if (typeof document > "u") return null;
335
339
  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();
336
340
  return t ? t.replace(/\/$/, "") : null;
337
341
  }
338
- function B() {
339
- return _e() || (y() ? ge : he);
342
+ function _e() {
343
+ return V() || (b() ? ge : he);
340
344
  }
341
345
  //#endregion
342
346
  //#region src/v2/api/fetchExperiencePreview.ts
@@ -352,7 +356,7 @@ function ve(e) {
352
356
  async function ye(e, t) {
353
357
  let n = e.trim();
354
358
  if (!n) throw Error("Experience preview requires experienceId.");
355
- let r = (t?.apiBaseUrl ?? B()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
359
+ let r = (t?.apiBaseUrl ?? _e()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
356
360
  method: "GET",
357
361
  headers: { Accept: "application/json" },
358
362
  signal: t?.signal
@@ -382,7 +386,7 @@ async function ye(e, t) {
382
386
  }
383
387
  //#endregion
384
388
  //#region src/v2/errors/LiformaError.ts
385
- var V = class extends Error {
389
+ var H = class extends Error {
386
390
  code;
387
391
  requestId;
388
392
  status;
@@ -400,7 +404,7 @@ function xe(e, t, n) {
400
404
  i = JSON.parse(t);
401
405
  } catch {}
402
406
  let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = be(a) ?? be(i) ?? {};
403
- return new V(u, {
407
+ return new H(u, {
404
408
  code: l,
405
409
  requestId: d,
406
410
  status: e,
@@ -409,37 +413,37 @@ function xe(e, t, n) {
409
413
  }
410
414
  //#endregion
411
415
  //#region src/v2/api/captureAttribution.ts
412
- var Se = 128, H = /[\u0000-\u001f\u007f]/g;
413
- function U(e) {
416
+ var U = 128, Se = /[\u0000-\u001f\u007f]/g;
417
+ function W(e) {
414
418
  if (!e) return;
415
- let t = e.replace(H, "").trim();
416
- if (t) return t.slice(0, Se);
419
+ let t = e.replace(Se, "").trim();
420
+ if (t) return t.slice(0, U);
417
421
  }
418
422
  function Ce(e) {
419
423
  let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
420
424
  return {
421
- ...U(t.get("utm_source")) ? { utmSource: U(t.get("utm_source")) } : {},
422
- ...U(t.get("utm_medium")) ? { utmMedium: U(t.get("utm_medium")) } : {},
423
- ...U(t.get("utm_campaign")) ? { utmCampaign: U(t.get("utm_campaign")) } : {},
424
- ...U(t.get("utm_content")) ? { utmContent: U(t.get("utm_content")) } : {},
425
- ...U(t.get("utm_term")) ? { utmTerm: U(t.get("utm_term")) } : {}
425
+ ...W(t.get("utm_source")) ? { utmSource: W(t.get("utm_source")) } : {},
426
+ ...W(t.get("utm_medium")) ? { utmMedium: W(t.get("utm_medium")) } : {},
427
+ ...W(t.get("utm_campaign")) ? { utmCampaign: W(t.get("utm_campaign")) } : {},
428
+ ...W(t.get("utm_content")) ? { utmContent: W(t.get("utm_content")) } : {},
429
+ ...W(t.get("utm_term")) ? { utmTerm: W(t.get("utm_term")) } : {}
426
430
  };
427
431
  }
428
432
  function we(e) {
429
433
  if (e === !1) return;
430
434
  if (e && typeof e == "object") {
431
435
  let t = {
432
- ...U(e.utmSource) ? { utmSource: U(e.utmSource) } : {},
433
- ...U(e.utmMedium) ? { utmMedium: U(e.utmMedium) } : {},
434
- ...U(e.utmCampaign) ? { utmCampaign: U(e.utmCampaign) } : {},
435
- ...U(e.utmContent) ? { utmContent: U(e.utmContent) } : {},
436
- ...U(e.utmTerm) ? { utmTerm: U(e.utmTerm) } : {},
437
- ...U(e.referrer) ? { referrer: U(e.referrer) } : {}
436
+ ...W(e.utmSource) ? { utmSource: W(e.utmSource) } : {},
437
+ ...W(e.utmMedium) ? { utmMedium: W(e.utmMedium) } : {},
438
+ ...W(e.utmCampaign) ? { utmCampaign: W(e.utmCampaign) } : {},
439
+ ...W(e.utmContent) ? { utmContent: W(e.utmContent) } : {},
440
+ ...W(e.utmTerm) ? { utmTerm: W(e.utmTerm) } : {},
441
+ ...W(e.referrer) ? { referrer: W(e.referrer) } : {}
438
442
  };
439
443
  return Object.keys(t).length ? t : void 0;
440
444
  }
441
445
  if (typeof window > "u") return;
442
- let t = Ce(window.location?.search), n = U(document.referrer || void 0), r = {
446
+ let t = Ce(window.location?.search), n = W(document.referrer || void 0), r = {
443
447
  ...t,
444
448
  ...n ? { referrer: n } : {}
445
449
  };
@@ -496,19 +500,19 @@ function De(e, t) {
496
500
  }
497
501
  //#endregion
498
502
  //#region src/v2/types/sessionLaunch.ts
499
- function W(e, t) {
503
+ function G(e, t) {
500
504
  return t === void 0 ? {} : { [e]: t };
501
505
  }
502
- function G(e) {
506
+ function K(e) {
503
507
  return !!e && typeof e == "object" && !Array.isArray(e);
504
508
  }
505
- function K(e) {
509
+ function q(e) {
506
510
  return typeof e == "boolean";
507
511
  }
508
512
  function Oe(e) {
509
- if (!G(e)) return null;
513
+ if (!K(e)) return null;
510
514
  let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
511
- return !G(t) || !G(n) || !G(r) || !G(i) || !K(t.input) || !K(t.output) || !K(t.externalAudio) || !K(n.managed) || !K(r.enabled) || !K(i.enabled) ? null : {
515
+ return !K(t) || !K(n) || !K(r) || !K(i) || !q(t.input) || !q(t.output) || !q(t.externalAudio) || !q(n.managed) || !q(r.enabled) || !q(i.enabled) ? null : {
512
516
  speech: {
513
517
  input: t.input,
514
518
  output: t.output,
@@ -520,7 +524,7 @@ function Oe(e) {
520
524
  };
521
525
  }
522
526
  function ke(e) {
523
- return !G(e) || !K(e.avatar) || !K(e.speechInput) || !K(e.speechOutput) || !K(e.tools) || !K(e.externalAudio) ? null : {
527
+ return !K(e) || !q(e.avatar) || !q(e.speechInput) || !q(e.speechOutput) || !q(e.tools) || !q(e.externalAudio) ? null : {
524
528
  speech: {
525
529
  input: e.speechInput,
526
530
  output: e.speechOutput,
@@ -531,12 +535,12 @@ function ke(e) {
531
535
  tools: { enabled: e.tools }
532
536
  };
533
537
  }
534
- function Ae(e) {
538
+ function J(e) {
535
539
  return Oe(e) ?? ke(e);
536
540
  }
537
- function q(e) {
538
- if (!G(e)) throw Error("Session Launch response is missing session.");
539
- 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 = Ae(e.capabilities), l = je(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;
541
+ function Ae(e) {
542
+ if (!K(e)) throw Error("Session Launch response is missing session.");
543
+ 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 = J(e.capabilities), l = je(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;
540
544
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
541
545
  return {
542
546
  id: t,
@@ -556,7 +560,7 @@ function je(e) {
556
560
  if (!Array.isArray(e) || e.length === 0) return;
557
561
  let t = [];
558
562
  for (let n of e) {
559
- if (!G(n)) continue;
563
+ if (!K(n)) continue;
560
564
  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() : "";
561
565
  !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
562
566
  axis: e,
@@ -567,103 +571,103 @@ function je(e) {
567
571
  }
568
572
  return t.length > 0 ? t : void 0;
569
573
  }
570
- function J(e) {
574
+ function Me(e) {
571
575
  let t = e.localeVoiceFallbacks;
572
576
  if (t?.length) for (let e of t) {
573
577
  let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
574
578
  console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
575
579
  }
576
580
  }
577
- function Me(e) {
578
- if (!G(e)) throw Error("Session Launch response must be a JSON object.");
581
+ function Ne(e) {
582
+ if (!K(e)) throw Error("Session Launch response must be a JSON object.");
579
583
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
580
584
  if (!t) throw Error("Session Launch response is missing launch.");
581
- let n = q(e.session);
582
- return J(n), {
585
+ let n = Ae(e.session);
586
+ return Me(n), {
583
587
  session: n,
584
588
  launch: t
585
589
  };
586
590
  }
587
591
  //#endregion
588
592
  //#region src/v2/api/mintPublicSession.ts
589
- function Ne() {
593
+ function Pe() {
590
594
  try {
591
595
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
592
596
  } catch {}
593
597
  }
594
- function Pe(e) {
598
+ function Fe(e) {
595
599
  return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
596
600
  }
597
- function Fe(e, t) {
598
- let n = Ne(), r = Pe(t.code), i = t.message.trim(), a = t.details ?? {};
601
+ function Ie(e, t) {
602
+ let n = Pe(), r = Fe(t.code), i = t.message.trim(), a = t.details ?? {};
599
603
  if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
600
604
  if (i.includes(e) && i.includes("allowed origin")) return t;
601
605
  let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
602
- return new V(`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.`, {
606
+ return new H(`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.`, {
603
607
  code: "ORIGIN_NOT_ALLOWED",
604
608
  requestId: t.requestId,
605
609
  status: t.status,
606
610
  details: a
607
611
  });
608
612
  }
609
- return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new V(`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”.`, {
613
+ return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new H(`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”.`, {
610
614
  code: "BROWSER_EMBEDS_DISABLED",
611
615
  requestId: t.requestId,
612
616
  status: t.status,
613
617
  details: a
614
- }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new V(`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.`, {
618
+ }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new H(`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.`, {
615
619
  code: "EXPERIENCE_UNAVAILABLE",
616
620
  requestId: t.requestId,
617
621
  status: t.status,
618
622
  details: a
619
623
  }) : t;
620
624
  }
621
- function Ie(e) {
625
+ function Le(e) {
622
626
  let t = e?.locale?.trim();
623
627
  if (t) return t;
624
628
  let n = e?.language?.trim();
625
629
  if (n) return n;
626
630
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
627
631
  }
628
- function Le(e) {
632
+ function Re(e) {
629
633
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
630
- if (t && n && t !== n) throw new V("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
634
+ if (t && n && t !== n) throw new H("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
631
635
  return t || n || void 0;
632
636
  }
633
- function Re(e, t) {
634
- let n = { experienceId: e }, r = Ie(t);
637
+ function ze(e, t) {
638
+ let n = { experienceId: e }, r = Le(t);
635
639
  r && (n.locale = r);
636
- let i = Le(t);
640
+ let i = Re(t);
637
641
  i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
638
642
  let a = we(t?.attribution);
639
643
  return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
640
644
  }
641
- async function ze(e, t) {
642
- let n = B(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
645
+ async function Be(e, t) {
646
+ let n = _e(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
643
647
  method: "POST",
644
648
  headers: {
645
649
  "Content-Type": "application/json",
646
650
  ...r ? { "Idempotency-Key": r } : {}
647
651
  },
648
- body: JSON.stringify(Re(e, t))
652
+ body: JSON.stringify(ze(e, t))
649
653
  });
650
654
  if (!i.ok) {
651
655
  let t = await i.text();
652
- throw Fe(e, xe(i.status, t, i.headers));
656
+ throw Ie(e, xe(i.status, t, i.headers));
653
657
  }
654
658
  let a;
655
659
  try {
656
660
  a = await i.json();
657
661
  } catch {
658
- throw new V("Browser session mint returned invalid JSON.", {
662
+ throw new H("Browser session mint returned invalid JSON.", {
659
663
  code: "INVALID_RESPONSE",
660
664
  status: i.status,
661
665
  requestId: i.headers.get("Liforma-Request-Id") ?? void 0
662
666
  });
663
667
  }
664
- return Me(a);
668
+ return Ne(a);
665
669
  }
666
- async function Be(e, t) {
670
+ async function Ve(e, t) {
667
671
  let n = De(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
668
672
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
669
673
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
@@ -679,7 +683,7 @@ async function Be(e, t) {
679
683
  let e = await o.text();
680
684
  throw xe(o.status, e, o.headers);
681
685
  }
682
- if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new V("Session endpoint must return a JSON Session Launch response.", {
686
+ if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new H("Session endpoint must return a JSON Session Launch response.", {
683
687
  code: "INVALID_RESPONSE",
684
688
  status: o.status,
685
689
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
@@ -688,20 +692,20 @@ async function Be(e, t) {
688
692
  try {
689
693
  s = await o.json();
690
694
  } catch {
691
- throw new V("Session endpoint returned invalid JSON.", {
695
+ throw new H("Session endpoint returned invalid JSON.", {
692
696
  code: "INVALID_RESPONSE",
693
697
  status: o.status,
694
698
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
695
699
  });
696
700
  }
697
- return Me(s);
701
+ return Ne(s);
698
702
  }
699
703
  //#endregion
700
704
  //#region src/v2/conversationProcessor.ts
701
- function Ve(e) {
705
+ function He(e) {
702
706
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
703
707
  }
704
- function He(e) {
708
+ function Ue(e) {
705
709
  if (typeof e == "string") {
706
710
  let t = e.trim();
707
711
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -715,24 +719,24 @@ function He(e) {
715
719
  ...e.behavior ? { behavior: e.behavior } : {}
716
720
  };
717
721
  }
718
- async function Ue(e, t) {
722
+ async function We(e, t) {
719
723
  let n = await e(t);
720
- return Ve(n) ? {
724
+ return He(n) ? {
721
725
  kind: "stream",
722
726
  stream: n
723
727
  } : {
724
728
  kind: "complete",
725
- speech: He(n)
729
+ speech: Ue(n)
726
730
  };
727
731
  }
728
732
  //#endregion
729
733
  //#region src/v2/embed/playerReachability.ts
730
- var We = "3002";
731
- function Ge(e) {
734
+ var Ge = "3002";
735
+ function Ke(e) {
732
736
  let t = new URL(e);
733
- 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 || We}. 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.`;
737
+ 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 || Ge}. 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.`;
734
738
  }
735
- async function Ke(e, t) {
739
+ async function qe(e, t) {
736
740
  try {
737
741
  await fetch(e, {
738
742
  method: "GET",
@@ -740,25 +744,25 @@ async function Ke(e, t) {
740
744
  signal: AbortSignal.timeout(8e3)
741
745
  });
742
746
  } catch {
743
- throw Error(Ge(t));
747
+ throw Error(Ke(t));
744
748
  }
745
749
  }
746
- function qe(e, t, n, r) {
750
+ function Je(e, t, n, r) {
747
751
  try {
748
752
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
749
753
  } catch (e) {
750
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ge(n), { cause: e }) : e;
754
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ke(n), { cause: e }) : e;
751
755
  }
752
756
  }
753
- var Je = new Set([1, 2]);
754
- function Ye(e) {
755
- return typeof e == "number" && Je.has(e);
757
+ var Ye = new Set([1, 2]);
758
+ function Xe(e) {
759
+ return typeof e == "number" && Ye.has(e);
756
760
  }
757
- var Xe = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
758
- function Ze(e) {
761
+ var Ze = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
762
+ function Qe(e) {
759
763
  if (!e || typeof e != "object") return null;
760
764
  let t = e;
761
- if (!Ye(t.schemaVersion) || !t.type || !Xe.has(t.type)) return null;
765
+ if (!Xe(t.schemaVersion) || !t.type || !Ze.has(t.type)) return null;
762
766
  if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
763
767
  if (t.type === "fullWindow" || t.type === "theatre") {
764
768
  let e = t.payload;
@@ -781,10 +785,10 @@ function Ze(e) {
781
785
  let n = t.payload;
782
786
  return !n || typeof n != "object" ? null : t;
783
787
  }
784
- function Qe(e, t) {
788
+ function $e(e, t) {
785
789
  return t === void 0 ? {} : { [e]: t };
786
790
  }
787
- function $e(e, t, n) {
791
+ function et(e, t, n) {
788
792
  let r = e.trim();
789
793
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
790
794
  let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatre;
@@ -798,34 +802,34 @@ function $e(e, t, n) {
798
802
  ...a ? { theme: a } : {},
799
803
  ...o === void 0 ? {} : { showFeedback: o },
800
804
  ...s ? { interaction: s } : {},
801
- ...Qe("settingsButton", n?.settingsButton),
802
- ...Qe("theatreButton", n?.theatreButton),
803
- ...Qe("fullscreenButton", n?.fullscreenButton),
805
+ ...$e("settingsButton", n?.settingsButton),
806
+ ...$e("theatreButton", n?.theatreButton),
807
+ ...$e("fullscreenButton", n?.fullscreenButton),
804
808
  ...c === void 0 ? {} : { theatre: c }
805
809
  }
806
810
  };
807
811
  }
808
- function et() {
812
+ function tt() {
809
813
  return {
810
814
  type: "parentHello",
811
815
  schemaVersion: 2
812
816
  };
813
817
  }
814
- function tt(e) {
818
+ function nt(e) {
815
819
  return {
816
820
  type: "widgetSetChrome",
817
821
  schemaVersion: 2,
818
822
  payload: { mode: e }
819
823
  };
820
824
  }
821
- function nt() {
825
+ function rt() {
822
826
  return {
823
827
  type: "widgetToggleAudioSettings",
824
828
  schemaVersion: 2,
825
829
  payload: {}
826
830
  };
827
831
  }
828
- function rt(e) {
832
+ function it(e) {
829
833
  return {
830
834
  type: "setTheatre",
831
835
  schemaVersion: 2,
@@ -834,8 +838,8 @@ function rt(e) {
834
838
  }
835
839
  //#endregion
836
840
  //#region src/v2/embed/fullWindowHost.ts
837
- var it = "2147483000";
838
- function at(e) {
841
+ var at = "2147483000";
842
+ function ot(e) {
839
843
  let { style: t } = e;
840
844
  return {
841
845
  position: t.position,
@@ -853,11 +857,11 @@ function at(e) {
853
857
  maxHeight: t.maxHeight
854
858
  };
855
859
  }
856
- function ot(e) {
860
+ function st(e) {
857
861
  let { style: t } = e;
858
- t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = it, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
862
+ t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = at, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
859
863
  }
860
- function st(e, t) {
864
+ function ct(e, t) {
861
865
  if (delete e.dataset.liformaFullWindow, !t) {
862
866
  e.style.position = "", e.style.top = "", e.style.right = "", e.style.bottom = "", e.style.left = "", e.style.inset = "", e.style.width = "", e.style.height = "", e.style.zIndex = "", e.style.margin = "", e.style.borderRadius = "", e.style.maxWidth = "", e.style.maxHeight = "";
863
867
  return;
@@ -867,20 +871,20 @@ function st(e, t) {
867
871
  }
868
872
  //#endregion
869
873
  //#region src/v2/embed/iframeHost.ts
870
- function ct(e) {
874
+ function lt(e) {
871
875
  return e;
872
876
  }
873
877
  function Y() {
874
878
  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)}`;
875
879
  }
876
- var lt = 3e4;
877
- function ut(e) {
880
+ var ut = 3e4;
881
+ function dt(e) {
878
882
  let t = e.container;
879
883
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
880
884
  let n = document.createElement("iframe");
881
885
  n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true"), n.setAttribute("fetchpriority", "high"), "fetchPriority" in n && (n.fetchPriority = "high");
882
886
  let r = !1, i = !1, a = null, o = null, s = (r) => {
883
- i !== r && (i = r, r ? (a = at(n), o = document.body.style.overflow, document.body.append(n), ot(n), document.body.style.overflow = "hidden") : (t.append(n), st(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
887
+ i !== r && (i = r, r ? (a = ot(n), o = document.body.style.overflow, document.body.append(n), st(n), document.body.style.overflow = "hidden") : (t.append(n), ct(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
884
888
  }, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
885
889
  p = e, m = t;
886
890
  }), g = () => {
@@ -891,10 +895,10 @@ function ut(e) {
891
895
  let i = Date.now();
892
896
  if (d > 0 && i - d < 250) return;
893
897
  d = i, g();
894
- let a = $e(t.launch, t.session, t.chrome), o = () => {
898
+ let a = et(t.launch, t.session, t.chrome), o = () => {
895
899
  if (r) return;
896
900
  let t = n.contentWindow;
897
- t && qe(t, a, e.playerOrigin);
901
+ t && Je(t, a, e.playerOrigin);
898
902
  };
899
903
  o();
900
904
  for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
@@ -902,17 +906,17 @@ function ut(e) {
902
906
  r || !l || _(l);
903
907
  }, y = () => {
904
908
  if (u += 1, u === 1) {
905
- Ke(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
909
+ qe(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
906
910
  return;
907
911
  }
908
912
  d = 0, v();
909
913
  }, b = () => {
910
- u > 0 || m?.(Error(Ge(e.playerOrigin)));
914
+ u > 0 || m?.(Error(Ke(e.playerOrigin)));
911
915
  };
912
916
  n.addEventListener("load", y), n.addEventListener("error", b);
913
917
  let x = (t) => {
914
918
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
915
- let i = Ze(t.data);
919
+ let i = Qe(t.data);
916
920
  if (i) switch (i.type) {
917
921
  case "close":
918
922
  e.onClose?.(i.payload);
@@ -951,7 +955,7 @@ function ut(e) {
951
955
  e.onUserSpeechEnded?.(i.payload);
952
956
  break;
953
957
  case "modeChange":
954
- e.onActivityChange?.(ct(i.payload.mode));
958
+ e.onActivityChange?.(lt(i.payload.mode));
955
959
  break;
956
960
  case "activityChange":
957
961
  e.onActivityChange?.(i.payload.activity);
@@ -1010,8 +1014,8 @@ function ut(e) {
1010
1014
  let S = (t, i) => {
1011
1015
  if (r) return;
1012
1016
  let a = n.contentWindow;
1013
- if (!a) throw Error(Ge(e.playerOrigin));
1014
- qe(a, t, e.playerOrigin, i);
1017
+ if (!a) throw Error(Ke(e.playerOrigin));
1018
+ Je(a, t, e.playerOrigin, i);
1015
1019
  }, C = (e, t = 12e4, n) => {
1016
1020
  let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Y();
1017
1021
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
@@ -1028,7 +1032,7 @@ function ut(e) {
1028
1032
  return h;
1029
1033
  },
1030
1034
  postParentHello() {
1031
- S(et());
1035
+ S(tt());
1032
1036
  },
1033
1037
  postLaunch(e, t, n) {
1034
1038
  r || (l = {
@@ -1050,13 +1054,13 @@ function ut(e) {
1050
1054
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1051
1055
  },
1052
1056
  postWidgetSetChrome(e) {
1053
- S(tt(e));
1057
+ S(nt(e));
1054
1058
  },
1055
1059
  postWidgetToggleAudioSettings() {
1056
- S(nt());
1060
+ S(rt());
1057
1061
  },
1058
1062
  postSetTheatre(e) {
1059
- S(rt(e));
1063
+ S(it(e));
1060
1064
  },
1061
1065
  speak(e) {
1062
1066
  return C({
@@ -1178,7 +1182,7 @@ function ut(e) {
1178
1182
  audio: e.audio,
1179
1183
  byteLength: e.byteLength
1180
1184
  }
1181
- }, lt, [e.audio]);
1185
+ }, ut, [e.audio]);
1182
1186
  },
1183
1187
  speechUtteranceSetTranscript(e) {
1184
1188
  return C({
@@ -1340,7 +1344,7 @@ function ut(e) {
1340
1344
  }
1341
1345
  //#endregion
1342
1346
  //#region src/v2/embed/readyGate.ts
1343
- function dt(e) {
1347
+ function ft(e) {
1344
1348
  let t, n = !1, r = !1, i = () => {
1345
1349
  r || !n || t === void 0 || (r = !0, e(t));
1346
1350
  };
@@ -1355,9 +1359,9 @@ function dt(e) {
1355
1359
  }
1356
1360
  //#endregion
1357
1361
  //#region src/v2/sdkRelease.ts
1358
- var ft = `sdk@${{
1362
+ var pt = `sdk@${{
1359
1363
  name: "@liforma/client",
1360
- version: "0.4.15",
1364
+ version: "0.4.16",
1361
1365
  type: "module",
1362
1366
  description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
1363
1367
  license: "MIT",
@@ -1579,54 +1583,54 @@ var ft = `sdk@${{
1579
1583
  vitest: "^4.1.10",
1580
1584
  wrangler: "^4.101.0"
1581
1585
  }
1582
- }.version}`, pt = "https://player.liforma.ai/embed", mt = "http://localhost:3002/embed";
1583
- function ht() {
1586
+ }.version}`, mt = "https://player.liforma.ai/embed", ht = "http://localhost:3002/embed";
1587
+ function gt() {
1584
1588
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1585
1589
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1586
1590
  if (typeof document > "u") return null;
1587
1591
  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();
1588
1592
  return t ? t.replace(/\/$/, "") : null;
1589
1593
  }
1590
- function gt() {
1591
- let e = ht();
1592
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : y() ? mt : pt;
1594
+ function _t() {
1595
+ let e = gt();
1596
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : b() ? ht : mt;
1593
1597
  }
1594
- function _t(e, t) {
1598
+ function vt(e, t) {
1595
1599
  return e?.trim() || t?.trim() || void 0;
1596
1600
  }
1597
- function vt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1598
- let p = (e ?? gt()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
1601
+ function yt(e, t, n, r, i, a, o, s, c, l, u, d, f) {
1602
+ let p = (e ?? _t()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
1599
1603
  g && h.searchParams.set("backdropId", g);
1600
1604
  let _ = r?.trim();
1601
1605
  _ && h.searchParams.set("avatarId", _);
1602
1606
  let v = d?.trim();
1603
1607
  v && h.searchParams.set("previewBg", v);
1604
1608
  let y = f?.trim();
1605
- return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), yt(h.toString());
1609
+ return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), bt(h.toString());
1606
1610
  }
1607
- function yt(e) {
1611
+ function bt(e) {
1608
1612
  if (typeof location > "u") return e;
1609
1613
  let t = new URL(e);
1610
1614
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1611
1615
  }
1612
- function bt(e) {
1616
+ function xt(e) {
1613
1617
  return new URL(e).origin;
1614
1618
  }
1615
1619
  //#endregion
1616
1620
  //#region src/v2/experienceEvents.ts
1617
- function xt() {
1621
+ function St() {
1618
1622
  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)}`;
1619
1623
  }
1620
- function St(e, t, n) {
1624
+ function Ct(e, t, n) {
1621
1625
  return {
1622
- id: xt(),
1626
+ id: St(),
1623
1627
  type: e,
1624
1628
  sessionId: t,
1625
1629
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1626
1630
  data: n
1627
1631
  };
1628
1632
  }
1629
- function Ct() {
1633
+ function wt() {
1630
1634
  return {
1631
1635
  ready: /* @__PURE__ */ new Set(),
1632
1636
  started: /* @__PURE__ */ new Set(),
@@ -1647,32 +1651,32 @@ function Ct() {
1647
1651
  conversationProcessorError: /* @__PURE__ */ new Set()
1648
1652
  };
1649
1653
  }
1650
- function wt(e, t, n) {
1654
+ function Tt(e, t, n) {
1651
1655
  return e[t].add(n), () => e[t].delete(n);
1652
1656
  }
1653
- function Tt(e, t, n) {
1657
+ function Et(e, t, n) {
1654
1658
  for (let r of e[t]) r(n);
1655
1659
  }
1656
- function Et(e) {
1660
+ function Dt(e) {
1657
1661
  for (let t of Object.keys(e)) e[t].clear();
1658
1662
  }
1659
1663
  //#endregion
1660
1664
  //#region src/v2/speech/types.ts
1661
- function Dt(e) {
1665
+ function Ot(e) {
1662
1666
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1663
1667
  }
1664
- function Ot(e) {
1668
+ function kt(e) {
1665
1669
  return "url" in e && typeof e.url == "string";
1666
1670
  }
1667
- function kt(e) {
1671
+ function At(e) {
1668
1672
  if (!("track" in e)) return !1;
1669
1673
  let t = e.track;
1670
1674
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1671
1675
  }
1672
- function At(e) {
1673
- return !Dt(e) && !Ot(e) && !kt(e) && "encoding" in e && typeof e.encoding == "string";
1676
+ function jt(e) {
1677
+ return !Ot(e) && !kt(e) && !At(e) && "encoding" in e && typeof e.encoding == "string";
1674
1678
  }
1675
- var jt = [
1679
+ var Mt = [
1676
1680
  8e3,
1677
1681
  16e3,
1678
1682
  22050,
@@ -1690,14 +1694,14 @@ var jt = [
1690
1694
  MAX_UTTERANCE_DURATION_MS: 9e4,
1691
1695
  MAX_PENDING_WRITES: 8,
1692
1696
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1693
- }, Mt = class extends Error {
1697
+ }, Nt = class extends Error {
1694
1698
  operation;
1695
1699
  requiredCapability;
1696
1700
  name = "UnsupportedSpeechOperationError";
1697
1701
  constructor(e, t) {
1698
1702
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1699
1703
  }
1700
- }, Nt = class extends Error {
1704
+ }, Pt = class extends Error {
1701
1705
  name = "SpeechUtteranceClosedError";
1702
1706
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1703
1707
  super(e);
@@ -1707,72 +1711,72 @@ var jt = [
1707
1711
  constructor(e, t) {
1708
1712
  super(e, t);
1709
1713
  }
1710
- }, Pt = class extends Error {
1714
+ }, Ft = class extends Error {
1711
1715
  name = "SpeechBufferTimeoutError";
1712
1716
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1713
1717
  super(e);
1714
1718
  }
1715
1719
  };
1716
- function Ft(e = "none") {
1720
+ function It(e = "none") {
1717
1721
  return {
1718
1722
  mode: e,
1719
1723
  trackedDurationMs: 0,
1720
1724
  fallbackDurationMs: 0
1721
1725
  };
1722
1726
  }
1723
- function It(e) {
1724
- return jt.includes(e);
1725
- }
1726
1727
  function Lt(e) {
1728
+ return Mt.includes(e);
1729
+ }
1730
+ function Rt(e) {
1727
1731
  if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
1728
1732
  if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
1729
- if (!It(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1733
+ if (!Lt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1730
1734
  }
1731
- function Rt(e) {
1732
- if (Dt(e)) {
1733
- Lt(e.format);
1735
+ function zt(e) {
1736
+ if (Ot(e)) {
1737
+ Rt(e.format);
1734
1738
  return;
1735
1739
  }
1736
- if (Ot(e)) {
1740
+ if (kt(e)) {
1737
1741
  if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
1738
- if (e.sampleRate !== void 0 && !It(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1742
+ if (e.sampleRate !== void 0 && !Lt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1739
1743
  return;
1740
1744
  }
1741
- if (kt(e)) {
1745
+ if (At(e)) {
1742
1746
  if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
1743
- if (e.sampleRate !== void 0 && !It(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1747
+ if (e.sampleRate !== void 0 && !Lt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1744
1748
  return;
1745
1749
  }
1746
- if (At(e)) {
1750
+ if (jt(e)) {
1747
1751
  let t = e.encoding.trim().toLowerCase();
1748
1752
  if (!t) throw new Z("Encoded audio MIME type is required.");
1749
1753
  if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1750
- if (e.sampleRate !== void 0 && !It(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1754
+ if (e.sampleRate !== void 0 && !Lt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
1751
1755
  return;
1752
1756
  }
1753
1757
  throw new Z("Unsupported speech.play audio shape.");
1754
1758
  }
1755
- function zt(e) {
1756
- if (e.format) return Lt(e.format), e.format;
1759
+ function Bt(e) {
1760
+ if (e.format) return Rt(e.format), e.format;
1757
1761
  if (e.track) {
1758
1762
  let t = {
1759
1763
  encoding: "pcm_s16le",
1760
1764
  sampleRate: e.sampleRate ?? 24e3,
1761
1765
  channels: 1
1762
1766
  };
1763
- return Lt(t), t;
1767
+ return Rt(t), t;
1764
1768
  }
1765
1769
  throw new Z("createUtterance requires format or track.");
1766
1770
  }
1767
- function Bt(e) {
1771
+ function Vt(e) {
1768
1772
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1769
1773
  }
1770
- function Vt(e) {
1774
+ function Ht(e) {
1771
1775
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1772
1776
  }
1773
1777
  //#endregion
1774
1778
  //#region src/byo/pcm.ts
1775
- function Ht(e) {
1779
+ function Ut(e) {
1776
1780
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1777
1781
  for (let t = 0; t < e.length; t++) {
1778
1782
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1782,11 +1786,11 @@ function Ht(e) {
1782
1786
  }
1783
1787
  //#endregion
1784
1788
  //#region src/byo/resample.ts
1785
- function Ut(e, t, n, r, i) {
1789
+ function Wt(e, t, n, r, i) {
1786
1790
  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;
1787
1791
  return ((a * i + o) * i + s) * i + c;
1788
1792
  }
1789
- function Wt(e, t) {
1793
+ function Gt(e, t) {
1790
1794
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1791
1795
  if (e === t) return {
1792
1796
  fromRate: e,
@@ -1809,7 +1813,7 @@ function Wt(e, t) {
1809
1813
  let a = [];
1810
1814
  for (; i + 2 < r.length - 1;) {
1811
1815
  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);
1812
- a.push(Ut(r[o], r[e], r[s], r[c], t)), i += n;
1816
+ a.push(Wt(r[o], r[e], r[s], r[c], t)), i += n;
1813
1817
  }
1814
1818
  let o = Math.max(0, Math.floor(i) - 1);
1815
1819
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1821,7 +1825,7 @@ function Wt(e, t) {
1821
1825
  }
1822
1826
  //#endregion
1823
1827
  //#region src/byo/audioCapture.ts
1824
- var Gt = "liforma-pcm-capture", Kt = `
1828
+ var Kt = "liforma-pcm-capture", qt = `
1825
1829
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1826
1830
  process(inputs) {
1827
1831
  const ch = inputs[0] && inputs[0][0];
@@ -1833,29 +1837,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1833
1837
  return true;
1834
1838
  }
1835
1839
  }
1836
- registerProcessor('${Gt}', LiformaPcmCaptureProcessor);
1837
- `, qt = null;
1838
- function Jt() {
1839
- return qt ||= URL.createObjectURL(new Blob([Kt], { type: "application/javascript" })), qt;
1840
- }
1840
+ registerProcessor('${Kt}', LiformaPcmCaptureProcessor);
1841
+ `, Jt = null;
1841
1842
  function Yt() {
1843
+ return Jt ||= URL.createObjectURL(new Blob([qt], { type: "application/javascript" })), Jt;
1844
+ }
1845
+ function Xt() {
1842
1846
  return window.AudioContext || window.webkitAudioContext || null;
1843
1847
  }
1844
- async function Xt(e) {
1845
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Yt();
1848
+ async function Zt(e) {
1849
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Xt();
1846
1850
  if (!o) throw Error("Web Audio is required for audio capture");
1847
1851
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1848
1852
  l.gain.value = 0;
1849
- let u = s.sampleRate, d = Wt(u, n), f = !1, p = !1, m = (e) => {
1853
+ let u = s.sampleRate, d = Gt(u, n), f = !1, p = !1, m = (e) => {
1850
1854
  if (f || i && !i()) return;
1851
1855
  let t = d.push(e);
1852
- t.length !== 0 && r(Ht(t));
1856
+ t.length !== 0 && r(Ut(t));
1853
1857
  }, h = () => void 0;
1854
1858
  return await (async () => {
1855
1859
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1856
1860
  try {
1857
- await s.audioWorklet.addModule(Jt());
1858
- let e = new AudioWorkletNode(s, Gt, {
1861
+ await s.audioWorklet.addModule(Yt());
1862
+ let e = new AudioWorkletNode(s, Kt, {
1859
1863
  numberOfInputs: 1,
1860
1864
  numberOfOutputs: 1,
1861
1865
  outputChannelCount: [1]
@@ -1905,7 +1909,7 @@ async function Xt(e) {
1905
1909
  }
1906
1910
  //#endregion
1907
1911
  //#region src/v2/speech/captureMediaStreamTrack.ts
1908
- async function Zt(e) {
1912
+ async function Qt(e) {
1909
1913
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1910
1914
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
1911
1915
  if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
@@ -1914,13 +1918,13 @@ async function Zt(e) {
1914
1918
  s || (s = !0, c?.stop(), c = null);
1915
1919
  };
1916
1920
  try {
1917
- c = await Xt({
1921
+ c = await Zt({
1918
1922
  mediaStream: a,
1919
1923
  targetSampleRate: r,
1920
1924
  shouldSend: () => !s && !i?.aborted,
1921
1925
  onPcm: (e) => {
1922
1926
  if (s || i?.aborted) return;
1923
- let t = Bt(e);
1927
+ let t = Vt(e);
1924
1928
  o = o.then(async () => {
1925
1929
  if (s || i?.aborted) return;
1926
1930
  let e = 0;
@@ -1949,10 +1953,10 @@ async function Zt(e) {
1949
1953
  }
1950
1954
  //#endregion
1951
1955
  //#region src/v2/speech/speechController.ts
1952
- async function Qt(e, t) {
1953
- if (kt(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
1954
- if (Dt(e)) {
1955
- let t = Bt(e.data);
1956
+ async function $t(e, t) {
1957
+ if (At(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
1958
+ if (Ot(e)) {
1959
+ let t = Vt(e.data);
1956
1960
  if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
1957
1961
  return {
1958
1962
  kind: "pcm",
@@ -1960,17 +1964,17 @@ async function Qt(e, t) {
1960
1964
  format: e.format
1961
1965
  };
1962
1966
  }
1963
- if (Ot(e)) return {
1967
+ if (kt(e)) return {
1964
1968
  kind: "url",
1965
1969
  url: e.url.trim(),
1966
1970
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1967
1971
  };
1968
- if (!At(e)) throw new Z("Unsupported speech.play audio shape.");
1972
+ if (!jt(e)) throw new Z("Unsupported speech.play audio shape.");
1969
1973
  let n;
1970
1974
  if (typeof Blob < "u" && e.data instanceof Blob) {
1971
1975
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1972
1976
  n = new Uint8Array(await e.data.arrayBuffer());
1973
- } else n = Bt(e.data);
1977
+ } else n = Vt(e.data);
1974
1978
  return {
1975
1979
  kind: "encoded",
1976
1980
  data: n.slice().buffer,
@@ -1978,10 +1982,10 @@ async function Qt(e, t) {
1978
1982
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1979
1983
  };
1980
1984
  }
1981
- function $t() {
1985
+ function en() {
1982
1986
  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)}`;
1983
1987
  }
1984
- function en(e, t = "completed") {
1988
+ function tn(e, t = "completed") {
1985
1989
  return {
1986
1990
  utteranceId: e.speechId,
1987
1991
  characterId: e.characterId,
@@ -1995,13 +1999,13 @@ function en(e, t = "completed") {
1995
1999
  }
1996
2000
  };
1997
2001
  }
1998
- function tn(e) {
2002
+ function nn(e) {
1999
2003
  return e instanceof Error ? e : new Z(String(e));
2000
2004
  }
2001
- function nn(e) {
2005
+ function rn(e) {
2002
2006
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
2003
2007
  }
2004
- var rn = class {
2008
+ var an = class {
2005
2009
  id;
2006
2010
  characterId;
2007
2011
  result;
@@ -2030,14 +2034,14 @@ var rn = class {
2030
2034
  queue: e.queue,
2031
2035
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
2032
2036
  }).catch((e) => {
2033
- throw this.fail(tn(e)), tn(e);
2037
+ throw this.fail(nn(e)), nn(e);
2034
2038
  }), this.signal?.addEventListener("abort", () => {
2035
2039
  this.cancel();
2036
2040
  }, { once: !0 });
2037
2041
  }
2038
2042
  async write(e, t) {
2039
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Nt();
2040
- let n = Bt(e);
2043
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Pt();
2044
+ let n = Vt(e);
2041
2045
  if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
2042
2046
  if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
2043
2047
  if (n.byteLength === 0) return;
@@ -2046,13 +2050,13 @@ var rn = class {
2046
2050
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
2047
2051
  if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2048
2052
  let a = async () => {
2049
- if (this.closed || this.settled) throw new Nt();
2053
+ if (this.closed || this.settled) throw new Pt();
2050
2054
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
2051
2055
  utteranceId: this.id,
2052
2056
  audio: t.buffer,
2053
2057
  byteLength: t.byteLength
2054
2058
  }), a = await Promise.race([i, new Promise((e, t) => {
2055
- setTimeout(() => t(new Pt()), r);
2059
+ setTimeout(() => t(new Ft()), r);
2056
2060
  })]);
2057
2061
  this.bufferedMs = Math.max(0, a.bufferedMs);
2058
2062
  }, o = this.writeChain.then(a, a);
@@ -2064,7 +2068,7 @@ var rn = class {
2064
2068
  }
2065
2069
  }
2066
2070
  async setTranscript(e) {
2067
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Nt();
2071
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Pt();
2068
2072
  await this.requireHost().speechUtteranceSetTranscript({
2069
2073
  utteranceId: this.id,
2070
2074
  transcript: e
@@ -2081,7 +2085,7 @@ var rn = class {
2081
2085
  });
2082
2086
  return this.resolve(t), t;
2083
2087
  } catch (e) {
2084
- let t = tn(e);
2088
+ let t = nn(e);
2085
2089
  throw this.fail(t), t;
2086
2090
  }
2087
2091
  }
@@ -2099,11 +2103,11 @@ var rn = class {
2099
2103
  characterId: this.characterId,
2100
2104
  status: "cancelled",
2101
2105
  durationMs: 0,
2102
- animation: Ft("none")
2106
+ animation: It("none")
2103
2107
  };
2104
2108
  return this.resolve(t), t;
2105
2109
  } catch (e) {
2106
- let t = tn(e);
2110
+ let t = nn(e);
2107
2111
  throw this.fail(t), t;
2108
2112
  }
2109
2113
  }
@@ -2116,7 +2120,7 @@ var rn = class {
2116
2120
  return e;
2117
2121
  }
2118
2122
  resolve(e) {
2119
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Nt()));
2123
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Pt()));
2120
2124
  }
2121
2125
  fail(e) {
2122
2126
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
@@ -2128,7 +2132,7 @@ var rn = class {
2128
2132
  }
2129
2133
  await new Promise((t, n) => {
2130
2134
  let r = setTimeout(() => {
2131
- n(new Pt());
2135
+ n(new Ft());
2132
2136
  }, e);
2133
2137
  this.pendingWriteWaiters.push({
2134
2138
  resolve: () => {
@@ -2147,13 +2151,13 @@ var rn = class {
2147
2151
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2148
2152
  }
2149
2153
  };
2150
- function an(e) {
2154
+ function on(e) {
2151
2155
  let t = null, n = (t, n) => {
2152
- if (!e.getCapabilities()[n]) throw new Mt(t, n);
2156
+ if (!e.getCapabilities()[n]) throw new Nt(t, n);
2153
2157
  }, r = {
2154
2158
  async speak(r) {
2155
2159
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2156
- let i = Vt(r.queue ?? "append");
2160
+ let i = Ht(r.queue ?? "append");
2157
2161
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2158
2162
  let a = e.getIframeHost();
2159
2163
  if (!a) throw new Z("Speech session is not attached.");
@@ -2173,41 +2177,41 @@ function an(e) {
2173
2177
  return;
2174
2178
  }
2175
2179
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2176
- t.removeEventListener("abort", s), n(en(e, "completed"));
2180
+ t.removeEventListener("abort", s), n(tn(e, "completed"));
2177
2181
  }, (a) => {
2178
- if (t.removeEventListener("abort", s), nn(a)) {
2182
+ if (t.removeEventListener("abort", s), rn(a)) {
2179
2183
  n({
2180
2184
  utteranceId: "utt_interrupted",
2181
2185
  characterId: r.characterId ?? e.getActiveCharacterId(),
2182
2186
  status: "interrupted",
2183
2187
  durationMs: 0,
2184
2188
  transcript: r.text,
2185
- animation: Ft("none")
2189
+ animation: It("none")
2186
2190
  });
2187
2191
  return;
2188
2192
  }
2189
- i(tn(a));
2193
+ i(nn(a));
2190
2194
  });
2191
2195
  });
2192
2196
  }
2193
2197
  try {
2194
- return en(await o, "completed");
2198
+ return tn(await o, "completed");
2195
2199
  } catch (t) {
2196
- if (nn(t)) return {
2200
+ if (rn(t)) return {
2197
2201
  utteranceId: "utt_interrupted",
2198
2202
  characterId: r.characterId ?? e.getActiveCharacterId(),
2199
2203
  status: "interrupted",
2200
2204
  durationMs: 0,
2201
2205
  transcript: r.text,
2202
- animation: Ft("none")
2206
+ animation: It("none")
2203
2207
  };
2204
- throw tn(t);
2208
+ throw nn(t);
2205
2209
  }
2206
2210
  },
2207
2211
  async play(i) {
2208
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Rt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2212
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), zt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2209
2213
  let a = i.queue ?? "append";
2210
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), kt(i.audio)) {
2214
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), At(i.audio)) {
2211
2215
  let e = i.audio.sampleRate ?? 24e3;
2212
2216
  return r.createUtterance({
2213
2217
  format: {
@@ -2223,7 +2227,7 @@ function an(e) {
2223
2227
  }
2224
2228
  let o = e.getIframeHost();
2225
2229
  if (!o) throw new Z("Speech session is not attached.");
2226
- let s = await Qt(i.audio, i.signal);
2230
+ let s = await $t(i.audio, i.signal);
2227
2231
  return o.speechPlay({
2228
2232
  source: s,
2229
2233
  characterId: i.characterId,
@@ -2235,13 +2239,13 @@ function an(e) {
2235
2239
  },
2236
2240
  createUtterance(r) {
2237
2241
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2238
- let i = zt(r);
2242
+ let i = Bt(r);
2239
2243
  if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
2240
2244
  let a = r.queue ?? "replace-active";
2241
2245
  if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
2242
2246
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2243
- let o = new rn({
2244
- id: $t(),
2247
+ let o = new an({
2248
+ id: en(),
2245
2249
  characterId: r.characterId ?? e.getActiveCharacterId(),
2246
2250
  format: i,
2247
2251
  queue: a,
@@ -2253,7 +2257,7 @@ function an(e) {
2253
2257
  t === o && (t = null);
2254
2258
  }), r.track && (async () => {
2255
2259
  try {
2256
- if (await Zt({
2260
+ if (await Qt({
2257
2261
  track: r.track,
2258
2262
  utterance: o,
2259
2263
  sampleRate: i.sampleRate,
@@ -2281,16 +2285,16 @@ function an(e) {
2281
2285
  }
2282
2286
  //#endregion
2283
2287
  //#region src/v2/types/sessionInteraction.ts
2284
- function on(e) {
2288
+ function sn(e) {
2285
2289
  let t = e?.trim();
2286
2290
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2287
2291
  }
2288
2292
  //#endregion
2289
2293
  //#region src/v2/experience.ts
2290
- function sn(e) {
2294
+ function cn(e) {
2291
2295
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2292
2296
  }
2293
- var cn = class e {
2297
+ var ln = class e {
2294
2298
  bootstrap;
2295
2299
  conversationProcessor;
2296
2300
  iframeHost = null;
@@ -2310,17 +2314,17 @@ var cn = class e {
2310
2314
  pendingTheatre = null;
2311
2315
  lastInteraction = null;
2312
2316
  closeHandlers = [];
2313
- eventRegistry = Ct();
2317
+ eventRegistry = wt();
2314
2318
  readyEnvelope = null;
2315
2319
  startedEnvelope = null;
2316
2320
  sessionMintedEnvelope = null;
2317
2321
  conversationCache = [];
2318
2322
  speech;
2319
2323
  constructor(e) {
2320
- this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = an({
2324
+ 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 = on({
2321
2325
  getIframeHost: () => this.iframeHost,
2322
2326
  assertSessionStarted: () => this.assertSessionStarted(),
2323
- getCapabilities: () => ln(this.resolvedSession),
2327
+ getCapabilities: () => un(this.resolvedSession),
2324
2328
  getActiveCharacterId: () => "character_unknown",
2325
2329
  onProcessorInterrupt: () => {
2326
2330
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2409,7 +2413,7 @@ var cn = class e {
2409
2413
  return null;
2410
2414
  }
2411
2415
  on(e, t) {
2412
- let n = wt(this.eventRegistry, e, t);
2416
+ let n = Tt(this.eventRegistry, e, t);
2413
2417
  return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
2414
2418
  }
2415
2419
  async attach(e) {
@@ -2423,13 +2427,13 @@ var cn = class e {
2423
2427
  if (this.closed) throw Error("Session has ended.");
2424
2428
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2425
2429
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2426
- let t = this.bootstrap.embedBaseUrl ?? gt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = vt(t, n, r ? void 0 : _t(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, sn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = bt(i), o = null, s = new Promise((e) => {
2430
+ let t = this.bootstrap.embedBaseUrl ?? _t(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = yt(t, n, r ? void 0 : vt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, cn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = xt(i), o = null, s = new Promise((e) => {
2427
2431
  o = e;
2428
2432
  }), c = null, l = new Promise((e) => {
2429
2433
  c = e;
2430
- }), u = dt((e) => {
2434
+ }), u = ft((e) => {
2431
2435
  this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2432
- }), d = this.bootstrap.onUserTranscript, f = ut({
2436
+ }), d = this.bootstrap.onUserTranscript, f = dt({
2433
2437
  container: e.container,
2434
2438
  src: i,
2435
2439
  playerOrigin: a,
@@ -2496,7 +2500,7 @@ var cn = class e {
2496
2500
  onTheatreChange: (t) => e.onTheatreChange?.(t)
2497
2501
  });
2498
2502
  this.iframeHost = f;
2499
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Be(this.bootstrap.sessionEndpoint, {
2503
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Ve(this.bootstrap.sessionEndpoint, {
2500
2504
  experienceId: this.bootstrap.experienceId,
2501
2505
  locale: this.bootstrap.locale,
2502
2506
  secondaryLocale: this.bootstrap.secondaryLocale,
@@ -2508,7 +2512,7 @@ var cn = class e {
2508
2512
  attribution: this.bootstrap.attribution,
2509
2513
  alreadyConverted: this.bootstrap.alreadyConverted,
2510
2514
  signal: this.endpointAbortController.signal
2511
- })) : this.bootstrap.kind === "public" ? ze(this.bootstrap.experienceId, {
2515
+ })) : this.bootstrap.kind === "public" ? Be(this.bootstrap.experienceId, {
2512
2516
  locale: this.bootstrap.locale,
2513
2517
  secondaryLocale: this.bootstrap.secondaryLocale,
2514
2518
  learningLocale: this.bootstrap.learningLocale,
@@ -2532,7 +2536,7 @@ var cn = class e {
2532
2536
  operation: "attach",
2533
2537
  message: e instanceof Error ? e.message : String(e),
2534
2538
  stack: e instanceof Error ? e.stack : void 0,
2535
- release: ft
2539
+ release: pt
2536
2540
  });
2537
2541
  } catch {}
2538
2542
  throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
@@ -2544,23 +2548,23 @@ var cn = class e {
2544
2548
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2545
2549
  this.launchToken = g;
2546
2550
  let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2547
- return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && J(_), f.postLaunch(g, _, {
2551
+ return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Me(_), f.postLaunch(g, _, {
2548
2552
  startButton: e.startButton,
2549
2553
  theme: e.theme,
2550
2554
  showFeedback: e.showFeedback,
2551
2555
  interaction: e.interaction,
2552
- ...W("settingsButton", e.settingsButton),
2553
- ...W("theatreButton", e.theatreButton),
2554
- ...W("fullscreenButton", e.fullscreenButton),
2556
+ ...G("settingsButton", e.settingsButton),
2557
+ ...G("theatreButton", e.theatreButton),
2558
+ ...G("fullscreenButton", e.fullscreenButton),
2555
2559
  ...e.theatre === void 0 ? {} : { theatre: e.theatre }
2556
2560
  }), u.setValue(_)) : f.postLaunch(g, void 0, {
2557
2561
  startButton: e.startButton,
2558
2562
  theme: e.theme,
2559
2563
  showFeedback: e.showFeedback,
2560
2564
  interaction: e.interaction,
2561
- ...W("settingsButton", e.settingsButton),
2562
- ...W("theatreButton", e.theatreButton),
2563
- ...W("fullscreenButton", e.fullscreenButton),
2565
+ ...G("settingsButton", e.settingsButton),
2566
+ ...G("theatreButton", e.theatreButton),
2567
+ ...G("fullscreenButton", e.fullscreenButton),
2564
2568
  ...e.theatre === void 0 ? {} : { theatre: e.theatre }
2565
2569
  }), await Promise.race([s, new Promise((e, t) => {
2566
2570
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
@@ -2572,7 +2576,7 @@ var cn = class e {
2572
2576
  operation: "attach",
2573
2577
  message: e instanceof Error ? e.message : String(e),
2574
2578
  stack: e instanceof Error ? e.stack : void 0,
2575
- release: ft
2579
+ release: pt
2576
2580
  });
2577
2581
  } catch {}
2578
2582
  throw e;
@@ -2586,7 +2590,7 @@ var cn = class e {
2586
2590
  operation: "attach",
2587
2591
  message: e instanceof Error ? e.message : String(e),
2588
2592
  stack: e instanceof Error ? e.stack : void 0,
2589
- release: ft
2593
+ release: pt
2590
2594
  });
2591
2595
  } catch {}
2592
2596
  throw e;
@@ -2618,7 +2622,7 @@ var cn = class e {
2618
2622
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2619
2623
  }
2620
2624
  async setFit(e) {
2621
- let t = on(e);
2625
+ let t = sn(e);
2622
2626
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2623
2627
  if (this.closed) throw Error("Session has ended.");
2624
2628
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
@@ -2668,7 +2672,7 @@ var cn = class e {
2668
2672
  this.close();
2669
2673
  }
2670
2674
  destroy() {
2671
- 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, Et(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
2675
+ 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, Dt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
2672
2676
  }
2673
2677
  resolveMintInteraction() {
2674
2678
  return this.bootstrap.kind === "launch" ? {} : {
@@ -2680,8 +2684,8 @@ var cn = class e {
2680
2684
  return this.resolvedSession?.id ?? "";
2681
2685
  }
2682
2686
  emitWrapped(e, t) {
2683
- let n = St(e, this.getSessionId(), t);
2684
- return Tt(this.eventRegistry, e, n), n;
2687
+ let n = Ct(e, this.getSessionId(), t);
2688
+ return Et(this.eventRegistry, e, n), n;
2685
2689
  }
2686
2690
  queueProcessorTurn(e) {
2687
2691
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -2690,7 +2694,7 @@ var cn = class e {
2690
2694
  let n = this.processorAbortController.signal;
2691
2695
  this.processorChain = this.processorChain.then(async () => {
2692
2696
  if (!n.aborted) try {
2693
- let r = await Ue(t, {
2697
+ let r = await We(t, {
2694
2698
  utteranceId: e.utteranceId,
2695
2699
  text: e.text,
2696
2700
  conversation: this.conversationCache,
@@ -2740,7 +2744,7 @@ var cn = class e {
2740
2744
  };
2741
2745
  }
2742
2746
  };
2743
- function ln(e) {
2747
+ function un(e) {
2744
2748
  return e ? {
2745
2749
  textSpeech: e.capabilities.speech.output,
2746
2750
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -2751,26 +2755,26 @@ function ln(e) {
2751
2755
  }
2752
2756
  //#endregion
2753
2757
  //#region src/widget/dockGeometry.ts
2754
- var un = "(min-width: 768px)", dn = 24, fn = .5, pn = 1200, mn = .85, hn = 9 / 16;
2755
- function gn() {
2758
+ var dn = "(min-width: 768px)", fn = 24, pn = .5, mn = 1200, hn = .85, gn = 9 / 16;
2759
+ function _n() {
2756
2760
  if (typeof window > "u") return 800;
2757
2761
  let e = window.screen?.availHeight;
2758
2762
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2759
2763
  }
2760
- function _n(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = dn, r = typeof window < "u" ? gn() : 800) {
2761
- let i = Math.max(160, Math.min(t - n * 2, t * mn)), a = Math.max(120, e - n * 2), o = Math.min(r * fn, pn, i), s = o * hn;
2762
- return s > a && (s = a, o = s / hn, o > i && (o = i, s = o * hn)), {
2764
+ function vn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = fn, r = typeof window < "u" ? _n() : 800) {
2765
+ let i = Math.max(160, Math.min(t - n * 2, t * hn)), a = Math.max(120, e - n * 2), o = Math.min(r * pn, mn, i), s = o * gn;
2766
+ return s > a && (s = a, o = s / gn, o > i && (o = i, s = o * gn)), {
2763
2767
  width: Math.round(s),
2764
2768
  height: Math.round(o)
2765
2769
  };
2766
2770
  }
2767
- function vn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = dn) {
2771
+ function yn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = fn) {
2768
2772
  return {
2769
2773
  left: Math.max(r, t - e.width - r),
2770
2774
  top: Math.max(r, n - e.height - r)
2771
2775
  };
2772
2776
  }
2773
- function yn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = dn) {
2777
+ function bn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = fn) {
2774
2778
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2775
2779
  return {
2776
2780
  left: Math.min(Math.max(a, e), o),
@@ -2778,14 +2782,14 @@ function yn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
2778
2782
  };
2779
2783
  }
2780
2784
  function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2781
- return e(un).matches;
2785
+ return e(dn).matches;
2782
2786
  }
2783
2787
  //#endregion
2784
2788
  //#region src/widget/mountExperienceWidget.ts
2785
- function bn(e) {
2789
+ function xn(e) {
2786
2790
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2787
2791
  }
2788
- function xn(e) {
2792
+ function Sn(e) {
2789
2793
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2790
2794
  let t = typeof e == "string" ? e.trim() : "";
2791
2795
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2793,10 +2797,10 @@ function xn(e) {
2793
2797
  function $(e) {
2794
2798
  return e === "expanded" || e === "docked";
2795
2799
  }
2796
- var Sn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", Cn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", wn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Tn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2797
- function En(e, t, n) {
2798
- z(ue);
2799
- let r = v({
2800
+ var Cn = "<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>", wn = "<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>", Tn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", En = "<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>";
2801
+ function Dn(e, t, n) {
2802
+ de(ue);
2803
+ let r = y({
2800
2804
  galleryThumb: t.galleryThumb,
2801
2805
  avatarImage: t.avatarImage,
2802
2806
  backgroundImage: t.backgroundImage,
@@ -2824,7 +2828,7 @@ function En(e, t, n) {
2824
2828
  }
2825
2829
  return e.replaceChildren(i), n?.parallax === !1 ? () => {} : le(i);
2826
2830
  }
2827
- function Dn(e) {
2831
+ function On(e) {
2828
2832
  return e.startButton ? {
2829
2833
  ...e.startButton,
2830
2834
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2836,7 +2840,7 @@ function Dn(e) {
2836
2840
  variant: "primary"
2837
2841
  };
2838
2842
  }
2839
- function On(e) {
2843
+ function kn(e) {
2840
2844
  let t = !1, n = () => {
2841
2845
  t || e();
2842
2846
  }, r = () => {
@@ -2856,12 +2860,12 @@ function On(e) {
2856
2860
  t = !0, window.removeEventListener("load", r), i?.();
2857
2861
  };
2858
2862
  }
2859
- function kn(e, t) {
2863
+ function An(e, t) {
2860
2864
  me(fe);
2861
2865
  let n = t.experienceId?.trim();
2862
2866
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2863
- let r = t.prefetch ?? "onExpand", i = bn(t.position), a = document.createElement("div");
2864
- a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", xn(t.offset));
2867
+ let r = t.prefetch ?? "onExpand", i = xn(t.position), a = document.createElement("div");
2868
+ 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", Sn(t.offset));
2865
2869
  let o = document.createElement("button");
2866
2870
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2867
2871
  let s = document.createElement("div");
@@ -2881,138 +2885,138 @@ function kn(e, t) {
2881
2885
  let m = document.createElement("span");
2882
2886
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2883
2887
  let h = document.createElement("button");
2884
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = wn, h.setAttribute("aria-label", "Reduce");
2888
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Tn, h.setAttribute("aria-label", "Reduce");
2885
2889
  let g = document.createElement("button");
2886
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Sn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2890
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Cn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2887
2891
  let _ = document.createElement("button");
2888
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Cn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2892
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = wn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2889
2893
  let v = document.createElement("div");
2890
2894
  v.className = "liforma-ew__stage";
2891
2895
  let y = document.createElement("div");
2892
2896
  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);
2893
- let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, ee = "", te = null, ne = null, re = null, k = null, A = null, j = null, M = null, ie = 0, ae = 0, N = null, P = !1, F = new AbortController(), I = t.parallax !== !1, L = () => {
2897
+ 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, te = null, M = null, N = null, P = null, ne = 0, re = 0, F = null, I = !1, L = new AbortController(), ie = t.parallax !== !1, R = () => {
2894
2898
  let e = a.dataset.state;
2895
2899
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
2896
- }, R = () => {
2897
- re !== null && (clearTimeout(re), re = null);
2900
+ }, ae = () => {
2901
+ j !== null && (clearTimeout(j), j = null);
2902
+ }, z = () => {
2903
+ te !== null && (clearTimeout(te), te = null), a.classList.remove("liforma-ew--layout-settling");
2898
2904
  }, oe = () => {
2899
- k !== null && (clearTimeout(k), k = null), a.classList.remove("liforma-ew--layout-settling");
2900
- }, se = () => {
2901
2905
  for (let e of [
2902
2906
  f,
2903
2907
  l,
2904
2908
  p
2905
2909
  ]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
2906
2910
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
2907
- }, ce = (e, t, n, r) => {
2911
+ }, se = (e, t, n, r) => {
2908
2912
  let i = (i) => {
2909
2913
  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";
2910
2914
  };
2911
2915
  i(f), i(l);
2912
2916
  let a = p.offsetWidth || 120;
2913
2917
  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";
2918
+ }, ce = (e, t) => {
2919
+ if (R() !== "docked") return;
2920
+ let n = vn(), r = bn(e - ne, t - re, n);
2921
+ M = r.left, N = r.top, se(r.left, r.top, n.width, n.height);
2914
2922
  }, le = (e, t) => {
2915
- if (L() !== "docked") return;
2916
- let n = _n(), r = yn(e - ie, t - ae, n);
2917
- A = r.left, j = r.top, ce(r.left, r.top, n.width, n.height);
2918
- }, ue = (e, t) => {
2919
- if (L() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2920
- let n = _n(), r = A ?? f.getBoundingClientRect().left, i = j ?? f.getBoundingClientRect().top, a = yn(r + e, i + t, n);
2921
- A = a.left, j = a.top, ce(a.left, a.top, n.width, n.height);
2922
- }, de = (e) => {
2923
- N === "toolbar" && (M === null || e.pointerId !== M || (e.preventDefault(), le(e.clientX, e.clientY)));
2924
- }, z = (e) => {
2925
- if (M === null || e && e.pointerId !== M) return;
2926
- let t = N;
2927
- M = null, N = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && P && (P = !1, window.removeEventListener("pointermove", de), window.removeEventListener("pointerup", z), window.removeEventListener("pointercancel", z));
2928
- }, pe = (e, t, n) => {
2929
- if (S || L() !== "docked" || !Q() || M !== null) return;
2930
- M = n, N = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2923
+ if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2924
+ let n = vn(), r = M ?? f.getBoundingClientRect().left, i = N ?? f.getBoundingClientRect().top, a = bn(r + e, i + t, n);
2925
+ M = a.left, N = a.top, se(a.left, a.top, n.width, n.height);
2926
+ }, ue = (e) => {
2927
+ F === "toolbar" && (P === null || e.pointerId !== P || (e.preventDefault(), ce(e.clientX, e.clientY)));
2928
+ }, B = (e) => {
2929
+ if (P === null || e && e.pointerId !== P) return;
2930
+ let t = F;
2931
+ P = null, F = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && I && (I = !1, window.removeEventListener("pointermove", ue), window.removeEventListener("pointerup", B), window.removeEventListener("pointercancel", B));
2932
+ }, de = (e, t, n) => {
2933
+ if (S || R() !== "docked" || !Q() || P !== null) return;
2934
+ P = n, F = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2931
2935
  let r = f.getBoundingClientRect();
2932
- ie = e - r.left, ae = t - r.top, P || (P = !0, window.addEventListener("pointermove", de), window.addEventListener("pointerup", z), window.addEventListener("pointercancel", z));
2933
- }, he = (e) => {
2934
- if (S || L() !== "docked" || !Q() || M !== null) return;
2935
- M = e.pointerId, N = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2936
+ ne = e - r.left, re = t - r.top, I || (I = !0, window.addEventListener("pointermove", ue), window.addEventListener("pointerup", B), window.addEventListener("pointercancel", B));
2937
+ }, pe = (e) => {
2938
+ if (S || R() !== "docked" || !Q() || P !== null) return;
2939
+ P = e.pointerId, F = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2936
2940
  let t = f.getBoundingClientRect();
2937
- A = t.left, j = t.top;
2941
+ M = t.left, N = t.top;
2942
+ }, he = (e) => {
2943
+ F === "player" && (P === null || e.pointerId !== P || le(e.dx, e.dy));
2938
2944
  }, ge = (e) => {
2939
- N === "player" && (M === null || e.pointerId !== M || ue(e.dx, e.dy));
2940
- }, _e = (e) => {
2941
- N === "player" && (M === null || e.pointerId !== M || z());
2942
- }, B = () => {
2943
- let e = Q(), t = L();
2945
+ F === "player" && (P === null || e.pointerId !== P || B());
2946
+ }, V = () => {
2947
+ let e = Q(), t = R();
2944
2948
  if (!e || t !== "expanded" && t !== "docked") {
2945
2949
  h.hidden = !0;
2946
2950
  return;
2947
2951
  }
2948
- h.hidden = !1, t === "docked" ? (h.innerHTML = Tn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = wn, h.setAttribute("aria-label", "Reduce"));
2949
- }, ve = (e) => {
2950
- let t = _n(), n = e && A !== null && j !== null ? yn(A, j, t) : vn(t);
2951
- n = yn(n.left, n.top, t), A = n.left, j = n.top, ce(n.left, n.top, t.width, t.height), B();
2952
- }, V = () => {
2952
+ h.hidden = !1, t === "docked" ? (h.innerHTML = En, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Tn, h.setAttribute("aria-label", "Reduce"));
2953
+ }, _e = (e) => {
2954
+ let t = vn(), n = e && M !== null && N !== null ? bn(M, N, t) : yn(t);
2955
+ n = bn(n.left, n.top, t), M = n.left, N = n.top, se(n.left, n.top, t.width, t.height), V();
2956
+ }, ve = () => {
2953
2957
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2954
2958
  requestAnimationFrame(() => {
2955
2959
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
2956
2960
  });
2957
2961
  });
2958
- }, be = (e) => {
2959
- if (oe(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
2962
+ }, H = (e) => {
2963
+ if (z(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
2960
2964
  a.classList.remove("liforma-ew--layout-settling");
2961
2965
  return;
2962
2966
  }
2963
- k = setTimeout(() => {
2964
- if (k = null, S || !$(a.dataset.state)) {
2967
+ te = setTimeout(() => {
2968
+ if (te = null, S || !$(a.dataset.state)) {
2965
2969
  a.classList.remove("liforma-ew--layout-settling");
2966
2970
  return;
2967
2971
  }
2968
- a.classList.remove("liforma-ew--layout-settling"), V();
2972
+ a.classList.remove("liforma-ew--layout-settling"), ve();
2969
2973
  }, 220);
2970
- }, xe = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2971
- R(), re = setTimeout(() => {
2972
- re = null, a.classList.remove("liforma-ew--session-concealing"), e();
2974
+ }, be = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
2975
+ ae(), j = setTimeout(() => {
2976
+ j = null, a.classList.remove("liforma-ew--session-concealing"), e();
2973
2977
  }, 280);
2974
- })), Se = {
2978
+ })), xe = {
2975
2979
  galleryThumb: t.galleryThumb,
2976
2980
  avatarImage: t.avatarImage,
2977
2981
  backgroundImage: t.backgroundImage,
2978
2982
  foregroundImage: t.foregroundImage,
2979
2983
  fallbackImage: t.fallbackImage
2980
- }, H = (e) => {
2984
+ }, U = (e) => {
2981
2985
  if (!e) {
2982
2986
  y.hidden = !0, y.textContent = "";
2983
2987
  return;
2984
2988
  }
2985
2989
  y.hidden = !1, y.textContent = e;
2986
- }, U = (e) => {
2990
+ }, Se = (e) => {
2987
2991
  if (!e) {
2988
2992
  c.hidden = !0, c.textContent = "";
2989
2993
  return;
2990
2994
  }
2991
2995
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
2996
+ }, W = () => {
2997
+ C = !0, o.disabled = !1, Se(null), r === "onExpand" && t.onPrefetchReady?.();
2992
2998
  }, Ce = () => {
2993
- C = !0, o.disabled = !1, U(null), r === "onExpand" && t.onPrefetchReady?.();
2994
- }, we = () => {
2995
2999
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2996
- }, Te = (e) => {
2997
- te?.(), te = null;
2998
- let t = En(s, e, { parallax: I });
2999
- return t ? (te = t, !0) : !1;
3000
- }, Ee = () => {
3001
- if (Te(Se)) {
3002
- Ce();
3000
+ }, we = (e) => {
3001
+ A?.(), A = null;
3002
+ let t = Dn(s, e, { parallax: ie });
3003
+ return t ? (A = t, !0) : !1;
3004
+ }, Te = () => {
3005
+ if (we(xe)) {
3006
+ W();
3003
3007
  return;
3004
3008
  }
3005
- U("Loading…"), ye(n, { signal: F.signal }).then((e) => {
3009
+ Se("Loading…"), ye(n, { signal: L.signal }).then((e) => {
3006
3010
  if (!S) {
3007
- if (!Te({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3008
- Ce();
3011
+ if (!we({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3012
+ W();
3009
3013
  }
3010
3014
  }).catch((e) => {
3011
- if (S || F.signal.aborted) return;
3015
+ if (S || L.signal.aborted) return;
3012
3016
  let n = e instanceof Error ? e : Error(String(e));
3013
- U("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3017
+ Se("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3014
3018
  });
3015
- }, De = () => ({
3019
+ }, Ee = () => ({
3016
3020
  experienceId: n,
3017
3021
  ui: "widget",
3018
3022
  ...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
@@ -3025,71 +3029,71 @@ function kn(e, t) {
3025
3029
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
3026
3030
  ...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
3027
3031
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
3028
- }), W = () => ({
3032
+ }), De = () => ({
3029
3033
  ...t.fit ? { fit: t.fit } : {},
3030
- startButton: Dn(t),
3034
+ startButton: On(t),
3031
3035
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
3032
3036
  ...t.interaction ? { interaction: t.interaction } : {}
3033
3037
  }), G = (e = !0) => {
3034
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), se(), a.dataset.state = "expanded", H(null), typeof document < "u" && (ee = document.body.style.overflow, document.body.style.overflow = "hidden"), B(), e && t.onExpanded?.();
3038
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), oe(), a.dataset.state = "expanded", U(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), V(), e && t.onExpanded?.();
3035
3039
  }, K = () => {
3036
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", H(null), typeof document < "u" && (document.body.style.overflow = ee), ve(!0), B(), b?.setWidgetChrome("docked");
3037
- }, Oe = (e) => {
3040
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", U(null), typeof document < "u" && (document.body.style.overflow = k), _e(!0), V(), b?.setWidgetChrome("docked");
3041
+ }, q = (e) => {
3038
3042
  e.on("started", () => {
3039
- S || (D = !0, a.dataset.live = "true", H(null), t.onStarted?.(), $(a.dataset.state) && V());
3043
+ S || (D = !0, a.dataset.live = "true", U(null), t.onStarted?.(), $(a.dataset.state) && ve());
3040
3044
  }), e.on("feedback", (e) => {
3041
3045
  S || t.onFeedback?.(e);
3042
3046
  }), e.on("feedbackFailed", (e) => {
3043
3047
  S || t.onFeedbackFailed?.(e);
3044
3048
  });
3049
+ }, Oe = () => {
3050
+ z(), u.hidden = !0, p.hidden = !0, oe(), 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), U(null), typeof document < "u" && (document.body.style.overflow = k), V();
3045
3051
  }, ke = () => {
3046
- oe(), u.hidden = !0, p.hidden = !0, se(), 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), H(null), typeof document < "u" && (document.body.style.overflow = ee), B();
3047
- }, Ae = () => {
3048
- R(), oe(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3052
+ ae(), z(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3049
3053
  let e = b;
3050
3054
  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");
3051
- }, q = () => {
3055
+ }, J = () => {
3052
3056
  if (!S && $(a.dataset.state)) {
3053
- if (z(), x = !1, b && E) {
3057
+ if (B(), x = !1, b && E) {
3054
3058
  let e = b;
3055
3059
  (async () => {
3056
- D && (await xe(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), ke(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && we(), t.onCollapsed?.(), t.onClose?.());
3060
+ D && (await be(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Oe(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && Ce(), t.onCollapsed?.(), t.onClose?.());
3057
3061
  })();
3058
3062
  return;
3059
3063
  }
3060
- Ae(), ke(), t.onCollapsed?.(), t.onClose?.();
3064
+ ke(), Oe(), t.onCollapsed?.(), t.onClose?.();
3061
3065
  }
3062
- }, je = () => {
3063
- S || Q() && L() === "expanded" && be(() => {
3066
+ }, Ae = () => {
3067
+ S || Q() && R() === "expanded" && H(() => {
3064
3068
  K();
3065
3069
  });
3066
- }, J = () => {
3067
- S || L() === "docked" && (z(), be(() => {
3068
- se(), G(!1), b?.setWidgetChrome("expanded");
3070
+ }, je = () => {
3071
+ S || R() === "docked" && (B(), H(() => {
3072
+ oe(), G(!1), b?.setWidgetChrome("expanded");
3069
3073
  }));
3070
3074
  }, Me = () => {
3071
- !b || !D || (R(), a.classList.remove("liforma-ew--session-revealed"), G(), b.setWidgetChrome("expanded"), x = !1, V());
3075
+ !b || !D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), b.setWidgetChrome("expanded"), x = !1, ve());
3072
3076
  }, Ne = () => {
3073
- !b || !E || D || (R(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, w || b.setWidgetChrome("expanded"));
3077
+ !b || !E || D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, w || b.setWidgetChrome("expanded"));
3074
3078
  }, Pe = (e) => {
3075
- S || e !== O && !D || (R(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, D && V());
3079
+ S || e !== O && !D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, D && ve());
3076
3080
  }, Fe = () => {
3077
3081
  if (S || T || w || b || $(a.dataset.state)) return;
3078
3082
  T = !0;
3079
3083
  let e = O;
3080
3084
  l.hidden = !1, (async () => {
3081
3085
  try {
3082
- let t = await cn.startSession(De());
3086
+ let t = await ln.startSession(Ee());
3083
3087
  if (S || e !== O) {
3084
3088
  t.destroy();
3085
3089
  return;
3086
3090
  }
3087
- b = t, Oe(t);
3091
+ b = t, q(t);
3088
3092
  let n = await t.attach({
3089
3093
  container: l,
3090
- ...W(),
3094
+ ...De(),
3091
3095
  onWidgetReady: () => {
3092
- S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : we());
3096
+ S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : Ce());
3093
3097
  },
3094
3098
  onWidgetExpand: () => {
3095
3099
  Pe(e);
@@ -3098,16 +3102,16 @@ function kn(e, t) {
3098
3102
  S || ze(e);
3099
3103
  },
3100
3104
  onWidgetDragStart: (e) => {
3101
- S || he(e);
3105
+ S || pe(e);
3102
3106
  },
3103
3107
  onWidgetDragMove: (e) => {
3104
- S || ge(e);
3108
+ S || he(e);
3105
3109
  },
3106
3110
  onWidgetDragEnd: (e) => {
3107
- S || _e(e);
3111
+ S || ge(e);
3108
3112
  },
3109
3113
  onPlayerStatusChange: (e) => {
3110
- S || e === "error" && $(a.dataset.state) && H("Could not load the experience.");
3114
+ S || e === "error" && $(a.dataset.state) && U("Could not load the experience.");
3111
3115
  }
3112
3116
  });
3113
3117
  if (S || e !== O) {
@@ -3115,7 +3119,7 @@ function kn(e, t) {
3115
3119
  return;
3116
3120
  }
3117
3121
  n.on("close", () => {
3118
- S || q();
3122
+ S || J();
3119
3123
  });
3120
3124
  } catch (n) {
3121
3125
  if (S || e !== O) return;
@@ -3138,29 +3142,29 @@ function kn(e, t) {
3138
3142
  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 () => {
3139
3143
  try {
3140
3144
  G();
3141
- let t = await cn.startSession(De());
3145
+ let t = await ln.startSession(Ee());
3142
3146
  if (S || e !== O) {
3143
3147
  t.destroy();
3144
3148
  return;
3145
3149
  }
3146
- b = t, Oe(t);
3150
+ b = t, q(t);
3147
3151
  let n = await t.attach({
3148
3152
  container: v,
3149
- ...W(),
3153
+ ...De(),
3150
3154
  onWidgetAudioSettings: (e) => {
3151
3155
  S || ze(e);
3152
3156
  },
3153
3157
  onWidgetDragStart: (e) => {
3154
- S || he(e);
3158
+ S || pe(e);
3155
3159
  },
3156
3160
  onWidgetDragMove: (e) => {
3157
- S || ge(e);
3161
+ S || he(e);
3158
3162
  },
3159
3163
  onWidgetDragEnd: (e) => {
3160
- S || _e(e);
3164
+ S || ge(e);
3161
3165
  },
3162
3166
  onPlayerStatusChange: (e) => {
3163
- S || (e === "error" ? H("Could not load the experience.") : $(a.dataset.state) && H(null));
3167
+ S || (e === "error" ? U("Could not load the experience.") : $(a.dataset.state) && U(null));
3164
3168
  }
3165
3169
  });
3166
3170
  if (S || e !== O) {
@@ -3168,12 +3172,12 @@ function kn(e, t) {
3168
3172
  return;
3169
3173
  }
3170
3174
  E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
3171
- S || q();
3175
+ S || J();
3172
3176
  });
3173
3177
  } catch (n) {
3174
3178
  if (S || e !== O) return;
3175
3179
  let r = n instanceof Error ? n : Error(String(n));
3176
- H(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3180
+ U(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3177
3181
  } finally {
3178
3182
  e === O && (x = !1);
3179
3183
  }
@@ -3195,54 +3199,54 @@ function kn(e, t) {
3195
3199
  Ie();
3196
3200
  }
3197
3201
  }, Re = (e) => {
3198
- if (e.stopPropagation(), L() === "expanded") {
3199
- je();
3202
+ if (e.stopPropagation(), R() === "expanded") {
3203
+ Ae();
3200
3204
  return;
3201
3205
  }
3202
- L() === "docked" && J();
3206
+ R() === "docked" && je();
3203
3207
  }, ze = (e) => {
3204
3208
  g.setAttribute("aria-pressed", e ? "true" : "false");
3205
3209
  }, Be = (e) => {
3206
3210
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
3207
3211
  }, Ve = (e) => {
3208
- L() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), pe(e.clientX, e.clientY, e.pointerId)));
3212
+ R() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), de(e.clientX, e.clientY, e.pointerId)));
3209
3213
  }, He = (e) => {
3210
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), q());
3214
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), J());
3211
3215
  }, Ue = () => {
3212
3216
  if (!S) {
3213
- if (L() === "docked") {
3217
+ if (R() === "docked") {
3214
3218
  if (!Q()) {
3215
- J();
3219
+ je();
3216
3220
  return;
3217
3221
  }
3218
- D ? be(() => {
3219
- ve(!0);
3220
- }) : ve(!0);
3222
+ D ? H(() => {
3223
+ _e(!0);
3224
+ }) : _e(!0);
3221
3225
  return;
3222
3226
  }
3223
- B();
3227
+ V();
3224
3228
  }
3225
- }, We = typeof window < "u" ? window.matchMedia(un) : null, Ge = () => {
3229
+ }, We = typeof window < "u" ? window.matchMedia(dn) : null, Ge = () => {
3226
3230
  if (!S) {
3227
- if (L() === "docked" && !Q()) {
3228
- J();
3231
+ if (R() === "docked" && !Q()) {
3232
+ je();
3229
3233
  return;
3230
3234
  }
3231
- B();
3235
+ V();
3232
3236
  }
3233
3237
  };
3234
- return o.addEventListener("click", Le), d.addEventListener("click", q), _.addEventListener("click", (e) => {
3235
- e.stopPropagation(), q();
3236
- }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), Ee(), B(), r === "eager" ? queueMicrotask(() => {
3238
+ return o.addEventListener("click", Le), d.addEventListener("click", J), _.addEventListener("click", (e) => {
3239
+ e.stopPropagation(), J();
3240
+ }), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), Te(), V(), r === "eager" ? queueMicrotask(() => {
3237
3241
  S || Fe();
3238
- }) : r === "idle" && (ne = On(() => {
3242
+ }) : r === "idle" && (ee = kn(() => {
3239
3243
  S || Fe();
3240
3244
  })), {
3241
3245
  root: a,
3242
3246
  expand: Le,
3243
- collapse: q,
3244
- dock: je,
3245
- maximize: J,
3247
+ collapse: J,
3248
+ dock: Ae,
3249
+ maximize: je,
3246
3250
  prefetch() {
3247
3251
  if (r === "onExpand") {
3248
3252
  Fe();
@@ -3251,11 +3255,11 @@ function kn(e, t) {
3251
3255
  Fe();
3252
3256
  },
3253
3257
  destroy() {
3254
- S || (S = !0, z(), ne?.(), ne = null, F.abort(), te?.(), te = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), Ae(), ke(), e.replaceChildren());
3258
+ S || (S = !0, B(), ee?.(), ee = null, L.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), ke(), Oe(), e.replaceChildren());
3255
3259
  }
3256
3260
  };
3257
3261
  }
3258
3262
  //#endregion
3259
- export { ue as EXPERIENCE_THUMBNAIL_CSS, fe as EXPERIENCE_WIDGET_CSS, cn as Experience, V as LiformaError, X as SPEECH_LIMITS, Pt as SpeechBufferTimeoutError, Z as SpeechRuntimeError, Nt as SpeechUtteranceClosedError, Mt as UnsupportedSpeechOperationError, ie as attachImageReady, M as attachLazyThumb, ce as attachScrollLinkedParallax, w as buildHostedLaunchUrl, z as ensureExperienceThumbnailStyles, me as ensureExperienceWidgetStyles, ye as fetchExperiencePreview, k as getDefaultLazyRootMargin, N as horizontalParallaxFromViewportY, xe as liformaErrorFromResponse, kn as mountExperienceWidget, n as navigateOnExperienceClose, T as resolveThumbnailHref, S as resolveThumbnailInteraction, v as resolveThumbnailLayers, r as thumbnailFitClass, _ as toGalleryThumbUrl, J as warnLocaleVoiceFallbacks };
3263
+ export { ue as EXPERIENCE_THUMBNAIL_CSS, fe as EXPERIENCE_WIDGET_CSS, ln as Experience, H as LiformaError, X as SPEECH_LIMITS, Ft as SpeechBufferTimeoutError, Z as SpeechRuntimeError, Pt as SpeechUtteranceClosedError, Nt as UnsupportedSpeechOperationError, re as attachImageReady, ne as attachLazyThumb, ce as attachScrollLinkedParallax, T as buildHostedLaunchUrl, de as ensureExperienceThumbnailStyles, me as ensureExperienceWidgetStyles, ye as fetchExperiencePreview, M as getDefaultLazyRootMargin, I as horizontalParallaxFromViewportY, xe as liformaErrorFromResponse, An as mountExperienceWidget, n as navigateOnExperienceClose, E as resolveThumbnailHref, C as resolveThumbnailInteraction, y as resolveThumbnailLayers, r as thumbnailFitClass, v as toGalleryThumbUrl, Me as warnLocaleVoiceFallbacks };
3260
3264
 
3261
3265
  //# sourceMappingURL=index.js.map