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