@eka-care/medassist-widget 0.1.124 → 0.1.125

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.
@@ -5478,7 +5478,7 @@ const vd = (e, t) => {
5478
5478
  return o(c, f), f;
5479
5479
  };
5480
5480
  return i = a, (...c) => i(Bd(...c));
5481
- }, jd = [], Oe = (e) => {
5481
+ }, jd = [], Ae = (e) => {
5482
5482
  const t = (n) => n[e] || jd;
5483
5483
  return t.isThemeGetter = !0, t;
5484
5484
  }, pl = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, gl = /^\((?:(\w[\w-]*):)?(.+)\)$/i, $d = /^\d+\/\d+$/, Yd = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Gd = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Wd = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, qd = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, Kd = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, Xt = (e) => $d.test(e), Q = (e) => !!e && !Number.isNaN(Number(e)), Rt = (e) => !!e && Number.isInteger(Number(e)), Jr = (e) => e.endsWith("%") && Q(e.slice(0, -1)), Et = (e) => Yd.test(e), Zd = () => !0, Xd = (e) => (
@@ -5493,7 +5493,7 @@ const vd = (e, t) => {
5493
5493
  const r = gl.exec(e);
5494
5494
  return r ? r[1] ? t(r[1]) : n : !1;
5495
5495
  }, El = (e) => e === "position" || e === "percentage", yl = (e) => e === "image" || e === "url", Sl = (e) => e === "length" || e === "size" || e === "bg-size", bl = (e) => e === "length", iu = (e) => e === "number", au = (e) => e === "family-name", vl = (e) => e === "shadow", lu = () => {
5496
- const e = Oe("color"), t = Oe("font"), n = Oe("text"), r = Oe("font-weight"), o = Oe("tracking"), i = Oe("leading"), a = Oe("breakpoint"), s = Oe("container"), c = Oe("spacing"), d = Oe("radius"), f = Oe("shadow"), u = Oe("inset-shadow"), p = Oe("text-shadow"), E = Oe("drop-shadow"), m = Oe("blur"), g = Oe("perspective"), b = Oe("aspect"), h = Oe("ease"), _ = Oe("animate"), y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], N = () => [
5496
+ const e = Ae("color"), t = Ae("font"), n = Ae("text"), r = Ae("font-weight"), o = Ae("tracking"), i = Ae("leading"), a = Ae("breakpoint"), s = Ae("container"), c = Ae("spacing"), d = Ae("radius"), f = Ae("shadow"), u = Ae("inset-shadow"), p = Ae("text-shadow"), E = Ae("drop-shadow"), m = Ae("blur"), g = Ae("perspective"), b = Ae("aspect"), h = Ae("ease"), _ = Ae("animate"), y = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], N = () => [
5497
5497
  "center",
5498
5498
  "top",
5499
5499
  "bottom",
@@ -5513,9 +5513,9 @@ const vd = (e, t) => {
5513
5513
  "left-bottom"
5514
5514
  ], C = () => [...N(), V, U], T = () => ["auto", "hidden", "clip", "visible", "scroll"], v = () => ["auto", "contain", "none"], w = () => [V, U, c], S = () => [Xt, "full", "auto", ...w()], R = () => [Rt, "none", "subgrid", V, U], O = () => ["auto", {
5515
5515
  span: ["full", Rt, V, U]
5516
- }, Rt, V, U], A = () => [Rt, "auto", V, U], B = () => ["auto", "min", "max", "fr", V, U], re = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], K = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], ue = () => ["auto", ...w()], ee = () => [Xt, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...w()], M = () => [e, V, U], z = () => [...N(), ki, Ri, {
5516
+ }, Rt, V, U], A = () => [Rt, "auto", V, U], B = () => ["auto", "min", "max", "fr", V, U], re = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], K = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], he = () => ["auto", ...w()], ee = () => [Xt, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...w()], M = () => [e, V, U], z = () => [...N(), ki, Ri, {
5517
5517
  position: [V, U]
5518
- }], oe = () => ["no-repeat", {
5518
+ }], se = () => ["no-repeat", {
5519
5519
  repeat: ["", "x", "y", "space", "round"]
5520
5520
  }], j = () => ["auto", "cover", "contain", ou, tu, {
5521
5521
  size: [V, U]
@@ -6068,63 +6068,63 @@ const vd = (e, t) => {
6068
6068
  * @see https://tailwindcss.com/docs/margin
6069
6069
  */
6070
6070
  m: [{
6071
- m: ue()
6071
+ m: he()
6072
6072
  }],
6073
6073
  /**
6074
6074
  * Margin X
6075
6075
  * @see https://tailwindcss.com/docs/margin
6076
6076
  */
6077
6077
  mx: [{
6078
- mx: ue()
6078
+ mx: he()
6079
6079
  }],
6080
6080
  /**
6081
6081
  * Margin Y
6082
6082
  * @see https://tailwindcss.com/docs/margin
6083
6083
  */
6084
6084
  my: [{
6085
- my: ue()
6085
+ my: he()
6086
6086
  }],
6087
6087
  /**
6088
6088
  * Margin Start
6089
6089
  * @see https://tailwindcss.com/docs/margin
6090
6090
  */
6091
6091
  ms: [{
6092
- ms: ue()
6092
+ ms: he()
6093
6093
  }],
6094
6094
  /**
6095
6095
  * Margin End
6096
6096
  * @see https://tailwindcss.com/docs/margin
6097
6097
  */
6098
6098
  me: [{
6099
- me: ue()
6099
+ me: he()
6100
6100
  }],
6101
6101
  /**
6102
6102
  * Margin Top
6103
6103
  * @see https://tailwindcss.com/docs/margin
6104
6104
  */
6105
6105
  mt: [{
6106
- mt: ue()
6106
+ mt: he()
6107
6107
  }],
6108
6108
  /**
6109
6109
  * Margin Right
6110
6110
  * @see https://tailwindcss.com/docs/margin
6111
6111
  */
6112
6112
  mr: [{
6113
- mr: ue()
6113
+ mr: he()
6114
6114
  }],
6115
6115
  /**
6116
6116
  * Margin Bottom
6117
6117
  * @see https://tailwindcss.com/docs/margin
6118
6118
  */
6119
6119
  mb: [{
6120
- mb: ue()
6120
+ mb: he()
6121
6121
  }],
6122
6122
  /**
6123
6123
  * Margin Left
6124
6124
  * @see https://tailwindcss.com/docs/margin
6125
6125
  */
6126
6126
  ml: [{
6127
- ml: ue()
6127
+ ml: he()
6128
6128
  }],
6129
6129
  /**
6130
6130
  * Space Between X
@@ -6493,7 +6493,7 @@ const vd = (e, t) => {
6493
6493
  * @see https://tailwindcss.com/docs/background-repeat
6494
6494
  */
6495
6495
  "bg-repeat": [{
6496
- bg: oe()
6496
+ bg: se()
6497
6497
  }],
6498
6498
  /**
6499
6499
  * Background Size
@@ -7170,7 +7170,7 @@ const vd = (e, t) => {
7170
7170
  * @see https://tailwindcss.com/docs/mask-repeat
7171
7171
  */
7172
7172
  "mask-repeat": [{
7173
- mask: oe()
7173
+ mask: se()
7174
7174
  }],
7175
7175
  /**
7176
7176
  * Mask Size
@@ -8121,7 +8121,7 @@ const Ai = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Oi = dl, S
8121
8121
  size: "default"
8122
8122
  }
8123
8123
  }
8124
- ), de = J(
8124
+ ), ue = J(
8125
8125
  ({ className: e, variant: t, size: n, asChild: r = !1, ...o }, i) => /* @__PURE__ */ l(
8126
8126
  r ? mu : "button",
8127
8127
  {
@@ -8131,7 +8131,7 @@ const Ai = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Oi = dl, S
8131
8131
  }
8132
8132
  )
8133
8133
  );
8134
- de.displayName = "Button";
8134
+ ue.displayName = "Button";
8135
8135
  const vu = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), wu = (e) => e.replace(
8136
8136
  /^([A-Z])|[\s-_]+(\w)/g,
8137
8137
  (t, n, r) => r ? r.toUpperCase() : n.toLowerCase()
@@ -9451,7 +9451,7 @@ function Xh({
9451
9451
  ] }),
9452
9452
  /* @__PURE__ */ l("div", { className: P("flex items-center", !m && "gap-1"), children: [
9453
9453
  !w && (!N || !u) && /* @__PURE__ */ l(
9454
- de,
9454
+ ue,
9455
9455
  {
9456
9456
  type: "button",
9457
9457
  variant: "ghost",
@@ -9464,7 +9464,7 @@ function Xh({
9464
9464
  }
9465
9465
  ),
9466
9466
  f && N && /* @__PURE__ */ l(
9467
- de,
9467
+ ue,
9468
9468
  {
9469
9469
  type: "button",
9470
9470
  variant: "ghost",
@@ -9476,7 +9476,7 @@ function Xh({
9476
9476
  }
9477
9477
  ),
9478
9478
  m && /* @__PURE__ */ l(
9479
- de,
9479
+ ue,
9480
9480
  {
9481
9481
  onClick: d,
9482
9482
  type: "button",
@@ -9488,7 +9488,7 @@ function Xh({
9488
9488
  }
9489
9489
  ),
9490
9490
  (t || !b) && /* @__PURE__ */ l(
9491
- de,
9491
+ ue,
9492
9492
  {
9493
9493
  onClick: e,
9494
9494
  type: "button",
@@ -10101,7 +10101,7 @@ function tf({
10101
10101
  }
10102
10102
  ),
10103
10103
  /* @__PURE__ */ l(
10104
- de,
10104
+ ue,
10105
10105
  {
10106
10106
  type: "button",
10107
10107
  size: "icon",
@@ -10185,8 +10185,8 @@ function sf({
10185
10185
  if (re.length === m && g.test(re))
10186
10186
  p.current(re);
10187
10187
  else {
10188
- const ue = b().findIndex((ee) => !ee);
10189
- a.current[ue === -1 ? 0 : ue]?.focus();
10188
+ const he = b().findIndex((ee) => !ee);
10189
+ a.current[he === -1 ? 0 : he]?.focus();
10190
10190
  }
10191
10191
  }
10192
10192
  },
@@ -10272,7 +10272,7 @@ function sf({
10272
10272
  /* @__PURE__ */ l("div", { className: "flex items-center w-full gap-2 justify-between", children: [
10273
10273
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: O }),
10274
10274
  /* @__PURE__ */ l(
10275
- de,
10275
+ ue,
10276
10276
  {
10277
10277
  type: "button",
10278
10278
  size: "icon",
@@ -10334,7 +10334,7 @@ function lf({
10334
10334
  }
10335
10335
  ),
10336
10336
  /* @__PURE__ */ l(
10337
- de,
10337
+ ue,
10338
10338
  {
10339
10339
  type: "button",
10340
10340
  size: "icon",
@@ -10461,7 +10461,7 @@ function ff({
10461
10461
  const T = G(null), v = G(null), w = e.trim().length > 0 || s, S = m === void 0 || m.includes(I.SYNAPSE_CONVERSATION.AUDIO), R = m === void 0 || m.includes(I.SYNAPSE_CONVERSATION.VOICE), O = w || !S, A = w, B = m === void 0 || m.includes(I.SYNAPSE_CONVERSATION.FILE), re = (d || p !== _e.IDLE) && !a, K = P(
10462
10462
  "rounded-full transition-all duration-200 ",
10463
10463
  a ? "bg-gradient-to-r from-rose-400 via-primary to-indigo-500 text-white ring-2 ring-white/60 animate-pulse shadow-[0_0_20px_rgba(139,92,246,0.45)]" : re ? "text-primary/50 cursor-not-allowed shadow-none" : "text-foreground hover:bg-primary hover:text-primary-foreground"
10464
- ), ue = (j) => {
10464
+ ), he = (j) => {
10465
10465
  const Y = Array.from(j.target.files || []);
10466
10466
  Y.length > 0 && r(Y);
10467
10467
  }, ee = () => {
@@ -10472,7 +10472,7 @@ function ff({
10472
10472
  j.style.height = "auto", j.style.overflow = "hidden";
10473
10473
  const Y = j.scrollHeight, Z = C ? 20 : 28, X = 120, Te = Math.max(Z, Math.min(Y, X));
10474
10474
  j.style.height = Te + "px", Y > X ? j.style.overflow = "auto" : j.style.overflow = "hidden";
10475
- }, oe = (j) => {
10475
+ }, se = (j) => {
10476
10476
  z(j.currentTarget);
10477
10477
  };
10478
10478
  return H(() => {
@@ -10531,7 +10531,7 @@ function ff({
10531
10531
  max: 3,
10532
10532
  accept: "image/jpeg, image/png, image/jpg, application/pdf",
10533
10533
  className: "hidden",
10534
- onChange: ue,
10534
+ onChange: he,
10535
10535
  disabled: d,
10536
10536
  title: "Attach file",
10537
10537
  "aria-label": "Attach file"
@@ -10547,7 +10547,7 @@ function ff({
10547
10547
  vo,
10548
10548
  {
10549
10549
  ref: v,
10550
- onInput: oe,
10550
+ onInput: se,
10551
10551
  placeholder: f,
10552
10552
  value: e,
10553
10553
  onChange: (j) => t(j.target.value),
@@ -10584,7 +10584,7 @@ function ff({
10584
10584
  "data-name": "cta-row",
10585
10585
  children: [
10586
10586
  /* @__PURE__ */ l("div", { className: "flex items-start shrink-0", "data-name": "input-left-cta", children: B && p === _e.IDLE && /* @__PURE__ */ l(
10587
- de,
10587
+ ue,
10588
10588
  {
10589
10589
  type: "button",
10590
10590
  variant: "ghost",
@@ -10608,7 +10608,7 @@ function ff({
10608
10608
  "data-name": "input-right-cta",
10609
10609
  children: [
10610
10610
  a ? /* @__PURE__ */ l(
10611
- de,
10611
+ ue,
10612
10612
  {
10613
10613
  type: "button",
10614
10614
  variant: "ghost",
@@ -10623,7 +10623,7 @@ function ff({
10623
10623
  children: /* @__PURE__ */ l(Li, { className: "w-4 h-4" })
10624
10624
  }
10625
10625
  ) : S && /* @__PURE__ */ l(
10626
- de,
10626
+ ue,
10627
10627
  {
10628
10628
  type: "button",
10629
10629
  variant: "ghost",
@@ -10640,7 +10640,7 @@ function ff({
10640
10640
  }
10641
10641
  ),
10642
10642
  O && !a ? /* @__PURE__ */ l(
10643
- de,
10643
+ ue,
10644
10644
  {
10645
10645
  type: "button",
10646
10646
  size: "icon",
@@ -10656,7 +10656,7 @@ function ff({
10656
10656
  children: /* @__PURE__ */ l(qn, { className: "w-4 h-4 text-primary-foreground" })
10657
10657
  }
10658
10658
  ) : S && R && !a && /* @__PURE__ */ l(
10659
- de,
10659
+ ue,
10660
10660
  {
10661
10661
  type: "button",
10662
10662
  variant: "ghost",
@@ -10687,7 +10687,7 @@ function ff({
10687
10687
  max: 3,
10688
10688
  accept: "image/jpeg, image/png, image/jpg, application/pdf",
10689
10689
  className: "hidden",
10690
- onChange: ue,
10690
+ onChange: he,
10691
10691
  disabled: d,
10692
10692
  title: "Attach file",
10693
10693
  "aria-label": "Attach file"
@@ -10715,7 +10715,7 @@ function ff({
10715
10715
  vo,
10716
10716
  {
10717
10717
  ref: v,
10718
- onInput: oe,
10718
+ onInput: se,
10719
10719
  placeholder: f,
10720
10720
  value: e,
10721
10721
  onChange: (j) => t(j.target.value),
@@ -10742,7 +10742,7 @@ function ff({
10742
10742
  ) }),
10743
10743
  /* @__PURE__ */ l("div", { className: "flex items-center justify-between", children: [
10744
10744
  /* @__PURE__ */ l("div", { className: "flex items-center shrink-0", children: B && p === _e.IDLE && /* @__PURE__ */ l(
10745
- de,
10745
+ ue,
10746
10746
  {
10747
10747
  type: "button",
10748
10748
  variant: "ghost",
@@ -10761,7 +10761,7 @@ function ff({
10761
10761
  ) }),
10762
10762
  /* @__PURE__ */ l("div", { className: "flex items-center gap-2 shrink-0", children: [
10763
10763
  a ? /* @__PURE__ */ l(
10764
- de,
10764
+ ue,
10765
10765
  {
10766
10766
  type: "button",
10767
10767
  variant: "ghost",
@@ -10776,7 +10776,7 @@ function ff({
10776
10776
  children: /* @__PURE__ */ l(Li, { className: "w-4 h-4" })
10777
10777
  }
10778
10778
  ) : O ? /* @__PURE__ */ l(
10779
- de,
10779
+ ue,
10780
10780
  {
10781
10781
  type: "button",
10782
10782
  size: "icon",
@@ -10792,7 +10792,7 @@ function ff({
10792
10792
  children: /* @__PURE__ */ l(qn, { className: "w-4 h-4 text-primary-foreground" })
10793
10793
  }
10794
10794
  ) : S && /* @__PURE__ */ l(
10795
- de,
10795
+ ue,
10796
10796
  {
10797
10797
  type: "button",
10798
10798
  variant: "ghost",
@@ -10806,7 +10806,7 @@ function ff({
10806
10806
  }
10807
10807
  ),
10808
10808
  S && R && !a && /* @__PURE__ */ l(
10809
- de,
10809
+ ue,
10810
10810
  {
10811
10811
  type: "button",
10812
10812
  variant: "ghost",
@@ -10908,7 +10908,7 @@ function gf({ isOpen: e, onClose: t, botName: n }) {
10908
10908
  /* @__PURE__ */ l("p", { className: "text-sm text-muted-foreground text-left leading-5 text-pretty", children: `${n} is an AI assistant here to guide you and connect you with care — its responses offer general health information, not a professional medical diagnosis.` })
10909
10909
  ] }),
10910
10910
  /* @__PURE__ */ l(
10911
- de,
10911
+ ue,
10912
10912
  {
10913
10913
  onClick: t,
10914
10914
  className: "w-full bg-primary hover:bg-primary/90 text-primary-foreground",
@@ -11003,7 +11003,7 @@ function Tf({
11003
11003
  _.value
11004
11004
  )) }),
11005
11005
  /* @__PURE__ */ l(
11006
- de,
11006
+ ue,
11007
11007
  {
11008
11008
  disabled: !b,
11009
11009
  onClick: h,
@@ -11076,7 +11076,7 @@ function ql({
11076
11076
  theme: v,
11077
11077
  feedbackModal: w
11078
11078
  }) {
11079
- const [S, R] = F(!1), [O, A] = F(!1), [B, re] = F(!1), K = G(null), ue = W((L) => L.level), ee = b, M = ee === "full", z = G(null), [oe, j] = F("");
11079
+ const [S, R] = F(!1), [O, A] = F(!1), [B, re] = F(!1), K = G(null), he = W((L) => L.level), ee = b, M = ee === "full", z = G(null), [se, j] = F("");
11080
11080
  H(() => {
11081
11081
  z.current !== null && z.current !== ee && j(
11082
11082
  ee === "full" ? "Switched to fullscreen mode" : ee === "widget" ? "Switched to widget mode" : "Switched to mobile layout"
@@ -11121,7 +11121,7 @@ function ql({
11121
11121
  }
11122
11122
  }, ft = () => {
11123
11123
  ke();
11124
- }, Ie = () => {
11124
+ }, Oe = () => {
11125
11125
  if (!L || !window.visualViewport) return;
11126
11126
  const $e = window.visualViewport.offsetTop, et = Date.now();
11127
11127
  Math.abs($e - Ve) < ye || et - je < st || (je = et, Ve = $e, Ee = requestAnimationFrame(() => {
@@ -11130,8 +11130,8 @@ function ql({
11130
11130
  }, 150);
11131
11131
  }));
11132
11132
  };
11133
- return window.visualViewport.addEventListener("resize", ft), window.visualViewport.addEventListener("scroll", Ie), ke(), () => {
11134
- Ee && cancelAnimationFrame(Ee), te && clearTimeout(te), Ne && clearTimeout(Ne), window.visualViewport?.removeEventListener("resize", ft), window.visualViewport?.removeEventListener("scroll", Ie), L && (L.style.width = "", L.style.height = "", L.style.maxHeight = "", L.style.minHeight = "", L.style.transition = "");
11133
+ return window.visualViewport.addEventListener("resize", ft), window.visualViewport.addEventListener("scroll", Oe), ke(), () => {
11134
+ Ee && cancelAnimationFrame(Ee), te && clearTimeout(te), Ne && clearTimeout(Ne), window.visualViewport?.removeEventListener("resize", ft), window.visualViewport?.removeEventListener("scroll", Oe), L && (L.style.width = "", L.style.height = "", L.style.maxHeight = "", L.style.minHeight = "", L.style.transition = "");
11135
11135
  };
11136
11136
  } else {
11137
11137
  const ke = () => {
@@ -11154,15 +11154,15 @@ function ql({
11154
11154
  if (ke.touches.length !== 1) return;
11155
11155
  const ft = je - ke.touches[0].clientY;
11156
11156
  je = ke.touches[0].clientY;
11157
- let Ie = ke.target;
11158
- for (; Ie && Ie !== L; ) {
11159
- const { overflowY: $e } = window.getComputedStyle(Ie);
11160
- if (($e === "auto" || $e === "scroll") && Ie.scrollHeight > Ie.clientHeight) {
11161
- const { scrollTop: et, scrollHeight: Ke, clientHeight: Mt } = Ie, lt = et <= 0 && ft < 0, Pt = et + Mt >= Ke - 1 && ft > 0;
11157
+ let Oe = ke.target;
11158
+ for (; Oe && Oe !== L; ) {
11159
+ const { overflowY: $e } = window.getComputedStyle(Oe);
11160
+ if (($e === "auto" || $e === "scroll") && Oe.scrollHeight > Oe.clientHeight) {
11161
+ const { scrollTop: et, scrollHeight: Ke, clientHeight: Mt } = Oe, lt = et <= 0 && ft < 0, Pt = et + Mt >= Ke - 1 && ft > 0;
11162
11162
  if (!lt && !Pt) return;
11163
11163
  break;
11164
11164
  }
11165
- Ie = Ie.parentElement;
11165
+ Oe = Oe.parentElement;
11166
11166
  }
11167
11167
  ke.preventDefault();
11168
11168
  };
@@ -11320,7 +11320,7 @@ function ql({
11320
11320
  whiteSpace: "nowrap",
11321
11321
  border: 0
11322
11322
  },
11323
- children: oe
11323
+ children: se
11324
11324
  }
11325
11325
  ),
11326
11326
  !Y.backgroundImage && /* @__PURE__ */ l(
@@ -11374,7 +11374,7 @@ function ql({
11374
11374
  }
11375
11375
  ),
11376
11376
  M && s,
11377
- ue === "user" && !M && c,
11377
+ he === "user" && !M && c,
11378
11378
  /* @__PURE__ */ l("div", { className: "flex-1 flex flex-col min-w-0 min-h-0 h-full", children: [
11379
11379
  /* @__PURE__ */ l("div", { className: "flex-shrink-0 sticky top-0 z-50 synapse-chat-widget-header", style: {
11380
11380
  // Same trick as the footer — solid bg layer + translucent overlay,
@@ -12023,11 +12023,11 @@ const jt = (e) => {
12023
12023
  }) => {
12024
12024
  const [s, c] = F([]), d = G([]), [f, u] = F(!1), [p, E] = F(!1), m = G(/* @__PURE__ */ new Map()), g = G(0), [b, h] = F(!1), _ = G([]), y = G(null), N = dh(), C = G(null), { isOnline: T } = Kl(), v = G(!1), w = W((k) => k.agentId), S = W((k) => k.sessionId), R = W((k) => k.isStreaming), O = W((k) => k.isWaitingForResponse), A = W((k) => k.initialMessage), B = W((k) => k.userId), re = W((k) => k.fileUploadPerSession), {
12025
12025
  setSessionId: K,
12026
- setRefreshToken: ue,
12026
+ setRefreshToken: he,
12027
12027
  setSessToken: ee,
12028
12028
  setLevel: M,
12029
12029
  setError: z,
12030
- setConnectionStatus: oe,
12030
+ setConnectionStatus: se,
12031
12031
  setShowRetryButton: j,
12032
12032
  setStartNewConnection: Y,
12033
12033
  setIsStreaming: Z,
@@ -12053,11 +12053,11 @@ const jt = (e) => {
12053
12053
  z({
12054
12054
  title: "No internet connection",
12055
12055
  description: "Please check your internet connection."
12056
- }), oe(Re.NOT_CONNECTED);
12056
+ }), se(Re.NOT_CONNECTED);
12057
12057
  else if (!b)
12058
- oe(Re.CONNECTING);
12058
+ se(Re.CONNECTING);
12059
12059
  else if (Ke())
12060
- oe(Re.CONNECTED), lt();
12060
+ se(Re.CONNECTED), lt();
12061
12061
  else {
12062
12062
  const { showRetryButton: k, startNewConnection: x, error: D } = W.getState();
12063
12063
  (k || x || D) && !Ke() && lt();
@@ -12097,7 +12097,7 @@ const jt = (e) => {
12097
12097
  callbacks: {
12098
12098
  onError: (x) => {
12099
12099
  if (typeof navigator < "u" && !navigator.onLine) {
12100
- oe(Re.NOT_CONNECTED), z({
12100
+ se(Re.NOT_CONNECTED), z({
12101
12101
  title: "No internet connection",
12102
12102
  description: "Will reconnect automatically when internet is restored."
12103
12103
  });
@@ -12113,17 +12113,17 @@ const jt = (e) => {
12113
12113
  dn();
12114
12114
  return;
12115
12115
  case I.SYNAPSE_RECOVERY_REASON.SESSION_NOT_FOUND:
12116
- z(null), oe(Re.NOT_CONNECTED), Y(!0);
12116
+ z(null), se(Re.NOT_CONNECTED), Y(!0);
12117
12117
  return;
12118
12118
  case I.SYNAPSE_RECOVERY_REASON.RETRY_LATER:
12119
- oe(Re.CONNECTING);
12119
+ se(Re.CONNECTING);
12120
12120
  return;
12121
12121
  }
12122
12122
  switch (x.code) {
12123
12123
  case I.SynapseErrorCode.API:
12124
12124
  case I.SynapseErrorCode.SESSION: {
12125
12125
  const D = x;
12126
- D.status === 404 || D?.context?.status === 404 ? Y(!0) : (oe(Re.NOT_CONNECTED), z({
12126
+ D.status === 404 || D?.context?.status === 404 ? Y(!0) : (se(Re.NOT_CONNECTED), z({
12127
12127
  title: "Something went wrong!",
12128
12128
  description: jt(x)
12129
12129
  }), j(!0));
@@ -12136,7 +12136,7 @@ const jt = (e) => {
12136
12136
  });
12137
12137
  break;
12138
12138
  case I.SynapseErrorCode.CONNECTION:
12139
- Ke() || (oe(Re.NOT_CONNECTED), g.current < 2 ? (g.current = g.current + 1, Ie(S)) : (j(!0), z({
12139
+ Ke() || (se(Re.NOT_CONNECTED), g.current < 2 ? (g.current = g.current + 1, Oe(S)) : (j(!0), z({
12140
12140
  title: "Trying to connect...",
12141
12141
  description: jt(x)
12142
12142
  })));
@@ -12151,7 +12151,7 @@ const jt = (e) => {
12151
12151
  },
12152
12152
  onTokenExchange: (x) => {
12153
12153
  const D = W.getState().userId;
12154
- (!!x?.user_id && !!D && x.user_id !== D || x?.userid_change_detected) && ce(), x?.refresh_token && ue(x.refresh_token), x?.sess_token && ee(x.sess_token), x?.level && M(x.level), x?.user_id && Ne(x.user_id);
12154
+ (!!x?.user_id && !!D && x.user_id !== D || x?.userid_change_detected) && ce(), x?.refresh_token && he(x.refresh_token), x?.sess_token && ee(x.sess_token), x?.level && M(x.level), x?.user_id && Ne(x.user_id);
12155
12155
  }
12156
12156
  },
12157
12157
  ...n && { serverUrl: n },
@@ -12179,7 +12179,7 @@ const jt = (e) => {
12179
12179
  }, 3e4) : R && C.current && (clearTimeout(C.current), C.current = null), () => {
12180
12180
  C.current && (clearTimeout(C.current), C.current = null);
12181
12181
  }), [O, R, X]);
12182
- const Ie = async (k) => {
12182
+ const Oe = async (k) => {
12183
12183
  try {
12184
12184
  const x = await y.current?.startSession(
12185
12185
  k ? { session_id: k } : void 0
@@ -12193,7 +12193,7 @@ const jt = (e) => {
12193
12193
  } catch (x) {
12194
12194
  if (x?.reason) return;
12195
12195
  const D = x;
12196
- D.status === 404 || D.context?.status == 404 ? (z(null), oe(Re.NOT_CONNECTED), Y(!0)) : (z({
12196
+ D.status === 404 || D.context?.status == 404 ? (z(null), se(Re.NOT_CONNECTED), Y(!0)) : (z({
12197
12197
  title: "Connection Lost!",
12198
12198
  description: jt(x)
12199
12199
  }), j(!0));
@@ -12208,11 +12208,11 @@ const jt = (e) => {
12208
12208
  try {
12209
12209
  const le = await y.current?.getSessionMessages(k);
12210
12210
  if (!le?.length) return [];
12211
- const { messages: se, elicitations: Pe } = jf(le);
12211
+ const { messages: ie, elicitations: Pe } = jf(le);
12212
12212
  return Object.keys(Pe).length && st({
12213
12213
  ...W.getState().elicitationState,
12214
12214
  ...Pe
12215
- }), Ee(k, se), c(se), se;
12215
+ }), Ee(k, ie), c(ie), ie;
12216
12216
  } catch {
12217
12217
  return [];
12218
12218
  } finally {
@@ -12235,11 +12235,11 @@ const jt = (e) => {
12235
12235
  return;
12236
12236
  }
12237
12237
  if (u(!0), k) {
12238
- oe(Re.CONNECTING), c([]), await ce(), await y?.current?.endSession(), lt(), await Ie(), Pt();
12238
+ se(Re.CONNECTING), c([]), await ce(), await y?.current?.endSession(), lt(), await Oe(), Pt();
12239
12239
  return;
12240
12240
  }
12241
12241
  const D = W.getState()?.sessionId, $ = x || D || void 0;
12242
- $ !== D && (Mt(), c([]), $ && await $e($)), await Ie($), Pt();
12242
+ $ !== D && (Mt(), c([]), $ && await $e($)), await Oe($), Pt();
12243
12243
  } catch {
12244
12244
  } finally {
12245
12245
  u(!1);
@@ -12252,12 +12252,12 @@ const jt = (e) => {
12252
12252
  y.current?.on(I.SYNAPSE_REALTIME_EVENTS.MESSAGE_CHUNK, (k) => {
12253
12253
  const x = k;
12254
12254
  if (x.data?.text && x.messageId) {
12255
- R || (X(!1), Z(!0)), Ke() && oe(Re.CONNECTED), lt();
12255
+ R || (X(!1), Z(!0)), Ke() && se(Re.CONNECTED), lt();
12256
12256
  const D = x.data.text, $ = x.messageId, le = v.current;
12257
- v.current = !1, c((se) => {
12258
- const Pe = se[se.length - 1];
12257
+ v.current = !1, c((ie) => {
12258
+ const Pe = ie[ie.length - 1];
12259
12259
  if (Pe && Pe.id === $ && Pe.role === Ue.ASSISTANT) {
12260
- const ve = [...se], Ye = le && Pe.content.length > 0 && !/\s$/.test(Pe.content) && !/^\s/.test(D) ? `
12260
+ const ve = [...ie], Ye = le && Pe.content.length > 0 && !/\s$/.test(Pe.content) && !/^\s/.test(D) ? `
12261
12261
 
12262
12262
  ` : "";
12263
12263
  return ve[ve.length - 1] = {
@@ -12266,7 +12266,7 @@ const jt = (e) => {
12266
12266
  }, ve;
12267
12267
  } else
12268
12268
  return [
12269
- ...se,
12269
+ ...ie,
12270
12270
  {
12271
12271
  id: $,
12272
12272
  content: D,
@@ -12280,7 +12280,7 @@ const jt = (e) => {
12280
12280
  }), y.current?.on(I.SYNAPSE_REALTIME_EVENTS.END_OF_STREAM, () => {
12281
12281
  v.current = !1, Z(!1), Te(null), X(!1);
12282
12282
  }), y.current?.on(I.SYNAPSE_REALTIME_EVENTS.CONNECTED, () => {
12283
- lt(), oe(Re.CONNECTED);
12283
+ lt(), se(Re.CONNECTED);
12284
12284
  }), y.current?.on(
12285
12285
  I.SYNAPSE_REALTIME_EVENTS.TOOL_CALL,
12286
12286
  (k) => {
@@ -12289,17 +12289,17 @@ const jt = (e) => {
12289
12289
  if (!x?.messageId || !x?.data || !x?.data?.details?.component || !x?.data?.tool_id)
12290
12290
  return;
12291
12291
  O && X(!1);
12292
- const { messageId: D, data: $ } = x, le = $.tool_id, se = `${D}::${le}`, ve = W.getState().elicitationState[se], Ye = $.details?.component, tt = x?.data?.details?._meta?.tool_result, un = $.details?.input, Me = Uf(ve?.input, un, Ye);
12292
+ const { messageId: D, data: $ } = x, le = $.tool_id, ie = `${D}::${le}`, ve = W.getState().elicitationState[ie], Ye = $.details?.component, tt = x?.data?.details?._meta?.tool_result, un = $.details?.input, Ie = Uf(ve?.input, un, Ye);
12293
12293
  let it = x.data.details?._meta?.disp_toast_msg;
12294
12294
  const mt = $?.details?._meta?.schema?.required || [];
12295
12295
  switch ($?.details?.status) {
12296
12296
  case I.SYNAPSE_EICITATION_STATUS.PROGRESS: {
12297
12297
  const xe = x?.data?.details?.input || {}, Ge = mt.reduce((ct, gt) => (xe[gt] !== void 0 && (ct[gt] = xe[gt]), ct), {}), ne = { ...ve?.server_input || {}, ...Ge }, Ze = mt.filter((ct) => !ne[ct]), xt = x.data.details?._meta?.mcp_meta_fields || [];
12298
- ye(se, {
12298
+ ye(ie, {
12299
12299
  tool_id: le,
12300
12300
  active: !0,
12301
12301
  disabled: !1,
12302
- input: Me,
12302
+ input: Ie,
12303
12303
  server_input: ne,
12304
12304
  messageId: D,
12305
12305
  required: mt,
@@ -12319,7 +12319,7 @@ const jt = (e) => {
12319
12319
  break;
12320
12320
  }
12321
12321
  case I.SYNAPSE_EICITATION_STATUS.SUCCESS: {
12322
- ye(se, {
12322
+ ye(ie, {
12323
12323
  ...ve || {},
12324
12324
  tool_id: le,
12325
12325
  // disabled: !isActiveComponent(component),
@@ -12329,7 +12329,7 @@ const jt = (e) => {
12329
12329
  //to continue tool calls
12330
12330
  messageId: D,
12331
12331
  component: Ye,
12332
- input: Me,
12332
+ input: Ie,
12333
12333
  tool_result: tt,
12334
12334
  send_to_llm: !0
12335
12335
  //to send the tool results immediately after success
@@ -12337,7 +12337,7 @@ const jt = (e) => {
12337
12337
  break;
12338
12338
  }
12339
12339
  case I.SYNAPSE_EICITATION_STATUS.FAILURE: {
12340
- ye(se, {
12340
+ ye(ie, {
12341
12341
  ...ve || {},
12342
12342
  tool_id: le,
12343
12343
  active: !1,
@@ -12349,13 +12349,13 @@ const jt = (e) => {
12349
12349
  break;
12350
12350
  }
12351
12351
  default:
12352
- ye(se, {
12352
+ ye(ie, {
12353
12353
  tool_id: le,
12354
12354
  disabled: !1,
12355
12355
  active: !1,
12356
12356
  messageId: D,
12357
12357
  tool_result: tt,
12358
- input: Me,
12358
+ input: Ie,
12359
12359
  // send_to_llm: true,
12360
12360
  component: Ye
12361
12361
  });
@@ -12369,7 +12369,7 @@ const jt = (e) => {
12369
12369
  id: D,
12370
12370
  content: x.data?.details?.input?.text || "",
12371
12371
  role: Ue.ASSISTANT,
12372
- tool_keys: [se],
12372
+ tool_keys: [ie],
12373
12373
  isResponseFromTool: !0,
12374
12374
  // timestamp: formatMessageTimestamp(timestamp),
12375
12375
  isStored: !1,
@@ -12380,7 +12380,7 @@ const jt = (e) => {
12380
12380
  const Ze = {
12381
12381
  ...xe[ne],
12382
12382
  isResponseFromTool: !0,
12383
- tool_keys: [.../* @__PURE__ */ new Set([...xe[ne].tool_keys || [], se])],
12383
+ tool_keys: [.../* @__PURE__ */ new Set([...xe[ne].tool_keys || [], ie])],
12384
12384
  ...pt ? { userHint: pt } : {}
12385
12385
  };
12386
12386
  xe[ne] = Ze, te(S, D, Ze);
@@ -12388,16 +12388,16 @@ const jt = (e) => {
12388
12388
  return [...xe];
12389
12389
  });
12390
12390
  const Dt = x?.data?.details?._meta?.disp_message, hn = W.getState().elicitationState;
12391
- if ((!hn[se]?.active || hn[se]?.send_to_llm) && (Dt || Object.keys(tt || {}).length))
12391
+ if ((!hn[ie]?.active || hn[ie]?.send_to_llm) && (Dt || Object.keys(tt || {}).length))
12392
12392
  try {
12393
- Lt({ message: Dt || "", tool_result: tt, toolCalled: !0, tool_key: se });
12393
+ Lt({ message: Dt || "", tool_result: tt, toolCalled: !0, tool_key: ie });
12394
12394
  } catch {
12395
12395
  }
12396
12396
  }
12397
12397
  ), y.current?.on(I.SYNAPSE_REALTIME_EVENTS.DISCONNECTED, (k) => {
12398
12398
  if (k?.reason === I.DisconnectionReason.CLIENT_CLOSED) return;
12399
12399
  const x = typeof navigator < "u" && !navigator.onLine;
12400
- if (oe(Re.NOT_CONNECTED), x) {
12400
+ if (se(Re.NOT_CONNECTED), x) {
12401
12401
  z({
12402
12402
  title: "No internet connection",
12403
12403
  description: "Will reconnect automatically when internet is restored."
@@ -12491,13 +12491,13 @@ const jt = (e) => {
12491
12491
  c(($) => {
12492
12492
  const le = $[$.length - 1];
12493
12493
  if (le && le.id === D && le.role === Ue.ASSISTANT) {
12494
- const se = [...$];
12495
- return se[se.length - 1] = {
12494
+ const ie = [...$];
12495
+ return ie[ie.length - 1] = {
12496
12496
  ...le,
12497
12497
  toolCallStatus: `Calling tool: ${x.data.name}...`
12498
12498
  }, S && te(S, D, {
12499
12499
  toolCallStatus: `Calling tool: ${x.data.name}...`
12500
- }), se;
12500
+ }), ie;
12501
12501
  }
12502
12502
  return $;
12503
12503
  });
@@ -12510,13 +12510,13 @@ const jt = (e) => {
12510
12510
  c(($) => {
12511
12511
  const le = $[$.length - 1];
12512
12512
  if (le && le.id === D && le.role === Ue.ASSISTANT) {
12513
- const se = [...$];
12514
- return se[se.length - 1] = {
12513
+ const ie = [...$];
12514
+ return ie[ie.length - 1] = {
12515
12515
  ...le,
12516
12516
  toolCallStatus: "Tool call completed."
12517
12517
  }, S && te(S, D, {
12518
12518
  toolCallStatus: "Tool call completed."
12519
- }), se;
12519
+ }), ie;
12520
12520
  }
12521
12521
  return $;
12522
12522
  });
@@ -12528,12 +12528,12 @@ const jt = (e) => {
12528
12528
  audio: D,
12529
12529
  toolCalled: $,
12530
12530
  selectedComponent: le,
12531
- resend: se,
12531
+ resend: ie,
12532
12532
  tool_declined: Pe,
12533
12533
  tool_result: ve,
12534
12534
  tool_key: Ye
12535
12535
  }) => {
12536
- const tt = W.getState().elicitationState, un = Object.values(tt).some((Me) => Me.active);
12536
+ const tt = W.getState().elicitationState, un = Object.values(tt).some((Ie) => Ie.active);
12537
12537
  if (!(!$ && (!x || x.length === 0) && !k?.trim() && !D?.audio && !le && !un && !ve && !Object.keys(ve || {}).length)) {
12538
12538
  if (x && x.length > 3) {
12539
12539
  z({
@@ -12542,7 +12542,7 @@ const jt = (e) => {
12542
12542
  });
12543
12543
  return;
12544
12544
  }
12545
- if (x && x.length > 0 && x.reduce((Me, it) => Me + it.size, 0) > 10 * 1024 * 1024) {
12545
+ if (x && x.length > 0 && x.reduce((Ie, it) => Ie + it.size, 0) > 10 * 1024 * 1024) {
12546
12546
  z({
12547
12547
  title: "Total file size limit of 10MB exceeded",
12548
12548
  description: "Please reduce the size of the files or try again with less files"
@@ -12550,29 +12550,29 @@ const jt = (e) => {
12550
12550
  return;
12551
12551
  }
12552
12552
  if (x && x.length > 0 && x.length + re > eo) {
12553
- const Me = eo - re;
12553
+ const Ie = eo - re;
12554
12554
  z({
12555
12555
  title: `You can only upload up to ${eo} files per session`,
12556
- description: `${Me <= 0 ? "Maximum file upload limit reached" : `You have ${Me} file${Me === 1 ? "" : "s"} upload${Me === 1 ? "" : "s"} left`}`
12556
+ description: `${Ie <= 0 ? "Maximum file upload limit reached" : `You have ${Ie} file${Ie === 1 ? "" : "s"} upload${Ie === 1 ? "" : "s"} left`}`
12557
12557
  });
12558
12558
  return;
12559
12559
  } else x && x.length && Ve(re + x.length);
12560
- z(null), j(!1), Ke() && oe(Re.CONNECTED);
12560
+ z(null), j(!1), Ke() && se(Re.CONNECTED);
12561
12561
  try {
12562
- const Me = s.length <= 2 && _.current.length == 1 ? _.current : null;
12562
+ const Ie = s.length <= 2 && _.current.length == 1 ? _.current : null;
12563
12563
  let it = null, mt = null;
12564
12564
  const pt = s.length - 1, Dt = pt >= 0 ? s[pt] : null, xe = W.getState().elicitationState, Ge = Ye || null, ne = Ge ? xe[Ge] : void 0, xt = ne?.component === I.SYNAPSE_COMPONENTS.DOCTOR_CARD || ne?.component === I.SYNAPSE_COMPONENTS.CARD ? !!ne && !ve && !!ne.active : !!ne?.active, ct = !!(x || []).length || !!D?.audio || !!Pe || !xt || !$, gt = le ? le.label : void 0, fn = ne?.component === I.SYNAPSE_COMPONENTS.PILL && typeof gt == "string" ? gt : null;
12565
12565
  if (!ct && xt && Ge && ne?.messageId) {
12566
- const he = ne.toolSelectionNames?.length ? ne.toolSelectionNames : ne.required?.filter((Ce) => !ne.server_input?.[Ce]) ?? [], Ae = he.reduce((Ce, Se) => {
12566
+ const de = ne.toolSelectionNames?.length ? ne.toolSelectionNames : ne.required?.filter((Ce) => !ne.server_input?.[Ce]) ?? [], Me = de.reduce((Ce, Se) => {
12567
12567
  if (le) {
12568
12568
  const pn = le[Se];
12569
12569
  pn !== void 0 && (Ce[Se] = pn);
12570
- } else he.length === 1 && (Ce[Se] = k);
12570
+ } else de.length === 1 && (Ce[Se] = k);
12571
12571
  return Ce;
12572
- }, {}), _t = ne.mcp_meta_fields?.reduce((Ce, Se) => (he.includes(Se) ? Ce[Se] = Ae[Se] : ne.server_input?.[Se] && (Ce[Se] = ne.server_input[Se]), se && !Ce.is_resend && (Ce.is_resend = se), Ce), {}), Lr = Object.keys(ne.server_input || {})?.reduce((Ce, Se) => {
12572
+ }, {}), _t = ne.mcp_meta_fields?.reduce((Ce, Se) => (de.includes(Se) ? Ce[Se] = Me[Se] : ne.server_input?.[Se] && (Ce[Se] = ne.server_input[Se]), ie && !Ce.is_resend && (Ce.is_resend = ie), Ce), {}), Lr = Object.keys(ne.server_input || {})?.reduce((Ce, Se) => {
12573
12573
  const pn = !Object.keys(_t || {})?.includes(Se), gs = !!ne.server_input?.[Se];
12574
- return (se ? pn && gs : pn && ne.required?.includes(Se) && gs) && (Ce[Se] = ne.server_input?.[Se]), Ce;
12575
- }, {}), Dr = se ? {} : (ne.required || he).reduce((Ce, Se) => (Object.keys(_t || {}).includes(Se) || (Ae[Se] !== void 0 ? Ce[Se] = Ae[Se] : le && le[Se] !== void 0 && (Ce[Se] = le[Se])), Ce), {}), mn = {
12574
+ return (ie ? pn && gs : pn && ne.required?.includes(Se) && gs) && (Ce[Se] = ne.server_input?.[Se]), Ce;
12575
+ }, {}), Dr = ie ? {} : (ne.required || de).reduce((Ce, Se) => (Object.keys(_t || {}).includes(Se) || (Me[Se] !== void 0 ? Ce[Se] = Me[Se] : le && le[Se] !== void 0 && (Ce[Se] = le[Se])), Ce), {}), mn = {
12576
12576
  ...Lr || {},
12577
12577
  //existing inputs
12578
12578
  ...Dr,
@@ -12597,26 +12597,26 @@ const jt = (e) => {
12597
12597
  });
12598
12598
  }
12599
12599
  } else {
12600
- const he = Dt?.id, Ae = he ? Object.entries(tt).filter(([Lr, Dr]) => {
12600
+ const de = Dt?.id, Me = de ? Object.entries(tt).filter(([Lr, Dr]) => {
12601
12601
  const [mn] = Lr.split("::");
12602
- return mn === he && Dr.active;
12602
+ return mn === de && Dr.active;
12603
12603
  }) : [], _t = ve ?? ne?.tool_result;
12604
12604
  await y.current?.sendMessage({
12605
12605
  // Always a string — a tool_result forward with no user text sends "".
12606
12606
  message: k ?? "",
12607
12607
  files: x,
12608
12608
  audio: D,
12609
- ...Me && { initial_prompts: Me },
12610
- ...Pe || Ae.length > 0 ? {
12609
+ ...Ie && { initial_prompts: Ie },
12610
+ ...Pe || Me.length > 0 ? {
12611
12611
  tool_declined: !0,
12612
12612
  tool_id: ne?.tool_id || ""
12613
12613
  } : {},
12614
12614
  ..._t && { tool_result: _t }
12615
12615
  });
12616
12616
  }
12617
- (k || x && x.length > 0 || D?.audio || fn || mt) && (c((he) => {
12618
- if (it) return he;
12619
- const Ae = he.length === 0 && A?.text ? [{
12617
+ (k || x && x.length > 0 || D?.audio || fn || mt) && (c((de) => {
12618
+ if (it) return de;
12619
+ const Me = de.length === 0 && A?.text ? [{
12620
12620
  id: "initial-bot-message",
12621
12621
  content: A.text,
12622
12622
  role: Ue.ASSISTANT,
@@ -12624,8 +12624,8 @@ const jt = (e) => {
12624
12624
  isStored: !1
12625
12625
  }] : [];
12626
12626
  return [
12627
- ...he,
12628
- ...Ae,
12627
+ ...de,
12628
+ ...Me,
12629
12629
  {
12630
12630
  id: Date.now().toString(),
12631
12631
  content: fn || mt || k || "",
@@ -12637,15 +12637,15 @@ const jt = (e) => {
12637
12637
  }
12638
12638
  ];
12639
12639
  }), it || X(!0), it = null);
12640
- const ie = W.getState().elicitationState, we = /* @__PURE__ */ new Set();
12641
- Ge && we.add(Ge), Dt?.tool_keys?.forEach((he) => we.add(he)), we.forEach((he) => {
12642
- const Ae = ie[he];
12643
- Ae && ye(he, {
12644
- ...Ae,
12640
+ const oe = W.getState().elicitationState, we = /* @__PURE__ */ new Set();
12641
+ Ge && we.add(Ge), Dt?.tool_keys?.forEach((de) => we.add(de)), we.forEach((de) => {
12642
+ const Me = oe[de];
12643
+ Me && ye(de, {
12644
+ ...Me,
12645
12645
  ...ct && { active: !1, disabled: !0 },
12646
- ...he === Ge ? {
12646
+ ...de === Ge ? {
12647
12647
  response_value: {
12648
- ...Ae?.response_value || {},
12648
+ ...Me?.response_value || {},
12649
12649
  label: fn || k || ""
12650
12650
  }
12651
12651
  } : {}
@@ -12698,13 +12698,13 @@ const jt = (e) => {
12698
12698
  ot(), window.postMessage(
12699
12699
  { type: "AUTH_EXPIRED", message: "Authentication expired" },
12700
12700
  "*"
12701
- ), oe(Re.NOT_CONNECTED), z({
12701
+ ), se(Re.NOT_CONNECTED), z({
12702
12702
  title: "Session expired",
12703
12703
  description: "Your session has expired. Please reload the page to continue."
12704
12704
  });
12705
12705
  }, Nt = async () => {
12706
12706
  if (Ke()) {
12707
- oe(Re.CONNECTED);
12707
+ se(Re.CONNECTED);
12708
12708
  const k = d.current[d.current.length - 1];
12709
12709
  if (k && k.role === Ue.USER)
12710
12710
  try {
@@ -12716,10 +12716,10 @@ const jt = (e) => {
12716
12716
  });
12717
12717
  } catch {
12718
12718
  }
12719
- } else if (oe(Re.NOT_CONNECTED), g.current < 2) {
12719
+ } else if (se(Re.NOT_CONNECTED), g.current < 2) {
12720
12720
  g.current++;
12721
12721
  const { sessionId: k } = W.getState();
12722
- await Ie(k);
12722
+ await Oe(k);
12723
12723
  } else g.current === 2 ? (g.current++, j(!0), z({
12724
12724
  title: "Trying to connect..."
12725
12725
  })) : (z({
@@ -12924,17 +12924,17 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
12924
12924
  toggleMute: c
12925
12925
  } = uh(), d = () => {
12926
12926
  r === I.VOICE_AGENT_STATE.IDLE && i();
12927
- }, f = r !== I.VOICE_AGENT_STATE.IDLE, [u, p] = F(""), [E, m] = F(!1), g = W((ie) => ie.setDisplayMode), [b, h] = F(
12927
+ }, f = r !== I.VOICE_AGENT_STATE.IDLE, [u, p] = F(""), [E, m] = F(!1), g = W((oe) => oe.setDisplayMode), [b, h] = F(
12928
12928
  n.displayMode === "full" ? "full" : "widget"
12929
- ), _ = () => h((ie) => ie === "full" ? "widget" : "full"), N = Gl() ? "mobile" : b, [C, T] = F([]), v = G(!1), [w, S] = F(!1), [R, O] = F(!1), A = G(null), {
12929
+ ), _ = () => h((oe) => oe === "full" ? "widget" : "full"), N = Gl() ? "mobile" : b, [C, T] = F([]), v = G(!1), [w, S] = F(!1), [R, O] = F(!1), A = G(null), {
12930
12930
  setAgentId: B,
12931
12931
  startNewConnection: re,
12932
12932
  showRetryButton: K,
12933
- clearError: ue,
12933
+ clearError: he,
12934
12934
  error: ee,
12935
12935
  connectionStatus: M,
12936
12936
  recordingStatus: z,
12937
- isWaitingForResponse: oe,
12937
+ isWaitingForResponse: se,
12938
12938
  isStreaming: j,
12939
12939
  setError: Y,
12940
12940
  sessionId: Z,
@@ -12944,7 +12944,7 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
12944
12944
  sessionInitialMessages: ce,
12945
12945
  setInitialDisplayMode: ot,
12946
12946
  clearSession: ze
12947
- } = W(), L = W((ie) => ie.elicitationState), Ee = W((ie) => ie.level), {
12947
+ } = W(), L = W((oe) => oe.elicitationState), Ee = W((oe) => oe.level), {
12948
12948
  incomingMessages: te,
12949
12949
  loading: Ne,
12950
12950
  isLoadingSessionMessages: Ve,
@@ -12953,7 +12953,7 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
12953
12953
  startSession: st,
12954
12954
  isReady: ke,
12955
12955
  startRecording: ft,
12956
- stopRecording: Ie,
12956
+ stopRecording: Oe,
12957
12957
  handleRetry: $e,
12958
12958
  isValidFile: et,
12959
12959
  sendMessageFeedback: Ke,
@@ -12976,8 +12976,8 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
12976
12976
  const Nt = ae(async () => {
12977
12977
  Zt(!0);
12978
12978
  try {
12979
- const ie = await dn.current();
12980
- Pr(ie);
12979
+ const oe = await dn.current();
12980
+ Pr(oe);
12981
12981
  } catch {
12982
12982
  } finally {
12983
12983
  Zt(!1);
@@ -12986,7 +12986,7 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
12986
12986
  nr(!0), await Nt();
12987
12987
  }, [Nt]), hs = ae(() => {
12988
12988
  nr(!1);
12989
- }, []), [fs, ms] = F(!1), ps = ae(() => ms((ie) => !ie), []);
12989
+ }, []), [fs, ms] = F(!1), ps = ae(() => ms((oe) => !oe), []);
12990
12990
  H(() => {
12991
12991
  N !== "full" || Ee !== "user" || Nt();
12992
12992
  }, [N, Ee, Z, Nt]), H(() => {
@@ -12996,20 +12996,20 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
12996
12996
  }, []);
12997
12997
  const k = () => {
12998
12998
  n.feedback && !Xf(t) ? O(!0) : n.onClose();
12999
- }, x = async (ie, we) => {
13000
- await lt(ie, we), O(!1), n.onClose();
12999
+ }, x = async (oe, we) => {
13000
+ await lt(oe, we), O(!1), n.onClose();
13001
13001
  }, D = () => {
13002
13002
  O(!1), n.onClose();
13003
13003
  }, $ = () => {
13004
13004
  Jf(t), O(!1), n.onClose();
13005
13005
  }, le = () => {
13006
13006
  O(!1);
13007
- }, se = te.length > 0, Pe = te.length === 1, ve = fe(() => {
13008
- const ie = te[te.length - 1], we = ie?.tool_keys?.[ie.tool_keys.length - 1];
13007
+ }, ie = te.length > 0, Pe = te.length === 1, ve = fe(() => {
13008
+ const oe = te[te.length - 1], we = oe?.tool_keys?.[oe.tool_keys.length - 1];
13009
13009
  if (!we) return null;
13010
- const he = L[we];
13011
- return he?.active ? { ...he, tool_key: we } : null;
13012
- }, [te, L]), Ye = fe(() => (Z ? ce[Z] : void 0) ?? Te ?? n?.initialMessage ?? null, [Z, ce, Te, n?.initialMessage]), tt = fe(() => !!Ye?.text || !!Ye?.suggestions?.length, [Ye]), un = fe(() => tt && te?.length === 0 && !Ve, [te, tt, Ve]), Me = fe(() => ve ? ve.component === I.SYNAPSE_COMPONENTS.MOBILE || ve.component === I.SYNAPSE_COMPONENTS.OTP || ve.component === I.SYNAPSE_COMPONENTS.EMAIL : !1, [ve]), {
13010
+ const de = L[we];
13011
+ return de?.active ? { ...de, tool_key: we } : null;
13012
+ }, [te, L]), Ye = fe(() => (Z ? ce[Z] : void 0) ?? Te ?? n?.initialMessage ?? null, [Z, ce, Te, n?.initialMessage]), tt = fe(() => !!Ye?.text || !!Ye?.suggestions?.length, [Ye]), un = fe(() => tt && te?.length === 0 && !Ve, [te, tt, Ve]), Ie = fe(() => ve ? ve.component === I.SYNAPSE_COMPONENTS.MOBILE || ve.component === I.SYNAPSE_COMPONENTS.OTP || ve.component === I.SYNAPSE_COMPONENTS.EMAIL : !1, [ve]), {
13013
13013
  scrollAreaRef: it,
13014
13014
  messagesEndRef: mt,
13015
13015
  showScrollButton: pt,
@@ -13019,17 +13019,17 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
13019
13019
  isStreaming: j,
13020
13020
  isFirstMessage: Pe,
13021
13021
  resolvedMode: N
13022
- }), hn = M === I.ConnectionStatus.CONNECTED, xe = oe || j, Ge = fe(() => z === _e.IDLE ? null : z === _e.LISTENING ? "Listening..." : z === _e.PROCESSING ? "Processing..." : z === _e.TRANSCRIBING ? "Transcribing..." : null, [z]), ne = Ge && z !== _e.IDLE ? Ge : oe || j ? "Please wait for the response..." : "Type a reply…", Ze = async (ie, we) => {
13022
+ }), hn = M === I.ConnectionStatus.CONNECTED, xe = se || j, Ge = fe(() => z === _e.IDLE ? null : z === _e.LISTENING ? "Listening..." : z === _e.PROCESSING ? "Processing..." : z === _e.TRANSCRIBING ? "Transcribing..." : null, [z]), ne = Ge && z !== _e.IDLE ? Ge : se || j ? "Please wait for the response..." : "Type a reply…", Ze = async (oe, we) => {
13023
13023
  if (xe)
13024
13024
  return;
13025
- const he = we ? ye : je, Ae = ie?.message ?? u;
13026
- (Ae.trim() || E || w || ie?.resend) && (C.length > 0 ? (await he({
13025
+ const de = we ? ye : je, Me = oe?.message ?? u;
13026
+ C.length > 0 ? (await de({
13027
13027
  files: C,
13028
- message: Ae.trim()
13029
- }), T([]), S(!1)) : Ae.trim() ? await he({ ...ie, message: Ae.trim() }) : ie?.resend && await he(ie), p(""), m(!1), S(!1));
13030
- }, xt = (ie) => {
13031
- if (ie && ie.length > 0) {
13032
- const we = ie.filter((he) => !!et(he));
13028
+ message: Me.trim()
13029
+ }), T([]), S(!1)) : Me.trim() ? await de({ ...oe, message: Me.trim() }) : oe?.resend ? await de(oe) : oe && await de(oe), p(""), m(!1), S(!1);
13030
+ }, xt = (oe) => {
13031
+ if (oe && oe.length > 0) {
13032
+ const we = oe.filter((de) => !!et(de));
13033
13033
  if (we?.length + C.length > 3) {
13034
13034
  Y({
13035
13035
  title: "You can only upload up to 3 files at a time",
@@ -13037,7 +13037,7 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
13037
13037
  });
13038
13038
  return;
13039
13039
  }
13040
- if (we?.length > 0 && we.reduce((he, Ae) => he + Ae.size, 0) > 10 * 1024 * 1024) {
13040
+ if (we?.length > 0 && we.reduce((de, Me) => de + Me.size, 0) > 10 * 1024 * 1024) {
13041
13041
  Y({
13042
13042
  title: `Total file size limit of ${_h} MB exceeded`,
13043
13043
  description: "Please reduce the size of the files or try again with less files"
@@ -13045,19 +13045,19 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
13045
13045
  return;
13046
13046
  }
13047
13047
  if (we?.length > 0)
13048
- ie = we;
13048
+ oe = we;
13049
13049
  else
13050
13050
  return;
13051
13051
  }
13052
- T((we) => (S((we?.length ?? 0) + (ie?.length ?? 0) > 0), [...we, ...ie]));
13053
- }, ct = (ie) => {
13052
+ T((we) => (S((we?.length ?? 0) + (oe?.length ?? 0) > 0), [...we, ...oe]));
13053
+ }, ct = (oe) => {
13054
13054
  T((we) => {
13055
- const he = we.filter((Ae, _t) => _t !== ie);
13056
- return S(he.length > 0), he;
13055
+ const de = we.filter((Me, _t) => _t !== oe);
13056
+ return S(de.length > 0), de;
13057
13057
  });
13058
13058
  }, gt = async () => {
13059
13059
  if (E)
13060
- await Ie(), m(!1);
13060
+ await Oe(), m(!1);
13061
13061
  else {
13062
13062
  if (xe) return;
13063
13063
  try {
@@ -13106,17 +13106,17 @@ function Qf({ isOpen: e, agentId: t, config: n }) {
13106
13106
  // Store values
13107
13107
  startNewConnection: re,
13108
13108
  showRetryButton: K,
13109
- clearError: ue,
13109
+ clearError: he,
13110
13110
  error: ee,
13111
13111
  connectionStatus: M,
13112
13112
  isStreaming: j,
13113
13113
  sessionId: Z,
13114
13114
  activeElicitation: ve,
13115
13115
  // Derived
13116
- inConversation: se,
13116
+ inConversation: ie,
13117
13117
  isFirstMessage: Pe,
13118
13118
  isEmptyChat: un,
13119
- isAuthComponent: Me,
13119
+ isAuthComponent: Ie,
13120
13120
  isConnected: hn,
13121
13121
  isComposerDisabled: xe,
13122
13122
  loading: Ne,
@@ -13389,19 +13389,19 @@ function op(e = "", t = {}) {
13389
13389
  if (S === "ref") return N;
13390
13390
  const R = N[S] = (function(O, A, B, re) {
13391
13391
  return A === "style" ? (function(K) {
13392
- const ue = [];
13393
- let ee = "", M = !1, z = !1, oe = "";
13394
- if (!K) return ue;
13392
+ const he = [];
13393
+ let ee = "", M = !1, z = !1, se = "";
13394
+ if (!K) return he;
13395
13395
  for (let Y = 0; Y < K.length; Y++) {
13396
13396
  const Z = K[Y];
13397
- if (Z !== '"' && Z !== "'" || M || (z ? Z === oe && (z = !1, oe = "") : (z = !0, oe = Z)), Z === "(" && ee.endsWith("url") ? M = !0 : Z === ")" && M && (M = !1), Z !== ";" || z || M) ee += Z;
13397
+ if (Z !== '"' && Z !== "'" || M || (z ? Z === se && (z = !1, se = "") : (z = !0, se = Z)), Z === "(" && ee.endsWith("url") ? M = !0 : Z === ")" && M && (M = !1), Z !== ";" || z || M) ee += Z;
13398
13398
  else {
13399
13399
  const X = ee.trim();
13400
13400
  if (X) {
13401
13401
  const Te = X.indexOf(":");
13402
13402
  if (Te > 0) {
13403
13403
  const ge = X.slice(0, Te).trim(), ce = X.slice(Te + 1).trim();
13404
- ue.push([ge, ce]);
13404
+ he.push([ge, ce]);
13405
13405
  }
13406
13406
  }
13407
13407
  ee = "";
@@ -13412,12 +13412,12 @@ function op(e = "", t = {}) {
13412
13412
  const Y = j.indexOf(":");
13413
13413
  if (Y > 0) {
13414
13414
  const Z = j.slice(0, Y).trim(), X = j.slice(Y + 1).trim();
13415
- ue.push([Z, X]);
13415
+ he.push([Z, X]);
13416
13416
  }
13417
13417
  }
13418
- return ue;
13419
- })(B).reduce(function(K, [ue, ee]) {
13420
- return K[ue.replace(/(-[a-z])/g, (M) => M[1].toUpperCase())] = re(ee, O, ue), K;
13418
+ return he;
13419
+ })(B).reduce(function(K, [he, ee]) {
13420
+ return K[he.replace(/(-[a-z])/g, (M) => M[1].toUpperCase())] = re(ee, O, he), K;
13421
13421
  }, {}) : nm.indexOf(A) !== -1 ? re(dt(B), O, A) : (B.match(ym) && (B = dt(B.slice(1, B.length - 1))), B === "true" || B !== "false" && B);
13422
13422
  })(h, v, w, r);
13423
13423
  typeof R == "string" && (so.test(R) || io.test(R)) && (N[S] = d(R.trim()));
@@ -13747,7 +13747,7 @@ function fp({
13747
13747
  }
13748
13748
  ),
13749
13749
  /* @__PURE__ */ l(
13750
- de,
13750
+ ue,
13751
13751
  {
13752
13752
  onClick: y,
13753
13753
  disabled: i.length === 0 || m || o,
@@ -13888,7 +13888,7 @@ function mp({
13888
13888
  ),
13889
13889
  !s && !b && !y && o && n && h === I.USER_FEEDBACK.NONE && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
13890
13890
  /* @__PURE__ */ l(
13891
- de,
13891
+ ue,
13892
13892
  {
13893
13893
  variant: "ghost",
13894
13894
  size: "sm",
@@ -13898,7 +13898,7 @@ function mp({
13898
13898
  }
13899
13899
  ),
13900
13900
  /* @__PURE__ */ l(
13901
- de,
13901
+ ue,
13902
13902
  {
13903
13903
  variant: "ghost",
13904
13904
  size: "sm",
@@ -13909,7 +13909,7 @@ function mp({
13909
13909
  )
13910
13910
  ] }) }),
13911
13911
  !s && !b && !y && o && h === I.USER_FEEDBACK.LIKE && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l(
13912
- de,
13912
+ ue,
13913
13913
  {
13914
13914
  variant: "ghost",
13915
13915
  size: "sm",
@@ -13919,7 +13919,7 @@ function mp({
13919
13919
  }
13920
13920
  ) }),
13921
13921
  !s && !b && !y && o && h === I.USER_FEEDBACK.DISLIKE && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l(
13922
- de,
13922
+ ue,
13923
13923
  {
13924
13924
  variant: "ghost",
13925
13925
  size: "sm",
@@ -13929,7 +13929,7 @@ function mp({
13929
13929
  }
13930
13930
  ) }),
13931
13931
  m && o && a?.length ? /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l(
13932
- de,
13932
+ ue,
13933
13933
  {
13934
13934
  variant: "link",
13935
13935
  size: "sm",
@@ -13988,7 +13988,7 @@ function mp({
13988
13988
  ),
13989
13989
  !y && o && h === I.USER_FEEDBACK.NONE && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
13990
13990
  /* @__PURE__ */ l(
13991
- de,
13991
+ ue,
13992
13992
  {
13993
13993
  variant: "ghost",
13994
13994
  size: "sm",
@@ -13998,7 +13998,7 @@ function mp({
13998
13998
  }
13999
13999
  ),
14000
14000
  /* @__PURE__ */ l(
14001
- de,
14001
+ ue,
14002
14002
  {
14003
14003
  variant: "ghost",
14004
14004
  size: "sm",
@@ -14009,7 +14009,7 @@ function mp({
14009
14009
  )
14010
14010
  ] }) }),
14011
14011
  !y && o && h === I.USER_FEEDBACK.LIKE && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l(
14012
- de,
14012
+ ue,
14013
14013
  {
14014
14014
  variant: "ghost",
14015
14015
  size: "sm",
@@ -14019,7 +14019,7 @@ function mp({
14019
14019
  }
14020
14020
  ) }),
14021
14021
  !y && o && h === I.USER_FEEDBACK.DISLIKE && /* @__PURE__ */ l("div", { className: "flex items-center gap-2 self-start mt-1", children: /* @__PURE__ */ l(
14022
- de,
14022
+ ue,
14023
14023
  {
14024
14024
  variant: "ghost",
14025
14025
  size: "sm",
@@ -14336,11 +14336,11 @@ function Sp({
14336
14336
  voiceAgentState: B,
14337
14337
  isMuted: re,
14338
14338
  isVoiceAgentActive: K,
14339
- disconnectVoiceAgent: ue,
14339
+ disconnectVoiceAgent: he,
14340
14340
  resetVoiceAgent: ee,
14341
14341
  toggleMute: M,
14342
14342
  handleClose: z,
14343
- isSessionDrawerOpen: oe,
14343
+ isSessionDrawerOpen: se,
14344
14344
  pastSessions: j,
14345
14345
  isLoadingPastSessions: Y,
14346
14346
  openSessionDrawer: Z,
@@ -14411,7 +14411,7 @@ function Sp({
14411
14411
  sessionDrawer: /* @__PURE__ */ l(
14412
14412
  Of,
14413
14413
  {
14414
- isOpen: oe,
14414
+ isOpen: se,
14415
14415
  onClose: X,
14416
14416
  sessions: j,
14417
14417
  activeSessionId: p,
@@ -14450,7 +14450,7 @@ function Sp({
14450
14450
  {
14451
14451
  state: B,
14452
14452
  isMuted: re,
14453
- onEndCall: ue,
14453
+ onEndCall: he,
14454
14454
  onClose: ee,
14455
14455
  onToggleMute: M,
14456
14456
  agentName: n.title,
@@ -14502,7 +14502,7 @@ function Sp({
14502
14502
  }
14503
14503
  ) }),
14504
14504
  s && /* @__PURE__ */ l("div", { className: "absolute bottom-[10px] left-1/2 transform -translate-x-1/2 z-10", children: /* @__PURE__ */ l(
14505
- de,
14505
+ ue,
14506
14506
  {
14507
14507
  onClick: () => R("smooth"),
14508
14508
  size: "icon",
@@ -14638,7 +14638,7 @@ function Cp({
14638
14638
  }
14639
14639
  ),
14640
14640
  /* @__PURE__ */ l("div", { className: "mt-5 flex items-center justify-center gap-3", children: /* @__PURE__ */ l(
14641
- de,
14641
+ ue,
14642
14642
  {
14643
14643
  type: "button",
14644
14644
  onClick: d,
@@ -14719,7 +14719,7 @@ const Np = (e, t, n) => {
14719
14719
  typeof window < "u" && (window.renderMedAssist = Np, window.fetchAgentConfig = Rp);
14720
14720
  export {
14721
14721
  G as A,
14722
- de as B,
14722
+ ue as B,
14723
14723
  os as C,
14724
14724
  J as D,
14725
14725
  Ou as F,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eka-care/medassist-widget",
3
3
  "description": "MedAssist Widget react application",
4
- "version": "0.1.124",
4
+ "version": "0.1.125",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"