@eloquentai/chat-sdk 0.29.0-dev → 0.29.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +146 -6
  2. package/dist/components/banner.d.ts +1 -1
  3. package/dist/components/chat/chat.d.ts +22 -0
  4. package/dist/components/chat/hooks/use-chat.d.ts +79 -0
  5. package/dist/components/chat/{interface-props.hook.d.ts → hooks/use-interface-props.d.ts} +2 -2
  6. package/dist/components/chat/hooks/use-keyboard-inset.d.ts +6 -0
  7. package/dist/components/chat/{message-events.hook.d.ts → hooks/use-message-events.d.ts} +5 -5
  8. package/dist/components/chat/{persistence.hook.d.ts → hooks/use-persistence.d.ts} +5 -2
  9. package/dist/components/chat/{realtime-socket.hook.d.ts → hooks/use-realtime-socket.d.ts} +5 -4
  10. package/dist/components/chat/hooks/use-scroll-lock.d.ts +6 -0
  11. package/dist/components/chat/{sdk-initialization.hook.d.ts → hooks/use-sdk-initialization.d.ts} +4 -2
  12. package/dist/components/chat/index.d.ts +1 -3
  13. package/dist/components/chat/message-mapping.d.ts +17 -0
  14. package/dist/components/chat/validations.d.ts +62 -74
  15. package/dist/components/chat-interface/chat-interface.d.ts +2 -0
  16. package/dist/components/chat-interface/content.d.ts +1 -1
  17. package/dist/components/chat-interface/context.d.ts +2 -2
  18. package/dist/components/chat-interface/footer.d.ts +1 -1
  19. package/dist/components/chat-interface/header.d.ts +1 -1
  20. package/dist/components/chat-interface/index.d.ts +2 -27
  21. package/dist/components/chat-interface/message-bubble/message-action-buttons.d.ts +6 -0
  22. package/dist/components/chat-interface/message-bubble/message-animation-state.d.ts +2 -0
  23. package/dist/components/chat-interface/message-bubble/message-bubble-item.d.ts +7 -0
  24. package/dist/components/{chat-message-bubble.d.ts → chat-interface/message-bubble/message-bubble.d.ts} +2 -2
  25. package/dist/components/{chat-rating-bubble.d.ts → chat-interface/rating-message-bubble.d.ts} +1 -1
  26. package/dist/components/chat-interface/shared.d.ts +11 -1
  27. package/dist/components/chat-interface/skeleton.d.ts +4 -2
  28. package/dist/components/chat-interface/suggested-messages.d.ts +20 -0
  29. package/dist/components/chat-interface/types.d.ts +56 -0
  30. package/dist/components/embed/chat-bubble.d.ts +6 -0
  31. package/dist/components/{iframe.d.ts → embed/iframe.d.ts} +1 -1
  32. package/dist/components/{portal.d.ts → embed/portal.d.ts} +2 -1
  33. package/dist/components/{chat → embed}/proactive-message.d.ts +1 -1
  34. package/dist/components/{render-chat.d.ts → embed/render-chat.d.ts} +1 -1
  35. package/dist/components/index.d.ts +2 -2
  36. package/dist/components/logo.d.ts +1 -1
  37. package/dist/components/ui/avatar.d.ts +3 -4
  38. package/dist/components/ui/card.d.ts +7 -7
  39. package/dist/components/ui/dialog.d.ts +11 -12
  40. package/dist/components/ui/markdown-viewer.d.ts +1 -1
  41. package/dist/components/ui/scroll-area.d.ts +5 -5
  42. package/dist/components/ui/skeleton.d.ts +2 -1
  43. package/dist/components/ui/star-rating.d.ts +1 -1
  44. package/dist/components/ui/textarea.d.ts +1 -2
  45. package/dist/contexts/{agent-cognition-context-definition.d.ts → agent-cognition/agent-cognition-context.d.ts} +1 -1
  46. package/dist/contexts/{agent-cognition.context.d.ts → agent-cognition/agent-cognition-provider.d.ts} +1 -1
  47. package/dist/contexts/{error-handling.utils.d.ts → error-handling/error-context.d.ts} +1 -1
  48. package/dist/contexts/{constants.d.ts → error-handling/error-messages.d.ts} +4 -0
  49. package/dist/contexts/error-handling/error-provider.d.ts +4 -0
  50. package/dist/contexts/theme.context.d.ts +14 -1
  51. package/dist/embed-loader.d.ts +35 -0
  52. package/dist/embed-loader.entry.d.ts +1 -0
  53. package/dist/hooks/use-debounce.d.ts +6 -0
  54. package/dist/hooks/use-drag-scroll.d.ts +5 -4
  55. package/dist/hooks/use-latest-ref.d.ts +9 -0
  56. package/dist/hooks/use-typed-text.d.ts +11 -0
  57. package/dist/index-hFbiYJI3.js +4165 -0
  58. package/dist/index-hFbiYJI3.js.map +1 -0
  59. package/dist/index.css +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.mjs +2288 -7
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/lib/appsync-events-client.d.ts +71 -0
  64. package/dist/lib/color-aura.d.ts +23 -0
  65. package/dist/lib/color-contrast.d.ts +13 -0
  66. package/dist/lib/config.d.ts +0 -15
  67. package/dist/lib/cookies.d.ts +13 -0
  68. package/dist/lib/eloquent-ai-api-client.d.ts +20 -2
  69. package/dist/lib/http.d.ts +3 -0
  70. package/dist/lib/retry.d.ts +10 -0
  71. package/dist/lib/utils.d.ts +0 -7
  72. package/dist/lib/wrap-promise.d.ts +7 -0
  73. package/dist/skeleton-ebiDTqw5.js +18959 -0
  74. package/dist/skeleton-ebiDTqw5.js.map +1 -0
  75. package/dist/ui.d.ts +10 -0
  76. package/dist/ui.mjs +19 -0
  77. package/dist/ui.mjs.map +1 -0
  78. package/package.json +59 -31
  79. package/dist/components/chat/chat.hook.d.ts +0 -47
  80. package/dist/components/chat-bubble.d.ts +0 -4
  81. package/dist/components/logo-animated.d.ts +0 -6
  82. package/dist/components/logo-squared.d.ts +0 -5
  83. package/dist/components/ui/input.d.ts +0 -3
  84. package/dist/components/ui/loading-ellipsis.d.ts +0 -1
  85. package/dist/components/ui/popover.d.ts +0 -6
  86. package/dist/contexts/error-handling.context.d.ts +0 -4
  87. package/dist/contexts/utils.d.ts +0 -2
  88. package/dist/hooks/useTypewriter.d.ts +0 -1
  89. package/dist/index-DaMnFGD6.js +0 -18793
  90. package/dist/index-DaMnFGD6.js.map +0 -1
  91. package/dist/index-DySyj7Hm.js +0 -30694
  92. package/dist/index-DySyj7Hm.js.map +0 -1
  93. /package/dist/components/chat/{ui-initialization.hook.d.ts → hooks/use-ui-initialization.d.ts} +0 -0
  94. /package/dist/components/chat/{user-identity.hook.d.ts → hooks/use-user-identity.d.ts} +0 -0
  95. /package/dist/{hooks → contexts/agent-cognition}/use-agent-cognition-context.d.ts +0 -0
  96. /package/dist/{hooks → contexts/agent-cognition}/use-agent-cognition.d.ts +0 -0
  97. /package/dist/hooks/{useFetch.d.ts → use-fetch.d.ts} +0 -0
  98. /package/dist/{type.d.ts → types/message.d.ts} +0 -0
package/dist/index.mjs CHANGED
@@ -1,13 +1,2294 @@
1
- import { C as n, a as s, r, u as f } from "./index-DySyj7Hm.js";
1
+ "use client";
2
+ import { L as mt, c as He, u as wt, g as Fe, X as vt, d as Ae, e as bt, f as qt, h as yt, A as xt, E as kt, i as _t, S as Ct, C as St, T as It } from "./skeleton-ebiDTqw5.js";
3
+ import { jsx as m, jsxs as _e, Fragment as Ge } from "react/jsx-runtime";
4
+ import { useState as q, useEffect as Z, useMemo as Le, useRef as L, useCallback as v } from "react";
5
+ import { createPortal as Ze } from "react-dom";
6
+ import Et from "react-dom/client";
2
7
  try {
3
- let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, d = new e.Error().stack;
4
- d && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[d] = "118859a5-c0fd-4bc2-9d01-2ca49e89967d", e._sentryDebugIdIdentifier = "sentry-dbid-118859a5-c0fd-4bc2-9d01-2ca49e89967d");
8
+ let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
9
+ t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "31334120-d537-452b-8787-caa8fb4737c5", e._sentryDebugIdIdentifier = "sentry-dbid-31334120-d537-452b-8787-caa8fb4737c5");
5
10
  } catch {
6
11
  }
