@thewhatmatters/wmds 0.4.2 → 0.4.4

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 (157) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/CONSUMING.md +2 -2
  3. package/bin/wmds-check.mjs +108 -10
  4. package/dist/components/organisms/ChatDock/ChatDock.d.ts +21 -15
  5. package/dist/components/organisms/ChatDock/ChatDock.d.ts.map +1 -1
  6. package/dist/components/organisms/ChatDock/ChatDock.js +418 -423
  7. package/dist/components/organisms/ChatDock/ChatDockGate.d.ts +21 -10
  8. package/dist/components/organisms/ChatDock/ChatDockGate.d.ts.map +1 -1
  9. package/dist/components/organisms/ChatDock/ChatDockGate.js +124 -118
  10. package/dist/components/organisms/ChatDock/chatDockGateContext.d.ts +12 -0
  11. package/dist/components/organisms/ChatDock/chatDockGateContext.d.ts.map +1 -0
  12. package/dist/components/organisms/ChatDock/chatDockGateContext.js +9 -0
  13. package/dist/components/organisms/ChatDock/chatDockGateStyles.d.ts +21 -9
  14. package/dist/components/organisms/ChatDock/chatDockGateStyles.d.ts.map +1 -1
  15. package/dist/components/organisms/ChatDock/chatDockGateStyles.js +2 -3
  16. package/dist/components/organisms/ChatDock/chatDockStyles.d.ts +6 -6
  17. package/dist/components/organisms/ChatDock/chatDockStyles.d.ts.map +1 -1
  18. package/dist/components/organisms/ChatDock/chatDockStyles.js +2 -2
  19. package/dist/components/organisms/ChatDock/chatDockViewport.d.ts +6 -0
  20. package/dist/components/organisms/ChatDock/chatDockViewport.d.ts.map +1 -1
  21. package/dist/components/organisms/ChatDock/chatDockViewport.js +14 -1
  22. package/dist/components/organisms/Toast/Toast.d.ts.map +1 -1
  23. package/dist/components/organisms/Toast/Toast.js +11 -5
  24. package/dist/lib/dialogOverlay.d.ts.map +1 -1
  25. package/dist/lib/dialogOverlay.js +18 -15
  26. package/dist/styles.css +1 -1
  27. package/docs/component-contracts.md +4 -2
  28. package/docs/components.md +5 -5
  29. package/docs/exports.json +1 -1
  30. package/docs/patterns/components-accordion--flush.tsx +1 -1
  31. package/docs/patterns/components-avatar--dropdown-row.tsx +1 -1
  32. package/docs/patterns/components-badge--outline-tags.tsx +1 -1
  33. package/docs/patterns/components-badge--with-avatar.tsx +1 -1
  34. package/docs/patterns/components-breadcrumb--editorial.tsx +1 -1
  35. package/docs/patterns/components-breadcrumb--long-path.tsx +1 -1
  36. package/docs/patterns/components-breadcrumb--path.tsx +1 -1
  37. package/docs/patterns/components-breadcrumb--router-links.tsx +1 -1
  38. package/docs/patterns/components-button-button--copy-button.tsx +1 -1
  39. package/docs/patterns/components-button-button--destructive-action.tsx +1 -1
  40. package/docs/patterns/components-button-button--external-link.tsx +1 -1
  41. package/docs/patterns/components-button-button--ghost-action.tsx +1 -1
  42. package/docs/patterns/components-button-button--inverse-action.tsx +1 -1
  43. package/docs/patterns/components-button-button--link-render.tsx +1 -1
  44. package/docs/patterns/components-button-button--multi-state-badge.tsx +1 -1
  45. package/docs/patterns/components-button-button--outline-mono.tsx +1 -1
  46. package/docs/patterns/components-button-button--primary-action.tsx +1 -1
  47. package/docs/patterns/components-button-button--row-hug.tsx +1 -1
  48. package/docs/patterns/components-button-button--row-layout.tsx +1 -1
  49. package/docs/patterns/components-button-button--secondary-action.tsx +1 -1
  50. package/docs/patterns/components-button-button--suggestion-pills.tsx +1 -1
  51. package/docs/patterns/components-button-button--with-count.tsx +1 -1
  52. package/docs/patterns/components-button-button--with-icon.tsx +1 -1
  53. package/docs/patterns/components-button-floatingactionbutton--vertical-actions.tsx +1 -1
  54. package/docs/patterns/components-calembed--pattern-skip-in-footer.tsx +1 -1
  55. package/docs/patterns/components-card-card--body-slot-occupancy-history.tsx +1 -1
  56. package/docs/patterns/components-card-card--headerless-media.tsx +1 -1
  57. package/docs/patterns/components-card-card--outlined-layout.tsx +1 -1
  58. package/docs/patterns/components-card-card--pinned-height.tsx +1 -1
  59. package/docs/patterns/components-card-selectablecard--selectable-cards-pattern.tsx +1 -1
  60. package/docs/patterns/components-chart--audience-activity-heatmap.tsx +1 -1
  61. package/docs/patterns/components-chart--cartesian-no-data-gaps.tsx +1 -1
  62. package/docs/patterns/components-chart--occupancy-history-in-card.tsx +1 -1
  63. package/docs/patterns/components-chart--occupancy-in-card.tsx +1 -1
  64. package/docs/patterns/components-chart--post-reach-distribution.tsx +1 -1
  65. package/docs/patterns/components-chart--ranked-audience-breakdown.tsx +1 -1
  66. package/docs/patterns/components-chart--unit-grid-composition.tsx +1 -1
  67. package/docs/patterns/components-chatdock--pattern-chat-dock.tsx +3 -2
  68. package/docs/patterns/components-chatdock--pattern-start-project-gate.tsx +54 -11
  69. package/docs/patterns/components-chatqa--pattern-qa-with-reply.tsx +1 -1
  70. package/docs/patterns/components-checkbox-checkbox--default.tsx +1 -1
  71. package/docs/patterns/components-checkbox-checkbox--with-count.tsx +1 -1
  72. package/docs/patterns/components-checkbox-checkbox--with-description.tsx +1 -1
  73. package/docs/patterns/components-checkbox-checkboxgroup--default.tsx +1 -1
  74. package/docs/patterns/components-checkbox-checkboxgroup--option-counts.tsx +1 -1
  75. package/docs/patterns/components-descriptionlist--details.tsx +1 -1
  76. package/docs/patterns/components-descriptionlist--post-metadata.tsx +1 -1
  77. package/docs/patterns/components-dialog--alert-dialog-destructive.tsx +1 -1
  78. package/docs/patterns/components-dialog--default-dialog.tsx +1 -1
  79. package/docs/patterns/components-dialog--form-dialog.tsx +1 -1
  80. package/docs/patterns/components-displaycontrols--page-utilities.tsx +1 -1
  81. package/docs/patterns/components-field--horizontal-input.tsx +1 -1
  82. package/docs/patterns/components-field--horizontal-text-area.tsx +1 -1
  83. package/docs/patterns/components-field--multi-control.tsx +1 -1
  84. package/docs/patterns/components-footerreveal--marketing-hero-pattern.tsx +1 -1
  85. package/docs/patterns/components-footerreveal--marketing-hero-ruled-pattern.tsx +1 -1
  86. package/docs/patterns/components-footerreveal--marketing-hero-with-gallery-intro.tsx +1 -1
  87. package/docs/patterns/components-footerreveal--marketing-page-pattern.tsx +1 -1
  88. package/docs/patterns/components-footerreveal--ruled-grid-footer-pattern.tsx +1 -1
  89. package/docs/patterns/components-footerreveal--sequenced-marketing-hero.tsx +1 -1
  90. package/docs/patterns/components-herointro--two-line-intro.tsx +1 -1
  91. package/docs/patterns/components-herotilestack--marketing-hero-pattern.tsx +1 -1
  92. package/docs/patterns/components-herotilestack--marketing-hero-text-sequence.tsx +1 -1
  93. package/docs/patterns/components-herotilestack--marketing-hero-with-gallery-intro.tsx +1 -1
  94. package/docs/patterns/components-indexlist--post-index.tsx +1 -1
  95. package/docs/patterns/components-intakeconfirmation--booked-pattern.tsx +1 -1
  96. package/docs/patterns/components-intakeconfirmation--emailed-pattern.tsx +1 -1
  97. package/docs/patterns/components-intakeform--about-you-pattern.tsx +1 -1
  98. package/docs/patterns/components-intakemodal--intake-modal-pattern.tsx +1 -1
  99. package/docs/patterns/components-kbd--command-row.tsx +1 -1
  100. package/docs/patterns/components-kbd--numbered-choices.tsx +1 -1
  101. package/docs/patterns/components-kbd--shortcut.tsx +1 -1
  102. package/docs/patterns/components-moremenu--action-menu.tsx +1 -1
  103. package/docs/patterns/components-moremenu--in-card-header.tsx +1 -1
  104. package/docs/patterns/components-navlist--side-nav-settings.tsx +1 -1
  105. package/docs/patterns/components-pageheader--app-header-pattern.tsx +1 -1
  106. package/docs/patterns/components-pageheader--page-section-header.tsx +1 -1
  107. package/docs/patterns/components-pageheader--toolbar-header.tsx +1 -1
  108. package/docs/patterns/components-panel--end-detail-rail.tsx +1 -1
  109. package/docs/patterns/components-pillgroup--pill-group-pattern.tsx +1 -1
  110. package/docs/patterns/components-promptbar--pattern-prompt-bar.tsx +1 -1
  111. package/docs/patterns/components-prose--article-body.tsx +1 -1
  112. package/docs/patterns/components-radio-radiogroup--default.tsx +1 -1
  113. package/docs/patterns/components-scrollhorizontal--project-gallery-pattern.tsx +1 -1
  114. package/docs/patterns/components-scrollhorizontal--with-intro.tsx +1 -1
  115. package/docs/patterns/components-sectioncaption--column-caption.tsx +1 -1
  116. package/docs/patterns/components-sectioncaption--with-action.tsx +1 -1
  117. package/docs/patterns/components-sheet--bottom-sheet.tsx +1 -1
  118. package/docs/patterns/components-sheet--end-sheet.tsx +1 -1
  119. package/docs/patterns/components-sitenav--brand-and-cta.tsx +1 -1
  120. package/docs/patterns/components-sitenav--centered-links.tsx +1 -1
  121. package/docs/patterns/components-sitenav--compact.tsx +1 -1
  122. package/docs/patterns/components-sitenav--marketing-header.tsx +1 -1
  123. package/docs/patterns/components-sitenav--mega-menu.tsx +1 -1
  124. package/docs/patterns/components-stat--insights-row.tsx +1 -1
  125. package/docs/patterns/components-stepprogress--step-progress-pattern.tsx +1 -1
  126. package/docs/patterns/components-switch--default.tsx +1 -1
  127. package/docs/patterns/components-switch--settings-row.tsx +1 -1
  128. package/docs/patterns/components-tab--settings-pages.tsx +1 -1
  129. package/docs/patterns/components-taskrows--action-details.tsx +1 -1
  130. package/docs/patterns/components-taskrows--capsules.tsx +1 -1
  131. package/docs/patterns/components-taskrows--card-with-status-rows.tsx +1 -1
  132. package/docs/patterns/components-taskrows--controlled-expand.tsx +1 -1
  133. package/docs/patterns/components-taskrows--custom-slots.tsx +1 -1
  134. package/docs/patterns/components-taskrows--status-list.tsx +1 -1
  135. package/docs/patterns/components-taskrows--tag-chips.tsx +1 -1
  136. package/docs/patterns/components-textlink--external-destination.tsx +1 -1
  137. package/docs/patterns/components-textlink--inline-prose.tsx +1 -1
  138. package/docs/patterns/components-textlink--quiet-title.tsx +1 -1
  139. package/docs/patterns/components-textlink--supporting-copy.tsx +1 -1
  140. package/docs/patterns/components-textsequence--default.tsx +1 -1
  141. package/docs/patterns/components-textsequence--reduced-motion.tsx +1 -1
  142. package/docs/patterns/components-textsequence--shapes.tsx +1 -1
  143. package/docs/patterns/components-toast--stacked-notifications.tsx +1 -1
  144. package/docs/patterns/components-tooltip--controlled.tsx +1 -1
  145. package/docs/patterns/components-tooltip--disabled-control.tsx +1 -1
  146. package/docs/patterns/components-tooltip--icon-action.tsx +1 -1
  147. package/docs/patterns/components-tooltip--keyboard-shortcut.tsx +1 -1
  148. package/docs/patterns/components-tooltip--placement.tsx +1 -1
  149. package/docs/patterns/foundations-scroll-fade--horizontal-rail.tsx +1 -1
  150. package/docs/patterns/foundations-scroll-fade--overflowing-list.tsx +1 -1
  151. package/docs/patterns/guides-chart-explorations--comparison-gallery.tsx +1 -1
  152. package/docs/patterns/guides-filter-panel--filtered-index.tsx +41 -17
  153. package/docs/patterns/guides-overlay-flows--notification-preferences.tsx +1 -1
  154. package/docs/patterns/guides-post-page--post-page.tsx +34 -4
  155. package/docs/patterns/guides-profile-typography--editorial-profile.tsx +1 -1
  156. package/docs/patterns/index.json +1 -1
  157. package/package.json +1 -1
