@liforma/client 0.4.13 → 0.4.15
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.
- package/CHANGELOG.md +18 -0
- package/README.md +4 -4
- package/dist/next/index.js +704 -623
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/thumbnail/index.d.ts +1 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/locationPlate.d.ts +3 -3
- package/dist/next/thumbnail/locationPlate.d.ts.map +1 -1
- package/dist/next/thumbnail/plateDelivery.d.ts +18 -0
- package/dist/next/thumbnail/plateDelivery.d.ts.map +1 -0
- package/dist/next/thumbnail/plateDelivery.test.d.ts +2 -0
- package/dist/next/thumbnail/plateDelivery.test.d.ts.map +1 -0
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +1 -1
- package/dist/next/thumbnail.js +147 -91
- package/dist/next/thumbnail.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +7 -7
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +11 -5
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts +4 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/next/v2/types/sessionLaunch.d.ts +6 -0
- package/dist/next/v2/types/sessionLaunch.d.ts.map +1 -1
- package/dist/npm/index.js +494 -469
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/index.d.ts +1 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +106 -70
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/locationPlate.d.ts +3 -3
- package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -1
- package/dist/npm/thumbnail/plateDelivery.d.ts +18 -0
- package/dist/npm/thumbnail/plateDelivery.d.ts.map +1 -0
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +7 -7
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +11 -5
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +1 -1
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +1 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts +4 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/npm/v2/types/index.d.ts +1 -1
- package/dist/npm/v2/types/index.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionLaunch.d.ts +6 -0
- package/dist/npm/v2/types/sessionLaunch.d.ts.map +1 -1
- package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
- package/dist/react/component/experienceComponentRuntime.d.ts +3 -1
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +9 -4
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +733 -640
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/react/thumbnail/index.d.ts +1 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/locationPlate.d.ts +3 -3
- package/dist/react/thumbnail/locationPlate.d.ts.map +1 -1
- package/dist/react/thumbnail/plateDelivery.d.ts +18 -0
- package/dist/react/thumbnail/plateDelivery.d.ts.map +1 -0
- package/dist/react/thumbnail/plateDelivery.test.d.ts +2 -0
- package/dist/react/thumbnail/plateDelivery.test.d.ts.map +1 -0
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +1 -1
- package/dist/react/thumbnail.js +147 -91
- package/dist/react/thumbnail.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +7 -7
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +11 -5
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts +4 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/react/v2/types/sessionLaunch.d.ts +6 -0
- package/dist/react/v2/types/sessionLaunch.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +3 -3
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +2 -2
- package/dist/sdk/v2/thumbnail.js.map +1 -1
- package/dist/svelte/Experience.svelte +12 -0
- package/dist/svelte/ExperienceThumbnail.svelte +49 -8
- package/package.json +4 -1
package/dist/next/index.js
CHANGED
|
@@ -107,9 +107,9 @@ function y(e) {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/thumbnail/locationPlate.ts
|
|
110
|
-
var b = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
110
|
+
var b = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
|
|
111
111
|
function x(e, t) {
|
|
112
|
-
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
112
|
+
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
113
113
|
}
|
|
114
114
|
function S(e, t) {
|
|
115
115
|
let n = e.trim();
|
|
@@ -123,7 +123,7 @@ function C(e, t) {
|
|
|
123
123
|
let r = new ResizeObserver(n);
|
|
124
124
|
return r.observe(e), () => r.disconnect();
|
|
125
125
|
}
|
|
126
|
-
var w = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
126
|
+
var w = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
127
127
|
function T(e) {
|
|
128
128
|
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
129
129
|
}
|
|
@@ -173,21 +173,21 @@ function j(e, t) {
|
|
|
173
173
|
}
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
176
|
-
var
|
|
177
|
-
function
|
|
176
|
+
var M = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, ee = /_CH(\.webp)/i;
|
|
177
|
+
function N(e) {
|
|
178
178
|
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("/");
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function P(e, t = "256x256", n) {
|
|
181
181
|
let r = e.trim();
|
|
182
182
|
if (!r) return r;
|
|
183
|
-
if (
|
|
183
|
+
if (N(r)) return A(r, t, n);
|
|
184
184
|
let i = j(r, n);
|
|
185
|
-
return i = i.replace(
|
|
185
|
+
return i = i.replace(M, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(ee, "_neutral$1");
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function F(e) {
|
|
188
188
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
189
189
|
if (!t) return null;
|
|
190
|
-
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 = T(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() :
|
|
190
|
+
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 = T(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : P(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : A(e, a, o);
|
|
191
191
|
return {
|
|
192
192
|
avatarImage: c(t),
|
|
193
193
|
...n ? { backgroundImage: l(n) } : {},
|
|
@@ -197,7 +197,7 @@ function P(e) {
|
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/shims/localStack.ts
|
|
200
|
-
function
|
|
200
|
+
function te() {
|
|
201
201
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
202
202
|
if (typeof location > "u") return !1;
|
|
203
203
|
try {
|
|
@@ -208,83 +208,83 @@ function ne() {
|
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
211
|
-
var
|
|
212
|
-
function
|
|
211
|
+
var I = "https://player.liforma.ai", L = "http://localhost:3002";
|
|
212
|
+
function ne(e) {
|
|
213
213
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function re(e) {
|
|
216
216
|
let t = e?.trim();
|
|
217
|
-
return t ? t.replace(/\/$/, "") :
|
|
217
|
+
return t ? t.replace(/\/$/, "") : te() ? L : I;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
let t = e.experienceId.trim(), n =
|
|
219
|
+
function ie(e) {
|
|
220
|
+
let t = e.experienceId.trim(), n = re(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
221
221
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function R(e) {
|
|
224
224
|
let t = e.href?.trim();
|
|
225
225
|
if (t) return t;
|
|
226
226
|
let n = e.experienceId?.trim();
|
|
227
227
|
if (!n) return;
|
|
228
228
|
let r = e.returnUrl?.trim();
|
|
229
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
229
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ie({
|
|
230
230
|
experienceId: n,
|
|
231
231
|
...r ? { returnUrl: r } : {},
|
|
232
232
|
playerBaseUrl: e.playerBaseUrl
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function z() {
|
|
236
236
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var B = 0, ae = [];
|
|
239
|
+
function oe() {
|
|
240
|
+
return z() ? 4 : Infinity;
|
|
241
|
+
}
|
|
239
242
|
function se() {
|
|
240
|
-
return
|
|
243
|
+
return z() ? 160 : 0;
|
|
241
244
|
}
|
|
242
245
|
function ce() {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
let e = se();
|
|
247
|
-
for (; z < e && oe.length > 0;) {
|
|
248
|
-
let e = oe.shift();
|
|
246
|
+
let e = oe();
|
|
247
|
+
for (; B < e && ae.length > 0;) {
|
|
248
|
+
let e = ae.shift();
|
|
249
249
|
if (!e || e.cancelled) continue;
|
|
250
|
-
|
|
251
|
-
let t =
|
|
250
|
+
B += 1, e.start();
|
|
251
|
+
let t = se();
|
|
252
252
|
if (t <= 0) {
|
|
253
|
-
|
|
253
|
+
B = Math.max(0, B - 1);
|
|
254
254
|
continue;
|
|
255
255
|
}
|
|
256
256
|
window.setTimeout(() => {
|
|
257
|
-
|
|
257
|
+
B = Math.max(0, B - 1), ce();
|
|
258
258
|
}, t);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
if (!
|
|
261
|
+
function le(e) {
|
|
262
|
+
if (!z()) return e(), () => {};
|
|
263
263
|
let t = {
|
|
264
264
|
start: e,
|
|
265
265
|
cancelled: !1
|
|
266
266
|
};
|
|
267
|
-
return
|
|
267
|
+
return ae.push(t), ce(), () => {
|
|
268
268
|
t.cancelled = !0;
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/thumbnail/lazyLoad.ts
|
|
273
|
-
function
|
|
274
|
-
return
|
|
273
|
+
function V() {
|
|
274
|
+
return z() ? "96px 0px" : "280px 0px";
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function ue(e) {
|
|
277
277
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
278
278
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function de(e, t) {
|
|
281
281
|
if (typeof window > "u") return !1;
|
|
282
282
|
let n = e.getBoundingClientRect();
|
|
283
283
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
287
|
-
o || (s?.(), s =
|
|
285
|
+
function fe(e, t) {
|
|
286
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? V(), i = ue(r), a = !1, o = !1, s = null, c = () => {
|
|
287
|
+
o || (s?.(), s = le(() => {
|
|
288
288
|
s = null, o = !0, n(!0);
|
|
289
289
|
}));
|
|
290
290
|
}, l = (e) => {
|
|
@@ -306,55 +306,55 @@ function pe(e, t) {
|
|
|
306
306
|
rootMargin: r,
|
|
307
307
|
threshold: 0
|
|
308
308
|
});
|
|
309
|
-
return u.observe(e),
|
|
309
|
+
return u.observe(e), de(e, i) && l(!0), () => {
|
|
310
310
|
s?.(), s = null, u.disconnect();
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
//#endregion
|
|
314
314
|
//#region src/thumbnail/scrollParallax.ts
|
|
315
|
-
function
|
|
315
|
+
function pe() {
|
|
316
316
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function H(e, t) {
|
|
319
319
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
320
320
|
}
|
|
321
|
-
var
|
|
321
|
+
var me = /* @__PURE__ */ new Set(), U = !1, W = 0;
|
|
322
322
|
function he() {
|
|
323
|
-
if (W = 0,
|
|
323
|
+
if (W = 0, me.size === 0 || typeof window > "u") return;
|
|
324
324
|
let e = window.innerHeight;
|
|
325
|
-
for (let t of
|
|
325
|
+
for (let t of me) {
|
|
326
326
|
if (t.pointerActive?.()) continue;
|
|
327
327
|
let n = t.element.getBoundingClientRect();
|
|
328
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
328
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(H(n, e));
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function G() {
|
|
332
332
|
W === 0 && (W = requestAnimationFrame(he));
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
U || typeof window > "u" || (U = !0, window.addEventListener("scroll",
|
|
334
|
+
function K() {
|
|
335
|
+
U || typeof window > "u" || (U = !0, window.addEventListener("scroll", G, { passive: !0 }), window.addEventListener("resize", G, { passive: !0 }));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
337
|
+
function ge() {
|
|
338
|
+
me.size > 0 || !U || typeof window > "u" || (U = !1, W !== 0 && (cancelAnimationFrame(W), W = 0), window.removeEventListener("scroll", G), window.removeEventListener("resize", G));
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
if (!
|
|
340
|
+
function _e(e, t) {
|
|
341
|
+
if (!pe()) return () => {};
|
|
342
342
|
let n = {
|
|
343
343
|
element: e,
|
|
344
344
|
onParallax: t.onParallax,
|
|
345
345
|
pointerActive: t.pointerActive
|
|
346
346
|
};
|
|
347
|
-
return
|
|
348
|
-
|
|
347
|
+
return me.add(n), K(), n.pointerActive?.() || t.onParallax(H(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
348
|
+
me.delete(n), ge();
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
351
|
//#endregion
|
|
352
352
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
353
|
-
function
|
|
353
|
+
function ve(e) {
|
|
354
354
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
355
355
|
let a = r || i;
|
|
356
356
|
e.classList.toggle("liforma-et--parallax", a), e.classList.toggle("liforma-et--scroll-parallax", i), e.style.setProperty("--liforma-et-parallax-x", String(t)), e.style.setProperty("--liforma-et-parallax-y", String(n));
|
|
357
|
-
}, s =
|
|
357
|
+
}, s = _e(e, {
|
|
358
358
|
onParallax: (e) => {
|
|
359
359
|
i = !0, a || (t = e, n = 0, o());
|
|
360
360
|
},
|
|
@@ -367,7 +367,7 @@ function ye(e) {
|
|
|
367
367
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
368
368
|
}, u = () => {
|
|
369
369
|
let s = a;
|
|
370
|
-
a = !1, r = !1, i && s ? (t =
|
|
370
|
+
a = !1, r = !1, i && s ? (t = H(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
371
371
|
}, d = (e) => {
|
|
372
372
|
e.pointerType === "mouse" && (r = !0, o());
|
|
373
373
|
}, f = () => {
|
|
@@ -379,30 +379,65 @@ function ye(e) {
|
|
|
379
379
|
}
|
|
380
380
|
//#endregion
|
|
381
381
|
//#region src/thumbnail/styles.ts
|
|
382
|
-
var
|
|
383
|
-
function
|
|
384
|
-
if (typeof document > "u" ||
|
|
382
|
+
var ye = ":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}", be = !1;
|
|
383
|
+
function xe(e) {
|
|
384
|
+
if (typeof document > "u" || be) return;
|
|
385
385
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
386
|
-
|
|
386
|
+
be = !0;
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
let t = document.createElement("style");
|
|
390
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
390
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), be = !0;
|
|
391
|
+
}
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/thumbnail/plateDelivery.ts
|
|
394
|
+
var Se = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Ce = null;
|
|
395
|
+
function we(e) {
|
|
396
|
+
let t = e.trim();
|
|
397
|
+
if (!t || t.startsWith("blob:") || t.startsWith("data:")) return !1;
|
|
398
|
+
let n = t.split(/[?#]/)[0] ?? t, r = /\/avatars\//i.test(n), i = /\/locations\//i.test(n);
|
|
399
|
+
return !r && !i || /\.depth\.webp$/i.test(n) ? !1 : /\.webp$/i.test(n);
|
|
400
|
+
}
|
|
401
|
+
function Te(e) {
|
|
402
|
+
if (!we(e)) return null;
|
|
403
|
+
let t = e.search(/[?#]/);
|
|
404
|
+
if (t < 0) return e.replace(/\.webp$/i, ".avif");
|
|
405
|
+
let n = e.slice(0, t), r = e.slice(t);
|
|
406
|
+
return `${n.replace(/\.webp$/i, ".avif")}${r}`;
|
|
407
|
+
}
|
|
408
|
+
function Ee() {
|
|
409
|
+
return typeof Image > "u" ? Promise.resolve(!1) : (Ce ||= new Promise((e) => {
|
|
410
|
+
let t = new Image();
|
|
411
|
+
t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = Se;
|
|
412
|
+
}), Ce);
|
|
413
|
+
}
|
|
414
|
+
function De(e, t) {
|
|
415
|
+
return t ? Te(e) ?? e : e;
|
|
416
|
+
}
|
|
417
|
+
function Oe(e) {
|
|
418
|
+
let t = e.trim(), n = t.search(/[?#]/), r = n < 0 ? t : t.slice(0, n);
|
|
419
|
+
if (!/\.avif$/i.test(r)) return null;
|
|
420
|
+
let i = r.replace(/\.avif$/i, ".webp");
|
|
421
|
+
return n < 0 ? i : `${i}${t.slice(n)}`;
|
|
422
|
+
}
|
|
423
|
+
function ke(e) {
|
|
424
|
+
let t = e.trim();
|
|
425
|
+
return /-400x225\.(webp|avif)(?:$|[?#])/i.test(t) ? t.replace(/-400x225\.(webp|avif)/i, "-800x450.$1") : null;
|
|
391
426
|
}
|
|
392
427
|
//#endregion
|
|
393
428
|
//#region src/react/ExperienceThumbnail.tsx
|
|
394
|
-
function
|
|
429
|
+
function Ae(e, t) {
|
|
395
430
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
396
431
|
}
|
|
397
|
-
function
|
|
398
|
-
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: w = "full", lazy: T = !0, className: E = "", fallbackImage: D, normalizeUrls: O = !0, cdnBaseUrl: k } = s, A = n(null), j = n(!1), [
|
|
432
|
+
function je(s) {
|
|
433
|
+
let { galleryThumb: c, avatarImage: l, backgroundImage: u, foregroundImage: d, alt: f, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: b, parallax: S = !0, fit: w = "full", lazy: T = !0, className: E = "", fallbackImage: D, normalizeUrls: O = !0, cdnBaseUrl: k } = s, A = n(null), j = n(!1), [M, ee] = r(0), [N, P] = r(0), te = x(M, N), I = t(() => F({
|
|
399
434
|
galleryThumb: c,
|
|
400
435
|
avatarImage: l,
|
|
401
436
|
backgroundImage: u,
|
|
402
437
|
foregroundImage: d,
|
|
403
438
|
fallbackImage: D,
|
|
404
439
|
normalize: O,
|
|
405
|
-
locationPlateSize:
|
|
440
|
+
locationPlateSize: te,
|
|
406
441
|
cdnBaseUrl: k
|
|
407
442
|
}), [
|
|
408
443
|
c,
|
|
@@ -411,87 +446,89 @@ function we(s) {
|
|
|
411
446
|
d,
|
|
412
447
|
D,
|
|
413
448
|
O,
|
|
414
|
-
|
|
449
|
+
te,
|
|
415
450
|
k
|
|
416
|
-
]),
|
|
451
|
+
]), L = ne({
|
|
417
452
|
href: m,
|
|
418
453
|
hasClickHandler: typeof _ == "function",
|
|
419
454
|
experienceId: p
|
|
420
|
-
}),
|
|
455
|
+
}), re = L === "anchor" && !m?.trim() && !!p?.trim(), ie = !!I?.backgroundImage, z = S !== !1, [B, ae] = r(!T), [oe, se] = r(!1), [ce, le] = r(!1), [V, ue] = r(!1), [de, pe] = r(!1), [me, U] = r(!1), [W, he] = r(!1), [G, K] = r(!1), [ge, ve] = r(0), [be, Se] = r(0), [Ce, we] = r(!1), [Te, je] = r(!1), [Me, Ne] = r(!1), [Pe, Fe] = r(!1), [q, Ie] = r(), Le = I ? Ce && I.fallbackImage ? I.fallbackImage : I.avatarImage : "";
|
|
421
456
|
e(() => {
|
|
422
|
-
|
|
457
|
+
xe(ye), Ee().then((e) => {
|
|
458
|
+
se(e), le(!0);
|
|
459
|
+
});
|
|
423
460
|
}, []), e(() => {
|
|
424
|
-
|
|
461
|
+
Ie(R({
|
|
425
462
|
href: m,
|
|
426
463
|
experienceId: p,
|
|
427
464
|
returnUrl: v,
|
|
428
465
|
playerBaseUrl: b,
|
|
429
|
-
useCurrentPageAsReturnUrl:
|
|
466
|
+
useCurrentPageAsReturnUrl: re && !v?.trim()
|
|
430
467
|
}));
|
|
431
468
|
}, [
|
|
432
469
|
m,
|
|
433
470
|
p,
|
|
434
471
|
v,
|
|
435
472
|
b,
|
|
436
|
-
|
|
473
|
+
re
|
|
437
474
|
]), e(() => {
|
|
438
|
-
|
|
475
|
+
je(!1), Ne(!1), Fe(!1), we(!1), ue(!1), pe(!1), U(!1);
|
|
439
476
|
}, [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
477
|
+
I?.backgroundImage,
|
|
478
|
+
I?.foregroundImage,
|
|
479
|
+
Le
|
|
443
480
|
]), e(() => {
|
|
444
481
|
let e = A.current;
|
|
445
482
|
if (e) return C(e, (e, t) => {
|
|
446
|
-
|
|
483
|
+
ee(e), P(t);
|
|
447
484
|
});
|
|
448
|
-
}, [
|
|
485
|
+
}, [L, q]), e(() => {
|
|
449
486
|
let e = A.current;
|
|
450
487
|
if (e) {
|
|
451
488
|
if (!T) {
|
|
452
|
-
|
|
489
|
+
ae(!0);
|
|
453
490
|
return;
|
|
454
491
|
}
|
|
455
|
-
return
|
|
456
|
-
e &&
|
|
492
|
+
return fe(e, { onVisibleChange: (e) => {
|
|
493
|
+
e && ae(!0);
|
|
457
494
|
} });
|
|
458
495
|
}
|
|
459
496
|
}, [
|
|
460
497
|
T,
|
|
461
|
-
F,
|
|
462
498
|
I,
|
|
463
|
-
|
|
499
|
+
L,
|
|
500
|
+
q
|
|
464
501
|
]), e(() => {
|
|
465
502
|
let e = A.current;
|
|
466
|
-
if (!(!e || !
|
|
503
|
+
if (!(!e || !z)) return _e(e, {
|
|
467
504
|
onParallax: (e) => {
|
|
468
|
-
|
|
505
|
+
K(!0), j.current || (ve(e), Se(0));
|
|
469
506
|
},
|
|
470
507
|
pointerActive: () => j.current
|
|
471
508
|
});
|
|
472
509
|
}, [
|
|
473
|
-
|
|
474
|
-
F,
|
|
510
|
+
z,
|
|
475
511
|
I,
|
|
476
|
-
|
|
512
|
+
L,
|
|
513
|
+
q
|
|
477
514
|
]);
|
|
478
|
-
let
|
|
479
|
-
if (!
|
|
515
|
+
let Re = (e) => {
|
|
516
|
+
if (!z || G) return;
|
|
480
517
|
let t = e.currentTarget.getBoundingClientRect();
|
|
481
|
-
t.width <= 0 || t.height <= 0 || (
|
|
482
|
-
},
|
|
518
|
+
t.width <= 0 || t.height <= 0 || (ve(((e.clientX - t.left) / t.width - .5) * 2), Se(((e.clientY - t.top) / t.height - .5) * 2));
|
|
519
|
+
}, ze = (e) => {
|
|
483
520
|
let t = j.current;
|
|
484
|
-
j.current = !1,
|
|
485
|
-
},
|
|
486
|
-
if (!
|
|
487
|
-
j.current = !0, e.pointerType === "mouse" &&
|
|
521
|
+
j.current = !1, he(!1), G && t ? (ve(H(e.getBoundingClientRect(), window.innerHeight)), Se(0)) : G || (ve(0), Se(0));
|
|
522
|
+
}, J = (e) => {
|
|
523
|
+
if (!z) return;
|
|
524
|
+
j.current = !0, e.pointerType === "mouse" && he(!0);
|
|
488
525
|
let t = e.currentTarget, n = () => {
|
|
489
|
-
|
|
526
|
+
ze(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
490
527
|
};
|
|
491
528
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
492
|
-
},
|
|
493
|
-
if (_?.(e), !e.defaultPrevented &&
|
|
494
|
-
let t =
|
|
529
|
+
}, Be = (e) => {
|
|
530
|
+
if (_?.(e), !e.defaultPrevented && re && !v?.trim()) {
|
|
531
|
+
let t = R({
|
|
495
532
|
experienceId: p,
|
|
496
533
|
playerBaseUrl: b,
|
|
497
534
|
useCurrentPageAsReturnUrl: !0
|
|
@@ -499,135 +536,154 @@ function we(s) {
|
|
|
499
536
|
t && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && (e.preventDefault(), window.location.assign(t));
|
|
500
537
|
}
|
|
501
538
|
};
|
|
502
|
-
if (!
|
|
503
|
-
let
|
|
539
|
+
if (!I) return null;
|
|
540
|
+
let Ve = z && (W || G), He = B && ce && (Me || Te || Pe), Ue = [
|
|
504
541
|
"liforma-et",
|
|
505
|
-
|
|
542
|
+
ie ? "liforma-et--scene" : "",
|
|
506
543
|
y(w),
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
544
|
+
Ve ? "liforma-et--parallax" : "",
|
|
545
|
+
G ? "liforma-et--scroll-parallax" : "",
|
|
546
|
+
B && !He ? "liforma-et--loading" : "",
|
|
547
|
+
He ? "liforma-et--revealed" : "",
|
|
511
548
|
E
|
|
512
|
-
].filter(Boolean).join(" "),
|
|
513
|
-
"--liforma-et-parallax-x":
|
|
514
|
-
"--liforma-et-parallax-y":
|
|
515
|
-
},
|
|
549
|
+
].filter(Boolean).join(" "), Y = {
|
|
550
|
+
"--liforma-et-parallax-x": ge,
|
|
551
|
+
"--liforma-et-parallax-y": be
|
|
552
|
+
}, We = (e, t) => {
|
|
516
553
|
e.complete && t(!0);
|
|
517
|
-
},
|
|
554
|
+
}, Ge = /* @__PURE__ */ o(i, { children: [
|
|
518
555
|
/* @__PURE__ */ a("span", {
|
|
519
556
|
className: "liforma-et__placeholder",
|
|
520
557
|
"aria-hidden": "true"
|
|
521
558
|
}),
|
|
522
|
-
|
|
523
|
-
className:
|
|
524
|
-
src:
|
|
559
|
+
B && ce && I.backgroundImage ? /* @__PURE__ */ a("img", {
|
|
560
|
+
className: Ae("liforma-et__background", Te),
|
|
561
|
+
src: De(I.backgroundImage, oe),
|
|
525
562
|
alt: "",
|
|
526
563
|
decoding: "async",
|
|
527
564
|
ref: (e) => {
|
|
528
|
-
e &&
|
|
565
|
+
e && We(e, je);
|
|
529
566
|
},
|
|
530
|
-
onLoad: () =>
|
|
531
|
-
onError: () =>
|
|
567
|
+
onLoad: () => je(!0),
|
|
568
|
+
onError: (e) => {
|
|
569
|
+
let t = e.currentTarget, n = ke(t.src);
|
|
570
|
+
if (n && !V) {
|
|
571
|
+
ue(!0), t.src = n;
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
je(!0);
|
|
575
|
+
}
|
|
532
576
|
}) : null,
|
|
533
|
-
|
|
534
|
-
className:
|
|
535
|
-
src:
|
|
577
|
+
B && ce && Le ? /* @__PURE__ */ a("img", {
|
|
578
|
+
className: Ae("liforma-et__avatar", Me),
|
|
579
|
+
src: De(Le, oe),
|
|
536
580
|
alt: "",
|
|
537
581
|
decoding: "async",
|
|
538
582
|
ref: (e) => {
|
|
539
|
-
e &&
|
|
583
|
+
e && We(e, Ne);
|
|
540
584
|
},
|
|
541
|
-
onLoad: () =>
|
|
542
|
-
onError: () => {
|
|
543
|
-
|
|
585
|
+
onLoad: () => Ne(!0),
|
|
586
|
+
onError: (e) => {
|
|
587
|
+
let t = e.currentTarget, n = Oe(t.src);
|
|
588
|
+
if (n && !me) {
|
|
589
|
+
U(!0), t.src = n;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
I.fallbackImage ? we(!0) : Ne(!0);
|
|
544
593
|
}
|
|
545
594
|
}) : null,
|
|
546
|
-
|
|
547
|
-
className:
|
|
548
|
-
src:
|
|
595
|
+
B && ce && I.foregroundImage ? /* @__PURE__ */ a("img", {
|
|
596
|
+
className: Ae("liforma-et__foreground", Pe),
|
|
597
|
+
src: De(I.foregroundImage, oe),
|
|
549
598
|
alt: "",
|
|
550
599
|
decoding: "async",
|
|
551
600
|
ref: (e) => {
|
|
552
|
-
e &&
|
|
601
|
+
e && We(e, Fe);
|
|
553
602
|
},
|
|
554
|
-
onLoad: () =>
|
|
555
|
-
onError: () =>
|
|
603
|
+
onLoad: () => Fe(!0),
|
|
604
|
+
onError: (e) => {
|
|
605
|
+
let t = e.currentTarget, n = ke(t.src);
|
|
606
|
+
if (n && !de) {
|
|
607
|
+
pe(!0), t.src = n;
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
Fe(!0);
|
|
611
|
+
}
|
|
556
612
|
}) : null
|
|
557
|
-
] }),
|
|
558
|
-
onPointerDown:
|
|
559
|
-
onPointerUp: (e) =>
|
|
560
|
-
onPointerCancel: (e) =>
|
|
613
|
+
] }), Ke = {
|
|
614
|
+
onPointerDown: J,
|
|
615
|
+
onPointerUp: (e) => ze(e.currentTarget),
|
|
616
|
+
onPointerCancel: (e) => ze(e.currentTarget),
|
|
561
617
|
onPointerEnter: (e) => {
|
|
562
|
-
|
|
618
|
+
z && e.pointerType === "mouse" && he(!0);
|
|
563
619
|
},
|
|
564
|
-
onPointerMove:
|
|
620
|
+
onPointerMove: Re,
|
|
565
621
|
onPointerLeave: () => {
|
|
566
|
-
j.current || (
|
|
622
|
+
j.current || (he(!1), G || (ve(0), Se(0)));
|
|
567
623
|
}
|
|
568
|
-
},
|
|
624
|
+
}, qe = (e) => {
|
|
569
625
|
A.current = e;
|
|
570
626
|
};
|
|
571
|
-
return
|
|
572
|
-
ref:
|
|
573
|
-
className:
|
|
574
|
-
style:
|
|
575
|
-
href:
|
|
627
|
+
return L === "anchor" && q ? /* @__PURE__ */ a("a", {
|
|
628
|
+
ref: qe,
|
|
629
|
+
className: Ue,
|
|
630
|
+
style: Y,
|
|
631
|
+
href: q,
|
|
576
632
|
target: h,
|
|
577
633
|
rel: g,
|
|
578
634
|
"aria-label": f,
|
|
579
|
-
onClick:
|
|
580
|
-
...
|
|
581
|
-
children:
|
|
582
|
-
}) :
|
|
635
|
+
onClick: Be,
|
|
636
|
+
...Ke,
|
|
637
|
+
children: Ge
|
|
638
|
+
}) : L === "button" ? /* @__PURE__ */ a("button", {
|
|
583
639
|
type: "button",
|
|
584
|
-
ref:
|
|
585
|
-
className:
|
|
586
|
-
style:
|
|
640
|
+
ref: qe,
|
|
641
|
+
className: Ue,
|
|
642
|
+
style: Y,
|
|
587
643
|
"aria-label": f,
|
|
588
|
-
onClick:
|
|
589
|
-
...
|
|
590
|
-
children:
|
|
644
|
+
onClick: Be,
|
|
645
|
+
...Ke,
|
|
646
|
+
children: Ge
|
|
591
647
|
}) : /* @__PURE__ */ a("div", {
|
|
592
|
-
ref:
|
|
593
|
-
className:
|
|
594
|
-
style:
|
|
648
|
+
ref: qe,
|
|
649
|
+
className: Ue,
|
|
650
|
+
style: Y,
|
|
595
651
|
role: f ? "img" : void 0,
|
|
596
652
|
"aria-label": f || void 0,
|
|
597
653
|
"aria-hidden": f ? void 0 : !0,
|
|
598
|
-
...
|
|
599
|
-
children:
|
|
654
|
+
...Ke,
|
|
655
|
+
children: Ge
|
|
600
656
|
});
|
|
601
657
|
}
|
|
602
658
|
//#endregion
|
|
603
659
|
//#region src/widget/styles.ts
|
|
604
|
-
var Te = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", Ee = "liforma-experience-widget-styles";
|
|
605
|
-
function
|
|
660
|
+
var Me = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", Ne = "liforma-experience-widget-styles";
|
|
661
|
+
function Pe(e = Me) {
|
|
606
662
|
if (typeof document > "u") return;
|
|
607
|
-
let t = document.getElementById(
|
|
663
|
+
let t = document.getElementById(Ne);
|
|
608
664
|
if (t) {
|
|
609
665
|
t.textContent = e;
|
|
610
666
|
return;
|
|
611
667
|
}
|
|
612
668
|
let n = document.createElement("style");
|
|
613
|
-
n.id =
|
|
669
|
+
n.id = Ne, n.textContent = e, document.head.append(n);
|
|
614
670
|
}
|
|
615
671
|
//#endregion
|
|
616
672
|
//#region src/shims/apiBaseUrl.ts
|
|
617
|
-
var
|
|
618
|
-
function
|
|
673
|
+
var Fe = "https://api.liforma.ai", q = "http://localhost:3001";
|
|
674
|
+
function Ie() {
|
|
619
675
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
620
676
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
621
677
|
if (typeof document > "u") return null;
|
|
622
678
|
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();
|
|
623
679
|
return t ? t.replace(/\/$/, "") : null;
|
|
624
680
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
681
|
+
function Le() {
|
|
682
|
+
return Ie() || (te() ? q : Fe);
|
|
627
683
|
}
|
|
628
684
|
//#endregion
|
|
629
685
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
630
|
-
function
|
|
686
|
+
function Re(e) {
|
|
631
687
|
if (!e || typeof e != "object") return null;
|
|
632
688
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
633
689
|
return n ? {
|
|
@@ -636,10 +692,10 @@ function je(e) {
|
|
|
636
692
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
637
693
|
} : null;
|
|
638
694
|
}
|
|
639
|
-
async function
|
|
695
|
+
async function ze(e, t) {
|
|
640
696
|
let n = e.trim();
|
|
641
697
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
642
|
-
let r = (t?.apiBaseUrl ??
|
|
698
|
+
let r = (t?.apiBaseUrl ?? Le()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
643
699
|
method: "GET",
|
|
644
700
|
headers: { Accept: "application/json" },
|
|
645
701
|
signal: t?.signal
|
|
@@ -659,7 +715,7 @@ async function Me(e, t) {
|
|
|
659
715
|
throw Error("Experience preview returned invalid JSON.");
|
|
660
716
|
}
|
|
661
717
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
662
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
718
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Re(o.galleryThumb);
|
|
663
719
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
664
720
|
return {
|
|
665
721
|
experienceId: s || n,
|
|
@@ -669,7 +725,7 @@ async function Me(e, t) {
|
|
|
669
725
|
}
|
|
670
726
|
//#endregion
|
|
671
727
|
//#region src/v2/errors/LiformaError.ts
|
|
672
|
-
var
|
|
728
|
+
var J = class extends Error {
|
|
673
729
|
code;
|
|
674
730
|
requestId;
|
|
675
731
|
status;
|
|
@@ -678,16 +734,16 @@ var q = class extends Error {
|
|
|
678
734
|
super(e, t?.cause === void 0 ? void 0 : { cause: t.cause }), this.name = "LiformaError", this.code = t?.code?.trim() || "UNKNOWN", this.requestId = t?.requestId?.trim() || void 0, this.status = t?.status, this.details = t?.details;
|
|
679
735
|
}
|
|
680
736
|
};
|
|
681
|
-
function
|
|
737
|
+
function Be(e) {
|
|
682
738
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
683
739
|
}
|
|
684
|
-
function
|
|
740
|
+
function Ve(e, t, n) {
|
|
685
741
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
686
742
|
try {
|
|
687
743
|
i = JSON.parse(t);
|
|
688
744
|
} catch {}
|
|
689
|
-
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 } =
|
|
690
|
-
return new
|
|
745
|
+
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) ?? {};
|
|
746
|
+
return new J(u, {
|
|
691
747
|
code: l,
|
|
692
748
|
requestId: d,
|
|
693
749
|
status: e,
|
|
@@ -696,37 +752,37 @@ function Pe(e, t, n) {
|
|
|
696
752
|
}
|
|
697
753
|
//#endregion
|
|
698
754
|
//#region src/v2/api/captureAttribution.ts
|
|
699
|
-
var
|
|
700
|
-
function
|
|
755
|
+
var He = 128, Ue = /[\u0000-\u001f\u007f]/g;
|
|
756
|
+
function Y(e) {
|
|
701
757
|
if (!e) return;
|
|
702
|
-
let t = e.replace(
|
|
703
|
-
if (t) return t.slice(0,
|
|
758
|
+
let t = e.replace(Ue, "").trim();
|
|
759
|
+
if (t) return t.slice(0, He);
|
|
704
760
|
}
|
|
705
|
-
function
|
|
761
|
+
function We(e) {
|
|
706
762
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
707
763
|
return {
|
|
708
|
-
...
|
|
709
|
-
...
|
|
710
|
-
...
|
|
711
|
-
...
|
|
712
|
-
...
|
|
764
|
+
...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
|
|
765
|
+
...Y(t.get("utm_medium")) ? { utmMedium: Y(t.get("utm_medium")) } : {},
|
|
766
|
+
...Y(t.get("utm_campaign")) ? { utmCampaign: Y(t.get("utm_campaign")) } : {},
|
|
767
|
+
...Y(t.get("utm_content")) ? { utmContent: Y(t.get("utm_content")) } : {},
|
|
768
|
+
...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
|
|
713
769
|
};
|
|
714
770
|
}
|
|
715
|
-
function
|
|
771
|
+
function Ge(e) {
|
|
716
772
|
if (e === !1) return;
|
|
717
773
|
if (e && typeof e == "object") {
|
|
718
774
|
let t = {
|
|
719
|
-
...
|
|
720
|
-
...
|
|
721
|
-
...
|
|
722
|
-
...
|
|
723
|
-
...
|
|
724
|
-
...
|
|
775
|
+
...Y(e.utmSource) ? { utmSource: Y(e.utmSource) } : {},
|
|
776
|
+
...Y(e.utmMedium) ? { utmMedium: Y(e.utmMedium) } : {},
|
|
777
|
+
...Y(e.utmCampaign) ? { utmCampaign: Y(e.utmCampaign) } : {},
|
|
778
|
+
...Y(e.utmContent) ? { utmContent: Y(e.utmContent) } : {},
|
|
779
|
+
...Y(e.utmTerm) ? { utmTerm: Y(e.utmTerm) } : {},
|
|
780
|
+
...Y(e.referrer) ? { referrer: Y(e.referrer) } : {}
|
|
725
781
|
};
|
|
726
782
|
return Object.keys(t).length ? t : void 0;
|
|
727
783
|
}
|
|
728
784
|
if (typeof window > "u") return;
|
|
729
|
-
let t =
|
|
785
|
+
let t = We(window.location?.search), n = Y(document.referrer || void 0), r = {
|
|
730
786
|
...t,
|
|
731
787
|
...n ? { referrer: n } : {}
|
|
732
788
|
};
|
|
@@ -734,19 +790,19 @@ function Re(e) {
|
|
|
734
790
|
}
|
|
735
791
|
//#endregion
|
|
736
792
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
737
|
-
function
|
|
793
|
+
function Ke(e) {
|
|
738
794
|
let t = e.locale?.trim();
|
|
739
795
|
if (t) return t;
|
|
740
796
|
let n = e.language?.trim();
|
|
741
797
|
if (n) return n;
|
|
742
798
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
743
799
|
}
|
|
744
|
-
function
|
|
800
|
+
function qe(e) {
|
|
745
801
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
746
802
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
747
803
|
return t || n || void 0;
|
|
748
804
|
}
|
|
749
|
-
function
|
|
805
|
+
function Je(e, t) {
|
|
750
806
|
let n = e.trim();
|
|
751
807
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
752
808
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -754,7 +810,7 @@ function Ve(e, t) {
|
|
|
754
810
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
755
811
|
let i = t.experienceId.trim();
|
|
756
812
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
757
|
-
let a =
|
|
813
|
+
let a = Ke(t), o = qe(t), s = t.idempotencyKey?.trim();
|
|
758
814
|
return {
|
|
759
815
|
url: r.toString(),
|
|
760
816
|
init: {
|
|
@@ -773,7 +829,7 @@ function Ve(e, t) {
|
|
|
773
829
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
774
830
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
775
831
|
...(() => {
|
|
776
|
-
let e =
|
|
832
|
+
let e = Ge(t.attribution);
|
|
777
833
|
return e ? { attribution: e } : {};
|
|
778
834
|
})(),
|
|
779
835
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -783,16 +839,19 @@ function Ve(e, t) {
|
|
|
783
839
|
}
|
|
784
840
|
//#endregion
|
|
785
841
|
//#region src/v2/types/sessionLaunch.ts
|
|
786
|
-
function
|
|
842
|
+
function Ye(e, t) {
|
|
843
|
+
return t === void 0 ? {} : { [e]: t };
|
|
844
|
+
}
|
|
845
|
+
function Xe(e) {
|
|
787
846
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
788
847
|
}
|
|
789
848
|
function X(e) {
|
|
790
849
|
return typeof e == "boolean";
|
|
791
850
|
}
|
|
792
|
-
function
|
|
793
|
-
if (!
|
|
851
|
+
function Ze(e) {
|
|
852
|
+
if (!Xe(e)) return null;
|
|
794
853
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
795
|
-
return !
|
|
854
|
+
return !Xe(t) || !Xe(n) || !Xe(r) || !Xe(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
|
|
796
855
|
speech: {
|
|
797
856
|
input: t.input,
|
|
798
857
|
output: t.output,
|
|
@@ -803,8 +862,8 @@ function He(e) {
|
|
|
803
862
|
tools: { enabled: i.enabled }
|
|
804
863
|
};
|
|
805
864
|
}
|
|
806
|
-
function
|
|
807
|
-
return !
|
|
865
|
+
function Qe(e) {
|
|
866
|
+
return !Xe(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
|
|
808
867
|
speech: {
|
|
809
868
|
input: e.speechInput,
|
|
810
869
|
output: e.speechOutput,
|
|
@@ -815,12 +874,12 @@ function Ue(e) {
|
|
|
815
874
|
tools: { enabled: e.tools }
|
|
816
875
|
};
|
|
817
876
|
}
|
|
818
|
-
function
|
|
819
|
-
return
|
|
877
|
+
function $e(e) {
|
|
878
|
+
return Ze(e) ?? Qe(e);
|
|
820
879
|
}
|
|
821
|
-
function
|
|
822
|
-
if (!
|
|
823
|
-
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 =
|
|
880
|
+
function et(e) {
|
|
881
|
+
if (!Xe(e)) throw Error("Session Launch response is missing session.");
|
|
882
|
+
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 = $e(e.capabilities), l = tt(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;
|
|
824
883
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
825
884
|
return {
|
|
826
885
|
id: t,
|
|
@@ -836,11 +895,11 @@ function Ge(e) {
|
|
|
836
895
|
...d ? { createdAt: d } : {}
|
|
837
896
|
};
|
|
838
897
|
}
|
|
839
|
-
function
|
|
898
|
+
function tt(e) {
|
|
840
899
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
841
900
|
let t = [];
|
|
842
901
|
for (let n of e) {
|
|
843
|
-
if (!
|
|
902
|
+
if (!Xe(n)) continue;
|
|
844
903
|
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() : "";
|
|
845
904
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
846
905
|
axis: e,
|
|
@@ -851,104 +910,104 @@ function Ke(e) {
|
|
|
851
910
|
}
|
|
852
911
|
return t.length > 0 ? t : void 0;
|
|
853
912
|
}
|
|
854
|
-
function
|
|
913
|
+
function nt(e) {
|
|
855
914
|
let t = e.localeVoiceFallbacks;
|
|
856
915
|
if (t?.length) for (let e of t) {
|
|
857
916
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
858
917
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
859
918
|
}
|
|
860
919
|
}
|
|
861
|
-
function
|
|
862
|
-
if (!
|
|
920
|
+
function rt(e) {
|
|
921
|
+
if (!Xe(e)) throw Error("Session Launch response must be a JSON object.");
|
|
863
922
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
864
923
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
865
|
-
let n =
|
|
866
|
-
return
|
|
924
|
+
let n = et(e.session);
|
|
925
|
+
return nt(n), {
|
|
867
926
|
session: n,
|
|
868
927
|
launch: t
|
|
869
928
|
};
|
|
870
929
|
}
|
|
871
930
|
//#endregion
|
|
872
931
|
//#region src/v2/api/mintPublicSession.ts
|
|
873
|
-
function
|
|
932
|
+
function it() {
|
|
874
933
|
try {
|
|
875
934
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
876
935
|
} catch {}
|
|
877
936
|
}
|
|
878
|
-
function
|
|
937
|
+
function at(e) {
|
|
879
938
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
880
939
|
}
|
|
881
|
-
function
|
|
882
|
-
let n =
|
|
940
|
+
function ot(e, t) {
|
|
941
|
+
let n = it(), r = at(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
883
942
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
884
943
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
885
944
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
886
|
-
return new
|
|
945
|
+
return new J(`Your origin ${r} is not an allowed origin for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, add ${r} to the list of allowed origins, and ensure “Allow public client-only embeds” is enabled.`, {
|
|
887
946
|
code: "ORIGIN_NOT_ALLOWED",
|
|
888
947
|
requestId: t.requestId,
|
|
889
948
|
status: t.status,
|
|
890
949
|
details: a
|
|
891
950
|
});
|
|
892
951
|
}
|
|
893
|
-
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new
|
|
952
|
+
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new J(`Browser embeds are not enabled for experience ${e}. If you own this experience, sign in to the Liforma developer portal (app.liforma.ai), open Workspace → Settings → Origins, and enable “Allow public client-only embeds”.`, {
|
|
894
953
|
code: "BROWSER_EMBEDS_DISABLED",
|
|
895
954
|
requestId: t.requestId,
|
|
896
955
|
status: t.status,
|
|
897
956
|
details: a
|
|
898
|
-
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new
|
|
957
|
+
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new J(`No playable experience found for “${e}”. Check that the experience id is correct (it should look like exp_…), and that the experience exists and is published in the Liforma developer portal (app.liforma.ai). Deleted, archived, and unpublished experiences cannot be started from a browser embed.`, {
|
|
899
958
|
code: "EXPERIENCE_UNAVAILABLE",
|
|
900
959
|
requestId: t.requestId,
|
|
901
960
|
status: t.status,
|
|
902
961
|
details: a
|
|
903
962
|
}) : t;
|
|
904
963
|
}
|
|
905
|
-
function
|
|
964
|
+
function st(e) {
|
|
906
965
|
let t = e?.locale?.trim();
|
|
907
966
|
if (t) return t;
|
|
908
967
|
let n = e?.language?.trim();
|
|
909
968
|
if (n) return n;
|
|
910
969
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
911
970
|
}
|
|
912
|
-
function
|
|
971
|
+
function ct(e) {
|
|
913
972
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
914
|
-
if (t && n && t !== n) throw new
|
|
973
|
+
if (t && n && t !== n) throw new J("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
915
974
|
return t || n || void 0;
|
|
916
975
|
}
|
|
917
|
-
function
|
|
918
|
-
let n = { experienceId: e }, r =
|
|
976
|
+
function lt(e, t) {
|
|
977
|
+
let n = { experienceId: e }, r = st(t);
|
|
919
978
|
r && (n.locale = r);
|
|
920
|
-
let i =
|
|
979
|
+
let i = ct(t);
|
|
921
980
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
922
|
-
let a =
|
|
981
|
+
let a = Ge(t?.attribution);
|
|
923
982
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
924
983
|
}
|
|
925
|
-
async function
|
|
926
|
-
let n =
|
|
984
|
+
async function ut(e, t) {
|
|
985
|
+
let n = Le(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
927
986
|
method: "POST",
|
|
928
987
|
headers: {
|
|
929
988
|
"Content-Type": "application/json",
|
|
930
989
|
...r ? { "Idempotency-Key": r } : {}
|
|
931
990
|
},
|
|
932
|
-
body: JSON.stringify(
|
|
991
|
+
body: JSON.stringify(lt(e, t))
|
|
933
992
|
});
|
|
934
993
|
if (!i.ok) {
|
|
935
994
|
let t = await i.text();
|
|
936
|
-
throw
|
|
995
|
+
throw ot(e, Ve(i.status, t, i.headers));
|
|
937
996
|
}
|
|
938
997
|
let a;
|
|
939
998
|
try {
|
|
940
999
|
a = await i.json();
|
|
941
1000
|
} catch {
|
|
942
|
-
throw new
|
|
1001
|
+
throw new J("Browser session mint returned invalid JSON.", {
|
|
943
1002
|
code: "INVALID_RESPONSE",
|
|
944
1003
|
status: i.status,
|
|
945
1004
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
946
1005
|
});
|
|
947
1006
|
}
|
|
948
|
-
return
|
|
1007
|
+
return rt(a);
|
|
949
1008
|
}
|
|
950
|
-
async function
|
|
951
|
-
let n =
|
|
1009
|
+
async function dt(e, t) {
|
|
1010
|
+
let n = Je(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
952
1011
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
953
1012
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
954
1013
|
try {
|
|
@@ -961,9 +1020,9 @@ async function nt(e, t) {
|
|
|
961
1020
|
}
|
|
962
1021
|
if (!o.ok) {
|
|
963
1022
|
let e = await o.text();
|
|
964
|
-
throw
|
|
1023
|
+
throw Ve(o.status, e, o.headers);
|
|
965
1024
|
}
|
|
966
|
-
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new
|
|
1025
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new J("Session endpoint must return a JSON Session Launch response.", {
|
|
967
1026
|
code: "INVALID_RESPONSE",
|
|
968
1027
|
status: o.status,
|
|
969
1028
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
@@ -972,20 +1031,20 @@ async function nt(e, t) {
|
|
|
972
1031
|
try {
|
|
973
1032
|
s = await o.json();
|
|
974
1033
|
} catch {
|
|
975
|
-
throw new
|
|
1034
|
+
throw new J("Session endpoint returned invalid JSON.", {
|
|
976
1035
|
code: "INVALID_RESPONSE",
|
|
977
1036
|
status: o.status,
|
|
978
1037
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
979
1038
|
});
|
|
980
1039
|
}
|
|
981
|
-
return
|
|
1040
|
+
return rt(s);
|
|
982
1041
|
}
|
|
983
1042
|
//#endregion
|
|
984
1043
|
//#region src/v2/conversationProcessor.ts
|
|
985
|
-
function
|
|
1044
|
+
function ft(e) {
|
|
986
1045
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
987
1046
|
}
|
|
988
|
-
function
|
|
1047
|
+
function pt(e) {
|
|
989
1048
|
if (typeof e == "string") {
|
|
990
1049
|
let t = e.trim();
|
|
991
1050
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -999,24 +1058,24 @@ function it(e) {
|
|
|
999
1058
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
1000
1059
|
};
|
|
1001
1060
|
}
|
|
1002
|
-
async function
|
|
1061
|
+
async function mt(e, t) {
|
|
1003
1062
|
let n = await e(t);
|
|
1004
|
-
return
|
|
1063
|
+
return ft(n) ? {
|
|
1005
1064
|
kind: "stream",
|
|
1006
1065
|
stream: n
|
|
1007
1066
|
} : {
|
|
1008
1067
|
kind: "complete",
|
|
1009
|
-
speech:
|
|
1068
|
+
speech: pt(n)
|
|
1010
1069
|
};
|
|
1011
1070
|
}
|
|
1012
1071
|
//#endregion
|
|
1013
1072
|
//#region src/v2/embed/playerReachability.ts
|
|
1014
|
-
var
|
|
1015
|
-
function
|
|
1073
|
+
var ht = "3002";
|
|
1074
|
+
function gt(e) {
|
|
1016
1075
|
let t = new URL(e);
|
|
1017
|
-
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 ||
|
|
1076
|
+
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 || ht}. 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.`;
|
|
1018
1077
|
}
|
|
1019
|
-
async function
|
|
1078
|
+
async function _t(e, t) {
|
|
1020
1079
|
try {
|
|
1021
1080
|
await fetch(e, {
|
|
1022
1081
|
method: "GET",
|
|
@@ -1024,25 +1083,25 @@ async function ct(e, t) {
|
|
|
1024
1083
|
signal: AbortSignal.timeout(8e3)
|
|
1025
1084
|
});
|
|
1026
1085
|
} catch {
|
|
1027
|
-
throw Error(
|
|
1086
|
+
throw Error(gt(t));
|
|
1028
1087
|
}
|
|
1029
1088
|
}
|
|
1030
|
-
function
|
|
1089
|
+
function vt(e, t, n, r) {
|
|
1031
1090
|
try {
|
|
1032
1091
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
1033
1092
|
} catch (e) {
|
|
1034
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
1093
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(gt(n), { cause: e }) : e;
|
|
1035
1094
|
}
|
|
1036
1095
|
}
|
|
1037
|
-
var
|
|
1038
|
-
function
|
|
1039
|
-
return typeof e == "number" &&
|
|
1096
|
+
var yt = new Set([1, 2]);
|
|
1097
|
+
function bt(e) {
|
|
1098
|
+
return typeof e == "number" && yt.has(e);
|
|
1040
1099
|
}
|
|
1041
|
-
var
|
|
1042
|
-
function
|
|
1100
|
+
var xt = 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("."));
|
|
1101
|
+
function St(e) {
|
|
1043
1102
|
if (!e || typeof e != "object") return null;
|
|
1044
1103
|
let t = e;
|
|
1045
|
-
if (!
|
|
1104
|
+
if (!bt(t.schemaVersion) || !t.type || !xt.has(t.type)) return null;
|
|
1046
1105
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
1047
1106
|
if (t.type === "fullWindow" || t.type === "theatre") {
|
|
1048
1107
|
let e = t.payload;
|
|
@@ -1065,10 +1124,13 @@ function pt(e) {
|
|
|
1065
1124
|
let n = t.payload;
|
|
1066
1125
|
return !n || typeof n != "object" ? null : t;
|
|
1067
1126
|
}
|
|
1068
|
-
function
|
|
1127
|
+
function Ct(e, t) {
|
|
1128
|
+
return t === void 0 ? {} : { [e]: t };
|
|
1129
|
+
}
|
|
1130
|
+
function wt(e, t, n) {
|
|
1069
1131
|
let r = e.trim();
|
|
1070
1132
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
1071
|
-
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.
|
|
1133
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatre;
|
|
1072
1134
|
return {
|
|
1073
1135
|
type: "launch",
|
|
1074
1136
|
schemaVersion: 2,
|
|
@@ -1079,32 +1141,34 @@ function mt(e, t, n) {
|
|
|
1079
1141
|
...a ? { theme: a } : {},
|
|
1080
1142
|
...o === void 0 ? {} : { showFeedback: o },
|
|
1081
1143
|
...s ? { interaction: s } : {},
|
|
1082
|
-
...
|
|
1083
|
-
...
|
|
1144
|
+
...Ct("settingsButton", n?.settingsButton),
|
|
1145
|
+
...Ct("theatreButton", n?.theatreButton),
|
|
1146
|
+
...Ct("fullscreenButton", n?.fullscreenButton),
|
|
1147
|
+
...c === void 0 ? {} : { theatre: c }
|
|
1084
1148
|
}
|
|
1085
1149
|
};
|
|
1086
1150
|
}
|
|
1087
|
-
function
|
|
1151
|
+
function Tt() {
|
|
1088
1152
|
return {
|
|
1089
1153
|
type: "parentHello",
|
|
1090
1154
|
schemaVersion: 2
|
|
1091
1155
|
};
|
|
1092
1156
|
}
|
|
1093
|
-
function
|
|
1157
|
+
function Et(e) {
|
|
1094
1158
|
return {
|
|
1095
1159
|
type: "widgetSetChrome",
|
|
1096
1160
|
schemaVersion: 2,
|
|
1097
1161
|
payload: { mode: e }
|
|
1098
1162
|
};
|
|
1099
1163
|
}
|
|
1100
|
-
function
|
|
1164
|
+
function Dt() {
|
|
1101
1165
|
return {
|
|
1102
1166
|
type: "widgetToggleAudioSettings",
|
|
1103
1167
|
schemaVersion: 2,
|
|
1104
1168
|
payload: {}
|
|
1105
1169
|
};
|
|
1106
1170
|
}
|
|
1107
|
-
function
|
|
1171
|
+
function Ot(e) {
|
|
1108
1172
|
return {
|
|
1109
1173
|
type: "setTheatre",
|
|
1110
1174
|
schemaVersion: 2,
|
|
@@ -1113,8 +1177,8 @@ function vt(e) {
|
|
|
1113
1177
|
}
|
|
1114
1178
|
//#endregion
|
|
1115
1179
|
//#region src/v2/embed/fullWindowHost.ts
|
|
1116
|
-
var
|
|
1117
|
-
function
|
|
1180
|
+
var kt = "2147483000";
|
|
1181
|
+
function At(e) {
|
|
1118
1182
|
let { style: t } = e;
|
|
1119
1183
|
return {
|
|
1120
1184
|
position: t.position,
|
|
@@ -1132,11 +1196,11 @@ function bt(e) {
|
|
|
1132
1196
|
maxHeight: t.maxHeight
|
|
1133
1197
|
};
|
|
1134
1198
|
}
|
|
1135
|
-
function
|
|
1199
|
+
function jt(e) {
|
|
1136
1200
|
let { style: t } = e;
|
|
1137
|
-
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 =
|
|
1201
|
+
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 = kt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
1138
1202
|
}
|
|
1139
|
-
function
|
|
1203
|
+
function Mt(e, t) {
|
|
1140
1204
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
1141
1205
|
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 = "";
|
|
1142
1206
|
return;
|
|
@@ -1146,20 +1210,20 @@ function St(e, t) {
|
|
|
1146
1210
|
}
|
|
1147
1211
|
//#endregion
|
|
1148
1212
|
//#region src/v2/embed/iframeHost.ts
|
|
1149
|
-
function
|
|
1213
|
+
function Nt(e) {
|
|
1150
1214
|
return e;
|
|
1151
1215
|
}
|
|
1152
1216
|
function Z() {
|
|
1153
1217
|
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)}`;
|
|
1154
1218
|
}
|
|
1155
|
-
var
|
|
1156
|
-
function
|
|
1219
|
+
var Pt = 3e4;
|
|
1220
|
+
function Ft(e) {
|
|
1157
1221
|
let t = e.container;
|
|
1158
1222
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
1159
1223
|
let n = document.createElement("iframe");
|
|
1160
|
-
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");
|
|
1224
|
+
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");
|
|
1161
1225
|
let r = !1, i = !1, a = null, o = null, s = (r) => {
|
|
1162
|
-
i !== r && (i = r, r ? (a =
|
|
1226
|
+
i !== r && (i = r, r ? (a = At(n), o = document.body.style.overflow, document.body.append(n), jt(n), document.body.style.overflow = "hidden") : (t.append(n), Mt(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
|
|
1163
1227
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
1164
1228
|
p = e, m = t;
|
|
1165
1229
|
}), g = () => {
|
|
@@ -1170,10 +1234,10 @@ function Tt(e) {
|
|
|
1170
1234
|
let i = Date.now();
|
|
1171
1235
|
if (d > 0 && i - d < 250) return;
|
|
1172
1236
|
d = i, g();
|
|
1173
|
-
let a =
|
|
1237
|
+
let a = wt(t.launch, t.session, t.chrome), o = () => {
|
|
1174
1238
|
if (r) return;
|
|
1175
1239
|
let t = n.contentWindow;
|
|
1176
|
-
t &&
|
|
1240
|
+
t && vt(t, a, e.playerOrigin);
|
|
1177
1241
|
};
|
|
1178
1242
|
o();
|
|
1179
1243
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -1181,17 +1245,17 @@ function Tt(e) {
|
|
|
1181
1245
|
r || !l || _(l);
|
|
1182
1246
|
}, y = () => {
|
|
1183
1247
|
if (u += 1, u === 1) {
|
|
1184
|
-
|
|
1248
|
+
_t(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
1185
1249
|
return;
|
|
1186
1250
|
}
|
|
1187
1251
|
d = 0, v();
|
|
1188
1252
|
}, b = () => {
|
|
1189
|
-
u > 0 || m?.(Error(
|
|
1253
|
+
u > 0 || m?.(Error(gt(e.playerOrigin)));
|
|
1190
1254
|
};
|
|
1191
1255
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
1192
1256
|
let x = (t) => {
|
|
1193
1257
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
1194
|
-
let i =
|
|
1258
|
+
let i = St(t.data);
|
|
1195
1259
|
if (i) switch (i.type) {
|
|
1196
1260
|
case "close":
|
|
1197
1261
|
e.onClose?.(i.payload);
|
|
@@ -1230,7 +1294,7 @@ function Tt(e) {
|
|
|
1230
1294
|
e.onUserSpeechEnded?.(i.payload);
|
|
1231
1295
|
break;
|
|
1232
1296
|
case "modeChange":
|
|
1233
|
-
e.onActivityChange?.(
|
|
1297
|
+
e.onActivityChange?.(Nt(i.payload.mode));
|
|
1234
1298
|
break;
|
|
1235
1299
|
case "activityChange":
|
|
1236
1300
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -1289,8 +1353,8 @@ function Tt(e) {
|
|
|
1289
1353
|
let S = (t, i) => {
|
|
1290
1354
|
if (r) return;
|
|
1291
1355
|
let a = n.contentWindow;
|
|
1292
|
-
if (!a) throw Error(
|
|
1293
|
-
|
|
1356
|
+
if (!a) throw Error(gt(e.playerOrigin));
|
|
1357
|
+
vt(a, t, e.playerOrigin, i);
|
|
1294
1358
|
}, C = (e, t = 12e4, n) => {
|
|
1295
1359
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
|
|
1296
1360
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -1307,7 +1371,7 @@ function Tt(e) {
|
|
|
1307
1371
|
return h;
|
|
1308
1372
|
},
|
|
1309
1373
|
postParentHello() {
|
|
1310
|
-
S(
|
|
1374
|
+
S(Tt());
|
|
1311
1375
|
},
|
|
1312
1376
|
postLaunch(e, t, n) {
|
|
1313
1377
|
r || (l = {
|
|
@@ -1329,13 +1393,13 @@ function Tt(e) {
|
|
|
1329
1393
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
1330
1394
|
},
|
|
1331
1395
|
postWidgetSetChrome(e) {
|
|
1332
|
-
S(
|
|
1396
|
+
S(Et(e));
|
|
1333
1397
|
},
|
|
1334
1398
|
postWidgetToggleAudioSettings() {
|
|
1335
|
-
S(
|
|
1399
|
+
S(Dt());
|
|
1336
1400
|
},
|
|
1337
1401
|
postSetTheatre(e) {
|
|
1338
|
-
S(
|
|
1402
|
+
S(Ot(e));
|
|
1339
1403
|
},
|
|
1340
1404
|
speak(e) {
|
|
1341
1405
|
return C({
|
|
@@ -1457,7 +1521,7 @@ function Tt(e) {
|
|
|
1457
1521
|
audio: e.audio,
|
|
1458
1522
|
byteLength: e.byteLength
|
|
1459
1523
|
}
|
|
1460
|
-
},
|
|
1524
|
+
}, Pt, [e.audio]);
|
|
1461
1525
|
},
|
|
1462
1526
|
speechUtteranceSetTranscript(e) {
|
|
1463
1527
|
return C({
|
|
@@ -1619,7 +1683,7 @@ function Tt(e) {
|
|
|
1619
1683
|
}
|
|
1620
1684
|
//#endregion
|
|
1621
1685
|
//#region src/v2/embed/readyGate.ts
|
|
1622
|
-
function
|
|
1686
|
+
function It(e) {
|
|
1623
1687
|
let t, n = !1, r = !1, i = () => {
|
|
1624
1688
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
1625
1689
|
};
|
|
@@ -1634,9 +1698,9 @@ function Et(e) {
|
|
|
1634
1698
|
}
|
|
1635
1699
|
//#endregion
|
|
1636
1700
|
//#region src/v2/sdkRelease.ts
|
|
1637
|
-
var
|
|
1701
|
+
var Lt = `sdk@${{
|
|
1638
1702
|
name: "@liforma/client",
|
|
1639
|
-
version: "0.4.
|
|
1703
|
+
version: "0.4.15",
|
|
1640
1704
|
type: "module",
|
|
1641
1705
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1642
1706
|
license: "MIT",
|
|
@@ -1797,6 +1861,8 @@ var Dt = `sdk@${{
|
|
|
1797
1861
|
"generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
|
|
1798
1862
|
"build:locations": "node scripts/build-locations.mjs",
|
|
1799
1863
|
"publish:locations": "node scripts/publish-locations.mjs",
|
|
1864
|
+
"publish:location-400x225": "node scripts/build-location-400x225.mjs",
|
|
1865
|
+
"test:location-400x225": "node scripts/test-location-400x225.mjs",
|
|
1800
1866
|
"verify:locations": "node scripts/verify-location-sources.mjs",
|
|
1801
1867
|
"publish:models": "node scripts/publish-models.mjs",
|
|
1802
1868
|
"publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
|
|
@@ -1826,6 +1892,7 @@ var Dt = `sdk@${{
|
|
|
1826
1892
|
"preview:test": "npm run build && npm run preview"
|
|
1827
1893
|
},
|
|
1828
1894
|
dependencies: {
|
|
1895
|
+
"@jsquash/avif": "^1.3.0",
|
|
1829
1896
|
"@jsquash/webp": "^1.5.0",
|
|
1830
1897
|
zod: "^4.4.3"
|
|
1831
1898
|
},
|
|
@@ -1855,50 +1922,54 @@ var Dt = `sdk@${{
|
|
|
1855
1922
|
vitest: "^4.1.10",
|
|
1856
1923
|
wrangler: "^4.101.0"
|
|
1857
1924
|
}
|
|
1858
|
-
}.version}`,
|
|
1859
|
-
function
|
|
1925
|
+
}.version}`, Rt = "https://player.liforma.ai/embed", zt = "http://localhost:3002/embed";
|
|
1926
|
+
function Bt() {
|
|
1860
1927
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1861
1928
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1862
1929
|
if (typeof document > "u") return null;
|
|
1863
1930
|
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();
|
|
1864
1931
|
return t ? t.replace(/\/$/, "") : null;
|
|
1865
1932
|
}
|
|
1866
|
-
function
|
|
1867
|
-
let e =
|
|
1868
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
1933
|
+
function Vt() {
|
|
1934
|
+
let e = Bt();
|
|
1935
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : te() ? zt : Rt;
|
|
1869
1936
|
}
|
|
1870
|
-
function
|
|
1937
|
+
function Ht(e, t) {
|
|
1871
1938
|
return e?.trim() || t?.trim() || void 0;
|
|
1872
1939
|
}
|
|
1873
|
-
function
|
|
1874
|
-
let
|
|
1875
|
-
|
|
1876
|
-
let
|
|
1877
|
-
|
|
1940
|
+
function Ut(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
1941
|
+
let p = (e ?? Vt()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
|
|
1942
|
+
g && h.searchParams.set("backdropId", g);
|
|
1943
|
+
let _ = r?.trim();
|
|
1944
|
+
_ && h.searchParams.set("avatarId", _);
|
|
1945
|
+
let v = d?.trim();
|
|
1946
|
+
v && h.searchParams.set("previewBg", v);
|
|
1947
|
+
let y = f?.trim();
|
|
1948
|
+
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)), Wt(h.toString());
|
|
1878
1949
|
}
|
|
1879
|
-
function
|
|
1950
|
+
function Wt(e) {
|
|
1880
1951
|
if (typeof location > "u") return e;
|
|
1881
1952
|
let t = new URL(e);
|
|
1882
1953
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1883
1954
|
}
|
|
1884
|
-
function
|
|
1955
|
+
function Gt(e) {
|
|
1885
1956
|
return new URL(e).origin;
|
|
1886
1957
|
}
|
|
1887
1958
|
//#endregion
|
|
1888
1959
|
//#region src/v2/experienceEvents.ts
|
|
1889
|
-
function
|
|
1960
|
+
function Kt() {
|
|
1890
1961
|
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)}`;
|
|
1891
1962
|
}
|
|
1892
|
-
function
|
|
1963
|
+
function qt(e, t, n) {
|
|
1893
1964
|
return {
|
|
1894
|
-
id:
|
|
1965
|
+
id: Kt(),
|
|
1895
1966
|
type: e,
|
|
1896
1967
|
sessionId: t,
|
|
1897
1968
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1898
1969
|
data: n
|
|
1899
1970
|
};
|
|
1900
1971
|
}
|
|
1901
|
-
function
|
|
1972
|
+
function Jt() {
|
|
1902
1973
|
return {
|
|
1903
1974
|
ready: /* @__PURE__ */ new Set(),
|
|
1904
1975
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1919,39 +1990,39 @@ function Rt() {
|
|
|
1919
1990
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1920
1991
|
};
|
|
1921
1992
|
}
|
|
1922
|
-
function
|
|
1993
|
+
function Yt(e, t, n) {
|
|
1923
1994
|
return e[t].add(n), () => e[t].delete(n);
|
|
1924
1995
|
}
|
|
1925
|
-
function
|
|
1996
|
+
function Xt(e, t, n) {
|
|
1926
1997
|
for (let r of e[t]) r(n);
|
|
1927
1998
|
}
|
|
1928
|
-
function
|
|
1999
|
+
function Zt(e) {
|
|
1929
2000
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1930
2001
|
}
|
|
1931
2002
|
//#endregion
|
|
1932
2003
|
//#region src/v2/speech/types.ts
|
|
1933
|
-
function
|
|
2004
|
+
function Qt(e) {
|
|
1934
2005
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1935
2006
|
}
|
|
1936
|
-
function
|
|
2007
|
+
function $t(e) {
|
|
1937
2008
|
return "url" in e && typeof e.url == "string";
|
|
1938
2009
|
}
|
|
1939
|
-
function
|
|
2010
|
+
function en(e) {
|
|
1940
2011
|
if (!("track" in e)) return !1;
|
|
1941
2012
|
let t = e.track;
|
|
1942
2013
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1943
2014
|
}
|
|
1944
|
-
function
|
|
1945
|
-
return !
|
|
2015
|
+
function tn(e) {
|
|
2016
|
+
return !Qt(e) && !$t(e) && !en(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1946
2017
|
}
|
|
1947
|
-
var
|
|
2018
|
+
var nn = [
|
|
1948
2019
|
8e3,
|
|
1949
2020
|
16e3,
|
|
1950
2021
|
22050,
|
|
1951
2022
|
24e3,
|
|
1952
2023
|
44100,
|
|
1953
2024
|
48e3
|
|
1954
|
-
],
|
|
2025
|
+
], rn = {
|
|
1955
2026
|
MAX_CHUNK_BYTES: 64 * 1024,
|
|
1956
2027
|
RECOMMENDED_CHUNK_MS_MIN: 20,
|
|
1957
2028
|
RECOMMENDED_CHUNK_MS_MAX: 200,
|
|
@@ -1962,14 +2033,14 @@ var Kt = [
|
|
|
1962
2033
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1963
2034
|
MAX_PENDING_WRITES: 8,
|
|
1964
2035
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1965
|
-
},
|
|
2036
|
+
}, an = class extends Error {
|
|
1966
2037
|
operation;
|
|
1967
2038
|
requiredCapability;
|
|
1968
2039
|
name = "UnsupportedSpeechOperationError";
|
|
1969
2040
|
constructor(e, t) {
|
|
1970
2041
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1971
2042
|
}
|
|
1972
|
-
},
|
|
2043
|
+
}, on = class extends Error {
|
|
1973
2044
|
name = "SpeechUtteranceClosedError";
|
|
1974
2045
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1975
2046
|
super(e);
|
|
@@ -1979,72 +2050,72 @@ var Kt = [
|
|
|
1979
2050
|
constructor(e, t) {
|
|
1980
2051
|
super(e, t);
|
|
1981
2052
|
}
|
|
1982
|
-
},
|
|
2053
|
+
}, sn = class extends Error {
|
|
1983
2054
|
name = "SpeechBufferTimeoutError";
|
|
1984
2055
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1985
2056
|
super(e);
|
|
1986
2057
|
}
|
|
1987
2058
|
};
|
|
1988
|
-
function
|
|
2059
|
+
function cn(e = "none") {
|
|
1989
2060
|
return {
|
|
1990
2061
|
mode: e,
|
|
1991
2062
|
trackedDurationMs: 0,
|
|
1992
2063
|
fallbackDurationMs: 0
|
|
1993
2064
|
};
|
|
1994
2065
|
}
|
|
1995
|
-
function
|
|
1996
|
-
return
|
|
2066
|
+
function ln(e) {
|
|
2067
|
+
return nn.includes(e);
|
|
1997
2068
|
}
|
|
1998
|
-
function
|
|
2069
|
+
function un(e) {
|
|
1999
2070
|
if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
|
|
2000
2071
|
if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
|
|
2001
|
-
if (!
|
|
2072
|
+
if (!ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2002
2073
|
}
|
|
2003
|
-
function
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
2074
|
+
function dn(e) {
|
|
2075
|
+
if (Qt(e)) {
|
|
2076
|
+
un(e.format);
|
|
2006
2077
|
return;
|
|
2007
2078
|
}
|
|
2008
|
-
if (
|
|
2079
|
+
if ($t(e)) {
|
|
2009
2080
|
if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
|
|
2010
|
-
if (e.sampleRate !== void 0 && !
|
|
2081
|
+
if (e.sampleRate !== void 0 && !ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2011
2082
|
return;
|
|
2012
2083
|
}
|
|
2013
|
-
if (
|
|
2084
|
+
if (en(e)) {
|
|
2014
2085
|
if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
2015
|
-
if (e.sampleRate !== void 0 && !
|
|
2086
|
+
if (e.sampleRate !== void 0 && !ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2016
2087
|
return;
|
|
2017
2088
|
}
|
|
2018
|
-
if (
|
|
2089
|
+
if (tn(e)) {
|
|
2019
2090
|
let t = e.encoding.trim().toLowerCase();
|
|
2020
2091
|
if (!t) throw new Q("Encoded audio MIME type is required.");
|
|
2021
2092
|
if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
2022
|
-
if (e.sampleRate !== void 0 && !
|
|
2093
|
+
if (e.sampleRate !== void 0 && !ln(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2023
2094
|
return;
|
|
2024
2095
|
}
|
|
2025
2096
|
throw new Q("Unsupported speech.play audio shape.");
|
|
2026
2097
|
}
|
|
2027
|
-
function
|
|
2028
|
-
if (e.format) return
|
|
2098
|
+
function fn(e) {
|
|
2099
|
+
if (e.format) return un(e.format), e.format;
|
|
2029
2100
|
if (e.track) {
|
|
2030
2101
|
let t = {
|
|
2031
2102
|
encoding: "pcm_s16le",
|
|
2032
2103
|
sampleRate: e.sampleRate ?? 24e3,
|
|
2033
2104
|
channels: 1
|
|
2034
2105
|
};
|
|
2035
|
-
return
|
|
2106
|
+
return un(t), t;
|
|
2036
2107
|
}
|
|
2037
2108
|
throw new Q("createUtterance requires format or track.");
|
|
2038
2109
|
}
|
|
2039
|
-
function
|
|
2110
|
+
function pn(e) {
|
|
2040
2111
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2041
2112
|
}
|
|
2042
|
-
function
|
|
2113
|
+
function mn(e) {
|
|
2043
2114
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
2044
2115
|
}
|
|
2045
2116
|
//#endregion
|
|
2046
2117
|
//#region src/byo/pcm.ts
|
|
2047
|
-
function
|
|
2118
|
+
function hn(e) {
|
|
2048
2119
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
2049
2120
|
for (let t = 0; t < e.length; t++) {
|
|
2050
2121
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -2054,11 +2125,11 @@ function an(e) {
|
|
|
2054
2125
|
}
|
|
2055
2126
|
//#endregion
|
|
2056
2127
|
//#region src/byo/resample.ts
|
|
2057
|
-
function
|
|
2128
|
+
function gn(e, t, n, r, i) {
|
|
2058
2129
|
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;
|
|
2059
2130
|
return ((a * i + o) * i + s) * i + c;
|
|
2060
2131
|
}
|
|
2061
|
-
function
|
|
2132
|
+
function _n(e, t) {
|
|
2062
2133
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
2063
2134
|
if (e === t) return {
|
|
2064
2135
|
fromRate: e,
|
|
@@ -2081,7 +2152,7 @@ function sn(e, t) {
|
|
|
2081
2152
|
let a = [];
|
|
2082
2153
|
for (; i + 2 < r.length - 1;) {
|
|
2083
2154
|
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);
|
|
2084
|
-
a.push(
|
|
2155
|
+
a.push(gn(r[o], r[e], r[s], r[c], t)), i += n;
|
|
2085
2156
|
}
|
|
2086
2157
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
2087
2158
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -2093,7 +2164,7 @@ function sn(e, t) {
|
|
|
2093
2164
|
}
|
|
2094
2165
|
//#endregion
|
|
2095
2166
|
//#region src/byo/audioCapture.ts
|
|
2096
|
-
var
|
|
2167
|
+
var vn = "liforma-pcm-capture", yn = `
|
|
2097
2168
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
2098
2169
|
process(inputs) {
|
|
2099
2170
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -2105,29 +2176,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
2105
2176
|
return true;
|
|
2106
2177
|
}
|
|
2107
2178
|
}
|
|
2108
|
-
registerProcessor('${
|
|
2109
|
-
`,
|
|
2110
|
-
function
|
|
2111
|
-
return
|
|
2179
|
+
registerProcessor('${vn}', LiformaPcmCaptureProcessor);
|
|
2180
|
+
`, bn = null;
|
|
2181
|
+
function xn() {
|
|
2182
|
+
return bn ||= URL.createObjectURL(new Blob([yn], { type: "application/javascript" })), bn;
|
|
2112
2183
|
}
|
|
2113
|
-
function
|
|
2184
|
+
function Sn() {
|
|
2114
2185
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
2115
2186
|
}
|
|
2116
|
-
async function
|
|
2117
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
2187
|
+
async function Cn(e) {
|
|
2188
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Sn();
|
|
2118
2189
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
2119
2190
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
2120
2191
|
l.gain.value = 0;
|
|
2121
|
-
let u = s.sampleRate, d =
|
|
2192
|
+
let u = s.sampleRate, d = _n(u, n), f = !1, p = !1, m = (e) => {
|
|
2122
2193
|
if (f || i && !i()) return;
|
|
2123
2194
|
let t = d.push(e);
|
|
2124
|
-
t.length !== 0 && r(
|
|
2195
|
+
t.length !== 0 && r(hn(t));
|
|
2125
2196
|
}, h = () => void 0;
|
|
2126
2197
|
return await (async () => {
|
|
2127
2198
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
2128
2199
|
try {
|
|
2129
|
-
await s.audioWorklet.addModule(
|
|
2130
|
-
let e = new AudioWorkletNode(s,
|
|
2200
|
+
await s.audioWorklet.addModule(xn());
|
|
2201
|
+
let e = new AudioWorkletNode(s, vn, {
|
|
2131
2202
|
numberOfInputs: 1,
|
|
2132
2203
|
numberOfOutputs: 1,
|
|
2133
2204
|
outputChannelCount: [1]
|
|
@@ -2177,7 +2248,7 @@ async function pn(e) {
|
|
|
2177
2248
|
}
|
|
2178
2249
|
//#endregion
|
|
2179
2250
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
2180
|
-
async function
|
|
2251
|
+
async function wn(e) {
|
|
2181
2252
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
2182
2253
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
|
|
2183
2254
|
if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -2186,18 +2257,18 @@ async function mn(e) {
|
|
|
2186
2257
|
s || (s = !0, c?.stop(), c = null);
|
|
2187
2258
|
};
|
|
2188
2259
|
try {
|
|
2189
|
-
c = await
|
|
2260
|
+
c = await Cn({
|
|
2190
2261
|
mediaStream: a,
|
|
2191
2262
|
targetSampleRate: r,
|
|
2192
2263
|
shouldSend: () => !s && !i?.aborted,
|
|
2193
2264
|
onPcm: (e) => {
|
|
2194
2265
|
if (s || i?.aborted) return;
|
|
2195
|
-
let t =
|
|
2266
|
+
let t = pn(e);
|
|
2196
2267
|
o = o.then(async () => {
|
|
2197
2268
|
if (s || i?.aborted) return;
|
|
2198
2269
|
let e = 0;
|
|
2199
2270
|
for (; e < t.byteLength;) {
|
|
2200
|
-
let r = Math.min(e +
|
|
2271
|
+
let r = Math.min(e + rn.MAX_CHUNK_BYTES, t.byteLength);
|
|
2201
2272
|
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
2202
2273
|
let i = t.subarray(e, r);
|
|
2203
2274
|
e = r, i.byteLength !== 0 && await n.write(i);
|
|
@@ -2221,10 +2292,10 @@ async function mn(e) {
|
|
|
2221
2292
|
}
|
|
2222
2293
|
//#endregion
|
|
2223
2294
|
//#region src/v2/speech/speechController.ts
|
|
2224
|
-
async function
|
|
2225
|
-
if (
|
|
2226
|
-
if (
|
|
2227
|
-
let t =
|
|
2295
|
+
async function Tn(e, t) {
|
|
2296
|
+
if (en(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
|
|
2297
|
+
if (Qt(e)) {
|
|
2298
|
+
let t = pn(e.data);
|
|
2228
2299
|
if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
|
|
2229
2300
|
return {
|
|
2230
2301
|
kind: "pcm",
|
|
@@ -2232,17 +2303,17 @@ async function hn(e, t) {
|
|
|
2232
2303
|
format: e.format
|
|
2233
2304
|
};
|
|
2234
2305
|
}
|
|
2235
|
-
if (
|
|
2306
|
+
if ($t(e)) return {
|
|
2236
2307
|
kind: "url",
|
|
2237
2308
|
url: e.url.trim(),
|
|
2238
2309
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2239
2310
|
};
|
|
2240
|
-
if (!
|
|
2311
|
+
if (!tn(e)) throw new Q("Unsupported speech.play audio shape.");
|
|
2241
2312
|
let n;
|
|
2242
2313
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
2243
2314
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2244
2315
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
2245
|
-
} else n =
|
|
2316
|
+
} else n = pn(e.data);
|
|
2246
2317
|
return {
|
|
2247
2318
|
kind: "encoded",
|
|
2248
2319
|
data: n.slice().buffer,
|
|
@@ -2250,10 +2321,10 @@ async function hn(e, t) {
|
|
|
2250
2321
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2251
2322
|
};
|
|
2252
2323
|
}
|
|
2253
|
-
function
|
|
2324
|
+
function En() {
|
|
2254
2325
|
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)}`;
|
|
2255
2326
|
}
|
|
2256
|
-
function
|
|
2327
|
+
function Dn(e, t = "completed") {
|
|
2257
2328
|
return {
|
|
2258
2329
|
utteranceId: e.speechId,
|
|
2259
2330
|
characterId: e.characterId,
|
|
@@ -2267,13 +2338,13 @@ function _n(e, t = "completed") {
|
|
|
2267
2338
|
}
|
|
2268
2339
|
};
|
|
2269
2340
|
}
|
|
2270
|
-
function
|
|
2341
|
+
function On(e) {
|
|
2271
2342
|
return e instanceof Error ? e : new Q(String(e));
|
|
2272
2343
|
}
|
|
2273
|
-
function
|
|
2344
|
+
function kn(e) {
|
|
2274
2345
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
2275
2346
|
}
|
|
2276
|
-
var
|
|
2347
|
+
var An = class {
|
|
2277
2348
|
id;
|
|
2278
2349
|
characterId;
|
|
2279
2350
|
result;
|
|
@@ -2302,29 +2373,29 @@ var bn = class {
|
|
|
2302
2373
|
queue: e.queue,
|
|
2303
2374
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
2304
2375
|
}).catch((e) => {
|
|
2305
|
-
throw this.fail(
|
|
2376
|
+
throw this.fail(On(e)), On(e);
|
|
2306
2377
|
}), this.signal?.addEventListener("abort", () => {
|
|
2307
2378
|
this.cancel();
|
|
2308
2379
|
}, { once: !0 });
|
|
2309
2380
|
}
|
|
2310
2381
|
async write(e, t) {
|
|
2311
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2312
|
-
let n =
|
|
2382
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new on();
|
|
2383
|
+
let n = pn(e);
|
|
2313
2384
|
if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
|
|
2314
|
-
if (n.byteLength >
|
|
2385
|
+
if (n.byteLength > rn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${rn.MAX_CHUNK_BYTES}).`);
|
|
2315
2386
|
if (n.byteLength === 0) return;
|
|
2316
|
-
let r = t?.timeoutMs ??
|
|
2387
|
+
let r = t?.timeoutMs ?? rn.DEFAULT_WRITE_TIMEOUT_MS;
|
|
2317
2388
|
await this.acquireWriteSlot(r);
|
|
2318
2389
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
2319
|
-
if (this.bufferedMs + i >
|
|
2390
|
+
if (this.bufferedMs + i > rn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
2320
2391
|
let a = async () => {
|
|
2321
|
-
if (this.closed || this.settled) throw new
|
|
2392
|
+
if (this.closed || this.settled) throw new on();
|
|
2322
2393
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
2323
2394
|
utteranceId: this.id,
|
|
2324
2395
|
audio: t.buffer,
|
|
2325
2396
|
byteLength: t.byteLength
|
|
2326
2397
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
2327
|
-
setTimeout(() => t(new
|
|
2398
|
+
setTimeout(() => t(new sn()), r);
|
|
2328
2399
|
})]);
|
|
2329
2400
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
2330
2401
|
}, o = this.writeChain.then(a, a);
|
|
@@ -2336,7 +2407,7 @@ var bn = class {
|
|
|
2336
2407
|
}
|
|
2337
2408
|
}
|
|
2338
2409
|
async setTranscript(e) {
|
|
2339
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2410
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new on();
|
|
2340
2411
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
2341
2412
|
utteranceId: this.id,
|
|
2342
2413
|
transcript: e
|
|
@@ -2353,7 +2424,7 @@ var bn = class {
|
|
|
2353
2424
|
});
|
|
2354
2425
|
return this.resolve(t), t;
|
|
2355
2426
|
} catch (e) {
|
|
2356
|
-
let t =
|
|
2427
|
+
let t = On(e);
|
|
2357
2428
|
throw this.fail(t), t;
|
|
2358
2429
|
}
|
|
2359
2430
|
}
|
|
@@ -2371,11 +2442,11 @@ var bn = class {
|
|
|
2371
2442
|
characterId: this.characterId,
|
|
2372
2443
|
status: "cancelled",
|
|
2373
2444
|
durationMs: 0,
|
|
2374
|
-
animation:
|
|
2445
|
+
animation: cn("none")
|
|
2375
2446
|
};
|
|
2376
2447
|
return this.resolve(t), t;
|
|
2377
2448
|
} catch (e) {
|
|
2378
|
-
let t =
|
|
2449
|
+
let t = On(e);
|
|
2379
2450
|
throw this.fail(t), t;
|
|
2380
2451
|
}
|
|
2381
2452
|
}
|
|
@@ -2388,19 +2459,19 @@ var bn = class {
|
|
|
2388
2459
|
return e;
|
|
2389
2460
|
}
|
|
2390
2461
|
resolve(e) {
|
|
2391
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2462
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new on()));
|
|
2392
2463
|
}
|
|
2393
2464
|
fail(e) {
|
|
2394
2465
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
2395
2466
|
}
|
|
2396
2467
|
async acquireWriteSlot(e) {
|
|
2397
|
-
if (this.pendingWriteCount <
|
|
2468
|
+
if (this.pendingWriteCount < rn.MAX_PENDING_WRITES) {
|
|
2398
2469
|
this.pendingWriteCount += 1;
|
|
2399
2470
|
return;
|
|
2400
2471
|
}
|
|
2401
2472
|
await new Promise((t, n) => {
|
|
2402
2473
|
let r = setTimeout(() => {
|
|
2403
|
-
n(new
|
|
2474
|
+
n(new sn());
|
|
2404
2475
|
}, e);
|
|
2405
2476
|
this.pendingWriteWaiters.push({
|
|
2406
2477
|
resolve: () => {
|
|
@@ -2419,13 +2490,13 @@ var bn = class {
|
|
|
2419
2490
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2420
2491
|
}
|
|
2421
2492
|
};
|
|
2422
|
-
function
|
|
2493
|
+
function jn(e) {
|
|
2423
2494
|
let t = null, n = (t, n) => {
|
|
2424
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2495
|
+
if (!e.getCapabilities()[n]) throw new an(t, n);
|
|
2425
2496
|
}, r = {
|
|
2426
2497
|
async speak(r) {
|
|
2427
2498
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2428
|
-
let i =
|
|
2499
|
+
let i = mn(r.queue ?? "append");
|
|
2429
2500
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2430
2501
|
let a = e.getIframeHost();
|
|
2431
2502
|
if (!a) throw new Q("Speech session is not attached.");
|
|
@@ -2445,41 +2516,41 @@ function xn(e) {
|
|
|
2445
2516
|
return;
|
|
2446
2517
|
}
|
|
2447
2518
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2448
|
-
t.removeEventListener("abort", s), n(
|
|
2519
|
+
t.removeEventListener("abort", s), n(Dn(e, "completed"));
|
|
2449
2520
|
}, (a) => {
|
|
2450
|
-
if (t.removeEventListener("abort", s),
|
|
2521
|
+
if (t.removeEventListener("abort", s), kn(a)) {
|
|
2451
2522
|
n({
|
|
2452
2523
|
utteranceId: "utt_interrupted",
|
|
2453
2524
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2454
2525
|
status: "interrupted",
|
|
2455
2526
|
durationMs: 0,
|
|
2456
2527
|
transcript: r.text,
|
|
2457
|
-
animation:
|
|
2528
|
+
animation: cn("none")
|
|
2458
2529
|
});
|
|
2459
2530
|
return;
|
|
2460
2531
|
}
|
|
2461
|
-
i(
|
|
2532
|
+
i(On(a));
|
|
2462
2533
|
});
|
|
2463
2534
|
});
|
|
2464
2535
|
}
|
|
2465
2536
|
try {
|
|
2466
|
-
return
|
|
2537
|
+
return Dn(await o, "completed");
|
|
2467
2538
|
} catch (t) {
|
|
2468
|
-
if (
|
|
2539
|
+
if (kn(t)) return {
|
|
2469
2540
|
utteranceId: "utt_interrupted",
|
|
2470
2541
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2471
2542
|
status: "interrupted",
|
|
2472
2543
|
durationMs: 0,
|
|
2473
2544
|
transcript: r.text,
|
|
2474
|
-
animation:
|
|
2545
|
+
animation: cn("none")
|
|
2475
2546
|
};
|
|
2476
|
-
throw
|
|
2547
|
+
throw On(t);
|
|
2477
2548
|
}
|
|
2478
2549
|
},
|
|
2479
2550
|
async play(i) {
|
|
2480
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2551
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), dn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2481
2552
|
let a = i.queue ?? "append";
|
|
2482
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2553
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), en(i.audio)) {
|
|
2483
2554
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2484
2555
|
return r.createUtterance({
|
|
2485
2556
|
format: {
|
|
@@ -2495,7 +2566,7 @@ function xn(e) {
|
|
|
2495
2566
|
}
|
|
2496
2567
|
let o = e.getIframeHost();
|
|
2497
2568
|
if (!o) throw new Q("Speech session is not attached.");
|
|
2498
|
-
let s = await
|
|
2569
|
+
let s = await Tn(i.audio, i.signal);
|
|
2499
2570
|
return o.speechPlay({
|
|
2500
2571
|
source: s,
|
|
2501
2572
|
characterId: i.characterId,
|
|
@@ -2507,13 +2578,13 @@ function xn(e) {
|
|
|
2507
2578
|
},
|
|
2508
2579
|
createUtterance(r) {
|
|
2509
2580
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2510
|
-
let i =
|
|
2581
|
+
let i = fn(r);
|
|
2511
2582
|
if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
|
|
2512
2583
|
let a = r.queue ?? "replace-active";
|
|
2513
2584
|
if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
|
|
2514
2585
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2515
|
-
let o = new
|
|
2516
|
-
id:
|
|
2586
|
+
let o = new An({
|
|
2587
|
+
id: En(),
|
|
2517
2588
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2518
2589
|
format: i,
|
|
2519
2590
|
queue: a,
|
|
@@ -2525,7 +2596,7 @@ function xn(e) {
|
|
|
2525
2596
|
t === o && (t = null);
|
|
2526
2597
|
}), r.track && (async () => {
|
|
2527
2598
|
try {
|
|
2528
|
-
if (await
|
|
2599
|
+
if (await wn({
|
|
2529
2600
|
track: r.track,
|
|
2530
2601
|
utterance: o,
|
|
2531
2602
|
sampleRate: i.sampleRate,
|
|
@@ -2553,16 +2624,16 @@ function xn(e) {
|
|
|
2553
2624
|
}
|
|
2554
2625
|
//#endregion
|
|
2555
2626
|
//#region src/v2/types/sessionInteraction.ts
|
|
2556
|
-
function
|
|
2627
|
+
function Mn(e) {
|
|
2557
2628
|
let t = e?.trim();
|
|
2558
2629
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
2559
2630
|
}
|
|
2560
2631
|
//#endregion
|
|
2561
2632
|
//#region src/v2/experience.ts
|
|
2562
|
-
function
|
|
2633
|
+
function Nn(e) {
|
|
2563
2634
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
2564
2635
|
}
|
|
2565
|
-
var
|
|
2636
|
+
var Pn = class e {
|
|
2566
2637
|
bootstrap;
|
|
2567
2638
|
conversationProcessor;
|
|
2568
2639
|
iframeHost = null;
|
|
@@ -2582,17 +2653,17 @@ var wn = class e {
|
|
|
2582
2653
|
pendingTheatre = null;
|
|
2583
2654
|
lastInteraction = null;
|
|
2584
2655
|
closeHandlers = [];
|
|
2585
|
-
eventRegistry =
|
|
2656
|
+
eventRegistry = Jt();
|
|
2586
2657
|
readyEnvelope = null;
|
|
2587
2658
|
startedEnvelope = null;
|
|
2588
2659
|
sessionMintedEnvelope = null;
|
|
2589
2660
|
conversationCache = [];
|
|
2590
2661
|
speech;
|
|
2591
2662
|
constructor(e) {
|
|
2592
|
-
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 =
|
|
2663
|
+
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 = jn({
|
|
2593
2664
|
getIframeHost: () => this.iframeHost,
|
|
2594
2665
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
2595
|
-
getCapabilities: () =>
|
|
2666
|
+
getCapabilities: () => Fn(this.resolvedSession),
|
|
2596
2667
|
getActiveCharacterId: () => "character_unknown",
|
|
2597
2668
|
onProcessorInterrupt: () => {
|
|
2598
2669
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -2613,6 +2684,8 @@ var wn = class e {
|
|
|
2613
2684
|
embedBaseUrl: t.embedBaseUrl,
|
|
2614
2685
|
debug: t.debug,
|
|
2615
2686
|
speechOnly: t.speechOnly,
|
|
2687
|
+
previewBackground: t.previewBackground,
|
|
2688
|
+
previewForeground: t.previewForeground,
|
|
2616
2689
|
ui: t.ui,
|
|
2617
2690
|
onStart: t.onStart,
|
|
2618
2691
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2636,6 +2709,8 @@ var wn = class e {
|
|
|
2636
2709
|
mode: t.mode,
|
|
2637
2710
|
speechInputMode: t.speechInputMode,
|
|
2638
2711
|
speechOnly: t.speechOnly,
|
|
2712
|
+
previewBackground: t.previewBackground,
|
|
2713
|
+
previewForeground: t.previewForeground,
|
|
2639
2714
|
attribution: t.attribution,
|
|
2640
2715
|
alreadyConverted: t.alreadyConverted,
|
|
2641
2716
|
ui: t.ui,
|
|
@@ -2659,6 +2734,8 @@ var wn = class e {
|
|
|
2659
2734
|
mode: t.mode,
|
|
2660
2735
|
speechInputMode: t.speechInputMode,
|
|
2661
2736
|
speechOnly: t.speechOnly,
|
|
2737
|
+
previewBackground: t.previewBackground,
|
|
2738
|
+
previewForeground: t.previewForeground,
|
|
2662
2739
|
attribution: t.attribution,
|
|
2663
2740
|
alreadyConverted: t.alreadyConverted,
|
|
2664
2741
|
ui: t.ui,
|
|
@@ -2675,7 +2752,7 @@ var wn = class e {
|
|
|
2675
2752
|
return null;
|
|
2676
2753
|
}
|
|
2677
2754
|
on(e, t) {
|
|
2678
|
-
let n =
|
|
2755
|
+
let n = Yt(this.eventRegistry, e, t);
|
|
2679
2756
|
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;
|
|
2680
2757
|
}
|
|
2681
2758
|
async attach(e) {
|
|
@@ -2689,13 +2766,13 @@ var wn = class e {
|
|
|
2689
2766
|
if (this.closed) throw Error("Session has ended.");
|
|
2690
2767
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2691
2768
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2692
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2769
|
+
let t = this.bootstrap.embedBaseUrl ?? Vt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = Ut(t, n, r ? void 0 : Ht(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Nn(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 = Gt(i), o = null, s = new Promise((e) => {
|
|
2693
2770
|
o = e;
|
|
2694
2771
|
}), c = null, l = new Promise((e) => {
|
|
2695
2772
|
c = e;
|
|
2696
|
-
}), u =
|
|
2773
|
+
}), u = It((e) => {
|
|
2697
2774
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
2698
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
2775
|
+
}), d = this.bootstrap.onUserTranscript, f = Ft({
|
|
2699
2776
|
container: e.container,
|
|
2700
2777
|
src: i,
|
|
2701
2778
|
playerOrigin: a,
|
|
@@ -2762,7 +2839,7 @@ var wn = class e {
|
|
|
2762
2839
|
onTheatreChange: (t) => e.onTheatreChange?.(t)
|
|
2763
2840
|
});
|
|
2764
2841
|
this.iframeHost = f;
|
|
2765
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
2842
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), dt(this.bootstrap.sessionEndpoint, {
|
|
2766
2843
|
experienceId: this.bootstrap.experienceId,
|
|
2767
2844
|
locale: this.bootstrap.locale,
|
|
2768
2845
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -2774,7 +2851,7 @@ var wn = class e {
|
|
|
2774
2851
|
attribution: this.bootstrap.attribution,
|
|
2775
2852
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2776
2853
|
signal: this.endpointAbortController.signal
|
|
2777
|
-
})) : this.bootstrap.kind === "public" ?
|
|
2854
|
+
})) : this.bootstrap.kind === "public" ? ut(this.bootstrap.experienceId, {
|
|
2778
2855
|
locale: this.bootstrap.locale,
|
|
2779
2856
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
2780
2857
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -2798,7 +2875,7 @@ var wn = class e {
|
|
|
2798
2875
|
operation: "attach",
|
|
2799
2876
|
message: e instanceof Error ? e.message : String(e),
|
|
2800
2877
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2801
|
-
release:
|
|
2878
|
+
release: Lt
|
|
2802
2879
|
});
|
|
2803
2880
|
} catch {}
|
|
2804
2881
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -2810,19 +2887,23 @@ var wn = class e {
|
|
|
2810
2887
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2811
2888
|
this.launchToken = g;
|
|
2812
2889
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2813
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
2890
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && nt(_), f.postLaunch(g, _, {
|
|
2814
2891
|
startButton: e.startButton,
|
|
2815
2892
|
theme: e.theme,
|
|
2816
2893
|
showFeedback: e.showFeedback,
|
|
2817
2894
|
interaction: e.interaction,
|
|
2818
|
-
...e.
|
|
2895
|
+
...Ye("settingsButton", e.settingsButton),
|
|
2896
|
+
...Ye("theatreButton", e.theatreButton),
|
|
2897
|
+
...Ye("fullscreenButton", e.fullscreenButton),
|
|
2819
2898
|
...e.theatre === void 0 ? {} : { theatre: e.theatre }
|
|
2820
2899
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
2821
2900
|
startButton: e.startButton,
|
|
2822
2901
|
theme: e.theme,
|
|
2823
2902
|
showFeedback: e.showFeedback,
|
|
2824
2903
|
interaction: e.interaction,
|
|
2825
|
-
...e.
|
|
2904
|
+
...Ye("settingsButton", e.settingsButton),
|
|
2905
|
+
...Ye("theatreButton", e.theatreButton),
|
|
2906
|
+
...Ye("fullscreenButton", e.fullscreenButton),
|
|
2826
2907
|
...e.theatre === void 0 ? {} : { theatre: e.theatre }
|
|
2827
2908
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2828
2909
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
@@ -2834,7 +2915,7 @@ var wn = class e {
|
|
|
2834
2915
|
operation: "attach",
|
|
2835
2916
|
message: e instanceof Error ? e.message : String(e),
|
|
2836
2917
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2837
|
-
release:
|
|
2918
|
+
release: Lt
|
|
2838
2919
|
});
|
|
2839
2920
|
} catch {}
|
|
2840
2921
|
throw e;
|
|
@@ -2848,7 +2929,7 @@ var wn = class e {
|
|
|
2848
2929
|
operation: "attach",
|
|
2849
2930
|
message: e instanceof Error ? e.message : String(e),
|
|
2850
2931
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2851
|
-
release:
|
|
2932
|
+
release: Lt
|
|
2852
2933
|
});
|
|
2853
2934
|
} catch {}
|
|
2854
2935
|
throw e;
|
|
@@ -2880,7 +2961,7 @@ var wn = class e {
|
|
|
2880
2961
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2881
2962
|
}
|
|
2882
2963
|
async setFit(e) {
|
|
2883
|
-
let t =
|
|
2964
|
+
let t = Mn(e);
|
|
2884
2965
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2885
2966
|
if (this.closed) throw Error("Session has ended.");
|
|
2886
2967
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
@@ -2930,7 +3011,7 @@ var wn = class e {
|
|
|
2930
3011
|
this.close();
|
|
2931
3012
|
}
|
|
2932
3013
|
destroy() {
|
|
2933
|
-
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,
|
|
3014
|
+
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, Zt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
2934
3015
|
}
|
|
2935
3016
|
resolveMintInteraction() {
|
|
2936
3017
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2942,8 +3023,8 @@ var wn = class e {
|
|
|
2942
3023
|
return this.resolvedSession?.id ?? "";
|
|
2943
3024
|
}
|
|
2944
3025
|
emitWrapped(e, t) {
|
|
2945
|
-
let n =
|
|
2946
|
-
return
|
|
3026
|
+
let n = qt(e, this.getSessionId(), t);
|
|
3027
|
+
return Xt(this.eventRegistry, e, n), n;
|
|
2947
3028
|
}
|
|
2948
3029
|
queueProcessorTurn(e) {
|
|
2949
3030
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2952,7 +3033,7 @@ var wn = class e {
|
|
|
2952
3033
|
let n = this.processorAbortController.signal;
|
|
2953
3034
|
this.processorChain = this.processorChain.then(async () => {
|
|
2954
3035
|
if (!n.aborted) try {
|
|
2955
|
-
let r = await
|
|
3036
|
+
let r = await mt(t, {
|
|
2956
3037
|
utteranceId: e.utteranceId,
|
|
2957
3038
|
text: e.text,
|
|
2958
3039
|
conversation: this.conversationCache,
|
|
@@ -3002,7 +3083,7 @@ var wn = class e {
|
|
|
3002
3083
|
};
|
|
3003
3084
|
}
|
|
3004
3085
|
};
|
|
3005
|
-
function
|
|
3086
|
+
function Fn(e) {
|
|
3006
3087
|
return e ? {
|
|
3007
3088
|
textSpeech: e.capabilities.speech.output,
|
|
3008
3089
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -3013,41 +3094,41 @@ function Tn(e) {
|
|
|
3013
3094
|
}
|
|
3014
3095
|
//#endregion
|
|
3015
3096
|
//#region src/widget/dockGeometry.ts
|
|
3016
|
-
var
|
|
3017
|
-
function
|
|
3097
|
+
var In = "(min-width: 768px)", Ln = 24, Rn = .5, zn = 1200, Bn = .85, Vn = 9 / 16;
|
|
3098
|
+
function Hn() {
|
|
3018
3099
|
if (typeof window > "u") return 800;
|
|
3019
3100
|
let e = window.screen?.availHeight;
|
|
3020
3101
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
3021
3102
|
}
|
|
3022
|
-
function
|
|
3023
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
3024
|
-
return s > a && (s = a, o = s /
|
|
3103
|
+
function Un(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Ln, r = typeof window < "u" ? Hn() : 800) {
|
|
3104
|
+
let i = Math.max(160, Math.min(t - n * 2, t * Bn)), a = Math.max(120, e - n * 2), o = Math.min(r * Rn, zn, i), s = o * Vn;
|
|
3105
|
+
return s > a && (s = a, o = s / Vn, o > i && (o = i, s = o * Vn)), {
|
|
3025
3106
|
width: Math.round(s),
|
|
3026
3107
|
height: Math.round(o)
|
|
3027
3108
|
};
|
|
3028
3109
|
}
|
|
3029
|
-
function
|
|
3110
|
+
function Wn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Ln) {
|
|
3030
3111
|
return {
|
|
3031
3112
|
left: Math.max(r, t - e.width - r),
|
|
3032
3113
|
top: Math.max(r, n - e.height - r)
|
|
3033
3114
|
};
|
|
3034
3115
|
}
|
|
3035
|
-
function
|
|
3116
|
+
function Gn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Ln) {
|
|
3036
3117
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
3037
3118
|
return {
|
|
3038
3119
|
left: Math.min(Math.max(a, e), o),
|
|
3039
3120
|
top: Math.min(Math.max(a, t), s)
|
|
3040
3121
|
};
|
|
3041
3122
|
}
|
|
3042
|
-
function
|
|
3043
|
-
return e(
|
|
3123
|
+
function Kn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
3124
|
+
return e(In).matches;
|
|
3044
3125
|
}
|
|
3045
3126
|
//#endregion
|
|
3046
3127
|
//#region src/widget/mountExperienceWidget.ts
|
|
3047
|
-
function
|
|
3128
|
+
function qn(e) {
|
|
3048
3129
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
3049
3130
|
}
|
|
3050
|
-
function
|
|
3131
|
+
function Jn(e) {
|
|
3051
3132
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
3052
3133
|
let t = typeof e == "string" ? e.trim() : "";
|
|
3053
3134
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -3055,10 +3136,10 @@ function Rn(e) {
|
|
|
3055
3136
|
function $(e) {
|
|
3056
3137
|
return e === "expanded" || e === "docked";
|
|
3057
3138
|
}
|
|
3058
|
-
var
|
|
3059
|
-
function
|
|
3060
|
-
|
|
3061
|
-
let r =
|
|
3139
|
+
var Yn = "<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>", Xn = "<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>", Zn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Qn = "<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>";
|
|
3140
|
+
function $n(e, t, n) {
|
|
3141
|
+
xe(ye);
|
|
3142
|
+
let r = F({
|
|
3062
3143
|
galleryThumb: t.galleryThumb,
|
|
3063
3144
|
avatarImage: t.avatarImage,
|
|
3064
3145
|
backgroundImage: t.backgroundImage,
|
|
@@ -3084,9 +3165,9 @@ function Un(e, t, n) {
|
|
|
3084
3165
|
let e = document.createElement("img");
|
|
3085
3166
|
e.className = "liforma-et__foreground liforma-et__media", e.alt = "", e.decoding = "async", e.src = r.foregroundImage, e.addEventListener("load", () => o(e), { once: !0 }), i.append(e);
|
|
3086
3167
|
}
|
|
3087
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
3168
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ve(i);
|
|
3088
3169
|
}
|
|
3089
|
-
function
|
|
3170
|
+
function er(e) {
|
|
3090
3171
|
return e.startButton ? {
|
|
3091
3172
|
...e.startButton,
|
|
3092
3173
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -3098,7 +3179,7 @@ function Wn(e) {
|
|
|
3098
3179
|
variant: "primary"
|
|
3099
3180
|
};
|
|
3100
3181
|
}
|
|
3101
|
-
function
|
|
3182
|
+
function tr(e) {
|
|
3102
3183
|
let t = !1, n = () => {
|
|
3103
3184
|
t || e();
|
|
3104
3185
|
}, r = () => {
|
|
@@ -3118,12 +3199,12 @@ function Gn(e) {
|
|
|
3118
3199
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
3119
3200
|
};
|
|
3120
3201
|
}
|
|
3121
|
-
function
|
|
3122
|
-
|
|
3202
|
+
function nr(e, t) {
|
|
3203
|
+
Pe(Me);
|
|
3123
3204
|
let n = t.experienceId?.trim();
|
|
3124
3205
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
3125
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
3126
|
-
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",
|
|
3206
|
+
let r = t.prefetch ?? "onExpand", i = qn(t.position), a = document.createElement("div");
|
|
3207
|
+
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", Jn(t.offset));
|
|
3127
3208
|
let o = document.createElement("button");
|
|
3128
3209
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
3129
3210
|
let s = document.createElement("div");
|
|
@@ -3143,74 +3224,74 @@ function Kn(e, t) {
|
|
|
3143
3224
|
let m = document.createElement("span");
|
|
3144
3225
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
3145
3226
|
let h = document.createElement("button");
|
|
3146
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
3227
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Zn, h.setAttribute("aria-label", "Reduce");
|
|
3147
3228
|
let g = document.createElement("button");
|
|
3148
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
3229
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Yn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
3149
3230
|
let _ = document.createElement("button");
|
|
3150
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
3231
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Xn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
3151
3232
|
let v = document.createElement("div");
|
|
3152
3233
|
v.className = "liforma-ew__stage";
|
|
3153
3234
|
let y = document.createElement("div");
|
|
3154
3235
|
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);
|
|
3155
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null,
|
|
3236
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, ee = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
|
|
3156
3237
|
let e = a.dataset.state;
|
|
3157
3238
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
3158
|
-
}, R = () => {
|
|
3159
|
-
ee !== null && (clearTimeout(ee), ee = null);
|
|
3160
3239
|
}, z = () => {
|
|
3161
|
-
|
|
3162
|
-
},
|
|
3240
|
+
M !== null && (clearTimeout(M), M = null);
|
|
3241
|
+
}, B = () => {
|
|
3242
|
+
ee !== null && (clearTimeout(ee), ee = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3243
|
+
}, ae = () => {
|
|
3163
3244
|
for (let e of [
|
|
3164
3245
|
f,
|
|
3165
3246
|
l,
|
|
3166
3247
|
p
|
|
3167
3248
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
3168
3249
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
3169
|
-
},
|
|
3250
|
+
}, oe = (e, t, n, r) => {
|
|
3170
3251
|
let i = (i) => {
|
|
3171
3252
|
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";
|
|
3172
3253
|
};
|
|
3173
3254
|
i(f), i(l);
|
|
3174
3255
|
let a = p.offsetWidth || 120;
|
|
3175
3256
|
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";
|
|
3257
|
+
}, se = (e, t) => {
|
|
3258
|
+
if (R() !== "docked") return;
|
|
3259
|
+
let n = Un(), r = Gn(e - te, t - I, n);
|
|
3260
|
+
N = r.left, P = r.top, oe(r.left, r.top, n.width, n.height);
|
|
3176
3261
|
}, ce = (e, t) => {
|
|
3177
|
-
if (
|
|
3178
|
-
let n =
|
|
3179
|
-
|
|
3180
|
-
}, le = (e
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
},
|
|
3187
|
-
if (
|
|
3188
|
-
|
|
3189
|
-
P = null, I = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && re && (re = !1, window.removeEventListener("pointermove", ue), window.removeEventListener("pointerup", B), window.removeEventListener("pointercancel", B));
|
|
3190
|
-
}, de = (e, t, n) => {
|
|
3191
|
-
if (S || L() !== "docked" || !In() || P !== null) return;
|
|
3192
|
-
P = n, I = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3262
|
+
if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
3263
|
+
let n = Un(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Gn(r + e, i + t, n);
|
|
3264
|
+
N = a.left, P = a.top, oe(a.left, a.top, n.width, n.height);
|
|
3265
|
+
}, le = (e) => {
|
|
3266
|
+
L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), se(e.clientX, e.clientY)));
|
|
3267
|
+
}, V = (e) => {
|
|
3268
|
+
if (F === null || e && e.pointerId !== F) return;
|
|
3269
|
+
let t = L;
|
|
3270
|
+
F = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && ne && (ne = !1, window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
3271
|
+
}, ue = (e, t, n) => {
|
|
3272
|
+
if (S || R() !== "docked" || !Kn() || F !== null) return;
|
|
3273
|
+
F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3193
3274
|
let r = f.getBoundingClientRect();
|
|
3194
|
-
|
|
3195
|
-
},
|
|
3196
|
-
if (S ||
|
|
3197
|
-
|
|
3275
|
+
te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", le), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
3276
|
+
}, de = (e) => {
|
|
3277
|
+
if (S || R() !== "docked" || !Kn() || F !== null) return;
|
|
3278
|
+
F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3198
3279
|
let t = f.getBoundingClientRect();
|
|
3199
|
-
|
|
3280
|
+
N = t.left, P = t.top;
|
|
3281
|
+
}, fe = (e) => {
|
|
3282
|
+
L === "player" && (F === null || e.pointerId !== F || ce(e.dx, e.dy));
|
|
3200
3283
|
}, pe = (e) => {
|
|
3201
|
-
|
|
3202
|
-
},
|
|
3203
|
-
|
|
3204
|
-
}, V = () => {
|
|
3205
|
-
let e = In(), t = L();
|
|
3284
|
+
L === "player" && (F === null || e.pointerId !== F || V());
|
|
3285
|
+
}, H = () => {
|
|
3286
|
+
let e = Kn(), t = R();
|
|
3206
3287
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
3207
3288
|
h.hidden = !0;
|
|
3208
3289
|
return;
|
|
3209
3290
|
}
|
|
3210
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
3211
|
-
},
|
|
3212
|
-
let t =
|
|
3213
|
-
n =
|
|
3291
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = Qn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Zn, h.setAttribute("aria-label", "Reduce"));
|
|
3292
|
+
}, me = (e) => {
|
|
3293
|
+
let t = Un(), n = e && N !== null && P !== null ? Gn(N, P, t) : Wn(t);
|
|
3294
|
+
n = Gn(n.left, n.top, t), N = n.left, P = n.top, oe(n.left, n.top, t.width, t.height), H();
|
|
3214
3295
|
}, U = () => {
|
|
3215
3296
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
3216
3297
|
requestAnimationFrame(() => {
|
|
@@ -3218,63 +3299,63 @@ function Kn(e, t) {
|
|
|
3218
3299
|
});
|
|
3219
3300
|
});
|
|
3220
3301
|
}, W = (e) => {
|
|
3221
|
-
if (
|
|
3302
|
+
if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
3222
3303
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3223
3304
|
return;
|
|
3224
3305
|
}
|
|
3225
|
-
|
|
3226
|
-
if (
|
|
3306
|
+
ee = setTimeout(() => {
|
|
3307
|
+
if (ee = null, S || !$(a.dataset.state)) {
|
|
3227
3308
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3228
3309
|
return;
|
|
3229
3310
|
}
|
|
3230
3311
|
a.classList.remove("liforma-ew--layout-settling"), U();
|
|
3231
3312
|
}, 220);
|
|
3232
3313
|
}, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
3233
|
-
|
|
3234
|
-
|
|
3314
|
+
z(), M = setTimeout(() => {
|
|
3315
|
+
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
3235
3316
|
}, 280);
|
|
3236
|
-
})),
|
|
3317
|
+
})), G = {
|
|
3237
3318
|
galleryThumb: t.galleryThumb,
|
|
3238
3319
|
avatarImage: t.avatarImage,
|
|
3239
3320
|
backgroundImage: t.backgroundImage,
|
|
3240
3321
|
foregroundImage: t.foregroundImage,
|
|
3241
3322
|
fallbackImage: t.fallbackImage
|
|
3242
|
-
},
|
|
3323
|
+
}, K = (e) => {
|
|
3243
3324
|
if (!e) {
|
|
3244
3325
|
y.hidden = !0, y.textContent = "";
|
|
3245
3326
|
return;
|
|
3246
3327
|
}
|
|
3247
3328
|
y.hidden = !1, y.textContent = e;
|
|
3248
|
-
},
|
|
3329
|
+
}, ge = (e) => {
|
|
3249
3330
|
if (!e) {
|
|
3250
3331
|
c.hidden = !0, c.textContent = "";
|
|
3251
3332
|
return;
|
|
3252
3333
|
}
|
|
3253
3334
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
3335
|
+
}, _e = () => {
|
|
3336
|
+
C = !0, o.disabled = !1, ge(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3254
3337
|
}, ve = () => {
|
|
3255
|
-
C = !0, o.disabled = !1, _e(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3256
|
-
}, ye = () => {
|
|
3257
3338
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
3258
|
-
},
|
|
3339
|
+
}, ye = (e) => {
|
|
3259
3340
|
A?.(), A = null;
|
|
3260
|
-
let t =
|
|
3341
|
+
let t = $n(s, e, { parallax: ie });
|
|
3261
3342
|
return t ? (A = t, !0) : !1;
|
|
3262
|
-
},
|
|
3263
|
-
if (
|
|
3264
|
-
|
|
3343
|
+
}, be = () => {
|
|
3344
|
+
if (ye(G)) {
|
|
3345
|
+
_e();
|
|
3265
3346
|
return;
|
|
3266
3347
|
}
|
|
3267
|
-
|
|
3348
|
+
ge("Loading…"), ze(n, { signal: re.signal }).then((e) => {
|
|
3268
3349
|
if (!S) {
|
|
3269
|
-
if (!
|
|
3270
|
-
|
|
3350
|
+
if (!ye({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
3351
|
+
_e();
|
|
3271
3352
|
}
|
|
3272
3353
|
}).catch((e) => {
|
|
3273
|
-
if (S ||
|
|
3354
|
+
if (S || re.signal.aborted) return;
|
|
3274
3355
|
let n = e instanceof Error ? e : Error(String(e));
|
|
3275
|
-
|
|
3356
|
+
ge("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
3276
3357
|
});
|
|
3277
|
-
},
|
|
3358
|
+
}, xe = () => ({
|
|
3278
3359
|
experienceId: n,
|
|
3279
3360
|
ui: "widget",
|
|
3280
3361
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
@@ -3287,89 +3368,89 @@ function Kn(e, t) {
|
|
|
3287
3368
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
3288
3369
|
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
3289
3370
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
3290
|
-
}),
|
|
3371
|
+
}), Se = () => ({
|
|
3291
3372
|
...t.fit ? { fit: t.fit } : {},
|
|
3292
|
-
startButton:
|
|
3373
|
+
startButton: er(t),
|
|
3293
3374
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
3294
3375
|
...t.interaction ? { interaction: t.interaction } : {}
|
|
3295
|
-
}),
|
|
3296
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
3297
|
-
},
|
|
3298
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
3299
|
-
},
|
|
3376
|
+
}), Ce = (e = !0) => {
|
|
3377
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
|
|
3378
|
+
}, we = () => {
|
|
3379
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", K(null), typeof document < "u" && (document.body.style.overflow = k), me(!0), H(), b?.setWidgetChrome("docked");
|
|
3380
|
+
}, Te = (e) => {
|
|
3300
3381
|
e.on("started", () => {
|
|
3301
|
-
S || (D = !0, a.dataset.live = "true",
|
|
3382
|
+
S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && U());
|
|
3302
3383
|
}), e.on("feedback", (e) => {
|
|
3303
3384
|
S || t.onFeedback?.(e);
|
|
3304
3385
|
}), e.on("feedbackFailed", (e) => {
|
|
3305
3386
|
S || t.onFeedbackFailed?.(e);
|
|
3306
3387
|
});
|
|
3307
|
-
},
|
|
3308
|
-
|
|
3309
|
-
},
|
|
3310
|
-
|
|
3388
|
+
}, Ee = () => {
|
|
3389
|
+
B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), H();
|
|
3390
|
+
}, De = () => {
|
|
3391
|
+
z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3311
3392
|
let e = b;
|
|
3312
3393
|
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");
|
|
3313
|
-
},
|
|
3394
|
+
}, Oe = () => {
|
|
3314
3395
|
if (!S && $(a.dataset.state)) {
|
|
3315
|
-
if (
|
|
3396
|
+
if (V(), x = !1, b && E) {
|
|
3316
3397
|
let e = b;
|
|
3317
3398
|
(async () => {
|
|
3318
|
-
D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"),
|
|
3399
|
+
D && (await he(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Ee(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && ve(), t.onCollapsed?.(), t.onClose?.());
|
|
3319
3400
|
})();
|
|
3320
3401
|
return;
|
|
3321
3402
|
}
|
|
3322
|
-
|
|
3403
|
+
De(), Ee(), t.onCollapsed?.(), t.onClose?.();
|
|
3323
3404
|
}
|
|
3324
|
-
},
|
|
3325
|
-
S ||
|
|
3326
|
-
|
|
3405
|
+
}, ke = () => {
|
|
3406
|
+
S || Kn() && R() === "expanded" && W(() => {
|
|
3407
|
+
we();
|
|
3327
3408
|
});
|
|
3328
|
-
},
|
|
3329
|
-
S ||
|
|
3330
|
-
|
|
3409
|
+
}, Ae = () => {
|
|
3410
|
+
S || R() === "docked" && (V(), W(() => {
|
|
3411
|
+
ae(), Ce(!1), b?.setWidgetChrome("expanded");
|
|
3331
3412
|
}));
|
|
3413
|
+
}, je = () => {
|
|
3414
|
+
!b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, U());
|
|
3332
3415
|
}, Ne = () => {
|
|
3333
|
-
!b || !D || (
|
|
3334
|
-
}, Pe = () => {
|
|
3335
|
-
!b || !E || D || (R(), a.classList.remove("liforma-ew--session-revealed"), we(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3416
|
+
!b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3336
3417
|
}, Fe = (e) => {
|
|
3337
|
-
S || e !== O && !D || (
|
|
3338
|
-
},
|
|
3418
|
+
S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && U());
|
|
3419
|
+
}, q = () => {
|
|
3339
3420
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
3340
3421
|
T = !0;
|
|
3341
3422
|
let e = O;
|
|
3342
3423
|
l.hidden = !1, (async () => {
|
|
3343
3424
|
try {
|
|
3344
|
-
let t = await
|
|
3425
|
+
let t = await Pn.startSession(xe());
|
|
3345
3426
|
if (S || e !== O) {
|
|
3346
3427
|
t.destroy();
|
|
3347
3428
|
return;
|
|
3348
3429
|
}
|
|
3349
|
-
b = t,
|
|
3430
|
+
b = t, Te(t);
|
|
3350
3431
|
let n = await t.attach({
|
|
3351
3432
|
container: l,
|
|
3352
|
-
...
|
|
3433
|
+
...Se(),
|
|
3353
3434
|
onWidgetReady: () => {
|
|
3354
|
-
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") :
|
|
3435
|
+
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ve());
|
|
3355
3436
|
},
|
|
3356
3437
|
onWidgetExpand: () => {
|
|
3357
3438
|
Fe(e);
|
|
3358
3439
|
},
|
|
3359
3440
|
onWidgetAudioSettings: (e) => {
|
|
3360
|
-
S ||
|
|
3441
|
+
S || J(e);
|
|
3361
3442
|
},
|
|
3362
3443
|
onWidgetDragStart: (e) => {
|
|
3363
|
-
S ||
|
|
3444
|
+
S || de(e);
|
|
3364
3445
|
},
|
|
3365
3446
|
onWidgetDragMove: (e) => {
|
|
3366
|
-
S ||
|
|
3447
|
+
S || fe(e);
|
|
3367
3448
|
},
|
|
3368
3449
|
onWidgetDragEnd: (e) => {
|
|
3369
|
-
S ||
|
|
3450
|
+
S || pe(e);
|
|
3370
3451
|
},
|
|
3371
3452
|
onPlayerStatusChange: (e) => {
|
|
3372
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3453
|
+
S || e === "error" && $(a.dataset.state) && K("Could not load the experience.");
|
|
3373
3454
|
}
|
|
3374
3455
|
});
|
|
3375
3456
|
if (S || e !== O) {
|
|
@@ -3377,7 +3458,7 @@ function Kn(e, t) {
|
|
|
3377
3458
|
return;
|
|
3378
3459
|
}
|
|
3379
3460
|
n.on("close", () => {
|
|
3380
|
-
S ||
|
|
3461
|
+
S || Oe();
|
|
3381
3462
|
});
|
|
3382
3463
|
} catch (n) {
|
|
3383
3464
|
if (S || e !== O) return;
|
|
@@ -3386,43 +3467,43 @@ function Kn(e, t) {
|
|
|
3386
3467
|
t.onError?.(r), console.error("[ExperienceWidget] warm prefetch failed", r);
|
|
3387
3468
|
}
|
|
3388
3469
|
})();
|
|
3389
|
-
},
|
|
3470
|
+
}, Ie = () => {
|
|
3390
3471
|
if (S || x || !C || $(a.dataset.state)) return;
|
|
3391
3472
|
if (b && D) {
|
|
3392
|
-
|
|
3473
|
+
je();
|
|
3393
3474
|
return;
|
|
3394
3475
|
}
|
|
3395
3476
|
if (b && E) {
|
|
3396
|
-
|
|
3477
|
+
Ne();
|
|
3397
3478
|
return;
|
|
3398
3479
|
}
|
|
3399
3480
|
let e = ++O;
|
|
3400
3481
|
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 () => {
|
|
3401
3482
|
try {
|
|
3402
|
-
|
|
3403
|
-
let t = await
|
|
3483
|
+
Ce();
|
|
3484
|
+
let t = await Pn.startSession(xe());
|
|
3404
3485
|
if (S || e !== O) {
|
|
3405
3486
|
t.destroy();
|
|
3406
3487
|
return;
|
|
3407
3488
|
}
|
|
3408
|
-
b = t,
|
|
3489
|
+
b = t, Te(t);
|
|
3409
3490
|
let n = await t.attach({
|
|
3410
3491
|
container: v,
|
|
3411
|
-
...
|
|
3492
|
+
...Se(),
|
|
3412
3493
|
onWidgetAudioSettings: (e) => {
|
|
3413
|
-
S ||
|
|
3494
|
+
S || J(e);
|
|
3414
3495
|
},
|
|
3415
3496
|
onWidgetDragStart: (e) => {
|
|
3416
|
-
S ||
|
|
3497
|
+
S || de(e);
|
|
3417
3498
|
},
|
|
3418
3499
|
onWidgetDragMove: (e) => {
|
|
3419
|
-
S ||
|
|
3500
|
+
S || fe(e);
|
|
3420
3501
|
},
|
|
3421
3502
|
onWidgetDragEnd: (e) => {
|
|
3422
|
-
S ||
|
|
3503
|
+
S || pe(e);
|
|
3423
3504
|
},
|
|
3424
3505
|
onPlayerStatusChange: (e) => {
|
|
3425
|
-
S || (e === "error" ?
|
|
3506
|
+
S || (e === "error" ? K("Could not load the experience.") : $(a.dataset.state) && K(null));
|
|
3426
3507
|
}
|
|
3427
3508
|
});
|
|
3428
3509
|
if (S || e !== O) {
|
|
@@ -3430,12 +3511,12 @@ function Kn(e, t) {
|
|
|
3430
3511
|
return;
|
|
3431
3512
|
}
|
|
3432
3513
|
E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
|
|
3433
|
-
S ||
|
|
3514
|
+
S || Oe();
|
|
3434
3515
|
});
|
|
3435
3516
|
} catch (n) {
|
|
3436
3517
|
if (S || e !== O) return;
|
|
3437
3518
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3438
|
-
|
|
3519
|
+
K(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3439
3520
|
} finally {
|
|
3440
3521
|
e === O && (x = !1);
|
|
3441
3522
|
}
|
|
@@ -3443,88 +3524,88 @@ function Kn(e, t) {
|
|
|
3443
3524
|
}, Le = () => {
|
|
3444
3525
|
if (!(S || $(a.dataset.state))) {
|
|
3445
3526
|
if (b && D) {
|
|
3446
|
-
|
|
3527
|
+
je();
|
|
3447
3528
|
return;
|
|
3448
3529
|
}
|
|
3449
3530
|
if (b && E) {
|
|
3450
|
-
|
|
3531
|
+
Ne();
|
|
3451
3532
|
return;
|
|
3452
3533
|
}
|
|
3453
3534
|
if (T || b) {
|
|
3454
|
-
|
|
3535
|
+
Ce();
|
|
3455
3536
|
return;
|
|
3456
3537
|
}
|
|
3457
|
-
|
|
3538
|
+
Ie();
|
|
3458
3539
|
}
|
|
3459
3540
|
}, Re = (e) => {
|
|
3460
|
-
if (e.stopPropagation(),
|
|
3461
|
-
|
|
3541
|
+
if (e.stopPropagation(), R() === "expanded") {
|
|
3542
|
+
ke();
|
|
3462
3543
|
return;
|
|
3463
3544
|
}
|
|
3464
|
-
|
|
3465
|
-
},
|
|
3545
|
+
R() === "docked" && Ae();
|
|
3546
|
+
}, J = (e) => {
|
|
3466
3547
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
3467
3548
|
}, Be = (e) => {
|
|
3468
3549
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3469
3550
|
}, Ve = (e) => {
|
|
3470
|
-
|
|
3471
|
-
},
|
|
3472
|
-
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(),
|
|
3473
|
-
},
|
|
3551
|
+
R() === "docked" && Kn() && (e.target?.closest("button") || (e.preventDefault(), ue(e.clientX, e.clientY, e.pointerId)));
|
|
3552
|
+
}, He = (e) => {
|
|
3553
|
+
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), Oe());
|
|
3554
|
+
}, Ue = () => {
|
|
3474
3555
|
if (!S) {
|
|
3475
|
-
if (
|
|
3476
|
-
if (!
|
|
3477
|
-
|
|
3556
|
+
if (R() === "docked") {
|
|
3557
|
+
if (!Kn()) {
|
|
3558
|
+
Ae();
|
|
3478
3559
|
return;
|
|
3479
3560
|
}
|
|
3480
3561
|
D ? W(() => {
|
|
3481
|
-
|
|
3482
|
-
}) :
|
|
3562
|
+
me(!0);
|
|
3563
|
+
}) : me(!0);
|
|
3483
3564
|
return;
|
|
3484
3565
|
}
|
|
3485
|
-
|
|
3566
|
+
H();
|
|
3486
3567
|
}
|
|
3487
|
-
},
|
|
3568
|
+
}, Y = typeof window < "u" ? window.matchMedia(In) : null, We = () => {
|
|
3488
3569
|
if (!S) {
|
|
3489
|
-
if (
|
|
3490
|
-
|
|
3570
|
+
if (R() === "docked" && !Kn()) {
|
|
3571
|
+
Ae();
|
|
3491
3572
|
return;
|
|
3492
3573
|
}
|
|
3493
|
-
|
|
3574
|
+
H();
|
|
3494
3575
|
}
|
|
3495
3576
|
};
|
|
3496
|
-
return o.addEventListener("click", Le), d.addEventListener("click",
|
|
3497
|
-
e.stopPropagation(),
|
|
3498
|
-
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown",
|
|
3499
|
-
S ||
|
|
3500
|
-
}) : r === "idle" && (j =
|
|
3501
|
-
S ||
|
|
3577
|
+
return o.addEventListener("click", Le), d.addEventListener("click", Oe), _.addEventListener("click", (e) => {
|
|
3578
|
+
e.stopPropagation(), Oe();
|
|
3579
|
+
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), Y?.addEventListener("change", We), be(), H(), r === "eager" ? queueMicrotask(() => {
|
|
3580
|
+
S || q();
|
|
3581
|
+
}) : r === "idle" && (j = tr(() => {
|
|
3582
|
+
S || q();
|
|
3502
3583
|
})), {
|
|
3503
3584
|
root: a,
|
|
3504
3585
|
expand: Le,
|
|
3505
|
-
collapse:
|
|
3506
|
-
dock:
|
|
3507
|
-
maximize:
|
|
3586
|
+
collapse: Oe,
|
|
3587
|
+
dock: ke,
|
|
3588
|
+
maximize: Ae,
|
|
3508
3589
|
prefetch() {
|
|
3509
3590
|
if (r === "onExpand") {
|
|
3510
|
-
|
|
3591
|
+
q();
|
|
3511
3592
|
return;
|
|
3512
3593
|
}
|
|
3513
|
-
|
|
3594
|
+
q();
|
|
3514
3595
|
},
|
|
3515
3596
|
destroy() {
|
|
3516
|
-
S || (S = !0,
|
|
3597
|
+
S || (S = !0, V(), j?.(), j = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), Y?.removeEventListener("change", We), De(), Ee(), e.replaceChildren());
|
|
3517
3598
|
}
|
|
3518
3599
|
};
|
|
3519
3600
|
}
|
|
3520
3601
|
//#endregion
|
|
3521
3602
|
//#region src/react/ExperienceWidget.tsx
|
|
3522
|
-
function
|
|
3523
|
-
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded:
|
|
3603
|
+
function rr(t) {
|
|
3604
|
+
let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: j = "", onExpanded: M, onCollapsed: ee, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = t, ne = m === "bottom-right" || m === "bottom-left";
|
|
3524
3605
|
return e(() => {
|
|
3525
3606
|
let e = r.current;
|
|
3526
3607
|
if (!e || !i.trim()) return;
|
|
3527
|
-
let t =
|
|
3608
|
+
let t = nr(e, {
|
|
3528
3609
|
experienceId: i,
|
|
3529
3610
|
alt: o,
|
|
3530
3611
|
galleryThumb: s,
|
|
@@ -3551,14 +3632,14 @@ function qn(t) {
|
|
|
3551
3632
|
startButtonLabel: O,
|
|
3552
3633
|
startButton: k,
|
|
3553
3634
|
showFeedback: A,
|
|
3554
|
-
onFeedback:
|
|
3555
|
-
onFeedbackFailed:
|
|
3556
|
-
onExpanded:
|
|
3557
|
-
onCollapsed:
|
|
3558
|
-
onStarted:
|
|
3559
|
-
onClose:
|
|
3560
|
-
onError:
|
|
3561
|
-
onPrefetchReady:
|
|
3635
|
+
onFeedback: I,
|
|
3636
|
+
onFeedbackFailed: L,
|
|
3637
|
+
onExpanded: M,
|
|
3638
|
+
onCollapsed: ee,
|
|
3639
|
+
onStarted: N,
|
|
3640
|
+
onClose: P,
|
|
3641
|
+
onError: F,
|
|
3642
|
+
onPrefetchReady: te
|
|
3562
3643
|
});
|
|
3563
3644
|
return () => t.destroy();
|
|
3564
3645
|
}, [
|
|
@@ -3588,18 +3669,18 @@ function qn(t) {
|
|
|
3588
3669
|
O,
|
|
3589
3670
|
k,
|
|
3590
3671
|
A,
|
|
3591
|
-
F,
|
|
3592
3672
|
I,
|
|
3593
|
-
|
|
3594
|
-
te,
|
|
3673
|
+
L,
|
|
3595
3674
|
M,
|
|
3675
|
+
ee,
|
|
3596
3676
|
N,
|
|
3597
3677
|
P,
|
|
3598
|
-
|
|
3678
|
+
F,
|
|
3679
|
+
te
|
|
3599
3680
|
]), /* @__PURE__ */ a("div", {
|
|
3600
3681
|
ref: r,
|
|
3601
3682
|
className: j,
|
|
3602
|
-
style:
|
|
3683
|
+
style: ne ? { display: "contents" } : {
|
|
3603
3684
|
width: "100%",
|
|
3604
3685
|
height: "100%",
|
|
3605
3686
|
minHeight: "inherit"
|
|
@@ -3608,11 +3689,11 @@ function qn(t) {
|
|
|
3608
3689
|
}
|
|
3609
3690
|
//#endregion
|
|
3610
3691
|
//#region src/next/index.ts
|
|
3611
|
-
function
|
|
3692
|
+
function ir(e = {}) {
|
|
3612
3693
|
let t = v(e);
|
|
3613
3694
|
return { POST: ({ request: e }) => t(e) };
|
|
3614
3695
|
}
|
|
3615
3696
|
//#endregion
|
|
3616
|
-
export {
|
|
3697
|
+
export { je as ExperienceThumbnail, rr as ExperienceWidget, v as createLiformaSessionRouteHandler, ir as createLiformaSvelteKitSessionHandler };
|
|
3617
3698
|
|
|
3618
3699
|
//# sourceMappingURL=index.js.map
|