@tavus/widget 0.1.9 → 0.1.10

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
@@ -26960,13 +26960,17 @@ function SN({ label: e, value: t }) {
26960
26960
  }
26961
26961
  //#endregion
26962
26962
  //#region ../core/src/magic-canvas/magic-canvas.tsx
26963
- var CN = 1e3, wN = 5e3, TN = 1200, EN = 48, DN = "allow-scripts", ON = { "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms" };
26964
- function kN(e, t) {
26963
+ var CN = 1e3, wN = 5e3, TN = 1200, EN = 2e3;
26964
+ function DN(e) {
26965
+ return e.correct_answer === void 0 ? TN : EN;
26966
+ }
26967
+ var ON = 48, kN = "allow-scripts", AN = { "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms" };
26968
+ function jN(e, t) {
26965
26969
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
26966
26970
  let n = e.data;
26967
26971
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
26968
26972
  }
26969
- var AN = class {
26973
+ var MN = class {
26970
26974
  onmessage;
26971
26975
  onerror;
26972
26976
  onclose;
@@ -26977,7 +26981,7 @@ var AN = class {
26977
26981
  }
26978
26982
  start() {
26979
26983
  let e = (e) => {
26980
- kN(e, this.#e) && this.onmessage?.(e.data);
26984
+ jN(e, this.#e) && this.onmessage?.(e.data);
26981
26985
  };
26982
26986
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
26983
26987
  }
@@ -26988,12 +26992,12 @@ var AN = class {
26988
26992
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
26989
26993
  }
26990
26994
  };
26991
- function jN(e) {
26992
- for (let t of jx) if (e.some((e) => KN(e) === t)) return t;
26995
+ function NN(e) {
26996
+ for (let t of jx) if (e.some((e) => JN(e) === t)) return t;
26993
26997
  return null;
26994
26998
  }
26995
- function MN({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = qN() } = {}) {
26996
- let { client: r } = ev(), { dataTheme: i, cssVars: a } = yN(), o = ph(), s = Bg(), [c, l] = w([]), [u, d] = VN(), [f, p] = w(() => ({
26999
+ function PN({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = YN() } = {}) {
27000
+ let { client: r } = ev(), { dataTheme: i, cssVars: a } = yN(), o = ph(), s = Bg(), [c, l] = w([]), [u, d] = UN(), [f, p] = w(() => ({
26997
27001
  enabled: n,
26998
27002
  iframeLifecycleState: "idle"
26999
27003
  })), m = O((e) => {
@@ -27041,7 +27045,7 @@ function MN({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
27041
27045
  } catch (e) {
27042
27046
  m({
27043
27047
  iframeLifecycleState: "error",
27044
- lastError: XN(e).message
27048
+ lastError: QN(e).message
27045
27049
  });
27046
27050
  }
27047
27051
  }, [s, m]) });
@@ -27062,7 +27066,7 @@ function MN({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
27062
27066
  v.safe_area?.width,
27063
27067
  v.safe_area?.height
27064
27068
  ]);
27065
- let b = jN(_.map(({ layout: e }) => e));
27069
+ let b = NN(_.map(({ layout: e }) => e));
27066
27070
  T(() => {
27067
27071
  t?.(b);
27068
27072
  }, [t, b]);
@@ -27074,12 +27078,12 @@ function MN({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
27074
27078
  children: [
27075
27079
  x && y && /* @__PURE__ */ k("div", { class: "absolute inset-0 bg-black/45" }),
27076
27080
  x && jx.map((e) => {
27077
- let t = _.filter(({ layout: t }) => KN(t) === e);
27078
- return t.length === 0 ? null : /* @__PURE__ */ k(PN, {
27081
+ let t = _.filter(({ layout: t }) => JN(t) === e);
27082
+ return t.length === 0 ? null : /* @__PURE__ */ k(IN, {
27079
27083
  slot: e,
27080
27084
  safeAreaTop: v.safe_area?.y,
27081
27085
  frameWidth: d.width,
27082
- children: (e) => t.map(({ instance: t, layout: n }) => /* @__PURE__ */ k(FN, {
27086
+ children: (e) => t.map(({ instance: t, layout: n }) => /* @__PURE__ */ k(LN, {
27083
27087
  availableHeight: e,
27084
27088
  client: r,
27085
27089
  hostTheme: g,
@@ -27110,17 +27114,17 @@ function MN({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
27110
27114
  ]
27111
27115
  });
27112
27116
  }
27113
- var NN = 16;
27114
- function PN({ slot: e, safeAreaTop: t, frameWidth: n, children: r }) {
27115
- let [i, a] = HN(), o = r(e === "full" ? void 0 : a);
27117
+ var FN = 16;
27118
+ function IN({ slot: e, safeAreaTop: t, frameWidth: n, children: r }) {
27119
+ let [i, a] = WN(), o = r(e === "full" ? void 0 : a);
27116
27120
  if (e === "safe-area-left" || e === "safe-area-right") {
27117
- let r = t == null ? "1rem" : `${t * 100}%`, a = n != null && n > 0 ? Math.max(0, n - NN * 2) : void 0;
27121
+ let r = t == null ? "1rem" : `${t * 100}%`, a = n != null && n > 0 ? Math.max(0, n - FN * 2) : void 0;
27118
27122
  return /* @__PURE__ */ k("div", {
27119
27123
  ref: i,
27120
- class: GN(e),
27124
+ class: qN(e),
27121
27125
  style: {
27122
27126
  top: r,
27123
- bottom: `${WN}px`,
27127
+ bottom: `${KN}px`,
27124
27128
  maxWidth: a
27125
27129
  },
27126
27130
  "data-canvas-slot": e,
@@ -27132,23 +27136,23 @@ function PN({ slot: e, safeAreaTop: t, frameWidth: n, children: r }) {
27132
27136
  }
27133
27137
  return /* @__PURE__ */ k("div", {
27134
27138
  ref: i,
27135
- class: GN(e),
27139
+ class: qN(e),
27136
27140
  "data-canvas-slot": e,
27137
27141
  children: o
27138
27142
  });
27139
27143
  }
27140
- function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout: i, dimmed: a, onDebug: o, onComplete: s, onDisplayModeChange: c, sendAppMessage: l }) {
27144
+ function LN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout: i, dimmed: a, onDebug: o, onComplete: s, onDisplayModeChange: c, sendAppMessage: l }) {
27141
27145
  let u = E(null), d = E(null), f = E(e), p = E(320), m = E(n), h = E(r), g = E(i), _ = E(-1), v = E(s), y = E(c), b = E(l), [x, S] = w(320);
27142
27146
  T(() => {
27143
27147
  h.current = r;
27144
27148
  }, [r]), T(() => {
27145
- p.current = x, d.current?.setHostContext(zN(h.current, m.current, g.current, f.current, x));
27149
+ p.current = x, d.current?.setHostContext(VN(h.current, m.current, g.current, f.current, x));
27146
27150
  }, [x]), T(() => {
27147
27151
  f.current = e;
27148
- let t = RN(n, u.current);
27149
- m.current = t, d.current?.setHostContext(zN(h.current, t, g.current, e, p.current));
27152
+ let t = BN(n, u.current);
27153
+ m.current = t, d.current?.setHostContext(VN(h.current, t, g.current, e, p.current));
27150
27154
  }, [e, n]), T(() => {
27151
- g.current = i, d.current?.setHostContext(zN(h.current, m.current, i, e, p.current));
27155
+ g.current = i, d.current?.setHostContext(VN(h.current, m.current, i, e, p.current));
27152
27156
  }, [e, i]), T(() => {
27153
27157
  v.current = s, y.current = c, b.current = l;
27154
27158
  }, [
@@ -27161,7 +27165,7 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27161
27165
  let n = !1, i = null, a = null, s = null, c = null, l = new URL(r.canvas_config.sandbox_url, globalThis.location.href).href, x = (e) => {
27162
27166
  n || o({
27163
27167
  iframeLifecycleState: "error",
27164
- lastError: XN(e).message
27168
+ lastError: QN(e).message
27165
27169
  });
27166
27170
  }, C = () => {
27167
27171
  if (n || !a) return;
@@ -27195,11 +27199,11 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27195
27199
  text: {},
27196
27200
  structuredContent: {}
27197
27201
  }
27198
- }, { hostContext: zN(r, RN(m.current, e), g.current, f.current, p.current) });
27202
+ }, { hostContext: VN(r, BN(m.current, e), g.current, f.current, p.current) });
27199
27203
  i = u, d.current = u, u.oninitialized = () => {
27200
27204
  n || (o({ iframeLifecycleState: "ready" }), _.current = h.current.revision, u.sendToolInput({ arguments: h.current.arguments }).catch(x));
27201
27205
  }, u.onsizechange = ({ height: e }) => {
27202
- !n && typeof e == "number" && Number.isFinite(e) && S(Math.min(Math.max(e, EN), 720));
27206
+ !n && typeof e == "number" && Number.isFinite(e) && S(Math.min(Math.max(e, ON), 720));
27203
27207
  }, u.onmessage = async (e) => {
27204
27208
  let r = Wx(e), i = qx(e);
27205
27209
  if (!r) {
@@ -27234,9 +27238,9 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27234
27238
  lastError: void 0
27235
27239
  }), Kx(a) && (a.type === "submit" ? (c && clearTimeout(c), c = setTimeout(() => {
27236
27240
  c = null, n || v.current();
27237
- }, TN)) : v.current());
27241
+ }, DN(e.arguments))) : v.current());
27238
27242
  } catch (e) {
27239
- let t = XN(e).message;
27243
+ let t = QN(e).message;
27240
27244
  return o({
27241
27245
  lastInteractionPostResult: "error",
27242
27246
  lastError: t
@@ -27255,8 +27259,8 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27255
27259
  ...g.current,
27256
27260
  display_mode: t,
27257
27261
  viable_slot: t === "fullscreen" ? "full" : g.current.viable_slot
27258
- }, u.setHostContext(zN(h.current, m.current, g.current, f.current, p.current)), { mode: t };
27259
- }, u.connect(new AN(e)).then(() => void 0).catch(x);
27262
+ }, u.setHostContext(VN(h.current, m.current, g.current, f.current, p.current)), { mode: t };
27263
+ }, u.connect(new MN(e)).then(() => void 0).catch(x);
27260
27264
  };
27261
27265
  o({
27262
27266
  iframeLifecycleState: "mounting",
@@ -27277,7 +27281,7 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27277
27281
  r.revision !== 0 && (r.revision <= _.current || (_.current = r.revision, d.current?.sendToolInput({ arguments: r.arguments }).catch((e) => {
27278
27282
  o({
27279
27283
  iframeLifecycleState: "error",
27280
- lastError: XN(e).message
27284
+ lastError: QN(e).message
27281
27285
  });
27282
27286
  })));
27283
27287
  }, [
@@ -27285,11 +27289,11 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27285
27289
  r.revision,
27286
27290
  o
27287
27291
  ]);
27288
- let C = i.viable_slot === "full" || i.display_mode === "fullscreen", ee = C ? null : BN(x, e), te = ee?.placeholderStyle, ne = ee?.cardStyle, re = C ? { height: "100%" } : ee?.iframeStyle ?? { height: `${x}px` }, ie = [
27292
+ let C = i.viable_slot === "full" || i.display_mode === "fullscreen", ee = C ? null : HN(x, e), te = ee?.placeholderStyle, ne = ee?.cardStyle, re = C ? { height: "100%" } : ee?.iframeStyle ?? { height: `${x}px` }, ie = [
27289
27293
  "pointer-events-auto w-full overflow-hidden rounded-lg border border-base-300 bg-base-100 shadow-xl transition-[opacity,transform]",
27290
27294
  C ? "fixed inset-4 z-10 max-w-none" : "max-w-md",
27291
27295
  a ? "scale-[0.98] opacity-40" : ""
27292
- ].filter(Boolean).join(" "), ae = ON[r.canvas_config.component] ?? DN, oe = /* @__PURE__ */ k("div", {
27296
+ ].filter(Boolean).join(" "), ae = AN[r.canvas_config.component] ?? kN, oe = /* @__PURE__ */ k("div", {
27293
27297
  class: ie,
27294
27298
  style: ne,
27295
27299
  "data-canvas-card": i.viable_slot,
@@ -27307,7 +27311,7 @@ function FN({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
27307
27311
  children: oe
27308
27312
  });
27309
27313
  }
27310
- var IN = [
27314
+ var RN = [
27311
27315
  "--color-base-100",
27312
27316
  "--color-base-200",
27313
27317
  "--color-base-300",
@@ -27315,17 +27319,17 @@ var IN = [
27315
27319
  "--color-primary",
27316
27320
  "--color-error"
27317
27321
  ];
27318
- function LN(e) {
27322
+ function zN(e) {
27319
27323
  if (!e || typeof getComputedStyle != "function") return {};
27320
27324
  let t = getComputedStyle(e), n = {};
27321
- for (let e of IN) {
27325
+ for (let e of RN) {
27322
27326
  let r = t.getPropertyValue(e).trim();
27323
27327
  r && (n[e] = r);
27324
27328
  }
27325
27329
  return n;
27326
27330
  }
27327
- function RN(e, t) {
27328
- let n = LN(t);
27331
+ function BN(e, t) {
27332
+ let n = zN(t);
27329
27333
  return Object.keys(n).length === 0 ? e : {
27330
27334
  ...e,
27331
27335
  cssVars: {
@@ -27334,19 +27338,19 @@ function RN(e, t) {
27334
27338
  }
27335
27339
  };
27336
27340
  }
27337
- function zN(e, t, n, r, i) {
27338
- let a = ES(t, n), o = n.viable_slot === "full" || n.display_mode === "fullscreen", s = o ? void 0 : JN(r), c = o ? 1 : BN(i ?? 0, r)?.displayScale ?? 1;
27341
+ function VN(e, t, n, r, i) {
27342
+ let a = ES(t, n), o = n.viable_slot === "full" || n.display_mode === "fullscreen", s = o ? void 0 : XN(r), c = o ? 1 : HN(i ?? 0, r)?.displayScale ?? 1;
27339
27343
  return {
27340
27344
  ...e.canvas_config.host_context,
27341
27345
  ...a,
27342
27346
  containerDimensions: {
27343
- ...YN(a.containerDimensions) ? a.containerDimensions : {},
27347
+ ...ZN(a.containerDimensions) ? a.containerDimensions : {},
27344
27348
  ...s === void 0 ? {} : { maxHeight: s },
27345
27349
  displayScale: c
27346
27350
  }
27347
27351
  };
27348
27352
  }
27349
- function BN(e, t) {
27353
+ function HN(e, t) {
27350
27354
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
27351
27355
  let n = Math.min(e, 720);
27352
27356
  if (n <= t) return {
@@ -27385,11 +27389,11 @@ function BN(e, t) {
27385
27389
  }
27386
27390
  };
27387
27391
  }
27388
- function VN() {
27389
- let e = E(null), [t, n] = w(() => UN(null));
27392
+ function UN() {
27393
+ let e = E(null), [t, n] = w(() => GN(null));
27390
27394
  return T(() => {
27391
27395
  let t = () => n((t) => {
27392
- let n = UN(e.current);
27396
+ let n = GN(e.current);
27393
27397
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
27394
27398
  });
27395
27399
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -27399,7 +27403,7 @@ function VN() {
27399
27403
  };
27400
27404
  }, []), [e, t];
27401
27405
  }
27402
- function HN() {
27406
+ function WN() {
27403
27407
  let e = E(null), [t, n] = w();
27404
27408
  return T(() => {
27405
27409
  let t = e.current;
@@ -27415,7 +27419,7 @@ function HN() {
27415
27419
  return a.observe(t), () => a.disconnect();
27416
27420
  }, []), [e, t];
27417
27421
  }
27418
- function UN(e) {
27422
+ function GN(e) {
27419
27423
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
27420
27424
  if (n && n.width > 0 && n.height > 0) {
27421
27425
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -27431,8 +27435,8 @@ function UN(e) {
27431
27435
  visualViewportHeight: t
27432
27436
  };
27433
27437
  }
27434
- var WN = 72;
27435
- function GN(e) {
27438
+ var KN = 72;
27439
+ function qN(e) {
27436
27440
  let t = "absolute flex gap-2";
27437
27441
  switch (e) {
27438
27442
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto`;
@@ -27441,25 +27445,25 @@ function GN(e) {
27441
27445
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
27442
27446
  }
27443
27447
  }
27444
- function KN(e) {
27448
+ function JN(e) {
27445
27449
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
27446
27450
  }
27447
- function qN() {
27451
+ function YN() {
27448
27452
  return !1;
27449
27453
  }
27450
- function JN(e) {
27454
+ function XN(e) {
27451
27455
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
27452
27456
  }
27453
- function YN(e) {
27457
+ function ZN(e) {
27454
27458
  return typeof e == "object" && !!e && !Array.isArray(e);
27455
27459
  }
27456
- function XN(e) {
27460
+ function QN(e) {
27457
27461
  return e instanceof Error ? e : Error(String(e));
27458
27462
  }
27459
27463
  //#endregion
27460
27464
  //#region ../core/src/hooks/use-replica-join-timeout.ts
27461
- var ZN = 1e4;
27462
- function QN({ onTimeout: e, timeoutMs: t = ZN, active: n = !0 }) {
27465
+ var $N = 1e4;
27466
+ function eP({ onTimeout: e, timeoutMs: t = $N, active: n = !0 }) {
27463
27467
  let r = mx().length > 0, [i, a] = w(!1), o = E(e);
27464
27468
  return T(() => {
27465
27469
  o.current = e;
@@ -27483,22 +27487,22 @@ function QN({ onTimeout: e, timeoutMs: t = ZN, active: n = !0 }) {
27483
27487
  }
27484
27488
  //#endregion
27485
27489
  //#region ../core/src/hooks/use-system-shutdown.ts
27486
- function $N(e) {
27490
+ function tP(e) {
27487
27491
  if (typeof e != "object" || !e) return !1;
27488
27492
  let t = e;
27489
27493
  return t.message_type === "system" && t.event_type === "system.shutdown";
27490
27494
  }
27491
- function eP({ onShutdown: e }) {
27495
+ function nP({ onShutdown: e }) {
27492
27496
  let t = E(e);
27493
27497
  T(() => {
27494
27498
  t.current = e;
27495
27499
  }, [e]), Qg({ onAppMessage: O((e) => {
27496
- $N(e?.data) && t.current();
27500
+ tP(e?.data) && t.current();
27497
27501
  }, []) });
27498
27502
  }
27499
27503
  //#endregion
27500
27504
  //#region ../core/src/hooks/use-cvi-call.ts
27501
- function tP() {
27505
+ function rP() {
27502
27506
  let e = ph();
27503
27507
  return {
27504
27508
  joinCall: O(({ url: t, micOnly: n = !1 }) => {
@@ -27514,24 +27518,24 @@ function tP() {
27514
27518
  }
27515
27519
  //#endregion
27516
27520
  //#region ../core/src/hooks/use-picture-in-picture.ts
27517
- var nP = bn("PiP"), rP = 360, iP = 280;
27518
- function aP() {
27521
+ var iP = bn("PiP"), aP = 360, oP = 280;
27522
+ function sP() {
27519
27523
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
27520
27524
  }
27521
- function oP(e) {
27522
- let { enabled: t, active: n } = e, [r, i] = w(null), a = aP(), o = mt(Cv), s = O(() => {
27525
+ function cP(e) {
27526
+ let { enabled: t, active: n } = e, [r, i] = w(null), a = sP(), o = mt(Cv), s = O(() => {
27523
27527
  i((e) => (e && !e.closed && e.close(), null));
27524
27528
  }, []), c = O(async () => {
27525
27529
  if (a && !(!t || !n) && !(r && !r.closed)) try {
27526
27530
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
27527
- width: rP,
27528
- height: iP
27531
+ width: aP,
27532
+ height: oP
27529
27533
  }), t = Xe.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
27530
27534
  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", () => {
27531
27535
  i((t) => t === e ? null : t);
27532
27536
  }, { once: !0 }), i(e);
27533
27537
  } catch (e) {
27534
- nP.warn("Failed to open PiP window", e);
27538
+ iP.warn("Failed to open PiP window", e);
27535
27539
  }
27536
27540
  }, [
27537
27541
  a,
@@ -27552,13 +27556,13 @@ function oP(e) {
27552
27556
  try {
27553
27557
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
27554
27558
  } catch (e) {
27555
- nP.warn("mediaSession metadata setup failed", e);
27559
+ iP.warn("mediaSession metadata setup failed", e);
27556
27560
  }
27557
27561
  let t = (t, n) => {
27558
27562
  try {
27559
27563
  e.setActionHandler(t, n), r.push(t);
27560
27564
  } catch (e) {
27561
- nP.warn(`mediaSession.${t} not supported`, e);
27565
+ iP.warn(`mediaSession.${t} not supported`, e);
27562
27566
  }
27563
27567
  };
27564
27568
  t("enterpictureinpicture", () => {
@@ -27612,11 +27616,11 @@ function oP(e) {
27612
27616
  }
27613
27617
  //#endregion
27614
27618
  //#region ../core/src/utils/device-preferences.ts
27615
- var sP = Gt(null), cP = {
27619
+ var lP = Gt(null), uP = {
27616
27620
  active: !1,
27617
27621
  video_shift_x: 0,
27618
27622
  backdrop: { type: "snapshot_mirror" }
27619
- }, lP = ya(({ id: e, showAudioWave: t = !0 }) => {
27623
+ }, dP = ya(({ id: e, showAudioWave: t = !0 }) => {
27620
27624
  let n = d_(e).isOff;
27621
27625
  return /* @__PURE__ */ k("div", {
27622
27626
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -27631,16 +27635,16 @@ var sP = Gt(null), cP = {
27631
27635
  children: /* @__PURE__ */ k(sx, { id: e })
27632
27636
  })]
27633
27637
  });
27634
- }), uP = ya(() => {
27638
+ }), fP = ya(() => {
27635
27639
  let e = Zh(), { isScreenSharing: t } = hb(), n = mx()[0];
27636
- return /* @__PURE__ */ k(de, { children: [t && n && /* @__PURE__ */ k(lP, { id: n }), e && /* @__PURE__ */ k(lP, {
27640
+ return /* @__PURE__ */ k(de, { children: [t && n && /* @__PURE__ */ k(dP, { id: n }), e && /* @__PURE__ */ k(dP, {
27637
27641
  id: e,
27638
27642
  showAudioWave: !1
27639
27643
  })] });
27640
- }), dP = ya(() => /* @__PURE__ */ k("div", {
27644
+ }), pP = ya(() => /* @__PURE__ */ k("div", {
27641
27645
  class: "absolute top-4 left-4 flex flex-col items-end gap-2 z-20",
27642
- children: /* @__PURE__ */ k(uP, {})
27643
- })), fP = ya(({ isAudioOnly: e, canvasLayoutEffect: t, canvasRenderedSlot: n }) => {
27646
+ children: /* @__PURE__ */ k(fP, {})
27647
+ })), mP = ya(({ isAudioOnly: e, canvasLayoutEffect: t, canvasRenderedSlot: n }) => {
27644
27648
  let r = Zh(), i = !l_(r ?? "").isOff, a = hx(e), o = l_(a.phase === "ready" ? a.replicaId : ""), s = !i && (o.state === "playable" || o.state === "loading"), c = t.active && !i && (!e || s);
27645
27649
  return a.phase === "left" ? /* @__PURE__ */ k(ax, {}) : a.phase === "connecting" ? /* @__PURE__ */ k(ix, {}) : e && !s ? /* @__PURE__ */ k("div", {
27646
27650
  class: "absolute inset-0 flex items-center justify-center",
@@ -27651,7 +27655,7 @@ var sP = Gt(null), cP = {
27651
27655
  avatarOff: a.videoState.isOff,
27652
27656
  canvasLayoutEffect: t,
27653
27657
  smartSidecarActive: c
27654
- }) : /* @__PURE__ */ k(pP, {
27658
+ }) : /* @__PURE__ */ k(hP, {
27655
27659
  personaSessionId: a.replicaId,
27656
27660
  localId: r,
27657
27661
  isScreenSharing: i,
@@ -27660,11 +27664,11 @@ var sP = Gt(null), cP = {
27660
27664
  canvasLayoutEffect: t,
27661
27665
  canvasRenderedSlot: n
27662
27666
  }), /* @__PURE__ */ k(lg, { sessionId: a.replicaId })] });
27663
- }), pP = ya(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ k(rC, {
27667
+ }), hP = ya(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ k(rC, {
27664
27668
  canvasLayoutEffect: a,
27665
27669
  smartSidecarActive: i,
27666
27670
  isScreenSharing: n,
27667
- captureSnapshot: _P,
27671
+ captureSnapshot: yP,
27668
27672
  personaMode: "auto",
27669
27673
  renderedSlot: o,
27670
27674
  fill: (i) => /* @__PURE__ */ k(yx, {
@@ -27674,7 +27678,7 @@ var sP = Gt(null), cP = {
27674
27678
  avatarOff: r,
27675
27679
  videoRef: i
27676
27680
  })
27677
- })), mP = ya(({ items: e }) => {
27681
+ })), gP = ya(({ items: e }) => {
27678
27682
  let [t, n] = w(!1), r = E(null);
27679
27683
  return T(() => {
27680
27684
  if (!t) return;
@@ -27704,8 +27708,8 @@ var sP = Gt(null), cP = {
27704
27708
  children: e
27705
27709
  })]
27706
27710
  });
27707
- }), hP = ya(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ k(de, { children: e }) : /* @__PURE__ */ k(mP, { items: e })), gP = ya(({ onLeave: e }) => {
27708
- let { joinCall: t, leaveCall: n } = tP(), r = Bg(), { config: i } = ev(), { session: a, end: o } = Gb(), s = Zh(), c = E(null), l = mt(Nv)?.frameRef ?? c, [u, d] = w(!1), [f, p] = w(!1), [m, h] = w(cP), [g, _] = w(null), v = a.value?.conversationUrl, y = i.value.customization.conversation, b = y.modality === "audio", x = y.enable_chat, S = y.enable_closed_captions, C = y.enable_picture_in_picture, { pipWindow: ee } = oP({
27711
+ }), _P = ya(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ k(de, { children: e }) : /* @__PURE__ */ k(gP, { items: e })), vP = ya(({ onLeave: e }) => {
27712
+ let { joinCall: t, leaveCall: n } = rP(), r = Bg(), { config: i } = ev(), { session: a, end: o } = Gb(), s = Zh(), c = E(null), l = mt(Nv)?.frameRef ?? c, [u, d] = w(!1), [f, p] = w(!1), [m, h] = w(uP), [g, _] = w(null), v = a.value?.conversationUrl, y = i.value.customization.conversation, b = y.modality === "audio", x = y.enable_chat, S = y.enable_closed_captions, C = y.enable_picture_in_picture, { pipWindow: ee } = cP({
27709
27713
  enabled: C,
27710
27714
  active: r === "joined-meeting"
27711
27715
  });
@@ -27717,13 +27721,13 @@ var sP = Gt(null), cP = {
27717
27721
  }), []);
27718
27722
  let { camera: te, requestCamera: ne } = bb(), { isCamMuted: re } = pb(), ie = te.isGranted && !re;
27719
27723
  T(() => {
27720
- !b && r === "joined-meeting" && (sP.value = ie);
27724
+ !b && r === "joined-meeting" && (lP.value = ie);
27721
27725
  }, [
27722
27726
  b,
27723
27727
  r,
27724
27728
  ie
27725
27729
  ]);
27726
- let ae = E(!b && !s && sP.value === !0);
27730
+ let ae = E(!b && !s && lP.value === !0);
27727
27731
  T(() => {
27728
27732
  r === "joined-meeting" && ae.current && (ae.current = !1, ne());
27729
27733
  }, [r, ne]), T(() => {
@@ -27747,10 +27751,10 @@ var sP = Gt(null), cP = {
27747
27751
  let se = O(() => {
27748
27752
  o(), n();
27749
27753
  }, [o]);
27750
- if (QN({
27754
+ if (eP({
27751
27755
  active: r === "joined-meeting",
27752
27756
  onTimeout: se
27753
- }), eP({ onShutdown: se }), !v) return null;
27757
+ }), nP({ onShutdown: se }), !v) return null;
27754
27758
  let ce = [/* @__PURE__ */ k(Wb, { compact: !0 }, "screen-share")];
27755
27759
  x && ce.push(/* @__PURE__ */ k(ex, { compact: !0 }, "chat"));
27756
27760
  let le = r === "left-meeting";
@@ -27760,14 +27764,14 @@ var sP = Gt(null), cP = {
27760
27764
  /* @__PURE__ */ k("div", {
27761
27765
  class: "relative w-full h-full z-[5]",
27762
27766
  children: [
27763
- /* @__PURE__ */ k(fP, {
27767
+ /* @__PURE__ */ k(mP, {
27764
27768
  isAudioOnly: b,
27765
27769
  canvasLayoutEffect: m,
27766
27770
  canvasRenderedSlot: g
27767
27771
  }),
27768
- !b && /* @__PURE__ */ k(dP, {}),
27772
+ !b && /* @__PURE__ */ k(pP, {}),
27769
27773
  /* @__PURE__ */ k(Xb, {}),
27770
- /* @__PURE__ */ k(MN, {
27774
+ /* @__PURE__ */ k(PN, {
27771
27775
  debugEnabled: f,
27772
27776
  onLayoutEffectChange: h,
27773
27777
  onRenderedSlotChange: _
@@ -27795,7 +27799,7 @@ var sP = Gt(null), cP = {
27795
27799
  /* @__PURE__ */ k(zb, { level: !0 }),
27796
27800
  !b && /* @__PURE__ */ k(Vb, {}),
27797
27801
  S && /* @__PURE__ */ k(Yb, {}),
27798
- /* @__PURE__ */ k(hP, { items: ce }),
27802
+ /* @__PURE__ */ k(_P, { items: ce }),
27799
27803
  /* @__PURE__ */ k("button", {
27800
27804
  type: "button",
27801
27805
  class: "btn btn-control btn-error",
@@ -27812,7 +27816,7 @@ var sP = Gt(null), cP = {
27812
27816
  ]
27813
27817
  }), ee && Ia(/* @__PURE__ */ k(_x, { onLeave: se }), ee.document.body)] }) }) });
27814
27818
  });
27815
- function _P(e) {
27819
+ function yP(e) {
27816
27820
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
27817
27821
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
27818
27822
  t.width = 640, t.height = n;
@@ -27827,7 +27831,7 @@ function _P(e) {
27827
27831
  }
27828
27832
  //#endregion
27829
27833
  //#region ../core/src/components/ui/loading-button.tsx
27830
- function vP({ loading: e = !1, disabled: t, class: n, children: r, ...i }) {
27834
+ function bP({ loading: e = !1, disabled: t, class: n, children: r, ...i }) {
27831
27835
  return /* @__PURE__ */ k("button", {
27832
27836
  type: "button",
27833
27837
  class: `btn relative ${n ? ` ${n}` : ""}`,
@@ -27843,7 +27847,7 @@ function vP({ loading: e = !1, disabled: t, class: n, children: r, ...i }) {
27843
27847
  }
27844
27848
  //#endregion
27845
27849
  //#region ../core/src/components/hair-check/index.tsx
27846
- function yP(e, t, n) {
27850
+ function xP(e, t, n) {
27847
27851
  switch (t) {
27848
27852
  case "granted": return n ? e?.cameraOptional ?? "Camera is optional — turn it on anytime." : e?.ready ?? "You're all set — join whenever you're ready.";
27849
27853
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -27854,7 +27858,7 @@ function yP(e, t, n) {
27854
27858
  default: return e?.loading ?? "Getting your microphone ready...";
27855
27859
  }
27856
27860
  }
27857
- function bP({ message: e }) {
27861
+ function SP({ message: e }) {
27858
27862
  return /* @__PURE__ */ k("div", {
27859
27863
  class: "relative max-w-[min(20rem,90%)]",
27860
27864
  children: [/* @__PURE__ */ k("div", {
@@ -27875,7 +27879,7 @@ function bP({ message: e }) {
27875
27879
  })]
27876
27880
  });
27877
27881
  }
27878
- var xP = ya(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27882
+ var CP = ya(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27879
27883
  let i = ph(), { config: a } = ev(), { localSessionId: o, isCamMuted: s } = pb(), { mic: c, camera: l, requestMic: u, requestCamera: d } = bb(), f = a.value.customization.conversation.modality === "video";
27880
27884
  T(() => {
27881
27885
  u();
@@ -27890,7 +27894,7 @@ var xP = ya(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27890
27894
  l.isBlocked,
27891
27895
  d
27892
27896
  ]);
27893
- let h = f && p && !l.isGranted, g = yP(e, c.status, h);
27897
+ let h = f && p && !l.isGranted, g = xP(e, c.status, h);
27894
27898
  return /* @__PURE__ */ k(Db, { children: /* @__PURE__ */ k("div", {
27895
27899
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
27896
27900
  children: [l.isGranted && !s ? /* @__PURE__ */ k("div", {
@@ -27911,14 +27915,14 @@ var xP = ya(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27911
27915
  })
27912
27916
  }), /* @__PURE__ */ k("div", {
27913
27917
  class: "absolute bottom-6 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[90%]",
27914
- children: [g && /* @__PURE__ */ k(bP, { message: g }), /* @__PURE__ */ k("div", {
27918
+ children: [g && /* @__PURE__ */ k(SP, { message: g }), /* @__PURE__ */ k("div", {
27915
27919
  class: "flex flex-wrap items-center justify-center gap-1.5 @max-mobile:gap-1",
27916
27920
  children: [
27917
27921
  /* @__PURE__ */ k("div", {
27918
27922
  class: "flex items-center justify-center gap-1.5 shrink-0 @max-mobile:gap-1",
27919
27923
  children: [/* @__PURE__ */ k(zb, { level: !0 }), f && /* @__PURE__ */ k(Vb, {})]
27920
27924
  }),
27921
- /* @__PURE__ */ k(vP, {
27925
+ /* @__PURE__ */ k(bP, {
27922
27926
  class: "btn-accent ",
27923
27927
  loading: t,
27924
27928
  disabled: !p,
@@ -27937,8 +27941,8 @@ var xP = ya(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27937
27941
  })]
27938
27942
  })]
27939
27943
  }) });
27940
- }), SP = "Password required", CP = "Enter the password to start this conversation.", wP = "Password", TP = "Continue";
27941
- function EP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27944
+ }), wP = "Password required", TP = "Enter the password to start this conversation.", EP = "Password", DP = "Continue";
27945
+ function OP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27942
27946
  let [i, a] = w(""), o = gt();
27943
27947
  return /* @__PURE__ */ k("div", {
27944
27948
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -27958,18 +27962,18 @@ function EP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27958
27962
  /* @__PURE__ */ k("h3", {
27959
27963
  id: `${o}-title`,
27960
27964
  class: "card-title text-base-content",
27961
- children: t?.title ?? SP
27965
+ children: t?.title ?? wP
27962
27966
  }),
27963
27967
  /* @__PURE__ */ k("p", {
27964
27968
  class: "text-sm text-base-content/70",
27965
- children: t?.description ?? CP
27969
+ children: t?.description ?? TP
27966
27970
  }),
27967
27971
  /* @__PURE__ */ k("input", {
27968
27972
  id: o,
27969
27973
  type: "password",
27970
27974
  autocomplete: "current-password",
27971
27975
  class: "input input-bordered w-full",
27972
- placeholder: t?.placeholder ?? wP,
27976
+ placeholder: t?.placeholder ?? EP,
27973
27977
  value: i,
27974
27978
  disabled: n,
27975
27979
  onInput: (e) => a(e.target.value),
@@ -27980,12 +27984,12 @@ function EP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27980
27984
  role: "alert",
27981
27985
  children: r
27982
27986
  }),
27983
- /* @__PURE__ */ k(vP, {
27987
+ /* @__PURE__ */ k(bP, {
27984
27988
  class: "btn-primary",
27985
27989
  type: "submit",
27986
27990
  disabled: !i.trim(),
27987
27991
  loading: n,
27988
- children: t?.submit ?? TP
27992
+ children: t?.submit ?? DP
27989
27993
  })
27990
27994
  ]
27991
27995
  })
@@ -27994,35 +27998,35 @@ function EP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27994
27998
  }
27995
27999
  //#endregion
27996
28000
  //#region ../core/src/components/captcha-challenge/index.tsx
27997
- var DP = bn("CaptchaChallenge"), OP = 1;
27998
- function kP(e) {
28001
+ var kP = bn("CaptchaChallenge"), AP = 1;
28002
+ function jP(e) {
27999
28003
  return typeof e == "object" && !!e && e.source === "tavus-captcha" && typeof e.type == "string";
28000
28004
  }
28001
- function AP(e, t, n, r, i) {
28005
+ function MP(e, t, n, r, i) {
28002
28006
  return `${e.replace(/\/+$/, "")}${t.startsWith("/") ? t : `/${t}`}?deployment_uuid=${encodeURIComponent(n)}&action=${encodeURIComponent(r)}&parent_origin=${encodeURIComponent(i)}`;
28003
28007
  }
28004
- function jP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
28005
- let i = (mt(Tt).baseUrl ?? "https://tavusapi.com").replace(/\/+$/, ""), a = new URL(i).origin, [o, s] = w(0), [c, l] = w(0), [u, d] = w(!1), [f, p] = w(!1), m = AP(i, e.challenge_path, t, e.action, window.location.origin), h = O(() => {
28008
+ function NP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
28009
+ let i = (mt(Tt).baseUrl ?? "https://tavusapi.com").replace(/\/+$/, ""), a = new URL(i).origin, [o, s] = w(0), [c, l] = w(0), [u, d] = w(!1), [f, p] = w(!1), m = MP(i, e.challenge_path, t, e.action, window.location.origin), h = O(() => {
28006
28010
  p(!1), s((e) => e + 1);
28007
28011
  }, []);
28008
28012
  return T(() => {
28009
28013
  function e(e) {
28010
28014
  if (u || e.origin !== a) return;
28011
28015
  let i = e.data;
28012
- if (kP(i) && i.deployment_uuid === t) {
28016
+ if (jP(i) && i.deployment_uuid === t) {
28013
28017
  if (i.type === "interactive") {
28014
28018
  p(!0);
28015
28019
  return;
28016
28020
  }
28017
28021
  if (i.type === "token" && i.token) {
28018
- DP.info("Captcha token received"), p(!1), n(i.token);
28022
+ kP.info("Captcha token received"), p(!1), n(i.token);
28019
28023
  return;
28020
28024
  }
28021
28025
  if (i.type === "expired") {
28022
- DP.info("Captcha token expired, reloading iframe"), h();
28026
+ kP.info("Captcha token expired, reloading iframe"), h();
28023
28027
  return;
28024
28028
  }
28025
- i.type === "error" && (DP.warn("Captcha error received", i.code), c < OP ? (l((e) => e + 1), h()) : (DP.warn("Captcha error retries exhausted, falling back to no-token mode"), d(!0), r()));
28029
+ i.type === "error" && (kP.warn("Captcha error received", i.code), c < AP ? (l((e) => e + 1), h()) : (kP.warn("Captcha error retries exhausted, falling back to no-token mode"), d(!0), r()));
28026
28030
  }
28027
28031
  }
28028
28032
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
@@ -28052,7 +28056,7 @@ function jP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
28052
28056
  }
28053
28057
  //#endregion
28054
28058
  //#region ../core/src/components/welcome/index.tsx
28055
- function MP({ text: e, onStart: t, isStarting: n }) {
28059
+ function PP({ text: e, onStart: t, isStarting: n }) {
28056
28060
  let { config: r, deploymentId: i } = ev(), a = mt(G_), o = Ky(r.value), s = o.btn_title ?? e?.fallback_button ?? "Start the conversation", c = r.value.customization.terms_content?.trim() ?? "", l = r.value.customization.terms_enabled === !0, u = c.length > 0, d = u && l, f = D(() => d && S_(i, c), [
28057
28061
  d,
28058
28062
  i,
@@ -28061,13 +28065,13 @@ function MP({ text: e, onStart: t, isStarting: n }) {
28061
28065
  return /* @__PURE__ */ k(tb, {
28062
28066
  title: o.title,
28063
28067
  description: o.description,
28064
- overlay: /* @__PURE__ */ k(de, { children: [te && /* @__PURE__ */ k(jP, {
28068
+ overlay: /* @__PURE__ */ k(de, { children: [te && /* @__PURE__ */ k(NP, {
28065
28069
  captcha: _,
28066
28070
  deploymentId: i,
28067
28071
  onToken: b,
28068
28072
  onFallback: x
28069
- }, y), g && a ? /* @__PURE__ */ k(EP, { onSubmit: a.setPassword }) : null] }),
28070
- children: [/* @__PURE__ */ k(vP, {
28073
+ }, y), g && a ? /* @__PURE__ */ k(OP, { onSubmit: a.setPassword }) : null] }),
28074
+ children: [/* @__PURE__ */ k(bP, {
28071
28075
  class: "btn-neutral rounded-box",
28072
28076
  onClick: () => {
28073
28077
  d && C && !f && T_(i, c), t();
@@ -28099,23 +28103,23 @@ function MP({ text: e, onStart: t, isStarting: n }) {
28099
28103
  }
28100
28104
  //#endregion
28101
28105
  //#region ../core/src/shells/flow-state-body.tsx
28102
- function NP({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
28106
+ function FP({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
28103
28107
  switch (e.state) {
28104
- case "idle": return /* @__PURE__ */ k(MP, {
28108
+ case "idle": return /* @__PURE__ */ k(PP, {
28105
28109
  text: t,
28106
28110
  onStart: () => {
28107
28111
  e.start();
28108
28112
  },
28109
28113
  isStarting: e.isStarting
28110
28114
  });
28111
- case "haircheck": return /* @__PURE__ */ k(xP, {
28115
+ case "haircheck": return /* @__PURE__ */ k(CP, {
28112
28116
  onJoin: () => {
28113
28117
  e.join();
28114
28118
  },
28115
28119
  onCancel: () => e.cancel(),
28116
28120
  isJoining: e.isStarting
28117
28121
  });
28118
- case "call": return /* @__PURE__ */ k(gP, { onLeave: () => e.leave() });
28122
+ case "call": return /* @__PURE__ */ k(vP, { onLeave: () => e.leave() });
28119
28123
  case "ended": return /* @__PURE__ */ k(fb, { onRestart: () => e.restart() });
28120
28124
  case "unavailable": return /* @__PURE__ */ k(ob, {
28121
28125
  cause: e.unavailableCause ?? "busy",
@@ -28133,8 +28137,8 @@ function NP({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
28133
28137
  }
28134
28138
  //#endregion
28135
28139
  //#region ../core/src/providers/widget-ui-provider.tsx
28136
- var PP = Le(null);
28137
- function FP({ children: e }) {
28140
+ var IP = Le(null);
28141
+ function LP({ children: e }) {
28138
28142
  let { config: t } = mt(xi), n = t.peek().customization?.widget, r = n?.expandable ?? "default", i = fn(r === "start-expanded" || r === "always"), a = fn(n?.variant ?? "full"), o = fn(n?.position ?? "bottom-right"), s = fn(r), c = fn(n?.avatar?.type ?? "orb"), l = E(r);
28139
28143
  yn(() => {
28140
28144
  let e = t.value.customization?.widget, n = e?.expandable ?? "default";
@@ -28165,21 +28169,21 @@ function FP({ children: e }) {
28165
28169
  d,
28166
28170
  f
28167
28171
  ]);
28168
- return /* @__PURE__ */ k(PP.Provider, {
28172
+ return /* @__PURE__ */ k(IP.Provider, {
28169
28173
  value: p,
28170
28174
  children: e
28171
28175
  });
28172
28176
  }
28173
28177
  //#endregion
28174
28178
  //#region ../core/src/components/powered-by/index.tsx
28175
- function IP() {
28179
+ function RP() {
28176
28180
  let { config: e } = ev(), t = e.value.customization.branding;
28177
- return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ k(LP, {}) : t?.logo || t?.text ? /* @__PURE__ */ k(RP, {
28181
+ return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ k(zP, {}) : t?.logo || t?.text ? /* @__PURE__ */ k(BP, {
28178
28182
  logo: t.logo,
28179
28183
  text: t.text
28180
28184
  }) : null;
28181
28185
  }
28182
- function LP() {
28186
+ function zP() {
28183
28187
  let { isDark: e } = yN(), t = e.value ? "white" : "#140206";
28184
28188
  return /* @__PURE__ */ k("a", {
28185
28189
  href: "https://tavus.io",
@@ -28206,7 +28210,7 @@ function LP() {
28206
28210
  })] })]
28207
28211
  });
28208
28212
  }
28209
- function RP({ logo: e, text: t }) {
28213
+ function BP({ logo: e, text: t }) {
28210
28214
  return /* @__PURE__ */ k("div", {
28211
28215
  class: "inline-flex items-center gap-1 text-xs text-base-content/50",
28212
28216
  children: [e ? /* @__PURE__ */ k("img", {
@@ -28218,63 +28222,63 @@ function RP({ logo: e, text: t }) {
28218
28222
  }
28219
28223
  //#endregion
28220
28224
  //#region ../core/src/hooks/use-widget-text.ts
28221
- var zP = {
28225
+ var VP = {
28222
28226
  title: "Hi! Want to chat?",
28223
28227
  btn_title: "Start conversation"
28224
28228
  };
28225
- function BP() {
28229
+ function HP() {
28226
28230
  let { config: e } = ev(), t = e.value.customization.widget?.text;
28227
28231
  return D(() => ({
28228
- title: t?.title || zP.title,
28229
- btn_title: t?.btn_title || zP.btn_title
28232
+ title: t?.title || VP.title,
28233
+ btn_title: t?.btn_title || VP.btn_title
28230
28234
  }), [t]);
28231
28235
  }
28232
28236
  //#endregion
28233
28237
  //#region ../core/src/hooks/use-widget-ui.ts
28234
- function VP() {
28235
- let e = mt(PP);
28238
+ function UP() {
28239
+ let e = mt(IP);
28236
28240
  if (!e) throw Error("useWidgetUI must be used within WidgetUIProvider");
28237
28241
  return e;
28238
28242
  }
28239
28243
  //#endregion
28240
28244
  //#region ../core/src/components/widget-launcher/widget-avatar.tsx
28241
- var HP = {
28245
+ var WP = {
28242
28246
  xs: "w-6 h-6",
28243
28247
  sm: "w-8 h-8",
28244
28248
  md: "w-10 h-10",
28245
28249
  lg: "w-16 h-16"
28246
- }, UP = {
28250
+ }, GP = {
28247
28251
  xs: "w-3 h-3",
28248
28252
  sm: "w-4 h-4",
28249
28253
  md: "w-5 h-5",
28250
28254
  lg: "w-8 h-8"
28251
28255
  };
28252
- function WP({ size: e = "md", className: t = "" }) {
28253
- let { avatarType: n } = VP(), { config: r } = ev(), i = Gy(r.value);
28256
+ function KP({ size: e = "md", className: t = "" }) {
28257
+ let { avatarType: n } = UP(), { config: r } = ev(), i = Gy(r.value);
28254
28258
  return (Ky(r.value).background.type === "replica" || n.value === "image") && i ? /* @__PURE__ */ k("div", {
28255
- class: `relative ${HP[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
28259
+ class: `relative ${WP[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
28256
28260
  children: /* @__PURE__ */ k(Xy, { replica: i })
28257
28261
  }) : /* @__PURE__ */ k("div", {
28258
- class: `relative ${HP[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
28259
- children: /* @__PURE__ */ k("span", { class: `${UP[e]} rounded-full bg-primary animate-pulse` })
28262
+ class: `relative ${WP[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
28263
+ children: /* @__PURE__ */ k("span", { class: `${GP[e]} rounded-full bg-primary animate-pulse` })
28260
28264
  });
28261
28265
  }
28262
28266
  //#endregion
28263
28267
  //#region ../core/src/components/widget-launcher/widget-launcher.tsx
28264
- function GP({ variant: e }) {
28265
- let { toggle: t } = VP(), n = BP();
28268
+ function qP({ variant: e }) {
28269
+ let { toggle: t } = UP(), n = HP();
28266
28270
  return e === "tiny" ? /* @__PURE__ */ k("button", {
28267
28271
  type: "button",
28268
28272
  onClick: t,
28269
28273
  "aria-label": n.btn_title,
28270
28274
  class: "rounded-box overflow-hidden shadow-xl hover:shadow-2xl transition-shadow cursor-pointer",
28271
- children: /* @__PURE__ */ k(WP, { size: "lg" })
28275
+ children: /* @__PURE__ */ k(KP, { size: "lg" })
28272
28276
  }) : e === "compact" ? /* @__PURE__ */ k("button", {
28273
28277
  type: "button",
28274
28278
  onClick: t,
28275
28279
  "aria-label": n.btn_title,
28276
28280
  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",
28277
- children: [/* @__PURE__ */ k(WP, { size: "md" }), /* @__PURE__ */ k("span", {
28281
+ children: [/* @__PURE__ */ k(KP, { size: "md" }), /* @__PURE__ */ k("span", {
28278
28282
  class: "flex flex-col gap-0.5",
28279
28283
  children: [/* @__PURE__ */ k("span", {
28280
28284
  class: "text-base font-medium leading-tight",
@@ -28291,7 +28295,7 @@ function GP({ variant: e }) {
28291
28295
  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",
28292
28296
  children: [/* @__PURE__ */ k("div", {
28293
28297
  class: "flex items-center gap-2.5",
28294
- children: [/* @__PURE__ */ k(WP, { size: "md" }), /* @__PURE__ */ k("span", {
28298
+ children: [/* @__PURE__ */ k(KP, { size: "md" }), /* @__PURE__ */ k("span", {
28295
28299
  class: "text-sm font-medium leading-snug",
28296
28300
  children: n.title
28297
28301
  })]
@@ -28309,13 +28313,13 @@ function GP({ variant: e }) {
28309
28313
  }
28310
28314
  //#endregion
28311
28315
  //#region ../core/src/components/widget-launcher/widget-greeting-bubble.tsx
28312
- var KP = "tavus:widget:greeting-dismissed";
28313
- function qP({ anchor: e }) {
28314
- let t = BP(), { variant: n, expand: r } = VP(), [i, a] = w(!1);
28316
+ var JP = "tavus:widget:greeting-dismissed";
28317
+ function YP({ anchor: e }) {
28318
+ let t = HP(), { variant: n, expand: r } = UP(), [i, a] = w(!1);
28315
28319
  T(() => {
28316
28320
  if (n.value === "tiny") {
28317
28321
  try {
28318
- if (sessionStorage.getItem(KP) === "1") return;
28322
+ if (sessionStorage.getItem(JP) === "1") return;
28319
28323
  } catch {}
28320
28324
  a(!0);
28321
28325
  }
@@ -28323,7 +28327,7 @@ function qP({ anchor: e }) {
28323
28327
  let o = O((e) => {
28324
28328
  e.stopPropagation();
28325
28329
  try {
28326
- sessionStorage.setItem(KP, "1");
28330
+ sessionStorage.setItem(JP, "1");
28327
28331
  } catch {}
28328
28332
  a(!1);
28329
28333
  }, []);
@@ -28355,18 +28359,18 @@ function qP({ anchor: e }) {
28355
28359
  }
28356
28360
  //#endregion
28357
28361
  //#region ../core/src/hooks/use-host-bridge.ts
28358
- function JP() {
28362
+ function XP() {
28359
28363
  let e = mt(bv);
28360
28364
  if (!e) throw Error("useHostBridge must be used within HostBridgeProvider");
28361
28365
  return e;
28362
28366
  }
28363
28367
  //#endregion
28364
28368
  //#region ../core/src/shells/widget/widget-popup.tsx
28365
- var YP = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", XP = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", ZP = "p-1 flex-1 min-h-0", QP = "p-1 flex-1 min-h-0";
28366
- function $P({ variant: e, children: t, fullscreen: n }) {
28367
- let { collapse: r, expandable: i } = VP(), a = i.value !== "always";
28369
+ var ZP = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", QP = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", $P = "p-1 flex-1 min-h-0", eF = "p-1 flex-1 min-h-0";
28370
+ function tF({ variant: e, children: t, fullscreen: n }) {
28371
+ let { collapse: r, expandable: i } = UP(), a = i.value !== "always";
28368
28372
  return n ? /* @__PURE__ */ k("div", {
28369
- class: XP,
28373
+ class: QP,
28370
28374
  children: [
28371
28375
  /* @__PURE__ */ k("div", {
28372
28376
  class: "flex items-center justify-end gap-2 px-2.5 py-1.5 border-b border-base-300",
@@ -28382,18 +28386,18 @@ function $P({ variant: e, children: t, fullscreen: n }) {
28382
28386
  })
28383
28387
  }),
28384
28388
  /* @__PURE__ */ k("div", {
28385
- class: QP,
28389
+ class: eF,
28386
28390
  children: t
28387
28391
  }),
28388
28392
  /* @__PURE__ */ k("div", {
28389
28393
  class: "flex justify-end px-2.5",
28390
- children: /* @__PURE__ */ k(IP, {})
28394
+ children: /* @__PURE__ */ k(RP, {})
28391
28395
  })
28392
28396
  ]
28393
28397
  }) : /* @__PURE__ */ k("div", {
28394
28398
  class: "flex flex-col h-[min(34rem,calc(100dvh-3rem))]",
28395
28399
  children: [/* @__PURE__ */ k("div", {
28396
- class: `${YP} flex-1 overflow-hidden`,
28400
+ class: `${ZP} flex-1 overflow-hidden`,
28397
28401
  children: [/* @__PURE__ */ k("div", {
28398
28402
  class: "flex items-center justify-end gap-2 px-2.5 pt-1.5 shrink-0",
28399
28403
  children: a && /* @__PURE__ */ k("button", {
@@ -28407,68 +28411,68 @@ function $P({ variant: e, children: t, fullscreen: n }) {
28407
28411
  })
28408
28412
  })
28409
28413
  }), /* @__PURE__ */ k("div", {
28410
- class: ZP,
28414
+ class: $P,
28411
28415
  children: t
28412
28416
  })]
28413
28417
  }), /* @__PURE__ */ k("div", {
28414
28418
  class: "flex justify-end pr-2 pt-1.5 shrink-0",
28415
- children: /* @__PURE__ */ k(IP, {})
28419
+ children: /* @__PURE__ */ k(RP, {})
28416
28420
  })]
28417
28421
  });
28418
28422
  }
28419
28423
  //#endregion
28420
28424
  //#region ../core/src/shells/widget/widget-shell.tsx
28421
- var eF = bn("Widget"), tF = "1rem", nF = 480;
28422
- function rF() {
28423
- return typeof window > "u" ? !1 : window.innerWidth <= nF;
28425
+ var nF = bn("Widget"), rF = "1rem", iF = 480;
28426
+ function aF() {
28427
+ return typeof window > "u" ? !1 : window.innerWidth <= iF;
28424
28428
  }
28425
- function iF(e) {
28429
+ function oF(e) {
28426
28430
  switch (e) {
28427
28431
  case "bottom-right": return {
28428
- bottom: tF,
28429
- right: tF
28432
+ bottom: rF,
28433
+ right: rF
28430
28434
  };
28431
28435
  case "bottom-left": return {
28432
- bottom: tF,
28433
- left: tF
28436
+ bottom: rF,
28437
+ left: rF
28434
28438
  };
28435
28439
  case "top-right": return {
28436
- top: tF,
28437
- right: tF
28440
+ top: rF,
28441
+ right: rF
28438
28442
  };
28439
28443
  case "top-left": return {
28440
- top: tF,
28441
- left: tF
28444
+ top: rF,
28445
+ left: rF
28442
28446
  };
28443
28447
  case "top": return {
28444
- top: tF,
28448
+ top: rF,
28445
28449
  left: "50%",
28446
28450
  transform: "translateX(-50%)"
28447
28451
  };
28448
28452
  case "bottom": return {
28449
- bottom: tF,
28453
+ bottom: rF,
28450
28454
  left: "50%",
28451
28455
  transform: "translateX(-50%)"
28452
28456
  };
28453
28457
  }
28454
28458
  }
28455
- var aF = [
28459
+ var sF = [
28456
28460
  "top",
28457
28461
  "bottom",
28458
28462
  "left",
28459
28463
  "right",
28460
28464
  "transform"
28461
28465
  ];
28462
- function oF(e) {
28466
+ function cF(e) {
28463
28467
  return e === "bottom-left" || e === "top-left" ? "left" : "right";
28464
28468
  }
28465
- function sF() {
28466
- let { config: e, initError: t } = ev(), n = BP(), { expanded: r, position: i, variant: a } = VP(), { shadowHost: o } = JP(), s = sb(), c = fn(rF());
28469
+ function lF() {
28470
+ let { config: e, initError: t } = ev(), n = HP(), { expanded: r, position: i, variant: a } = UP(), { shadowHost: o } = XP(), s = sb(), c = fn(aF());
28467
28471
  T(() => {
28468
28472
  if (typeof window > "u") return;
28469
- c.value = rF();
28473
+ c.value = aF();
28470
28474
  let e = () => {
28471
- c.value = rF();
28475
+ c.value = aF();
28472
28476
  };
28473
28477
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
28474
28478
  }, [c]);
@@ -28478,27 +28482,27 @@ function sF() {
28478
28482
  if (e) {
28479
28483
  if (a) e.style.top = "0", e.style.right = "0", e.style.bottom = "0", e.style.left = "0", e.style.transform = "";
28480
28484
  else {
28481
- let n = iF(t);
28482
- for (let t of aF) e.style[t] = n[t] ?? "";
28485
+ let n = oF(t);
28486
+ for (let t of sF) e.style[t] = n[t] ?? "";
28483
28487
  }
28484
28488
  e.dataset.tavusWidgetPosition = t, e.dataset.tavusWidgetExpanded = n ? "true" : "false", e.dataset.tavusWidgetFullscreen = a ? "true" : "false", e.dataset.tavusWidgetSmall = c.value ? "true" : "false";
28485
28489
  }
28486
- }), t.value) return eF.error("Widget cannot initialize (init request failed):", t.value), null;
28487
- if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return eF.error("Widget is unavailable (total_limit reached) — not rendering"), null;
28490
+ }), t.value) return nF.error("Widget cannot initialize (init request failed):", t.value), null;
28491
+ if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return nF.error("Widget is unavailable (total_limit reached) — not rendering"), null;
28488
28492
  if (!r.value) {
28489
- let e = oF(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";
28493
+ let e = cF(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";
28490
28494
  return /* @__PURE__ */ k("div", {
28491
28495
  class: "flex flex-col",
28492
28496
  children: [/* @__PURE__ */ k("div", {
28493
28497
  class: t,
28494
- children: [/* @__PURE__ */ k(qP, { anchor: e }), /* @__PURE__ */ k(GP, { variant: a.value })]
28498
+ children: [/* @__PURE__ */ k(YP, { anchor: e }), /* @__PURE__ */ k(qP, { variant: a.value })]
28495
28499
  }), /* @__PURE__ */ k("div", {
28496
28500
  class: `flex ${n} pt-1.5`,
28497
- children: /* @__PURE__ */ k(IP, {})
28501
+ children: /* @__PURE__ */ k(RP, {})
28498
28502
  })]
28499
28503
  });
28500
28504
  }
28501
- return e.value.is_available === !1 ? /* @__PURE__ */ k($P, {
28505
+ return e.value.is_available === !1 ? /* @__PURE__ */ k(tF, {
28502
28506
  variant: a.value,
28503
28507
  fullscreen: c.value,
28504
28508
  children: /* @__PURE__ */ k(Pv, { children: /* @__PURE__ */ k(ob, {
@@ -28506,10 +28510,10 @@ function sF() {
28506
28510
  canRetry: !1,
28507
28511
  onRetry: () => {}
28508
28512
  }) })
28509
- }) : /* @__PURE__ */ k($P, {
28513
+ }) : /* @__PURE__ */ k(tF, {
28510
28514
  variant: a.value,
28511
28515
  fullscreen: c.value,
28512
- children: /* @__PURE__ */ k(Pv, { children: /* @__PURE__ */ k(NP, {
28516
+ children: /* @__PURE__ */ k(Pv, { children: /* @__PURE__ */ k(FP, {
28513
28517
  flow: s,
28514
28518
  welcomeText: l,
28515
28519
  onUnavailableCancel: () => s.restart()
@@ -28518,11 +28522,11 @@ function sF() {
28518
28522
  }
28519
28523
  //#endregion
28520
28524
  //#region ../core/src/widget/tavus-widget.tsx
28521
- var cF = ":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}";
28522
- function lF(e) {
28525
+ var uF = ":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}";
28526
+ function dF(e) {
28523
28527
  return /* @__PURE__ */ k(de, { children: [
28524
28528
  /* @__PURE__ */ k("style", { dangerouslySetInnerHTML: { __html: Xe } }),
28525
- /* @__PURE__ */ k("style", { dangerouslySetInnerHTML: { __html: cF } }),
28529
+ /* @__PURE__ */ k("style", { dangerouslySetInnerHTML: { __html: uF } }),
28526
28530
  /* @__PURE__ */ k(Dt, {
28527
28531
  "deployment-id": e["deployment-id"],
28528
28532
  "override-config": e["override-config"],
@@ -28531,13 +28535,13 @@ function lF(e) {
28531
28535
  "memory-stores": e["memory-stores"],
28532
28536
  "base-url": e["base-url"],
28533
28537
  token: e.token,
28534
- children: /* @__PURE__ */ k(Si, { children: /* @__PURE__ */ k(wi, { children: /* @__PURE__ */ k(K_, { children: /* @__PURE__ */ k(vv, { children: /* @__PURE__ */ k(Sv, { children: /* @__PURE__ */ k(wv, { children: /* @__PURE__ */ k(FP, { children: /* @__PURE__ */ k(sF, {}) }) }) }) }) }) }) })
28538
+ children: /* @__PURE__ */ k(Si, { children: /* @__PURE__ */ k(wi, { children: /* @__PURE__ */ k(K_, { children: /* @__PURE__ */ k(vv, { children: /* @__PURE__ */ k(Sv, { children: /* @__PURE__ */ k(wv, { children: /* @__PURE__ */ k(LP, { children: /* @__PURE__ */ k(lF, {}) }) }) }) }) }) }) })
28535
28539
  })
28536
28540
  ] });
28537
28541
  }
28538
- var uF;
28539
- function dF() {
28540
- uF ||= He(lF, "tavus-widget", [
28542
+ var fF;
28543
+ function pF() {
28544
+ fF ||= He(dF, "tavus-widget", [
28541
28545
  "deployment-id",
28542
28546
  "override-config",
28543
28547
  "conversational-context",
@@ -28552,7 +28556,7 @@ function dF() {
28552
28556
  }
28553
28557
  //#endregion
28554
28558
  //#region src/integration.ts
28555
- var fF = [
28559
+ var mF = [
28556
28560
  "tavus:chat-message",
28557
28561
  "tavus:conversation-ended",
28558
28562
  "tavus:conversation-started",
@@ -28563,7 +28567,7 @@ var fF = [
28563
28567
  "tavus:ready",
28564
28568
  "tavus:state-change",
28565
28569
  "tavus:tool-call"
28566
- ], pF = class {
28570
+ ], hF = class {
28567
28571
  element = null;
28568
28572
  tagName;
28569
28573
  constructor(e = "tavus-widget") {
@@ -28610,6 +28614,6 @@ var fF = [
28610
28614
  };
28611
28615
  //#endregion
28612
28616
  //#region src/index.ts
28613
- typeof window < "u" && dF();
28617
+ typeof window < "u" && pF();
28614
28618
  //#endregion
28615
- export { fF as TAVUS_EVENT_NAMES, pF as TavusIntegration };
28619
+ export { mF as TAVUS_EVENT_NAMES, hF as TavusIntegration };