@@ -1,21 +1,22 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../../lib/cn.js";
3
- import { motionBeatSeconds as t, motionStaggerSeconds as n, motionTransitionProp as r, readMotionDurationSeconds as i } from "../../../lib/motion.js";
4
- import { ButtonIcon as a } from "../../atoms/Button/ButtonIcon.js";
5
- import { Button as o } from "../../atoms/Button/Button.js";
6
- import { IconButton as s } from "../../atoms/IconButton/IconButton.js";
3
+ import { motionBeatSeconds as t, motionStaggerSeconds as n, motionTransitionProp as r } from "../../../lib/motion.js";
4
+ import { ButtonIcon as i } from "../../atoms/Button/ButtonIcon.js";
5
+ import { Button as a } from "../../atoms/Button/Button.js";
6
+ import { IconButton as o } from "../../atoms/IconButton/IconButton.js";
7
7
  import { Status as ee } from "../../atoms/Status/Status.js";
8
8
  import { PromptBar as te } from "../../molecules/PromptBar/PromptBar.js";
9
9
  import { OverlayPanelHeader as ne } from "../Dialog/OverlayPanelHeader.js";
10
- import { subscribeChatDockViewport as re, useChatDockVisibleArea as ie, useChatDockWide as ae } from "./chatDockViewport.js";
11
- import { ChatDockGate as c, chatDockGateDefaultLabels as l } from "./ChatDockGate.js";
12
- import { chatDockAssistantMessageClasses as u, chatDockComposerAreaClasses as oe, chatDockComposerClasses as se, chatDockComposerFootSpacerClasses as ce, chatDockComposerLayerClasses as le, chatDockDisclaimerClasses as ue, chatDockDockClasses as de, chatDockDockHoverClasses as fe, chatDockFollowUpRowClasses as pe, chatDockFollowUpsComposerClasses as me, chatDockFollowUpsInlineClasses as he, chatDockGridClasses as ge, chatDockMarkClasses as _e, chatDockPillClasses as ve, chatDockPillsClasses as ye, chatDockPlacements as d, chatDockReplyActionsClasses as be, chatDockReplyActionsPendingClasses as xe, chatDockReplyButtonsClasses as Se, chatDockReplyClasses as Ce, chatDockReplyMetaClasses as we, chatDockRootClasses as Te, chatDockRootRaisedClasses as Ee, chatDockSuggestionLabelClasses as De, chatDockSuggestionListClasses as Oe, chatDockSuggestionRowContentClasses as ke, chatDockThinkingClasses as Ae, chatDockThreadClasses as je, chatDockUserMessageClasses as Me, chatDockWindowClasses as Ne, chatDockWindowContentClasses as Pe } from "./chatDockStyles.js";
13
- import { useContext as Fe, useEffect as f, useId as Ie, useLayoutEffect as p, useRef as m, useState as h, useSyncExternalStore as Le } from "react";
14
- import { Check as Re, Copy as ze, CornerDownRight as Be, ThumbsDown as Ve, ThumbsUp as He } from "lucide-react";
15
- import { Fragment as Ue, jsx as g, jsxs as _ } from "react/jsx-runtime";
16
- import { AnimatePresence as v, MotionConfigContext as We, motion as y, useReducedMotion as Ge } from "motion/react";
10
+ import { ChatDockGateContext as re } from "./chatDockGateContext.js";
11
+ import { subscribeChatDockViewport as ie, useChatDockReducedMotion as ae, useChatDockVisibleArea as oe, useChatDockWide as se } from "./chatDockViewport.js";
12
+ import { ChatDockGate as s, chatDockGateDefaultLabels as ce } from "./ChatDockGate.js";
13
+ import { chatDockAssistantMessageClasses as le, chatDockComposerClasses as ue, chatDockComposerFootSpacerClasses as de, chatDockDisclaimerClasses as fe, chatDockDockClasses as pe, chatDockDockHoverClasses as me, chatDockFollowUpRowClasses as he, chatDockFollowUpsComposerClasses as ge, chatDockFollowUpsInlineClasses as _e, chatDockGateSlotClasses as ve, chatDockGridClasses as ye, chatDockMarkClasses as be, chatDockPillClasses as xe, chatDockPillsClasses as Se, chatDockPlacements as c, chatDockReplyActionsClasses as Ce, chatDockReplyActionsPendingClasses as we, chatDockReplyButtonsClasses as Te, chatDockReplyClasses as Ee, chatDockReplyMetaClasses as De, chatDockRootClasses as Oe, chatDockRootRaisedClasses as ke, chatDockSuggestionLabelClasses as Ae, chatDockSuggestionListClasses as je, chatDockSuggestionRowContentClasses as Me, chatDockThinkingClasses as Ne, chatDockThreadClasses as Pe, chatDockThreadContentClasses as Fe, chatDockUserMessageClasses as Ie, chatDockWindowClasses as Le, chatDockWindowContentClasses as Re } from "./chatDockStyles.js";
14
+ import { useContext as ze, useEffect as l, useId as Be, useLayoutEffect as u, useRef as d, useState as f, useSyncExternalStore as Ve } from "react";
15
+ import { Check as He, Copy as Ue, CornerDownRight as We, ThumbsDown as Ge, ThumbsUp as Ke } from "lucide-react";
16
+ import { Fragment as qe, jsx as p, jsxs as m } from "react/jsx-runtime";
17
+ import { AnimatePresence as h, MotionConfigContext as Je, motion as g } from "motion/react";
17
18
  //#region src/components/organisms/ChatDock/ChatDock.tsx