12
+ if (typeof window < "u") {
13
+ const e = "development";
14
+ import("./index-hFbiYJI3.js").then(({ init: t }) => {
15
+ t({
16
+ dsn: void 0,
17
+ environment: e,
18
+ sendDefaultPii: !1,
19
+ debug: !1,
20
+ enabled: !0,
21
+ beforeSend(o) {
22
+ const r = /* @__PURE__ */ new Set([
23
+ "authorization",
24
+ "cookie",
25
+ "x-api-key",
26
+ "x-auth-token"
27
+ ]), a = o.request?.headers;
28
+ if (a)
29
+ for (const l of Object.keys(a))
30
+ r.has(l.toLowerCase()) && (a[l] = "[Filtered]");
31
+ return o.request && (o.request.data = "[Filtered]"), o;
32
+ }
33
+ });
34
+ });
35
+ }
36
+ const Ne = '/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--eloq-aura-angle:0deg}}}@layer theme{:root,:host{--eloq-font-sans:system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--eloq-font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--eloq-color-red-50:oklch(97.1% .013 17.38);--eloq-color-red-200:oklch(88.5% .062 18.334);--eloq-color-red-400:oklch(70.4% .191 22.216);--eloq-color-red-500:oklch(63.7% .237 25.331);--eloq-color-red-800:oklch(44.4% .177 26.899);--eloq-color-amber-50:oklch(98.7% .022 95.277);--eloq-color-amber-200:oklch(92.4% .12 95.746);--eloq-color-amber-400:oklch(82.8% .189 84.429);--eloq-color-amber-500:oklch(76.9% .188 70.08);--eloq-color-amber-800:oklch(47.3% .137 46.201);--eloq-color-yellow-400:oklch(85.2% .199 91.936);--eloq-color-green-50:oklch(98.2% .018 155.826);--eloq-color-green-200:oklch(92.5% .084 155.995);--eloq-color-green-400:oklch(79.2% .209 151.711);--eloq-color-green-500:oklch(72.3% .219 149.579);--eloq-color-green-800:oklch(44.8% .119 151.328);--eloq-color-blue-50:oklch(97% .014 254.604);--eloq-color-blue-200:oklch(88.2% .059 254.128);--eloq-color-blue-400:oklch(70.7% .165 254.624);--eloq-color-blue-500:oklch(62.3% .214 259.815);--eloq-color-blue-800:oklch(42.4% .199 265.638);--eloq-color-gray-200:oklch(92.8% .006 264.531);--eloq-color-gray-300:oklch(87.2% .01 258.338);--eloq-color-gray-400:oklch(70.7% .022 261.325);--eloq-color-gray-500:oklch(55.1% .027 264.364);--eloq-color-gray-600:oklch(44.6% .03 256.802);--eloq-color-black:#000;--eloq-color-white:#fff;--eloq-spacing:.25rem;--eloq-container-xs:20rem;--eloq-container-lg:32rem;--eloq-text-xs:.75rem;--eloq-text-xs--line-height:calc(1 / .75);--eloq-text-sm:.875rem;--eloq-text-sm--line-height:calc(1.25 / .875);--eloq-text-base:1rem;--eloq-text-base--line-height: 1.5 ;--eloq-text-lg:1.125rem;--eloq-text-lg--line-height:calc(1.75 / 1.125);--eloq-text-2xl:1.5rem;--eloq-text-2xl--line-height:calc(2 / 1.5);--eloq-font-weight-medium:500;--eloq-font-weight-semibold:600;--eloq-tracking-tight:-.025em;--eloq-leading-relaxed:1.625;--eloq-radius-sm:calc(var(--radius) - 4px);--eloq-radius-md:calc(var(--radius) - 2px);--eloq-radius-lg:var(--radius);--eloq-radius-xl:.75rem;--eloq-radius-2xl:1rem;--eloq-radius-3xl:1.5rem;--eloq-drop-shadow-lg:0 4px 4px #00000026;--eloq-drop-shadow-xl:0 9px 7px #0000001a;--eloq-ease-out:cubic-bezier(0, 0, .2, 1);--eloq-animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--eloq-default-transition-duration:.15s;--eloq-default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--eloq-default-font-family:var(--eloq-font-sans);--eloq-default-mono-font-family:var(--eloq-font-mono);--eloq-animate-panel-in:panel-in .35s cubic-bezier(.16, 1, .3, 1) both;--eloq-animate-panel-out:panel-out .25s cubic-bezier(.4, 0, 1, 1) both;--eloq-animate-thinking-dot:thinking-dot 1.2s ease-in-out infinite;--eloq-animate-thinking-shimmer:thinking-shimmer 1.8s linear infinite;--eloq-animate-message-in:message-in .3s ease-out both;--eloq-animate-slide-up-in:slide-up-in .3s ease-out both;--eloq-animate-dialog-overlay-in:dialog-overlay-in .2s ease-out both;--eloq-animate-dialog-overlay-out:dialog-overlay-out .2s ease-in both;--eloq-animate-dialog-content-in:dialog-content-in .2s ease-out both;--eloq-animate-dialog-content-out:dialog-content-out .2s ease-in both}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--eloq-default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--eloq-default-font-feature-settings,normal);font-variation-settings:var(--eloq-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--eloq-default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--eloq-default-mono-font-feature-settings,normal);font-variation-settings:var(--eloq-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:267 56% 46%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--cream:37.5 44% 96.5%;--chart-1:12 76% 61%;--chart-2:173 58% 39%;--chart-3:197 37% 24%;--chart-4:43 74% 66%;--chart-5:27 87% 67%;--radius:.5rem}.dark{--background:262 50% 10%;--foreground:262 5% 90%;--card:262 50% 10%;--card-foreground:262 5% 90%;--popover:262 50% 5%;--popover-foreground:262 5% 90%;--primary:262 62% 70%;--primary-foreground:0 0% 100%;--primary-dark:262 62% 60%;--secondary:262 30% 30%;--secondary-foreground:0 0% 100%;--secondary-dark:262 30% 20%;--secondary-light:262 30% 40%;--tertiary:267 56% 46%;--tertiary-foreground:0 0% 100%;--tertiary-dark:267 38% 25%;--tertiary-light:263 100% 85%;--muted:224 30% 25%;--muted-foreground:262 5% 90%;--accent:224 30% 25%;--accent-foreground:262 5% 100%;--accent-dark:224 30% 15%;--destructive:0 100% 30%;--destructive-foreground:262 5% 90%;--border:0 0% 30%;--input:262 30% 25%;--ring:262 62% 71%;--cream:257 28% 20%;--radius:.5rem;--sidebar-background:var(--background);--sidebar-foreground:var(--foreground);--sidebar-primary:var(--primary);--sidebar-primary-foreground:var(--primary-foreground);--sidebar-accent:var(--accent);--sidebar-accent-foreground:var(--accent-foreground);--sidebar-border:var(--border);--sidebar-ring:var(--ring)}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}}@layer components;@layer utilities{.eloq\\:sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.eloq\\:absolute{position:absolute}.eloq\\:fixed{position:fixed}.eloq\\:relative{position:relative}.eloq\\:inset-0{inset:0}.eloq\\:top-0{top:0}.eloq\\:top-0\\.5{top:calc(var(--eloq-spacing) * .5)}.eloq\\:top-4{top:calc(var(--eloq-spacing) * 4)}.eloq\\:top-\\[50\\%\\]{top:50%}.eloq\\:-right-\\[9px\\]{right:-9px}.eloq\\:right-0\\.5{right:calc(var(--eloq-spacing) * .5)}.eloq\\:right-2{right:calc(var(--eloq-spacing) * 2)}.eloq\\:right-4{right:calc(var(--eloq-spacing) * 4)}.eloq\\:right-16{right:calc(var(--eloq-spacing) * 16)}.eloq\\:bottom-0{bottom:0}.eloq\\:bottom-1{bottom:var(--eloq-spacing)}.eloq\\:bottom-2{bottom:calc(var(--eloq-spacing) * 2)}.eloq\\:bottom-10{bottom:calc(var(--eloq-spacing) * 10)}.eloq\\:left-0{left:0}.eloq\\:left-\\[50\\%\\]{left:50%}.eloq\\:left-\\[calc\\(50\\%-0\\.75rem\\)\\]{left:calc(50% - .75rem)}.eloq\\:z-10{z-index:10}.eloq\\:z-20{z-index:20}.eloq\\:z-50{z-index:50}.eloq\\:m-0{margin:0}.eloq\\:m-auto{margin:auto}.eloq\\:mx-1{margin-inline:var(--eloq-spacing)}.eloq\\:mx-auto{margin-inline:auto}.eloq\\:my-2{margin-block:calc(var(--eloq-spacing) * 2)}.eloq\\:my-4{margin-block:calc(var(--eloq-spacing) * 4)}.eloq\\:-mt-2{margin-top:calc(var(--eloq-spacing) * -2)}.eloq\\:-mt-6{margin-top:calc(var(--eloq-spacing) * -6)}.eloq\\:-mt-20{margin-top:calc(var(--eloq-spacing) * -20)}.eloq\\:mt-1{margin-top:var(--eloq-spacing)}.eloq\\:mt-2{margin-top:calc(var(--eloq-spacing) * 2)}.eloq\\:mt-10{margin-top:calc(var(--eloq-spacing) * 10)}.eloq\\:mr-1{margin-right:var(--eloq-spacing)}.eloq\\:mr-\\[2px\\]{margin-right:2px}.eloq\\:mb-1{margin-bottom:var(--eloq-spacing)}.eloq\\:mb-3{margin-bottom:calc(var(--eloq-spacing) * 3)}.eloq\\:mb-4{margin-bottom:calc(var(--eloq-spacing) * 4)}.eloq\\:mb-10{margin-bottom:calc(var(--eloq-spacing) * 10)}.eloq\\:ml-0{margin-left:0}.eloq\\:ml-1{margin-left:var(--eloq-spacing)}.eloq\\:ml-5{margin-left:calc(var(--eloq-spacing) * 5)}.eloq\\:box-content{box-sizing:content-box}.eloq\\:block{display:block}.eloq\\:flex{display:flex}.eloq\\:grid{display:grid}.eloq\\:hidden{display:none}.eloq\\:inline-flex{display:inline-flex}.eloq\\:aspect-square{aspect-ratio:1}.eloq\\:h-2\\.5{height:calc(var(--eloq-spacing) * 2.5)}.eloq\\:h-4{height:calc(var(--eloq-spacing) * 4)}.eloq\\:h-5{height:calc(var(--eloq-spacing) * 5)}.eloq\\:h-6{height:calc(var(--eloq-spacing) * 6)}.eloq\\:h-8{height:calc(var(--eloq-spacing) * 8)}.eloq\\:h-10{height:calc(var(--eloq-spacing) * 10)}.eloq\\:h-12{height:calc(var(--eloq-spacing) * 12)}.eloq\\:h-14{height:calc(var(--eloq-spacing) * 14)}.eloq\\:h-16{height:calc(var(--eloq-spacing) * 16)}.eloq\\:h-\\[0\\.42em\\]{height:.42em}.eloq\\:h-\\[160px\\]{height:160px}.eloq\\:h-\\[220px\\]{height:220px}.eloq\\:h-\\[560px\\]{height:560px}.eloq\\:h-\\[600px\\]{height:600px}.eloq\\:h-full{height:100%}.eloq\\:max-h-\\[132px\\]{max-height:132px}.eloq\\:min-h-\\[48px\\]{min-height:48px}.eloq\\:min-h-\\[80px\\]{min-height:80px}.eloq\\:w-2\\.5{width:calc(var(--eloq-spacing) * 2.5)}.eloq\\:w-2\\/3{width:66.6667%}.eloq\\:w-3{width:calc(var(--eloq-spacing) * 3)}.eloq\\:w-4{width:calc(var(--eloq-spacing) * 4)}.eloq\\:w-5{width:calc(var(--eloq-spacing) * 5)}.eloq\\:w-6{width:calc(var(--eloq-spacing) * 6)}.eloq\\:w-8{width:calc(var(--eloq-spacing) * 8)}.eloq\\:w-10{width:calc(var(--eloq-spacing) * 10)}.eloq\\:w-12{width:calc(var(--eloq-spacing) * 12)}.eloq\\:w-14{width:calc(var(--eloq-spacing) * 14)}.eloq\\:w-16{width:calc(var(--eloq-spacing) * 16)}.eloq\\:w-24{width:calc(var(--eloq-spacing) * 24)}.eloq\\:w-32{width:calc(var(--eloq-spacing) * 32)}.eloq\\:w-48{width:calc(var(--eloq-spacing) * 48)}.eloq\\:w-\\[0\\.42em\\]{width:.42em}.eloq\\:w-\\[70\\%\\]{width:70%}.eloq\\:w-\\[320px\\]{width:320px}.eloq\\:w-\\[340px\\]{width:340px}.eloq\\:w-\\[380px\\]{width:380px}.eloq\\:w-\\[420px\\]{width:420px}.eloq\\:w-full{width:100%}.eloq\\:max-w-\\[75\\%\\]{max-width:75%}.eloq\\:max-w-\\[88\\%\\]{max-width:88%}.eloq\\:max-w-\\[90vw\\]{max-width:90vw}.eloq\\:max-w-full{max-width:100%}.eloq\\:max-w-lg{max-width:var(--eloq-container-lg)}.eloq\\:max-w-xs{max-width:var(--eloq-container-xs)}.eloq\\:min-w-0{min-width:0}.eloq\\:min-w-min{min-width:min-content}.eloq\\:flex-1{flex:1}.eloq\\:flex-none{flex:none}.eloq\\:flex-shrink-0,.eloq\\:shrink-0{flex-shrink:0}.eloq\\:flex-grow{flex-grow:1}.eloq\\:origin-bottom-right{transform-origin:100% 100%}.eloq\\:translate-x-0{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.eloq\\:translate-x-8{--tw-translate-x:calc(var(--eloq-spacing) * 8);translate:var(--tw-translate-x) var(--tw-translate-y)}.eloq\\:translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.eloq\\:translate-y-\\[-50\\%\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.eloq\\:scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.eloq\\:scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.eloq\\:-scale-x-100{--tw-scale-x: -100% ;scale:var(--tw-scale-x) var(--tw-scale-y)}.eloq\\:scale-\\[0\\.05\\]{scale:.05}.eloq\\:transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.eloq\\:animate-message-in{animation:var(--eloq-animate-message-in)}.eloq\\:animate-panel-in{animation:var(--eloq-animate-panel-in)}.eloq\\:animate-panel-out{animation:var(--eloq-animate-panel-out)}.eloq\\:animate-pulse{animation:var(--eloq-animate-pulse)}.eloq\\:animate-slide-up-in{animation:var(--eloq-animate-slide-up-in)}.eloq\\:animate-thinking-dot{animation:var(--eloq-animate-thinking-dot)}.eloq\\:animate-thinking-shimmer{animation:var(--eloq-animate-thinking-shimmer)}.eloq\\:cursor-default{cursor:default}.eloq\\:cursor-grab{cursor:grab}.eloq\\:cursor-pointer{cursor:pointer}.eloq\\:touch-none{touch-action:none}.eloq\\:resize-none{resize:none}.eloq\\:list-decimal{list-style-type:decimal}.eloq\\:list-disc{list-style-type:disc}.eloq\\:flex-col{flex-direction:column}.eloq\\:flex-col-reverse{flex-direction:column-reverse}.eloq\\:flex-row{flex-direction:row}.eloq\\:items-center{align-items:center}.eloq\\:items-end{align-items:flex-end}.eloq\\:items-start{align-items:flex-start}.eloq\\:justify-between{justify-content:space-between}.eloq\\:justify-center{justify-content:center}.eloq\\:justify-end{justify-content:flex-end}.eloq\\:justify-start{justify-content:flex-start}.eloq\\:gap-1{gap:var(--eloq-spacing)}.eloq\\:gap-1\\.5{gap:calc(var(--eloq-spacing) * 1.5)}.eloq\\:gap-2{gap:calc(var(--eloq-spacing) * 2)}.eloq\\:gap-3{gap:calc(var(--eloq-spacing) * 3)}.eloq\\:gap-4{gap:calc(var(--eloq-spacing) * 4)}.eloq\\:gap-\\[0\\.25em\\]{gap:.25em}:where(.eloq\\:space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block:0}:where(.eloq\\:space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--eloq-spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--eloq-spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.eloq\\:space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--eloq-spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--eloq-spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.eloq\\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--eloq-spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--eloq-spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.eloq\\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--eloq-spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--eloq-spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.eloq\\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--eloq-spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--eloq-spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.eloq\\:space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(var(--eloq-spacing) * var(--tw-space-x-reverse));margin-inline-end:calc(var(--eloq-spacing) * calc(1 - var(--tw-space-x-reverse)))}:where(.eloq\\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--eloq-spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--eloq-spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.eloq\\:space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--eloq-spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--eloq-spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}.eloq\\:self-end{align-self:flex-end}.eloq\\:self-stretch{align-self:stretch}.eloq\\:overflow-hidden{overflow:hidden}.eloq\\:overflow-x-auto{overflow-x:auto}.eloq\\:rounded-2xl{border-radius:var(--eloq-radius-2xl)}.eloq\\:rounded-3xl{border-radius:var(--eloq-radius-3xl)}.eloq\\:rounded-\\[inherit\\]{border-radius:inherit}.eloq\\:rounded-full{border-radius:3.40282e38px}.eloq\\:rounded-lg{border-radius:var(--eloq-radius-lg)}.eloq\\:rounded-md{border-radius:var(--eloq-radius-md)}.eloq\\:rounded-none{border-radius:0}.eloq\\:rounded-sm{border-radius:var(--eloq-radius-sm)}.eloq\\:rounded-xl{border-radius:var(--eloq-radius-xl)}.eloq\\:rounded-t-2xl{border-top-left-radius:var(--eloq-radius-2xl);border-top-right-radius:var(--eloq-radius-2xl)}.eloq\\:border{border-style:var(--tw-border-style);border-width:1px}.eloq\\:border-0{border-style:var(--tw-border-style);border-width:0}.eloq\\:border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.eloq\\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.eloq\\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.eloq\\:border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.eloq\\:border-amber-400{border-color:var(--eloq-color-amber-400)}.eloq\\:border-blue-500{border-color:var(--eloq-color-blue-500)}.eloq\\:border-border{border-color:hsl(var(--border))}.eloq\\:border-green-500{border-color:var(--eloq-color-green-500)}.eloq\\:border-input{border-color:hsl(var(--input))}.eloq\\:border-red-500{border-color:var(--eloq-color-red-500)}.eloq\\:border-t-transparent{border-top-color:#0000}.eloq\\:border-l-transparent{border-left-color:#0000}.eloq\\:bg-\\[\\#0a0a0a\\]{background-color:#0a0a0a}.eloq\\:bg-\\[\\#000\\]{background-color:#000}.eloq\\:bg-\\[\\#fff\\]{background-color:#fff}.eloq\\:bg-amber-50{background-color:var(--eloq-color-amber-50)}.eloq\\:bg-background{background-color:hsl(var(--background))}.eloq\\:bg-black\\/80{background-color:var(--eloq-color-black)}@supports (color:color-mix(in lab,red,red)){.eloq\\:bg-black\\/80{background-color:color-mix(in oklab,var(--eloq-color-black) 80%,transparent)}}.eloq\\:bg-blue-50{background-color:var(--eloq-color-blue-50)}.eloq\\:bg-border{background-color:hsl(var(--border))}.eloq\\:bg-card{background-color:hsl(var(--card))}.eloq\\:bg-cream{background-color:hsl(var(--cream))}.eloq\\:bg-gray-400{background-color:var(--eloq-color-gray-400)}.eloq\\:bg-green-50{background-color:var(--eloq-color-green-50)}.eloq\\:bg-muted{background-color:hsl(var(--muted))}.eloq\\:bg-muted-foreground{background-color:hsl(var(--muted-foreground))}.eloq\\:bg-red-50{background-color:var(--eloq-color-red-50)}.eloq\\:bg-transparent{background-color:#0000}.eloq\\:bg-white,.eloq\\:bg-white\\/20{background-color:var(--eloq-color-white)}@supports (color:color-mix(in lab,red,red)){.eloq\\:bg-white\\/20{background-color:color-mix(in oklab,var(--eloq-color-white) 20%,transparent)}}.eloq\\:bg-white\\/90{background-color:var(--eloq-color-white)}@supports (color:color-mix(in lab,red,red)){.eloq\\:bg-white\\/90{background-color:color-mix(in oklab,var(--eloq-color-white) 90%,transparent)}}.eloq\\:fill-none{fill:none}.eloq\\:fill-yellow-400{fill:var(--eloq-color-yellow-400)}.eloq\\:object-contain{object-fit:contain}.eloq\\:p-0{padding:0}.eloq\\:p-0\\.5{padding:calc(var(--eloq-spacing) * .5)}.eloq\\:p-1{padding:var(--eloq-spacing)}.eloq\\:p-1\\.5{padding:calc(var(--eloq-spacing) * 1.5)}.eloq\\:p-2{padding:calc(var(--eloq-spacing) * 2)}.eloq\\:p-3{padding:calc(var(--eloq-spacing) * 3)}.eloq\\:p-4{padding:calc(var(--eloq-spacing) * 4)}.eloq\\:p-6{padding:calc(var(--eloq-spacing) * 6)}.eloq\\:p-\\[1px\\]{padding:1px}.eloq\\:px-0{padding-inline:0}.eloq\\:px-3{padding-inline:calc(var(--eloq-spacing) * 3)}.eloq\\:px-4{padding-inline:calc(var(--eloq-spacing) * 4)}.eloq\\:px-5{padding-inline:calc(var(--eloq-spacing) * 5)}.eloq\\:px-\\[12px\\]{padding-inline:12px}.eloq\\:px-\\[16px\\]{padding-inline:16px}.eloq\\:py-1{padding-block:var(--eloq-spacing)}.eloq\\:py-1\\.5{padding-block:calc(var(--eloq-spacing) * 1.5)}.eloq\\:py-2{padding-block:calc(var(--eloq-spacing) * 2)}.eloq\\:py-3{padding-block:calc(var(--eloq-spacing) * 3)}.eloq\\:py-3\\.5{padding-block:calc(var(--eloq-spacing) * 3.5)}.eloq\\:py-\\[8px\\]{padding-block:8px}.eloq\\:py-\\[12px\\]{padding-block:12px}.eloq\\:pt-0{padding-top:0}.eloq\\:pt-2{padding-top:calc(var(--eloq-spacing) * 2)}.eloq\\:pt-4{padding-top:calc(var(--eloq-spacing) * 4)}.eloq\\:pt-5{padding-top:calc(var(--eloq-spacing) * 5)}.eloq\\:pt-6{padding-top:calc(var(--eloq-spacing) * 6)}.eloq\\:pt-10{padding-top:calc(var(--eloq-spacing) * 10)}.eloq\\:pt-24{padding-top:calc(var(--eloq-spacing) * 24)}.eloq\\:pr-2{padding-right:calc(var(--eloq-spacing) * 2)}.eloq\\:pr-4{padding-right:calc(var(--eloq-spacing) * 4)}.eloq\\:pr-12{padding-right:calc(var(--eloq-spacing) * 12)}.eloq\\:pb-2{padding-bottom:calc(var(--eloq-spacing) * 2)}.eloq\\:pb-4{padding-bottom:calc(var(--eloq-spacing) * 4)}.eloq\\:pb-10{padding-bottom:calc(var(--eloq-spacing) * 10)}.eloq\\:pb-14{padding-bottom:calc(var(--eloq-spacing) * 14)}.eloq\\:pl-3{padding-left:calc(var(--eloq-spacing) * 3)}.eloq\\:pl-4{padding-left:calc(var(--eloq-spacing) * 4)}.eloq\\:text-center{text-align:center}.eloq\\:text-left{text-align:left}.eloq\\:text-2xl{font-size:var(--eloq-text-2xl);line-height:var(--tw-leading,var(--eloq-text-2xl--line-height))}.eloq\\:text-base{font-size:var(--eloq-text-base);line-height:var(--tw-leading,var(--eloq-text-base--line-height))}.eloq\\:text-lg{font-size:var(--eloq-text-lg);line-height:var(--tw-leading,var(--eloq-text-lg--line-height))}.eloq\\:text-sm{font-size:var(--eloq-text-sm);line-height:var(--tw-leading,var(--eloq-text-sm--line-height))}.eloq\\:text-xs{font-size:var(--eloq-text-xs);line-height:var(--tw-leading,var(--eloq-text-xs--line-height))}.eloq\\:text-\\[10px\\]{font-size:10px}.eloq\\:leading-5{--tw-leading:calc(var(--eloq-spacing) * 5);line-height:calc(var(--eloq-spacing) * 5)}.eloq\\:leading-none{--tw-leading:1;line-height:1}.eloq\\:leading-relaxed{--tw-leading:var(--eloq-leading-relaxed);line-height:var(--eloq-leading-relaxed)}.eloq\\:font-medium{--tw-font-weight:var(--eloq-font-weight-medium);font-weight:var(--eloq-font-weight-medium)}.eloq\\:font-semibold{--tw-font-weight:var(--eloq-font-weight-semibold);font-weight:var(--eloq-font-weight-semibold)}.eloq\\:tracking-tight{--tw-tracking:var(--eloq-tracking-tight);letter-spacing:var(--eloq-tracking-tight)}.eloq\\:whitespace-nowrap{white-space:nowrap}.eloq\\:text-\\[\\#000\\]{color:#000}.eloq\\:text-\\[\\#fff\\]{color:#fff}.eloq\\:text-amber-500{color:var(--eloq-color-amber-500)}.eloq\\:text-amber-800{color:var(--eloq-color-amber-800)}.eloq\\:text-blue-500{color:var(--eloq-color-blue-500)}.eloq\\:text-blue-800{color:var(--eloq-color-blue-800)}.eloq\\:text-card-foreground{color:hsl(var(--card-foreground))}.eloq\\:text-destructive{color:hsl(var(--destructive))}.eloq\\:text-foreground{color:hsl(var(--foreground))}.eloq\\:text-gray-300{color:var(--eloq-color-gray-300)}.eloq\\:text-gray-400{color:var(--eloq-color-gray-400)}.eloq\\:text-gray-500{color:var(--eloq-color-gray-500)}.eloq\\:text-green-500{color:var(--eloq-color-green-500)}.eloq\\:text-green-800{color:var(--eloq-color-green-800)}.eloq\\:text-muted{color:hsl(var(--muted))}.eloq\\:text-muted-foreground{color:hsl(var(--muted-foreground))}.eloq\\:text-primary{color:hsl(var(--primary))}.eloq\\:text-primary-foreground{color:hsl(var(--primary-foreground))}.eloq\\:text-red-500{color:var(--eloq-color-red-500)}.eloq\\:text-red-800{color:var(--eloq-color-red-800)}.eloq\\:text-yellow-400{color:var(--eloq-color-yellow-400)}.eloq\\:italic{font-style:italic}.eloq\\:underline{text-decoration-line:underline}.eloq\\:opacity-0{opacity:0}.eloq\\:opacity-50{opacity:.5}.eloq\\:opacity-70{opacity:.7}.eloq\\:opacity-75{opacity:.75}.eloq\\:opacity-100{opacity:1}.eloq\\:shadow-\\[0_-8px_24px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\]{--tw-shadow:0 -8px 24px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:shadow-\\[0_0_4px_0_rgba\\(0\\,0\\,0\\,0\\.20\\)\\]{--tw-shadow:0 0 4px 0 var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:shadow-\\[0_3px_4px_-2px_rgba\\(0\\,0\\,0\\,0\\.04\\)\\]{--tw-shadow:0 3px 4px -2px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.eloq\\:drop-shadow-lg{--tw-drop-shadow-size:drop-shadow(0 4px 4px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--eloq-drop-shadow-lg));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.eloq\\:transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--eloq-default-transition-timing-function));transition-duration:var(--tw-duration,var(--eloq-default-transition-duration))}.eloq\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--eloq-default-transition-timing-function));transition-duration:var(--tw-duration,var(--eloq-default-transition-duration))}.eloq\\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--eloq-default-transition-timing-function));transition-duration:var(--tw-duration,var(--eloq-default-transition-duration))}.eloq\\:duration-200{--tw-duration:.2s;transition-duration:.2s}.eloq\\:duration-300{--tw-duration:.3s;transition-duration:.3s}.eloq\\:duration-500{--tw-duration:.5s;transition-duration:.5s}.eloq\\:ease-out{--tw-ease:var(--eloq-ease-out);transition-timing-function:var(--eloq-ease-out)}.eloq\\:select-none{-webkit-user-select:none;user-select:none}.eloq\\:placeholder\\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.eloq\\:last\\:mb-0:last-child{margin-bottom:0}@media(hover:hover){.eloq\\:hover\\:bg-black\\/5:hover{background-color:var(--eloq-color-black)}@supports (color:color-mix(in lab,red,red)){.eloq\\:hover\\:bg-black\\/5:hover{background-color:color-mix(in oklab,var(--eloq-color-black) 5%,transparent)}}.eloq\\:hover\\:bg-muted:hover{background-color:hsl(var(--muted))}.eloq\\:hover\\:text-gray-600:hover{color:var(--eloq-color-gray-600)}.eloq\\:hover\\:text-primary:hover{color:hsl(var(--primary))}.eloq\\:hover\\:opacity-80:hover{opacity:.8}.eloq\\:hover\\:opacity-90:hover{opacity:.9}.eloq\\:hover\\:opacity-100:hover{opacity:1}.eloq\\:hover\\:drop-shadow-xl:hover{--tw-drop-shadow-size:drop-shadow(0 9px 7px var(--tw-drop-shadow-color,#0000001a));--tw-drop-shadow:drop-shadow(var(--eloq-drop-shadow-xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.eloq\\:focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:focus\\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.eloq\\:focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.eloq\\:focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.eloq\\:focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.eloq\\:focus-visible\\:ring-muted:focus-visible{--tw-ring-color:hsl(var(--muted))}.eloq\\:focus-visible\\:ring-primary:focus-visible{--tw-ring-color:hsl(var(--primary))}.eloq\\:focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.eloq\\:focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.eloq\\:active\\:cursor-grabbing:active{cursor:grabbing}.eloq\\:disabled\\:pointer-events-none:disabled{pointer-events:none}.eloq\\:disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.eloq\\:disabled\\:opacity-50:disabled{opacity:.5}.eloq\\:data-\\[state\\=closed\\]\\:animate-dialog-content-out[data-state=closed]{animation:var(--eloq-animate-dialog-content-out)}.eloq\\:data-\\[state\\=closed\\]\\:animate-dialog-overlay-out[data-state=closed]{animation:var(--eloq-animate-dialog-overlay-out)}.eloq\\:data-\\[state\\=open\\]\\:animate-dialog-content-in[data-state=open]{animation:var(--eloq-animate-dialog-content-in)}.eloq\\:data-\\[state\\=open\\]\\:animate-dialog-overlay-in[data-state=open]{animation:var(--eloq-animate-dialog-overlay-in)}.eloq\\:data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.eloq\\:data-\\[state\\=open\\]\\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}@media(prefers-reduced-motion:reduce){.eloq\\:motion-reduce\\:animate-none{animation:none}.eloq\\:motion-reduce\\:opacity-70{opacity:.7}}@media(min-width:40rem){.eloq\\:sm\\:flex-row{flex-direction:row}.eloq\\:sm\\:justify-end{justify-content:flex-end}:where(.eloq\\:sm\\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--eloq-spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--eloq-spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.eloq\\:sm\\:rounded-lg{border-radius:var(--eloq-radius-lg)}.eloq\\:sm\\:text-left{text-align:left}.eloq\\:sm\\:text-sm{font-size:var(--eloq-text-sm);line-height:var(--tw-leading,var(--eloq-text-sm--line-height))}}@media(min-width:48rem){.eloq\\:md\\:text-sm{font-size:var(--eloq-text-sm);line-height:var(--tw-leading,var(--eloq-text-sm--line-height))}}.eloq\\:dark\\:border:is(.dark *){border-style:var(--tw-border-style);border-width:1px}.eloq\\:dark\\:border-b:is(.dark *){border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.eloq\\:dark\\:border-border:is(.dark *){border-color:hsl(var(--border))}.eloq\\:dark\\:bg-amber-400\\/10:is(.dark *){background-color:var(--eloq-color-amber-400)}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:bg-amber-400\\/10:is(.dark *){background-color:color-mix(in oklab,var(--eloq-color-amber-400) 10%,transparent)}}.eloq\\:dark\\:bg-blue-500\\/10:is(.dark *){background-color:var(--eloq-color-blue-500)}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:bg-blue-500\\/10:is(.dark *){background-color:color-mix(in oklab,var(--eloq-color-blue-500) 10%,transparent)}}.eloq\\:dark\\:bg-card:is(.dark *),.eloq\\:dark\\:bg-card\\/90:is(.dark *){background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:bg-card\\/90:is(.dark *){background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.eloq\\:dark\\:bg-gray-200:is(.dark *){background-color:var(--eloq-color-gray-200)}.eloq\\:dark\\:bg-green-500\\/10:is(.dark *){background-color:var(--eloq-color-green-500)}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:bg-green-500\\/10:is(.dark *){background-color:color-mix(in oklab,var(--eloq-color-green-500) 10%,transparent)}}.eloq\\:dark\\:bg-muted:is(.dark *){background-color:hsl(var(--muted))}.eloq\\:dark\\:bg-red-500\\/10:is(.dark *){background-color:var(--eloq-color-red-500)}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:bg-red-500\\/10:is(.dark *){background-color:color-mix(in oklab,var(--eloq-color-red-500) 10%,transparent)}}.eloq\\:dark\\:text-amber-200:is(.dark *){color:var(--eloq-color-amber-200)}.eloq\\:dark\\:text-amber-400:is(.dark *){color:var(--eloq-color-amber-400)}.eloq\\:dark\\:text-blue-200:is(.dark *){color:var(--eloq-color-blue-200)}.eloq\\:dark\\:text-blue-400:is(.dark *){color:var(--eloq-color-blue-400)}.eloq\\:dark\\:text-foreground:is(.dark *){color:hsl(var(--foreground))}.eloq\\:dark\\:text-gray-500:is(.dark *){color:var(--eloq-color-gray-500)}.eloq\\:dark\\:text-green-200:is(.dark *){color:var(--eloq-color-green-200)}.eloq\\:dark\\:text-green-400:is(.dark *){color:var(--eloq-color-green-400)}.eloq\\:dark\\:text-muted-foreground:is(.dark *),.eloq\\:dark\\:text-muted-foreground\\/50:is(.dark *){color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:text-muted-foreground\\/50:is(.dark *){color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.eloq\\:dark\\:text-red-200:is(.dark *){color:var(--eloq-color-red-200)}.eloq\\:dark\\:text-red-400:is(.dark *){color:var(--eloq-color-red-400)}.eloq\\:dark\\:shadow-none:is(.dark *){--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media(hover:hover){.eloq\\:dark\\:hover\\:bg-white\\/10:is(.dark *):hover{background-color:var(--eloq-color-white)}@supports (color:color-mix(in lab,red,red)){.eloq\\:dark\\:hover\\:bg-white\\/10:is(.dark *):hover{background-color:color-mix(in oklab,var(--eloq-color-white) 10%,transparent)}}.eloq\\:dark\\:hover\\:text-gray-300:is(.dark *):hover{color:var(--eloq-color-gray-300)}.eloq\\:dark\\:hover\\:text-primary:is(.dark *):hover{color:hsl(var(--primary))}}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}}body{background-color:#0000}.eloquent-chat{font-family:system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}.collapse{visibility:unset!important}.eloq-wrap-anywhere{overflow-wrap:anywhere}.eloq-thin-scrollbar{scrollbar-width:thin;scrollbar-color:hsl(var(--border)) transparent}.eloq-thin-scrollbar::-webkit-scrollbar{width:8px;height:8px}.eloq-thin-scrollbar::-webkit-scrollbar-thumb{background-color:hsl(var(--border));border-radius:9999px}.eloq-thin-scrollbar::-webkit-scrollbar-track{background-color:#0000}.eloq-test-mode-stripe{background:repeating-linear-gradient(-45deg,#f6e05e,#f6e05e 10px,#000 10px 20px)}.eloq-thinking-shimmer{--eloq-thinking-base:#9ca3af;--eloq-thinking-highlight:#4b5563;background:linear-gradient(90deg,var(--eloq-thinking-base) 0%,var(--eloq-thinking-base) 35%,var(--eloq-thinking-highlight) 50%,var(--eloq-thinking-base) 65%,var(--eloq-thinking-base) 100%);color:#0000;background-size:200% 100%;-webkit-background-clip:text;background-clip:text}.dark .eloq-thinking-shimmer{--eloq-thinking-base:#6b7280;--eloq-thinking-highlight:#e5e7eb}@media(prefers-reduced-motion:reduce){.eloq-thinking-shimmer{color:var(--eloq-thinking-base);background:0 0}}@property --eloq-aura-angle{syntax:"<angle>";inherits:false;initial-value:0deg}.eloq-aura{--eloq-aura-strong:#9e9e9e;--eloq-aura-soft:#d1d1d1;background:conic-gradient(from var(--eloq-aura-angle),var(--eloq-aura-strong),var(--eloq-aura-soft),var(--eloq-aura-strong));border-radius:9999px;padding:2px;animation:2.6s linear infinite eloq-aura-spin;position:relative}@keyframes eloq-aura-spin{to{--eloq-aura-angle:360deg}}.eloq-aura-shine{border-radius:inherit;pointer-events:none;position:absolute;inset:0;overflow:hidden}.eloq-aura-shine:after{content:"";background:linear-gradient(90deg,#0000,#fffc,#0000);width:18%;position:absolute;top:-20%;bottom:-20%;left:0;transform:translate(-200%)skew(-20deg)}.eloq-aura-shine--active:after{animation:1.1s ease-in-out both eloq-aura-shine-sweep}@keyframes eloq-aura-shine-sweep{0%{transform:translate(-200%)skew(-20deg)}to{transform:translate(700%)skew(-20deg)}}@media(prefers-reduced-motion:reduce){.eloq-aura{animation:none}.eloq-aura-shine:after,.eloq-aura-shine--active:after{opacity:0;animation:none}}@keyframes panel-in{0%{opacity:0;transform:scale(.05)}to{opacity:1;transform:scale(1)}}@keyframes thinking-dot{0%,60%,to{opacity:.45;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}@keyframes thinking-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@keyframes panel-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.05)}}@keyframes message-in{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}@keyframes slide-up-in{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes dialog-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes dialog-overlay-out{0%{opacity:1}to{opacity:0}}@keyframes dialog-content-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes dialog-content-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}', zt = ".eloquentai-chat-launcher{transition:transform .2s ease-in-out}.eloquentai-chat-launcher:hover{transform:scale(1.1)}";
37
+ function Rt({
38
+ toggleBubble: e,
39
+ isDarkMode: t = !1
40
+ }) {
41
+ const o = t ? "#fff" : "#000", r = t ? "#000000" : "#ffffff";
42
+ return /* @__PURE__ */ m("div", { className: "eloq:absolute eloq:inset-0 eloq:m-auto eloq:flex eloq:items-center eloq:justify-center eloq:overflow-hidden", children: /* @__PURE__ */ m(
43
+ "div",
44
+ {
45
+ className: He(
46
+ "eloq:chat-bubble eloq:relative eloq:flex eloq:items-center eloq:justify-center eloq:w-12 eloq:h-12 eloq:rounded-full eloq:cursor-pointer",
47
+ // Inverted in dark mode: a black launcher disappears on dark pages.
48
+ t ? "eloq:bg-[#fff] eloq:text-[#000]" : "eloq:bg-[#000] eloq:text-[#fff]"
49
+ ),
50
+ onClick: e,
51
+ children: /* @__PURE__ */ m("div", { className: "eloq:absolute eloq:inset-0 eloq:flex eloq:justify-center eloq:items-center eloq:m-auto", children: /* @__PURE__ */ m(mt, { bgColor: o, fgColor: r }) })
52
+ }
53
+ ) });
54
+ }
55
+ function je({ children: e, head: t, ...o }) {
56
+ const [r, a] = q(null), l = r?.contentWindow?.document?.head, n = r?.contentWindow?.document?.body;
57
+ return /* @__PURE__ */ _e("iframe", { ...o, ref: a, children: [
58
+ l && Ze(t, l),
59
+ n && Ze(e, n)
60
+ ] });
61
+ }
62
+ function Tt({ children: e, container: t }) {
63
+ return Ze(e, t);
64
+ }
65
+ function Mt({
66
+ message: e,
67
+ isVisible: t,
68
+ onDismiss: o,
69
+ onMessageClick: r,
70
+ autoHideDelay: a
71
+ }) {
72
+ const [l, n] = q(!1), [s, c] = q("entering"), i = wt();
73
+ return Z(() => {
74
+ if (t) {
75
+ n(!0), c("entering");
76
+ const d = setTimeout(() => {
77
+ c("visible");
78
+ }, 50), h = setTimeout(() => {
79
+ c("exiting"), setTimeout(() => {
80
+ o();
81
+ }, 300);
82
+ }, a);
83
+ return () => {
84
+ clearTimeout(d), clearTimeout(h);
85
+ };
86
+ } else {
87
+ c("exiting");
88
+ const d = setTimeout(() => {
89
+ n(!1), c("entering");
90
+ }, 300);
91
+ return () => clearTimeout(d);
92
+ }
93
+ }, [t, o, a]), l ? /* @__PURE__ */ m(
94
+ "div",
95
+ {
96
+ className: He(
97
+ // right-16 leaves a ~7px gap between the tail tip and the launcher
98
+ // circle's edge — the tail points at it without sliding underneath.
99
+ "eloq:absolute eloq:right-16 eloq:bottom-0 eloq:max-w-xs eloq:transform eloq:transition-all eloq:duration-500 eloq:ease-out",
100
+ s === "entering" && "eloq:translate-x-8 eloq:opacity-0 eloq:scale-95",
101
+ s === "visible" && "eloq:translate-x-0 eloq:opacity-100 eloq:scale-100",
102
+ s === "exiting" && "eloq:translate-x-8 eloq:opacity-0 eloq:scale-95"
103
+ ),
104
+ children: /* @__PURE__ */ m("div", { className: "eloq:relative eloq:drop-shadow-lg eloq:hover:drop-shadow-xl eloq:transition-all eloq:duration-300", children: /* @__PURE__ */ _e(
105
+ "div",
106
+ {
107
+ className: "eloq:relative eloq:rounded-lg eloq:border eloq:p-3 eloq:cursor-pointer",
108
+ style: {
109
+ backgroundColor: i.botBubbleColor
110
+ },
111
+ onClick: r,
112
+ children: [
113
+ /* @__PURE__ */ _e(
114
+ "svg",
115
+ {
116
+ "aria-hidden": !0,
117
+ className: "eloq:absolute eloq:bottom-1 eloq:-right-[9px] eloq:h-4 eloq:w-4 eloq:-scale-x-100",
118
+ viewBox: "0 0 10.54 11.14",
119
+ children: [
120
+ /* @__PURE__ */ m(
121
+ "path",
122
+ {
123
+ d: "M5.75,0s0,.36,0,.51c-.09,4.52-5.74,10.64-5.74,10.64,8.19.02,10.54-2.26,10.54-2.26h0c-1.6-2.96-3.19-5.92-4.79-8.88Z",
124
+ fill: i.botBubbleColor,
125
+ strokeWidth: 2,
126
+ vectorEffect: "non-scaling-stroke",
127
+ style: { stroke: "hsl(var(--border))" }
128
+ }
129
+ ),
130
+ /* @__PURE__ */ m(
131
+ "rect",
132
+ {
133
+ x: "6.2",
134
+ y: "-1",
135
+ width: "6",
136
+ height: "14",
137
+ fill: i.botBubbleColor
138
+ }
139
+ )
140
+ ]
141
+ }
142
+ ),
143
+ /* @__PURE__ */ m(
144
+ "p",
145
+ {
146
+ className: "eloq:text-sm eloq:leading-relaxed eloq:pr-4",
147
+ style: {
148
+ color: i.botBubbleTextColor || Fe(i.botBubbleColor)
149
+ },
150
+ children: e
151
+ }
152
+ ),
153
+ /* @__PURE__ */ m(
154
+ "button",
155
+ {
156
+ "aria-label": "Dismiss message",
157
+ onClick: (d) => {
158
+ d.stopPropagation(), o();
159
+ },
160
+ className: "eloq:absolute eloq:top-0.5 eloq:right-0.5 eloq:p-1.5 eloq:opacity-50 eloq:hover:opacity-100 eloq:hover:bg-black/5 eloq:dark:hover:bg-white/10 eloq:rounded-full eloq:transition-all eloq:duration-200",
161
+ style: {
162
+ // Follows the bubble's computed text colour, so the X blends
163
+ // with the message on any bubble background (and dark mode).
164
+ color: i.botBubbleTextColor || Fe(i.botBubbleColor)
165
+ },
166
+ children: /* @__PURE__ */ m(vt, { className: "eloq:w-2.5 eloq:h-2.5", strokeWidth: 1.75 })
167
+ }
168
+ )
169
+ ]
170
+ }
171
+ ) })
172
+ }
173
+ ) : null;
174
+ }
175
+ function Xe(e) {
176
+ if (typeof document > "u") return null;
177
+ const t = document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));
178
+ return t ? decodeURIComponent(t[1]) : null;
179
+ }
180
+ function At(e, t, o) {
181
+ if (typeof document > "u") return;
182
+ const r = new Date(Date.now() + o * 60 * 60 * 1e3).toUTCString();
183
+ document.cookie = `${e}=${encodeURIComponent(t)}; expires=${r}; path=/; SameSite=Lax`;
184
+ }
185
+ function Pt(e) {
186
+ typeof document > "u" || (document.cookie = `${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`);
187
+ }
188
+ function Ot({
189
+ chatProps: e,
190
+ chatSettings: t
191
+ }) {
192
+ return Le(() => t ? {
193
+ assistantName: t.agent_name,
194
+ assistantLogo: t.avatar_url || void 0,
195
+ theme: {
196
+ ...e?.theme,
197
+ mode: t.theme ?? "light",
198
+ userBubbleColor: t.user_bubble_color || e?.theme?.userBubbleColor,
199
+ botBubbleColor: t.bot_bubble_color || e?.theme?.botBubbleColor,
200
+ suggestedMessageBubbleColor: t.suggested_message_bubble_color || e?.theme?.suggestedMessageBubbleColor,
201
+ userBubbleTextColor: t.user_bubble_text_color || e?.theme?.userBubbleTextColor,
202
+ botBubbleTextColor: t.bot_bubble_text_color || e?.theme?.botBubbleTextColor,
203
+ suggestedMessageBubbleTextColor: t.suggested_message_bubble_text_color || e?.theme?.suggestedMessageBubbleTextColor
204
+ },
205
+ welcomeMessage: t.welcome_message || void 0,
206
+ legalText: t.footer_html || void 0,
207
+ suggestedMessages: t.suggested_messages,
208
+ suggestedMessageTexts: t.suggested_message_texts ?? void 0,
209
+ // Boot value wins when the server sends one (?? so an explicit false
210
+ // still wins); the host-app prop is the fallback.
211
+ hasSuggestedMessageAura: t.suggested_message_aura ?? e?.hasSuggestedMessageAura,
212
+ hasSuggestedMessageShine: t.suggested_message_shine ?? e?.hasSuggestedMessageShine,
213
+ displayWelcomeMessages: t.auto_display_welcome_message,
214
+ collectUserFeedback: t.collect_user_feedback,
215
+ title: t.title || "responds instantly",
216
+ subtitle: t.subtitle || "Ask me anything"
217
+ } : e, [e, t]);
218
+ }
219
+ function W(e) {
220
+ const t = L(e);
221
+ return Z(() => {
222
+ t.current = e;
223
+ }), t;
224
+ }
225
+ class Pe extends Error {
226
+ constructor(t) {
227
+ super(t), this.name = "NetworkError";
228
+ }
229
+ }
230
+ class de extends Error {
231
+ status;
232
+ response;
233
+ constructor(t, o, r) {
234
+ super(o), this.name = "ServerError", this.status = t, this.response = r;
235
+ }
236
+ }
237
+ const Ut = "x-elo-chat-token", Dt = "x-elo-chat-token-renewed";
238
+ class $t {
239
+ baseURL;
240
+ headers;
241
+ region = null;
242
+ chatToken = null;
243
+ constructor(t) {
244
+ this.baseURL = t.baseURL, this.headers = {
245
+ "Content-Type": "application/json",
246
+ "ELO-APP-ID": t.appId,
247
+ Origin: typeof window < "u" ? window.location.origin : ""
248
+ };
249
+ }
250
+ setRegion(t) {
251
+ this.region = t;
252
+ }
253
+ setChatToken(t) {
254
+ this.chatToken = t;
255
+ }
256
+ getChatToken() {
257
+ return this.chatToken;
258
+ }
259
+ async request(t, o = {}) {
260
+ const r = this.region ? { "X-Region": this.region } : {}, a = this.chatToken ? { [Ut]: this.chatToken } : {};
261
+ let l;
262
+ try {
263
+ l = await fetch(`${this.baseURL}${t}`, {
264
+ ...o,
265
+ headers: {
266
+ ...this.headers,
267
+ ...r,
268
+ ...a,
269
+ ...o.headers
270
+ }
271
+ });
272
+ } catch (c) {
273
+ throw c instanceof TypeError ? new Pe(c.message) : c;
274
+ }
275
+ const n = l.headers.get(Dt);
276
+ n && (this.chatToken = n);
277
+ let s;
278
+ try {
279
+ s = await l.json();
280
+ } catch (c) {
281
+ console.error("Error parsing JSON response:", c);
282
+ }
283
+ if (!l.ok)
284
+ throw l.status >= 500 ? new de(l.status, "API error", s) : new de(l.status, "HTTP error", s);
285
+ return s;
286
+ }
287
+ async get(t) {
288
+ return this.request(t, { method: "GET" });
289
+ }
290
+ async post(t, o) {
291
+ return this.request(t, {
292
+ method: "POST",
293
+ body: JSON.stringify(o)
294
+ });
295
+ }
296
+ async put(t, o) {
297
+ return this.request(t, {
298
+ method: "PUT",
299
+ body: JSON.stringify(o)
300
+ });
301
+ }
302
+ /**
303
+ * External GET request without default headers or credentials
304
+ * Used for cross-origin requests that don't need authentication
305
+ */
306
+ async getExternal(t) {
307
+ const o = await fetch(t, {
308
+ method: "GET",
309
+ credentials: "omit"
310
+ });
311
+ let r;
312
+ try {
313
+ r = await o.json();
314
+ } catch (a) {
315
+ console.error("Error parsing JSON response:", a);
316
+ }
317
+ if (!o.ok)
318
+ throw o.status >= 500 ? new de(o.status, "API error", r) : new de(o.status, "HTTP error", r);
319
+ return r;
320
+ }
321
+ }
322
+ function Nt() {
323
+ if (typeof window > "u")
324
+ return {};
325
+ const e = new URLSearchParams(window.location.search), t = {};
326
+ return e.forEach((o, r) => {
327
+ t[r] = o;
328
+ }), t;
329
+ }
330
+ const jt = "eloquent-ai::conversation-data", ye = typeof window < "u", Bt = 1800 * 1e3;
331
+ function Ke({ appId: e }) {
332
+ const t = Le(() => `${jt}-${e}`, [e]), o = Le(
333
+ () => ({
334
+ conversationId: null,
335
+ userId: null,
336
+ deviceId: null,
337
+ messages: []
338
+ }),
339
+ []
340
+ ), r = v(() => {
341
+ try {
342
+ if (!ye) return o;
343
+ const i = localStorage.getItem(t);
344
+ return i ? JSON.parse(i) : o;
345
+ } catch (i) {
346
+ return console.error(
347
+ "Error retrieving conversation data from localStorage:",
348
+ i
349
+ ), o;
350
+ }
351
+ }, [t, o]), a = v(() => {
352
+ try {
353
+ const i = r();
354
+ return i.lastActivity ? Date.now() - i.lastActivity > Bt : !0;
355
+ } catch (i) {
356
+ return console.error("Error checking conversation expiration:", i), !0;
357
+ }
358
+ }, [r]), l = v(
359
+ (i, d, h, u, p) => {
360
+ try {
361
+ if (!ye) return;
362
+ const g = {
363
+ conversationId: i,
364
+ userId: d,
365
+ deviceId: u,
366
+ messages: h,
367
+ lastActivity: Date.now(),
368
+ chatToken: p
369
+ };
370
+ localStorage.setItem(t, JSON.stringify(g));
371
+ } catch (g) {
372
+ console.error("Error saving conversation data to localStorage:", g);
373
+ }
374
+ },
375
+ [t]
376
+ ), n = v(() => {
377
+ try {
378
+ if (!ye) return;
379
+ const i = r();
380
+ localStorage.setItem(
381
+ t,
382
+ JSON.stringify({ ...i, isChatClosed: !0 })
383
+ );
384
+ } catch (i) {
385
+ console.error(
386
+ "Error marking conversation as closed in localStorage:",
387
+ i
388
+ );
389
+ }
390
+ }, [t, r]), s = v(() => {
391
+ try {
392
+ if (!ye) return;
393
+ const i = localStorage.getItem(t);
394
+ if (i) {
395
+ const d = JSON.parse(i);
396
+ localStorage.setItem(
397
+ t,
398
+ JSON.stringify({
399
+ ...o,
400
+ deviceId: d.deviceId,
401
+ userId: d.userId
402
+ })
403
+ );
404
+ }
405
+ } catch (i) {
406
+ console.error(
407
+ "Error clearing conversation data from localStorage:",
408
+ i
409
+ );
410
+ }
411
+ }, [t, o]), c = v(() => {
412
+ try {
413
+ if (!ye) return;
414
+ const i = r();
415
+ i.conversationId && (i.lastActivity = Date.now(), localStorage.setItem(t, JSON.stringify(i)));
416
+ } catch (i) {
417
+ console.error("Error updating last activity timestamp:", i);
418
+ }
419
+ }, [r, t]);
420
+ return {
421
+ isChatExpired: a,
422
+ saveChatData: l,
423
+ clearChatData: s,
424
+ getSavedChatData: r,
425
+ updateLastActivity: c,
426
+ markChatClosed: n
427
+ };
428
+ }
429
+ const Lt = "aws-appsync-event-ws", Zt = 15e3, Ht = 3e5, Kt = 5e3, Vt = 1;
430
+ function Wt(e) {
431
+ const t = new URL(e);
432
+ return /\.appsync-api\.[\w-]+\.amazonaws\.com(\.cn)?$/.test(t.hostname) && (t.hostname = t.hostname.replace(
433
+ ".appsync-api.",
434
+ ".appsync-realtime-api."
435
+ )), t.protocol = "wss:", t.pathname = `${t.pathname.replace(/\/$/, "")}/realtime`, t.toString();
436
+ }
437
+ function Jt(e, t) {
438
+ const o = new URL(e).host;
439
+ return "authorizationToken" in t ? { Authorization: t.authorizationToken, host: o } : { "x-api-key": t.apiKey, host: o };
440
+ }
441
+ function Ft(e) {
442
+ return `header-${btoa(JSON.stringify(e)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")}`;
443
+ }
444
+ function Be(e) {
445
+ return !e || e.length === 0 ? "unknown error" : e.map((t) => `${t.errorType ?? "Error"}: ${t.message ?? ""}`).join("; ");
446
+ }
447
+ function Gt(e) {
448
+ const {
449
+ httpEndpoint: t,
450
+ auth: o,
451
+ channel: r,
452
+ onEvent: a,
453
+ onDisconnect: l,
454
+ createWebSocket: n = (d, h) => new WebSocket(d, h)
455
+ } = e, s = Jt(t, o), c = Wt(t), i = crypto.randomUUID();
456
+ return new Promise((d, h) => {
457
+ let u;
458
+ try {
459
+ u = n(c, [
460
+ Lt,
461
+ Ft(s)
462
+ ]);
463
+ } catch (f) {
464
+ h(f instanceof Error ? f : new Error(String(f)));
465
+ return;
466
+ }
467
+ let p = "connecting", g = !1, x = Ht, R = Date.now(), y = null, U = null;
468
+ const A = () => {
469
+ y && (clearTimeout(y), y = null), U && (clearInterval(U), U = null);
470
+ }, _ = (f) => {
471
+ if (p === "closed") return;
472
+ const w = p === "established";
473
+ p = "closed", A();
474
+ try {
475
+ u.close();
476
+ } catch {
477
+ }
478
+ g || (w ? l(f) : h(new Error(f)));
479
+ }, S = (f) => {
480
+ u.readyState === Vt && u.send(JSON.stringify(f));
481
+ }, C = (f) => {
482
+ y && clearTimeout(y), y = setTimeout(() => {
483
+ _(`Timed out waiting for ${f}`);
484
+ }, Zt);
485
+ };
486
+ u.addEventListener("open", () => {
487
+ p !== "closed" && (S({ type: "connection_init" }), C("connection_ack"));
488
+ }), u.addEventListener("message", (f) => {
489
+ if (p === "closed") return;
490
+ let w;
491
+ try {
492
+ w = JSON.parse(String(f.data));
493
+ } catch {
494
+ console.warn("[EloquentChatSDK] Unparseable realtime frame ignored");
495
+ return;
496
+ }
497
+ switch (w.type) {
498
+ case "connection_ack": {
499
+ if (p !== "connecting") return;
500
+ p = "subscribing", typeof w.connectionTimeoutMs == "number" && (x = w.connectionTimeoutMs), S({
501
+ type: "subscribe",
502
+ id: i,
503
+ channel: r,
504
+ authorization: s
505
+ }), C("subscribe_success");
506
+ return;
507
+ }
508
+ case "connection_error": {
509
+ _(`Connection error: ${Be(w.errors)}`);
510
+ return;
511
+ }
512
+ case "subscribe_success": {
513
+ if (p !== "subscribing" || w.id !== i) return;
514
+ p = "established", y && (clearTimeout(y), y = null), R = Date.now(), U = setInterval(() => {
515
+ Date.now() - R > x && _("Keep-alive timeout");
516
+ }, Kt), d({
517
+ close: () => {
518
+ g = !0, S({ type: "unsubscribe", id: i }), _("Closed by client");
519
+ }
520
+ });
521
+ return;
522
+ }
523
+ case "subscribe_error": {
524
+ if (w.id !== i) return;
525
+ _(`Subscribe error: ${Be(w.errors)}`);
526
+ return;
527
+ }
528
+ case "ka": {
529
+ R = Date.now();
530
+ return;
531
+ }
532
+ case "data": {
533
+ if (w.id !== i) return;
534
+ R = Date.now();
535
+ let I = w.event;
536
+ if (typeof I == "string")
537
+ try {
538
+ I = JSON.parse(I);
539
+ } catch {
540
+ console.warn(
541
+ "[EloquentChatSDK] Unparseable realtime event ignored"
542
+ );
543
+ return;
544
+ }
545
+ a(I);
546
+ return;
547
+ }
548
+ case "broadcast_error": {
549
+ console.warn(
550
+ "[EloquentChatSDK] Realtime broadcast error:",
551
+ Be(w.errors)
552
+ );
553
+ return;
554
+ }
555
+ default:
556
+ return;
557
+ }
558
+ }), u.addEventListener("close", () => {
559
+ _("WebSocket closed");
560
+ }), u.addEventListener("error", () => {
561
+ _("WebSocket error");
562
+ });
563
+ });
564
+ }
565
+ var Ye;
566
+ function K(e, t, o) {
567
+ function r(s, c) {
568
+ if (s._zod || Object.defineProperty(s, "_zod", {
569
+ value: {
570
+ def: c,
571
+ constr: n,
572
+ traits: /* @__PURE__ */ new Set()
573
+ },
574
+ enumerable: !1
575
+ }), s._zod.traits.has(e))
576
+ return;
577
+ s._zod.traits.add(e), t(s, c);
578
+ const i = n.prototype, d = Object.keys(i);
579
+ for (let h = 0; h < d.length; h++) {
580
+ const u = d[h];
581
+ u in s || (s[u] = i[u].bind(s));
582
+ }
583
+ }
584
+ const a = o?.Parent ?? Object;
585
+ class l extends a {
586
+ }
587
+ Object.defineProperty(l, "name", { value: e });
588
+ function n(s) {
589
+ var c;
590
+ const i = o?.Parent ? new l() : this;
591
+ r(i, s), (c = i._zod).deferred ?? (c.deferred = []);
592
+ for (const d of i._zod.deferred)
593
+ d();
594
+ return i;
595
+ }
596
+ return Object.defineProperty(n, "init", { value: r }), Object.defineProperty(n, Symbol.hasInstance, {
597
+ value: (s) => o?.Parent && s instanceof o.Parent ? !0 : s?._zod?.traits?.has(e)
598
+ }), Object.defineProperty(n, "name", { value: e }), n;
599
+ }
600
+ class ke extends Error {
601
+ constructor() {
602
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
603
+ }
604
+ }
605
+ (Ye = globalThis).__zod_globalConfig ?? (Ye.__zod_globalConfig = {});
606
+ const Qe = globalThis.__zod_globalConfig;
607
+ function fe(e) {
608
+ return e && Object.assign(Qe, e), Qe;
609
+ }
610
+ function Xt(e, t) {
611
+ return typeof t == "bigint" ? t.toString() : t;
612
+ }
613
+ function Yt(e) {
614
+ return {
615
+ get value() {
616
+ {
617
+ const t = e();
618
+ return Object.defineProperty(this, "value", { value: t }), t;
619
+ }
620
+ }
621
+ };
622
+ }
623
+ function it(e) {
624
+ const t = e.startsWith("^") ? 1 : 0, o = e.endsWith("$") ? e.length - 1 : e.length;
625
+ return e.slice(t, o);
626
+ }
627
+ const et = /* @__PURE__ */ Symbol("evaluating");
628
+ function oe(e, t, o) {
629
+ let r;
630
+ Object.defineProperty(e, t, {
631
+ get() {
632
+ if (r !== et)
633
+ return r === void 0 && (r = et, r = o()), r;
634
+ },
635
+ set(a) {
636
+ Object.defineProperty(e, t, {
637
+ value: a
638
+ // configurable: true,
639
+ });
640
+ },
641
+ configurable: !0
642
+ });
643
+ }
644
+ const st = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
645
+ };
646
+ function Qt(e) {
647
+ return typeof e == "object" && e !== null && !Array.isArray(e);
648
+ }
649
+ function tt(e) {
650
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
651
+ }
652
+ function eo(e, t, o) {
653
+ const r = new e._zod.constr(t ?? e._zod.def);
654
+ return (!t || o?.parent) && (r._zod.parent = e), r;
655
+ }
656
+ function Ce(e) {
657
+ return {};
658
+ }
659
+ function to(e) {
660
+ return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
661
+ }
662
+ function xe(e, t = 0) {
663
+ if (e.aborted === !0)
664
+ return !0;
665
+ for (let o = t; o < e.issues.length; o++)
666
+ if (e.issues[o]?.continue !== !0)
667
+ return !0;
668
+ return !1;
669
+ }
670
+ function oo(e, t = 0) {
671
+ if (e.aborted === !0)
672
+ return !0;
673
+ for (let o = t; o < e.issues.length; o++)
674
+ if (e.issues[o]?.continue === !1)
675
+ return !0;
676
+ return !1;
677
+ }
678
+ function ro(e, t) {
679
+ return t.map((o) => {
680
+ var r;
681
+ return (r = o).path ?? (r.path = []), o.path.unshift(e), o;
682
+ });
683
+ }
684
+ function ze(e) {
685
+ return typeof e == "string" ? e : e?.message;
686
+ }
687
+ function Se(e, t, o) {
688
+ const r = e.message ? e.message : ze(e.inst?._zod.def?.error?.(e)) ?? ze(t?.error?.(e)) ?? ze(o.customError?.(e)) ?? ze(o.localeError?.(e)) ?? "Invalid input", { inst: a, continue: l, input: n, ...s } = e;
689
+ return s.path ?? (s.path = []), s.message = r, t?.reportInput && (s.input = n), s;
690
+ }
691
+ const lt = (e, t) => {
692
+ e.name = "$ZodError", Object.defineProperty(e, "_zod", {
693
+ value: e._zod,
694
+ enumerable: !1
695
+ }), Object.defineProperty(e, "issues", {
696
+ value: t,
697
+ enumerable: !1
698
+ }), e.message = JSON.stringify(t, Xt, 2), Object.defineProperty(e, "toString", {
699
+ value: () => e.message,
700
+ enumerable: !1
701
+ });
702
+ }, no = K("$ZodError", lt), Oe = K("$ZodError", lt, { Parent: Error }), ao = (e) => (t, o, r, a) => {
703
+ const l = r ? { ...r, async: !1 } : { async: !1 }, n = t._zod.run({ value: o, issues: [] }, l);
704
+ if (n instanceof Promise)
705
+ throw new ke();
706
+ if (n.issues.length) {
707
+ const s = new (a?.Err ?? e)(n.issues.map((c) => Se(c, l, fe())));
708
+ throw st(s, a?.callee), s;
709
+ }
710
+ return n.value;
711
+ }, io = /* @__PURE__ */ ao(Oe), so = (e) => async (t, o, r, a) => {
712
+ const l = r ? { ...r, async: !0 } : { async: !0 };
713
+ let n = t._zod.run({ value: o, issues: [] }, l);
714
+ if (n instanceof Promise && (n = await n), n.issues.length) {
715
+ const s = new (a?.Err ?? e)(n.issues.map((c) => Se(c, l, fe())));
716
+ throw st(s, a?.callee), s;
717
+ }
718
+ return n.value;
719
+ }, lo = /* @__PURE__ */ so(Oe), co = (e) => (t, o, r) => {
720
+ const a = r ? { ...r, async: !1 } : { async: !1 }, l = t._zod.run({ value: o, issues: [] }, a);
721
+ if (l instanceof Promise)
722
+ throw new ke();
723
+ return l.issues.length ? {
724
+ success: !1,
725
+ error: new (e ?? no)(l.issues.map((n) => Se(n, a, fe())))
726
+ } : { success: !0, data: l.value };
727
+ }, ct = /* @__PURE__ */ co(Oe), uo = (e) => async (t, o, r) => {
728
+ const a = r ? { ...r, async: !0 } : { async: !0 };
729
+ let l = t._zod.run({ value: o, issues: [] }, a);
730
+ return l instanceof Promise && (l = await l), l.issues.length ? {
731
+ success: !1,
732
+ error: new e(l.issues.map((n) => Se(n, a, fe())))
733
+ } : { success: !0, data: l.value };
734
+ }, dt = /* @__PURE__ */ uo(Oe), po = (e) => {
735
+ const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
736
+ return new RegExp(`^${t}$`);
737
+ }, ho = /^null$/i, go = {
738
+ major: 4,
739
+ minor: 4,
740
+ patch: 3
741
+ }, he = /* @__PURE__ */ K("$ZodType", (e, t) => {
742
+ var o;
743
+ e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = go;
744
+ const r = [...e._zod.def.checks ?? []];
745
+ e._zod.traits.has("$ZodCheck") && r.unshift(e);
746
+ for (const a of r)
747
+ for (const l of a._zod.onattach)
748
+ l(e);
749
+ if (r.length === 0)
750
+ (o = e._zod).deferred ?? (o.deferred = []), e._zod.deferred?.push(() => {
751
+ e._zod.run = e._zod.parse;
752
+ });
753
+ else {
754
+ const a = (n, s, c) => {
755
+ let i = xe(n), d;
756
+ for (const h of s) {
757
+ if (h._zod.def.when) {
758
+ if (oo(n) || !h._zod.def.when(n))
759
+ continue;
760
+ } else if (i)
761
+ continue;
762
+ const u = n.issues.length, p = h._zod.check(n);
763
+ if (p instanceof Promise && c?.async === !1)
764
+ throw new ke();
765
+ if (d || p instanceof Promise)
766
+ d = (d ?? Promise.resolve()).then(async () => {
767
+ await p, n.issues.length !== u && (i || (i = xe(n, u)));
768
+ });
769
+ else {
770
+ if (n.issues.length === u)
771
+ continue;
772
+ i || (i = xe(n, u));
773
+ }
774
+ }
775
+ return d ? d.then(() => n) : n;
776
+ }, l = (n, s, c) => {
777
+ if (xe(n))
778
+ return n.aborted = !0, n;
779
+ const i = a(s, r, c);
780
+ if (i instanceof Promise) {
781
+ if (c.async === !1)
782
+ throw new ke();
783
+ return i.then((d) => e._zod.parse(d, c));
784
+ }
785
+ return e._zod.parse(i, c);
786
+ };
787
+ e._zod.run = (n, s) => {
788
+ if (s.skipChecks)
789
+ return e._zod.parse(n, s);
790
+ if (s.direction === "backward") {
791
+ const i = e._zod.parse({ value: n.value, issues: [] }, { ...s, skipChecks: !0 });
792
+ return i instanceof Promise ? i.then((d) => l(d, n, s)) : l(i, n, s);
793
+ }
794
+ const c = e._zod.parse(n, s);
795
+ if (c instanceof Promise) {
796
+ if (s.async === !1)
797
+ throw new ke();
798
+ return c.then((i) => a(i, r, s));
799
+ }
800
+ return a(c, r, s);
801
+ };
802
+ }
803
+ oe(e, "~standard", () => ({
804
+ validate: (a) => {
805
+ try {
806
+ const l = ct(e, a);
807
+ return l.success ? { value: l.data } : { issues: l.error?.issues };
808
+ } catch {
809
+ return dt(e, a).then((n) => n.success ? { value: n.data } : { issues: n.error?.issues });
810
+ }
811
+ },
812
+ vendor: "zod",
813
+ version: 1
814
+ }));
815
+ }), fo = /* @__PURE__ */ K("$ZodString", (e, t) => {
816
+ he.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? po(e._zod.bag), e._zod.parse = (o, r) => {
817
+ if (t.coerce)
818
+ try {
819
+ o.value = String(o.value);
820
+ } catch {
821
+ }
822
+ return typeof o.value == "string" || o.issues.push({
823
+ expected: "string",
824
+ code: "invalid_type",
825
+ input: o.value,
826
+ inst: e
827
+ }), o;
828
+ };
829
+ }), mo = /* @__PURE__ */ K("$ZodNull", (e, t) => {
830
+ he.init(e, t), e._zod.pattern = ho, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (o, r) => {
831
+ const a = o.value;
832
+ return a === null || o.issues.push({
833
+ expected: "null",
834
+ code: "invalid_type",
835
+ input: a,
836
+ inst: e
837
+ }), o;
838
+ };
839
+ });
840
+ function Me(e, t, o, r, a, l) {
841
+ const n = o in r;
842
+ if (e.issues.length) {
843
+ if (a && l && !n)
844
+ return;
845
+ t.issues.push(...ro(o, e.issues));
846
+ }
847
+ if (!n && !a) {
848
+ e.issues.length || t.issues.push({
849
+ code: "invalid_type",
850
+ expected: "nonoptional",
851
+ input: void 0,
852
+ path: [o]
853
+ });
854
+ return;
855
+ }
856
+ e.value === void 0 ? n && (t.value[o] = void 0) : t.value[o] = e.value;
857
+ }
858
+ function wo(e) {
859
+ const t = Object.keys(e.shape);
860
+ for (const r of t)
861
+ if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
862
+ throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
863
+ const o = to(e.shape);
864
+ return {
865
+ ...e,
866
+ keys: t,
867
+ keySet: new Set(t),
868
+ numKeys: t.length,
869
+ optionalKeys: new Set(o)
870
+ };
871
+ }
872
+ function vo(e, t, o, r, a, l) {
873
+ const n = [], s = a.keySet, c = a.catchall._zod, i = c.def.type, d = c.optin === "optional", h = c.optout === "optional";
874
+ for (const u in t) {
875
+ if (u === "__proto__" || s.has(u))
876
+ continue;
877
+ if (i === "never") {
878
+ n.push(u);
879
+ continue;
880
+ }
881
+ const p = c.run({ value: t[u], issues: [] }, r);
882
+ p instanceof Promise ? e.push(p.then((g) => Me(g, o, u, t, d, h))) : Me(p, o, u, t, d, h);
883
+ }
884
+ return n.length && o.issues.push({
885
+ code: "unrecognized_keys",
886
+ keys: n,
887
+ input: t,
888
+ inst: l
889
+ }), e.length ? Promise.all(e).then(() => o) : o;
890
+ }
891
+ const bo = /* @__PURE__ */ K("$ZodObject", (e, t) => {
892
+ if (he.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
893
+ const s = t.shape;
894
+ Object.defineProperty(t, "shape", {
895
+ get: () => {
896
+ const c = { ...s };
897
+ return Object.defineProperty(t, "shape", {
898
+ value: c
899
+ }), c;
900
+ }
901
+ });
902
+ }
903
+ const r = Yt(() => wo(t));
904
+ oe(e._zod, "propValues", () => {
905
+ const s = t.shape, c = {};
906
+ for (const i in s) {
907
+ const d = s[i]._zod;
908
+ if (d.values) {
909
+ c[i] ?? (c[i] = /* @__PURE__ */ new Set());
910
+ for (const h of d.values)
911
+ c[i].add(h);
912
+ }
913
+ }
914
+ return c;
915
+ });
916
+ const a = Qt, l = t.catchall;
917
+ let n;
918
+ e._zod.parse = (s, c) => {
919
+ n ?? (n = r.value);
920
+ const i = s.value;
921
+ if (!a(i))
922
+ return s.issues.push({
923
+ expected: "object",
924
+ code: "invalid_type",
925
+ input: i,
926
+ inst: e
927
+ }), s;
928
+ s.value = {};
929
+ const d = [], h = n.shape;
930
+ for (const u of n.keys) {
931
+ const p = h[u], g = p._zod.optin === "optional", x = p._zod.optout === "optional", R = p._zod.run({ value: i[u], issues: [] }, c);
932
+ R instanceof Promise ? d.push(R.then((y) => Me(y, s, u, i, g, x))) : Me(R, s, u, i, g, x);
933
+ }
934
+ return l ? vo(d, i, s, c, r.value, e) : d.length ? Promise.all(d).then(() => s) : s;
935
+ };
936
+ });
937
+ function ot(e, t, o, r) {
938
+ for (const l of e)
939
+ if (l.issues.length === 0)
940
+ return t.value = l.value, t;
941
+ const a = e.filter((l) => !xe(l));
942
+ return a.length === 1 ? (t.value = a[0].value, a[0]) : (t.issues.push({
943
+ code: "invalid_union",
944
+ input: t.value,
945
+ inst: o,
946
+ errors: e.map((l) => l.issues.map((n) => Se(n, r, fe())))
947
+ }), t);
948
+ }
949
+ const qo = /* @__PURE__ */ K("$ZodUnion", (e, t) => {
950
+ he.init(e, t), oe(e._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), oe(e._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), oe(e._zod, "values", () => {
951
+ if (t.options.every((r) => r._zod.values))
952
+ return new Set(t.options.flatMap((r) => Array.from(r._zod.values)));
953
+ }), oe(e._zod, "pattern", () => {
954
+ if (t.options.every((r) => r._zod.pattern)) {
955
+ const r = t.options.map((a) => a._zod.pattern);
956
+ return new RegExp(`^(${r.map((a) => it(a.source)).join("|")})$`);
957
+ }
958
+ });
959
+ const o = t.options.length === 1 ? t.options[0]._zod.run : null;
960
+ e._zod.parse = (r, a) => {
961
+ if (o)
962
+ return o(r, a);
963
+ let l = !1;
964
+ const n = [];
965
+ for (const s of t.options) {
966
+ const c = s._zod.run({
967
+ value: r.value,
968
+ issues: []
969
+ }, a);
970
+ if (c instanceof Promise)
971
+ n.push(c), l = !0;
972
+ else {
973
+ if (c.issues.length === 0)
974
+ return c;
975
+ n.push(c);
976
+ }
977
+ }
978
+ return l ? Promise.all(n).then((s) => ot(s, r, e, a)) : ot(n, r, e, a);
979
+ };
980
+ }), yo = /* @__PURE__ */ K("$ZodLiteral", (e, t) => {
981
+ if (he.init(e, t), t.values.length === 0)
982
+ throw new Error("Cannot create literal schema with no valid values");
983
+ const o = new Set(t.values);
984
+ e._zod.values = o, e._zod.pattern = new RegExp(`^(${t.values.map((r) => typeof r == "string" ? tt(r) : r ? tt(r.toString()) : String(r)).join("|")})$`), e._zod.parse = (r, a) => {
985
+ const l = r.value;
986
+ return o.has(l) || r.issues.push({
987
+ code: "invalid_value",
988
+ values: t.values,
989
+ input: l,
990
+ inst: e
991
+ }), r;
992
+ };
993
+ }), xo = /* @__PURE__ */ K("$ZodNullable", (e, t) => {
994
+ he.init(e, t), oe(e._zod, "optin", () => t.innerType._zod.optin), oe(e._zod, "optout", () => t.innerType._zod.optout), oe(e._zod, "pattern", () => {
995
+ const o = t.innerType._zod.pattern;
996
+ return o ? new RegExp(`^(${it(o.source)}|null)$`) : void 0;
997
+ }), oe(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (o, r) => o.value === null ? o : t.innerType._zod.run(o, r);
998
+ });
999
+ // @__NO_SIDE_EFFECTS__
1000
+ function ko(e, t) {
1001
+ return new e({
1002
+ type: "string",
1003
+ ...Ce()
1004
+ });
1005
+ }
1006
+ // @__NO_SIDE_EFFECTS__
1007
+ function _o(e, t) {
1008
+ return new e({
1009
+ type: "null",
1010
+ ...Ce()
1011
+ });
1012
+ }
1013
+ const me = /* @__PURE__ */ K("ZodMiniType", (e, t) => {
1014
+ if (!e._zod)
1015
+ throw new Error("Uninitialized schema in ZodMiniType.");
1016
+ he.init(e, t), e.def = t, e.type = t.type, e.parse = (o, r) => io(e, o, r, { callee: e.parse }), e.safeParse = (o, r) => ct(e, o, r), e.parseAsync = async (o, r) => lo(e, o, r, { callee: e.parseAsync }), e.safeParseAsync = async (o, r) => dt(e, o, r), e.check = (...o) => e.clone({
1017
+ ...t,
1018
+ checks: [
1019
+ ...t.checks ?? [],
1020
+ ...o.map((r) => typeof r == "function" ? {
1021
+ _zod: { check: r, def: { check: "custom" }, onattach: [] }
1022
+ } : r)
1023
+ ]
1024
+ }, { parent: !0 }), e.with = e.check, e.clone = (o, r) => eo(e, o, r), e.brand = () => e, e.register = ((o, r) => (o.add(e, r), e)), e.apply = (o) => o(e);
1025
+ }), Co = /* @__PURE__ */ K("ZodMiniString", (e, t) => {
1026
+ fo.init(e, t), me.init(e, t);
1027
+ });
1028
+ // @__NO_SIDE_EFFECTS__
1029
+ function T(e) {
1030
+ return /* @__PURE__ */ ko(Co);
1031
+ }
1032
+ const So = /* @__PURE__ */ K("ZodMiniNull", (e, t) => {
1033
+ mo.init(e, t), me.init(e, t);
1034
+ });
1035
+ // @__NO_SIDE_EFFECTS__
1036
+ function Io(e) {
1037
+ return /* @__PURE__ */ _o(So);
1038
+ }
1039
+ const Eo = /* @__PURE__ */ K("ZodMiniObject", (e, t) => {
1040
+ bo.init(e, t), me.init(e, t), oe(e, "shape", () => t.shape);
1041
+ });
1042
+ // @__NO_SIDE_EFFECTS__
1043
+ function O(e, t) {
1044
+ const o = {
1045
+ type: "object",
1046
+ shape: e ?? {},
1047
+ ...Ce()
1048
+ };
1049
+ return new Eo(o);
1050
+ }
1051
+ const zo = /* @__PURE__ */ K("ZodMiniUnion", (e, t) => {
1052
+ qo.init(e, t), me.init(e, t);
1053
+ });
1054
+ // @__NO_SIDE_EFFECTS__
1055
+ function Ro(e, t) {
1056
+ return new zo({
1057
+ type: "union",
1058
+ options: e,
1059
+ ...Ce()
1060
+ });
1061
+ }
1062
+ const To = /* @__PURE__ */ K("ZodMiniLiteral", (e, t) => {
1063
+ yo.init(e, t), me.init(e, t);
1064
+ });
1065
+ // @__NO_SIDE_EFFECTS__
1066
+ function ae(e, t) {
1067
+ return new To({
1068
+ type: "literal",
1069
+ values: Array.isArray(e) ? e : [e],
1070
+ ...Ce()
1071
+ });
1072
+ }
1073
+ const Mo = /* @__PURE__ */ K("ZodMiniNullable", (e, t) => {
1074
+ xo.init(e, t), me.init(e, t);
1075
+ });
1076
+ // @__NO_SIDE_EFFECTS__
1077
+ function Ve(e) {
1078
+ return new Mo({
1079
+ type: "nullable",
1080
+ innerType: e
1081
+ });
1082
+ }
1083
+ fe({ jitless: !0 });
1084
+ const Ao = /* @__PURE__ */ O({
1085
+ type: /* @__PURE__ */ ae("utterance"),
1086
+ content: /* @__PURE__ */ T(),
1087
+ role: /* @__PURE__ */ T()
1088
+ }), Po = /* @__PURE__ */ O({
1089
+ type: /* @__PURE__ */ ae("agent_cognition"),
1090
+ content: /* @__PURE__ */ T()
1091
+ }), Oo = /* @__PURE__ */ O({
1092
+ type: /* @__PURE__ */ ae("chat_closed_expired"),
1093
+ content: /* @__PURE__ */ T()
1094
+ }), Uo = /* @__PURE__ */ O({
1095
+ type: /* @__PURE__ */ ae("agent_captured_url"),
1096
+ content: /* @__PURE__ */ T()
1097
+ }), Do = /* @__PURE__ */ O({
1098
+ type: /* @__PURE__ */ ae("agent_topic"),
1099
+ content: /* @__PURE__ */ T()
1100
+ }), $o = /* @__PURE__ */ O({
1101
+ type: /* @__PURE__ */ ae("agent_summary"),
1102
+ content: /* @__PURE__ */ T()
1103
+ }), No = /* @__PURE__ */ O({
1104
+ type: /* @__PURE__ */ ae("chat_rating"),
1105
+ content: /* @__PURE__ */ T()
1106
+ }), jo = /* @__PURE__ */ O({
1107
+ type: /* @__PURE__ */ ae("breadcrumb"),
1108
+ content: /* @__PURE__ */ T()
1109
+ }), Bo = /* @__PURE__ */ O({
1110
+ type: /* @__PURE__ */ ae("chat_escalated"),
1111
+ content: /* @__PURE__ */ Io()
1112
+ }), Lo = /* @__PURE__ */ O({
1113
+ type: /* @__PURE__ */ ae("error"),
1114
+ code: /* @__PURE__ */ T()
1115
+ }), Zo = /* @__PURE__ */ O({
1116
+ message_id: /* @__PURE__ */ Ve(/* @__PURE__ */ T()),
1117
+ created_at: /* @__PURE__ */ T(),
1118
+ data: Ao
1119
+ }), Ho = /* @__PURE__ */ O({
1120
+ created_at: /* @__PURE__ */ T(),
1121
+ data: Lo
1122
+ }), Ko = /* @__PURE__ */ O({
1123
+ created_at: /* @__PURE__ */ T(),
1124
+ data: Po
1125
+ }), Vo = /* @__PURE__ */ O({
1126
+ message_id: /* @__PURE__ */ Ve(/* @__PURE__ */ T()),
1127
+ created_at: /* @__PURE__ */ T(),
1128
+ data: Oo
1129
+ }), Wo = /* @__PURE__ */ O({
1130
+ created_at: /* @__PURE__ */ T(),
1131
+ data: Uo
1132
+ }), Jo = /* @__PURE__ */ O({
1133
+ created_at: /* @__PURE__ */ T(),
1134
+ data: Do
1135
+ }), Fo = /* @__PURE__ */ O({
1136
+ created_at: /* @__PURE__ */ T(),
1137
+ data: $o
1138
+ }), Go = /* @__PURE__ */ O({
1139
+ created_at: /* @__PURE__ */ T(),
1140
+ data: No
1141
+ }), Xo = /* @__PURE__ */ O({
1142
+ created_at: /* @__PURE__ */ T(),
1143
+ data: jo
1144
+ }), Yo = /* @__PURE__ */ O({
1145
+ message_id: /* @__PURE__ */ Ve(/* @__PURE__ */ T()),
1146
+ created_at: /* @__PURE__ */ T(),
1147
+ data: Bo
1148
+ }), Qo = /* @__PURE__ */ Ro([
1149
+ Zo,
1150
+ Ho,
1151
+ Ko,
1152
+ Wo,
1153
+ Jo,
1154
+ Fo,
1155
+ Vo,
1156
+ Go,
1157
+ Xo,
1158
+ Yo
1159
+ ]), er = 500, tr = 3e4, or = 6e4;
1160
+ function rr({
1161
+ chatSettings: e,
1162
+ chatId: t,
1163
+ messages: o,
1164
+ onMessage: r,
1165
+ onCognition: a,
1166
+ onCognitionComplete: l,
1167
+ onError: n,
1168
+ onChatClosed: s,
1169
+ onAgentCapturedUrl: c,
1170
+ onAgentTopic: i,
1171
+ onAgentSummary: d,
1172
+ onRatingRequest: h,
1173
+ onBreadcrumb: u,
1174
+ fetchHistory: p,
1175
+ getChatToken: g,
1176
+ backupPollingInterval: x = or
1177
+ }) {
1178
+ const R = L(/* @__PURE__ */ new Set());
1179
+ Z(() => {
1180
+ for (const M of o)
1181
+ M.id && R.current.add(M.id);
1182
+ }, [o]);
1183
+ const y = L(null), U = L(null), A = L(0), _ = L(null), S = L(null), C = L(!1), f = L(!1), w = W(r), I = W(a), Q = W(l), E = W(n), P = W(s), N = W(c), J = W(i), H = W(d), j = W(h), B = W(u), F = W(p), b = W(g), { publishError: z } = Ae(), V = e?.app_sync_url, k = e?.app_sync_api_key, D = !!(V && k), $ = W(V), G = W(k), ie = v(() => {
1184
+ y.current && (y.current.close(), y.current = null);
1185
+ }, []), ue = v(() => {
1186
+ S.current && (clearInterval(S.current), S.current = null);
1187
+ }, []), se = v(() => {
1188
+ _.current && (clearTimeout(_.current), _.current = null);
1189
+ }, []), pe = L(() => {
1190
+ }), le = v(
1191
+ async (M) => {
1192
+ ie();
1193
+ const ee = $.current, Y = G.current;
1194
+ if (!ee || !Y)
1195
+ throw new Error("Cannot connect: AppSync settings not available");
1196
+ const Ie = b.current(), De = await Gt({
1197
+ httpEndpoint: ee,
1198
+ auth: Ie ? { authorizationToken: Ie } : { apiKey: Y },
1199
+ channel: `/default/chat/${M}`,
1200
+ onDisconnect: () => {
1201
+ y.current = null, pe.current();
1202
+ },
1203
+ onEvent: ($e) => {
1204
+ const ge = Qo.safeParse($e);
1205
+ if (!ge.success) {
1206
+ console.error("Invalid conversation response:", ge.error);
1207
+ return;
1208
+ }
1209
+ const re = ge.data;
1210
+ switch (re.data.type) {
1211
+ case "utterance": {
1212
+ const X = re, te = X.message_id ?? crypto.randomUUID();
1213
+ if (R.current.has(te))
1214
+ return;
1215
+ R.current.add(te), Q.current(), w.current(
1216
+ {
1217
+ message_id: te,
1218
+ response: {
1219
+ id: te,
1220
+ type: X.data.type,
1221
+ content: X.data.content
1222
+ }
1223
+ },
1224
+ M
1225
+ );
1226
+ return;
1227
+ }
1228
+ case "error": {
1229
+ const te = parseInt(re.data.code);
1230
+ z({ code: te, message: bt(te) }), E.current?.();
1231
+ return;
1232
+ }
1233
+ case "agent_cognition": {
1234
+ const X = re;
1235
+ I.current(X.data.content);
1236
+ return;
1237
+ }
1238
+ case "agent_captured_url": {
1239
+ const X = re;
1240
+ N.current?.(X.data.content);
1241
+ return;
1242
+ }
1243
+ case "agent_topic": {
1244
+ const X = re;
1245
+ J.current?.(X.data.content);
1246
+ return;
1247
+ }
1248
+ case "agent_summary": {
1249
+ const X = re;
1250
+ H.current?.(X.data.content);
1251
+ return;
1252
+ }
1253
+ case "chat_closed_expired": {
1254
+ P.current?.(), j.current?.();
1255
+ return;
1256
+ }
1257
+ case "chat_rating": {
1258
+ j.current?.();
1259
+ return;
1260
+ }
1261
+ case "breadcrumb": {
1262
+ B.current?.();
1263
+ return;
1264
+ }
1265
+ case "chat_escalated": {
1266
+ P.current?.(), j.current?.();
1267
+ return;
1268
+ }
1269
+ default:
1270
+ console.warn(
1271
+ "Unknown notification type:",
1272
+ re.data.type
1273
+ );
1274
+ }
1275
+ }
1276
+ });
1277
+ y.current = De;
1278
+ },
1279
+ // The *Ref entries are latest-refs (stable identities); listed to satisfy
1280
+ // exhaustive-deps, which can't see that useLatestRef returns a ref.
1281
+ [
1282
+ ie,
1283
+ z,
1284
+ $,
1285
+ G,
1286
+ b,
1287
+ w,
1288
+ I,
1289
+ Q,
1290
+ E,
1291
+ P,
1292
+ N,
1293
+ J,
1294
+ H,
1295
+ j,
1296
+ B
1297
+ ]
1298
+ ), ce = v(
1299
+ async (M) => {
1300
+ try {
1301
+ const ee = await F.current(M);
1302
+ for (const Y of ee)
1303
+ Y.role !== "assistant" || !Y.message_id || R.current.has(Y.message_id) || (R.current.add(Y.message_id), w.current(
1304
+ { message_id: Y.message_id, response: Y.response },
1305
+ M
1306
+ ));
1307
+ } catch (ee) {
1308
+ console.warn("Backup poll failed:", ee);
1309
+ }
1310
+ },
1311
+ [F, w]
1312
+ ), we = v(
1313
+ (M) => {
1314
+ ue(), S.current = setInterval(
1315
+ () => ce(M),
1316
+ x
1317
+ );
1318
+ },
1319
+ [ue, ce, x]
1320
+ ), ve = v(
1321
+ function M() {
1322
+ if (!C.current || f.current || _.current)
1323
+ return;
1324
+ const ee = U.current;
1325
+ if (!ee) return;
1326
+ const Y = Math.min(
1327
+ er * Math.pow(2, A.current),
1328
+ tr
1329
+ );
1330
+ A.current += 1, _.current = setTimeout(async () => {
1331
+ _.current = null, f.current = !0;
1332
+ try {
1333
+ await le(ee), A.current = 0, f.current = !1, await ce(ee);
1334
+ } catch {
1335
+ f.current = !1, M();
1336
+ }
1337
+ }, Y);
1338
+ },
1339
+ [le, ce]
1340
+ );
1341
+ Z(() => {
1342
+ pe.current = ve;
1343
+ });
1344
+ const be = v(
1345
+ async (M) => {
1346
+ if (!D || !M)
1347
+ throw new Error(
1348
+ "Cannot connect: AppSync settings not ready or missing chatId"
1349
+ );
1350
+ se(), C.current = !0, U.current = M, A.current = 0, we(M), await le(M);
1351
+ },
1352
+ [D, se, le, we]
1353
+ ), qe = v(() => {
1354
+ C.current = !1, U.current = null, A.current = 0, se(), ue(), ie();
1355
+ }, [se, ue, ie]), Ue = v(() => {
1356
+ R.current.clear();
1357
+ }, []);
1358
+ return Z(() => {
1359
+ !t || !D || U.current === t || be(t).catch((M) => {
1360
+ console.error("Failed to eagerly connect:", M), U.current = t, C.current = !0, pe.current();
1361
+ });
1362
+ }, [t, D, be]), Z(() => () => {
1363
+ qe();
1364
+ }, [qe]), { connect: be, disconnect: qe, clearProcessedIds: Ue };
1365
+ }
1366
+ function nr(e) {
1367
+ return {
1368
+ id: e.message_id,
1369
+ content: e.response.content ?? "",
1370
+ sender: "assistant",
1371
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1372
+ };
1373
+ }
1374
+ function ar(e) {
1375
+ return {
1376
+ id: crypto.randomUUID(),
1377
+ content: e,
1378
+ sender: "assistant",
1379
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1380
+ isWelcomeMessage: !0
1381
+ };
1382
+ }
1383
+ function ir() {
1384
+ return {
1385
+ id: crypto.randomUUID(),
1386
+ content: "",
1387
+ sender: "assistant",
1388
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1389
+ isRatingRequest: !0
1390
+ };
1391
+ }
1392
+ function sr() {
1393
+ return {
1394
+ id: crypto.randomUUID(),
1395
+ content: "This conversation is closed, please start a new chat.",
1396
+ sender: "assistant",
1397
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1398
+ };
1399
+ }
1400
+ function lr({
1401
+ appId: e,
1402
+ userId: t,
1403
+ userName: o,
1404
+ userData: r,
1405
+ externalId: a,
1406
+ deviceId: l,
1407
+ apiClient: n,
1408
+ chatSettings: s,
1409
+ messages: c,
1410
+ setMessages: i,
1411
+ currentChat: d,
1412
+ setCurrentChat: h,
1413
+ onChatClosed: u,
1414
+ isChatClosed: p
1415
+ }) {
1416
+ const { saveChatData: g, clearChatData: x, updateLastActivity: R, markChatClosed: y } = Ke({
1417
+ appId: e
1418
+ }), { publishApiError: U, publishNetworkError: A } = Ae(), { showCognition: _, hideCognition: S } = qt(), C = W(n), f = v(
1419
+ (b, z) => {
1420
+ b.response.content && i((V) => {
1421
+ if (V.some(($) => $.isRatingRequest) || s?.welcome_message && b.response.content === s.welcome_message)
1422
+ return V;
1423
+ const D = [
1424
+ ...V.filter(($) => !$.isThinking),
1425
+ nr(b)
1426
+ ];
1427
+ return g(
1428
+ z,
1429
+ t,
1430
+ D,
1431
+ l,
1432
+ C.current?.getChatToken()
1433
+ ), D;
1434
+ });
1435
+ },
1436
+ [s, l, g, i, t, C]
1437
+ ), w = v(() => {
1438
+ S(), i((b) => b.filter((z) => !z.isThinking));
1439
+ }, [i, S]), I = v(() => {
1440
+ i((b) => [...b.filter((V) => !V.isRatingRequest), ir()]);
1441
+ }, [i]);
1442
+ Z(() => {
1443
+ }, [I]);
1444
+ const Q = v(
1445
+ (b) => C.current ? C.current.getChatHistory(b) : Promise.resolve([]),
1446
+ [C]
1447
+ ), E = v(() => C.current?.getChatToken() ?? null, [C]), P = v(() => {
1448
+ y(), u?.();
1449
+ }, [y, u]), { connect: N, disconnect: J, clearProcessedIds: H } = rr({
1450
+ chatSettings: s,
1451
+ chatId: d?.id ?? null,
1452
+ messages: c,
1453
+ onMessage: f,
1454
+ onCognition: _,
1455
+ onCognitionComplete: S,
1456
+ onError: w,
1457
+ onChatClosed: P,
1458
+ onRatingRequest: I,
1459
+ onBreadcrumb: P,
1460
+ fetchHistory: Q,
1461
+ getChatToken: E
1462
+ }), j = v(() => {
1463
+ S(), J(), H(), i(
1464
+ (b) => b.filter((z) => Array.isArray(z) ? !1 : z.isWelcomeMessage)
1465
+ ), x(), h(null);
1466
+ }, [
1467
+ S,
1468
+ J,
1469
+ H,
1470
+ x,
1471
+ i,
1472
+ h
1473
+ ]), B = v(
1474
+ async (b) => {
1475
+ if (!n || c.some((k) => k.isRatingRequest)) return;
1476
+ if (p) {
1477
+ i((k) => [...k, sr()]);
1478
+ return;
1479
+ }
1480
+ const z = {
1481
+ ...b,
1482
+ id: crypto.randomUUID(),
1483
+ isNew: !0
1484
+ };
1485
+ _();
1486
+ const V = [...c, z];
1487
+ i(V), R();
1488
+ try {
1489
+ let k = d?.id;
1490
+ if (!k) {
1491
+ k = (await n.createConversation({
1492
+ userId: a || t,
1493
+ deviceId: l,
1494
+ userName: o,
1495
+ userData: r,
1496
+ externalMetadata: {
1497
+ searchParams: Nt()
1498
+ }
1499
+ })).chat_id, h({ id: k });
1500
+ try {
1501
+ await N(k);
1502
+ } catch (G) {
1503
+ console.warn(
1504
+ "Failed to connect realtime channel, continuing with REST-only delivery:",
1505
+ G
1506
+ );
1507
+ }
1508
+ }
1509
+ const D = await n.replyToConversation({
1510
+ text: b.content,
1511
+ conversationId: k,
1512
+ userId: a || t,
1513
+ deviceId: l,
1514
+ userName: o,
1515
+ userData: r
1516
+ });
1517
+ i(
1518
+ ($) => $.map(
1519
+ (G) => G.id === z.id ? { ...G, id: D.message_id, isNew: !1 } : G
1520
+ )
1521
+ );
1522
+ } catch (k) {
1523
+ throw S(), i((D) => D.filter(($) => !$.isThinking)), k instanceof Pe || k instanceof de && k.status === 403 ? (A(), k) : (U(k), k instanceof de && // A 401 here means the chat's session token is invalid/expired
1524
+ // (or the chat closed) — treat it the same as a client-side
1525
+ // expired chat: drop the stale session and let the next send
1526
+ // start a fresh one, instead of surfacing an error.
1527
+ (k.status >= 500 || k.status === 401) ? (h(null), x(), i((D) => D.slice(0, -1)), n.reset()) : i(
1528
+ (D) => D.map(
1529
+ ($) => $.id === z.id ? { ...$, isFailed: !0 } : $
1530
+ )
1531
+ ), k);
1532
+ }
1533
+ },
1534
+ [
1535
+ n,
1536
+ p,
1537
+ _,
1538
+ c,
1539
+ i,
1540
+ R,
1541
+ d?.id,
1542
+ a,
1543
+ t,
1544
+ l,
1545
+ h,
1546
+ N,
1547
+ S,
1548
+ U,
1549
+ A,
1550
+ x,
1551
+ o,
1552
+ r
1553
+ ]
1554
+ ), F = v(
1555
+ async (b) => {
1556
+ const z = d?.id;
1557
+ !C.current || !z || await C.current.addRating(z, b);
1558
+ },
1559
+ [d?.id, C]
1560
+ );
1561
+ return {
1562
+ onCleanMessages: j,
1563
+ onSendMessage: B,
1564
+ onRateChat: F
1565
+ };
1566
+ }
1567
+ const cr = { BASE_URL: "/", DEV: !1, MODE: "dev", PROD: !0, SSR: !1, VITE_API_URL: "https://chat.eloquentai.dev", VITE_CDN_URL: "https://cdn.eloquentai.dev", VITE_ENVIRONMENT: "dev", VITE_REGION_API_URL: "https://region.eloquentai.dev" };
1568
+ function ut(e) {
1569
+ return typeof window > "u" || typeof import.meta > "u" ? "" : cr[e] || "";
1570
+ }
1571
+ const dr = ut("VITE_API_URL"), ur = ut("VITE_REGION_API_URL");
1572
+ function pr() {
1573
+ return dr || "";
1574
+ }
1575
+ function hr() {
1576
+ return ur || "";
1577
+ }
1578
+ class gr {
1579
+ httpClient;
1580
+ userId = null;
1581
+ conversationId = null;
1582
+ constructor(t) {
1583
+ this.userId = t.userId || null, this.httpClient = new $t(t);
1584
+ }
1585
+ getUserData() {
1586
+ return {
1587
+ userId: this.userId,
1588
+ conversationId: this.conversationId
1589
+ };
1590
+ }
1591
+ /**
1592
+ * Reset API client by clearing all stored state
1593
+ */
1594
+ reset() {
1595
+ this.conversationId = null, this.httpClient.setChatToken(null);
1596
+ }
1597
+ setRegion(t) {
1598
+ this.httpClient.setRegion(t);
1599
+ }
1600
+ getChatToken() {
1601
+ return this.httpClient.getChatToken();
1602
+ }
1603
+ setChatToken(t) {
1604
+ this.httpClient.setChatToken(t);
1605
+ }
1606
+ /**
1607
+ * Get organization data by app ID
1608
+ */
1609
+ async getOrganizationByAppId(t) {
1610
+ const o = hr();
1611
+ return await this.httpClient.getExternal(
1612
+ `${o}/by-app-id/${t}`
1613
+ );
1614
+ }
1615
+ async boot() {
1616
+ return (await this.httpClient.get(
1617
+ "/v1/sdk/boot"
1618
+ )).data;
1619
+ }
1620
+ async addRating(t, o) {
1621
+ return (await this.httpClient.put(`/v1/chat/${t}/rating`, { rating: o })).data;
1622
+ }
1623
+ async createConversation(t) {
1624
+ const o = await this.httpClient.post("/v2/chat", {
1625
+ user_data: {
1626
+ user_id: t.userId,
1627
+ device_id: t.deviceId,
1628
+ user_name: t.userName,
1629
+ external_id: t.externalId,
1630
+ user_data: t.userData
1631
+ },
1632
+ ...t.externalMetadata && Object.keys(t.externalMetadata).length > 0 ? { external_metadata: t.externalMetadata } : {}
1633
+ }), { data: r } = o;
1634
+ return this.httpClient.setChatToken(r.chat_token), r;
1635
+ }
1636
+ async replyToConversation(t) {
1637
+ const o = {
1638
+ text: t.text,
1639
+ user_data: {
1640
+ device_id: t.deviceId,
1641
+ user_id: t.userId,
1642
+ user_name: t.userName,
1643
+ user_data: t.userData
1644
+ }
1645
+ }, { data: r } = await this.httpClient.post(`/v3/chat/${t.conversationId}`, o);
1646
+ return r;
1647
+ }
1648
+ async identifyUser(t) {
1649
+ const o = {
1650
+ device_id: t.deviceId,
1651
+ user_id: t.userId,
1652
+ user_name: t.userName,
1653
+ external_id: t.externalId,
1654
+ user_data: t.userData
1655
+ }, { data: r } = await this.httpClient.post(`/v1/chat/${t.conversationId}/identify`, o);
1656
+ return r;
1657
+ }
1658
+ async getChatHistory(t) {
1659
+ return (await this.httpClient.get(
1660
+ `/v1/chat/${t}/history`
1661
+ )).data;
1662
+ }
1663
+ }
1664
+ async function rt(e) {
1665
+ try {
1666
+ return [await e, null];
1667
+ } catch (t) {
1668
+ return [null, t];
1669
+ }
1670
+ }
1671
+ const fr = {
1672
+ retries: 3,
1673
+ minDelayMs: 200,
1674
+ maxDelayMs: 1e3,
1675
+ factor: 2
1676
+ };
1677
+ function mr(e) {
1678
+ return e instanceof Pe ? !0 : e instanceof de ? e.status === 429 || e.status >= 500 : !1;
1679
+ }
1680
+ function wr(e, t) {
1681
+ const o = t.minDelayMs * t.factor ** e, r = Math.min(o, t.maxDelayMs);
1682
+ return Math.random() * r;
1683
+ }
1684
+ async function nt(e, t = {}) {
1685
+ const o = { ...fr, ...t };
1686
+ for (let r = 0; ; r++)
1687
+ try {
1688
+ return await e();
1689
+ } catch (a) {
1690
+ if (r >= o.retries || !mr(a))
1691
+ throw a;
1692
+ await new Promise(
1693
+ (l) => setTimeout(l, wr(r, o))
1694
+ );
1695
+ }
1696
+ }
1697
+ const Re = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
1698
+ function vr(e, t, o) {
1699
+ const r = o?.dedupe !== !1, [a, l] = q(
1700
+ () => Re.get(e)
1701
+ ), { publishApiError: n, publishNetworkError: s } = Ae(), [c, i] = q(void 0), [d, h] = q(!1), u = L(!0);
1702
+ L(() => (u.current = !0, () => {
1703
+ u.current = !1;
1704
+ }));
1705
+ const p = v(async () => {
1706
+ if (Re.has(e)) {
1707
+ const g = Re.get(e);
1708
+ return l(g), g;
1709
+ }
1710
+ h(!0), i(void 0);
1711
+ try {
1712
+ if (r && Te.has(e))
1713
+ return await Te.get(e);
1714
+ const g = t();
1715
+ r && Te.set(e, g);
1716
+ const x = await g;
1717
+ return Re.set(e, x), u.current && l(x), x;
1718
+ } catch (g) {
1719
+ throw g instanceof Pe || g instanceof de && g.status === 403 ? s() : n(g), u.current && i(g), g;
1720
+ } finally {
1721
+ Te.delete(e), u.current && h(!1);
1722
+ }
1723
+ }, [e, r, t, n, s]);
1724
+ return { data: a, error: c, isLoading: d, fetch: p };
1725
+ }
1726
+ function at(e, t) {
1727
+ const o = e?.deviceId || crypto.randomUUID();
1728
+ return e?.userId ? e.externalId !== t ? { userId: e.userId, externalId: t, deviceId: o } : {
1729
+ userId: e.userId,
1730
+ externalId: e.externalId,
1731
+ deviceId: o
1732
+ } : t ? { userId: t, externalId: t, deviceId: o } : { userId: crypto.randomUUID(), externalId: null, deviceId: o };
1733
+ }
1734
+ function br(e) {
1735
+ const { appId: t, initialUserId: o } = e, { getSavedChatData: r } = Ke({ appId: t }), [a, l] = q(
1736
+ () => at(r(), o)
1737
+ ), [n, s] = q(o);
1738
+ return n !== o && (s(o), l(at(r(), o))), {
1739
+ // Identity is available synchronously; kept in the contract because
1740
+ // consumers (SDK boot) still key off it.
1741
+ isReady: !0,
1742
+ userId: a.userId,
1743
+ deviceId: a.deviceId,
1744
+ externalId: a.externalId
1745
+ };
1746
+ }
1747
+ function qr({
1748
+ apiUrl: e,
1749
+ appId: t,
1750
+ initialUserId: o,
1751
+ userName: r,
1752
+ userData: a
1753
+ }) {
1754
+ const {
1755
+ userId: l,
1756
+ externalId: n,
1757
+ deviceId: s,
1758
+ isReady: c
1759
+ } = br({ appId: t, initialUserId: o }), { isChatExpired: i, clearChatData: d, getSavedChatData: h } = Ke({
1760
+ appId: t
1761
+ }), { current: u } = L(e || pr()), [p] = q(
1762
+ new gr({
1763
+ baseURL: u,
1764
+ appId: t
1765
+ })
1766
+ ), [g, x] = q(null), [R, y] = q(null), [U, A] = q([]), [_, S] = q(!1), [C, f] = q(!1), [w, I] = q(!0), E = vr(`sdk-boot-${t}`, () => p.boot()).fetch;
1767
+ Z(() => {
1768
+ if (i())
1769
+ d();
1770
+ else {
1771
+ const {
1772
+ conversationId: N,
1773
+ userId: J,
1774
+ messages: H,
1775
+ isChatClosed: j,
1776
+ chatToken: B
1777
+ } = h();
1778
+ N && J && (y({
1779
+ id: N
1780
+ }), p.setChatToken(B ?? null), H && H.length > 0 && A(H), j && f(!0));
1781
+ }
1782
+ }, [h, i, d, p]);
1783
+ const P = L(!1);
1784
+ return Z(() => {
1785
+ if (P.current) return;
1786
+ P.current = !0, (async () => {
1787
+ const [J, H] = await rt(
1788
+ nt(() => p.getOrganizationByAppId(t))
1789
+ );
1790
+ if (H) {
1791
+ console.error("Failed to fetch organization data:", H), I(!1), S(!0);
1792
+ return;
1793
+ }
1794
+ p.setRegion(J.region);
1795
+ const [j, B] = await rt(nt(E));
1796
+ if (B) {
1797
+ I(!1), S(!0);
1798
+ return;
1799
+ }
1800
+ const F = j.chat_settings.welcome_message;
1801
+ x(j.chat_settings), I(j.chat_settings.is_active ?? !0), F && A((b) => b.length > 0 || b.some((z) => z.isWelcomeMessage) ? b : [ar(F)]), S(!0);
1802
+ })();
1803
+ }, [c, p, t, E]), {
1804
+ userId: l,
1805
+ userName: r,
1806
+ userData: a,
1807
+ externalId: n,
1808
+ deviceId: s,
1809
+ apiClient: p,
1810
+ chatSettings: g,
1811
+ currentChat: R,
1812
+ messages: U,
1813
+ isReady: _,
1814
+ isChatClosed: C,
1815
+ isChatActive: w
1816
+ };
1817
+ }
1818
+ const pt = "(max-width: 640px)";
1819
+ function yr() {
1820
+ return typeof window > "u" ? !1 : window.matchMedia(pt).matches;
1821
+ }
1822
+ function xr(e) {
1823
+ const [t, o] = q(yr), [r, a] = q(
1824
+ null
1825
+ ), l = e ?? t, n = typeof window > "u";
1826
+ return Z(() => {
1827
+ if (n) return;
1828
+ const s = window.matchMedia(pt), c = (i) => {
1829
+ o(i.matches);
1830
+ };
1831
+ return c(s), s.addEventListener("change", c), () => s.removeEventListener("change", c);
1832
+ }, [n]), Z(() => {
1833
+ if (n) return;
1834
+ const s = document.createElement("div");
1835
+ return s.className = "eloquent-ai-chat-portal", s.style.position = "relative", s.style.zIndex = "30", document.body.appendChild(s), a(s), () => {
1836
+ s.parentElement && s.parentElement.removeChild(s);
1837
+ };
1838
+ }, [n]), {
1839
+ isMobileScreen: t,
1840
+ isMobile: l,
1841
+ portalContainer: r
1842
+ };
1843
+ }
1844
+ const kr = 2, _r = (e) => `eloquent-ai:chat-widget-closed-${e}`;
1845
+ function Cr({
1846
+ environment: e,
1847
+ apiUrl: t,
1848
+ appId: o,
1849
+ userId: r,
1850
+ userName: a,
1851
+ userData: l,
1852
+ chatProps: n,
1853
+ isMobile: s,
1854
+ isInitiallyOpen: c,
1855
+ hasCloseButton: i,
1856
+ hasCleanChatButton: d,
1857
+ // Deprecated aliases, kept until hosts migrate to the is/has names above.
1858
+ initialOpen: h,
1859
+ closeButton: u,
1860
+ cleanChatButton: p,
1861
+ proactiveMessageHideDelay: g = 5e3,
1862
+ isAlwaysOpen: x = !1,
1863
+ hasCleanChatButtonOverride: R
1864
+ }) {
1865
+ const { isMobile: y, portalContainer: U } = xr(s), {
1866
+ userId: A,
1867
+ externalId: _,
1868
+ deviceId: S,
1869
+ apiClient: C,
1870
+ chatSettings: f,
1871
+ currentChat: w,
1872
+ messages: I,
1873
+ isReady: Q,
1874
+ isChatClosed: E,
1875
+ isChatActive: P
1876
+ } = qr({
1877
+ apiUrl: t,
1878
+ appId: o,
1879
+ initialUserId: r,
1880
+ userName: a,
1881
+ userData: l
1882
+ }), N = Ot({ chatProps: n, chatSettings: f }), J = c ?? h ?? !1, H = i ?? u ?? !0, j = d ?? p ?? !0, B = _r(o), [F, b] = q(() => x ? !0 : Xe(B) === "true" || y ? !1 : J ?? y), [z, V] = q(!1);
1883
+ Z(() => {
1884
+ if (!Q || z || (V(!0), x)) return;
1885
+ const ne = f?.initial_open;
1886
+ ne != null && (y || ne && Xe(B) === "true" || b(ne));
1887
+ }, [
1888
+ Q,
1889
+ z,
1890
+ f?.initial_open,
1891
+ y,
1892
+ B,
1893
+ x
1894
+ ]);
1895
+ const k = f?.initial_open ?? J, D = f?.close_button ?? H, $ = R ?? f?.clean_chat_button ?? j, G = f?.proactive_message_hide_delay ?? g, ie = v(
1896
+ (ne) => {
1897
+ x || b((Ee) => {
1898
+ const Je = typeof ne == "function" ? ne(Ee) : ne;
1899
+ return Je ? Pt(B) : At(B, "true", kr), Je;
1900
+ });
1901
+ },
1902
+ [B, x]
1903
+ ), ue = yt(F, 400), [se, pe] = q(
1904
+ n?.messages ?? []
1905
+ ), [le, ce] = q(w), [we, ve] = q(!1), [be, qe] = q(I);
1906
+ be !== I && (qe(I), I.length > 0 && pe(I));
1907
+ const [Ue, M] = q(w);
1908
+ Ue !== w && (M(w), w && ce(w));
1909
+ const [ee, Y] = q(E);
1910
+ ee !== E && (Y(E), E && ve(!0));
1911
+ const Ie = v(() => {
1912
+ ve(!0);
1913
+ }, []), [De, $e] = q(!1), ge = Q && f?.auto_display_welcome_message && f?.welcome_message ? f.welcome_message : "", re = {
1914
+ text: ge,
1915
+ isVisible: ge !== "" && !De,
1916
+ autoHideDelay: G
1917
+ }, { onSendMessage: X, onCleanMessages: te, onRateChat: ht } = lr({
1918
+ appId: o,
1919
+ userId: A,
1920
+ userName: a,
1921
+ userData: l,
1922
+ externalId: _,
1923
+ deviceId: S,
1924
+ apiClient: C,
1925
+ chatSettings: f,
1926
+ setMessages: pe,
1927
+ messages: se,
1928
+ currentChat: le,
1929
+ setCurrentChat: ce,
1930
+ onChatClosed: Ie,
1931
+ isChatClosed: we
1932
+ });
1933
+ Z(() => {
1934
+ I.length > 0 && pe(I);
1935
+ }, [I]), Z(() => {
1936
+ w && ce(w);
1937
+ }, [w]);
1938
+ const We = L(null);
1939
+ Z(() => {
1940
+ if (!le || !_ || !C) return;
1941
+ const ne = {
1942
+ userId: A,
1943
+ userName: a,
1944
+ userData: l,
1945
+ externalId: _,
1946
+ deviceId: S,
1947
+ conversationId: le.id
1948
+ }, Ee = JSON.stringify(ne);
1949
+ We.current !== Ee && (We.current = Ee, C.identifyUser(ne));
1950
+ }, [
1951
+ _,
1952
+ A,
1953
+ a,
1954
+ l,
1955
+ S,
1956
+ le,
1957
+ C
1958
+ ]);
1959
+ const gt = v(() => {
1960
+ te(), ve(!1);
1961
+ }, [te]), ft = v(() => {
1962
+ $e(!0);
1963
+ }, []);
1964
+ return {
1965
+ isReady: Q,
1966
+ isChatActive: P,
1967
+ isInitiallyOpen: k,
1968
+ hasCloseButton: D,
1969
+ hasCleanChatButton: $,
1970
+ isMobile: y,
1971
+ chatInterfaceProps: N,
1972
+ chatOpen: F,
1973
+ chatOpenDebounced: ue,
1974
+ messages: se,
1975
+ portalContainer: U,
1976
+ onSendMessage: X,
1977
+ setChatOpen: ie,
1978
+ onCleanMessages: te,
1979
+ proactiveMessage: re,
1980
+ hideProactiveMessage: ft,
1981
+ isChatClosed: we,
1982
+ onStartNewChat: gt,
1983
+ onRateChat: ht
1984
+ };
1985
+ }
1986
+ function Sr(e) {
1987
+ const [t, o] = q(0);
1988
+ return Z(() => {
1989
+ const r = window.visualViewport;
1990
+ if (!e || !r) {
1991
+ o(0);
1992
+ return;
1993
+ }
1994
+ const a = () => {
1995
+ const l = window.innerHeight - r.height - r.offsetTop;
1996
+ o(Math.max(0, Math.round(l)));
1997
+ };
1998
+ return a(), r.addEventListener("resize", a), r.addEventListener("scroll", a), () => {
1999
+ r.removeEventListener("resize", a), r.removeEventListener("scroll", a), o(0);
2000
+ };
2001
+ }, [e]), t;
2002
+ }
2003
+ function Ir(e) {
2004
+ Z(() => {
2005
+ if (!e) return;
2006
+ const { body: t } = document, o = window.scrollY, r = {
2007
+ position: t.style.position,
2008
+ top: t.style.top,
2009
+ left: t.style.left,
2010
+ right: t.style.right,
2011
+ overflow: t.style.overflow
2012
+ };
2013
+ return t.style.position = "fixed", t.style.top = `-${o}px`, t.style.left = "0", t.style.right = "0", t.style.overflow = "hidden", () => {
2014
+ t.style.position = r.position, t.style.top = r.top, t.style.left = r.left, t.style.right = r.right, t.style.overflow = r.overflow, window.scrollTo(0, o);
2015
+ };
2016
+ }, [e]);
2017
+ }
2018
+ function Er() {
2019
+ const [e, t] = q(!1), [o, r] = q(null), a = L(null), l = L(null), n = v((c = "...") => {
2020
+ const i = () => {
2021
+ r(c), t(!0), l.current = null, a.current && clearTimeout(a.current), a.current = setTimeout(() => {
2022
+ a.current = null, l.current && i();
2023
+ }, 1e3);
2024
+ };
2025
+ a.current ? l.current = c : i();
2026
+ }, []), s = v(() => {
2027
+ a.current && (clearTimeout(a.current), a.current = null), l.current = null, t(!1), r(null);
2028
+ }, []);
2029
+ return {
2030
+ isVisible: e,
2031
+ content: o,
2032
+ showCognition: n,
2033
+ hideCognition: s
2034
+ };
2035
+ }
2036
+ function zr({
2037
+ children: e
2038
+ }) {
2039
+ const t = Er();
2040
+ return /* @__PURE__ */ m(xt.Provider, { value: t, children: e });
2041
+ }
2042
+ const Rr = ({ children: e }) => {
2043
+ const [t, o] = q(null), [r, a] = q(!1), l = _t(o), i = {
2044
+ error: t,
2045
+ hideSdk: r,
2046
+ publishApiError: l,
2047
+ publishError: (d) => o(d),
2048
+ publishNetworkError: () => a(!0),
2049
+ clearError: () => o(null)
2050
+ };
2051
+ return /* @__PURE__ */ m(kt.Provider, { value: i, children: e });
2052
+ }, Tr = 100;
2053
+ function Mr({
2054
+ appId: e,
2055
+ userId: t,
2056
+ userName: o,
2057
+ userData: r,
2058
+ chatProps: a,
2059
+ proactiveMessageHideDelay: l = 5e3,
2060
+ isMobile: n,
2061
+ hasCloseButton: s,
2062
+ hasCleanChatButton: c,
2063
+ isInitiallyOpen: i,
2064
+ // Deprecated aliases, resolved in useChat (new name wins).
2065
+ closeButton: d,
2066
+ cleanChatButton: h,
2067
+ initialOpen: u,
2068
+ INTERNAL_ONLY_CHAT_INTERFACE_ONLY: p = !1,
2069
+ INTERNAL_ONLY_SHOW_CLEAN_CHAT_BUTTON: g = void 0,
2070
+ INTERNAL_ONLY_BLOCK_STYLE: x = !1,
2071
+ INTERNAL_ONLY_FEATURE_MESSAGE_CLICK: R = void 0,
2072
+ INTERNAL_ONLY_FEATURE_CLEAR_CHAT_CLICK: y = void 0,
2073
+ INTERNAL_ONLY_SHOW_COPY_BUTTON: U = !1,
2074
+ INTERNAL_ONLY_ENVIRONMENT: A = "live",
2075
+ INTERNAL_ONLY_API_URL: _
2076
+ }) {
2077
+ const { hideSdk: S } = Ae(), {
2078
+ isReady: C,
2079
+ isChatActive: f,
2080
+ isInitiallyOpen: w,
2081
+ hasCloseButton: I,
2082
+ hasCleanChatButton: Q,
2083
+ isMobile: E,
2084
+ chatOpen: P,
2085
+ chatInterfaceProps: N,
2086
+ chatOpenDebounced: J,
2087
+ messages: H,
2088
+ portalContainer: j,
2089
+ onSendMessage: B,
2090
+ setChatOpen: F,
2091
+ proactiveMessage: b,
2092
+ hideProactiveMessage: z,
2093
+ isChatClosed: V,
2094
+ onStartNewChat: k,
2095
+ onRateChat: D
2096
+ } = Cr({
2097
+ environment: A,
2098
+ apiUrl: _,
2099
+ appId: e,
2100
+ userId: t,
2101
+ userName: o,
2102
+ userData: r,
2103
+ chatProps: a,
2104
+ isMobile: n,
2105
+ isInitiallyOpen: i,
2106
+ hasCloseButton: s,
2107
+ hasCleanChatButton: c,
2108
+ initialOpen: u,
2109
+ closeButton: d,
2110
+ cleanChatButton: h,
2111
+ proactiveMessageHideDelay: l,
2112
+ // Embedded: the interface is the page content with no launcher to reopen
2113
+ // it, so nothing (boot initial_open, closed-cookie, props) may close it.
2114
+ isAlwaysOpen: p,
2115
+ hasCleanChatButtonOverride: g
2116
+ }), $ = Sr(E && P);
2117
+ Ir(E && P);
2118
+ const G = !C;
2119
+ if (S || G && !p || !G && !f) return null;
2120
+ const ie = () => /* @__PURE__ */ _e(
2121
+ "div",
2122
+ {
2123
+ style: {
2124
+ WebkitTouchCallout: "none",
2125
+ WebkitUserSelect: "none",
2126
+ KhtmlUserSelect: "none",
2127
+ MozUserSelect: "none",
2128
+ msUserSelect: "none",
2129
+ userSelect: "none",
2130
+ position: "fixed",
2131
+ right: 12,
2132
+ bottom: 4,
2133
+ ...x ? { position: "relative", inset: 0, width: "100%", height: "100%" } : {}
2134
+ },
2135
+ children: [
2136
+ /* @__PURE__ */ m("style", { children: zt }),
2137
+ /* @__PURE__ */ m(
2138
+ je,
2139
+ {
2140
+ className: "eloquentai-chat-messaging",
2141
+ head: /* @__PURE__ */ _e(Ge, { children: [
2142
+ /* @__PURE__ */ m("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }),
2143
+ /* @__PURE__ */ m("link", { rel: "preconnect", href: "https://fonts.gstatic.com" }),
2144
+ /* @__PURE__ */ m(
2145
+ "link",
2146
+ {
2147
+ href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap",
2148
+ rel: "stylesheet"
2149
+ }
2150
+ ),
2151
+ /* @__PURE__ */ m("style", { children: Ne })
2152
+ ] }),
2153
+ style: {
2154
+ display: P || J ? "block" : "none",
2155
+ width: E ? "100vw" : "400px",
2156
+ // 100dvh accounts for mobile browser chrome (e.g. address bar); 100vh fallback for older browsers
2157
+ "--chat-mobile-viewport-height": "100dvh",
2158
+ height: E ? "var(--chat-mobile-viewport-height, 100vh)" : "700px",
2159
+ maxHeight: E ? "var(--chat-mobile-viewport-height, 100vh)" : `calc(100% - ${Tr}px)`,
2160
+ border: "none",
2161
+ zIndex: 2147483e3,
2162
+ position: "fixed",
2163
+ top: E ? 0 : void 0,
2164
+ left: E ? 0 : void 0,
2165
+ right: E ? 0 : 16,
2166
+ bottom: E ? 0 : 16,
2167
+ ...x ? {
2168
+ position: "relative",
2169
+ top: 0,
2170
+ left: 0,
2171
+ right: 0,
2172
+ bottom: 0,
2173
+ width: "100%",
2174
+ height: "100%",
2175
+ maxHeight: "100%",
2176
+ zIndex: 0
2177
+ } : {}
2178
+ },
2179
+ children: G ? (
2180
+ // Only reachable in embedded mode (the launcher returns null while
2181
+ // booting): hold the widget's frame with a skeleton so a remount —
2182
+ // project/environment switch in the host app — doesn't flash an
2183
+ // empty hole where the chat was.
2184
+ /* @__PURE__ */ m(Ct, { isOpen: !0, isMobile: E, skipAnimation: !0 })
2185
+ ) : /* @__PURE__ */ m(
2186
+ St,
2187
+ {
2188
+ ...N,
2189
+ hasIntroAnimation: !p,
2190
+ isTestMode: A === "test",
2191
+ isOpen: P,
2192
+ keyboardInset: $,
2193
+ messages: H,
2194
+ onSendMessage: B,
2195
+ onMessageClick: R,
2196
+ isMobile: E,
2197
+ hasCloseButton: I,
2198
+ hasCleanChatButton: Q,
2199
+ hasCopyButton: U,
2200
+ isChatClosed: V,
2201
+ onStartNewChat: k,
2202
+ onRateChat: D,
2203
+ onClose: () => F(!1),
2204
+ onCleanChat: () => {
2205
+ k(), y?.();
2206
+ }
2207
+ }
2208
+ )
2209
+ }
2210
+ ),
2211
+ !p && /* @__PURE__ */ m(
2212
+ je,
2213
+ {
2214
+ className: "eloquentai-chat-launcher",
2215
+ head: /* @__PURE__ */ m("style", { children: Ne }),
2216
+ style: {
2217
+ position: "fixed",
2218
+ bottom: 17,
2219
+ right: 17,
2220
+ display: "block",
2221
+ width: 48,
2222
+ height: 48,
2223
+ border: "none",
2224
+ zIndex: E ? 2147482999 : 2147483e3,
2225
+ opacity: P ? 0 : 1,
2226
+ pointerEvents: P ? "none" : "auto",
2227
+ transition: P ? "opacity 100ms ease-in" : "opacity 200ms ease-out 320ms"
2228
+ },
2229
+ children: /* @__PURE__ */ m(
2230
+ Rt,
2231
+ {
2232
+ isOpen: P,
2233
+ toggleBubble: () => F((se) => !se),
2234
+ isDarkMode: N?.theme?.mode === "dark"
2235
+ }
2236
+ )
2237
+ }
2238
+ ),
2239
+ N?.displayWelcomeMessages ? /* @__PURE__ */ m(
2240
+ je,
2241
+ {
2242
+ className: "eloquentai-chat-proactive-message",
2243
+ head: /* @__PURE__ */ m("style", { children: Ne }),
2244
+ style: {
2245
+ position: "fixed",
2246
+ // Aligns the bubble's tail with the launcher's center: the
2247
+ // launcher circle is 48px tall at bottom:17, so its center is
2248
+ // ~41px up; the tail sits ~16px above this iframe's bottom.
2249
+ bottom: 24,
2250
+ right: 17
2251
+ },
2252
+ children: /* @__PURE__ */ m(It, { ...N?.theme ?? {}, children: /* @__PURE__ */ m(
2253
+ "div",
2254
+ {
2255
+ className: He("eloq:w-full eloq:h-full", {
2256
+ dark: N?.theme?.mode === "dark"
2257
+ }),
2258
+ children: b && !w && /* @__PURE__ */ m(
2259
+ Mt,
2260
+ {
2261
+ message: b.text,
2262
+ isVisible: b.isVisible,
2263
+ onDismiss: z,
2264
+ onMessageClick: () => {
2265
+ F(!0), z();
2266
+ },
2267
+ autoHideDelay: b.autoHideDelay
2268
+ }
2269
+ )
2270
+ }
2271
+ ) })
2272
+ }
2273
+ ) : null
2274
+ ]
2275
+ }
2276
+ );
2277
+ return /* @__PURE__ */ m(Ge, { children: x ? ie() : j ? /* @__PURE__ */ m(Tt, { container: j, children: ie() }) : null });
2278
+ }
2279
+ function Ar(e) {
2280
+ return /* @__PURE__ */ m(Rr, { children: /* @__PURE__ */ m(zr, { children: /* @__PURE__ */ m(Mr, { ...e }) }) });
2281
+ }
2282
+ function Nr(e, t) {
2283
+ return ((r, a, l) => {
2284
+ const n = Et.createRoot(a);
2285
+ return n.render(/* @__PURE__ */ m(r, { ...l })), n.unmount;
2286
+ })(Ar, e, t);
2287
+ }
7
2288
  export {
8
- n as Chat,
9
- s as ChatInterface,
10
- r as renderChat,
11
- f as useRealtimeSocket
2289
+ Ar as Chat,
2290
+ St as ChatInterface,
2291
+ Nr as renderChat,
2292
+ rr as useRealtimeSocket
12
2293
  };
13
2294
  //# sourceMappingURL=index.mjs.map