@tavus/widget 0.15.0 → 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.0",
2965
+ version: "0.16.0",
2966
2966
  variant: "widget"
2967
2967
  }, wn = /* @__PURE__ */ new Set([
2968
2968
  "Error",
@@ -28457,7 +28457,10 @@ function GP(e) {
28457
28457
  let t = UP(e)?.state;
28458
28458
  return t === "success" || t === "error";
28459
28459
  }
28460
- function KP(e, t, n) {
28460
+ function KP(e) {
28461
+ return UP(e)?.state === "error";
28462
+ }
28463
+ function qP(e, t, n) {
28461
28464
  let r = `${t + 8}px`;
28462
28465
  if (n === void 0 || !Number.isFinite(n) || n <= 0) return {
28463
28466
  left: "1rem",
@@ -28471,7 +28474,7 @@ function KP(e, t, n) {
28471
28474
  bottom: r
28472
28475
  };
28473
28476
  }
28474
- function qP(e) {
28477
+ function JP(e) {
28475
28478
  let t = e?.trim();
28476
28479
  if (!t) return zP * VP();
28477
28480
  let n = Number.parseFloat(t);
@@ -28479,8 +28482,8 @@ function qP(e) {
28479
28482
  if (t.endsWith("rem")) return n * VP();
28480
28483
  if (t.endsWith("px")) return n;
28481
28484
  }
28482
- function JP(e, t) {
28483
- let n = e["--color-neutral"], r = e["--color-neutral-content"], i = qP(e["--radius-field"]);
28485
+ function YP(e, t) {
28486
+ let n = e["--color-neutral"], r = e["--color-neutral-content"], i = JP(e["--radius-field"]);
28484
28487
  return {
28485
28488
  ...n ? { "--activity-bg": n } : {},
28486
28489
  ...r ? { "--activity-fg": r } : {},
@@ -28492,62 +28495,62 @@ function JP(e, t) {
28492
28495
  }
28493
28496
  //#endregion
28494
28497
  //#region ../core/src/magic-canvas/magic-canvas.tsx
28495
- var YP = 1e3, XP = 5e3, ZP = 1200, QP = [2e3, 6e3];
28496
- async function $P(e, t, n) {
28497
- let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), XP);
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);
28498
28501
  try {
28499
28502
  await mn(e, t, n, { signal: r.signal });
28500
28503
  } finally {
28501
28504
  globalThis.clearTimeout(i);
28502
28505
  }
28503
28506
  }
28504
- function eF(e) {
28507
+ function tF(e) {
28505
28508
  return e instanceof cn && e.status >= 400 && e.status < 500 && e.status !== 408 && e.status !== 429;
28506
28509
  }
28507
- function tF(e, t) {
28510
+ function nF(e, t) {
28508
28511
  console.error("Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.", e), t({
28509
28512
  lastInteractionPostResult: "error",
28510
- lastError: FF(e).message
28513
+ lastError: IF(e).message
28511
28514
  }, {
28512
28515
  error: e,
28513
28516
  operation: "canvas.bridge"
28514
28517
  });
28515
28518
  }
28516
- function nF(e) {
28519
+ function rF(e) {
28517
28520
  return e.content.some((e) => e.type === "text" && typeof e.text == "string" && e.text.trim() !== "");
28518
28521
  }
28519
- function rF(e, t, n, r) {
28522
+ function iF(e, t, n, r) {
28520
28523
  (async () => {
28521
28524
  let i;
28522
- for (let a of QP) {
28525
+ for (let a of $P) {
28523
28526
  await new Promise((e) => setTimeout(e, a));
28524
28527
  try {
28525
- await $P(e, t, n), r({
28528
+ await eF(e, t, n), r({
28526
28529
  lastInteractionPostResult: "recovered",
28527
28530
  lastError: void 0
28528
28531
  });
28529
28532
  return;
28530
28533
  } catch (e) {
28531
- if (i = e, eF(e)) break;
28534
+ if (i = e, tF(e)) break;
28532
28535
  }
28533
28536
  }
28534
- tF(i, r);
28537
+ nF(i, r);
28535
28538
  })();
28536
28539
  }
28537
- var iF = 2e3;
28538
- function aF(e) {
28539
- return e.correct_answer === void 0 ? ZP : iF;
28540
+ var aF = 2e3;
28541
+ function oF(e) {
28542
+ return e.correct_answer === void 0 ? QP : aF;
28540
28543
  }
28541
- var oF = 48, sF = 24, cF = "ui-monospace, SFMono-Regular, Menlo, monospace", lF = 160, uF = () => {}, dF = "allow-scripts", fF = {
28544
+ var sF = 48, cF = 24, lF = "ui-monospace, SFMono-Regular, Menlo, monospace", uF = 160, dF = () => {}, fF = "allow-scripts", pF = {
28542
28545
  "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms",
28543
28546
  "canvas.text": "allow-scripts allow-popups allow-popups-to-escape-sandbox"
28544
28547
  };
28545
- function pF(e, t) {
28548
+ function mF(e, t) {
28546
28549
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
28547
28550
  let n = e.data;
28548
28551
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
28549
28552
  }
28550
- var mF = class {
28553
+ var hF = class {
28551
28554
  onmessage;
28552
28555
  onerror;
28553
28556
  onclose;
@@ -28558,7 +28561,7 @@ var mF = class {
28558
28561
  }
28559
28562
  start() {
28560
28563
  let e = (e) => {
28561
- pF(e, this.#e) && this.onmessage?.(e.data);
28564
+ mF(e, this.#e) && this.onmessage?.(e.data);
28562
28565
  };
28563
28566
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
28564
28567
  }
@@ -28569,12 +28572,12 @@ var mF = class {
28569
28572
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
28570
28573
  }
28571
28574
  };
28572
- function hF(e) {
28573
- for (let t of Sy) if (e.some((e) => jF(e) === t)) return t;
28575
+ function gF(e) {
28576
+ for (let t of Sy) if (e.some((e) => MF(e) === t)) return t;
28574
28577
  return null;
28575
28578
  }
28576
- function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = MF(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28577
- let { client: l, telemetry: u } = Zm(), { dataTheme: 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] = DF(), E = I(st)?.surface, D = HP(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(() => {
28578
28581
  S.current !== null && (clearTimeout(S.current), S.current = null);
28579
28582
  }, []), k = F(() => {
28580
28583
  C.current !== null && (clearTimeout(C.current), C.current = null);
@@ -28642,7 +28645,7 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28642
28645
  m,
28643
28646
  se
28644
28647
  ]), le = P(() => ({
28645
- theme: d.value === "dark" ? "dark" : "light",
28648
+ theme: d.value ? "dark" : "light",
28646
28649
  cssVars: f.value
28647
28650
  }), [d.value, f.value]);
28648
28651
  M(() => {
@@ -28666,13 +28669,10 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28666
28669
  try {
28667
28670
  let t = Sb(e.data);
28668
28671
  if (!t) return;
28669
- let n = By(x.current, t);
28670
- if (n.consumed) {
28671
- if (!n.strip) re();
28672
- else if (GP(n.strip.arguments)) {
28673
- let e = x.current;
28674
- e !== null && e.tool_call_id === n.strip.tool_call_id && e.conversation_id === n.strip.conversation_id && ie();
28675
- } 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();
28676
28676
  } else g((e) => Iy(e, t));
28677
28677
  se({
28678
28678
  lastToolCall: e.data,
@@ -28683,7 +28683,7 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28683
28683
  } catch (e) {
28684
28684
  se({
28685
28685
  iframeLifecycleState: "error",
28686
- lastError: FF(e).message
28686
+ lastError: IF(e).message
28687
28687
  }, {
28688
28688
  error: e,
28689
28689
  operation: "canvas.validate"
@@ -28721,7 +28721,7 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28721
28721
  de.safe_area?.width,
28722
28722
  de.safe_area?.height
28723
28723
  ]);
28724
- let pe = hF(ue.map(({ layout: e }) => e));
28724
+ let pe = gF(ue.map(({ layout: e }) => e));
28725
28725
  M(() => {
28726
28726
  t?.(pe);
28727
28727
  }, [t, pe]);
@@ -28730,7 +28730,7 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28730
28730
  ref: w,
28731
28731
  "data-magic-canvas-root": !0,
28732
28732
  class: "pointer-events-none absolute inset-0 z-30",
28733
- style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - sF}px`,
28733
+ style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - cF}px`,
28734
28734
  children: [
28735
28735
  me && fe && /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-black/45" }),
28736
28736
  me && !fe && oe.sheetBottomPx !== null && /* @__PURE__ */ L("div", {
@@ -28741,15 +28741,15 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28741
28741
  backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))"
28742
28742
  }
28743
28743
  }),
28744
- me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(bF, {
28745
- slot: jF(t),
28744
+ me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(xF, {
28745
+ slot: MF(t),
28746
28746
  safeAreaTop: de.safe_area?.y,
28747
28747
  frameWidth: T.width,
28748
28748
  ...n ? {
28749
28749
  gridRect: n,
28750
28750
  gridAnimate: oe.animate
28751
28751
  } : {},
28752
- children: (r) => /* @__PURE__ */ L(xF, {
28752
+ children: (r) => /* @__PURE__ */ L(SF, {
28753
28753
  availableHeight: r,
28754
28754
  client: l,
28755
28755
  gridDriven: n !== null,
@@ -28775,7 +28775,7 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28775
28775
  sendAppMessage: ce
28776
28776
  })
28777
28777
  }, e.id)),
28778
- _ && /* @__PURE__ */ L(_F, {
28778
+ _ && /* @__PURE__ */ L(vF, {
28779
28779
  client: l,
28780
28780
  controlsRect: a,
28781
28781
  density: D,
@@ -28795,7 +28795,7 @@ function gF({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28795
28795
  ]
28796
28796
  });
28797
28797
  }
28798
- function _F({ 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 }) {
28799
28799
  let u = FP[n], d = {
28800
28800
  ...o.layout,
28801
28801
  preferred_slot: "safe-area-bottom",
@@ -28805,7 +28805,7 @@ function _F({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
28805
28805
  ...a,
28806
28806
  cssVars: {
28807
28807
  ...a.cssVars,
28808
- "--font-mono": cF
28808
+ "--font-mono": lF
28809
28809
  },
28810
28810
  activity: {
28811
28811
  density: n,
@@ -28814,13 +28814,13 @@ function _F({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
28814
28814
  }), [n, a]);
28815
28815
  return /* @__PURE__ */ L("div", {
28816
28816
  class: "cvi-status-strip absolute flex justify-center",
28817
- style: KP(t, 72, i),
28817
+ style: qP(t, 72, i),
28818
28818
  "data-canvas-status-strip": !0,
28819
- children: /* @__PURE__ */ L(vF, {
28819
+ children: /* @__PURE__ */ L(yF, {
28820
28820
  exiting: r,
28821
28821
  instanceId: o.id,
28822
- children: /* @__PURE__ */ L(xF, {
28823
- availableHeight: lF,
28822
+ children: /* @__PURE__ */ L(SF, {
28823
+ availableHeight: uF,
28824
28824
  client: e,
28825
28825
  fixedHeightPx: u,
28826
28826
  hostTheme: f,
@@ -28828,15 +28828,15 @@ function _F({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
28828
28828
  layout: d,
28829
28829
  onComplete: s,
28830
28830
  onDebug: c,
28831
- onDisplayModeChange: uF,
28832
- onNaturalHeightChange: uF,
28831
+ onDisplayModeChange: dF,
28832
+ onNaturalHeightChange: dF,
28833
28833
  sendAppMessage: l,
28834
28834
  variant: "strip"
28835
28835
  })
28836
28836
  })
28837
28837
  });
28838
28838
  }
28839
- function vF({ exiting: e, instanceId: t, children: n }) {
28839
+ function yF({ exiting: e, instanceId: t, children: n }) {
28840
28840
  let r = N(null);
28841
28841
  return Xe(() => {
28842
28842
  let t = r.current;
@@ -28872,9 +28872,9 @@ function vF({ exiting: e, instanceId: t, children: n }) {
28872
28872
  children: n
28873
28873
  });
28874
28874
  }
28875
- var yF = 16;
28876
- function bF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
28877
- let [o, s] = OF(), 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);
28878
28878
  if (r) return /* @__PURE__ */ L("div", {
28879
28879
  ref: o,
28880
28880
  class: "pointer-events-auto absolute",
@@ -28890,7 +28890,7 @@ function bF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28890
28890
  let r = t == null ? "1rem" : `${t * 100}%`, i = n != null && n > 0 ? Math.max(0, n - 32) : void 0;
28891
28891
  return /* @__PURE__ */ L("div", {
28892
28892
  ref: o,
28893
- class: `cvi-strip-lift ${AF(e)}`,
28893
+ class: `cvi-strip-lift ${jF(e)}`,
28894
28894
  style: {
28895
28895
  top: r,
28896
28896
  bottom: "calc(72px + var(--mc-strip-band, 0px))",
@@ -28905,8 +28905,8 @@ function bF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28905
28905
  }
28906
28906
  return e === "safe-area-bottom" ? /* @__PURE__ */ L("div", {
28907
28907
  ref: o,
28908
- class: AF(e),
28909
- style: { top: `${yF}px` },
28908
+ class: jF(e),
28909
+ style: { top: `${bF}px` },
28910
28910
  "data-canvas-slot": e,
28911
28911
  children: /* @__PURE__ */ L("div", {
28912
28912
  class: "contents",
@@ -28914,7 +28914,7 @@ function bF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28914
28914
  })
28915
28915
  }) : /* @__PURE__ */ L("div", {
28916
28916
  ref: o,
28917
- class: AF(e),
28917
+ class: jF(e),
28918
28918
  "data-canvas-slot": e,
28919
28919
  children: /* @__PURE__ */ L("div", {
28920
28920
  class: "contents",
@@ -28922,7 +28922,7 @@ function bF({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
28922
28922
  })
28923
28923
  });
28924
28924
  }
28925
- function xF({ 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 }) {
28926
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({
28927
28927
  fixed: m,
28928
28928
  max: g
@@ -28935,17 +28935,17 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
28935
28935
  }, [m, g]), M(() => {
28936
28936
  w.current = a;
28937
28937
  }, [a]), M(() => {
28938
- x.current = ne, v.current?.setHostContext(TF(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));
28939
28939
  }, [ne]), M(() => {
28940
28940
  y.current = e, b.current = r;
28941
- let t = wF(i, _.current);
28942
- C.current = t, v.current?.setHostContext(TF(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));
28943
28943
  }, [
28944
28944
  e,
28945
28945
  i,
28946
28946
  r
28947
28947
  ]), M(() => {
28948
- T.current = o, v.current?.setHostContext(TF(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));
28949
28949
  }, [e, o]), M(() => {
28950
28950
  D.current = l, ee.current = u, O.current = d, te.current = f;
28951
28951
  }, [
@@ -28959,7 +28959,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
28959
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) => {
28960
28960
  n || c({
28961
28961
  iframeLifecycleState: "error",
28962
- lastError: FF(e).message
28962
+ lastError: IF(e).message
28963
28963
  }, {
28964
28964
  error: e,
28965
28965
  operation: "canvas.bridge"
@@ -28996,18 +28996,18 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
28996
28996
  text: {},
28997
28997
  structuredContent: {}
28998
28998
  }
28999
- }, { hostContext: TF(a, wF(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) });
29000
29000
  r = f, v.current = f, f.oninitialized = () => {
29001
29001
  n || (c({ iframeLifecycleState: "ready" }), E.current = w.current.revision, f.sendToolInput({ arguments: w.current.arguments }).catch(u));
29002
29002
  }, f.onsizechange = ({ height: e }) => {
29003
29003
  if (!n && typeof e == "number" && Number.isFinite(e)) {
29004
- let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, oF), n) : e === t ? t : Math.min(e, lF);
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);
29005
29005
  k(r), O.current(w.current.id, r);
29006
29006
  }
29007
29007
  }, f.onmessage = async (e) => {
29008
29008
  let r = Vy(e);
29009
29009
  if (!r) {
29010
- if (nF(e)) {
29010
+ if (rF(e)) {
29011
29011
  let e = "Magic Canvas message included text without interaction metadata; no interaction row was recorded.";
29012
29012
  return c({
29013
29013
  lastInteractionPostResult: "error",
@@ -29032,7 +29032,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29032
29032
  }
29033
29033
  })();
29034
29034
  if ("error" in a) {
29035
- let e = FF(a.error).message;
29035
+ let e = IF(a.error).message;
29036
29036
  return c({
29037
29037
  lastInteractionPostResult: "error",
29038
29038
  lastError: e
@@ -29049,19 +29049,19 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29049
29049
  try {
29050
29050
  u = Wy(e, o);
29051
29051
  } catch (e) {
29052
- c({ lastError: FF(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);
29053
29053
  }
29054
29054
  let d = !0;
29055
29055
  try {
29056
- await $P(t, o.conversation_id, l.body);
29056
+ await eF(t, o.conversation_id, l.body);
29057
29057
  } catch (e) {
29058
- d = !1, eF(e) ? tF(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({
29059
29059
  lastInteractionPostResult: "failed_open",
29060
- lastError: FF(e).message
29060
+ lastError: IF(e).message
29061
29061
  }, {
29062
29062
  error: e,
29063
29063
  operation: "canvas.bridge"
29064
- }), rF(t, o.conversation_id, l.body, c));
29064
+ }), iF(t, o.conversation_id, l.body, c));
29065
29065
  }
29066
29066
  if (n) return {};
29067
29067
  if (u) try {
@@ -29072,7 +29072,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29072
29072
  properties: { text: u }
29073
29073
  });
29074
29074
  } catch (e) {
29075
- console.error("Magic Canvas respond send failed.", e), c({ lastError: FF(e).message }, {
29075
+ console.error("Magic Canvas respond send failed.", e), c({ lastError: IF(e).message }, {
29076
29076
  error: e,
29077
29077
  operation: "canvas.bridge"
29078
29078
  });
@@ -29082,18 +29082,18 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29082
29082
  lastError: void 0
29083
29083
  }), Uy(o) && (o.type === "submit" ? (s && clearTimeout(s), s = setTimeout(() => {
29084
29084
  s = null, n || D.current();
29085
- }, aF(i.arguments))) : D.current()), {};
29085
+ }, oF(i.arguments))) : D.current()), {};
29086
29086
  }, f.onupdatemodelcontext = async (e) => (i = e, o ||= setTimeout(() => {
29087
29087
  o = null, d();
29088
- }, YP), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29088
+ }, XP), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29089
29089
  if (h) return { mode: "inline" };
29090
29090
  let t = e === "fullscreen" ? "fullscreen" : "inline";
29091
29091
  return ee.current(t), T.current = {
29092
29092
  ...T.current,
29093
29093
  display_mode: t,
29094
29094
  viable_slot: t === "fullscreen" ? "full" : T.current.viable_slot
29095
- }, f.setHostContext(TF(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29096
- }, f.connect(new mF(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);
29097
29097
  };
29098
29098
  c({
29099
29099
  iframeLifecycleState: "mounting",
@@ -29115,7 +29115,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29115
29115
  a.revision !== 0 && (a.revision <= E.current || (E.current = a.revision, v.current?.sendToolInput({ arguments: a.arguments }).catch((e) => {
29116
29116
  c({
29117
29117
  iframeLifecycleState: "error",
29118
- lastError: FF(e).message
29118
+ lastError: IF(e).message
29119
29119
  }, {
29120
29120
  error: e,
29121
29121
  operation: "canvas.bridge"
@@ -29126,7 +29126,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29126
29126
  a.revision,
29127
29127
  c
29128
29128
  ]);
29129
- let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : EF(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 ?? {
29130
29130
  width: "100%",
29131
29131
  height: `${ne}px`
29132
29132
  }, se = h ? "pointer-events-auto w-full overflow-hidden" : [
@@ -29134,7 +29134,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29134
29134
  r ? "" : "shadow-xl",
29135
29135
  re ? "fixed inset-4 z-10 max-w-none" : n ? "max-w-none" : "max-w-md",
29136
29136
  s ? "scale-[0.98] opacity-40" : ""
29137
- ].filter(Boolean).join(" "), ce = fF[a.canvas_config.component] ?? dF, le = /* @__PURE__ */ L("div", {
29137
+ ].filter(Boolean).join(" "), ce = pF[a.canvas_config.component] ?? fF, le = /* @__PURE__ */ L("div", {
29138
29138
  class: se,
29139
29139
  style: A,
29140
29140
  ...h ? { "data-canvas-strip": o.viable_slot } : { "data-canvas-card": o.viable_slot },
@@ -29153,7 +29153,7 @@ function xF({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29153
29153
  children: le
29154
29154
  });
29155
29155
  }
29156
- var SF = [
29156
+ var CF = [
29157
29157
  "--color-base-100",
29158
29158
  "--color-base-200",
29159
29159
  "--color-base-300",
@@ -29163,17 +29163,17 @@ var SF = [
29163
29163
  "--color-neutral",
29164
29164
  "--color-neutral-content"
29165
29165
  ];
29166
- function CF(e) {
29166
+ function wF(e) {
29167
29167
  if (!e || typeof getComputedStyle != "function") return {};
29168
29168
  let t = getComputedStyle(e), n = {};
29169
- for (let e of SF) {
29169
+ for (let e of CF) {
29170
29170
  let r = t.getPropertyValue(e).trim();
29171
29171
  r && (n[e] = r);
29172
29172
  }
29173
29173
  return n;
29174
29174
  }
29175
- function wF(e, t) {
29176
- let n = CF(t);
29175
+ function TF(e, t) {
29176
+ let n = wF(t);
29177
29177
  return Object.keys(n).length === 0 ? e : {
29178
29178
  ...e,
29179
29179
  cssVars: {
@@ -29182,20 +29182,20 @@ function wF(e, t) {
29182
29182
  }
29183
29183
  };
29184
29184
  }
29185
- function TF(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 : NF(r), l = t.activity ? JP(t.cssVars, t.activity) : {}, u = s ? 1 : EF(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;
29187
29187
  return {
29188
29188
  ...e.canvas_config.host_context,
29189
29189
  ...o,
29190
29190
  ...l,
29191
29191
  containerDimensions: {
29192
- ...PF(o.containerDimensions) ? o.containerDimensions : {},
29192
+ ...FF(o.containerDimensions) ? o.containerDimensions : {},
29193
29193
  ...c === void 0 ? {} : { maxHeight: c },
29194
29194
  displayScale: u
29195
29195
  }
29196
29196
  };
29197
29197
  }
29198
- function EF(e, t, n = !1) {
29198
+ function DF(e, t, n = !1) {
29199
29199
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
29200
29200
  let r = Math.min(e, 720);
29201
29201
  if (n) return {
@@ -29235,11 +29235,11 @@ function EF(e, t, n = !1) {
29235
29235
  }
29236
29236
  };
29237
29237
  }
29238
- function DF() {
29239
- let e = N(null), [t, n] = j(() => kF(null));
29238
+ function OF() {
29239
+ let e = N(null), [t, n] = j(() => AF(null));
29240
29240
  return M(() => {
29241
29241
  let t = () => n((t) => {
29242
- let n = kF(e.current);
29242
+ let n = AF(e.current);
29243
29243
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
29244
29244
  });
29245
29245
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -29249,7 +29249,7 @@ function DF() {
29249
29249
  };
29250
29250
  }, []), [e, t];
29251
29251
  }
29252
- function OF() {
29252
+ function kF() {
29253
29253
  let e = N(null), [t, n] = j();
29254
29254
  return M(() => {
29255
29255
  let t = e.current;
@@ -29265,7 +29265,7 @@ function OF() {
29265
29265
  return a.observe(t), () => a.disconnect();
29266
29266
  }, []), [e, t];
29267
29267
  }
29268
- function kF(e) {
29268
+ function AF(e) {
29269
29269
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
29270
29270
  if (n && n.width > 0 && n.height > 0) {
29271
29271
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -29281,7 +29281,7 @@ function kF(e) {
29281
29281
  visualViewportHeight: t
29282
29282
  };
29283
29283
  }
29284
- function AF(e) {
29284
+ function jF(e) {
29285
29285
  let t = "absolute flex gap-2";
29286
29286
  switch (e) {
29287
29287
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;
@@ -29290,24 +29290,24 @@ function AF(e) {
29290
29290
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
29291
29291
  }
29292
29292
  }
29293
- function jF(e) {
29293
+ function MF(e) {
29294
29294
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
29295
29295
  }
29296
- function MF() {
29296
+ function NF() {
29297
29297
  return !1;
29298
29298
  }
29299
- function NF(e) {
29299
+ function PF(e) {
29300
29300
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
29301
29301
  }
29302
- function PF(e) {
29302
+ function FF(e) {
29303
29303
  return typeof e == "object" && !!e && !Array.isArray(e);
29304
29304
  }
29305
- function FF(e) {
29305
+ function IF(e) {
29306
29306
  return e instanceof Error ? e : Error(String(e));
29307
29307
  }
29308
29308
  //#endregion
29309
29309
  //#region ../core/src/magic-canvas/grid-error-boundary.tsx
29310
- var IF = class extends D {
29310
+ var LF = class extends D {
29311
29311
  state = { errored: !1 };
29312
29312
  componentDidCatch(e) {
29313
29313
  this.props.onError(e), this.setState({ errored: !0 });
@@ -29315,8 +29315,8 @@ var IF = class extends D {
29315
29315
  render() {
29316
29316
  return this.state.errored ? null : this.props.children;
29317
29317
  }
29318
- }, LF = 1e4;
29319
- function RF(e, t = LF) {
29318
+ }, RF = 1e4;
29319
+ function zF(e, t = RF) {
29320
29320
  let [n, r] = j(!1), i = N(!1);
29321
29321
  return M(() => {
29322
29322
  if (!e) {
@@ -29331,7 +29331,7 @@ function RF(e, t = LF) {
29331
29331
  }
29332
29332
  //#endregion
29333
29333
  //#region ../core/src/hooks/use-call-presence.ts
29334
- function zF(e) {
29334
+ function BF(e) {
29335
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;
29336
29336
  return P(() => ({
29337
29337
  presence: i,
@@ -29353,7 +29353,7 @@ function zF(e) {
29353
29353
  }
29354
29354
  //#endregion
29355
29355
  //#region ../core/src/hooks/use-call-controls-visible.ts
29356
- function BF(e, t, n) {
29356
+ function VF(e, t, n) {
29357
29357
  let [r, i] = j(!0);
29358
29358
  return M(() => {
29359
29359
  if (!t) return;
@@ -29383,7 +29383,7 @@ function BF(e, t, n) {
29383
29383
  }
29384
29384
  //#endregion
29385
29385
  //#region ../core/src/hooks/use-call-controls-rect.ts
29386
- function VF(e, t, n, r, i) {
29386
+ function HF(e, t, n, r, i) {
29387
29387
  let [a, o] = j(void 0);
29388
29388
  return M(() => {
29389
29389
  if (!r) return;
@@ -29417,8 +29417,8 @@ function VF(e, t, n, r, i) {
29417
29417
  }
29418
29418
  //#endregion
29419
29419
  //#region ../core/src/hooks/use-replica-join-timeout.ts
29420
- var HF = 1e4;
29421
- function UF({ onTimeout: e, timeoutMs: t = HF, active: n = !0 }) {
29420
+ var UF = 1e4;
29421
+ function WF({ onTimeout: e, timeoutMs: t = UF, active: n = !0 }) {
29422
29422
  let r = $v().length > 0, [i, a] = j(!1), o = N(e);
29423
29423
  return M(() => {
29424
29424
  o.current = e;
@@ -29442,39 +29442,39 @@ function UF({ onTimeout: e, timeoutMs: t = HF, active: n = !0 }) {
29442
29442
  }
29443
29443
  //#endregion
29444
29444
  //#region ../core/src/hooks/use-system-shutdown.ts
29445
- function WF(e) {
29445
+ function GF(e) {
29446
29446
  if (typeof e != "object" || !e) return !1;
29447
29447
  let t = e;
29448
29448
  return t.message_type === "system" && t.event_type === "system.shutdown";
29449
29449
  }
29450
- function GF({ onShutdown: e }) {
29450
+ function KF({ onShutdown: e }) {
29451
29451
  let t = N(e);
29452
29452
  M(() => {
29453
29453
  t.current = e;
29454
29454
  }, [e]), jf({ onAppMessage: F((e) => {
29455
- WF(e?.data) && t.current();
29455
+ GF(e?.data) && t.current();
29456
29456
  }, []) });
29457
29457
  }
29458
29458
  //#endregion
29459
29459
  //#region ../core/src/hooks/use-picture-in-picture.ts
29460
- var KF = tn("PiP"), qF = 360, JF = 280;
29461
- function YF() {
29460
+ var qF = tn("PiP"), JF = 360, YF = 280;
29461
+ function XF() {
29462
29462
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
29463
29463
  }
29464
- function XF(e) {
29465
- let { enabled: t, active: n } = e, [r, i] = j(null), a = YF(), 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(() => {
29466
29466
  i((e) => (e && !e.closed && e.close(), null));
29467
29467
  }, []), c = F(async () => {
29468
29468
  if (a && t && n && (!r || r.closed)) try {
29469
29469
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
29470
- width: qF,
29471
- height: JF
29470
+ width: JF,
29471
+ height: YF
29472
29472
  }), t = Pe.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
29473
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", () => {
29474
29474
  i((t) => t === e ? null : t);
29475
29475
  }, { once: !0 }), i(e);
29476
29476
  } catch (e) {
29477
- KF.warn("Failed to open PiP window", e);
29477
+ qF.warn("Failed to open PiP window", e);
29478
29478
  }
29479
29479
  }, [
29480
29480
  a,
@@ -29495,13 +29495,13 @@ function XF(e) {
29495
29495
  try {
29496
29496
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
29497
29497
  } catch (e) {
29498
- KF.warn("mediaSession metadata setup failed", e);
29498
+ qF.warn("mediaSession metadata setup failed", e);
29499
29499
  }
29500
29500
  let t = (t, n) => {
29501
29501
  try {
29502
29502
  e.setActionHandler(t, n), r.push(t);
29503
29503
  } catch (e) {
29504
- KF.info(`mediaSession.${t} not supported`, e);
29504
+ qF.info(`mediaSession.${t} not supported`, e);
29505
29505
  }
29506
29506
  };
29507
29507
  t("enterpictureinpicture", () => {
@@ -29555,11 +29555,11 @@ function XF(e) {
29555
29555
  }
29556
29556
  //#endregion
29557
29557
  //#region ../core/src/utils/device-preferences.ts
29558
- var ZF = Dt(null), QF = {
29558
+ var QF = Dt(null), $F = {
29559
29559
  active: !1,
29560
29560
  video_shift_x: 0,
29561
29561
  backdrop: { type: "snapshot_mirror" }
29562
- }, $F = Hf(({ id: e, showAudioWave: t = !0 }) => {
29562
+ }, eI = Hf(({ id: e, showAudioWave: t = !0 }) => {
29563
29563
  let n = Pf(e).isOff;
29564
29564
  return /* @__PURE__ */ L("div", {
29565
29565
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -29574,16 +29574,16 @@ var ZF = Dt(null), QF = {
29574
29574
  children: /* @__PURE__ */ L(Kv, { id: e })
29575
29575
  })]
29576
29576
  });
29577
- }), eI = Hf(() => {
29577
+ }), tI = Hf(() => {
29578
29578
  let e = Of(), { isScreenSharing: t } = av(), n = $v()[0];
29579
- return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L($F, { id: n }), e && /* @__PURE__ */ L($F, {
29579
+ return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(eI, { id: n }), e && /* @__PURE__ */ L(eI, {
29580
29580
  id: e,
29581
29581
  showAudioWave: !1
29582
29582
  })] });
29583
- }), tI = Hf(() => /* @__PURE__ */ L("div", {
29583
+ }), nI = Hf(() => /* @__PURE__ */ L("div", {
29584
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",
29585
- children: /* @__PURE__ */ L(eI, {})
29586
- })), nI = 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: [
29587
29587
  /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-base-200" }),
29588
29588
  i.content && /* @__PURE__ */ L("div", {
29589
29589
  class: "absolute overflow-hidden rounded-box bg-black",
@@ -29605,7 +29605,7 @@ var ZF = Dt(null), QF = {
29605
29605
  avatarOff: r
29606
29606
  })
29607
29607
  })
29608
- ] })), rI = Hf(() => {
29608
+ ] })), iI = Hf(() => {
29609
29609
  let { effect: e, animate: t } = CP.value, n = Of();
29610
29610
  return n === null || e.selfView === null ? null : /* @__PURE__ */ L("div", {
29611
29611
  class: "absolute z-20 overflow-hidden rounded-box bg-black/30",
@@ -29618,23 +29618,23 @@ var ZF = Dt(null), QF = {
29618
29618
  className: "h-full w-full object-cover"
29619
29619
  })
29620
29620
  });
29621
- }), iI = Hf(({ canvasRenderedSlot: e }) => {
29621
+ }), aI = Hf(({ canvasRenderedSlot: e }) => {
29622
29622
  let t = LM(CP.value.effect);
29623
- return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(IF, {
29623
+ return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(LF, {
29624
29624
  onError: kM,
29625
- children: /* @__PURE__ */ L(rI, {})
29626
- }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(tI, {});
29627
- }), aI = Hf(() => {
29625
+ children: /* @__PURE__ */ L(iI, {})
29626
+ }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(nI, {});
29627
+ }), oI = Hf(() => {
29628
29628
  let e = $v()[0];
29629
29629
  return e ? /* @__PURE__ */ L(nv, { sessionId: e }) : null;
29630
- }), oI = Hf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(aI, {}), /* @__PURE__ */ L(sI, { ...e })] })), sI = 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 }) => {
29631
29631
  let { presence: i, localId: a, isScreenSharing: o, isPersonaPresenting: s } = t, c = CP.value, l = n.active && !o && (!e || s);
29632
29632
  return i.phase === "left" ? /* @__PURE__ */ L(Wv, {}) : i.phase === "connecting" ? /* @__PURE__ */ L(Uv, {}) : e && !s ? /* @__PURE__ */ L("div", {
29633
29633
  class: "absolute inset-0 flex items-center justify-center",
29634
29634
  children: /* @__PURE__ */ L(Xv, { sessionId: i.replicaId })
29635
- }) : c.effect.driving ? /* @__PURE__ */ L(IF, {
29635
+ }) : c.effect.driving ? /* @__PURE__ */ L(LF, {
29636
29636
  onError: kM,
29637
- children: /* @__PURE__ */ L(nI, {
29637
+ children: /* @__PURE__ */ L(rI, {
29638
29638
  personaSessionId: i.replicaId,
29639
29639
  localId: a,
29640
29640
  isScreenSharing: o,
@@ -29648,7 +29648,7 @@ var ZF = Dt(null), QF = {
29648
29648
  avatarOff: i.videoState.isOff,
29649
29649
  canvasLayoutEffect: n,
29650
29650
  smartSidecarActive: l
29651
- }) : /* @__PURE__ */ L(cI, {
29651
+ }) : /* @__PURE__ */ L(lI, {
29652
29652
  personaSessionId: i.replicaId,
29653
29653
  localId: a,
29654
29654
  isScreenSharing: o,
@@ -29657,11 +29657,11 @@ var ZF = Dt(null), QF = {
29657
29657
  canvasLayoutEffect: n,
29658
29658
  canvasRenderedSlot: r
29659
29659
  });
29660
- }), cI = 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, {
29661
29661
  canvasLayoutEffect: a,
29662
29662
  smartSidecarActive: i,
29663
29663
  isScreenSharing: n,
29664
- captureSnapshot: fI,
29664
+ captureSnapshot: pI,
29665
29665
  personaMode: "auto",
29666
29666
  renderedSlot: o,
29667
29667
  fill: (i) => /* @__PURE__ */ L(iy, {
@@ -29671,7 +29671,7 @@ var ZF = Dt(null), QF = {
29671
29671
  avatarOff: r,
29672
29672
  videoRef: i
29673
29673
  })
29674
- })), lI = Hf(({ items: e }) => {
29674
+ })), uI = Hf(({ items: e }) => {
29675
29675
  let [t, n] = j(!1), r = N(null);
29676
29676
  return M(() => {
29677
29677
  if (!t) return;
@@ -29701,8 +29701,8 @@ var ZF = Dt(null), QF = {
29701
29701
  children: e
29702
29702
  })]
29703
29703
  });
29704
- }), uI = Hf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L(lI, { items: e })), dI = 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(QF), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = RF(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = BF(x, CM(y.magic_grid, w), C), E = VF(x, S, 72, !0, C), D = y.modality === "audio", ee = zF(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 } = XF({
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({
29706
29706
  enabled: re && !O,
29707
29707
  active: t === "joined-meeting"
29708
29708
  });
@@ -29711,13 +29711,13 @@ var ZF = Dt(null), QF = {
29711
29711
  }, [i]);
29712
29712
  let { camera: ae, requestCamera: A } = dh(), { isCamMuted: oe } = rv(), se = ae.isGranted && !oe;
29713
29713
  M(() => {
29714
- te && t === "joined-meeting" && (ZF.value = se);
29714
+ te && t === "joined-meeting" && (QF.value = se);
29715
29715
  }, [
29716
29716
  te,
29717
29717
  t,
29718
29718
  se
29719
29719
  ]);
29720
- let ce = N(te && !a && ZF.value === !0);
29720
+ let ce = N(te && !a && QF.value === !0);
29721
29721
  M(() => {
29722
29722
  t === "joined-meeting" && ce.current && (ce.current = !1, A());
29723
29723
  }, [t, A]), M(() => {
@@ -29741,10 +29741,10 @@ var ZF = Dt(null), QF = {
29741
29741
  let ue = F(() => {
29742
29742
  i();
29743
29743
  }, [i]);
29744
- if (UF({
29744
+ if (WF({
29745
29745
  active: !O && t === "joined-meeting",
29746
29746
  onTimeout: ue
29747
- }), GF({ onShutdown: ue }), !C) return null;
29747
+ }), KF({ onShutdown: ue }), !C) return null;
29748
29748
  if (O) return /* @__PURE__ */ L(Lv, {
29749
29749
  defaultOpen: !0,
29750
29750
  children: /* @__PURE__ */ L("div", {
@@ -29776,14 +29776,14 @@ var ZF = Dt(null), QF = {
29776
29776
  /* @__PURE__ */ L("div", {
29777
29777
  class: "relative w-full h-full z-[5]",
29778
29778
  children: [
29779
- /* @__PURE__ */ L(oI, {
29779
+ /* @__PURE__ */ L(sI, {
29780
29780
  isAudioOnly: D,
29781
29781
  presence: ee,
29782
29782
  canvasLayoutEffect: p,
29783
29783
  canvasRenderedSlot: h
29784
29784
  }),
29785
- !D && /* @__PURE__ */ L(iI, { canvasRenderedSlot: h }),
29786
- /* @__PURE__ */ L(gF, {
29785
+ !D && /* @__PURE__ */ L(aI, { canvasRenderedSlot: h }),
29786
+ /* @__PURE__ */ L(_F, {
29787
29787
  debugEnabled: d,
29788
29788
  callPresence: ee,
29789
29789
  callControlsVisible: T,
@@ -29821,7 +29821,7 @@ var ZF = Dt(null), QF = {
29821
29821
  /* @__PURE__ */ L(wv, { level: !0 }),
29822
29822
  !D && /* @__PURE__ */ L(Ev, {}),
29823
29823
  k && /* @__PURE__ */ L(Pv, {}),
29824
- /* @__PURE__ */ L(uI, { items: de }),
29824
+ /* @__PURE__ */ L(dI, { items: de }),
29825
29825
  /* @__PURE__ */ L("button", {
29826
29826
  type: "button",
29827
29827
  class: "btn btn-control btn-error",
@@ -29838,7 +29838,7 @@ var ZF = Dt(null), QF = {
29838
29838
  ]
29839
29839
  }), ie && np(/* @__PURE__ */ L(ny, { onLeave: ue }), ie.document.body)] }) }) });
29840
29840
  });
29841
- function fI(e) {
29841
+ function pI(e) {
29842
29842
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
29843
29843
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
29844
29844
  t.width = 640, t.height = n;
@@ -29853,7 +29853,7 @@ function fI(e) {
29853
29853
  }
29854
29854
  //#endregion
29855
29855
  //#region ../core/src/components/hair-check/index.tsx
29856
- function pI(e, t, n) {
29856
+ function mI(e, t, n) {
29857
29857
  switch (t) {
29858
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.";
29859
29859
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -29864,7 +29864,7 @@ function pI(e, t, n) {
29864
29864
  default: return e?.loading ?? "Getting your microphone ready...";
29865
29865
  }
29866
29866
  }
29867
- var mI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29867
+ var hI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29868
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);
29869
29869
  M(() => {
29870
29870
  d();
@@ -29880,7 +29880,7 @@ var mI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29880
29880
  u.isBlocked,
29881
29881
  f
29882
29882
  ]);
29883
- let v = p && g && !u.isGranted, y = pI(e, l.status, v);
29883
+ let v = p && g && !u.isGranted, y = mI(e, l.status, v);
29884
29884
  return /* @__PURE__ */ L(fv, { children: /* @__PURE__ */ L("div", {
29885
29885
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
29886
29886
  children: [u.isGranted && !c ? /* @__PURE__ */ L("div", {
@@ -29931,8 +29931,8 @@ var mI = Hf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
29931
29931
  })]
29932
29932
  })]
29933
29933
  }) });
29934
- }), hI = "Password required", gI = "Enter the password to start this conversation.", _I = "Password", vI = "Continue";
29935
- function yI({ 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 }) {
29936
29936
  let [i, a] = j(""), o = Ze();
29937
29937
  return /* @__PURE__ */ L("div", {
29938
29938
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -29952,18 +29952,18 @@ function yI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29952
29952
  /* @__PURE__ */ L("h3", {
29953
29953
  id: `${o}-title`,
29954
29954
  class: "card-title text-base-content",
29955
- children: t?.title ?? hI
29955
+ children: t?.title ?? gI
29956
29956
  }),
29957
29957
  /* @__PURE__ */ L("p", {
29958
29958
  class: "text-sm text-base-content/70",
29959
- children: t?.description ?? gI
29959
+ children: t?.description ?? _I
29960
29960
  }),
29961
29961
  /* @__PURE__ */ L("input", {
29962
29962
  id: o,
29963
29963
  type: "password",
29964
29964
  autocomplete: "current-password",
29965
29965
  class: "input input-bordered w-full",
29966
- placeholder: t?.placeholder ?? _I,
29966
+ placeholder: t?.placeholder ?? vI,
29967
29967
  value: i,
29968
29968
  disabled: n,
29969
29969
  onInput: (e) => a(e.target.value),
@@ -29979,7 +29979,7 @@ function yI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29979
29979
  type: "submit",
29980
29980
  disabled: !i.trim(),
29981
29981
  loading: n,
29982
- children: t?.submit ?? vI
29982
+ children: t?.submit ?? yI
29983
29983
  })
29984
29984
  ]
29985
29985
  })
@@ -29988,7 +29988,7 @@ function yI({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
29988
29988
  }
29989
29989
  //#endregion
29990
29990
  //#region ../core/src/components/welcome/index.tsx
29991
- function bI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
29991
+ function xI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
29992
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), [
29993
29993
  p,
29994
29994
  a,
@@ -29997,7 +29997,7 @@ function bI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
29997
29997
  return /* @__PURE__ */ L(G_, {
29998
29998
  title: c.title,
29999
29999
  description: c.description,
30000
- overlay: v && s ? /* @__PURE__ */ L(yI, { onSubmit: s.setPassword }) : null,
30000
+ overlay: v && s ? /* @__PURE__ */ L(bI, { onSubmit: s.setPassword }) : null,
30001
30001
  children: [/* @__PURE__ */ L("div", {
30002
30002
  class: "relative",
30003
30003
  children: [r && /* @__PURE__ */ L(P_, {
@@ -30035,28 +30035,28 @@ function bI({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30035
30035
  }
30036
30036
  //#endregion
30037
30037
  //#region ../core/src/hooks/use-haircheck-text.ts
30038
- function xI(...e) {
30038
+ function SI(...e) {
30039
30039
  for (let t of e) {
30040
30040
  let e = t?.trim();
30041
30041
  if (e) return e;
30042
30042
  }
30043
30043
  }
30044
- function SI() {
30044
+ function CI() {
30045
30045
  let { config: e } = Zm(), { haircheck: t } = e.value.customization;
30046
30046
  return P(() => ({
30047
- prompt: xI(t.permission_request_description, t.permission_request_title),
30048
- ready: xI(t.permission_granted_description, t.permission_granted_title),
30049
- denied: xI(t.permission_denied_description, t.permission_denied_title),
30050
- join: xI(t.join_button),
30051
- cancel: xI(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)
30052
30052
  }), [t]);
30053
30053
  }
30054
30054
  //#endregion
30055
30055
  //#region ../core/src/shells/flow-state-body.tsx
30056
- function CI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30057
- let r = SI();
30056
+ function wI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30057
+ let r = CI();
30058
30058
  switch (e.state) {
30059
- case "idle": return /* @__PURE__ */ L(bI, {
30059
+ case "idle": return /* @__PURE__ */ L(xI, {
30060
30060
  text: t,
30061
30061
  onStart: () => {
30062
30062
  e.start();
@@ -30064,7 +30064,7 @@ function CI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30064
30064
  isStarting: e.isStarting,
30065
30065
  permissionRequest: e.permissionRequest
30066
30066
  });
30067
- case "haircheck": return /* @__PURE__ */ L(mI, {
30067
+ case "haircheck": return /* @__PURE__ */ L(hI, {
30068
30068
  text: r,
30069
30069
  onJoin: () => {
30070
30070
  e.join();
@@ -30072,7 +30072,7 @@ function CI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30072
30072
  onCancel: () => e.cancel(),
30073
30073
  isJoining: e.isStarting
30074
30074
  });
30075
- case "call": return /* @__PURE__ */ L(dI, { onLeave: () => e.leave() });
30075
+ case "call": return /* @__PURE__ */ L(fI, { onLeave: () => e.leave() });
30076
30076
  case "ended": return /* @__PURE__ */ L($_, {
30077
30077
  isStarting: e.isStarting,
30078
30078
  permissionRequest: e.permissionRequest,
@@ -30097,7 +30097,7 @@ function CI({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30097
30097
  }
30098
30098
  //#endregion
30099
30099
  //#region ../core/src/providers/widget-ui-provider.tsx
30100
- function wI({ children: e }) {
30100
+ function TI({ children: e }) {
30101
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);
30102
30102
  en(() => {
30103
30103
  let e = t.value.customization?.widget, n = e?.expandable ?? "default";
@@ -30147,14 +30147,14 @@ function wI({ children: e }) {
30147
30147
  }
30148
30148
  //#endregion
30149
30149
  //#region ../core/src/components/powered-by/index.tsx
30150
- function TI() {
30150
+ function EI() {
30151
30151
  let { config: e } = Zm(), t = e.value.customization.branding;
30152
- return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ L(EI, {}) : t?.logo || t?.text ? /* @__PURE__ */ L(DI, {
30152
+ return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ L(DI, {}) : t?.logo || t?.text ? /* @__PURE__ */ L(OI, {
30153
30153
  logo: t.logo,
30154
30154
  text: t.text
30155
30155
  }) : null;
30156
30156
  }
30157
- function EI() {
30157
+ function DI() {
30158
30158
  let { isDark: e } = vj(), t = e.value ? "white" : "#140206";
30159
30159
  return /* @__PURE__ */ L("a", {
30160
30160
  href: "https://tavus.io",
@@ -30181,7 +30181,7 @@ function EI() {
30181
30181
  })] })]
30182
30182
  });
30183
30183
  }
30184
- function DI({ logo: e, text: t }) {
30184
+ function OI({ logo: e, text: t }) {
30185
30185
  return /* @__PURE__ */ L("div", {
30186
30186
  class: "inline-flex items-center gap-1 text-xs text-base-content/50",
30187
30187
  children: [e ? /* @__PURE__ */ L("img", {
@@ -30193,63 +30193,63 @@ function DI({ logo: e, text: t }) {
30193
30193
  }
30194
30194
  //#endregion
30195
30195
  //#region ../core/src/hooks/use-widget-text.ts
30196
- var OI = {
30196
+ var kI = {
30197
30197
  title: "Hi! Want to chat?",
30198
30198
  btn_title: "Start conversation"
30199
30199
  };
30200
- function kI() {
30200
+ function AI() {
30201
30201
  let { config: e } = Zm(), t = e.value.customization.widget?.text;
30202
30202
  return P(() => ({
30203
- title: t?.title || OI.title,
30204
- btn_title: t?.btn_title || OI.btn_title
30203
+ title: t?.title || kI.title,
30204
+ btn_title: t?.btn_title || kI.btn_title
30205
30205
  }), [t]);
30206
30206
  }
30207
30207
  //#endregion
30208
30208
  //#region ../core/src/hooks/use-widget-ui.ts
30209
- function AI() {
30209
+ function jI() {
30210
30210
  let e = I(bh);
30211
30211
  if (!e) throw Error("useWidgetUI must be used within WidgetUIProvider");
30212
30212
  return e;
30213
30213
  }
30214
30214
  //#endregion
30215
30215
  //#region ../core/src/components/widget-launcher/widget-avatar.tsx
30216
- var jI = {
30216
+ var MI = {
30217
30217
  xs: "w-6 h-6",
30218
30218
  sm: "w-8 h-8",
30219
30219
  md: "w-10 h-10",
30220
30220
  lg: "w-16 h-16"
30221
- }, MI = {
30221
+ }, NI = {
30222
30222
  xs: "w-3 h-3",
30223
30223
  sm: "w-4 h-4",
30224
30224
  md: "w-5 h-5",
30225
30225
  lg: "w-8 h-8"
30226
30226
  };
30227
- function NI({ size: e = "md", className: t = "" }) {
30228
- let { avatarType: n } = AI(), { 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);
30229
30229
  return (s_(r.value).background.type === "replica" || n.value === "image") && i ? /* @__PURE__ */ L("div", {
30230
- class: `relative ${jI[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
30230
+ class: `relative ${MI[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
30231
30231
  children: /* @__PURE__ */ L(m_, { replica: i })
30232
30232
  }) : /* @__PURE__ */ L("div", {
30233
- class: `relative ${jI[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
30234
- children: /* @__PURE__ */ L("span", { class: `${MI[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` })
30235
30235
  });
30236
30236
  }
30237
30237
  //#endregion
30238
30238
  //#region ../core/src/components/widget-launcher/widget-launcher.tsx
30239
- function PI({ variant: e }) {
30240
- let { toggle: t } = AI(), n = kI();
30239
+ function FI({ variant: e }) {
30240
+ let { toggle: t } = jI(), n = AI();
30241
30241
  return e === "tiny" ? /* @__PURE__ */ L("button", {
30242
30242
  type: "button",
30243
30243
  onClick: t,
30244
30244
  "aria-label": n.btn_title,
30245
30245
  class: "rounded-box overflow-hidden shadow-xl hover:shadow-2xl transition-shadow cursor-pointer",
30246
- children: /* @__PURE__ */ L(NI, { size: "lg" })
30246
+ children: /* @__PURE__ */ L(PI, { size: "lg" })
30247
30247
  }) : e === "compact" ? /* @__PURE__ */ L("button", {
30248
30248
  type: "button",
30249
30249
  onClick: t,
30250
30250
  "aria-label": n.btn_title,
30251
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",
30252
- children: [/* @__PURE__ */ L(NI, { size: "md" }), /* @__PURE__ */ L("span", {
30252
+ children: [/* @__PURE__ */ L(PI, { size: "md" }), /* @__PURE__ */ L("span", {
30253
30253
  class: "flex flex-col gap-0.5",
30254
30254
  children: [/* @__PURE__ */ L("span", {
30255
30255
  class: "text-base font-medium leading-tight",
@@ -30266,7 +30266,7 @@ function PI({ variant: e }) {
30266
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",
30267
30267
  children: [/* @__PURE__ */ L("div", {
30268
30268
  class: "flex items-center gap-2.5",
30269
- children: [/* @__PURE__ */ L(NI, { size: "md" }), /* @__PURE__ */ L("span", {
30269
+ children: [/* @__PURE__ */ L(PI, { size: "md" }), /* @__PURE__ */ L("span", {
30270
30270
  class: "text-sm font-medium leading-snug",
30271
30271
  children: n.title
30272
30272
  })]
@@ -30284,13 +30284,13 @@ function PI({ variant: e }) {
30284
30284
  }
30285
30285
  //#endregion
30286
30286
  //#region ../core/src/components/widget-launcher/widget-greeting-bubble.tsx
30287
- var FI = "tavus:widget:greeting-dismissed";
30288
- function II({ anchor: e }) {
30289
- let t = kI(), { variant: n, expand: r } = AI(), [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);
30290
30290
  M(() => {
30291
30291
  if (n.value === "tiny") {
30292
30292
  try {
30293
- if (sessionStorage.getItem(FI) === "1") return;
30293
+ if (sessionStorage.getItem(II) === "1") return;
30294
30294
  } catch {}
30295
30295
  a(!0);
30296
30296
  }
@@ -30298,7 +30298,7 @@ function II({ anchor: e }) {
30298
30298
  let o = F((e) => {
30299
30299
  e.stopPropagation();
30300
30300
  try {
30301
- sessionStorage.setItem(FI, "1");
30301
+ sessionStorage.setItem(II, "1");
30302
30302
  } catch {}
30303
30303
  a(!1);
30304
30304
  }, []);
@@ -30330,18 +30330,18 @@ function II({ anchor: e }) {
30330
30330
  }
30331
30331
  //#endregion
30332
30332
  //#region ../core/src/hooks/use-host-bridge.ts
30333
- function LI() {
30333
+ function RI() {
30334
30334
  let e = I(Sh);
30335
30335
  if (!e) throw Error("useHostBridge must be used within HostBridgeProvider");
30336
30336
  return e;
30337
30337
  }
30338
30338
  //#endregion
30339
30339
  //#region ../core/src/shells/widget/widget-popup.tsx
30340
- var RI = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", zI = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", BI = "p-1 flex-1 min-h-0", VI = "p-1 flex-1 min-h-0";
30341
- function HI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30342
- let { expandable: i } = AI(), 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";
30343
30343
  return r ? /* @__PURE__ */ L("div", {
30344
- class: zI,
30344
+ class: BI,
30345
30345
  children: [
30346
30346
  /* @__PURE__ */ L("div", {
30347
30347
  class: "flex items-center justify-end gap-2 px-2.5 py-1.5 border-b border-base-300",
@@ -30357,18 +30357,18 @@ function HI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30357
30357
  })
30358
30358
  }),
30359
30359
  /* @__PURE__ */ L("div", {
30360
- class: VI,
30360
+ class: HI,
30361
30361
  children: t
30362
30362
  }),
30363
30363
  /* @__PURE__ */ L("div", {
30364
30364
  class: "flex justify-end px-2.5",
30365
- children: /* @__PURE__ */ L(TI, {})
30365
+ children: /* @__PURE__ */ L(EI, {})
30366
30366
  })
30367
30367
  ]
30368
30368
  }) : /* @__PURE__ */ L("div", {
30369
30369
  class: "flex flex-col h-[min(34rem,calc(100dvh-3rem))]",
30370
30370
  children: [/* @__PURE__ */ L("div", {
30371
- class: `${RI} flex-1 overflow-hidden`,
30371
+ class: `${zI} flex-1 overflow-hidden`,
30372
30372
  children: [/* @__PURE__ */ L("div", {
30373
30373
  class: "flex items-center justify-end gap-2 px-2.5 pt-1.5 shrink-0",
30374
30374
  children: a && /* @__PURE__ */ L("button", {
@@ -30382,77 +30382,77 @@ function HI({ variant: e, children: t, onClose: n, fullscreen: r }) {
30382
30382
  })
30383
30383
  })
30384
30384
  }), /* @__PURE__ */ L("div", {
30385
- class: BI,
30385
+ class: VI,
30386
30386
  children: t
30387
30387
  })]
30388
30388
  }), /* @__PURE__ */ L("div", {
30389
30389
  class: "flex justify-end pr-2 pt-1.5 shrink-0",
30390
- children: /* @__PURE__ */ L(TI, {})
30390
+ children: /* @__PURE__ */ L(EI, {})
30391
30391
  })]
30392
30392
  });
30393
30393
  }
30394
30394
  //#endregion
30395
30395
  //#region ../core/src/shells/widget/widget-shell.tsx
30396
- var UI = tn("Widget"), WI = "1rem", GI = 480;
30397
- function KI(e, t, n) {
30396
+ var WI = tn("Widget"), GI = "1rem", KI = 480;
30397
+ function qI(e, t, n) {
30398
30398
  let r = e.state === "call", i = r || e.state === "haircheck" || e.isStarting;
30399
30399
  e.cancel(), r && e.leave(), i && t(), n();
30400
30400
  }
30401
- function qI() {
30402
- return typeof window > "u" ? !1 : window.innerWidth <= GI;
30401
+ function JI() {
30402
+ return typeof window > "u" ? !1 : window.innerWidth <= KI;
30403
30403
  }
30404
- function JI(e) {
30404
+ function YI(e) {
30405
30405
  switch (e) {
30406
30406
  case "bottom-right": return {
30407
- bottom: WI,
30408
- right: WI
30407
+ bottom: GI,
30408
+ right: GI
30409
30409
  };
30410
30410
  case "bottom-left": return {
30411
- bottom: WI,
30412
- left: WI
30411
+ bottom: GI,
30412
+ left: GI
30413
30413
  };
30414
30414
  case "top-right": return {
30415
- top: WI,
30416
- right: WI
30415
+ top: GI,
30416
+ right: GI
30417
30417
  };
30418
30418
  case "top-left": return {
30419
- top: WI,
30420
- left: WI
30419
+ top: GI,
30420
+ left: GI
30421
30421
  };
30422
30422
  case "top": return {
30423
- top: WI,
30423
+ top: GI,
30424
30424
  left: "50%",
30425
30425
  transform: "translateX(-50%)"
30426
30426
  };
30427
30427
  case "bottom": return {
30428
- bottom: WI,
30428
+ bottom: GI,
30429
30429
  left: "50%",
30430
30430
  transform: "translateX(-50%)"
30431
30431
  };
30432
30432
  }
30433
30433
  }
30434
- var YI = [
30434
+ var XI = [
30435
30435
  "top",
30436
30436
  "bottom",
30437
30437
  "left",
30438
30438
  "right",
30439
30439
  "transform"
30440
30440
  ];
30441
- function XI(e) {
30441
+ function ZI(e) {
30442
30442
  return e === "bottom-left" || e === "top-left" ? "left" : "right";
30443
30443
  }
30444
- function ZI() {
30445
- let { config: e, initError: t } = Zm(), n = kI(), { expanded: r, position: i, variant: a, collapse: o } = AI(), { end: s } = Av(), { shadowHost: c } = LI(), l = j_(), u = qt(qI());
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());
30446
30446
  M(() => {
30447
30447
  if (typeof window > "u") return;
30448
- u.value = qI();
30448
+ u.value = JI();
30449
30449
  let e = () => {
30450
- u.value = qI();
30450
+ u.value = JI();
30451
30451
  };
30452
30452
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
30453
30453
  }, [u]);
30454
30454
  let d = P(() => ({ fallback_button: n.btn_title }), [n.btn_title]), f = F(() => {
30455
- KI(l, s, o);
30455
+ qI(l, s, o);
30456
30456
  }, [
30457
30457
  l,
30458
30458
  s,
@@ -30463,27 +30463,27 @@ function ZI() {
30463
30463
  if (e) {
30464
30464
  if (a) e.style.top = "0", e.style.right = "0", e.style.bottom = "0", e.style.left = "0", e.style.transform = "";
30465
30465
  else {
30466
- let n = JI(t);
30467
- for (let t of YI) e.style[t] = n[t] ?? "";
30466
+ let n = YI(t);
30467
+ for (let t of XI) e.style[t] = n[t] ?? "";
30468
30468
  }
30469
30469
  e.dataset.tavusWidgetPosition = t, e.dataset.tavusWidgetExpanded = n ? "true" : "false", e.dataset.tavusWidgetFullscreen = a ? "true" : "false", e.dataset.tavusWidgetSmall = u.value ? "true" : "false";
30470
30470
  }
30471
- }), t.value) return UI.error("Widget cannot initialize (init request failed):", t.value), null;
30472
- if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return UI.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;
30473
30473
  if (!r.value) {
30474
- let e = XI(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";
30475
30475
  return /* @__PURE__ */ L("div", {
30476
30476
  class: "flex flex-col",
30477
30477
  children: [/* @__PURE__ */ L("div", {
30478
30478
  class: t,
30479
- children: [/* @__PURE__ */ L(II, { anchor: e }), /* @__PURE__ */ L(PI, { variant: a.value })]
30479
+ children: [/* @__PURE__ */ L(LI, { anchor: e }), /* @__PURE__ */ L(FI, { variant: a.value })]
30480
30480
  }), /* @__PURE__ */ L("div", {
30481
30481
  class: `flex ${n} pt-1.5`,
30482
- children: /* @__PURE__ */ L(TI, {})
30482
+ children: /* @__PURE__ */ L(EI, {})
30483
30483
  })]
30484
30484
  });
30485
30485
  }
30486
- return e.value.is_available === !1 ? /* @__PURE__ */ L(HI, {
30486
+ return e.value.is_available === !1 ? /* @__PURE__ */ L(UI, {
30487
30487
  variant: a.value,
30488
30488
  fullscreen: u.value,
30489
30489
  onClose: f,
@@ -30492,11 +30492,11 @@ function ZI() {
30492
30492
  canRetry: !1,
30493
30493
  onRetry: () => {}
30494
30494
  }) })
30495
- }) : /* @__PURE__ */ L(HI, {
30495
+ }) : /* @__PURE__ */ L(UI, {
30496
30496
  variant: a.value,
30497
30497
  fullscreen: u.value,
30498
30498
  onClose: f,
30499
- children: /* @__PURE__ */ L(Bh, { children: /* @__PURE__ */ L(CI, {
30499
+ children: /* @__PURE__ */ L(Bh, { children: /* @__PURE__ */ L(wI, {
30500
30500
  flow: l,
30501
30501
  welcomeText: d,
30502
30502
  onUnavailableCancel: () => l.restart()
@@ -30505,11 +30505,11 @@ function ZI() {
30505
30505
  }
30506
30506
  //#endregion
30507
30507
  //#region ../core/src/widget/tavus-widget.tsx
30508
- var QI = ":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 $I(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) {
30510
30510
  return /* @__PURE__ */ L(E, { children: [
30511
30511
  /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: Pe } }),
30512
- /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: QI } }),
30512
+ /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: $I } }),
30513
30513
  /* @__PURE__ */ L(lt, {
30514
30514
  surface: "widget",
30515
30515
  "camera-on-start": e["camera-on-start"],
@@ -30520,13 +30520,13 @@ function $I(e) {
30520
30520
  "memory-stores": e["memory-stores"],
30521
30521
  "base-url": e["base-url"],
30522
30522
  token: e.token,
30523
- children: /* @__PURE__ */ L(_r, { children: /* @__PURE__ */ L(yr, { children: /* @__PURE__ */ L(Om, { children: /* @__PURE__ */ L(Xm, { children: /* @__PURE__ */ L(yh, { children: /* @__PURE__ */ L(wI, { children: /* @__PURE__ */ L(wh, { children: /* @__PURE__ */ L(Eh, { children: /* @__PURE__ */ L(ZI, {}) }) }) }) }) }) }) }) })
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, {}) }) }) }) }) }) }) }) })
30524
30524
  })
30525
30525
  ] });
30526
30526
  }
30527
- var eL;
30528
- function tL() {
30529
- eL ||= Ee($I, "tavus-widget", [
30527
+ var tL;
30528
+ function nL() {
30529
+ tL ||= Ee(eL, "tavus-widget", [
30530
30530
  "camera-on-start",
30531
30531
  "deployment-id",
30532
30532
  "override-config",
@@ -30542,7 +30542,7 @@ function tL() {
30542
30542
  }
30543
30543
  //#endregion
30544
30544
  //#region src/integration.ts
30545
- var nL = [
30545
+ var rL = [
30546
30546
  "tavus:chat-message",
30547
30547
  "tavus:conversation-created",
30548
30548
  "tavus:conversation-ended",
@@ -30554,7 +30554,7 @@ var nL = [
30554
30554
  "tavus:ready",
30555
30555
  "tavus:state-change",
30556
30556
  "tavus:tool-call"
30557
- ], rL = class {
30557
+ ], iL = class {
30558
30558
  element = null;
30559
30559
  tagName;
30560
30560
  constructor(e = "tavus-widget") {
@@ -30605,6 +30605,6 @@ var nL = [
30605
30605
  };
30606
30606
  //#endregion
30607
30607
  //#region src/index.ts
30608
- typeof window < "u" && tL();
30608
+ typeof window < "u" && nL();
30609
30609
  //#endregion
30610
- export { nL as TAVUS_EVENT_NAMES, rL as TavusIntegration };
30610
+ export { rL as TAVUS_EVENT_NAMES, iL as TavusIntegration };