18
- var Ke = {
19
+ var Ye = {
19
20
  close: "Close chat",
20
21
  thinking: "Thinking…",
21
22
  conversation: "Conversation",
@@ -26,19 +27,20 @@ var Ke = {
26
27
  copy: "Copy reply",
27
28
  copied: "Copied",
28
29
  helpful: "Mark this reply helpful",
29
- notHelpful: "Mark this reply not helpful"
30
- }, b = ["inline", "composer"];
31
- function qe(e) {
30
+ notHelpful: "Mark this reply not helpful",
31
+ gatePlaceholder: "Finish or cancel the form to keep chatting"
32
+ }, Xe = ["inline", "composer"];
33
+ function Ze(e) {
32
34
  return e.filter((e) => e.prompt != null && e.prompt.trim() !== "");
33
35
  }
34
- function Je(e, t) {
36
+ function Qe(e, t) {
35
37
  return e.length > 0 && t.length === 0;
36
38
  }
37
- function Ye({ followUps: e, messages: t, thinking: n, sentAfterId: r }) {
39
+ function $e({ followUps: e, messages: t, thinking: n, sentAfterId: r }) {
38
40
  let i = t[t.length - 1];
39
41
  return e.length > 0 && !n && i?.role === "assistant" && i.id !== r;
40
42
  }
41
- function Xe({ message: e, isLatest: t, thinking: n, takesVotes: r }) {
43
+ function et({ message: e, isLatest: t, thinking: n, takesVotes: r }) {
42
44
  if (e.role !== "assistant") return null;
43
45
  let i = {
44
46
  copy: e.copyText != null,
@@ -50,189 +52,214 @@ function Xe({ message: e, isLatest: t, thinking: n, takesVotes: r }) {
50
52
  ready: !(t && n)
51
53
  };
52
54
  }
53
- var Ze = 2e3, Qe = 48;
54
- function $e() {
55
+ var tt = 2e3, nt = 48;
56
+ function rt() {
55
57
  return window.innerHeight;
56
58
  }
57
- function et() {
59
+ function it() {
58
60
  return Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
59
61
  }
60
- function x(e, t, n) {
62
+ function at(e, t, n) {
61
63
  return e === "inline" ? 32 * n : Math.max(0, Math.min(40 * n, t - 7 * n));
62
64
  }
63
- var S = 7, C = 12;
64
- function tt({ windowHeight: e, headerHeight: t, bottomInset: n, remPx: r }) {
65
- let i = r + t + .75 * r + S * r + .75 * r + n;
66
- return Math.round(Math.max(C * r, e - i));
65
+ function ot({ normal: e, needed: t, max: n }) {
66
+ return Math.round(Math.max(e, Math.min(n, t)));
67
67
  }
68
- function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thinking: C = !1, suggestions: w = [], onSend: nt, onSuggestionSelect: rt, followUps: T = [], followUpsPlacement: it = "inline", onMessageFeedback: at, gate: ot, open: st, defaultOpen: ct = !1, onOpenChange: lt, placeholder: ut, disclaimer: E, labels: dt, placement: D = "fixed", className: ft }) {
69
- let O = {
70
- ...Ke,
71
- ...dt
72
- }, pt = Ie(), mt = Ie(), { reducedMotion: ht } = Fe(We), k = Ge() === !0 || ht === "always", A = ae(), gt = Le(re, $e, () => 800), j = Le(re, et, () => 16), _t = st !== void 0, [vt, yt] = h(ct), M = _t ? st : vt, [bt, xt] = h(""), [St, Ct] = h(null), [N, wt] = h(null), [Tt, Et] = h(!M);
73
- M && Tt && Et(!1);
74
- let P = !M && Tt, F = ot != null, I = F && M, [Dt, Ot] = h(I), [L, R] = h(!1);
75
- Dt !== I && (Ot(I), R(!0));
76
- let [kt, At] = h(null), [jt, Mt] = h(!I);
77
- I && jt && Mt(!1);
78
- let [Nt, Pt] = h(I);
79
- !I && Nt && Pt(!1);
80
- let z = ie(D === "fixed" && !A && !P), B = m(null), Ft = m(null), It = m(null), Lt = m(null), Rt = m(null), V = m(null), zt = m(null), Bt = m(F), H = m(I), U = m(null), Vt = m(null), Ht = m(!0), W = m(!1), Ut = m(M), Wt = m(M);
81
- function G(e) {
82
- e !== M && (_t || yt(e), lt?.(e));
68
+ var st = 900;
69
+ function ct(e, t) {
70
+ e != null && t != null && (t.offsetHeight <= e.clientHeight ? e.scrollTop = e.scrollHeight : e.scrollTop += t.getBoundingClientRect().top - e.getBoundingClientRect().top);
71
+ }
72
+ function _({ title: s, subtitle: ce, mark: c, greeting: Xe, messages: _ = [], thinking: v = !1, suggestions: y = [], onSend: lt, onSuggestionSelect: ut, followUps: b = [], followUpsPlacement: dt = "inline", onMessageFeedback: ft, gate: pt, gateSubtitle: mt, open: ht, defaultOpen: gt = !1, onOpenChange: _t, placeholder: vt, disclaimer: x, labels: yt, placement: S = "fixed", className: bt }) {
73
+ let C = {
74
+ ...Ye,
75
+ ...yt
76
+ }, xt = Be(), St = Be(), { reducedMotion: Ct } = ze(Je), w = ae(Ct), T = se(), wt = Ve(ie, rt, () => 800), E = Ve(ie, it, () => 16), Tt = ht !== void 0, [Et, Dt] = f(gt), D = Tt ? ht : Et, [Ot, kt] = f(""), [At, jt] = f(null), [O, Mt] = f(null), [Nt, Pt] = f(!D);
77
+ D && Nt && Pt(!1);
78
+ let k = !D && Nt, A = pt != null, j = A && D, [Ft, It] = f(null), M = oe(S === "fixed" && !T && !k), N = d(null), Lt = d(null), Rt = d(null), zt = d(null), P = d(null), Bt = d(null), Vt = d(null), F = d(null), Ht = d(0), Ut = d(A), I = d(A), L = d(j), R = d(null), z = d(null), B = d(!0), V = d(!1), H = d(D), U = d(D);
79
+ function W(e) {
80
+ e !== D && (Tt || Dt(e), _t?.(e));
83
81
  }
84
- function Gt(e) {
82
+ function Wt(e) {
85
83
  let t = e.trim();
86
- t !== "" && (G(!0), Ht.current = !0, xt(""), Ct(S[S.length - 1]?.id ?? null), nt(t));
84
+ t !== "" && (W(!0), B.current = !0, kt(""), jt(_[_.length - 1]?.id ?? null), lt(t));
87
85
  }
88
- function Kt(e) {
89
- rt?.(e), e.prompt != null && Gt(e.prompt);
86
+ function G(e) {
87
+ ut?.(e), e.prompt != null && Wt(e.prompt);
90
88
  }
91
- function qt(e) {
89
+ function Gt(e) {
92
90
  let t = e.copyText, n = typeof navigator > "u" ? void 0 : navigator.clipboard;
93
- t != null && n != null && n.writeText(t).then(() => wt({
91
+ t != null && n != null && n.writeText(t).then(() => Mt({
94
92
  id: e.id,
95
93
  at: Date.now()
96
94
  }), () => void 0);
97
95
  }
98
- f(() => {
99
- if (N == null) return;
100
- let e = window.setTimeout(() => wt(null), Ze);
96
+ l(() => {
97
+ if (O == null) return;
98
+ let e = window.setTimeout(() => Mt(null), tt);
101
99
  return () => window.clearTimeout(e);
102
- }, [N]);
103
- function Jt(e) {
104
- Kt(e), U.current?.focus();
100
+ }, [O]);
101
+ function Kt(e) {
102
+ G(e), R.current?.focus();
105
103
  }
106
- function Yt(e) {
107
- Kt(e), e.prompt != null && U.current?.focus();
104
+ function qt(e) {
105
+ G(e), e.prompt != null && R.current?.focus();
108
106
  }
109
- f(() => {
110
- Wt.current = M;
111
- let e = U.current;
112
- if (e != null && M && !Ut.current) document.activeElement !== e && e.focus();
113
- else if (e != null && !M && Ut.current) {
114
- let t = document.activeElement, n = t == null || t === document.body || B.current?.contains(t) === !0;
115
- t !== e && n && (W.current = !0, e.focus(), W.current = !1);
107
+ l(() => {
108
+ U.current = D;
109
+ let e = R.current;
110
+ if (e != null && D && !H.current) document.activeElement !== e && e.focus();
111
+ else if (e != null && !D && H.current) {
112
+ let t = document.activeElement, n = t == null || t === document.body || N.current?.contains(t) === !0;
113
+ t !== e && n && (V.current = !0, e.focus(), V.current = !1);
116
114
  }
117
- Ut.current = M;
118
- }, [M]), f(() => {
119
- F && !Bt.current && !Wt.current && G(!0), Bt.current = F;
120
- }), f(() => {
121
- if (I && !H.current) {
122
- let e = zt.current;
115
+ H.current = D;
116
+ }, [D]), l(() => {
117
+ A && !Ut.current && !U.current && W(!0), Ut.current = A;
118
+ }), l(() => {
119
+ if (j && !L.current) {
120
+ let e = P.current;
123
121
  (e?.querySelector("[data-chat-dock-gate-focus]") ?? e)?.focus({ preventScroll: !0 });
124
- } else if (!I && H.current && M) {
125
- let e = U.current, t = document.activeElement, n = t == null || t === document.body || B.current?.contains(t) === !0;
126
- e != null && n && (W.current = !0, e.focus({ preventScroll: !0 }), W.current = !1);
122
+ } else if (!j && L.current && D) {
123
+ let e = R.current, t = document.activeElement, n = t == null || t === document.body || N.current?.contains(t) === !0;
124
+ e != null && n && (V.current = !0, e.focus({ preventScroll: !0 }), V.current = !1);
127
125
  }
128
- H.current = I;
129
- }, [I, M]), f(() => {
130
- if (!L) return;
131
- let e = (i("fast") + i("medium")) * 1e3 + 100, t = window.setTimeout(() => R(!1), e);
132
- return () => window.clearTimeout(t);
133
- }, [L]), p(() => {
134
- let e = Rt.current;
135
- if (e == null || typeof ResizeObserver > "u") return;
136
- let t = new ResizeObserver(() => At(e.offsetHeight));
137
- return t.observe(e), () => {
138
- t.disconnect();
126
+ L.current = j;
127
+ }, [j, D]);
128
+ let [K] = f(() => ({ revealGate: () => {
129
+ Ht.current = performance.now() + st, ct(z.current, P.current);
130
+ } }));
131
+ l(() => {
132
+ j && K.revealGate();
133
+ }, [j, K]), u(() => {
134
+ let e = z.current, t = F.current;
135
+ if (!j || e == null || t == null || typeof ResizeObserver > "u") return;
136
+ let n = new ResizeObserver(() => {
137
+ performance.now() <= Ht.current && ct(e, P.current);
138
+ });
139
+ return n.observe(e), n.observe(t), () => {
140
+ n.disconnect();
139
141
  };
140
- }, []);
141
- let Xt = E != null, K = D === "fixed" && !A ? "rise" : "grow";
142
- p(() => {
143
- let e = B.current, t = It.current, n = Lt.current;
142
+ }, [j]);
143
+ let Jt = x != null, q = S === "fixed" && !T ? "rise" : "grow";
144
+ u(() => {
145
+ let e = N.current, t = Rt.current, n = zt.current;
144
146
  if (e == null || t == null || n == null) return;
145
147
  let r = () => {
146
- let r = K === "rise" ? Math.max(0, window.innerHeight - z.bottom - e.getBoundingClientRect().bottom) : 0;
147
- Ft.current?.style.setProperty("--chat-dock-composer", `${t.offsetHeight + n.offsetHeight + r}px`);
148
- let i = tt({
149
- windowHeight: K === "rise" ? window.innerHeight - z.top - z.bottom : x(D, window.innerHeight, j),
150
- headerHeight: V.current?.offsetHeight || 4 * j,
151
- bottomInset: n.offsetHeight + r,
152
- remPx: j
153
- });
154
- e.style.setProperty("--chat-dock-gate-max", `${i}px`);
148
+ let r = q === "rise" ? Math.max(0, window.innerHeight - M.bottom - e.getBoundingClientRect().bottom) : 0;
149
+ Lt.current?.style.setProperty("--chat-dock-composer", `${t.offsetHeight + n.offsetHeight + r}px`);
155
150
  };
156
151
  if (r(), typeof ResizeObserver > "u") return;
157
152
  let i = new ResizeObserver(r);
158
- return i.observe(t), i.observe(n), V.current != null && i.observe(V.current), () => {
153
+ return i.observe(t), i.observe(n), () => {
159
154
  i.disconnect();
160
155
  };
161
156
  }, [
162
- Xt,
163
- K,
164
- gt,
165
- z.top,
166
- z.bottom,
167
- D,
168
- j,
169
- I
170
- ]), p(() => {
171
- let e = Vt.current;
172
- e != null && Ht.current && (e.scrollTop = e.scrollHeight);
173
- });
174
- function Zt(e) {
175
- !M || I || e.key !== "Escape" || e.defaultPrevented || (e.preventDefault(), G(!1));
157
+ Jt,
158
+ q,
159
+ wt,
160
+ M.top,
161
+ M.bottom
162
+ ]);
163
+ let Yt = j && S === "fixed" && q === "grow";
164
+ u(() => {
165
+ let e = Bt.current, t = Vt.current, n = F.current, r = z.current;
166
+ if (!Yt || e == null || t == null || n == null || r == null) {
167
+ It(null);
168
+ return;
169
+ }
170
+ let i = () => {
171
+ let i = getComputedStyle(e), a = getComputedStyle(r), o = Number.parseFloat(i.paddingTop) + Number.parseFloat(i.paddingBottom) + t.offsetHeight + Number.parseFloat(i.rowGap || "0") + n.offsetHeight + Number.parseFloat(a.paddingTop) + Number.parseFloat(a.paddingBottom);
172
+ It(ot({
173
+ normal: at(S, window.innerHeight, E),
174
+ needed: o,
175
+ max: Math.max(0, window.innerHeight - 7 * E)
176
+ }));
177
+ };
178
+ if (i(), typeof ResizeObserver > "u") return;
179
+ let a = new ResizeObserver(i);
180
+ return a.observe(n), a.observe(t), () => {
181
+ a.disconnect();
182
+ };
183
+ }, [
184
+ Yt,
185
+ S,
186
+ E,
187
+ wt
188
+ ]), u(() => {
189
+ let e = z.current;
190
+ I.current && !A && (B.current = !0), I.current = A, e != null && B.current && !A && (e.scrollTop = e.scrollHeight);
191
+ }), u(() => {
192
+ let e = z.current;
193
+ if (e == null || typeof ResizeObserver > "u") return;
194
+ let t = new ResizeObserver(() => {
195
+ !I.current && B.current && (e.scrollTop = e.scrollHeight);
196
+ });
197
+ return t.observe(e), () => {
198
+ t.disconnect();
199
+ };
200
+ }, []);
201
+ function Xt(e) {
202
+ !D || e.key !== "Escape" || e.defaultPrevented || (e.preventDefault(), W(!1));
176
203
  }
177
- let Qt = qe(w), $t = !I && Je(w, S), en = !I && Ye({
178
- followUps: T,
179
- messages: S,
180
- thinking: C,
181
- sentAfterId: St
182
- }), q = M ? "open" : "closed", J = r("medium"), Y = r("fast"), tn = n(), nn = t(1), X = tn, Z = { duration: 0 }, Q = {
183
- default: Z,
184
- opacity: Y
185
- }, rn = 3.25 * j, an = {
204
+ let Zt = A ? mt : ce, Qt = Ze(y), $t = !A && Qe(y, _), en = !A && $e({
205
+ followUps: b,
206
+ messages: _,
207
+ thinking: v,
208
+ sentAfterId: At
209
+ }), J = D ? "open" : "closed", Y = r("medium"), X = r("fast"), tn = n(), nn = t(1), Z = tn, Q = { duration: 0 }, $ = {
210
+ default: Q,
211
+ opacity: X
212
+ }, rn = 3.25 * E, an = {
186
213
  height: rn,
187
214
  left: 0,
188
215
  right: 0,
189
216
  borderRadius: rn / 2
190
217
  }, on = {
191
- height: x(D, gt, j),
192
- left: -j,
193
- right: -j,
194
- borderRadius: j
195
- }, sn = k ? {
218
+ height: Yt && Ft != null ? Ft : at(S, wt, E),
219
+ left: -E,
220
+ right: -E,
221
+ borderRadius: E
222
+ }, sn = w ? {
196
223
  open: {
197
- ...K === "grow" ? on : { y: 0 },
224
+ ...q === "grow" ? on : { y: 0 },
198
225
  opacity: 1,
199
- transition: Q
226
+ transition: $
200
227
  },
201
228
  closed: {
202
- ...K === "grow" ? on : { y: 0 },
229
+ ...q === "grow" ? on : { y: 0 },
203
230
  opacity: 0,
204
- transition: Q
231
+ transition: $
205
232
  }
206
- } : K === "grow" ? {
233
+ } : q === "grow" ? {
207
234
  open: {
208
235
  ...on,
209
236
  opacity: 1,
210
- transition: J
237
+ transition: Y
211
238
  },
212
239
  closed: {
213
240
  ...an,
214
241
  opacity: 1,
215
242
  transition: {
216
- ...J,
217
- delay: X
243
+ ...Y,
244
+ delay: Z
218
245
  }
219
246
  }
220
247
  } : {
221
248
  open: {
222
249
  y: 0,
223
250
  opacity: 1,
224
- transition: J
251
+ transition: Y
225
252
  },
226
253
  closed: {
227
254
  y: "100%",
228
255
  opacity: 1,
229
256
  transition: {
230
- ...J,
231
- delay: X
257
+ ...Y,
258
+ delay: Z
232
259
  }
233
260
  }
234
261
  }, cn = {
235
- variants: k ? {
262
+ variants: w ? {
236
263
  open: {},
237
264
  closed: {}
238
265
  } : {
@@ -240,37 +267,37 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
240
267
  opacity: 1,
241
268
  y: 0,
242
269
  transition: {
243
- ...Y,
270
+ ...X,
244
271
  delay: nn + e * tn
245
272
  }
246
273
  }),
247
274
  closed: {
248
275
  opacity: 0,
249
276
  y: 8,
250
- transition: Y
277
+ transition: X
251
278
  }
252
279
  },
253
280
  initial: !1,
254
- animate: q
281
+ animate: J
255
282
  }, ln = {
256
283
  open: {
257
284
  width: 0,
258
285
  opacity: 0,
259
- transition: k ? Q : {
260
- width: J,
261
- opacity: Y
286
+ transition: w ? $ : {
287
+ width: Y,
288
+ opacity: X
262
289
  }
263
290
  },
264
291
  closed: {
265
292
  width: "auto",
266
293
  opacity: 1,
267
- transition: k ? Q : {
294
+ transition: w ? $ : {
268
295
  width: {
269
- ...J,
270
- delay: X
296
+ ...Y,
297
+ delay: Z
271
298
  },
272
299
  opacity: {
273
- ...Y,
300
+ ...X,
274
301
  delay: nn
275
302
  }
276
303
  }
@@ -279,10 +306,10 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
279
306
  open: {
280
307
  height: "auto",
281
308
  opacity: 1,
282
- transition: k ? Q : {
283
- height: J,
309
+ transition: w ? $ : {
310
+ height: Y,
284
311
  opacity: {
285
- ...Y,
312
+ ...X,
286
313
  delay: nn
287
314
  }
288
315
  }
@@ -290,33 +317,33 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
290
317
  closed: {
291
318
  height: 0,
292
319
  opacity: 0,
293
- transition: k ? Q : {
320
+ transition: w ? $ : {
294
321
  height: {
295
- ...J,
296
- delay: X
322
+ ...Y,
323
+ delay: Z
297
324
  },
298
- opacity: Y
325
+ opacity: X
299
326
  }
300
327
  }
301
328
  }, dn = {
302
- initial: !k && "hidden",
303
- animate: M ? "visible" : "folded",
329
+ initial: !w && "hidden",
330
+ animate: D ? "visible" : "folded",
304
331
  exit: {
305
332
  opacity: 0,
306
- transition: Z
333
+ transition: Q
307
334
  },
308
335
  variants: {
309
336
  hidden: {},
310
337
  visible: {
311
338
  opacity: 1,
312
339
  transition: {
313
- ...Y,
340
+ ...X,
314
341
  staggerChildren: tn
315
342
  }
316
343
  },
317
344
  folded: {
318
345
  opacity: 0,
319
- transition: k ? Z : Y
346
+ transition: w ? Q : X
320
347
  }
321
348
  }
322
349
  }, fn = {
@@ -327,147 +354,215 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
327
354
  visible: {
328
355
  opacity: 1,
329
356
  y: 0,
330
- transition: Y
357
+ transition: X
331
358
  }
332
- }, $ = (e) => e.preventDefault(), pn = A ? "sm" : "md";
333
- function mn(t, n) {
334
- let r = N?.id === t.id, i = t.feedback ?? null, a = (e) => at?.(t, i === e ? null : e);
335
- return /* @__PURE__ */ _("div", {
336
- className: e(be, n.ready ? void 0 : xe),
359
+ }, pn = (e) => e.preventDefault(), mn = T ? "sm" : "md";
360
+ function hn(t, n) {
361
+ let r = O?.id === t.id, i = t.feedback ?? null, a = (e) => ft?.(t, i === e ? null : e);
362
+ return /* @__PURE__ */ m("div", {
363
+ className: e(Ce, n.ready ? void 0 : we),
337
364
  "data-reply-actions": n.ready ? "ready" : "pending",
338
- children: [n.copy || n.vote ? /* @__PURE__ */ _("div", {
339
- className: Se,
340
- children: [n.copy ? /* @__PURE__ */ g(s, {
341
- size: pn,
342
- icon: g(r ? Re : ze, {}),
343
- "aria-label": r ? O.copied : O.copy,
344
- onClick: () => qt(t)
345
- }) : null, n.vote ? /* @__PURE__ */ _(Ue, { children: [/* @__PURE__ */ g(s, {
346
- size: pn,
347
- icon: /* @__PURE__ */ g(He, {}),
348
- "aria-label": O.helpful,
365
+ children: [n.copy || n.vote ? /* @__PURE__ */ m("div", {
366
+ className: Te,
367
+ children: [n.copy ? /* @__PURE__ */ p(o, {
368
+ size: mn,
369
+ icon: p(r ? He : Ue, {}),
370
+ "aria-label": r ? C.copied : C.copy,
371
+ onClick: () => Gt(t)
372
+ }) : null, n.vote ? /* @__PURE__ */ m(qe, { children: [/* @__PURE__ */ p(o, {
373
+ size: mn,
374
+ icon: /* @__PURE__ */ p(Ke, {}),
375
+ "aria-label": C.helpful,
349
376
  pressed: i === "up",
350
377
  onClick: () => a("up")
351
- }), /* @__PURE__ */ g(s, {
352
- size: pn,
353
- icon: /* @__PURE__ */ g(Ve, {}),
354
- "aria-label": O.notHelpful,
378
+ }), /* @__PURE__ */ p(o, {
379
+ size: mn,
380
+ icon: /* @__PURE__ */ p(Ge, {}),
381
+ "aria-label": C.notHelpful,
355
382
  pressed: i === "down",
356
383
  onClick: () => a("down")
357
384
  })] }) : null]
358
- }) : null, t.meta == null ? null : /* @__PURE__ */ _("p", {
359
- className: we,
360
- children: [t.meta.label, t.meta.description == null ? null : /* @__PURE__ */ _("span", {
385
+ }) : null, t.meta == null ? null : /* @__PURE__ */ m("p", {
386
+ className: De,
387
+ children: [t.meta.label, t.meta.description == null ? null : /* @__PURE__ */ m("span", {
361
388
  className: "sr-only",
362
389
  children: [". ", t.meta.description]
363
390
  })]
364
391
  })]
365
392
  });
366
393
  }
367
- return /* @__PURE__ */ g("div", {
368
- className: e(Te[D], D === "fixed" && !P ? Ee : void 0, ft),
369
- "data-open": M ? "" : void 0,
370
- "data-gate": I ? "" : void 0,
371
- style: z.top > 0 || z.bottom > 0 ? {
372
- "--chat-dock-vv-top": `${z.top}px`,
373
- "--chat-dock-vv-bottom": `${z.bottom}px`
394
+ return /* @__PURE__ */ p("div", {
395
+ className: e(Oe[S], S === "fixed" && !k ? ke : void 0, bt),
396
+ "data-open": D ? "" : void 0,
397
+ "data-gate": j ? "" : void 0,
398
+ style: M.top > 0 || M.bottom > 0 ? {
399
+ "--chat-dock-vv-top": `${M.top}px`,
400
+ "--chat-dock-vv-bottom": `${M.bottom}px`
374
401
  } : void 0,
375
- children: /* @__PURE__ */ g("div", {
376
- className: ge,
377
- children: /* @__PURE__ */ g("div", {
402
+ children: /* @__PURE__ */ p("div", {
403
+ className: ye,
404
+ children: /* @__PURE__ */ p("div", {
378
405
  className: "band",
379
- children: /* @__PURE__ */ _("div", {
380
- ref: B,
381
- className: e(de, P ? fe : void 0),
382
- role: M ? "dialog" : void 0,
383
- "aria-modal": M ? "false" : void 0,
384
- "aria-labelledby": M ? pt : void 0,
385
- "aria-describedby": M && l != null ? mt : void 0,
386
- onKeyDown: Zt,
406
+ children: /* @__PURE__ */ m("div", {
407
+ ref: N,
408
+ className: e(pe, k ? me : void 0),
409
+ role: D ? "dialog" : void 0,
410
+ "aria-modal": D ? "false" : void 0,
411
+ "aria-labelledby": D ? xt : void 0,
412
+ "aria-describedby": D && Zt != null ? St : void 0,
413
+ onKeyDown: Xt,
387
414
  children: [
388
- /* @__PURE__ */ g(v, {
415
+ /* @__PURE__ */ p(h, {
389
416
  initial: !1,
390
- children: !M && Qt.length > 0 ? /* @__PURE__ */ g(y.div, {
391
- className: ye,
417
+ children: !D && Qt.length > 0 ? /* @__PURE__ */ p(g.div, {
418
+ className: Se,
392
419
  role: "group",
393
- "aria-label": O.suggestions,
420
+ "aria-label": C.suggestions,
394
421
  exit: {
395
422
  opacity: 0,
396
- transition: k ? Z : Y
423
+ transition: w ? Q : X
397
424
  },
398
- children: Qt.map((e, t) => /* @__PURE__ */ g("span", {
399
- className: ve,
425
+ children: Qt.map((e, t) => /* @__PURE__ */ p("span", {
426
+ className: xe,
400
427
  style: { "--chat-dock-pill-index": t },
401
- children: /* @__PURE__ */ g(o, {
428
+ children: /* @__PURE__ */ p(a, {
402
429
  type: "button",
403
430
  role: "secondary",
404
431
  size: "md",
405
432
  icon: e.icon,
406
- onClick: () => Kt(e),
433
+ onClick: () => G(e),
407
434
  children: e.label
408
435
  })
409
436
  }, e.id))
410
437
  }, "pills") : null
411
438
  }),
412
- /* @__PURE__ */ g(y.div, {
413
- ref: Ft,
414
- className: Ne[D],
415
- "data-chat-dock-window": q,
416
- hidden: P,
417
- variants: sn,
439
+ /* @__PURE__ */ p(g.div, {
440
+ ref: Lt,
441
+ className: Le[S],
442
+ "data-chat-dock-window": J,
443
+ hidden: k,
418
444
  initial: !1,
419
- animate: q,
420
- onAnimationComplete: (e) => {
421
- e === "closed" && !Wt.current && Et(!0);
445
+ animate: sn[J],
446
+ onAnimationComplete: () => {
447
+ U.current || Pt(!0);
422
448
  },
423
- children: /* @__PURE__ */ _("div", {
424
- className: Pe,
449
+ children: /* @__PURE__ */ m("div", {
450
+ ref: Bt,
451
+ className: Re,
425
452
  children: [
426
- /* @__PURE__ */ g(y.div, {
427
- ref: V,
453
+ /* @__PURE__ */ p(g.div, {
454
+ ref: Vt,
428
455
  className: "shrink-0",
429
456
  custom: 0,
430
457
  ...cn,
431
- children: /* @__PURE__ */ g(ne, {
432
- titleId: pt,
433
- descriptionId: mt,
434
- title: c,
435
- description: l,
436
- headerStart: d,
437
- closeLabel: O.close,
438
- onClose: () => G(!1),
458
+ children: /* @__PURE__ */ p(ne, {
459
+ titleId: xt,
460
+ descriptionId: St,
461
+ title: s,
462
+ description: Zt,
463
+ headerStart: c,
464
+ closeLabel: C.close,
465
+ onClose: () => W(!1),
439
466
  delineated: !0
440
467
  })
441
468
  }),
442
- /* @__PURE__ */ _(y.div, {
443
- ref: Vt,
444
- className: je,
469
+ /* @__PURE__ */ p(g.div, {
470
+ ref: z,
471
+ className: Pe,
445
472
  role: "log",
446
- "aria-label": O.conversation,
473
+ "aria-label": C.conversation,
447
474
  tabIndex: 0,
448
475
  custom: 1,
449
476
  ...cn,
450
477
  onScroll: (e) => {
451
478
  let t = e.currentTarget;
452
- Ht.current = t.scrollHeight - t.scrollTop - t.clientHeight <= Qe;
479
+ B.current = t.scrollHeight - t.scrollTop - t.clientHeight <= nt;
453
480
  },
454
- children: [b == null ? null : /* @__PURE__ */ g("div", {
455
- className: u,
456
- children: b
457
- }), /* @__PURE__ */ _(v, {
458
- initial: !1,
459
- children: [
460
- S.map((e, t) => {
461
- let n = Xe({
462
- message: e,
463
- isLatest: t === S.length - 1,
464
- thinking: C,
465
- takesVotes: at != null
466
- });
467
- return /* @__PURE__ */ g(y.div, {
468
- "data-role": e.role,
469
- className: e.role === "user" ? Me : n == null ? u : Ce,
470
- initial: !k && {
481
+ children: /* @__PURE__ */ m("div", {
482
+ ref: F,
483
+ className: Fe,
484
+ children: [Xe == null ? null : /* @__PURE__ */ p("div", {
485
+ className: le,
486
+ children: Xe
487
+ }), /* @__PURE__ */ m(h, {
488
+ initial: !1,
489
+ children: [
490
+ _.map((e, t) => {
491
+ let n = A ? null : et({
492
+ message: e,
493
+ isLatest: t === _.length - 1,
494
+ thinking: v,
495
+ takesVotes: ft != null
496
+ });
497
+ return /* @__PURE__ */ p(g.div, {
498
+ "data-role": e.role,
499
+ className: e.role === "user" ? Ie : n == null ? le : Ee,
500
+ initial: !w && {
501
+ opacity: 0,
502
+ y: 8
503
+ },
504
+ animate: {
505
+ opacity: 1,
506
+ y: 0
507
+ },
508
+ transition: X,
509
+ children: n == null ? e.content : /* @__PURE__ */ m(qe, { children: [/* @__PURE__ */ p("div", {
510
+ className: le,
511
+ children: e.content
512
+ }), hn(e, n)] })
513
+ }, e.id);
514
+ }),
515
+ en && dt === "inline" ? /* @__PURE__ */ p(g.div, {
516
+ role: "group",
517
+ "aria-label": C.followUps,
518
+ "data-follow-ups": "inline",
519
+ className: _e,
520
+ ...dn,
521
+ animate: "visible",
522
+ children: b.map((e) => /* @__PURE__ */ p(g.div, {
523
+ className: he,
524
+ variants: fn,
525
+ children: /* @__PURE__ */ p(a, {
526
+ type: "button",
527
+ role: "ghost",
528
+ layout: "row",
529
+ onMouseDown: pn,
530
+ onClick: () => Kt(e),
531
+ children: /* @__PURE__ */ m("span", {
532
+ className: Me,
533
+ children: [/* @__PURE__ */ p(i, {
534
+ size: "md",
535
+ children: /* @__PURE__ */ p(We, {})
536
+ }), /* @__PURE__ */ p("span", {
537
+ className: Ae,
538
+ children: e.label
539
+ })]
540
+ })
541
+ })
542
+ }, e.id))
543
+ }, "follow-ups") : null,
544
+ v ? /* @__PURE__ */ m(g.div, {
545
+ className: Ne,
546
+ initial: !w && { opacity: 0 },
547
+ animate: { opacity: 1 },
548
+ exit: {
549
+ opacity: 0,
550
+ transition: Q
551
+ },
552
+ transition: X,
553
+ children: [/* @__PURE__ */ p(ee, {
554
+ variant: "dot",
555
+ tone: "neutral",
556
+ pulsing: !0,
557
+ besideLabel: !0
558
+ }), /* @__PURE__ */ p("span", { children: C.thinking })]
559
+ }, "thinking") : null,
560
+ A ? /* @__PURE__ */ p(g.div, {
561
+ ref: P,
562
+ className: ve,
563
+ "data-chat-dock-gate": "",
564
+ "aria-live": "off",
565
+ initial: !w && {
471
566
  opacity: 0,
472
567
  y: 8
473
568
  },
@@ -475,102 +570,61 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
475
570
  opacity: 1,
476
571
  y: 0
477
572
  },
478
- transition: Y,
479
- children: n == null ? e.content : /* @__PURE__ */ _(Ue, { children: [/* @__PURE__ */ g("div", {
480
- className: u,
481
- children: e.content
482
- }), mn(e, n)] })
483
- }, e.id);
484
- }),
485
- en && it === "inline" ? /* @__PURE__ */ g(y.div, {
486
- role: "group",
487
- "aria-label": O.followUps,
488
- "data-follow-ups": "inline",
489
- className: he,
490
- ...dn,
491
- animate: "visible",
492
- children: T.map((e) => /* @__PURE__ */ g(y.div, {
493
- className: pe,
494
- variants: fn,
495
- children: /* @__PURE__ */ g(o, {
496
- type: "button",
497
- role: "ghost",
498
- layout: "row",
499
- onMouseDown: $,
500
- onClick: () => Jt(e),
501
- children: /* @__PURE__ */ _("span", {
502
- className: ke,
503
- children: [/* @__PURE__ */ g(a, {
504
- size: "md",
505
- children: /* @__PURE__ */ g(Be, {})
506
- }), /* @__PURE__ */ g("span", {
507
- className: De,
508
- children: e.label
509
- })]
510
- })
573
+ exit: {
574
+ opacity: 0,
575
+ transition: Q
576
+ },
577
+ transition: X,
578
+ children: /* @__PURE__ */ p(re.Provider, {
579
+ value: K,
580
+ children: pt
511
581
  })
512
- }, e.id))
513
- }, "follow-ups") : null,
514
- C ? /* @__PURE__ */ _(y.div, {
515
- className: Ae,
516
- initial: !k && { opacity: 0 },
517
- animate: { opacity: 1 },
518
- exit: {
519
- opacity: 0,
520
- transition: Z
521
- },
522
- transition: Y,
523
- children: [/* @__PURE__ */ g(ee, {
524
- variant: "dot",
525
- tone: "neutral",
526
- pulsing: !0,
527
- besideLabel: !0
528
- }), /* @__PURE__ */ g("span", { children: O.thinking })]
529
- }, "thinking") : null
530
- ]
531
- })]
582
+ }, "gate") : null
583
+ ]
584
+ })]
585
+ })
532
586
  }),
533
- $t ? /* @__PURE__ */ g(y.div, {
534
- className: Oe,
587
+ $t ? /* @__PURE__ */ p(g.div, {
588
+ className: je,
535
589
  role: "group",
536
- "aria-label": O.suggestions,
590
+ "aria-label": C.suggestions,
537
591
  custom: 2,
538
592
  ...cn,
539
- children: w.map((e) => /* @__PURE__ */ g(o, {
593
+ children: y.map((e) => /* @__PURE__ */ p(a, {
540
594
  type: "button",
541
595
  role: "ghost",
542
596
  layout: "row",
543
- onMouseDown: e.prompt == null ? void 0 : $,
544
- onClick: () => Yt(e),
545
- children: /* @__PURE__ */ _("span", {
546
- className: ke,
547
- children: [e.icon == null ? null : /* @__PURE__ */ g(a, {
597
+ onMouseDown: e.prompt == null ? void 0 : pn,
598
+ onClick: () => qt(e),
599
+ children: /* @__PURE__ */ m("span", {
600
+ className: Me,
601
+ children: [e.icon == null ? null : /* @__PURE__ */ p(i, {
548
602
  size: "md",
549
603
  children: e.icon
550
- }), /* @__PURE__ */ g("span", {
551
- className: De,
604
+ }), /* @__PURE__ */ p("span", {
605
+ className: Ae,
552
606
  children: e.label
553
607
  })]
554
608
  })
555
609
  }, e.id))
556
610
  }) : null,
557
- /* @__PURE__ */ g(v, {
611
+ /* @__PURE__ */ p(h, {
558
612
  initial: !1,
559
- children: en && it === "composer" ? /* @__PURE__ */ g(y.div, {
613
+ children: en && dt === "composer" ? /* @__PURE__ */ p(g.div, {
560
614
  role: "group",
561
- "aria-label": O.followUps,
615
+ "aria-label": C.followUps,
562
616
  "data-follow-ups": "composer",
563
- className: me,
617
+ className: ge,
564
618
  ...dn,
565
- children: T.map((e) => /* @__PURE__ */ g(y.span, {
619
+ children: b.map((e) => /* @__PURE__ */ p(g.span, {
566
620
  className: "inline-flex",
567
621
  variants: fn,
568
- children: /* @__PURE__ */ g(o, {
622
+ children: /* @__PURE__ */ p(a, {
569
623
  type: "button",
570
624
  role: "secondary",
571
625
  size: "md",
572
- onMouseDown: $,
573
- onClick: () => Jt(e),
626
+ onMouseDown: pn,
627
+ onClick: () => Kt(e),
574
628
  children: e.label
575
629
  })
576
630
  }, e.id))
@@ -578,111 +632,52 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
578
632
  })
579
633
  ]
580
634
  })
581
- }, K),
582
- /* @__PURE__ */ g("span", {
635
+ }, q),
636
+ /* @__PURE__ */ p("span", {
583
637
  className: "sr-only",
584
638
  role: "status",
585
- children: N == null ? "" : O.copied
639
+ children: O == null ? "" : C.copied
586
640
  }),
587
- /* @__PURE__ */ _("div", {
588
- className: se,
589
- children: [/* @__PURE__ */ g(y.div, {
590
- ref: It,
591
- initial: !1,
592
- animate: { height: kt ?? "auto" },
593
- transition: L && !k ? J : Z,
594
- style: L ? { overflow: "hidden" } : void 0,
595
- onAnimationComplete: () => R(!1),
596
- children: /* @__PURE__ */ _("div", {
597
- ref: Rt,
598
- className: oe,
599
- children: [/* @__PURE__ */ g(v, {
641
+ /* @__PURE__ */ m("div", {
642
+ className: ue,
643
+ children: [/* @__PURE__ */ p("div", {
644
+ ref: Rt,
645
+ children: /* @__PURE__ */ p(te, {
646
+ ref: R,
647
+ value: Ot,
648
+ onValueChange: (e) => {
649
+ kt(e), W(!0);
650
+ },
651
+ onSend: Wt,
652
+ onFocus: () => {
653
+ V.current || W(!0);
654
+ },
655
+ onClick: () => W(!0),
656
+ disabled: j,
657
+ start: c == null ? void 0 : /* @__PURE__ */ p(g.span, {
658
+ className: be,
659
+ "aria-hidden": D ? !0 : void 0,
660
+ variants: ln,
600
661
  initial: !1,
601
- children: F ? /* @__PURE__ */ g(y.div, {
602
- ref: zt,
603
- className: e(le, I ? void 0 : "pointer-events-none"),
604
- "data-chat-dock-gate": "",
605
- hidden: jt,
606
- initial: {
607
- opacity: 0,
608
- y: 12
609
- },
610
- animate: I ? {
611
- opacity: 1,
612
- y: 0,
613
- transition: {
614
- ...Y,
615
- delay: k ? 0 : Y.duration
616
- }
617
- } : {
618
- opacity: 0,
619
- y: 12,
620
- transition: Y
621
- },
622
- exit: {
623
- opacity: 0,
624
- y: 12,
625
- transition: Y
626
- },
627
- onAnimationComplete: () => {
628
- I || Mt(!0);
629
- },
630
- children: ot
631
- }, "gate") : null
632
- }), /* @__PURE__ */ g(y.div, {
633
- className: e(le, I ? "pointer-events-none" : void 0),
634
- hidden: Nt,
635
- initial: !1,
636
- animate: I ? {
637
- opacity: 0,
638
- transition: Y
639
- } : {
640
- opacity: 1,
641
- transition: {
642
- ...Y,
643
- delay: L && !k ? Y.duration : 0
644
- }
645
- },
646
- onAnimationComplete: () => {
647
- I && Pt(!0);
648
- },
649
- children: /* @__PURE__ */ g(te, {
650
- ref: U,
651
- value: bt,
652
- onValueChange: (e) => {
653
- xt(e), G(!0);
654
- },
655
- onSend: Gt,
656
- onFocus: () => {
657
- W.current || G(!0);
658
- },
659
- onClick: () => G(!0),
660
- start: d == null ? void 0 : /* @__PURE__ */ g(y.span, {
661
- className: _e,
662
- "aria-hidden": M ? !0 : void 0,
663
- variants: ln,
664
- initial: !1,
665
- animate: q,
666
- children: d
667
- }),
668
- placeholder: ut,
669
- "aria-label": O.field,
670
- sendLabel: O.send
671
- })
672
- })]
662
+ animate: J,
663
+ children: c
664
+ }),
665
+ placeholder: j ? C.gatePlaceholder : vt,
666
+ "aria-label": C.field,
667
+ sendLabel: C.send
673
668
  })
674
- }), /* @__PURE__ */ g(y.div, {
669
+ }), /* @__PURE__ */ p(g.div, {
675
670
  className: "overflow-hidden",
676
- "aria-hidden": !M || void 0,
671
+ "aria-hidden": !D || void 0,
677
672
  variants: un,
678
673
  initial: !1,
679
- animate: q,
680
- children: /* @__PURE__ */ g("div", {
681
- ref: Lt,
682
- children: E != null && !I ? /* @__PURE__ */ g("p", {
683
- className: ue[D],
684
- children: E
685
- }) : /* @__PURE__ */ g("div", { className: ce[D] })
674
+ animate: J,
675
+ children: /* @__PURE__ */ p("div", {
676
+ ref: zt,
677
+ children: x == null ? /* @__PURE__ */ p("div", { className: de[S] }) : /* @__PURE__ */ p("p", {
678
+ className: fe[S],
679
+ children: x
680
+ })
686
681
  })
687
682
  })]
688
683
  })
@@ -692,6 +687,6 @@ function w({ title: c, subtitle: l, mark: d, greeting: b, messages: S = [], thin
692
687
  })
693
688
  });
694
689
  }
695
- var nt = Object.assign(w, { Gate: c });
690
+ var v = Object.assign(_, { Gate: s });
696
691
  //#endregion
697
- export { nt as ChatDock, c as ChatDockGate, Ke as chatDockDefaultLabels, b as chatDockFollowUpsPlacements, l as chatDockGateDefaultLabels, tt as chatDockGateMaxHeight, x as chatDockOpenHeight, qe as chatDockPillSuggestions, d as chatDockPlacements, Xe as chatDockReplyRow, Ye as chatDockShowsFollowUps, Je as chatDockShowsSuggestionRows };
692
+ export { v as ChatDock, s as ChatDockGate, Ye as chatDockDefaultLabels, Xe as chatDockFollowUpsPlacements, ce as chatDockGateDefaultLabels, ot as chatDockGateWindowHeight, at as chatDockOpenHeight, Ze as chatDockPillSuggestions, c as chatDockPlacements, et as chatDockReplyRow, $e as chatDockShowsFollowUps, Qe as chatDockShowsSuggestionRows };