@liforma/client 0.4.13 → 0.4.14

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +4 -4
  3. package/dist/next/index.js +687 -618
  4. package/dist/next/index.js.map +1 -1
  5. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  6. package/dist/next/thumbnail/index.d.ts +1 -0
  7. package/dist/next/thumbnail/index.d.ts.map +1 -1
  8. package/dist/next/thumbnail/locationPlate.d.ts +3 -3
  9. package/dist/next/thumbnail/locationPlate.d.ts.map +1 -1
  10. package/dist/next/thumbnail/plateDelivery.d.ts +18 -0
  11. package/dist/next/thumbnail/plateDelivery.d.ts.map +1 -0
  12. package/dist/next/thumbnail/plateDelivery.test.d.ts +2 -0
  13. package/dist/next/thumbnail/plateDelivery.test.d.ts.map +1 -0
  14. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +1 -1
  15. package/dist/next/thumbnail.js +147 -91
  16. package/dist/next/thumbnail.js.map +1 -1
  17. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  18. package/dist/next/v2/experience.d.ts +3 -0
  19. package/dist/next/v2/experience.d.ts.map +1 -1
  20. package/dist/next/v2/shims/embedBaseUrl.d.ts +4 -1
  21. package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
  22. package/dist/npm/index.js +23 -10
  23. package/dist/npm/index.js.map +1 -1
  24. package/dist/npm/thumbnail/index.d.ts +1 -0
  25. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  26. package/dist/npm/thumbnail/index.js +106 -70
  27. package/dist/npm/thumbnail/index.js.map +1 -1
  28. package/dist/npm/thumbnail/locationPlate.d.ts +3 -3
  29. package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -1
  30. package/dist/npm/thumbnail/plateDelivery.d.ts +18 -0
  31. package/dist/npm/thumbnail/plateDelivery.d.ts.map +1 -0
  32. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +1 -1
  33. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  34. package/dist/npm/v2/experience.d.ts +3 -0
  35. package/dist/npm/v2/experience.d.ts.map +1 -1
  36. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  37. package/dist/npm/v2/shims/embedBaseUrl.d.ts +4 -1
  38. package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
  39. package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
  40. package/dist/react/component/experienceComponentTypes.d.ts +3 -0
  41. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  42. package/dist/react/index.js +693 -618
  43. package/dist/react/index.js.map +1 -1
  44. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  45. package/dist/react/thumbnail/index.d.ts +1 -0
  46. package/dist/react/thumbnail/index.d.ts.map +1 -1
  47. package/dist/react/thumbnail/locationPlate.d.ts +3 -3
  48. package/dist/react/thumbnail/locationPlate.d.ts.map +1 -1
  49. package/dist/react/thumbnail/plateDelivery.d.ts +18 -0
  50. package/dist/react/thumbnail/plateDelivery.d.ts.map +1 -0
  51. package/dist/react/thumbnail/plateDelivery.test.d.ts +2 -0
  52. package/dist/react/thumbnail/plateDelivery.test.d.ts.map +1 -0
  53. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +1 -1
  54. package/dist/react/thumbnail.js +147 -91
  55. package/dist/react/thumbnail.js.map +1 -1
  56. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  57. package/dist/react/v2/experience.d.ts +3 -0
  58. package/dist/react/v2/experience.d.ts.map +1 -1
  59. package/dist/react/v2/shims/embedBaseUrl.d.ts +4 -1
  60. package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
  61. package/dist/sdk/v2/client.js +2 -2
  62. package/dist/sdk/v2/client.js.map +1 -1
  63. package/dist/sdk/v2/thumbnail.js +2 -2
  64. package/dist/sdk/v2/thumbnail.js.map +1 -1
  65. package/dist/svelte/Experience.svelte +8 -0
  66. package/dist/svelte/ExperienceThumbnail.svelte +49 -8
  67. package/package.json +4 -1
@@ -31,6 +31,8 @@ function _(e) {
31
31
  embedBaseUrl: e.embedBaseUrl,
32
32
  debug: e.debug,
33
33
  speechOnly: e.speechOnly,
34
+ previewBackground: e.previewBackground,
35
+ previewForeground: e.previewForeground,
34
36
  conversationProcessor: e.conversationProcessor
35
37
  };
