@tavus/widget 0.0.1-beta.10 → 0.0.1-beta.12

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
@@ -19092,20 +19092,20 @@ function Wy({ title: e, description: t, media: n, children: r, overlay: i }) {
19092
19092
  //#region ../core/src/utils/unavailable-copy.ts
19093
19093
  var Gy = {
19094
19094
  daily_limit: {
19095
- title: "Agent is at today's limit",
19096
- description: "This Agent can take more conversations tomorrow."
19095
+ title: "PAL is at today's limit",
19096
+ description: "This PAL can take more conversations tomorrow."
19097
19097
  },
19098
19098
  total_limit: {
19099
- title: "Agent is unavailable",
19100
- description: "This Agent isn't available right now. Please check back later."
19099
+ title: "PAL is unavailable",
19100
+ description: "This PAL isn't available right now. Please check back later."
19101
19101
  },
19102
19102
  busy: {
19103
- title: "Agent is in another conversation",
19103
+ title: "PAL is in another conversation",
19104
19104
  description: "Please try again in a moment."
19105
19105
  },
19106
19106
  error: {
19107
- title: "Couldn't load this Agent",
19108
- description: "This Agent couldn't be loaded. Please try again later."
19107
+ title: "Couldn't load this PAL",
19108
+ description: "This PAL couldn't be loaded. Please try again later."
19109
19109
  }
19110
19110
  };
19111
19111
  function Ky(e, t) {
@@ -19808,14 +19808,14 @@ var Lb = ba(() => {
19808
19808
  }), Rb = ba(() => {
19809
19809
  let { isEnabled: e } = Ib(), { captionText: t, captionRole: n } = Nb(), r = t.value, i = n.value;
19810
19810
  return !e || !r ? null : /* @__PURE__ */ A("div", {
19811
- class: "absolute bottom-24 left-1/2 -translate-x-1/2 max-w-[80%] px-4 py-2 rounded-box bg-black/60 text-white",
19811
+ class: "absolute bottom-24 left-1/2 -translate-x-1/2 max-w-[80%] px-4 py-2 rounded-box bg-black/60 text-white z-10",
19812
19812
  role: "status",
19813
19813
  "aria-live": "polite",
19814
19814
  children: /* @__PURE__ */ A("div", {
19815
19815
  class: "text-sm leading-5 max-h-15 overflow-hidden flex flex-col justify-end text-center",
19816
19816
  children: /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("span", {
19817
19817
  class: `text-xs ${i === "replica" ? "text-secondary" : "text-primary"} mr-2`,
19818
- children: i === "replica" ? "Replica" : "You"
19818
+ children: i === "replica" ? "PAL" : "You"
19819
19819
  }), r] })
19820
19820
  })
19821
19821
  });
@@ -19856,7 +19856,7 @@ var Hb = ba((e = {}) => {
19856
19856
  class: `flex flex-col gap-1 ${t ? "items-end" : "items-start"}`,
19857
19857
  children: [/* @__PURE__ */ A("span", {
19858
19858
  class: `text-xs ${t ? "text-primary" : "text-secondary"}`,
19859
- children: t ? "You" : "Replica"
19859
+ children: t ? "You" : "PAL"
19860
19860
  }), /* @__PURE__ */ A("span", {
19861
19861
  class: `px-3 py-2 rounded-field text-sm max-w-[80%] ${t ? "bg-primary text-primary-content" : "bg-base-200 text-base-content"}`,
19862
19862
  children: e.text
@@ -25348,108 +25348,41 @@ function _j() {
25348
25348
  return e;
25349
25349
  }
25350
25350
  //#endregion
25351
- //#region ../core/src/magic-canvas/internal/bridge.ts
25352
- async function vj(e) {
25353
- try {
25354
- await e.teardownResource({}, { timeout: 1e3 });
25355
- } catch {}
25356
- try {
25357
- await e.close();
25358
- } catch {}
25359
- }
25360
- //#endregion
25361
- //#region ../core/src/magic-canvas/debug-panel.tsx
25362
- function yj({ state: e }) {
25363
- return e.enabled ? /* @__PURE__ */ A("details", {
25364
- class: "pointer-events-auto w-full max-w-md rounded-lg border border-base-300 bg-base-100/95 p-2 text-xs shadow-lg backdrop-blur",
25365
- children: [/* @__PURE__ */ A("summary", {
25366
- class: "cursor-pointer font-medium",
25367
- children: "Magic Canvas debug"
25368
- }), /* @__PURE__ */ A("dl", {
25369
- class: "mt-2 grid gap-2",
25370
- children: [
25371
- /* @__PURE__ */ A(bj, {
25372
- label: "iframe",
25373
- value: e.iframeLifecycleState
25374
- }),
25375
- /* @__PURE__ */ A(bj, {
25376
- label: "post",
25377
- value: e.lastInteractionPostResult
25378
- }),
25379
- /* @__PURE__ */ A(bj, {
25380
- label: "context",
25381
- value: e.lastModelContextUpdate
25382
- }),
25383
- /* @__PURE__ */ A(bj, {
25384
- label: "error",
25385
- value: e.lastError
25386
- }),
25387
- /* @__PURE__ */ A(xj, {
25388
- label: "tool_call",
25389
- value: e.lastToolCall
25390
- }),
25391
- /* @__PURE__ */ A(xj, {
25392
- label: "canvas_config",
25393
- value: e.parsedCanvasConfig
25394
- })
25395
- ]
25396
- })]
25397
- }) : null;
25398
- }
25399
- function bj({ label: e, value: t }) {
25400
- return t ? /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("dt", {
25401
- class: "font-semibold",
25402
- children: e
25403
- }), /* @__PURE__ */ A("dd", {
25404
- class: "break-words text-base-content/70",
25405
- children: t
25406
- })] }) : null;
25407
- }
25408
- function xj({ label: e, value: t }) {
25409
- return t === void 0 ? null : /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("dt", {
25410
- class: "font-semibold",
25411
- children: e
25412
- }), /* @__PURE__ */ A("dd", { children: /* @__PURE__ */ A("pre", {
25413
- class: "max-h-40 overflow-auto rounded bg-base-200 p-2 text-[10px] leading-relaxed",
25414
- children: JSON.stringify(t, null, 2)
25415
- }) })] });
25416
- }
25417
- //#endregion
25418
- //#region ../core/src/magic-canvas/internal/allowlists.ts
25419
- var Sj = new Set(["mcp-ui.tavus.io", "mcp-ui.tavus-preview.io"]), Cj = [".sandbox-tavus.io"], wj = new Set(["tavusapi.com"]);
25420
- function Tj(e) {
25351
+ //#region ../../node_modules/@tavus-engineering/magic-canvas-core/dist/allowlists.js
25352
+ var vj = new Set(["mcp-ui.tavus.io", "mcp-ui.tavus-preview.io"]), yj = [".sandbox-tavus.io"], bj = new Set(["tavusapi.com"]);
25353
+ function xj(e) {
25421
25354
  let t;
25422
25355
  try {
25423
25356
  t = new URL(e);
25424
25357
  } catch {
25425
25358
  return !1;
25426
25359
  }
25427
- return Oj(t) ? !0 : t.protocol === "https:" ? Sj.has(t.hostname) ? !0 : Cj.some((e) => t.hostname.endsWith(e)) : !1;
25360
+ return wj(t) ? !0 : t.protocol === "https:" ? vj.has(t.hostname) ? !0 : yj.some((e) => t.hostname.endsWith(e)) : !1;
25428
25361
  }
25429
- function Ej(e) {
25430
- return Tj(e);
25362
+ function Sj(e) {
25363
+ return xj(e);
25431
25364
  }
25432
- function Dj(e) {
25365
+ function Cj(e) {
25433
25366
  let t;
25434
25367
  try {
25435
25368
  t = new URL(e);
25436
25369
  } catch {
25437
25370
  return !1;
25438
25371
  }
25439
- return kj(t) ? !0 : t.protocol === "https:" && wj.has(t.hostname);
25372
+ return Tj(t) ? !0 : t.protocol === "https:" && bj.has(t.hostname);
25440
25373
  }
25441
- function Oj(e) {
25442
- return kj(e);
25374
+ function wj(e) {
25375
+ return Tj(e);
25443
25376
  }
25444
- function kj(e) {
25445
- return !Aj() || e.protocol !== "http:" && e.protocol !== "https:" ? !1 : [
25377
+ function Tj(e) {
25378
+ return !Ej() || e.protocol !== "http:" && e.protocol !== "https:" ? !1 : [
25446
25379
  "localhost",
25447
25380
  "127.0.0.1",
25448
25381
  "::1",
25449
25382
  "[::1]"
25450
25383
  ].includes(e.hostname);
25451
25384
  }
25452
- function Aj() {
25385
+ function Ej() {
25453
25386
  try {
25454
25387
  let e = globalThis.location?.hostname;
25455
25388
  return typeof e == "string" && [
@@ -25463,44 +25396,54 @@ function Aj() {
25463
25396
  }
25464
25397
  }
25465
25398
  //#endregion
25466
- //#region ../core/src/magic-canvas/internal/runtime.ts
25467
- var jj = "tavus.canvas.interaction", Mj = [
25399
+ //#region ../../node_modules/@tavus-engineering/magic-canvas-core/dist/bridge.js
25400
+ async function Dj(e) {
25401
+ try {
25402
+ await e.teardownResource({}, { timeout: 1e3 });
25403
+ } catch {}
25404
+ try {
25405
+ await e.close?.();
25406
+ } catch {}
25407
+ }
25408
+ //#endregion
25409
+ //#region ../../node_modules/@tavus-engineering/magic-canvas-core/dist/runtime.js
25410
+ var Oj = "tavus.canvas.interaction", kj = [
25468
25411
  "safe-area-right",
25469
25412
  "safe-area-left",
25470
25413
  "safe-area-bottom",
25471
25414
  "full"
25472
- ], Nj = "safe-area-right", Pj = {
25415
+ ], Aj = "safe-area-right", jj = {
25473
25416
  x: 275 / 1280,
25474
25417
  y: 111 / 720,
25475
25418
  width: 730 / 1280,
25476
25419
  height: 609 / 720
25477
- }, Fj = { type: "snapshot_mirror" };
25478
- function Ij(e) {
25479
- return aM(e) ? e.message_type === "conversation" && e.event_type === "conversation.tool_call" && typeof e.conversation_id == "string" && aM(e.properties) : !1;
25480
- }
25481
- function Lj(e) {
25482
- if (!aM(e)) return null;
25483
- let t = yM(e, "component"), n = yM(e, "component_version"), r = yM(e, "sandbox_url"), i = SM(e, "mcp_server_url", Ej), a = SM(e, "api_base_url", Dj), o = SM(e, "interaction_url", Dj), s = lM(e.layout), c = e.version;
25484
- return c !== 1 || !t || !n || !r || !Tj(r) || i === null || a === null || o === null || s === null ? null : {
25420
+ }, Mj = { type: "snapshot_mirror" };
25421
+ function Nj(e) {
25422
+ return tM(e) ? e.message_type === "conversation" && e.event_type === "conversation.tool_call" && typeof e.conversation_id == "string" && tM(e.properties) : !1;
25423
+ }
25424
+ function Pj(e) {
25425
+ if (!tM(e)) return null;
25426
+ let t = hM(e, "component"), n = hM(e, "component_version"), r = hM(e, "sandbox_url"), i = vM(e, "mcp_server_url", Sj), a = vM(e, "api_base_url", Cj), o = vM(e, "interaction_url", Cj), s = aM(e.layout), c = e.version;
25427
+ return c !== 1 || !t || !n || !r || !xj(r) || i === null || a === null || o === null || s === null ? null : {
25485
25428
  version: c,
25486
25429
  component: t,
25487
25430
  component_version: n,
25488
- resource_uri: yM(e, "resource_uri"),
25431
+ resource_uri: hM(e, "resource_uri"),
25489
25432
  sandbox_url: r,
25490
25433
  mcp_server_url: i,
25491
- mcp_tool_name: yM(e, "mcp_tool_name"),
25434
+ mcp_tool_name: hM(e, "mcp_tool_name"),
25492
25435
  api_base_url: a,
25493
25436
  interaction_url: o,
25494
25437
  layout: s,
25495
- host_context: aM(e.host_context) ? e.host_context : void 0
25438
+ host_context: tM(e.host_context) ? e.host_context : void 0
25496
25439
  };
25497
25440
  }
25498
- function Rj(e) {
25441
+ function Fj(e) {
25499
25442
  if (e === void 0) return {
25500
25443
  ok: !0,
25501
25444
  value: {}
25502
25445
  };
25503
- if (aM(e)) return {
25446
+ if (tM(e)) return {
25504
25447
  ok: !0,
25505
25448
  value: e
25506
25449
  };
@@ -25510,7 +25453,7 @@ function Rj(e) {
25510
25453
  };
25511
25454
  try {
25512
25455
  let t = JSON.parse(e);
25513
- return aM(t) ? {
25456
+ return tM(t) ? {
25514
25457
  ok: !0,
25515
25458
  value: t
25516
25459
  } : {
@@ -25520,14 +25463,14 @@ function Rj(e) {
25520
25463
  } catch (e) {
25521
25464
  return {
25522
25465
  ok: !1,
25523
- error: oM(e)
25466
+ error: nM(e)
25524
25467
  };
25525
25468
  }
25526
25469
  }
25527
- function zj(e) {
25470
+ function Ij(e) {
25528
25471
  let t = e.properties.name;
25529
25472
  if (t !== "canvas_clear" && t !== "update_component") return null;
25530
- let n = Rj(e.properties.arguments);
25473
+ let n = Fj(e.properties.arguments);
25531
25474
  if (!n.ok) throw n.error;
25532
25475
  if (t === "canvas_clear") {
25533
25476
  let t = n.value.tool_call_id, r = n.value.reason;
@@ -25542,7 +25485,7 @@ function zj(e) {
25542
25485
  }
25543
25486
  let r = n.value.tool_call_id, i = n.value.updates;
25544
25487
  if (typeof r != "string" || r.length === 0) throw Error("Magic Canvas update_component requires a target tool_call_id.");
25545
- if (!aM(i)) throw Error("Magic Canvas update_component requires an object updates payload.");
25488
+ if (!tM(i)) throw Error("Magic Canvas update_component requires an object updates payload.");
25546
25489
  return {
25547
25490
  kind: "update",
25548
25491
  conversation_id: e.conversation_id,
@@ -25550,39 +25493,32 @@ function zj(e) {
25550
25493
  updates: i
25551
25494
  };
25552
25495
  }
25553
- var Bj = ["safe-area-left", "safe-area-right"];
25554
- function Vj(e) {
25555
- let t = Bj.includes(e.preferred_slot) ? e.preferred_slot : Nj;
25496
+ var Lj = ["safe-area-left", "safe-area-right"];
25497
+ function Rj(e) {
25498
+ let t = Lj.includes(e.preferred_slot) ? e.preferred_slot : Aj;
25556
25499
  return t === e.preferred_slot && e.display_mode === "inline" ? e : {
25557
25500
  ...e,
25558
25501
  preferred_slot: t,
25559
25502
  display_mode: "inline"
25560
25503
  };
25561
25504
  }
25562
- function Hj(e) {
25505
+ function zj(e) {
25563
25506
  return e.display_mode === "fullscreen" ? "full" : e.preferred_slot;
25564
25507
  }
25565
- function Uj(e) {
25566
- return e === "full" || e === "safe-area-bottom";
25567
- }
25568
- function Wj(e, t) {
25569
- let n = Hj(t.layout);
25570
- return Uj(n) ? [t] : [...e.filter((e) => {
25571
- let t = Hj(e.layout);
25572
- return !Uj(t) && t !== n;
25573
- }), t];
25508
+ function Bj(e, t) {
25509
+ return [t];
25574
25510
  }
25575
- function Gj(e, t) {
25511
+ function Vj(e, t) {
25576
25512
  switch (t.kind) {
25577
25513
  case "show": {
25578
25514
  let n = e.find((e) => e.id === t.instance.id), r = n ? {
25579
25515
  ...t.instance,
25580
25516
  revision: n.revision + 1
25581
25517
  } : t.instance;
25582
- return Wj(e.filter((e) => e.id !== t.instance.id), r);
25518
+ return Bj(e.filter((e) => e.id !== t.instance.id), r);
25583
25519
  }
25584
25520
  case "update": {
25585
- let n = (e) => e.conversation_id === t.conversation_id && e.tool_call_id === t.tool_call_id, r = tM(t.updates), i, a = e.map((e) => {
25521
+ let n = (e) => e.conversation_id === t.conversation_id && e.tool_call_id === t.tool_call_id, r = Zj(t.updates), i, a = e.map((e) => {
25586
25522
  if (!n(e)) return e;
25587
25523
  let t = {
25588
25524
  ...e,
@@ -25590,7 +25526,7 @@ function Gj(e, t) {
25590
25526
  ...e.arguments,
25591
25527
  ...r.componentArguments
25592
25528
  },
25593
- layout: Vj({
25529
+ layout: Rj({
25594
25530
  preferred_slot: r.preferredSlot ?? e.layout.preferred_slot,
25595
25531
  display_mode: r.displayMode ?? e.layout.display_mode,
25596
25532
  avoid_safe_area: r.avoidSafeArea ?? e.layout.avoid_safe_area,
@@ -25603,86 +25539,86 @@ function Gj(e, t) {
25603
25539
  });
25604
25540
  if (i === void 0) return a;
25605
25541
  let o = e.find(n);
25606
- return o && Hj(o.layout) === Hj(i.layout) ? a : Wj(a.filter((e) => !n(e)), i);
25542
+ return o && zj(o.layout) === zj(i.layout) ? a : Bj(a.filter((e) => !n(e)), i);
25607
25543
  }
25608
25544
  case "clear": return t.tool_call_id ? e.filter((e) => !(e.conversation_id === t.conversation_id && e.tool_call_id === t.tool_call_id)) : e.filter((e) => e.conversation_id !== t.conversation_id);
25609
25545
  }
25610
25546
  }
25611
- function Kj(e) {
25612
- if (!aM(e) || !Array.isArray(e.content)) return null;
25547
+ function Hj(e) {
25548
+ if (!tM(e) || !Array.isArray(e.content)) return null;
25613
25549
  for (let t of e.content) {
25614
- if (!aM(t)) continue;
25615
- let e = (aM(t._meta) ? t._meta : null)?.[jj];
25616
- if (aM(e)) return CM(e);
25550
+ if (!tM(t)) continue;
25551
+ let e = (tM(t._meta) ? t._meta : null)?.[Oj];
25552
+ if (tM(e)) return yM(e);
25617
25553
  }
25618
25554
  return null;
25619
25555
  }
25620
- function qj(e, t) {
25556
+ function Uj(e, t) {
25621
25557
  let n = t.type, r = t.value;
25622
25558
  if (!n) throw Error("Magic Canvas interaction is missing type.");
25623
25559
  if (r === void 0) throw Error("Magic Canvas interaction is missing value.");
25624
25560
  return {
25625
- interaction_id: t.interaction_id ?? iM(e.tool_call_id, n),
25561
+ interaction_id: t.interaction_id ?? eM(e.tool_call_id, n),
25626
25562
  conversation_id: e.conversation_id,
25627
25563
  tool_call_id: e.tool_call_id,
25628
25564
  component: t.component ?? e.canvas_config.component,
25629
25565
  component_version: t.component_version ?? e.canvas_config.component_version,
25630
25566
  type: n,
25631
25567
  value: r,
25632
- metadata: aM(t.metadata) ? t.metadata : {}
25568
+ metadata: tM(t.metadata) ? t.metadata : {}
25633
25569
  };
25634
25570
  }
25635
- function Jj(e) {
25571
+ function Wj(e) {
25636
25572
  return e.type === "dismiss" || e.type === "clear" ? !0 : e.type !== "submit" && e.type !== "skip" ? !1 : e.component === "canvas.question" || e.component === "canvas.input" || e.component === "canvas.calendar";
25637
25573
  }
25638
- function Yj(e) {
25639
- return !aM(e) || !Array.isArray(e.content) ? "" : e.content.map((e) => aM(e) && e.type === "text" && typeof e.text == "string" ? e.text : "").filter(Boolean).join("\n").trim();
25574
+ function Gj(e) {
25575
+ return !tM(e) || !Array.isArray(e.content) ? "" : e.content.map((e) => tM(e) && e.type === "text" && typeof e.text == "string" ? e.text : "").filter(Boolean).join("\n").trim();
25640
25576
  }
25641
- function Xj(e, t) {
25642
- let n = aM(t.structuredContent) ? t.structuredContent : void 0, r = sM(t.content), i = typeof n?.state == "string" ? n.state : "updated", a = typeof n?.summary == "string" ? n.summary : r, o = [`Magic Canvas state update for ${e.canvas_config.component} (${e.tool_call_id}).`, `State: ${i}.`];
25643
- return a && o.push(`Summary: ${a}`), n && o.push(`Structured state: ${cM(n)}`), r && r !== a && o.push(r), o.join("\n");
25577
+ function Kj(e, t) {
25578
+ let n = tM(t.structuredContent) ? t.structuredContent : void 0, r = rM(t.content), i = typeof n?.state == "string" ? n.state : "updated", a = typeof n?.summary == "string" ? n.summary : r, o = [`Magic Canvas state update for ${e.canvas_config.component} (${e.tool_call_id}).`, `State: ${i}.`];
25579
+ return a && o.push(`Summary: ${a}`), n && o.push(`Structured state: ${iM(n)}`), r && r !== a && o.push(r), o.join("\n");
25644
25580
  }
25645
- function Zj({ conversationId: e, toolCallId: t, args: n, canvasConfig: r }) {
25646
- let i = tM(n);
25581
+ function qj({ conversationId: e, toolCallId: t, args: n, canvasConfig: r }) {
25582
+ let i = Zj(n);
25647
25583
  return {
25648
25584
  id: t,
25649
25585
  conversation_id: e,
25650
25586
  tool_call_id: t,
25651
25587
  arguments: i.componentArguments,
25652
25588
  canvas_config: r,
25653
- layout: Vj({
25654
- preferred_slot: i.preferredSlot ?? r.layout?.preferred_slot ?? nM(r.component),
25589
+ layout: Rj({
25590
+ preferred_slot: i.preferredSlot ?? r.layout?.preferred_slot ?? Qj(r.component),
25655
25591
  display_mode: i.displayMode ?? "inline",
25656
25592
  avoid_safe_area: i.avoidSafeArea ?? r.layout?.avoid_safe_area ?? !0,
25657
- safe_area: i.safeArea ?? r.layout?.safe_area ?? Pj,
25658
- backdrop: i.backdrop ?? r.layout?.backdrop ?? Fj
25593
+ safe_area: i.safeArea ?? r.layout?.safe_area ?? jj,
25594
+ backdrop: i.backdrop ?? r.layout?.backdrop ?? Mj
25659
25595
  }),
25660
25596
  revision: 0
25661
25597
  };
25662
25598
  }
25663
- function Qj(e, t) {
25599
+ function Jj(e, t) {
25664
25600
  let n = e.layout.display_mode;
25665
25601
  return {
25666
25602
  ...e.layout,
25667
25603
  display_mode: n,
25668
- viable_slot: n === "fullscreen" ? "full" : eM(e.layout.preferred_slot, t)
25604
+ viable_slot: n === "fullscreen" ? "full" : Xj(e.layout.preferred_slot, t)
25669
25605
  };
25670
25606
  }
25671
- function $j(e, t) {
25607
+ function Yj(e, t) {
25672
25608
  let n = e.filter((e) => !e.avoid_safe_area || e.display_mode === "fullscreen" ? !1 : e.viable_slot === "safe-area-left" || e.viable_slot === "safe-area-right"), r = n.some((e) => e.viable_slot === "safe-area-left"), i = n.some((e) => e.viable_slot === "safe-area-right");
25673
25609
  if (r && i) return {
25674
25610
  active: !1,
25675
25611
  video_shift_x: 0,
25676
- backdrop: Fj
25612
+ backdrop: Mj
25677
25613
  };
25678
25614
  let a = [...n].reverse()[0];
25679
25615
  if (!a || t.width < 900) return {
25680
25616
  active: !1,
25681
25617
  video_shift_x: 0,
25682
- backdrop: Fj
25618
+ backdrop: Mj
25683
25619
  };
25684
25620
  let o = Math.min(448, Math.max(0, t.width - 32)), s = a.safe_area, c = s.x * t.width, l = (s.x + s.width) * t.width, u = Math.min(360, t.width * .3), d = 0;
25685
- return d = a.viable_slot === "safe-area-left" ? xM(16 + o + 24 - c, 0, u) : -xM(l - (t.width - 16 - o - 24), 0, u), {
25621
+ return d = a.viable_slot === "safe-area-left" ? _M(16 + o + 24 - c, 0, u) : -_M(l - (t.width - 16 - o - 24), 0, u), {
25686
25622
  active: !0,
25687
25623
  side: a.viable_slot === "safe-area-left" ? "left" : "right",
25688
25624
  video_shift_x: Math.round(d),
@@ -25690,31 +25626,31 @@ function $j(e, t) {
25690
25626
  backdrop: a.backdrop
25691
25627
  };
25692
25628
  }
25693
- function eM(e, t) {
25629
+ function Xj(e, t) {
25694
25630
  return e === "full" || e === "safe-area-bottom" && t.visualViewportHeight !== void 0 && t.visualViewportHeight < t.height * .75 ? "full" : (e === "safe-area-left" || e === "safe-area-right") && t.width < 768 && t.height >= t.width ? "safe-area-bottom" : e;
25695
25631
  }
25696
- function tM(e) {
25632
+ function Zj(e) {
25697
25633
  let t = {};
25698
25634
  for (let [n, r] of Object.entries(e)) n === "layout" || n === "preferred_slot" || n === "preferredSlot" || n === "display_mode" || n === "displayMode" || n === "presentation" || n === "fullscreen" || n === "avoid_safe_area" || n === "avoidSafeArea" || n === "safe_area" || n === "safeArea" || n === "backdrop" || (t[n] = r);
25699
25635
  return {
25700
25636
  componentArguments: t,
25701
- preferredSlot: uM(e.layout) ?? uM(e.preferred_slot) ?? uM(e.preferredSlot),
25702
- displayMode: dM(e),
25703
- avoidSafeArea: fM(e),
25704
- safeArea: pM(e),
25705
- backdrop: mM(e)
25637
+ preferredSlot: oM(e.layout) ?? oM(e.preferred_slot) ?? oM(e.preferredSlot),
25638
+ displayMode: sM(e),
25639
+ avoidSafeArea: cM(e),
25640
+ safeArea: lM(e),
25641
+ backdrop: uM(e)
25706
25642
  };
25707
25643
  }
25708
- function nM(e) {
25644
+ function Qj(e) {
25709
25645
  switch (e) {
25710
25646
  case "canvas.alert": return "safe-area-bottom";
25711
25647
  case "canvas.chart":
25712
25648
  case "canvas.image":
25713
25649
  case "canvas.video": return "full";
25714
- default: return Nj;
25650
+ default: return Aj;
25715
25651
  }
25716
25652
  }
25717
- function rM(e, t) {
25653
+ function $j(e, t) {
25718
25654
  let n = t?.displayScale ?? 1;
25719
25655
  if (e.display_mode === "fullscreen" || e.viable_slot === "full") return {
25720
25656
  maxWidth: void 0,
@@ -25732,128 +25668,185 @@ function rM(e, t) {
25732
25668
  displayScale: n
25733
25669
  };
25734
25670
  }
25735
- function iM(e, t) {
25671
+ function eM(e, t) {
25736
25672
  return `ci_${e.replace(/[^a-zA-Z0-9_-]/g, "_")}_${t}_${globalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2, 10)}`;
25737
25673
  }
25738
- function aM(e) {
25674
+ function tM(e) {
25739
25675
  return typeof e == "object" && !!e && !Array.isArray(e);
25740
25676
  }
25741
- function oM(e) {
25677
+ function nM(e) {
25742
25678
  return e instanceof Error ? e : Error(String(e));
25743
25679
  }
25744
- function sM(e) {
25745
- return Array.isArray(e) ? e.map((e) => aM(e) && e.type === "text" && typeof e.text == "string" ? e.text : "").filter(Boolean).join("\n").trim() : "";
25680
+ function rM(e) {
25681
+ return Array.isArray(e) ? e.map((e) => tM(e) && e.type === "text" && typeof e.text == "string" ? e.text : "").filter(Boolean).join("\n").trim() : "";
25746
25682
  }
25747
- function cM(e) {
25683
+ function iM(e) {
25748
25684
  let t = JSON.stringify(e);
25749
25685
  return t ? t.length <= 2e3 ? t : `${t.slice(0, 2e3)}...` : "{}";
25750
25686
  }
25751
- function lM(e) {
25687
+ function aM(e) {
25752
25688
  if (e === void 0) return;
25753
- if (!aM(e)) return null;
25754
- let t = uM(e), n = hM(e.safe_area ?? e.safeArea), r = gM(e.backdrop);
25689
+ if (!tM(e)) return null;
25690
+ let t = oM(e), n = dM(e.safe_area ?? e.safeArea), r = fM(e.backdrop);
25755
25691
  return n === null || r === null ? null : {
25756
25692
  ...t ? { preferred_slot: t } : {},
25757
- ..._M(e.avoid_safe_area ?? e.avoidSafeArea, "avoid_safe_area"),
25693
+ ...pM(e.avoid_safe_area ?? e.avoidSafeArea, "avoid_safe_area"),
25758
25694
  ...n ? { safe_area: n } : {},
25759
25695
  ...r ? { backdrop: r } : {}
25760
25696
  };
25761
25697
  }
25762
- function uM(e) {
25763
- if (typeof e == "string" && vM(e)) return e;
25764
- if (!aM(e)) return;
25698
+ function oM(e) {
25699
+ if (typeof e == "string" && mM(e)) return e;
25700
+ if (!tM(e)) return;
25765
25701
  let t = e.preferred_slot ?? e.preferredSlot ?? e.slot;
25766
- return typeof t == "string" && vM(t) ? t : void 0;
25702
+ return typeof t == "string" && mM(t) ? t : void 0;
25767
25703
  }
25768
- function dM(e) {
25704
+ function sM(e) {
25769
25705
  if (e.presentation === !0 || e.fullscreen === !0) return "fullscreen";
25770
25706
  if (e.presentation === !1 || e.fullscreen === !1) return "inline";
25771
25707
  let t = e.display_mode ?? e.displayMode;
25772
25708
  return t === "fullscreen" || t === "inline" ? t : void 0;
25773
25709
  }
25774
- function fM(e) {
25775
- let t = aM(e.layout) ? e.layout : void 0, n = e.avoid_safe_area ?? e.avoidSafeArea ?? t?.avoid_safe_area ?? t?.avoidSafeArea;
25710
+ function cM(e) {
25711
+ let t = tM(e.layout) ? e.layout : void 0, n = e.avoid_safe_area ?? e.avoidSafeArea ?? t?.avoid_safe_area ?? t?.avoidSafeArea;
25776
25712
  return typeof n == "boolean" ? n : void 0;
25777
25713
  }
25778
- function pM(e) {
25779
- let t = aM(e.layout) ? e.layout : void 0;
25780
- return hM(e.safe_area ?? e.safeArea ?? t?.safe_area ?? t?.safeArea) ?? void 0;
25714
+ function lM(e) {
25715
+ let t = tM(e.layout) ? e.layout : void 0;
25716
+ return dM(e.safe_area ?? e.safeArea ?? t?.safe_area ?? t?.safeArea) ?? void 0;
25781
25717
  }
25782
- function mM(e) {
25783
- let t = aM(e.layout) ? e.layout : void 0;
25784
- return gM(e.backdrop ?? t?.backdrop) ?? void 0;
25718
+ function uM(e) {
25719
+ let t = tM(e.layout) ? e.layout : void 0;
25720
+ return fM(e.backdrop ?? t?.backdrop) ?? void 0;
25785
25721
  }
25786
- function hM(e) {
25722
+ function dM(e) {
25787
25723
  if (e === void 0) return;
25788
- if (!aM(e)) return null;
25789
- let t = bM(e, "x"), n = bM(e, "y"), r = bM(e, "width"), i = bM(e, "height");
25724
+ if (!tM(e)) return null;
25725
+ let t = gM(e, "x"), n = gM(e, "y"), r = gM(e, "width"), i = gM(e, "height");
25790
25726
  return t === void 0 || n === void 0 || r === void 0 || i === void 0 || t < 0 || n < 0 || r <= 0 || i <= 0 || t + r > 1.001 || n + i > 1.001 ? null : {
25791
- x: xM(t, 0, 1),
25792
- y: xM(n, 0, 1),
25793
- width: xM(r, 0, 1),
25794
- height: xM(i, 0, 1)
25727
+ x: _M(t, 0, 1),
25728
+ y: _M(n, 0, 1),
25729
+ width: _M(r, 0, 1),
25730
+ height: _M(i, 0, 1)
25795
25731
  };
25796
25732
  }
25797
- function gM(e) {
25733
+ function fM(e) {
25798
25734
  if (e === void 0) return;
25799
25735
  if (e === "snapshot_mirror" || e === "none") return { type: e };
25800
- if (!aM(e)) return null;
25736
+ if (!tM(e)) return null;
25801
25737
  let t = e.type;
25802
25738
  return t === "snapshot_mirror" || t === "none" ? { type: t } : null;
25803
25739
  }
25804
- function _M(e, t) {
25740
+ function pM(e, t) {
25805
25741
  return typeof e == "boolean" ? { [t]: e } : {};
25806
25742
  }
25807
- function vM(e) {
25808
- return Mj.includes(e);
25743
+ function mM(e) {
25744
+ return kj.includes(e);
25809
25745
  }
25810
- function yM(e, t) {
25746
+ function hM(e, t) {
25811
25747
  let n = e[t];
25812
25748
  return typeof n == "string" && n.length > 0 ? n : void 0;
25813
25749
  }
25814
- function bM(e, t) {
25750
+ function gM(e, t) {
25815
25751
  let n = e[t];
25816
25752
  return typeof n == "number" && Number.isFinite(n) ? n : void 0;
25817
25753
  }
25818
- function xM(e, t, n) {
25754
+ function _M(e, t, n) {
25819
25755
  return Math.min(Math.max(e, t), n);
25820
25756
  }
25821
- function SM(e, t, n) {
25822
- let r = yM(e, t);
25757
+ function vM(e, t, n) {
25758
+ let r = hM(e, t);
25823
25759
  if (r) return n(r) ? r : null;
25824
25760
  }
25825
- function CM(e) {
25826
- return e.interaction_id !== void 0 && typeof e.interaction_id != "string" || e.component !== void 0 && typeof e.component != "string" || e.component_version !== void 0 && typeof e.component_version != "string" || e.type !== void 0 && typeof e.type != "string" || e.metadata !== void 0 && !aM(e.metadata) ? null : e;
25761
+ function yM(e) {
25762
+ return e.interaction_id !== void 0 && typeof e.interaction_id != "string" || e.component !== void 0 && typeof e.component != "string" || e.component_version !== void 0 && typeof e.component_version != "string" || e.type !== void 0 && typeof e.type != "string" || e.metadata !== void 0 && !tM(e.metadata) ? null : e;
25763
+ }
25764
+ //#endregion
25765
+ //#region ../core/src/magic-canvas/debug-panel.tsx
25766
+ function bM({ state: e }) {
25767
+ return e.enabled ? /* @__PURE__ */ A("details", {
25768
+ class: "pointer-events-auto w-full max-w-md rounded-lg border border-base-300 bg-base-100/95 p-2 text-xs shadow-lg backdrop-blur",
25769
+ children: [/* @__PURE__ */ A("summary", {
25770
+ class: "cursor-pointer font-medium",
25771
+ children: "Magic Canvas debug"
25772
+ }), /* @__PURE__ */ A("dl", {
25773
+ class: "mt-2 grid gap-2",
25774
+ children: [
25775
+ /* @__PURE__ */ A(xM, {
25776
+ label: "iframe",
25777
+ value: e.iframeLifecycleState
25778
+ }),
25779
+ /* @__PURE__ */ A(xM, {
25780
+ label: "post",
25781
+ value: e.lastInteractionPostResult
25782
+ }),
25783
+ /* @__PURE__ */ A(xM, {
25784
+ label: "context",
25785
+ value: e.lastModelContextUpdate
25786
+ }),
25787
+ /* @__PURE__ */ A(xM, {
25788
+ label: "error",
25789
+ value: e.lastError
25790
+ }),
25791
+ /* @__PURE__ */ A(SM, {
25792
+ label: "tool_call",
25793
+ value: e.lastToolCall
25794
+ }),
25795
+ /* @__PURE__ */ A(SM, {
25796
+ label: "canvas_config",
25797
+ value: e.parsedCanvasConfig
25798
+ })
25799
+ ]
25800
+ })]
25801
+ }) : null;
25802
+ }
25803
+ function xM({ label: e, value: t }) {
25804
+ return t ? /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("dt", {
25805
+ class: "font-semibold",
25806
+ children: e
25807
+ }), /* @__PURE__ */ A("dd", {
25808
+ class: "break-words text-base-content/70",
25809
+ children: t
25810
+ })] }) : null;
25811
+ }
25812
+ function SM({ label: e, value: t }) {
25813
+ return t === void 0 ? null : /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("dt", {
25814
+ class: "font-semibold",
25815
+ children: e
25816
+ }), /* @__PURE__ */ A("dd", { children: /* @__PURE__ */ A("pre", {
25817
+ class: "max-h-40 overflow-auto rounded bg-base-200 p-2 text-[10px] leading-relaxed",
25818
+ children: JSON.stringify(t, null, 2)
25819
+ }) })] });
25827
25820
  }
25828
25821
  //#endregion
25829
25822
  //#region ../core/src/magic-canvas/runtime.ts
25830
- var wM = "tavus-deployment magic-canvas/0.0.0";
25831
- function TM(e) {
25832
- if (!Ij(e) || e.canvas_config === void 0 || e.canvas_config === null) return null;
25833
- let t = Lj(e.canvas_config), n = e.properties.tool_call_id;
25823
+ var CM = "tavus-deployment magic-canvas/0.0.0";
25824
+ function wM(e) {
25825
+ if (!Nj(e) || e.canvas_config === void 0 || e.canvas_config === null) return null;
25826
+ let t = Pj(e.canvas_config), n = e.properties.tool_call_id;
25834
25827
  if (!t) return null;
25835
25828
  if (!n) throw Error("Received Magic Canvas tool call without tool_call_id.");
25836
- let r = Rj(e.properties.arguments);
25829
+ let r = Fj(e.properties.arguments);
25837
25830
  if (!r.ok) throw r.error;
25838
- return Zj({
25831
+ return qj({
25839
25832
  conversationId: e.conversation_id,
25840
25833
  toolCallId: n,
25841
25834
  args: r.value,
25842
25835
  canvasConfig: t
25843
25836
  });
25844
25837
  }
25845
- function EM(e) {
25846
- if (!Ij(e)) return null;
25838
+ function TM(e) {
25839
+ if (!Nj(e)) return null;
25847
25840
  if (e.canvas_config !== void 0 && e.canvas_config !== null) {
25848
- let t = TM(e);
25841
+ let t = wM(e);
25849
25842
  return t ? {
25850
25843
  kind: "show",
25851
25844
  instance: t
25852
25845
  } : null;
25853
25846
  }
25854
- return zj(e);
25847
+ return Ij(e);
25855
25848
  }
25856
- function DM(e) {
25849
+ function EM(e) {
25857
25850
  return { body: {
25858
25851
  interaction_id: e.interaction_id,
25859
25852
  tool_call_id: e.tool_call_id,
@@ -25864,13 +25857,13 @@ function DM(e) {
25864
25857
  metadata: e.metadata
25865
25858
  } };
25866
25859
  }
25867
- function OM(e, t) {
25860
+ function DM(e, t) {
25868
25861
  return {
25869
25862
  theme: e.theme,
25870
25863
  displayMode: t?.display_mode ?? "inline",
25871
25864
  availableDisplayModes: ["inline", "fullscreen"],
25872
25865
  ...t ? {
25873
- containerDimensions: rM(t),
25866
+ containerDimensions: $j(t),
25874
25867
  layout: {
25875
25868
  preferred_slot: t.preferred_slot,
25876
25869
  viable_slot: t.viable_slot,
@@ -25880,11 +25873,11 @@ function OM(e, t) {
25880
25873
  }
25881
25874
  } : {},
25882
25875
  platform: "web",
25883
- userAgent: wM,
25884
- styles: { variables: kM(e.cssVars) }
25876
+ userAgent: CM,
25877
+ styles: { variables: OM(e.cssVars) }
25885
25878
  };
25886
25879
  }
25887
- function kM(e) {
25880
+ function OM(e) {
25888
25881
  return {
25889
25882
  "--border-radius-md": e["--radius-box"] ?? e["--tavus-boxes-radius"] ?? "0.5rem",
25890
25883
  "--border-radius-sm": e["--radius-field"] ?? e["--tavus-field-radius"] ?? "0.375rem",
@@ -25893,10 +25886,10 @@ function kM(e) {
25893
25886
  "--border-width-regular": e["--border"] ?? e["--tavus-border-width"] ?? "1px",
25894
25887
  "--font-text-sm-size": "0.875rem",
25895
25888
  "--font-text-md-size": "1rem",
25896
- ...AM(e)
25889
+ ...kM(e)
25897
25890
  };
25898
25891
  }
25899
- function AM(e) {
25892
+ function kM(e) {
25900
25893
  let t = e["--color-base-content"], n = e["--color-base-100"], r = e["--color-base-200"], i = e["--color-base-300"], a = e["--color-error"], o = {}, s = (e, t) => {
25901
25894
  t && (o[e] = t);
25902
25895
  }, c = (e, t, n) => e && n ? `color-mix(in oklch, ${e} ${t}%, ${n})` : void 0;
@@ -25904,13 +25897,13 @@ function AM(e) {
25904
25897
  }
25905
25898
  //#endregion
25906
25899
  //#region ../core/src/magic-canvas/magic-canvas.tsx
25907
- var jM = 1e3, MM = 5e3, NM = 1200, PM = 48, FM = "allow-scripts", IM = { "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms" };
25908
- function LM(e, t) {
25900
+ var AM = 1e3, jM = 5e3, MM = 1200, NM = 48, PM = "allow-scripts", FM = { "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms" };
25901
+ function IM(e, t) {
25909
25902
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
25910
25903
  let n = e.data;
25911
25904
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
25912
25905
  }
25913
- var RM = class {
25906
+ var LM = class {
25914
25907
  onmessage;
25915
25908
  onerror;
25916
25909
  onclose;
@@ -25921,7 +25914,7 @@ var RM = class {
25921
25914
  }
25922
25915
  start() {
25923
25916
  let e = (e) => {
25924
- LM(e, this.#e) && this.onmessage?.(e.data);
25917
+ IM(e, this.#e) && this.onmessage?.(e.data);
25925
25918
  };
25926
25919
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
25927
25920
  }
@@ -25932,12 +25925,12 @@ var RM = class {
25932
25925
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
25933
25926
  }
25934
25927
  };
25935
- function zM(e) {
25936
- for (let t of Mj) if (e.some((e) => eN(e) === t)) return t;
25928
+ function RM(e) {
25929
+ for (let t of kj) if (e.some((e) => $M(e) === t)) return t;
25937
25930
  return null;
25938
25931
  }
25939
- function BM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = tN() } = {}) {
25940
- let { client: r } = K_(), { dataTheme: i, cssVars: a } = _j(), o = oh(), s = Mg(), [c, l] = T([]), [u, d] = YM(), [f, p] = T(() => ({
25932
+ function zM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = eN() } = {}) {
25933
+ let { client: r } = K_(), { dataTheme: i, cssVars: a } = _j(), o = oh(), s = Mg(), [c, l] = T([]), [u, d] = JM(), [f, p] = T(() => ({
25941
25934
  enabled: n,
25942
25935
  iframeLifecycleState: "idle"
25943
25936
  })), m = k((e) => {
@@ -25974,9 +25967,9 @@ function BM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
25974
25967
  return;
25975
25968
  }
25976
25969
  try {
25977
- let t = EM(e.data);
25970
+ let t = TM(e.data);
25978
25971
  if (!t) return;
25979
- l((e) => Gj(e, t)), m({
25972
+ l((e) => Vj(e, t)), m({
25980
25973
  lastToolCall: e.data,
25981
25974
  parsedCanvasConfig: t.kind === "show" ? t.instance.canvas_config : void 0,
25982
25975
  iframeLifecycleState: t.kind === "clear" ? "closed" : "received",
@@ -25985,14 +25978,14 @@ function BM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
25985
25978
  } catch (e) {
25986
25979
  m({
25987
25980
  iframeLifecycleState: "error",
25988
- lastError: iN(e).message
25981
+ lastError: rN(e).message
25989
25982
  });
25990
25983
  }
25991
25984
  }, [s, m]) });
25992
25985
  let _ = c.map((e) => ({
25993
25986
  instance: e,
25994
- layout: Qj(e, d)
25995
- })), v = $j(_.map(({ layout: e }) => e), d), y = [..._].reverse().find(({ layout: e }) => e.display_mode === "fullscreen")?.instance.tool_call_id;
25987
+ layout: Jj(e, d)
25988
+ })), v = Yj(_.map(({ layout: e }) => e), d), y = [..._].reverse().find(({ layout: e }) => e.display_mode === "fullscreen")?.instance.tool_call_id;
25996
25989
  E(() => {
25997
25990
  e?.(v);
25998
25991
  }, [
@@ -26006,7 +25999,7 @@ function BM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
26006
25999
  v.safe_area?.width,
26007
26000
  v.safe_area?.height
26008
26001
  ]);
26009
- let b = zM(_.map(({ layout: e }) => e));
26002
+ let b = RM(_.map(({ layout: e }) => e));
26010
26003
  E(() => {
26011
26004
  t?.(b);
26012
26005
  }, [t, b]);
@@ -26017,13 +26010,13 @@ function BM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
26017
26010
  class: "pointer-events-none absolute inset-0 z-30",
26018
26011
  children: [
26019
26012
  x && y && /* @__PURE__ */ A("div", { class: "absolute inset-0 bg-black/45" }),
26020
- x && Mj.map((e) => {
26021
- let t = _.filter(({ layout: t }) => eN(t) === e);
26022
- return t.length === 0 ? null : /* @__PURE__ */ A(HM, {
26013
+ x && kj.map((e) => {
26014
+ let t = _.filter(({ layout: t }) => $M(t) === e);
26015
+ return t.length === 0 ? null : /* @__PURE__ */ A(VM, {
26023
26016
  slot: e,
26024
26017
  safeAreaTop: v.safe_area?.y,
26025
26018
  frameWidth: d.width,
26026
- children: (e) => t.map(({ instance: t, layout: n }) => /* @__PURE__ */ A(UM, {
26019
+ children: (e) => t.map(({ instance: t, layout: n }) => /* @__PURE__ */ A(HM, {
26027
26020
  availableHeight: e,
26028
26021
  client: r,
26029
26022
  hostTheme: g,
@@ -26049,22 +26042,22 @@ function BM({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
26049
26042
  }),
26050
26043
  x && /* @__PURE__ */ A("div", {
26051
26044
  class: "absolute right-4 bottom-24 @max-mobile:right-3 @max-mobile:bottom-20",
26052
- children: /* @__PURE__ */ A(yj, { state: f })
26045
+ children: /* @__PURE__ */ A(bM, { state: f })
26053
26046
  })
26054
26047
  ]
26055
26048
  });
26056
26049
  }
26057
- var VM = 16;
26058
- function HM({ slot: e, safeAreaTop: t, frameWidth: n, children: r }) {
26059
- let [i, a] = XM(), o = r(e === "full" ? void 0 : a);
26050
+ var BM = 16;
26051
+ function VM({ slot: e, safeAreaTop: t, frameWidth: n, children: r }) {
26052
+ let [i, a] = YM(), o = r(e === "full" ? void 0 : a);
26060
26053
  if (e === "safe-area-left" || e === "safe-area-right") {
26061
- let r = t == null ? "1rem" : `${t * 100}%`, a = n != null && n > 0 ? Math.max(0, n - VM * 2) : void 0;
26054
+ let r = t == null ? "1rem" : `${t * 100}%`, a = n != null && n > 0 ? Math.max(0, n - BM * 2) : void 0;
26062
26055
  return /* @__PURE__ */ A("div", {
26063
26056
  ref: i,
26064
- class: $M(e),
26057
+ class: QM(e),
26065
26058
  style: {
26066
26059
  top: r,
26067
- bottom: `${QM}px`,
26060
+ bottom: `${ZM}px`,
26068
26061
  maxWidth: a
26069
26062
  },
26070
26063
  "data-canvas-slot": e,
@@ -26076,23 +26069,23 @@ function HM({ slot: e, safeAreaTop: t, frameWidth: n, children: r }) {
26076
26069
  }
26077
26070
  return /* @__PURE__ */ A("div", {
26078
26071
  ref: i,
26079
- class: $M(e),
26072
+ class: QM(e),
26080
26073
  "data-canvas-slot": e,
26081
26074
  children: o
26082
26075
  });
26083
26076
  }
26084
- function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout: i, dimmed: a, onDebug: o, onComplete: s, onDisplayModeChange: c, sendAppMessage: l }) {
26077
+ function HM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout: i, dimmed: a, onDebug: o, onComplete: s, onDisplayModeChange: c, sendAppMessage: l }) {
26085
26078
  let u = D(null), d = D(null), f = D(e), p = D(320), m = D(n), h = D(r), g = D(i), _ = D(-1), v = D(s), y = D(c), b = D(l), [x, S] = T(320);
26086
26079
  E(() => {
26087
26080
  h.current = r;
26088
26081
  }, [r]), E(() => {
26089
- p.current = x, d.current?.setHostContext(qM(h.current, m.current, g.current, f.current, x));
26082
+ p.current = x, d.current?.setHostContext(KM(h.current, m.current, g.current, f.current, x));
26090
26083
  }, [x]), E(() => {
26091
26084
  f.current = e;
26092
- let t = KM(n, u.current);
26093
- m.current = t, d.current?.setHostContext(qM(h.current, t, g.current, e, p.current));
26085
+ let t = GM(n, u.current);
26086
+ m.current = t, d.current?.setHostContext(KM(h.current, t, g.current, e, p.current));
26094
26087
  }, [e, n]), E(() => {
26095
- g.current = i, d.current?.setHostContext(qM(h.current, m.current, i, e, p.current));
26088
+ g.current = i, d.current?.setHostContext(KM(h.current, m.current, i, e, p.current));
26096
26089
  }, [e, i]), E(() => {
26097
26090
  v.current = s, y.current = c, b.current = l;
26098
26091
  }, [
@@ -26105,11 +26098,11 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26105
26098
  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) => {
26106
26099
  n || o({
26107
26100
  iframeLifecycleState: "error",
26108
- lastError: iN(e).message
26101
+ lastError: rN(e).message
26109
26102
  });
26110
26103
  }, C = () => {
26111
26104
  if (n || !a) return;
26112
- let e = h.current, t = Xj(e, a);
26105
+ let e = h.current, t = Kj(e, a);
26113
26106
  a = null, b.current({
26114
26107
  message_type: "conversation",
26115
26108
  event_type: "conversation.append_llm_context",
@@ -26139,13 +26132,13 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26139
26132
  text: {},
26140
26133
  structuredContent: {}
26141
26134
  }
26142
- }, { hostContext: qM(r, KM(m.current, e), g.current, f.current, p.current) });
26135
+ }, { hostContext: KM(r, GM(m.current, e), g.current, f.current, p.current) });
26143
26136
  i = u, d.current = u, u.oninitialized = () => {
26144
26137
  n || (o({ iframeLifecycleState: "ready" }), _.current = h.current.revision, u.sendToolInput({ arguments: h.current.arguments }).catch(x));
26145
26138
  }, u.onsizechange = ({ height: e }) => {
26146
- !n && typeof e == "number" && Number.isFinite(e) && S(Math.min(Math.max(e, PM), 720));
26139
+ !n && typeof e == "number" && Number.isFinite(e) && S(Math.min(Math.max(e, NM), 720));
26147
26140
  }, u.onmessage = async (e) => {
26148
- let r = Kj(e), i = Yj(e);
26141
+ let r = Hj(e), i = Gj(e);
26149
26142
  if (!r) {
26150
26143
  if (i) {
26151
26144
  let e = "Magic Canvas message included text without interaction metadata; no interaction row was recorded.";
@@ -26161,7 +26154,7 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26161
26154
  return {};
26162
26155
  }
26163
26156
  try {
26164
- let e = h.current, a = qj(e, r), s = DM(a), l = new AbortController(), u = globalThis.setTimeout(() => l.abort(), MM);
26157
+ let e = h.current, a = Uj(e, r), s = EM(a), l = new AbortController(), u = globalThis.setTimeout(() => l.abort(), jM);
26165
26158
  try {
26166
26159
  await En(t, a.conversation_id, s.body, { signal: l.signal });
26167
26160
  } finally {
@@ -26176,11 +26169,11 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26176
26169
  }), o({
26177
26170
  lastInteractionPostResult: "success",
26178
26171
  lastError: void 0
26179
- }), Jj(a) && (a.type === "submit" ? (c && clearTimeout(c), c = setTimeout(() => {
26172
+ }), Wj(a) && (a.type === "submit" ? (c && clearTimeout(c), c = setTimeout(() => {
26180
26173
  c = null, n || v.current();
26181
- }, NM)) : v.current());
26174
+ }, MM)) : v.current());
26182
26175
  } catch (e) {
26183
- let t = iN(e).message;
26176
+ let t = rN(e).message;
26184
26177
  return o({
26185
26178
  lastInteractionPostResult: "error",
26186
26179
  lastError: t
@@ -26193,14 +26186,14 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26193
26186
  return {};
26194
26187
  }, u.onupdatemodelcontext = async (e) => (a = e, s ||= setTimeout(() => {
26195
26188
  s = null, C();
26196
- }, jM), {}), u.onrequestdisplaymode = async ({ mode: e }) => {
26189
+ }, AM), {}), u.onrequestdisplaymode = async ({ mode: e }) => {
26197
26190
  let t = e === "fullscreen" ? "fullscreen" : "inline";
26198
26191
  return y.current(t), g.current = {
26199
26192
  ...g.current,
26200
26193
  display_mode: t,
26201
26194
  viable_slot: t === "fullscreen" ? "full" : g.current.viable_slot
26202
- }, u.setHostContext(qM(h.current, m.current, g.current, f.current, p.current)), { mode: t };
26203
- }, u.connect(new RM(e)).then(() => void 0).catch(x);
26195
+ }, u.setHostContext(KM(h.current, m.current, g.current, f.current, p.current)), { mode: t };
26196
+ }, u.connect(new LM(e)).then(() => void 0).catch(x);
26204
26197
  };
26205
26198
  o({
26206
26199
  iframeLifecycleState: "mounting",
@@ -26210,7 +26203,7 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26210
26203
  w();
26211
26204
  };
26212
26205
  return e.addEventListener("load", ee), w(), () => {
26213
- s &&= (clearTimeout(s), null), c &&= (clearTimeout(c), null), C(), n = !0, e.removeEventListener("load", ee), d.current = null, o({ iframeLifecycleState: "closed" }), i && vj(i);
26206
+ s &&= (clearTimeout(s), null), c &&= (clearTimeout(c), null), C(), n = !0, e.removeEventListener("load", ee), d.current = null, o({ iframeLifecycleState: "closed" }), i && Dj(i);
26214
26207
  };
26215
26208
  }, [
26216
26209
  t,
@@ -26221,7 +26214,7 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26221
26214
  r.revision !== 0 && (r.revision <= _.current || (_.current = r.revision, d.current?.sendToolInput({ arguments: r.arguments }).catch((e) => {
26222
26215
  o({
26223
26216
  iframeLifecycleState: "error",
26224
- lastError: iN(e).message
26217
+ lastError: rN(e).message
26225
26218
  });
26226
26219
  })));
26227
26220
  }, [
@@ -26229,11 +26222,11 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26229
26222
  r.revision,
26230
26223
  o
26231
26224
  ]);
26232
- let C = i.viable_slot === "full" || i.display_mode === "fullscreen", w = C ? null : JM(x, e), ee = w?.placeholderStyle, te = w?.cardStyle, ne = C ? { height: "100%" } : w?.iframeStyle ?? { height: `${x}px` }, re = [
26225
+ let C = i.viable_slot === "full" || i.display_mode === "fullscreen", w = C ? null : qM(x, e), ee = w?.placeholderStyle, te = w?.cardStyle, ne = C ? { height: "100%" } : w?.iframeStyle ?? { height: `${x}px` }, re = [
26233
26226
  "pointer-events-auto w-full overflow-hidden rounded-lg border border-base-300 bg-base-100 shadow-xl transition-[opacity,transform]",
26234
26227
  C ? "fixed inset-4 z-10 max-w-none" : "max-w-md",
26235
26228
  a ? "scale-[0.98] opacity-40" : ""
26236
- ].filter(Boolean).join(" "), ie = IM[r.canvas_config.component] ?? FM, ae = /* @__PURE__ */ A("div", {
26229
+ ].filter(Boolean).join(" "), ie = FM[r.canvas_config.component] ?? PM, ae = /* @__PURE__ */ A("div", {
26237
26230
  class: re,
26238
26231
  style: te,
26239
26232
  "data-canvas-card": i.viable_slot,
@@ -26251,7 +26244,7 @@ function UM({ availableHeight: e, client: t, hostTheme: n, instance: r, layout:
26251
26244
  children: ae
26252
26245
  });
26253
26246
  }
26254
- var WM = [
26247
+ var UM = [
26255
26248
  "--color-base-100",
26256
26249
  "--color-base-200",
26257
26250
  "--color-base-300",
@@ -26259,17 +26252,17 @@ var WM = [
26259
26252
  "--color-primary",
26260
26253
  "--color-error"
26261
26254
  ];
26262
- function GM(e) {
26255
+ function WM(e) {
26263
26256
  if (!e || typeof getComputedStyle != "function") return {};
26264
26257
  let t = getComputedStyle(e), n = {};
26265
- for (let e of WM) {
26258
+ for (let e of UM) {
26266
26259
  let r = t.getPropertyValue(e).trim();
26267
26260
  r && (n[e] = r);
26268
26261
  }
26269
26262
  return n;
26270
26263
  }
26271
- function KM(e, t) {
26272
- let n = GM(t);
26264
+ function GM(e, t) {
26265
+ let n = WM(t);
26273
26266
  return Object.keys(n).length === 0 ? e : {
26274
26267
  ...e,
26275
26268
  cssVars: {
@@ -26278,19 +26271,19 @@ function KM(e, t) {
26278
26271
  }
26279
26272
  };
26280
26273
  }
26281
- function qM(e, t, n, r, i) {
26282
- let a = OM(t, n), o = n.viable_slot === "full" || n.display_mode === "fullscreen", s = o ? void 0 : nN(r), c = o ? 1 : JM(i ?? 0, r)?.displayScale ?? 1;
26274
+ function KM(e, t, n, r, i) {
26275
+ let a = DM(t, n), o = n.viable_slot === "full" || n.display_mode === "fullscreen", s = o ? void 0 : tN(r), c = o ? 1 : qM(i ?? 0, r)?.displayScale ?? 1;
26283
26276
  return {
26284
26277
  ...e.canvas_config.host_context,
26285
26278
  ...a,
26286
26279
  containerDimensions: {
26287
- ...rN(a.containerDimensions) ? a.containerDimensions : {},
26280
+ ...nN(a.containerDimensions) ? a.containerDimensions : {},
26288
26281
  ...s === void 0 ? {} : { maxHeight: s },
26289
26282
  displayScale: c
26290
26283
  }
26291
26284
  };
26292
26285
  }
26293
- function JM(e, t) {
26286
+ function qM(e, t) {
26294
26287
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
26295
26288
  let n = Math.min(e, 720);
26296
26289
  if (n <= t) return {
@@ -26329,11 +26322,11 @@ function JM(e, t) {
26329
26322
  }
26330
26323
  };
26331
26324
  }
26332
- function YM() {
26333
- let e = D(null), [t, n] = T(() => ZM(null));
26325
+ function JM() {
26326
+ let e = D(null), [t, n] = T(() => XM(null));
26334
26327
  return E(() => {
26335
26328
  let t = () => n((t) => {
26336
- let n = ZM(e.current);
26329
+ let n = XM(e.current);
26337
26330
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
26338
26331
  });
26339
26332
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -26343,7 +26336,7 @@ function YM() {
26343
26336
  };
26344
26337
  }, []), [e, t];
26345
26338
  }
26346
- function XM() {
26339
+ function YM() {
26347
26340
  let e = D(null), [t, n] = T();
26348
26341
  return E(() => {
26349
26342
  let t = e.current;
@@ -26359,7 +26352,7 @@ function XM() {
26359
26352
  return a.observe(t), () => a.disconnect();
26360
26353
  }, []), [e, t];
26361
26354
  }
26362
- function ZM(e) {
26355
+ function XM(e) {
26363
26356
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
26364
26357
  if (n && n.width > 0 && n.height > 0) {
26365
26358
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -26375,8 +26368,8 @@ function ZM(e) {
26375
26368
  visualViewportHeight: t
26376
26369
  };
26377
26370
  }
26378
- var QM = 72;
26379
- function $M(e) {
26371
+ var ZM = 72;
26372
+ function QM(e) {
26380
26373
  let t = "absolute flex gap-2";
26381
26374
  switch (e) {
26382
26375
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto`;
@@ -26385,25 +26378,25 @@ function $M(e) {
26385
26378
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
26386
26379
  }
26387
26380
  }
26388
- function eN(e) {
26381
+ function $M(e) {
26389
26382
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
26390
26383
  }
26391
- function tN() {
26384
+ function eN() {
26392
26385
  return !1;
26393
26386
  }
26394
- function nN(e) {
26387
+ function tN(e) {
26395
26388
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
26396
26389
  }
26397
- function rN(e) {
26390
+ function nN(e) {
26398
26391
  return typeof e == "object" && !!e && !Array.isArray(e);
26399
26392
  }
26400
- function iN(e) {
26393
+ function rN(e) {
26401
26394
  return e instanceof Error ? e : Error(String(e));
26402
26395
  }
26403
26396
  //#endregion
26404
26397
  //#region ../core/src/magic-canvas/persona-presentation.tsx
26405
- var aN = 24, oN = 96;
26406
- function sN(e = document) {
26398
+ var iN = 24, aN = 96;
26399
+ function oN(e = document) {
26407
26400
  let t = Array.from(e.querySelectorAll("[data-canvas-card]")).map((e) => e.getBoundingClientRect());
26408
26401
  return t.length === 0 ? null : {
26409
26402
  left: Math.min(...t.map((e) => e.left)),
@@ -26412,11 +26405,11 @@ function sN(e = document) {
26412
26405
  bottom: Math.max(...t.map((e) => e.bottom))
26413
26406
  };
26414
26407
  }
26415
- function cN(e) {
26408
+ function sN(e) {
26416
26409
  let t = e?.getRootNode();
26417
26410
  return t instanceof ShadowRoot ? t : document;
26418
26411
  }
26419
- function lN(e) {
26412
+ function cN(e) {
26420
26413
  if (!e) return null;
26421
26414
  let t = e.getBoundingClientRect();
26422
26415
  return t.width <= 0 || t.height <= 0 ? null : {
@@ -26426,19 +26419,19 @@ function lN(e) {
26426
26419
  bottom: t.bottom
26427
26420
  };
26428
26421
  }
26429
- function uN(e, t, n, r) {
26422
+ function lN(e, t, n, r) {
26430
26423
  if (!t) return !1;
26431
- let i = r ? r.left : 0, a = r ? r.top : 0, o = r ? r.right - r.left : globalThis.innerWidth, s = r ? r.bottom - r.top : globalThis.innerHeight, c = e?.safe_area ?? Pj, l = i + c.x * o + n, u = i + (c.x + c.width) * o + n, d = a + c.y * s, f = a + (c.y + c.height) * s;
26424
+ let i = r ? r.left : 0, a = r ? r.top : 0, o = r ? r.right - r.left : globalThis.innerWidth, s = r ? r.bottom - r.top : globalThis.innerHeight, c = e?.safe_area ?? jj, l = i + c.x * o + n, u = i + (c.x + c.width) * o + n, d = a + c.y * s, f = a + (c.y + c.height) * s;
26432
26425
  return l < t.right && u > t.left && d < t.bottom && f > t.top;
26433
26426
  }
26434
- function dN(e, t, n) {
26435
- let [r, i] = T(() => e ? sN(cN(n?.current)) : null);
26427
+ function uN(e, t, n) {
26428
+ let [r, i] = T(() => e ? oN(sN(n?.current)) : null);
26436
26429
  return dt(() => {
26437
26430
  if (!e) {
26438
26431
  i(null);
26439
26432
  return;
26440
26433
  }
26441
- let t = cN(n?.current), r = () => i(sN(t)), a = new ResizeObserver(r), o = () => {
26434
+ let t = sN(n?.current), r = () => i(oN(t)), a = new ResizeObserver(r), o = () => {
26442
26435
  for (let e of t.querySelectorAll("[data-canvas-card]")) a.observe(e);
26443
26436
  };
26444
26437
  r(), o(), a.observe(document.documentElement);
@@ -26454,14 +26447,14 @@ function dN(e, t, n) {
26454
26447
  n
26455
26448
  ]), e ? r : null;
26456
26449
  }
26457
- function fN(e, t, n) {
26458
- let [r, i] = T(() => t ? lN(e.current) : null);
26450
+ function dN(e, t, n) {
26451
+ let [r, i] = T(() => t ? cN(e.current) : null);
26459
26452
  return dt(() => {
26460
26453
  if (!t) {
26461
26454
  i(null);
26462
26455
  return;
26463
26456
  }
26464
- let n = () => i(lN(e.current)), r = new ResizeObserver(n);
26457
+ let n = () => i(cN(e.current)), r = new ResizeObserver(n);
26465
26458
  n(), e.current && r.observe(e.current), r.observe(document.documentElement);
26466
26459
  let a = globalThis.requestAnimationFrame(n);
26467
26460
  return globalThis.addEventListener("resize", n), () => {
@@ -26473,14 +26466,14 @@ function fN(e, t, n) {
26473
26466
  e
26474
26467
  ]), t ? r : null;
26475
26468
  }
26476
- function pN(e, t, n, r, i, a) {
26469
+ function fN(e, t, n, r, i, a) {
26477
26470
  let o = e?.side ?? (n === "safe-area-left" ? "left" : n === "safe-area-right" ? "right" : null);
26478
26471
  return {
26479
- usePip: o != null && (t === "pip" || t === "auto" && uN(e, r, i, a)),
26472
+ usePip: o != null && (t === "pip" || t === "auto" && lN(e, r, i, a)),
26480
26473
  side: o
26481
26474
  };
26482
26475
  }
26483
- function mN(e, t = document, n) {
26476
+ function pN(e, t = document, n) {
26484
26477
  let r = n ? n.left : 0, i = n ? n.right : globalThis.innerWidth, a = n ? n.top : 0, o = n ? n.bottom : globalThis.innerHeight, s = i - r, c = o - a, l = Array.from(t.querySelectorAll("[data-canvas-card]")).map((e) => e.getBoundingClientRect()), u, d, f, p;
26485
26478
  if (l.length > 0) {
26486
26479
  let t = Math.min(...l.map((e) => e.left)), n = Math.max(...l.map((e) => e.right));
@@ -26489,31 +26482,31 @@ function mN(e, t = document, n) {
26489
26482
  let t = Math.min(448, Math.max(0, s - 32));
26490
26483
  [u, d] = e === "right" ? [r, i - 16 - t] : [r + 16 + t, i], f = a, p = o;
26491
26484
  }
26492
- let m = d - u >= 144 && p - f >= oN && u >= r && d <= i;
26485
+ let m = d - u >= 144 && p - f >= aN && u >= r && d <= i;
26493
26486
  if (l.length > 0 && !m) {
26494
26487
  let t = Math.min(448, Math.max(0, s - 32));
26495
26488
  [u, d] = e === "right" ? [r, i - 16 - t] : [r + 16 + t, i], f = a, p = o;
26496
26489
  }
26497
- let h = Math.max(0, d - u - aN * 2), g = Math.max(oN, Math.min(h, c - aN * 2));
26490
+ let h = Math.max(0, d - u - iN * 2), g = Math.max(aN, Math.min(h, c - iN * 2));
26498
26491
  return {
26499
26492
  centerX: (u + d) / 2 - r,
26500
26493
  centerY: (f + p) / 2 - a,
26501
26494
  diameter: g
26502
26495
  };
26503
26496
  }
26504
- var hN = "560ms linear(0, 0, .0001, .0002, .0003, .0005, .0007, .001, .0013, .0016, .002, .0024, .0029, .0033, .0039, .0044, .005, .0057, .0063, .007, .0079, .0086, .0094, .0103, .0112, .0121, .0132 1.84%, .0153, .0175, .0201, .0226, .0253, .0283, .0313, .0345, .038, .0416, .0454, .0493, .0535, .0576, .0621, .0667, .0714, .0764, .0816 5.04%, .0897, .098 5.62%, .1071, .1165, .1263 6.56%, .137, .1481 7.25%, .1601 7.62%, .1706 7.94%, .1819 8.28%, .194, .2068 9.02%, .2331 9.79%, .2898 11.44%, .3151 12.18%, .3412 12.95%, .3533, .365 13.66%, .3786, .3918, .4045, .4167, .4288, .4405, .452, .4631 16.72%, .4759, .4884, .5005, .5124, .5242, .5354, .5467, .5576, .5686, .5791, .5894, .5995, .6094, .6194, .6289, .6385, .6477, .6569, .6659 24.45%, .6702, .6747, .6789, .6833, .6877, .6919, .696, .7002, .7043, .7084, .7125, .7165, .7205, .7244, .7283, .7321, .7358, .7396, .7433, .7471, .7507, .7544, .7579, .7615, .7649, .7685, .7718, .7752, .7786, .782, .7853, .7885, .7918, .7951, .7982, .8013, .8043, .8075, .8104, .8135, .8165, .8195, .8224, .8253, .8281, .8309, .8336, .8365, .8391, .8419, .8446, .8472, .8499, .8524, .855, .8575, .8599, .8625 37.27%, .8651, .8678, .8703, .8729, .8754, .8779, .8803, .8827, .8851, .8875, .8898, .892, .8942, .8965, .8987, .9009, .903, .9051, .9071, .9092, .9112, .9132, .9151, .9171, .919, .9209, .9227, .9245, .9262, .928, .9297, .9314, .9331, .9347, .9364, .9379, .9395, .941, .9425, .944, .9454, .9469, .9483, .9497, .951, .9524, .9537, .955, .9562, .9574, .9586, .9599, .961, .9622, .9633, .9644, .9655, .9665, .9676, .9686, .9696, .9705, .9715, .9724, .9733, .9742, .975, .9758, .9766, .9774, .9782, .9789, .9796, .9804, .9811, .9817, .9824, .9831, .9837, .9843, .9849, .9855, .986, .9866, .9871, .9877, .9882, .9887, .9892, .9896 70.56%, .9905 71.67%, .9914 72.82%, .9922, .9929 75.2%, .9936 76.43%, .9942 77.71%, .9948 79.03%, .9954 80.39%, .9959 81.81%, .9963 83.28%, .9968 84.82%, .9972 86.41%, .9975 88.07%, .9979 89.81%, .9982 91.64%, .9984 93.56%, .9987 95.58%, .9989 97.72%, .9991)";
26505
- function gN(e, t) {
26497
+ var mN = "560ms linear(0, 0, .0001, .0002, .0003, .0005, .0007, .001, .0013, .0016, .002, .0024, .0029, .0033, .0039, .0044, .005, .0057, .0063, .007, .0079, .0086, .0094, .0103, .0112, .0121, .0132 1.84%, .0153, .0175, .0201, .0226, .0253, .0283, .0313, .0345, .038, .0416, .0454, .0493, .0535, .0576, .0621, .0667, .0714, .0764, .0816 5.04%, .0897, .098 5.62%, .1071, .1165, .1263 6.56%, .137, .1481 7.25%, .1601 7.62%, .1706 7.94%, .1819 8.28%, .194, .2068 9.02%, .2331 9.79%, .2898 11.44%, .3151 12.18%, .3412 12.95%, .3533, .365 13.66%, .3786, .3918, .4045, .4167, .4288, .4405, .452, .4631 16.72%, .4759, .4884, .5005, .5124, .5242, .5354, .5467, .5576, .5686, .5791, .5894, .5995, .6094, .6194, .6289, .6385, .6477, .6569, .6659 24.45%, .6702, .6747, .6789, .6833, .6877, .6919, .696, .7002, .7043, .7084, .7125, .7165, .7205, .7244, .7283, .7321, .7358, .7396, .7433, .7471, .7507, .7544, .7579, .7615, .7649, .7685, .7718, .7752, .7786, .782, .7853, .7885, .7918, .7951, .7982, .8013, .8043, .8075, .8104, .8135, .8165, .8195, .8224, .8253, .8281, .8309, .8336, .8365, .8391, .8419, .8446, .8472, .8499, .8524, .855, .8575, .8599, .8625 37.27%, .8651, .8678, .8703, .8729, .8754, .8779, .8803, .8827, .8851, .8875, .8898, .892, .8942, .8965, .8987, .9009, .903, .9051, .9071, .9092, .9112, .9132, .9151, .9171, .919, .9209, .9227, .9245, .9262, .928, .9297, .9314, .9331, .9347, .9364, .9379, .9395, .941, .9425, .944, .9454, .9469, .9483, .9497, .951, .9524, .9537, .955, .9562, .9574, .9586, .9599, .961, .9622, .9633, .9644, .9655, .9665, .9676, .9686, .9696, .9705, .9715, .9724, .9733, .9742, .975, .9758, .9766, .9774, .9782, .9789, .9796, .9804, .9811, .9817, .9824, .9831, .9837, .9843, .9849, .9855, .986, .9866, .9871, .9877, .9882, .9887, .9892, .9896 70.56%, .9905 71.67%, .9914 72.82%, .9922, .9929 75.2%, .9936 76.43%, .9942 77.71%, .9948 79.03%, .9954 80.39%, .9959 81.81%, .9963 83.28%, .9968 84.82%, .9972 86.41%, .9975 88.07%, .9979 89.81%, .9982 91.64%, .9984 93.56%, .9987 95.58%, .9989 97.72%, .9991)";
26498
+ function hN(e, t) {
26506
26499
  let n = Math.abs(t) / 2;
26507
26500
  return e === "left" ? `${n}px center` : `calc(100% - ${n}px) center`;
26508
26501
  }
26509
- function _N(e, t, n) {
26510
- let [r, i] = T(() => e && t ? mN(t, cN(n?.current), lN(n?.current)) : null);
26502
+ function gN(e, t, n) {
26503
+ let [r, i] = T(() => e && t ? pN(t, sN(n?.current), cN(n?.current)) : null);
26511
26504
  return dt(() => {
26512
26505
  if (!e || !t) {
26513
26506
  i(null);
26514
26507
  return;
26515
26508
  }
26516
- let r = cN(n?.current), a = () => i(mN(t, r, lN(n?.current))), o = new ResizeObserver(a), s = () => {
26509
+ let r = sN(n?.current), a = () => i(pN(t, r, cN(n?.current))), o = new ResizeObserver(a), s = () => {
26517
26510
  for (let e of r.querySelectorAll("[data-canvas-card]")) o.observe(e);
26518
26511
  };
26519
26512
  a(), s(), n?.current && o.observe(n.current), o.observe(document.documentElement);
@@ -26529,7 +26522,7 @@ function _N(e, t, n) {
26529
26522
  n
26530
26523
  ]), e && t ? r : null;
26531
26524
  }
26532
- function vN(e, t) {
26525
+ function _N(e, t) {
26533
26526
  let [n, r] = T(null);
26534
26527
  return dt(() => {
26535
26528
  if (!t) {
@@ -26548,19 +26541,19 @@ function vN(e, t) {
26548
26541
  return a.observe(n), i(), () => a.disconnect();
26549
26542
  }, [t, e]), t ? n : null;
26550
26543
  }
26551
- var yN = 1;
26552
- function bN(e, t, n) {
26544
+ var vN = 1;
26545
+ function yN(e, t, n) {
26553
26546
  return Math.min(Math.max(e, t), n);
26554
26547
  }
26555
- function xN(e, t, n, r) {
26556
- let i = Math.min(e.diameter / t.height, 1), a = r?.safe_area ?? Pj, o = ((a.x + a.width / 2) * t.width + n) * i, s = (a.y + a.height / 2) * t.height * i, c = e.diameter / 2;
26548
+ function bN(e, t, n, r) {
26549
+ let i = Math.min(e.diameter / t.height, 1), a = r?.safe_area ?? jj, o = ((a.x + a.width / 2) * t.width + n) * i, s = (a.y + a.height / 2) * t.height * i, c = e.diameter / 2;
26557
26550
  return {
26558
26551
  scale: i,
26559
- tx: bN(e.centerX - o, e.centerX + c - t.width * i, e.centerX - c),
26560
- ty: bN(e.centerY - s, e.centerY + c - t.height * i, e.centerY - c)
26552
+ tx: yN(e.centerX - o, e.centerX + c - t.width * i, e.centerX - c),
26553
+ ty: yN(e.centerY - s, e.centerY + c - t.height * i, e.centerY - c)
26561
26554
  };
26562
26555
  }
26563
- var SN = [
26556
+ var xN = [
26564
26557
  "cx",
26565
26558
  "cy",
26566
26559
  "r",
@@ -26569,13 +26562,13 @@ var SN = [
26569
26562
  "s",
26570
26563
  "shift"
26571
26564
  ];
26572
- function CN(e, t, n, r, i) {
26565
+ function SN(e, t, n, r, i) {
26573
26566
  if (!n) return null;
26574
26567
  let { width: a, height: o } = n, s = {
26575
26568
  x: a / 2,
26576
26569
  y: o / 2
26577
26570
  }, c = null;
26578
- if (e && (c = xN(e, n, r, i), s = {
26571
+ if (e && (c = bN(e, n, r, i), s = {
26579
26572
  x: (e.centerX - c.tx) / c.scale,
26580
26573
  y: (e.centerY - c.ty) / c.scale
26581
26574
  }), t && c && e) return {
@@ -26598,12 +26591,12 @@ function CN(e, t, n, r, i) {
26598
26591
  shift: r
26599
26592
  };
26600
26593
  }
26601
- function wN(e, t, n) {
26594
+ function CN(e, t, n) {
26602
26595
  let r = D(null), i = D(e), a = D(n), o = D(0), s = D(0);
26603
26596
  i.current = e, a.current = n, E(() => {
26604
26597
  let e = i.current;
26605
26598
  if (!e) return;
26606
- if (!r.current || TN()) {
26599
+ if (!r.current || wN()) {
26607
26600
  r.current = {
26608
26601
  values: { ...e },
26609
26602
  velocity: {
@@ -26628,21 +26621,21 @@ function wN(e, t, n) {
26628
26621
  let u = Math.min((e - s.current) / 1e3, 1 / 30);
26629
26622
  s.current = e;
26630
26623
  let d = !0;
26631
- for (let e of SN) {
26624
+ for (let e of xN) {
26632
26625
  let r = (t[e] - l.values[e]) / (n * n) - 2 / n * l.velocity[e], i = l.velocity[e] + r * u, a = l.values[e] + i * u, o = e === "s" ? .001 : .25;
26633
26626
  Math.abs(t[e] - a) < o && Math.abs(i) * n < o ? (l.values[e] = t[e], l.velocity[e] = 0) : (l.values[e] = a, l.velocity[e] = i, d = !1);
26634
26627
  }
26635
26628
  a.current(l.values, d), d || (o.current = globalThis.requestAnimationFrame(c));
26636
26629
  };
26637
26630
  o.current = globalThis.requestAnimationFrame(c);
26638
- }, [e ? SN.map((t) => Math.round(e[t] * 100)).join() : "", t]), E(() => () => {
26631
+ }, [e ? xN.map((t) => Math.round(e[t] * 100)).join() : "", t]), E(() => () => {
26639
26632
  o.current && globalThis.cancelAnimationFrame(o.current);
26640
26633
  }, []);
26641
26634
  }
26642
- function TN() {
26635
+ function wN() {
26643
26636
  return globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
26644
26637
  }
26645
- function EN({ geom: e, visible: t }) {
26638
+ function TN({ geom: e, visible: t }) {
26646
26639
  return /* @__PURE__ */ A("div", {
26647
26640
  "aria-hidden": "true",
26648
26641
  "data-morph": "ring",
@@ -26658,7 +26651,7 @@ function EN({ geom: e, visible: t }) {
26658
26651
  }
26659
26652
  });
26660
26653
  }
26661
- function DN(e, t) {
26654
+ function EN(e, t) {
26662
26655
  let n = t >= 0 ? "left" : "right", r = D({
26663
26656
  side: n,
26664
26657
  shift: t
@@ -26676,14 +26669,14 @@ function DN(e, t) {
26676
26669
  let i = e ? n : r.current.side;
26677
26670
  return {
26678
26671
  side: i,
26679
- transformOrigin: gN(i, e ? t : r.current.shift),
26672
+ transformOrigin: hN(i, e ? t : r.current.shift),
26680
26673
  translateX: e ? 0 : -r.current.shift
26681
26674
  };
26682
26675
  }
26683
- function ON(e, t, n) {
26676
+ function DN(e, t, n) {
26684
26677
  return `${e.side ?? ""}:${e.active}:${t}:${n ?? ""}`;
26685
26678
  }
26686
- function kN({ snapshotUrl: e, transformOrigin: t }) {
26679
+ function ON({ snapshotUrl: e, transformOrigin: t }) {
26687
26680
  return /* @__PURE__ */ A("div", {
26688
26681
  class: "absolute inset-0 bg-cover bg-center",
26689
26682
  style: {
@@ -26693,7 +26686,7 @@ function kN({ snapshotUrl: e, transformOrigin: t }) {
26693
26686
  }
26694
26687
  });
26695
26688
  }
26696
- function AN({ snapshotUrl: e, translateX: t, transition: n, transformOrigin: r }) {
26689
+ function kN({ snapshotUrl: e, translateX: t, transition: n, transformOrigin: r }) {
26697
26690
  return /* @__PURE__ */ A("div", {
26698
26691
  "aria-hidden": "true",
26699
26692
  "data-morph": "mirror",
@@ -26704,13 +26697,13 @@ function AN({ snapshotUrl: e, translateX: t, transition: n, transformOrigin: r }
26704
26697
  transition: `transform ${n}`,
26705
26698
  willChange: "transform"
26706
26699
  },
26707
- children: /* @__PURE__ */ A(kN, {
26700
+ children: /* @__PURE__ */ A(ON, {
26708
26701
  snapshotUrl: e,
26709
26702
  transformOrigin: r
26710
26703
  })
26711
26704
  });
26712
26705
  }
26713
- function jN({ ambient: e, usePip: t, transition: n }) {
26706
+ function AN({ ambient: e, usePip: t, transition: n }) {
26714
26707
  return e === "none" ? null : /* @__PURE__ */ A("div", {
26715
26708
  "aria-hidden": "true",
26716
26709
  "data-morph": "ambient",
@@ -26722,7 +26715,7 @@ function jN({ ambient: e, usePip: t, transition: n }) {
26722
26715
  }
26723
26716
  });
26724
26717
  }
26725
- function MN({ morphCapable: e, snapshotUrl: t, mirrorSide: n, videoShiftX: r, transition: i, sceneRef: a, videoWrapRef: o, fill: s, videoRef: c }) {
26718
+ function jN({ morphCapable: e, snapshotUrl: t, mirrorSide: n, videoShiftX: r, transition: i, sceneRef: a, videoWrapRef: o, fill: s, videoRef: c }) {
26726
26719
  return /* @__PURE__ */ A("div", {
26727
26720
  ref: a,
26728
26721
  "data-morph": "scene",
@@ -26739,8 +26732,8 @@ function MN({ morphCapable: e, snapshotUrl: t, mirrorSide: n, videoShiftX: r, tr
26739
26732
  "aria-hidden": "true",
26740
26733
  "data-morph": "window-mirror",
26741
26734
  class: "absolute top-0 bottom-0 w-full",
26742
- style: n === "right" ? { left: `calc(100% - ${yN}px)` } : { right: `calc(100% - ${yN}px)` },
26743
- children: /* @__PURE__ */ A(kN, {
26735
+ style: n === "right" ? { left: `calc(100% - ${vN}px)` } : { right: `calc(100% - ${vN}px)` },
26736
+ children: /* @__PURE__ */ A(ON, {
26744
26737
  snapshotUrl: t,
26745
26738
  transformOrigin: "center"
26746
26739
  })
@@ -26748,8 +26741,8 @@ function MN({ morphCapable: e, snapshotUrl: t, mirrorSide: n, videoShiftX: r, tr
26748
26741
  })
26749
26742
  });
26750
26743
  }
26751
- function NN({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n, fill: r, captureSnapshot: i, transition: a = hN, transitionMs: o = 560, personaMode: s = "shift", renderedSlot: c = null, ambient: l = "default", children: u }) {
26752
- let d = D(null), [f, p] = T(null), m = t && e.backdrop.type === "snapshot_mirror", h = t ? e.video_shift_x : 0, g = D(null), _ = ON(e, h, c), { usePip: v, side: y } = pN(e, s, c, dN(s !== "shift", _, g), h, fN(g, s !== "shift", _)), b = _N(s !== "shift", y, g), x = DN(m, h);
26744
+ function MN({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n, fill: r, captureSnapshot: i, transition: a = mN, transitionMs: o = 560, personaMode: s = "shift", renderedSlot: c = null, ambient: l = "default", children: u }) {
26745
+ let d = D(null), [f, p] = T(null), m = t && e.backdrop.type === "snapshot_mirror", h = t ? e.video_shift_x : 0, g = D(null), _ = DN(e, h, c), { usePip: v, side: y } = fN(e, s, c, uN(s !== "shift", _, g), h, dN(g, s !== "shift", _)), b = gN(s !== "shift", y, g), x = EN(m, h);
26753
26746
  E(() => {
26754
26747
  if (!m) return;
26755
26748
  let e = !1, t = 0, n, r = 0, a = () => {
@@ -26780,23 +26773,23 @@ function NN({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n,
26780
26773
  f,
26781
26774
  o
26782
26775
  ]);
26783
- let S = v && y != null && b != null, C = s !== "shift", w = vN(g, C), ee = f !== null && !C, te = C && y != null, ne = D(null), re = D(null), [ie, ae] = T(!0), oe = D(!0), se = k((e, t) => {
26776
+ let S = v && y != null && b != null, C = s !== "shift", w = _N(g, C), ee = f !== null && !C, te = C && y != null, ne = D(null), re = D(null), [ie, ae] = T(!0), oe = D(!0), se = k((e, t) => {
26784
26777
  let n = ne.current;
26785
26778
  n && (n.style.clipPath = `circle(${e.r}px at ${e.cx}px ${e.cy}px)`, n.style.transform = `translate(${e.tx}px, ${e.ty}px) scale(${e.s})`);
26786
26779
  let r = re.current;
26787
26780
  r && (r.style.transform = `translate3d(${e.shift}px, 0, 0)`), oe.current !== t && (oe.current = t, ae(t));
26788
26781
  }, []);
26789
- return wN(C ? CN(b, S, w, h, e) : null, o, se), /* @__PURE__ */ A("div", {
26782
+ return CN(C ? SN(b, S, w, h, e) : null, o, se), /* @__PURE__ */ A("div", {
26790
26783
  ref: g,
26791
26784
  class: `relative w-full h-full overflow-hidden ${n ? "flex items-center justify-center" : ""}`,
26792
26785
  children: [
26793
- ee && f !== null && /* @__PURE__ */ A(AN, {
26786
+ ee && f !== null && /* @__PURE__ */ A(kN, {
26794
26787
  snapshotUrl: f,
26795
26788
  translateX: x.translateX,
26796
26789
  transition: a,
26797
26790
  transformOrigin: x.transformOrigin
26798
26791
  }),
26799
- te && /* @__PURE__ */ A(jN, {
26792
+ te && /* @__PURE__ */ A(AN, {
26800
26793
  ambient: l,
26801
26794
  usePip: v,
26802
26795
  transition: a
@@ -26804,7 +26797,7 @@ function NN({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n,
26804
26797
  /* @__PURE__ */ A("div", {
26805
26798
  "data-morph": "fg",
26806
26799
  class: "absolute inset-0 z-10",
26807
- children: /* @__PURE__ */ A(MN, {
26800
+ children: /* @__PURE__ */ A(jN, {
26808
26801
  morphCapable: C,
26809
26802
  snapshotUrl: f,
26810
26803
  mirrorSide: x.side,
@@ -26816,7 +26809,7 @@ function NN({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n,
26816
26809
  videoRef: d
26817
26810
  })
26818
26811
  }),
26819
- C && b && /* @__PURE__ */ A(EN, {
26812
+ C && b && /* @__PURE__ */ A(TN, {
26820
26813
  geom: b,
26821
26814
  visible: S && ie
26822
26815
  }),
@@ -26826,8 +26819,8 @@ function NN({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n,
26826
26819
  }
26827
26820
  //#endregion
26828
26821
  //#region ../core/src/hooks/use-replica-join-timeout.ts
26829
- var PN = 1e4;
26830
- function FN({ onTimeout: e, timeoutMs: t = PN, active: n = !0 }) {
26822
+ var NN = 1e4;
26823
+ function PN({ onTimeout: e, timeoutMs: t = NN, active: n = !0 }) {
26831
26824
  let r = $b().length > 0, [i, a] = T(!1), o = D(e);
26832
26825
  return E(() => {
26833
26826
  o.current = e;
@@ -26851,22 +26844,22 @@ function FN({ onTimeout: e, timeoutMs: t = PN, active: n = !0 }) {
26851
26844
  }
26852
26845
  //#endregion
26853
26846
  //#region ../core/src/hooks/use-system-shutdown.ts
26854
- function IN(e) {
26847
+ function FN(e) {
26855
26848
  if (typeof e != "object" || !e) return !1;
26856
26849
  let t = e;
26857
26850
  return t.message_type === "system" && t.event_type === "system.shutdown";
26858
26851
  }
26859
- function LN({ onShutdown: e }) {
26852
+ function IN({ onShutdown: e }) {
26860
26853
  let t = D(e);
26861
26854
  E(() => {
26862
26855
  t.current = e;
26863
26856
  }, [e]), Wg({ onAppMessage: k((e) => {
26864
- IN(e?.data) && t.current();
26857
+ FN(e?.data) && t.current();
26865
26858
  }, []) });
26866
26859
  }
26867
26860
  //#endregion
26868
26861
  //#region ../core/src/hooks/use-cvi-call.ts
26869
- function RN() {
26862
+ function LN() {
26870
26863
  let e = oh();
26871
26864
  return {
26872
26865
  joinCall: k(({ url: t, micOnly: n = !1 }) => {
@@ -26882,24 +26875,24 @@ function RN() {
26882
26875
  }
26883
26876
  //#endregion
26884
26877
  //#region ../core/src/hooks/use-picture-in-picture.ts
26885
- var zN = yn("PiP"), BN = 360, VN = 280;
26886
- function HN() {
26878
+ var RN = yn("PiP"), zN = 360, BN = 280;
26879
+ function VN() {
26887
26880
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
26888
26881
  }
26889
- function UN(e) {
26890
- let { enabled: t, active: n } = e, [r, i] = T(null), a = HN(), o = pt(hv), s = k(() => {
26882
+ function HN(e) {
26883
+ let { enabled: t, active: n } = e, [r, i] = T(null), a = VN(), o = pt(hv), s = k(() => {
26891
26884
  i((e) => (e && !e.closed && e.close(), null));
26892
26885
  }, []), c = k(async () => {
26893
26886
  if (a && !(!t || !n) && !(r && !r.closed)) try {
26894
26887
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
26895
- width: BN,
26896
- height: VN
26888
+ width: zN,
26889
+ height: BN
26897
26890
  }), t = Ye.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
26898
26891
  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", () => {
26899
26892
  i((t) => t === e ? null : t);
26900
26893
  }, { once: !0 }), i(e);
26901
26894
  } catch (e) {
26902
- zN.warn("Failed to open PiP window", e);
26895
+ RN.warn("Failed to open PiP window", e);
26903
26896
  }
26904
26897
  }, [
26905
26898
  a,
@@ -26920,13 +26913,13 @@ function UN(e) {
26920
26913
  try {
26921
26914
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
26922
26915
  } catch (e) {
26923
- zN.warn("mediaSession metadata setup failed", e);
26916
+ RN.warn("mediaSession metadata setup failed", e);
26924
26917
  }
26925
26918
  let t = (t, n) => {
26926
26919
  try {
26927
26920
  e.setActionHandler(t, n), r.push(t);
26928
26921
  } catch (e) {
26929
- zN.warn(`mediaSession.${t} not supported`, e);
26922
+ RN.warn(`mediaSession.${t} not supported`, e);
26930
26923
  }
26931
26924
  };
26932
26925
  t("enterpictureinpicture", () => {
@@ -26980,11 +26973,11 @@ function UN(e) {
26980
26973
  }
26981
26974
  //#endregion
26982
26975
  //#region ../core/src/utils/device-preferences.ts
26983
- var WN = Wt(null), GN = {
26976
+ var UN = Wt(null), WN = {
26984
26977
  active: !1,
26985
26978
  video_shift_x: 0,
26986
26979
  backdrop: { type: "snapshot_mirror" }
26987
- }, KN = ba(({ id: e, showAudioWave: t = !0 }) => {
26980
+ }, GN = ba(({ id: e, showAudioWave: t = !0 }) => {
26988
26981
  let n = r_(e).isOff;
26989
26982
  return /* @__PURE__ */ A("div", {
26990
26983
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -26999,28 +26992,28 @@ var WN = Wt(null), GN = {
26999
26992
  children: /* @__PURE__ */ A(Yb, { id: e })
27000
26993
  })]
27001
26994
  });
27002
- }), qN = ba(() => {
26995
+ }), KN = ba(() => {
27003
26996
  let e = Uh(), { isScreenSharing: t } = ib(), n = $b()[0];
27004
- return /* @__PURE__ */ A(ue, { children: [t && n && /* @__PURE__ */ A(KN, { id: n }), e && /* @__PURE__ */ A(KN, {
26997
+ return /* @__PURE__ */ A(ue, { children: [t && n && /* @__PURE__ */ A(GN, { id: n }), e && /* @__PURE__ */ A(GN, {
27005
26998
  id: e,
27006
26999
  showAudioWave: !1
27007
27000
  })] });
27008
- }), JN = ba(() => /* @__PURE__ */ A("div", {
27001
+ }), qN = ba(() => /* @__PURE__ */ A("div", {
27009
27002
  class: "absolute top-4 left-4 flex flex-col items-end gap-2 z-20",
27010
- children: /* @__PURE__ */ A(qN, {})
27011
- })), YN = ba(({ isAudioOnly: e, canvasLayoutEffect: t, canvasRenderedSlot: n }) => {
27003
+ children: /* @__PURE__ */ A(KN, {})
27004
+ })), JN = ba(({ isAudioOnly: e, canvasLayoutEffect: t, canvasRenderedSlot: n }) => {
27012
27005
  let r = Uh(), i = !t_(r ?? "").isOff, a = ex(e), o = t_(a.phase === "ready" ? a.replicaId : ""), s = !i && (o.state === "playable" || o.state === "loading"), c = t.active && !i && (!e || s);
27013
27006
  return a.phase === "left" ? /* @__PURE__ */ A(qb, {}) : a.phase === "connecting" ? /* @__PURE__ */ A(Kb, {}) : e && !s ? /* @__PURE__ */ A("div", {
27014
27007
  class: "absolute inset-0 flex items-center justify-center",
27015
27008
  children: [/* @__PURE__ */ A(Xb, { sessionId: a.replicaId }), /* @__PURE__ */ A(tg, { sessionId: a.replicaId })]
27016
- }) : /* @__PURE__ */ A(NN, {
27009
+ }) : /* @__PURE__ */ A(MN, {
27017
27010
  canvasLayoutEffect: s ? {
27018
27011
  ...t,
27019
27012
  backdrop: { type: "none" }
27020
27013
  } : t,
27021
27014
  smartSidecarActive: c,
27022
27015
  isScreenSharing: i,
27023
- captureSnapshot: $N,
27016
+ captureSnapshot: QN,
27024
27017
  personaMode: s ? "shift" : "auto",
27025
27018
  renderedSlot: n,
27026
27019
  fill: (t) => /* @__PURE__ */ A(rx, {
@@ -27034,7 +27027,7 @@ var WN = Wt(null), GN = {
27034
27027
  }),
27035
27028
  children: /* @__PURE__ */ A(tg, { sessionId: a.replicaId })
27036
27029
  });
27037
- }), XN = ba(({ items: e }) => {
27030
+ }), YN = ba(({ items: e }) => {
27038
27031
  let [t, n] = T(!1), r = D(null);
27039
27032
  return E(() => {
27040
27033
  if (!t) return;
@@ -27064,8 +27057,8 @@ var WN = Wt(null), GN = {
27064
27057
  children: e
27065
27058
  })]
27066
27059
  });
27067
- }), ZN = ba(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ A(ue, { children: e }) : /* @__PURE__ */ A(XN, { items: e })), QN = ba(({ onLeave: e }) => {
27068
- let { joinCall: t, leaveCall: n } = RN(), r = Mg(), { config: i } = K_(), { session: a, end: o } = Nb(), s = Uh(), c = D(null), l = pt(Tv)?.frameRef ?? c, [u, d] = T(!1), [f, p] = T(!1), [m, h] = T(GN), [g, _] = T(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: w } = UN({
27060
+ }), XN = ba(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ A(ue, { children: e }) : /* @__PURE__ */ A(YN, { items: e })), ZN = ba(({ onLeave: e }) => {
27061
+ let { joinCall: t, leaveCall: n } = LN(), r = Mg(), { config: i } = K_(), { session: a, end: o } = Nb(), s = Uh(), c = D(null), l = pt(Tv)?.frameRef ?? c, [u, d] = T(!1), [f, p] = T(!1), [m, h] = T(WN), [g, _] = T(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: w } = HN({
27069
27062
  enabled: C,
27070
27063
  active: r === "joined-meeting"
27071
27064
  });
@@ -27077,13 +27070,13 @@ var WN = Wt(null), GN = {
27077
27070
  }), []);
27078
27071
  let { camera: ee, requestCamera: te } = lb(), { isCamMuted: ne } = nb(), re = ee.isGranted && !ne;
27079
27072
  E(() => {
27080
- !b && r === "joined-meeting" && (WN.value = re);
27073
+ !b && r === "joined-meeting" && (UN.value = re);
27081
27074
  }, [
27082
27075
  b,
27083
27076
  r,
27084
27077
  re
27085
27078
  ]);
27086
- let ie = D(!b && !s && WN.value === !0);
27079
+ let ie = D(!b && !s && UN.value === !0);
27087
27080
  E(() => {
27088
27081
  r === "joined-meeting" && ie.current && (ie.current = !1, te());
27089
27082
  }, [r, te]), E(() => {
@@ -27107,10 +27100,10 @@ var WN = Wt(null), GN = {
27107
27100
  let oe = k(() => {
27108
27101
  o(), n();
27109
27102
  }, [o]);
27110
- if (FN({
27103
+ if (PN({
27111
27104
  active: r === "joined-meeting",
27112
27105
  onTimeout: oe
27113
- }), LN({ onShutdown: oe }), !v) return null;
27106
+ }), IN({ onShutdown: oe }), !v) return null;
27114
27107
  let se = [/* @__PURE__ */ A(Mb, { compact: !0 }, "screen-share")];
27115
27108
  return x && se.push(/* @__PURE__ */ A(Hb, { compact: !0 }, "chat")), /* @__PURE__ */ A(Fb, { children: /* @__PURE__ */ A(Bb, { children: /* @__PURE__ */ A(gb, { children: [/* @__PURE__ */ A("div", {
27116
27109
  class: "absolute inset-0",
@@ -27118,14 +27111,14 @@ var WN = Wt(null), GN = {
27118
27111
  /* @__PURE__ */ A("div", {
27119
27112
  class: "relative w-full h-full z-[5]",
27120
27113
  children: [
27121
- /* @__PURE__ */ A(YN, {
27114
+ /* @__PURE__ */ A(JN, {
27122
27115
  isAudioOnly: b,
27123
27116
  canvasLayoutEffect: m,
27124
27117
  canvasRenderedSlot: g
27125
27118
  }),
27126
- !b && /* @__PURE__ */ A(JN, {}),
27119
+ !b && /* @__PURE__ */ A(qN, {}),
27127
27120
  /* @__PURE__ */ A(Rb, {}),
27128
- /* @__PURE__ */ A(BM, {
27121
+ /* @__PURE__ */ A(zM, {
27129
27122
  debugEnabled: f,
27130
27123
  onLayoutEffectChange: h,
27131
27124
  onRenderedSlotChange: _
@@ -27150,7 +27143,7 @@ var WN = Wt(null), GN = {
27150
27143
  /* @__PURE__ */ A(Db, {}),
27151
27144
  !b && /* @__PURE__ */ A(kb, {}),
27152
27145
  S && /* @__PURE__ */ A(Lb, {}),
27153
- /* @__PURE__ */ A(ZN, { items: se }),
27146
+ /* @__PURE__ */ A(XN, { items: se }),
27154
27147
  /* @__PURE__ */ A("button", {
27155
27148
  type: "button",
27156
27149
  class: "btn btn-control btn-error",
@@ -27167,7 +27160,7 @@ var WN = Wt(null), GN = {
27167
27160
  ]
27168
27161
  }), w && La(/* @__PURE__ */ A(nx, { onLeave: oe }), w.document.body)] }) }) });
27169
27162
  });
27170
- function $N(e) {
27163
+ function QN(e) {
27171
27164
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
27172
27165
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
27173
27166
  t.width = 640, t.height = n;
@@ -27182,7 +27175,7 @@ function $N(e) {
27182
27175
  }
27183
27176
  //#endregion
27184
27177
  //#region ../core/src/components/ui/loading-button.tsx
27185
- function eP({ loading: e = !1, disabled: t, class: n, children: r, ...i }) {
27178
+ function $N({ loading: e = !1, disabled: t, class: n, children: r, ...i }) {
27186
27179
  return /* @__PURE__ */ A("button", {
27187
27180
  type: "button",
27188
27181
  class: `btn relative ${n ? ` ${n}` : ""}`,
@@ -27198,7 +27191,7 @@ function eP({ loading: e = !1, disabled: t, class: n, children: r, ...i }) {
27198
27191
  }
27199
27192
  //#endregion
27200
27193
  //#region ../core/src/components/hair-check/index.tsx
27201
- function tP(e, t, n) {
27194
+ function eP(e, t, n) {
27202
27195
  switch (t) {
27203
27196
  case "granted": return n ? e?.cameraOptional ?? "Camera is optional — turn it on anytime." : e?.ready ?? "You're all set — join whenever you're ready.";
27204
27197
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -27209,7 +27202,7 @@ function tP(e, t, n) {
27209
27202
  default: return e?.loading ?? "Getting your microphone ready...";
27210
27203
  }
27211
27204
  }
27212
- function nP({ message: e }) {
27205
+ function tP({ message: e }) {
27213
27206
  return /* @__PURE__ */ A("div", {
27214
27207
  class: "relative max-w-[min(20rem,90%)]",
27215
27208
  children: [/* @__PURE__ */ A("div", {
@@ -27230,7 +27223,7 @@ function nP({ message: e }) {
27230
27223
  })]
27231
27224
  });
27232
27225
  }
27233
- var rP = ba(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27226
+ var nP = ba(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27234
27227
  let i = oh(), { config: a } = K_(), { localSessionId: o, isCamMuted: s } = nb(), { mic: c, camera: l, requestMic: u, requestCamera: d } = lb(), f = a.value.customization.conversation.modality === "video";
27235
27228
  E(() => {
27236
27229
  u();
@@ -27245,7 +27238,7 @@ var rP = ba(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27245
27238
  l.isBlocked,
27246
27239
  d
27247
27240
  ]);
27248
- let h = f && p && !l.isGranted, g = tP(e, c.status, h);
27241
+ let h = f && p && !l.isGranted, g = eP(e, c.status, h);
27249
27242
  return /* @__PURE__ */ A(gb, { children: /* @__PURE__ */ A("div", {
27250
27243
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
27251
27244
  children: [l.isGranted && !s ? /* @__PURE__ */ A("div", {
@@ -27266,14 +27259,14 @@ var rP = ba(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27266
27259
  })
27267
27260
  }), /* @__PURE__ */ A("div", {
27268
27261
  class: "absolute bottom-6 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[90%]",
27269
- children: [g && /* @__PURE__ */ A(nP, { message: g }), /* @__PURE__ */ A("div", {
27262
+ children: [g && /* @__PURE__ */ A(tP, { message: g }), /* @__PURE__ */ A("div", {
27270
27263
  class: "flex flex-wrap items-center justify-center gap-1.5 @max-mobile:gap-1",
27271
27264
  children: [
27272
27265
  /* @__PURE__ */ A("div", {
27273
27266
  class: "flex items-center justify-center gap-1.5 shrink-0 @max-mobile:gap-1",
27274
27267
  children: [/* @__PURE__ */ A(Db, {}), f && /* @__PURE__ */ A(kb, {})]
27275
27268
  }),
27276
- /* @__PURE__ */ A(eP, {
27269
+ /* @__PURE__ */ A($N, {
27277
27270
  class: "btn-accent ",
27278
27271
  loading: t,
27279
27272
  disabled: !p,
@@ -27292,8 +27285,8 @@ var rP = ba(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
27292
27285
  })]
27293
27286
  })]
27294
27287
  }) });
27295
- }), iP = "Password required", aP = "Enter the password to start this conversation.", oP = "Password", sP = "Continue";
27296
- function cP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27288
+ }), rP = "Password required", iP = "Enter the password to start this conversation.", aP = "Password", oP = "Continue";
27289
+ function sP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27297
27290
  let [i, a] = T(""), o = ht();
27298
27291
  return /* @__PURE__ */ A("div", {
27299
27292
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -27313,18 +27306,18 @@ function cP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27313
27306
  /* @__PURE__ */ A("h3", {
27314
27307
  id: `${o}-title`,
27315
27308
  class: "card-title text-base-content",
27316
- children: t?.title ?? iP
27309
+ children: t?.title ?? rP
27317
27310
  }),
27318
27311
  /* @__PURE__ */ A("p", {
27319
27312
  class: "text-sm text-base-content/70",
27320
- children: t?.description ?? aP
27313
+ children: t?.description ?? iP
27321
27314
  }),
27322
27315
  /* @__PURE__ */ A("input", {
27323
27316
  id: o,
27324
27317
  type: "password",
27325
27318
  autocomplete: "current-password",
27326
27319
  class: "input input-bordered w-full",
27327
- placeholder: t?.placeholder ?? oP,
27320
+ placeholder: t?.placeholder ?? aP,
27328
27321
  value: i,
27329
27322
  disabled: n,
27330
27323
  onInput: (e) => a(e.target.value),
@@ -27335,12 +27328,12 @@ function cP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27335
27328
  role: "alert",
27336
27329
  children: r
27337
27330
  }),
27338
- /* @__PURE__ */ A(eP, {
27331
+ /* @__PURE__ */ A($N, {
27339
27332
  class: "btn-primary",
27340
27333
  type: "submit",
27341
27334
  disabled: !i.trim(),
27342
27335
  loading: n,
27343
- children: t?.submit ?? sP
27336
+ children: t?.submit ?? oP
27344
27337
  })
27345
27338
  ]
27346
27339
  })
@@ -27349,11 +27342,11 @@ function cP({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
27349
27342
  }
27350
27343
  //#endregion
27351
27344
  //#region ../core/src/components/captcha-challenge/index.tsx
27352
- var lP = yn("CaptchaChallenge"), uP = 1;
27353
- function dP(e) {
27345
+ var cP = yn("CaptchaChallenge"), lP = 1;
27346
+ function uP(e) {
27354
27347
  return typeof e == "object" && !!e && e.source === "tavus-captcha" && typeof e.type == "string";
27355
27348
  }
27356
- function fP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
27349
+ function dP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
27357
27350
  let i = (pt(wt).baseUrl ?? "https://tavusapi.com").replace(/\/+$/, "").split("/").slice(0, 3).join("/"), [a, o] = T(0), [s, c] = T(0), [l, u] = T(!1), [d, f] = T(!1), p = `${i}${e.challenge_path}?deployment_uuid=${encodeURIComponent(t)}&action=${encodeURIComponent(e.action)}&parent_origin=${encodeURIComponent(window.location.origin)}`, m = k(() => {
27358
27351
  f(!1), o((e) => e + 1);
27359
27352
  }, []);
@@ -27361,20 +27354,20 @@ function fP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
27361
27354
  function e(e) {
27362
27355
  if (l || e.origin !== i) return;
27363
27356
  let a = e.data;
27364
- if (dP(a) && a.deployment_uuid === t) {
27357
+ if (uP(a) && a.deployment_uuid === t) {
27365
27358
  if (a.type === "interactive") {
27366
27359
  f(!0);
27367
27360
  return;
27368
27361
  }
27369
27362
  if (a.type === "token" && a.token) {
27370
- lP.info("Captcha token received"), f(!1), n(a.token);
27363
+ cP.info("Captcha token received"), f(!1), n(a.token);
27371
27364
  return;
27372
27365
  }
27373
27366
  if (a.type === "expired") {
27374
- lP.info("Captcha token expired, reloading iframe"), m();
27367
+ cP.info("Captcha token expired, reloading iframe"), m();
27375
27368
  return;
27376
27369
  }
27377
- a.type === "error" && (lP.warn("Captcha error received", a.code), s < uP ? (c((e) => e + 1), m()) : (lP.warn("Captcha error retries exhausted, falling back to no-token mode"), u(!0), r()));
27370
+ a.type === "error" && (cP.warn("Captcha error received", a.code), s < lP ? (c((e) => e + 1), m()) : (cP.warn("Captcha error retries exhausted, falling back to no-token mode"), u(!0), r()));
27378
27371
  }
27379
27372
  }
27380
27373
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
@@ -27404,7 +27397,7 @@ function fP({ captcha: e, deploymentId: t, onToken: n, onFallback: r }) {
27404
27397
  }
27405
27398
  //#endregion
27406
27399
  //#region ../core/src/components/welcome/index.tsx
27407
- function pP({ text: e, onStart: t, isStarting: n }) {
27400
+ function fP({ text: e, onStart: t, isStarting: n }) {
27408
27401
  let { config: r, deploymentId: i } = K_(), a = pt(L_), o = Ry(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 = O(() => d && m_(i, c), [
27409
27402
  d,
27410
27403
  i,
@@ -27413,13 +27406,13 @@ function pP({ text: e, onStart: t, isStarting: n }) {
27413
27406
  return /* @__PURE__ */ A(Wy, {
27414
27407
  title: o.title,
27415
27408
  description: o.description,
27416
- overlay: /* @__PURE__ */ A(ue, { children: [ee && /* @__PURE__ */ A(fP, {
27409
+ overlay: /* @__PURE__ */ A(ue, { children: [ee && /* @__PURE__ */ A(dP, {
27417
27410
  captcha: _,
27418
27411
  deploymentId: i,
27419
27412
  onToken: b,
27420
27413
  onFallback: x
27421
- }, y), g && a ? /* @__PURE__ */ A(cP, { onSubmit: a.setPassword }) : null] }),
27422
- children: [/* @__PURE__ */ A(eP, {
27414
+ }, y), g && a ? /* @__PURE__ */ A(sP, { onSubmit: a.setPassword }) : null] }),
27415
+ children: [/* @__PURE__ */ A($N, {
27423
27416
  class: "btn-neutral rounded-box",
27424
27417
  onClick: () => {
27425
27418
  d && C && !f && __(i, c), t();
@@ -27451,23 +27444,23 @@ function pP({ text: e, onStart: t, isStarting: n }) {
27451
27444
  }
27452
27445
  //#endregion
27453
27446
  //#region ../core/src/shells/flow-state-body.tsx
27454
- function mP({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
27447
+ function pP({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
27455
27448
  switch (e.state) {
27456
- case "idle": return /* @__PURE__ */ A(pP, {
27449
+ case "idle": return /* @__PURE__ */ A(fP, {
27457
27450
  text: t,
27458
27451
  onStart: () => {
27459
27452
  e.start();
27460
27453
  },
27461
27454
  isStarting: e.isStarting
27462
27455
  });
27463
- case "haircheck": return /* @__PURE__ */ A(rP, {
27456
+ case "haircheck": return /* @__PURE__ */ A(nP, {
27464
27457
  onJoin: () => {
27465
27458
  e.join();
27466
27459
  },
27467
27460
  onCancel: () => e.cancel(),
27468
27461
  isJoining: e.isStarting
27469
27462
  });
27470
- case "call": return /* @__PURE__ */ A(QN, { onLeave: () => e.leave() });
27463
+ case "call": return /* @__PURE__ */ A(ZN, { onLeave: () => e.leave() });
27471
27464
  case "ended": return /* @__PURE__ */ A(tb, { onRestart: () => e.restart() });
27472
27465
  case "unavailable": return /* @__PURE__ */ A(Yy, {
27473
27466
  cause: e.unavailableCause ?? "busy",
@@ -27485,8 +27478,8 @@ function mP({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
27485
27478
  }
27486
27479
  //#endregion
27487
27480
  //#region ../core/src/providers/widget-ui-provider.tsx
27488
- var hP = Ie(null);
27489
- function gP({ children: e }) {
27481
+ var mP = Ie(null);
27482
+ function hP({ children: e }) {
27490
27483
  let { config: t } = pt(bi), n = t.peek().customization?.widget, r = n?.expandable ?? "default", i = dn(r === "start-expanded" || r === "always"), a = dn(n?.variant ?? "full"), o = dn(n?.position ?? "bottom-right"), s = dn(r), c = dn(n?.avatar?.type ?? "orb"), l = D(r);
27491
27484
  vn(() => {
27492
27485
  let e = t.value.customization?.widget, n = e?.expandable ?? "default";
@@ -27517,21 +27510,21 @@ function gP({ children: e }) {
27517
27510
  d,
27518
27511
  f
27519
27512
  ]);
27520
- return /* @__PURE__ */ A(hP.Provider, {
27513
+ return /* @__PURE__ */ A(mP.Provider, {
27521
27514
  value: p,
27522
27515
  children: e
27523
27516
  });
27524
27517
  }
27525
27518
  //#endregion
27526
27519
  //#region ../core/src/components/powered-by/index.tsx
27527
- function _P() {
27520
+ function gP() {
27528
27521
  let { config: e } = K_(), t = e.value.customization.branding;
27529
- return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ A(vP, {}) : t?.logo || t?.text ? /* @__PURE__ */ A(yP, {
27522
+ return e.value.show_tavus_branding !== !1 && !t?.hide_tavus_badge ? /* @__PURE__ */ A(_P, {}) : t?.logo || t?.text ? /* @__PURE__ */ A(vP, {
27530
27523
  logo: t.logo,
27531
27524
  text: t.text
27532
27525
  }) : null;
27533
27526
  }
27534
- function vP() {
27527
+ function _P() {
27535
27528
  let { isDark: e } = _j(), t = e.value ? "white" : "#140206";
27536
27529
  return /* @__PURE__ */ A("a", {
27537
27530
  href: "https://tavus.io",
@@ -27558,7 +27551,7 @@ function vP() {
27558
27551
  })] })]
27559
27552
  });
27560
27553
  }
27561
- function yP({ logo: e, text: t }) {
27554
+ function vP({ logo: e, text: t }) {
27562
27555
  return /* @__PURE__ */ A("div", {
27563
27556
  class: "inline-flex items-center gap-1 text-xs text-base-content/50",
27564
27557
  children: [e ? /* @__PURE__ */ A("img", {
@@ -27570,41 +27563,41 @@ function yP({ logo: e, text: t }) {
27570
27563
  }
27571
27564
  //#endregion
27572
27565
  //#region ../core/src/hooks/use-widget-text.ts
27573
- var bP = {
27566
+ var yP = {
27574
27567
  title: "Hi! Want to chat?",
27575
27568
  btn_title: "Start conversation"
27576
27569
  };
27577
- function xP() {
27570
+ function bP() {
27578
27571
  let { config: e } = K_(), t = e.value.customization.widget?.text;
27579
27572
  return O(() => ({
27580
- title: t?.title || bP.title,
27581
- btn_title: t?.btn_title || bP.btn_title
27573
+ title: t?.title || yP.title,
27574
+ btn_title: t?.btn_title || yP.btn_title
27582
27575
  }), [t]);
27583
27576
  }
27584
27577
  //#endregion
27585
27578
  //#region ../core/src/hooks/use-widget-ui.ts
27586
- function SP() {
27587
- let e = pt(hP);
27579
+ function xP() {
27580
+ let e = pt(mP);
27588
27581
  if (!e) throw Error("useWidgetUI must be used within WidgetUIProvider");
27589
27582
  return e;
27590
27583
  }
27591
27584
  //#endregion
27592
27585
  //#region ../core/src/components/widget-launcher/widget-avatar.tsx
27593
- var CP = {
27586
+ var SP = {
27594
27587
  xs: "w-6 h-6",
27595
27588
  sm: "w-8 h-8",
27596
27589
  md: "w-10 h-10",
27597
27590
  lg: "w-16 h-16"
27598
- }, wP = {
27591
+ }, CP = {
27599
27592
  xs: "w-3 h-3",
27600
27593
  sm: "w-4 h-4",
27601
27594
  md: "w-5 h-5",
27602
27595
  lg: "w-8 h-8"
27603
27596
  };
27604
- function TP({ size: e = "md", className: t = "" }) {
27605
- let { avatarType: n } = SP(), { config: r } = K_(), i = Ly(r.value);
27597
+ function wP({ size: e = "md", className: t = "" }) {
27598
+ let { avatarType: n } = xP(), { config: r } = K_(), i = Ly(r.value);
27606
27599
  return (Ry(r.value).background.type === "replica" || n.value === "image") && i ? /* @__PURE__ */ A("div", {
27607
- class: `relative ${CP[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
27600
+ class: `relative ${SP[e]} rounded-box overflow-hidden bg-base-300 ${t}`,
27608
27601
  children: i.kind === "image" ? /* @__PURE__ */ A("img", {
27609
27602
  src: i.url,
27610
27603
  class: "absolute inset-0 w-full h-full object-cover",
@@ -27619,26 +27612,26 @@ function TP({ size: e = "md", className: t = "" }) {
27619
27612
  playsinline: !0
27620
27613
  })
27621
27614
  }) : /* @__PURE__ */ A("div", {
27622
- class: `relative ${CP[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
27623
- children: /* @__PURE__ */ A("span", { class: `${wP[e]} rounded-full bg-primary animate-pulse` })
27615
+ class: `relative ${SP[e]} rounded-box bg-primary/15 flex items-center justify-center ${t}`,
27616
+ children: /* @__PURE__ */ A("span", { class: `${CP[e]} rounded-full bg-primary animate-pulse` })
27624
27617
  });
27625
27618
  }
27626
27619
  //#endregion
27627
27620
  //#region ../core/src/components/widget-launcher/widget-launcher.tsx
27628
- function EP({ variant: e }) {
27629
- let { toggle: t } = SP(), n = xP();
27621
+ function TP({ variant: e }) {
27622
+ let { toggle: t } = xP(), n = bP();
27630
27623
  return e === "tiny" ? /* @__PURE__ */ A("button", {
27631
27624
  type: "button",
27632
27625
  onClick: t,
27633
27626
  "aria-label": n.btn_title,
27634
27627
  class: "rounded-box overflow-hidden shadow-xl hover:shadow-2xl transition-shadow cursor-pointer",
27635
- children: /* @__PURE__ */ A(TP, { size: "lg" })
27628
+ children: /* @__PURE__ */ A(wP, { size: "lg" })
27636
27629
  }) : e === "compact" ? /* @__PURE__ */ A("button", {
27637
27630
  type: "button",
27638
27631
  onClick: t,
27639
27632
  "aria-label": n.btn_title,
27640
27633
  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",
27641
- children: [/* @__PURE__ */ A(TP, { size: "md" }), /* @__PURE__ */ A("span", {
27634
+ children: [/* @__PURE__ */ A(wP, { size: "md" }), /* @__PURE__ */ A("span", {
27642
27635
  class: "flex flex-col gap-0.5",
27643
27636
  children: [/* @__PURE__ */ A("span", {
27644
27637
  class: "text-base font-medium leading-tight",
@@ -27655,7 +27648,7 @@ function EP({ variant: e }) {
27655
27648
  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",
27656
27649
  children: [/* @__PURE__ */ A("div", {
27657
27650
  class: "flex items-center gap-2.5",
27658
- children: [/* @__PURE__ */ A(TP, { size: "md" }), /* @__PURE__ */ A("span", {
27651
+ children: [/* @__PURE__ */ A(wP, { size: "md" }), /* @__PURE__ */ A("span", {
27659
27652
  class: "text-sm font-medium leading-snug",
27660
27653
  children: n.title
27661
27654
  })]
@@ -27673,13 +27666,13 @@ function EP({ variant: e }) {
27673
27666
  }
27674
27667
  //#endregion
27675
27668
  //#region ../core/src/components/widget-launcher/widget-greeting-bubble.tsx
27676
- var DP = "tavus:widget:greeting-dismissed";
27677
- function OP({ anchor: e }) {
27678
- let t = xP(), { variant: n, expand: r } = SP(), [i, a] = T(!1);
27669
+ var EP = "tavus:widget:greeting-dismissed";
27670
+ function DP({ anchor: e }) {
27671
+ let t = bP(), { variant: n, expand: r } = xP(), [i, a] = T(!1);
27679
27672
  E(() => {
27680
27673
  if (n.value === "tiny") {
27681
27674
  try {
27682
- if (sessionStorage.getItem(DP) === "1") return;
27675
+ if (sessionStorage.getItem(EP) === "1") return;
27683
27676
  } catch {}
27684
27677
  a(!0);
27685
27678
  }
@@ -27687,7 +27680,7 @@ function OP({ anchor: e }) {
27687
27680
  let o = k((e) => {
27688
27681
  e.stopPropagation();
27689
27682
  try {
27690
- sessionStorage.setItem(DP, "1");
27683
+ sessionStorage.setItem(EP, "1");
27691
27684
  } catch {}
27692
27685
  a(!1);
27693
27686
  }, []);
@@ -27719,18 +27712,18 @@ function OP({ anchor: e }) {
27719
27712
  }
27720
27713
  //#endregion
27721
27714
  //#region ../core/src/hooks/use-host-bridge.ts
27722
- function kP() {
27715
+ function OP() {
27723
27716
  let e = pt(fv);
27724
27717
  if (!e) throw Error("useHostBridge must be used within HostBridgeProvider");
27725
27718
  return e;
27726
27719
  }
27727
27720
  //#endregion
27728
27721
  //#region ../core/src/shells/widget/widget-popup.tsx
27729
- var AP = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", jP = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", MP = "p-1 flex-1 min-h-0", NP = "p-1 flex-1 min-h-0";
27730
- function PP({ variant: e, children: t, fullscreen: n }) {
27731
- let { collapse: r, expandable: i } = SP(), a = i.value !== "always";
27722
+ var kP = "bg-base-100 text-base-content rounded-box border border-base-300 shadow-xl w-[22rem] flex flex-col animate-[tavusPopIn_180ms_ease-out]", AP = "bg-base-100 text-base-content w-[100vw] h-[100dvh] flex flex-col animate-[tavusFadeUp_180ms_ease-out]", jP = "p-1 flex-1 min-h-0", MP = "p-1 flex-1 min-h-0";
27723
+ function NP({ variant: e, children: t, fullscreen: n }) {
27724
+ let { collapse: r, expandable: i } = xP(), a = i.value !== "always";
27732
27725
  return n ? /* @__PURE__ */ A("div", {
27733
- class: jP,
27726
+ class: AP,
27734
27727
  children: [
27735
27728
  /* @__PURE__ */ A("div", {
27736
27729
  class: "flex items-center justify-end gap-2 px-2.5 py-1.5 border-b border-base-300",
@@ -27746,18 +27739,18 @@ function PP({ variant: e, children: t, fullscreen: n }) {
27746
27739
  })
27747
27740
  }),
27748
27741
  /* @__PURE__ */ A("div", {
27749
- class: NP,
27742
+ class: MP,
27750
27743
  children: t
27751
27744
  }),
27752
27745
  /* @__PURE__ */ A("div", {
27753
27746
  class: "flex justify-end px-2.5",
27754
- children: /* @__PURE__ */ A(_P, {})
27747
+ children: /* @__PURE__ */ A(gP, {})
27755
27748
  })
27756
27749
  ]
27757
27750
  }) : /* @__PURE__ */ A("div", {
27758
27751
  class: "flex flex-col h-[min(34rem,calc(100dvh-3rem))]",
27759
27752
  children: [/* @__PURE__ */ A("div", {
27760
- class: `${AP} flex-1 overflow-hidden`,
27753
+ class: `${kP} flex-1 overflow-hidden`,
27761
27754
  children: [/* @__PURE__ */ A("div", {
27762
27755
  class: "flex items-center justify-end gap-2 px-2.5 pt-1.5 shrink-0",
27763
27756
  children: a && /* @__PURE__ */ A("button", {
@@ -27771,68 +27764,68 @@ function PP({ variant: e, children: t, fullscreen: n }) {
27771
27764
  })
27772
27765
  })
27773
27766
  }), /* @__PURE__ */ A("div", {
27774
- class: MP,
27767
+ class: jP,
27775
27768
  children: t
27776
27769
  })]
27777
27770
  }), /* @__PURE__ */ A("div", {
27778
27771
  class: "flex justify-end pr-2 pt-1.5 shrink-0",
27779
- children: /* @__PURE__ */ A(_P, {})
27772
+ children: /* @__PURE__ */ A(gP, {})
27780
27773
  })]
27781
27774
  });
27782
27775
  }
27783
27776
  //#endregion
27784
27777
  //#region ../core/src/shells/widget/widget-shell.tsx
27785
- var FP = yn("Widget"), IP = "1rem", LP = 480;
27786
- function RP() {
27787
- return typeof window > "u" ? !1 : window.innerWidth <= LP;
27778
+ var PP = yn("Widget"), FP = "1rem", IP = 480;
27779
+ function LP() {
27780
+ return typeof window > "u" ? !1 : window.innerWidth <= IP;
27788
27781
  }
27789
- function zP(e) {
27782
+ function RP(e) {
27790
27783
  switch (e) {
27791
27784
  case "bottom-right": return {
27792
- bottom: IP,
27793
- right: IP
27785
+ bottom: FP,
27786
+ right: FP
27794
27787
  };
27795
27788
  case "bottom-left": return {
27796
- bottom: IP,
27797
- left: IP
27789
+ bottom: FP,
27790
+ left: FP
27798
27791
  };
27799
27792
  case "top-right": return {
27800
- top: IP,
27801
- right: IP
27793
+ top: FP,
27794
+ right: FP
27802
27795
  };
27803
27796
  case "top-left": return {
27804
- top: IP,
27805
- left: IP
27797
+ top: FP,
27798
+ left: FP
27806
27799
  };
27807
27800
  case "top": return {
27808
- top: IP,
27801
+ top: FP,
27809
27802
  left: "50%",
27810
27803
  transform: "translateX(-50%)"
27811
27804
  };
27812
27805
  case "bottom": return {
27813
- bottom: IP,
27806
+ bottom: FP,
27814
27807
  left: "50%",
27815
27808
  transform: "translateX(-50%)"
27816
27809
  };
27817
27810
  }
27818
27811
  }
27819
- var BP = [
27812
+ var zP = [
27820
27813
  "top",
27821
27814
  "bottom",
27822
27815
  "left",
27823
27816
  "right",
27824
27817
  "transform"
27825
27818
  ];
27826
- function VP(e) {
27819
+ function BP(e) {
27827
27820
  return e === "bottom-left" || e === "top-left" ? "left" : "right";
27828
27821
  }
27829
- function HP() {
27830
- let { config: e, initError: t } = K_(), n = xP(), { expanded: r, position: i, variant: a } = SP(), { shadowHost: o } = kP(), s = Xy(), c = dn(RP());
27822
+ function VP() {
27823
+ let { config: e, initError: t } = K_(), n = bP(), { expanded: r, position: i, variant: a } = xP(), { shadowHost: o } = OP(), s = Xy(), c = dn(LP());
27831
27824
  E(() => {
27832
27825
  if (typeof window > "u") return;
27833
- c.value = RP();
27826
+ c.value = LP();
27834
27827
  let e = () => {
27835
- c.value = RP();
27828
+ c.value = LP();
27836
27829
  };
27837
27830
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
27838
27831
  }, [c]);
@@ -27842,27 +27835,27 @@ function HP() {
27842
27835
  if (e) {
27843
27836
  if (a) e.style.top = "0", e.style.right = "0", e.style.bottom = "0", e.style.left = "0", e.style.transform = "";
27844
27837
  else {
27845
- let n = zP(t);
27846
- for (let t of BP) e.style[t] = n[t] ?? "";
27838
+ let n = RP(t);
27839
+ for (let t of zP) e.style[t] = n[t] ?? "";
27847
27840
  }
27848
27841
  e.dataset.tavusWidgetPosition = t, e.dataset.tavusWidgetExpanded = n ? "true" : "false", e.dataset.tavusWidgetFullscreen = a ? "true" : "false", e.dataset.tavusWidgetSmall = c.value ? "true" : "false";
27849
27842
  }
27850
- }), t.value) return FP.error("Widget cannot initialize (init request failed):", t.value), null;
27851
- if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return FP.error("Widget is unavailable (total_limit reached) — not rendering"), null;
27843
+ }), t.value) return PP.error("Widget cannot initialize (init request failed):", t.value), null;
27844
+ if (e.value.is_available === !1 && e.value.unavailable_reason === "total_limit") return PP.error("Widget is unavailable (total_limit reached) — not rendering"), null;
27852
27845
  if (!r.value) {
27853
- let e = VP(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";
27846
+ let e = BP(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";
27854
27847
  return /* @__PURE__ */ A("div", {
27855
27848
  class: "flex flex-col",
27856
27849
  children: [/* @__PURE__ */ A("div", {
27857
27850
  class: t,
27858
- children: [/* @__PURE__ */ A(OP, { anchor: e }), /* @__PURE__ */ A(EP, { variant: a.value })]
27851
+ children: [/* @__PURE__ */ A(DP, { anchor: e }), /* @__PURE__ */ A(TP, { variant: a.value })]
27859
27852
  }), /* @__PURE__ */ A("div", {
27860
27853
  class: `flex ${n} pt-1.5`,
27861
- children: /* @__PURE__ */ A(_P, {})
27854
+ children: /* @__PURE__ */ A(gP, {})
27862
27855
  })]
27863
27856
  });
27864
27857
  }
27865
- return e.value.is_available === !1 ? /* @__PURE__ */ A(PP, {
27858
+ return e.value.is_available === !1 ? /* @__PURE__ */ A(NP, {
27866
27859
  variant: a.value,
27867
27860
  fullscreen: c.value,
27868
27861
  children: /* @__PURE__ */ A(Ev, { children: /* @__PURE__ */ A(Yy, {
@@ -27870,10 +27863,10 @@ function HP() {
27870
27863
  canRetry: !1,
27871
27864
  onRetry: () => {}
27872
27865
  }) })
27873
- }) : /* @__PURE__ */ A(PP, {
27866
+ }) : /* @__PURE__ */ A(NP, {
27874
27867
  variant: a.value,
27875
27868
  fullscreen: c.value,
27876
- children: /* @__PURE__ */ A(Ev, { children: /* @__PURE__ */ A(mP, {
27869
+ children: /* @__PURE__ */ A(Ev, { children: /* @__PURE__ */ A(pP, {
27877
27870
  flow: s,
27878
27871
  welcomeText: l,
27879
27872
  onUnavailableCancel: () => s.restart()
@@ -27882,11 +27875,11 @@ function HP() {
27882
27875
  }
27883
27876
  //#endregion
27884
27877
  //#region ../core/src/widget/tavus-widget.tsx
27885
- var UP = ":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}";
27886
- function WP(e) {
27878
+ var HP = ":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}";
27879
+ function UP(e) {
27887
27880
  return /* @__PURE__ */ A(ue, { children: [
27888
27881
  /* @__PURE__ */ A("style", { dangerouslySetInnerHTML: { __html: Ye } }),
27889
- /* @__PURE__ */ A("style", { dangerouslySetInnerHTML: { __html: UP } }),
27882
+ /* @__PURE__ */ A("style", { dangerouslySetInnerHTML: { __html: HP } }),
27890
27883
  /* @__PURE__ */ A(Et, {
27891
27884
  "deployment-id": e["deployment-id"],
27892
27885
  "override-config": e["override-config"],
@@ -27895,13 +27888,13 @@ function WP(e) {
27895
27888
  "memory-stores": e["memory-stores"],
27896
27889
  "base-url": e["base-url"],
27897
27890
  token: e.token,
27898
- children: /* @__PURE__ */ A(xi, { children: /* @__PURE__ */ A(Ci, { children: /* @__PURE__ */ A(R_, { children: /* @__PURE__ */ A(uv, { children: /* @__PURE__ */ A(mv, { children: /* @__PURE__ */ A(gv, { children: /* @__PURE__ */ A(gP, { children: /* @__PURE__ */ A(HP, {}) }) }) }) }) }) }) })
27891
+ children: /* @__PURE__ */ A(xi, { children: /* @__PURE__ */ A(Ci, { children: /* @__PURE__ */ A(R_, { children: /* @__PURE__ */ A(uv, { children: /* @__PURE__ */ A(mv, { children: /* @__PURE__ */ A(gv, { children: /* @__PURE__ */ A(hP, { children: /* @__PURE__ */ A(VP, {}) }) }) }) }) }) }) })
27899
27892
  })
27900
27893
  ] });
27901
27894
  }
27902
- var GP;
27903
- function KP() {
27904
- GP ||= Ve(WP, "tavus-widget", [
27895
+ var WP;
27896
+ function GP() {
27897
+ WP ||= Ve(UP, "tavus-widget", [
27905
27898
  "deployment-id",
27906
27899
  "override-config",
27907
27900
  "conversational-context",
@@ -27916,7 +27909,7 @@ function KP() {
27916
27909
  }
27917
27910
  //#endregion
27918
27911
  //#region src/integration.ts
27919
- var qP = [
27912
+ var KP = [
27920
27913
  "tavus:chat-message",
27921
27914
  "tavus:conversation-ended",
27922
27915
  "tavus:conversation-started",
@@ -27927,7 +27920,7 @@ var qP = [
27927
27920
  "tavus:ready",
27928
27921
  "tavus:state-change",
27929
27922
  "tavus:tool-call"
27930
- ], JP = class {
27923
+ ], qP = class {
27931
27924
  element = null;
27932
27925
  tagName;
27933
27926
  constructor(e = "tavus-widget") {
@@ -27974,6 +27967,6 @@ var qP = [
27974
27967
  };
27975
27968
  //#endregion
27976
27969
  //#region src/index.ts
27977
- typeof window < "u" && KP();
27970
+ typeof window < "u" && GP();
27978
27971
  //#endregion
27979
- export { qP as TAVUS_EVENT_NAMES, JP as TavusIntegration };
27972
+ export { KP as TAVUS_EVENT_NAMES, qP as TavusIntegration };