@liforma/client 0.4.9 → 0.4.11
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 +23 -1
- package/dist/next/index.js +763 -623
- package/dist/next/index.js.map +1 -1
- package/dist/next/react/ExperienceThumbnail.d.ts +2 -0
- package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/next/react/ExperienceWidget.d.ts +3 -0
- package/dist/next/react/ExperienceWidget.d.ts.map +1 -1
- package/dist/next/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/next/thumbnail/expandAssetUrl.test.d.ts +2 -0
- package/dist/next/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
- package/dist/next/thumbnail/index.d.ts +3 -0
- package/dist/next/thumbnail/index.d.ts.map +1 -1
- package/dist/next/thumbnail/locationPlate.d.ts +13 -0
- package/dist/next/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/next/thumbnail/locationPlate.test.d.ts +2 -0
- package/dist/next/thumbnail/locationPlate.test.d.ts.map +1 -0
- package/dist/next/thumbnail/styles.d.ts.map +1 -1
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/next/thumbnail/types.d.ts +7 -1
- package/dist/next/thumbnail/types.d.ts.map +1 -1
- package/dist/next/thumbnail.js +273 -192
- package/dist/next/thumbnail.js.map +1 -1
- package/dist/next/v2/embed/iframeHost.d.ts +6 -2
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +25 -2
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +25 -3
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/next/v2/types/sessionInteraction.d.ts +13 -1
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/next/v2/types/sessionManifest.d.ts +1 -0
- package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/next/v2/types/stage.d.ts +8 -0
- package/dist/next/v2/types/stage.d.ts.map +1 -0
- package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/next/widget/types.d.ts +1 -0
- package/dist/next/widget/types.d.ts.map +1 -1
- package/dist/npm/index.js +566 -454
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/npm/thumbnail/index.d.ts +3 -0
- package/dist/npm/thumbnail/index.d.ts.map +1 -1
- package/dist/npm/thumbnail/index.js +151 -75
- package/dist/npm/thumbnail/index.js.map +1 -1
- package/dist/npm/thumbnail/locationPlate.d.ts +13 -0
- package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/npm/thumbnail/styles.d.ts.map +1 -1
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/npm/thumbnail/types.d.ts +7 -1
- package/dist/npm/thumbnail/types.d.ts.map +1 -1
- package/dist/npm/v2/embed/iframeHost.d.ts +6 -2
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +25 -2
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +25 -3
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +2 -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/liforma-experience.d.ts +2 -0
- package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +2 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionInteraction.d.ts +13 -1
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionManifest.d.ts +1 -0
- package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/npm/v2/types/sessionManifestSchema.d.ts +17 -0
- package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
- package/dist/npm/v2/types/stage.d.ts +8 -0
- package/dist/npm/v2/types/stage.d.ts.map +1 -0
- package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/npm/widget/types.d.ts +1 -0
- package/dist/npm/widget/types.d.ts.map +1 -1
- package/dist/react/component/experienceComponentRuntime.d.ts +4 -0
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +15 -1
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +884 -719
- 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 +2 -0
- package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
- package/dist/react/react/ExperienceWidget.d.ts +3 -0
- package/dist/react/react/ExperienceWidget.d.ts.map +1 -1
- package/dist/react/thumbnail/expandAssetUrl.d.ts +17 -0
- package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -0
- package/dist/react/thumbnail/expandAssetUrl.test.d.ts +2 -0
- package/dist/react/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
- package/dist/react/thumbnail/index.d.ts +3 -0
- package/dist/react/thumbnail/index.d.ts.map +1 -1
- package/dist/react/thumbnail/locationPlate.d.ts +13 -0
- package/dist/react/thumbnail/locationPlate.d.ts.map +1 -0
- package/dist/react/thumbnail/locationPlate.test.d.ts +2 -0
- package/dist/react/thumbnail/locationPlate.test.d.ts.map +1 -0
- package/dist/react/thumbnail/styles.d.ts.map +1 -1
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +12 -2
- package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
- package/dist/react/thumbnail/types.d.ts +7 -1
- package/dist/react/thumbnail/types.d.ts.map +1 -1
- package/dist/react/thumbnail.js +273 -192
- package/dist/react/thumbnail.js.map +1 -1
- package/dist/react/v2/embed/iframeHost.d.ts +6 -2
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +25 -2
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +25 -3
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts +15 -1
- package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
- package/dist/react/v2/types/sessionInteraction.d.ts +13 -1
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/react/v2/types/sessionManifest.d.ts +1 -0
- package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
- package/dist/react/v2/types/stage.d.ts +8 -0
- package/dist/react/v2/types/stage.d.ts.map +1 -0
- package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
- package/dist/react/widget/types.d.ts +1 -0
- package/dist/react/widget/types.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +2 -2
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +9 -2
- package/dist/sdk/v2/thumbnail.js.map +1 -1
- package/dist/svelte/Experience.svelte +43 -0
- package/dist/svelte/Experience.svelte.d.ts +3 -0
- package/dist/svelte/ExperienceThumbnail.svelte +24 -2
- package/dist/svelte/ExperienceThumbnail.svelte.d.ts +2 -0
- package/dist/svelte/ExperienceWidget.svelte +9 -0
- package/dist/svelte/ExperienceWidget.svelte.d.ts +3 -0
- package/package.json +1 -1
package/dist/npm/index.js
CHANGED
|
@@ -34,28 +34,87 @@ 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/locationPlate.ts
|
|
38
|
+
var i = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
39
|
+
function a(e, t) {
|
|
40
|
+
let n = e.trim();
|
|
41
|
+
return n && n.replace(i, (e, n, r, i, a) => `${n}${t}${i}${a}`);
|
|
42
|
+
}
|
|
43
|
+
var o = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
|
|
39
44
|
function s(e) {
|
|
40
|
-
|
|
41
|
-
if (!t) return t;
|
|
42
|
-
let n = t.replace(i, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
|
|
43
|
-
return n = n.replace(a, "_neutral$1"), n = n.replace(o, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
|
|
45
|
+
return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
|
|
44
46
|
}
|
|
45
47
|
function c(e) {
|
|
48
|
+
return /^https?:\/\//i.test(e) || e.startsWith("//");
|
|
49
|
+
}
|
|
50
|
+
function l(e) {
|
|
51
|
+
return e.startsWith("//") ? `https:${e}` : e;
|
|
52
|
+
}
|
|
53
|
+
function u(e) {
|
|
54
|
+
let t = e.indexOf("?");
|
|
55
|
+
return t === -1 ? {
|
|
56
|
+
pathname: e,
|
|
57
|
+
search: ""
|
|
58
|
+
} : {
|
|
59
|
+
pathname: e.slice(0, t),
|
|
60
|
+
search: e.slice(t)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function d(e, t, n = "") {
|
|
64
|
+
return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
|
|
65
|
+
}
|
|
66
|
+
function f(e, t, n) {
|
|
67
|
+
let r = e.trim();
|
|
68
|
+
if (!r) return r;
|
|
69
|
+
let i = s(n);
|
|
70
|
+
if (c(r)) return a(l(r), t);
|
|
71
|
+
let { pathname: f, search: p } = u(r.replace(/\\/g, "/")), m = f;
|
|
72
|
+
if (!m.startsWith("/")) m = `/locations/${m.replace(/^locations\//i, "")}`;
|
|
73
|
+
else if (!/^\/locations\//i.test(m)) return /^\/avatars\//i.test(m) ? d(i, m, p) : r;
|
|
74
|
+
if (/\.webp$/i.test(m) && !o.test(m.replace(/\.webp$/i, ""))) return d(i, m, p);
|
|
75
|
+
let h = m.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
|
|
76
|
+
return h = h.replace(o, ""), `${i}/locations/${h}-${t}.webp${p}`;
|
|
77
|
+
}
|
|
78
|
+
function p(e, t) {
|
|
79
|
+
let n = e.trim();
|
|
80
|
+
if (!n) return n;
|
|
81
|
+
let r = s(t);
|
|
82
|
+
if (c(n)) return l(n);
|
|
83
|
+
let { pathname: i, search: a } = u(n.replace(/\\/g, "/")), o = i;
|
|
84
|
+
if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
|
|
85
|
+
else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
|
|
86
|
+
else return n;
|
|
87
|
+
if (!/^\/avatars\//i.test(o)) return n;
|
|
88
|
+
let f = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
|
|
89
|
+
return f && !f.includes("/") && !a ? `${r}/avatars/${f}/256/${f}_neutral.webp` : d(r, o, a);
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
93
|
+
var m = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, h = /_CH(\.webp)/i;
|
|
94
|
+
function g(e) {
|
|
95
|
+
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
|
+
}
|
|
97
|
+
function _(e, t = "256x256", n) {
|
|
98
|
+
let r = e.trim();
|
|
99
|
+
if (!r) return r;
|
|
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");
|
|
103
|
+
}
|
|
104
|
+
function v(e) {
|
|
46
105
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
47
106
|
if (!t) return null;
|
|
48
|
-
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
|
|
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, l = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : _(e, a, o), u = (e) => !c && /^https?:\/\//i.test(e.trim()) ? e.trim() : f(e, a, o);
|
|
49
108
|
return {
|
|
50
|
-
avatarImage:
|
|
51
|
-
...n ? { backgroundImage:
|
|
52
|
-
...r ? { foregroundImage:
|
|
53
|
-
...i ? { fallbackImage:
|
|
109
|
+
avatarImage: l(t),
|
|
110
|
+
...n ? { backgroundImage: u(n) } : {},
|
|
111
|
+
...r ? { foregroundImage: u(r) } : {},
|
|
112
|
+
...i ? { fallbackImage: l(i) } : {}
|
|
54
113
|
};
|
|
55
114
|
}
|
|
56
115
|
//#endregion
|
|
57
116
|
//#region src/shims/localStack.ts
|
|
58
|
-
function
|
|
117
|
+
function y() {
|
|
59
118
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
60
119
|
if (typeof location > "u") return !1;
|
|
61
120
|
try {
|
|
@@ -66,83 +125,83 @@ function l() {
|
|
|
66
125
|
}
|
|
67
126
|
//#endregion
|
|
68
127
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
69
|
-
var
|
|
70
|
-
function
|
|
128
|
+
var b = "https://player.liforma.ai", x = "http://localhost:3002";
|
|
129
|
+
function S(e) {
|
|
71
130
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
72
131
|
}
|
|
73
|
-
function
|
|
132
|
+
function C(e) {
|
|
74
133
|
let t = e?.trim();
|
|
75
|
-
return t ? t.replace(/\/$/, "") :
|
|
134
|
+
return t ? t.replace(/\/$/, "") : y() ? x : b;
|
|
76
135
|
}
|
|
77
|
-
function
|
|
78
|
-
let t = e.experienceId.trim(), n =
|
|
136
|
+
function w(e) {
|
|
137
|
+
let t = e.experienceId.trim(), n = C(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
79
138
|
return i && r.searchParams.set("returnUrl", i), r.toString();
|
|
80
139
|
}
|
|
81
|
-
function
|
|
140
|
+
function T(e) {
|
|
82
141
|
let t = e.href?.trim();
|
|
83
142
|
if (t) return t;
|
|
84
143
|
let n = e.experienceId?.trim();
|
|
85
144
|
if (!n) return;
|
|
86
145
|
let r = e.returnUrl?.trim();
|
|
87
|
-
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href),
|
|
146
|
+
return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), w({
|
|
88
147
|
experienceId: n,
|
|
89
148
|
...r ? { returnUrl: r } : {},
|
|
90
149
|
playerBaseUrl: e.playerBaseUrl
|
|
91
150
|
});
|
|
92
151
|
}
|
|
93
|
-
function
|
|
152
|
+
function E() {
|
|
94
153
|
return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
95
154
|
}
|
|
96
|
-
var
|
|
97
|
-
function
|
|
98
|
-
return
|
|
155
|
+
var D = 0, O = [];
|
|
156
|
+
function ee() {
|
|
157
|
+
return E() ? 4 : Infinity;
|
|
99
158
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
159
|
+
function k() {
|
|
160
|
+
return E() ? 160 : 0;
|
|
102
161
|
}
|
|
103
|
-
function
|
|
104
|
-
let e =
|
|
105
|
-
for (;
|
|
106
|
-
let e =
|
|
162
|
+
function te() {
|
|
163
|
+
let e = ee();
|
|
164
|
+
for (; D < e && O.length > 0;) {
|
|
165
|
+
let e = O.shift();
|
|
107
166
|
if (!e || e.cancelled) continue;
|
|
108
|
-
|
|
109
|
-
let t =
|
|
167
|
+
D += 1, e.start();
|
|
168
|
+
let t = k();
|
|
110
169
|
if (t <= 0) {
|
|
111
|
-
|
|
170
|
+
D = Math.max(0, D - 1);
|
|
112
171
|
continue;
|
|
113
172
|
}
|
|
114
173
|
window.setTimeout(() => {
|
|
115
|
-
|
|
174
|
+
D = Math.max(0, D - 1), te();
|
|
116
175
|
}, t);
|
|
117
176
|
}
|
|
118
177
|
}
|
|
119
|
-
function
|
|
120
|
-
if (!
|
|
178
|
+
function A(e) {
|
|
179
|
+
if (!E()) return e(), () => {};
|
|
121
180
|
let t = {
|
|
122
181
|
start: e,
|
|
123
182
|
cancelled: !1
|
|
124
183
|
};
|
|
125
|
-
return
|
|
184
|
+
return O.push(t), te(), () => {
|
|
126
185
|
t.cancelled = !0;
|
|
127
186
|
};
|
|
128
187
|
}
|
|
129
188
|
//#endregion
|
|
130
189
|
//#region src/thumbnail/lazyLoad.ts
|
|
131
|
-
function
|
|
132
|
-
return
|
|
190
|
+
function j() {
|
|
191
|
+
return E() ? "96px 0px" : "280px 0px";
|
|
133
192
|
}
|
|
134
|
-
function
|
|
193
|
+
function M(e) {
|
|
135
194
|
let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
|
|
136
195
|
return Number.isFinite(n) ? Math.abs(n) : 280;
|
|
137
196
|
}
|
|
138
|
-
function
|
|
197
|
+
function N(e, t) {
|
|
139
198
|
if (typeof window > "u") return !1;
|
|
140
199
|
let n = e.getBoundingClientRect();
|
|
141
200
|
return n.bottom >= -t && n.top <= window.innerHeight + t;
|
|
142
201
|
}
|
|
143
|
-
function
|
|
144
|
-
let { onVisibleChange: n } = t, r = t.rootMargin ??
|
|
145
|
-
o || (s?.(), s =
|
|
202
|
+
function P(e, t) {
|
|
203
|
+
let { onVisibleChange: n } = t, r = t.rootMargin ?? j(), i = M(r), a = !1, o = !1, s = null, c = () => {
|
|
204
|
+
o || (s?.(), s = A(() => {
|
|
146
205
|
s = null, o = !0, n(!0);
|
|
147
206
|
}));
|
|
148
207
|
}, l = (e) => {
|
|
@@ -164,11 +223,11 @@ function E(e, t) {
|
|
|
164
223
|
rootMargin: r,
|
|
165
224
|
threshold: 0
|
|
166
225
|
});
|
|
167
|
-
return u.observe(e),
|
|
226
|
+
return u.observe(e), N(e, i) && l(!0), () => {
|
|
168
227
|
s?.(), s = null, u.disconnect();
|
|
169
228
|
};
|
|
170
229
|
}
|
|
171
|
-
function
|
|
230
|
+
function ne(e, t) {
|
|
172
231
|
let n = () => t();
|
|
173
232
|
return e.complete ? queueMicrotask(n) : (e.addEventListener("load", n, { once: !0 }), e.addEventListener("error", n, { once: !0 })), () => {
|
|
174
233
|
e.removeEventListener("load", n), e.removeEventListener("error", n);
|
|
@@ -176,49 +235,49 @@ function D(e, t) {
|
|
|
176
235
|
}
|
|
177
236
|
//#endregion
|
|
178
237
|
//#region src/thumbnail/scrollParallax.ts
|
|
179
|
-
function
|
|
238
|
+
function re() {
|
|
180
239
|
return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
|
|
181
240
|
}
|
|
182
|
-
function
|
|
241
|
+
function F(e, t) {
|
|
183
242
|
return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
|
|
184
243
|
}
|
|
185
|
-
var
|
|
186
|
-
function
|
|
187
|
-
if (
|
|
244
|
+
var I = /* @__PURE__ */ new Set(), L = !1, R = 0;
|
|
245
|
+
function z() {
|
|
246
|
+
if (R = 0, I.size === 0 || typeof window > "u") return;
|
|
188
247
|
let e = window.innerHeight;
|
|
189
|
-
for (let t of
|
|
248
|
+
for (let t of I) {
|
|
190
249
|
if (t.pointerActive?.()) continue;
|
|
191
250
|
let n = t.element.getBoundingClientRect();
|
|
192
|
-
n.bottom < -64 || n.top > e + 64 || t.onParallax(
|
|
251
|
+
n.bottom < -64 || n.top > e + 64 || t.onParallax(F(n, e));
|
|
193
252
|
}
|
|
194
253
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
254
|
+
function B() {
|
|
255
|
+
R === 0 && (R = requestAnimationFrame(z));
|
|
197
256
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
257
|
+
function ie() {
|
|
258
|
+
L || typeof window > "u" || (L = !0, window.addEventListener("scroll", B, { passive: !0 }), window.addEventListener("resize", B, { passive: !0 }));
|
|
200
259
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
260
|
+
function ae() {
|
|
261
|
+
I.size > 0 || !L || typeof window > "u" || (L = !1, R !== 0 && (cancelAnimationFrame(R), R = 0), window.removeEventListener("scroll", B), window.removeEventListener("resize", B));
|
|
203
262
|
}
|
|
204
|
-
function
|
|
205
|
-
if (!
|
|
263
|
+
function oe(e, t) {
|
|
264
|
+
if (!re()) return () => {};
|
|
206
265
|
let n = {
|
|
207
266
|
element: e,
|
|
208
267
|
onParallax: t.onParallax,
|
|
209
268
|
pointerActive: t.pointerActive
|
|
210
269
|
};
|
|
211
|
-
return
|
|
212
|
-
|
|
270
|
+
return I.add(n), ie(), n.pointerActive?.() || t.onParallax(F(e.getBoundingClientRect(), window.innerHeight)), () => {
|
|
271
|
+
I.delete(n), ae();
|
|
213
272
|
};
|
|
214
273
|
}
|
|
215
274
|
//#endregion
|
|
216
275
|
//#region src/thumbnail/attachThumbnailParallax.ts
|
|
217
|
-
function
|
|
276
|
+
function se(e) {
|
|
218
277
|
let t = 0, n = 0, r = !1, i = !1, a = !1, o = () => {
|
|
219
278
|
let a = r || i;
|
|
220
279
|
e.classList.toggle("liforma-et--parallax", a), e.classList.toggle("liforma-et--scroll-parallax", i), e.style.setProperty("--liforma-et-parallax-x", String(t)), e.style.setProperty("--liforma-et-parallax-y", String(n));
|
|
221
|
-
}, s =
|
|
280
|
+
}, s = oe(e, {
|
|
222
281
|
onParallax: (e) => {
|
|
223
282
|
i = !0, a || (t = e, n = 0, o());
|
|
224
283
|
},
|
|
@@ -231,7 +290,7 @@ function te(e) {
|
|
|
231
290
|
a = !0, e.pointerType === "mouse" && (r = !0), o();
|
|
232
291
|
}, u = () => {
|
|
233
292
|
let s = a;
|
|
234
|
-
a = !1, r = !1, i && s ? (t =
|
|
293
|
+
a = !1, r = !1, i && s ? (t = F(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
|
|
235
294
|
}, d = (e) => {
|
|
236
295
|
e.pointerType === "mouse" && (r = !0, o());
|
|
237
296
|
}, f = () => {
|
|
@@ -243,45 +302,45 @@ function te(e) {
|
|
|
243
302
|
}
|
|
244
303
|
//#endregion
|
|
245
304
|
//#region src/thumbnail/styles.ts
|
|
246
|
-
var
|
|
247
|
-
function
|
|
248
|
-
if (typeof document > "u" ||
|
|
305
|
+
var ce = ":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.65rem;\n overflow: hidden;\n background: #111;\n color: inherit;\n text-decoration: none;\n cursor: inherit;\n -webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n cursor: pointer;\n}\n\nbutton.liforma-et {\n font: inherit;\n appearance: none;\n}\n\n.liforma-et__placeholder {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n linear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n opacity: 1;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n opacity: 0;\n}\n\n.liforma-et__media {\n opacity: 0;\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n opacity: 1;\n}\n\n.liforma-et__background {\n position: absolute;\n inset: 0;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n )\n scale(var(--liforma-et-bg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et__avatar {\n position: relative;\n z-index: 2;\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n object-position: center bottom;\n transform: scale(var(--liforma-et-avatar-scale))\n translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n );\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n transform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.35;\n --liforma-et-bg-scale: 1.35;\n --liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n transform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n object-fit: cover;\n object-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n position: absolute;\n inset: 0;\n z-index: 3;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center center;\n pointer-events: none;\n transform: translate(\n calc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n calc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n )\n scale(var(--liforma-et-fg-scale));\n transform-origin: center center;\n transition:\n opacity var(--liforma-et-reveal-duration) ease,\n transform 160ms ease;\n}\n\n.liforma-et--parallax {\n --liforma-et-bg-scale: 1.08;\n --liforma-et-fg-scale: 1.05;\n --liforma-et-avatar-scale: 1.08;\n --liforma-et-bg-shift: 10px;\n --liforma-et-fg-shift: 4px;\n --liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n will-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.95;\n --liforma-et-bg-scale: 1.95;\n --liforma-et-fg-scale: 1.95;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n --liforma-et-avatar-scale: 1.42;\n --liforma-et-bg-scale: 1.42;\n --liforma-et-fg-scale: 1.42;\n --liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n transition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-et {\n --liforma-et-reveal-duration: 0ms;\n }\n\n .liforma-et--parallax {\n --liforma-et-bg-scale: 1;\n --liforma-et-fg-scale: 1;\n --liforma-et-avatar-scale: 1;\n --liforma-et-bg-shift: 0px;\n --liforma-et-fg-shift: 0px;\n --liforma-et-avatar-shift: 0px;\n }\n\n .liforma-et--parallax.liforma-et--fit-face {\n --liforma-et-avatar-scale: 1.85;\n --liforma-et-bg-scale: 1.85;\n --liforma-et-fg-scale: 1.85;\n }\n\n .liforma-et__background,\n .liforma-et__foreground,\n .liforma-et__avatar {\n transition: none;\n }\n}", le = !1;
|
|
306
|
+
function V(e) {
|
|
307
|
+
if (typeof document > "u" || le) return;
|
|
249
308
|
if (document.querySelector("style[data-liforma-et]")) {
|
|
250
|
-
|
|
309
|
+
le = !0;
|
|
251
310
|
return;
|
|
252
311
|
}
|
|
253
312
|
let t = document.createElement("style");
|
|
254
|
-
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t),
|
|
313
|
+
t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), le = !0;
|
|
255
314
|
}
|
|
256
315
|
//#endregion
|
|
257
316
|
//#region src/widget/styles.ts
|
|
258
|
-
var re = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", ie = "liforma-experience-widget-styles";
|
|
259
|
-
function
|
|
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 fe(e = ue) {
|
|
260
319
|
if (typeof document > "u") return;
|
|
261
|
-
let t = document.getElementById(
|
|
320
|
+
let t = document.getElementById(de);
|
|
262
321
|
if (t) {
|
|
263
322
|
t.textContent = e;
|
|
264
323
|
return;
|
|
265
324
|
}
|
|
266
325
|
let n = document.createElement("style");
|
|
267
|
-
n.id =
|
|
326
|
+
n.id = de, n.textContent = e, document.head.append(n);
|
|
268
327
|
}
|
|
269
328
|
//#endregion
|
|
270
329
|
//#region src/shims/apiBaseUrl.ts
|
|
271
|
-
var
|
|
272
|
-
function
|
|
330
|
+
var pe = "https://api.liforma.ai", me = "http://localhost:3001";
|
|
331
|
+
function he() {
|
|
273
332
|
let e = globalThis.__LIFORMA_API_BASE_URL;
|
|
274
333
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
275
334
|
if (typeof document > "u") return null;
|
|
276
335
|
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();
|
|
277
336
|
return t ? t.replace(/\/$/, "") : null;
|
|
278
337
|
}
|
|
279
|
-
function
|
|
280
|
-
return
|
|
338
|
+
function H() {
|
|
339
|
+
return he() || (y() ? me : pe);
|
|
281
340
|
}
|
|
282
341
|
//#endregion
|
|
283
342
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
284
|
-
function
|
|
343
|
+
function ge(e) {
|
|
285
344
|
if (!e || typeof e != "object") return null;
|
|
286
345
|
let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
|
|
287
346
|
return n ? {
|
|
@@ -290,10 +349,10 @@ function le(e) {
|
|
|
290
349
|
...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
|
|
291
350
|
} : null;
|
|
292
351
|
}
|
|
293
|
-
async function
|
|
352
|
+
async function _e(e, t) {
|
|
294
353
|
let n = e.trim();
|
|
295
354
|
if (!n) throw Error("Experience preview requires experienceId.");
|
|
296
|
-
let r = (t?.apiBaseUrl ??
|
|
355
|
+
let r = (t?.apiBaseUrl ?? H()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
|
|
297
356
|
method: "GET",
|
|
298
357
|
headers: { Accept: "application/json" },
|
|
299
358
|
signal: t?.signal
|
|
@@ -313,7 +372,7 @@ async function ue(e, t) {
|
|
|
313
372
|
throw Error("Experience preview returned invalid JSON.");
|
|
314
373
|
}
|
|
315
374
|
if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
|
|
316
|
-
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l =
|
|
375
|
+
let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = ge(o.galleryThumb);
|
|
317
376
|
if (!l) throw Error("Experience preview is missing gallery thumb images.");
|
|
318
377
|
return {
|
|
319
378
|
experienceId: s || n,
|
|
@@ -323,7 +382,7 @@ async function ue(e, t) {
|
|
|
323
382
|
}
|
|
324
383
|
//#endregion
|
|
325
384
|
//#region src/v2/errors/LiformaError.ts
|
|
326
|
-
var
|
|
385
|
+
var U = class extends Error {
|
|
327
386
|
code;
|
|
328
387
|
requestId;
|
|
329
388
|
status;
|
|
@@ -332,16 +391,16 @@ var B = class extends Error {
|
|
|
332
391
|
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;
|
|
333
392
|
}
|
|
334
393
|
};
|
|
335
|
-
function
|
|
394
|
+
function ve(e) {
|
|
336
395
|
if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
|
|
337
396
|
}
|
|
338
|
-
function
|
|
397
|
+
function ye(e, t, n) {
|
|
339
398
|
let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
|
|
340
399
|
try {
|
|
341
400
|
i = JSON.parse(t);
|
|
342
401
|
} catch {}
|
|
343
|
-
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 } =
|
|
344
|
-
return new
|
|
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 } = ve(a) ?? ve(i) ?? {};
|
|
403
|
+
return new U(u, {
|
|
345
404
|
code: l,
|
|
346
405
|
requestId: d,
|
|
347
406
|
status: e,
|
|
@@ -350,37 +409,37 @@ function fe(e, t, n) {
|
|
|
350
409
|
}
|
|
351
410
|
//#endregion
|
|
352
411
|
//#region src/v2/api/captureAttribution.ts
|
|
353
|
-
var
|
|
354
|
-
function
|
|
412
|
+
var be = 128, W = /[\u0000-\u001f\u007f]/g;
|
|
413
|
+
function G(e) {
|
|
355
414
|
if (!e) return;
|
|
356
|
-
let t = e.replace(
|
|
357
|
-
if (t) return t.slice(0,
|
|
415
|
+
let t = e.replace(W, "").trim();
|
|
416
|
+
if (t) return t.slice(0, be);
|
|
358
417
|
}
|
|
359
|
-
function
|
|
418
|
+
function xe(e) {
|
|
360
419
|
let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
|
|
361
420
|
return {
|
|
362
|
-
...
|
|
363
|
-
...
|
|
364
|
-
...
|
|
365
|
-
...
|
|
366
|
-
...
|
|
421
|
+
...G(t.get("utm_source")) ? { utmSource: G(t.get("utm_source")) } : {},
|
|
422
|
+
...G(t.get("utm_medium")) ? { utmMedium: G(t.get("utm_medium")) } : {},
|
|
423
|
+
...G(t.get("utm_campaign")) ? { utmCampaign: G(t.get("utm_campaign")) } : {},
|
|
424
|
+
...G(t.get("utm_content")) ? { utmContent: G(t.get("utm_content")) } : {},
|
|
425
|
+
...G(t.get("utm_term")) ? { utmTerm: G(t.get("utm_term")) } : {}
|
|
367
426
|
};
|
|
368
427
|
}
|
|
369
|
-
function
|
|
428
|
+
function Se(e) {
|
|
370
429
|
if (e === !1) return;
|
|
371
430
|
if (e && typeof e == "object") {
|
|
372
431
|
let t = {
|
|
373
|
-
...
|
|
374
|
-
...
|
|
375
|
-
...
|
|
376
|
-
...
|
|
377
|
-
...
|
|
378
|
-
...
|
|
432
|
+
...G(e.utmSource) ? { utmSource: G(e.utmSource) } : {},
|
|
433
|
+
...G(e.utmMedium) ? { utmMedium: G(e.utmMedium) } : {},
|
|
434
|
+
...G(e.utmCampaign) ? { utmCampaign: G(e.utmCampaign) } : {},
|
|
435
|
+
...G(e.utmContent) ? { utmContent: G(e.utmContent) } : {},
|
|
436
|
+
...G(e.utmTerm) ? { utmTerm: G(e.utmTerm) } : {},
|
|
437
|
+
...G(e.referrer) ? { referrer: G(e.referrer) } : {}
|
|
379
438
|
};
|
|
380
439
|
return Object.keys(t).length ? t : void 0;
|
|
381
440
|
}
|
|
382
441
|
if (typeof window > "u") return;
|
|
383
|
-
let t =
|
|
442
|
+
let t = xe(window.location?.search), n = G(document.referrer || void 0), r = {
|
|
384
443
|
...t,
|
|
385
444
|
...n ? { referrer: n } : {}
|
|
386
445
|
};
|
|
@@ -388,19 +447,19 @@ function he(e) {
|
|
|
388
447
|
}
|
|
389
448
|
//#endregion
|
|
390
449
|
//#region src/v2/api/sessionEndpointRequest.ts
|
|
391
|
-
function
|
|
450
|
+
function Ce(e) {
|
|
392
451
|
let t = e.locale?.trim();
|
|
393
452
|
if (t) return t;
|
|
394
453
|
let n = e.language?.trim();
|
|
395
454
|
if (n) return n;
|
|
396
455
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
397
456
|
}
|
|
398
|
-
function
|
|
457
|
+
function we(e) {
|
|
399
458
|
let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
|
|
400
459
|
if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
|
|
401
460
|
return t || n || void 0;
|
|
402
461
|
}
|
|
403
|
-
function
|
|
462
|
+
function Te(e, t) {
|
|
404
463
|
let n = e.trim();
|
|
405
464
|
if (!n) throw Error("sessionEndpoint must not be empty.");
|
|
406
465
|
if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
|
|
@@ -408,7 +467,7 @@ function _e(e, t) {
|
|
|
408
467
|
if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
|
|
409
468
|
let i = t.experienceId.trim();
|
|
410
469
|
if (!i) throw Error("sessionEndpoint requires experienceId.");
|
|
411
|
-
let a =
|
|
470
|
+
let a = Ce(t), o = we(t), s = t.idempotencyKey?.trim();
|
|
412
471
|
return {
|
|
413
472
|
url: r.toString(),
|
|
414
473
|
init: {
|
|
@@ -427,7 +486,7 @@ function _e(e, t) {
|
|
|
427
486
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
428
487
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
429
488
|
...(() => {
|
|
430
|
-
let e =
|
|
489
|
+
let e = Se(t.attribution);
|
|
431
490
|
return e ? { attribution: e } : {};
|
|
432
491
|
})(),
|
|
433
492
|
...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
|
|
@@ -437,16 +496,16 @@ function _e(e, t) {
|
|
|
437
496
|
}
|
|
438
497
|
//#endregion
|
|
439
498
|
//#region src/v2/types/sessionLaunch.ts
|
|
440
|
-
function
|
|
499
|
+
function K(e) {
|
|
441
500
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
442
501
|
}
|
|
443
|
-
function
|
|
502
|
+
function q(e) {
|
|
444
503
|
return typeof e == "boolean";
|
|
445
504
|
}
|
|
446
|
-
function
|
|
447
|
-
if (!
|
|
505
|
+
function Ee(e) {
|
|
506
|
+
if (!K(e)) return null;
|
|
448
507
|
let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
|
|
449
|
-
return !
|
|
508
|
+
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 : {
|
|
450
509
|
speech: {
|
|
451
510
|
input: t.input,
|
|
452
511
|
output: t.output,
|
|
@@ -457,8 +516,8 @@ function ve(e) {
|
|
|
457
516
|
tools: { enabled: i.enabled }
|
|
458
517
|
};
|
|
459
518
|
}
|
|
460
|
-
function
|
|
461
|
-
return !
|
|
519
|
+
function De(e) {
|
|
520
|
+
return !K(e) || !q(e.avatar) || !q(e.speechInput) || !q(e.speechOutput) || !q(e.tools) || !q(e.externalAudio) ? null : {
|
|
462
521
|
speech: {
|
|
463
522
|
input: e.speechInput,
|
|
464
523
|
output: e.speechOutput,
|
|
@@ -469,12 +528,12 @@ function K(e) {
|
|
|
469
528
|
tools: { enabled: e.tools }
|
|
470
529
|
};
|
|
471
530
|
}
|
|
472
|
-
function
|
|
473
|
-
return
|
|
531
|
+
function Oe(e) {
|
|
532
|
+
return Ee(e) ?? De(e);
|
|
474
533
|
}
|
|
475
|
-
function
|
|
476
|
-
if (!
|
|
477
|
-
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 =
|
|
534
|
+
function ke(e) {
|
|
535
|
+
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 = Oe(e.capabilities), l = J(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;
|
|
478
537
|
if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
|
|
479
538
|
return {
|
|
480
539
|
id: t,
|
|
@@ -490,11 +549,11 @@ function be(e) {
|
|
|
490
549
|
...d ? { createdAt: d } : {}
|
|
491
550
|
};
|
|
492
551
|
}
|
|
493
|
-
function
|
|
552
|
+
function J(e) {
|
|
494
553
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
495
554
|
let t = [];
|
|
496
555
|
for (let n of e) {
|
|
497
|
-
if (!
|
|
556
|
+
if (!K(n)) continue;
|
|
498
557
|
let e = n.axis === "locale" || n.axis === "secondaryLocale" ? n.axis : null, r = typeof n.requested == "string" ? n.requested.trim() : "", i = typeof n.resolved == "string" ? n.resolved.trim() : "";
|
|
499
558
|
!e || !r || !i || n.reason !== "voice_unsupported" || t.push({
|
|
500
559
|
axis: e,
|
|
@@ -505,104 +564,104 @@ function xe(e) {
|
|
|
505
564
|
}
|
|
506
565
|
return t.length > 0 ? t : void 0;
|
|
507
566
|
}
|
|
508
|
-
function
|
|
567
|
+
function Ae(e) {
|
|
509
568
|
let t = e.localeVoiceFallbacks;
|
|
510
569
|
if (t?.length) for (let e of t) {
|
|
511
570
|
let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
|
|
512
571
|
console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
|
|
513
572
|
}
|
|
514
573
|
}
|
|
515
|
-
function
|
|
516
|
-
if (!
|
|
574
|
+
function je(e) {
|
|
575
|
+
if (!K(e)) throw Error("Session Launch response must be a JSON object.");
|
|
517
576
|
let t = typeof e.launch == "string" ? e.launch.trim() : "";
|
|
518
577
|
if (!t) throw Error("Session Launch response is missing launch.");
|
|
519
|
-
let n =
|
|
520
|
-
return
|
|
578
|
+
let n = ke(e.session);
|
|
579
|
+
return Ae(n), {
|
|
521
580
|
session: n,
|
|
522
581
|
launch: t
|
|
523
582
|
};
|
|
524
583
|
}
|
|
525
584
|
//#endregion
|
|
526
585
|
//#region src/v2/api/mintPublicSession.ts
|
|
527
|
-
function
|
|
586
|
+
function Me() {
|
|
528
587
|
try {
|
|
529
588
|
if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
|
|
530
589
|
} catch {}
|
|
531
590
|
}
|
|
532
|
-
function
|
|
591
|
+
function Ne(e) {
|
|
533
592
|
return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
|
|
534
593
|
}
|
|
535
|
-
function
|
|
536
|
-
let n =
|
|
594
|
+
function Pe(e, t) {
|
|
595
|
+
let n = Me(), r = Ne(t.code), i = t.message.trim(), a = t.details ?? {};
|
|
537
596
|
if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
|
|
538
597
|
if (i.includes(e) && i.includes("allowed origin")) return t;
|
|
539
598
|
let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
|
|
540
|
-
return new
|
|
599
|
+
return new U(`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.`, {
|
|
541
600
|
code: "ORIGIN_NOT_ALLOWED",
|
|
542
601
|
requestId: t.requestId,
|
|
543
602
|
status: t.status,
|
|
544
603
|
details: a
|
|
545
604
|
});
|
|
546
605
|
}
|
|
547
|
-
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new
|
|
606
|
+
return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new U(`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”.`, {
|
|
548
607
|
code: "BROWSER_EMBEDS_DISABLED",
|
|
549
608
|
requestId: t.requestId,
|
|
550
609
|
status: t.status,
|
|
551
610
|
details: a
|
|
552
|
-
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new
|
|
611
|
+
}) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new U(`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.`, {
|
|
553
612
|
code: "EXPERIENCE_UNAVAILABLE",
|
|
554
613
|
requestId: t.requestId,
|
|
555
614
|
status: t.status,
|
|
556
615
|
details: a
|
|
557
616
|
}) : t;
|
|
558
617
|
}
|
|
559
|
-
function
|
|
618
|
+
function Fe(e) {
|
|
560
619
|
let t = e?.locale?.trim();
|
|
561
620
|
if (t) return t;
|
|
562
621
|
let n = e?.language?.trim();
|
|
563
622
|
if (n) return n;
|
|
564
623
|
if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
|
|
565
624
|
}
|
|
566
|
-
function
|
|
625
|
+
function Ie(e) {
|
|
567
626
|
let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
|
|
568
|
-
if (t && n && t !== n) throw new
|
|
627
|
+
if (t && n && t !== n) throw new U("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
|
|
569
628
|
return t || n || void 0;
|
|
570
629
|
}
|
|
571
|
-
function
|
|
572
|
-
let n = { experienceId: e }, r =
|
|
630
|
+
function Le(e, t) {
|
|
631
|
+
let n = { experienceId: e }, r = Fe(t);
|
|
573
632
|
r && (n.locale = r);
|
|
574
|
-
let i =
|
|
633
|
+
let i = Ie(t);
|
|
575
634
|
i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
|
|
576
|
-
let a =
|
|
635
|
+
let a = Se(t?.attribution);
|
|
577
636
|
return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
|
|
578
637
|
}
|
|
579
|
-
async function
|
|
580
|
-
let n =
|
|
638
|
+
async function Re(e, t) {
|
|
639
|
+
let n = H(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
|
|
581
640
|
method: "POST",
|
|
582
641
|
headers: {
|
|
583
642
|
"Content-Type": "application/json",
|
|
584
643
|
...r ? { "Idempotency-Key": r } : {}
|
|
585
644
|
},
|
|
586
|
-
body: JSON.stringify(
|
|
645
|
+
body: JSON.stringify(Le(e, t))
|
|
587
646
|
});
|
|
588
647
|
if (!i.ok) {
|
|
589
648
|
let t = await i.text();
|
|
590
|
-
throw
|
|
649
|
+
throw Pe(e, ye(i.status, t, i.headers));
|
|
591
650
|
}
|
|
592
651
|
let a;
|
|
593
652
|
try {
|
|
594
653
|
a = await i.json();
|
|
595
654
|
} catch {
|
|
596
|
-
throw new
|
|
655
|
+
throw new U("Browser session mint returned invalid JSON.", {
|
|
597
656
|
code: "INVALID_RESPONSE",
|
|
598
657
|
status: i.status,
|
|
599
658
|
requestId: i.headers.get("Liforma-Request-Id") ?? void 0
|
|
600
659
|
});
|
|
601
660
|
}
|
|
602
|
-
return
|
|
661
|
+
return je(a);
|
|
603
662
|
}
|
|
604
|
-
async function
|
|
605
|
-
let n =
|
|
663
|
+
async function ze(e, t) {
|
|
664
|
+
let n = Te(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
|
|
606
665
|
t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
|
|
607
666
|
let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
|
|
608
667
|
try {
|
|
@@ -615,9 +674,9 @@ async function J(e, t) {
|
|
|
615
674
|
}
|
|
616
675
|
if (!o.ok) {
|
|
617
676
|
let e = await o.text();
|
|
618
|
-
throw
|
|
677
|
+
throw ye(o.status, e, o.headers);
|
|
619
678
|
}
|
|
620
|
-
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new
|
|
679
|
+
if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new U("Session endpoint must return a JSON Session Launch response.", {
|
|
621
680
|
code: "INVALID_RESPONSE",
|
|
622
681
|
status: o.status,
|
|
623
682
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
@@ -626,20 +685,20 @@ async function J(e, t) {
|
|
|
626
685
|
try {
|
|
627
686
|
s = await o.json();
|
|
628
687
|
} catch {
|
|
629
|
-
throw new
|
|
688
|
+
throw new U("Session endpoint returned invalid JSON.", {
|
|
630
689
|
code: "INVALID_RESPONSE",
|
|
631
690
|
status: o.status,
|
|
632
691
|
requestId: o.headers.get("Liforma-Request-Id") ?? void 0
|
|
633
692
|
});
|
|
634
693
|
}
|
|
635
|
-
return
|
|
694
|
+
return je(s);
|
|
636
695
|
}
|
|
637
696
|
//#endregion
|
|
638
697
|
//#region src/v2/conversationProcessor.ts
|
|
639
|
-
function
|
|
698
|
+
function Be(e) {
|
|
640
699
|
return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
|
|
641
700
|
}
|
|
642
|
-
function
|
|
701
|
+
function Ve(e) {
|
|
643
702
|
if (typeof e == "string") {
|
|
644
703
|
let t = e.trim();
|
|
645
704
|
if (!t) throw Error("conversationProcessor returned empty text.");
|
|
@@ -653,24 +712,24 @@ function je(e) {
|
|
|
653
712
|
...e.behavior ? { behavior: e.behavior } : {}
|
|
654
713
|
};
|
|
655
714
|
}
|
|
656
|
-
async function
|
|
715
|
+
async function He(e, t) {
|
|
657
716
|
let n = await e(t);
|
|
658
|
-
return
|
|
717
|
+
return Be(n) ? {
|
|
659
718
|
kind: "stream",
|
|
660
719
|
stream: n
|
|
661
720
|
} : {
|
|
662
721
|
kind: "complete",
|
|
663
|
-
speech:
|
|
722
|
+
speech: Ve(n)
|
|
664
723
|
};
|
|
665
724
|
}
|
|
666
725
|
//#endregion
|
|
667
726
|
//#region src/v2/embed/playerReachability.ts
|
|
668
|
-
var
|
|
669
|
-
function
|
|
727
|
+
var Ue = "3002";
|
|
728
|
+
function We(e) {
|
|
670
729
|
let t = new URL(e);
|
|
671
|
-
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 ||
|
|
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 || Ue}. 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.`;
|
|
672
731
|
}
|
|
673
|
-
async function
|
|
732
|
+
async function Ge(e, t) {
|
|
674
733
|
try {
|
|
675
734
|
await fetch(e, {
|
|
676
735
|
method: "GET",
|
|
@@ -678,25 +737,25 @@ async function Fe(e, t) {
|
|
|
678
737
|
signal: AbortSignal.timeout(8e3)
|
|
679
738
|
});
|
|
680
739
|
} catch {
|
|
681
|
-
throw Error(
|
|
740
|
+
throw Error(We(t));
|
|
682
741
|
}
|
|
683
742
|
}
|
|
684
|
-
function
|
|
743
|
+
function Ke(e, t, n, r) {
|
|
685
744
|
try {
|
|
686
745
|
r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
|
|
687
746
|
} catch (e) {
|
|
688
|
-
throw e instanceof DOMException && e.name === "SecurityError" ? Error(
|
|
747
|
+
throw e instanceof DOMException && e.name === "SecurityError" ? Error(We(n), { cause: e }) : e;
|
|
689
748
|
}
|
|
690
749
|
}
|
|
691
|
-
var
|
|
692
|
-
function
|
|
693
|
-
return typeof e == "number" &&
|
|
750
|
+
var qe = new Set([1, 2]);
|
|
751
|
+
function Je(e) {
|
|
752
|
+
return typeof e == "number" && qe.has(e);
|
|
694
753
|
}
|
|
695
|
-
var
|
|
696
|
-
function
|
|
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.interactionChange".split("."));
|
|
755
|
+
function Xe(e) {
|
|
697
756
|
if (!e || typeof e != "object") return null;
|
|
698
757
|
let t = e;
|
|
699
|
-
if (!
|
|
758
|
+
if (!Je(t.schemaVersion) || !t.type || !Ye.has(t.type)) return null;
|
|
700
759
|
if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
|
|
701
760
|
if (t.type === "fullWindow") {
|
|
702
761
|
let e = t.payload;
|
|
@@ -719,10 +778,10 @@ function Be(e) {
|
|
|
719
778
|
let n = t.payload;
|
|
720
779
|
return !n || typeof n != "object" ? null : t;
|
|
721
780
|
}
|
|
722
|
-
function
|
|
781
|
+
function Ze(e, t, n) {
|
|
723
782
|
let r = e.trim();
|
|
724
783
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
725
|
-
let i = n?.startButton, a = n?.theme, o = n?.showFeedback;
|
|
784
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction;
|
|
726
785
|
return {
|
|
727
786
|
type: "launch",
|
|
728
787
|
schemaVersion: 2,
|
|
@@ -731,24 +790,25 @@ function Ve(e, t, n) {
|
|
|
731
790
|
...t === void 0 ? {} : { session: t },
|
|
732
791
|
...i ? { startButton: i } : {},
|
|
733
792
|
...a ? { theme: a } : {},
|
|
734
|
-
...o === void 0 ? {} : { showFeedback: o }
|
|
793
|
+
...o === void 0 ? {} : { showFeedback: o },
|
|
794
|
+
...s ? { interaction: s } : {}
|
|
735
795
|
}
|
|
736
796
|
};
|
|
737
797
|
}
|
|
738
|
-
function
|
|
798
|
+
function Qe() {
|
|
739
799
|
return {
|
|
740
800
|
type: "parentHello",
|
|
741
801
|
schemaVersion: 2
|
|
742
802
|
};
|
|
743
803
|
}
|
|
744
|
-
function
|
|
804
|
+
function $e(e) {
|
|
745
805
|
return {
|
|
746
806
|
type: "widgetSetChrome",
|
|
747
807
|
schemaVersion: 2,
|
|
748
808
|
payload: { mode: e }
|
|
749
809
|
};
|
|
750
810
|
}
|
|
751
|
-
function
|
|
811
|
+
function et() {
|
|
752
812
|
return {
|
|
753
813
|
type: "widgetToggleAudioSettings",
|
|
754
814
|
schemaVersion: 2,
|
|
@@ -757,8 +817,8 @@ function We() {
|
|
|
757
817
|
}
|
|
758
818
|
//#endregion
|
|
759
819
|
//#region src/v2/embed/fullWindowHost.ts
|
|
760
|
-
var
|
|
761
|
-
function
|
|
820
|
+
var tt = "2147483000";
|
|
821
|
+
function nt(e) {
|
|
762
822
|
let { style: t } = e;
|
|
763
823
|
return {
|
|
764
824
|
position: t.position,
|
|
@@ -776,11 +836,11 @@ function Ke(e) {
|
|
|
776
836
|
maxHeight: t.maxHeight
|
|
777
837
|
};
|
|
778
838
|
}
|
|
779
|
-
function
|
|
839
|
+
function rt(e) {
|
|
780
840
|
let { style: t } = e;
|
|
781
|
-
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 =
|
|
841
|
+
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 = tt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
|
|
782
842
|
}
|
|
783
|
-
function
|
|
843
|
+
function it(e, t) {
|
|
784
844
|
if (delete e.dataset.liformaFullWindow, !t) {
|
|
785
845
|
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 = "";
|
|
786
846
|
return;
|
|
@@ -790,20 +850,20 @@ function Je(e, t) {
|
|
|
790
850
|
}
|
|
791
851
|
//#endregion
|
|
792
852
|
//#region src/v2/embed/iframeHost.ts
|
|
793
|
-
function
|
|
853
|
+
function at(e) {
|
|
794
854
|
return e;
|
|
795
855
|
}
|
|
796
856
|
function Y() {
|
|
797
857
|
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)}`;
|
|
798
858
|
}
|
|
799
|
-
var
|
|
800
|
-
function
|
|
859
|
+
var ot = 3e4;
|
|
860
|
+
function st(e) {
|
|
801
861
|
let t = e.container;
|
|
802
862
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
803
863
|
let n = document.createElement("iframe");
|
|
804
864
|
n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), 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");
|
|
805
865
|
let r = !1, i = !1, a = null, o = t.closest(".liforma-experience-shell") instanceof HTMLElement ? t.closest(".liforma-experience-shell") : t, s = (t) => {
|
|
806
|
-
i !== t && (i = t, t ? (a =
|
|
866
|
+
i !== t && (i = t, t ? (a = nt(o), rt(o)) : (it(o, a), a = null), e.onFullWindowChange?.(t));
|
|
807
867
|
}, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
|
|
808
868
|
p = e, m = t;
|
|
809
869
|
}), g = () => {
|
|
@@ -814,10 +874,10 @@ function Ze(e) {
|
|
|
814
874
|
let i = Date.now();
|
|
815
875
|
if (d > 0 && i - d < 250) return;
|
|
816
876
|
d = i, g();
|
|
817
|
-
let a =
|
|
877
|
+
let a = Ze(t.launch, t.session, t.chrome), o = () => {
|
|
818
878
|
if (r) return;
|
|
819
879
|
let t = n.contentWindow;
|
|
820
|
-
t &&
|
|
880
|
+
t && Ke(t, a, e.playerOrigin);
|
|
821
881
|
};
|
|
822
882
|
o();
|
|
823
883
|
for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
|
|
@@ -825,17 +885,17 @@ function Ze(e) {
|
|
|
825
885
|
r || !l || _(l);
|
|
826
886
|
}, y = () => {
|
|
827
887
|
if (u += 1, u === 1) {
|
|
828
|
-
|
|
888
|
+
Ge(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
|
|
829
889
|
return;
|
|
830
890
|
}
|
|
831
891
|
d = 0, v();
|
|
832
892
|
}, b = () => {
|
|
833
|
-
u > 0 || m?.(Error(
|
|
893
|
+
u > 0 || m?.(Error(We(e.playerOrigin)));
|
|
834
894
|
};
|
|
835
895
|
n.addEventListener("load", y), n.addEventListener("error", b);
|
|
836
896
|
let x = (t) => {
|
|
837
897
|
if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
|
|
838
|
-
let i =
|
|
898
|
+
let i = Xe(t.data);
|
|
839
899
|
if (i) switch (i.type) {
|
|
840
900
|
case "close":
|
|
841
901
|
e.onClose?.(i.payload);
|
|
@@ -874,7 +934,7 @@ function Ze(e) {
|
|
|
874
934
|
e.onUserSpeechEnded?.(i.payload);
|
|
875
935
|
break;
|
|
876
936
|
case "modeChange":
|
|
877
|
-
e.onActivityChange?.(
|
|
937
|
+
e.onActivityChange?.(at(i.payload.mode));
|
|
878
938
|
break;
|
|
879
939
|
case "activityChange":
|
|
880
940
|
e.onActivityChange?.(i.payload.activity);
|
|
@@ -930,8 +990,8 @@ function Ze(e) {
|
|
|
930
990
|
let S = (t, i) => {
|
|
931
991
|
if (r) return;
|
|
932
992
|
let a = n.contentWindow;
|
|
933
|
-
if (!a) throw Error(
|
|
934
|
-
|
|
993
|
+
if (!a) throw Error(We(e.playerOrigin));
|
|
994
|
+
Ke(a, t, e.playerOrigin, i);
|
|
935
995
|
}, C = (e, t = 12e4, n) => {
|
|
936
996
|
let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Y();
|
|
937
997
|
return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
|
|
@@ -948,7 +1008,7 @@ function Ze(e) {
|
|
|
948
1008
|
return h;
|
|
949
1009
|
},
|
|
950
1010
|
postParentHello() {
|
|
951
|
-
S(
|
|
1011
|
+
S(Qe());
|
|
952
1012
|
},
|
|
953
1013
|
postLaunch(e, t, n) {
|
|
954
1014
|
r || (l = {
|
|
@@ -970,10 +1030,10 @@ function Ze(e) {
|
|
|
970
1030
|
throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
|
|
971
1031
|
},
|
|
972
1032
|
postWidgetSetChrome(e) {
|
|
973
|
-
S(
|
|
1033
|
+
S($e(e));
|
|
974
1034
|
},
|
|
975
1035
|
postWidgetToggleAudioSettings() {
|
|
976
|
-
S(
|
|
1036
|
+
S(et());
|
|
977
1037
|
},
|
|
978
1038
|
speak(e) {
|
|
979
1039
|
return C({
|
|
@@ -1095,7 +1155,7 @@ function Ze(e) {
|
|
|
1095
1155
|
audio: e.audio,
|
|
1096
1156
|
byteLength: e.byteLength
|
|
1097
1157
|
}
|
|
1098
|
-
},
|
|
1158
|
+
}, ot, [e.audio]);
|
|
1099
1159
|
},
|
|
1100
1160
|
speechUtteranceSetTranscript(e) {
|
|
1101
1161
|
return C({
|
|
@@ -1167,6 +1227,36 @@ function Ze(e) {
|
|
|
1167
1227
|
}
|
|
1168
1228
|
});
|
|
1169
1229
|
},
|
|
1230
|
+
setStage(e) {
|
|
1231
|
+
return C({
|
|
1232
|
+
type: "setStage",
|
|
1233
|
+
schemaVersion: 2,
|
|
1234
|
+
payload: {
|
|
1235
|
+
correlationId: Y(),
|
|
1236
|
+
stage: e
|
|
1237
|
+
}
|
|
1238
|
+
});
|
|
1239
|
+
},
|
|
1240
|
+
setPipBackground(e) {
|
|
1241
|
+
return C({
|
|
1242
|
+
type: "setPipBackground",
|
|
1243
|
+
schemaVersion: 2,
|
|
1244
|
+
payload: {
|
|
1245
|
+
correlationId: Y(),
|
|
1246
|
+
pipBackground: e
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
},
|
|
1250
|
+
setPipShadow(e) {
|
|
1251
|
+
return C({
|
|
1252
|
+
type: "setPipShadow",
|
|
1253
|
+
schemaVersion: 2,
|
|
1254
|
+
payload: {
|
|
1255
|
+
correlationId: Y(),
|
|
1256
|
+
pipShadow: e
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
},
|
|
1170
1260
|
setInteraction(e) {
|
|
1171
1261
|
return C({
|
|
1172
1262
|
type: "setInteraction",
|
|
@@ -1227,7 +1317,7 @@ function Ze(e) {
|
|
|
1227
1317
|
}
|
|
1228
1318
|
//#endregion
|
|
1229
1319
|
//#region src/v2/embed/readyGate.ts
|
|
1230
|
-
function
|
|
1320
|
+
function ct(e) {
|
|
1231
1321
|
let t, n = !1, r = !1, i = () => {
|
|
1232
1322
|
r || !n || t === void 0 || (r = !0, e(t));
|
|
1233
1323
|
};
|
|
@@ -1242,9 +1332,9 @@ function Qe(e) {
|
|
|
1242
1332
|
}
|
|
1243
1333
|
//#endregion
|
|
1244
1334
|
//#region src/v2/sdkRelease.ts
|
|
1245
|
-
var
|
|
1335
|
+
var lt = `sdk@${{
|
|
1246
1336
|
name: "@liforma/client",
|
|
1247
|
-
version: "0.4.
|
|
1337
|
+
version: "0.4.11",
|
|
1248
1338
|
type: "module",
|
|
1249
1339
|
description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
|
|
1250
1340
|
license: "MIT",
|
|
@@ -1463,50 +1553,50 @@ var $e = `sdk@${{
|
|
|
1463
1553
|
vitest: "^4.1.10",
|
|
1464
1554
|
wrangler: "^4.101.0"
|
|
1465
1555
|
}
|
|
1466
|
-
}.version}`,
|
|
1467
|
-
function
|
|
1556
|
+
}.version}`, ut = "https://player.liforma.ai/embed", dt = "http://localhost:3002/embed";
|
|
1557
|
+
function ft() {
|
|
1468
1558
|
let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
|
|
1469
1559
|
if (e?.trim()) return e.trim().replace(/\/$/, "");
|
|
1470
1560
|
if (typeof document > "u") return null;
|
|
1471
1561
|
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();
|
|
1472
1562
|
return t ? t.replace(/\/$/, "") : null;
|
|
1473
1563
|
}
|
|
1474
|
-
function
|
|
1475
|
-
let e =
|
|
1476
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
1564
|
+
function pt() {
|
|
1565
|
+
let e = ft();
|
|
1566
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : y() ? dt : ut;
|
|
1477
1567
|
}
|
|
1478
|
-
function
|
|
1568
|
+
function mt(e, t) {
|
|
1479
1569
|
return e?.trim() || t?.trim() || void 0;
|
|
1480
1570
|
}
|
|
1481
|
-
function
|
|
1482
|
-
let
|
|
1483
|
-
|
|
1484
|
-
let
|
|
1485
|
-
return
|
|
1571
|
+
function ht(e, t, n, r, i, a, o, s, c, l, u) {
|
|
1572
|
+
let d = (e ?? pt()).replace(/\/$/, ""), f = d.endsWith("/embed") ? d : `${d}/embed`, p = new URL(f), m = n?.trim();
|
|
1573
|
+
m && p.searchParams.set("backdropId", m);
|
|
1574
|
+
let h = r?.trim();
|
|
1575
|
+
return h && p.searchParams.set("avatarId", h), (i === "face" || i === "medium") && p.searchParams.set("fit", i), c === "pip" && p.searchParams.set("stage", "pip"), l === "set" && p.searchParams.set("pipBackground", "set"), u === !1 && p.searchParams.set("pipShadow", "0"), a === "widget" && p.searchParams.set("ui", "widget"), o && p.searchParams.set("close", "1"), t && p.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && p.searchParams.set("cast", String(s)), gt(p.toString());
|
|
1486
1576
|
}
|
|
1487
|
-
function
|
|
1577
|
+
function gt(e) {
|
|
1488
1578
|
if (typeof location > "u") return e;
|
|
1489
1579
|
let t = new URL(e);
|
|
1490
1580
|
return t.searchParams.set("parentOrigin", location.origin), t.toString();
|
|
1491
1581
|
}
|
|
1492
|
-
function
|
|
1582
|
+
function _t(e) {
|
|
1493
1583
|
return new URL(e).origin;
|
|
1494
1584
|
}
|
|
1495
1585
|
//#endregion
|
|
1496
1586
|
//#region src/v2/experienceEvents.ts
|
|
1497
|
-
function
|
|
1587
|
+
function vt() {
|
|
1498
1588
|
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)}`;
|
|
1499
1589
|
}
|
|
1500
|
-
function
|
|
1590
|
+
function yt(e, t, n) {
|
|
1501
1591
|
return {
|
|
1502
|
-
id:
|
|
1592
|
+
id: vt(),
|
|
1503
1593
|
type: e,
|
|
1504
1594
|
sessionId: t,
|
|
1505
1595
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1506
1596
|
data: n
|
|
1507
1597
|
};
|
|
1508
1598
|
}
|
|
1509
|
-
function
|
|
1599
|
+
function bt() {
|
|
1510
1600
|
return {
|
|
1511
1601
|
ready: /* @__PURE__ */ new Set(),
|
|
1512
1602
|
started: /* @__PURE__ */ new Set(),
|
|
@@ -1527,32 +1617,32 @@ function ut() {
|
|
|
1527
1617
|
conversationProcessorError: /* @__PURE__ */ new Set()
|
|
1528
1618
|
};
|
|
1529
1619
|
}
|
|
1530
|
-
function
|
|
1620
|
+
function xt(e, t, n) {
|
|
1531
1621
|
return e[t].add(n), () => e[t].delete(n);
|
|
1532
1622
|
}
|
|
1533
|
-
function
|
|
1623
|
+
function St(e, t, n) {
|
|
1534
1624
|
for (let r of e[t]) r(n);
|
|
1535
1625
|
}
|
|
1536
|
-
function
|
|
1626
|
+
function Ct(e) {
|
|
1537
1627
|
for (let t of Object.keys(e)) e[t].clear();
|
|
1538
1628
|
}
|
|
1539
1629
|
//#endregion
|
|
1540
1630
|
//#region src/v2/speech/types.ts
|
|
1541
|
-
function
|
|
1631
|
+
function wt(e) {
|
|
1542
1632
|
return "data" in e && "format" in e && e.format != null && !("track" in e);
|
|
1543
1633
|
}
|
|
1544
|
-
function
|
|
1634
|
+
function Tt(e) {
|
|
1545
1635
|
return "url" in e && typeof e.url == "string";
|
|
1546
1636
|
}
|
|
1547
|
-
function
|
|
1637
|
+
function Et(e) {
|
|
1548
1638
|
if (!("track" in e)) return !1;
|
|
1549
1639
|
let t = e.track;
|
|
1550
1640
|
return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
|
|
1551
1641
|
}
|
|
1552
|
-
function
|
|
1553
|
-
return !
|
|
1642
|
+
function Dt(e) {
|
|
1643
|
+
return !wt(e) && !Tt(e) && !Et(e) && "encoding" in e && typeof e.encoding == "string";
|
|
1554
1644
|
}
|
|
1555
|
-
var
|
|
1645
|
+
var Ot = [
|
|
1556
1646
|
8e3,
|
|
1557
1647
|
16e3,
|
|
1558
1648
|
22050,
|
|
@@ -1570,14 +1660,14 @@ var vt = [
|
|
|
1570
1660
|
MAX_UTTERANCE_DURATION_MS: 9e4,
|
|
1571
1661
|
MAX_PENDING_WRITES: 8,
|
|
1572
1662
|
DEFAULT_WRITE_TIMEOUT_MS: 5e3
|
|
1573
|
-
},
|
|
1663
|
+
}, kt = class extends Error {
|
|
1574
1664
|
operation;
|
|
1575
1665
|
requiredCapability;
|
|
1576
1666
|
name = "UnsupportedSpeechOperationError";
|
|
1577
1667
|
constructor(e, t) {
|
|
1578
1668
|
super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
|
|
1579
1669
|
}
|
|
1580
|
-
},
|
|
1670
|
+
}, At = class extends Error {
|
|
1581
1671
|
name = "SpeechUtteranceClosedError";
|
|
1582
1672
|
constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
|
|
1583
1673
|
super(e);
|
|
@@ -1587,72 +1677,72 @@ var vt = [
|
|
|
1587
1677
|
constructor(e, t) {
|
|
1588
1678
|
super(e, t);
|
|
1589
1679
|
}
|
|
1590
|
-
},
|
|
1680
|
+
}, jt = class extends Error {
|
|
1591
1681
|
name = "SpeechBufferTimeoutError";
|
|
1592
1682
|
constructor(e = "Timed out waiting for speech buffer capacity.") {
|
|
1593
1683
|
super(e);
|
|
1594
1684
|
}
|
|
1595
1685
|
};
|
|
1596
|
-
function
|
|
1686
|
+
function Mt(e = "none") {
|
|
1597
1687
|
return {
|
|
1598
1688
|
mode: e,
|
|
1599
1689
|
trackedDurationMs: 0,
|
|
1600
1690
|
fallbackDurationMs: 0
|
|
1601
1691
|
};
|
|
1602
1692
|
}
|
|
1603
|
-
function
|
|
1604
|
-
return
|
|
1693
|
+
function Nt(e) {
|
|
1694
|
+
return Ot.includes(e);
|
|
1605
1695
|
}
|
|
1606
|
-
function
|
|
1696
|
+
function Pt(e) {
|
|
1607
1697
|
if (e.encoding !== "pcm_s16le") throw new Z(`Unsupported audio encoding: ${e.encoding}`);
|
|
1608
1698
|
if (e.channels !== 1) throw new Z(`Unsupported channel count: ${e.channels}`);
|
|
1609
|
-
if (!
|
|
1699
|
+
if (!Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1610
1700
|
}
|
|
1611
|
-
function
|
|
1612
|
-
if (
|
|
1613
|
-
|
|
1701
|
+
function Ft(e) {
|
|
1702
|
+
if (wt(e)) {
|
|
1703
|
+
Pt(e.format);
|
|
1614
1704
|
return;
|
|
1615
1705
|
}
|
|
1616
|
-
if (
|
|
1706
|
+
if (Tt(e)) {
|
|
1617
1707
|
if (!e.url.trim()) throw new Z("Audio URL must be non-empty.");
|
|
1618
|
-
if (e.sampleRate !== void 0 && !
|
|
1708
|
+
if (e.sampleRate !== void 0 && !Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1619
1709
|
return;
|
|
1620
1710
|
}
|
|
1621
|
-
if (
|
|
1711
|
+
if (Et(e)) {
|
|
1622
1712
|
if (e.track.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
1623
|
-
if (e.sampleRate !== void 0 && !
|
|
1713
|
+
if (e.sampleRate !== void 0 && !Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1624
1714
|
return;
|
|
1625
1715
|
}
|
|
1626
|
-
if (
|
|
1716
|
+
if (Dt(e)) {
|
|
1627
1717
|
let t = e.encoding.trim().toLowerCase();
|
|
1628
1718
|
if (!t) throw new Z("Encoded audio MIME type is required.");
|
|
1629
1719
|
if (t === "pcm_s16le") throw new Z("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
|
|
1630
|
-
if (e.sampleRate !== void 0 && !
|
|
1720
|
+
if (e.sampleRate !== void 0 && !Nt(e.sampleRate)) throw new Z(`Unsupported sample rate: ${e.sampleRate}`);
|
|
1631
1721
|
return;
|
|
1632
1722
|
}
|
|
1633
1723
|
throw new Z("Unsupported speech.play audio shape.");
|
|
1634
1724
|
}
|
|
1635
|
-
function
|
|
1636
|
-
if (e.format) return
|
|
1725
|
+
function It(e) {
|
|
1726
|
+
if (e.format) return Pt(e.format), e.format;
|
|
1637
1727
|
if (e.track) {
|
|
1638
1728
|
let t = {
|
|
1639
1729
|
encoding: "pcm_s16le",
|
|
1640
1730
|
sampleRate: e.sampleRate ?? 24e3,
|
|
1641
1731
|
channels: 1
|
|
1642
1732
|
};
|
|
1643
|
-
return
|
|
1733
|
+
return Pt(t), t;
|
|
1644
1734
|
}
|
|
1645
1735
|
throw new Z("createUtterance requires format or track.");
|
|
1646
1736
|
}
|
|
1647
|
-
function
|
|
1737
|
+
function Lt(e) {
|
|
1648
1738
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1649
1739
|
}
|
|
1650
|
-
function
|
|
1740
|
+
function Rt(e) {
|
|
1651
1741
|
return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
|
|
1652
1742
|
}
|
|
1653
1743
|
//#endregion
|
|
1654
1744
|
//#region src/byo/pcm.ts
|
|
1655
|
-
function
|
|
1745
|
+
function zt(e) {
|
|
1656
1746
|
let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
|
|
1657
1747
|
for (let t = 0; t < e.length; t++) {
|
|
1658
1748
|
let r = Math.max(-1, Math.min(1, e[t]));
|
|
@@ -1662,11 +1752,11 @@ function kt(e) {
|
|
|
1662
1752
|
}
|
|
1663
1753
|
//#endregion
|
|
1664
1754
|
//#region src/byo/resample.ts
|
|
1665
|
-
function
|
|
1755
|
+
function Bt(e, t, n, r, i) {
|
|
1666
1756
|
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;
|
|
1667
1757
|
return ((a * i + o) * i + s) * i + c;
|
|
1668
1758
|
}
|
|
1669
|
-
function
|
|
1759
|
+
function Vt(e, t) {
|
|
1670
1760
|
if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
|
|
1671
1761
|
if (e === t) return {
|
|
1672
1762
|
fromRate: e,
|
|
@@ -1689,7 +1779,7 @@ function jt(e, t) {
|
|
|
1689
1779
|
let a = [];
|
|
1690
1780
|
for (; i + 2 < r.length - 1;) {
|
|
1691
1781
|
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);
|
|
1692
|
-
a.push(
|
|
1782
|
+
a.push(Bt(r[o], r[e], r[s], r[c], t)), i += n;
|
|
1693
1783
|
}
|
|
1694
1784
|
let o = Math.max(0, Math.floor(i) - 1);
|
|
1695
1785
|
return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
|
|
@@ -1701,7 +1791,7 @@ function jt(e, t) {
|
|
|
1701
1791
|
}
|
|
1702
1792
|
//#endregion
|
|
1703
1793
|
//#region src/byo/audioCapture.ts
|
|
1704
|
-
var
|
|
1794
|
+
var Ht = "liforma-pcm-capture", Ut = `
|
|
1705
1795
|
class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
1706
1796
|
process(inputs) {
|
|
1707
1797
|
const ch = inputs[0] && inputs[0][0];
|
|
@@ -1713,29 +1803,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
|
|
|
1713
1803
|
return true;
|
|
1714
1804
|
}
|
|
1715
1805
|
}
|
|
1716
|
-
registerProcessor('${
|
|
1717
|
-
`,
|
|
1718
|
-
function
|
|
1719
|
-
return
|
|
1806
|
+
registerProcessor('${Ht}', LiformaPcmCaptureProcessor);
|
|
1807
|
+
`, Wt = null;
|
|
1808
|
+
function Gt() {
|
|
1809
|
+
return Wt ||= URL.createObjectURL(new Blob([Ut], { type: "application/javascript" })), Wt;
|
|
1720
1810
|
}
|
|
1721
|
-
function
|
|
1811
|
+
function Kt() {
|
|
1722
1812
|
return window.AudioContext || window.webkitAudioContext || null;
|
|
1723
1813
|
}
|
|
1724
|
-
async function
|
|
1725
|
-
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o =
|
|
1814
|
+
async function qt(e) {
|
|
1815
|
+
let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Kt();
|
|
1726
1816
|
if (!o) throw Error("Web Audio is required for audio capture");
|
|
1727
1817
|
let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
|
|
1728
1818
|
l.gain.value = 0;
|
|
1729
|
-
let u = s.sampleRate, d =
|
|
1819
|
+
let u = s.sampleRate, d = Vt(u, n), f = !1, p = !1, m = (e) => {
|
|
1730
1820
|
if (f || i && !i()) return;
|
|
1731
1821
|
let t = d.push(e);
|
|
1732
|
-
t.length !== 0 && r(
|
|
1822
|
+
t.length !== 0 && r(zt(t));
|
|
1733
1823
|
}, h = () => void 0;
|
|
1734
1824
|
return await (async () => {
|
|
1735
1825
|
if (typeof s.audioWorklet?.addModule != "function") return !1;
|
|
1736
1826
|
try {
|
|
1737
|
-
await s.audioWorklet.addModule(
|
|
1738
|
-
let e = new AudioWorkletNode(s,
|
|
1827
|
+
await s.audioWorklet.addModule(Gt());
|
|
1828
|
+
let e = new AudioWorkletNode(s, Ht, {
|
|
1739
1829
|
numberOfInputs: 1,
|
|
1740
1830
|
numberOfOutputs: 1,
|
|
1741
1831
|
outputChannelCount: [1]
|
|
@@ -1785,7 +1875,7 @@ async function Lt(e) {
|
|
|
1785
1875
|
}
|
|
1786
1876
|
//#endregion
|
|
1787
1877
|
//#region src/v2/speech/captureMediaStreamTrack.ts
|
|
1788
|
-
async function
|
|
1878
|
+
async function Jt(e) {
|
|
1789
1879
|
let { track: t, utterance: n, sampleRate: r, signal: i } = e;
|
|
1790
1880
|
if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Z("MediaStreamTrack is not available in this environment.");
|
|
1791
1881
|
if (t.kind !== "audio") throw new Z("speech.play track must be an audio MediaStreamTrack.");
|
|
@@ -1794,13 +1884,13 @@ async function Rt(e) {
|
|
|
1794
1884
|
s || (s = !0, c?.stop(), c = null);
|
|
1795
1885
|
};
|
|
1796
1886
|
try {
|
|
1797
|
-
c = await
|
|
1887
|
+
c = await qt({
|
|
1798
1888
|
mediaStream: a,
|
|
1799
1889
|
targetSampleRate: r,
|
|
1800
1890
|
shouldSend: () => !s && !i?.aborted,
|
|
1801
1891
|
onPcm: (e) => {
|
|
1802
1892
|
if (s || i?.aborted) return;
|
|
1803
|
-
let t =
|
|
1893
|
+
let t = Lt(e);
|
|
1804
1894
|
o = o.then(async () => {
|
|
1805
1895
|
if (s || i?.aborted) return;
|
|
1806
1896
|
let e = 0;
|
|
@@ -1829,10 +1919,10 @@ async function Rt(e) {
|
|
|
1829
1919
|
}
|
|
1830
1920
|
//#endregion
|
|
1831
1921
|
//#region src/v2/speech/speechController.ts
|
|
1832
|
-
async function
|
|
1833
|
-
if (
|
|
1834
|
-
if (
|
|
1835
|
-
let t =
|
|
1922
|
+
async function Yt(e, t) {
|
|
1923
|
+
if (Et(e)) throw new Z("MediaStreamTrack play is handled on the host before embed.");
|
|
1924
|
+
if (wt(e)) {
|
|
1925
|
+
let t = Lt(e.data);
|
|
1836
1926
|
if (t.byteLength & 1) throw new Z("PCM byte length must be even.");
|
|
1837
1927
|
return {
|
|
1838
1928
|
kind: "pcm",
|
|
@@ -1840,17 +1930,17 @@ async function zt(e, t) {
|
|
|
1840
1930
|
format: e.format
|
|
1841
1931
|
};
|
|
1842
1932
|
}
|
|
1843
|
-
if (
|
|
1933
|
+
if (Tt(e)) return {
|
|
1844
1934
|
kind: "url",
|
|
1845
1935
|
url: e.url.trim(),
|
|
1846
1936
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1847
1937
|
};
|
|
1848
|
-
if (!
|
|
1938
|
+
if (!Dt(e)) throw new Z("Unsupported speech.play audio shape.");
|
|
1849
1939
|
let n;
|
|
1850
1940
|
if (typeof Blob < "u" && e.data instanceof Blob) {
|
|
1851
1941
|
if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
1852
1942
|
n = new Uint8Array(await e.data.arrayBuffer());
|
|
1853
|
-
} else n =
|
|
1943
|
+
} else n = Lt(e.data);
|
|
1854
1944
|
return {
|
|
1855
1945
|
kind: "encoded",
|
|
1856
1946
|
data: n.slice().buffer,
|
|
@@ -1858,10 +1948,10 @@ async function zt(e, t) {
|
|
|
1858
1948
|
...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
|
|
1859
1949
|
};
|
|
1860
1950
|
}
|
|
1861
|
-
function
|
|
1951
|
+
function Xt() {
|
|
1862
1952
|
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)}`;
|
|
1863
1953
|
}
|
|
1864
|
-
function
|
|
1954
|
+
function Zt(e, t = "completed") {
|
|
1865
1955
|
return {
|
|
1866
1956
|
utteranceId: e.speechId,
|
|
1867
1957
|
characterId: e.characterId,
|
|
@@ -1875,13 +1965,13 @@ function Vt(e, t = "completed") {
|
|
|
1875
1965
|
}
|
|
1876
1966
|
};
|
|
1877
1967
|
}
|
|
1878
|
-
function
|
|
1968
|
+
function Qt(e) {
|
|
1879
1969
|
return e instanceof Error ? e : new Z(String(e));
|
|
1880
1970
|
}
|
|
1881
|
-
function
|
|
1971
|
+
function $t(e) {
|
|
1882
1972
|
return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
|
|
1883
1973
|
}
|
|
1884
|
-
var
|
|
1974
|
+
var en = class {
|
|
1885
1975
|
id;
|
|
1886
1976
|
characterId;
|
|
1887
1977
|
result;
|
|
@@ -1910,14 +2000,14 @@ var Wt = class {
|
|
|
1910
2000
|
queue: e.queue,
|
|
1911
2001
|
...e.transcript === void 0 ? {} : { transcript: e.transcript }
|
|
1912
2002
|
}).catch((e) => {
|
|
1913
|
-
throw this.fail(
|
|
2003
|
+
throw this.fail(Qt(e)), Qt(e);
|
|
1914
2004
|
}), this.signal?.addEventListener("abort", () => {
|
|
1915
2005
|
this.cancel();
|
|
1916
2006
|
}, { once: !0 });
|
|
1917
2007
|
}
|
|
1918
2008
|
async write(e, t) {
|
|
1919
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
1920
|
-
let n =
|
|
2009
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new At();
|
|
2010
|
+
let n = Lt(e);
|
|
1921
2011
|
if (n.byteLength & 1) throw new Z("PCM chunk byte length must be even (complete s16 samples).");
|
|
1922
2012
|
if (n.byteLength > X.MAX_CHUNK_BYTES) throw new Z(`PCM chunk exceeds MAX_CHUNK_BYTES (${X.MAX_CHUNK_BYTES}).`);
|
|
1923
2013
|
if (n.byteLength === 0) return;
|
|
@@ -1926,13 +2016,13 @@ var Wt = class {
|
|
|
1926
2016
|
let i = n.byteLength / 2 / this.sampleRate * 1e3;
|
|
1927
2017
|
if (this.bufferedMs + i > X.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Z("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
|
|
1928
2018
|
let a = async () => {
|
|
1929
|
-
if (this.closed || this.settled) throw new
|
|
2019
|
+
if (this.closed || this.settled) throw new At();
|
|
1930
2020
|
let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
|
|
1931
2021
|
utteranceId: this.id,
|
|
1932
2022
|
audio: t.buffer,
|
|
1933
2023
|
byteLength: t.byteLength
|
|
1934
2024
|
}), a = await Promise.race([i, new Promise((e, t) => {
|
|
1935
|
-
setTimeout(() => t(new
|
|
2025
|
+
setTimeout(() => t(new jt()), r);
|
|
1936
2026
|
})]);
|
|
1937
2027
|
this.bufferedMs = Math.max(0, a.bufferedMs);
|
|
1938
2028
|
}, o = this.writeChain.then(a, a);
|
|
@@ -1944,7 +2034,7 @@ var Wt = class {
|
|
|
1944
2034
|
}
|
|
1945
2035
|
}
|
|
1946
2036
|
async setTranscript(e) {
|
|
1947
|
-
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new
|
|
2037
|
+
if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new At();
|
|
1948
2038
|
await this.requireHost().speechUtteranceSetTranscript({
|
|
1949
2039
|
utteranceId: this.id,
|
|
1950
2040
|
transcript: e
|
|
@@ -1961,7 +2051,7 @@ var Wt = class {
|
|
|
1961
2051
|
});
|
|
1962
2052
|
return this.resolve(t), t;
|
|
1963
2053
|
} catch (e) {
|
|
1964
|
-
let t =
|
|
2054
|
+
let t = Qt(e);
|
|
1965
2055
|
throw this.fail(t), t;
|
|
1966
2056
|
}
|
|
1967
2057
|
}
|
|
@@ -1979,11 +2069,11 @@ var Wt = class {
|
|
|
1979
2069
|
characterId: this.characterId,
|
|
1980
2070
|
status: "cancelled",
|
|
1981
2071
|
durationMs: 0,
|
|
1982
|
-
animation:
|
|
2072
|
+
animation: Mt("none")
|
|
1983
2073
|
};
|
|
1984
2074
|
return this.resolve(t), t;
|
|
1985
2075
|
} catch (e) {
|
|
1986
|
-
let t =
|
|
2076
|
+
let t = Qt(e);
|
|
1987
2077
|
throw this.fail(t), t;
|
|
1988
2078
|
}
|
|
1989
2079
|
}
|
|
@@ -1996,7 +2086,7 @@ var Wt = class {
|
|
|
1996
2086
|
return e;
|
|
1997
2087
|
}
|
|
1998
2088
|
resolve(e) {
|
|
1999
|
-
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new
|
|
2089
|
+
this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new At()));
|
|
2000
2090
|
}
|
|
2001
2091
|
fail(e) {
|
|
2002
2092
|
this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
|
|
@@ -2008,7 +2098,7 @@ var Wt = class {
|
|
|
2008
2098
|
}
|
|
2009
2099
|
await new Promise((t, n) => {
|
|
2010
2100
|
let r = setTimeout(() => {
|
|
2011
|
-
n(new
|
|
2101
|
+
n(new jt());
|
|
2012
2102
|
}, e);
|
|
2013
2103
|
this.pendingWriteWaiters.push({
|
|
2014
2104
|
resolve: () => {
|
|
@@ -2027,13 +2117,13 @@ var Wt = class {
|
|
|
2027
2117
|
for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
|
|
2028
2118
|
}
|
|
2029
2119
|
};
|
|
2030
|
-
function
|
|
2120
|
+
function tn(e) {
|
|
2031
2121
|
let t = null, n = (t, n) => {
|
|
2032
|
-
if (!e.getCapabilities()[n]) throw new
|
|
2122
|
+
if (!e.getCapabilities()[n]) throw new kt(t, n);
|
|
2033
2123
|
}, r = {
|
|
2034
2124
|
async speak(r) {
|
|
2035
2125
|
if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
|
|
2036
|
-
let i =
|
|
2126
|
+
let i = Rt(r.queue ?? "append");
|
|
2037
2127
|
i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
|
|
2038
2128
|
let a = e.getIframeHost();
|
|
2039
2129
|
if (!a) throw new Z("Speech session is not attached.");
|
|
@@ -2053,41 +2143,41 @@ function Gt(e) {
|
|
|
2053
2143
|
return;
|
|
2054
2144
|
}
|
|
2055
2145
|
t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
|
|
2056
|
-
t.removeEventListener("abort", s), n(
|
|
2146
|
+
t.removeEventListener("abort", s), n(Zt(e, "completed"));
|
|
2057
2147
|
}, (a) => {
|
|
2058
|
-
if (t.removeEventListener("abort", s),
|
|
2148
|
+
if (t.removeEventListener("abort", s), $t(a)) {
|
|
2059
2149
|
n({
|
|
2060
2150
|
utteranceId: "utt_interrupted",
|
|
2061
2151
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2062
2152
|
status: "interrupted",
|
|
2063
2153
|
durationMs: 0,
|
|
2064
2154
|
transcript: r.text,
|
|
2065
|
-
animation:
|
|
2155
|
+
animation: Mt("none")
|
|
2066
2156
|
});
|
|
2067
2157
|
return;
|
|
2068
2158
|
}
|
|
2069
|
-
i(
|
|
2159
|
+
i(Qt(a));
|
|
2070
2160
|
});
|
|
2071
2161
|
});
|
|
2072
2162
|
}
|
|
2073
2163
|
try {
|
|
2074
|
-
return
|
|
2164
|
+
return Zt(await o, "completed");
|
|
2075
2165
|
} catch (t) {
|
|
2076
|
-
if (
|
|
2166
|
+
if ($t(t)) return {
|
|
2077
2167
|
utteranceId: "utt_interrupted",
|
|
2078
2168
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2079
2169
|
status: "interrupted",
|
|
2080
2170
|
durationMs: 0,
|
|
2081
2171
|
transcript: r.text,
|
|
2082
|
-
animation:
|
|
2172
|
+
animation: Mt("none")
|
|
2083
2173
|
};
|
|
2084
|
-
throw
|
|
2174
|
+
throw Qt(t);
|
|
2085
2175
|
}
|
|
2086
2176
|
},
|
|
2087
2177
|
async play(i) {
|
|
2088
|
-
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"),
|
|
2178
|
+
if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Ft(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
|
|
2089
2179
|
let a = i.queue ?? "append";
|
|
2090
|
-
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)),
|
|
2180
|
+
if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), Et(i.audio)) {
|
|
2091
2181
|
let e = i.audio.sampleRate ?? 24e3;
|
|
2092
2182
|
return r.createUtterance({
|
|
2093
2183
|
format: {
|
|
@@ -2103,7 +2193,7 @@ function Gt(e) {
|
|
|
2103
2193
|
}
|
|
2104
2194
|
let o = e.getIframeHost();
|
|
2105
2195
|
if (!o) throw new Z("Speech session is not attached.");
|
|
2106
|
-
let s = await
|
|
2196
|
+
let s = await Yt(i.audio, i.signal);
|
|
2107
2197
|
return o.speechPlay({
|
|
2108
2198
|
source: s,
|
|
2109
2199
|
characterId: i.characterId,
|
|
@@ -2115,13 +2205,13 @@ function Gt(e) {
|
|
|
2115
2205
|
},
|
|
2116
2206
|
createUtterance(r) {
|
|
2117
2207
|
e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
|
|
2118
|
-
let i =
|
|
2208
|
+
let i = It(r);
|
|
2119
2209
|
if (r.track && r.track.kind !== "audio") throw new Z("createUtterance track must be an audio MediaStreamTrack.");
|
|
2120
2210
|
let a = r.queue ?? "replace-active";
|
|
2121
2211
|
if (a !== "replace-active" && a !== "replace-all") throw new Z("createUtterance queue must be replace-active or replace-all.");
|
|
2122
2212
|
e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
|
|
2123
|
-
let o = new
|
|
2124
|
-
id:
|
|
2213
|
+
let o = new en({
|
|
2214
|
+
id: Xt(),
|
|
2125
2215
|
characterId: r.characterId ?? e.getActiveCharacterId(),
|
|
2126
2216
|
format: i,
|
|
2127
2217
|
queue: a,
|
|
@@ -2133,7 +2223,7 @@ function Gt(e) {
|
|
|
2133
2223
|
t === o && (t = null);
|
|
2134
2224
|
}), r.track && (async () => {
|
|
2135
2225
|
try {
|
|
2136
|
-
if (await
|
|
2226
|
+
if (await Jt({
|
|
2137
2227
|
track: r.track,
|
|
2138
2228
|
utterance: o,
|
|
2139
2229
|
sampleRate: i.sampleRate,
|
|
@@ -2161,16 +2251,16 @@ function Gt(e) {
|
|
|
2161
2251
|
}
|
|
2162
2252
|
//#endregion
|
|
2163
2253
|
//#region src/v2/types/sessionInteraction.ts
|
|
2164
|
-
function
|
|
2254
|
+
function nn(e) {
|
|
2165
2255
|
let t = e?.trim();
|
|
2166
2256
|
return t === "full" || t === "face" || t === "medium" ? t : void 0;
|
|
2167
2257
|
}
|
|
2168
2258
|
//#endregion
|
|
2169
2259
|
//#region src/v2/experience.ts
|
|
2170
|
-
function
|
|
2260
|
+
function rn(e) {
|
|
2171
2261
|
return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
|
|
2172
2262
|
}
|
|
2173
|
-
var
|
|
2263
|
+
var an = class e {
|
|
2174
2264
|
bootstrap;
|
|
2175
2265
|
conversationProcessor;
|
|
2176
2266
|
iframeHost = null;
|
|
@@ -2184,19 +2274,22 @@ var Jt = class e {
|
|
|
2184
2274
|
closed = !1;
|
|
2185
2275
|
attached = !1;
|
|
2186
2276
|
pendingFit = null;
|
|
2277
|
+
pendingStage = null;
|
|
2278
|
+
pendingPipBackground = null;
|
|
2279
|
+
pendingPipShadow = null;
|
|
2187
2280
|
lastInteraction = null;
|
|
2188
2281
|
closeHandlers = [];
|
|
2189
|
-
eventRegistry =
|
|
2282
|
+
eventRegistry = bt();
|
|
2190
2283
|
readyEnvelope = null;
|
|
2191
2284
|
startedEnvelope = null;
|
|
2192
2285
|
sessionMintedEnvelope = null;
|
|
2193
2286
|
conversationCache = [];
|
|
2194
2287
|
speech;
|
|
2195
2288
|
constructor(e) {
|
|
2196
|
-
this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech =
|
|
2289
|
+
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 = tn({
|
|
2197
2290
|
getIframeHost: () => this.iframeHost,
|
|
2198
2291
|
assertSessionStarted: () => this.assertSessionStarted(),
|
|
2199
|
-
getCapabilities: () =>
|
|
2292
|
+
getCapabilities: () => on(this.resolvedSession),
|
|
2200
2293
|
getActiveCharacterId: () => "character_unknown",
|
|
2201
2294
|
onProcessorInterrupt: () => {
|
|
2202
2295
|
this.processorAbortController?.abort(), this.processorAbortController = null;
|
|
@@ -2279,7 +2372,7 @@ var Jt = class e {
|
|
|
2279
2372
|
return null;
|
|
2280
2373
|
}
|
|
2281
2374
|
on(e, t) {
|
|
2282
|
-
let n =
|
|
2375
|
+
let n = xt(this.eventRegistry, e, t);
|
|
2283
2376
|
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;
|
|
2284
2377
|
}
|
|
2285
2378
|
async attach(e) {
|
|
@@ -2293,13 +2386,13 @@ var Jt = class e {
|
|
|
2293
2386
|
if (this.closed) throw Error("Session has ended.");
|
|
2294
2387
|
if (this.attached && this.iframeHost) return this.createPlayerFacade();
|
|
2295
2388
|
this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
|
|
2296
|
-
let t = this.bootstrap.embedBaseUrl ??
|
|
2389
|
+
let t = this.bootstrap.embedBaseUrl ?? pt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = ht(t, n, r ? void 0 : mt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, rn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow), a = _t(i), o = null, s = new Promise((e) => {
|
|
2297
2390
|
o = e;
|
|
2298
2391
|
}), c = null, l = new Promise((e) => {
|
|
2299
2392
|
c = e;
|
|
2300
|
-
}), u =
|
|
2393
|
+
}), u = ct((e) => {
|
|
2301
2394
|
this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
|
|
2302
|
-
}), d = this.bootstrap.onUserTranscript, f =
|
|
2395
|
+
}), d = this.bootstrap.onUserTranscript, f = st({
|
|
2303
2396
|
container: e.container,
|
|
2304
2397
|
src: i,
|
|
2305
2398
|
playerOrigin: a,
|
|
@@ -2365,7 +2458,7 @@ var Jt = class e {
|
|
|
2365
2458
|
onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
|
|
2366
2459
|
});
|
|
2367
2460
|
this.iframeHost = f;
|
|
2368
|
-
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(),
|
|
2461
|
+
let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ze(this.bootstrap.sessionEndpoint, {
|
|
2369
2462
|
experienceId: this.bootstrap.experienceId,
|
|
2370
2463
|
locale: this.bootstrap.locale,
|
|
2371
2464
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
@@ -2377,7 +2470,7 @@ var Jt = class e {
|
|
|
2377
2470
|
attribution: this.bootstrap.attribution,
|
|
2378
2471
|
alreadyConverted: this.bootstrap.alreadyConverted,
|
|
2379
2472
|
signal: this.endpointAbortController.signal
|
|
2380
|
-
})) : this.bootstrap.kind === "public" ?
|
|
2473
|
+
})) : this.bootstrap.kind === "public" ? Re(this.bootstrap.experienceId, {
|
|
2381
2474
|
locale: this.bootstrap.locale,
|
|
2382
2475
|
secondaryLocale: this.bootstrap.secondaryLocale,
|
|
2383
2476
|
learningLocale: this.bootstrap.learningLocale,
|
|
@@ -2401,7 +2494,7 @@ var Jt = class e {
|
|
|
2401
2494
|
operation: "attach",
|
|
2402
2495
|
message: e instanceof Error ? e.message : String(e),
|
|
2403
2496
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2404
|
-
release:
|
|
2497
|
+
release: lt
|
|
2405
2498
|
});
|
|
2406
2499
|
} catch {}
|
|
2407
2500
|
throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
|
|
@@ -2413,14 +2506,16 @@ var Jt = class e {
|
|
|
2413
2506
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2414
2507
|
this.launchToken = g;
|
|
2415
2508
|
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2416
|
-
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" &&
|
|
2509
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Ae(_), f.postLaunch(g, _, {
|
|
2417
2510
|
startButton: e.startButton,
|
|
2418
2511
|
theme: e.theme,
|
|
2419
|
-
showFeedback: e.showFeedback
|
|
2512
|
+
showFeedback: e.showFeedback,
|
|
2513
|
+
interaction: e.interaction
|
|
2420
2514
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
2421
2515
|
startButton: e.startButton,
|
|
2422
2516
|
theme: e.theme,
|
|
2423
|
-
showFeedback: e.showFeedback
|
|
2517
|
+
showFeedback: e.showFeedback,
|
|
2518
|
+
interaction: e.interaction
|
|
2424
2519
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2425
2520
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
2426
2521
|
})]).catch((e) => {
|
|
@@ -2431,7 +2526,7 @@ var Jt = class e {
|
|
|
2431
2526
|
operation: "attach",
|
|
2432
2527
|
message: e instanceof Error ? e.message : String(e),
|
|
2433
2528
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2434
|
-
release:
|
|
2529
|
+
release: lt
|
|
2435
2530
|
});
|
|
2436
2531
|
} catch {}
|
|
2437
2532
|
throw e;
|
|
@@ -2445,11 +2540,11 @@ var Jt = class e {
|
|
|
2445
2540
|
operation: "attach",
|
|
2446
2541
|
message: e instanceof Error ? e.message : String(e),
|
|
2447
2542
|
stack: e instanceof Error ? e.stack : void 0,
|
|
2448
|
-
release:
|
|
2543
|
+
release: lt
|
|
2449
2544
|
});
|
|
2450
2545
|
} catch {}
|
|
2451
2546
|
throw e;
|
|
2452
|
-
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
|
|
2547
|
+
}), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.pendingStage && await f.setStage(this.pendingStage), this.pendingPipBackground && await f.setPipBackground(this.pendingPipBackground), this.pendingPipShadow !== null && await f.setPipShadow(this.pendingPipShadow), this.createPlayerFacade();
|
|
2453
2548
|
}
|
|
2454
2549
|
async startListening() {
|
|
2455
2550
|
this.assertSessionStarted(), await this.iframeHost.startListening();
|
|
@@ -2473,11 +2568,25 @@ var Jt = class e {
|
|
|
2473
2568
|
this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
|
|
2474
2569
|
}
|
|
2475
2570
|
async setFit(e) {
|
|
2476
|
-
let t =
|
|
2571
|
+
let t = nn(e);
|
|
2477
2572
|
if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
|
|
2478
2573
|
if (this.closed) throw Error("Session has ended.");
|
|
2479
2574
|
this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
|
|
2480
2575
|
}
|
|
2576
|
+
async setStage(e) {
|
|
2577
|
+
if (e !== "fill" && e !== "pip") throw Error("setStage requires \"fill\" or \"pip\".");
|
|
2578
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2579
|
+
this.pendingStage = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setStage(e);
|
|
2580
|
+
}
|
|
2581
|
+
async setPipBackground(e) {
|
|
2582
|
+
if (e !== "none" && e !== "set") throw Error("setPipBackground requires \"none\" or \"set\".");
|
|
2583
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2584
|
+
this.pendingPipBackground = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipBackground(e);
|
|
2585
|
+
}
|
|
2586
|
+
async setPipShadow(e) {
|
|
2587
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2588
|
+
this.pendingPipShadow = e, !(!this.attached || !this.iframeHost) && await this.iframeHost.setPipShadow(e);
|
|
2589
|
+
}
|
|
2481
2590
|
async setInteraction(e) {
|
|
2482
2591
|
if (this.closed) throw Error("Session has ended.");
|
|
2483
2592
|
if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
|
|
@@ -2509,7 +2618,7 @@ var Jt = class e {
|
|
|
2509
2618
|
this.close();
|
|
2510
2619
|
}
|
|
2511
2620
|
destroy() {
|
|
2512
|
-
this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null,
|
|
2621
|
+
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, Ct(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
|
|
2513
2622
|
}
|
|
2514
2623
|
resolveMintInteraction() {
|
|
2515
2624
|
return this.bootstrap.kind === "launch" ? {} : {
|
|
@@ -2521,8 +2630,8 @@ var Jt = class e {
|
|
|
2521
2630
|
return this.resolvedSession?.id ?? "";
|
|
2522
2631
|
}
|
|
2523
2632
|
emitWrapped(e, t) {
|
|
2524
|
-
let n =
|
|
2525
|
-
return
|
|
2633
|
+
let n = yt(e, this.getSessionId(), t);
|
|
2634
|
+
return St(this.eventRegistry, e, n), n;
|
|
2526
2635
|
}
|
|
2527
2636
|
queueProcessorTurn(e) {
|
|
2528
2637
|
if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
|
|
@@ -2531,7 +2640,7 @@ var Jt = class e {
|
|
|
2531
2640
|
let n = this.processorAbortController.signal;
|
|
2532
2641
|
this.processorChain = this.processorChain.then(async () => {
|
|
2533
2642
|
if (!n.aborted) try {
|
|
2534
|
-
let r = await
|
|
2643
|
+
let r = await He(t, {
|
|
2535
2644
|
utteranceId: e.utteranceId,
|
|
2536
2645
|
text: e.text,
|
|
2537
2646
|
conversation: this.conversationCache,
|
|
@@ -2581,7 +2690,7 @@ var Jt = class e {
|
|
|
2581
2690
|
};
|
|
2582
2691
|
}
|
|
2583
2692
|
};
|
|
2584
|
-
function
|
|
2693
|
+
function on(e) {
|
|
2585
2694
|
return e ? {
|
|
2586
2695
|
textSpeech: e.capabilities.speech.output,
|
|
2587
2696
|
externalSpeechAudio: e.capabilities.speech.externalAudio
|
|
@@ -2592,26 +2701,26 @@ function Yt(e) {
|
|
|
2592
2701
|
}
|
|
2593
2702
|
//#endregion
|
|
2594
2703
|
//#region src/widget/dockGeometry.ts
|
|
2595
|
-
var
|
|
2596
|
-
function
|
|
2704
|
+
var sn = "(min-width: 768px)", cn = 24, ln = .5, un = 1200, dn = .85, fn = 9 / 16;
|
|
2705
|
+
function pn() {
|
|
2597
2706
|
if (typeof window > "u") return 800;
|
|
2598
2707
|
let e = window.screen?.availHeight;
|
|
2599
2708
|
return typeof e == "number" && e > 0 ? e : window.innerHeight;
|
|
2600
2709
|
}
|
|
2601
|
-
function
|
|
2602
|
-
let i = Math.max(160, Math.min(t - n * 2, t *
|
|
2603
|
-
return s > a && (s = a, o = s /
|
|
2710
|
+
function mn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = cn, r = typeof window < "u" ? pn() : 800) {
|
|
2711
|
+
let i = Math.max(160, Math.min(t - n * 2, t * dn)), a = Math.max(120, e - n * 2), o = Math.min(r * ln, un, i), s = o * fn;
|
|
2712
|
+
return s > a && (s = a, o = s / fn, o > i && (o = i, s = o * fn)), {
|
|
2604
2713
|
width: Math.round(s),
|
|
2605
2714
|
height: Math.round(o)
|
|
2606
2715
|
};
|
|
2607
2716
|
}
|
|
2608
|
-
function
|
|
2717
|
+
function hn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = cn) {
|
|
2609
2718
|
return {
|
|
2610
2719
|
left: Math.max(r, t - e.width - r),
|
|
2611
2720
|
top: Math.max(r, n - e.height - r)
|
|
2612
2721
|
};
|
|
2613
2722
|
}
|
|
2614
|
-
function
|
|
2723
|
+
function gn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = cn) {
|
|
2615
2724
|
let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
|
|
2616
2725
|
return {
|
|
2617
2726
|
left: Math.min(Math.max(a, e), o),
|
|
@@ -2619,14 +2728,14 @@ function on(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typ
|
|
|
2619
2728
|
};
|
|
2620
2729
|
}
|
|
2621
2730
|
function Q(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
|
|
2622
|
-
return e(
|
|
2731
|
+
return e(sn).matches;
|
|
2623
2732
|
}
|
|
2624
2733
|
//#endregion
|
|
2625
2734
|
//#region src/widget/mountExperienceWidget.ts
|
|
2626
|
-
function
|
|
2735
|
+
function _n(e) {
|
|
2627
2736
|
return e === "bottom-right" || e === "bottom-left" ? e : "static";
|
|
2628
2737
|
}
|
|
2629
|
-
function
|
|
2738
|
+
function vn(e) {
|
|
2630
2739
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
2631
2740
|
let t = typeof e == "string" ? e.trim() : "";
|
|
2632
2741
|
return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
|
|
@@ -2634,10 +2743,10 @@ function cn(e) {
|
|
|
2634
2743
|
function $(e) {
|
|
2635
2744
|
return e === "expanded" || e === "docked";
|
|
2636
2745
|
}
|
|
2637
|
-
var
|
|
2638
|
-
function
|
|
2639
|
-
|
|
2640
|
-
let r =
|
|
2746
|
+
var yn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", bn = "<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>", xn = "<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>", Sn = "<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>";
|
|
2747
|
+
function Cn(e, t, n) {
|
|
2748
|
+
V(ce);
|
|
2749
|
+
let r = v({
|
|
2641
2750
|
galleryThumb: t.galleryThumb,
|
|
2642
2751
|
avatarImage: t.avatarImage,
|
|
2643
2752
|
backgroundImage: t.backgroundImage,
|
|
@@ -2663,9 +2772,9 @@ function pn(e, t, n) {
|
|
|
2663
2772
|
let e = document.createElement("img");
|
|
2664
2773
|
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);
|
|
2665
2774
|
}
|
|
2666
|
-
return e.replaceChildren(i), n?.parallax === !1 ? () => {} :
|
|
2775
|
+
return e.replaceChildren(i), n?.parallax === !1 ? () => {} : se(i);
|
|
2667
2776
|
}
|
|
2668
|
-
function
|
|
2777
|
+
function wn(e) {
|
|
2669
2778
|
return e.startButton ? {
|
|
2670
2779
|
...e.startButton,
|
|
2671
2780
|
label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
|
|
@@ -2677,7 +2786,7 @@ function mn(e) {
|
|
|
2677
2786
|
variant: "primary"
|
|
2678
2787
|
};
|
|
2679
2788
|
}
|
|
2680
|
-
function
|
|
2789
|
+
function Tn(e) {
|
|
2681
2790
|
let t = !1, n = () => {
|
|
2682
2791
|
t || e();
|
|
2683
2792
|
}, r = () => {
|
|
@@ -2697,12 +2806,12 @@ function hn(e) {
|
|
|
2697
2806
|
t = !0, window.removeEventListener("load", r), i?.();
|
|
2698
2807
|
};
|
|
2699
2808
|
}
|
|
2700
|
-
function
|
|
2701
|
-
|
|
2809
|
+
function En(e, t) {
|
|
2810
|
+
fe(ue);
|
|
2702
2811
|
let n = t.experienceId?.trim();
|
|
2703
2812
|
if (!n) throw Error("ExperienceWidget requires experienceId.");
|
|
2704
|
-
let r = t.prefetch ?? "onExpand", i =
|
|
2705
|
-
a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset",
|
|
2813
|
+
let r = t.prefetch ?? "onExpand", i = _n(t.position), a = document.createElement("div");
|
|
2814
|
+
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", vn(t.offset));
|
|
2706
2815
|
let o = document.createElement("button");
|
|
2707
2816
|
o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
|
|
2708
2817
|
let s = document.createElement("div");
|
|
@@ -2722,168 +2831,171 @@ function gn(e, t) {
|
|
|
2722
2831
|
let m = document.createElement("span");
|
|
2723
2832
|
m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
|
|
2724
2833
|
let h = document.createElement("button");
|
|
2725
|
-
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML =
|
|
2834
|
+
h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = xn, h.setAttribute("aria-label", "Reduce");
|
|
2726
2835
|
let g = document.createElement("button");
|
|
2727
|
-
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML =
|
|
2836
|
+
g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = yn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
|
|
2728
2837
|
let _ = document.createElement("button");
|
|
2729
|
-
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML =
|
|
2838
|
+
_.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = bn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
|
|
2730
2839
|
let v = document.createElement("div");
|
|
2731
2840
|
v.className = "liforma-ew__stage";
|
|
2732
2841
|
let y = document.createElement("div");
|
|
2733
2842
|
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);
|
|
2734
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0,
|
|
2843
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, ee = "", k = null, te = null, A = null, j = null, M = null, N = null, P = null, ne = 0, re = 0, F = null, I = !1, L = new AbortController(), R = t.parallax !== !1, z = () => {
|
|
2735
2844
|
let e = a.dataset.state;
|
|
2736
2845
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
2737
|
-
},
|
|
2738
|
-
|
|
2739
|
-
},
|
|
2740
|
-
|
|
2741
|
-
},
|
|
2846
|
+
}, B = () => {
|
|
2847
|
+
A !== null && (clearTimeout(A), A = null);
|
|
2848
|
+
}, ie = () => {
|
|
2849
|
+
j !== null && (clearTimeout(j), j = null), a.classList.remove("liforma-ew--layout-settling");
|
|
2850
|
+
}, ae = () => {
|
|
2742
2851
|
for (let e of [
|
|
2743
2852
|
f,
|
|
2744
2853
|
l,
|
|
2745
2854
|
p
|
|
2746
2855
|
]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
2747
2856
|
p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
|
|
2748
|
-
},
|
|
2857
|
+
}, oe = (e, t, n, r) => {
|
|
2749
2858
|
let i = (i) => {
|
|
2750
2859
|
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";
|
|
2751
2860
|
};
|
|
2752
2861
|
i(f), i(l);
|
|
2753
2862
|
let a = p.offsetWidth || 120;
|
|
2754
2863
|
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";
|
|
2755
|
-
},
|
|
2864
|
+
}, se = (e, t) => {
|
|
2756
2865
|
if (z() !== "docked") return;
|
|
2757
|
-
let n =
|
|
2758
|
-
|
|
2759
|
-
},
|
|
2866
|
+
let n = mn(), r = gn(e - ne, t - re, n);
|
|
2867
|
+
M = r.left, N = r.top, oe(r.left, r.top, n.width, n.height);
|
|
2868
|
+
}, ce = (e, t) => {
|
|
2760
2869
|
if (z() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
2761
|
-
let n =
|
|
2762
|
-
|
|
2763
|
-
},
|
|
2764
|
-
|
|
2870
|
+
let n = mn(), r = M ?? f.getBoundingClientRect().left, i = N ?? f.getBoundingClientRect().top, a = gn(r + e, i + t, n);
|
|
2871
|
+
M = a.left, N = a.top, oe(a.left, a.top, n.width, n.height);
|
|
2872
|
+
}, le = (e) => {
|
|
2873
|
+
F === "toolbar" && (P === null || e.pointerId !== P || (e.preventDefault(), se(e.clientX, e.clientY)));
|
|
2765
2874
|
}, V = (e) => {
|
|
2766
|
-
if (
|
|
2767
|
-
let t =
|
|
2768
|
-
|
|
2769
|
-
},
|
|
2770
|
-
if (S || z() !== "docked" || !Q() ||
|
|
2771
|
-
|
|
2875
|
+
if (P === null || e && e.pointerId !== P) return;
|
|
2876
|
+
let t = F;
|
|
2877
|
+
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", le), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
|
|
2878
|
+
}, de = (e, t, n) => {
|
|
2879
|
+
if (S || z() !== "docked" || !Q() || P !== null) return;
|
|
2880
|
+
P = n, F = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2772
2881
|
let r = f.getBoundingClientRect();
|
|
2773
|
-
|
|
2774
|
-
},
|
|
2775
|
-
if (S || z() !== "docked" || !Q() ||
|
|
2776
|
-
|
|
2882
|
+
ne = e - r.left, re = t - r.top, I || (I = !0, window.addEventListener("pointermove", le), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
|
|
2883
|
+
}, pe = (e) => {
|
|
2884
|
+
if (S || z() !== "docked" || !Q() || P !== null) return;
|
|
2885
|
+
P = e.pointerId, F = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
2777
2886
|
let t = f.getBoundingClientRect();
|
|
2778
|
-
|
|
2887
|
+
M = t.left, N = t.top;
|
|
2779
2888
|
}, me = (e) => {
|
|
2780
|
-
|
|
2889
|
+
F === "player" && (P === null || e.pointerId !== P || ce(e.dx, e.dy));
|
|
2781
2890
|
}, he = (e) => {
|
|
2782
|
-
|
|
2783
|
-
},
|
|
2891
|
+
F === "player" && (P === null || e.pointerId !== P || V());
|
|
2892
|
+
}, H = () => {
|
|
2784
2893
|
let e = Q(), t = z();
|
|
2785
2894
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
2786
2895
|
h.hidden = !0;
|
|
2787
2896
|
return;
|
|
2788
2897
|
}
|
|
2789
|
-
h.hidden = !1, t === "docked" ? (h.innerHTML =
|
|
2898
|
+
h.hidden = !1, t === "docked" ? (h.innerHTML = Sn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = xn, h.setAttribute("aria-label", "Reduce"));
|
|
2790
2899
|
}, ge = (e) => {
|
|
2791
|
-
let t =
|
|
2792
|
-
n =
|
|
2793
|
-
},
|
|
2900
|
+
let t = mn(), n = e && M !== null && N !== null ? gn(M, N, t) : hn(t);
|
|
2901
|
+
n = gn(n.left, n.top, t), M = n.left, N = n.top, oe(n.left, n.top, t.width, t.height), H();
|
|
2902
|
+
}, U = () => {
|
|
2794
2903
|
a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
|
|
2795
2904
|
requestAnimationFrame(() => {
|
|
2796
2905
|
S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
|
|
2797
2906
|
});
|
|
2798
2907
|
});
|
|
2799
|
-
},
|
|
2800
|
-
if (
|
|
2908
|
+
}, ve = (e) => {
|
|
2909
|
+
if (ie(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
2801
2910
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2802
2911
|
return;
|
|
2803
2912
|
}
|
|
2804
|
-
|
|
2805
|
-
if (
|
|
2913
|
+
j = setTimeout(() => {
|
|
2914
|
+
if (j = null, S || !$(a.dataset.state)) {
|
|
2806
2915
|
a.classList.remove("liforma-ew--layout-settling");
|
|
2807
2916
|
return;
|
|
2808
2917
|
}
|
|
2809
|
-
a.classList.remove("liforma-ew--layout-settling"),
|
|
2918
|
+
a.classList.remove("liforma-ew--layout-settling"), U();
|
|
2810
2919
|
}, 220);
|
|
2811
|
-
},
|
|
2812
|
-
|
|
2813
|
-
|
|
2920
|
+
}, ye = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
2921
|
+
B(), A = setTimeout(() => {
|
|
2922
|
+
A = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
2814
2923
|
}, 280);
|
|
2815
|
-
})),
|
|
2924
|
+
})), be = {
|
|
2816
2925
|
galleryThumb: t.galleryThumb,
|
|
2817
2926
|
avatarImage: t.avatarImage,
|
|
2818
2927
|
backgroundImage: t.backgroundImage,
|
|
2819
2928
|
foregroundImage: t.foregroundImage,
|
|
2820
2929
|
fallbackImage: t.fallbackImage
|
|
2821
|
-
},
|
|
2930
|
+
}, W = (e) => {
|
|
2822
2931
|
if (!e) {
|
|
2823
2932
|
y.hidden = !0, y.textContent = "";
|
|
2824
2933
|
return;
|
|
2825
2934
|
}
|
|
2826
2935
|
y.hidden = !1, y.textContent = e;
|
|
2827
|
-
},
|
|
2936
|
+
}, G = (e) => {
|
|
2828
2937
|
if (!e) {
|
|
2829
2938
|
c.hidden = !0, c.textContent = "";
|
|
2830
2939
|
return;
|
|
2831
2940
|
}
|
|
2832
2941
|
c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
|
|
2833
|
-
}, be = () => {
|
|
2834
|
-
C = !0, o.disabled = !1, ye(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
2835
2942
|
}, xe = () => {
|
|
2943
|
+
C = !0, o.disabled = !1, G(null), r === "onExpand" && t.onPrefetchReady?.();
|
|
2944
|
+
}, Se = () => {
|
|
2836
2945
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
2837
|
-
},
|
|
2838
|
-
|
|
2839
|
-
let t =
|
|
2840
|
-
return t ? (
|
|
2841
|
-
},
|
|
2842
|
-
if (
|
|
2843
|
-
|
|
2946
|
+
}, Ce = (e) => {
|
|
2947
|
+
k?.(), k = null;
|
|
2948
|
+
let t = Cn(s, e, { parallax: R });
|
|
2949
|
+
return t ? (k = t, !0) : !1;
|
|
2950
|
+
}, we = () => {
|
|
2951
|
+
if (Ce(be)) {
|
|
2952
|
+
xe();
|
|
2844
2953
|
return;
|
|
2845
2954
|
}
|
|
2846
|
-
|
|
2955
|
+
G("Loading…"), _e(n, { signal: L.signal }).then((e) => {
|
|
2847
2956
|
if (!S) {
|
|
2848
|
-
if (!
|
|
2849
|
-
|
|
2957
|
+
if (!Ce({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
|
|
2958
|
+
xe();
|
|
2850
2959
|
}
|
|
2851
2960
|
}).catch((e) => {
|
|
2852
|
-
if (S ||
|
|
2961
|
+
if (S || L.signal.aborted) return;
|
|
2853
2962
|
let n = e instanceof Error ? e : Error(String(e));
|
|
2854
|
-
|
|
2963
|
+
G("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
|
|
2855
2964
|
});
|
|
2856
|
-
},
|
|
2965
|
+
}, Te = () => ({
|
|
2857
2966
|
experienceId: n,
|
|
2858
2967
|
ui: "widget",
|
|
2859
2968
|
...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
|
|
2860
2969
|
...t.locale ? { locale: t.locale } : {},
|
|
2970
|
+
...t.secondaryLocale ? { secondaryLocale: t.secondaryLocale } : {},
|
|
2971
|
+
...t.learningLocale ? { learningLocale: t.learningLocale } : {},
|
|
2861
2972
|
...t.language ? { language: t.language } : {},
|
|
2862
2973
|
...t.mode ? { mode: t.mode } : {},
|
|
2863
2974
|
...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
|
|
2864
2975
|
...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
|
|
2865
2976
|
...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
|
|
2866
2977
|
...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
|
|
2867
|
-
}),
|
|
2978
|
+
}), K = () => ({
|
|
2868
2979
|
...t.fit ? { fit: t.fit } : {},
|
|
2869
|
-
startButton:
|
|
2870
|
-
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
|
|
2980
|
+
startButton: wn(t),
|
|
2981
|
+
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
|
|
2982
|
+
...t.interaction ? { interaction: t.interaction } : {}
|
|
2871
2983
|
}), q = (e = !0) => {
|
|
2872
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
2984
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", W(null), typeof document < "u" && (ee = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
|
|
2873
2985
|
}, Ee = () => {
|
|
2874
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked",
|
|
2986
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", W(null), typeof document < "u" && (document.body.style.overflow = ee), ge(!0), H(), b?.setWidgetChrome("docked");
|
|
2875
2987
|
}, De = (e) => {
|
|
2876
2988
|
e.on("started", () => {
|
|
2877
|
-
S || (D = !0, a.dataset.live = "true",
|
|
2989
|
+
S || (D = !0, a.dataset.live = "true", W(null), t.onStarted?.(), $(a.dataset.state) && U());
|
|
2878
2990
|
}), e.on("feedback", (e) => {
|
|
2879
2991
|
S || t.onFeedback?.(e);
|
|
2880
2992
|
}), e.on("feedbackFailed", (e) => {
|
|
2881
2993
|
S || t.onFeedbackFailed?.(e);
|
|
2882
2994
|
});
|
|
2883
2995
|
}, Oe = () => {
|
|
2884
|
-
|
|
2996
|
+
ie(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), W(null), typeof document < "u" && (document.body.style.overflow = ee), H();
|
|
2885
2997
|
}, ke = () => {
|
|
2886
|
-
|
|
2998
|
+
B(), ie(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
2887
2999
|
let e = b;
|
|
2888
3000
|
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");
|
|
2889
3001
|
}, J = () => {
|
|
@@ -2891,33 +3003,33 @@ function gn(e, t) {
|
|
|
2891
3003
|
if (V(), x = !1, b && E) {
|
|
2892
3004
|
let e = b;
|
|
2893
3005
|
(async () => {
|
|
2894
|
-
D && (await
|
|
3006
|
+
D && (await ye(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Oe(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && Se(), t.onCollapsed?.(), t.onClose?.());
|
|
2895
3007
|
})();
|
|
2896
3008
|
return;
|
|
2897
3009
|
}
|
|
2898
3010
|
ke(), Oe(), t.onCollapsed?.(), t.onClose?.();
|
|
2899
3011
|
}
|
|
2900
3012
|
}, Ae = () => {
|
|
2901
|
-
S || Q() && z() === "expanded" &&
|
|
3013
|
+
S || Q() && z() === "expanded" && ve(() => {
|
|
2902
3014
|
Ee();
|
|
2903
3015
|
});
|
|
2904
3016
|
}, je = () => {
|
|
2905
|
-
S || z() === "docked" && (V(),
|
|
2906
|
-
|
|
3017
|
+
S || z() === "docked" && (V(), ve(() => {
|
|
3018
|
+
ae(), q(!1), b?.setWidgetChrome("expanded");
|
|
2907
3019
|
}));
|
|
2908
3020
|
}, Me = () => {
|
|
2909
|
-
!b || !D || (
|
|
3021
|
+
!b || !D || (B(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, U());
|
|
2910
3022
|
}, Ne = () => {
|
|
2911
|
-
!b || !E || D || (
|
|
3023
|
+
!b || !E || D || (B(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
2912
3024
|
}, Pe = (e) => {
|
|
2913
|
-
S || e !== O && !D || (
|
|
3025
|
+
S || e !== O && !D || (B(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, D && U());
|
|
2914
3026
|
}, Fe = () => {
|
|
2915
3027
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
2916
3028
|
T = !0;
|
|
2917
3029
|
let e = O;
|
|
2918
3030
|
l.hidden = !1, (async () => {
|
|
2919
3031
|
try {
|
|
2920
|
-
let t = await
|
|
3032
|
+
let t = await an.startSession(Te());
|
|
2921
3033
|
if (S || e !== O) {
|
|
2922
3034
|
t.destroy();
|
|
2923
3035
|
return;
|
|
@@ -2925,9 +3037,9 @@ function gn(e, t) {
|
|
|
2925
3037
|
b = t, De(t);
|
|
2926
3038
|
let n = await t.attach({
|
|
2927
3039
|
container: l,
|
|
2928
|
-
...
|
|
3040
|
+
...K(),
|
|
2929
3041
|
onWidgetReady: () => {
|
|
2930
|
-
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") :
|
|
3042
|
+
S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : Se());
|
|
2931
3043
|
},
|
|
2932
3044
|
onWidgetExpand: () => {
|
|
2933
3045
|
Pe(e);
|
|
@@ -2936,7 +3048,7 @@ function gn(e, t) {
|
|
|
2936
3048
|
S || ze(e);
|
|
2937
3049
|
},
|
|
2938
3050
|
onWidgetDragStart: (e) => {
|
|
2939
|
-
S ||
|
|
3051
|
+
S || pe(e);
|
|
2940
3052
|
},
|
|
2941
3053
|
onWidgetDragMove: (e) => {
|
|
2942
3054
|
S || me(e);
|
|
@@ -2945,7 +3057,7 @@ function gn(e, t) {
|
|
|
2945
3057
|
S || he(e);
|
|
2946
3058
|
},
|
|
2947
3059
|
onPlayerStatusChange: (e) => {
|
|
2948
|
-
S || e === "error" && $(a.dataset.state) &&
|
|
3060
|
+
S || e === "error" && $(a.dataset.state) && W("Could not load the experience.");
|
|
2949
3061
|
}
|
|
2950
3062
|
});
|
|
2951
3063
|
if (S || e !== O) {
|
|
@@ -2976,7 +3088,7 @@ function gn(e, t) {
|
|
|
2976
3088
|
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 () => {
|
|
2977
3089
|
try {
|
|
2978
3090
|
q();
|
|
2979
|
-
let t = await
|
|
3091
|
+
let t = await an.startSession(Te());
|
|
2980
3092
|
if (S || e !== O) {
|
|
2981
3093
|
t.destroy();
|
|
2982
3094
|
return;
|
|
@@ -2984,12 +3096,12 @@ function gn(e, t) {
|
|
|
2984
3096
|
b = t, De(t);
|
|
2985
3097
|
let n = await t.attach({
|
|
2986
3098
|
container: v,
|
|
2987
|
-
...
|
|
3099
|
+
...K(),
|
|
2988
3100
|
onWidgetAudioSettings: (e) => {
|
|
2989
3101
|
S || ze(e);
|
|
2990
3102
|
},
|
|
2991
3103
|
onWidgetDragStart: (e) => {
|
|
2992
|
-
S ||
|
|
3104
|
+
S || pe(e);
|
|
2993
3105
|
},
|
|
2994
3106
|
onWidgetDragMove: (e) => {
|
|
2995
3107
|
S || me(e);
|
|
@@ -2998,7 +3110,7 @@ function gn(e, t) {
|
|
|
2998
3110
|
S || he(e);
|
|
2999
3111
|
},
|
|
3000
3112
|
onPlayerStatusChange: (e) => {
|
|
3001
|
-
S || (e === "error" ?
|
|
3113
|
+
S || (e === "error" ? W("Could not load the experience.") : $(a.dataset.state) && W(null));
|
|
3002
3114
|
}
|
|
3003
3115
|
});
|
|
3004
3116
|
if (S || e !== O) {
|
|
@@ -3011,7 +3123,7 @@ function gn(e, t) {
|
|
|
3011
3123
|
} catch (n) {
|
|
3012
3124
|
if (S || e !== O) return;
|
|
3013
3125
|
let r = n instanceof Error ? n : Error(String(n));
|
|
3014
|
-
|
|
3126
|
+
W(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
|
|
3015
3127
|
} finally {
|
|
3016
3128
|
e === O && (x = !1);
|
|
3017
3129
|
}
|
|
@@ -3043,7 +3155,7 @@ function gn(e, t) {
|
|
|
3043
3155
|
}, Be = (e) => {
|
|
3044
3156
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3045
3157
|
}, Ve = (e) => {
|
|
3046
|
-
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(),
|
|
3158
|
+
z() === "docked" && Q() && (e.target?.closest("button") || (e.preventDefault(), de(e.clientX, e.clientY, e.pointerId)));
|
|
3047
3159
|
}, He = (e) => {
|
|
3048
3160
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), J());
|
|
3049
3161
|
}, Ue = () => {
|
|
@@ -3053,27 +3165,27 @@ function gn(e, t) {
|
|
|
3053
3165
|
je();
|
|
3054
3166
|
return;
|
|
3055
3167
|
}
|
|
3056
|
-
D ?
|
|
3168
|
+
D ? ve(() => {
|
|
3057
3169
|
ge(!0);
|
|
3058
3170
|
}) : ge(!0);
|
|
3059
3171
|
return;
|
|
3060
3172
|
}
|
|
3061
|
-
|
|
3173
|
+
H();
|
|
3062
3174
|
}
|
|
3063
|
-
}, We = typeof window < "u" ? window.matchMedia(
|
|
3175
|
+
}, We = typeof window < "u" ? window.matchMedia(sn) : null, Ge = () => {
|
|
3064
3176
|
if (!S) {
|
|
3065
3177
|
if (z() === "docked" && !Q()) {
|
|
3066
3178
|
je();
|
|
3067
3179
|
return;
|
|
3068
3180
|
}
|
|
3069
|
-
|
|
3181
|
+
H();
|
|
3070
3182
|
}
|
|
3071
3183
|
};
|
|
3072
3184
|
return o.addEventListener("click", Le), d.addEventListener("click", J), _.addEventListener("click", (e) => {
|
|
3073
3185
|
e.stopPropagation(), J();
|
|
3074
|
-
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge),
|
|
3186
|
+
}), h.addEventListener("click", Re), g.addEventListener("click", Be), p.addEventListener("pointerdown", Ve), window.addEventListener("keydown", He), window.addEventListener("resize", Ue), We?.addEventListener("change", Ge), we(), H(), r === "eager" ? queueMicrotask(() => {
|
|
3075
3187
|
S || Fe();
|
|
3076
|
-
}) : r === "idle" && (
|
|
3188
|
+
}) : r === "idle" && (te = Tn(() => {
|
|
3077
3189
|
S || Fe();
|
|
3078
3190
|
})), {
|
|
3079
3191
|
root: a,
|
|
@@ -3089,11 +3201,11 @@ function gn(e, t) {
|
|
|
3089
3201
|
Fe();
|
|
3090
3202
|
},
|
|
3091
3203
|
destroy() {
|
|
3092
|
-
S || (S = !0, V(),
|
|
3204
|
+
S || (S = !0, V(), te?.(), te = null, L.abort(), k?.(), k = null, window.removeEventListener("keydown", He), window.removeEventListener("resize", Ue), We?.removeEventListener("change", Ge), ke(), Oe(), e.replaceChildren());
|
|
3093
3205
|
}
|
|
3094
3206
|
};
|
|
3095
3207
|
}
|
|
3096
3208
|
//#endregion
|
|
3097
|
-
export {
|
|
3209
|
+
export { ce as EXPERIENCE_THUMBNAIL_CSS, ue as EXPERIENCE_WIDGET_CSS, an as Experience, U as LiformaError, X as SPEECH_LIMITS, jt as SpeechBufferTimeoutError, Z as SpeechRuntimeError, At as SpeechUtteranceClosedError, kt as UnsupportedSpeechOperationError, ne as attachImageReady, P as attachLazyThumb, oe as attachScrollLinkedParallax, w as buildHostedLaunchUrl, V as ensureExperienceThumbnailStyles, fe as ensureExperienceWidgetStyles, _e as fetchExperiencePreview, j as getDefaultLazyRootMargin, F as horizontalParallaxFromViewportY, ye as liformaErrorFromResponse, En as mountExperienceWidget, n as navigateOnExperienceClose, T as resolveThumbnailHref, S as resolveThumbnailInteraction, v as resolveThumbnailLayers, r as thumbnailFitClass, _ as toGalleryThumbUrl, Ae as warnLocaleVoiceFallbacks };
|
|
3098
3210
|
|
|
3099
3211
|
//# sourceMappingURL=index.js.map
|