@tavus/widget 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2962,7 +2962,7 @@ var Sn = class extends Error {
2962
2962
  }
2963
2963
  }, Cn = {
2964
2964
  name: "@tavus/widget",
2965
- version: "0.15.1",
2965
+ version: "0.16.0",
2966
2966
  variant: "widget"
2967
2967
  }, wn = /* @__PURE__ */ new Set([
2968
2968
  "Error",
@@ -28432,27 +28432,35 @@ var FP = {
28432
28432
  stiffness: 2822,
28433
28433
  damping: 84,
28434
28434
  mass: 3.5
28435
- };
28436
- function zP(e, t) {
28435
+ }, zP = .25, BP = 16;
28436
+ function VP() {
28437
+ if (typeof document > "u" || typeof getComputedStyle != "function") return BP;
28438
+ let e = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
28439
+ return Number.isFinite(e) ? e : BP;
28440
+ }
28441
+ function HP(e, t) {
28437
28442
  return e === "widget" || t !== void 0 && t > 0 && t < 640 ? "compact" : "regular";
28438
28443
  }
28439
- function BP(e) {
28444
+ function UP(e) {
28440
28445
  if (typeof e == "string") try {
28441
28446
  let t = JSON.parse(e);
28442
- return VP(t) ? t : null;
28447
+ return WP(t) ? t : null;
28443
28448
  } catch {
28444
28449
  return null;
28445
28450
  }
28446
- return VP(e) ? e : null;
28451
+ return WP(e) ? e : null;
28447
28452
  }
28448
- function VP(e) {
28453
+ function WP(e) {
28449
28454
  return typeof e == "object" && !!e && !Array.isArray(e);
28450
28455
  }
28451
- function HP(e) {
28452
- let t = BP(e)?.state;
28456
+ function GP(e) {
28457
+ let t = UP(e)?.state;
28453
28458
  return t === "success" || t === "error";
28454
28459
  }
28455
- function UP(e, t, n) {
28460
+ function KP(e) {
28461
+ return UP(e)?.state === "error";
28462
+ }
28463
+ function qP(e, t, n) {
28456
28464
  let r = `${t + 8}px`;
28457
28465
  if (n === void 0 || !Number.isFinite(n) || n <= 0) return {
28458
28466
  left: "1rem",
@@ -28466,75 +28474,83 @@ function UP(e, t, n) {
28466
28474
  bottom: r
28467
28475
  };
28468
28476
  }
28469
- var WP = "rgb(0 0 0 / 50%)", GP = "oklch(98.5% 0 0)", KP = 1.5;
28470
- function qP(e, t) {
28477
+ function JP(e) {
28478
+ let t = e?.trim();
28479
+ if (!t) return zP * VP();
28480
+ let n = Number.parseFloat(t);
28481
+ if (!Number.isFinite(n)) return zP * VP();
28482
+ if (t.endsWith("rem")) return n * VP();
28483
+ if (t.endsWith("px")) return n;
28484
+ }
28485
+ function YP(e, t) {
28486
+ let n = e["--color-neutral"], r = e["--color-neutral-content"], i = JP(e["--radius-field"]);
28471
28487
  return {
28472
- "--activity-bg": WP,
28473
- "--activity-fg": GP,
28488
+ ...n ? { "--activity-bg": n } : {},
28489
+ ...r ? { "--activity-fg": r } : {},
28474
28490
  "--activity-border": "transparent",
28475
- "--activity-radius": `${KP}px`,
28491
+ ...i === void 0 ? {} : { "--activity-radius": `${i}px` },
28476
28492
  "--activity-height": `${FP[t.density]}px`,
28477
28493
  "--activity-align": t.align
28478
28494
  };
28479
28495
  }
28480
28496
  //#endregion
28481
28497
  //#region ../core/src/magic-canvas/magic-canvas.tsx
28482
- var JP = 1e3, YP = 5e3, XP = 1200, ZP = [2e3, 6e3];
28483
- async function QP(e, t, n) {
28484
- let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), YP);
28498
+ var XP = 1e3, ZP = 5e3, QP = 1200, $P = [2e3, 6e3];
28499
+ async function eF(e, t, n) {
28500
+ let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), ZP);
28485
28501
  try {
28486
28502
  await mn(e, t, n, { signal: r.signal });
28487
28503
  } finally {
28488
28504
  globalThis.clearTimeout(i);
28489
28505
  }
28490
28506
  }
28491
- function $P(e) {
28507
+ function tF(e) {
28492
28508
  return e instanceof cn && e.status >= 400 && e.status < 500 && e.status !== 408 && e.status !== 429;
28493
28509
  }
28494
- function eF(e, t) {
28510
+ function nF(e, t) {
28495
28511
  console.error("Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.", e), t({
28496
28512
  lastInteractionPostResult: "error",
28497
- lastError: PF(e).message
28513
+ lastError: IF(e).message
28498
28514
  }, {
28499
28515
  error: e,
28500
28516
  operation: "canvas.bridge"
28501
28517
  });
28502
28518
  }
28503
- function tF(e) {
28519
+ function rF(e) {
28504
28520
  return e.content.some((e) => e.type === "text" && typeof e.text == "string" && e.text.trim() !== "");
28505
28521
  }
28506
- function nF(e, t, n, r) {
28522
+ function iF(e, t, n, r) {
28507
28523
  (async () => {
28508
28524
  let i;
28509
- for (let a of ZP) {
28525
+ for (let a of $P) {
28510
28526
  await new Promise((e) => setTimeout(e, a));
28511
28527
  try {
28512
- await QP(e, t, n), r({
28528
+ await eF(e, t, n), r({
28513
28529
  lastInteractionPostResult: "recovered",
28514
28530
  lastError: void 0
28515
28531
  });
28516
28532
  return;
28517
28533
  } catch (e) {
28518
- if (i = e, $P(e)) break;
28534
+ if (i = e, tF(e)) break;
28519
28535
  }
28520
28536
  }
28521
- eF(i, r);
28537
+ nF(i, r);
28522
28538
  })();
28523
28539
  }
28524
- var rF = 2e3;
28525
- function iF(e) {
28526
- return e.correct_answer === void 0 ? XP : rF;
28540
+ var aF = 2e3;
28541
+ function oF(e) {
28542
+ return e.correct_answer === void 0 ? QP : aF;
28527
28543
  }
28528
- var aF = 48, oF = 24, sF = "ui-monospace, SFMono-Regular, Menlo, monospace", cF = 160, lF = () => {}, uF = "allow-scripts", dF = {
28544
+ var sF = 48, cF = 24, lF = "ui-monospace, SFMono-Regular, Menlo, monospace", uF = 160, dF = () => {}, fF = "allow-scripts", pF = {
28529
28545
  "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms",
28530
28546
  "canvas.text": "allow-scripts allow-popups allow-popups-to-escape-sandbox"
28531
28547
  };
28532
- function fF(e, t) {
28548
+ function mF(e, t) {
28533
28549
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
28534
28550
  let n = e.data;
28535
28551
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
28536
28552
  }
28537
- var pF = class {
28553
+ var hF = class {
28538
28554
  onmessage;
28539
28555
  onerror;
28540
28556
  onclose;
@@ -28545,7 +28561,7 @@ var pF = class {
28545
28561
  }
28546
28562
  start() {
28547
28563
  let e = (e) => {
28548
- fF(e, this.#e) && this.onmessage?.(e.data);
28564
+ mF(e, this.#e) && this.onmessage?.(e.data);
28549
28565
  };
28550
28566
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
28551
28567
  }
@@ -28556,12 +28572,12 @@ var pF = class {
28556
28572
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
28557
28573
  }
28558
28574
  };
28559
- function mF(e) {
28560
- for (let t of Sy) if (e.some((e) => AF(e) === t)) return t;
28575
+ function gF(e) {
28576
+ for (let t of Sy) if (e.some((e) => MF(e) === t)) return t;
28561
28577
  return null;
28562
28578
  }
28563
- function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = jF(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28564
- let { client: l, telemetry: u } = Zm(), { isDark: d, cssVars: f } = vj(), p = Ef(), m = Df(), [h, g] = j([]), [_, v] = j(null), [y, b] = j(!1), x = N(null), S = N(null), C = N(null), [w, T] = EF(), E = I(st)?.surface, D = zP(E, T.width), ee = FP[D], O = y ? null : _, te = O ? ee + 8 : 0, ne = F(() => {
28579
+ function _F({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = NF(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28580
+ let { client: l, telemetry: u } = Zm(), { isDark: d, cssVars: f } = vj(), p = Ef(), m = Df(), [h, g] = j([]), [_, v] = j(null), [y, b] = j(!1), x = N(null), S = N(null), C = N(null), [w, T] = OF(), E = I(st)?.surface, D = HP(E, T.width), ee = FP[D], O = y ? null : _, te = O ? ee + 8 : 0, ne = F(() => {
28565
28581
  S.current !== null && (clearTimeout(S.current), S.current = null);
28566
28582
  }, []), k = F(() => {
28567
28583
  C.current !== null && (clearTimeout(C.current), C.current = null);
@@ -28653,13 +28669,10 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28653
28669
  try {
28654
28670
  let t = Sb(e.data);
28655
28671
  if (!t) return;
28656
- let n = By(x.current, t);
28657
- if (n.consumed) {
28658
- if (!n.strip) re();
28659
- else if (HP(n.strip.arguments)) {
28660
- let e = x.current;
28661
- e !== null && e.tool_call_id === n.strip.tool_call_id && e.conversation_id === n.strip.conversation_id && ie();
28662
- } else ne(), k(), x.current = n.strip, b(!1), v(n.strip);
28672
+ let n = x.current, r = By(n, t);
28673
+ if (r.consumed) {
28674
+ let e = n !== null && r.strip !== null && n.tool_call_id === r.strip.tool_call_id && n.conversation_id === r.strip.conversation_id, t = C.current !== null;
28675
+ r.strip ? GP(r.strip.arguments) ? e && (KP(r.strip.arguments) && !t && (x.current = r.strip, v(r.strip)), ie()) : e && t || (ne(), k(), x.current = r.strip, b(!1), v(r.strip)) : re();
28663
28676
  } else g((e) => Iy(e, t));
28664
28677
  se({
28665
28678
  lastToolCall: e.data,
@@ -28670,7 +28683,7 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28670
28683
  } catch (e) {
28671
28684
  se({
28672
28685
  iframeLifecycleState: "error",
28673
- lastError: PF(e).message
28686
+ lastError: IF(e).message
28674
28687
  }, {
28675
28688
  error: e,
28676
28689
  operation: "canvas.validate"
@@ -28708,7 +28721,7 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28708
28721
  de.safe_area?.width,
28709
28722
  de.safe_area?.height
28710
28723
  ]);
28711
- let pe = mF(ue.map(({ layout: e }) => e));
28724
+ let pe = gF(ue.map(({ layout: e }) => e));
28712
28725
  M(() => {
28713
28726
  t?.(pe);
28714
28727
  }, [t, pe]);
@@ -28717,7 +28730,7 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28717
28730
  ref: w,
28718
28731
  "data-magic-canvas-root": !0,
28719
28732
  class: "pointer-events-none absolute inset-0 z-30",
28720
- style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - oF}px`,
28733
+ style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - cF}px`,
28721
28734
  children: [
28722
28735
  me && fe && /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-black/45" }),
28723
28736
  me && !fe && oe.sheetBottomPx !== null && /* @__PURE__ */ L("div", {
@@ -28728,15 +28741,15 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28728
28741
  backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))"
28729
28742
  }
28730
28743
  }),
28731
- me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(yF, {
28732
- slot: AF(t),
28744
+ me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(xF, {
28745
+ slot: MF(t),
28733
28746
  safeAreaTop: de.safe_area?.y,
28734
28747
  frameWidth: T.width,
28735
28748
  ...n ? {
28736
28749
  gridRect: n,
28737
28750
  gridAnimate: oe.animate
28738
28751
  } : {},
28739
- children: (r) => /* @__PURE__ */ L(bF, {
28752
+ children: (r) => /* @__PURE__ */ L(SF, {
28740
28753
  availableHeight: r,
28741
28754
  client: l,
28742
28755
  gridDriven: n !== null,
@@ -28762,7 +28775,7 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28762
28775
  sendAppMessage: ce
28763
28776
  })
28764
28777
  }, e.id)),
28765
- _ && /* @__PURE__ */ L(gF, {
28778
+ _ && /* @__PURE__ */ L(vF, {
28766
28779
  client: l,
28767
28780
  controlsRect: a,
28768
28781
  density: D,
@@ -28782,7 +28795,7 @@ function hF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28782
28795
  ]
28783
28796
  });
28784
28797
  }
28785
- function gF({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i, hostTheme: a, instance: o, onComplete: s, onDebug: c, sendAppMessage: l }) {
28798
+ function vF({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i, hostTheme: a, instance: o, onComplete: s, onDebug: c, sendAppMessage: l }) {
28786
28799
  let u = FP[n], d = {
28787
28800
  ...o.layout,
28788
28801
  preferred_slot: "safe-area-bottom",
@@ -28792,7 +28805,7 @@ function gF({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
28792
28805
  ...a,
28793
28806
  cssVars: {
28794
28807
  ...a.cssVars,
28795
- "--font-mono": sF
28808
+ "--font-mono": lF
28796
28809
  },
28797
28810
  activity: {
28798
28811
  density: n,
@@ -28801,13 +28814,13 @@ function gF({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
28801
28814
  }), [n, a]);
28802
28815
  return /* @__PURE__ */ L("div", {
28803
28816
  class: "cvi-status-strip absolute flex justify-center",
28804
- style: UP(t, 72, i),
28817
+ style: qP(t, 72, i),
28805
28818
  "data-canvas-status-strip": !0,
28806
- children: /* @__PURE__ */ L(_F, {
28819
+ children: /* @__PURE__ */ L(yF, {
28807
28820
  exiting: r,
28808
28821
  instanceId: o.id,
28809
- children: /* @__PURE__ */ L(bF, {
28810
- availableHeight: cF,
28822
+ children: /* @__PURE__ */ L(SF, {
28823
+ availableHeight: uF,
28811
28824
  client: e,
28812
28825
  fixedHeightPx: u,
28813
28826
  hostTheme: f,
@@ -28815,15 +28828,15 @@ function gF({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
28815
28828
  layout: d,
28816
28829
  onComplete: s,
28817
28830
  onDebug: c,
28818
- onDisplayModeChange: lF,
28819
- onNaturalHeightChange: lF,
28831
+ onDisplayModeChange: dF,
28832
+ onNaturalHeightChange: dF,
28820
28833
  sendAppMessage: l,
28821
28834
  variant: "strip"
28822
28835
  })
28823
28836
  })
28824
28837
  });
28825
28838
  }
28826
- function _F({ exiting: e, instanceId: t, children: n }) {
28839
+ function yF({ exiting: e, instanceId: t, children: n }) {
28827
28840
  let r = N(null);
28828
28841
  return Xe(() => {
28829
28842
  let t = r.current;
@@ -28859,9 +28872,9 @@ function _F({ exiting: e, instanceId: t, children: n }) {
28859
28872
  children: n
28860
28873
  });
28861
28874
  }
28862
- var vF = 16;
28863
- function yF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
28864
- let [o, s] = DF(), c = a(r ? r.height : e === "full" ? void 0 : s);
28875
+ var bF = 16;
28876
+ function xF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
28877
+ let [o, s] = kF(), c = a(r ? r.height : e === "full" ? void 0 : s);
28865
28878
  if (r) return /* @__PURE__ */ L("div", {
28866
28879
  ref: o,
28867
28880
  class: "pointer-events-auto absolute",
@@ -28877,7 +28890,7 @@ function yF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28877
28890
  let r = t == null ? "1rem" : `${t * 100}%`, i = n != null && n > 0 ? Math.max(0, n - 32) : void 0;
28878
28891
  return /* @__PURE__ */ L("div", {
28879
28892
  ref: o,
28880
- class: `cvi-strip-lift ${kF(e)}`,
28893
+ class: `cvi-strip-lift ${jF(e)}`,
28881
28894
  style: {
28882
28895
  top: r,
28883
28896
  bottom: "calc(72px + var(--mc-strip-band, 0px))",
@@ -28892,8 +28905,8 @@ function yF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28892
28905
  }
28893
28906
  return e === "safe-area-bottom" ? /* @__PURE__ */ L("div", {
28894
28907
  ref: o,
28895
- class: kF(e),
28896
- style: { top: `${vF}px` },
28908
+ class: jF(e),
28909
+ style: { top: `${bF}px` },
28897
28910
  "data-canvas-slot": e,
28898
28911
  children: /* @__PURE__ */ L("div", {
28899
28912
  class: "contents",
@@ -28901,7 +28914,7 @@ function yF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28901
28914
  })
28902
28915
  }) : /* @__PURE__ */ L("div", {
28903
28916
  ref: o,
28904
- class: kF(e),
28917
+ class: jF(e),
28905
28918
  "data-canvas-slot": e,
28906
28919
  children: /* @__PURE__ */ L("div", {
28907
28920
  class: "contents",
@@ -28909,7 +28922,7 @@ function yF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28909
28922
  })
28910
28923
  });
28911
28924
  }
28912
- function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard: r = !1, hostTheme: i, instance: a, layout: o, dimmed: s, onDebug: c, onComplete: l, onDisplayModeChange: u, onNaturalHeightChange: d, sendAppMessage: f, variant: p = "card", fixedHeightPx: m }) {
28925
+ function SF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard: r = !1, hostTheme: i, instance: a, layout: o, dimmed: s, onDebug: c, onComplete: l, onDisplayModeChange: u, onNaturalHeightChange: d, sendAppMessage: f, variant: p = "card", fixedHeightPx: m }) {
28913
28926
  let h = p === "strip", g = m ?? 720, _ = N(null), v = N(null), y = N(e), b = N(r), x = N(m ?? 320), S = N({
28914
28927
  fixed: m,
28915
28928
  max: g
@@ -28922,17 +28935,17 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
28922
28935
  }, [m, g]), M(() => {
28923
28936
  w.current = a;
28924
28937
  }, [a]), M(() => {
28925
- x.current = ne, v.current?.setHostContext(wF(w.current, C.current, T.current, y.current, ne, b.current));
28938
+ x.current = ne, v.current?.setHostContext(EF(w.current, C.current, T.current, y.current, ne, b.current));
28926
28939
  }, [ne]), M(() => {
28927
28940
  y.current = e, b.current = r;
28928
- let t = CF(i, _.current);
28929
- C.current = t, v.current?.setHostContext(wF(w.current, t, T.current, e, x.current, r));
28941
+ let t = TF(i, _.current);
28942
+ C.current = t, v.current?.setHostContext(EF(w.current, t, T.current, e, x.current, r));
28930
28943
  }, [
28931
28944
  e,
28932
28945
  i,
28933
28946
  r
28934
28947
  ]), M(() => {
28935
- T.current = o, v.current?.setHostContext(wF(w.current, C.current, o, e, x.current, b.current));
28948
+ T.current = o, v.current?.setHostContext(EF(w.current, C.current, o, e, x.current, b.current));
28936
28949
  }, [e, o]), M(() => {
28937
28950
  D.current = l, ee.current = u, O.current = d, te.current = f;
28938
28951
  }, [
@@ -28946,7 +28959,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
28946
28959
  let n = !1, r = null, i = null, o = null, s = null, l = new URL(a.canvas_config.sandbox_url, globalThis.location.href).href, u = (e) => {
28947
28960
  n || c({
28948
28961
  iframeLifecycleState: "error",
28949
- lastError: PF(e).message
28962
+ lastError: IF(e).message
28950
28963
  }, {
28951
28964
  error: e,
28952
28965
  operation: "canvas.bridge"
@@ -28983,18 +28996,18 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
28983
28996
  text: {},
28984
28997
  structuredContent: {}
28985
28998
  }
28986
- }, { hostContext: wF(a, CF(C.current, e), T.current, y.current, x.current, b.current) });
28999
+ }, { hostContext: EF(a, TF(C.current, e), T.current, y.current, x.current, b.current) });
28987
29000
  r = f, v.current = f, f.oninitialized = () => {
28988
29001
  n || (c({ iframeLifecycleState: "ready" }), E.current = w.current.revision, f.sendToolInput({ arguments: w.current.arguments }).catch(u));
28989
29002
  }, f.onsizechange = ({ height: e }) => {
28990
29003
  if (!n && typeof e == "number" && Number.isFinite(e)) {
28991
- let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, aF), n) : e === t ? t : Math.min(e, cF);
29004
+ let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, sF), n) : e === t ? t : Math.min(e, uF);
28992
29005
  k(r), O.current(w.current.id, r);
28993
29006
  }
28994
29007
  }, f.onmessage = async (e) => {
28995
29008
  let r = Vy(e);
28996
29009
  if (!r) {
28997
- if (tF(e)) {
29010
+ if (rF(e)) {
28998
29011
  let e = "Magic Canvas message included text without interaction metadata; no interaction row was recorded.";
28999
29012
  return c({
29000
29013
  lastInteractionPostResult: "error",
@@ -29019,7 +29032,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29019
29032
  }
29020
29033
  })();
29021
29034
  if ("error" in a) {
29022
- let e = PF(a.error).message;
29035
+ let e = IF(a.error).message;
29023
29036
  return c({
29024
29037
  lastInteractionPostResult: "error",
29025
29038
  lastError: e
@@ -29036,19 +29049,19 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29036
29049
  try {
29037
29050
  u = Wy(e, o);
29038
29051
  } catch (e) {
29039
- c({ lastError: PF(e).message }), o.type === "submit" && console.warn("Magic Canvas dropped the response text of a submitted card.", e);
29052
+ c({ lastError: IF(e).message }), o.type === "submit" && console.warn("Magic Canvas dropped the response text of a submitted card.", e);
29040
29053
  }
29041
29054
  let d = !0;
29042
29055
  try {
29043
- await QP(t, o.conversation_id, l.body);
29056
+ await eF(t, o.conversation_id, l.body);
29044
29057
  } catch (e) {
29045
- d = !1, $P(e) ? eF(e, c) : (console.warn("Magic Canvas interaction POST failed; continuing without it and retrying in the background.", e), c({
29058
+ d = !1, tF(e) ? nF(e, c) : (console.warn("Magic Canvas interaction POST failed; continuing without it and retrying in the background.", e), c({
29046
29059
  lastInteractionPostResult: "failed_open",
29047
- lastError: PF(e).message
29060
+ lastError: IF(e).message
29048
29061
  }, {
29049
29062
  error: e,
29050
29063
  operation: "canvas.bridge"
29051
- }), nF(t, o.conversation_id, l.body, c));
29064
+ }), iF(t, o.conversation_id, l.body, c));
29052
29065
  }
29053
29066
  if (n) return {};
29054
29067
  if (u) try {
@@ -29059,7 +29072,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29059
29072
  properties: { text: u }
29060
29073
  });
29061
29074
  } catch (e) {
29062
- console.error("Magic Canvas respond send failed.", e), c({ lastError: PF(e).message }, {
29075
+ console.error("Magic Canvas respond send failed.", e), c({ lastError: IF(e).message }, {
29063
29076
  error: e,
29064
29077
  operation: "canvas.bridge"
29065
29078
  });
@@ -29069,18 +29082,18 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29069
29082
  lastError: void 0
29070
29083
  }), Uy(o) && (o.type === "submit" ? (s && clearTimeout(s), s = setTimeout(() => {
29071
29084
  s = null, n || D.current();
29072
- }, iF(i.arguments))) : D.current()), {};
29085
+ }, oF(i.arguments))) : D.current()), {};
29073
29086
  }, f.onupdatemodelcontext = async (e) => (i = e, o ||= setTimeout(() => {
29074
29087
  o = null, d();
29075
- }, JP), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29088
+ }, XP), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29076
29089
  if (h) return { mode: "inline" };
29077
29090
  let t = e === "fullscreen" ? "fullscreen" : "inline";
29078
29091
  return ee.current(t), T.current = {
29079
29092
  ...T.current,
29080
29093
  display_mode: t,
29081
29094
  viable_slot: t === "fullscreen" ? "full" : T.current.viable_slot
29082
- }, f.setHostContext(wF(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29083
- }, f.connect(new pF(e)).then(() => void 0).catch(u);
29095
+ }, f.setHostContext(EF(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29096
+ }, f.connect(new hF(e)).then(() => void 0).catch(u);
29084
29097
  };
29085
29098
  c({
29086
29099
  iframeLifecycleState: "mounting",
@@ -29102,7 +29115,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29102
29115
  a.revision !== 0 && (a.revision <= E.current || (E.current = a.revision, v.current?.sendToolInput({ arguments: a.arguments }).catch((e) => {
29103
29116
  c({
29104
29117
  iframeLifecycleState: "error",
29105
- lastError: PF(e).message
29118
+ lastError: IF(e).message
29106
29119
  }, {
29107
29120
  error: e,
29108
29121
  operation: "canvas.bridge"
@@ -29113,7 +29126,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29113
29126
  a.revision,
29114
29127
  c
29115
29128
  ]);
29116
- let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : TF(ne, e, r), ae = ie?.placeholderStyle, A = ie?.cardStyle, oe = re ? { height: "100%" } : ie?.iframeStyle ?? {
29129
+ let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : DF(ne, e, r), ae = ie?.placeholderStyle, A = ie?.cardStyle, oe = re ? { height: "100%" } : ie?.iframeStyle ?? {
29117
29130
  width: "100%",
29118
29131
  height: `${ne}px`
29119
29132
  }, se = h ? "pointer-events-auto w-full overflow-hidden" : [
@@ -29121,7 +29134,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29121
29134
  r ? "" : "shadow-xl",
29122
29135
  re ? "fixed inset-4 z-10 max-w-none" : n ? "max-w-none" : "max-w-md",
29123
29136
  s ? "scale-[0.98] opacity-40" : ""
29124
- ].filter(Boolean).join(" "), ce = dF[a.canvas_config.component] ?? uF, le = /* @__PURE__ */ L("div", {
29137
+ ].filter(Boolean).join(" "), ce = pF[a.canvas_config.component] ?? fF, le = /* @__PURE__ */ L("div", {
29125
29138
  class: se,
29126
29139
  style: A,
29127
29140
  ...h ? { "data-canvas-strip": o.viable_slot } : { "data-canvas-card": o.viable_slot },
@@ -29140,7 +29153,7 @@ function bF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29140
29153
  children: le
29141
29154
  });
29142
29155
  }
29143
- var xF = [
29156
+ var CF = [
29144
29157
  "--color-base-100",
29145
29158
  "--color-base-200",
29146
29159
  "--color-base-300",
@@ -29150,17 +29163,17 @@ var xF = [
29150
29163
  "--color-neutral",
29151
29164
  "--color-neutral-content"
29152
29165
  ];
29153
- function SF(e) {
29166
+ function wF(e) {
29154
29167
  if (!e || typeof getComputedStyle != "function") return {};
29155
29168
  let t = getComputedStyle(e), n = {};
29156
- for (let e of xF) {
29169
+ for (let e of CF) {
29157
29170
  let r = t.getPropertyValue(e).trim();
29158
29171
  r && (n[e] = r);
29159
29172
  }
29160
29173
  return n;
29161
29174
  }
29162
- function CF(e, t) {
29163
- let n = SF(t);
29175
+ function TF(e, t) {
29176
+ let n = wF(t);
29164
29177
  return Object.keys(n).length === 0 ? e : {
29165
29178
  ...e,
29166
29179
  cssVars: {
@@ -29169,20 +29182,20 @@ function CF(e, t) {
29169
29182
  }
29170
29183
  };
29171
29184
  }
29172
- function wF(e, t, n, r, i, a = !1) {
29173
- let o = wb(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : MF(r), l = t.activity ? qP(t.cssVars, t.activity) : {}, u = s ? 1 : TF(i ?? 0, r, a)?.displayScale ?? 1;
29185
+ function EF(e, t, n, r, i, a = !1) {
29186
+ let o = wb(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : PF(r), l = t.activity ? YP(t.cssVars, t.activity) : {}, u = s ? 1 : DF(i ?? 0, r, a)?.displayScale ?? 1;
29174
29187
  return {
29175
29188
  ...e.canvas_config.host_context,
29176
29189
  ...o,
29177
29190
  ...l,
29178
29191
  containerDimensions: {
29179
- ...NF(o.containerDimensions) ? o.containerDimensions : {},
29192
+ ...FF(o.containerDimensions) ? o.containerDimensions : {},
29180
29193
  ...c === void 0 ? {} : { maxHeight: c },
29181
29194
  displayScale: u
29182
29195
  }
29183
29196
  };
29184
29197
  }
29185
- function TF(e, t, n = !1) {
29198
+ function DF(e, t, n = !1) {
29186
29199
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
29187
29200
  let r = Math.min(e, 720);
29188
29201
  if (n) return {
@@ -29222,11 +29235,11 @@ function TF(e, t, n = !1) {
29222
29235
  }
29223
29236
  };
29224
29237
  }
29225
- function EF() {
29226
- let e = N(null), [t, n] = j(() => OF(null));
29238
+ function OF() {
29239
+ let e = N(null), [t, n] = j(() => AF(null));
29227
29240
  return M(() => {
29228
29241
  let t = () => n((t) => {
29229
- let n = OF(e.current);
29242
+ let n = AF(e.current);
29230
29243
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
29231
29244
  });
29232
29245
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -29236,7 +29249,7 @@ function EF() {
29236
29249
  };
29237
29250
  }, []), [e, t];
29238
29251
  }
29239
- function DF() {
29252
+ function kF() {
29240
29253
  let e = N(null), [t, n] = j();
29241
29254
  return M(() => {
29242
29255
  let t = e.current;
@@ -29252,7 +29265,7 @@ function DF() {
29252
29265
  return a.observe(t), () => a.disconnect();
29253
29266
  }, []), [e, t];
29254
29267
  }
29255
- function OF(e) {
29268
+ function AF(e) {
29256
29269
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
29257
29270
  if (n && n.width > 0 && n.height > 0) {
29258
29271
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -29268,7 +29281,7 @@ function OF(e) {
29268
29281
  visualViewportHeight: t
29269
29282
  };
29270
29283
  }
29271
- function kF(e) {
29284
+ function jF(e) {
29272
29285
  let t = "absolute flex gap-2";
29273
29286
  switch (e) {
29274
29287
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;
@@ -29277,24 +29290,24 @@ function kF(e) {
29277
29290
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
29278
29291
  }
29279
29292
  }
29280
- function AF(e) {
29293
+ function MF(e) {
29281
29294
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
29282
29295
  }
29283
- function jF() {
29296
+ function NF() {
29284
29297
  return !1;
29285
29298
  }
29286
- function MF(e) {
29299
+ function PF(e) {
29287
29300
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
29288
29301
  }
29289
- function NF(e) {
29302
+ function FF(e) {
29290
29303
  return typeof e == "object" && !!e && !Array.isArray(e);
29291
29304
  }
29292
- function PF(e) {
29305
+ function IF(e) {
29293
29306
  return e instanceof Error ? e : Error(String(e));
29294
29307
  }
29295
29308
  //#endregion
29296
29309
  //#region ../core/src/magic-canvas/grid-error-boundary.tsx
29297
- var FF = class extends D {
29310
+ var LF = class extends D {
29298
29311
  state = { errored: !1 };
29299
29312
  componentDidCatch(e) {
29300
29313
  this.props.onError(e), this.setState({ errored: !0 });
@@ -29302,8 +29315,8 @@ var FF = class extends D {
29302
29315
  render() {
29303
29316
  return this.state.errored ? null : this.props.children;
29304
29317
  }
29305
- }, IF = 1e4;
29306
- function LF(e, t = IF) {
29318
+ }, RF = 1e4;
29319
+ function zF(e, t = RF) {
29307
29320
  let [n, r] = j(!1), i = N(!1);
29308
29321
  return M(() => {
29309
29322
  if (!e) {
@@ -29318,7 +29331,7 @@ function LF(e, t = IF) {
29318
29331
  }
29319
29332
  //#endregion
29320
29333
  //#region ../core/src/hooks/use-call-presence.ts
29321
- function RF(e) {
29334
+ function BF(e) {
29322
29335
  let t = Of(), n = Pf(t ?? ""), r = !If(t ?? "").isOff, i = ey(e), a = i.phase === "ready" ? i.replicaId : "", o = If(a), s = !r && (o.state === "playable" || o.state === "loading"), c = i.phase === "ready" && !e && !i.videoState.isOff, l = !e && t !== null && !n.isOff, u = i.phase !== "ready" || i.videoState.isOff;
29323
29336
  return P(() => ({
29324
29337
  presence: i,
@@ -29340,7 +29353,7 @@ function RF(e) {
29340
29353
  }
29341
29354
  //#endregion
29342
29355
  //#region ../core/src/hooks/use-call-controls-visible.ts
29343
- function zF(e, t, n) {
29356
+ function VF(e, t, n) {
29344
29357
  let [r, i] = j(!0);
29345
29358
  return M(() => {
29346
29359
  if (!t) return;
@@ -29370,7 +29383,7 @@ function zF(e, t, n) {
29370
29383
  }
29371
29384
  //#endregion
29372
29385
  //#region ../core/src/hooks/use-call-controls-rect.ts
29373
- function BF(e, t, n, r, i) {
29386
+ function HF(e, t, n, r, i) {
29374
29387
  let [a, o] = j(void 0);
29375
29388
  return M(() => {
29376
29389
  if (!r) return;
@@ -29404,8 +29417,8 @@ function BF(e, t, n, r, i) {
29404
29417
  }
29405
29418
  //#endregion
29406
29419
  //#region ../core/src/hooks/use-replica-join-timeout.ts
29407
- var VF = 1e4;
29408
- function HF({ onTimeout: e, timeoutMs: t = VF, active: n = !0 }) {
29420
+ var UF = 1e4;
29421
+ function WF({ onTimeout: e, timeoutMs: t = UF, active: n = !0 }) {
29409
29422
  let r = $v().length > 0, [i, a] = j(!1), o = N(e);
29410
29423
  return M(() => {
29411
29424
  o.current = e;
@@ -29429,39 +29442,39 @@ function HF({ onTimeout: e, timeoutMs: t = VF, active: n = !0 }) {
29429
29442
  }
29430
29443
  //#endregion
29431
29444
  //#region ../core/src/hooks/use-system-shutdown.ts
29432
- function UF(e) {
29445
+ function GF(e) {
29433
29446
  if (typeof e != "object" || !e) return !1;
29434
29447
  let t = e;
29435
29448
  return t.message_type === "system" && t.event_type === "system.shutdown";
29436
29449
  }
29437
- function WF({ onShutdown: e }) {
29450
+ function KF({ onShutdown: e }) {
29438
29451
  let t = N(e);
29439
29452
  M(() => {
29440
29453
  t.current = e;
29441
29454
  }, [e]), jf({ onAppMessage: F((e) => {
29442
- UF(e?.data) && t.current();
29455
+ GF(e?.data) && t.current();
29443
29456
  }, []) });
29444
29457
  }
29445
29458
  //#endregion
29446
29459
  //#region ../core/src/hooks/use-picture-in-picture.ts
29447
- var GF = tn("PiP"), KF = 360, qF = 280;
29448
- function JF() {
29460
+ var qF = tn("PiP"), JF = 360, YF = 280;
29461
+ function XF() {
29449
29462
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
29450
29463
  }
29451
- function YF(e) {
29452
- let { enabled: t, active: n } = e, [r, i] = j(null), a = JF(), o = I(Th), s = F(() => {
29464
+ function ZF(e) {
29465
+ let { enabled: t, active: n } = e, [r, i] = j(null), a = XF(), o = I(Th), s = F(() => {
29453
29466
  i((e) => (e && !e.closed && e.close(), null));
29454
29467
  }, []), c = F(async () => {
29455
29468
  if (a && t && n && (!r || r.closed)) try {
29456
29469
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
29457
- width: KF,
29458
- height: qF
29470
+ width: JF,
29471
+ height: YF
29459
29472
  }), t = Pe.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
29460
29473
  n.textContent = t, e.document.head.appendChild(n), e.document.body.style.margin = "0", e.document.body.style.width = "100%", e.document.body.style.height = "100vh", e.document.body.style.overflow = "hidden", e.addEventListener("pagehide", () => {
29461
29474
  i((t) => t === e ? null : t);
29462
29475
  }, { once: !0 }), i(e);
29463
29476
  } catch (e) {
29464
- GF.warn("Failed to open PiP window", e);
29477
+ qF.warn("Failed to open PiP window", e);
29465
29478
  }
29466
29479
  }, [
29467
29480
  a,
@@ -29482,13 +29495,13 @@ function YF(e) {
29482
29495
  try {
29483
29496
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
29484
29497
  } catch (e) {
29485
- GF.warn("mediaSession metadata setup failed", e);
29498
+ qF.warn("mediaSession metadata setup failed", e);
29486
29499
  }
29487
29500
  let t = (t, n) => {
29488
29501
  try {
29489
29502
  e.setActionHandler(t, n), r.push(t);
29490
29503
  } catch (e) {
29491
- GF.info(`mediaSession.${t} not supported`, e);
29504
+ qF.info(`mediaSession.${t} not supported`, e);
29492
29505
  }
29493
29506
  };
29494
29507
  t("enterpictureinpicture", () => {
@@ -29542,11 +29555,11 @@ function YF(e) {
29542
29555
  }
29543
29556
  //#endregion
29544
29557
  //#region ../core/src/utils/device-preferences.ts
29545
- var XF = Dt(null), ZF = {
29558
+ var QF = Dt(null), $F = {
29546
29559
  active: !1,
29547
29560
  video_shift_x: 0,
29548
29561
  backdrop: { type: "snapshot_mirror" }
29549
- }, QF = Hf(({ id: e, showAudioWave: t = !0 }) => {
29562
+ }, eI = Hf(({ id: e, showAudioWave: t = !0 }) => {
29550
29563
  let n = Pf(e).isOff;
29551
29564
  return /* @__PURE__ */ L("div", {
29552
29565
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -29561,16 +29574,16 @@ var XF = Dt(null), ZF = {
29561
29574
  children: /* @__PURE__ */ L(Kv, { id: e })
29562
29575
  })]
29563
29576
  });
29564
- }), $F = Hf(() => {
29577
+ }), tI = Hf(() => {
29565
29578
  let e = Of(), { isScreenSharing: t } = av(), n = $v()[0];
29566
- return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(QF, { id: n }), e && /* @__PURE__ */ L(QF, {
29579
+ return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(eI, { id: n }), e && /* @__PURE__ */ L(eI, {
29567
29580
  id: e,
29568
29581
  showAudioWave: !1
29569
29582
  })] });
29570
- }), eI = Hf(() => /* @__PURE__ */ L("div", {
29583
+ }), nI = Hf(() => /* @__PURE__ */ L("div", {
29571
29584
  class: "cvi-strip-lift absolute bottom-4 @max-mobile:bottom-[calc(5rem_+_var(--cvi-status-strip,0px))] left-4 flex flex-col items-end gap-2 z-20",
29572
- children: /* @__PURE__ */ L($F, {})
29573
- })), tI = Hf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, effect: i, animate: a }) => /* @__PURE__ */ L(E, { children: [
29585
+ children: /* @__PURE__ */ L(tI, {})
29586
+ })), rI = Hf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, effect: i, animate: a }) => /* @__PURE__ */ L(E, { children: [
29574
29587
  /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-base-200" }),
29575
29588
  i.content && /* @__PURE__ */ L("div", {
29576
29589
  class: "absolute overflow-hidden rounded-box bg-black",
@@ -29592,7 +29605,7 @@ var XF = Dt(null), ZF = {
29592
29605
  avatarOff: r
29593
29606
  })
29594
29607
  })
29595
- ] })), nI = Hf(() => {
29608
+ ] })), iI = Hf(() => {
29596
29609
  let { effect: e, animate: t } = CP.value, n = Of();
29597
29610
  return n === null || e.selfView === null ? null : /* @__PURE__ */ L("div", {
29598
29611
  class: "absolute z-20 overflow-hidden rounded-box bg-black/30",
@@ -29605,23 +29618,23 @@ var XF = Dt(null), ZF = {
29605
29618
  className: "h-full w-full object-cover"
29606
29619
  })
29607
29620
  });
29608
- }), rI = Hf(({ canvasRenderedSlot: e }) => {
29621
+ }), aI = Hf(({ canvasRenderedSlot: e }) => {
29609
29622
  let t = LM(CP.value.effect);
29610
- return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(FF, {
29623
+ return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(LF, {
29611
29624
  onError: kM,
29612
- children: /* @__PURE__ */ L(nI, {})
29613
- }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(eI, {});
29614
- }), iI = Hf(() => {
29625
+ children: /* @__PURE__ */ L(iI, {})
29626
+ }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(nI, {});
29627
+ }), oI = Hf(() => {
29615
29628
  let e = $v()[0];
29616
29629
  return e ? /* @__PURE__ */ L(nv, { sessionId: e }) : null;
29617
- }), aI = Hf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(iI, {}), /* @__PURE__ */ L(oI, { ...e })] })), oI = Hf(({ isAudioOnly: e, presence: t, canvasLayoutEffect: n, canvasRenderedSlot: r }) => {
29630
+ }), sI = Hf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(oI, {}), /* @__PURE__ */ L(cI, { ...e })] })), cI = Hf(({ isAudioOnly: e, presence: t, canvasLayoutEffect: n, canvasRenderedSlot: r }) => {
29618
29631
  let { presence: i, localId: a, isScreenSharing: o, isPersonaPresenting: s } = t, c = CP.value, l = n.active && !o && (!e || s);
29619
29632
  return i.phase === "left" ? /* @__PURE__ */ L(Wv, {}) : i.phase === "connecting" ? /* @__PURE__ */ L(Uv, {}) : e && !s ? /* @__PURE__ */ L("div", {
29620
29633
  class: "absolute inset-0 flex items-center justify-center",
29621
29634
  children: /* @__PURE__ */ L(Xv, { sessionId: i.replicaId })
29622
- }) : c.effect.driving ? /* @__PURE__ */ L(FF, {
29635
+ }) : c.effect.driving ? /* @__PURE__ */ L(LF, {
29623
29636
  onError: kM,
29624
- children: /* @__PURE__ */ L(tI, {
29637
+ children: /* @__PURE__ */ L(rI, {
29625
29638
  personaSessionId: i.replicaId,
29626
29639
  localId: a,
29627
29640
  isScreenSharing: o,
@@ -29635,7 +29648,7 @@ var XF = Dt(null), ZF = {
29635
29648
  avatarOff: i.videoState.isOff,
29636
29649
  canvasLayoutEffect: n,
29637
29650
  smartSidecarActive: l
29638
- }) : /* @__PURE__ */ L(sI, {
29651
+ }) : /* @__PURE__ */ L(lI, {
29639
29652
  personaSessionId: i.replicaId,
29640
29653
  localId: a,
29641
29654
  isScreenSharing: o,
@@ -29644,11 +29657,11 @@ var XF = Dt(null), ZF = {
29644
29657
  canvasLayoutEffect: n,
29645
29658
  canvasRenderedSlot: r
29646
29659
  });
29647
- }), sI = Hf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ L(ex, {
29660
+ }), lI = Hf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ L(ex, {
29648
29661
  canvasLayoutEffect: a,
29649
29662
  smartSidecarActive: i,
29650
29663
  isScreenSharing: n,
29651
- captureSnapshot: dI,
29664
+ captureSnapshot: pI,
29652
29665
  personaMode: "auto",
29653
29666
  renderedSlot: o,
29654
29667
  fill: (i) => /* @__PURE__ */ L(iy, {
@@ -29658,7 +29671,7 @@ var XF = Dt(null), ZF = {
29658
29671
  avatarOff: r,
29659
29672
  videoRef: i
29660
29673
  })
29661
- })), cI = Hf(({ items: e }) => {
29674
+ })), uI = Hf(({ items: e }) => {
29662
29675
  let [t, n] = j(!1), r = N(null);
29663
29676
  return M(() => {
29664
29677
  if (!t) return;
@@ -29688,8 +29701,8 @@ var XF = Dt(null), ZF = {
29688
29701
  children: e
29689
29702
  })]
29690
29703
  });
29691
- }), lI = Hf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L(cI, { items: e })), uI = Hf(({ onLeave: e }) => {
29692
- let t = Df(), { config: n } = Zm(), { session: r, end: i } = Av(), a = Of(), o = N(null), s = I(zh)?.frameRef ?? o, [c, l] = j(!1), u = M_() === "full-screen", [d, f] = j(!1), [p, m] = j(ZF), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = LF(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = zF(x, CM(y.magic_grid, w), C), E = BF(x, S, 72, !0, C), D = y.modality === "audio", ee = RF(D), O = y.modality === "chat", te = y.modality === "video", ne = y.enable_chat, k = y.enable_closed_captions, re = y.enable_picture_in_picture, { pipWindow: ie } = YF({
29704
+ }), dI = Hf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L(uI, { items: e })), fI = Hf(({ onLeave: e }) => {
29705
+ let t = Df(), { config: n } = Zm(), { session: r, end: i } = Av(), a = Of(), o = N(null), s = I(zh)?.frameRef ?? o, [c, l] = j(!1), u = M_() === "full-screen", [d, f] = j(!1), [p, m] = j($F), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = zF(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = VF(x, CM(y.magic_grid, w), C), E = HF(x, S, 72, !0, C), D = y.modality === "audio", ee = BF(D), O = y.modality === "chat", te = y.modality === "video", ne = y.enable_chat, k = y.enable_closed_captions, re = y.enable_picture_in_picture, { pipWindow: ie } = ZF({
29693
29706
  enabled: re && !O,
29694
29707
  active: t === "joined-meeting"
29695
29708
  });
@@ -29698,13 +29711,13 @@ var XF = Dt(null), ZF = {
29698
29711
  }, [i]);
29699
29712
  let { camera: ae, requestCamera: A } = dh(), { isCamMuted: oe } = rv(), se = ae.isGranted && !oe;
29700
29713
  M(() => {
29701
- te && t === "joined-meeting" && (XF.value = se);
29714
+ te && t === "joined-meeting" && (QF.value = se);
29702
29715
  }, [
29703
29716
  te,
29704
29717
  t,
29705
29718
  se
29706
29719
  ]);
29707
- let ce = N(te && !a && XF.value === !0);
29720
+ let ce = N(te && !a && QF.value === !0);
29708
29721
  M(() => {
29709
29722
  t === "joined-meeting" && ce.current && (ce.current = !1, A());
29710
29723
  }, [t, A]), M(() => {
@@ -29728,10 +29741,10 @@ var XF = Dt(null), ZF = {
29728
29741
  let ue = F(() => {
29729
29742
  i();
29730
29743
  }, [i]);
29731
- if (HF({
29744
+ if (WF({
29732
29745
  active: !O && t === "joined-meeting",
29733
29746
  onTimeout: ue
29734
- }), WF({ onShutdown: ue }), !C) return null;
29747
+ }), KF({ onShutdown: ue }), !C) return null;
29735
29748
  if (O) return /* @__PURE__ */ L(Lv, {
29736
29749
  defaultOpen: !0,
29737
29750
  children: /* @__PURE__ */ L("div", {
@@ -29763,14 +29776,14 @@ var XF = Dt(null), ZF = {
29763
29776
  /* @__PURE__ */ L("div", {
29764
29777
  class: "relative w-full h-full z-[5]",
29765
29778
  children: [
29766
- /* @__PURE__ */ L(aI, {
29779
+ /* @__PURE__ */ L(sI, {
29767
29780
  isAudioOnly: D,
29768
29781
  presence: ee,
29769
29782
  canvasLayoutEffect: p,
29770
29783
  canvasRenderedSlot: h
29771
29784
  }),
29772
- !D && /* @__PURE__ */ L(rI, { canvasRenderedSlot: h }),
29773
- /* @__PURE__ */ L(hF, {
29785
+ !D && /* @__PURE__ */ L(aI, { canvasRenderedSlot: h }),
29786
+ /* @__PURE__ */ L(_F, {
29774
29787
  debugEnabled: d,
29775
29788
  callPresence: ee,
29776
29789
  callControlsVisible: T,
@@ -29808,7 +29821,7 @@ var XF = Dt(null), ZF = {
29808
29821
  /* @__PURE__ */ L(wv, { level: !0 }),
29809
29822
  !D && /* @__PURE__ */ L(Ev, {}),
29810
29823
  k && /* @__PURE__ */ L(Pv, {}),
29811
- /* @__PURE__ */ L(lI, { items: de }),
29824
+ /* @__PURE__ */ L(dI, { items: de }),
29812
29825
  /* @__PURE__ */ L("button", {
29813
29826
  type: "button",
29814
29827
  class: "btn btn-control btn-error",
@@ -29825,7 +29838,7 @@ var XF = Dt(null), ZF = {
29825
29838
  ]
29826
29839
  }), ie && np(/* @__PURE__ */ L(ny, { onLeave: ue }), ie.document.body)] }) }) });
29827
29840
  });
29828
- function dI(e) {
29841
+ function pI(e) {
29829
29842
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
29830
29843
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
29831
29844
  t.width = 640, t.height = n;
@@ -29840,7 +29853,7 @@ function dI(e) {
29840
29853
  }
29841
29854
  //#endregion
29842
29855
  //#region ../core/src/components/hair-check/index.tsx
29843
- function fI(e, t, n) {
29856
+ function mI(e, t, n) {
29844
29857
  switch (t) {
29845
29858
  case "granted": return n ? e?.cameraOptional ?? "Camera is optional — turn it on anytime." : e?.ready ?? "You're all set — join whenever you're ready.";
29846
29859
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -29851,7 +29864,7 @@ function fI(e, t, n) {
29851
29864
  default: return e?.loading ?? "Getting your microphone ready...";
29852
29865
  }
29853
29866
  }
29854
- var pI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29867
+ var hI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29855
29868
  let i = Ef(), { config: a } = Zm(), { cameraOnStart: o } = I(st), { localSessionId: s, isCamMuted: c } = rv(), { mic: l, camera: u, requestMic: d, requestCamera: f } = dh(), p = a.value.customization.conversation.modality === "video", m = s_(a.value), h = o_(a.value);
29856
29869
  M(() => {
29857
29870
  d();
@@ -29867,7 +29880,7 @@ var pI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29867
29880
  u.isBlocked,
29868
29881
  f
29869
29882
  ]);
29870
- let v = p && g && !u.isGranted, y = fI(e, l.status, v);
29883
+ let v = p && g && !u.isGranted, y = mI(e, l.status, v);
29871
29884
  return /* @__PURE__ */ L(fv, { children: /* @__PURE__ */ L("div", {
29872
29885
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
29873
29886
  children: [u.isGranted && !c ? /* @__PURE__ */ L("div", {
@@ -29918,8 +29931,8 @@ var pI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29918
29931
  })]
29919
29932
  })]
29920
29933
  }) });
29921
- }), mI = "Password required", hI = "Enter the password to start this conversation.", gI = "Password", _I = "Continue";
29922
- function vI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29934
+ }), gI = "Password required", _I = "Enter the password to start this conversation.", vI = "Password", yI = "Continue";
29935
+ function bI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29923
29936
  let [i, a] = j(""), o = Ze();
29924
29937
  return /* @__PURE__ */ L("div", {
29925
29938
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -29939,18 +29952,18 @@ function vI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29939
29952
  /* @__PURE__ */ L("h3", {
29940
29953
  id: `${o}-title`,
29941
29954
  class: "card-title text-base-content",
29942
- children: t?.title ?? mI
29955
+ children: t?.title ?? gI
29943
29956
  }),
29944
29957
  /* @__PURE__ */ L("p", {
29945
29958
  class: "text-sm text-base-content/70",
29946
- children: t?.description ?? hI
29959
+ children: t?.description ?? _I
29947
29960
  }),
29948
29961
  /* @__PURE__ */ L("input", {
29949
29962
  id: o,
29950
29963
  type: "password",
29951
29964
  autocomplete: "current-password",
29952
29965
  class: "input input-bordered w-full",
29953
- placeholder: t?.placeholder ?? gI,
29966
+ placeholder: t?.placeholder ?? vI,
29954
29967
  value: i,
29955
29968
  disabled: n,
29956
29969
  onInput: (e) => a(e.target.value),
@@ -29966,7 +29979,7 @@ function vI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29966
29979
  type: "submit",
29967
29980
  disabled: !i.trim(),
29968
29981
  loading: n,
29969
- children: t?.submit ?? _I
29982
+ children: t?.submit ?? yI
29970
29983
  })
29971
29984
  ]
29972
29985
  })
@@ -29975,7 +29988,7 @@ function vI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29975
29988
  }
29976
29989
  //#endregion
29977
29990
  //#region ../core/src/components/welcome/index.tsx
29978
- function yI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
29991
+ function xI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
29979
29992
  let { config: i, deploymentId: a } = Zm(), o = M_() === "full-screen", s = I(Dm), c = s_(i.value), l = c.btn_title ?? e?.fallback_button ?? "Start the conversation", u = i.value.customization.terms_content?.trim() ?? "", d = i.value.customization.terms_enabled === !0, f = u.length > 0, p = f && d, m = P(() => p && $p(a, u), [
29980
29993
  p,
29981
29994
  a,
@@ -29984,7 +29997,7 @@ function yI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
29984
29997
  return /* @__PURE__ */ L(G_, {
29985
29998
  title: c.title,
29986
29999
  description: c.description,
29987
- overlay: v && s ? /* @__PURE__ */ L(vI, { onSubmit: s.setPassword }) : null,
30000
+ overlay: v && s ? /* @__PURE__ */ L(bI, { onSubmit: s.setPassword }) : null,
29988
30001
  children: [/* @__PURE__ */ L("div", {
29989
30002
  class: "relative",
29990
30003
  children: [r && /* @__PURE__ */ L(P_, {
@@ -30022,28 +30035,28 @@ function yI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30022
30035
  }
30023
30036
  //#endregion
30024
30037
  //#region ../core/src/hooks/use-haircheck-text.ts
30025
- function bI(...e) {
30038
+ function SI(...e) {
30026
30039
  for (let t of e) {
30027
30040
  let e = t?.trim();
30028
30041
  if (e) return e;
30029
30042
  }
30030
30043
  }
30031
- function xI() {
30044
+ function CI() {
30032
30045
  let { config: e } = Zm(), { haircheck: t } = e.value.customization;
30033
30046
  return P(() => ({
30034
- prompt: bI(t.permission_request_description, t.permission_request_title),
30035
- ready: bI(t.permission_granted_description, t.permission_granted_title),
30036
- denied: bI(t.permission_denied_description, t.permission_denied_title),
30037
- join: bI(t.join_button),
30038
- cancel: bI(t.cancel_btn)
30047
+ prompt: SI(t.permission_request_description, t.permission_request_title),
30048
+ ready: SI(t.permission_granted_description, t.permission_granted_title),
30049
+ denied: SI(t.permission_denied_description, t.permission_denied_title),
30050
+ join: SI(t.join_button),
30051
+ cancel: SI(t.cancel_btn)
30039
30052
  }), [t]);
30040
30053
  }
30041
30054
  //#endregion
30042
30055
  //#region ../core/src/shells/flow-state-body.tsx
30043
- function SI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30044
- let r = xI();
30056
+ function wI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30057
+ let r = CI();
30045
30058
  switch (e.state) {
30046
- case "idle": return /* @__PURE__ */ L(yI, {
30059
+ case "idle": return /* @__PURE__ */ L(xI, {
30047
30060
  text: t,
30048
30061
  onStart: () => {
30049
30062
  e.start();
@@ -30051,7 +30064,7 @@ function SI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30051
30064
  isStarting: e.isStarting,
30052
30065
  permissionRequest: e.permissionRequest
30053
30066
  });
30054
- case "haircheck": return /* @__PURE__ */ L(pI, {
30067
+ case "haircheck": return /* @__PURE__ */ L(hI, {
30055
30068
  text: r,
30056
30069
  onJoin: () => {
30057
30070
  e.join();
@@ -30059,7 +30072,7 @@ function SI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30059
30072
  onCancel: () => e.cancel(),
30060
30073
  isJoining: e.isStarting
30061
30074
  });
30062
- case "call": return /* @__PURE__ */ L(uI, { onLeave: () => e.leave() });
30075
+ case "call": return /* @__PURE__ */ L(fI, { onLeave: () => e.leave() });
30063
30076
  case "ended": return /* @__PURE__ */ L($_, {
30064
30077
  isStarting: e.isStarting,
30065
30078
  permissionRequest: e.permissionRequest,
@@ -30084,7 +30097,7 @@ function SI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30084
30097
  }
30085
30098
  //#endregion
30086
30099
  //#region ../core/src/providers/widget-ui-provider.tsx
30087
- function CI({ children: e }) {
30100
+ function TI({ children: e }) {
30088
30101
  let { config: t } = I(gr), n = t.peek().customization?.widget, r = n?.expandable ?? "default", i = qt(r === "start-expanded" || r === "always"), a = qt(n?.variant ?? "full"), o = qt(n?.position ?? "bottom-right"), s = qt(r), c = qt(n?.avatar?.type ?? "orb"), l = N(r);
30089
30102
  en(() => {
30090
30103
  let e = t.value.customization?.widget, n = e?.expandable ?? "default";
@@ -30134,14 +30147,14 @@ function CI({ children: e }) {
30134
30147
  }
30135
30148
  //#endregion
30136
30149
  //#region ../core/src/components/powered-by/index.tsx
30137
- function wI() {
30150
+ function EI() {
30138
30151
  let { config: e } = Zm(), t = e.value.customization.branding;
30139
- return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ L(TI, {}) : t?.logo || t?.text ? /* @__PURE__ */ L(EI, {
30152
+ return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ L(DI, {}) : t?.logo || t?.text ? /* @__PURE__ */ L(OI, {
30140
30153
  logo: t.logo,
30141
30154
  text: t.text
30142
30155
  }) : null;
30143
30156
  }
30144
- function TI() {
30157
+ function DI() {
30145
30158
  let { isDark: e } = vj(), t = e.value ? "white" : "#140206";
30146
30159
  return /* @__PURE__ */ L("a", {
30147
30160
  href: "https://tavus.io",
@@ -30168,7 +30181,7 @@ function TI() {
30168
30181
  })] })]
30169
30182
  });
30170
30183
  }
30171
- function EI({ logo: e, text: t }) {
30184
+ function OI({ logo: e, text: t }) {
30172
30185
  return /* @__PURE__ */ L("div", {
30173
30186
  class: "inline-flex items-center gap-1 text-xs text-base-content/50",
30174
30187
  children: [e ? /* @__PURE__ */ L("img", {
@@ -30180,63 +30193,63 @@ function EI({ logo: e, text: t }) {
30180
30193
  }
30181
30194
  //#endregion
30182
30195
  //#region ../core/src/hooks/use-widget-text.ts
30183
- var DI = {
30196
+ var kI = {
30184
30197
  title: "Hi! Want to chat?",
30185
30198
  btn_title: "Start conversation"
30186
30199
  };
30187
- function OI() {
30200
+ function AI() {
30188
30201
  let { config: e } = Zm(), t = e.value.customization.widget?.text;
30189
30202
  return P(() => ({
30190
- title: t?.title || DI.title,
30191
- btn_title: t?.btn_title || DI.btn_title
30203
+ title: t?.title || kI.title,
30204
+ btn_title: t?.btn_title || kI.btn_title
30192
30205
  }), [t]);
30193
30206
  }
30194
30207
  //#endregion
30195
30208
  //#region ../core/src/hooks/use-widget-ui.ts
30196
- function kI() {
30209
+ function jI() {
30197
30210
  let e = I(bh);
30198
30211
  if (!e) throw Error("useWidgetUI must be used within WidgetUIProvider");
30199
30212
  return e;
30200
30213
  }
30201
30214
  //#endregion
30202
30215
  //#region ../core/src/components/widget-launcher/widget-avatar.tsx
30203
- var AI = {
30216
+ var MI = {
30204
30217
  xs: "w-6 h-6",
30205
30218
  sm: "w-8 h-8",
30206
30219
  md: "w-10 h-10",
30207
30220
  lg: "w-16 h-16"
30208
- }, jI = {
30221
+ }, NI = {
30209
30222
  xs: "w-3 h-3",
30210
30223
  sm: "w-4 h-4",
30211
30224
  md: "w-5 h-5",
30212
30225
  lg: "w-8 h-8"
30213
30226
  };
30214
- function MI({ size: e = "md", className: t = "" }) {
30215
- let { avatarType: n } = kI(), { config: r } = Zm(), i = o_(r.value);
30227
+ function PI({ size: e = "md", className: t = "" }) {
30228
+ let { avatarType: n } = jI(), { config: r } = Zm(), i = o_(r.value);
30216
30229
  return (s_(r.value).background.type === "replica" || n.value === "image") && i ? /* @__PURE__ */ L("div", {
30217
- class: `relative ${AI[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
30230
+ class: `relative ${MI[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
30218
30231
  children: /* @__PURE__ */ L(m_, { replica: i })
30219
30232
  }) : /* @__PURE__ */ L("div", {
30220
- class: `relative ${AI[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
30221
- children: /* @__PURE__ */ L("span", { class: `${jI[e]} rounded-full bg-primary animate-pulse` })
30233
+ class: `relative ${MI[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
30234
+ children: /* @__PURE__ */ L("span", { class: `${NI[e]} rounded-full bg-primary animate-pulse` })
30222
30235
  });
30223
30236
  }
30224
30237
  //#endregion
30225
30238
  //#region ../core/src/components/widget-launcher/widget-launcher.tsx
30226
- function NI({ variant: e }) {
30227
- let { toggle: t } = kI(), n = OI();
30239
+ function FI({ variant: e }) {
30240
+ let { toggle: t } = jI(), n = AI();
30228
30241
  return e === "tiny" ? /* @__PURE__ */ L("button", {
30229
30242
  type: "button",
30230
30243
  onClick: t,
30231
30244
  "aria-label": n.btn_title,
30232
30245
  class: "rounded-box overflow-hidden shadow-xl hover:shadow-2xl transition-shadow cursor-pointer",
30233
- children: /* @__PURE__ */ L(MI, { size: "lg" })
30246
+ children: /* @__PURE__ */ L(PI, { size: "lg" })
30234
30247
  }) : e === "compact" ? /* @__PURE__ */ L("button", {
30235
30248
  type: "button",
30236
30249
  onClick: t,
30237
30250
  "aria-label": n.btn_title,
30238
30251
  class: "group flex items-center gap-2.5 py-2.5 pl-2.5 pr-8 rounded-box bg-base-100 text-base-content border border-base-300 shadow-lg hover:shadow-xl transition-shadow cursor-pointer text-left",
30239
- children: [/* @__PURE__ */ L(MI, { size: "md" }), /* @__PURE__ */ L("span", {
30252
+ children: [/* @__PURE__ */ L(PI, { size: "md" }), /* @__PURE__ */ L("span", {
30240
30253
  class: "flex flex-col gap-0.5",
30241
30254
  children: [/* @__PURE__ */ L("span", {
30242
30255
  class: "text-base font-medium leading-tight",
@@ -30253,7 +30266,7 @@ function NI({ variant: e }) {
30253
30266
  class: "flex flex-col gap-3 p-3 w-64 rounded-box bg-base-100 text-base-content border border-base-300 shadow-xl hover:shadow-2xl transition-shadow cursor-pointer text-left",
30254
30267
  children: [/* @__PURE__ */ L("div", {
30255
30268
  class: "flex items-center gap-2.5",
30256
- children: [/* @__PURE__ */ L(MI, { size: "md" }), /* @__PURE__ */ L("span", {
30269
+ children: [/* @__PURE__ */ L(PI, { size: "md" }), /* @__PURE__ */ L("span", {
30257
30270
  class: "text-sm font-medium leading-snug",
30258
30271
  children: n.title
30259
30272
  })]
@@ -30271,13 +30284,13 @@ function NI({ variant: e }) {
30271
30284
  }
30272
30285
  //#endregion
30273
30286
  //#region ../core/src/components/widget-launcher/widget-greeting-bubble.tsx
30274
- var PI = "tavus:widget:greeting-dismissed";
30275
- function FI({ anchor: e }) {
30276
- let t = OI(), { variant: n, expand: r } = kI(), [i, a] = j(!1);
30287
+ var II = "tavus:widget:greeting-dismissed";
30288
+ function LI({ anchor: e }) {
30289
+ let t = AI(), { variant: n, expand: r } = jI(), [i, a] = j(!1);
30277
30290
  M(() => {
30278
30291
  if (n.value === "tiny") {
30279
30292
  try {
30280
- if (sessionStorage.getItem(PI) === "1") return;
30293
+ if (sessionStorage.getItem(II) === "1") return;
30281
30294
  } catch {}
30282
30295
  a(!0);
30283
30296
  }
@@ -30285,7 +30298,7 @@ function FI({ anchor: e }) {
30285
30298
  let o = F((e) => {
30286
30299
  e.stopPropagation();
30287
30300
  try {
30288
- sessionStorage.setItem(PI, "1");
30301
+ sessionStorage.setItem(II, "1");
30289
30302
  } catch {}
30290
30303
  a(!1);
30291
30304
  }, []);
@@ -30317,18 +30330,18 @@ function FI({ anchor: e }) {
30317
30330
  }
30318
30331
  //#endregion
30319
30332
  //#region ../core/src/hooks/use-host-bridge.ts
30320
- function II() {
30333
+ function RI() {
30321
30334
  let e = I(Sh);
30322
30335
  if (!e) throw Error("useHostBridge must be used within HostBridgeProvider");
30323
30336
  return e;
30324
30337
  }
30325
30338
  //#endregion
30326
30339
  //#region ../core/src/shells/widget/widget-popup.tsx
30327
- var LI = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", RI = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", zI = "p-1 flex-1 min-h-0", BI = "p-1 flex-1 min-h-0";
30328
- function VI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30329
- let { expandable: i } = kI(), a = i.value !== "always";
30340
+ var zI = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", BI = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", VI = "p-1 flex-1 min-h-0", HI = "p-1 flex-1 min-h-0";
30341
+ function UI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30342
+ let { expandable: i } = jI(), a = i.value !== "always";
30330
30343
  return r ? /* @__PURE__ */ L("div", {
30331
- class: RI,
30344
+ class: BI,
30332
30345
  children: [
30333
30346
  /* @__PURE__ */ L("div", {
30334
30347
  class: "flex items-center justify-end gap-2 px-2.5 py-1.5 border-b border-base-300",
@@ -30344,18 +30357,18 @@ function VI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30344
30357
  })
30345
30358
  }),
30346
30359
  /* @__PURE__ */ L("div", {
30347
- class: BI,
30360
+ class: HI,
30348
30361
  children: t
30349
30362
  }),
30350
30363
  /* @__PURE__ */ L("div", {
30351
30364
  class: "flex justify-end px-2.5",
30352
- children: /* @__PURE__ */ L(wI, {})
30365
+ children: /* @__PURE__ */ L(EI, {})
30353
30366
  })
30354
30367
  ]
30355
30368
  }) : /* @__PURE__ */ L("div", {
30356
30369
  class: "flex flex-col h-[min(34rem,calc(100dvh-3rem))]",
30357
30370
  children: [/* @__PURE__ */ L("div", {
30358
- class: `${LI} flex-1 overflow-hidden`,
30371
+ class: `${zI} flex-1 overflow-hidden`,
30359
30372
  children: [/* @__PURE__ */ L("div", {
30360
30373
  class: "flex items-center justify-end gap-2 px-2.5 pt-1.5 shrink-0",
30361
30374
  children: a && /* @__PURE__ */ L("button", {
@@ -30369,77 +30382,77 @@ function VI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30369
30382
  })
30370
30383
  })
30371
30384
  }), /* @__PURE__ */ L("div", {
30372
- class: zI,
30385
+ class: VI,
30373
30386
  children: t
30374
30387
  })]
30375
30388
  }), /* @__PURE__ */ L("div", {
30376
30389
  class: "flex justify-end pr-2 pt-1.5 shrink-0",
30377
- children: /* @__PURE__ */ L(wI, {})
30390
+ children: /* @__PURE__ */ L(EI, {})
30378
30391
  })]
30379
30392
  });
30380
30393
  }
30381
30394
  //#endregion
30382
30395
  //#region ../core/src/shells/widget/widget-shell.tsx
30383
- var HI = tn("Widget"), UI = "1rem", WI = 480;
30384
- function GI(e, t, n) {
30396
+ var WI = tn("Widget"), GI = "1rem", KI = 480;
30397
+ function qI(e, t, n) {
30385
30398
  let r = e.state === "call", i = r || e.state === "haircheck" || e.isStarting;
30386
30399
  e.cancel(), r && e.leave(), i && t(), n();
30387
30400
  }
30388
- function KI() {
30389
- return typeof window > "u" ? !1 : window.innerWidth <= WI;
30401
+ function JI() {
30402
+ return typeof window > "u" ? !1 : window.innerWidth <= KI;
30390
30403
  }
30391
- function qI(e) {
30404
+ function YI(e) {
30392
30405
  switch (e) {
30393
30406
  case "bottom-right": return {
30394
- bottom: UI,
30395
- right: UI
30407
+ bottom: GI,
30408
+ right: GI
30396
30409
  };
30397
30410
  case "bottom-left": return {
30398
- bottom: UI,
30399
- left: UI
30411
+ bottom: GI,
30412
+ left: GI
30400
30413
  };
30401
30414
  case "top-right": return {
30402
- top: UI,
30403
- right: UI
30415
+ top: GI,
30416
+ right: GI
30404
30417
  };
30405
30418
  case "top-left": return {
30406
- top: UI,
30407
- left: UI
30419
+ top: GI,
30420
+ left: GI
30408
30421
  };
30409
30422
  case "top": return {
30410
- top: UI,
30423
+ top: GI,
30411
30424
  left: "50%",
30412
30425
  transform: "translateX(-50%)"
30413
30426
  };
30414
30427
  case "bottom": return {
30415
- bottom: UI,
30428
+ bottom: GI,
30416
30429
  left: "50%",
30417
30430
  transform: "translateX(-50%)"
30418
30431
  };
30419
30432
  }
30420
30433
  }
30421
- var JI = [
30434
+ var XI = [
30422
30435
  "top",
30423
30436
  "bottom",
30424
30437
  "left",
30425
30438
  "right",
30426
30439
  "transform"
30427
30440
  ];
30428
- function YI(e) {
30441
+ function ZI(e) {
30429
30442
  return e === "bottom-left" || e === "top-left" ? "left" : "right";
30430
30443
  }
30431
- function XI() {
30432
- let { config: e, initError: t } = Zm(), n = OI(), { expanded: r, position: i, variant: a, collapse: o } = kI(), { end: s } = Av(), { shadowHost: c } = II(), l = j_(), u = qt(KI());
30444
+ function QI() {
30445
+ let { config: e, initError: t } = Zm(), n = AI(), { expanded: r, position: i, variant: a, collapse: o } = jI(), { end: s } = Av(), { shadowHost: c } = RI(), l = j_(), u = qt(JI());
30433
30446
  M(() => {
30434
30447
  if (typeof window > "u") return;
30435
- u.value = KI();
30448
+ u.value = JI();
30436
30449
  let e = () => {
30437
- u.value = KI();
30450
+ u.value = JI();
30438
30451
  };
30439
30452
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
30440
30453
  }, [u]);
30441
30454
  let d = P(() => ({ fallback_button: n.btn_title }), [n.btn_title]), f = F(() => {
30442
- GI(l, s, o);
30455
+ qI(l, s, o);
30443
30456
  }, [
30444
30457
  l,
30445
30458
  s,
@@ -30450,27 +30463,27 @@ function XI() {
30450
30463
  if (e) {
30451
30464
  if (a) e.style.top = "0", e.style.right = "0", e.style.bottom = "0", e.style.left = "0", e.style.transform = "";
30452
30465
  else {
30453
- let n = qI(t);
30454
- for (let t of JI) e.style[t] = n[t] ?? "";
30466
+ let n = YI(t);
30467
+ for (let t of XI) e.style[t] = n[t] ?? "";
30455
30468
  }
30456
30469
  e.dataset.tavusWidgetPosition = t, e.dataset.tavusWidgetExpanded = n ? "true" : "false", e.dataset.tavusWidgetFullscreen = a ? "true" : "false", e.dataset.tavusWidgetSmall = u.value ? "true" : "false";
30457
30470
  }
30458
- }), t.value) return HI.error("Widget cannot initialize (init request failed):", t.value), null;
30459
- if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return HI.error("Widget is unavailable (total_limit reached) — not rendering"), null;
30471
+ }), t.value) return WI.error("Widget cannot initialize (init request failed):", t.value), null;
30472
+ if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return WI.error("Widget is unavailable (total_limit reached) — not rendering"), null;
30460
30473
  if (!r.value) {
30461
- let e = YI(i.value), t = e === "right" ? "flex items-end gap-2 justify-end" : "flex items-end gap-2 flex-row-reverse justify-end", n = e === "right" ? "justify-end pr-2" : "justify-start pl-2";
30474
+ let e = ZI(i.value), t = e === "right" ? "flex items-end gap-2 justify-end" : "flex items-end gap-2 flex-row-reverse justify-end", n = e === "right" ? "justify-end pr-2" : "justify-start pl-2";
30462
30475
  return /* @__PURE__ */ L("div", {
30463
30476
  class: "flex flex-col",
30464
30477
  children: [/* @__PURE__ */ L("div", {
30465
30478
  class: t,
30466
- children: [/* @__PURE__ */ L(FI, { anchor: e }), /* @__PURE__ */ L(NI, { variant: a.value })]
30479
+ children: [/* @__PURE__ */ L(LI, { anchor: e }), /* @__PURE__ */ L(FI, { variant: a.value })]
30467
30480
  }), /* @__PURE__ */ L("div", {
30468
30481
  class: `flex ${n} pt-1.5`,
30469
- children: /* @__PURE__ */ L(wI, {})
30482
+ children: /* @__PURE__ */ L(EI, {})
30470
30483
  })]
30471
30484
  });
30472
30485
  }
30473
- return e.value.is_available === !1 ? /* @__PURE__ */ L(VI, {
30486
+ return e.value.is_available === !1 ? /* @__PURE__ */ L(UI, {
30474
30487
  variant: a.value,
30475
30488
  fullscreen: u.value,
30476
30489
  onClose: f,
@@ -30479,11 +30492,11 @@ function XI() {
30479
30492
  canRetry: !1,
30480
30493
  onRetry: () => {}
30481
30494
  }) })
30482
- }) : /* @__PURE__ */ L(VI, {
30495
+ }) : /* @__PURE__ */ L(UI, {
30483
30496
  variant: a.value,
30484
30497
  fullscreen: u.value,
30485
30498
  onClose: f,
30486
- children: /* @__PURE__ */ L(Bh, { children: /* @__PURE__ */ L(SI, {
30499
+ children: /* @__PURE__ */ L(Bh, { children: /* @__PURE__ */ L(wI, {
30487
30500
  flow: l,
30488
30501
  welcomeText: d,
30489
30502
  onUnavailableCancel: () => l.restart()
@@ -30492,11 +30505,11 @@ function XI() {
30492
30505
  }
30493
30506
  //#endregion
30494
30507
  //#region ../core/src/widget/tavus-widget.tsx
30495
- var ZI = ":host {\n display: block;\n position: fixed;\n z-index: 50;\n background: transparent;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n}";
30496
- function QI(e) {
30508
+ var $I = ":host {\n display: block;\n position: fixed;\n z-index: 50;\n background: transparent;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n}";
30509
+ function eL(e) {
30497
30510
  return /* @__PURE__ */ L(E, { children: [
30498
30511
  /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: Pe } }),
30499
- /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: ZI } }),
30512
+ /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: $I } }),
30500
30513
  /* @__PURE__ */ L(lt, {
30501
30514
  surface: "widget",
30502
30515
  "camera-on-start": e["camera-on-start"],
@@ -30507,13 +30520,13 @@ function QI(e) {
30507
30520
  "memory-stores": e["memory-stores"],
30508
30521
  "base-url": e["base-url"],
30509
30522
  token: e.token,
30510
- children: /* @__PURE__ */ L(_r, { children: /* @__PURE__ */ L(yr, { children: /* @__PURE__ */ L(Om, { children: /* @__PURE__ */ L(Xm, { children: /* @__PURE__ */ L(yh, { children: /* @__PURE__ */ L(CI, { children: /* @__PURE__ */ L(wh, { children: /* @__PURE__ */ L(Eh, { children: /* @__PURE__ */ L(XI, {}) }) }) }) }) }) }) }) })
30523
+ children: /* @__PURE__ */ L(_r, { children: /* @__PURE__ */ L(yr, { children: /* @__PURE__ */ L(Om, { children: /* @__PURE__ */ L(Xm, { children: /* @__PURE__ */ L(yh, { children: /* @__PURE__ */ L(TI, { children: /* @__PURE__ */ L(wh, { children: /* @__PURE__ */ L(Eh, { children: /* @__PURE__ */ L(QI, {}) }) }) }) }) }) }) }) })
30511
30524
  })
30512
30525
  ] });
30513
30526
  }
30514
- var $I;
30515
- function eL() {
30516
- $I ||= Ee(QI, "tavus-widget", [
30527
+ var tL;
30528
+ function nL() {
30529
+ tL ||= Ee(eL, "tavus-widget", [
30517
30530
  "camera-on-start",
30518
30531
  "deployment-id",
30519
30532
  "override-config",
@@ -30529,7 +30542,7 @@ function eL() {
30529
30542
  }
30530
30543
  //#endregion
30531
30544
  //#region src/integration.ts
30532
- var tL = [
30545
+ var rL = [
30533
30546
  "tavus:chat-message",
30534
30547
  "tavus:conversation-created",
30535
30548
  "tavus:conversation-ended",
@@ -30541,7 +30554,7 @@ var tL = [
30541
30554
  "tavus:ready",
30542
30555
  "tavus:state-change",
30543
30556
  "tavus:tool-call"
30544
- ], nL = class {
30557
+ ], iL = class {
30545
30558
  element = null;
30546
30559
  tagName;
30547
30560
  constructor(e = "tavus-widget") {
@@ -30592,6 +30605,6 @@ var tL = [
30592
30605
  };
30593
30606
  //#endregion
30594
30607
  //#region src/index.ts
30595
- typeof window < "u" && eL();
30608
+ typeof window < "u" && nL();
30596
30609
  //#endregion
30597
- export { tL as TAVUS_EVENT_NAMES, nL as TavusIntegration };
30610
+ export { rL as TAVUS_EVENT_NAMES, iL as TavusIntegration };