@liforma/client 0.4.14 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/next/index.js +625 -602
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/thumbnail/avatarPlate.d.ts +11 -0
- package/dist/next/thumbnail/avatarPlate.d.ts.map +1 -0
- package/dist/next/thumbnail/avatarPlate.test.d.ts +2 -0
- package/dist/next/thumbnail/avatarPlate.test.d.ts.map +1 -0
- package/dist/next/thumbnail/expandAssetUrl.d.ts +3 -2
- package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -1
- package/dist/next/thumbnail/index.d.ts +2 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +7 -3
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/next/thumbnail.js +211 -200
- package/dist/next/thumbnail.js.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 +8 -5
- package/dist/next/v2/experience.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 +506 -490
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/avatarPlate.d.ts +11 -0
- package/dist/npm/thumbnail/avatarPlate.d.ts.map +1 -0
- package/dist/npm/thumbnail/expandAssetUrl.d.ts +3 -2
- package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.d.ts +2 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +123 -110
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +7 -3
- package/dist/npm/thumbnail/toGalleryThumbUrl.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 +8 -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/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/experienceComponentRuntime.d.ts +3 -1
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +6 -4
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +733 -704
- 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/avatarPlate.d.ts +11 -0
- package/dist/react/thumbnail/avatarPlate.d.ts.map +1 -0
- package/dist/react/thumbnail/avatarPlate.test.d.ts +2 -0
- package/dist/react/thumbnail/avatarPlate.test.d.ts.map +1 -0
- package/dist/react/thumbnail/expandAssetUrl.d.ts +3 -2
- package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -1
- package/dist/react/thumbnail/index.d.ts +2 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +7 -3
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/react/thumbnail.js +211 -200
- package/dist/react/thumbnail.js.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 +8 -5
- package/dist/react/v2/experience.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 +4 -0
- package/dist/svelte/ExperienceThumbnail.svelte +3 -0
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -178,26 +178,26 @@ function O() {
|
|
|
178
178
|
function k() {
|
|
179
179
|
return new DOMException("Aborted", "AbortError");
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function ee(e) {
|
|
182
182
|
return e instanceof DOMException || e instanceof Error ? e : Error(String(e));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function te(e) {
|
|
185
185
|
return e instanceof DOMException && e.name === "AbortError";
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function A(e) {
|
|
188
188
|
!e.instance || e.instanceDestroyed || (e.instanceDestroyed = !0, e.instance.destroy());
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function j(e, t, n, r) {
|
|
191
191
|
e.unsubscribers.push(t.on(n, r));
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
193
|
+
function M(e, t, n) {
|
|
194
|
+
j(e, t, "ready", (t) => {
|
|
195
195
|
e.destroyed || (e.ready.resolve(t), n().onReady?.(t));
|
|
196
|
-
}),
|
|
196
|
+
}), j(e, t, "started", (t) => {
|
|
197
197
|
e.destroyed || (e.started.resolve(t), n().onStarted?.(t));
|
|
198
|
-
}),
|
|
198
|
+
}), j(e, t, "userTranscript", (e) => n().onUserTranscript?.(e)), j(e, t, "userSpeechStarted", (e) => n().onUserSpeechStarted?.(e)), j(e, t, "userSpeechEnded", (e) => n().onUserSpeechEnded?.(e)), j(e, t, "characterSpeechStarted", (e) => n().onCharacterSpeechStarted?.(e)), j(e, t, "characterSpeechEnded", (e) => n().onCharacterSpeechEnded?.(e)), j(e, t, "characterFocusChanged", (e) => n().onCharacterFocusChanged?.(e)), j(e, t, "conversationUpdate", (e) => n().onConversationUpdate?.(e)), j(e, t, "message", (e) => n().onMessage?.(e)), j(e, t, "listeningState", (e) => n().onListeningState?.(e)), j(e, t, "activityChange", (e) => n().onActivityChange?.(e)), j(e, t, "feedback", (e) => n().onFeedback?.(e)), j(e, t, "feedbackFailed", (e) => n().onFeedbackFailed?.(e)), j(e, t, "conversationProcessorError", (e) => n().onConversationProcessorError?.(e));
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function N(e = () => ({}), t = () => ({})) {
|
|
201
201
|
let n = 0, r = null;
|
|
202
202
|
function i(e) {
|
|
203
203
|
if (e) {
|
|
@@ -212,8 +212,8 @@ function P(e = () => ({}), t = () => ({})) {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
function a(e, t, n, a, o = !1, s) {
|
|
215
|
-
let c =
|
|
216
|
-
return !
|
|
215
|
+
let c = ee(e);
|
|
216
|
+
return !te(c) && r === t && !t.destroyed && (o && a?.(D(c, { experienceId: i(s) })), t.reportedErrors.has(c) || (t.reportedErrors.add(c), console.error("[Experience]", c), n.onError?.(c))), c;
|
|
217
217
|
}
|
|
218
218
|
function o() {
|
|
219
219
|
if (!r || r.destroyed) throw k();
|
|
@@ -241,16 +241,16 @@ function P(e = () => ({}), t = () => ({})) {
|
|
|
241
241
|
let t = k();
|
|
242
242
|
e.session.reject(t), e.ready.reject(t), e.started.reject(t);
|
|
243
243
|
for (let t of e.unsubscribers.splice(0)) t();
|
|
244
|
-
|
|
244
|
+
A(e), r === e && (r = null);
|
|
245
245
|
}
|
|
246
246
|
async function f(e, n, i, o, u, d) {
|
|
247
247
|
try {
|
|
248
248
|
let a = await c.startSession(i);
|
|
249
249
|
if (e.instance = a, e.destroyed || r !== e) {
|
|
250
|
-
|
|
250
|
+
A(e);
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
|
-
|
|
253
|
+
M(e, a, o);
|
|
254
254
|
let d = t(), f = d.returnUrl?.trim() || u?.trim(), p = await a.attach({
|
|
255
255
|
container: n,
|
|
256
256
|
fit: d.fit,
|
|
@@ -263,7 +263,9 @@ function P(e = () => ({}), t = () => ({})) {
|
|
|
263
263
|
interaction: d.interaction,
|
|
264
264
|
closeButton: d.closeButton,
|
|
265
265
|
returnUrl: f,
|
|
266
|
-
...d.
|
|
266
|
+
...d.settingsButton === void 0 ? {} : { settingsButton: d.settingsButton },
|
|
267
|
+
...d.theatreButton === void 0 ? {} : { theatreButton: d.theatreButton },
|
|
268
|
+
...d.fullscreenButton === void 0 ? {} : { fullscreenButton: d.fullscreenButton },
|
|
267
269
|
...d.theatre === void 0 ? {} : { theatre: d.theatre },
|
|
268
270
|
onTheatreChange: (e) => t().onTheatreChange?.(e),
|
|
269
271
|
showClose: !!(o().onClose || f || d.closeButton === !0 || d.closeButton && typeof d.closeButton == "object" && d.closeButton.visible !== !1),
|
|
@@ -285,7 +287,7 @@ function P(e = () => ({}), t = () => ({})) {
|
|
|
285
287
|
});
|
|
286
288
|
} catch (t) {
|
|
287
289
|
let n = a(t, e, o(), d, !0, i);
|
|
288
|
-
e.session.reject(n), e.ready.reject(n), e.started.reject(n),
|
|
290
|
+
e.session.reject(n), e.ready.reject(n), e.started.reject(n), A(e);
|
|
289
291
|
}
|
|
290
292
|
}
|
|
291
293
|
function p(t, n, i, o) {
|
|
@@ -315,17 +317,17 @@ function P(e = () => ({}), t = () => ({})) {
|
|
|
315
317
|
}
|
|
316
318
|
//#endregion
|
|
317
319
|
//#region src/svelte/experienceLoadErrorStyles.ts
|
|
318
|
-
var
|
|
319
|
-
function
|
|
320
|
+
var P = "liforma-experience-load-error-styles";
|
|
321
|
+
function ne() {
|
|
320
322
|
if (typeof document > "u" || document.getElementById("liforma-experience-load-error-styles")) return;
|
|
321
323
|
let e = document.createElement("style");
|
|
322
|
-
e.id =
|
|
324
|
+
e.id = P, e.textContent = re, document.head.append(e);
|
|
323
325
|
}
|
|
324
|
-
var
|
|
326
|
+
var re = "\n .liforma-loading-screen {\n inset: 0;\n z-index: 20;\n box-sizing: border-box;\n overflow-x: clip;\n width: 100%;\n height: 100%;\n max-width: 100vw;\n background:\n radial-gradient(circle at 50% 60%, rgba(79, 126, 196, 0.18), transparent 38%),\n #030508;\n font-family: system-ui, -apple-system, sans-serif;\n color: #e8f0ff;\n text-align: center;\n }\n .liforma-loading-screen-absolute {\n position: absolute;\n }\n .liforma-loading-card {\n position: absolute;\n left: 50%;\n top: 60%;\n transform: translate(-50%, -50%);\n width: min(22rem, calc(100% - 2.5rem));\n max-width: calc(100% - max(1.25rem, env(safe-area-inset-left, 0px)) - max(1.25rem, env(safe-area-inset-right, 0px)));\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n }\n .liforma-loading-card-error {\n display: block;\n text-align: center;\n padding: 1rem 1.05rem;\n border-radius: 14px;\n border: 1px solid rgba(255, 154, 154, 0.28);\n background:\n linear-gradient(180deg, rgba(21, 29, 42, 0.92), rgba(9, 13, 20, 0.92));\n }\n .liforma-loading-kicker {\n margin: 0 0 0.18rem;\n color: #8ba4c5;\n font-size: 0.68rem;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.08em;\n }\n .liforma-loading-error {\n margin: 0;\n max-width: 28rem;\n color: #ffb4b4;\n font-size: 0.92rem;\n line-height: 1.4;\n }\n .liforma-loading-error-title {\n margin: 0;\n color: #f6ebe8;\n font-size: 0.98rem;\n font-weight: 650;\n line-height: 1.35;\n }\n .liforma-loading-error-advanced {\n margin: 0.85rem 0 0;\n padding: 0;\n border: 0;\n background: transparent;\n color: #9eb7d8;\n font: inherit;\n font-size: 0.78rem;\n font-weight: 650;\n letter-spacing: 0.02em;\n text-decoration: underline;\n text-underline-offset: 0.18em;\n cursor: pointer;\n }\n .liforma-loading-error-advanced:hover,\n .liforma-loading-error-advanced:focus-visible {\n color: #d7e6ff;\n outline: none;\n }\n .liforma-loading-error-detail {\n margin: 0.7rem 0 0;\n padding: 0.65rem 0.7rem;\n border-radius: 10px;\n border: 1px solid rgba(158, 191, 255, 0.16);\n background: rgba(3, 5, 8, 0.45);\n color: #c6d4e8;\n font-size: 0.78rem;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n line-height: 1.4;\n text-align: left;\n white-space: pre-wrap;\n word-break: break-word;\n }\n .liforma-loading-error-detail[hidden] {\n display: none;\n }\n";
|
|
325
327
|
//#endregion
|
|
326
328
|
//#region src/svelte/experienceLoadErrorOverlay.ts
|
|
327
|
-
function
|
|
328
|
-
|
|
329
|
+
function F(e, t) {
|
|
330
|
+
ne();
|
|
329
331
|
let n = t, r = !1, i = document.createElement("div");
|
|
330
332
|
i.className = "liforma-loading-screen liforma-loading-screen-absolute", i.setAttribute("role", "alert"), i.setAttribute("aria-live", "assertive");
|
|
331
333
|
let a = document.createElement("div");
|
|
@@ -355,8 +357,8 @@ function L(e, t) {
|
|
|
355
357
|
}
|
|
356
358
|
//#endregion
|
|
357
359
|
//#region src/react/Experience.tsx
|
|
358
|
-
var
|
|
359
|
-
let { returnUrl: c, fit: l, stage: u, pipBackground: p, pipShadow: m, startButton: h, theme: g, showFeedback: y, interaction: b,
|
|
360
|
+
var I = e(function(e, a) {
|
|
361
|
+
let { returnUrl: c, fit: l, stage: u, pipBackground: p, pipShadow: m, startButton: h, theme: g, showFeedback: y, interaction: b, settingsButton: x, theatreButton: S, fullscreenButton: C, theatre: w, onTheatreChange: T, closeButton: E, onReady: D, onStarted: O, onUserTranscript: te, onUserSpeechStarted: A, onUserSpeechEnded: j, onCharacterSpeechStarted: M, onCharacterSpeechEnded: P, onCharacterFocusChanged: ne, onConversationUpdate: re, onMessage: I, onListeningState: ie, onActivityChange: ae, onFeedback: L, onFeedbackFailed: R, onConversationProcessorError: oe, onPlayerStatusChange: se, onStateUpdate: ce, onClose: le, onError: ue } = e, de = o({}), z = o({
|
|
360
362
|
fit: l,
|
|
361
363
|
stage: u,
|
|
362
364
|
pipBackground: p,
|
|
@@ -365,13 +367,15 @@ var ne = e(function(e, a) {
|
|
|
365
367
|
theme: g,
|
|
366
368
|
showFeedback: y,
|
|
367
369
|
interaction: b,
|
|
368
|
-
closeButton:
|
|
370
|
+
closeButton: E,
|
|
369
371
|
returnUrl: c,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
settingsButton: x,
|
|
373
|
+
theatreButton: S,
|
|
374
|
+
fullscreenButton: C,
|
|
375
|
+
theatre: w,
|
|
376
|
+
onTheatreChange: T
|
|
377
|
+
}), B = o(N(() => de.current, () => z.current)), V = o(null), [fe, pe] = s(!1), [H, me] = s(null), U = o(null), he = o(null), ge = v(e);
|
|
378
|
+
z.current = {
|
|
375
379
|
fit: l,
|
|
376
380
|
stage: u,
|
|
377
381
|
pipBackground: p,
|
|
@@ -380,34 +384,36 @@ var ne = e(function(e, a) {
|
|
|
380
384
|
theme: g,
|
|
381
385
|
showFeedback: y,
|
|
382
386
|
interaction: b,
|
|
383
|
-
closeButton:
|
|
387
|
+
closeButton: E,
|
|
384
388
|
returnUrl: c,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
389
|
+
settingsButton: x,
|
|
390
|
+
theatreButton: S,
|
|
391
|
+
fullscreenButton: C,
|
|
392
|
+
theatre: w,
|
|
393
|
+
onTheatreChange: T
|
|
394
|
+
}, de.current = {
|
|
395
|
+
onReady: D,
|
|
396
|
+
onStarted: O,
|
|
397
|
+
onUserTranscript: te,
|
|
398
|
+
onUserSpeechStarted: A,
|
|
399
|
+
onUserSpeechEnded: j,
|
|
400
|
+
onCharacterSpeechStarted: M,
|
|
401
|
+
onCharacterSpeechEnded: P,
|
|
402
|
+
onCharacterFocusChanged: ne,
|
|
403
|
+
onConversationUpdate: re,
|
|
404
|
+
onMessage: I,
|
|
405
|
+
onListeningState: ie,
|
|
406
|
+
onActivityChange: ae,
|
|
407
|
+
onFeedback: L,
|
|
408
|
+
onFeedbackFailed: R,
|
|
409
|
+
onConversationProcessorError: oe,
|
|
410
|
+
onPlayerStatusChange: se,
|
|
411
|
+
onStateUpdate: ce,
|
|
412
|
+
onClose: le,
|
|
413
|
+
onError: ue
|
|
414
|
+
};
|
|
415
|
+
let _e = t((e) => {
|
|
416
|
+
U.current = e, pe(e !== null);
|
|
411
417
|
}, []);
|
|
412
418
|
return r(a, () => ({
|
|
413
419
|
ready: () => {
|
|
@@ -446,20 +452,20 @@ var ne = e(function(e, a) {
|
|
|
446
452
|
engage: () => B.current.withSession((e) => e.engage()),
|
|
447
453
|
end: () => B.current.withSession((e) => e.end())
|
|
448
454
|
}), []), i(() => {
|
|
449
|
-
if (!
|
|
450
|
-
let t =
|
|
455
|
+
if (!fe || !U.current) return;
|
|
456
|
+
let t = U.current, n = B.current, r;
|
|
451
457
|
try {
|
|
452
458
|
r = { options: _(e) };
|
|
453
459
|
} catch (e) {
|
|
454
|
-
r = { error:
|
|
460
|
+
r = { error: ee(e) };
|
|
455
461
|
}
|
|
456
|
-
let i = n.activateGeneration(t, r, c,
|
|
462
|
+
let i = n.activateGeneration(t, r, c, me);
|
|
457
463
|
return V.current = i, () => {
|
|
458
464
|
n.cancelGeneration(i), V.current === i && (V.current = null);
|
|
459
465
|
};
|
|
460
466
|
}, [
|
|
461
|
-
|
|
462
|
-
|
|
467
|
+
fe,
|
|
468
|
+
ge,
|
|
463
469
|
c
|
|
464
470
|
]), n(() => {
|
|
465
471
|
let e = B.current.getActiveInstance();
|
|
@@ -475,15 +481,15 @@ var ne = e(function(e, a) {
|
|
|
475
481
|
let e = B.current.getActiveInstance();
|
|
476
482
|
e && e.setPipShadow(m);
|
|
477
483
|
}, [m]), n(() => {
|
|
478
|
-
if (!
|
|
484
|
+
if (!S) return;
|
|
479
485
|
let e = B.current.getActiveInstance();
|
|
480
|
-
e && e.setTheatre(
|
|
481
|
-
}, [
|
|
482
|
-
let e =
|
|
483
|
-
if (!e || (e.replaceChildren(), !
|
|
484
|
-
let t =
|
|
486
|
+
e && e.setTheatre(w === !0);
|
|
487
|
+
}, [S, w]), n(() => {
|
|
488
|
+
let e = he.current;
|
|
489
|
+
if (!e || (e.replaceChildren(), !H)) return;
|
|
490
|
+
let t = F(e, H);
|
|
485
491
|
return () => t.remove();
|
|
486
|
-
}, [
|
|
492
|
+
}, [H]), /* @__PURE__ */ f("div", {
|
|
487
493
|
className: "liforma-experience-shell",
|
|
488
494
|
style: {
|
|
489
495
|
position: "relative",
|
|
@@ -492,17 +498,17 @@ var ne = e(function(e, a) {
|
|
|
492
498
|
minHeight: "inherit"
|
|
493
499
|
},
|
|
494
500
|
children: [/* @__PURE__ */ d("div", {
|
|
495
|
-
ref:
|
|
501
|
+
ref: he,
|
|
496
502
|
className: "liforma-experience-error-host",
|
|
497
|
-
"aria-hidden":
|
|
503
|
+
"aria-hidden": H ? void 0 : !0,
|
|
498
504
|
style: {
|
|
499
505
|
position: "absolute",
|
|
500
506
|
inset: 0,
|
|
501
507
|
zIndex: 20,
|
|
502
|
-
pointerEvents:
|
|
508
|
+
pointerEvents: H ? "auto" : "none"
|
|
503
509
|
}
|
|
504
510
|
}), /* @__PURE__ */ d("div", {
|
|
505
|
-
ref:
|
|
511
|
+
ref: _e,
|
|
506
512
|
className: "liforma-experience-host",
|
|
507
513
|
style: {
|
|
508
514
|
position: "absolute",
|
|
@@ -514,20 +520,32 @@ var ne = e(function(e, a) {
|
|
|
514
520
|
});
|
|
515
521
|
//#endregion
|
|
516
522
|
//#region src/thumbnail/types.ts
|
|
517
|
-
function
|
|
523
|
+
function ie(e) {
|
|
518
524
|
return e === "face" ? "liforma-et--fit-face" : e === "medium" ? "liforma-et--fit-medium" : "";
|
|
519
525
|
}
|
|
520
526
|
//#endregion
|
|
521
|
-
//#region src/thumbnail/
|
|
522
|
-
var
|
|
527
|
+
//#region src/thumbnail/avatarPlate.ts
|
|
528
|
+
var ae = /(\/avatars\/[^/]+\/)(\d+)(\/)/i;
|
|
529
|
+
function L(e, t) {
|
|
530
|
+
if (!Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1) return "256";
|
|
531
|
+
let n = Math.max(e, t);
|
|
532
|
+
return n > 512 ? "1024" : n > 280 ? "512" : "256";
|
|
533
|
+
}
|
|
523
534
|
function R(e, t) {
|
|
535
|
+
let n = e.trim();
|
|
536
|
+
return n && n.replace(ae, (e, n, r, i) => `${n}${t}${i}`);
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/thumbnail/locationPlate.ts
|
|
540
|
+
var oe = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
|
|
541
|
+
function se(e, t) {
|
|
524
542
|
return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
|
|
525
543
|
}
|
|
526
|
-
function
|
|
544
|
+
function ce(e, t) {
|
|
527
545
|
let n = e.trim();
|
|
528
|
-
return n && n.replace(
|
|
546
|
+
return n && n.replace(oe, (e, n, r, i, a) => `${n}${t}${i}${a}`);
|
|
529
547
|
}
|
|
530
|
-
function
|
|
548
|
+
function le(e, t) {
|
|
531
549
|
let n = () => {
|
|
532
550
|
t(e.clientWidth, e.clientHeight);
|
|
533
551
|
};
|
|
@@ -535,17 +553,17 @@ function oe(e, t) {
|
|
|
535
553
|
let r = new ResizeObserver(n);
|
|
536
554
|
return r.observe(e), () => r.disconnect();
|
|
537
555
|
}
|
|
538
|
-
var
|
|
539
|
-
function
|
|
556
|
+
var ue = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
557
|
+
function de(e) {
|
|
540
558
|
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
541
559
|
}
|
|
542
|
-
function
|
|
560
|
+
function z(e) {
|
|
543
561
|
return /^https?:\/\//i.test(e) || e.startsWith("//");
|
|
544
562
|
}
|
|
545
|
-
function
|
|
563
|
+
function B(e) {
|
|
546
564
|
return e.startsWith("//") ? `https:${e}` : e;
|
|
547
565
|
}
|
|
548
|
-
function
|
|
566
|
+
function V(e) {
|
|
549
567
|
let t = e.indexOf("?");
|
|
550
568
|
return t === -1 ? {
|
|
551
569
|
pathname: e,
|
|
@@ -555,61 +573,58 @@ function B(e) {
|
|
|
555
573
|
search: e.slice(t)
|
|
556
574
|
};
|
|
557
575
|
}
|
|
558
|
-
function
|
|
576
|
+
function fe(e, t, n = "") {
|
|
559
577
|
return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
|
|
560
578
|
}
|
|
561
|
-
function
|
|
579
|
+
function pe(e, t, n) {
|
|
562
580
|
let r = e.trim();
|
|
563
581
|
if (!r) return r;
|
|
564
|
-
let i =
|
|
565
|
-
if (
|
|
566
|
-
let { pathname: a, search: o } =
|
|
582
|
+
let i = de(n);
|
|
583
|
+
if (z(r)) return ce(B(r), t);
|
|
584
|
+
let { pathname: a, search: o } = V(r.replace(/\\/g, "/")), s = a;
|
|
567
585
|
if (!s.startsWith("/")) s = `/locations/${s.replace(/^locations\//i, "")}`;
|
|
568
|
-
else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ?
|
|
569
|
-
if (/\.webp$/i.test(s) && !
|
|
586
|
+
else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? fe(i, s, o) : r;
|
|
587
|
+
if (/\.webp$/i.test(s) && !ue.test(s.replace(/\.webp$/i, ""))) return fe(i, s, o);
|
|
570
588
|
let c = s.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
|
|
571
|
-
return c = c.replace(
|
|
589
|
+
return c = c.replace(ue, ""), `${i}/locations/${c}-${t}.webp${o}`;
|
|
572
590
|
}
|
|
573
|
-
function
|
|
574
|
-
let
|
|
575
|
-
if (!
|
|
576
|
-
let
|
|
577
|
-
if (
|
|
578
|
-
let { pathname:
|
|
579
|
-
if (!
|
|
580
|
-
else if (/^[^/]+$/.test(
|
|
581
|
-
else return
|
|
582
|
-
if (!/^\/avatars\//i.test(
|
|
583
|
-
let
|
|
584
|
-
return
|
|
591
|
+
function H(e, t, n = "256") {
|
|
592
|
+
let r = e.trim();
|
|
593
|
+
if (!r) return r;
|
|
594
|
+
let i = de(t), a = n;
|
|
595
|
+
if (z(r)) return R(B(r), a);
|
|
596
|
+
let { pathname: o, search: s } = V(r.replace(/\\/g, "/")), c = o;
|
|
597
|
+
if (!c.startsWith("/")) if (/^avatars\//i.test(c)) c = `/${c}`;
|
|
598
|
+
else if (/^[^/]+$/.test(c) && !s) return `${i}/avatars/${c}/${a}/${c}_neutral.webp`;
|
|
599
|
+
else return r;
|
|
600
|
+
if (!/^\/avatars\//i.test(c)) return r;
|
|
601
|
+
let l = c.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
|
|
602
|
+
return l && !l.includes("/") && !s ? `${i}/avatars/${l}/${a}/${l}_neutral.webp` : R(fe(i, c, s), a);
|
|
585
603
|
}
|
|
586
604
|
//#endregion
|
|
587
605
|
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
588
|
-
var
|
|
589
|
-
function
|
|
606
|
+
var me = /_CH(\.webp)/i;
|
|
607
|
+
function U(e) {
|
|
590
608
|
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("/");
|
|
591
609
|
}
|
|
592
|
-
function
|
|
593
|
-
let
|
|
594
|
-
|
|
595
|
-
if (H(r)) return ue(r, t, n);
|
|
596
|
-
let i = de(r, n);
|
|
597
|
-
return i = i.replace(fe, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(pe, "_neutral$1");
|
|
610
|
+
function he(e, t = "256x256", n, r = "256") {
|
|
611
|
+
let i = e.trim();
|
|
612
|
+
return i && (U(i) ? pe(i, t, n) : H(i, n, r).replace(me, "_neutral$1"));
|
|
598
613
|
}
|
|
599
|
-
function
|
|
614
|
+
function ge(e) {
|
|
600
615
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
601
616
|
if (!t) return null;
|
|
602
|
-
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 =
|
|
617
|
+
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = e.avatarPlateSize ?? "256", s = de(e.cdnBaseUrl), c = e.normalize !== !1, l = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : he(e, a, s, o), u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : pe(e, a, s);
|
|
603
618
|
return {
|
|
604
|
-
avatarImage:
|
|
605
|
-
...n ? { backgroundImage:
|
|
606
|
-
...r ? { foregroundImage:
|
|
607
|
-
...i ? { fallbackImage:
|
|
619
|
+
avatarImage: l(t),
|
|
620
|
+
...n ? { backgroundImage: u(n) } : {},
|
|
621
|
+
...r ? { foregroundImage: u(r) } : {},
|
|
622
|
+
...i ? { fallbackImage: l(i) } : {}
|
|
608
623
|
};
|
|
609
624
|
}
|
|
610
625
|
//#endregion
|
|
611
626
|
//#region src/shims/localStack.ts
|
|
612
|
-
function
|
|
627
|
+
function _e() {
|
|
613
628
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
614
629
|
if (typeof location > "u") return !1;
|
|
615
630
|
try {
|
|
@@ -620,83 +635,83 @@ function ge() {
|
|
|
620
635
|
}
|
|
621
636
|
//#endregion
|
|
622
637
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
623
|
-
var
|
|
624
|
-
function
|
|
638
|
+
var W = "https://player.liforma.ai", ve = "http://localhost:3002";
|
|
639
|
+
function ye(e) {
|
|
625
640
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
626
641
|
}
|
|
627
|
-
function
|
|
642
|
+
function be(e) {
|
|
628
643
|
let t = e?.trim();
|
|
629
|
-
return t ? t.replace(/\/$/, "") :
|
|
644
|
+
return t ? t.replace(/\/$/, "") : _e() ? ve : W;
|
|
630
645
|
}
|
|
631
|
-
function
|
|
632
|
-
let t = e.experienceId.trim(), n =
|
|
646
|
+
function xe(e) {
|
|
647
|
+
let t = e.experienceId.trim(), n = be(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
633
648
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
634
649
|
}
|
|
635
|
-
function
|
|
650
|
+
function Se(e) {
|
|
636
651
|
let t = e.href?.trim();
|
|
637
652
|
if (t) return t;
|
|
638
653
|
let n = e.experienceId?.trim();
|
|
639
654
|
if (!n) return;
|
|
640
655
|
let r = e.returnUrl?.trim();
|
|
641
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
656
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), xe({
|
|
642
657
|
experienceId: n,
|
|
643
658
|
...r ? { returnUrl: r } : {},
|
|
644
659
|
playerBaseUrl: e.playerBaseUrl
|
|
645
660
|
});
|
|
646
661
|
}
|
|
647
|
-
function
|
|
662
|
+
function Ce() {
|
|
648
663
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
649
664
|
}
|
|
650
|
-
var
|
|
665
|
+
var G = 0, K = [];
|
|
651
666
|
function we() {
|
|
652
|
-
return
|
|
653
|
-
}
|
|
654
|
-
function G() {
|
|
655
|
-
return xe() ? 160 : 0;
|
|
667
|
+
return Ce() ? 4 : Infinity;
|
|
656
668
|
}
|
|
657
669
|
function Te() {
|
|
670
|
+
return Ce() ? 160 : 0;
|
|
671
|
+
}
|
|
672
|
+
function Ee() {
|
|
658
673
|
let e = we();
|
|
659
|
-
for (;
|
|
660
|
-
let e =
|
|
674
|
+
for (; G < e && K.length > 0;) {
|
|
675
|
+
let e = K.shift();
|
|
661
676
|
if (!e || e.cancelled) continue;
|
|
662
|
-
|
|
663
|
-
let t =
|
|
677
|
+
G += 1, e.start();
|
|
678
|
+
let t = Te();
|
|
664
679
|
if (t <= 0) {
|
|
665
|
-
|
|
680
|
+
G = Math.max(0, G - 1);
|
|
666
681
|
continue;
|
|
667
682
|
}
|
|
668
683
|
window.setTimeout(() => {
|
|
669
|
-
|
|
684
|
+
G = Math.max(0, G - 1), Ee();
|
|
670
685
|
}, t);
|
|
671
686
|
}
|
|
672
687
|
}
|
|
673
|
-
function
|
|
674
|
-
if (!
|
|
688
|
+
function De(e) {
|
|
689
|
+
if (!Ce()) return e(), () => {};
|
|
675
690
|
let t = {
|
|
676
691
|
start: e,
|
|
677
692
|
cancelled: !1
|
|
678
693
|
};
|
|
679
|
-
return
|
|
694
|
+
return K.push(t), Ee(), () => {
|
|
680
695
|
t.cancelled = !0;
|
|
681
696
|
};
|
|
682
697
|
}
|
|
683
698
|
//#endregion
|
|
684
699
|
//#region src/thumbnail/lazyLoad.ts
|
|
685
|
-
function
|
|
686
|
-
return
|
|
700
|
+
function q() {
|
|
701
|
+
return Ce() ? "96px 0px" : "280px 0px";
|
|
687
702
|
}
|
|
688
703
|
function Oe(e) {
|
|
689
704
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
690
705
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
691
706
|
}
|
|
692
|
-
function
|
|
707
|
+
function ke(e, t) {
|
|
693
708
|
if (typeof window > "u") return !1;
|
|
694
709
|
let n = e.getBoundingClientRect();
|
|
695
710
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
696
711
|
}
|
|
697
|
-
function
|
|
698
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
699
|
-
o || (s?.(), s =
|
|
712
|
+
function Ae(e, t) {
|
|
713
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? q(), i = Oe(r), a = !1, o = !1, s = null, c = () => {
|
|
714
|
+
o || (s?.(), s = De(() => {
|
|
700
715
|
s = null, o = !0, n(!0);
|
|
701
716
|
}));
|
|
702
717
|
}, l = (e) => {
|
|
@@ -718,55 +733,55 @@ function ke(e, t) {
|
|
|
718
733
|
rootMargin: r,
|
|
719
734
|
threshold: 0
|
|
720
735
|
});
|
|
721
|
-
return u.observe(e),
|
|
736
|
+
return u.observe(e), ke(e, i) && l(!0), () => {
|
|
722
737
|
s?.(), s = null, u.disconnect();
|
|
723
738
|
};
|
|
724
739
|
}
|
|
725
740
|
//#endregion
|
|
726
741
|
//#region src/thumbnail/scrollParallax.ts
|
|
727
|
-
function
|
|
742
|
+
function je() {
|
|
728
743
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
729
744
|
}
|
|
730
|
-
function
|
|
745
|
+
function Me(e, t) {
|
|
731
746
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
732
747
|
}
|
|
733
|
-
var
|
|
734
|
-
function
|
|
735
|
-
if (
|
|
748
|
+
var J = /* @__PURE__ */ new Set(), Ne = !1, Pe = 0;
|
|
749
|
+
function Fe() {
|
|
750
|
+
if (Pe = 0, J.size === 0 || typeof window > "u") return;
|
|
736
751
|
let e = window.innerHeight;
|
|
737
|
-
for (let t of
|
|
752
|
+
for (let t of J) {
|
|
738
753
|
if (t.pointerActive?.()) continue;
|
|
739
754
|
let n = t.element.getBoundingClientRect();
|
|
740
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
755
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(Me(n, e));
|
|
741
756
|
}
|
|
742
757
|
}
|
|
743
|
-
function
|
|
744
|
-
|
|
758
|
+
function Ie() {
|
|
759
|
+
Pe === 0 && (Pe = requestAnimationFrame(Fe));
|
|
745
760
|
}
|
|
746
|
-
function
|
|
747
|
-
|
|
761
|
+
function Le() {
|
|
762
|
+
Ne || typeof window > "u" || (Ne = !0, window.addEventListener("scroll", Ie, { passive: !0 }), window.addEventListener("resize", Ie, { passive: !0 }));
|
|
748
763
|
}
|
|
749
|
-
function
|
|
750
|
-
|
|
764
|
+
function Re() {
|
|
765
|
+
J.size > 0 || !Ne || typeof window > "u" || (Ne = !1, Pe !== 0 && (cancelAnimationFrame(Pe), Pe = 0), window.removeEventListener("scroll", Ie), window.removeEventListener("resize", Ie));
|
|
751
766
|
}
|
|
752
|
-
function
|
|
753
|
-
if (!
|
|
767
|
+
function ze(e, t) {
|
|
768
|
+
if (!je()) return () => {};
|
|
754
769
|
let n = {
|
|
755
770
|
element: e,
|
|
756
771
|
onParallax: t.onParallax,
|
|
757
772
|
pointerActive: t.pointerActive
|
|
758
773
|
};
|
|
759
|
-
return
|
|
760
|
-
|
|
774
|
+
return J.add(n), Le(), n.pointerActive?.() || t.onParallax(Me(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
775
|
+
J.delete(n), Re();
|
|
761
776
|
};
|
|
762
777
|
}
|
|
763
778
|
//#endregion
|
|
764
779
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
765
|
-
function
|
|
780
|
+
function Be(e) {
|
|
766
781
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
767
782
|
let a = r || i;
|
|
768
783
|
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));
|
|
769
|
-
}, s =
|
|
784
|
+
}, s = ze(e, {
|
|
770
785
|
onParallax: (e) => {
|
|
771
786
|
i = !0, a || (t = e, n = 0, o());
|
|
772
787
|
},
|
|
@@ -779,7 +794,7 @@ function Re(e) {
|
|
|
779
794
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
780
795
|
}, u = () => {
|
|
781
796
|
let s = a;
|
|
782
|
-
a = !1, r = !1, i && s ? (t =
|
|
797
|
+
a = !1, r = !1, i && s ? (t = Me(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
783
798
|
}, d = (e) => {
|
|
784
799
|
e.pointerType === "mouse" && (r = !0, o());
|
|
785
800
|
}, f = () => {
|
|
@@ -791,65 +806,66 @@ function Re(e) {
|
|
|
791
806
|
}
|
|
792
807
|
//#endregion
|
|
793
808
|
//#region src/thumbnail/styles.ts
|
|
794
|
-
var
|
|
795
|
-
function
|
|
796
|
-
if (typeof document > "u" ||
|
|
809
|
+
var Ve = ":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}", He = !1;
|
|
810
|
+
function Ue(e) {
|
|
811
|
+
if (typeof document > "u" || He) return;
|
|
797
812
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
798
|
-
|
|
813
|
+
He = !0;
|
|
799
814
|
return;
|
|
800
815
|
}
|
|
801
816
|
let t = document.createElement("style");
|
|
802
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
817
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), He = !0;
|
|
803
818
|
}
|
|
804
819
|
//#endregion
|
|
805
820
|
//#region src/thumbnail/plateDelivery.ts
|
|
806
|
-
var
|
|
807
|
-
function
|
|
821
|
+
var We = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Ge = null;
|
|
822
|
+
function Ke(e) {
|
|
808
823
|
let t = e.trim();
|
|
809
824
|
if (!t || t.startsWith("blob:") || t.startsWith("data:")) return !1;
|
|
810
825
|
let n = t.split(/[?#]/)[0] ?? t, r = /\/avatars\//i.test(n), i = /\/locations\//i.test(n);
|
|
811
826
|
return !r && !i || /\.depth\.webp$/i.test(n) ? !1 : /\.webp$/i.test(n);
|
|
812
827
|
}
|
|
813
|
-
function
|
|
814
|
-
if (!
|
|
828
|
+
function qe(e) {
|
|
829
|
+
if (!Ke(e)) return null;
|
|
815
830
|
let t = e.search(/[?#]/);
|
|
816
831
|
if (t < 0) return e.replace(/\.webp$/i, ".avif");
|
|
817
832
|
let n = e.slice(0, t), r = e.slice(t);
|
|
818
833
|
return `${n.replace(/\.webp$/i, ".avif")}${r}`;
|
|
819
834
|
}
|
|
820
|
-
function
|
|
821
|
-
return typeof Image > "u" ? Promise.resolve(!1) : (
|
|
835
|
+
function Je() {
|
|
836
|
+
return typeof Image > "u" ? Promise.resolve(!1) : (Ge ||= new Promise((e) => {
|
|
822
837
|
let t = new Image();
|
|
823
|
-
t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src =
|
|
824
|
-
}),
|
|
838
|
+
t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = We;
|
|
839
|
+
}), Ge);
|
|
825
840
|
}
|
|
826
|
-
function
|
|
827
|
-
return t ?
|
|
841
|
+
function Ye(e, t) {
|
|
842
|
+
return t ? qe(e) ?? e : e;
|
|
828
843
|
}
|
|
829
|
-
function
|
|
844
|
+
function Xe(e) {
|
|
830
845
|
let t = e.trim(), n = t.search(/[?#]/), r = n < 0 ? t : t.slice(0, n);
|
|
831
846
|
if (!/\.avif$/i.test(r)) return null;
|
|
832
847
|
let i = r.replace(/\.avif$/i, ".webp");
|
|
833
848
|
return n < 0 ? i : `${i}${t.slice(n)}`;
|
|
834
849
|
}
|
|
835
|
-
function
|
|
850
|
+
function Ze(e) {
|
|
836
851
|
let t = e.trim();
|
|
837
852
|
return /-400x225\.(webp|avif)(?:$|[?#])/i.test(t) ? t.replace(/-400x225\.(webp|avif)/i, "-800x450.$1") : null;
|
|
838
853
|
}
|
|
839
854
|
//#endregion
|
|
840
855
|
//#region src/react/ExperienceThumbnail.tsx
|
|
841
|
-
function
|
|
856
|
+
function Qe(e, t) {
|
|
842
857
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
843
858
|
}
|
|
844
|
-
function
|
|
845
|
-
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w, normalizeUrls: T = !0, cdnBaseUrl: E } = e, D = o(null), O = o(!1), [k,
|
|
859
|
+
function $e(e) {
|
|
860
|
+
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w, normalizeUrls: T = !0, cdnBaseUrl: E } = e, D = o(null), O = o(!1), [k, ee] = s(0), [te, A] = s(0), j = se(k, te), M = L(k, te), N = a(() => ge({
|
|
846
861
|
galleryThumb: t,
|
|
847
862
|
avatarImage: r,
|
|
848
863
|
backgroundImage: i,
|
|
849
864
|
foregroundImage: c,
|
|
850
865
|
fallbackImage: w,
|
|
851
866
|
normalize: T,
|
|
852
|
-
locationPlateSize:
|
|
867
|
+
locationPlateSize: j,
|
|
868
|
+
avatarPlateSize: M,
|
|
853
869
|
cdnBaseUrl: E
|
|
854
870
|
}), [
|
|
855
871
|
t,
|
|
@@ -858,89 +874,90 @@ function Ze(e) {
|
|
|
858
874
|
c,
|
|
859
875
|
w,
|
|
860
876
|
T,
|
|
877
|
+
j,
|
|
861
878
|
M,
|
|
862
879
|
E
|
|
863
|
-
]), P =
|
|
880
|
+
]), P = ye({
|
|
864
881
|
href: m,
|
|
865
882
|
hasClickHandler: typeof _ == "function",
|
|
866
883
|
experienceId: p
|
|
867
|
-
}),
|
|
884
|
+
}), ne = P === "anchor" && !m?.trim() && !!p?.trim(), re = !!N?.backgroundImage, F = b !== !1, [I, ae] = s(!S), [R, oe] = s(!1), [ce, ue] = s(!1), [de, z] = s(!1), [B, V] = s(!1), [fe, pe] = s(!1), [H, me] = s(!1), [U, he] = s(!1), [_e, W] = s(0), [ve, be] = s(0), [xe, Ce] = s(!1), [G, K] = s(!1), [we, Te] = s(!1), [Ee, De] = s(!1), [q, Oe] = s(), ke = N ? xe && N.fallbackImage ? N.fallbackImage : N.avatarImage : "";
|
|
868
885
|
n(() => {
|
|
869
|
-
Ve
|
|
870
|
-
|
|
886
|
+
Ue(Ve), Je().then((e) => {
|
|
887
|
+
oe(e), ue(!0);
|
|
871
888
|
});
|
|
872
889
|
}, []), n(() => {
|
|
873
|
-
Oe(
|
|
890
|
+
Oe(Se({
|
|
874
891
|
href: m,
|
|
875
892
|
experienceId: p,
|
|
876
893
|
returnUrl: v,
|
|
877
894
|
playerBaseUrl: y,
|
|
878
|
-
useCurrentPageAsReturnUrl:
|
|
895
|
+
useCurrentPageAsReturnUrl: ne && !v?.trim()
|
|
879
896
|
}));
|
|
880
897
|
}, [
|
|
881
898
|
m,
|
|
882
899
|
p,
|
|
883
900
|
v,
|
|
884
901
|
y,
|
|
885
|
-
|
|
902
|
+
ne
|
|
886
903
|
]), n(() => {
|
|
887
|
-
|
|
904
|
+
K(!1), Te(!1), De(!1), Ce(!1), z(!1), V(!1), pe(!1);
|
|
888
905
|
}, [
|
|
889
906
|
N?.backgroundImage,
|
|
890
907
|
N?.foregroundImage,
|
|
891
|
-
|
|
908
|
+
ke
|
|
892
909
|
]), n(() => {
|
|
893
910
|
let e = D.current;
|
|
894
|
-
if (e) return
|
|
895
|
-
|
|
911
|
+
if (e) return le(e, (e, t) => {
|
|
912
|
+
ee(e), A(t);
|
|
896
913
|
});
|
|
897
|
-
}, [P,
|
|
914
|
+
}, [P, q]), n(() => {
|
|
898
915
|
let e = D.current;
|
|
899
916
|
if (e) {
|
|
900
917
|
if (!S) {
|
|
901
|
-
|
|
918
|
+
ae(!0);
|
|
902
919
|
return;
|
|
903
920
|
}
|
|
904
|
-
return
|
|
905
|
-
e &&
|
|
921
|
+
return Ae(e, { onVisibleChange: (e) => {
|
|
922
|
+
e && ae(!0);
|
|
906
923
|
} });
|
|
907
924
|
}
|
|
908
925
|
}, [
|
|
909
926
|
S,
|
|
910
927
|
N,
|
|
911
928
|
P,
|
|
912
|
-
|
|
929
|
+
q
|
|
913
930
|
]), n(() => {
|
|
914
931
|
let e = D.current;
|
|
915
|
-
if (!(!e || !
|
|
932
|
+
if (!(!e || !F)) return ze(e, {
|
|
916
933
|
onParallax: (e) => {
|
|
917
|
-
|
|
934
|
+
he(!0), O.current || (W(e), be(0));
|
|
918
935
|
},
|
|
919
936
|
pointerActive: () => O.current
|
|
920
937
|
});
|
|
921
938
|
}, [
|
|
922
|
-
|
|
939
|
+
F,
|
|
923
940
|
N,
|
|
924
941
|
P,
|
|
925
|
-
|
|
942
|
+
q
|
|
926
943
|
]);
|
|
927
|
-
let
|
|
928
|
-
if (!
|
|
944
|
+
let je = (e) => {
|
|
945
|
+
if (!F || U) return;
|
|
929
946
|
let t = e.currentTarget.getBoundingClientRect();
|
|
930
|
-
t.width <= 0 || t.height <= 0 || (
|
|
931
|
-
},
|
|
947
|
+
t.width <= 0 || t.height <= 0 || (W(((e.clientX - t.left) / t.width - .5) * 2), be(((e.clientY - t.top) / t.height - .5) * 2));
|
|
948
|
+
}, J = (e) => {
|
|
932
949
|
let t = O.current;
|
|
933
|
-
O.current = !1,
|
|
934
|
-
},
|
|
935
|
-
if (!
|
|
936
|
-
O.current = !0, e.pointerType === "mouse" &&
|
|
950
|
+
O.current = !1, me(!1), U && t ? (W(Me(e.getBoundingClientRect(), window.innerHeight)), be(0)) : U || (W(0), be(0));
|
|
951
|
+
}, Ne = (e) => {
|
|
952
|
+
if (!F) return;
|
|
953
|
+
O.current = !0, e.pointerType === "mouse" && me(!0);
|
|
937
954
|
let t = e.currentTarget, n = () => {
|
|
938
|
-
|
|
955
|
+
J(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
|
|
939
956
|
};
|
|
940
957
|
window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
|
|
941
|
-
},
|
|
942
|
-
if (_?.(e), !e.defaultPrevented &&
|
|
943
|
-
let t =
|
|
958
|
+
}, Pe = (e) => {
|
|
959
|
+
if (_?.(e), !e.defaultPrevented && ne && !v?.trim()) {
|
|
960
|
+
let t = Se({
|
|
944
961
|
experienceId: p,
|
|
945
962
|
playerBaseUrl: y,
|
|
946
963
|
useCurrentPageAsReturnUrl: !0
|
|
@@ -949,153 +966,153 @@ function Ze(e) {
|
|
|
949
966
|
}
|
|
950
967
|
};
|
|
951
968
|
if (!N) return null;
|
|
952
|
-
let
|
|
969
|
+
let Fe = F && (H || U), Ie = I && ce && (we || G || Ee), Le = [
|
|
953
970
|
"liforma-et",
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
971
|
+
re ? "liforma-et--scene" : "",
|
|
972
|
+
ie(x),
|
|
973
|
+
Fe ? "liforma-et--parallax" : "",
|
|
974
|
+
U ? "liforma-et--scroll-parallax" : "",
|
|
975
|
+
I && !Ie ? "liforma-et--loading" : "",
|
|
976
|
+
Ie ? "liforma-et--revealed" : "",
|
|
960
977
|
C
|
|
961
|
-
].filter(Boolean).join(" "),
|
|
962
|
-
"--liforma-et-parallax-x":
|
|
978
|
+
].filter(Boolean).join(" "), Re = {
|
|
979
|
+
"--liforma-et-parallax-x": _e,
|
|
963
980
|
"--liforma-et-parallax-y": ve
|
|
964
|
-
},
|
|
981
|
+
}, Be = (e, t) => {
|
|
965
982
|
e.complete && t(!0);
|
|
966
|
-
},
|
|
983
|
+
}, He = /* @__PURE__ */ f(u, { children: [
|
|
967
984
|
/* @__PURE__ */ d("span", {
|
|
968
985
|
className: "liforma-et__placeholder",
|
|
969
986
|
"aria-hidden": "true"
|
|
970
987
|
}),
|
|
971
|
-
|
|
972
|
-
className:
|
|
973
|
-
src:
|
|
988
|
+
I && ce && N.backgroundImage ? /* @__PURE__ */ d("img", {
|
|
989
|
+
className: Qe("liforma-et__background", G),
|
|
990
|
+
src: Ye(N.backgroundImage, R),
|
|
974
991
|
alt: "",
|
|
975
992
|
decoding: "async",
|
|
976
993
|
ref: (e) => {
|
|
977
|
-
e &&
|
|
994
|
+
e && Be(e, K);
|
|
978
995
|
},
|
|
979
|
-
onLoad: () =>
|
|
996
|
+
onLoad: () => K(!0),
|
|
980
997
|
onError: (e) => {
|
|
981
|
-
let t = e.currentTarget, n =
|
|
982
|
-
if (n && !
|
|
983
|
-
|
|
998
|
+
let t = e.currentTarget, n = Ze(t.src);
|
|
999
|
+
if (n && !de) {
|
|
1000
|
+
z(!0), t.src = n;
|
|
984
1001
|
return;
|
|
985
1002
|
}
|
|
986
|
-
|
|
1003
|
+
K(!0);
|
|
987
1004
|
}
|
|
988
1005
|
}) : null,
|
|
989
|
-
|
|
990
|
-
className:
|
|
991
|
-
src:
|
|
1006
|
+
I && ce && ke ? /* @__PURE__ */ d("img", {
|
|
1007
|
+
className: Qe("liforma-et__avatar", we),
|
|
1008
|
+
src: Ye(ke, R),
|
|
992
1009
|
alt: "",
|
|
993
1010
|
decoding: "async",
|
|
994
1011
|
ref: (e) => {
|
|
995
|
-
e &&
|
|
1012
|
+
e && Be(e, Te);
|
|
996
1013
|
},
|
|
997
|
-
onLoad: () =>
|
|
1014
|
+
onLoad: () => Te(!0),
|
|
998
1015
|
onError: (e) => {
|
|
999
|
-
let t = e.currentTarget, n =
|
|
1000
|
-
if (n && !
|
|
1001
|
-
|
|
1016
|
+
let t = e.currentTarget, n = Xe(t.src);
|
|
1017
|
+
if (n && !fe) {
|
|
1018
|
+
pe(!0), t.src = n;
|
|
1002
1019
|
return;
|
|
1003
1020
|
}
|
|
1004
|
-
N.fallbackImage ?
|
|
1021
|
+
N.fallbackImage ? Ce(!0) : Te(!0);
|
|
1005
1022
|
}
|
|
1006
1023
|
}) : null,
|
|
1007
|
-
|
|
1008
|
-
className:
|
|
1009
|
-
src:
|
|
1024
|
+
I && ce && N.foregroundImage ? /* @__PURE__ */ d("img", {
|
|
1025
|
+
className: Qe("liforma-et__foreground", Ee),
|
|
1026
|
+
src: Ye(N.foregroundImage, R),
|
|
1010
1027
|
alt: "",
|
|
1011
1028
|
decoding: "async",
|
|
1012
1029
|
ref: (e) => {
|
|
1013
|
-
e &&
|
|
1030
|
+
e && Be(e, De);
|
|
1014
1031
|
},
|
|
1015
|
-
onLoad: () =>
|
|
1032
|
+
onLoad: () => De(!0),
|
|
1016
1033
|
onError: (e) => {
|
|
1017
|
-
let t = e.currentTarget, n =
|
|
1034
|
+
let t = e.currentTarget, n = Ze(t.src);
|
|
1018
1035
|
if (n && !B) {
|
|
1019
1036
|
V(!0), t.src = n;
|
|
1020
1037
|
return;
|
|
1021
1038
|
}
|
|
1022
|
-
|
|
1039
|
+
De(!0);
|
|
1023
1040
|
}
|
|
1024
1041
|
}) : null
|
|
1025
|
-
] }),
|
|
1026
|
-
onPointerDown:
|
|
1027
|
-
onPointerUp: (e) =>
|
|
1028
|
-
onPointerCancel: (e) =>
|
|
1042
|
+
] }), We = {
|
|
1043
|
+
onPointerDown: Ne,
|
|
1044
|
+
onPointerUp: (e) => J(e.currentTarget),
|
|
1045
|
+
onPointerCancel: (e) => J(e.currentTarget),
|
|
1029
1046
|
onPointerEnter: (e) => {
|
|
1030
|
-
|
|
1047
|
+
F && e.pointerType === "mouse" && me(!0);
|
|
1031
1048
|
},
|
|
1032
|
-
onPointerMove:
|
|
1049
|
+
onPointerMove: je,
|
|
1033
1050
|
onPointerLeave: () => {
|
|
1034
|
-
O.current || (
|
|
1051
|
+
O.current || (me(!1), U || (W(0), be(0)));
|
|
1035
1052
|
}
|
|
1036
|
-
},
|
|
1053
|
+
}, Ge = (e) => {
|
|
1037
1054
|
D.current = e;
|
|
1038
1055
|
};
|
|
1039
|
-
return P === "anchor" &&
|
|
1040
|
-
ref:
|
|
1041
|
-
className:
|
|
1042
|
-
style:
|
|
1043
|
-
href:
|
|
1056
|
+
return P === "anchor" && q ? /* @__PURE__ */ d("a", {
|
|
1057
|
+
ref: Ge,
|
|
1058
|
+
className: Le,
|
|
1059
|
+
style: Re,
|
|
1060
|
+
href: q,
|
|
1044
1061
|
target: h,
|
|
1045
1062
|
rel: g,
|
|
1046
1063
|
"aria-label": l,
|
|
1047
|
-
onClick:
|
|
1048
|
-
...
|
|
1049
|
-
children:
|
|
1064
|
+
onClick: Pe,
|
|
1065
|
+
...We,
|
|
1066
|
+
children: He
|
|
1050
1067
|
}) : P === "button" ? /* @__PURE__ */ d("button", {
|
|
1051
1068
|
type: "button",
|
|
1052
|
-
ref:
|
|
1053
|
-
className:
|
|
1054
|
-
style:
|
|
1069
|
+
ref: Ge,
|
|
1070
|
+
className: Le,
|
|
1071
|
+
style: Re,
|
|
1055
1072
|
"aria-label": l,
|
|
1056
|
-
onClick:
|
|
1057
|
-
...
|
|
1058
|
-
children:
|
|
1073
|
+
onClick: Pe,
|
|
1074
|
+
...We,
|
|
1075
|
+
children: He
|
|
1059
1076
|
}) : /* @__PURE__ */ d("div", {
|
|
1060
|
-
ref:
|
|
1061
|
-
className:
|
|
1062
|
-
style:
|
|
1077
|
+
ref: Ge,
|
|
1078
|
+
className: Le,
|
|
1079
|
+
style: Re,
|
|
1063
1080
|
role: l ? "img" : void 0,
|
|
1064
1081
|
"aria-label": l || void 0,
|
|
1065
1082
|
"aria-hidden": l ? void 0 : !0,
|
|
1066
|
-
...
|
|
1067
|
-
children:
|
|
1083
|
+
...We,
|
|
1084
|
+
children: He
|
|
1068
1085
|
});
|
|
1069
1086
|
}
|
|
1070
1087
|
//#endregion
|
|
1071
1088
|
//#region src/widget/styles.ts
|
|
1072
|
-
var Qe = "\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", $e = "liforma-experience-widget-styles";
|
|
1073
|
-
function
|
|
1089
|
+
var et = "\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", tt = "liforma-experience-widget-styles";
|
|
1090
|
+
function nt(e = et) {
|
|
1074
1091
|
if (typeof document > "u") return;
|
|
1075
|
-
let t = document.getElementById(
|
|
1092
|
+
let t = document.getElementById(tt);
|
|
1076
1093
|
if (t) {
|
|
1077
1094
|
t.textContent = e;
|
|
1078
1095
|
return;
|
|
1079
1096
|
}
|
|
1080
1097
|
let n = document.createElement("style");
|
|
1081
|
-
n.id =
|
|
1098
|
+
n.id = tt, n.textContent = e, document.head.append(n);
|
|
1082
1099
|
}
|
|
1083
1100
|
//#endregion
|
|
1084
1101
|
//#region src/shims/apiBaseUrl.ts
|
|
1085
|
-
var
|
|
1086
|
-
function
|
|
1102
|
+
var rt = "https://api.liforma.ai", it = "http://localhost:3001";
|
|
1103
|
+
function at() {
|
|
1087
1104
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
1088
1105
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1089
1106
|
if (typeof document > "u") return null;
|
|
1090
1107
|
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();
|
|
1091
1108
|
return t ? t.replace(/\/$/, "") : null;
|
|
1092
1109
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return
|
|
1110
|
+
function ot() {
|
|
1111
|
+
return at() || (_e() ? it : rt);
|
|
1095
1112
|
}
|
|
1096
1113
|
//#endregion
|
|
1097
1114
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
1098
|
-
function
|
|
1115
|
+
function st(e) {
|
|
1099
1116
|
if (!e || typeof e != "object") return null;
|
|
1100
1117
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
1101
1118
|
return n ? {
|
|
@@ -1104,10 +1121,10 @@ function at(e) {
|
|
|
1104
1121
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
1105
1122
|
} : null;
|
|
1106
1123
|
}
|
|
1107
|
-
async function
|
|
1124
|
+
async function ct(e, t) {
|
|
1108
1125
|
let n = e.trim();
|
|
1109
1126
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
1110
|
-
let r = (t?.apiBaseUrl ??
|
|
1127
|
+
let r = (t?.apiBaseUrl ?? ot()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
1111
1128
|
method: "GET",
|
|
1112
1129
|
headers: { Accept: "application/json" },
|
|
1113
1130
|
signal: t?.signal
|
|
@@ -1127,7 +1144,7 @@ async function ot(e, t) {
|
|
|
1127
1144
|
throw Error("Experience preview returned invalid JSON.");
|
|
1128
1145
|
}
|
|
1129
1146
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
1130
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
1147
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = st(o.galleryThumb);
|
|
1131
1148
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
1132
1149
|
return {
|
|
1133
1150
|
experienceId: s || n,
|
|
@@ -1137,7 +1154,7 @@ async function ot(e, t) {
|
|
|
1137
1154
|
}
|
|
1138
1155
|
//#endregion
|
|
1139
1156
|
//#region src/v2/errors/LiformaError.ts
|
|
1140
|
-
var
|
|
1157
|
+
var lt = class extends Error {
|
|
1141
1158
|
code;
|
|
1142
1159
|
requestId;
|
|
1143
1160
|
status;
|
|
@@ -1146,16 +1163,16 @@ var st = class extends Error {
|
|
|
1146
1163
|
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;
|
|
1147
1164
|
}
|
|
1148
1165
|
};
|
|
1149
|
-
function
|
|
1166
|
+
function ut(e) {
|
|
1150
1167
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
1151
1168
|
}
|
|
1152
|
-
function
|
|
1169
|
+
function dt(e, t, n) {
|
|
1153
1170
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
1154
1171
|
try {
|
|
1155
1172
|
i = JSON.parse(t);
|
|
1156
1173
|
} catch {}
|
|
1157
|
-
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 } =
|
|
1158
|
-
return new
|
|
1174
|
+
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 } = ut(a) ?? ut(i) ?? {};
|
|
1175
|
+
return new lt(u, {
|
|
1159
1176
|
code: l,
|
|
1160
1177
|
requestId: d,
|
|
1161
1178
|
status: e,
|
|
@@ -1164,13 +1181,13 @@ function lt(e, t, n) {
|
|
|
1164
1181
|
}
|
|
1165
1182
|
//#endregion
|
|
1166
1183
|
//#region src/v2/api/captureAttribution.ts
|
|
1167
|
-
var
|
|
1184
|
+
var ft = 128, pt = /[\u0000-\u001f\u007f]/g;
|
|
1168
1185
|
function Y(e) {
|
|
1169
1186
|
if (!e) return;
|
|
1170
|
-
let t = e.replace(
|
|
1171
|
-
if (t) return t.slice(0,
|
|
1187
|
+
let t = e.replace(pt, "").trim();
|
|
1188
|
+
if (t) return t.slice(0, ft);
|
|
1172
1189
|
}
|
|
1173
|
-
function
|
|
1190
|
+
function mt(e) {
|
|
1174
1191
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
1175
1192
|
return {
|
|
1176
1193
|
...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
|
|
@@ -1180,7 +1197,7 @@ function ft(e) {
|
|
|
1180
1197
|
...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
|
|
1181
1198
|
};
|
|
1182
1199
|
}
|
|
1183
|
-
function
|
|
1200
|
+
function ht(e) {
|
|
1184
1201
|
if (e === !1) return;
|
|
1185
1202
|
if (e && typeof e == "object") {
|
|
1186
1203
|
let t = {
|
|
@@ -1194,7 +1211,7 @@ function pt(e) {
|
|
|
1194
1211
|
return Object.keys(t).length ? t : void 0;
|
|
1195
1212
|
}
|
|
1196
1213
|
if (typeof window > "u") return;
|
|
1197
|
-
let t =
|
|
1214
|
+
let t = mt(window.location?.search), n = Y(document.referrer || void 0), r = {
|
|
1198
1215
|
...t,
|
|
1199
1216
|
...n ? { referrer: n } : {}
|
|
1200
1217
|
};
|
|
@@ -1202,19 +1219,19 @@ function pt(e) {
|
|
|
1202
1219
|
}
|
|
1203
1220
|
//#endregion
|
|
1204
1221
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
1205
|
-
function
|
|
1222
|
+
function gt(e) {
|
|
1206
1223
|
let t = e.locale?.trim();
|
|
1207
1224
|
if (t) return t;
|
|
1208
1225
|
let n = e.language?.trim();
|
|
1209
1226
|
if (n) return n;
|
|
1210
1227
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
1211
1228
|
}
|
|
1212
|
-
function
|
|
1229
|
+
function _t(e) {
|
|
1213
1230
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
1214
1231
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
1215
1232
|
return t || n || void 0;
|
|
1216
1233
|
}
|
|
1217
|
-
function
|
|
1234
|
+
function vt(e, t) {
|
|
1218
1235
|
let n = e.trim();
|
|
1219
1236
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
1220
1237
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -1222,7 +1239,7 @@ function gt(e, t) {
|
|
|
1222
1239
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
1223
1240
|
let i = t.experienceId.trim();
|
|
1224
1241
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
1225
|
-
let a =
|
|
1242
|
+
let a = gt(t), o = _t(t), s = t.idempotencyKey?.trim();
|
|
1226
1243
|
return {
|
|
1227
1244
|
url: r.toString(),
|
|
1228
1245
|
init: {
|
|
@@ -1241,7 +1258,7 @@ function gt(e, t) {
|
|
|
1241
1258
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
1242
1259
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
1243
1260
|
...(() => {
|
|
1244
|
-
let e =
|
|
1261
|
+
let e = ht(t.attribution);
|
|
1245
1262
|
return e ? { attribution: e } : {};
|
|
1246
1263
|
})(),
|
|
1247
1264
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -1251,16 +1268,19 @@ function gt(e, t) {
|
|
|
1251
1268
|
}
|
|
1252
1269
|
//#endregion
|
|
1253
1270
|
//#region src/v2/types/sessionLaunch.ts
|
|
1254
|
-
function
|
|
1271
|
+
function yt(e, t) {
|
|
1272
|
+
return t === void 0 ? {} : { [e]: t };
|
|
1273
|
+
}
|
|
1274
|
+
function bt(e) {
|
|
1255
1275
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
1256
1276
|
}
|
|
1257
1277
|
function X(e) {
|
|
1258
1278
|
return typeof e == "boolean";
|
|
1259
1279
|
}
|
|
1260
|
-
function
|
|
1261
|
-
if (!
|
|
1280
|
+
function xt(e) {
|
|
1281
|
+
if (!bt(e)) return null;
|
|
1262
1282
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
1263
|
-
return !
|
|
1283
|
+
return !bt(t) || !bt(n) || !bt(r) || !bt(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
|
|
1264
1284
|
speech: {
|
|
1265
1285
|
input: t.input,
|
|
1266
1286
|
output: t.output,
|
|
@@ -1271,8 +1291,8 @@ function vt(e) {
|
|
|
1271
1291
|
tools: { enabled: i.enabled }
|
|
1272
1292
|
};
|
|
1273
1293
|
}
|
|
1274
|
-
function
|
|
1275
|
-
return !
|
|
1294
|
+
function St(e) {
|
|
1295
|
+
return !bt(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
|
|
1276
1296
|
speech: {
|
|
1277
1297
|
input: e.speechInput,
|
|
1278
1298
|
output: e.speechOutput,
|
|
@@ -1283,12 +1303,12 @@ function yt(e) {
|
|
|
1283
1303
|
tools: { enabled: e.tools }
|
|
1284
1304
|
};
|
|
1285
1305
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return
|
|
1306
|
+
function Ct(e) {
|
|
1307
|
+
return xt(e) ?? St(e);
|
|
1288
1308
|
}
|
|
1289
|
-
function
|
|
1290
|
-
if (!
|
|
1291
|
-
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 =
|
|
1309
|
+
function wt(e) {
|
|
1310
|
+
if (!bt(e)) throw Error("Session Launch response is missing session.");
|
|
1311
|
+
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 = Ct(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;
|
|
1292
1312
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
1293
1313
|
return {
|
|
1294
1314
|
id: t,
|
|
@@ -1304,11 +1324,11 @@ function xt(e) {
|
|
|
1304
1324
|
...d ? { createdAt: d } : {}
|
|
1305
1325
|
};
|
|
1306
1326
|
}
|
|
1307
|
-
function
|
|
1327
|
+
function Tt(e) {
|
|
1308
1328
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
1309
1329
|
let t = [];
|
|
1310
1330
|
for (let n of e) {
|
|
1311
|
-
if (!
|
|
1331
|
+
if (!bt(n)) continue;
|
|
1312
1332
|
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() : "";
|
|
1313
1333
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
1314
1334
|
axis: e,
|
|
@@ -1319,104 +1339,104 @@ function St(e) {
|
|
|
1319
1339
|
}
|
|
1320
1340
|
return t.length > 0 ? t : void 0;
|
|
1321
1341
|
}
|
|
1322
|
-
function
|
|
1342
|
+
function Et(e) {
|
|
1323
1343
|
let t = e.localeVoiceFallbacks;
|
|
1324
1344
|
if (t?.length) for (let e of t) {
|
|
1325
1345
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
1326
1346
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
1327
1347
|
}
|
|
1328
1348
|
}
|
|
1329
|
-
function
|
|
1330
|
-
if (!
|
|
1349
|
+
function Dt(e) {
|
|
1350
|
+
if (!bt(e)) throw Error("Session Launch response must be a JSON object.");
|
|
1331
1351
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
1332
1352
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
1333
|
-
let n =
|
|
1334
|
-
return
|
|
1353
|
+
let n = wt(e.session);
|
|
1354
|
+
return Et(n), {
|
|
1335
1355
|
session: n,
|
|
1336
1356
|
launch: t
|
|
1337
1357
|
};
|
|
1338
1358
|
}
|
|
1339
1359
|
//#endregion
|
|
1340
1360
|
//#region src/v2/api/mintPublicSession.ts
|
|
1341
|
-
function
|
|
1361
|
+
function Ot() {
|
|
1342
1362
|
try {
|
|
1343
1363
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
1344
1364
|
} catch {}
|
|
1345
1365
|
}
|
|
1346
|
-
function
|
|
1366
|
+
function kt(e) {
|
|
1347
1367
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
1348
1368
|
}
|
|
1349
|
-
function
|
|
1350
|
-
let n =
|
|
1369
|
+
function At(e, t) {
|
|
1370
|
+
let n = Ot(), r = kt(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
1351
1371
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
1352
1372
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
1353
1373
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
1354
|
-
return new
|
|
1374
|
+
return new lt(`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.`, {
|
|
1355
1375
|
code: "ORIGIN_NOT_ALLOWED",
|
|
1356
1376
|
requestId: t.requestId,
|
|
1357
1377
|
status: t.status,
|
|
1358
1378
|
details: a
|
|
1359
1379
|
});
|
|
1360
1380
|
}
|
|
1361
|
-
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new
|
|
1381
|
+
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new lt(`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”.`, {
|
|
1362
1382
|
code: "BROWSER_EMBEDS_DISABLED",
|
|
1363
1383
|
requestId: t.requestId,
|
|
1364
1384
|
status: t.status,
|
|
1365
1385
|
details: a
|
|
1366
|
-
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new
|
|
1386
|
+
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new lt(`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.`, {
|
|
1367
1387
|
code: "EXPERIENCE_UNAVAILABLE",
|
|
1368
1388
|
requestId: t.requestId,
|
|
1369
1389
|
status: t.status,
|
|
1370
1390
|
details: a
|
|
1371
1391
|
}) : t;
|
|
1372
1392
|
}
|
|
1373
|
-
function
|
|
1393
|
+
function jt(e) {
|
|
1374
1394
|
let t = e?.locale?.trim();
|
|
1375
1395
|
if (t) return t;
|
|
1376
1396
|
let n = e?.language?.trim();
|
|
1377
1397
|
if (n) return n;
|
|
1378
1398
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
1379
1399
|
}
|
|
1380
|
-
function
|
|
1400
|
+
function Mt(e) {
|
|
1381
1401
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
1382
|
-
if (t && n && t !== n) throw new
|
|
1402
|
+
if (t && n && t !== n) throw new lt("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
1383
1403
|
return t || n || void 0;
|
|
1384
1404
|
}
|
|
1385
|
-
function
|
|
1386
|
-
let n = { experienceId: e }, r =
|
|
1405
|
+
function Nt(e, t) {
|
|
1406
|
+
let n = { experienceId: e }, r = jt(t);
|
|
1387
1407
|
r && (n.locale = r);
|
|
1388
|
-
let i =
|
|
1408
|
+
let i = Mt(t);
|
|
1389
1409
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
1390
|
-
let a =
|
|
1410
|
+
let a = ht(t?.attribution);
|
|
1391
1411
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
1392
1412
|
}
|
|
1393
|
-
async function
|
|
1394
|
-
let n =
|
|
1413
|
+
async function Pt(e, t) {
|
|
1414
|
+
let n = ot(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
1395
1415
|
method: "POST",
|
|
1396
1416
|
headers: {
|
|
1397
1417
|
"Content-Type": "application/json",
|
|
1398
1418
|
...r ? { "Idempotency-Key": r } : {}
|
|
1399
1419
|
},
|
|
1400
|
-
body: JSON.stringify(
|
|
1420
|
+
body: JSON.stringify(Nt(e, t))
|
|
1401
1421
|
});
|
|
1402
1422
|
if (!i.ok) {
|
|
1403
1423
|
let t = await i.text();
|
|
1404
|
-
throw
|
|
1424
|
+
throw At(e, dt(i.status, t, i.headers));
|
|
1405
1425
|
}
|
|
1406
1426
|
let a;
|
|
1407
1427
|
try {
|
|
1408
1428
|
a = await i.json();
|
|
1409
1429
|
} catch {
|
|
1410
|
-
throw new
|
|
1430
|
+
throw new lt("Browser session mint returned invalid JSON.", {
|
|
1411
1431
|
code: "INVALID_RESPONSE",
|
|
1412
1432
|
status: i.status,
|
|
1413
1433
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
1414
1434
|
});
|
|
1415
1435
|
}
|
|
1416
|
-
return
|
|
1436
|
+
return Dt(a);
|
|
1417
1437
|
}
|
|
1418
|
-
async function
|
|
1419
|
-
let n =
|
|
1438
|
+
async function Ft(e, t) {
|
|
1439
|
+
let n = vt(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
1420
1440
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
1421
1441
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
1422
1442
|
try {
|
|
@@ -1429,9 +1449,9 @@ async function Mt(e, t) {
|
|
|
1429
1449
|
}
|
|
1430
1450
|
if (!o.ok) {
|
|
1431
1451
|
let e = await o.text();
|
|
1432
|
-
throw
|
|
1452
|
+
throw dt(o.status, e, o.headers);
|
|
1433
1453
|
}
|
|
1434
|
-
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new
|
|
1454
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new lt("Session endpoint must return a JSON Session Launch response.", {
|
|
1435
1455
|
code: "INVALID_RESPONSE",
|
|
1436
1456
|
status: o.status,
|
|
1437
1457
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
@@ -1440,20 +1460,20 @@ async function Mt(e, t) {
|
|
|
1440
1460
|
try {
|
|
1441
1461
|
s = await o.json();
|
|
1442
1462
|
} catch {
|
|
1443
|
-
throw new
|
|
1463
|
+
throw new lt("Session endpoint returned invalid JSON.", {
|
|
1444
1464
|
code: "INVALID_RESPONSE",
|
|
1445
1465
|
status: o.status,
|
|
1446
1466
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
1447
1467
|
});
|
|
1448
1468
|
}
|
|
1449
|
-
return
|
|
1469
|
+
return Dt(s);
|
|
1450
1470
|
}
|
|
1451
1471
|
//#endregion
|
|
1452
1472
|
//#region src/v2/conversationProcessor.ts
|
|
1453
|
-
function
|
|
1473
|
+
function It(e) {
|
|
1454
1474
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
1455
1475
|
}
|
|
1456
|
-
function
|
|
1476
|
+
function Lt(e) {
|
|
1457
1477
|
if (typeof e == "string") {
|
|
1458
1478
|
let t = e.trim();
|
|
1459
1479
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -1467,24 +1487,24 @@ function Pt(e) {
|
|
|
1467
1487
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
1468
1488
|
};
|
|
1469
1489
|
}
|
|
1470
|
-
async function
|
|
1490
|
+
async function Rt(e, t) {
|
|
1471
1491
|
let n = await e(t);
|
|
1472
|
-
return
|
|
1492
|
+
return It(n) ? {
|
|
1473
1493
|
kind: "stream",
|
|
1474
1494
|
stream: n
|
|
1475
1495
|
} : {
|
|
1476
1496
|
kind: "complete",
|
|
1477
|
-
speech:
|
|
1497
|
+
speech: Lt(n)
|
|
1478
1498
|
};
|
|
1479
1499
|
}
|
|
1480
1500
|
//#endregion
|
|
1481
1501
|
//#region src/v2/embed/playerReachability.ts
|
|
1482
|
-
var
|
|
1483
|
-
function
|
|
1502
|
+
var zt = "3002";
|
|
1503
|
+
function Bt(e) {
|
|
1484
1504
|
let t = new URL(e);
|
|
1485
|
-
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 ||
|
|
1505
|
+
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 || zt}. 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.`;
|
|
1486
1506
|
}
|
|
1487
|
-
async function
|
|
1507
|
+
async function Vt(e, t) {
|
|
1488
1508
|
try {
|
|
1489
1509
|
await fetch(e, {
|
|
1490
1510
|
method: "GET",
|
|
@@ -1492,25 +1512,25 @@ async function Rt(e, t) {
|
|
|
1492
1512
|
signal: AbortSignal.timeout(8e3)
|
|
1493
1513
|
});
|
|
1494
1514
|
} catch {
|
|
1495
|
-
throw Error(
|
|
1515
|
+
throw Error(Bt(t));
|
|
1496
1516
|
}
|
|
1497
1517
|
}
|
|
1498
|
-
function
|
|
1518
|
+
function Ht(e, t, n, r) {
|
|
1499
1519
|
try {
|
|
1500
1520
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
1501
1521
|
} catch (e) {
|
|
1502
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
1522
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(Bt(n), { cause: e }) : e;
|
|
1503
1523
|
}
|
|
1504
1524
|
}
|
|
1505
|
-
var
|
|
1506
|
-
function
|
|
1507
|
-
return typeof e == "number" &&
|
|
1525
|
+
var Ut = new Set([1, 2]);
|
|
1526
|
+
function Wt(e) {
|
|
1527
|
+
return typeof e == "number" && Ut.has(e);
|
|
1508
1528
|
}
|
|
1509
|
-
var
|
|
1510
|
-
function
|
|
1529
|
+
var Gt = 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("."));
|
|
1530
|
+
function Kt(e) {
|
|
1511
1531
|
if (!e || typeof e != "object") return null;
|
|
1512
1532
|
let t = e;
|
|
1513
|
-
if (!
|
|
1533
|
+
if (!Wt(t.schemaVersion) || !t.type || !Gt.has(t.type)) return null;
|
|
1514
1534
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
1515
1535
|
if (t.type === "fullWindow" || t.type === "theatre") {
|
|
1516
1536
|
let e = t.payload;
|
|
@@ -1533,10 +1553,13 @@ function Ut(e) {
|
|
|
1533
1553
|
let n = t.payload;
|
|
1534
1554
|
return !n || typeof n != "object" ? null : t;
|
|
1535
1555
|
}
|
|
1536
|
-
function
|
|
1556
|
+
function qt(e, t) {
|
|
1557
|
+
return t === void 0 ? {} : { [e]: t };
|
|
1558
|
+
}
|
|
1559
|
+
function Jt(e, t, n) {
|
|
1537
1560
|
let r = e.trim();
|
|
1538
1561
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
1539
|
-
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.
|
|
1562
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatre;
|
|
1540
1563
|
return {
|
|
1541
1564
|
type: "launch",
|
|
1542
1565
|
schemaVersion: 2,
|
|
@@ -1547,32 +1570,34 @@ function Wt(e, t, n) {
|
|
|
1547
1570
|
...a ? { theme: a } : {},
|
|
1548
1571
|
...o === void 0 ? {} : { showFeedback: o },
|
|
1549
1572
|
...s ? { interaction: s } : {},
|
|
1550
|
-
...
|
|
1551
|
-
...
|
|
1573
|
+
...qt("settingsButton", n?.settingsButton),
|
|
1574
|
+
...qt("theatreButton", n?.theatreButton),
|
|
1575
|
+
...qt("fullscreenButton", n?.fullscreenButton),
|
|
1576
|
+
...c === void 0 ? {} : { theatre: c }
|
|
1552
1577
|
}
|
|
1553
1578
|
};
|
|
1554
1579
|
}
|
|
1555
|
-
function
|
|
1580
|
+
function Yt() {
|
|
1556
1581
|
return {
|
|
1557
1582
|
type: "parentHello",
|
|
1558
1583
|
schemaVersion: 2
|
|
1559
1584
|
};
|
|
1560
1585
|
}
|
|
1561
|
-
function
|
|
1586
|
+
function Xt(e) {
|
|
1562
1587
|
return {
|
|
1563
1588
|
type: "widgetSetChrome",
|
|
1564
1589
|
schemaVersion: 2,
|
|
1565
1590
|
payload: { mode: e }
|
|
1566
1591
|
};
|
|
1567
1592
|
}
|
|
1568
|
-
function
|
|
1593
|
+
function Zt() {
|
|
1569
1594
|
return {
|
|
1570
1595
|
type: "widgetToggleAudioSettings",
|
|
1571
1596
|
schemaVersion: 2,
|
|
1572
1597
|
payload: {}
|
|
1573
1598
|
};
|
|
1574
1599
|
}
|
|
1575
|
-
function
|
|
1600
|
+
function Qt(e) {
|
|
1576
1601
|
return {
|
|
1577
1602
|
type: "setTheatre",
|
|
1578
1603
|
schemaVersion: 2,
|
|
@@ -1581,8 +1606,8 @@ function Jt(e) {
|
|
|
1581
1606
|
}
|
|
1582
1607
|
//#endregion
|
|
1583
1608
|
//#region src/v2/embed/fullWindowHost.ts
|
|
1584
|
-
var
|
|
1585
|
-
function
|
|
1609
|
+
var $t = "2147483000";
|
|
1610
|
+
function en(e) {
|
|
1586
1611
|
let { style: t } = e;
|
|
1587
1612
|
return {
|
|
1588
1613
|
position: t.position,
|
|
@@ -1600,11 +1625,11 @@ function Xt(e) {
|
|
|
1600
1625
|
maxHeight: t.maxHeight
|
|
1601
1626
|
};
|
|
1602
1627
|
}
|
|
1603
|
-
function
|
|
1628
|
+
function tn(e) {
|
|
1604
1629
|
let { style: t } = e;
|
|
1605
|
-
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 =
|
|
1630
|
+
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 = $t, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
1606
1631
|
}
|
|
1607
|
-
function
|
|
1632
|
+
function nn(e, t) {
|
|
1608
1633
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
1609
1634
|
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 = "";
|
|
1610
1635
|
return;
|
|
@@ -1614,20 +1639,20 @@ function Qt(e, t) {
|
|
|
1614
1639
|
}
|
|
1615
1640
|
//#endregion
|
|
1616
1641
|
//#region src/v2/embed/iframeHost.ts
|
|
1617
|
-
function
|
|
1642
|
+
function rn(e) {
|
|
1618
1643
|
return e;
|
|
1619
1644
|
}
|
|
1620
1645
|
function Z() {
|
|
1621
1646
|
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)}`;
|
|
1622
1647
|
}
|
|
1623
|
-
var
|
|
1624
|
-
function
|
|
1648
|
+
var an = 3e4;
|
|
1649
|
+
function on(e) {
|
|
1625
1650
|
let t = e.container;
|
|
1626
1651
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
1627
1652
|
let n = document.createElement("iframe");
|
|
1628
1653
|
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");
|
|
1629
1654
|
let r = !1, i = !1, a = null, o = null, s = (r) => {
|
|
1630
|
-
i !== r && (i = r, r ? (a =
|
|
1655
|
+
i !== r && (i = r, r ? (a = en(n), o = document.body.style.overflow, document.body.append(n), tn(n), document.body.style.overflow = "hidden") : (t.append(n), nn(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
|
|
1631
1656
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
1632
1657
|
p = e, m = t;
|
|
1633
1658
|
}), g = () => {
|
|
@@ -1638,10 +1663,10 @@ function tn(e) {
|
|
|
1638
1663
|
let i = Date.now();
|
|
1639
1664
|
if (d > 0 && i - d < 250) return;
|
|
1640
1665
|
d = i, g();
|
|
1641
|
-
let a =
|
|
1666
|
+
let a = Jt(t.launch, t.session, t.chrome), o = () => {
|
|
1642
1667
|
if (r) return;
|
|
1643
1668
|
let t = n.contentWindow;
|
|
1644
|
-
t &&
|
|
1669
|
+
t && Ht(t, a, e.playerOrigin);
|
|
1645
1670
|
};
|
|
1646
1671
|
o();
|
|
1647
1672
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -1649,17 +1674,17 @@ function tn(e) {
|
|
|
1649
1674
|
r || !l || _(l);
|
|
1650
1675
|
}, y = () => {
|
|
1651
1676
|
if (u += 1, u === 1) {
|
|
1652
|
-
|
|
1677
|
+
Vt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
1653
1678
|
return;
|
|
1654
1679
|
}
|
|
1655
1680
|
d = 0, v();
|
|
1656
1681
|
}, b = () => {
|
|
1657
|
-
u > 0 || m?.(Error(
|
|
1682
|
+
u > 0 || m?.(Error(Bt(e.playerOrigin)));
|
|
1658
1683
|
};
|
|
1659
1684
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
1660
1685
|
let x = (t) => {
|
|
1661
1686
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
1662
|
-
let i =
|
|
1687
|
+
let i = Kt(t.data);
|
|
1663
1688
|
if (i) switch (i.type) {
|
|
1664
1689
|
case "close":
|
|
1665
1690
|
e.onClose?.(i.payload);
|
|
@@ -1698,7 +1723,7 @@ function tn(e) {
|
|
|
1698
1723
|
e.onUserSpeechEnded?.(i.payload);
|
|
1699
1724
|
break;
|
|
1700
1725
|
case "modeChange":
|
|
1701
|
-
e.onActivityChange?.(
|
|
1726
|
+
e.onActivityChange?.(rn(i.payload.mode));
|
|
1702
1727
|
break;
|
|
1703
1728
|
case "activityChange":
|
|
1704
1729
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -1757,8 +1782,8 @@ function tn(e) {
|
|
|
1757
1782
|
let S = (t, i) => {
|
|
1758
1783
|
if (r) return;
|
|
1759
1784
|
let a = n.contentWindow;
|
|
1760
|
-
if (!a) throw Error(
|
|
1761
|
-
|
|
1785
|
+
if (!a) throw Error(Bt(e.playerOrigin));
|
|
1786
|
+
Ht(a, t, e.playerOrigin, i);
|
|
1762
1787
|
}, C = (e, t = 12e4, n) => {
|
|
1763
1788
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
|
|
1764
1789
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -1775,7 +1800,7 @@ function tn(e) {
|
|
|
1775
1800
|
return h;
|
|
1776
1801
|
},
|
|
1777
1802
|
postParentHello() {
|
|
1778
|
-
S(
|
|
1803
|
+
S(Yt());
|
|
1779
1804
|
},
|
|
1780
1805
|
postLaunch(e, t, n) {
|
|
1781
1806
|
r || (l = {
|
|
@@ -1797,13 +1822,13 @@ function tn(e) {
|
|
|
1797
1822
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
1798
1823
|
},
|
|
1799
1824
|
postWidgetSetChrome(e) {
|
|
1800
|
-
S(
|
|
1825
|
+
S(Xt(e));
|
|
1801
1826
|
},
|
|
1802
1827
|
postWidgetToggleAudioSettings() {
|
|
1803
|
-
S(
|
|
1828
|
+
S(Zt());
|
|
1804
1829
|
},
|
|
1805
1830
|
postSetTheatre(e) {
|
|
1806
|
-
S(
|
|
1831
|
+
S(Qt(e));
|
|
1807
1832
|
},
|
|
1808
1833
|
speak(e) {
|
|
1809
1834
|
return C({
|
|
@@ -1925,7 +1950,7 @@ function tn(e) {
|
|
|
1925
1950
|
audio: e.audio,
|
|
1926
1951
|
byteLength: e.byteLength
|
|
1927
1952
|
}
|
|
1928
|
-
},
|
|
1953
|
+
}, an, [e.audio]);
|
|
1929
1954
|
},
|
|
1930
1955
|
speechUtteranceSetTranscript(e) {
|
|
1931
1956
|
return C({
|
|
@@ -2087,7 +2112,7 @@ function tn(e) {
|
|
|
2087
2112
|
}
|
|
2088
2113
|
//#endregion
|
|
2089
2114
|
//#region src/v2/embed/readyGate.ts
|
|
2090
|
-
function
|
|
2115
|
+
function sn(e) {
|
|
2091
2116
|
let t, n = !1, r = !1, i = () => {
|
|
2092
2117
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
2093
2118
|
};
|
|
@@ -2102,9 +2127,9 @@ function nn(e) {
|
|
|
2102
2127
|
}
|
|
2103
2128
|
//#endregion
|
|
2104
2129
|
//#region src/v2/sdkRelease.ts
|
|
2105
|
-
var
|
|
2130
|
+
var cn = `sdk@${{
|
|
2106
2131
|
name: "@liforma/client",
|
|
2107
|
-
version: "0.4.
|
|
2132
|
+
version: "0.4.16",
|
|
2108
2133
|
type: "module",
|
|
2109
2134
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
2110
2135
|
license: "MIT",
|
|
@@ -2326,54 +2351,54 @@ var rn = `sdk@${{
|
|
|
2326
2351
|
vitest: "^4.1.10",
|
|
2327
2352
|
wrangler: "^4.101.0"
|
|
2328
2353
|
}
|
|
2329
|
-
}.version}`,
|
|
2330
|
-
function
|
|
2354
|
+
}.version}`, ln = "https://player.liforma.ai/embed", un = "http://localhost:3002/embed";
|
|
2355
|
+
function dn() {
|
|
2331
2356
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
2332
2357
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
2333
2358
|
if (typeof document > "u") return null;
|
|
2334
2359
|
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();
|
|
2335
2360
|
return t ? t.replace(/\/$/, "") : null;
|
|
2336
2361
|
}
|
|
2337
|
-
function
|
|
2338
|
-
let e =
|
|
2339
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
2362
|
+
function fn() {
|
|
2363
|
+
let e = dn();
|
|
2364
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : _e() ? un : ln;
|
|
2340
2365
|
}
|
|
2341
|
-
function
|
|
2366
|
+
function pn(e, t) {
|
|
2342
2367
|
return e?.trim() || t?.trim() || void 0;
|
|
2343
2368
|
}
|
|
2344
|
-
function
|
|
2345
|
-
let p = (e ??
|
|
2369
|
+
function mn(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
2370
|
+
let p = (e ?? fn()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
|
|
2346
2371
|
g && h.searchParams.set("backdropId", g);
|
|
2347
2372
|
let _ = r?.trim();
|
|
2348
2373
|
_ && h.searchParams.set("avatarId", _);
|
|
2349
2374
|
let v = d?.trim();
|
|
2350
2375
|
v && h.searchParams.set("previewBg", v);
|
|
2351
2376
|
let y = f?.trim();
|
|
2352
|
-
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)),
|
|
2377
|
+
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)), hn(h.toString());
|
|
2353
2378
|
}
|
|
2354
|
-
function
|
|
2379
|
+
function hn(e) {
|
|
2355
2380
|
if (typeof location > "u") return e;
|
|
2356
2381
|
let t = new URL(e);
|
|
2357
2382
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
2358
2383
|
}
|
|
2359
|
-
function
|
|
2384
|
+
function gn(e) {
|
|
2360
2385
|
return new URL(e).origin;
|
|
2361
2386
|
}
|
|
2362
2387
|
//#endregion
|
|
2363
2388
|
//#region src/v2/experienceEvents.ts
|
|
2364
|
-
function
|
|
2389
|
+
function _n() {
|
|
2365
2390
|
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)}`;
|
|
2366
2391
|
}
|
|
2367
|
-
function
|
|
2392
|
+
function vn(e, t, n) {
|
|
2368
2393
|
return {
|
|
2369
|
-
id:
|
|
2394
|
+
id: _n(),
|
|
2370
2395
|
type: e,
|
|
2371
2396
|
sessionId: t,
|
|
2372
2397
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2373
2398
|
data: n
|
|
2374
2399
|
};
|
|
2375
2400
|
}
|
|
2376
|
-
function
|
|
2401
|
+
function yn() {
|
|
2377
2402
|
return {
|
|
2378
2403
|
ready: /* @__PURE__ */ new Set(),
|
|
2379
2404
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -2394,39 +2419,39 @@ function hn() {
|
|
|
2394
2419
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
2395
2420
|
};
|
|
2396
2421
|
}
|
|
2397
|
-
function
|
|
2422
|
+
function bn(e, t, n) {
|
|
2398
2423
|
return e[t].add(n), () => e[t].delete(n);
|
|
2399
2424
|
}
|
|
2400
|
-
function
|
|
2425
|
+
function xn(e, t, n) {
|
|
2401
2426
|
for (let r of e[t]) r(n);
|
|
2402
2427
|
}
|
|
2403
|
-
function
|
|
2428
|
+
function Sn(e) {
|
|
2404
2429
|
for (let t of Object.keys(e)) e[t].clear();
|
|
2405
2430
|
}
|
|
2406
2431
|
//#endregion
|
|
2407
2432
|
//#region src/v2/speech/types.ts
|
|
2408
|
-
function
|
|
2433
|
+
function Cn(e) {
|
|
2409
2434
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
2410
2435
|
}
|
|
2411
|
-
function
|
|
2436
|
+
function wn(e) {
|
|
2412
2437
|
return "url" in e && typeof e.url == "string";
|
|
2413
2438
|
}
|
|
2414
|
-
function
|
|
2439
|
+
function Tn(e) {
|
|
2415
2440
|
if (!("track" in e)) return !1;
|
|
2416
2441
|
let t = e.track;
|
|
2417
2442
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
2418
2443
|
}
|
|
2419
|
-
function
|
|
2420
|
-
return !
|
|
2444
|
+
function En(e) {
|
|
2445
|
+
return !Cn(e) && !wn(e) && !Tn(e) && "encoding" in e && typeof e.encoding == "string";
|
|
2421
2446
|
}
|
|
2422
|
-
var
|
|
2447
|
+
var Dn = [
|
|
2423
2448
|
8e3,
|
|
2424
2449
|
16e3,
|
|
2425
2450
|
22050,
|
|
2426
2451
|
24e3,
|
|
2427
2452
|
44100,
|
|
2428
2453
|
48e3
|
|
2429
|
-
],
|
|
2454
|
+
], On = {
|
|
2430
2455
|
MAX_CHUNK_BYTES: 64 * 1024,
|
|
2431
2456
|
RECOMMENDED_CHUNK_MS_MIN: 20,
|
|
2432
2457
|
RECOMMENDED_CHUNK_MS_MAX: 200,
|
|
@@ -2437,14 +2462,14 @@ var Cn = [
|
|
|
2437
2462
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
2438
2463
|
MAX_PENDING_WRITES: 8,
|
|
2439
2464
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
2440
|
-
},
|
|
2465
|
+
}, kn = class extends Error {
|
|
2441
2466
|
operation;
|
|
2442
2467
|
requiredCapability;
|
|
2443
2468
|
name = "UnsupportedSpeechOperationError";
|
|
2444
2469
|
constructor(e, t) {
|
|
2445
2470
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
2446
2471
|
}
|
|
2447
|
-
},
|
|
2472
|
+
}, An = class extends Error {
|
|
2448
2473
|
name = "SpeechUtteranceClosedError";
|
|
2449
2474
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
2450
2475
|
super(e);
|
|
@@ -2454,72 +2479,72 @@ var Cn = [
|
|
|
2454
2479
|
constructor(e, t) {
|
|
2455
2480
|
super(e, t);
|
|
2456
2481
|
}
|
|
2457
|
-
},
|
|
2482
|
+
}, jn = class extends Error {
|
|
2458
2483
|
name = "SpeechBufferTimeoutError";
|
|
2459
2484
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
2460
2485
|
super(e);
|
|
2461
2486
|
}
|
|
2462
2487
|
};
|
|
2463
|
-
function
|
|
2488
|
+
function Mn(e = "none") {
|
|
2464
2489
|
return {
|
|
2465
2490
|
mode: e,
|
|
2466
2491
|
trackedDurationMs: 0,
|
|
2467
2492
|
fallbackDurationMs: 0
|
|
2468
2493
|
};
|
|
2469
2494
|
}
|
|
2470
|
-
function
|
|
2471
|
-
return
|
|
2495
|
+
function Nn(e) {
|
|
2496
|
+
return Dn.includes(e);
|
|
2472
2497
|
}
|
|
2473
|
-
function
|
|
2498
|
+
function Pn(e) {
|
|
2474
2499
|
if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
|
|
2475
2500
|
if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
|
|
2476
|
-
if (!
|
|
2501
|
+
if (!Nn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2477
2502
|
}
|
|
2478
|
-
function
|
|
2479
|
-
if (
|
|
2480
|
-
|
|
2503
|
+
function Fn(e) {
|
|
2504
|
+
if (Cn(e)) {
|
|
2505
|
+
Pn(e.format);
|
|
2481
2506
|
return;
|
|
2482
2507
|
}
|
|
2483
|
-
if (
|
|
2508
|
+
if (wn(e)) {
|
|
2484
2509
|
if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
|
|
2485
|
-
if (e.sampleRate !== void 0 && !
|
|
2510
|
+
if (e.sampleRate !== void 0 && !Nn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2486
2511
|
return;
|
|
2487
2512
|
}
|
|
2488
|
-
if (
|
|
2513
|
+
if (Tn(e)) {
|
|
2489
2514
|
if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
2490
|
-
if (e.sampleRate !== void 0 && !
|
|
2515
|
+
if (e.sampleRate !== void 0 && !Nn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2491
2516
|
return;
|
|
2492
2517
|
}
|
|
2493
|
-
if (
|
|
2518
|
+
if (En(e)) {
|
|
2494
2519
|
let t = e.encoding.trim().toLowerCase();
|
|
2495
2520
|
if (!t) throw new Q("Encoded audio MIME type is required.");
|
|
2496
2521
|
if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
2497
|
-
if (e.sampleRate !== void 0 && !
|
|
2522
|
+
if (e.sampleRate !== void 0 && !Nn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
|
|
2498
2523
|
return;
|
|
2499
2524
|
}
|
|
2500
2525
|
throw new Q("Unsupported speech.play audio shape.");
|
|
2501
2526
|
}
|
|
2502
|
-
function
|
|
2503
|
-
if (e.format) return
|
|
2527
|
+
function In(e) {
|
|
2528
|
+
if (e.format) return Pn(e.format), e.format;
|
|
2504
2529
|
if (e.track) {
|
|
2505
2530
|
let t = {
|
|
2506
2531
|
encoding: "pcm_s16le",
|
|
2507
2532
|
sampleRate: e.sampleRate ?? 24e3,
|
|
2508
2533
|
channels: 1
|
|
2509
2534
|
};
|
|
2510
|
-
return
|
|
2535
|
+
return Pn(t), t;
|
|
2511
2536
|
}
|
|
2512
2537
|
throw new Q("createUtterance requires format or track.");
|
|
2513
2538
|
}
|
|
2514
|
-
function
|
|
2539
|
+
function Ln(e) {
|
|
2515
2540
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2516
2541
|
}
|
|
2517
|
-
function
|
|
2542
|
+
function Rn(e) {
|
|
2518
2543
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
2519
2544
|
}
|
|
2520
2545
|
//#endregion
|
|
2521
2546
|
//#region src/byo/pcm.ts
|
|
2522
|
-
function
|
|
2547
|
+
function zn(e) {
|
|
2523
2548
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
2524
2549
|
for (let t = 0; t < e.length; t++) {
|
|
2525
2550
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -2529,11 +2554,11 @@ function Fn(e) {
|
|
|
2529
2554
|
}
|
|
2530
2555
|
//#endregion
|
|
2531
2556
|
//#region src/byo/resample.ts
|
|
2532
|
-
function
|
|
2557
|
+
function Bn(e, t, n, r, i) {
|
|
2533
2558
|
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;
|
|
2534
2559
|
return ((a * i + o) * i + s) * i + c;
|
|
2535
2560
|
}
|
|
2536
|
-
function
|
|
2561
|
+
function Vn(e, t) {
|
|
2537
2562
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
2538
2563
|
if (e === t) return {
|
|
2539
2564
|
fromRate: e,
|
|
@@ -2556,7 +2581,7 @@ function Ln(e, t) {
|
|
|
2556
2581
|
let a = [];
|
|
2557
2582
|
for (; i + 2 < r.length - 1;) {
|
|
2558
2583
|
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);
|
|
2559
|
-
a.push(
|
|
2584
|
+
a.push(Bn(r[o], r[e], r[s], r[c], t)), i += n;
|
|
2560
2585
|
}
|
|
2561
2586
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
2562
2587
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -2568,7 +2593,7 @@ function Ln(e, t) {
|
|
|
2568
2593
|
}
|
|
2569
2594
|
//#endregion
|
|
2570
2595
|
//#region src/byo/audioCapture.ts
|
|
2571
|
-
var
|
|
2596
|
+
var Hn = "liforma-pcm-capture", Un = `
|
|
2572
2597
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
2573
2598
|
process(inputs) {
|
|
2574
2599
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -2580,29 +2605,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
2580
2605
|
return true;
|
|
2581
2606
|
}
|
|
2582
2607
|
}
|
|
2583
|
-
registerProcessor('${
|
|
2584
|
-
`,
|
|
2585
|
-
function
|
|
2586
|
-
return
|
|
2608
|
+
registerProcessor('${Hn}', LiformaPcmCaptureProcessor);
|
|
2609
|
+
`, Wn = null;
|
|
2610
|
+
function Gn() {
|
|
2611
|
+
return Wn ||= URL.createObjectURL(new Blob([Un], { type: "application/javascript" })), Wn;
|
|
2587
2612
|
}
|
|
2588
|
-
function
|
|
2613
|
+
function Kn() {
|
|
2589
2614
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
2590
2615
|
}
|
|
2591
|
-
async function
|
|
2592
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
2616
|
+
async function qn(e) {
|
|
2617
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Kn();
|
|
2593
2618
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
2594
2619
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
2595
2620
|
l.gain.value = 0;
|
|
2596
|
-
let u = s.sampleRate, d =
|
|
2621
|
+
let u = s.sampleRate, d = Vn(u, n), f = !1, p = !1, m = (e) => {
|
|
2597
2622
|
if (f || i && !i()) return;
|
|
2598
2623
|
let t = d.push(e);
|
|
2599
|
-
t.length !== 0 && r(
|
|
2624
|
+
t.length !== 0 && r(zn(t));
|
|
2600
2625
|
}, h = () => void 0;
|
|
2601
2626
|
return await (async () => {
|
|
2602
2627
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
2603
2628
|
try {
|
|
2604
|
-
await s.audioWorklet.addModule(
|
|
2605
|
-
let e = new AudioWorkletNode(s,
|
|
2629
|
+
await s.audioWorklet.addModule(Gn());
|
|
2630
|
+
let e = new AudioWorkletNode(s, Hn, {
|
|
2606
2631
|
numberOfInputs: 1,
|
|
2607
2632
|
numberOfOutputs: 1,
|
|
2608
2633
|
outputChannelCount: [1]
|
|
@@ -2652,7 +2677,7 @@ async function Un(e) {
|
|
|
2652
2677
|
}
|
|
2653
2678
|
//#endregion
|
|
2654
2679
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
2655
|
-
async function
|
|
2680
|
+
async function Jn(e) {
|
|
2656
2681
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
2657
2682
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
|
|
2658
2683
|
if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -2661,18 +2686,18 @@ async function Wn(e) {
|
|
|
2661
2686
|
s || (s = !0, c?.stop(), c = null);
|
|
2662
2687
|
};
|
|
2663
2688
|
try {
|
|
2664
|
-
c = await
|
|
2689
|
+
c = await qn({
|
|
2665
2690
|
mediaStream: a,
|
|
2666
2691
|
targetSampleRate: r,
|
|
2667
2692
|
shouldSend: () => !s && !i?.aborted,
|
|
2668
2693
|
onPcm: (e) => {
|
|
2669
2694
|
if (s || i?.aborted) return;
|
|
2670
|
-
let t =
|
|
2695
|
+
let t = Ln(e);
|
|
2671
2696
|
o = o.then(async () => {
|
|
2672
2697
|
if (s || i?.aborted) return;
|
|
2673
2698
|
let e = 0;
|
|
2674
2699
|
for (; e < t.byteLength;) {
|
|
2675
|
-
let r = Math.min(e +
|
|
2700
|
+
let r = Math.min(e + On.MAX_CHUNK_BYTES, t.byteLength);
|
|
2676
2701
|
if ((r - e) % 2 == 1 && --r, r <= e) break;
|
|
2677
2702
|
let i = t.subarray(e, r);
|
|
2678
2703
|
e = r, i.byteLength !== 0 && await n.write(i);
|
|
@@ -2696,10 +2721,10 @@ async function Wn(e) {
|
|
|
2696
2721
|
}
|
|
2697
2722
|
//#endregion
|
|
2698
2723
|
//#region src/v2/speech/speechController.ts
|
|
2699
|
-
async function
|
|
2700
|
-
if (
|
|
2701
|
-
if (
|
|
2702
|
-
let t =
|
|
2724
|
+
async function Yn(e, t) {
|
|
2725
|
+
if (Tn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
|
|
2726
|
+
if (Cn(e)) {
|
|
2727
|
+
let t = Ln(e.data);
|
|
2703
2728
|
if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
|
|
2704
2729
|
return {
|
|
2705
2730
|
kind: "pcm",
|
|
@@ -2707,17 +2732,17 @@ async function Gn(e, t) {
|
|
|
2707
2732
|
format: e.format
|
|
2708
2733
|
};
|
|
2709
2734
|
}
|
|
2710
|
-
if (
|
|
2735
|
+
if (wn(e)) return {
|
|
2711
2736
|
kind: "url",
|
|
2712
2737
|
url: e.url.trim(),
|
|
2713
2738
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2714
2739
|
};
|
|
2715
|
-
if (!
|
|
2740
|
+
if (!En(e)) throw new Q("Unsupported speech.play audio shape.");
|
|
2716
2741
|
let n;
|
|
2717
2742
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
2718
2743
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2719
2744
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
2720
|
-
} else n =
|
|
2745
|
+
} else n = Ln(e.data);
|
|
2721
2746
|
return {
|
|
2722
2747
|
kind: "encoded",
|
|
2723
2748
|
data: n.slice().buffer,
|
|
@@ -2725,10 +2750,10 @@ async function Gn(e, t) {
|
|
|
2725
2750
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
2726
2751
|
};
|
|
2727
2752
|
}
|
|
2728
|
-
function
|
|
2753
|
+
function Xn() {
|
|
2729
2754
|
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)}`;
|
|
2730
2755
|
}
|
|
2731
|
-
function
|
|
2756
|
+
function Zn(e, t = "completed") {
|
|
2732
2757
|
return {
|
|
2733
2758
|
utteranceId: e.speechId,
|
|
2734
2759
|
characterId: e.characterId,
|
|
@@ -2742,13 +2767,13 @@ function qn(e, t = "completed") {
|
|
|
2742
2767
|
}
|
|
2743
2768
|
};
|
|
2744
2769
|
}
|
|
2745
|
-
function
|
|
2770
|
+
function Qn(e) {
|
|
2746
2771
|
return e instanceof Error ? e : new Q(String(e));
|
|
2747
2772
|
}
|
|
2748
|
-
function
|
|
2773
|
+
function $n(e) {
|
|
2749
2774
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
2750
2775
|
}
|
|
2751
|
-
var
|
|
2776
|
+
var er = class {
|
|
2752
2777
|
id;
|
|
2753
2778
|
characterId;
|
|
2754
2779
|
result;
|
|
@@ -2777,29 +2802,29 @@ var Xn = class {
|
|
|
2777
2802
|
queue: e.queue,
|
|
2778
2803
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
2779
2804
|
}).catch((e) => {
|
|
2780
|
-
throw this.fail(
|
|
2805
|
+
throw this.fail(Qn(e)), Qn(e);
|
|
2781
2806
|
}), this.signal?.addEventListener("abort", () => {
|
|
2782
2807
|
this.cancel();
|
|
2783
2808
|
}, { once: !0 });
|
|
2784
2809
|
}
|
|
2785
2810
|
async write(e, t) {
|
|
2786
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2787
|
-
let n =
|
|
2811
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new An();
|
|
2812
|
+
let n = Ln(e);
|
|
2788
2813
|
if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
|
|
2789
|
-
if (n.byteLength >
|
|
2814
|
+
if (n.byteLength > On.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${On.MAX_CHUNK_BYTES}).`);
|
|
2790
2815
|
if (n.byteLength === 0) return;
|
|
2791
|
-
let r = t?.timeoutMs ??
|
|
2816
|
+
let r = t?.timeoutMs ?? On.DEFAULT_WRITE_TIMEOUT_MS;
|
|
2792
2817
|
await this.acquireWriteSlot(r);
|
|
2793
2818
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
2794
|
-
if (this.bufferedMs + i >
|
|
2819
|
+
if (this.bufferedMs + i > On.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
2795
2820
|
let a = async () => {
|
|
2796
|
-
if (this.closed || this.settled) throw new
|
|
2821
|
+
if (this.closed || this.settled) throw new An();
|
|
2797
2822
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
2798
2823
|
utteranceId: this.id,
|
|
2799
2824
|
audio: t.buffer,
|
|
2800
2825
|
byteLength: t.byteLength
|
|
2801
2826
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
2802
|
-
setTimeout(() => t(new
|
|
2827
|
+
setTimeout(() => t(new jn()), r);
|
|
2803
2828
|
})]);
|
|
2804
2829
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
2805
2830
|
}, o = this.writeChain.then(a, a);
|
|
@@ -2811,7 +2836,7 @@ var Xn = class {
|
|
|
2811
2836
|
}
|
|
2812
2837
|
}
|
|
2813
2838
|
async setTranscript(e) {
|
|
2814
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2839
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new An();
|
|
2815
2840
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
2816
2841
|
utteranceId: this.id,
|
|
2817
2842
|
transcript: e
|
|
@@ -2828,7 +2853,7 @@ var Xn = class {
|
|
|
2828
2853
|
});
|
|
2829
2854
|
return this.resolve(t), t;
|
|
2830
2855
|
} catch (e) {
|
|
2831
|
-
let t =
|
|
2856
|
+
let t = Qn(e);
|
|
2832
2857
|
throw this.fail(t), t;
|
|
2833
2858
|
}
|
|
2834
2859
|
}
|
|
@@ -2846,11 +2871,11 @@ var Xn = class {
|
|
|
2846
2871
|
characterId: this.characterId,
|
|
2847
2872
|
status: "cancelled",
|
|
2848
2873
|
durationMs: 0,
|
|
2849
|
-
animation:
|
|
2874
|
+
animation: Mn("none")
|
|
2850
2875
|
};
|
|
2851
2876
|
return this.resolve(t), t;
|
|
2852
2877
|
} catch (e) {
|
|
2853
|
-
let t =
|
|
2878
|
+
let t = Qn(e);
|
|
2854
2879
|
throw this.fail(t), t;
|
|
2855
2880
|
}
|
|
2856
2881
|
}
|
|
@@ -2863,19 +2888,19 @@ var Xn = class {
|
|
|
2863
2888
|
return e;
|
|
2864
2889
|
}
|
|
2865
2890
|
resolve(e) {
|
|
2866
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2891
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new An()));
|
|
2867
2892
|
}
|
|
2868
2893
|
fail(e) {
|
|
2869
2894
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
2870
2895
|
}
|
|
2871
2896
|
async acquireWriteSlot(e) {
|
|
2872
|
-
if (this.pendingWriteCount <
|
|
2897
|
+
if (this.pendingWriteCount < On.MAX_PENDING_WRITES) {
|
|
2873
2898
|
this.pendingWriteCount += 1;
|
|
2874
2899
|
return;
|
|
2875
2900
|
}
|
|
2876
2901
|
await new Promise((t, n) => {
|
|
2877
2902
|
let r = setTimeout(() => {
|
|
2878
|
-
n(new
|
|
2903
|
+
n(new jn());
|
|
2879
2904
|
}, e);
|
|
2880
2905
|
this.pendingWriteWaiters.push({
|
|
2881
2906
|
resolve: () => {
|
|
@@ -2894,13 +2919,13 @@ var Xn = class {
|
|
|
2894
2919
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2895
2920
|
}
|
|
2896
2921
|
};
|
|
2897
|
-
function
|
|
2922
|
+
function tr(e) {
|
|
2898
2923
|
let t = null, n = (t, n) => {
|
|
2899
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2924
|
+
if (!e.getCapabilities()[n]) throw new kn(t, n);
|
|
2900
2925
|
}, r = {
|
|
2901
2926
|
async speak(r) {
|
|
2902
2927
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2903
|
-
let i =
|
|
2928
|
+
let i = Rn(r.queue ?? "append");
|
|
2904
2929
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2905
2930
|
let a = e.getIframeHost();
|
|
2906
2931
|
if (!a) throw new Q("Speech session is not attached.");
|
|
@@ -2920,41 +2945,41 @@ function Zn(e) {
|
|
|
2920
2945
|
return;
|
|
2921
2946
|
}
|
|
2922
2947
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2923
|
-
t.removeEventListener("abort", s), n(
|
|
2948
|
+
t.removeEventListener("abort", s), n(Zn(e, "completed"));
|
|
2924
2949
|
}, (a) => {
|
|
2925
|
-
if (t.removeEventListener("abort", s),
|
|
2950
|
+
if (t.removeEventListener("abort", s), $n(a)) {
|
|
2926
2951
|
n({
|
|
2927
2952
|
utteranceId: "utt_interrupted",
|
|
2928
2953
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2929
2954
|
status: "interrupted",
|
|
2930
2955
|
durationMs: 0,
|
|
2931
2956
|
transcript: r.text,
|
|
2932
|
-
animation:
|
|
2957
|
+
animation: Mn("none")
|
|
2933
2958
|
});
|
|
2934
2959
|
return;
|
|
2935
2960
|
}
|
|
2936
|
-
i(
|
|
2961
|
+
i(Qn(a));
|
|
2937
2962
|
});
|
|
2938
2963
|
});
|
|
2939
2964
|
}
|
|
2940
2965
|
try {
|
|
2941
|
-
return
|
|
2966
|
+
return Zn(await o, "completed");
|
|
2942
2967
|
} catch (t) {
|
|
2943
|
-
if (
|
|
2968
|
+
if ($n(t)) return {
|
|
2944
2969
|
utteranceId: "utt_interrupted",
|
|
2945
2970
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2946
2971
|
status: "interrupted",
|
|
2947
2972
|
durationMs: 0,
|
|
2948
2973
|
transcript: r.text,
|
|
2949
|
-
animation:
|
|
2974
|
+
animation: Mn("none")
|
|
2950
2975
|
};
|
|
2951
|
-
throw
|
|
2976
|
+
throw Qn(t);
|
|
2952
2977
|
}
|
|
2953
2978
|
},
|
|
2954
2979
|
async play(i) {
|
|
2955
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2980
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Fn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2956
2981
|
let a = i.queue ?? "append";
|
|
2957
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2982
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Tn(i.audio)) {
|
|
2958
2983
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2959
2984
|
return r.createUtterance({
|
|
2960
2985
|
format: {
|
|
@@ -2970,7 +2995,7 @@ function Zn(e) {
|
|
|
2970
2995
|
}
|
|
2971
2996
|
let o = e.getIframeHost();
|
|
2972
2997
|
if (!o) throw new Q("Speech session is not attached.");
|
|
2973
|
-
let s = await
|
|
2998
|
+
let s = await Yn(i.audio, i.signal);
|
|
2974
2999
|
return o.speechPlay({
|
|
2975
3000
|
source: s,
|
|
2976
3001
|
characterId: i.characterId,
|
|
@@ -2982,13 +3007,13 @@ function Zn(e) {
|
|
|
2982
3007
|
},
|
|
2983
3008
|
createUtterance(r) {
|
|
2984
3009
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2985
|
-
let i =
|
|
3010
|
+
let i = In(r);
|
|
2986
3011
|
if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
|
|
2987
3012
|
let a = r.queue ?? "replace-active";
|
|
2988
3013
|
if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
|
|
2989
3014
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2990
|
-
let o = new
|
|
2991
|
-
id:
|
|
3015
|
+
let o = new er({
|
|
3016
|
+
id: Xn(),
|
|
2992
3017
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2993
3018
|
format: i,
|
|
2994
3019
|
queue: a,
|
|
@@ -3000,7 +3025,7 @@ function Zn(e) {
|
|
|
3000
3025
|
t === o && (t = null);
|
|
3001
3026
|
}), r.track && (async () => {
|
|
3002
3027
|
try {
|
|
3003
|
-
if (await
|
|
3028
|
+
if (await Jn({
|
|
3004
3029
|
track: r.track,
|
|
3005
3030
|
utterance: o,
|
|
3006
3031
|
sampleRate: i.sampleRate,
|
|
@@ -3028,16 +3053,16 @@ function Zn(e) {
|
|
|
3028
3053
|
}
|
|
3029
3054
|
//#endregion
|
|
3030
3055
|
//#region src/v2/types/sessionInteraction.ts
|
|
3031
|
-
function
|
|
3056
|
+
function nr(e) {
|
|
3032
3057
|
let t = e?.trim();
|
|
3033
3058
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
3034
3059
|
}
|
|
3035
3060
|
//#endregion
|
|
3036
3061
|
//#region src/v2/experience.ts
|
|
3037
|
-
function
|
|
3062
|
+
function rr(e) {
|
|
3038
3063
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
3039
3064
|
}
|
|
3040
|
-
var
|
|
3065
|
+
var ir = class e {
|
|
3041
3066
|
bootstrap;
|
|
3042
3067
|
conversationProcessor;
|
|
3043
3068
|
iframeHost = null;
|
|
@@ -3057,17 +3082,17 @@ var er = class e {
|
|
|
3057
3082
|
pendingTheatre = null;
|
|
3058
3083
|
lastInteraction = null;
|
|
3059
3084
|
closeHandlers = [];
|
|
3060
|
-
eventRegistry =
|
|
3085
|
+
eventRegistry = yn();
|
|
3061
3086
|
readyEnvelope = null;
|
|
3062
3087
|
startedEnvelope = null;
|
|
3063
3088
|
sessionMintedEnvelope = null;
|
|
3064
3089
|
conversationCache = [];
|
|
3065
3090
|
speech;
|
|
3066
3091
|
constructor(e) {
|
|
3067
|
-
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 =
|
|
3092
|
+
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 = tr({
|
|
3068
3093
|
getIframeHost: () => this.iframeHost,
|
|
3069
3094
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
3070
|
-
getCapabilities: () =>
|
|
3095
|
+
getCapabilities: () => ar(this.resolvedSession),
|
|
3071
3096
|
getActiveCharacterId: () => "character_unknown",
|
|
3072
3097
|
onProcessorInterrupt: () => {
|
|
3073
3098
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -3156,7 +3181,7 @@ var er = class e {
|
|
|
3156
3181
|
return null;
|
|
3157
3182
|
}
|
|
3158
3183
|
on(e, t) {
|
|
3159
|
-
let n =
|
|
3184
|
+
let n = bn(this.eventRegistry, e, t);
|
|
3160
3185
|
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;
|
|
3161
3186
|
}
|
|
3162
3187
|
async attach(e) {
|
|
@@ -3170,13 +3195,13 @@ var er = class e {
|
|
|
3170
3195
|
if (this.closed) throw Error("Session has ended.");
|
|
3171
3196
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
3172
3197
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
3173
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
3198
|
+
let t = this.bootstrap.embedBaseUrl ?? fn(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = mn(t, n, r ? void 0 : pn(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, rr(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 = gn(i), o = null, s = new Promise((e) => {
|
|
3174
3199
|
o = e;
|
|
3175
3200
|
}), c = null, l = new Promise((e) => {
|
|
3176
3201
|
c = e;
|
|
3177
|
-
}), u =
|
|
3202
|
+
}), u = sn((e) => {
|
|
3178
3203
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
3179
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
3204
|
+
}), d = this.bootstrap.onUserTranscript, f = on({
|
|
3180
3205
|
container: e.container,
|
|
3181
3206
|
src: i,
|
|
3182
3207
|
playerOrigin: a,
|
|
@@ -3243,7 +3268,7 @@ var er = class e {
|
|
|
3243
3268
|
onTheatreChange: (t) => e.onTheatreChange?.(t)
|
|
3244
3269
|
});
|
|
3245
3270
|
this.iframeHost = f;
|
|
3246
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
3271
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Ft(this.bootstrap.sessionEndpoint, {
|
|
3247
3272
|
experienceId: this.bootstrap.experienceId,
|
|
3248
3273
|
locale: this.bootstrap.locale,
|
|
3249
3274
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -3255,7 +3280,7 @@ var er = class e {
|
|
|
3255
3280
|
attribution: this.bootstrap.attribution,
|
|
3256
3281
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
3257
3282
|
signal: this.endpointAbortController.signal
|
|
3258
|
-
})) : this.bootstrap.kind === "public" ?
|
|
3283
|
+
})) : this.bootstrap.kind === "public" ? Pt(this.bootstrap.experienceId, {
|
|
3259
3284
|
locale: this.bootstrap.locale,
|
|
3260
3285
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
3261
3286
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -3279,7 +3304,7 @@ var er = class e {
|
|
|
3279
3304
|
operation: "attach",
|
|
3280
3305
|
message: e instanceof Error ? e.message : String(e),
|
|
3281
3306
|
stack: e instanceof Error ? e.stack : void 0,
|
|
3282
|
-
release:
|
|
3307
|
+
release: cn
|
|
3283
3308
|
});
|
|
3284
3309
|
} catch {}
|
|
3285
3310
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -3291,19 +3316,23 @@ var er = class e {
|
|
|
3291
3316
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
3292
3317
|
this.launchToken = g;
|
|
3293
3318
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
3294
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
3319
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Et(_), f.postLaunch(g, _, {
|
|
3295
3320
|
startButton: e.startButton,
|
|
3296
3321
|
theme: e.theme,
|
|
3297
3322
|
showFeedback: e.showFeedback,
|
|
3298
3323
|
interaction: e.interaction,
|
|
3299
|
-
...e.
|
|
3324
|
+
...yt("settingsButton", e.settingsButton),
|
|
3325
|
+
...yt("theatreButton", e.theatreButton),
|
|
3326
|
+
...yt("fullscreenButton", e.fullscreenButton),
|
|
3300
3327
|
...e.theatre === void 0 ? {} : { theatre: e.theatre }
|
|
3301
3328
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
3302
3329
|
startButton: e.startButton,
|
|
3303
3330
|
theme: e.theme,
|
|
3304
3331
|
showFeedback: e.showFeedback,
|
|
3305
3332
|
interaction: e.interaction,
|
|
3306
|
-
...e.
|
|
3333
|
+
...yt("settingsButton", e.settingsButton),
|
|
3334
|
+
...yt("theatreButton", e.theatreButton),
|
|
3335
|
+
...yt("fullscreenButton", e.fullscreenButton),
|
|
3307
3336
|
...e.theatre === void 0 ? {} : { theatre: e.theatre }
|
|
3308
3337
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
3309
3338
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
@@ -3315,7 +3344,7 @@ var er = class e {
|
|
|
3315
3344
|
operation: "attach",
|
|
3316
3345
|
message: e instanceof Error ? e.message : String(e),
|
|
3317
3346
|
stack: e instanceof Error ? e.stack : void 0,
|
|
3318
|
-
release:
|
|
3347
|
+
release: cn
|
|
3319
3348
|
});
|
|
3320
3349
|
} catch {}
|
|
3321
3350
|
throw e;
|
|
@@ -3329,7 +3358,7 @@ var er = class e {
|
|
|
3329
3358
|
operation: "attach",
|
|
3330
3359
|
message: e instanceof Error ? e.message : String(e),
|
|
3331
3360
|
stack: e instanceof Error ? e.stack : void 0,
|
|
3332
|
-
release:
|
|
3361
|
+
release: cn
|
|
3333
3362
|
});
|
|
3334
3363
|
} catch {}
|
|
3335
3364
|
throw e;
|
|
@@ -3361,7 +3390,7 @@ var er = class e {
|
|
|
3361
3390
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
3362
3391
|
}
|
|
3363
3392
|
async setFit(e) {
|
|
3364
|
-
let t =
|
|
3393
|
+
let t = nr(e);
|
|
3365
3394
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
3366
3395
|
if (this.closed) throw Error("Session has ended.");
|
|
3367
3396
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
@@ -3411,7 +3440,7 @@ var er = class e {
|
|
|
3411
3440
|
this.close();
|
|
3412
3441
|
}
|
|
3413
3442
|
destroy() {
|
|
3414
|
-
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,
|
|
3443
|
+
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, Sn(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
3415
3444
|
}
|
|
3416
3445
|
resolveMintInteraction() {
|
|
3417
3446
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -3423,8 +3452,8 @@ var er = class e {
|
|
|
3423
3452
|
return this.resolvedSession?.id ?? "";
|
|
3424
3453
|
}
|
|
3425
3454
|
emitWrapped(e, t) {
|
|
3426
|
-
let n =
|
|
3427
|
-
return
|
|
3455
|
+
let n = vn(e, this.getSessionId(), t);
|
|
3456
|
+
return xn(this.eventRegistry, e, n), n;
|
|
3428
3457
|
}
|
|
3429
3458
|
queueProcessorTurn(e) {
|
|
3430
3459
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -3433,7 +3462,7 @@ var er = class e {
|
|
|
3433
3462
|
let n = this.processorAbortController.signal;
|
|
3434
3463
|
this.processorChain = this.processorChain.then(async () => {
|
|
3435
3464
|
if (!n.aborted) try {
|
|
3436
|
-
let r = await
|
|
3465
|
+
let r = await Rt(t, {
|
|
3437
3466
|
utteranceId: e.utteranceId,
|
|
3438
3467
|
text: e.text,
|
|
3439
3468
|
conversation: this.conversationCache,
|
|
@@ -3483,7 +3512,7 @@ var er = class e {
|
|
|
3483
3512
|
};
|
|
3484
3513
|
}
|
|
3485
3514
|
};
|
|
3486
|
-
function
|
|
3515
|
+
function ar(e) {
|
|
3487
3516
|
return e ? {
|
|
3488
3517
|
textSpeech: e.capabilities.speech.output,
|
|
3489
3518
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -3494,41 +3523,41 @@ function tr(e) {
|
|
|
3494
3523
|
}
|
|
3495
3524
|
//#endregion
|
|
3496
3525
|
//#region src/widget/dockGeometry.ts
|
|
3497
|
-
var
|
|
3498
|
-
function
|
|
3526
|
+
var or = "(min-width: 768px)", sr = 24, cr = .5, lr = 1200, ur = .85, dr = 9 / 16;
|
|
3527
|
+
function fr() {
|
|
3499
3528
|
if (typeof window > "u") return 800;
|
|
3500
3529
|
let e = window.screen?.availHeight;
|
|
3501
3530
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
3502
3531
|
}
|
|
3503
|
-
function
|
|
3504
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
3505
|
-
return s > a && (s = a, o = s /
|
|
3532
|
+
function pr(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = sr, r = typeof window < "u" ? fr() : 800) {
|
|
3533
|
+
let i = Math.max(160, Math.min(t - n * 2, t * ur)), a = Math.max(120, e - n * 2), o = Math.min(r * cr, lr, i), s = o * dr;
|
|
3534
|
+
return s > a && (s = a, o = s / dr, o > i && (o = i, s = o * dr)), {
|
|
3506
3535
|
width: Math.round(s),
|
|
3507
3536
|
height: Math.round(o)
|
|
3508
3537
|
};
|
|
3509
3538
|
}
|
|
3510
|
-
function
|
|
3539
|
+
function mr(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = sr) {
|
|
3511
3540
|
return {
|
|
3512
3541
|
left: Math.max(r, t - e.width - r),
|
|
3513
3542
|
top: Math.max(r, n - e.height - r)
|
|
3514
3543
|
};
|
|
3515
3544
|
}
|
|
3516
|
-
function
|
|
3545
|
+
function hr(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = sr) {
|
|
3517
3546
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
3518
3547
|
return {
|
|
3519
3548
|
left: Math.min(Math.max(a, e), o),
|
|
3520
3549
|
top: Math.min(Math.max(a, t), s)
|
|
3521
3550
|
};
|
|
3522
3551
|
}
|
|
3523
|
-
function
|
|
3524
|
-
return e(
|
|
3552
|
+
function gr(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
3553
|
+
return e(or).matches;
|
|
3525
3554
|
}
|
|
3526
3555
|
//#endregion
|
|
3527
3556
|
//#region src/widget/mountExperienceWidget.ts
|
|
3528
|
-
function
|
|
3557
|
+
function _r(e) {
|
|
3529
3558
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
3530
3559
|
}
|
|
3531
|
-
function
|
|
3560
|
+
function vr(e) {
|
|
3532
3561
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
3533
3562
|
let t = typeof e == "string" ? e.trim() : "";
|
|
3534
3563
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -3536,10 +3565,10 @@ function mr(e) {
|
|
|
3536
3565
|
function $(e) {
|
|
3537
3566
|
return e === "expanded" || e === "docked";
|
|
3538
3567
|
}
|
|
3539
|
-
var
|
|
3540
|
-
function
|
|
3541
|
-
Ve
|
|
3542
|
-
let r =
|
|
3568
|
+
var yr = "<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>", br = "<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>", xr = "<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>", Sr = "<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>";
|
|
3569
|
+
function Cr(e, t, n) {
|
|
3570
|
+
Ue(Ve);
|
|
3571
|
+
let r = ge({
|
|
3543
3572
|
galleryThumb: t.galleryThumb,
|
|
3544
3573
|
avatarImage: t.avatarImage,
|
|
3545
3574
|
backgroundImage: t.backgroundImage,
|
|
@@ -3565,9 +3594,9 @@ function yr(e, t, n) {
|
|
|
3565
3594
|
let e = document.createElement("img");
|
|
3566
3595
|
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);
|
|
3567
3596
|
}
|
|
3568
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
3597
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Be(i);
|
|
3569
3598
|
}
|
|
3570
|
-
function
|
|
3599
|
+
function wr(e) {
|
|
3571
3600
|
return e.startButton ? {
|
|
3572
3601
|
...e.startButton,
|
|
3573
3602
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -3579,7 +3608,7 @@ function br(e) {
|
|
|
3579
3608
|
variant: "primary"
|
|
3580
3609
|
};
|
|
3581
3610
|
}
|
|
3582
|
-
function
|
|
3611
|
+
function Tr(e) {
|
|
3583
3612
|
let t = !1, n = () => {
|
|
3584
3613
|
t || e();
|
|
3585
3614
|
}, r = () => {
|
|
@@ -3599,12 +3628,12 @@ function xr(e) {
|
|
|
3599
3628
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
3600
3629
|
};
|
|
3601
3630
|
}
|
|
3602
|
-
function
|
|
3603
|
-
et
|
|
3631
|
+
function Er(e, t) {
|
|
3632
|
+
nt(et);
|
|
3604
3633
|
let n = t.experienceId?.trim();
|
|
3605
3634
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
3606
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
3607
|
-
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",
|
|
3635
|
+
let r = t.prefetch ?? "onExpand", i = _r(t.position), a = document.createElement("div");
|
|
3636
|
+
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", vr(t.offset));
|
|
3608
3637
|
let o = document.createElement("button");
|
|
3609
3638
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
3610
3639
|
let s = document.createElement("div");
|
|
@@ -3624,136 +3653,136 @@ function Sr(e, t) {
|
|
|
3624
3653
|
let m = document.createElement("span");
|
|
3625
3654
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
3626
3655
|
let h = document.createElement("button");
|
|
3627
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
3656
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = xr, h.setAttribute("aria-label", "Reduce");
|
|
3628
3657
|
let g = document.createElement("button");
|
|
3629
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
3658
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = yr, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
3630
3659
|
let _ = document.createElement("button");
|
|
3631
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
3660
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = br, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
3632
3661
|
let v = document.createElement("div");
|
|
3633
3662
|
v.className = "liforma-ew__stage";
|
|
3634
3663
|
let y = document.createElement("div");
|
|
3635
3664
|
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);
|
|
3636
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "",
|
|
3665
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", ee = null, te = null, A = null, j = null, M = null, N = null, P = null, ne = 0, re = 0, F = null, I = !1, ie = new AbortController(), ae = t.parallax !== !1, L = () => {
|
|
3637
3666
|
let e = a.dataset.state;
|
|
3638
3667
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
3639
|
-
},
|
|
3640
|
-
|
|
3668
|
+
}, R = () => {
|
|
3669
|
+
A !== null && (clearTimeout(A), A = null);
|
|
3641
3670
|
}, oe = () => {
|
|
3642
|
-
|
|
3643
|
-
},
|
|
3671
|
+
j !== null && (clearTimeout(j), j = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3672
|
+
}, se = () => {
|
|
3644
3673
|
for (let e of [
|
|
3645
3674
|
f,
|
|
3646
3675
|
l,
|
|
3647
3676
|
p
|
|
3648
3677
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
3649
3678
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
3650
|
-
},
|
|
3679
|
+
}, ce = (e, t, n, r) => {
|
|
3651
3680
|
let i = (i) => {
|
|
3652
3681
|
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";
|
|
3653
3682
|
};
|
|
3654
3683
|
i(f), i(l);
|
|
3655
3684
|
let a = p.offsetWidth || 120;
|
|
3656
3685
|
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";
|
|
3657
|
-
}, ce = (e, t) => {
|
|
3658
|
-
if (R() !== "docked") return;
|
|
3659
|
-
let n = lr(), r = dr(e - te, t - I, n);
|
|
3660
|
-
N = r.left, P = r.top, se(r.left, r.top, n.width, n.height);
|
|
3661
3686
|
}, le = (e, t) => {
|
|
3662
|
-
if (
|
|
3663
|
-
let n =
|
|
3664
|
-
|
|
3665
|
-
},
|
|
3666
|
-
L
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
let t = L;
|
|
3670
|
-
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", B), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
3671
|
-
}, ue = (e, t, n) => {
|
|
3672
|
-
if (S || R() !== "docked" || !fr() || F !== null) return;
|
|
3673
|
-
F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3674
|
-
let r = f.getBoundingClientRect();
|
|
3675
|
-
te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", B), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
3687
|
+
if (L() !== "docked") return;
|
|
3688
|
+
let n = pr(), r = hr(e - ne, t - re, n);
|
|
3689
|
+
M = r.left, N = r.top, ce(r.left, r.top, n.width, n.height);
|
|
3690
|
+
}, ue = (e, t) => {
|
|
3691
|
+
if (L() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
3692
|
+
let n = pr(), r = M ?? f.getBoundingClientRect().left, i = N ?? f.getBoundingClientRect().top, a = hr(r + e, i + t, n);
|
|
3693
|
+
M = a.left, N = a.top, ce(a.left, a.top, n.width, n.height);
|
|
3676
3694
|
}, de = (e) => {
|
|
3677
|
-
|
|
3678
|
-
|
|
3695
|
+
F === "toolbar" && (P === null || e.pointerId !== P || (e.preventDefault(), le(e.clientX, e.clientY)));
|
|
3696
|
+
}, z = (e) => {
|
|
3697
|
+
if (P === null || e && e.pointerId !== P) return;
|
|
3698
|
+
let t = F;
|
|
3699
|
+
P = null, F = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && I && (I = !1, window.removeEventListener("pointermove", de), window.removeEventListener("pointerup", z), window.removeEventListener("pointercancel", z));
|
|
3700
|
+
}, B = (e, t, n) => {
|
|
3701
|
+
if (S || L() !== "docked" || !gr() || P !== null) return;
|
|
3702
|
+
P = n, F = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3703
|
+
let r = f.getBoundingClientRect();
|
|
3704
|
+
ne = e - r.left, re = t - r.top, I || (I = !0, window.addEventListener("pointermove", de), window.addEventListener("pointerup", z), window.addEventListener("pointercancel", z));
|
|
3705
|
+
}, V = (e) => {
|
|
3706
|
+
if (S || L() !== "docked" || !gr() || P !== null) return;
|
|
3707
|
+
P = e.pointerId, F = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3679
3708
|
let t = f.getBoundingClientRect();
|
|
3680
|
-
|
|
3709
|
+
M = t.left, N = t.top;
|
|
3681
3710
|
}, fe = (e) => {
|
|
3682
|
-
|
|
3711
|
+
F === "player" && (P === null || e.pointerId !== P || ue(e.dx, e.dy));
|
|
3683
3712
|
}, pe = (e) => {
|
|
3684
|
-
|
|
3713
|
+
F === "player" && (P === null || e.pointerId !== P || z());
|
|
3685
3714
|
}, H = () => {
|
|
3686
|
-
let e =
|
|
3715
|
+
let e = gr(), t = L();
|
|
3687
3716
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
3688
3717
|
h.hidden = !0;
|
|
3689
3718
|
return;
|
|
3690
3719
|
}
|
|
3691
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
3720
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = Sr, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = xr, h.setAttribute("aria-label", "Reduce"));
|
|
3692
3721
|
}, me = (e) => {
|
|
3693
|
-
let t =
|
|
3694
|
-
n =
|
|
3695
|
-
},
|
|
3722
|
+
let t = pr(), n = e && M !== null && N !== null ? hr(M, N, t) : mr(t);
|
|
3723
|
+
n = hr(n.left, n.top, t), M = n.left, N = n.top, ce(n.left, n.top, t.width, t.height), H();
|
|
3724
|
+
}, U = () => {
|
|
3696
3725
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
3697
3726
|
requestAnimationFrame(() => {
|
|
3698
3727
|
S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
3699
3728
|
});
|
|
3700
3729
|
});
|
|
3701
|
-
},
|
|
3730
|
+
}, he = (e) => {
|
|
3702
3731
|
if (oe(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
3703
3732
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3704
3733
|
return;
|
|
3705
3734
|
}
|
|
3706
|
-
|
|
3707
|
-
if (
|
|
3735
|
+
j = setTimeout(() => {
|
|
3736
|
+
if (j = null, S || !$(a.dataset.state)) {
|
|
3708
3737
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3709
3738
|
return;
|
|
3710
3739
|
}
|
|
3711
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
3740
|
+
a.classList.remove("liforma-ew--layout-settling"), U();
|
|
3712
3741
|
}, 220);
|
|
3713
|
-
},
|
|
3714
|
-
|
|
3715
|
-
|
|
3742
|
+
}, ge = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
3743
|
+
R(), A = setTimeout(() => {
|
|
3744
|
+
A = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
3716
3745
|
}, 280);
|
|
3717
|
-
})),
|
|
3746
|
+
})), _e = {
|
|
3718
3747
|
galleryThumb: t.galleryThumb,
|
|
3719
3748
|
avatarImage: t.avatarImage,
|
|
3720
3749
|
backgroundImage: t.backgroundImage,
|
|
3721
3750
|
foregroundImage: t.foregroundImage,
|
|
3722
3751
|
fallbackImage: t.fallbackImage
|
|
3723
|
-
},
|
|
3752
|
+
}, W = (e) => {
|
|
3724
3753
|
if (!e) {
|
|
3725
3754
|
y.hidden = !0, y.textContent = "";
|
|
3726
3755
|
return;
|
|
3727
3756
|
}
|
|
3728
3757
|
y.hidden = !1, y.textContent = e;
|
|
3729
|
-
},
|
|
3758
|
+
}, ve = (e) => {
|
|
3730
3759
|
if (!e) {
|
|
3731
3760
|
c.hidden = !0, c.textContent = "";
|
|
3732
3761
|
return;
|
|
3733
3762
|
}
|
|
3734
3763
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
3735
3764
|
}, ye = () => {
|
|
3736
|
-
C = !0, o.disabled = !1,
|
|
3765
|
+
C = !0, o.disabled = !1, ve(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
3737
3766
|
}, be = () => {
|
|
3738
3767
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
3739
3768
|
}, xe = (e) => {
|
|
3740
|
-
|
|
3741
|
-
let t =
|
|
3742
|
-
return t ? (
|
|
3769
|
+
ee?.(), ee = null;
|
|
3770
|
+
let t = Cr(s, e, { parallax: ae });
|
|
3771
|
+
return t ? (ee = t, !0) : !1;
|
|
3743
3772
|
}, Se = () => {
|
|
3744
|
-
if (xe(
|
|
3773
|
+
if (xe(_e)) {
|
|
3745
3774
|
ye();
|
|
3746
3775
|
return;
|
|
3747
3776
|
}
|
|
3748
|
-
|
|
3777
|
+
ve("Loading…"), ct(n, { signal: ie.signal }).then((e) => {
|
|
3749
3778
|
if (!S) {
|
|
3750
3779
|
if (!xe({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
3751
3780
|
ye();
|
|
3752
3781
|
}
|
|
3753
3782
|
}).catch((e) => {
|
|
3754
|
-
if (S ||
|
|
3783
|
+
if (S || ie.signal.aborted) return;
|
|
3755
3784
|
let n = e instanceof Error ? e : Error(String(e));
|
|
3756
|
-
|
|
3785
|
+
ve("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
3757
3786
|
});
|
|
3758
3787
|
}, Ce = () => ({
|
|
3759
3788
|
experienceId: n,
|
|
@@ -3768,69 +3797,69 @@ function Sr(e, t) {
|
|
|
3768
3797
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
3769
3798
|
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
3770
3799
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
3771
|
-
}),
|
|
3800
|
+
}), G = () => ({
|
|
3772
3801
|
...t.fit ? { fit: t.fit } : {},
|
|
3773
|
-
startButton:
|
|
3802
|
+
startButton: wr(t),
|
|
3774
3803
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
3775
3804
|
...t.interaction ? { interaction: t.interaction } : {}
|
|
3776
|
-
}),
|
|
3777
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
3778
|
-
},
|
|
3779
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
3780
|
-
},
|
|
3805
|
+
}), K = (e = !0) => {
|
|
3806
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), se(), a.dataset.state = "expanded", W(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
|
|
3807
|
+
}, we = () => {
|
|
3808
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", W(null), typeof document < "u" && (document.body.style.overflow = k), me(!0), H(), b?.setWidgetChrome("docked");
|
|
3809
|
+
}, Te = (e) => {
|
|
3781
3810
|
e.on("started", () => {
|
|
3782
|
-
S || (D = !0, a.dataset.live = "true",
|
|
3811
|
+
S || (D = !0, a.dataset.live = "true", W(null), t.onStarted?.(), $(a.dataset.state) && U());
|
|
3783
3812
|
}), e.on("feedback", (e) => {
|
|
3784
3813
|
S || t.onFeedback?.(e);
|
|
3785
3814
|
}), e.on("feedbackFailed", (e) => {
|
|
3786
3815
|
S || t.onFeedbackFailed?.(e);
|
|
3787
3816
|
});
|
|
3817
|
+
}, Ee = () => {
|
|
3818
|
+
oe(), u.hidden = !0, p.hidden = !0, se(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), W(null), typeof document < "u" && (document.body.style.overflow = k), H();
|
|
3788
3819
|
}, De = () => {
|
|
3789
|
-
|
|
3790
|
-
}, Oe = () => {
|
|
3791
|
-
ae(), oe(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3820
|
+
R(), oe(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3792
3821
|
let e = b;
|
|
3793
3822
|
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");
|
|
3794
|
-
},
|
|
3823
|
+
}, q = () => {
|
|
3795
3824
|
if (!S && $(a.dataset.state)) {
|
|
3796
|
-
if (
|
|
3825
|
+
if (z(), x = !1, b && E) {
|
|
3797
3826
|
let e = b;
|
|
3798
3827
|
(async () => {
|
|
3799
|
-
D && (await
|
|
3828
|
+
D && (await ge(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Ee(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && be(), t.onCollapsed?.(), t.onClose?.());
|
|
3800
3829
|
})();
|
|
3801
3830
|
return;
|
|
3802
3831
|
}
|
|
3803
|
-
|
|
3832
|
+
De(), Ee(), t.onCollapsed?.(), t.onClose?.();
|
|
3804
3833
|
}
|
|
3805
|
-
},
|
|
3806
|
-
S ||
|
|
3807
|
-
|
|
3834
|
+
}, Oe = () => {
|
|
3835
|
+
S || gr() && L() === "expanded" && he(() => {
|
|
3836
|
+
we();
|
|
3808
3837
|
});
|
|
3809
|
-
},
|
|
3810
|
-
S ||
|
|
3811
|
-
|
|
3838
|
+
}, ke = () => {
|
|
3839
|
+
S || L() === "docked" && (z(), he(() => {
|
|
3840
|
+
se(), K(!1), b?.setWidgetChrome("expanded");
|
|
3812
3841
|
}));
|
|
3842
|
+
}, Ae = () => {
|
|
3843
|
+
!b || !D || (R(), a.classList.remove("liforma-ew--session-revealed"), K(), b.setWidgetChrome("expanded"), x = !1, U());
|
|
3813
3844
|
}, je = () => {
|
|
3814
|
-
!b || !D || (
|
|
3815
|
-
}, q = () => {
|
|
3816
|
-
!b || !E || D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3845
|
+
!b || !E || D || (R(), a.classList.remove("liforma-ew--session-revealed"), K(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3817
3846
|
}, Me = (e) => {
|
|
3818
|
-
S || e !== O && !D || (
|
|
3847
|
+
S || e !== O && !D || (R(), a.classList.remove("liforma-ew--session-revealed"), K(), x = !1, D && U());
|
|
3819
3848
|
}, J = () => {
|
|
3820
3849
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
3821
3850
|
T = !0;
|
|
3822
3851
|
let e = O;
|
|
3823
3852
|
l.hidden = !1, (async () => {
|
|
3824
3853
|
try {
|
|
3825
|
-
let t = await
|
|
3854
|
+
let t = await ir.startSession(Ce());
|
|
3826
3855
|
if (S || e !== O) {
|
|
3827
3856
|
t.destroy();
|
|
3828
3857
|
return;
|
|
3829
3858
|
}
|
|
3830
|
-
b = t,
|
|
3859
|
+
b = t, Te(t);
|
|
3831
3860
|
let n = await t.attach({
|
|
3832
3861
|
container: l,
|
|
3833
|
-
...
|
|
3862
|
+
...G(),
|
|
3834
3863
|
onWidgetReady: () => {
|
|
3835
3864
|
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : be());
|
|
3836
3865
|
},
|
|
@@ -3841,7 +3870,7 @@ function Sr(e, t) {
|
|
|
3841
3870
|
S || Ie(e);
|
|
3842
3871
|
},
|
|
3843
3872
|
onWidgetDragStart: (e) => {
|
|
3844
|
-
S ||
|
|
3873
|
+
S || V(e);
|
|
3845
3874
|
},
|
|
3846
3875
|
onWidgetDragMove: (e) => {
|
|
3847
3876
|
S || fe(e);
|
|
@@ -3850,7 +3879,7 @@ function Sr(e, t) {
|
|
|
3850
3879
|
S || pe(e);
|
|
3851
3880
|
},
|
|
3852
3881
|
onPlayerStatusChange: (e) => {
|
|
3853
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3882
|
+
S || e === "error" && $(a.dataset.state) && W("Could not load the experience.");
|
|
3854
3883
|
}
|
|
3855
3884
|
});
|
|
3856
3885
|
if (S || e !== O) {
|
|
@@ -3858,7 +3887,7 @@ function Sr(e, t) {
|
|
|
3858
3887
|
return;
|
|
3859
3888
|
}
|
|
3860
3889
|
n.on("close", () => {
|
|
3861
|
-
S ||
|
|
3890
|
+
S || q();
|
|
3862
3891
|
});
|
|
3863
3892
|
} catch (n) {
|
|
3864
3893
|
if (S || e !== O) return;
|
|
@@ -3870,31 +3899,31 @@ function Sr(e, t) {
|
|
|
3870
3899
|
}, Ne = () => {
|
|
3871
3900
|
if (S || x || !C || $(a.dataset.state)) return;
|
|
3872
3901
|
if (b && D) {
|
|
3873
|
-
|
|
3902
|
+
Ae();
|
|
3874
3903
|
return;
|
|
3875
3904
|
}
|
|
3876
3905
|
if (b && E) {
|
|
3877
|
-
|
|
3906
|
+
je();
|
|
3878
3907
|
return;
|
|
3879
3908
|
}
|
|
3880
3909
|
let e = ++O;
|
|
3881
3910
|
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 () => {
|
|
3882
3911
|
try {
|
|
3883
|
-
|
|
3884
|
-
let t = await
|
|
3912
|
+
K();
|
|
3913
|
+
let t = await ir.startSession(Ce());
|
|
3885
3914
|
if (S || e !== O) {
|
|
3886
3915
|
t.destroy();
|
|
3887
3916
|
return;
|
|
3888
3917
|
}
|
|
3889
|
-
b = t,
|
|
3918
|
+
b = t, Te(t);
|
|
3890
3919
|
let n = await t.attach({
|
|
3891
3920
|
container: v,
|
|
3892
|
-
...
|
|
3921
|
+
...G(),
|
|
3893
3922
|
onWidgetAudioSettings: (e) => {
|
|
3894
3923
|
S || Ie(e);
|
|
3895
3924
|
},
|
|
3896
3925
|
onWidgetDragStart: (e) => {
|
|
3897
|
-
S ||
|
|
3926
|
+
S || V(e);
|
|
3898
3927
|
},
|
|
3899
3928
|
onWidgetDragMove: (e) => {
|
|
3900
3929
|
S || fe(e);
|
|
@@ -3903,7 +3932,7 @@ function Sr(e, t) {
|
|
|
3903
3932
|
S || pe(e);
|
|
3904
3933
|
},
|
|
3905
3934
|
onPlayerStatusChange: (e) => {
|
|
3906
|
-
S || (e === "error" ?
|
|
3935
|
+
S || (e === "error" ? W("Could not load the experience.") : $(a.dataset.state) && W(null));
|
|
3907
3936
|
}
|
|
3908
3937
|
});
|
|
3909
3938
|
if (S || e !== O) {
|
|
@@ -3911,12 +3940,12 @@ function Sr(e, t) {
|
|
|
3911
3940
|
return;
|
|
3912
3941
|
}
|
|
3913
3942
|
E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
|
|
3914
|
-
S ||
|
|
3943
|
+
S || q();
|
|
3915
3944
|
});
|
|
3916
3945
|
} catch (n) {
|
|
3917
3946
|
if (S || e !== O) return;
|
|
3918
3947
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3919
|
-
|
|
3948
|
+
W(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3920
3949
|
} finally {
|
|
3921
3950
|
e === O && (x = !1);
|
|
3922
3951
|
}
|
|
@@ -3924,68 +3953,68 @@ function Sr(e, t) {
|
|
|
3924
3953
|
}, Pe = () => {
|
|
3925
3954
|
if (!(S || $(a.dataset.state))) {
|
|
3926
3955
|
if (b && D) {
|
|
3927
|
-
|
|
3956
|
+
Ae();
|
|
3928
3957
|
return;
|
|
3929
3958
|
}
|
|
3930
3959
|
if (b && E) {
|
|
3931
|
-
|
|
3960
|
+
je();
|
|
3932
3961
|
return;
|
|
3933
3962
|
}
|
|
3934
3963
|
if (T || b) {
|
|
3935
|
-
|
|
3964
|
+
K();
|
|
3936
3965
|
return;
|
|
3937
3966
|
}
|
|
3938
3967
|
Ne();
|
|
3939
3968
|
}
|
|
3940
3969
|
}, Fe = (e) => {
|
|
3941
|
-
if (e.stopPropagation(),
|
|
3942
|
-
|
|
3970
|
+
if (e.stopPropagation(), L() === "expanded") {
|
|
3971
|
+
Oe();
|
|
3943
3972
|
return;
|
|
3944
3973
|
}
|
|
3945
|
-
|
|
3974
|
+
L() === "docked" && ke();
|
|
3946
3975
|
}, Ie = (e) => {
|
|
3947
3976
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
3948
3977
|
}, Le = (e) => {
|
|
3949
3978
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3950
3979
|
}, Re = (e) => {
|
|
3951
|
-
|
|
3980
|
+
L() === "docked" && gr() && (e.target?.closest("button") || (e.preventDefault(), B(e.clientX, e.clientY, e.pointerId)));
|
|
3952
3981
|
}, ze = (e) => {
|
|
3953
|
-
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(),
|
|
3982
|
+
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), q());
|
|
3954
3983
|
}, Be = () => {
|
|
3955
3984
|
if (!S) {
|
|
3956
|
-
if (
|
|
3957
|
-
if (!
|
|
3958
|
-
|
|
3985
|
+
if (L() === "docked") {
|
|
3986
|
+
if (!gr()) {
|
|
3987
|
+
ke();
|
|
3959
3988
|
return;
|
|
3960
3989
|
}
|
|
3961
|
-
D ?
|
|
3990
|
+
D ? he(() => {
|
|
3962
3991
|
me(!0);
|
|
3963
3992
|
}) : me(!0);
|
|
3964
3993
|
return;
|
|
3965
3994
|
}
|
|
3966
3995
|
H();
|
|
3967
3996
|
}
|
|
3968
|
-
}, Ve = typeof window < "u" ? window.matchMedia(
|
|
3997
|
+
}, Ve = typeof window < "u" ? window.matchMedia(or) : null, He = () => {
|
|
3969
3998
|
if (!S) {
|
|
3970
|
-
if (
|
|
3971
|
-
|
|
3999
|
+
if (L() === "docked" && !gr()) {
|
|
4000
|
+
ke();
|
|
3972
4001
|
return;
|
|
3973
4002
|
}
|
|
3974
4003
|
H();
|
|
3975
4004
|
}
|
|
3976
4005
|
};
|
|
3977
|
-
return o.addEventListener("click", Pe), d.addEventListener("click",
|
|
3978
|
-
e.stopPropagation(),
|
|
4006
|
+
return o.addEventListener("click", Pe), d.addEventListener("click", q), _.addEventListener("click", (e) => {
|
|
4007
|
+
e.stopPropagation(), q();
|
|
3979
4008
|
}), h.addEventListener("click", Fe), g.addEventListener("click", Le), p.addEventListener("pointerdown", Re), window.addEventListener("keydown", ze), window.addEventListener("resize", Be), Ve?.addEventListener("change", He), Se(), H(), r === "eager" ? queueMicrotask(() => {
|
|
3980
4009
|
S || J();
|
|
3981
|
-
}) : r === "idle" && (
|
|
4010
|
+
}) : r === "idle" && (te = Tr(() => {
|
|
3982
4011
|
S || J();
|
|
3983
4012
|
})), {
|
|
3984
4013
|
root: a,
|
|
3985
4014
|
expand: Pe,
|
|
3986
|
-
collapse:
|
|
3987
|
-
dock:
|
|
3988
|
-
maximize:
|
|
4015
|
+
collapse: q,
|
|
4016
|
+
dock: Oe,
|
|
4017
|
+
maximize: ke,
|
|
3989
4018
|
prefetch() {
|
|
3990
4019
|
if (r === "onExpand") {
|
|
3991
4020
|
J();
|
|
@@ -3994,18 +4023,18 @@ function Sr(e, t) {
|
|
|
3994
4023
|
J();
|
|
3995
4024
|
},
|
|
3996
4025
|
destroy() {
|
|
3997
|
-
S || (S = !0,
|
|
4026
|
+
S || (S = !0, z(), te?.(), te = null, ie.abort(), ee?.(), ee = null, window.removeEventListener("keydown", ze), window.removeEventListener("resize", Be), Ve?.removeEventListener("change", He), De(), Ee(), e.replaceChildren());
|
|
3998
4027
|
}
|
|
3999
4028
|
};
|
|
4000
4029
|
}
|
|
4001
4030
|
//#endregion
|
|
4002
4031
|
//#region src/react/ExperienceWidget.tsx
|
|
4003
|
-
function
|
|
4004
|
-
let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback:
|
|
4032
|
+
function Dr(e) {
|
|
4033
|
+
let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: ee, className: te = "", onExpanded: A, onCollapsed: j, onStarted: M, onClose: N, onError: P, onPrefetchReady: ne, onFeedback: re, onFeedbackFailed: F } = e, I = m === "bottom-right" || m === "bottom-left";
|
|
4005
4034
|
return n(() => {
|
|
4006
4035
|
let e = t.current;
|
|
4007
4036
|
if (!e || !r.trim()) return;
|
|
4008
|
-
let n =
|
|
4037
|
+
let n = Er(e, {
|
|
4009
4038
|
experienceId: r,
|
|
4010
4039
|
alt: i,
|
|
4011
4040
|
galleryThumb: a,
|
|
@@ -4031,15 +4060,15 @@ function Cr(e) {
|
|
|
4031
4060
|
expandedMaxHeight: D,
|
|
4032
4061
|
startButtonLabel: O,
|
|
4033
4062
|
startButton: k,
|
|
4034
|
-
showFeedback:
|
|
4035
|
-
onFeedback:
|
|
4036
|
-
onFeedbackFailed:
|
|
4037
|
-
onExpanded:
|
|
4038
|
-
onCollapsed:
|
|
4039
|
-
onStarted:
|
|
4040
|
-
onClose:
|
|
4041
|
-
onError:
|
|
4042
|
-
onPrefetchReady:
|
|
4063
|
+
showFeedback: ee,
|
|
4064
|
+
onFeedback: re,
|
|
4065
|
+
onFeedbackFailed: F,
|
|
4066
|
+
onExpanded: A,
|
|
4067
|
+
onCollapsed: j,
|
|
4068
|
+
onStarted: M,
|
|
4069
|
+
onClose: N,
|
|
4070
|
+
onError: P,
|
|
4071
|
+
onPrefetchReady: ne
|
|
4043
4072
|
});
|
|
4044
4073
|
return () => n.destroy();
|
|
4045
4074
|
}, [
|
|
@@ -4068,19 +4097,19 @@ function Cr(e) {
|
|
|
4068
4097
|
D,
|
|
4069
4098
|
O,
|
|
4070
4099
|
k,
|
|
4100
|
+
ee,
|
|
4101
|
+
re,
|
|
4102
|
+
F,
|
|
4071
4103
|
A,
|
|
4072
|
-
I,
|
|
4073
|
-
L,
|
|
4074
4104
|
j,
|
|
4075
4105
|
M,
|
|
4076
4106
|
N,
|
|
4077
4107
|
P,
|
|
4078
|
-
|
|
4079
|
-
te
|
|
4108
|
+
ne
|
|
4080
4109
|
]), /* @__PURE__ */ d("div", {
|
|
4081
4110
|
ref: t,
|
|
4082
|
-
className:
|
|
4083
|
-
style:
|
|
4111
|
+
className: te,
|
|
4112
|
+
style: I ? { display: "contents" } : {
|
|
4084
4113
|
width: "100%",
|
|
4085
4114
|
height: "100%",
|
|
4086
4115
|
minHeight: "inherit"
|
|
@@ -4088,6 +4117,6 @@ function Cr(e) {
|
|
|
4088
4117
|
});
|
|
4089
4118
|
}
|
|
4090
4119
|
//#endregion
|
|
4091
|
-
export {
|
|
4120
|
+
export { I as Experience, $e as ExperienceThumbnail, Dr as ExperienceWidget };
|
|
4092
4121
|
|
|
4093
4122
|
//# sourceMappingURL=index.js.map
|