36
38
  if (t && e.experienceId && e.sessionEndpoint) return {
@@ -49,6 +51,8 @@ function _(e) {
49
51
  mode: e.mode,
50
52
  speechInputMode: e.speechInputMode,
51
53
  speechOnly: e.speechOnly,
54
+ previewBackground: e.previewBackground,
55
+ previewForeground: e.previewForeground,
52
56
  attribution: e.attribution,
53
57
  alreadyConverted: e.alreadyConverted,
54
58
  conversationProcessor: e.conversationProcessor
@@ -68,6 +72,8 @@ function _(e) {
68
72
  mode: e.mode,
69
73
  speechInputMode: e.speechInputMode,
70
74
  speechOnly: e.speechOnly,
75
+ previewBackground: e.previewBackground,
76
+ previewForeground: e.previewForeground,
71
77
  attribution: e.attribution,
72
78
  alreadyConverted: e.alreadyConverted,
73
79
  conversationProcessor: e.conversationProcessor
@@ -350,7 +356,7 @@ function L(e, t) {
350
356
  //#endregion
351
357
  //#region src/react/Experience.tsx
352
358
  var ne = e(function(e, a) {
353
- let { returnUrl: c, fit: l, stage: u, pipBackground: p, pipShadow: m, startButton: h, theme: g, showFeedback: y, interaction: b, theatreButton: x, theatre: S, onTheatreChange: C, closeButton: w, onReady: T, onStarted: E, onUserTranscript: D, onUserSpeechStarted: O, onUserSpeechEnded: ee, onCharacterSpeechStarted: j, onCharacterSpeechEnded: M, onCharacterFocusChanged: N, onConversationUpdate: F, onMessage: te, onListeningState: I, onActivityChange: ne, onFeedback: re, onFeedbackFailed: ie, onConversationProcessorError: R, onPlayerStatusChange: z, onStateUpdate: ae, onClose: B, onError: oe } = e, se = o({}), ce = o({
359
+ let { returnUrl: c, fit: l, stage: u, pipBackground: p, pipShadow: m, startButton: h, theme: g, showFeedback: y, interaction: b, theatreButton: x, theatre: S, onTheatreChange: C, closeButton: w, onReady: T, onStarted: E, onUserTranscript: D, onUserSpeechStarted: O, onUserSpeechEnded: ee, onCharacterSpeechStarted: j, onCharacterSpeechEnded: M, onCharacterFocusChanged: N, onConversationUpdate: F, onMessage: te, onListeningState: I, onActivityChange: ne, onFeedback: re, onFeedbackFailed: ie, onConversationProcessorError: R, onPlayerStatusChange: ae, onStateUpdate: oe, onClose: z, onError: se } = e, ce = o({}), le = o({
354
360
  fit: l,
355
361
  stage: u,
356
362
  pipBackground: p,
@@ -364,8 +370,8 @@ var ne = e(function(e, a) {
364
370
  theatreButton: x,
365
371
  theatre: S,
366
372
  onTheatreChange: C
367
- }), V = o(P(() => se.current, () => ce.current)), H = o(null), [le, ue] = s(!1), [U, de] = s(null), W = o(null), G = o(null), fe = v(e);
368
- ce.current = {
373
+ }), B = o(P(() => ce.current, () => le.current)), V = o(null), [ue, de] = s(!1), [fe, pe] = s(null), H = o(null), me = o(null), he = v(e);
374
+ le.current = {
369
375
  fit: l,
370
376
  stage: u,
371
377
  pipBackground: p,
@@ -379,7 +385,7 @@ var ne = e(function(e, a) {
379
385
  theatreButton: x,
380
386
  theatre: S,
381
387
  onTheatreChange: C
382
- }, se.current = {
388
+ }, ce.current = {
383
389
  onReady: T,
384
390
  onStarted: E,
385
391
  onUserTranscript: D,
@@ -395,89 +401,89 @@ var ne = e(function(e, a) {
395
401
  onFeedback: re,
396
402
  onFeedbackFailed: ie,
397
403
  onConversationProcessorError: R,
398
- onPlayerStatusChange: z,
399
- onStateUpdate: ae,
400
- onClose: B,
401
- onError: oe
404
+ onPlayerStatusChange: ae,
405
+ onStateUpdate: oe,
406
+ onClose: z,
407
+ onError: se
402
408
  };
403
- let pe = t((e) => {
404
- W.current = e, ue(e !== null);
409
+ let ge = t((e) => {
410
+ H.current = e, de(e !== null);
405
411
  }, []);
406
412
  return r(a, () => ({
407
413
  ready: () => {
408
- let e = H.current;
414
+ let e = V.current;
409
415
  return !e || e.destroyed ? Promise.reject(k()) : e.ready.promise;
410
416
  },
411
417
  started: () => {
412
- let e = H.current;
418
+ let e = V.current;
413
419
  return !e || e.destroyed ? Promise.reject(k()) : e.started.promise;
414
420
  },
415
421
  speech: {
416
- speak: (e) => V.current.withSession((t) => t.speech.speak(e)),
417
- play: (e) => V.current.withSession((t) => t.speech.play(e)),
422
+ speak: (e) => B.current.withSession((t) => t.speech.speak(e)),
423
+ play: (e) => B.current.withSession((t) => t.speech.play(e)),
418
424
  createUtterance: (e) => {
419
- let t = V.current.getActiveInstance();
425
+ let t = B.current.getActiveInstance();
420
426
  if (!t) throw Error("Session has not started. Wait for the player start button and the started event before using speech APIs.");
421
427
  return t.speech.createUtterance(e);
422
428
  },
423
- interrupt: (e) => V.current.withSession((t) => t.speech.interrupt(e))
429
+ interrupt: (e) => B.current.withSession((t) => t.speech.interrupt(e))
424
430
  },
425
- startListening: () => V.current.withSession((e) => e.startListening()),
426
- stopListening: () => V.current.withSession((e) => e.stopListening()),
427
- listenOnce: (e) => V.current.withSession((t) => t.listenOnce(e)),
428
- getSession: () => V.current.getActiveInstance()?.getSession() ?? null,
429
- getManifest: () => V.current.getActiveInstance()?.getManifest() ?? null,
430
- getConversation: () => V.current.getActiveInstance()?.getConversation() ?? [],
431
- focusCharacter: (e) => V.current.withSession((t) => t.focusCharacter(e)),
432
- setFit: (e) => V.current.withSession((t) => t.setFit(e)),
433
- setStage: (e) => V.current.withSession((t) => t.setStage(e)),
434
- setPipBackground: (e) => V.current.withSession((t) => t.setPipBackground(e)),
435
- setPipShadow: (e) => V.current.withSession((t) => t.setPipShadow(e)),
431
+ startListening: () => B.current.withSession((e) => e.startListening()),
432
+ stopListening: () => B.current.withSession((e) => e.stopListening()),
433
+ listenOnce: (e) => B.current.withSession((t) => t.listenOnce(e)),
434
+ getSession: () => B.current.getActiveInstance()?.getSession() ?? null,
435
+ getManifest: () => B.current.getActiveInstance()?.getManifest() ?? null,
436
+ getConversation: () => B.current.getActiveInstance()?.getConversation() ?? [],
437
+ focusCharacter: (e) => B.current.withSession((t) => t.focusCharacter(e)),
438
+ setFit: (e) => B.current.withSession((t) => t.setFit(e)),
439
+ setStage: (e) => B.current.withSession((t) => t.setStage(e)),
440
+ setPipBackground: (e) => B.current.withSession((t) => t.setPipBackground(e)),
441
+ setPipShadow: (e) => B.current.withSession((t) => t.setPipShadow(e)),
436
442
  setTheatre: (e) => {
437
- V.current.getActiveInstance()?.setTheatre(e);
443
+ B.current.getActiveInstance()?.setTheatre(e);
438
444
  },
439
- conversion: (e) => V.current.withSession((t) => t.conversion(e)),
440
- engage: () => V.current.withSession((e) => e.engage()),
441
- end: () => V.current.withSession((e) => e.end())
445
+ conversion: (e) => B.current.withSession((t) => t.conversion(e)),
446
+ engage: () => B.current.withSession((e) => e.engage()),
447
+ end: () => B.current.withSession((e) => e.end())
442
448
  }), []), i(() => {
443
- if (!le || !W.current) return;
444
- let t = W.current, n = V.current, r;
449
+ if (!ue || !H.current) return;
450
+ let t = H.current, n = B.current, r;
445
451
  try {
446
452
  r = { options: _(e) };
447
453
  } catch (e) {
448
454
  r = { error: A(e) };
449
455
  }
450
- let i = n.activateGeneration(t, r, c, de);
451
- return H.current = i, () => {
452
- n.cancelGeneration(i), H.current === i && (H.current = null);
456
+ let i = n.activateGeneration(t, r, c, pe);
457
+ return V.current = i, () => {
458
+ n.cancelGeneration(i), V.current === i && (V.current = null);
453
459
  };
454
460
  }, [
455
- le,
456
- fe,
461
+ ue,
462
+ he,
457
463
  c
458
464
  ]), n(() => {
459
- let e = V.current.getActiveInstance();
465
+ let e = B.current.getActiveInstance();
460
466
  e && e.setFit(l ?? "full");
461
467
  }, [l]), n(() => {
462
- let e = V.current.getActiveInstance();
468
+ let e = B.current.getActiveInstance();
463
469
  e && e.setStage(u ?? "fill");
464
470
  }, [u]), n(() => {
465
- let e = V.current.getActiveInstance();
471
+ let e = B.current.getActiveInstance();
466
472
  e && e.setPipBackground(p ?? "none");
467
473
  }, [p]), n(() => {
468
474
  if (m === void 0) return;
469
- let e = V.current.getActiveInstance();
475
+ let e = B.current.getActiveInstance();
470
476
  e && e.setPipShadow(m);
471
477
  }, [m]), n(() => {
472
478
  if (!x) return;
473
- let e = V.current.getActiveInstance();
479
+ let e = B.current.getActiveInstance();
474
480
  e && e.setTheatre(S === !0);
475
481
  }, [x, S]), n(() => {
476
- let e = G.current;
477
- if (!e || (e.replaceChildren(), !U)) return;
478
- let t = L(e, U);
482
+ let e = me.current;
483
+ if (!e || (e.replaceChildren(), !fe)) return;
484
+ let t = L(e, fe);
479
485
  return () => t.remove();
480
- }, [U]), /* @__PURE__ */ f("div", {
486
+ }, [fe]), /* @__PURE__ */ f("div", {
481
487
  className: "liforma-experience-shell",
482
488
  style: {
483
489
  position: "relative",
@@ -486,17 +492,17 @@ var ne = e(function(e, a) {
486
492
  minHeight: "inherit"
487
493
  },
488
494
  children: [/* @__PURE__ */ d("div", {
489
- ref: G,
495
+ ref: me,
490
496
  className: "liforma-experience-error-host",
491
- "aria-hidden": U ? void 0 : !0,
497
+ "aria-hidden": fe ? void 0 : !0,
492
498
  style: {
493
499
  position: "absolute",
494
500
  inset: 0,
495
501
  zIndex: 20,
496
- pointerEvents: U ? "auto" : "none"
502
+ pointerEvents: fe ? "auto" : "none"
497
503
  }
498
504
  }), /* @__PURE__ */ d("div", {
499
- ref: pe,
505
+ ref: ge,
500
506
  className: "liforma-experience-host",
501
507
  style: {
502
508
  position: "absolute",
@@ -513,15 +519,15 @@ function re(e) {
513
519
  }
514
520
  //#endregion
515
521
  //#region src/thumbnail/locationPlate.ts
516
- var ie = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
522
+ var ie = /(-)(\d+x\d+)(\.(?:webp|avif))(\?|$)/i;
517
523
  function R(e, t) {
518
- return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : e > 800 || t > 450 ? "1672x941" : "800x450";
524
+ return !Number.isFinite(e) || !Number.isFinite(t) || e < 1 || t < 1 || e <= t ? "256x256" : t <= 225 ? "400x225" : e > 800 || t > 450 ? "1672x941" : "800x450";
519
525
  }
520
- function z(e, t) {
526
+ function ae(e, t) {
521
527
  let n = e.trim();
522
528
  return n && n.replace(ie, (e, n, r, i, a) => `${n}${t}${i}${a}`);
523
529
  }
524
- function ae(e, t) {
530
+ function oe(e, t) {
525
531
  let n = () => {
526
532
  t(e.clientWidth, e.clientHeight);
527
533
  };
@@ -529,17 +535,17 @@ function ae(e, t) {
529
535
  let r = new ResizeObserver(n);
530
536
  return r.observe(e), () => r.disconnect();
531
537
  }
532
- var B = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;
533
- function oe(e) {
538
+ var z = /-(256x256|400x225|400x450|800x450|836x971|1672x941|167x94)$/i;
539
+ function se(e) {
534
540
  return e?.trim().replace(/\/$/, "") || "https://cdn.liforma.ai";
535
541
  }
536
- function se(e) {
542
+ function ce(e) {
537
543
  return /^https?:\/\//i.test(e) || e.startsWith("//");
538
544
  }
539
- function ce(e) {
545
+ function le(e) {
540
546
  return e.startsWith("//") ? `https:${e}` : e;
541
547
  }
542
- function V(e) {
548
+ function B(e) {
543
549
  let t = e.indexOf("?");
544
550
  return t === -1 ? {
545
551
  pathname: e,
@@ -549,51 +555,51 @@ function V(e) {
549
555
  search: e.slice(t)
550
556
  };
551
557
  }
552
- function H(e, t, n = "") {
558
+ function V(e, t, n = "") {
553
559
  return `${e}${t.startsWith("/") ? t : `/${t}`}${n}`;
554
560
  }
555
- function le(e, t, n) {
561
+ function ue(e, t, n) {
556
562
  let r = e.trim();
557
563
  if (!r) return r;
558
- let i = oe(n);
559
- if (se(r)) return z(ce(r), t);
560
- let { pathname: a, search: o } = V(r.replace(/\\/g, "/")), s = a;
564
+ let i = se(n);
565
+ if (ce(r)) return ae(le(r), t);
566
+ let { pathname: a, search: o } = B(r.replace(/\\/g, "/")), s = a;
561
567
  if (!s.startsWith("/")) s = `/locations/${s.replace(/^locations\//i, "")}`;
562
- else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? H(i, s, o) : r;
563
- if (/\.webp$/i.test(s) && !B.test(s.replace(/\.webp$/i, ""))) return H(i, s, o);
568
+ else if (!/^\/locations\//i.test(s)) return /^\/avatars\//i.test(s) ? V(i, s, o) : r;
569
+ if (/\.webp$/i.test(s) && !z.test(s.replace(/\.webp$/i, ""))) return V(i, s, o);
564
570
  let c = s.replace(/^\/locations\//i, "").replace(/\.webp$/i, "");
565
- return c = c.replace(B, ""), `${i}/locations/${c}-${t}.webp${o}`;
571
+ return c = c.replace(z, ""), `${i}/locations/${c}-${t}.webp${o}`;
566
572
  }
567
- function ue(e, t) {
573
+ function de(e, t) {
568
574
  let n = e.trim();
569
575
  if (!n) return n;
570
- let r = oe(t);
571
- if (se(n)) return ce(n);
572
- let { pathname: i, search: a } = V(n.replace(/\\/g, "/")), o = i;
576
+ let r = se(t);
577
+ if (ce(n)) return le(n);
578
+ let { pathname: i, search: a } = B(n.replace(/\\/g, "/")), o = i;
573
579
  if (!o.startsWith("/")) if (/^avatars\//i.test(o)) o = `/${o}`;
574
580
  else if (/^[^/]+$/.test(o) && !a) return `${r}/avatars/${o}/256/${o}_neutral.webp`;
575
581
  else return n;
576
582
  if (!/^\/avatars\//i.test(o)) return n;
577
583
  let s = o.replace(/^\/avatars\//i, "").replace(/\/+$/, "");
578
- return s && !s.includes("/") && !a ? `${r}/avatars/${s}/256/${s}_neutral.webp` : H(r, o, a);
584
+ return s && !s.includes("/") && !a ? `${r}/avatars/${s}/256/${s}_neutral.webp` : V(r, o, a);
579
585
  }
580
586
  //#endregion
581
587
  //#region src/thumbnail/toGalleryThumbUrl.ts
582
- var U = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, de = /_CH(\.webp)/i;
583
- function W(e) {
588
+ var fe = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, pe = /_CH(\.webp)/i;
589
+ function H(e) {
584
590
  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("/");
585
591
  }
586
- function G(e, t = "256x256", n) {
592
+ function me(e, t = "256x256", n) {
587
593
  let r = e.trim();
588
594
  if (!r) return r;
589
- if (W(r)) return le(r, t, n);
590
- let i = ue(r, n);
591
- return i = i.replace(U, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(de, "_neutral$1");
595
+ if (H(r)) return ue(r, t, n);
596
+ let i = de(r, n);
597
+ return i = i.replace(fe, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`), i.replace(pe, "_neutral$1");
592
598
  }
593
- function fe(e) {
599
+ function he(e) {
594
600
  let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
595
601
  if (!t) return null;
596
- 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 = oe(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : G(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : le(e, a, o);
602
+ let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "", a = e.locationPlateSize ?? "256x256", o = se(e.cdnBaseUrl), s = e.normalize !== !1, c = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : me(e, a, o), l = (e) => !s && /^https?:\/\//i.test(e.trim()) ? e.trim() : ue(e, a, o);
597
603
  return {
598
604
  avatarImage: c(t),
599
605
  ...n ? { backgroundImage: l(n) } : {},
@@ -603,7 +609,7 @@ function fe(e) {
603
609
  }
604
610
  //#endregion
605
611
  //#region src/shims/localStack.ts
606
- function pe() {
612
+ function ge() {
607
613
  if (globalThis.__LIFORMA_STACK === "local") return !0;
608
614
  if (typeof location > "u") return !1;
609
615
  try {
@@ -614,83 +620,83 @@ function pe() {
614
620
  }
615
621
  //#endregion
616
622
  //#region src/thumbnail/hostedLaunchUrl.ts
617
- var me = "https://player.liforma.ai", he = "http://localhost:3002";
618
- function ge(e) {
623
+ var _e = "https://player.liforma.ai", ve = "http://localhost:3002";
624
+ function U(e) {
619
625
  return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
620
626
  }
621
- function _e(e) {
627
+ function W(e) {
622
628
  let t = e?.trim();
623
- return t ? t.replace(/\/$/, "") : pe() ? he : me;
629
+ return t ? t.replace(/\/$/, "") : ge() ? ve : _e;
624
630
  }
625
- function ve(e) {
626
- let t = e.experienceId.trim(), n = _e(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
631
+ function ye(e) {
632
+ let t = e.experienceId.trim(), n = W(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
627
633
  return i && r.searchParams.set("returnUrl", i), r.toString();
628
634
  }
629
- function ye(e) {
635
+ function be(e) {
630
636
  let t = e.href?.trim();
631
637
  if (t) return t;
632
638
  let n = e.experienceId?.trim();
633
639
  if (!n) return;
634
640
  let r = e.returnUrl?.trim();
635
- return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ve({
641
+ return !r && e.useCurrentPageAsReturnUrl && typeof window < "u" && (r = window.location.href), ye({
636
642
  experienceId: n,
637
643
  ...r ? { returnUrl: r } : {},
638
644
  playerBaseUrl: e.playerBaseUrl
639
645
  });
640
646
  }
641
- function be() {
647
+ function xe() {
642
648
  return typeof window > "u" ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
643
649
  }
644
- var K = 0, xe = [];
645
- function Se() {
646
- return be() ? 4 : Infinity;
650
+ var Se = 0, Ce = [];
651
+ function we() {
652
+ return xe() ? 4 : Infinity;
647
653
  }
648
- function Ce() {
649
- return be() ? 160 : 0;
654
+ function G() {
655
+ return xe() ? 160 : 0;
650
656
  }
651
- function we() {
652
- let e = Se();
653
- for (; K < e && xe.length > 0;) {
654
- let e = xe.shift();
657
+ function Te() {
658
+ let e = we();
659
+ for (; Se < e && Ce.length > 0;) {
660
+ let e = Ce.shift();
655
661
  if (!e || e.cancelled) continue;
656
- K += 1, e.start();
657
- let t = Ce();
662
+ Se += 1, e.start();
663
+ let t = G();
658
664
  if (t <= 0) {
659
- K = Math.max(0, K - 1);
665
+ Se = Math.max(0, Se - 1);
660
666
  continue;
661
667
  }
662
668
  window.setTimeout(() => {
663
- K = Math.max(0, K - 1), we();
669
+ Se = Math.max(0, Se - 1), Te();
664
670
  }, t);
665
671
  }
666
672
  }
667
- function Te(e) {
668
- if (!be()) return e(), () => {};
673
+ function Ee(e) {
674
+ if (!xe()) return e(), () => {};
669
675
  let t = {
670
676
  start: e,
671
677
  cancelled: !1
672
678
  };
673
- return xe.push(t), we(), () => {
679
+ return Ce.push(t), Te(), () => {
674
680
  t.cancelled = !0;
675
681
  };
676
682
  }
677
683
  //#endregion
678
684
  //#region src/thumbnail/lazyLoad.ts
679
- function Ee() {
680
- return be() ? "96px 0px" : "280px 0px";
685
+ function De() {
686
+ return xe() ? "96px 0px" : "280px 0px";
681
687
  }
682
- function De(e) {
688
+ function Oe(e) {
683
689
  let t = e.trim().split(/\s+/)[0] ?? "0px", n = Number.parseFloat(t);
684
690
  return Number.isFinite(n) ? Math.abs(n) : 280;
685
691
  }
686
- function q(e, t) {
692
+ function K(e, t) {
687
693
  if (typeof window > "u") return !1;
688
694
  let n = e.getBoundingClientRect();
689
695
  return n.bottom >= -t && n.top <= window.innerHeight + t;
690
696
  }
691
- function Oe(e, t) {
692
- let { onVisibleChange: n } = t, r = t.rootMargin ?? Ee(), i = De(r), a = !1, o = !1, s = null, c = () => {
693
- o || (s?.(), s = Te(() => {
697
+ function ke(e, t) {
698
+ let { onVisibleChange: n } = t, r = t.rootMargin ?? De(), i = Oe(r), a = !1, o = !1, s = null, c = () => {
699
+ o || (s?.(), s = Ee(() => {
694
700
  s = null, o = !0, n(!0);
695
701
  }));
696
702
  }, l = (e) => {
@@ -712,46 +718,46 @@ function Oe(e, t) {
712
718
  rootMargin: r,
713
719
  threshold: 0
714
720
  });
715
- return u.observe(e), q(e, i) && l(!0), () => {
721
+ return u.observe(e), K(e, i) && l(!0), () => {
716
722
  s?.(), s = null, u.disconnect();
717
723
  };
718
724
  }
719
725
  //#endregion
720
726
  //#region src/thumbnail/scrollParallax.ts
721
- function ke() {
727
+ function Ae() {
722
728
  return typeof window > "u" || window.matchMedia("(prefers-reduced-motion: reduce)").matches ? !1 : window.matchMedia("(hover: none), (pointer: coarse)").matches;
723
729
  }
724
- function Ae(e, t) {
730
+ function je(e, t) {
725
731
  return ((e.top + e.height / 2) / Math.max(t, 1) - .5) * 2;
726
732
  }
727
- var J = /* @__PURE__ */ new Set(), je = !1, Me = 0;
733
+ var q = /* @__PURE__ */ new Set(), Me = !1, J = 0;
728
734
  function Ne() {
729
- if (Me = 0, J.size === 0 || typeof window > "u") return;
735
+ if (J = 0, q.size === 0 || typeof window > "u") return;
730
736
  let e = window.innerHeight;
731
- for (let t of J) {
737
+ for (let t of q) {
732
738
  if (t.pointerActive?.()) continue;
733
739
  let n = t.element.getBoundingClientRect();
734
- n.bottom < -64 || n.top > e + 64 || t.onParallax(Ae(n, e));
740
+ n.bottom < -64 || n.top > e + 64 || t.onParallax(je(n, e));
735
741
  }
736
742
  }
737
743
  function Pe() {
738
- Me === 0 && (Me = requestAnimationFrame(Ne));
744
+ J === 0 && (J = requestAnimationFrame(Ne));
739
745
  }
740
746
  function Fe() {
741
- je || typeof window > "u" || (je = !0, window.addEventListener("scroll", Pe, { passive: !0 }), window.addEventListener("resize", Pe, { passive: !0 }));
747
+ Me || typeof window > "u" || (Me = !0, window.addEventListener("scroll", Pe, { passive: !0 }), window.addEventListener("resize", Pe, { passive: !0 }));
742
748
  }
743
749
  function Ie() {
744
- J.size > 0 || !je || typeof window > "u" || (je = !1, Me !== 0 && (cancelAnimationFrame(Me), Me = 0), window.removeEventListener("scroll", Pe), window.removeEventListener("resize", Pe));
750
+ q.size > 0 || !Me || typeof window > "u" || (Me = !1, J !== 0 && (cancelAnimationFrame(J), J = 0), window.removeEventListener("scroll", Pe), window.removeEventListener("resize", Pe));
745
751
  }
746
752
  function Le(e, t) {
747
- if (!ke()) return () => {};
753
+ if (!Ae()) return () => {};
748
754
  let n = {
749
755
  element: e,
750
756
  onParallax: t.onParallax,
751
757
  pointerActive: t.pointerActive
752
758
  };
753
- return J.add(n), Fe(), n.pointerActive?.() || t.onParallax(Ae(e.getBoundingClientRect(), window.innerHeight)), () => {
754
- J.delete(n), Ie();
759
+ return q.add(n), Fe(), n.pointerActive?.() || t.onParallax(je(e.getBoundingClientRect(), window.innerHeight)), () => {
760
+ q.delete(n), Ie();
755
761
  };
756
762
  }
757
763
  //#endregion
@@ -773,7 +779,7 @@ function Re(e) {
773
779
  a = !0, e.pointerType === "mouse" && (r = !0), o();
774
780
  }, u = () => {
775
781
  let s = a;
776
- a = !1, r = !1, i && s ? (t = Ae(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
782
+ a = !1, r = !1, i && s ? (t = je(e.getBoundingClientRect(), window.innerHeight), n = 0) : i || (t = 0, n = 0), o();
777
783
  }, d = (e) => {
778
784
  e.pointerType === "mouse" && (r = !0, o());
779
785
  }, f = () => {
@@ -796,12 +802,47 @@ function Ve(e) {
796
802
  t.setAttribute("data-liforma-et", ""), t.textContent = e, document.head.appendChild(t), Be = !0;
797
803
  }
798
804
  //#endregion
805
+ //#region src/thumbnail/plateDelivery.ts
806
+ var He = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=", Ue = null;
807
+ function We(e) {
808
+ let t = e.trim();
809
+ if (!t || t.startsWith("blob:") || t.startsWith("data:")) return !1;
810
+ let n = t.split(/[?#]/)[0] ?? t, r = /\/avatars\//i.test(n), i = /\/locations\//i.test(n);
811
+ return !r && !i || /\.depth\.webp$/i.test(n) ? !1 : /\.webp$/i.test(n);
812
+ }
813
+ function Ge(e) {
814
+ if (!We(e)) return null;
815
+ let t = e.search(/[?#]/);
816
+ if (t < 0) return e.replace(/\.webp$/i, ".avif");
817
+ let n = e.slice(0, t), r = e.slice(t);
818
+ return `${n.replace(/\.webp$/i, ".avif")}${r}`;
819
+ }
820
+ function Ke() {
821
+ return typeof Image > "u" ? Promise.resolve(!1) : (Ue ||= new Promise((e) => {
822
+ let t = new Image();
823
+ t.onload = () => e(t.naturalWidth > 0 && t.naturalHeight > 0), t.onerror = () => e(!1), t.src = He;
824
+ }), Ue);
825
+ }
826
+ function qe(e, t) {
827
+ return t ? Ge(e) ?? e : e;
828
+ }
829
+ function Je(e) {
830
+ let t = e.trim(), n = t.search(/[?#]/), r = n < 0 ? t : t.slice(0, n);
831
+ if (!/\.avif$/i.test(r)) return null;
832
+ let i = r.replace(/\.avif$/i, ".webp");
833
+ return n < 0 ? i : `${i}${t.slice(n)}`;
834
+ }
835
+ function Ye(e) {
836
+ let t = e.trim();
837
+ return /-400x225\.(webp|avif)(?:$|[?#])/i.test(t) ? t.replace(/-400x225\.(webp|avif)/i, "-800x450.$1") : null;
838
+ }
839
+ //#endregion
799
840
  //#region src/react/ExperienceThumbnail.tsx
800
- function He(e, t) {
841
+ function Xe(e, t) {
801
842
  return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
802
843
  }
803
- function Ue(e) {
804
- let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w, normalizeUrls: T = !0, cdnBaseUrl: E } = e, D = o(null), O = o(!1), [k, A] = s(0), [ee, j] = s(0), M = R(k, ee), N = a(() => fe({
844
+ function Ze(e) {
845
+ let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w, normalizeUrls: T = !0, cdnBaseUrl: E } = e, D = o(null), O = o(!1), [k, A] = s(0), [ee, j] = s(0), M = R(k, ee), N = a(() => he({
805
846
  galleryThumb: t,
806
847
  avatarImage: r,
807
848
  backgroundImage: i,
@@ -819,15 +860,17 @@ function Ue(e) {
819
860
  T,
820
861
  M,
821
862
  E
822
- ]), P = ge({
863
+ ]), P = U({
823
864
  href: m,
824
865
  hasClickHandler: typeof _ == "function",
825
866
  experienceId: p
826
- }), F = P === "anchor" && !m?.trim() && !!p?.trim(), te = !!N?.backgroundImage, I = b !== !1, [L, ne] = s(!S), [ie, z] = s(!1), [B, oe] = s(!1), [se, ce] = s(0), [V, H] = s(0), [le, ue] = s(!1), [U, de] = s(!1), [W, G] = s(!1), [pe, me] = s(!1), [he, _e] = s(), ve = N ? le && N.fallbackImage ? N.fallbackImage : N.avatarImage : "";
867
+ }), F = P === "anchor" && !m?.trim() && !!p?.trim(), te = !!N?.backgroundImage, I = b !== !1, [L, ne] = s(!S), [ie, ae] = s(!1), [z, se] = s(!1), [ce, le] = s(!1), [B, V] = s(!1), [ue, de] = s(!1), [fe, pe] = s(!1), [H, me] = s(!1), [ge, _e] = s(0), [ve, W] = s(0), [ye, xe] = s(!1), [Se, Ce] = s(!1), [we, G] = s(!1), [Te, Ee] = s(!1), [De, Oe] = s(), K = N ? ye && N.fallbackImage ? N.fallbackImage : N.avatarImage : "";
827
868
  n(() => {
828
- Ve(ze);
869
+ Ve(ze), Ke().then((e) => {
870
+ ae(e), se(!0);
871
+ });
829
872
  }, []), n(() => {
830
- _e(ye({
873
+ Oe(be({
831
874
  href: m,
832
875
  experienceId: p,
833
876
  returnUrl: v,
@@ -841,24 +884,24 @@ function Ue(e) {
841
884
  y,
842
885
  F
843
886
  ]), n(() => {
844
- de(!1), G(!1), me(!1), ue(!1);
887
+ Ce(!1), G(!1), Ee(!1), xe(!1), le(!1), V(!1), de(!1);
845
888
  }, [
846
889
  N?.backgroundImage,
847
890
  N?.foregroundImage,
848
- ve
891
+ K
849
892
  ]), n(() => {
850
893
  let e = D.current;
851
- if (e) return ae(e, (e, t) => {
894
+ if (e) return oe(e, (e, t) => {
852
895
  A(e), j(t);
853
896
  });
854
- }, [P, he]), n(() => {
897
+ }, [P, De]), n(() => {
855
898
  let e = D.current;
856
899
  if (e) {
857
900
  if (!S) {
858
901
  ne(!0);
859
902
  return;
860
903
  }
861
- return Oe(e, { onVisibleChange: (e) => {
904
+ return ke(e, { onVisibleChange: (e) => {
862
905
  e && ne(!0);
863
906
  } });
864
907
  }
@@ -866,12 +909,12 @@ function Ue(e) {
866
909
  S,
867
910
  N,
868
911
  P,
869
- he
912
+ De
870
913
  ]), n(() => {
871
914
  let e = D.current;
872
915
  if (!(!e || !I)) return Le(e, {
873
916
  onParallax: (e) => {
874
- oe(!0), O.current || (ce(e), H(0));
917
+ me(!0), O.current || (_e(e), W(0));
875
918
  },
876
919
  pointerActive: () => O.current
877
920
  });
@@ -879,25 +922,25 @@ function Ue(e) {
879
922
  I,
880
923
  N,
881
924
  P,
882
- he
925
+ De
883
926
  ]);
884
- let be = (e) => {
885
- if (!I || B) return;
927
+ let Ae = (e) => {
928
+ if (!I || H) return;
886
929
  let t = e.currentTarget.getBoundingClientRect();
887
- t.width <= 0 || t.height <= 0 || (ce(((e.clientX - t.left) / t.width - .5) * 2), H(((e.clientY - t.top) / t.height - .5) * 2));
888
- }, K = (e) => {
930
+ t.width <= 0 || t.height <= 0 || (_e(((e.clientX - t.left) / t.width - .5) * 2), W(((e.clientY - t.top) / t.height - .5) * 2));
931
+ }, q = (e) => {
889
932
  let t = O.current;
890
- O.current = !1, z(!1), B && t ? (ce(Ae(e.getBoundingClientRect(), window.innerHeight)), H(0)) : B || (ce(0), H(0));
891
- }, xe = (e) => {
933
+ O.current = !1, pe(!1), H && t ? (_e(je(e.getBoundingClientRect(), window.innerHeight)), W(0)) : H || (_e(0), W(0));
934
+ }, Me = (e) => {
892
935
  if (!I) return;
893
- O.current = !0, e.pointerType === "mouse" && z(!0);
936
+ O.current = !0, e.pointerType === "mouse" && pe(!0);
894
937
  let t = e.currentTarget, n = () => {
895
- K(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
938
+ q(t), window.removeEventListener("pointerup", n), window.removeEventListener("pointercancel", n);
896
939
  };
897
940
  window.addEventListener("pointerup", n), window.addEventListener("pointercancel", n);
898
- }, Se = (e) => {
941
+ }, J = (e) => {
899
942
  if (_?.(e), !e.defaultPrevented && F && !v?.trim()) {
900
- let t = ye({
943
+ let t = be({
901
944
  experienceId: p,
902
945
  playerBaseUrl: y,
903
946
  useCurrentPageAsReturnUrl: !0
@@ -906,134 +949,153 @@ function Ue(e) {
906
949
  }
907
950
  };
908
951
  if (!N) return null;
909
- let Ce = I && (ie || B), we = L && (W || U || pe), Te = [
952
+ let Ne = I && (fe || H), Pe = L && z && (we || Se || Te), Fe = [
910
953
  "liforma-et",
911
954
  te ? "liforma-et--scene" : "",
912
955
  re(x),
913
- Ce ? "liforma-et--parallax" : "",
914
- B ? "liforma-et--scroll-parallax" : "",
915
- L && !we ? "liforma-et--loading" : "",
916
- we ? "liforma-et--revealed" : "",
956
+ Ne ? "liforma-et--parallax" : "",
957
+ H ? "liforma-et--scroll-parallax" : "",
958
+ L && !Pe ? "liforma-et--loading" : "",
959
+ Pe ? "liforma-et--revealed" : "",
917
960
  C
918
- ].filter(Boolean).join(" "), Ee = {
919
- "--liforma-et-parallax-x": se,
920
- "--liforma-et-parallax-y": V
921
- }, De = (e, t) => {
961
+ ].filter(Boolean).join(" "), Ie = {
962
+ "--liforma-et-parallax-x": ge,
963
+ "--liforma-et-parallax-y": ve
964
+ }, Re = (e, t) => {
922
965
  e.complete && t(!0);
923
- }, q = /* @__PURE__ */ f(u, { children: [
966
+ }, Be = /* @__PURE__ */ f(u, { children: [
924
967
  /* @__PURE__ */ d("span", {
925
968
  className: "liforma-et__placeholder",
926
969
  "aria-hidden": "true"
927
970
  }),
928
- L && N.backgroundImage ? /* @__PURE__ */ d("img", {
929
- className: He("liforma-et__background", U),
930
- src: N.backgroundImage,
971
+ L && z && N.backgroundImage ? /* @__PURE__ */ d("img", {
972
+ className: Xe("liforma-et__background", Se),
973
+ src: qe(N.backgroundImage, ie),
931
974
  alt: "",
932
975
  decoding: "async",
933
976
  ref: (e) => {
934
- e && De(e, de);
977
+ e && Re(e, Ce);
935
978
  },
936
- onLoad: () => de(!0),
937
- onError: () => de(!0)
979
+ onLoad: () => Ce(!0),
980
+ onError: (e) => {
981
+ let t = e.currentTarget, n = Ye(t.src);
982
+ if (n && !ce) {
983
+ le(!0), t.src = n;
984
+ return;
985
+ }
986
+ Ce(!0);
987
+ }
938
988
  }) : null,
939
- L && ve ? /* @__PURE__ */ d("img", {
940
- className: He("liforma-et__avatar", W),
941
- src: ve,
989
+ L && z && K ? /* @__PURE__ */ d("img", {
990
+ className: Xe("liforma-et__avatar", we),
991
+ src: qe(K, ie),
942
992
  alt: "",
943
993
  decoding: "async",
944
994
  ref: (e) => {
945
- e && De(e, G);
995
+ e && Re(e, G);
946
996
  },
947
997
  onLoad: () => G(!0),
948
- onError: () => {
949
- N.fallbackImage ? ue(!0) : G(!0);
998
+ onError: (e) => {
999
+ let t = e.currentTarget, n = Je(t.src);
1000
+ if (n && !ue) {
1001
+ de(!0), t.src = n;
1002
+ return;
1003
+ }
1004
+ N.fallbackImage ? xe(!0) : G(!0);
950
1005
  }
951
1006
  }) : null,
952
- L && N.foregroundImage ? /* @__PURE__ */ d("img", {
953
- className: He("liforma-et__foreground", pe),
954
- src: N.foregroundImage,
1007
+ L && z && N.foregroundImage ? /* @__PURE__ */ d("img", {
1008
+ className: Xe("liforma-et__foreground", Te),
1009
+ src: qe(N.foregroundImage, ie),
955
1010
  alt: "",
956
1011
  decoding: "async",
957
1012
  ref: (e) => {
958
- e && De(e, me);
1013
+ e && Re(e, Ee);
959
1014
  },
960
- onLoad: () => me(!0),
961
- onError: () => me(!0)
1015
+ onLoad: () => Ee(!0),
1016
+ onError: (e) => {
1017
+ let t = e.currentTarget, n = Ye(t.src);
1018
+ if (n && !B) {
1019
+ V(!0), t.src = n;
1020
+ return;
1021
+ }
1022
+ Ee(!0);
1023
+ }
962
1024
  }) : null
963
- ] }), ke = {
964
- onPointerDown: xe,
965
- onPointerUp: (e) => K(e.currentTarget),
966
- onPointerCancel: (e) => K(e.currentTarget),
1025
+ ] }), He = {
1026
+ onPointerDown: Me,
1027
+ onPointerUp: (e) => q(e.currentTarget),
1028
+ onPointerCancel: (e) => q(e.currentTarget),
967
1029
  onPointerEnter: (e) => {
968
- I && e.pointerType === "mouse" && z(!0);
1030
+ I && e.pointerType === "mouse" && pe(!0);
969
1031
  },
970
- onPointerMove: be,
1032
+ onPointerMove: Ae,
971
1033
  onPointerLeave: () => {
972
- O.current || (z(!1), B || (ce(0), H(0)));
1034
+ O.current || (pe(!1), H || (_e(0), W(0)));
973
1035
  }
974
- }, J = (e) => {
1036
+ }, Ue = (e) => {
975
1037
  D.current = e;
976
1038
  };
977
- return P === "anchor" && he ? /* @__PURE__ */ d("a", {
978
- ref: J,
979
- className: Te,
980
- style: Ee,
981
- href: he,
1039
+ return P === "anchor" && De ? /* @__PURE__ */ d("a", {
1040
+ ref: Ue,
1041
+ className: Fe,
1042
+ style: Ie,
1043
+ href: De,
982
1044
  target: h,
983
1045
  rel: g,
984
1046
  "aria-label": l,
985
- onClick: Se,
986
- ...ke,
987
- children: q
1047
+ onClick: J,
1048
+ ...He,
1049
+ children: Be
988
1050
  }) : P === "button" ? /* @__PURE__ */ d("button", {
989
1051
  type: "button",
990
- ref: J,
991
- className: Te,
992
- style: Ee,
1052
+ ref: Ue,
1053
+ className: Fe,
1054
+ style: Ie,
993
1055
  "aria-label": l,
994
- onClick: Se,
995
- ...ke,
996
- children: q
1056
+ onClick: J,
1057
+ ...He,
1058
+ children: Be
997
1059
  }) : /* @__PURE__ */ d("div", {
998
- ref: J,
999
- className: Te,
1000
- style: Ee,
1060
+ ref: Ue,
1061
+ className: Fe,
1062
+ style: Ie,
1001
1063
  role: l ? "img" : void 0,
1002
1064
  "aria-label": l || void 0,
1003
1065
  "aria-hidden": l ? void 0 : !0,
1004
- ...ke,
1005
- children: q
1066
+ ...He,
1067
+ children: Be
1006
1068
  });
1007
1069
  }
1008
1070
  //#endregion
1009
1071
  //#region src/widget/styles.ts
1010
- var We = "\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", Ge = "liforma-experience-widget-styles";
1011
- function Ke(e = We) {
1072
+ var Qe = "\n.liforma-ew {\n box-sizing: border-box;\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n/* Optional self-positioned FAB (position=bottom-right|bottom-left).\n * Cap at 50vmin so small phones don't get an oversized thumb (desktop 224px stays). */\n.liforma-ew[data-position='bottom-right'],\n.liforma-ew[data-position='bottom-left'] {\n position: fixed;\n width: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n height: min(var(--liforma-ew-fab-size, 224px), 50vmin);\n bottom: var(--liforma-ew-offset, 16px);\n z-index: 2147482900;\n}\n\n.liforma-ew[data-position='bottom-right'] {\n right: var(--liforma-ew-offset, 16px);\n left: auto;\n}\n\n.liforma-ew[data-position='bottom-left'] {\n left: var(--liforma-ew-offset, 16px);\n right: auto;\n}\n\n/* While open, collapse the FAB box so a corner hole / thumb never remains. */\n.liforma-ew[data-position='bottom-right'][data-state='expanded'],\n.liforma-ew[data-position='bottom-right'][data-state='docked'],\n.liforma-ew[data-position='bottom-left'][data-state='expanded'],\n.liforma-ew[data-position='bottom-left'][data-state='docked'] {\n width: 0;\n height: 0;\n min-width: 0;\n min-height: 0;\n overflow: visible;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='expanded'] .liforma-ew__overlay,\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar,\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__hit {\n box-sizing: border-box;\n display: block;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n font: inherit;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n transform: scale(1);\n transform-origin: center center;\n transition:\n transform 180ms ease,\n filter 180ms ease;\n will-change: transform;\n}\n\n/* Author display must not defeat the HTML hidden attribute. */\n.liforma-ew__hit[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 3px;\n border-radius: 0.75rem;\n}\n\n@media (hover: hover) and (pointer: fine) {\n /* Scale the thumb whenever the collapsed FAB is hovered — including via the warm iframe hit layer. */\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: scale(1.06);\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover .liforma-et,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-et {\n box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);\n }\n}\n\n.liforma-ew__face {\n width: 100%;\n height: 100%;\n min-height: 0;\n position: relative;\n}\n\n.liforma-ew__face-status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 0.5rem;\n text-align: center;\n font: 600 0.75rem/1.3 system-ui, sans-serif;\n color: #e8ecf4;\n background: rgba(10, 12, 18, 0.72);\n border-radius: 0.75rem;\n pointer-events: none;\n}\n\n.liforma-ew__face-status[hidden] {\n display: none !important;\n}\n\n.liforma-ew__hit:disabled {\n cursor: default;\n opacity: 0.85;\n}\n\n.liforma-ew__face .liforma-et {\n border-radius: 0.75rem;\n box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);\n transition: box-shadow 180ms ease;\n}\n\n.liforma-ew__warm {\n box-sizing: border-box;\n position: absolute;\n inset: 0;\n z-index: 2;\n border-radius: 0.75rem;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n/*\n * Collapsed: keep the warm iframe as an invisible hit target only.\n * Painting it over the thumb causes a “ghost enlarge” (face scales under a static iframe).\n */\n.liforma-ew[data-state='collapsed'] .liforma-ew__warm {\n opacity: 0;\n transition: none;\n}\n\n.liforma-ew[data-warm='true'] .liforma-ew__warm {\n pointer-events: auto;\n}\n\n.liforma-ew[data-warm='true']:not([data-live='true']) .liforma-ew__hit {\n pointer-events: none;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__hit {\n pointer-events: auto;\n}\n\n.liforma-ew[data-live='true'] .liforma-ew__warm,\n.liforma-ew[data-live='true'] .liforma-ew__stage {\n /* Hidden under the thumb / until post-resize fade-in (matches cold avatar reveal). */\n opacity: 0;\n}\n\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='expanded'] .liforma-ew__stage,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-live='true'].liforma-ew--session-revealed[data-state='docked'] .liforma-ew__stage {\n opacity: 1;\n}\n\n.liforma-ew--session-concealing .liforma-ew__warm,\n.liforma-ew--session-concealing .liforma-ew__stage {\n transition-duration: 280ms;\n}\n\n/* Instant hide while dock/maximize geometry settles (player morph resize ~160ms). */\n.liforma-ew--layout-settling .liforma-ew__warm,\n.liforma-ew--layout-settling .liforma-ew__stage {\n opacity: 0 !important;\n transition: none !important;\n}\n\n.liforma-ew[data-live='true'][data-state='collapsed'] .liforma-ew__warm {\n /* Keep the live iframe under the thumb; FAB click resumes the shell. */\n pointer-events: none;\n opacity: 0;\n /* Instant hide when collapsed so the FAB never shows a resized live mesh. */\n transition: none;\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__warm {\n position: fixed;\n /* Match overlay panel inset so the warm iframe fills the conversation shell. */\n inset: clamp(12px, 3vw, 28px);\n z-index: 2147483001;\n width: auto;\n height: auto;\n border-radius: 16px;\n pointer-events: auto;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__warm {\n position: fixed;\n inset: auto;\n z-index: 2147483001;\n border-radius: 16px;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew__toolbar {\n display: none;\n position: fixed;\n z-index: 2147483002;\n pointer-events: auto;\n box-sizing: border-box;\n align-items: center;\n gap: 0.35rem;\n padding: 0.35rem 0.4rem;\n border-radius: 999px;\n background: rgba(12, 14, 20, 0.72);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);\n}\n\n.liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n display: flex;\n top: calc(clamp(12px, 3vw, 28px) + 10px);\n right: calc(clamp(12px, 3vw, 28px) + 10px);\n left: auto;\n cursor: default;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar {\n display: flex;\n /* left/top set inline to track the panel; strip remains a drag handle */\n cursor: grab;\n touch-action: none;\n user-select: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel,\n.liforma-ew[data-state='docked'] .liforma-ew__warm,\n.liforma-ew[data-state='docked'] .liforma-ew__stage {\n /* Player also reports surface drags via postMessage when docked. */\n cursor: grab;\n touch-action: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__toolbar.liforma-ew__toolbar--dragging,\n.liforma-ew--dock-dragging,\n.liforma-ew--dock-dragging .liforma-ew__toolbar,\n.liforma-ew--dock-dragging .liforma-ew__panel,\n.liforma-ew--dock-dragging .liforma-ew__warm,\n.liforma-ew--dock-dragging .liforma-ew__stage {\n cursor: grabbing;\n}\n\n\n.liforma-ew__toolbar[hidden] {\n display: none !important;\n}\n\n.liforma-ew__icon-btn {\n appearance: none;\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 999px;\n color: #f5f7fb;\n background: transparent;\n cursor: pointer;\n}\n\n.liforma-ew__icon-btn:hover {\n background: rgba(255, 255, 255, 0.12);\n}\n\n.liforma-ew__icon-btn[aria-pressed='true'] {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.liforma-ew__icon-btn:focus-visible {\n outline: 2px solid #5b8def;\n outline-offset: 2px;\n}\n\n.liforma-ew__icon-btn svg {\n width: 1.05rem;\n height: 1.05rem;\n display: block;\n}\n\n.liforma-ew__drag-grip {\n display: none;\n width: 0.85rem;\n height: 1.25rem;\n margin: 0 0.15rem 0 0.25rem;\n background:\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0 0 / 0.35rem 0.35rem,\n radial-gradient(circle, currentColor 1.1px, transparent 1.2px) 0.35rem 0 / 0.35rem 0.35rem;\n background-repeat: repeat-y;\n opacity: 0.55;\n color: #f5f7fb;\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__drag-grip {\n display: block;\n}\n\n.liforma-ew__dock-toggle[hidden] {\n display: none !important;\n}\n\n.liforma-ew__overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483000;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: clamp(12px, 3vw, 28px);\n box-sizing: border-box;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__overlay {\n padding: 0;\n align-items: stretch;\n justify-content: stretch;\n pointer-events: none;\n background: transparent;\n}\n\n.liforma-ew__overlay[hidden] {\n display: none !important;\n}\n\n.liforma-ew__backdrop {\n position: absolute;\n inset: 0;\n border: 0;\n padding: 0;\n margin: 0;\n background: rgba(6, 8, 14, 0.62);\n cursor: pointer;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__backdrop {\n display: none !important;\n}\n\n.liforma-ew__panel {\n position: relative;\n z-index: 1;\n display: flex;\n flex-direction: column;\n /* Fill the overlay so player loading / start UI centers in the visible window. */\n width: var(--liforma-ew-max-w, 100%);\n height: var(--liforma-ew-max-h, 100%);\n max-width: 100%;\n max-height: 100%;\n border-radius: 16px;\n overflow: hidden;\n background: #030508;\n box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);\n /* Warm iframe sits above as a sibling; keep panel as chrome shell. */\n pointer-events: none;\n}\n\n.liforma-ew[data-state='docked'] .liforma-ew__panel {\n position: fixed;\n inset: auto;\n max-width: none;\n max-height: none;\n pointer-events: auto;\n /* left/top/width/height set inline from dock geometry */\n}\n\n.liforma-ew:not([data-warm='true']) .liforma-ew__panel {\n pointer-events: auto;\n}\n\n.liforma-ew__stage {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n background: #030508;\n opacity: 1;\n transition: opacity 1000ms ease;\n}\n\n.liforma-ew__status {\n position: absolute;\n inset: 0;\n z-index: 1;\n display: grid;\n place-items: center;\n padding: 1.5rem;\n text-align: center;\n color: #d7dde8;\n font: 500 0.9375rem/1.45 system-ui, sans-serif;\n background: rgba(3, 5, 8, 0.92);\n pointer-events: none;\n}\n\n.liforma-ew__status[hidden] {\n display: none !important;\n}\n\n/* Mobile expanded: ~90% viewport, no reduce control. */\n@media (max-width: 767px) {\n .liforma-ew[data-state='expanded'] .liforma-ew__overlay {\n padding: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__panel {\n width: 90vw;\n height: 90vh;\n max-width: 90vw;\n max-height: 90vh;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__warm {\n inset: 5vh 5vw;\n }\n\n .liforma-ew[data-state='expanded'] .liforma-ew__toolbar {\n top: calc(5vh + 10px);\n right: calc(5vw + 10px);\n }\n\n .liforma-ew__dock-toggle {\n display: none !important;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .liforma-ew__hit {\n transition: none;\n will-change: auto;\n }\n\n .liforma-ew[data-state='collapsed'] .liforma-ew__hit:not(:disabled):hover,\n .liforma-ew[data-state='collapsed']:has(.liforma-ew__warm:hover) .liforma-ew__hit {\n transform: none;\n }\n\n .liforma-ew__face .liforma-et {\n box-shadow: none;\n transition: none;\n }\n\n .liforma-ew__warm,\n .liforma-ew__stage {\n transition: none;\n }\n}\n", $e = "liforma-experience-widget-styles";
1073
+ function et(e = Qe) {
1012
1074
  if (typeof document > "u") return;
1013
- let t = document.getElementById(Ge);
1075
+ let t = document.getElementById($e);
1014
1076
  if (t) {
1015
1077
  t.textContent = e;
1016
1078
  return;
1017
1079
  }
1018
1080
  let n = document.createElement("style");
1019
- n.id = Ge, n.textContent = e, document.head.append(n);
1081
+ n.id = $e, n.textContent = e, document.head.append(n);
1020
1082
  }
1021
1083
  //#endregion
1022
1084
  //#region src/shims/apiBaseUrl.ts
1023
- var qe = "https://api.liforma.ai", Je = "http://localhost:3001";
1024
- function Ye() {
1085
+ var tt = "https://api.liforma.ai", nt = "http://localhost:3001";
1086
+ function rt() {
1025
1087
  let e = globalThis.__LIFORMA_API_BASE_URL;
1026
1088
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1027
1089
  if (typeof document > "u") return null;
1028
1090
  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();
1029
1091
  return t ? t.replace(/\/$/, "") : null;
1030
1092
  }
1031
- function Xe() {
1032
- return Ye() || (pe() ? Je : qe);
1093
+ function it() {
1094
+ return rt() || (ge() ? nt : tt);
1033
1095
  }
1034
1096
  //#endregion
1035
1097
  //#region src/v2/api/fetchExperiencePreview.ts
1036
- function Ze(e) {
1098
+ function at(e) {
1037
1099
  if (!e || typeof e != "object") return null;
1038
1100
  let t = e, n = typeof t.avatarImage == "string" ? t.avatarImage.trim() : "";
1039
1101
  return n ? {
@@ -1042,10 +1104,10 @@ function Ze(e) {
1042
1104
  ...typeof t.foregroundImage == "string" && t.foregroundImage.trim() ? { foregroundImage: t.foregroundImage.trim() } : {}
1043
1105
  } : null;
1044
1106
  }
1045
- async function Qe(e, t) {
1107
+ async function ot(e, t) {
1046
1108
  let n = e.trim();
1047
1109
  if (!n) throw Error("Experience preview requires experienceId.");
1048
- let r = (t?.apiBaseUrl ?? Xe()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
1110
+ let r = (t?.apiBaseUrl ?? it()).replace(/\/$/, ""), i = await fetch(`${r}/v1/experiences/${encodeURIComponent(n)}/preview`, {
1049
1111
  method: "GET",
1050
1112
  headers: { Accept: "application/json" },
1051
1113
  signal: t?.signal
@@ -1065,7 +1127,7 @@ async function Qe(e, t) {
1065
1127
  throw Error("Experience preview returned invalid JSON.");
1066
1128
  }
1067
1129
  if (!a || typeof a != "object") throw Error("Experience preview returned an invalid payload.");
1068
- let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = Ze(o.galleryThumb);
1130
+ let o = a, s = typeof o.experienceId == "string" ? o.experienceId.trim() : n, c = typeof o.title == "string" ? o.title.trim() : "", l = at(o.galleryThumb);
1069
1131
  if (!l) throw Error("Experience preview is missing gallery thumb images.");
1070
1132
  return {
1071
1133
  experienceId: s || n,
@@ -1075,7 +1137,7 @@ async function Qe(e, t) {
1075
1137
  }
1076
1138
  //#endregion
1077
1139
  //#region src/v2/errors/LiformaError.ts
1078
- var $e = class extends Error {
1140
+ var st = class extends Error {
1079
1141
  code;
1080
1142
  requestId;
1081
1143
  status;
@@ -1084,16 +1146,16 @@ var $e = class extends Error {
1084
1146
  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;
1085
1147
  }
1086
1148
  };
1087
- function et(e) {
1149
+ function ct(e) {
1088
1150
  if (!(!e || typeof e != "object" || Array.isArray(e))) return e;
1089
1151
  }
1090
- function tt(e, t, n) {
1152
+ function lt(e, t, n) {
1091
1153
  let r = n?.get("Liforma-Request-Id")?.trim() || void 0, i;
1092
1154
  try {
1093
1155
  i = JSON.parse(t);
1094
1156
  } catch {}
1095
- 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 } = et(a) ?? et(i) ?? {};
1096
- return new $e(u, {
1157
+ let a = i?.error && typeof i.error == "object" ? i.error : void 0, o = a?.code ?? i?.code, s = a?.message ?? i?.message, c = a?.requestId ?? i?.requestId ?? r, l = typeof o == "string" && o.trim() ? o.trim() : "HTTP_ERROR", u = typeof s == "string" && s.trim() ? s.trim() : t.trim().slice(0, 500) || `Request failed (${e})`, d = typeof c == "string" && c.trim() ? c.trim() : r, { code: f, message: p, requestId: m, ...h } = ct(a) ?? ct(i) ?? {};
1158
+ return new st(u, {
1097
1159
  code: l,
1098
1160
  requestId: d,
1099
1161
  status: e,
@@ -1102,13 +1164,13 @@ function tt(e, t, n) {
1102
1164
  }
1103
1165
  //#endregion
1104
1166
  //#region src/v2/api/captureAttribution.ts
1105
- var nt = 128, rt = /[\u0000-\u001f\u007f]/g;
1167
+ var ut = 128, dt = /[\u0000-\u001f\u007f]/g;
1106
1168
  function Y(e) {
1107
1169
  if (!e) return;
1108
- let t = e.replace(rt, "").trim();
1109
- if (t) return t.slice(0, nt);
1170
+ let t = e.replace(dt, "").trim();
1171
+ if (t) return t.slice(0, ut);
1110
1172
  }
1111
- function it(e) {
1173
+ function ft(e) {
1112
1174
  let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
1113
1175
  return {
1114
1176
  ...Y(t.get("utm_source")) ? { utmSource: Y(t.get("utm_source")) } : {},
@@ -1118,7 +1180,7 @@ function it(e) {
1118
1180
  ...Y(t.get("utm_term")) ? { utmTerm: Y(t.get("utm_term")) } : {}
1119
1181
  };
1120
1182
  }
1121
- function at(e) {
1183
+ function pt(e) {
1122
1184
  if (e === !1) return;
1123
1185
  if (e && typeof e == "object") {
1124
1186
  let t = {
@@ -1132,7 +1194,7 @@ function at(e) {
1132
1194
  return Object.keys(t).length ? t : void 0;
1133
1195
  }
1134
1196
  if (typeof window > "u") return;
1135
- let t = it(window.location?.search), n = Y(document.referrer || void 0), r = {
1197
+ let t = ft(window.location?.search), n = Y(document.referrer || void 0), r = {
1136
1198
  ...t,
1137
1199
  ...n ? { referrer: n } : {}
1138
1200
  };
@@ -1140,19 +1202,19 @@ function at(e) {
1140
1202
  }
1141
1203
  //#endregion
1142
1204
  //#region src/v2/api/sessionEndpointRequest.ts
1143
- function ot(e) {
1205
+ function mt(e) {
1144
1206
  let t = e.locale?.trim();
1145
1207
  if (t) return t;
1146
1208
  let n = e.language?.trim();
1147
1209
  if (n) return n;
1148
1210
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
1149
1211
  }
1150
- function st(e) {
1212
+ function ht(e) {
1151
1213
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
1152
1214
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
1153
1215
  return t || n || void 0;
1154
1216
  }
1155
- function ct(e, t) {
1217
+ function gt(e, t) {
1156
1218
  let n = e.trim();
1157
1219
  if (!n) throw Error("sessionEndpoint must not be empty.");
1158
1220
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -1160,7 +1222,7 @@ function ct(e, t) {
1160
1222
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
1161
1223
  let i = t.experienceId.trim();
1162
1224
  if (!i) throw Error("sessionEndpoint requires experienceId.");
1163
- let a = ot(t), o = st(t), s = t.idempotencyKey?.trim();
1225
+ let a = mt(t), o = ht(t), s = t.idempotencyKey?.trim();
1164
1226
  return {
1165
1227
  url: r.toString(),
1166
1228
  init: {
@@ -1179,7 +1241,7 @@ function ct(e, t) {
1179
1241
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
1180
1242
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
1181
1243
  ...(() => {
1182
- let e = at(t.attribution);
1244
+ let e = pt(t.attribution);
1183
1245
  return e ? { attribution: e } : {};
1184
1246
  })(),
1185
1247
  ...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
@@ -1189,16 +1251,16 @@ function ct(e, t) {
1189
1251
  }
1190
1252
  //#endregion
1191
1253
  //#region src/v2/types/sessionLaunch.ts
1192
- function lt(e) {
1254
+ function _t(e) {
1193
1255
  return !!e && typeof e == "object" && !Array.isArray(e);
1194
1256
  }
1195
1257
  function X(e) {
1196
1258
  return typeof e == "boolean";
1197
1259
  }
1198
- function ut(e) {
1199
- if (!lt(e)) return null;
1260
+ function vt(e) {
1261
+ if (!_t(e)) return null;
1200
1262
  let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
1201
- return !lt(t) || !lt(n) || !lt(r) || !lt(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
1263
+ return !_t(t) || !_t(n) || !_t(r) || !_t(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
1202
1264
  speech: {
1203
1265
  input: t.input,
1204
1266
  output: t.output,
@@ -1209,8 +1271,8 @@ function ut(e) {
1209
1271
  tools: { enabled: i.enabled }
1210
1272
  };
1211
1273
  }
1212
- function dt(e) {
1213
- return !lt(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
1274
+ function yt(e) {
1275
+ return !_t(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
1214
1276
  speech: {
1215
1277
  input: e.speechInput,
1216
1278
  output: e.speechOutput,
@@ -1221,12 +1283,12 @@ function dt(e) {
1221
1283
  tools: { enabled: e.tools }
1222
1284
  };
1223
1285
  }
1224
- function ft(e) {
1225
- return ut(e) ?? dt(e);
1286
+ function bt(e) {
1287
+ return vt(e) ?? yt(e);
1226
1288
  }
1227
- function pt(e) {
1228
- if (!lt(e)) throw Error("Session Launch response is missing session.");
1229
- 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 = ft(e.capabilities), l = mt(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;
1289
+ function xt(e) {
1290
+ if (!_t(e)) throw Error("Session Launch response is missing session.");
1291
+ let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = bt(e.capabilities), l = St(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;
1230
1292
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
1231
1293
  return {
1232
1294
  id: t,
@@ -1242,11 +1304,11 @@ function pt(e) {
1242
1304
  ...d ? { createdAt: d } : {}
1243
1305
  };
1244
1306
  }
1245
- function mt(e) {
1307
+ function St(e) {
1246
1308
  if (!Array.isArray(e) || e.length === 0) return;
1247
1309
  let t = [];
1248
1310
  for (let n of e) {
1249
- if (!lt(n)) continue;
1311
+ if (!_t(n)) continue;
1250
1312
  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() : "";
1251
1313
  !e || !r || !i || n.reason !== "voice_unsupported" || t.push({
1252
1314
  axis: e,
@@ -1257,104 +1319,104 @@ function mt(e) {
1257
1319
  }
1258
1320
  return t.length > 0 ? t : void 0;
1259
1321
  }
1260
- function ht(e) {
1322
+ function Ct(e) {
1261
1323
  let t = e.localeVoiceFallbacks;
1262
1324
  if (t?.length) for (let e of t) {
1263
1325
  let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
1264
1326
  console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
1265
1327
  }
1266
1328
  }
1267
- function gt(e) {
1268
- if (!lt(e)) throw Error("Session Launch response must be a JSON object.");
1329
+ function wt(e) {
1330
+ if (!_t(e)) throw Error("Session Launch response must be a JSON object.");
1269
1331
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
1270
1332
  if (!t) throw Error("Session Launch response is missing launch.");
1271
- let n = pt(e.session);
1272
- return ht(n), {
1333
+ let n = xt(e.session);
1334
+ return Ct(n), {
1273
1335
  session: n,
1274
1336
  launch: t
1275
1337
  };
1276
1338
  }
1277
1339
  //#endregion
1278
1340
  //#region src/v2/api/mintPublicSession.ts
1279
- function _t() {
1341
+ function Tt() {
1280
1342
  try {
1281
1343
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
1282
1344
  } catch {}
1283
1345
  }
1284
- function vt(e) {
1346
+ function Et(e) {
1285
1347
  return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
1286
1348
  }
1287
- function yt(e, t) {
1288
- let n = _t(), r = vt(t.code), i = t.message.trim(), a = t.details ?? {};
1349
+ function Dt(e, t) {
1350
+ let n = Tt(), r = Et(t.code), i = t.message.trim(), a = t.details ?? {};
1289
1351
  if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
1290
1352
  if (i.includes(e) && i.includes("allowed origin")) return t;
1291
1353
  let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
1292
- return new $e(`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.`, {
1354
+ return new st(`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.`, {
1293
1355
  code: "ORIGIN_NOT_ALLOWED",
1294
1356
  requestId: t.requestId,
1295
1357
  status: t.status,
1296
1358
  details: a
1297
1359
  });
1298
1360
  }
1299
- return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new $e(`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”.`, {
1361
+ return r === "BROWSER_EMBEDS_DISABLED" || /^Browser embeds are not enabled/i.test(i) ? i.includes("Allow public client-only embeds") ? t : new st(`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”.`, {
1300
1362
  code: "BROWSER_EMBEDS_DISABLED",
1301
1363
  requestId: t.requestId,
1302
1364
  status: t.status,
1303
1365
  details: a
1304
- }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new $e(`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.`, {
1366
+ }) : r === "EXPERIENCE_UNAVAILABLE" || /^Experience is not available\.?$/i.test(i) || /^Unknown experience\.?$/i.test(i) ? i.includes("No playable experience found") ? t : new st(`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.`, {
1305
1367
  code: "EXPERIENCE_UNAVAILABLE",
1306
1368
  requestId: t.requestId,
1307
1369
  status: t.status,
1308
1370
  details: a
1309
1371
  }) : t;
1310
1372
  }
1311
- function bt(e) {
1373
+ function Ot(e) {
1312
1374
  let t = e?.locale?.trim();
1313
1375
  if (t) return t;
1314
1376
  let n = e?.language?.trim();
1315
1377
  if (n) return n;
1316
1378
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
1317
1379
  }
1318
- function xt(e) {
1380
+ function kt(e) {
1319
1381
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
1320
- if (t && n && t !== n) throw new $e("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
1382
+ if (t && n && t !== n) throw new st("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
1321
1383
  return t || n || void 0;
1322
1384
  }
1323
- function St(e, t) {
1324
- let n = { experienceId: e }, r = bt(t);
1385
+ function At(e, t) {
1386
+ let n = { experienceId: e }, r = Ot(t);
1325
1387
  r && (n.locale = r);
1326
- let i = xt(t);
1388
+ let i = kt(t);
1327
1389
  i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
1328
- let a = at(t?.attribution);
1390
+ let a = pt(t?.attribution);
1329
1391
  return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
1330
1392
  }
1331
- async function Ct(e, t) {
1332
- let n = Xe(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
1393
+ async function jt(e, t) {
1394
+ let n = it(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
1333
1395
  method: "POST",
1334
1396
  headers: {
1335
1397
  "Content-Type": "application/json",
1336
1398
  ...r ? { "Idempotency-Key": r } : {}
1337
1399
  },
1338
- body: JSON.stringify(St(e, t))
1400
+ body: JSON.stringify(At(e, t))
1339
1401
  });
1340
1402
  if (!i.ok) {
1341
1403
  let t = await i.text();
1342
- throw yt(e, tt(i.status, t, i.headers));
1404
+ throw Dt(e, lt(i.status, t, i.headers));
1343
1405
  }
1344
1406
  let a;
1345
1407
  try {
1346
1408
  a = await i.json();
1347
1409
  } catch {
1348
- throw new $e("Browser session mint returned invalid JSON.", {
1410
+ throw new st("Browser session mint returned invalid JSON.", {
1349
1411
  code: "INVALID_RESPONSE",
1350
1412
  status: i.status,
1351
1413
  requestId: i.headers.get("Liforma-Request-Id") ?? void 0
1352
1414
  });
1353
1415
  }
1354
- return gt(a);
1416
+ return wt(a);
1355
1417
  }
1356
- async function wt(e, t) {
1357
- let n = ct(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1418
+ async function Mt(e, t) {
1419
+ let n = gt(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
1358
1420
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
1359
1421
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
1360
1422
  try {
@@ -1367,9 +1429,9 @@ async function wt(e, t) {
1367
1429
  }
1368
1430
  if (!o.ok) {
1369
1431
  let e = await o.text();
1370
- throw tt(o.status, e, o.headers);
1432
+ throw lt(o.status, e, o.headers);
1371
1433
  }
1372
- if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new $e("Session endpoint must return a JSON Session Launch response.", {
1434
+ if (!o.headers.get("content-type")?.toLowerCase().includes("application/json")) throw new st("Session endpoint must return a JSON Session Launch response.", {
1373
1435
  code: "INVALID_RESPONSE",
1374
1436
  status: o.status,
1375
1437
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
@@ -1378,20 +1440,20 @@ async function wt(e, t) {
1378
1440
  try {
1379
1441
  s = await o.json();
1380
1442
  } catch {
1381
- throw new $e("Session endpoint returned invalid JSON.", {
1443
+ throw new st("Session endpoint returned invalid JSON.", {
1382
1444
  code: "INVALID_RESPONSE",
1383
1445
  status: o.status,
1384
1446
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
1385
1447
  });
1386
1448
  }
1387
- return gt(s);
1449
+ return wt(s);
1388
1450
  }
1389
1451
  //#endregion
1390
1452
  //#region src/v2/conversationProcessor.ts
1391
- function Tt(e) {
1453
+ function Nt(e) {
1392
1454
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
1393
1455
  }
1394
- function Et(e) {
1456
+ function Pt(e) {
1395
1457
  if (typeof e == "string") {
1396
1458
  let t = e.trim();
1397
1459
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -1405,24 +1467,24 @@ function Et(e) {
1405
1467
  ...e.behavior ? { behavior: e.behavior } : {}
1406
1468
  };
1407
1469
  }
1408
- async function Dt(e, t) {
1470
+ async function Ft(e, t) {
1409
1471
  let n = await e(t);
1410
- return Tt(n) ? {
1472
+ return Nt(n) ? {
1411
1473
  kind: "stream",
1412
1474
  stream: n
1413
1475
  } : {
1414
1476
  kind: "complete",
1415
- speech: Et(n)
1477
+ speech: Pt(n)
1416
1478
  };
1417
1479
  }
1418
1480
  //#endregion
1419
1481
  //#region src/v2/embed/playerReachability.ts
1420
- var Ot = "3002";
1421
- function kt(e) {
1482
+ var It = "3002";
1483
+ function Lt(e) {
1422
1484
  let t = new URL(e);
1423
- 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 || Ot}. 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.`;
1485
+ return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || It}. 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.`;
1424
1486
  }
1425
- async function At(e, t) {
1487
+ async function Rt(e, t) {
1426
1488
  try {
1427
1489
  await fetch(e, {
1428
1490
  method: "GET",
@@ -1430,25 +1492,25 @@ async function At(e, t) {
1430
1492
  signal: AbortSignal.timeout(8e3)
1431
1493
  });
1432
1494
  } catch {
1433
- throw Error(kt(t));
1495
+ throw Error(Lt(t));
1434
1496
  }
1435
1497
  }
1436
- function jt(e, t, n, r) {
1498
+ function zt(e, t, n, r) {
1437
1499
  try {
1438
1500
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
1439
1501
  } catch (e) {
1440
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(kt(n), { cause: e }) : e;
1502
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(Lt(n), { cause: e }) : e;
1441
1503
  }
1442
1504
  }
1443
- var Mt = new Set([1, 2]);
1444
- function Nt(e) {
1445
- return typeof e == "number" && Mt.has(e);
1505
+ var Bt = new Set([1, 2]);
1506
+ function Vt(e) {
1507
+ return typeof e == "number" && Bt.has(e);
1446
1508
  }
1447
- var Pt = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
1448
- function Ft(e) {
1509
+ var Ht = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow.theatre.interactionChange".split("."));
1510
+ function Ut(e) {
1449
1511
  if (!e || typeof e != "object") return null;
1450
1512
  let t = e;
1451
- if (!Nt(t.schemaVersion) || !t.type || !Pt.has(t.type)) return null;
1513
+ if (!Vt(t.schemaVersion) || !t.type || !Ht.has(t.type)) return null;
1452
1514
  if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
1453
1515
  if (t.type === "fullWindow" || t.type === "theatre") {
1454
1516
  let e = t.payload;
@@ -1471,7 +1533,7 @@ function Ft(e) {
1471
1533
  let n = t.payload;
1472
1534
  return !n || typeof n != "object" ? null : t;
1473
1535
  }
1474
- function It(e, t, n) {
1536
+ function Wt(e, t, n) {
1475
1537
  let r = e.trim();
1476
1538
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
1477
1539
  let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction, c = n?.theatreButton, l = n?.theatre;
@@ -1490,27 +1552,27 @@ function It(e, t, n) {
1490
1552
  }
1491
1553
  };
1492
1554
  }
1493
- function Lt() {
1555
+ function Gt() {
1494
1556
  return {
1495
1557
  type: "parentHello",
1496
1558
  schemaVersion: 2
1497
1559
  };
1498
1560
  }
1499
- function Rt(e) {
1561
+ function Kt(e) {
1500
1562
  return {
1501
1563
  type: "widgetSetChrome",
1502
1564
  schemaVersion: 2,
1503
1565
  payload: { mode: e }
1504
1566
  };
1505
1567
  }
1506
- function zt() {
1568
+ function qt() {
1507
1569
  return {
1508
1570
  type: "widgetToggleAudioSettings",
1509
1571
  schemaVersion: 2,
1510
1572
  payload: {}
1511
1573
  };
1512
1574
  }
1513
- function Bt(e) {
1575
+ function Jt(e) {
1514
1576
  return {
1515
1577
  type: "setTheatre",
1516
1578
  schemaVersion: 2,
@@ -1519,8 +1581,8 @@ function Bt(e) {
1519
1581
  }
1520
1582
  //#endregion
1521
1583
  //#region src/v2/embed/fullWindowHost.ts
1522
- var Vt = "2147483000";
1523
- function Ht(e) {
1584
+ var Yt = "2147483000";
1585
+ function Xt(e) {
1524
1586
  let { style: t } = e;
1525
1587
  return {
1526
1588
  position: t.position,
@@ -1538,11 +1600,11 @@ function Ht(e) {
1538
1600
  maxHeight: t.maxHeight
1539
1601
  };
1540
1602
  }
1541
- function Ut(e) {
1603
+ function Zt(e) {
1542
1604
  let { style: t } = e;
1543
- 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 = Vt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1605
+ t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = Yt, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1544
1606
  }
1545
- function Wt(e, t) {
1607
+ function Qt(e, t) {
1546
1608
  if (delete e.dataset.liformaFullWindow, !t) {
1547
1609
  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 = "";
1548
1610
  return;
@@ -1552,20 +1614,20 @@ function Wt(e, t) {
1552
1614
  }
1553
1615
  //#endregion
1554
1616
  //#region src/v2/embed/iframeHost.ts
1555
- function Gt(e) {
1617
+ function $t(e) {
1556
1618
  return e;
1557
1619
  }
1558
1620
  function Z() {
1559
1621
  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)}`;
1560
1622
  }
1561
- var Kt = 3e4;
1562
- function qt(e) {
1623
+ var en = 3e4;
1624
+ function tn(e) {
1563
1625
  let t = e.container;
1564
1626
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
1565
1627
  let n = document.createElement("iframe");
1566
- n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true");
1628
+ n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write; fullscreen"), n.setAttribute("allowfullscreen", ""), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true"), n.setAttribute("fetchpriority", "high"), "fetchPriority" in n && (n.fetchPriority = "high");
1567
1629
  let r = !1, i = !1, a = null, o = null, s = (r) => {
1568
- i !== r && (i = r, r ? (a = Ht(n), o = document.body.style.overflow, document.body.append(n), Ut(n), document.body.style.overflow = "hidden") : (t.append(n), Wt(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
1630
+ i !== r && (i = r, r ? (a = Xt(n), o = document.body.style.overflow, document.body.append(n), Zt(n), document.body.style.overflow = "hidden") : (t.append(n), Qt(n, a), a = null, o !== null && (document.body.style.overflow = o, o = null)), e.onFullWindowChange?.(r));
1569
1631
  }, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
1570
1632
  p = e, m = t;
1571
1633
  }), g = () => {
@@ -1576,10 +1638,10 @@ function qt(e) {
1576
1638
  let i = Date.now();
1577
1639
  if (d > 0 && i - d < 250) return;
1578
1640
  d = i, g();
1579
- let a = It(t.launch, t.session, t.chrome), o = () => {
1641
+ let a = Wt(t.launch, t.session, t.chrome), o = () => {
1580
1642
  if (r) return;
1581
1643
  let t = n.contentWindow;
1582
- t && jt(t, a, e.playerOrigin);
1644
+ t && zt(t, a, e.playerOrigin);
1583
1645
  };
1584
1646
  o();
1585
1647
  for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
@@ -1587,17 +1649,17 @@ function qt(e) {
1587
1649
  r || !l || _(l);
1588
1650
  }, y = () => {
1589
1651
  if (u += 1, u === 1) {
1590
- At(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1652
+ Rt(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1591
1653
  return;
1592
1654
  }
1593
1655
  d = 0, v();
1594
1656
  }, b = () => {
1595
- u > 0 || m?.(Error(kt(e.playerOrigin)));
1657
+ u > 0 || m?.(Error(Lt(e.playerOrigin)));
1596
1658
  };
1597
1659
  n.addEventListener("load", y), n.addEventListener("error", b);
1598
1660
  let x = (t) => {
1599
1661
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
1600
- let i = Ft(t.data);
1662
+ let i = Ut(t.data);
1601
1663
  if (i) switch (i.type) {
1602
1664
  case "close":
1603
1665
  e.onClose?.(i.payload);
@@ -1636,7 +1698,7 @@ function qt(e) {
1636
1698
  e.onUserSpeechEnded?.(i.payload);
1637
1699
  break;
1638
1700
  case "modeChange":
1639
- e.onActivityChange?.(Gt(i.payload.mode));
1701
+ e.onActivityChange?.($t(i.payload.mode));
1640
1702
  break;
1641
1703
  case "activityChange":
1642
1704
  e.onActivityChange?.(i.payload.activity);
@@ -1695,8 +1757,8 @@ function qt(e) {
1695
1757
  let S = (t, i) => {
1696
1758
  if (r) return;
1697
1759
  let a = n.contentWindow;
1698
- if (!a) throw Error(kt(e.playerOrigin));
1699
- jt(a, t, e.playerOrigin, i);
1760
+ if (!a) throw Error(Lt(e.playerOrigin));
1761
+ zt(a, t, e.playerOrigin, i);
1700
1762
  }, C = (e, t = 12e4, n) => {
1701
1763
  let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
1702
1764
  return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
@@ -1713,7 +1775,7 @@ function qt(e) {
1713
1775
  return h;
1714
1776
  },
1715
1777
  postParentHello() {
1716
- S(Lt());
1778
+ S(Gt());
1717
1779
  },
1718
1780
  postLaunch(e, t, n) {
1719
1781
  r || (l = {
@@ -1735,13 +1797,13 @@ function qt(e) {
1735
1797
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1736
1798
  },
1737
1799
  postWidgetSetChrome(e) {
1738
- S(Rt(e));
1800
+ S(Kt(e));
1739
1801
  },
1740
1802
  postWidgetToggleAudioSettings() {
1741
- S(zt());
1803
+ S(qt());
1742
1804
  },
1743
1805
  postSetTheatre(e) {
1744
- S(Bt(e));
1806
+ S(Jt(e));
1745
1807
  },
1746
1808
  speak(e) {
1747
1809
  return C({
@@ -1863,7 +1925,7 @@ function qt(e) {
1863
1925
  audio: e.audio,
1864
1926
  byteLength: e.byteLength
1865
1927
  }
1866
- }, Kt, [e.audio]);
1928
+ }, en, [e.audio]);
1867
1929
  },
1868
1930
  speechUtteranceSetTranscript(e) {
1869
1931
  return C({
@@ -2025,7 +2087,7 @@ function qt(e) {
2025
2087
  }
2026
2088
  //#endregion
2027
2089
  //#region src/v2/embed/readyGate.ts
2028
- function Jt(e) {
2090
+ function nn(e) {
2029
2091
  let t, n = !1, r = !1, i = () => {
2030
2092
  r || !n || t === void 0 || (r = !0, e(t));
2031
2093
  };
@@ -2040,9 +2102,9 @@ function Jt(e) {
2040
2102
  }
2041
2103
  //#endregion
2042
2104
  //#region src/v2/sdkRelease.ts
2043
- var Yt = `sdk@${{
2105
+ var rn = `sdk@${{
2044
2106
  name: "@liforma/client",
2045
- version: "0.4.13",
2107
+ version: "0.4.14",
2046
2108
  type: "module",
2047
2109
  description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
2048
2110
  license: "MIT",
@@ -2203,6 +2265,8 @@ var Yt = `sdk@${{
2203
2265
  "generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
2204
2266
  "build:locations": "node scripts/build-locations.mjs",
2205
2267
  "publish:locations": "node scripts/publish-locations.mjs",
2268
+ "publish:location-400x225": "node scripts/build-location-400x225.mjs",
2269
+ "test:location-400x225": "node scripts/test-location-400x225.mjs",
2206
2270
  "verify:locations": "node scripts/verify-location-sources.mjs",
2207
2271
  "publish:models": "node scripts/publish-models.mjs",
2208
2272
  "publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
@@ -2232,6 +2296,7 @@ var Yt = `sdk@${{
2232
2296
  "preview:test": "npm run build && npm run preview"
2233
2297
  },
2234
2298
  dependencies: {
2299
+ "@jsquash/avif": "^1.3.0",
2235
2300
  "@jsquash/webp": "^1.5.0",
2236
2301
  zod: "^4.4.3"
2237
2302
  },
@@ -2261,50 +2326,54 @@ var Yt = `sdk@${{
2261
2326
  vitest: "^4.1.10",
2262
2327
  wrangler: "^4.101.0"
2263
2328
  }
2264
- }.version}`, Xt = "https://player.liforma.ai/embed", Zt = "http://localhost:3002/embed";
2265
- function Qt() {
2329
+ }.version}`, an = "https://player.liforma.ai/embed", on = "http://localhost:3002/embed";
2330
+ function sn() {
2266
2331
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
2267
2332
  if (e?.trim()) return e.trim().replace(/\/$/, "");
2268
2333
  if (typeof document > "u") return null;
2269
2334
  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();
2270
2335
  return t ? t.replace(/\/$/, "") : null;
2271
2336
  }
2272
- function $t() {
2273
- let e = Qt();
2274
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : pe() ? Zt : Xt;
2337
+ function cn() {
2338
+ let e = sn();
2339
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : ge() ? on : an;
2275
2340
  }
2276
- function en(e, t) {
2341
+ function ln(e, t) {
2277
2342
  return e?.trim() || t?.trim() || void 0;
2278
2343
  }
2279
- function tn(e, t, n, r, i, a, o, s, c, l, u) {
2280
- let d = (e ?? $t()).replace(/\/$/, ""), f = d.endsWith("/embed") ? d : `${d}/embed`, p = new URL(f), m = n?.trim();
2281
- m && p.searchParams.set("backdropId", m);
2282
- let h = r?.trim();
2283
- 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)), nn(p.toString());
2344
+ function un(e, t, n, r, i, a, o, s, c, l, u, d, f) {
2345
+ let p = (e ?? cn()).replace(/\/$/, ""), m = p.endsWith("/embed") ? p : `${p}/embed`, h = new URL(m), g = n?.trim();
2346
+ g && h.searchParams.set("backdropId", g);
2347
+ let _ = r?.trim();
2348
+ _ && h.searchParams.set("avatarId", _);
2349
+ let v = d?.trim();
2350
+ v && h.searchParams.set("previewBg", v);
2351
+ let y = f?.trim();
2352
+ return y && h.searchParams.set("previewFg", y), (i === "face" || i === "medium") && h.searchParams.set("fit", i), c === "pip" && h.searchParams.set("stage", "pip"), l === "set" && h.searchParams.set("pipBackground", "set"), u === !1 && h.searchParams.set("pipShadow", "0"), a === "widget" && h.searchParams.set("ui", "widget"), o && h.searchParams.set("close", "1"), t && h.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && h.searchParams.set("cast", String(s)), dn(h.toString());
2284
2353
  }
2285
- function nn(e) {
2354
+ function dn(e) {
2286
2355
  if (typeof location > "u") return e;
2287
2356
  let t = new URL(e);
2288
2357
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
2289
2358
  }
2290
- function rn(e) {
2359
+ function fn(e) {
2291
2360
  return new URL(e).origin;
2292
2361
  }
2293
2362
  //#endregion
2294
2363
  //#region src/v2/experienceEvents.ts
2295
- function an() {
2364
+ function pn() {
2296
2365
  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)}`;
2297
2366
  }
2298
- function on(e, t, n) {
2367
+ function mn(e, t, n) {
2299
2368
  return {
2300
- id: an(),
2369
+ id: pn(),
2301
2370
  type: e,
2302
2371
  sessionId: t,
2303
2372
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2304
2373
  data: n
2305
2374
  };
2306
2375
  }
2307
- function sn() {
2376
+ function hn() {
2308
2377
  return {
2309
2378
  ready: /* @__PURE__ */ new Set(),
2310
2379
  started: /* @__PURE__ */ new Set(),
@@ -2325,39 +2394,39 @@ function sn() {
2325
2394
  conversationProcessorError: /* @__PURE__ */ new Set()
2326
2395
  };
2327
2396
  }
2328
- function cn(e, t, n) {
2397
+ function gn(e, t, n) {
2329
2398
  return e[t].add(n), () => e[t].delete(n);
2330
2399
  }
2331
- function ln(e, t, n) {
2400
+ function _n(e, t, n) {
2332
2401
  for (let r of e[t]) r(n);
2333
2402
  }
2334
- function un(e) {
2403
+ function vn(e) {
2335
2404
  for (let t of Object.keys(e)) e[t].clear();
2336
2405
  }
2337
2406
  //#endregion
2338
2407
  //#region src/v2/speech/types.ts
2339
- function dn(e) {
2408
+ function yn(e) {
2340
2409
  return "data" in e && "format" in e && e.format != null && !("track" in e);
2341
2410
  }
2342
- function fn(e) {
2411
+ function bn(e) {
2343
2412
  return "url" in e && typeof e.url == "string";
2344
2413
  }
2345
- function pn(e) {
2414
+ function xn(e) {
2346
2415
  if (!("track" in e)) return !1;
2347
2416
  let t = e.track;
2348
2417
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
2349
2418
  }
2350
- function mn(e) {
2351
- return !dn(e) && !fn(e) && !pn(e) && "encoding" in e && typeof e.encoding == "string";
2419
+ function Sn(e) {
2420
+ return !yn(e) && !bn(e) && !xn(e) && "encoding" in e && typeof e.encoding == "string";
2352
2421
  }
2353
- var hn = [
2422
+ var Cn = [
2354
2423
  8e3,
2355
2424
  16e3,
2356
2425
  22050,
2357
2426
  24e3,
2358
2427
  44100,
2359
2428
  48e3
2360
- ], gn = {
2429
+ ], wn = {
2361
2430
  MAX_CHUNK_BYTES: 64 * 1024,
2362
2431
  RECOMMENDED_CHUNK_MS_MIN: 20,
2363
2432
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -2368,14 +2437,14 @@ var hn = [
2368
2437
  MAX_UTTERANCE_DURATION_MS: 9e4,
2369
2438
  MAX_PENDING_WRITES: 8,
2370
2439
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
2371
- }, _n = class extends Error {
2440
+ }, Tn = class extends Error {
2372
2441
  operation;
2373
2442
  requiredCapability;
2374
2443
  name = "UnsupportedSpeechOperationError";
2375
2444
  constructor(e, t) {
2376
2445
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
2377
2446
  }
2378
- }, vn = class extends Error {
2447
+ }, En = class extends Error {
2379
2448
  name = "SpeechUtteranceClosedError";
2380
2449
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
2381
2450
  super(e);
@@ -2385,72 +2454,72 @@ var hn = [
2385
2454
  constructor(e, t) {
2386
2455
  super(e, t);
2387
2456
  }
2388
- }, yn = class extends Error {
2457
+ }, Dn = class extends Error {
2389
2458
  name = "SpeechBufferTimeoutError";
2390
2459
  constructor(e = "Timed out waiting for speech buffer capacity.") {
2391
2460
  super(e);
2392
2461
  }
2393
2462
  };
2394
- function bn(e = "none") {
2463
+ function On(e = "none") {
2395
2464
  return {
2396
2465
  mode: e,
2397
2466
  trackedDurationMs: 0,
2398
2467
  fallbackDurationMs: 0
2399
2468
  };
2400
2469
  }
2401
- function xn(e) {
2402
- return hn.includes(e);
2470
+ function kn(e) {
2471
+ return Cn.includes(e);
2403
2472
  }
2404
- function Sn(e) {
2473
+ function An(e) {
2405
2474
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
2406
2475
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
2407
- if (!xn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2476
+ if (!kn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2408
2477
  }
2409
- function Cn(e) {
2410
- if (dn(e)) {
2411
- Sn(e.format);
2478
+ function jn(e) {
2479
+ if (yn(e)) {
2480
+ An(e.format);
2412
2481
  return;
2413
2482
  }
2414
- if (fn(e)) {
2483
+ if (bn(e)) {
2415
2484
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
2416
- if (e.sampleRate !== void 0 && !xn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2485
+ if (e.sampleRate !== void 0 && !kn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2417
2486
  return;
2418
2487
  }
2419
- if (pn(e)) {
2488
+ if (xn(e)) {
2420
2489
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
2421
- if (e.sampleRate !== void 0 && !xn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2490
+ if (e.sampleRate !== void 0 && !kn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2422
2491
  return;
2423
2492
  }
2424
- if (mn(e)) {
2493
+ if (Sn(e)) {
2425
2494
  let t = e.encoding.trim().toLowerCase();
2426
2495
  if (!t) throw new Q("Encoded audio MIME type is required.");
2427
2496
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
2428
- if (e.sampleRate !== void 0 && !xn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2497
+ if (e.sampleRate !== void 0 && !kn(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
2429
2498
  return;
2430
2499
  }
2431
2500
  throw new Q("Unsupported speech.play audio shape.");
2432
2501
  }
2433
- function wn(e) {
2434
- if (e.format) return Sn(e.format), e.format;
2502
+ function Mn(e) {
2503
+ if (e.format) return An(e.format), e.format;
2435
2504
  if (e.track) {
2436
2505
  let t = {
2437
2506
  encoding: "pcm_s16le",
2438
2507
  sampleRate: e.sampleRate ?? 24e3,
2439
2508
  channels: 1
2440
2509
  };
2441
- return Sn(t), t;
2510
+ return An(t), t;
2442
2511
  }
2443
2512
  throw new Q("createUtterance requires format or track.");
2444
2513
  }
2445
- function Tn(e) {
2514
+ function Nn(e) {
2446
2515
  return e instanceof Uint8Array ? e : new Uint8Array(e);
2447
2516
  }
2448
- function En(e) {
2517
+ function Pn(e) {
2449
2518
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
2450
2519
  }
2451
2520
  //#endregion
2452
2521
  //#region src/byo/pcm.ts
2453
- function Dn(e) {
2522
+ function Fn(e) {
2454
2523
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
2455
2524
  for (let t = 0; t < e.length; t++) {
2456
2525
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -2460,11 +2529,11 @@ function Dn(e) {
2460
2529
  }
2461
2530
  //#endregion
2462
2531
  //#region src/byo/resample.ts
2463
- function On(e, t, n, r, i) {
2532
+ function In(e, t, n, r, i) {
2464
2533
  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;
2465
2534
  return ((a * i + o) * i + s) * i + c;
2466
2535
  }
2467
- function kn(e, t) {
2536
+ function Ln(e, t) {
2468
2537
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
2469
2538
  if (e === t) return {
2470
2539
  fromRate: e,
@@ -2487,7 +2556,7 @@ function kn(e, t) {
2487
2556
  let a = [];
2488
2557
  for (; i + 2 < r.length - 1;) {
2489
2558
  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);
2490
- a.push(On(r[o], r[e], r[s], r[c], t)), i += n;
2559
+ a.push(In(r[o], r[e], r[s], r[c], t)), i += n;
2491
2560
  }
2492
2561
  let o = Math.max(0, Math.floor(i) - 1);
2493
2562
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -2499,7 +2568,7 @@ function kn(e, t) {
2499
2568
  }
2500
2569
  //#endregion
2501
2570
  //#region src/byo/audioCapture.ts
2502
- var An = "liforma-pcm-capture", jn = `
2571
+ var Rn = "liforma-pcm-capture", zn = `
2503
2572
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2504
2573
  process(inputs) {
2505
2574
  const ch = inputs[0] && inputs[0][0];
@@ -2511,29 +2580,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
2511
2580
  return true;
2512
2581
  }
2513
2582
  }
2514
- registerProcessor('${An}', LiformaPcmCaptureProcessor);
2515
- `, Mn = null;
2516
- function Nn() {
2517
- return Mn ||= URL.createObjectURL(new Blob([jn], { type: "application/javascript" })), Mn;
2583
+ registerProcessor('${Rn}', LiformaPcmCaptureProcessor);
2584
+ `, Bn = null;
2585
+ function Vn() {
2586
+ return Bn ||= URL.createObjectURL(new Blob([zn], { type: "application/javascript" })), Bn;
2518
2587
  }
2519
- function Pn() {
2588
+ function Hn() {
2520
2589
  return window.AudioContext || window.webkitAudioContext || null;
2521
2590
  }
2522
- async function Fn(e) {
2523
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Pn();
2591
+ async function Un(e) {
2592
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Hn();
2524
2593
  if (!o) throw Error("Web Audio is required for audio capture");
2525
2594
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
2526
2595
  l.gain.value = 0;
2527
- let u = s.sampleRate, d = kn(u, n), f = !1, p = !1, m = (e) => {
2596
+ let u = s.sampleRate, d = Ln(u, n), f = !1, p = !1, m = (e) => {
2528
2597
  if (f || i && !i()) return;
2529
2598
  let t = d.push(e);
2530
- t.length !== 0 && r(Dn(t));
2599
+ t.length !== 0 && r(Fn(t));
2531
2600
  }, h = () => void 0;
2532
2601
  return await (async () => {
2533
2602
  if (typeof s.audioWorklet?.addModule != "function") return !1;
2534
2603
  try {
2535
- await s.audioWorklet.addModule(Nn());
2536
- let e = new AudioWorkletNode(s, An, {
2604
+ await s.audioWorklet.addModule(Vn());
2605
+ let e = new AudioWorkletNode(s, Rn, {
2537
2606
  numberOfInputs: 1,
2538
2607
  numberOfOutputs: 1,
2539
2608
  outputChannelCount: [1]
@@ -2583,7 +2652,7 @@ async function Fn(e) {
2583
2652
  }
2584
2653
  //#endregion
2585
2654
  //#region src/v2/speech/captureMediaStreamTrack.ts
2586
- async function In(e) {
2655
+ async function Wn(e) {
2587
2656
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
2588
2657
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
2589
2658
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -2592,18 +2661,18 @@ async function In(e) {
2592
2661
  s || (s = !0, c?.stop(), c = null);
2593
2662
  };
2594
2663
  try {
2595
- c = await Fn({
2664
+ c = await Un({
2596
2665
  mediaStream: a,
2597
2666
  targetSampleRate: r,
2598
2667
  shouldSend: () => !s && !i?.aborted,
2599
2668
  onPcm: (e) => {
2600
2669
  if (s || i?.aborted) return;
2601
- let t = Tn(e);
2670
+ let t = Nn(e);
2602
2671
  o = o.then(async () => {
2603
2672
  if (s || i?.aborted) return;
2604
2673
  let e = 0;
2605
2674
  for (; e < t.byteLength;) {
2606
- let r = Math.min(e + gn.MAX_CHUNK_BYTES, t.byteLength);
2675
+ let r = Math.min(e + wn.MAX_CHUNK_BYTES, t.byteLength);
2607
2676
  if ((r - e) % 2 == 1 && --r, r <= e) break;
2608
2677
  let i = t.subarray(e, r);
2609
2678
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -2627,10 +2696,10 @@ async function In(e) {
2627
2696
  }
2628
2697
  //#endregion
2629
2698
  //#region src/v2/speech/speechController.ts
2630
- async function Ln(e, t) {
2631
- if (pn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2632
- if (dn(e)) {
2633
- let t = Tn(e.data);
2699
+ async function Gn(e, t) {
2700
+ if (xn(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2701
+ if (yn(e)) {
2702
+ let t = Nn(e.data);
2634
2703
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
2635
2704
  return {
2636
2705
  kind: "pcm",
@@ -2638,17 +2707,17 @@ async function Ln(e, t) {
2638
2707
  format: e.format
2639
2708
  };
2640
2709
  }
2641
- if (fn(e)) return {
2710
+ if (bn(e)) return {
2642
2711
  kind: "url",
2643
2712
  url: e.url.trim(),
2644
2713
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2645
2714
  };
2646
- if (!mn(e)) throw new Q("Unsupported speech.play audio shape.");
2715
+ if (!Sn(e)) throw new Q("Unsupported speech.play audio shape.");
2647
2716
  let n;
2648
2717
  if (typeof Blob < "u" && e.data instanceof Blob) {
2649
2718
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
2650
2719
  n = new Uint8Array(await e.data.arrayBuffer());
2651
- } else n = Tn(e.data);
2720
+ } else n = Nn(e.data);
2652
2721
  return {
2653
2722
  kind: "encoded",
2654
2723
  data: n.slice().buffer,
@@ -2656,10 +2725,10 @@ async function Ln(e, t) {
2656
2725
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
2657
2726
  };
2658
2727
  }
2659
- function Rn() {
2728
+ function Kn() {
2660
2729
  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)}`;
2661
2730
  }
2662
- function zn(e, t = "completed") {
2731
+ function qn(e, t = "completed") {
2663
2732
  return {
2664
2733
  utteranceId: e.speechId,
2665
2734
  characterId: e.characterId,
@@ -2673,13 +2742,13 @@ function zn(e, t = "completed") {
2673
2742
  }
2674
2743
  };
2675
2744
  }
2676
- function Bn(e) {
2745
+ function Jn(e) {
2677
2746
  return e instanceof Error ? e : new Q(String(e));
2678
2747
  }
2679
- function Vn(e) {
2748
+ function Yn(e) {
2680
2749
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
2681
2750
  }
2682
- var Hn = class {
2751
+ var Xn = class {
2683
2752
  id;
2684
2753
  characterId;
2685
2754
  result;
@@ -2708,29 +2777,29 @@ var Hn = class {
2708
2777
  queue: e.queue,
2709
2778
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
2710
2779
  }).catch((e) => {
2711
- throw this.fail(Bn(e)), Bn(e);
2780
+ throw this.fail(Jn(e)), Jn(e);
2712
2781
  }), this.signal?.addEventListener("abort", () => {
2713
2782
  this.cancel();
2714
2783
  }, { once: !0 });
2715
2784
  }
2716
2785
  async write(e, t) {
2717
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new vn();
2718
- let n = Tn(e);
2786
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new En();
2787
+ let n = Nn(e);
2719
2788
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
2720
- if (n.byteLength > gn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${gn.MAX_CHUNK_BYTES}).`);
2789
+ if (n.byteLength > wn.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${wn.MAX_CHUNK_BYTES}).`);
2721
2790
  if (n.byteLength === 0) return;
2722
- let r = t?.timeoutMs ?? gn.DEFAULT_WRITE_TIMEOUT_MS;
2791
+ let r = t?.timeoutMs ?? wn.DEFAULT_WRITE_TIMEOUT_MS;
2723
2792
  await this.acquireWriteSlot(r);
2724
2793
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
2725
- if (this.bufferedMs + i > gn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2794
+ if (this.bufferedMs + i > wn.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2726
2795
  let a = async () => {
2727
- if (this.closed || this.settled) throw new vn();
2796
+ if (this.closed || this.settled) throw new En();
2728
2797
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
2729
2798
  utteranceId: this.id,
2730
2799
  audio: t.buffer,
2731
2800
  byteLength: t.byteLength
2732
2801
  }), a = await Promise.race([i, new Promise((e, t) => {
2733
- setTimeout(() => t(new yn()), r);
2802
+ setTimeout(() => t(new Dn()), r);
2734
2803
  })]);
2735
2804
  this.bufferedMs = Math.max(0, a.bufferedMs);
2736
2805
  }, o = this.writeChain.then(a, a);
@@ -2742,7 +2811,7 @@ var Hn = class {
2742
2811
  }
2743
2812
  }
2744
2813
  async setTranscript(e) {
2745
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new vn();
2814
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new En();
2746
2815
  await this.requireHost().speechUtteranceSetTranscript({
2747
2816
  utteranceId: this.id,
2748
2817
  transcript: e
@@ -2759,7 +2828,7 @@ var Hn = class {
2759
2828
  });
2760
2829
  return this.resolve(t), t;
2761
2830
  } catch (e) {
2762
- let t = Bn(e);
2831
+ let t = Jn(e);
2763
2832
  throw this.fail(t), t;
2764
2833
  }
2765
2834
  }
@@ -2777,11 +2846,11 @@ var Hn = class {
2777
2846
  characterId: this.characterId,
2778
2847
  status: "cancelled",
2779
2848
  durationMs: 0,
2780
- animation: bn("none")
2849
+ animation: On("none")
2781
2850
  };
2782
2851
  return this.resolve(t), t;
2783
2852
  } catch (e) {
2784
- let t = Bn(e);
2853
+ let t = Jn(e);
2785
2854
  throw this.fail(t), t;
2786
2855
  }
2787
2856
  }
@@ -2794,19 +2863,19 @@ var Hn = class {
2794
2863
  return e;
2795
2864
  }
2796
2865
  resolve(e) {
2797
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new vn()));
2866
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new En()));
2798
2867
  }
2799
2868
  fail(e) {
2800
2869
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
2801
2870
  }
2802
2871
  async acquireWriteSlot(e) {
2803
- if (this.pendingWriteCount < gn.MAX_PENDING_WRITES) {
2872
+ if (this.pendingWriteCount < wn.MAX_PENDING_WRITES) {
2804
2873
  this.pendingWriteCount += 1;
2805
2874
  return;
2806
2875
  }
2807
2876
  await new Promise((t, n) => {
2808
2877
  let r = setTimeout(() => {
2809
- n(new yn());
2878
+ n(new Dn());
2810
2879
  }, e);
2811
2880
  this.pendingWriteWaiters.push({
2812
2881
  resolve: () => {
@@ -2825,13 +2894,13 @@ var Hn = class {
2825
2894
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2826
2895
  }
2827
2896
  };
2828
- function Un(e) {
2897
+ function Zn(e) {
2829
2898
  let t = null, n = (t, n) => {
2830
- if (!e.getCapabilities()[n]) throw new _n(t, n);
2899
+ if (!e.getCapabilities()[n]) throw new Tn(t, n);
2831
2900
  }, r = {
2832
2901
  async speak(r) {
2833
2902
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2834
- let i = En(r.queue ?? "append");
2903
+ let i = Pn(r.queue ?? "append");
2835
2904
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2836
2905
  let a = e.getIframeHost();
2837
2906
  if (!a) throw new Q("Speech session is not attached.");
@@ -2851,41 +2920,41 @@ function Un(e) {
2851
2920
  return;
2852
2921
  }
2853
2922
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2854
- t.removeEventListener("abort", s), n(zn(e, "completed"));
2923
+ t.removeEventListener("abort", s), n(qn(e, "completed"));
2855
2924
  }, (a) => {
2856
- if (t.removeEventListener("abort", s), Vn(a)) {
2925
+ if (t.removeEventListener("abort", s), Yn(a)) {
2857
2926
  n({
2858
2927
  utteranceId: "utt_interrupted",
2859
2928
  characterId: r.characterId ?? e.getActiveCharacterId(),
2860
2929
  status: "interrupted",
2861
2930
  durationMs: 0,
2862
2931
  transcript: r.text,
2863
- animation: bn("none")
2932
+ animation: On("none")
2864
2933
  });
2865
2934
  return;
2866
2935
  }
2867
- i(Bn(a));
2936
+ i(Jn(a));
2868
2937
  });
2869
2938
  });
2870
2939
  }
2871
2940
  try {
2872
- return zn(await o, "completed");
2941
+ return qn(await o, "completed");
2873
2942
  } catch (t) {
2874
- if (Vn(t)) return {
2943
+ if (Yn(t)) return {
2875
2944
  utteranceId: "utt_interrupted",
2876
2945
  characterId: r.characterId ?? e.getActiveCharacterId(),
2877
2946
  status: "interrupted",
2878
2947
  durationMs: 0,
2879
2948
  transcript: r.text,
2880
- animation: bn("none")
2949
+ animation: On("none")
2881
2950
  };
2882
- throw Bn(t);
2951
+ throw Jn(t);
2883
2952
  }
2884
2953
  },
2885
2954
  async play(i) {
2886
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Cn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2955
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), jn(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2887
2956
  let a = i.queue ?? "append";
2888
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), pn(i.audio)) {
2957
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), xn(i.audio)) {
2889
2958
  let e = i.audio.sampleRate ?? 24e3;
2890
2959
  return r.createUtterance({
2891
2960
  format: {
@@ -2901,7 +2970,7 @@ function Un(e) {
2901
2970
  }
2902
2971
  let o = e.getIframeHost();
2903
2972
  if (!o) throw new Q("Speech session is not attached.");
2904
- let s = await Ln(i.audio, i.signal);
2973
+ let s = await Gn(i.audio, i.signal);
2905
2974
  return o.speechPlay({
2906
2975
  source: s,
2907
2976
  characterId: i.characterId,
@@ -2913,13 +2982,13 @@ function Un(e) {
2913
2982
  },
2914
2983
  createUtterance(r) {
2915
2984
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2916
- let i = wn(r);
2985
+ let i = Mn(r);
2917
2986
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2918
2987
  let a = r.queue ?? "replace-active";
2919
2988
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2920
2989
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2921
- let o = new Hn({
2922
- id: Rn(),
2990
+ let o = new Xn({
2991
+ id: Kn(),
2923
2992
  characterId: r.characterId ?? e.getActiveCharacterId(),
2924
2993
  format: i,
2925
2994
  queue: a,
@@ -2931,7 +3000,7 @@ function Un(e) {
2931
3000
  t === o && (t = null);
2932
3001
  }), r.track && (async () => {
2933
3002
  try {
2934
- if (await In({
3003
+ if (await Wn({
2935
3004
  track: r.track,
2936
3005
  utterance: o,
2937
3006
  sampleRate: i.sampleRate,
@@ -2959,16 +3028,16 @@ function Un(e) {
2959
3028
  }
2960
3029
  //#endregion
2961
3030
  //#region src/v2/types/sessionInteraction.ts
2962
- function Wn(e) {
3031
+ function Qn(e) {
2963
3032
  let t = e?.trim();
2964
3033
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2965
3034
  }
2966
3035
  //#endregion
2967
3036
  //#region src/v2/experience.ts
2968
- function Gn(e) {
3037
+ function $n(e) {
2969
3038
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2970
3039
  }
2971
- var Kn = class e {
3040
+ var er = class e {
2972
3041
  bootstrap;
2973
3042
  conversationProcessor;
2974
3043
  iframeHost = null;
@@ -2988,17 +3057,17 @@ var Kn = class e {
2988
3057
  pendingTheatre = null;
2989
3058
  lastInteraction = null;
2990
3059
  closeHandlers = [];
2991
- eventRegistry = sn();
3060
+ eventRegistry = hn();
2992
3061
  readyEnvelope = null;
2993
3062
  startedEnvelope = null;
2994
3063
  sessionMintedEnvelope = null;
2995
3064
  conversationCache = [];
2996
3065
  speech;
2997
3066
  constructor(e) {
2998
- 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 = Un({
3067
+ this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = Zn({
2999
3068
  getIframeHost: () => this.iframeHost,
3000
3069
  assertSessionStarted: () => this.assertSessionStarted(),
3001
- getCapabilities: () => qn(this.resolvedSession),
3070
+ getCapabilities: () => tr(this.resolvedSession),
3002
3071
  getActiveCharacterId: () => "character_unknown",
3003
3072
  onProcessorInterrupt: () => {
3004
3073
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -3019,6 +3088,8 @@ var Kn = class e {
3019
3088
  embedBaseUrl: t.embedBaseUrl,
3020
3089
  debug: t.debug,
3021
3090
  speechOnly: t.speechOnly,
3091
+ previewBackground: t.previewBackground,
3092
+ previewForeground: t.previewForeground,
3022
3093
  ui: t.ui,
3023
3094
  onStart: t.onStart,
3024
3095
  onUserTranscript: t.onUserTranscript,
@@ -3042,6 +3113,8 @@ var Kn = class e {
3042
3113
  mode: t.mode,
3043
3114
  speechInputMode: t.speechInputMode,
3044
3115
  speechOnly: t.speechOnly,
3116
+ previewBackground: t.previewBackground,
3117
+ previewForeground: t.previewForeground,
3045
3118
  attribution: t.attribution,
3046
3119
  alreadyConverted: t.alreadyConverted,
3047
3120
  ui: t.ui,
@@ -3065,6 +3138,8 @@ var Kn = class e {
3065
3138
  mode: t.mode,
3066
3139
  speechInputMode: t.speechInputMode,
3067
3140
  speechOnly: t.speechOnly,
3141
+ previewBackground: t.previewBackground,
3142
+ previewForeground: t.previewForeground,
3068
3143
  attribution: t.attribution,
3069
3144
  alreadyConverted: t.alreadyConverted,
3070
3145
  ui: t.ui,
@@ -3081,7 +3156,7 @@ var Kn = class e {
3081
3156
  return null;
3082
3157
  }
3083
3158
  on(e, t) {
3084
- let n = cn(this.eventRegistry, e, t);
3159
+ let n = gn(this.eventRegistry, e, t);
3085
3160
  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;
3086
3161
  }
3087
3162
  async attach(e) {
@@ -3095,13 +3170,13 @@ var Kn = class e {
3095
3170
  if (this.closed) throw Error("Session has ended.");
3096
3171
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
3097
3172
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
3098
- let t = this.bootstrap.embedBaseUrl ?? $t(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = tn(t, n, r ? void 0 : en(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, Gn(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow), a = rn(i), o = null, s = new Promise((e) => {
3173
+ let t = this.bootstrap.embedBaseUrl ?? cn(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = un(t, n, r ? void 0 : ln(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, $n(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize, e.stage, e.pipBackground, e.pipShadow, r ? void 0 : this.bootstrap.previewBackground, r ? void 0 : this.bootstrap.previewForeground), a = fn(i), o = null, s = new Promise((e) => {
3099
3174
  o = e;
3100
3175
  }), c = null, l = new Promise((e) => {
3101
3176
  c = e;
3102
- }), u = Jt((e) => {
3177
+ }), u = nn((e) => {
3103
3178
  this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
3104
- }), d = this.bootstrap.onUserTranscript, f = qt({
3179
+ }), d = this.bootstrap.onUserTranscript, f = tn({
3105
3180
  container: e.container,
3106
3181
  src: i,
3107
3182
  playerOrigin: a,
@@ -3168,7 +3243,7 @@ var Kn = class e {
3168
3243
  onTheatreChange: (t) => e.onTheatreChange?.(t)
3169
3244
  });
3170
3245
  this.iframeHost = f;
3171
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), wt(this.bootstrap.sessionEndpoint, {
3246
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), Mt(this.bootstrap.sessionEndpoint, {
3172
3247
  experienceId: this.bootstrap.experienceId,
3173
3248
  locale: this.bootstrap.locale,
3174
3249
  secondaryLocale: this.bootstrap.secondaryLocale,
@@ -3180,7 +3255,7 @@ var Kn = class e {
3180
3255
  attribution: this.bootstrap.attribution,
3181
3256
  alreadyConverted: this.bootstrap.alreadyConverted,
3182
3257
  signal: this.endpointAbortController.signal
3183
- })) : this.bootstrap.kind === "public" ? Ct(this.bootstrap.experienceId, {
3258
+ })) : this.bootstrap.kind === "public" ? jt(this.bootstrap.experienceId, {
3184
3259
  locale: this.bootstrap.locale,
3185
3260
  secondaryLocale: this.bootstrap.secondaryLocale,
3186
3261
  learningLocale: this.bootstrap.learningLocale,
@@ -3204,7 +3279,7 @@ var Kn = class e {
3204
3279
  operation: "attach",
3205
3280
  message: e instanceof Error ? e.message : String(e),
3206
3281
  stack: e instanceof Error ? e.stack : void 0,
3207
- release: Yt
3282
+ release: rn
3208
3283
  });
3209
3284
  } catch {}
3210
3285
  throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
@@ -3216,7 +3291,7 @@ var Kn = class e {
3216
3291
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
3217
3292
  this.launchToken = g;
3218
3293
  let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
3219
- return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && ht(_), f.postLaunch(g, _, {
3294
+ return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Ct(_), f.postLaunch(g, _, {
3220
3295
  startButton: e.startButton,
3221
3296
  theme: e.theme,
3222
3297
  showFeedback: e.showFeedback,
@@ -3240,7 +3315,7 @@ var Kn = class e {
3240
3315
  operation: "attach",
3241
3316
  message: e instanceof Error ? e.message : String(e),
3242
3317
  stack: e instanceof Error ? e.stack : void 0,
3243
- release: Yt
3318
+ release: rn
3244
3319
  });
3245
3320
  } catch {}
3246
3321
  throw e;
@@ -3254,7 +3329,7 @@ var Kn = class e {
3254
3329
  operation: "attach",
3255
3330
  message: e instanceof Error ? e.message : String(e),
3256
3331
  stack: e instanceof Error ? e.stack : void 0,
3257
- release: Yt
3332
+ release: rn
3258
3333
  });
3259
3334
  } catch {}
3260
3335
  throw e;
@@ -3286,7 +3361,7 @@ var Kn = class e {
3286
3361
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
3287
3362
  }
3288
3363
  async setFit(e) {
3289
- let t = Wn(e);
3364
+ let t = Qn(e);
3290
3365
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
3291
3366
  if (this.closed) throw Error("Session has ended.");
3292
3367
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
@@ -3336,7 +3411,7 @@ var Kn = class e {
3336
3411
  this.close();
3337
3412
  }
3338
3413
  destroy() {
3339
- 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, un(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
3414
+ this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, vn(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
3340
3415
  }
3341
3416
  resolveMintInteraction() {
3342
3417
  return this.bootstrap.kind === "launch" ? {} : {
@@ -3348,8 +3423,8 @@ var Kn = class e {
3348
3423
  return this.resolvedSession?.id ?? "";
3349
3424
  }
3350
3425
  emitWrapped(e, t) {
3351
- let n = on(e, this.getSessionId(), t);
3352
- return ln(this.eventRegistry, e, n), n;
3426
+ let n = mn(e, this.getSessionId(), t);
3427
+ return _n(this.eventRegistry, e, n), n;
3353
3428
  }
3354
3429
  queueProcessorTurn(e) {
3355
3430
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -3358,7 +3433,7 @@ var Kn = class e {
3358
3433
  let n = this.processorAbortController.signal;
3359
3434
  this.processorChain = this.processorChain.then(async () => {
3360
3435
  if (!n.aborted) try {
3361
- let r = await Dt(t, {
3436
+ let r = await Ft(t, {
3362
3437
  utteranceId: e.utteranceId,
3363
3438
  text: e.text,
3364
3439
  conversation: this.conversationCache,
@@ -3408,7 +3483,7 @@ var Kn = class e {
3408
3483
  };
3409
3484
  }
3410
3485
  };
3411
- function qn(e) {
3486
+ function tr(e) {
3412
3487
  return e ? {
3413
3488
  textSpeech: e.capabilities.speech.output,
3414
3489
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -3419,41 +3494,41 @@ function qn(e) {
3419
3494
  }
3420
3495
  //#endregion
3421
3496
  //#region src/widget/dockGeometry.ts
3422
- var Jn = "(min-width: 768px)", Yn = 24, Xn = .5, Zn = 1200, Qn = .85, $n = 9 / 16;
3423
- function er() {
3497
+ var nr = "(min-width: 768px)", rr = 24, ir = .5, ar = 1200, or = .85, sr = 9 / 16;
3498
+ function cr() {
3424
3499
  if (typeof window > "u") return 800;
3425
3500
  let e = window.screen?.availHeight;
3426
3501
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
3427
3502
  }
3428
- function tr(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = Yn, r = typeof window < "u" ? er() : 800) {
3429
- let i = Math.max(160, Math.min(t - n * 2, t * Qn)), a = Math.max(120, e - n * 2), o = Math.min(r * Xn, Zn, i), s = o * $n;
3430
- return s > a && (s = a, o = s / $n, o > i && (o = i, s = o * $n)), {
3503
+ function lr(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = rr, r = typeof window < "u" ? cr() : 800) {
3504
+ let i = Math.max(160, Math.min(t - n * 2, t * or)), a = Math.max(120, e - n * 2), o = Math.min(r * ir, ar, i), s = o * sr;
3505
+ return s > a && (s = a, o = s / sr, o > i && (o = i, s = o * sr)), {
3431
3506
  width: Math.round(s),
3432
3507
  height: Math.round(o)
3433
3508
  };
3434
3509
  }
3435
- function nr(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = Yn) {
3510
+ function ur(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = rr) {
3436
3511
  return {
3437
3512
  left: Math.max(r, t - e.width - r),
3438
3513
  top: Math.max(r, n - e.height - r)
3439
3514
  };
3440
3515
  }
3441
- function rr(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = Yn) {
3516
+ function dr(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = rr) {
3442
3517
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
3443
3518
  return {
3444
3519
  left: Math.min(Math.max(a, e), o),
3445
3520
  top: Math.min(Math.max(a, t), s)
3446
3521
  };
3447
3522
  }
3448
- function ir(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3449
- return e(Jn).matches;
3523
+ function fr(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
3524
+ return e(nr).matches;
3450
3525
  }
3451
3526
  //#endregion
3452
3527
  //#region src/widget/mountExperienceWidget.ts
3453
- function ar(e) {
3528
+ function pr(e) {
3454
3529
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
3455
3530
  }
3456
- function or(e) {
3531
+ function mr(e) {
3457
3532
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
3458
3533
  let t = typeof e == "string" ? e.trim() : "";
3459
3534
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -3461,10 +3536,10 @@ function or(e) {
3461
3536
  function $(e) {
3462
3537
  return e === "expanded" || e === "docked";
3463
3538
  }
3464
- var sr = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"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>", cr = "<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>", lr = "<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>", ur = "<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>";
3465
- function dr(e, t, n) {
3539
+ var hr = "<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>", gr = "<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>", _r = "<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>", vr = "<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>";
3540
+ function yr(e, t, n) {
3466
3541
  Ve(ze);
3467
- let r = fe({
3542
+ let r = he({
3468
3543
  galleryThumb: t.galleryThumb,
3469
3544
  avatarImage: t.avatarImage,
3470
3545
  backgroundImage: t.backgroundImage,
@@ -3492,7 +3567,7 @@ function dr(e, t, n) {
3492
3567
  }
3493
3568
  return e.replaceChildren(i), n?.parallax === !1 ? () => {} : Re(i);
3494
3569
  }
3495
- function fr(e) {
3570
+ function br(e) {
3496
3571
  return e.startButton ? {
3497
3572
  ...e.startButton,
3498
3573
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -3504,7 +3579,7 @@ function fr(e) {
3504
3579
  variant: "primary"
3505
3580
  };
3506
3581
  }
3507
- function pr(e) {
3582
+ function xr(e) {
3508
3583
  let t = !1, n = () => {
3509
3584
  t || e();
3510
3585
  }, r = () => {
@@ -3524,12 +3599,12 @@ function pr(e) {
3524
3599
  t = !0, window.removeEventListener("load", r), i?.();
3525
3600
  };
3526
3601
  }
3527
- function mr(e, t) {
3528
- Ke(We);
3602
+ function Sr(e, t) {
3603
+ et(Qe);
3529
3604
  let n = t.experienceId?.trim();
3530
3605
  if (!n) throw Error("ExperienceWidget requires experienceId.");
3531
- let r = t.prefetch ?? "onExpand", i = ar(t.position), a = document.createElement("div");
3532
- 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", or(t.offset));
3606
+ let r = t.prefetch ?? "onExpand", i = pr(t.position), a = document.createElement("div");
3607
+ a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", mr(t.offset));
3533
3608
  let o = document.createElement("button");
3534
3609
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
3535
3610
  let s = document.createElement("div");
@@ -3549,11 +3624,11 @@ function mr(e, t) {
3549
3624
  let m = document.createElement("span");
3550
3625
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
3551
3626
  let h = document.createElement("button");
3552
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = lr, h.setAttribute("aria-label", "Reduce");
3627
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = _r, h.setAttribute("aria-label", "Reduce");
3553
3628
  let g = document.createElement("button");
3554
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = sr, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
3629
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = hr, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
3555
3630
  let _ = document.createElement("button");
3556
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = cr, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3631
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = gr, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
3557
3632
  let v = document.createElement("div");
3558
3633
  v.className = "liforma-ew__stage";
3559
3634
  let y = document.createElement("div");
@@ -3561,70 +3636,70 @@ function mr(e, t) {
3561
3636
  let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, ee = null, j = null, M = null, N = null, P = null, F = null, te = 0, I = 0, L = null, ne = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
3562
3637
  let e = a.dataset.state;
3563
3638
  return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
3564
- }, z = () => {
3565
- j !== null && (clearTimeout(j), j = null);
3566
3639
  }, ae = () => {
3640
+ j !== null && (clearTimeout(j), j = null);
3641
+ }, oe = () => {
3567
3642
  M !== null && (clearTimeout(M), M = null), a.classList.remove("liforma-ew--layout-settling");
3568
- }, B = () => {
3643
+ }, z = () => {
3569
3644
  for (let e of [
3570
3645
  f,
3571
3646
  l,
3572
3647
  p
3573
3648
  ]) e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("width"), e.style.removeProperty("height"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
3574
3649
  p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging");
3575
- }, oe = (e, t, n, r) => {
3650
+ }, se = (e, t, n, r) => {
3576
3651
  let i = (i) => {
3577
3652
  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";
3578
3653
  };
3579
3654
  i(f), i(l);
3580
3655
  let a = p.offsetWidth || 120;
3581
3656
  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";
3582
- }, se = (e, t) => {
3583
- if (R() !== "docked") return;
3584
- let n = tr(), r = rr(e - te, t - I, n);
3585
- N = r.left, P = r.top, oe(r.left, r.top, n.width, n.height);
3586
3657
  }, ce = (e, t) => {
3658
+ if (R() !== "docked") return;
3659
+ let n = lr(), r = dr(e - te, t - I, n);
3660
+ N = r.left, P = r.top, se(r.left, r.top, n.width, n.height);
3661
+ }, le = (e, t) => {
3587
3662
  if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
3588
- let n = tr(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = rr(r + e, i + t, n);
3589
- N = a.left, P = a.top, oe(a.left, a.top, n.width, n.height);
3663
+ let n = lr(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = dr(r + e, i + t, n);
3664
+ N = a.left, P = a.top, se(a.left, a.top, n.width, n.height);
3665
+ }, B = (e) => {
3666
+ L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), ce(e.clientX, e.clientY)));
3590
3667
  }, V = (e) => {
3591
- L === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), se(e.clientX, e.clientY)));
3592
- }, H = (e) => {
3593
3668
  if (F === null || e && e.pointerId !== F) return;
3594
3669
  let t = L;
3595
- F = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && ne && (ne = !1, window.removeEventListener("pointermove", V), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H));
3596
- }, le = (e, t, n) => {
3597
- if (S || R() !== "docked" || !ir() || F !== null) return;
3670
+ F = null, L = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && ne && (ne = !1, window.removeEventListener("pointermove", B), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V));
3671
+ }, ue = (e, t, n) => {
3672
+ if (S || R() !== "docked" || !fr() || F !== null) return;
3598
3673
  F = n, L = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3599
3674
  let r = f.getBoundingClientRect();
3600
- te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", V), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
3601
- }, ue = (e) => {
3602
- if (S || R() !== "docked" || !ir() || F !== null) return;
3675
+ te = e - r.left, I = t - r.top, ne || (ne = !0, window.addEventListener("pointermove", B), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V));
3676
+ }, de = (e) => {
3677
+ if (S || R() !== "docked" || !fr() || F !== null) return;
3603
3678
  F = e.pointerId, L = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
3604
3679
  let t = f.getBoundingClientRect();
3605
3680
  N = t.left, P = t.top;
3606
- }, U = (e) => {
3607
- L === "player" && (F === null || e.pointerId !== F || ce(e.dx, e.dy));
3608
- }, de = (e) => {
3609
- L === "player" && (F === null || e.pointerId !== F || H());
3610
- }, W = () => {
3611
- let e = ir(), t = R();
3681
+ }, fe = (e) => {
3682
+ L === "player" && (F === null || e.pointerId !== F || le(e.dx, e.dy));
3683
+ }, pe = (e) => {
3684
+ L === "player" && (F === null || e.pointerId !== F || V());
3685
+ }, H = () => {
3686
+ let e = fr(), t = R();
3612
3687
  if (!e || t !== "expanded" && t !== "docked") {
3613
3688
  h.hidden = !0;
3614
3689
  return;
3615
3690
  }
3616
- h.hidden = !1, t === "docked" ? (h.innerHTML = ur, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = lr, h.setAttribute("aria-label", "Reduce"));
3617
- }, G = (e) => {
3618
- let t = tr(), n = e && N !== null && P !== null ? rr(N, P, t) : nr(t);
3619
- n = rr(n.left, n.top, t), N = n.left, P = n.top, oe(n.left, n.top, t.width, t.height), W();
3620
- }, fe = () => {
3691
+ h.hidden = !1, t === "docked" ? (h.innerHTML = vr, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = _r, h.setAttribute("aria-label", "Reduce"));
3692
+ }, me = (e) => {
3693
+ let t = lr(), n = e && N !== null && P !== null ? dr(N, P, t) : ur(t);
3694
+ n = dr(n.left, n.top, t), N = n.left, P = n.top, se(n.left, n.top, t.width, t.height), H();
3695
+ }, he = () => {
3621
3696
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
3622
3697
  requestAnimationFrame(() => {
3623
3698
  S || !$(a.dataset.state) || a.classList.add("liforma-ew--session-revealed");
3624
3699
  });
3625
3700
  });
3626
- }, pe = (e) => {
3627
- if (ae(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3701
+ }, ge = (e) => {
3702
+ if (oe(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
3628
3703
  a.classList.remove("liforma-ew--layout-settling");
3629
3704
  return;
3630
3705
  }
@@ -3633,54 +3708,54 @@ function mr(e, t) {
3633
3708
  a.classList.remove("liforma-ew--layout-settling");
3634
3709
  return;
3635
3710
  }
3636
- a.classList.remove("liforma-ew--layout-settling"), fe();
3711
+ a.classList.remove("liforma-ew--layout-settling"), he();
3637
3712
  }, 220);
3638
- }, me = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
3639
- z(), j = setTimeout(() => {
3713
+ }, _e = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
3714
+ ae(), j = setTimeout(() => {
3640
3715
  j = null, a.classList.remove("liforma-ew--session-concealing"), e();
3641
3716
  }, 280);
3642
- })), he = {
3717
+ })), ve = {
3643
3718
  galleryThumb: t.galleryThumb,
3644
3719
  avatarImage: t.avatarImage,
3645
3720
  backgroundImage: t.backgroundImage,
3646
3721
  foregroundImage: t.foregroundImage,
3647
3722
  fallbackImage: t.fallbackImage
3648
- }, ge = (e) => {
3723
+ }, U = (e) => {
3649
3724
  if (!e) {
3650
3725
  y.hidden = !0, y.textContent = "";
3651
3726
  return;
3652
3727
  }
3653
3728
  y.hidden = !1, y.textContent = e;
3654
- }, _e = (e) => {
3729
+ }, W = (e) => {
3655
3730
  if (!e) {
3656
3731
  c.hidden = !0, c.textContent = "";
3657
3732
  return;
3658
3733
  }
3659
3734
  c.hidden = !1, c.textContent = e, s.contains(c) || s.append(c);
3660
- }, ve = () => {
3661
- C = !0, o.disabled = !1, _e(null), r === "onExpand" && t.onPrefetchReady?.();
3662
3735
  }, ye = () => {
3736
+ C = !0, o.disabled = !1, W(null), r === "onExpand" && t.onPrefetchReady?.();
3737
+ }, be = () => {
3663
3738
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
3664
- }, be = (e) => {
3739
+ }, xe = (e) => {
3665
3740
  A?.(), A = null;
3666
- let t = dr(s, e, { parallax: ie });
3741
+ let t = yr(s, e, { parallax: ie });
3667
3742
  return t ? (A = t, !0) : !1;
3668
- }, K = () => {
3669
- if (be(he)) {
3670
- ve();
3743
+ }, Se = () => {
3744
+ if (xe(ve)) {
3745
+ ye();
3671
3746
  return;
3672
3747
  }
3673
- _e("Loading…"), Qe(n, { signal: re.signal }).then((e) => {
3748
+ W("Loading…"), ot(n, { signal: re.signal }).then((e) => {
3674
3749
  if (!S) {
3675
- if (!be({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3676
- ve();
3750
+ if (!xe({ galleryThumb: e.galleryThumb })) throw Error("Experience preview is missing gallery thumb images.");
3751
+ ye();
3677
3752
  }
3678
3753
  }).catch((e) => {
3679
3754
  if (S || re.signal.aborted) return;
3680
3755
  let n = e instanceof Error ? e : Error(String(e));
3681
- _e("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3756
+ W("Preview unavailable"), o.disabled = !0, t.onError?.(n), console.error("[ExperienceWidget]", n);
3682
3757
  });
3683
- }, xe = () => ({
3758
+ }, Ce = () => ({
3684
3759
  experienceId: n,
3685
3760
  ui: "widget",
3686
3761
  ...t.sessionEndpoint ? { sessionEndpoint: t.sessionEndpoint } : {},
@@ -3693,89 +3768,89 @@ function mr(e, t) {
3693
3768
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
3694
3769
  ...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
3695
3770
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
3696
- }), Se = () => ({
3771
+ }), we = () => ({
3697
3772
  ...t.fit ? { fit: t.fit } : {},
3698
- startButton: fr(t),
3773
+ startButton: br(t),
3699
3774
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
3700
3775
  ...t.interaction ? { interaction: t.interaction } : {}
3701
- }), Ce = (e = !0) => {
3702
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), B(), a.dataset.state = "expanded", ge(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
3703
- }, we = () => {
3704
- o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", ge(null), typeof document < "u" && (document.body.style.overflow = k), G(!0), W(), b?.setWidgetChrome("docked");
3705
- }, Te = (e) => {
3776
+ }), G = (e = !0) => {
3777
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), z(), a.dataset.state = "expanded", U(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), H(), e && t.onExpanded?.();
3778
+ }, Te = () => {
3779
+ o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", U(null), typeof document < "u" && (document.body.style.overflow = k), me(!0), H(), b?.setWidgetChrome("docked");
3780
+ }, Ee = (e) => {
3706
3781
  e.on("started", () => {
3707
- S || (D = !0, a.dataset.live = "true", ge(null), t.onStarted?.(), $(a.dataset.state) && fe());
3782
+ S || (D = !0, a.dataset.live = "true", U(null), t.onStarted?.(), $(a.dataset.state) && he());
3708
3783
  }), e.on("feedback", (e) => {
3709
3784
  S || t.onFeedback?.(e);
3710
3785
  }), e.on("feedbackFailed", (e) => {
3711
3786
  S || t.onFeedbackFailed?.(e);
3712
3787
  });
3713
- }, Ee = () => {
3714
- ae(), u.hidden = !0, p.hidden = !0, B(), 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), ge(null), typeof document < "u" && (document.body.style.overflow = k), W();
3715
3788
  }, De = () => {
3716
- z(), ae(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3789
+ oe(), u.hidden = !0, p.hidden = !0, z(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), U(null), typeof document < "u" && (document.body.style.overflow = k), H();
3790
+ }, Oe = () => {
3791
+ ae(), oe(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
3717
3792
  let e = b;
3718
3793
  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");
3719
- }, q = () => {
3794
+ }, K = () => {
3720
3795
  if (!S && $(a.dataset.state)) {
3721
- if (H(), x = !1, b && E) {
3796
+ if (V(), x = !1, b && E) {
3722
3797
  let e = b;
3723
3798
  (async () => {
3724
- D && (await me(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Ee(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && ye(), t.onCollapsed?.(), t.onClose?.());
3799
+ D && (await _e(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), De(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && be(), t.onCollapsed?.(), t.onClose?.());
3725
3800
  })();
3726
3801
  return;
3727
3802
  }
3728
- De(), Ee(), t.onCollapsed?.(), t.onClose?.();
3803
+ Oe(), De(), t.onCollapsed?.(), t.onClose?.();
3729
3804
  }
3730
- }, Oe = () => {
3731
- S || ir() && R() === "expanded" && pe(() => {
3732
- we();
3733
- });
3734
3805
  }, ke = () => {
3735
- S || R() === "docked" && (H(), pe(() => {
3736
- B(), Ce(!1), b?.setWidgetChrome("expanded");
3737
- }));
3806
+ S || fr() && R() === "expanded" && ge(() => {
3807
+ Te();
3808
+ });
3738
3809
  }, Ae = () => {
3739
- !b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), b.setWidgetChrome("expanded"), x = !1, fe());
3810
+ S || R() === "docked" && (V(), ge(() => {
3811
+ z(), G(!1), b?.setWidgetChrome("expanded");
3812
+ }));
3813
+ }, je = () => {
3814
+ !b || !D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), b.setWidgetChrome("expanded"), x = !1, he());
3815
+ }, q = () => {
3816
+ !b || !E || D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, w || b.setWidgetChrome("expanded"));
3817
+ }, Me = (e) => {
3818
+ S || e !== O && !D || (ae(), a.classList.remove("liforma-ew--session-revealed"), G(), x = !1, D && he());
3740
3819
  }, J = () => {
3741
- !b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, w || b.setWidgetChrome("expanded"));
3742
- }, je = (e) => {
3743
- S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), Ce(), x = !1, D && fe());
3744
- }, Me = () => {
3745
3820
  if (S || T || w || b || $(a.dataset.state)) return;
3746
3821
  T = !0;
3747
3822
  let e = O;
3748
3823
  l.hidden = !1, (async () => {
3749
3824
  try {
3750
- let t = await Kn.startSession(xe());
3825
+ let t = await er.startSession(Ce());
3751
3826
  if (S || e !== O) {
3752
3827
  t.destroy();
3753
3828
  return;
3754
3829
  }
3755
- b = t, Te(t);
3830
+ b = t, Ee(t);
3756
3831
  let n = await t.attach({
3757
3832
  container: l,
3758
- ...Se(),
3833
+ ...we(),
3759
3834
  onWidgetReady: () => {
3760
- S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : ye());
3835
+ S || e !== O || (T = !1, E = !0, $(a.dataset.state) ? t.setWidgetChrome("expanded") : be());
3761
3836
  },
3762
3837
  onWidgetExpand: () => {
3763
- je(e);
3838
+ Me(e);
3764
3839
  },
3765
3840
  onWidgetAudioSettings: (e) => {
3766
3841
  S || Ie(e);
3767
3842
  },
3768
3843
  onWidgetDragStart: (e) => {
3769
- S || ue(e);
3844
+ S || de(e);
3770
3845
  },
3771
3846
  onWidgetDragMove: (e) => {
3772
- S || U(e);
3847
+ S || fe(e);
3773
3848
  },
3774
3849
  onWidgetDragEnd: (e) => {
3775
- S || de(e);
3850
+ S || pe(e);
3776
3851
  },
3777
3852
  onPlayerStatusChange: (e) => {
3778
- S || e === "error" && $(a.dataset.state) && ge("Could not load the experience.");
3853
+ S || e === "error" && $(a.dataset.state) && U("Could not load the experience.");
3779
3854
  }
3780
3855
  });
3781
3856
  if (S || e !== O) {
@@ -3783,7 +3858,7 @@ function mr(e, t) {
3783
3858
  return;
3784
3859
  }
3785
3860
  n.on("close", () => {
3786
- S || q();
3861
+ S || K();
3787
3862
  });
3788
3863
  } catch (n) {
3789
3864
  if (S || e !== O) return;
@@ -3795,40 +3870,40 @@ function mr(e, t) {
3795
3870
  }, Ne = () => {
3796
3871
  if (S || x || !C || $(a.dataset.state)) return;
3797
3872
  if (b && D) {
3798
- Ae();
3873
+ je();
3799
3874
  return;
3800
3875
  }
3801
3876
  if (b && E) {
3802
- J();
3877
+ q();
3803
3878
  return;
3804
3879
  }
3805
3880
  let e = ++O;
3806
3881
  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 () => {
3807
3882
  try {
3808
- Ce();
3809
- let t = await Kn.startSession(xe());
3883
+ G();
3884
+ let t = await er.startSession(Ce());
3810
3885
  if (S || e !== O) {
3811
3886
  t.destroy();
3812
3887
  return;
3813
3888
  }
3814
- b = t, Te(t);
3889
+ b = t, Ee(t);
3815
3890
  let n = await t.attach({
3816
3891
  container: v,
3817
- ...Se(),
3892
+ ...we(),
3818
3893
  onWidgetAudioSettings: (e) => {
3819
3894
  S || Ie(e);
3820
3895
  },
3821
3896
  onWidgetDragStart: (e) => {
3822
- S || ue(e);
3897
+ S || de(e);
3823
3898
  },
3824
3899
  onWidgetDragMove: (e) => {
3825
- S || U(e);
3900
+ S || fe(e);
3826
3901
  },
3827
3902
  onWidgetDragEnd: (e) => {
3828
- S || de(e);
3903
+ S || pe(e);
3829
3904
  },
3830
3905
  onPlayerStatusChange: (e) => {
3831
- S || (e === "error" ? ge("Could not load the experience.") : $(a.dataset.state) && ge(null));
3906
+ S || (e === "error" ? U("Could not load the experience.") : $(a.dataset.state) && U(null));
3832
3907
  }
3833
3908
  });
3834
3909
  if (S || e !== O) {
@@ -3836,12 +3911,12 @@ function mr(e, t) {
3836
3911
  return;
3837
3912
  }
3838
3913
  E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
3839
- S || q();
3914
+ S || K();
3840
3915
  });
3841
3916
  } catch (n) {
3842
3917
  if (S || e !== O) return;
3843
3918
  let r = n instanceof Error ? n : Error(String(n));
3844
- ge(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3919
+ U(r.message), t.onError?.(r), console.error("[ExperienceWidget]", r);
3845
3920
  } finally {
3846
3921
  e === O && (x = !1);
3847
3922
  }
@@ -3849,88 +3924,88 @@ function mr(e, t) {
3849
3924
  }, Pe = () => {
3850
3925
  if (!(S || $(a.dataset.state))) {
3851
3926
  if (b && D) {
3852
- Ae();
3927
+ je();
3853
3928
  return;
3854
3929
  }
3855
3930
  if (b && E) {
3856
- J();
3931
+ q();
3857
3932
  return;
3858
3933
  }
3859
3934
  if (T || b) {
3860
- Ce();
3935
+ G();
3861
3936
  return;
3862
3937
  }
3863
3938
  Ne();
3864
3939
  }
3865
3940
  }, Fe = (e) => {
3866
3941
  if (e.stopPropagation(), R() === "expanded") {
3867
- Oe();
3942
+ ke();
3868
3943
  return;
3869
3944
  }
3870
- R() === "docked" && ke();
3945
+ R() === "docked" && Ae();
3871
3946
  }, Ie = (e) => {
3872
3947
  g.setAttribute("aria-pressed", e ? "true" : "false");
3873
3948
  }, Le = (e) => {
3874
3949
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
3875
3950
  }, Re = (e) => {
3876
- R() === "docked" && ir() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
3951
+ R() === "docked" && fr() && (e.target?.closest("button") || (e.preventDefault(), ue(e.clientX, e.clientY, e.pointerId)));
3877
3952
  }, ze = (e) => {
3878
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), q());
3953
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), K());
3879
3954
  }, Be = () => {
3880
3955
  if (!S) {
3881
3956
  if (R() === "docked") {
3882
- if (!ir()) {
3883
- ke();
3957
+ if (!fr()) {
3958
+ Ae();
3884
3959
  return;
3885
3960
  }
3886
- D ? pe(() => {
3887
- G(!0);
3888
- }) : G(!0);
3961
+ D ? ge(() => {
3962
+ me(!0);
3963
+ }) : me(!0);
3889
3964
  return;
3890
3965
  }
3891
- W();
3966
+ H();
3892
3967
  }
3893
- }, Ve = typeof window < "u" ? window.matchMedia(Jn) : null, He = () => {
3968
+ }, Ve = typeof window < "u" ? window.matchMedia(nr) : null, He = () => {
3894
3969
  if (!S) {
3895
- if (R() === "docked" && !ir()) {
3896
- ke();
3970
+ if (R() === "docked" && !fr()) {
3971
+ Ae();
3897
3972
  return;
3898
3973
  }
3899
- W();
3974
+ H();
3900
3975
  }
3901
3976
  };
3902
- return o.addEventListener("click", Pe), d.addEventListener("click", q), _.addEventListener("click", (e) => {
3903
- e.stopPropagation(), q();
3904
- }), h.addEventListener("click", Fe), g.addEventListener("click", Le), p.addEventListener("pointerdown", Re), window.addEventListener("keydown", ze), window.addEventListener("resize", Be), Ve?.addEventListener("change", He), K(), W(), r === "eager" ? queueMicrotask(() => {
3905
- S || Me();
3906
- }) : r === "idle" && (ee = pr(() => {
3907
- S || Me();
3977
+ return o.addEventListener("click", Pe), d.addEventListener("click", K), _.addEventListener("click", (e) => {
3978
+ e.stopPropagation(), K();
3979
+ }), h.addEventListener("click", Fe), g.addEventListener("click", Le), p.addEventListener("pointerdown", Re), window.addEventListener("keydown", ze), window.addEventListener("resize", Be), Ve?.addEventListener("change", He), Se(), H(), r === "eager" ? queueMicrotask(() => {
3980
+ S || J();
3981
+ }) : r === "idle" && (ee = xr(() => {
3982
+ S || J();
3908
3983
  })), {
3909
3984
  root: a,
3910
3985
  expand: Pe,
3911
- collapse: q,
3912
- dock: Oe,
3913
- maximize: ke,
3986
+ collapse: K,
3987
+ dock: ke,
3988
+ maximize: Ae,
3914
3989
  prefetch() {
3915
3990
  if (r === "onExpand") {
3916
- Me();
3991
+ J();
3917
3992
  return;
3918
3993
  }
3919
- Me();
3994
+ J();
3920
3995
  },
3921
3996
  destroy() {
3922
- S || (S = !0, H(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", ze), window.removeEventListener("resize", Be), Ve?.removeEventListener("change", He), De(), Ee(), e.replaceChildren());
3997
+ S || (S = !0, V(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", ze), window.removeEventListener("resize", Be), Ve?.removeEventListener("change", He), Oe(), De(), e.replaceChildren());
3923
3998
  }
3924
3999
  };
3925
4000
  }
3926
4001
  //#endregion
3927
4002
  //#region src/react/ExperienceWidget.tsx
3928
- function hr(e) {
4003
+ function Cr(e) {
3929
4004
  let t = o(null), { experienceId: r, alt: i, galleryThumb: a, avatarImage: s, backgroundImage: c, foregroundImage: l, fallbackImage: u, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, locale: _, secondaryLocale: v, learningLocale: y, language: b, mode: x, speechInputMode: S, speechOnly: C, fit: w, embedBaseUrl: T, expandedMaxWidth: E, expandedMaxHeight: D, startButtonLabel: O, startButton: k, showFeedback: A, className: ee = "", onExpanded: j, onCollapsed: M, onStarted: N, onClose: P, onError: F, onPrefetchReady: te, onFeedback: I, onFeedbackFailed: L } = e, ne = m === "bottom-right" || m === "bottom-left";
3930
4005
  return n(() => {
3931
4006
  let e = t.current;
3932
4007
  if (!e || !r.trim()) return;
3933
- let n = mr(e, {
4008
+ let n = Sr(e, {
3934
4009
  experienceId: r,
3935
4010
  alt: i,
3936
4011
  galleryThumb: a,
@@ -4013,6 +4088,6 @@ function hr(e) {
4013
4088
  });
4014
4089
  }
4015
4090
  //#endregion
4016
- export { ne as Experience, Ue as ExperienceThumbnail, hr as ExperienceWidget };
4091
+ export { ne as Experience, Ze as ExperienceThumbnail, Cr as ExperienceWidget };
4017
4092
 
4018
4093
  //# sourceMappingURL=index.js.map