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