@liforma/client 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/next/index.js +507 -180
- package/dist/next/index.js.map +1 -1
- package/dist/next/next/createLiformaSessionRouteHandler.d.ts +4 -0
- package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -1
- package/dist/next/v2/api/mintPublicSession.d.ts +1 -0
- package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -1
- package/dist/next/v2/api/sessionEndpointRequest.d.ts +4 -0
- package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +12 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +33 -1
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +15 -2
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/experienceEvents.d.ts +3 -1
- package/dist/next/v2/experienceEvents.d.ts.map +1 -1
- package/dist/next/v2/sdkRelease.d.ts +3 -0
- package/dist/next/v2/sdkRelease.d.ts.map +1 -0
- package/dist/next/v2/types/sessionInteraction.d.ts +17 -0
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/types.d.ts +4 -0
- package/dist/next/widget/types.d.ts.map +1 -1
- package/dist/npm/index.js +533 -220
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/svelte/experienceLoadError.d.ts.map +1 -1
- package/dist/npm/svelte/experienceLoadErrorStyles.d.ts +1 -1
- package/dist/npm/svelte/experienceLoadErrorStyles.d.ts.map +1 -1
- package/dist/npm/v2/api/mintPublicSession.d.ts +1 -0
- package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -1
- package/dist/npm/v2/api/sessionEndpointRequest.d.ts +4 -0
- package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +12 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +33 -1
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +15 -2
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/experienceEvents.d.ts +3 -1
- package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +1 -1
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +1 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/sdkRelease.d.ts +3 -0
- package/dist/npm/v2/sdkRelease.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts +17 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/types.d.ts +4 -0
- package/dist/npm/widget/types.d.ts.map +1 -1
- package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +5 -0
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +974 -646
- package/dist/react/index.js.map +1 -1
- package/dist/react/svelte/experienceLoadError.d.ts.map +1 -1
- package/dist/react/svelte/experienceLoadErrorStyles.d.ts +1 -1
- package/dist/react/svelte/experienceLoadErrorStyles.d.ts.map +1 -1
- package/dist/react/v2/api/mintPublicSession.d.ts +1 -0
- package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -1
- package/dist/react/v2/api/sessionEndpointRequest.d.ts +4 -0
- package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +12 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +33 -1
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +15 -2
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/experienceEvents.d.ts +3 -1
- package/dist/react/v2/experienceEvents.d.ts.map +1 -1
- package/dist/react/v2/sdkRelease.d.ts +3 -0
- package/dist/react/v2/sdkRelease.d.ts.map +1 -0
- package/dist/react/v2/types/sessionInteraction.d.ts +17 -0
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/types.d.ts +4 -0
- package/dist/react/widget/types.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +2 -2
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/svelte/Experience.svelte +4 -0
- package/dist/svelte/experienceLoadError.js +37 -15
- package/dist/svelte/experienceLoadError.test.js +8 -0
- package/dist/svelte/experienceLoadErrorOverlay.js +1 -1
- package/dist/svelte/experienceLoadErrorStyles.d.ts +1 -1
- package/dist/svelte/experienceLoadErrorStyles.js +1 -0
- package/package.json +1 -1
package/dist/npm/index.js
CHANGED
|
@@ -183,7 +183,7 @@ function k(e, t) {
|
|
|
183
183
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
184
184
|
}
|
|
185
185
|
var A = /* @__PURE__ */ new Set(), j = !1, M = 0;
|
|
186
|
-
function
|
|
186
|
+
function N() {
|
|
187
187
|
if (M = 0, A.size === 0 || typeof window > "u") return;
|
|
188
188
|
let e = window.innerHeight;
|
|
189
189
|
for (let t of A) {
|
|
@@ -192,33 +192,33 @@ function ee() {
|
|
|
192
192
|
n.bottom < -64 || n.top > e + 64 || t.onParallax(k(n, e));
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
function N() {
|
|
196
|
-
M === 0 && (M = requestAnimationFrame(ee));
|
|
197
|
-
}
|
|
198
195
|
function P() {
|
|
199
|
-
|
|
196
|
+
M === 0 && (M = requestAnimationFrame(N));
|
|
200
197
|
}
|
|
201
198
|
function F() {
|
|
202
|
-
|
|
199
|
+
j || typeof window > "u" || (j = !0, window.addEventListener("scroll", P, { passive: !0 }), window.addEventListener("resize", P, { passive: !0 }));
|
|
200
|
+
}
|
|
201
|
+
function I() {
|
|
202
|
+
A.size > 0 || !j || typeof window > "u" || (j = !1, M !== 0 && (cancelAnimationFrame(M), M = 0), window.removeEventListener("scroll", P), window.removeEventListener("resize", P));
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ee(e, t) {
|
|
205
205
|
if (!O()) return () => {};
|
|
206
206
|
let n = {
|
|
207
207
|
element: e,
|
|
208
208
|
onParallax: t.onParallax,
|
|
209
209
|
pointerActive: t.pointerActive
|
|
210
210
|
};
|
|
211
|
-
return A.add(n),
|
|
212
|
-
A.delete(n),
|
|
211
|
+
return A.add(n), F(), n.pointerActive?.() || t.onParallax(k(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
212
|
+
A.delete(n), I();
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
217
|
-
function
|
|
217
|
+
function te(e) {
|
|
218
218
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
219
219
|
let a = r || i;
|
|
220
220
|
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));
|
|
221
|
-
}, s =
|
|
221
|
+
}, s = ee(e, {
|
|
222
222
|
onParallax: (e) => {
|
|
223
223
|
i = !0, a || (t = e, n = 0, o());
|
|
224
224
|
},
|
|
@@ -243,32 +243,32 @@ function ne(e) {
|
|
|
243
243
|
}
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region src/thumbnail/styles.ts
|
|
246
|
-
var
|
|
247
|
-
function
|
|
248
|
-
if (typeof document > "u" ||
|
|
246
|
+
var L = ".liforma-et {\n --liforma-et-parallax-x: 0;\n --liforma-et-parallax-y: 0;\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n --liforma-et-reveal-duration: 420ms;\n\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", R = !1;
|
|
247
|
+
function ne(e) {
|
|
248
|
+
if (typeof document > "u" || R) return;
|
|
249
249
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
250
|
-
|
|
250
|
+
R = !0;
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
let t = document.createElement("style");
|
|
254
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
254
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), R = !0;
|
|
255
255
|
}
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/widget/styles.ts
|
|
258
|
-
var ie = "\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", ae = "liforma-experience-widget-styles";
|
|
259
|
-
function
|
|
258
|
+
var re = "\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", ie = "liforma-experience-widget-styles";
|
|
259
|
+
function ae(e = re) {
|
|
260
260
|
if (typeof document > "u") return;
|
|
261
|
-
let t = document.getElementById(
|
|
261
|
+
let t = document.getElementById(ie);
|
|
262
262
|
if (t) {
|
|
263
263
|
t.textContent = e;
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
let n = document.createElement("style");
|
|
267
|
-
n.id =
|
|
267
|
+
n.id = ie, n.textContent = e, document.head.append(n);
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/shims/apiBaseUrl.ts
|
|
271
|
-
var
|
|
271
|
+
var z = "https://api.liforma.ai", oe = "http://localhost:3001";
|
|
272
272
|
function se() {
|
|
273
273
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
274
274
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
@@ -277,7 +277,7 @@ function se() {
|
|
|
277
277
|
return t ? t.replace(/\/$/, "") : null;
|
|
278
278
|
}
|
|
279
279
|
function ce() {
|
|
280
|
-
return se() || (l() ?
|
|
280
|
+
return se() || (l() ? oe : z);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
@@ -429,7 +429,8 @@ function _e(e, t) {
|
|
|
429
429
|
...(() => {
|
|
430
430
|
let e = he(t.attribution);
|
|
431
431
|
return e ? { attribution: e } : {};
|
|
432
|
-
})()
|
|
432
|
+
})(),
|
|
433
|
+
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
433
434
|
})
|
|
434
435
|
}
|
|
435
436
|
};
|
|
@@ -573,7 +574,7 @@ function Oe(e, t) {
|
|
|
573
574
|
let i = De(t);
|
|
574
575
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
575
576
|
let a = he(t?.attribution);
|
|
576
|
-
return a && (n.attribution = a), n;
|
|
577
|
+
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
577
578
|
}
|
|
578
579
|
async function ke(e, t) {
|
|
579
580
|
let n = ce(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
@@ -691,7 +692,7 @@ var Le = new Set([1, 2]);
|
|
|
691
692
|
function Re(e) {
|
|
692
693
|
return typeof e == "number" && Le.has(e);
|
|
693
694
|
}
|
|
694
|
-
var ze = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow".split("."));
|
|
695
|
+
var ze = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.interactionChange".split("."));
|
|
695
696
|
function Be(e) {
|
|
696
697
|
if (!e || typeof e != "object") return null;
|
|
697
698
|
let t = e;
|
|
@@ -917,6 +918,9 @@ function Ze(e) {
|
|
|
917
918
|
case "fullWindow":
|
|
918
919
|
s(i.payload.active);
|
|
919
920
|
break;
|
|
921
|
+
case "interactionChange":
|
|
922
|
+
e.onInteractionChange?.(i.payload.interaction);
|
|
923
|
+
break;
|
|
920
924
|
}
|
|
921
925
|
};
|
|
922
926
|
if (window.addEventListener("message", x), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
|
|
@@ -1163,6 +1167,23 @@ function Ze(e) {
|
|
|
1163
1167
|
}
|
|
1164
1168
|
});
|
|
1165
1169
|
},
|
|
1170
|
+
setInteraction(e) {
|
|
1171
|
+
return C({
|
|
1172
|
+
type: "setInteraction",
|
|
1173
|
+
schemaVersion: 2,
|
|
1174
|
+
payload: {
|
|
1175
|
+
correlationId: Y(),
|
|
1176
|
+
interaction: e
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
},
|
|
1180
|
+
getInteraction() {
|
|
1181
|
+
return C({
|
|
1182
|
+
type: "getInteraction",
|
|
1183
|
+
schemaVersion: 2,
|
|
1184
|
+
payload: { correlationId: Y() }
|
|
1185
|
+
});
|
|
1186
|
+
},
|
|
1166
1187
|
conversion(e) {
|
|
1167
1188
|
return C({
|
|
1168
1189
|
type: "conversion",
|
|
@@ -1180,6 +1201,21 @@ function Ze(e) {
|
|
|
1180
1201
|
payload: { correlationId: Y() }
|
|
1181
1202
|
});
|
|
1182
1203
|
},
|
|
1204
|
+
reportSdkError(e) {
|
|
1205
|
+
return C({
|
|
1206
|
+
type: "reportSdkError",
|
|
1207
|
+
schemaVersion: 2,
|
|
1208
|
+
payload: {
|
|
1209
|
+
correlationId: Y(),
|
|
1210
|
+
errorCode: e.errorCode,
|
|
1211
|
+
message: e.message,
|
|
1212
|
+
stack: e.stack,
|
|
1213
|
+
severity: e.severity,
|
|
1214
|
+
operation: e.operation,
|
|
1215
|
+
release: e.release
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
},
|
|
1183
1219
|
destroy() {
|
|
1184
1220
|
if (!r) {
|
|
1185
1221
|
r = !0, i && s(!1);
|
|
@@ -1205,51 +1241,272 @@ function Qe(e) {
|
|
|
1205
1241
|
};
|
|
1206
1242
|
}
|
|
1207
1243
|
//#endregion
|
|
1208
|
-
//#region src/v2/
|
|
1209
|
-
var $e =
|
|
1210
|
-
|
|
1244
|
+
//#region src/v2/sdkRelease.ts
|
|
1245
|
+
var $e = `sdk@${{
|
|
1246
|
+
name: "@liforma/client",
|
|
1247
|
+
version: "0.4.9",
|
|
1248
|
+
type: "module",
|
|
1249
|
+
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1250
|
+
license: "MIT",
|
|
1251
|
+
homepage: "https://docs.liforma.ai",
|
|
1252
|
+
repository: {
|
|
1253
|
+
type: "git",
|
|
1254
|
+
url: "git+https://github.com/LiformaLtd/cdn.liforma.ai.git"
|
|
1255
|
+
},
|
|
1256
|
+
bugs: { url: "https://github.com/LiformaLtd/cdn.liforma.ai/issues" },
|
|
1257
|
+
publishConfig: { access: "public" },
|
|
1258
|
+
sideEffects: !1,
|
|
1259
|
+
exports: {
|
|
1260
|
+
".": {
|
|
1261
|
+
types: "./dist/npm/v2/npm.d.ts",
|
|
1262
|
+
import: "./dist/npm/index.js"
|
|
1263
|
+
},
|
|
1264
|
+
"./svelte": {
|
|
1265
|
+
types: "./dist/svelte/index.d.ts",
|
|
1266
|
+
import: "./dist/svelte/index.js",
|
|
1267
|
+
svelte: "./dist/svelte/index.js"
|
|
1268
|
+
},
|
|
1269
|
+
"./svelte/thumbnail": {
|
|
1270
|
+
types: "./dist/svelte/thumbnail.d.ts",
|
|
1271
|
+
import: "./dist/svelte/thumbnail.js",
|
|
1272
|
+
svelte: "./dist/svelte/thumbnail.js"
|
|
1273
|
+
},
|
|
1274
|
+
"./thumbnail": {
|
|
1275
|
+
types: "./dist/npm/thumbnail/index.d.ts",
|
|
1276
|
+
import: "./dist/npm/thumbnail/index.js"
|
|
1277
|
+
},
|
|
1278
|
+
"./react": {
|
|
1279
|
+
types: "./dist/react/react/index.d.ts",
|
|
1280
|
+
import: "./dist/react/index.js"
|
|
1281
|
+
},
|
|
1282
|
+
"./react/thumbnail": {
|
|
1283
|
+
types: "./dist/react/react/thumbnail.d.ts",
|
|
1284
|
+
import: "./dist/react/thumbnail.js"
|
|
1285
|
+
},
|
|
1286
|
+
"./next": {
|
|
1287
|
+
types: "./dist/next/next/index.d.ts",
|
|
1288
|
+
import: "./dist/next/index.js"
|
|
1289
|
+
},
|
|
1290
|
+
"./next/thumbnail": {
|
|
1291
|
+
types: "./dist/next/next/thumbnail.d.ts",
|
|
1292
|
+
import: "./dist/next/thumbnail.js"
|
|
1293
|
+
},
|
|
1294
|
+
"./byo": {
|
|
1295
|
+
types: "./dist/byo/index.d.ts",
|
|
1296
|
+
import: "./dist/byo/index.js"
|
|
1297
|
+
},
|
|
1298
|
+
"./elevenlabs": {
|
|
1299
|
+
types: "./dist/elevenlabs/index.d.ts",
|
|
1300
|
+
import: "./dist/elevenlabs/index.js"
|
|
1301
|
+
},
|
|
1302
|
+
"./openai": {
|
|
1303
|
+
types: "./dist/openai/index.d.ts",
|
|
1304
|
+
import: "./dist/openai/index.js"
|
|
1305
|
+
},
|
|
1306
|
+
"./deepgram": {
|
|
1307
|
+
types: "./dist/deepgram/index.d.ts",
|
|
1308
|
+
import: "./dist/deepgram/index.js"
|
|
1309
|
+
},
|
|
1310
|
+
"./google": {
|
|
1311
|
+
types: "./dist/google/index.d.ts",
|
|
1312
|
+
import: "./dist/google/index.js"
|
|
1313
|
+
},
|
|
1314
|
+
"./livekit": {
|
|
1315
|
+
types: "./dist/livekit/index.d.ts",
|
|
1316
|
+
import: "./dist/livekit/index.js"
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
files: [
|
|
1320
|
+
"dist/npm",
|
|
1321
|
+
"dist/svelte",
|
|
1322
|
+
"dist/react",
|
|
1323
|
+
"dist/next",
|
|
1324
|
+
"dist/byo",
|
|
1325
|
+
"dist/elevenlabs",
|
|
1326
|
+
"dist/openai",
|
|
1327
|
+
"dist/deepgram",
|
|
1328
|
+
"dist/google",
|
|
1329
|
+
"dist/livekit",
|
|
1330
|
+
"dist/sdk",
|
|
1331
|
+
"README.md",
|
|
1332
|
+
"CHANGELOG.md",
|
|
1333
|
+
"LICENSE"
|
|
1334
|
+
],
|
|
1335
|
+
peerDependencies: {
|
|
1336
|
+
"@elevenlabs/client": ">=1.0.0",
|
|
1337
|
+
"livekit-client": ">=2.0.0",
|
|
1338
|
+
react: "^18.0.0 || ^19.0.0",
|
|
1339
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
1340
|
+
svelte: "^5.0.0"
|
|
1341
|
+
},
|
|
1342
|
+
peerDependenciesMeta: {
|
|
1343
|
+
svelte: { optional: !0 },
|
|
1344
|
+
react: { optional: !0 },
|
|
1345
|
+
"react-dom": { optional: !0 },
|
|
1346
|
+
"@elevenlabs/client": { optional: !0 },
|
|
1347
|
+
"livekit-client": { optional: !0 }
|
|
1348
|
+
},
|
|
1349
|
+
scripts: {
|
|
1350
|
+
build: "npm run build:v2 && npm run build:npm && npm run build:svelte && npm run build:react && npm run build:next && npm run build:byo && npm run build:elevenlabs && npm run build:openai && npm run build:deepgram && npm run build:google && npm run build:livekit && npm run copy:preview",
|
|
1351
|
+
"build:react": "vite build --config vite.config.react.ts && vite build --config vite.config.react-thumbnail.ts && tsc -p tsconfig.react.json",
|
|
1352
|
+
"build:next": "vite build --config vite.config.next.ts && vite build --config vite.config.next-thumbnail.ts && tsc -p tsconfig.next.json",
|
|
1353
|
+
"build:byo": "vite build --config vite.config.byo.ts && tsc -p tsconfig.byo.json",
|
|
1354
|
+
"build:elevenlabs": "vite build --config vite.config.elevenlabs.ts && tsc -p tsconfig.elevenlabs.json",
|
|
1355
|
+
"build:openai": "vite build --config vite.config.openai.ts && tsc -p tsconfig.openai.json",
|
|
1356
|
+
"build:deepgram": "vite build --config vite.config.deepgram.ts && tsc -p tsconfig.deepgram.json",
|
|
1357
|
+
"build:google": "vite build --config vite.config.google.ts && tsc -p tsconfig.google.json",
|
|
1358
|
+
"build:livekit": "vite build --config vite.config.livekit.ts && tsc -p tsconfig.livekit.json",
|
|
1359
|
+
"copy:preview": "mkdir -p dist/preview && cp preview/v2-embed-test.html dist/preview/ && cp preview/v2-embed-test-redirect.html dist/preview/",
|
|
1360
|
+
"build:v2": "vite build --config vite.config.v2.ts && vite build --config vite.config.v2-thumbnail.ts",
|
|
1361
|
+
"build:npm": "vite build --config vite.config.npm.ts && vite build --config vite.config.thumbnail.ts && tsc -p tsconfig.npm.json",
|
|
1362
|
+
"build:svelte": "svelte-package -i src/svelte -o dist/svelte && vite build --config vite.config.svelte.ts",
|
|
1363
|
+
"check:consumer": "svelte-check --workspace test/consumer --tsconfig ./tsconfig.json",
|
|
1364
|
+
test: "vitest run",
|
|
1365
|
+
preview: "node scripts/preview-local.mjs",
|
|
1366
|
+
"dev:sdk": "npm run build:v2 && npm run copy:preview && npm run preview",
|
|
1367
|
+
dev: "npm run build && npm run preview",
|
|
1368
|
+
"publish:sdk": "node scripts/publish-sdk.mjs",
|
|
1369
|
+
"publish:npm": "node scripts/publish-npm.mjs",
|
|
1370
|
+
"publish:avatar": "node scripts/publish-avatar.mjs",
|
|
1371
|
+
"publish:avatars-dist": "node scripts/publish-avatars.mjs",
|
|
1372
|
+
"publish:avatars": "node scripts/republish-avatars.mjs",
|
|
1373
|
+
"build:avatars": "node scripts/build-avatars.mjs",
|
|
1374
|
+
"republish:avatars": "node scripts/republish-avatars.mjs",
|
|
1375
|
+
"catalogue:avatars": "node ../labs.liforma.ai/scripts/generate-avatar-index.mjs",
|
|
1376
|
+
"verify:avatars-dist": "node scripts/verify-avatars-dist.mjs",
|
|
1377
|
+
"verify:avatar-pack": "node scripts/verify-avatar-pack.mjs",
|
|
1378
|
+
"repair:render-plate-metadata": "node scripts/repair-render-plate-metadata.mjs",
|
|
1379
|
+
"verify:render-plate-crop": "node scripts/verify-render-plate-crop.mjs",
|
|
1380
|
+
"migrate:avatar-render-prep": "npm run migrate:avatar-render-prep --prefix ../labs.liforma.ai --",
|
|
1381
|
+
"convert:avatar-teeth": "node scripts/convert-avatar-teeth-webp.mjs",
|
|
1382
|
+
"warm:avatar-composites": "node scripts/warm-avatar-composites.mjs",
|
|
1383
|
+
"test:compose-costume": "node scripts/test-compose-costume-layers.mjs",
|
|
1384
|
+
"test:compose-costume-wasm": "node scripts/test-compose-costume-wasm.mjs",
|
|
1385
|
+
"test:parse-composite-filename": "node scripts/test-parse-composite-filename.mjs",
|
|
1386
|
+
"test:avatar-composite-rendered-path": "node scripts/test-avatar-composite-rendered-path.mjs",
|
|
1387
|
+
"test:avatar-compose-worker-cors": "node scripts/test-avatar-compose-worker-cors.mjs",
|
|
1388
|
+
"test:experience-thumb-url": "node scripts/test-experience-thumb-url.mjs",
|
|
1389
|
+
"test:compose-experience-thumb": "node scripts/test-compose-experience-thumb.mjs",
|
|
1390
|
+
"test:location-depth-paths": "node scripts/test-location-depth-paths.mjs",
|
|
1391
|
+
"test:location-binary-assets": "node scripts/test-location-binary-assets.mjs",
|
|
1392
|
+
"test:location-da3-depth": "node scripts/test-location-da3-depth.mjs",
|
|
1393
|
+
"test:location-interactions": "node scripts/test-location-interactions.mjs",
|
|
1394
|
+
"test:render-plate-chroma-key": "node scripts/test-render-plate-chroma-key.mjs",
|
|
1395
|
+
"test:sparse-plate": "node scripts/test-sparse-plate.mjs",
|
|
1396
|
+
"test:face-meshes-publish-depth": "node scripts/test-face-meshes-publish-depth.mjs",
|
|
1397
|
+
"test:avatar-avif-sibling": "node scripts/test-avatar-avif-sibling.mjs",
|
|
1398
|
+
"test:screen-chroma-key": "node scripts/test-screen-chroma-key.mjs",
|
|
1399
|
+
"pull:sources": "node scripts/sync-authoring-sources.mjs",
|
|
1400
|
+
"push:sources": "node scripts/sync-authoring-sources.mjs",
|
|
1401
|
+
"catalogue:locations": "node scripts/catalogue-locations.mjs",
|
|
1402
|
+
"generate:location-interactions": "node scripts/generate-location-interactions.mjs",
|
|
1403
|
+
"generate:location-depth": "node scripts/generate-location-depth.mjs",
|
|
1404
|
+
"generate:location-depth16-da3": "node scripts/generate-location-depth16-da3.mjs",
|
|
1405
|
+
"generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
|
|
1406
|
+
"build:locations": "node scripts/build-locations.mjs",
|
|
1407
|
+
"publish:locations": "node scripts/publish-locations.mjs",
|
|
1408
|
+
"verify:locations": "node scripts/verify-location-sources.mjs",
|
|
1409
|
+
"publish:models": "node scripts/publish-models.mjs",
|
|
1410
|
+
"publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
|
|
1411
|
+
"publish:models:ltx-int8": "node scripts/_upload-model-prefix.mjs text-to-video/lf-t2v-distill-int8",
|
|
1412
|
+
"publish:models:video-omni": "node scripts/_upload-model-prefix.mjs text-to-video/lf-video-omni-v1",
|
|
1413
|
+
"fetch:depth-anything-v2": "node scripts/fetch-depth-anything-v2.mjs",
|
|
1414
|
+
"fetch:video-depth-anything": "node scripts/fetch-video-depth-anything.mjs",
|
|
1415
|
+
"fetch:depth-pro": "node scripts/fetch-depth-pro.mjs",
|
|
1416
|
+
"fetch:face-landmarker": "node scripts/fetch-face-landmarker.mjs",
|
|
1417
|
+
"fetch:anime-face-detector": "node scripts/fetch-anime-face-detector.mjs",
|
|
1418
|
+
"fetch:face-parsing": "node scripts/fetch-face-parsing.mjs",
|
|
1419
|
+
"fetch:vitmatte": "node scripts/fetch-vitmatte.mjs",
|
|
1420
|
+
"fetch:liveportrait-mlx": "node scripts/fetch-liveportrait-mlx.mjs",
|
|
1421
|
+
"fetch:wav2vec-phoneme-ctc": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
|
|
1422
|
+
"fetch:lf-sta": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
|
|
1423
|
+
"fetch:supertonic-3": "node scripts/fetch-supertonic-3.mjs",
|
|
1424
|
+
"fetch:lf-tts": "node scripts/fetch-supertonic-3.mjs",
|
|
1425
|
+
"fetch:lf-t2i-turbo": "python3 ../tools/krea-2-salad/scripts/fetch_cdn_snapshot.py",
|
|
1426
|
+
"fetch:models": "npm run fetch:depth-anything-v2 && npm run fetch:video-depth-anything && npm run fetch:depth-pro && npm run fetch:face-landmarker && npm run fetch:anime-face-detector && npm run fetch:face-parsing && npm run fetch:vitmatte && npm run fetch:lf-sta && npm run fetch:lf-tts",
|
|
1427
|
+
locations: "npm run catalogue:locations && npm run build:locations",
|
|
1428
|
+
"configure:cors": "node scripts/configure-r2-cors.mjs",
|
|
1429
|
+
"verify:cors": "node scripts/verify-cdn-cors.mjs",
|
|
1430
|
+
"deploy:worker:avatar-compose": "node scripts/deploy-avatar-compose-worker.mjs",
|
|
1431
|
+
"deploy:worker:experience-thumb": "node scripts/deploy-experience-thumb-worker.mjs",
|
|
1432
|
+
deploy: "npm run build && npm run publish:sdk",
|
|
1433
|
+
verify: "npm run build && node scripts/check-sdk-size.mjs && node scripts/verify-thumbnail-light.mjs && node scripts/test-embed-protocol.mjs && node scripts/test-manifest-embed-url.mjs && node scripts/test-player-reachability.mjs && node scripts/test-session-endpoint.mjs && node scripts/verify-package.mjs",
|
|
1434
|
+
"preview:test": "npm run build && npm run preview"
|
|
1435
|
+
},
|
|
1436
|
+
dependencies: {
|
|
1437
|
+
"@jsquash/webp": "^1.5.0",
|
|
1438
|
+
zod: "^4.4.3"
|
|
1439
|
+
},
|
|
1440
|
+
devDependencies: {
|
|
1441
|
+
"@aws-sdk/client-s3": "^3.1000.0",
|
|
1442
|
+
"@aws-sdk/lib-storage": "^3.1110.0",
|
|
1443
|
+
"@elevenlabs/client": "^1.17.0",
|
|
1444
|
+
"@sveltejs/package": "^2.5.8",
|
|
1445
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
1446
|
+
"@testing-library/react": "^16.3.0",
|
|
1447
|
+
"@testing-library/svelte": "^5.4.2",
|
|
1448
|
+
"@types/node": "^25.9.3",
|
|
1449
|
+
"@types/react": "^19.1.12",
|
|
1450
|
+
"@types/react-dom": "^19.1.9",
|
|
1451
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
1452
|
+
"@webgpu/types": "^0.1.70",
|
|
1453
|
+
dotenv: "^17.2.3",
|
|
1454
|
+
jsdom: "^30.0.1",
|
|
1455
|
+
"livekit-client": "^2.21.0",
|
|
1456
|
+
react: "^19.1.1",
|
|
1457
|
+
"react-dom": "^19.1.1",
|
|
1458
|
+
sharp: "^0.34.2",
|
|
1459
|
+
svelte: "^5.55.2",
|
|
1460
|
+
"svelte-check": "^4.7.4",
|
|
1461
|
+
typescript: "^6.0.3",
|
|
1462
|
+
vite: "^8.0.16",
|
|
1463
|
+
vitest: "^4.1.10",
|
|
1464
|
+
wrangler: "^4.101.0"
|
|
1465
|
+
}
|
|
1466
|
+
}.version}`, et = "https://player.liforma.ai/embed", tt = "http://localhost:3002/embed";
|
|
1467
|
+
function nt() {
|
|
1211
1468
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1212
1469
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1213
1470
|
if (typeof document > "u") return null;
|
|
1214
1471
|
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();
|
|
1215
1472
|
return t ? t.replace(/\/$/, "") : null;
|
|
1216
1473
|
}
|
|
1217
|
-
function
|
|
1218
|
-
let e =
|
|
1219
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ?
|
|
1474
|
+
function rt() {
|
|
1475
|
+
let e = nt();
|
|
1476
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : l() ? tt : et;
|
|
1220
1477
|
}
|
|
1221
|
-
function
|
|
1478
|
+
function it(e, t) {
|
|
1222
1479
|
return e?.trim() || t?.trim() || void 0;
|
|
1223
1480
|
}
|
|
1224
|
-
function
|
|
1225
|
-
let c = (e ??
|
|
1481
|
+
function at(e, t, n, r, i, a, o, s) {
|
|
1482
|
+
let c = (e ?? rt()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
|
|
1226
1483
|
d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
|
|
1227
1484
|
let f = r?.trim();
|
|
1228
|
-
return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)),
|
|
1485
|
+
return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), ot(u.toString());
|
|
1229
1486
|
}
|
|
1230
|
-
function
|
|
1487
|
+
function ot(e) {
|
|
1231
1488
|
if (typeof location > "u") return e;
|
|
1232
1489
|
let t = new URL(e);
|
|
1233
1490
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1234
1491
|
}
|
|
1235
|
-
function
|
|
1492
|
+
function st(e) {
|
|
1236
1493
|
return new URL(e).origin;
|
|
1237
1494
|
}
|
|
1238
1495
|
//#endregion
|
|
1239
1496
|
//#region src/v2/experienceEvents.ts
|
|
1240
|
-
function
|
|
1497
|
+
function ct() {
|
|
1241
1498
|
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)}`;
|
|
1242
1499
|
}
|
|
1243
|
-
function
|
|
1500
|
+
function lt(e, t, n) {
|
|
1244
1501
|
return {
|
|
1245
|
-
id:
|
|
1502
|
+
id: ct(),
|
|
1246
1503
|
type: e,
|
|
1247
1504
|
sessionId: t,
|
|
1248
1505
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1249
1506
|
data: n
|
|
1250
1507
|
};
|
|
1251
1508
|
}
|
|
1252
|
-
function
|
|
1509
|
+
function ut() {
|
|
1253
1510
|
return {
|
|
1254
1511
|
ready: /* @__PURE__ */ new Set(),
|
|
1255
1512
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1264,37 +1521,38 @@ function lt() {
|
|
|
1264
1521
|
message: /* @__PURE__ */ new Set(),
|
|
1265
1522
|
listeningState: /* @__PURE__ */ new Set(),
|
|
1266
1523
|
activityChange: /* @__PURE__ */ new Set(),
|
|
1524
|
+
interactionChange: /* @__PURE__ */ new Set(),
|
|
1267
1525
|
feedback: /* @__PURE__ */ new Set(),
|
|
1268
1526
|
feedbackFailed: /* @__PURE__ */ new Set(),
|
|
1269
1527
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1270
1528
|
};
|
|
1271
1529
|
}
|
|
1272
|
-
function
|
|
1530
|
+
function dt(e, t, n) {
|
|
1273
1531
|
return e[t].add(n), () => e[t].delete(n);
|
|
1274
1532
|
}
|
|
1275
|
-
function
|
|
1533
|
+
function ft(e, t, n) {
|
|
1276
1534
|
for (let r of e[t]) r(n);
|
|
1277
1535
|
}
|
|
1278
|
-
function
|
|
1536
|
+
function pt(e) {
|
|
1279
1537
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1280
1538
|
}
|
|
1281
1539
|
//#endregion
|
|
1282
1540
|
//#region src/v2/speech/types.ts
|
|
1283
|
-
function
|
|
1541
|
+
function mt(e) {
|
|
1284
1542
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1285
1543
|
}
|
|
1286
|
-
function
|
|
1544
|
+
function ht(e) {
|
|
1287
1545
|
return "url" in e && typeof e.url == "string";
|
|
1288
1546
|
}
|
|
1289
|
-
function
|
|
1547
|
+
function gt(e) {
|
|
1290
1548
|
if (!("track" in e)) return !1;
|
|
1291
1549
|
let t = e.track;
|
|
1292
1550
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1293
1551
|
}
|
|
1294
|
-
function
|
|
1295
|
-
return !
|
|
1552
|
+
function _t(e) {
|
|
1553
|
+
return !mt(e) && !ht(e) && !gt(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1296
1554
|
}
|
|
1297
|
-
var
|
|
1555
|
+
var vt = [
|
|
1298
1556
|
8e3,
|
|
1299
1557
|
16e3,
|
|
1300
1558
|
22050,
|
|
@@ -1312,14 +1570,14 @@ var _t = [
|
|
|
1312
1570
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1313
1571
|
MAX_PENDING_WRITES: 8,
|
|
1314
1572
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1315
|
-
},
|
|
1573
|
+
}, yt = class extends Error {
|
|
1316
1574
|
operation;
|
|
1317
1575
|
requiredCapability;
|
|
1318
1576
|
name = "UnsupportedSpeechOperationError";
|
|
1319
1577
|
constructor(e, t) {
|
|
1320
1578
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1321
1579
|
}
|
|
1322
|
-
},
|
|
1580
|
+
}, bt = class extends Error {
|
|
1323
1581
|
name = "SpeechUtteranceClosedError";
|
|
1324
1582
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1325
1583
|
super(e);
|
|
@@ -1329,72 +1587,72 @@ var _t = [
|
|
|
1329
1587
|
constructor(e, t) {
|
|
1330
1588
|
super(e, t);
|
|
1331
1589
|
}
|
|
1332
|
-
},
|
|
1590
|
+
}, xt = class extends Error {
|
|
1333
1591
|
name = "SpeechBufferTimeoutError";
|
|
1334
1592
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1335
1593
|
super(e);
|
|
1336
1594
|
}
|
|
1337
1595
|
};
|
|
1338
|
-
function
|
|
1596
|
+
function St(e = "none") {
|
|
1339
1597
|
return {
|
|
1340
1598
|
mode: e,
|
|
1341
1599
|
trackedDurationMs: 0,
|
|
1342
1600
|
fallbackDurationMs: 0
|
|
1343
1601
|
};
|
|
1344
1602
|
}
|
|
1345
|
-
function St(e) {
|
|
1346
|
-
return _t.includes(e);
|
|
1347
|
-
}
|
|
1348
1603
|
function Ct(e) {
|
|
1604
|
+
return vt.includes(e);
|
|
1605
|
+
}
|
|
1606
|
+
function wt(e) {
|
|
1349
1607
|
if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
|
|
1350
1608
|
if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
|
|
1351
|
-
if (!
|
|
1609
|
+
if (!Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1352
1610
|
}
|
|
1353
|
-
function
|
|
1354
|
-
if (
|
|
1355
|
-
|
|
1611
|
+
function Tt(e) {
|
|
1612
|
+
if (mt(e)) {
|
|
1613
|
+
wt(e.format);
|
|
1356
1614
|
return;
|
|
1357
1615
|
}
|
|
1358
|
-
if (
|
|
1616
|
+
if (ht(e)) {
|
|
1359
1617
|
if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
|
|
1360
|
-
if (e.sampleRate !== void 0 && !
|
|
1618
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1361
1619
|
return;
|
|
1362
1620
|
}
|
|
1363
|
-
if (
|
|
1621
|
+
if (gt(e)) {
|
|
1364
1622
|
if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
1365
|
-
if (e.sampleRate !== void 0 && !
|
|
1623
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1366
1624
|
return;
|
|
1367
1625
|
}
|
|
1368
|
-
if (
|
|
1626
|
+
if (_t(e)) {
|
|
1369
1627
|
let t = e.encoding.trim().toLowerCase();
|
|
1370
1628
|
if (!t) throw new Z("Encoded audio MIME type is required.");
|
|
1371
1629
|
if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
1372
|
-
if (e.sampleRate !== void 0 && !
|
|
1630
|
+
if (e.sampleRate !== void 0 && !Ct(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1373
1631
|
return;
|
|
1374
1632
|
}
|
|
1375
1633
|
throw new Z("Unsupported speech.play audio shape.");
|
|
1376
1634
|
}
|
|
1377
|
-
function
|
|
1378
|
-
if (e.format) return
|
|
1635
|
+
function Et(e) {
|
|
1636
|
+
if (e.format) return wt(e.format), e.format;
|
|
1379
1637
|
if (e.track) {
|
|
1380
1638
|
let t = {
|
|
1381
1639
|
encoding: "pcm_s16le",
|
|
1382
1640
|
sampleRate: e.sampleRate ?? 24e3,
|
|
1383
1641
|
channels: 1
|
|
1384
1642
|
};
|
|
1385
|
-
return
|
|
1643
|
+
return wt(t), t;
|
|
1386
1644
|
}
|
|
1387
1645
|
throw new Z("createUtterance requires format or track.");
|
|
1388
1646
|
}
|
|
1389
|
-
function
|
|
1647
|
+
function Dt(e) {
|
|
1390
1648
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1391
1649
|
}
|
|
1392
|
-
function
|
|
1650
|
+
function Ot(e) {
|
|
1393
1651
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
1394
1652
|
}
|
|
1395
1653
|
//#endregion
|
|
1396
1654
|
//#region src/byo/pcm.ts
|
|
1397
|
-
function
|
|
1655
|
+
function kt(e) {
|
|
1398
1656
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
1399
1657
|
for (let t = 0; t < e.length; t++) {
|
|
1400
1658
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -1404,11 +1662,11 @@ function Ot(e) {
|
|
|
1404
1662
|
}
|
|
1405
1663
|
//#endregion
|
|
1406
1664
|
//#region src/byo/resample.ts
|
|
1407
|
-
function
|
|
1665
|
+
function At(e, t, n, r, i) {
|
|
1408
1666
|
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;
|
|
1409
1667
|
return ((a * i + o) * i + s) * i + c;
|
|
1410
1668
|
}
|
|
1411
|
-
function
|
|
1669
|
+
function jt(e, t) {
|
|
1412
1670
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
1413
1671
|
if (e === t) return {
|
|
1414
1672
|
fromRate: e,
|
|
@@ -1431,7 +1689,7 @@ function At(e, t) {
|
|
|
1431
1689
|
let a = [];
|
|
1432
1690
|
for (; i + 2 < r.length - 1;) {
|
|
1433
1691
|
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);
|
|
1434
|
-
a.push(
|
|
1692
|
+
a.push(At(r[o], r[e], r[s], r[c], t)), i += n;
|
|
1435
1693
|
}
|
|
1436
1694
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
1437
1695
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -1443,7 +1701,7 @@ function At(e, t) {
|
|
|
1443
1701
|
}
|
|
1444
1702
|
//#endregion
|
|
1445
1703
|
//#region src/byo/audioCapture.ts
|
|
1446
|
-
var
|
|
1704
|
+
var Mt = "liforma-pcm-capture", Nt = `
|
|
1447
1705
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
1448
1706
|
process(inputs) {
|
|
1449
1707
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -1455,29 +1713,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
1455
1713
|
return true;
|
|
1456
1714
|
}
|
|
1457
1715
|
}
|
|
1458
|
-
registerProcessor('${
|
|
1459
|
-
`,
|
|
1460
|
-
function Pt() {
|
|
1461
|
-
return Nt ||= URL.createObjectURL(new Blob([Mt], { type: "application/javascript" })), Nt;
|
|
1462
|
-
}
|
|
1716
|
+
registerProcessor('${Mt}', LiformaPcmCaptureProcessor);
|
|
1717
|
+
`, Pt = null;
|
|
1463
1718
|
function Ft() {
|
|
1719
|
+
return Pt ||= URL.createObjectURL(new Blob([Nt], { type: "application/javascript" })), Pt;
|
|
1720
|
+
}
|
|
1721
|
+
function It() {
|
|
1464
1722
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
1465
1723
|
}
|
|
1466
|
-
async function
|
|
1467
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
1724
|
+
async function Lt(e) {
|
|
1725
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = It();
|
|
1468
1726
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
1469
1727
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
1470
1728
|
l.gain.value = 0;
|
|
1471
|
-
let u = s.sampleRate, d =
|
|
1729
|
+
let u = s.sampleRate, d = jt(u, n), f = !1, p = !1, m = (e) => {
|
|
1472
1730
|
if (f || i && !i()) return;
|
|
1473
1731
|
let t = d.push(e);
|
|
1474
|
-
t.length !== 0 && r(
|
|
1732
|
+
t.length !== 0 && r(kt(t));
|
|
1475
1733
|
}, h = () => void 0;
|
|
1476
1734
|
return await (async () => {
|
|
1477
1735
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
1478
1736
|
try {
|
|
1479
|
-
await s.audioWorklet.addModule(
|
|
1480
|
-
let e = new AudioWorkletNode(s,
|
|
1737
|
+
await s.audioWorklet.addModule(Ft());
|
|
1738
|
+
let e = new AudioWorkletNode(s, Mt, {
|
|
1481
1739
|
numberOfInputs: 1,
|
|
1482
1740
|
numberOfOutputs: 1,
|
|
1483
1741
|
outputChannelCount: [1]
|
|
@@ -1527,7 +1785,7 @@ async function It(e) {
|
|
|
1527
1785
|
}
|
|
1528
1786
|
//#endregion
|
|
1529
1787
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
1530
|
-
async function
|
|
1788
|
+
async function Rt(e) {
|
|
1531
1789
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
1532
1790
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
|
|
1533
1791
|
if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -1536,13 +1794,13 @@ async function Lt(e) {
|
|
|
1536
1794
|
s || (s = !0, c?.stop(), c = null);
|
|
1537
1795
|
};
|
|
1538
1796
|
try {
|
|
1539
|
-
c = await
|
|
1797
|
+
c = await Lt({
|
|
1540
1798
|
mediaStream: a,
|
|
1541
1799
|
targetSampleRate: r,
|
|
1542
1800
|
shouldSend: () => !s && !i?.aborted,
|
|
1543
1801
|
onPcm: (e) => {
|
|
1544
1802
|
if (s || i?.aborted) return;
|
|
1545
|
-
let t =
|
|
1803
|
+
let t = Dt(e);
|
|
1546
1804
|
o = o.then(async () => {
|
|
1547
1805
|
if (s || i?.aborted) return;
|
|
1548
1806
|
let e = 0;
|
|
@@ -1571,10 +1829,10 @@ async function Lt(e) {
|
|
|
1571
1829
|
}
|
|
1572
1830
|
//#endregion
|
|
1573
1831
|
//#region src/v2/speech/speechController.ts
|
|
1574
|
-
async function
|
|
1575
|
-
if (
|
|
1576
|
-
if (
|
|
1577
|
-
let t =
|
|
1832
|
+
async function zt(e, t) {
|
|
1833
|
+
if (gt(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
|
|
1834
|
+
if (mt(e)) {
|
|
1835
|
+
let t = Dt(e.data);
|
|
1578
1836
|
if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
|
|
1579
1837
|
return {
|
|
1580
1838
|
kind: "pcm",
|
|
@@ -1582,17 +1840,17 @@ async function Rt(e, t) {
|
|
|
1582
1840
|
format: e.format
|
|
1583
1841
|
};
|
|
1584
1842
|
}
|
|
1585
|
-
if (
|
|
1843
|
+
if (ht(e)) return {
|
|
1586
1844
|
kind: "url",
|
|
1587
1845
|
url: e.url.trim(),
|
|
1588
1846
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1589
1847
|
};
|
|
1590
|
-
if (!
|
|
1848
|
+
if (!_t(e)) throw new Z("Unsupported speech.play audio shape.");
|
|
1591
1849
|
let n;
|
|
1592
1850
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
1593
1851
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1594
1852
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
1595
|
-
} else n =
|
|
1853
|
+
} else n = Dt(e.data);
|
|
1596
1854
|
return {
|
|
1597
1855
|
kind: "encoded",
|
|
1598
1856
|
data: n.slice().buffer,
|
|
@@ -1600,10 +1858,10 @@ async function Rt(e, t) {
|
|
|
1600
1858
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1601
1859
|
};
|
|
1602
1860
|
}
|
|
1603
|
-
function
|
|
1861
|
+
function Bt() {
|
|
1604
1862
|
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)}`;
|
|
1605
1863
|
}
|
|
1606
|
-
function
|
|
1864
|
+
function Vt(e, t = "completed") {
|
|
1607
1865
|
return {
|
|
1608
1866
|
utteranceId: e.speechId,
|
|
1609
1867
|
characterId: e.characterId,
|
|
@@ -1617,13 +1875,13 @@ function Bt(e, t = "completed") {
|
|
|
1617
1875
|
}
|
|
1618
1876
|
};
|
|
1619
1877
|
}
|
|
1620
|
-
function
|
|
1878
|
+
function Ht(e) {
|
|
1621
1879
|
return e instanceof Error ? e : new Z(String(e));
|
|
1622
1880
|
}
|
|
1623
|
-
function
|
|
1881
|
+
function Ut(e) {
|
|
1624
1882
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
1625
1883
|
}
|
|
1626
|
-
var
|
|
1884
|
+
var Wt = class {
|
|
1627
1885
|
id;
|
|
1628
1886
|
characterId;
|
|
1629
1887
|
result;
|
|
@@ -1652,14 +1910,14 @@ var Ut = class {
|
|
|
1652
1910
|
queue: e.queue,
|
|
1653
1911
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
1654
1912
|
}).catch((e) => {
|
|
1655
|
-
throw this.fail(
|
|
1913
|
+
throw this.fail(Ht(e)), Ht(e);
|
|
1656
1914
|
}), this.signal?.addEventListener("abort", () => {
|
|
1657
1915
|
this.cancel();
|
|
1658
1916
|
}, { once: !0 });
|
|
1659
1917
|
}
|
|
1660
1918
|
async write(e, t) {
|
|
1661
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1662
|
-
let n =
|
|
1919
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new bt();
|
|
1920
|
+
let n = Dt(e);
|
|
1663
1921
|
if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
|
|
1664
1922
|
if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
|
|
1665
1923
|
if (n.byteLength === 0) return;
|
|
@@ -1668,13 +1926,13 @@ var Ut = class {
|
|
|
1668
1926
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
1669
1927
|
if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
1670
1928
|
let a = async () => {
|
|
1671
|
-
if (this.closed || this.settled) throw new
|
|
1929
|
+
if (this.closed || this.settled) throw new bt();
|
|
1672
1930
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
1673
1931
|
utteranceId: this.id,
|
|
1674
1932
|
audio: t.buffer,
|
|
1675
1933
|
byteLength: t.byteLength
|
|
1676
1934
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
1677
|
-
setTimeout(() => t(new
|
|
1935
|
+
setTimeout(() => t(new xt()), r);
|
|
1678
1936
|
})]);
|
|
1679
1937
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
1680
1938
|
}, o = this.writeChain.then(a, a);
|
|
@@ -1686,7 +1944,7 @@ var Ut = class {
|
|
|
1686
1944
|
}
|
|
1687
1945
|
}
|
|
1688
1946
|
async setTranscript(e) {
|
|
1689
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1947
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new bt();
|
|
1690
1948
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
1691
1949
|
utteranceId: this.id,
|
|
1692
1950
|
transcript: e
|
|
@@ -1703,7 +1961,7 @@ var Ut = class {
|
|
|
1703
1961
|
});
|
|
1704
1962
|
return this.resolve(t), t;
|
|
1705
1963
|
} catch (e) {
|
|
1706
|
-
let t =
|
|
1964
|
+
let t = Ht(e);
|
|
1707
1965
|
throw this.fail(t), t;
|
|
1708
1966
|
}
|
|
1709
1967
|
}
|
|
@@ -1721,11 +1979,11 @@ var Ut = class {
|
|
|
1721
1979
|
characterId: this.characterId,
|
|
1722
1980
|
status: "cancelled",
|
|
1723
1981
|
durationMs: 0,
|
|
1724
|
-
animation:
|
|
1982
|
+
animation: St("none")
|
|
1725
1983
|
};
|
|
1726
1984
|
return this.resolve(t), t;
|
|
1727
1985
|
} catch (e) {
|
|
1728
|
-
let t =
|
|
1986
|
+
let t = Ht(e);
|
|
1729
1987
|
throw this.fail(t), t;
|
|
1730
1988
|
}
|
|
1731
1989
|
}
|
|
@@ -1738,7 +1996,7 @@ var Ut = class {
|
|
|
1738
1996
|
return e;
|
|
1739
1997
|
}
|
|
1740
1998
|
resolve(e) {
|
|
1741
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
1999
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new bt()));
|
|
1742
2000
|
}
|
|
1743
2001
|
fail(e) {
|
|
1744
2002
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
@@ -1750,7 +2008,7 @@ var Ut = class {
|
|
|
1750
2008
|
}
|
|
1751
2009
|
await new Promise((t, n) => {
|
|
1752
2010
|
let r = setTimeout(() => {
|
|
1753
|
-
n(new
|
|
2011
|
+
n(new xt());
|
|
1754
2012
|
}, e);
|
|
1755
2013
|
this.pendingWriteWaiters.push({
|
|
1756
2014
|
resolve: () => {
|
|
@@ -1769,13 +2027,13 @@ var Ut = class {
|
|
|
1769
2027
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
1770
2028
|
}
|
|
1771
2029
|
};
|
|
1772
|
-
function
|
|
2030
|
+
function Gt(e) {
|
|
1773
2031
|
let t = null, n = (t, n) => {
|
|
1774
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2032
|
+
if (!e.getCapabilities()[n]) throw new yt(t, n);
|
|
1775
2033
|
}, r = {
|
|
1776
2034
|
async speak(r) {
|
|
1777
2035
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
1778
|
-
let i =
|
|
2036
|
+
let i = Ot(r.queue ?? "append");
|
|
1779
2037
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
1780
2038
|
let a = e.getIframeHost();
|
|
1781
2039
|
if (!a) throw new Z("Speech session is not attached.");
|
|
@@ -1795,41 +2053,41 @@ function Wt(e) {
|
|
|
1795
2053
|
return;
|
|
1796
2054
|
}
|
|
1797
2055
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
1798
|
-
t.removeEventListener("abort", s), n(
|
|
2056
|
+
t.removeEventListener("abort", s), n(Vt(e, "completed"));
|
|
1799
2057
|
}, (a) => {
|
|
1800
|
-
if (t.removeEventListener("abort", s),
|
|
2058
|
+
if (t.removeEventListener("abort", s), Ut(a)) {
|
|
1801
2059
|
n({
|
|
1802
2060
|
utteranceId: "utt_interrupted",
|
|
1803
2061
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1804
2062
|
status: "interrupted",
|
|
1805
2063
|
durationMs: 0,
|
|
1806
2064
|
transcript: r.text,
|
|
1807
|
-
animation:
|
|
2065
|
+
animation: St("none")
|
|
1808
2066
|
});
|
|
1809
2067
|
return;
|
|
1810
2068
|
}
|
|
1811
|
-
i(
|
|
2069
|
+
i(Ht(a));
|
|
1812
2070
|
});
|
|
1813
2071
|
});
|
|
1814
2072
|
}
|
|
1815
2073
|
try {
|
|
1816
|
-
return
|
|
2074
|
+
return Vt(await o, "completed");
|
|
1817
2075
|
} catch (t) {
|
|
1818
|
-
if (
|
|
2076
|
+
if (Ut(t)) return {
|
|
1819
2077
|
utteranceId: "utt_interrupted",
|
|
1820
2078
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1821
2079
|
status: "interrupted",
|
|
1822
2080
|
durationMs: 0,
|
|
1823
2081
|
transcript: r.text,
|
|
1824
|
-
animation:
|
|
2082
|
+
animation: St("none")
|
|
1825
2083
|
};
|
|
1826
|
-
throw
|
|
2084
|
+
throw Ht(t);
|
|
1827
2085
|
}
|
|
1828
2086
|
},
|
|
1829
2087
|
async play(i) {
|
|
1830
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2088
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Tt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1831
2089
|
let a = i.queue ?? "append";
|
|
1832
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2090
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), gt(i.audio)) {
|
|
1833
2091
|
let e = i.audio.sampleRate ?? 24e3;
|
|
1834
2092
|
return r.createUtterance({
|
|
1835
2093
|
format: {
|
|
@@ -1845,7 +2103,7 @@ function Wt(e) {
|
|
|
1845
2103
|
}
|
|
1846
2104
|
let o = e.getIframeHost();
|
|
1847
2105
|
if (!o) throw new Z("Speech session is not attached.");
|
|
1848
|
-
let s = await
|
|
2106
|
+
let s = await zt(i.audio, i.signal);
|
|
1849
2107
|
return o.speechPlay({
|
|
1850
2108
|
source: s,
|
|
1851
2109
|
characterId: i.characterId,
|
|
@@ -1857,13 +2115,13 @@ function Wt(e) {
|
|
|
1857
2115
|
},
|
|
1858
2116
|
createUtterance(r) {
|
|
1859
2117
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
1860
|
-
let i =
|
|
2118
|
+
let i = Et(r);
|
|
1861
2119
|
if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
|
|
1862
2120
|
let a = r.queue ?? "replace-active";
|
|
1863
2121
|
if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
|
|
1864
2122
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
1865
|
-
let o = new
|
|
1866
|
-
id:
|
|
2123
|
+
let o = new Wt({
|
|
2124
|
+
id: Bt(),
|
|
1867
2125
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
1868
2126
|
format: i,
|
|
1869
2127
|
queue: a,
|
|
@@ -1875,7 +2133,7 @@ function Wt(e) {
|
|
|
1875
2133
|
t === o && (t = null);
|
|
1876
2134
|
}), r.track && (async () => {
|
|
1877
2135
|
try {
|
|
1878
|
-
if (await
|
|
2136
|
+
if (await Rt({
|
|
1879
2137
|
track: r.track,
|
|
1880
2138
|
utterance: o,
|
|
1881
2139
|
sampleRate: i.sampleRate,
|
|
@@ -1903,16 +2161,16 @@ function Wt(e) {
|
|
|
1903
2161
|
}
|
|
1904
2162
|
//#endregion
|
|
1905
2163
|
//#region src/v2/types/sessionInteraction.ts
|
|
1906
|
-
function
|
|
2164
|
+
function Kt(e) {
|
|
1907
2165
|
let t = e?.trim();
|
|
1908
2166
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
1909
2167
|
}
|
|
1910
2168
|
//#endregion
|
|
1911
2169
|
//#region src/v2/experience.ts
|
|
1912
|
-
function
|
|
2170
|
+
function qt(e) {
|
|
1913
2171
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
1914
2172
|
}
|
|
1915
|
-
var
|
|
2173
|
+
var Jt = class e {
|
|
1916
2174
|
bootstrap;
|
|
1917
2175
|
conversationProcessor;
|
|
1918
2176
|
iframeHost = null;
|
|
@@ -1926,18 +2184,19 @@ var qt = class e {
|
|
|
1926
2184
|
closed = !1;
|
|
1927
2185
|
attached = !1;
|
|
1928
2186
|
pendingFit = null;
|
|
2187
|
+
lastInteraction = null;
|
|
1929
2188
|
closeHandlers = [];
|
|
1930
|
-
eventRegistry =
|
|
2189
|
+
eventRegistry = ut();
|
|
1931
2190
|
readyEnvelope = null;
|
|
1932
2191
|
startedEnvelope = null;
|
|
1933
2192
|
sessionMintedEnvelope = null;
|
|
1934
2193
|
conversationCache = [];
|
|
1935
2194
|
speech;
|
|
1936
2195
|
constructor(e) {
|
|
1937
|
-
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 =
|
|
2196
|
+
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 = Gt({
|
|
1938
2197
|
getIframeHost: () => this.iframeHost,
|
|
1939
2198
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
1940
|
-
getCapabilities: () =>
|
|
2199
|
+
getCapabilities: () => Yt(this.resolvedSession),
|
|
1941
2200
|
getActiveCharacterId: () => "character_unknown",
|
|
1942
2201
|
onProcessorInterrupt: () => {
|
|
1943
2202
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -1982,6 +2241,7 @@ var qt = class e {
|
|
|
1982
2241
|
speechInputMode: t.speechInputMode,
|
|
1983
2242
|
speechOnly: t.speechOnly,
|
|
1984
2243
|
attribution: t.attribution,
|
|
2244
|
+
alreadyConverted: t.alreadyConverted,
|
|
1985
2245
|
ui: t.ui,
|
|
1986
2246
|
onStart: t.onStart,
|
|
1987
2247
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2004,6 +2264,7 @@ var qt = class e {
|
|
|
2004
2264
|
speechInputMode: t.speechInputMode,
|
|
2005
2265
|
speechOnly: t.speechOnly,
|
|
2006
2266
|
attribution: t.attribution,
|
|
2267
|
+
alreadyConverted: t.alreadyConverted,
|
|
2007
2268
|
ui: t.ui,
|
|
2008
2269
|
onStart: t.onStart,
|
|
2009
2270
|
onUserTranscript: t.onUserTranscript,
|
|
@@ -2018,7 +2279,7 @@ var qt = class e {
|
|
|
2018
2279
|
return null;
|
|
2019
2280
|
}
|
|
2020
2281
|
on(e, t) {
|
|
2021
|
-
let n =
|
|
2282
|
+
let n = dt(this.eventRegistry, e, t);
|
|
2022
2283
|
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;
|
|
2023
2284
|
}
|
|
2024
2285
|
async attach(e) {
|
|
@@ -2032,7 +2293,7 @@ var qt = class e {
|
|
|
2032
2293
|
if (this.closed) throw Error("Session has ended.");
|
|
2033
2294
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2034
2295
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2035
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2296
|
+
let t = this.bootstrap.embedBaseUrl ?? rt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = at(t, n, r ? void 0 : it(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, qt(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = st(i), o = null, s = new Promise((e) => {
|
|
2036
2297
|
o = e;
|
|
2037
2298
|
}), c = null, l = new Promise((e) => {
|
|
2038
2299
|
c = e;
|
|
@@ -2077,6 +2338,9 @@ var qt = class e {
|
|
|
2077
2338
|
onActivityChange: (e) => {
|
|
2078
2339
|
this.emitWrapped("activityChange", e);
|
|
2079
2340
|
},
|
|
2341
|
+
onInteractionChange: (e) => {
|
|
2342
|
+
this.lastInteraction = e, this.emitWrapped("interactionChange", e);
|
|
2343
|
+
},
|
|
2080
2344
|
onFeedback: (e) => {
|
|
2081
2345
|
this.emitWrapped("feedback", e);
|
|
2082
2346
|
},
|
|
@@ -2111,6 +2375,7 @@ var qt = class e {
|
|
|
2111
2375
|
speechInputMode: p.speechInputMode,
|
|
2112
2376
|
speechOnly: this.bootstrap.speechOnly,
|
|
2113
2377
|
attribution: this.bootstrap.attribution,
|
|
2378
|
+
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2114
2379
|
signal: this.endpointAbortController.signal
|
|
2115
2380
|
})) : this.bootstrap.kind === "public" ? ke(this.bootstrap.experienceId, {
|
|
2116
2381
|
locale: this.bootstrap.locale,
|
|
@@ -2120,7 +2385,8 @@ var qt = class e {
|
|
|
2120
2385
|
mode: p.mode,
|
|
2121
2386
|
speechInputMode: p.speechInputMode,
|
|
2122
2387
|
speechOnly: this.bootstrap.speechOnly,
|
|
2123
|
-
attribution: this.bootstrap.attribution
|
|
2388
|
+
attribution: this.bootstrap.attribution,
|
|
2389
|
+
alreadyConverted: this.bootstrap.alreadyConverted
|
|
2124
2390
|
}) : Promise.resolve(this.bootstrap.session ? {
|
|
2125
2391
|
session: this.bootstrap.session,
|
|
2126
2392
|
launch: this.bootstrap.launch
|
|
@@ -2128,6 +2394,16 @@ var qt = class e {
|
|
|
2128
2394
|
try {
|
|
2129
2395
|
[, h] = await Promise.all([f.waitForLoad(), m]);
|
|
2130
2396
|
} catch (e) {
|
|
2397
|
+
try {
|
|
2398
|
+
f.reportSdkError({
|
|
2399
|
+
errorCode: "sdk.session.attach_failed",
|
|
2400
|
+
severity: "error",
|
|
2401
|
+
operation: "attach",
|
|
2402
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2403
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2404
|
+
release: $e
|
|
2405
|
+
});
|
|
2406
|
+
} catch {}
|
|
2131
2407
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
2132
2408
|
} finally {
|
|
2133
2409
|
this.endpointAbortController = null;
|
|
@@ -2147,9 +2423,33 @@ var qt = class e {
|
|
|
2147
2423
|
showFeedback: e.showFeedback
|
|
2148
2424
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2149
2425
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
2150
|
-
})])
|
|
2426
|
+
})]).catch((e) => {
|
|
2427
|
+
try {
|
|
2428
|
+
f.reportSdkError({
|
|
2429
|
+
errorCode: "sdk.session.attach_failed",
|
|
2430
|
+
severity: "error",
|
|
2431
|
+
operation: "attach",
|
|
2432
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2433
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2434
|
+
release: $e
|
|
2435
|
+
});
|
|
2436
|
+
} catch {}
|
|
2437
|
+
throw e;
|
|
2438
|
+
}), await Promise.race([l, new Promise((e, t) => {
|
|
2151
2439
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
|
|
2152
|
-
})])
|
|
2440
|
+
})]).catch((e) => {
|
|
2441
|
+
try {
|
|
2442
|
+
f.reportSdkError({
|
|
2443
|
+
errorCode: "sdk.session.attach_failed",
|
|
2444
|
+
severity: "error",
|
|
2445
|
+
operation: "attach",
|
|
2446
|
+
message: e instanceof Error ? e.message : String(e),
|
|
2447
|
+
stack: e instanceof Error ? e.stack : void 0,
|
|
2448
|
+
release: $e
|
|
2449
|
+
});
|
|
2450
|
+
} catch {}
|
|
2451
|
+
throw e;
|
|
2452
|
+
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
|
|
2153
2453
|
}
|
|
2154
2454
|
async startListening() {
|
|
2155
2455
|
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
@@ -2173,11 +2473,23 @@ var qt = class e {
|
|
|
2173
2473
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2174
2474
|
}
|
|
2175
2475
|
async setFit(e) {
|
|
2176
|
-
let t =
|
|
2476
|
+
let t = Kt(e);
|
|
2177
2477
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2178
2478
|
if (this.closed) throw Error("Session has ended.");
|
|
2179
2479
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
2180
2480
|
}
|
|
2481
|
+
async setInteraction(e) {
|
|
2482
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2483
|
+
if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
|
|
2484
|
+
let t = await this.iframeHost.setInteraction(e);
|
|
2485
|
+
return this.lastInteraction = t, t;
|
|
2486
|
+
}
|
|
2487
|
+
async getInteraction() {
|
|
2488
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2489
|
+
if (!this.iframeHost) throw Error("getInteraction() requires attach() first.");
|
|
2490
|
+
let e = await this.iframeHost.getInteraction();
|
|
2491
|
+
return this.lastInteraction = e, e;
|
|
2492
|
+
}
|
|
2181
2493
|
async conversion(e) {
|
|
2182
2494
|
if (this.closed) throw Error("Session has ended.");
|
|
2183
2495
|
if (!this.iframeHost) throw Error("conversion() requires attach() first.");
|
|
@@ -2197,7 +2509,7 @@ var qt = class e {
|
|
|
2197
2509
|
this.close();
|
|
2198
2510
|
}
|
|
2199
2511
|
destroy() {
|
|
2200
|
-
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,
|
|
2512
|
+
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, pt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
2201
2513
|
}
|
|
2202
2514
|
resolveMintInteraction() {
|
|
2203
2515
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2209,8 +2521,8 @@ var qt = class e {
|
|
|
2209
2521
|
return this.resolvedSession?.id ?? "";
|
|
2210
2522
|
}
|
|
2211
2523
|
emitWrapped(e, t) {
|
|
2212
|
-
let n =
|
|
2213
|
-
return
|
|
2524
|
+
let n = lt(e, this.getSessionId(), t);
|
|
2525
|
+
return ft(this.eventRegistry, e, n), n;
|
|
2214
2526
|
}
|
|
2215
2527
|
queueProcessorTurn(e) {
|
|
2216
2528
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2269,7 +2581,7 @@ var qt = class e {
|
|
|
2269
2581
|
};
|
|
2270
2582
|
}
|
|
2271
2583
|
};
|
|
2272
|
-
function
|
|
2584
|
+
function Yt(e) {
|
|
2273
2585
|
return e ? {
|
|
2274
2586
|
textSpeech: e.capabilities.speech.output,
|
|
2275
2587
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -2280,26 +2592,26 @@ function Jt(e) {
|
|
|
2280
2592
|
}
|
|
2281
2593
|
//#endregion
|
|
2282
2594
|
//#region src/widget/dockGeometry.ts
|
|
2283
|
-
var
|
|
2284
|
-
function
|
|
2595
|
+
var Xt = "(min-width: 768px)", Zt = 24, Qt = .5, $t = 1200, en = .85, tn = 9 / 16;
|
|
2596
|
+
function nn() {
|
|
2285
2597
|
if (typeof window > "u") return 800;
|
|
2286
2598
|
let e = window.screen?.availHeight;
|
|
2287
2599
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
2288
2600
|
}
|
|
2289
|
-
function
|
|
2290
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
2291
|
-
return s > a && (s = a, o = s /
|
|
2601
|
+
function rn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Zt, r = typeof window < "u" ? nn() : 800) {
|
|
2602
|
+
let i = Math.max(160, Math.min(t - n * 2, t * en)), a = Math.max(120, e - n * 2), o = Math.min(r * Qt, $t, i), s = o * tn;
|
|
2603
|
+
return s > a && (s = a, o = s / tn, o > i && (o = i, s = o * tn)), {
|
|
2292
2604
|
width: Math.round(s),
|
|
2293
2605
|
height: Math.round(o)
|
|
2294
2606
|
};
|
|
2295
2607
|
}
|
|
2296
|
-
function
|
|
2608
|
+
function an(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Zt) {
|
|
2297
2609
|
return {
|
|
2298
2610
|
left: Math.max(r, t - e.width - r),
|
|
2299
2611
|
top: Math.max(r, n - e.height - r)
|
|
2300
2612
|
};
|
|
2301
2613
|
}
|
|
2302
|
-
function
|
|
2614
|
+
function on(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Zt) {
|
|
2303
2615
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
2304
2616
|
return {
|
|
2305
2617
|
left: Math.min(Math.max(a, e), o),
|
|
@@ -2307,14 +2619,14 @@ function an(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
|
|
|
2307
2619
|
};
|
|
2308
2620
|
}
|
|
2309
2621
|
function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
2310
|
-
return e(
|
|
2622
|
+
return e(Xt).matches;
|
|
2311
2623
|
}
|
|
2312
2624
|
//#endregion
|
|
2313
2625
|
//#region src/widget/mountExperienceWidget.ts
|
|
2314
|
-
function
|
|
2626
|
+
function sn(e) {
|
|
2315
2627
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
2316
2628
|
}
|
|
2317
|
-
function
|
|
2629
|
+
function cn(e) {
|
|
2318
2630
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
2319
2631
|
let t = typeof e == "string" ? e.trim() : "";
|
|
2320
2632
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -2322,9 +2634,9 @@ function sn(e) {
|
|
|
2322
2634
|
function $(e) {
|
|
2323
2635
|
return e === "expanded" || e === "docked";
|
|
2324
2636
|
}
|
|
2325
|
-
var
|
|
2326
|
-
function
|
|
2327
|
-
|
|
2637
|
+
var ln = "<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>", un = "<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>", dn = "<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>", fn = "<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>";
|
|
2638
|
+
function pn(e, t, n) {
|
|
2639
|
+
ne(L);
|
|
2328
2640
|
let r = c({
|
|
2329
2641
|
galleryThumb: t.galleryThumb,
|
|
2330
2642
|
avatarImage: t.avatarImage,
|
|
@@ -2351,9 +2663,9 @@ function fn(e, t, n) {
|
|
|
2351
2663
|
let e = document.createElement("img");
|
|
2352
2664
|
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);
|
|
2353
2665
|
}
|
|
2354
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
2666
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : te(i);
|
|
2355
2667
|
}
|
|
2356
|
-
function
|
|
2668
|
+
function mn(e) {
|
|
2357
2669
|
return e.startButton ? {
|
|
2358
2670
|
...e.startButton,
|
|
2359
2671
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -2365,7 +2677,7 @@ function pn(e) {
|
|
|
2365
2677
|
variant: "primary"
|
|
2366
2678
|
};
|
|
2367
2679
|
}
|
|
2368
|
-
function
|
|
2680
|
+
function hn(e) {
|
|
2369
2681
|
let t = !1, n = () => {
|
|
2370
2682
|
t || e();
|
|
2371
2683
|
}, r = () => {
|
|
@@ -2385,12 +2697,12 @@ function mn(e) {
|
|
|
2385
2697
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
2386
2698
|
};
|
|
2387
2699
|
}
|
|
2388
|
-
function
|
|
2389
|
-
|
|
2700
|
+
function gn(e, t) {
|
|
2701
|
+
ae(re);
|
|
2390
2702
|
let n = t.experienceId?.trim();
|
|
2391
2703
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
2392
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
2393
|
-
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",
|
|
2704
|
+
let r = t.prefetch ?? "onExpand", i = sn(t.position), a = document.createElement("div");
|
|
2705
|
+
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", cn(t.offset));
|
|
2394
2706
|
let o = document.createElement("button");
|
|
2395
2707
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
2396
2708
|
let s = document.createElement("div");
|
|
@@ -2410,22 +2722,22 @@ function hn(e, t) {
|
|
|
2410
2722
|
let m = document.createElement("span");
|
|
2411
2723
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
2412
2724
|
let h = document.createElement("button");
|
|
2413
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
2725
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = dn, h.setAttribute("aria-label", "Reduce");
|
|
2414
2726
|
let g = document.createElement("button");
|
|
2415
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
2727
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = ln, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
2416
2728
|
let _ = document.createElement("button");
|
|
2417
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
2729
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = un, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
2418
2730
|
let v = document.createElement("div");
|
|
2419
2731
|
v.className = "liforma-ew__stage";
|
|
2420
2732
|
let y = document.createElement("div");
|
|
2421
2733
|
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);
|
|
2422
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null,
|
|
2734
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, N = null, P = null, F = null, I = null, ee = 0, te = 0, L = null, R = !1, ne = new AbortController(), ie = t.parallax !== !1, z = () => {
|
|
2423
2735
|
let e = a.dataset.state;
|
|
2424
2736
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
2425
|
-
},
|
|
2737
|
+
}, oe = () => {
|
|
2426
2738
|
M !== null && (clearTimeout(M), M = null);
|
|
2427
2739
|
}, se = () => {
|
|
2428
|
-
|
|
2740
|
+
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
2429
2741
|
}, ce = () => {
|
|
2430
2742
|
for (let e of [
|
|
2431
2743
|
f,
|
|
@@ -2441,43 +2753,43 @@ function hn(e, t) {
|
|
|
2441
2753
|
let a = p.offsetWidth || 120;
|
|
2442
2754
|
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";
|
|
2443
2755
|
}, B = (e, t) => {
|
|
2444
|
-
if (
|
|
2445
|
-
let n =
|
|
2446
|
-
|
|
2756
|
+
if (z() !== "docked") return;
|
|
2757
|
+
let n = rn(), r = on(e - ee, t - te, n);
|
|
2758
|
+
P = r.left, F = r.top, le(r.left, r.top, n.width, n.height);
|
|
2447
2759
|
}, de = (e, t) => {
|
|
2448
|
-
if (
|
|
2449
|
-
let n =
|
|
2450
|
-
|
|
2760
|
+
if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
2761
|
+
let n = rn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = on(r + e, i + t, n);
|
|
2762
|
+
P = a.left, F = a.top, le(a.left, a.top, n.width, n.height);
|
|
2451
2763
|
}, fe = (e) => {
|
|
2452
|
-
|
|
2764
|
+
L === "toolbar" && (I === null || e.pointerId !== I || (e.preventDefault(), B(e.clientX, e.clientY)));
|
|
2453
2765
|
}, V = (e) => {
|
|
2454
|
-
if (
|
|
2455
|
-
let t =
|
|
2456
|
-
|
|
2766
|
+
if (I === null || e && e.pointerId !== I) return;
|
|
2767
|
+
let t = L;
|
|
2768
|
+
I = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && R && (R = !1, window.removeEventListener("pointermove", fe), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
2457
2769
|
}, pe = (e, t, n) => {
|
|
2458
|
-
if (S ||
|
|
2459
|
-
|
|
2770
|
+
if (S || z() !== "docked" || !Q() || I !== null) return;
|
|
2771
|
+
I = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2460
2772
|
let r = f.getBoundingClientRect();
|
|
2461
|
-
|
|
2773
|
+
ee = e - r.left, te = t - r.top, R || (R = !0, window.addEventListener("pointermove", fe), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
2462
2774
|
}, H = (e) => {
|
|
2463
|
-
if (S ||
|
|
2464
|
-
|
|
2775
|
+
if (S || z() !== "docked" || !Q() || I !== null) return;
|
|
2776
|
+
I = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2465
2777
|
let t = f.getBoundingClientRect();
|
|
2466
|
-
|
|
2778
|
+
P = t.left, F = t.top;
|
|
2467
2779
|
}, me = (e) => {
|
|
2468
|
-
|
|
2780
|
+
L === "player" && (I === null || e.pointerId !== I || de(e.dx, e.dy));
|
|
2469
2781
|
}, he = (e) => {
|
|
2470
|
-
|
|
2782
|
+
L === "player" && (I === null || e.pointerId !== I || V());
|
|
2471
2783
|
}, U = () => {
|
|
2472
|
-
let e = Q(), t =
|
|
2784
|
+
let e = Q(), t = z();
|
|
2473
2785
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
2474
2786
|
h.hidden = !0;
|
|
2475
2787
|
return;
|
|
2476
2788
|
}
|
|
2477
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
2789
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = fn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = dn, h.setAttribute("aria-label", "Reduce"));
|
|
2478
2790
|
}, ge = (e) => {
|
|
2479
|
-
let t =
|
|
2480
|
-
n =
|
|
2791
|
+
let t = rn(), n = e && P !== null && F !== null ? on(P, F, t) : an(t);
|
|
2792
|
+
n = on(n.left, n.top, t), P = n.left, F = n.top, le(n.left, n.top, t.width, t.height), U();
|
|
2481
2793
|
}, _e = () => {
|
|
2482
2794
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
2483
2795
|
requestAnimationFrame(() => {
|
|
@@ -2489,15 +2801,15 @@ function hn(e, t) {
|
|
|
2489
2801
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2490
2802
|
return;
|
|
2491
2803
|
}
|
|
2492
|
-
|
|
2493
|
-
if (
|
|
2804
|
+
N = setTimeout(() => {
|
|
2805
|
+
if (N = null, S || !$(a.dataset.state)) {
|
|
2494
2806
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2495
2807
|
return;
|
|
2496
2808
|
}
|
|
2497
2809
|
a.classList.remove("liforma-ew--layout-settling"), _e();
|
|
2498
2810
|
}, 220);
|
|
2499
2811
|
}, G = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
2500
|
-
|
|
2812
|
+
oe(), M = setTimeout(() => {
|
|
2501
2813
|
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
2502
2814
|
}, 280);
|
|
2503
2815
|
})), ve = {
|
|
@@ -2524,20 +2836,20 @@ function hn(e, t) {
|
|
|
2524
2836
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
2525
2837
|
}, Se = (e) => {
|
|
2526
2838
|
A?.(), A = null;
|
|
2527
|
-
let t =
|
|
2839
|
+
let t = pn(s, e, { parallax: ie });
|
|
2528
2840
|
return t ? (A = t, !0) : !1;
|
|
2529
2841
|
}, Ce = () => {
|
|
2530
2842
|
if (Se(ve)) {
|
|
2531
2843
|
be();
|
|
2532
2844
|
return;
|
|
2533
2845
|
}
|
|
2534
|
-
ye("Loading…"), ue(n, { signal:
|
|
2846
|
+
ye("Loading…"), ue(n, { signal: ne.signal }).then((e) => {
|
|
2535
2847
|
if (!S) {
|
|
2536
2848
|
if (!Se({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
2537
2849
|
be();
|
|
2538
2850
|
}
|
|
2539
2851
|
}).catch((e) => {
|
|
2540
|
-
if (S ||
|
|
2852
|
+
if (S || ne.signal.aborted) return;
|
|
2541
2853
|
let n = e instanceof Error ? e : Error(String(e));
|
|
2542
2854
|
ye("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
2543
2855
|
});
|
|
@@ -2550,10 +2862,11 @@ function hn(e, t) {
|
|
|
2550
2862
|
...t.mode ? { mode: t.mode } : {},
|
|
2551
2863
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
2552
2864
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
2865
|
+
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
2553
2866
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
2554
2867
|
}), Te = () => ({
|
|
2555
2868
|
...t.fit ? { fit: t.fit } : {},
|
|
2556
|
-
startButton:
|
|
2869
|
+
startButton: mn(t),
|
|
2557
2870
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
|
|
2558
2871
|
}), q = (e = !0) => {
|
|
2559
2872
|
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ce(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), U(), e && t.onExpanded?.();
|
|
@@ -2570,7 +2883,7 @@ function hn(e, t) {
|
|
|
2570
2883
|
}, Oe = () => {
|
|
2571
2884
|
se(), u.hidden = !0, p.hidden = !0, ce(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), U();
|
|
2572
2885
|
}, ke = () => {
|
|
2573
|
-
|
|
2886
|
+
oe(), se(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
2574
2887
|
let e = b;
|
|
2575
2888
|
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");
|
|
2576
2889
|
}, J = () => {
|
|
@@ -2585,26 +2898,26 @@ function hn(e, t) {
|
|
|
2585
2898
|
ke(), Oe(), t.onCollapsed?.(), t.onClose?.();
|
|
2586
2899
|
}
|
|
2587
2900
|
}, Ae = () => {
|
|
2588
|
-
S || Q() &&
|
|
2901
|
+
S || Q() && z() === "expanded" && W(() => {
|
|
2589
2902
|
Ee();
|
|
2590
2903
|
});
|
|
2591
2904
|
}, je = () => {
|
|
2592
|
-
S ||
|
|
2905
|
+
S || z() === "docked" && (V(), W(() => {
|
|
2593
2906
|
ce(), q(!1), b?.setWidgetChrome("expanded");
|
|
2594
2907
|
}));
|
|
2595
2908
|
}, Me = () => {
|
|
2596
|
-
!b || !D || (
|
|
2909
|
+
!b || !D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, _e());
|
|
2597
2910
|
}, Ne = () => {
|
|
2598
|
-
!b || !E || D || (
|
|
2911
|
+
!b || !E || D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
2599
2912
|
}, Pe = (e) => {
|
|
2600
|
-
S || e !== O && !D || (
|
|
2913
|
+
S || e !== O && !D || (oe(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, D && _e());
|
|
2601
2914
|
}, Fe = () => {
|
|
2602
2915
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
2603
2916
|
T = !0;
|
|
2604
2917
|
let e = O;
|
|
2605
2918
|
l.hidden = !1, (async () => {
|
|
2606
2919
|
try {
|
|
2607
|
-
let t = await
|
|
2920
|
+
let t = await Jt.startSession(we());
|
|
2608
2921
|
if (S || e !== O) {
|
|
2609
2922
|
t.destroy();
|
|
2610
2923
|
return;
|
|
@@ -2663,7 +2976,7 @@ function hn(e, t) {
|
|
|
2663
2976
|
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 () => {
|
|
2664
2977
|
try {
|
|
2665
2978
|
q();
|
|
2666
|
-
let t = await
|
|
2979
|
+
let t = await Jt.startSession(we());
|
|
2667
2980
|
if (S || e !== O) {
|
|
2668
2981
|
t.destroy();
|
|
2669
2982
|
return;
|
|
@@ -2720,22 +3033,22 @@ function hn(e, t) {
|
|
|
2720
3033
|
Ie();
|
|
2721
3034
|
}
|
|
2722
3035
|
}, Re = (e) => {
|
|
2723
|
-
if (e.stopPropagation(),
|
|
3036
|
+
if (e.stopPropagation(), z() === "expanded") {
|
|
2724
3037
|
Ae();
|
|
2725
3038
|
return;
|
|
2726
3039
|
}
|
|
2727
|
-
|
|
3040
|
+
z() === "docked" && je();
|
|
2728
3041
|
}, ze = (e) => {
|
|
2729
3042
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
2730
3043
|
}, Be = (e) => {
|
|
2731
3044
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
2732
3045
|
}, Ve = (e) => {
|
|
2733
|
-
|
|
3046
|
+
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), pe(e.clientX, e.clientY, e.pointerId)));
|
|
2734
3047
|
}, He = (e) => {
|
|
2735
3048
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), J());
|
|
2736
3049
|
}, Ue = () => {
|
|
2737
3050
|
if (!S) {
|
|
2738
|
-
if (
|
|
3051
|
+
if (z() === "docked") {
|
|
2739
3052
|
if (!Q()) {
|
|
2740
3053
|
je();
|
|
2741
3054
|
return;
|
|
@@ -2747,9 +3060,9 @@ function hn(e, t) {
|
|
|
2747
3060
|
}
|
|
2748
3061
|
U();
|
|
2749
3062
|
}
|
|
2750
|
-
}, We = typeof window < "u" ? window.matchMedia(
|
|
3063
|
+
}, We = typeof window < "u" ? window.matchMedia(Xt) : null, Ge = () => {
|
|
2751
3064
|
if (!S) {
|
|
2752
|
-
if (
|
|
3065
|
+
if (z() === "docked" && !Q()) {
|
|
2753
3066
|
je();
|
|
2754
3067
|
return;
|
|
2755
3068
|
}
|
|
@@ -2760,7 +3073,7 @@ function hn(e, t) {
|
|
|
2760
3073
|
e.stopPropagation(), J();
|
|
2761
3074
|
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), Ce(), U(), r === "eager" ? queueMicrotask(() => {
|
|
2762
3075
|
S || Fe();
|
|
2763
|
-
}) : r === "idle" && (j =
|
|
3076
|
+
}) : r === "idle" && (j = hn(() => {
|
|
2764
3077
|
S || Fe();
|
|
2765
3078
|
})), {
|
|
2766
3079
|
root: a,
|
|
@@ -2776,11 +3089,11 @@ function hn(e, t) {
|
|
|
2776
3089
|
Fe();
|
|
2777
3090
|
},
|
|
2778
3091
|
destroy() {
|
|
2779
|
-
S || (S = !0, V(), j?.(), j = null,
|
|
3092
|
+
S || (S = !0, V(), j?.(), j = null, ne.abort(), A?.(), A = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), ke(), Oe(), e.replaceChildren());
|
|
2780
3093
|
}
|
|
2781
3094
|
};
|
|
2782
3095
|
}
|
|
2783
3096
|
//#endregion
|
|
2784
|
-
export {
|
|
3097
|
+
export { L as EXPERIENCE_THUMBNAIL_CSS, re as EXPERIENCE_WIDGET_CSS, Jt as Experience, B as LiformaError, X as SPEECH_LIMITS, xt as SpeechBufferTimeoutError, Z as SpeechRuntimeError, bt as SpeechUtteranceClosedError, yt as UnsupportedSpeechOperationError, D as attachImageReady, E as attachLazyThumb, ee as attachScrollLinkedParallax, m as buildHostedLaunchUrl, ne as ensureExperienceThumbnailStyles, ae as ensureExperienceWidgetStyles, ue as fetchExperiencePreview, C as getDefaultLazyRootMargin, k as horizontalParallaxFromViewportY, fe as liformaErrorFromResponse, gn as mountExperienceWidget, n as navigateOnExperienceClose, h as resolveThumbnailHref, f as resolveThumbnailInteraction, c as resolveThumbnailLayers, r as thumbnailFitClass, s as toGalleryThumbUrl, Se as warnLocaleVoiceFallbacks };
|
|
2785
3098
|
|
|
2786
3099
|
//# sourceMappingURL=index.js.map
|