@tavus/embed 0.15.0 → 0.15.1

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
@@ -3015,7 +3015,7 @@ var Mn = class extends Error {
3015
3015
  }
3016
3016
  }, Nn = {
3017
3017
  name: "@tavus/embed",
3018
- version: "0.15.0",
3018
+ version: "0.15.1",
3019
3019
  variant: "embed"
3020
3020
  }, Pn = /* @__PURE__ */ new Set([
3021
3021
  "Error",
@@ -28738,32 +28738,27 @@ var TF = {
28738
28738
  stiffness: 2822,
28739
28739
  damping: 84,
28740
28740
  mass: 3.5
28741
- }, kF = .25, AF = 16;
28742
- function jF() {
28743
- if (typeof document > "u" || typeof getComputedStyle != "function") return AF;
28744
- let e = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
28745
- return Number.isFinite(e) ? e : AF;
28746
- }
28747
- function MF(e, t) {
28741
+ };
28742
+ function kF(e, t) {
28748
28743
  return e === "widget" || t !== void 0 && t > 0 && t < 640 ? "compact" : "regular";
28749
28744
  }
28750
- function NF(e) {
28745
+ function AF(e) {
28751
28746
  if (typeof e == "string") try {
28752
28747
  let t = JSON.parse(e);
28753
- return PF(t) ? t : null;
28748
+ return jF(t) ? t : null;
28754
28749
  } catch {
28755
28750
  return null;
28756
28751
  }
28757
- return PF(e) ? e : null;
28752
+ return jF(e) ? e : null;
28758
28753
  }
28759
- function PF(e) {
28754
+ function jF(e) {
28760
28755
  return typeof e == "object" && !!e && !Array.isArray(e);
28761
28756
  }
28762
- function FF(e) {
28763
- let t = NF(e)?.state;
28757
+ function MF(e) {
28758
+ let t = AF(e)?.state;
28764
28759
  return t === "success" || t === "error";
28765
28760
  }
28766
- function IF(e, t, n) {
28761
+ function NF(e, t, n) {
28767
28762
  let r = `${t + 8}px`;
28768
28763
  if (n === void 0 || !Number.isFinite(n) || n <= 0) return {
28769
28764
  left: "1rem",
@@ -28777,83 +28772,75 @@ function IF(e, t, n) {
28777
28772
  bottom: r
28778
28773
  };
28779
28774
  }
28780
- function LF(e) {
28781
- let t = e?.trim();
28782
- if (!t) return kF * jF();
28783
- let n = Number.parseFloat(t);
28784
- if (!Number.isFinite(n)) return kF * jF();
28785
- if (t.endsWith("rem")) return n * jF();
28786
- if (t.endsWith("px")) return n;
28787
- }
28788
- function RF(e, t) {
28789
- let n = e["--color-neutral"], r = e["--color-neutral-content"], i = LF(e["--radius-field"]);
28775
+ var PF = "rgb(0 0 0 / 50%)", FF = "oklch(98.5% 0 0)", IF = 1.5;
28776
+ function LF(e, t) {
28790
28777
  return {
28791
- ...n ? { "--activity-bg": n } : {},
28792
- ...r ? { "--activity-fg": r } : {},
28778
+ "--activity-bg": PF,
28779
+ "--activity-fg": FF,
28793
28780
  "--activity-border": "transparent",
28794
- ...i === void 0 ? {} : { "--activity-radius": `${i}px` },
28781
+ "--activity-radius": `${IF}px`,
28795
28782
  "--activity-height": `${TF[t.density]}px`,
28796
28783
  "--activity-align": t.align
28797
28784
  };
28798
28785
  }
28799
28786
  //#endregion
28800
28787
  //#region ../core/src/magic-canvas/magic-canvas.tsx
28801
- var zF = 1e3, BF = 5e3, VF = 1200, HF = [2e3, 6e3];
28802
- async function UF(e, t, n) {
28803
- let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), BF);
28788
+ var RF = 1e3, zF = 5e3, BF = 1200, VF = [2e3, 6e3];
28789
+ async function HF(e, t, n) {
28790
+ let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), zF);
28804
28791
  try {
28805
28792
  await wn(e, t, n, { signal: r.signal });
28806
28793
  } finally {
28807
28794
  globalThis.clearTimeout(i);
28808
28795
  }
28809
28796
  }
28810
- function WF(e) {
28797
+ function UF(e) {
28811
28798
  return e instanceof vn && e.status >= 400 && e.status < 500 && e.status !== 408 && e.status !== 429;
28812
28799
  }
28813
- function GF(e, t) {
28800
+ function WF(e, t) {
28814
28801
  console.error("Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.", e), t({
28815
28802
  lastInteractionPostResult: "error",
28816
- lastError: TI(e).message
28803
+ lastError: wI(e).message
28817
28804
  }, {
28818
28805
  error: e,
28819
28806
  operation: "canvas.bridge"
28820
28807
  });
28821
28808
  }
28822
- function KF(e) {
28809
+ function GF(e) {
28823
28810
  return e.content.some((e) => e.type === "text" && typeof e.text == "string" && e.text.trim() !== "");
28824
28811
  }
28825
- function qF(e, t, n, r) {
28812
+ function KF(e, t, n, r) {
28826
28813
  (async () => {
28827
28814
  let i;
28828
- for (let a of HF) {
28815
+ for (let a of VF) {
28829
28816
  await new Promise((e) => setTimeout(e, a));
28830
28817
  try {
28831
- await UF(e, t, n), r({
28818
+ await HF(e, t, n), r({
28832
28819
  lastInteractionPostResult: "recovered",
28833
28820
  lastError: void 0
28834
28821
  });
28835
28822
  return;
28836
28823
  } catch (e) {
28837
- if (i = e, WF(e)) break;
28824
+ if (i = e, UF(e)) break;
28838
28825
  }
28839
28826
  }
28840
- GF(i, r);
28827
+ WF(i, r);
28841
28828
  })();
28842
28829
  }
28843
- var JF = 2e3;
28844
- function YF(e) {
28845
- return e.correct_answer === void 0 ? VF : JF;
28830
+ var qF = 2e3;
28831
+ function JF(e) {
28832
+ return e.correct_answer === void 0 ? BF : qF;
28846
28833
  }
28847
- var XF = 48, ZF = 24, QF = "ui-monospace, SFMono-Regular, Menlo, monospace", $F = 160, eI = () => {}, tI = "allow-scripts", nI = {
28834
+ var YF = 48, XF = 24, ZF = "ui-monospace, SFMono-Regular, Menlo, monospace", QF = 160, $F = () => {}, eI = "allow-scripts", tI = {
28848
28835
  "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms",
28849
28836
  "canvas.text": "allow-scripts allow-popups allow-popups-to-escape-sandbox"
28850
28837
  };
28851
- function rI(e, t) {
28838
+ function nI(e, t) {
28852
28839
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
28853
28840
  let n = e.data;
28854
28841
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
28855
28842
  }
28856
- var iI = class {
28843
+ var rI = class {
28857
28844
  onmessage;
28858
28845
  onerror;
28859
28846
  onclose;
@@ -28864,7 +28851,7 @@ var iI = class {
28864
28851
  }
28865
28852
  start() {
28866
28853
  let e = (e) => {
28867
- rI(e, this.#e) && this.onmessage?.(e.data);
28854
+ nI(e, this.#e) && this.onmessage?.(e.data);
28868
28855
  };
28869
28856
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
28870
28857
  }
@@ -28875,12 +28862,12 @@ var iI = class {
28875
28862
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
28876
28863
  }
28877
28864
  };
28878
- function aI(e) {
28879
- for (let t of fb) if (e.some((e) => xI(e) === t)) return t;
28865
+ function iI(e) {
28866
+ for (let t of fb) if (e.some((e) => bI(e) === t)) return t;
28880
28867
  return null;
28881
28868
  }
28882
- function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = SI(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28883
- let { client: l, telemetry: u } = sh(), { dataTheme: d, cssVars: f } = cM(), p = If(), m = Lf(), [h, g] = j([]), [_, v] = j(null), [y, b] = j(!1), x = N(null), S = N(null), C = N(null), [w, T] = _I(), E = I(_t)?.surface, D = MF(E, T.width), ee = TF[D], O = y ? null : _, te = O ? ee + 8 : 0, ne = F(() => {
28869
+ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = xI(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28870
+ let { client: l, telemetry: u } = sh(), { isDark: d, cssVars: f } = cM(), p = If(), m = Lf(), [h, g] = j([]), [_, v] = j(null), [y, b] = j(!1), x = N(null), S = N(null), C = N(null), [w, T] = gI(), E = I(_t)?.surface, D = kF(E, T.width), ee = TF[D], O = y ? null : _, te = O ? ee + 8 : 0, ne = F(() => {
28884
28871
  S.current !== null && (clearTimeout(S.current), S.current = null);
28885
28872
  }, []), k = F(() => {
28886
28873
  C.current !== null && (clearTimeout(C.current), C.current = null);
@@ -28948,7 +28935,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28948
28935
  m,
28949
28936
  se
28950
28937
  ]), le = P(() => ({
28951
- theme: d.value === "dark" ? "dark" : "light",
28938
+ theme: d.value ? "dark" : "light",
28952
28939
  cssVars: f.value
28953
28940
  }), [d.value, f.value]);
28954
28941
  M(() => {
@@ -28975,7 +28962,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28975
28962
  let n = Ab(x.current, t);
28976
28963
  if (n.consumed) {
28977
28964
  if (!n.strip) re();
28978
- else if (FF(n.strip.arguments)) {
28965
+ else if (MF(n.strip.arguments)) {
28979
28966
  let e = x.current;
28980
28967
  e !== null && e.tool_call_id === n.strip.tool_call_id && e.conversation_id === n.strip.conversation_id && ie();
28981
28968
  } else ne(), k(), x.current = n.strip, b(!1), v(n.strip);
@@ -28989,7 +28976,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28989
28976
  } catch (e) {
28990
28977
  se({
28991
28978
  iframeLifecycleState: "error",
28992
- lastError: TI(e).message
28979
+ lastError: wI(e).message
28993
28980
  }, {
28994
28981
  error: e,
28995
28982
  operation: "canvas.validate"
@@ -29027,7 +29014,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29027
29014
  de.safe_area?.width,
29028
29015
  de.safe_area?.height
29029
29016
  ]);
29030
- let pe = aI(ue.map(({ layout: e }) => e));
29017
+ let pe = iI(ue.map(({ layout: e }) => e));
29031
29018
  M(() => {
29032
29019
  t?.(pe);
29033
29020
  }, [t, pe]);
@@ -29036,7 +29023,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29036
29023
  ref: w,
29037
29024
  "data-magic-canvas-root": !0,
29038
29025
  class: "pointer-events-none absolute inset-0 z-30",
29039
- style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - ZF}px`,
29026
+ style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - XF}px`,
29040
29027
  children: [
29041
29028
  me && fe && /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-black/45" }),
29042
29029
  me && !fe && oe.sheetBottomPx !== null && /* @__PURE__ */ L("div", {
@@ -29047,15 +29034,15 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29047
29034
  backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))"
29048
29035
  }
29049
29036
  }),
29050
- me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(uI, {
29051
- slot: xI(t),
29037
+ me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(lI, {
29038
+ slot: bI(t),
29052
29039
  safeAreaTop: de.safe_area?.y,
29053
29040
  frameWidth: T.width,
29054
29041
  ...n ? {
29055
29042
  gridRect: n,
29056
29043
  gridAnimate: oe.animate
29057
29044
  } : {},
29058
- children: (r) => /* @__PURE__ */ L(dI, {
29045
+ children: (r) => /* @__PURE__ */ L(uI, {
29059
29046
  availableHeight: r,
29060
29047
  client: l,
29061
29048
  gridDriven: n !== null,
@@ -29081,7 +29068,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29081
29068
  sendAppMessage: ce
29082
29069
  })
29083
29070
  }, e.id)),
29084
- _ && /* @__PURE__ */ L(sI, {
29071
+ _ && /* @__PURE__ */ L(oI, {
29085
29072
  client: l,
29086
29073
  controlsRect: a,
29087
29074
  density: D,
@@ -29101,7 +29088,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29101
29088
  ]
29102
29089
  });
29103
29090
  }
29104
- function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i, hostTheme: a, instance: o, onComplete: s, onDebug: c, sendAppMessage: l }) {
29091
+ function oI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i, hostTheme: a, instance: o, onComplete: s, onDebug: c, sendAppMessage: l }) {
29105
29092
  let u = TF[n], d = {
29106
29093
  ...o.layout,
29107
29094
  preferred_slot: "safe-area-bottom",
@@ -29111,7 +29098,7 @@ function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29111
29098
  ...a,
29112
29099
  cssVars: {
29113
29100
  ...a.cssVars,
29114
- "--font-mono": QF
29101
+ "--font-mono": ZF
29115
29102
  },
29116
29103
  activity: {
29117
29104
  density: n,
@@ -29120,13 +29107,13 @@ function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29120
29107
  }), [n, a]);
29121
29108
  return /* @__PURE__ */ L("div", {
29122
29109
  class: "cvi-status-strip absolute flex justify-center",
29123
- style: IF(t, 72, i),
29110
+ style: NF(t, 72, i),
29124
29111
  "data-canvas-status-strip": !0,
29125
- children: /* @__PURE__ */ L(cI, {
29112
+ children: /* @__PURE__ */ L(sI, {
29126
29113
  exiting: r,
29127
29114
  instanceId: o.id,
29128
- children: /* @__PURE__ */ L(dI, {
29129
- availableHeight: $F,
29115
+ children: /* @__PURE__ */ L(uI, {
29116
+ availableHeight: QF,
29130
29117
  client: e,
29131
29118
  fixedHeightPx: u,
29132
29119
  hostTheme: f,
@@ -29134,15 +29121,15 @@ function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29134
29121
  layout: d,
29135
29122
  onComplete: s,
29136
29123
  onDebug: c,
29137
- onDisplayModeChange: eI,
29138
- onNaturalHeightChange: eI,
29124
+ onDisplayModeChange: $F,
29125
+ onNaturalHeightChange: $F,
29139
29126
  sendAppMessage: l,
29140
29127
  variant: "strip"
29141
29128
  })
29142
29129
  })
29143
29130
  });
29144
29131
  }
29145
- function cI({ exiting: e, instanceId: t, children: n }) {
29132
+ function sI({ exiting: e, instanceId: t, children: n }) {
29146
29133
  let r = N(null);
29147
29134
  return Xe(() => {
29148
29135
  let t = r.current;
@@ -29178,9 +29165,9 @@ function cI({ exiting: e, instanceId: t, children: n }) {
29178
29165
  children: n
29179
29166
  });
29180
29167
  }
29181
- var lI = 16;
29182
- function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
29183
- let [o, s] = vI(), c = a(r ? r.height : e === "full" ? void 0 : s);
29168
+ var cI = 16;
29169
+ function lI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
29170
+ let [o, s] = _I(), c = a(r ? r.height : e === "full" ? void 0 : s);
29184
29171
  if (r) return /* @__PURE__ */ L("div", {
29185
29172
  ref: o,
29186
29173
  class: "pointer-events-auto absolute",
@@ -29196,7 +29183,7 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29196
29183
  let r = t == null ? "1rem" : `${t * 100}%`, i = n != null && n > 0 ? Math.max(0, n - 32) : void 0;
29197
29184
  return /* @__PURE__ */ L("div", {
29198
29185
  ref: o,
29199
- class: `cvi-strip-lift ${bI(e)}`,
29186
+ class: `cvi-strip-lift ${yI(e)}`,
29200
29187
  style: {
29201
29188
  top: r,
29202
29189
  bottom: "calc(72px + var(--mc-strip-band, 0px))",
@@ -29211,8 +29198,8 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29211
29198
  }
29212
29199
  return e === "safe-area-bottom" ? /* @__PURE__ */ L("div", {
29213
29200
  ref: o,
29214
- class: bI(e),
29215
- style: { top: `${lI}px` },
29201
+ class: yI(e),
29202
+ style: { top: `${cI}px` },
29216
29203
  "data-canvas-slot": e,
29217
29204
  children: /* @__PURE__ */ L("div", {
29218
29205
  class: "contents",
@@ -29220,7 +29207,7 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29220
29207
  })
29221
29208
  }) : /* @__PURE__ */ L("div", {
29222
29209
  ref: o,
29223
- class: bI(e),
29210
+ class: yI(e),
29224
29211
  "data-canvas-slot": e,
29225
29212
  children: /* @__PURE__ */ L("div", {
29226
29213
  class: "contents",
@@ -29228,7 +29215,7 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29228
29215
  })
29229
29216
  });
29230
29217
  }
29231
- function dI({ 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 }) {
29218
+ function uI({ 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 }) {
29232
29219
  let h = p === "strip", g = m ?? 720, _ = N(null), v = N(null), y = N(e), b = N(r), x = N(m ?? 320), S = N({
29233
29220
  fixed: m,
29234
29221
  max: g
@@ -29241,17 +29228,17 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29241
29228
  }, [m, g]), M(() => {
29242
29229
  w.current = a;
29243
29230
  }, [a]), M(() => {
29244
- x.current = ne, v.current?.setHostContext(hI(w.current, C.current, T.current, y.current, ne, b.current));
29231
+ x.current = ne, v.current?.setHostContext(mI(w.current, C.current, T.current, y.current, ne, b.current));
29245
29232
  }, [ne]), M(() => {
29246
29233
  y.current = e, b.current = r;
29247
- let t = mI(i, _.current);
29248
- C.current = t, v.current?.setHostContext(hI(w.current, t, T.current, e, x.current, r));
29234
+ let t = pI(i, _.current);
29235
+ C.current = t, v.current?.setHostContext(mI(w.current, t, T.current, e, x.current, r));
29249
29236
  }, [
29250
29237
  e,
29251
29238
  i,
29252
29239
  r
29253
29240
  ]), M(() => {
29254
- T.current = o, v.current?.setHostContext(hI(w.current, C.current, o, e, x.current, b.current));
29241
+ T.current = o, v.current?.setHostContext(mI(w.current, C.current, o, e, x.current, b.current));
29255
29242
  }, [e, o]), M(() => {
29256
29243
  D.current = l, ee.current = u, O.current = d, te.current = f;
29257
29244
  }, [
@@ -29265,7 +29252,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29265
29252
  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) => {
29266
29253
  n || c({
29267
29254
  iframeLifecycleState: "error",
29268
- lastError: TI(e).message
29255
+ lastError: wI(e).message
29269
29256
  }, {
29270
29257
  error: e,
29271
29258
  operation: "canvas.bridge"
@@ -29302,18 +29289,18 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29302
29289
  text: {},
29303
29290
  structuredContent: {}
29304
29291
  }
29305
- }, { hostContext: hI(a, mI(C.current, e), T.current, y.current, x.current, b.current) });
29292
+ }, { hostContext: mI(a, pI(C.current, e), T.current, y.current, x.current, b.current) });
29306
29293
  r = f, v.current = f, f.oninitialized = () => {
29307
29294
  n || (c({ iframeLifecycleState: "ready" }), E.current = w.current.revision, f.sendToolInput({ arguments: w.current.arguments }).catch(u));
29308
29295
  }, f.onsizechange = ({ height: e }) => {
29309
29296
  if (!n && typeof e == "number" && Number.isFinite(e)) {
29310
- let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, XF), n) : e === t ? t : Math.min(e, $F);
29297
+ let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, YF), n) : e === t ? t : Math.min(e, QF);
29311
29298
  k(r), O.current(w.current.id, r);
29312
29299
  }
29313
29300
  }, f.onmessage = async (e) => {
29314
29301
  let r = jb(e);
29315
29302
  if (!r) {
29316
- if (KF(e)) {
29303
+ if (GF(e)) {
29317
29304
  let e = "Magic Canvas message included text without interaction metadata; no interaction row was recorded.";
29318
29305
  return c({
29319
29306
  lastInteractionPostResult: "error",
@@ -29338,7 +29325,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29338
29325
  }
29339
29326
  })();
29340
29327
  if ("error" in a) {
29341
- let e = TI(a.error).message;
29328
+ let e = wI(a.error).message;
29342
29329
  return c({
29343
29330
  lastInteractionPostResult: "error",
29344
29331
  lastError: e
@@ -29355,19 +29342,19 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29355
29342
  try {
29356
29343
  u = Pb(e, o);
29357
29344
  } catch (e) {
29358
- c({ lastError: TI(e).message }), o.type === "submit" && console.warn("Magic Canvas dropped the response text of a submitted card.", e);
29345
+ c({ lastError: wI(e).message }), o.type === "submit" && console.warn("Magic Canvas dropped the response text of a submitted card.", e);
29359
29346
  }
29360
29347
  let d = !0;
29361
29348
  try {
29362
- await UF(t, o.conversation_id, l.body);
29349
+ await HF(t, o.conversation_id, l.body);
29363
29350
  } catch (e) {
29364
- d = !1, WF(e) ? GF(e, c) : (console.warn("Magic Canvas interaction POST failed; continuing without it and retrying in the background.", e), c({
29351
+ d = !1, UF(e) ? WF(e, c) : (console.warn("Magic Canvas interaction POST failed; continuing without it and retrying in the background.", e), c({
29365
29352
  lastInteractionPostResult: "failed_open",
29366
- lastError: TI(e).message
29353
+ lastError: wI(e).message
29367
29354
  }, {
29368
29355
  error: e,
29369
29356
  operation: "canvas.bridge"
29370
- }), qF(t, o.conversation_id, l.body, c));
29357
+ }), KF(t, o.conversation_id, l.body, c));
29371
29358
  }
29372
29359
  if (n) return {};
29373
29360
  if (u) try {
@@ -29378,7 +29365,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29378
29365
  properties: { text: u }
29379
29366
  });
29380
29367
  } catch (e) {
29381
- console.error("Magic Canvas respond send failed.", e), c({ lastError: TI(e).message }, {
29368
+ console.error("Magic Canvas respond send failed.", e), c({ lastError: wI(e).message }, {
29382
29369
  error: e,
29383
29370
  operation: "canvas.bridge"
29384
29371
  });
@@ -29388,18 +29375,18 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29388
29375
  lastError: void 0
29389
29376
  }), Nb(o) && (o.type === "submit" ? (s && clearTimeout(s), s = setTimeout(() => {
29390
29377
  s = null, n || D.current();
29391
- }, YF(i.arguments))) : D.current()), {};
29378
+ }, JF(i.arguments))) : D.current()), {};
29392
29379
  }, f.onupdatemodelcontext = async (e) => (i = e, o ||= setTimeout(() => {
29393
29380
  o = null, d();
29394
- }, zF), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29381
+ }, RF), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29395
29382
  if (h) return { mode: "inline" };
29396
29383
  let t = e === "fullscreen" ? "fullscreen" : "inline";
29397
29384
  return ee.current(t), T.current = {
29398
29385
  ...T.current,
29399
29386
  display_mode: t,
29400
29387
  viable_slot: t === "fullscreen" ? "full" : T.current.viable_slot
29401
- }, f.setHostContext(hI(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29402
- }, f.connect(new iI(e)).then(() => void 0).catch(u);
29388
+ }, f.setHostContext(mI(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29389
+ }, f.connect(new rI(e)).then(() => void 0).catch(u);
29403
29390
  };
29404
29391
  c({
29405
29392
  iframeLifecycleState: "mounting",
@@ -29421,7 +29408,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29421
29408
  a.revision !== 0 && (a.revision <= E.current || (E.current = a.revision, v.current?.sendToolInput({ arguments: a.arguments }).catch((e) => {
29422
29409
  c({
29423
29410
  iframeLifecycleState: "error",
29424
- lastError: TI(e).message
29411
+ lastError: wI(e).message
29425
29412
  }, {
29426
29413
  error: e,
29427
29414
  operation: "canvas.bridge"
@@ -29432,7 +29419,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29432
29419
  a.revision,
29433
29420
  c
29434
29421
  ]);
29435
- let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : gI(ne, e, r), ae = ie?.placeholderStyle, A = ie?.cardStyle, oe = re ? { height: "100%" } : ie?.iframeStyle ?? {
29422
+ let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : hI(ne, e, r), ae = ie?.placeholderStyle, A = ie?.cardStyle, oe = re ? { height: "100%" } : ie?.iframeStyle ?? {
29436
29423
  width: "100%",
29437
29424
  height: `${ne}px`
29438
29425
  }, se = h ? "pointer-events-auto w-full overflow-hidden" : [
@@ -29440,7 +29427,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29440
29427
  r ? "" : "shadow-xl",
29441
29428
  re ? "fixed inset-4 z-10 max-w-none" : n ? "max-w-none" : "max-w-md",
29442
29429
  s ? "scale-[0.98] opacity-40" : ""
29443
- ].filter(Boolean).join(" "), ce = nI[a.canvas_config.component] ?? tI, le = /* @__PURE__ */ L("div", {
29430
+ ].filter(Boolean).join(" "), ce = tI[a.canvas_config.component] ?? eI, le = /* @__PURE__ */ L("div", {
29444
29431
  class: se,
29445
29432
  style: A,
29446
29433
  ...h ? { "data-canvas-strip": o.viable_slot } : { "data-canvas-card": o.viable_slot },
@@ -29459,7 +29446,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29459
29446
  children: le
29460
29447
  });
29461
29448
  }
29462
- var fI = [
29449
+ var dI = [
29463
29450
  "--color-base-100",
29464
29451
  "--color-base-200",
29465
29452
  "--color-base-300",
@@ -29469,17 +29456,17 @@ var fI = [
29469
29456
  "--color-neutral",
29470
29457
  "--color-neutral-content"
29471
29458
  ];
29472
- function pI(e) {
29459
+ function fI(e) {
29473
29460
  if (!e || typeof getComputedStyle != "function") return {};
29474
29461
  let t = getComputedStyle(e), n = {};
29475
- for (let e of fI) {
29462
+ for (let e of dI) {
29476
29463
  let r = t.getPropertyValue(e).trim();
29477
29464
  r && (n[e] = r);
29478
29465
  }
29479
29466
  return n;
29480
29467
  }
29481
- function mI(e, t) {
29482
- let n = pI(t);
29468
+ function pI(e, t) {
29469
+ let n = fI(t);
29483
29470
  return Object.keys(n).length === 0 ? e : {
29484
29471
  ...e,
29485
29472
  cssVars: {
@@ -29488,20 +29475,20 @@ function mI(e, t) {
29488
29475
  }
29489
29476
  };
29490
29477
  }
29491
- function hI(e, t, n, r, i, a = !1) {
29492
- let o = mx(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : CI(r), l = t.activity ? RF(t.cssVars, t.activity) : {}, u = s ? 1 : gI(i ?? 0, r, a)?.displayScale ?? 1;
29478
+ function mI(e, t, n, r, i, a = !1) {
29479
+ let o = mx(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : SI(r), l = t.activity ? LF(t.cssVars, t.activity) : {}, u = s ? 1 : hI(i ?? 0, r, a)?.displayScale ?? 1;
29493
29480
  return {
29494
29481
  ...e.canvas_config.host_context,
29495
29482
  ...o,
29496
29483
  ...l,
29497
29484
  containerDimensions: {
29498
- ...wI(o.containerDimensions) ? o.containerDimensions : {},
29485
+ ...CI(o.containerDimensions) ? o.containerDimensions : {},
29499
29486
  ...c === void 0 ? {} : { maxHeight: c },
29500
29487
  displayScale: u
29501
29488
  }
29502
29489
  };
29503
29490
  }
29504
- function gI(e, t, n = !1) {
29491
+ function hI(e, t, n = !1) {
29505
29492
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
29506
29493
  let r = Math.min(e, 720);
29507
29494
  if (n) return {
@@ -29541,11 +29528,11 @@ function gI(e, t, n = !1) {
29541
29528
  }
29542
29529
  };
29543
29530
  }
29544
- function _I() {
29545
- let e = N(null), [t, n] = j(() => yI(null));
29531
+ function gI() {
29532
+ let e = N(null), [t, n] = j(() => vI(null));
29546
29533
  return M(() => {
29547
29534
  let t = () => n((t) => {
29548
- let n = yI(e.current);
29535
+ let n = vI(e.current);
29549
29536
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
29550
29537
  });
29551
29538
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -29555,7 +29542,7 @@ function _I() {
29555
29542
  };
29556
29543
  }, []), [e, t];
29557
29544
  }
29558
- function vI() {
29545
+ function _I() {
29559
29546
  let e = N(null), [t, n] = j();
29560
29547
  return M(() => {
29561
29548
  let t = e.current;
@@ -29571,7 +29558,7 @@ function vI() {
29571
29558
  return a.observe(t), () => a.disconnect();
29572
29559
  }, []), [e, t];
29573
29560
  }
29574
- function yI(e) {
29561
+ function vI(e) {
29575
29562
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
29576
29563
  if (n && n.width > 0 && n.height > 0) {
29577
29564
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -29587,7 +29574,7 @@ function yI(e) {
29587
29574
  visualViewportHeight: t
29588
29575
  };
29589
29576
  }
29590
- function bI(e) {
29577
+ function yI(e) {
29591
29578
  let t = "absolute flex gap-2";
29592
29579
  switch (e) {
29593
29580
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;
@@ -29596,24 +29583,24 @@ function bI(e) {
29596
29583
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
29597
29584
  }
29598
29585
  }
29599
- function xI(e) {
29586
+ function bI(e) {
29600
29587
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
29601
29588
  }
29602
- function SI() {
29589
+ function xI() {
29603
29590
  return !1;
29604
29591
  }
29605
- function CI(e) {
29592
+ function SI(e) {
29606
29593
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
29607
29594
  }
29608
- function wI(e) {
29595
+ function CI(e) {
29609
29596
  return typeof e == "object" && !!e && !Array.isArray(e);
29610
29597
  }
29611
- function TI(e) {
29598
+ function wI(e) {
29612
29599
  return e instanceof Error ? e : Error(String(e));
29613
29600
  }
29614
29601
  //#endregion
29615
29602
  //#region ../core/src/magic-canvas/grid-error-boundary.tsx
29616
- var EI = class extends D {
29603
+ var TI = class extends D {
29617
29604
  state = { errored: !1 };
29618
29605
  componentDidCatch(e) {
29619
29606
  this.props.onError(e), this.setState({ errored: !0 });
@@ -29621,8 +29608,8 @@ var EI = class extends D {
29621
29608
  render() {
29622
29609
  return this.state.errored ? null : this.props.children;
29623
29610
  }
29624
- }, DI = 1e4;
29625
- function OI(e, t = DI) {
29611
+ }, EI = 1e4;
29612
+ function DI(e, t = EI) {
29626
29613
  let [n, r] = j(!1), i = N(!1);
29627
29614
  return M(() => {
29628
29615
  if (!e) {
@@ -29637,7 +29624,7 @@ function OI(e, t = DI) {
29637
29624
  }
29638
29625
  //#endregion
29639
29626
  //#region ../core/src/hooks/use-call-presence.ts
29640
- function kI(e) {
29627
+ function OI(e) {
29641
29628
  let t = Rf(), n = Wf(t ?? ""), r = !Kf(t ?? "").isOff, i = Wy(e), a = i.phase === "ready" ? i.replicaId : "", o = Kf(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;
29642
29629
  return P(() => ({
29643
29630
  presence: i,
@@ -29659,7 +29646,7 @@ function kI(e) {
29659
29646
  }
29660
29647
  //#endregion
29661
29648
  //#region ../core/src/hooks/use-call-controls-visible.ts
29662
- function AI(e, t, n) {
29649
+ function kI(e, t, n) {
29663
29650
  let [r, i] = j(!0);
29664
29651
  return M(() => {
29665
29652
  if (!t) return;
@@ -29689,7 +29676,7 @@ function AI(e, t, n) {
29689
29676
  }
29690
29677
  //#endregion
29691
29678
  //#region ../core/src/hooks/use-call-controls-rect.ts
29692
- function jI(e, t, n, r, i) {
29679
+ function AI(e, t, n, r, i) {
29693
29680
  let [a, o] = j(void 0);
29694
29681
  return M(() => {
29695
29682
  if (!r) return;
@@ -29723,8 +29710,8 @@ function jI(e, t, n, r, i) {
29723
29710
  }
29724
29711
  //#endregion
29725
29712
  //#region ../core/src/hooks/use-replica-join-timeout.ts
29726
- var MI = 1e4;
29727
- function NI({ onTimeout: e, timeoutMs: t = MI, active: n = !0 }) {
29713
+ var jI = 1e4;
29714
+ function MI({ onTimeout: e, timeoutMs: t = jI, active: n = !0 }) {
29728
29715
  let r = Uy().length > 0, [i, a] = j(!1), o = N(e);
29729
29716
  return M(() => {
29730
29717
  o.current = e;
@@ -29748,39 +29735,39 @@ function NI({ onTimeout: e, timeoutMs: t = MI, active: n = !0 }) {
29748
29735
  }
29749
29736
  //#endregion
29750
29737
  //#region ../core/src/hooks/use-system-shutdown.ts
29751
- function PI(e) {
29738
+ function NI(e) {
29752
29739
  if (typeof e != "object" || !e) return !1;
29753
29740
  let t = e;
29754
29741
  return t.message_type === "system" && t.event_type === "system.shutdown";
29755
29742
  }
29756
- function FI({ onShutdown: e }) {
29743
+ function PI({ onShutdown: e }) {
29757
29744
  let t = N(e);
29758
29745
  M(() => {
29759
29746
  t.current = e;
29760
29747
  }, [e]), Vf({ onAppMessage: F((e) => {
29761
- PI(e?.data) && t.current();
29748
+ NI(e?.data) && t.current();
29762
29749
  }, []) });
29763
29750
  }
29764
29751
  //#endregion
29765
29752
  //#region ../core/src/hooks/use-picture-in-picture.ts
29766
- var II = fn("PiP"), LI = 360, RI = 280;
29767
- function zI() {
29753
+ var FI = fn("PiP"), II = 360, LI = 280;
29754
+ function RI() {
29768
29755
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
29769
29756
  }
29770
- function BI(e) {
29771
- let { enabled: t, active: n } = e, [r, i] = j(null), a = zI(), o = I(Fh), s = F(() => {
29757
+ function zI(e) {
29758
+ let { enabled: t, active: n } = e, [r, i] = j(null), a = RI(), o = I(Fh), s = F(() => {
29772
29759
  i((e) => (e && !e.closed && e.close(), null));
29773
29760
  }, []), c = F(async () => {
29774
29761
  if (a && t && n && (!r || r.closed)) try {
29775
29762
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
29776
- width: LI,
29777
- height: RI
29763
+ width: II,
29764
+ height: LI
29778
29765
  }), t = Pe.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
29779
29766
  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", () => {
29780
29767
  i((t) => t === e ? null : t);
29781
29768
  }, { once: !0 }), i(e);
29782
29769
  } catch (e) {
29783
- II.warn("Failed to open PiP window", e);
29770
+ FI.warn("Failed to open PiP window", e);
29784
29771
  }
29785
29772
  }, [
29786
29773
  a,
@@ -29801,13 +29788,13 @@ function BI(e) {
29801
29788
  try {
29802
29789
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
29803
29790
  } catch (e) {
29804
- II.warn("mediaSession metadata setup failed", e);
29791
+ FI.warn("mediaSession metadata setup failed", e);
29805
29792
  }
29806
29793
  let t = (t, n) => {
29807
29794
  try {
29808
29795
  e.setActionHandler(t, n), r.push(t);
29809
29796
  } catch (e) {
29810
- II.info(`mediaSession.${t} not supported`, e);
29797
+ FI.info(`mediaSession.${t} not supported`, e);
29811
29798
  }
29812
29799
  };
29813
29800
  t("enterpictureinpicture", () => {
@@ -29861,11 +29848,11 @@ function BI(e) {
29861
29848
  }
29862
29849
  //#endregion
29863
29850
  //#region ../core/src/utils/device-preferences.ts
29864
- var VI = Lt(null), HI = {
29851
+ var BI = Lt(null), VI = {
29865
29852
  active: !1,
29866
29853
  video_shift_x: 0,
29867
29854
  backdrop: { type: "snapshot_mirror" }
29868
- }, UI = Qf(({ id: e, showAudioWave: t = !0 }) => {
29855
+ }, HI = Qf(({ id: e, showAudioWave: t = !0 }) => {
29869
29856
  let n = Wf(e).isOff;
29870
29857
  return /* @__PURE__ */ L("div", {
29871
29858
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -29880,16 +29867,16 @@ var VI = Lt(null), HI = {
29880
29867
  children: /* @__PURE__ */ L(Iy, { id: e })
29881
29868
  })]
29882
29869
  });
29883
- }), WI = Qf(() => {
29870
+ }), UI = Qf(() => {
29884
29871
  let e = Rf(), { isScreenSharing: t } = Yv(), n = Uy()[0];
29885
- return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(UI, { id: n }), e && /* @__PURE__ */ L(UI, {
29872
+ return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(HI, { id: n }), e && /* @__PURE__ */ L(HI, {
29886
29873
  id: e,
29887
29874
  showAudioWave: !1
29888
29875
  })] });
29889
- }), GI = Qf(() => /* @__PURE__ */ L("div", {
29876
+ }), WI = Qf(() => /* @__PURE__ */ L("div", {
29890
29877
  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",
29891
- children: /* @__PURE__ */ L(WI, {})
29892
- })), KI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, effect: i, animate: a }) => /* @__PURE__ */ L(E, { children: [
29878
+ children: /* @__PURE__ */ L(UI, {})
29879
+ })), GI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, effect: i, animate: a }) => /* @__PURE__ */ L(E, { children: [
29893
29880
  /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-base-200" }),
29894
29881
  i.content && /* @__PURE__ */ L("div", {
29895
29882
  class: "absolute overflow-hidden rounded-box bg-black",
@@ -29911,7 +29898,7 @@ var VI = Lt(null), HI = {
29911
29898
  avatarOff: r
29912
29899
  })
29913
29900
  })
29914
- ] })), qI = Qf(() => {
29901
+ ] })), KI = Qf(() => {
29915
29902
  let { effect: e, animate: t } = pF.value, n = Rf();
29916
29903
  return n === null || e.selfView === null ? null : /* @__PURE__ */ L("div", {
29917
29904
  class: "absolute z-20 overflow-hidden rounded-box bg-black/30",
@@ -29924,23 +29911,23 @@ var VI = Lt(null), HI = {
29924
29911
  className: "h-full w-full object-cover"
29925
29912
  })
29926
29913
  });
29927
- }), JI = Qf(({ canvasRenderedSlot: e }) => {
29914
+ }), qI = Qf(({ canvasRenderedSlot: e }) => {
29928
29915
  let t = DN(pF.value.effect);
29929
- return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(EI, {
29916
+ return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(TI, {
29930
29917
  onError: yN,
29931
- children: /* @__PURE__ */ L(qI, {})
29932
- }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(GI, {});
29933
- }), YI = Qf(() => {
29918
+ children: /* @__PURE__ */ L(KI, {})
29919
+ }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(WI, {});
29920
+ }), JI = Qf(() => {
29934
29921
  let e = Uy()[0];
29935
29922
  return e ? /* @__PURE__ */ L(Kv, { sessionId: e }) : null;
29936
- }), XI = Qf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(YI, {}), /* @__PURE__ */ L(ZI, { ...e })] })), ZI = Qf(({ isAudioOnly: e, presence: t, canvasLayoutEffect: n, canvasRenderedSlot: r }) => {
29923
+ }), YI = Qf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(JI, {}), /* @__PURE__ */ L(XI, { ...e })] })), XI = Qf(({ isAudioOnly: e, presence: t, canvasLayoutEffect: n, canvasRenderedSlot: r }) => {
29937
29924
  let { presence: i, localId: a, isScreenSharing: o, isPersonaPresenting: s } = t, c = pF.value, l = n.active && !o && (!e || s);
29938
29925
  return i.phase === "left" ? /* @__PURE__ */ L(Py, {}) : i.phase === "connecting" ? /* @__PURE__ */ L(Ny, {}) : e && !s ? /* @__PURE__ */ L("div", {
29939
29926
  class: "absolute inset-0 flex items-center justify-center",
29940
29927
  children: /* @__PURE__ */ L(By, { sessionId: i.replicaId })
29941
- }) : c.effect.driving ? /* @__PURE__ */ L(EI, {
29928
+ }) : c.effect.driving ? /* @__PURE__ */ L(TI, {
29942
29929
  onError: yN,
29943
- children: /* @__PURE__ */ L(KI, {
29930
+ children: /* @__PURE__ */ L(GI, {
29944
29931
  personaSessionId: i.replicaId,
29945
29932
  localId: a,
29946
29933
  isScreenSharing: o,
@@ -29954,7 +29941,7 @@ var VI = Lt(null), HI = {
29954
29941
  avatarOff: i.videoState.isOff,
29955
29942
  canvasLayoutEffect: n,
29956
29943
  smartSidecarActive: l
29957
- }) : /* @__PURE__ */ L(QI, {
29944
+ }) : /* @__PURE__ */ L(ZI, {
29958
29945
  personaSessionId: i.replicaId,
29959
29946
  localId: a,
29960
29947
  isScreenSharing: o,
@@ -29963,11 +29950,11 @@ var VI = Lt(null), HI = {
29963
29950
  canvasLayoutEffect: n,
29964
29951
  canvasRenderedSlot: r
29965
29952
  });
29966
- }), QI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ L(Wx, {
29953
+ }), ZI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ L(Wx, {
29967
29954
  canvasLayoutEffect: a,
29968
29955
  smartSidecarActive: i,
29969
29956
  isScreenSharing: n,
29970
- captureSnapshot: nL,
29957
+ captureSnapshot: tL,
29971
29958
  personaMode: "auto",
29972
29959
  renderedSlot: o,
29973
29960
  fill: (i) => /* @__PURE__ */ L(Jy, {
@@ -29977,7 +29964,7 @@ var VI = Lt(null), HI = {
29977
29964
  avatarOff: r,
29978
29965
  videoRef: i
29979
29966
  })
29980
- })), $I = Qf(({ items: e }) => {
29967
+ })), QI = Qf(({ items: e }) => {
29981
29968
  let [t, n] = j(!1), r = N(null);
29982
29969
  return M(() => {
29983
29970
  if (!t) return;
@@ -30007,8 +29994,8 @@ var VI = Lt(null), HI = {
30007
29994
  children: e
30008
29995
  })]
30009
29996
  });
30010
- }), eL = Qf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L($I, { items: e })), tL = Qf(({ onLeave: e }) => {
30011
- let t = Lf(), { config: n } = sh(), { session: r, end: i } = by(), a = Rf(), o = N(null), s = I(Dg)?.frameRef ?? o, [c, l] = j(!1), u = Sv() === "full-screen", [d, f] = j(!1), [p, m] = j(HI), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = OI(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = AI(x, pN(y.magic_grid, w), C), E = jI(x, S, 72, !0, C), D = y.modality === "audio", ee = kI(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 } = BI({
29997
+ }), $I = Qf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L(QI, { items: e })), eL = Qf(({ onLeave: e }) => {
29998
+ let t = Lf(), { config: n } = sh(), { session: r, end: i } = by(), a = Rf(), o = N(null), s = I(Dg)?.frameRef ?? o, [c, l] = j(!1), u = Sv() === "full-screen", [d, f] = j(!1), [p, m] = j(VI), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = DI(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = kI(x, pN(y.magic_grid, w), C), E = AI(x, S, 72, !0, C), D = y.modality === "audio", ee = OI(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 } = zI({
30012
29999
  enabled: re && !O,
30013
30000
  active: t === "joined-meeting"
30014
30001
  });
@@ -30017,13 +30004,13 @@ var VI = Lt(null), HI = {
30017
30004
  }, [i]);
30018
30005
  let { camera: ae, requestCamera: A } = xh(), { isCamMuted: oe } = qv(), se = ae.isGranted && !oe;
30019
30006
  M(() => {
30020
- te && t === "joined-meeting" && (VI.value = se);
30007
+ te && t === "joined-meeting" && (BI.value = se);
30021
30008
  }, [
30022
30009
  te,
30023
30010
  t,
30024
30011
  se
30025
30012
  ]);
30026
- let ce = N(te && !a && VI.value === !0);
30013
+ let ce = N(te && !a && BI.value === !0);
30027
30014
  M(() => {
30028
30015
  t === "joined-meeting" && ce.current && (ce.current = !1, A());
30029
30016
  }, [t, A]), M(() => {
@@ -30047,10 +30034,10 @@ var VI = Lt(null), HI = {
30047
30034
  let ue = F(() => {
30048
30035
  i();
30049
30036
  }, [i]);
30050
- if (NI({
30037
+ if (MI({
30051
30038
  active: !O && t === "joined-meeting",
30052
30039
  onTimeout: ue
30053
- }), FI({ onShutdown: ue }), !C) return null;
30040
+ }), PI({ onShutdown: ue }), !C) return null;
30054
30041
  if (O) return /* @__PURE__ */ L(Dy, {
30055
30042
  defaultOpen: !0,
30056
30043
  children: /* @__PURE__ */ L("div", {
@@ -30082,14 +30069,14 @@ var VI = Lt(null), HI = {
30082
30069
  /* @__PURE__ */ L("div", {
30083
30070
  class: "relative w-full h-full z-[5]",
30084
30071
  children: [
30085
- /* @__PURE__ */ L(XI, {
30072
+ /* @__PURE__ */ L(YI, {
30086
30073
  isAudioOnly: D,
30087
30074
  presence: ee,
30088
30075
  canvasLayoutEffect: p,
30089
30076
  canvasRenderedSlot: h
30090
30077
  }),
30091
- !D && /* @__PURE__ */ L(JI, { canvasRenderedSlot: h }),
30092
- /* @__PURE__ */ L(oI, {
30078
+ !D && /* @__PURE__ */ L(qI, { canvasRenderedSlot: h }),
30079
+ /* @__PURE__ */ L(aI, {
30093
30080
  debugEnabled: d,
30094
30081
  callPresence: ee,
30095
30082
  callControlsVisible: T,
@@ -30127,7 +30114,7 @@ var VI = Lt(null), HI = {
30127
30114
  /* @__PURE__ */ L(my, { level: !0 }),
30128
30115
  !D && /* @__PURE__ */ L(gy, {}),
30129
30116
  k && /* @__PURE__ */ L(wy, {}),
30130
- /* @__PURE__ */ L(eL, { items: de }),
30117
+ /* @__PURE__ */ L($I, { items: de }),
30131
30118
  /* @__PURE__ */ L("button", {
30132
30119
  type: "button",
30133
30120
  class: "btn btn-control btn-error",
@@ -30144,7 +30131,7 @@ var VI = Lt(null), HI = {
30144
30131
  ]
30145
30132
  }), ie && fp(/* @__PURE__ */ L(Ky, { onLeave: ue }), ie.document.body)] }) }) });
30146
30133
  });
30147
- function nL(e) {
30134
+ function tL(e) {
30148
30135
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
30149
30136
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
30150
30137
  t.width = 640, t.height = n;
@@ -30159,7 +30146,7 @@ function nL(e) {
30159
30146
  }
30160
30147
  //#endregion
30161
30148
  //#region ../core/src/components/hair-check/index.tsx
30162
- function rL(e, t, n) {
30149
+ function nL(e, t, n) {
30163
30150
  switch (t) {
30164
30151
  case "granted": return n ? e?.cameraOptional ?? "Camera is optional — turn it on anytime." : e?.ready ?? "You're all set — join whenever you're ready.";
30165
30152
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -30170,7 +30157,7 @@ function rL(e, t, n) {
30170
30157
  default: return e?.loading ?? "Getting your microphone ready...";
30171
30158
  }
30172
30159
  }
30173
- var iL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30160
+ var rL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30174
30161
  let i = If(), { config: a } = sh(), { cameraOnStart: o } = I(_t), { localSessionId: s, isCamMuted: c } = qv(), { mic: l, camera: u, requestMic: d, requestCamera: f } = xh(), p = a.value.customization.conversation.modality === "video", m = Y_(a.value), h = J_(a.value);
30175
30162
  M(() => {
30176
30163
  d();
@@ -30186,7 +30173,7 @@ var iL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30186
30173
  u.isBlocked,
30187
30174
  f
30188
30175
  ]);
30189
- let v = p && g && !u.isGranted, y = rL(e, l.status, v);
30176
+ let v = p && g && !u.isGranted, y = nL(e, l.status, v);
30190
30177
  return /* @__PURE__ */ L(ny, { children: /* @__PURE__ */ L("div", {
30191
30178
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
30192
30179
  children: [u.isGranted && !c ? /* @__PURE__ */ L("div", {
@@ -30237,8 +30224,8 @@ var iL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30237
30224
  })]
30238
30225
  })]
30239
30226
  }) });
30240
- }), aL = "Password required", oL = "Enter the password to start this conversation.", sL = "Password", cL = "Continue";
30241
- function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30227
+ }), iL = "Password required", aL = "Enter the password to start this conversation.", oL = "Password", sL = "Continue";
30228
+ function cL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30242
30229
  let [i, a] = j(""), o = Ze();
30243
30230
  return /* @__PURE__ */ L("div", {
30244
30231
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -30258,18 +30245,18 @@ function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30258
30245
  /* @__PURE__ */ L("h3", {
30259
30246
  id: `${o}-title`,
30260
30247
  class: "card-title text-base-content",
30261
- children: t?.title ?? aL
30248
+ children: t?.title ?? iL
30262
30249
  }),
30263
30250
  /* @__PURE__ */ L("p", {
30264
30251
  class: "text-sm text-base-content/70",
30265
- children: t?.description ?? oL
30252
+ children: t?.description ?? aL
30266
30253
  }),
30267
30254
  /* @__PURE__ */ L("input", {
30268
30255
  id: o,
30269
30256
  type: "password",
30270
30257
  autocomplete: "current-password",
30271
30258
  class: "input input-bordered w-full",
30272
- placeholder: t?.placeholder ?? sL,
30259
+ placeholder: t?.placeholder ?? oL,
30273
30260
  value: i,
30274
30261
  disabled: n,
30275
30262
  onInput: (e) => a(e.target.value),
@@ -30285,7 +30272,7 @@ function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30285
30272
  type: "submit",
30286
30273
  disabled: !i.trim(),
30287
30274
  loading: n,
30288
- children: t?.submit ?? cL
30275
+ children: t?.submit ?? sL
30289
30276
  })
30290
30277
  ]
30291
30278
  })
@@ -30294,7 +30281,7 @@ function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30294
30281
  }
30295
30282
  //#endregion
30296
30283
  //#region ../core/src/components/welcome/index.tsx
30297
- function uL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30284
+ function lL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30298
30285
  let { config: i, deploymentId: a } = sh(), o = Sv() === "full-screen", s = I(Lm), c = Y_(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 && lm(a, u), [
30299
30286
  p,
30300
30287
  a,
@@ -30303,7 +30290,7 @@ function uL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30303
30290
  return /* @__PURE__ */ L(Fv, {
30304
30291
  title: c.title,
30305
30292
  description: c.description,
30306
- overlay: v && s ? /* @__PURE__ */ L(lL, { onSubmit: s.setPassword }) : null,
30293
+ overlay: v && s ? /* @__PURE__ */ L(cL, { onSubmit: s.setPassword }) : null,
30307
30294
  children: [/* @__PURE__ */ L("div", {
30308
30295
  class: "relative",
30309
30296
  children: [r && /* @__PURE__ */ L(wv, {
@@ -30341,28 +30328,28 @@ function uL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30341
30328
  }
30342
30329
  //#endregion
30343
30330
  //#region ../core/src/hooks/use-haircheck-text.ts
30344
- function dL(...e) {
30331
+ function uL(...e) {
30345
30332
  for (let t of e) {
30346
30333
  let e = t?.trim();
30347
30334
  if (e) return e;
30348
30335
  }
30349
30336
  }
30350
- function fL() {
30337
+ function dL() {
30351
30338
  let { config: e } = sh(), { haircheck: t } = e.value.customization;
30352
30339
  return P(() => ({
30353
- prompt: dL(t.permission_request_description, t.permission_request_title),
30354
- ready: dL(t.permission_granted_description, t.permission_granted_title),
30355
- denied: dL(t.permission_denied_description, t.permission_denied_title),
30356
- join: dL(t.join_button),
30357
- cancel: dL(t.cancel_btn)
30340
+ prompt: uL(t.permission_request_description, t.permission_request_title),
30341
+ ready: uL(t.permission_granted_description, t.permission_granted_title),
30342
+ denied: uL(t.permission_denied_description, t.permission_denied_title),
30343
+ join: uL(t.join_button),
30344
+ cancel: uL(t.cancel_btn)
30358
30345
  }), [t]);
30359
30346
  }
30360
30347
  //#endregion
30361
30348
  //#region ../core/src/shells/flow-state-body.tsx
30362
- function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30363
- let r = fL();
30349
+ function fL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30350
+ let r = dL();
30364
30351
  switch (e.state) {
30365
- case "idle": return /* @__PURE__ */ L(uL, {
30352
+ case "idle": return /* @__PURE__ */ L(lL, {
30366
30353
  text: t,
30367
30354
  onStart: () => {
30368
30355
  e.start();
@@ -30370,7 +30357,7 @@ function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30370
30357
  isStarting: e.isStarting,
30371
30358
  permissionRequest: e.permissionRequest
30372
30359
  });
30373
- case "haircheck": return /* @__PURE__ */ L(iL, {
30360
+ case "haircheck": return /* @__PURE__ */ L(rL, {
30374
30361
  text: r,
30375
30362
  onJoin: () => {
30376
30363
  e.join();
@@ -30378,7 +30365,7 @@ function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30378
30365
  onCancel: () => e.cancel(),
30379
30366
  isJoining: e.isStarting
30380
30367
  });
30381
- case "call": return /* @__PURE__ */ L(tL, { onLeave: () => e.leave() });
30368
+ case "call": return /* @__PURE__ */ L(eL, { onLeave: () => e.leave() });
30382
30369
  case "ended": return /* @__PURE__ */ L(Uv, {
30383
30370
  isStarting: e.isStarting,
30384
30371
  permissionRequest: e.permissionRequest,
@@ -30403,7 +30390,7 @@ function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30403
30390
  }
30404
30391
  //#endregion
30405
30392
  //#region ../core/src/shells/embed/embed-shell.tsx
30406
- function mL() {
30393
+ function pL() {
30407
30394
  let { config: e, configError: t } = sh(), n = xv(), r = yv(), i = P(() => ({ fallback_button: n.start_button }), [n.start_button]), a = e.value.is_available, o = e.value.unavailable_reason;
30408
30395
  return /* @__PURE__ */ L(Og, { children: t.value ? /* @__PURE__ */ L(vv, {
30409
30396
  cause: "error",
@@ -30413,18 +30400,18 @@ function mL() {
30413
30400
  cause: o ?? "daily_limit",
30414
30401
  canRetry: !1,
30415
30402
  onRetry: () => {}
30416
- }) : /* @__PURE__ */ L(pL, {
30403
+ }) : /* @__PURE__ */ L(fL, {
30417
30404
  flow: r,
30418
30405
  welcomeText: i
30419
30406
  }) });
30420
30407
  }
30421
30408
  //#endregion
30422
30409
  //#region ../core/src/embed/tavus-embed.tsx
30423
- var hL = ":host {\n display: block;\n /* Containing block for the captcha overlay, which is owned by a provider\n above the shells and so has no positioned ancestor of its own. */\n position: relative;\n width: 100%;\n height: 100%;\n max-height: 100vh;\n overflow: hidden;\n background: transparent;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n}";
30424
- function gL(e) {
30410
+ var mL = ":host {\n display: block;\n /* Containing block for the captcha overlay, which is owned by a provider\n above the shells and so has no positioned ancestor of its own. */\n position: relative;\n width: 100%;\n height: 100%;\n max-height: 100vh;\n overflow: hidden;\n background: transparent;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n}";
30411
+ function hL(e) {
30425
30412
  return /* @__PURE__ */ L(E, { children: [
30426
30413
  /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: Pe } }),
30427
- /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: hL } }),
30414
+ /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: mL } }),
30428
30415
  /* @__PURE__ */ L(yt, {
30429
30416
  surface: "embed",
30430
30417
  layout: e.layout,
@@ -30439,14 +30426,14 @@ function gL(e) {
30439
30426
  token: e.token,
30440
30427
  children: /* @__PURE__ */ L(Dr, {
30441
30428
  fallback: /* @__PURE__ */ L(Eg, {}),
30442
- children: /* @__PURE__ */ L(kr, { children: /* @__PURE__ */ L(Rm, { children: /* @__PURE__ */ L(oh, { children: /* @__PURE__ */ L(kh, { children: /* @__PURE__ */ L(Ph, { children: /* @__PURE__ */ L(Ih, { children: /* @__PURE__ */ L(_g, { children: /* @__PURE__ */ L(mL, {}) }) }) }) }) }) }) })
30429
+ children: /* @__PURE__ */ L(kr, { children: /* @__PURE__ */ L(Rm, { children: /* @__PURE__ */ L(oh, { children: /* @__PURE__ */ L(kh, { children: /* @__PURE__ */ L(Ph, { children: /* @__PURE__ */ L(Ih, { children: /* @__PURE__ */ L(_g, { children: /* @__PURE__ */ L(pL, {}) }) }) }) }) }) }) })
30443
30430
  })
30444
30431
  })
30445
30432
  ] });
30446
30433
  }
30447
- var _L;
30448
- function vL() {
30449
- _L ||= Ee(gL, "tavus-embed", [
30434
+ var gL;
30435
+ function _L() {
30436
+ gL ||= Ee(hL, "tavus-embed", [
30450
30437
  "layout",
30451
30438
  "camera-on-start",
30452
30439
  "deployment-id",
@@ -30465,7 +30452,7 @@ function vL() {
30465
30452
  fn("Widget");
30466
30453
  //#endregion
30467
30454
  //#region src/integration.ts
30468
- var yL = [
30455
+ var vL = [
30469
30456
  "tavus:chat-message",
30470
30457
  "tavus:conversation-created",
30471
30458
  "tavus:conversation-ended",
@@ -30477,7 +30464,7 @@ var yL = [
30477
30464
  "tavus:ready",
30478
30465
  "tavus:state-change",
30479
30466
  "tavus:tool-call"
30480
- ], bL = class {
30467
+ ], yL = class {
30481
30468
  element = null;
30482
30469
  tagName;
30483
30470
  constructor(e = "tavus-embed") {
@@ -30528,6 +30515,6 @@ var yL = [
30528
30515
  };
30529
30516
  //#endregion
30530
30517
  //#region src/index.ts
30531
- typeof window < "u" && vL();
30518
+ typeof window < "u" && _L();
30532
30519
  //#endregion
30533
- export { yL as TAVUS_EVENT_NAMES, bL as TavusIntegration };
30520
+ export { vL as TAVUS_EVENT_NAMES, yL as TavusIntegration };