@burdenoff/microfe-healthybowl 2026.904.3 → 2026.904.5

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.
@@ -1,81 +1,81 @@
1
- import "../../../utils/assistantAttachments.js";
2
- import { availableAttachmentSources as e, deviceHasCamera as t } from "../../../utils/attachmentSources.js";
3
- import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
4
- import { Camera as s, FileText as c, FolderOpen as l, ImageIcon as u, Plus as d } from "lucide-react";
5
- import { useAssistantTr as f } from "@burdenoff/fe-libs/shared/assistant";
6
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
1
+ import { MAX_ATTACHMENTS as e } from "../../../utils/assistantAttachments.js";
2
+ import { availableAttachmentSources as t, deviceHasCamera as n } from "../../../utils/attachmentSources.js";
3
+ import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
4
+ import { Camera as c, FileText as l, FolderOpen as u, ImageIcon as d, Plus as f } from "lucide-react";
5
+ import { useAssistantTr as p } from "@burdenoff/fe-libs/shared/assistant";
6
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
7
7
  //#region src/components/assistant/composer/AssistantAttachmentButton.tsx
8
- var h = {
9
- camera: s,
10
- gallery: u,
11
- documents: c,
12
- files: l
13
- }, g = ({ onFiles: s, onPickerOpen: c, direction: l = "up", canAddMore: u, disabled: g = !1 }) => {
14
- let _ = f(), v = a(null), y = a(null), b = a(null), [x, S] = o(!1), C = a(c);
15
- C.current = c;
16
- let w = i(() => e(t()), []), T = u ? _("composer.attach", "Attach files or photos") : _("composer.attachFull", "Attachment limit reached ({{max}})", { max: 5 });
17
- r(() => {
18
- if (!x) return;
8
+ var g = {
9
+ camera: c,
10
+ gallery: d,
11
+ documents: l,
12
+ files: u
13
+ }, _ = ({ onFiles: c, onPickerOpen: l, direction: u = "up", canAddMore: d, disabled: _ = !1 }) => {
14
+ let v = p(), y = o(null), b = o(null), x = o(null), [S, C] = s(!1), w = o(l);
15
+ w.current = l;
16
+ let T = a(() => t(n()), []), E = d ? v("composer.attach", "Attach files or photos") : v("composer.attachFull", "Attachment limit reached ({{max}})", { max: e });
17
+ i(() => {
18
+ if (!S) return;
19
19
  let e = (e) => {
20
- e.key === "Escape" && (S(!1), b.current?.focus());
20
+ e.key === "Escape" && (C(!1), x.current?.focus());
21
21
  }, t = (e) => {
22
22
  let t = e.target;
23
- y.current?.contains(t) || b.current?.contains(t) || S(!1);
23
+ b.current?.contains(t) || x.current?.contains(t) || C(!1);
24
24
  };
25
25
  return window.addEventListener("keydown", e), window.addEventListener("mousedown", t), () => {
26
26
  window.removeEventListener("keydown", e), window.removeEventListener("mousedown", t);
27
27
  };
28
- }, [x]);
29
- let E = n((e) => {
30
- s(e.target.files), e.target.value = "";
31
- }, [s]), D = n((e) => {
32
- let t = v.current;
33
- t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), S(!1), C.current?.(), t.click());
28
+ }, [S]);
29
+ let D = r((e) => {
30
+ c(e.target.files), e.target.value = "";
31
+ }, [c]), O = r((e) => {
32
+ let t = y.current;
33
+ t && (t.accept = e.accept, t.multiple = e.multiple, e.capture ? t.setAttribute("capture", e.capture) : t.removeAttribute("capture"), C(!1), w.current?.(), t.click());
34
34
  }, []);
35
- return /* @__PURE__ */ m("div", {
35
+ return /* @__PURE__ */ h("div", {
36
36
  className: "relative flex-shrink-0",
37
37
  children: [
38
- /* @__PURE__ */ p("input", {
39
- ref: v,
38
+ /* @__PURE__ */ m("input", {
39
+ ref: y,
40
40
  type: "file",
41
41
  multiple: !0,
42
42
  className: "hidden",
43
- onChange: E,
43
+ onChange: D,
44
44
  tabIndex: -1,
45
45
  "aria-hidden": "true",
46
46
  "data-testid": "assistant-attach-input"
47
47
  }),
48
- /* @__PURE__ */ p("button", {
49
- ref: b,
48
+ /* @__PURE__ */ m("button", {
49
+ ref: x,
50
50
  type: "button",
51
- onClick: () => S((e) => !e),
52
- disabled: g || !u,
53
- title: T,
54
- "aria-label": T,
51
+ onClick: () => C((e) => !e),
52
+ disabled: _ || !d,
53
+ title: E,
54
+ "aria-label": E,
55
55
  "aria-haspopup": "menu",
56
- "aria-expanded": x,
56
+ "aria-expanded": S,
57
57
  className: "flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated",
58
58
  "data-testid": "assistant-attach",
59
- children: /* @__PURE__ */ p(d, { className: "size-4" })
59
+ children: /* @__PURE__ */ m(f, { className: "size-4" })
60
60
  }),
61
- x ? /* @__PURE__ */ p("div", {
62
- ref: y,
61
+ S ? /* @__PURE__ */ m("div", {
62
+ ref: b,
63
63
  role: "menu",
64
- "aria-label": _("composer.attachSource", "Attach from"),
65
- className: `absolute ${l === "up" ? "bottom-full mb-2" : "top-full mt-2"} left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`,
64
+ "aria-label": v("composer.attachSource", "Attach from"),
65
+ className: `absolute ${u === "up" ? "bottom-full mb-2" : "top-full mt-2"} left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`,
66
66
  "data-testid": "assistant-attach-menu",
67
- children: w.map((e) => {
68
- let t = h[e.id];
69
- return /* @__PURE__ */ m("button", {
67
+ children: T.map((e) => {
68
+ let t = g[e.id];
69
+ return /* @__PURE__ */ h("button", {
70
70
  type: "button",
71
71
  role: "menuitem",
72
- onClick: () => D(e),
72
+ onClick: () => O(e),
73
73
  className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken",
74
74
  "data-testid": `assistant-attach-source-${e.id}`,
75
- children: [/* @__PURE__ */ p(t, {
75
+ children: [/* @__PURE__ */ m(t, {
76
76
  className: "size-4 flex-shrink-0 text-text-secondary",
77
77
  "aria-hidden": "true"
78
- }), _(e.labelKey, e.labelFallback)]
78
+ }), v(e.labelKey, e.labelFallback)]
79
79
  }, e.id);
80
80
  })
81
81
  }) : null
@@ -83,6 +83,6 @@ var h = {
83
83
  });
84
84
  };
85
85
  //#endregion
86
- export { g as AssistantAttachmentButton };
86
+ export { _ as AssistantAttachmentButton };
87
87
 
88
88
  //# sourceMappingURL=AssistantAttachmentButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantAttachmentButton.js","names":[],"sources":["../../../../src/components/assistant/composer/AssistantAttachmentButton.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState, type ChangeEvent, type FC } from 'react';\nimport { Camera, FileText, FolderOpen, ImageIcon, Plus } from 'lucide-react';\nimport { useAssistantTr } from '@burdenoff/fe-libs/shared/assistant';\nimport { MAX_ATTACHMENTS } from '@/utils/assistantAttachments';\nimport {\n availableAttachmentSources,\n deviceHasCamera,\n type AttachmentSource,\n type AttachmentSourceId,\n} from '@/utils/attachmentSources';\n\ninterface Props {\n onFiles: (files: FileList | null) => void;\n /**\n * The OS picker is about to take over the screen.\n *\n * ★ Exists for the voice session, which must release the microphone before the\n * camera app claims it. Fired on the `.click()` rather than on selection,\n * because by the time a file arrives the damage is done — and a CANCELLED\n * picker never reports anything at all.\n */\n onPickerOpen?: () => void;\n /**\n * Which way the source menu opens.\n *\n * ★ 'up' is right for the COMPOSER, which sits at the bottom of the panel — a\n * downward menu there is clipped by the panel edge at every size. It is wrong\n * for the voice session, whose attach control is anchored at the TOP: the menu\n * would open above the button, outside the panel, and all four sources would be\n * unreachable. The control would look present and do nothing.\n */\n direction?: 'up' | 'down';\n /** False once MAX_ATTACHMENTS is reached — the control explains why. */\n canAddMore: boolean;\n disabled?: boolean;\n}\n\nconst SOURCE_ICONS: Record<AttachmentSourceId, typeof Camera> = {\n camera: Camera,\n gallery: ImageIcon,\n documents: FileText,\n files: FolderOpen,\n};\n\n/**\n * Leading circular \"+\" attach control in the composer.\n *\n * ★ Opens a SOURCE MENU rather than the OS picker directly. One picker had to\n * stand in for every source, and on a phone it lands in Files — so\n * photographing a diseased leaf, the single most likely thing a farmer wants to\n * show the assistant, meant leaving for the camera app and coming back.\n *\n * ★ One input, reconfigured per source, rather than one input each. `accept` and\n * `capture` are set immediately before `.click()`, so there is exactly one place\n * a change event can arrive from and the existing `onFiles` contract — shared\n * with drag-drop and paste — is untouched.\n *\n * ★ Camera uses the `capture` attribute rather than a bespoke `getUserMedia`\n * viewfinder. That hands capture → preview → retake → use to the OS camera,\n * which does it better, is already localised, and cannot be exercised on a\n * desktop CI box at all; on a device without a camera the attribute is ignored\n * and the picker opens as usual, so it degrades instead of breaking.\n *\n * `accept` is advisory — the picker still allows \"All files\" on most platforms —\n * so validation lives in `validateFile`, not here.\n */\nexport const AssistantAttachmentButton: FC<Props> = ({\n onFiles,\n onPickerOpen,\n direction = 'up',\n canAddMore,\n disabled = false,\n}) => {\n const tr = useAssistantTr();\n const inputRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n // Ref so `pick` keeps its stable identity — it is passed to every menu item.\n const onPickerOpenRef = useRef(onPickerOpen);\n onPickerOpenRef.current = onPickerOpen;\n\n // Read once per mount: a device does not sprout a camera mid-session, and\n // matchMedia in render would run on every keystroke in the composer.\n const sources = useMemo(() => availableAttachmentSources(deviceHasCamera()), []);\n\n const label = canAddMore\n ? tr('composer.attach', 'Attach files or photos')\n : tr('composer.attachFull', 'Attachment limit reached ({{max}})', {\n max: MAX_ATTACHMENTS,\n });\n\n // Escape closes, and a click anywhere else closes — the same contract as the\n // export menu, so the two dropdowns in this panel behave identically.\n useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false);\n buttonRef.current?.focus();\n }\n };\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (menuRef.current?.contains(target) || buttonRef.current?.contains(target)) return;\n setOpen(false);\n };\n window.addEventListener('keydown', onKeyDown);\n window.addEventListener('mousedown', onPointerDown);\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('mousedown', onPointerDown);\n };\n }, [open]);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onFiles(event.target.files);\n // Reset so picking the SAME file twice in a row still fires a change event.\n event.target.value = '';\n },\n [onFiles]\n );\n\n const pick = useCallback((source: AttachmentSource) => {\n const input = inputRef.current;\n if (!input) return;\n input.accept = source.accept;\n input.multiple = source.multiple;\n // A property, not an attribute: `capture=\"\"` still means \"use the camera\",\n // so it has to be removed rather than blanked when the source is not camera.\n if (source.capture) input.setAttribute('capture', source.capture);\n else input.removeAttribute('capture');\n setOpen(false);\n onPickerOpenRef.current?.();\n input.click();\n }, []);\n\n return (\n <div className=\"relative flex-shrink-0\">\n <input\n ref={inputRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n onChange={handleChange}\n tabIndex={-1}\n aria-hidden=\"true\"\n data-testid=\"assistant-attach-input\"\n />\n <button\n ref={buttonRef}\n type=\"button\"\n onClick={() => setOpen((wasOpen) => !wasOpen)}\n disabled={disabled || !canAddMore}\n title={label}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n className=\"flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated\"\n data-testid=\"assistant-attach\"\n >\n <Plus className=\"size-4\" />\n </button>\n\n {open ? (\n <div\n ref={menuRef}\n role=\"menu\"\n aria-label={tr('composer.attachSource', 'Attach from')}\n // Direction follows the ANCHOR, not the component — see the prop.\n className={`absolute ${\n direction === 'up' ? 'bottom-full mb-2' : 'top-full mt-2'\n } left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`}\n data-testid=\"assistant-attach-menu\"\n >\n {sources.map((source) => {\n const Icon = SOURCE_ICONS[source.id];\n return (\n <button\n key={source.id}\n type=\"button\"\n role=\"menuitem\"\n onClick={() => pick(source)}\n className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken\"\n data-testid={`assistant-attach-source-${source.id}`}\n >\n <Icon className=\"size-4 flex-shrink-0 text-text-secondary\" aria-hidden=\"true\" />\n {tr(source.labelKey, source.labelFallback)}\n </button>\n );\n })}\n </div>\n ) : null}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAqCA,IAAM,IAA0D;CAC9D,QAAQ;CACR,SAAS;CACT,WAAW;CACX,OAAO;AACT,GAwBa,KAAwC,EACnD,YACA,iBACA,eAAY,MACZ,eACA,cAAW,SACP;CACJ,IAAM,IAAK,EAAe,GACpB,IAAW,EAAyB,IAAI,GACxC,IAAU,EAAuB,IAAI,GACrC,IAAY,EAA0B,IAAI,GAC1C,CAAC,GAAM,KAAW,EAAS,EAAK,GAEhC,IAAkB,EAAO,CAAY;CAC3C,EAAgB,UAAU;CAI1B,IAAM,IAAU,QAAc,EAA2B,EAAgB,CAAC,GAAG,CAAC,CAAC,GAEzE,IAAQ,IACV,EAAG,mBAAmB,wBAAwB,IAC9C,EAAG,uBAAuB,sCAAsC,EAC9D,KAAA,EACF,CAAC;CAIL,QAAgB;EACd,IAAI,CAAC,GAAM;EACX,IAAM,KAAa,MAAyB;GAC1C,AAAI,EAAM,QAAQ,aAChB,EAAQ,EAAK,GACb,EAAU,SAAS,MAAM;EAE7B,GACM,KAAiB,MAAsB;GAC3C,IAAM,IAAS,EAAM;GACjB,EAAQ,SAAS,SAAS,CAAM,KAAK,EAAU,SAAS,SAAS,CAAM,KAC3E,EAAQ,EAAK;EACf;EAGA,OAFA,OAAO,iBAAiB,WAAW,CAAS,GAC5C,OAAO,iBAAiB,aAAa,CAAa,SACrC;GAEX,AADA,OAAO,oBAAoB,WAAW,CAAS,GAC/C,OAAO,oBAAoB,aAAa,CAAa;EACvD;CACF,GAAG,CAAC,CAAI,CAAC;CAET,IAAM,IAAe,GAClB,MAAyC;EAGxC,AAFA,EAAQ,EAAM,OAAO,KAAK,GAE1B,EAAM,OAAO,QAAQ;CACvB,GACA,CAAC,CAAO,CACV,GAEM,IAAO,GAAa,MAA6B;EACrD,IAAM,IAAQ,EAAS;EAClB,MACL,EAAM,SAAS,EAAO,QACtB,EAAM,WAAW,EAAO,UAGpB,EAAO,UAAS,EAAM,aAAa,WAAW,EAAO,OAAO,IAC3D,EAAM,gBAAgB,SAAS,GACpC,EAAQ,EAAK,GACb,EAAgB,UAAU,GAC1B,EAAM,MAAM;CACd,GAAG,CAAC,CAAC;CAEL,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,SAAD;IACE,KAAK;IACL,MAAK;IACL,UAAA;IACA,WAAU;IACV,UAAU;IACV,UAAU;IACV,eAAY;IACZ,eAAY;GACb,CAAA;GACD,kBAAC,UAAD;IACE,KAAK;IACL,MAAK;IACL,eAAe,GAAS,MAAY,CAAC,CAAO;IAC5C,UAAU,KAAY,CAAC;IACvB,OAAO;IACP,cAAY;IACZ,iBAAc;IACd,iBAAe;IACf,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;GACpB,CAAA;GAEP,IACC,kBAAC,OAAD;IACE,KAAK;IACL,MAAK;IACL,cAAY,EAAG,yBAAyB,aAAa;IAErD,WAAW,YACT,MAAc,OAAO,qBAAqB,gBAC3C;IACD,eAAY;cAEX,EAAQ,KAAK,MAAW;KACvB,IAAM,IAAO,EAAa,EAAO;KACjC,OACE,kBAAC,UAAD;MAEE,MAAK;MACL,MAAK;MACL,eAAe,EAAK,CAAM;MAC1B,WAAU;MACV,eAAa,2BAA2B,EAAO;gBANjD,CAQE,kBAAC,GAAD;OAAM,WAAU;OAA2C,eAAY;MAAQ,CAAA,GAC9E,EAAG,EAAO,UAAU,EAAO,aAAa,CACnC;QATD,EAAO,EASN;IAEZ,CAAC;GACE,CAAA,IACH;EACD;;AAET"}
1
+ {"version":3,"file":"AssistantAttachmentButton.js","names":[],"sources":["../../../../src/components/assistant/composer/AssistantAttachmentButton.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState, type ChangeEvent, type FC } from 'react';\nimport { Camera, FileText, FolderOpen, ImageIcon, Plus } from 'lucide-react';\nimport { useAssistantTr } from '@burdenoff/fe-libs/shared/assistant';\nimport { MAX_ATTACHMENTS } from '@/utils/assistantAttachments';\nimport {\n availableAttachmentSources,\n deviceHasCamera,\n type AttachmentSource,\n type AttachmentSourceId,\n} from '@/utils/attachmentSources';\n\ninterface Props {\n onFiles: (files: FileList | null) => void;\n /**\n * The OS picker is about to take over the screen.\n *\n * ★ Exists for the voice session, which must release the microphone before the\n * camera app claims it. Fired on the `.click()` rather than on selection,\n * because by the time a file arrives the damage is done — and a CANCELLED\n * picker never reports anything at all.\n */\n onPickerOpen?: () => void;\n /**\n * Which way the source menu opens.\n *\n * ★ 'up' is right for the COMPOSER, which sits at the bottom of the panel — a\n * downward menu there is clipped by the panel edge at every size. It is wrong\n * for the voice session, whose attach control is anchored at the TOP: the menu\n * would open above the button, outside the panel, and all four sources would be\n * unreachable. The control would look present and do nothing.\n */\n direction?: 'up' | 'down';\n /** False once MAX_ATTACHMENTS is reached — the control explains why. */\n canAddMore: boolean;\n disabled?: boolean;\n}\n\nconst SOURCE_ICONS: Record<AttachmentSourceId, typeof Camera> = {\n camera: Camera,\n gallery: ImageIcon,\n documents: FileText,\n files: FolderOpen,\n};\n\n/**\n * Leading circular \"+\" attach control in the composer.\n *\n * ★ Opens a SOURCE MENU rather than the OS picker directly. One picker had to\n * stand in for every source, and on a phone it lands in Files — so\n * photographing a diseased leaf, the single most likely thing a farmer wants to\n * show the assistant, meant leaving for the camera app and coming back.\n *\n * ★ One input, reconfigured per source, rather than one input each. `accept` and\n * `capture` are set immediately before `.click()`, so there is exactly one place\n * a change event can arrive from and the existing `onFiles` contract — shared\n * with drag-drop and paste — is untouched.\n *\n * ★ Camera uses the `capture` attribute rather than a bespoke `getUserMedia`\n * viewfinder. That hands capture → preview → retake → use to the OS camera,\n * which does it better, is already localised, and cannot be exercised on a\n * desktop CI box at all; on a device without a camera the attribute is ignored\n * and the picker opens as usual, so it degrades instead of breaking.\n *\n * `accept` is advisory — the picker still allows \"All files\" on most platforms —\n * so validation lives in `validateFile`, not here.\n */\nexport const AssistantAttachmentButton: FC<Props> = ({\n onFiles,\n onPickerOpen,\n direction = 'up',\n canAddMore,\n disabled = false,\n}) => {\n const tr = useAssistantTr();\n const inputRef = useRef<HTMLInputElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n // Ref so `pick` keeps its stable identity — it is passed to every menu item.\n const onPickerOpenRef = useRef(onPickerOpen);\n onPickerOpenRef.current = onPickerOpen;\n\n // Read once per mount: a device does not sprout a camera mid-session, and\n // matchMedia in render would run on every keystroke in the composer.\n const sources = useMemo(() => availableAttachmentSources(deviceHasCamera()), []);\n\n const label = canAddMore\n ? tr('composer.attach', 'Attach files or photos')\n : tr('composer.attachFull', 'Attachment limit reached ({{max}})', {\n max: MAX_ATTACHMENTS,\n });\n\n // Escape closes, and a click anywhere else closes — the same contract as the\n // export menu, so the two dropdowns in this panel behave identically.\n useEffect(() => {\n if (!open) return;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false);\n buttonRef.current?.focus();\n }\n };\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (menuRef.current?.contains(target) || buttonRef.current?.contains(target)) return;\n setOpen(false);\n };\n window.addEventListener('keydown', onKeyDown);\n window.addEventListener('mousedown', onPointerDown);\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('mousedown', onPointerDown);\n };\n }, [open]);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onFiles(event.target.files);\n // Reset so picking the SAME file twice in a row still fires a change event.\n event.target.value = '';\n },\n [onFiles]\n );\n\n const pick = useCallback((source: AttachmentSource) => {\n const input = inputRef.current;\n if (!input) return;\n input.accept = source.accept;\n input.multiple = source.multiple;\n // A property, not an attribute: `capture=\"\"` still means \"use the camera\",\n // so it has to be removed rather than blanked when the source is not camera.\n if (source.capture) input.setAttribute('capture', source.capture);\n else input.removeAttribute('capture');\n setOpen(false);\n onPickerOpenRef.current?.();\n input.click();\n }, []);\n\n return (\n <div className=\"relative flex-shrink-0\">\n <input\n ref={inputRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n onChange={handleChange}\n tabIndex={-1}\n aria-hidden=\"true\"\n data-testid=\"assistant-attach-input\"\n />\n <button\n ref={buttonRef}\n type=\"button\"\n onClick={() => setOpen((wasOpen) => !wasOpen)}\n disabled={disabled || !canAddMore}\n title={label}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n className=\"flex size-9 items-center justify-center rounded-full border border-border-subtle bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:text-text-muted disabled:hover:bg-bg-elevated\"\n data-testid=\"assistant-attach\"\n >\n <Plus className=\"size-4\" />\n </button>\n\n {open ? (\n <div\n ref={menuRef}\n role=\"menu\"\n aria-label={tr('composer.attachSource', 'Attach from')}\n // Direction follows the ANCHOR, not the component — see the prop.\n className={`absolute ${\n direction === 'up' ? 'bottom-full mb-2' : 'top-full mt-2'\n } left-0 z-30 min-w-44 overflow-hidden rounded-xl border border-border-default bg-bg-elevated py-1 shadow-lg`}\n data-testid=\"assistant-attach-menu\"\n >\n {sources.map((source) => {\n const Icon = SOURCE_ICONS[source.id];\n return (\n <button\n key={source.id}\n type=\"button\"\n role=\"menuitem\"\n onClick={() => pick(source)}\n className=\"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken\"\n data-testid={`assistant-attach-source-${source.id}`}\n >\n <Icon className=\"size-4 flex-shrink-0 text-text-secondary\" aria-hidden=\"true\" />\n {tr(source.labelKey, source.labelFallback)}\n </button>\n );\n })}\n </div>\n ) : null}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAqCA,IAAM,IAA0D;CAC9D,QAAQ;CACR,SAAS;CACT,WAAW;CACX,OAAO;AACT,GAwBa,KAAwC,EACnD,YACA,iBACA,eAAY,MACZ,eACA,cAAW,SACP;CACJ,IAAM,IAAK,EAAe,GACpB,IAAW,EAAyB,IAAI,GACxC,IAAU,EAAuB,IAAI,GACrC,IAAY,EAA0B,IAAI,GAC1C,CAAC,GAAM,KAAW,EAAS,EAAK,GAEhC,IAAkB,EAAO,CAAY;CAC3C,EAAgB,UAAU;CAI1B,IAAM,IAAU,QAAc,EAA2B,EAAgB,CAAC,GAAG,CAAC,CAAC,GAEzE,IAAQ,IACV,EAAG,mBAAmB,wBAAwB,IAC9C,EAAG,uBAAuB,sCAAsC,EAC9D,KAAK,EACP,CAAC;CAIL,QAAgB;EACd,IAAI,CAAC,GAAM;EACX,IAAM,KAAa,MAAyB;GAC1C,AAAI,EAAM,QAAQ,aAChB,EAAQ,EAAK,GACb,EAAU,SAAS,MAAM;EAE7B,GACM,KAAiB,MAAsB;GAC3C,IAAM,IAAS,EAAM;GACjB,EAAQ,SAAS,SAAS,CAAM,KAAK,EAAU,SAAS,SAAS,CAAM,KAC3E,EAAQ,EAAK;EACf;EAGA,OAFA,OAAO,iBAAiB,WAAW,CAAS,GAC5C,OAAO,iBAAiB,aAAa,CAAa,SACrC;GAEX,AADA,OAAO,oBAAoB,WAAW,CAAS,GAC/C,OAAO,oBAAoB,aAAa,CAAa;EACvD;CACF,GAAG,CAAC,CAAI,CAAC;CAET,IAAM,IAAe,GAClB,MAAyC;EAGxC,AAFA,EAAQ,EAAM,OAAO,KAAK,GAE1B,EAAM,OAAO,QAAQ;CACvB,GACA,CAAC,CAAO,CACV,GAEM,IAAO,GAAa,MAA6B;EACrD,IAAM,IAAQ,EAAS;EAClB,MACL,EAAM,SAAS,EAAO,QACtB,EAAM,WAAW,EAAO,UAGpB,EAAO,UAAS,EAAM,aAAa,WAAW,EAAO,OAAO,IAC3D,EAAM,gBAAgB,SAAS,GACpC,EAAQ,EAAK,GACb,EAAgB,UAAU,GAC1B,EAAM,MAAM;CACd,GAAG,CAAC,CAAC;CAEL,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,SAAD;IACE,KAAK;IACL,MAAK;IACL,UAAA;IACA,WAAU;IACV,UAAU;IACV,UAAU;IACV,eAAY;IACZ,eAAY;GACb,CAAA;GACD,kBAAC,UAAD;IACE,KAAK;IACL,MAAK;IACL,eAAe,GAAS,MAAY,CAAC,CAAO;IAC5C,UAAU,KAAY,CAAC;IACvB,OAAO;IACP,cAAY;IACZ,iBAAc;IACd,iBAAe;IACf,WAAU;IACV,eAAY;cAEZ,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;GACpB,CAAA;GAEP,IACC,kBAAC,OAAD;IACE,KAAK;IACL,MAAK;IACL,cAAY,EAAG,yBAAyB,aAAa;IAErD,WAAW,YACT,MAAc,OAAO,qBAAqB,gBAC3C;IACD,eAAY;cAEX,EAAQ,KAAK,MAAW;KACvB,IAAM,IAAO,EAAa,EAAO;KACjC,OACE,kBAAC,UAAD;MAEE,MAAK;MACL,MAAK;MACL,eAAe,EAAK,CAAM;MAC1B,WAAU;MACV,eAAa,2BAA2B,EAAO;gBANjD,CAQE,kBAAC,GAAD;OAAM,WAAU;OAA2C,eAAY;MAAQ,CAAA,GAC9E,EAAG,EAAO,UAAU,EAAO,aAAa,CACnC;QATD,EAAO,EASN;IAEZ,CAAC;GACE,CAAA,IACH;EACD;;AAET"}
@@ -1,187 +1,187 @@
1
1
  import { useAssistantStore as e } from "../../../store/assistantStore.js";
2
2
  import { languageDisplayName as t } from "../../../utils/speechVoices.js";
3
3
  import { resolveAssistantLanguage as ee } from "../../../config/assistantLanguages.js";
4
- import { getSendableAttachments as n } from "../../../utils/assistantAttachments.js";
5
- import { useVoiceInput as r } from "../../../hooks/useVoiceInput.js";
6
- import { useAssistantAttachments as i } from "../../../hooks/useAssistantAttachments.js";
7
- import { AssistantAttachmentButton as a } from "./AssistantAttachmentButton.js";
8
- import { AssistantAttachmentChips as o } from "./AssistantAttachmentChips.js";
9
- import { AssistantVoiceButton as s } from "./AssistantVoiceButton.js";
10
- import { AssistantLanguageSelector as c } from "./AssistantLanguageSelector.js";
11
- import { AssistantVoiceSessionButton as te } from "../voice/AssistantVoiceSessionButton.js";
12
- import { AssistantModeSelector as ne } from "./AssistantModeSelector.js";
13
- import { useCallback as l, useLayoutEffect as re, useMemo as ie, useRef as u, useState as d } from "react";
14
- import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
- import { ArrowUp as p, Loader2 as m } from "lucide-react";
16
- import { useAssistantTr as h } from "@burdenoff/fe-libs/shared/assistant";
17
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
4
+ import { MAX_ATTACHMENTS as te, getSendableAttachments as ne } from "../../../utils/assistantAttachments.js";
5
+ import { useVoiceInput as n } from "../../../hooks/useVoiceInput.js";
6
+ import { useAssistantAttachments as re } from "../../../hooks/useAssistantAttachments.js";
7
+ import { AssistantAttachmentButton as r } from "./AssistantAttachmentButton.js";
8
+ import { AssistantAttachmentChips as i } from "./AssistantAttachmentChips.js";
9
+ import { AssistantVoiceButton as a } from "./AssistantVoiceButton.js";
10
+ import { AssistantLanguageSelector as o } from "./AssistantLanguageSelector.js";
11
+ import { AssistantVoiceSessionButton as s } from "../voice/AssistantVoiceSessionButton.js";
12
+ import { AssistantModeSelector as ie } from "./AssistantModeSelector.js";
13
+ import { useCallback as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f } from "react";
14
+ import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { ArrowUp as m, Loader2 as ae } from "lucide-react";
16
+ import { useAssistantTr as oe } from "@burdenoff/fe-libs/shared/assistant";
17
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
18
18
  //#region src/components/assistant/composer/AssistantComposer.tsx
19
- var v = 200, y = ({ writeAccessDenied: y = !1, onSend: b, disabled: x = !1, placeholder: ae, mode: oe, availableModes: S, onModeChange: se, onStartVoiceSession: C }) => {
20
- let w = h(), { locale: T } = f(), E = u(null), [D, O] = d(""), [k, A] = d(!1), j = u(0), { attachments: M, isBusy: N, preparingCount: P, sendBlocker: F, rejection: I, addFiles: L, remove: R, retry: z, clear: B, clearRejection: V, canAddMore: H } = i(), ce = l((e) => {
21
- O((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
22
- }, []), U = e((e) => e.assistantLanguage), W = e((e) => e.setAssistantLanguage), G = ie(() => ee(U, T), [U, T]), K = r({
23
- onFinalize: ce,
24
- language: G.tag
25
- }), le = ae ?? w("composer.placeholder", "Ask HealthyBowl anything…"), q = D.trim(), J = n(M), Y = M.filter((e) => e.status === "error"), X = (q.length > 0 || J.length > 0) && !x && F === null;
26
- re(() => {
27
- let e = E.current;
28
- e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, v)}px`);
29
- }, [D]);
30
- let Z = l(() => {
31
- X && (K.isActive && K.stop(), b(D.trim(), J), O(""), B());
19
+ var _ = 200, v = ({ writeAccessDenied: v = !1, onSend: y, disabled: b = !1, placeholder: x, mode: S, availableModes: C, onModeChange: se, onStartVoiceSession: w }) => {
20
+ let T = oe(), { locale: E } = p(), D = d(null), [O, k] = f(""), [A, j] = f(!1), M = d(0), { attachments: N, isBusy: P, preparingCount: F, sendBlocker: I, rejection: L, addFiles: R, remove: z, retry: B, clear: V, clearRejection: H, canAddMore: ce } = re(), U = c((e) => {
21
+ k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
22
+ }, []), W = e((e) => e.assistantLanguage), G = e((e) => e.setAssistantLanguage), K = u(() => ee(W, E), [W, E]), q = n({
23
+ onFinalize: U,
24
+ language: K.tag
25
+ }), le = x ?? T("composer.placeholder", "Ask HealthyBowl anything…"), J = O.trim(), Y = ne(N), X = N.filter((e) => e.status === "error"), Z = (J.length > 0 || Y.length > 0) && !b && I === null;
26
+ l(() => {
27
+ let e = D.current;
28
+ e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, _)}px`);
29
+ }, [O]);
30
+ let Q = c(() => {
31
+ Z && (q.isActive && q.stop(), y(O.trim(), Y), k(""), V());
32
32
  }, [
33
- X,
34
- b,
35
- D,
36
- J,
37
- B,
38
- K
39
- ]), ue = l((e) => {
40
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Z());
41
- }, [Z]), Q = l((e) => {
33
+ Z,
34
+ y,
35
+ O,
36
+ Y,
37
+ V,
38
+ q
39
+ ]), ue = c((e) => {
40
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Q());
41
+ }, [Q]), de = c((e) => {
42
42
  let t = Array.from(e.clipboardData?.files ?? []);
43
- t.length !== 0 && (e.preventDefault(), L(t));
44
- }, [L]), de = l((e) => {
45
- Array.from(e.dataTransfer?.types ?? []).includes("Files") && (j.current += 1, A(!0));
46
- }, []), fe = l(() => {
47
- j.current = Math.max(0, j.current - 1), j.current === 0 && A(!1);
48
- }, []), pe = l((e) => {
43
+ t.length !== 0 && (e.preventDefault(), R(t));
44
+ }, [R]), fe = c((e) => {
45
+ Array.from(e.dataTransfer?.types ?? []).includes("Files") && (M.current += 1, j(!0));
46
+ }, []), pe = c(() => {
47
+ M.current = Math.max(0, M.current - 1), M.current === 0 && j(!1);
48
+ }, []), me = c((e) => {
49
49
  Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
50
- }, []), me = l((e) => {
51
- e.preventDefault(), j.current = 0, A(!1), L(e.dataTransfer?.files ?? null);
52
- }, [L]), he = (e) => {
50
+ }, []), he = c((e) => {
51
+ e.preventDefault(), M.current = 0, j(!1), R(e.dataTransfer?.files ?? null);
52
+ }, [R]), ge = (e) => {
53
53
  switch (e) {
54
- case "too-many": return w("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
55
- case "too-large": return w("attachments.tooLarge", "That file is larger than 10 MB.");
56
- case "empty": return w("attachments.empty", "That file is empty.");
57
- case "unreadable": return w("attachments.unreadable", "That file could not be read.");
58
- case "unsupported-image": return w("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
54
+ case "too-many": return T("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: te });
55
+ case "too-large": return T("attachments.tooLarge", "That file is larger than 10 MB.");
56
+ case "empty": return T("attachments.empty", "That file is empty.");
57
+ case "unreadable": return T("attachments.unreadable", "That file could not be read.");
58
+ case "unsupported-image": return T("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
59
59
  }
60
60
  }, $ = (() => {
61
- switch (K.error) {
62
- case "not-allowed": return w("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
63
- case "audio-capture": return w("voice.noMic", "No microphone was found.");
64
- case "network": return w("voice.network", "Speech recognition is offline right now.");
65
- case "language-not-supported": return w("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: t(K.language, T) });
66
- case "unknown": return w("voice.failed", "Dictation stopped unexpectedly.");
61
+ switch (q.error) {
62
+ case "not-allowed": return T("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
63
+ case "audio-capture": return T("voice.noMic", "No microphone was found.");
64
+ case "network": return T("voice.network", "Speech recognition is offline right now.");
65
+ case "language-not-supported": return T("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: t(q.language, E) });
66
+ case "unknown": return T("voice.failed", "Dictation stopped unexpectedly.");
67
67
  default: return null;
68
68
  }
69
69
  })();
70
- return /* @__PURE__ */ _("div", {
70
+ return /* @__PURE__ */ g("div", {
71
71
  className: "flex-shrink-0 px-3 pb-3 pt-1.5",
72
72
  children: [
73
- /* @__PURE__ */ _("div", {
74
- onDragEnter: de,
75
- onDragLeave: fe,
76
- onDragOver: pe,
77
- onDrop: me,
78
- className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${k ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
73
+ /* @__PURE__ */ g("div", {
74
+ onDragEnter: fe,
75
+ onDragLeave: pe,
76
+ onDragOver: me,
77
+ onDrop: he,
78
+ className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${A ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
79
79
  "data-testid": "assistant-composer",
80
80
  children: [
81
- /* @__PURE__ */ g(o, {
82
- attachments: M,
83
- onRemove: R,
84
- onRetry: z,
85
- disabled: x,
86
- preparingCount: P
81
+ /* @__PURE__ */ h(i, {
82
+ attachments: N,
83
+ onRemove: z,
84
+ onRetry: B,
85
+ disabled: b,
86
+ preparingCount: F
87
87
  }),
88
- /* @__PURE__ */ _("div", {
88
+ /* @__PURE__ */ g("div", {
89
89
  className: "flex items-end gap-2",
90
90
  children: [
91
- /* @__PURE__ */ g(a, {
92
- onFiles: L,
93
- canAddMore: H,
94
- disabled: x
91
+ /* @__PURE__ */ h(r, {
92
+ onFiles: R,
93
+ canAddMore: ce,
94
+ disabled: b
95
95
  }),
96
- /* @__PURE__ */ g("textarea", {
97
- ref: E,
98
- value: D,
99
- onChange: (e) => O(e.target.value),
96
+ /* @__PURE__ */ h("textarea", {
97
+ ref: D,
98
+ value: O,
99
+ onChange: (e) => k(e.target.value),
100
100
  onKeyDown: ue,
101
- onPaste: Q,
102
- disabled: x,
103
- placeholder: k ? w("composer.dropHere", "Drop files to attach") : le,
101
+ onPaste: de,
102
+ disabled: b,
103
+ placeholder: A ? T("composer.dropHere", "Drop files to attach") : le,
104
104
  rows: 1,
105
105
  className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
106
- "aria-label": w("chatInput.ariaLabel", "Message input"),
106
+ "aria-label": T("chatInput.ariaLabel", "Message input"),
107
107
  "data-testid": "assistant-input"
108
108
  }),
109
- /* @__PURE__ */ g(c, {
110
- current: G,
111
- selected: U,
112
- onChange: W,
113
- disabled: x || K.isActive
109
+ /* @__PURE__ */ h(o, {
110
+ current: K,
111
+ selected: W,
112
+ onChange: G,
113
+ disabled: b || q.isActive
114
114
  }),
115
- K.isSupported && /* @__PURE__ */ g(s, {
116
- isListening: K.isListening,
117
- isStarting: K.isStarting,
118
- onToggle: K.toggle,
119
- disabled: x
115
+ q.isSupported && /* @__PURE__ */ h(a, {
116
+ isListening: q.isListening,
117
+ isStarting: q.isStarting,
118
+ onToggle: q.toggle,
119
+ disabled: b
120
120
  }),
121
- C && q.length === 0 && M.length === 0 && !K.isActive ? /* @__PURE__ */ g(te, {
122
- onStart: C,
123
- disabled: x
124
- }) : /* @__PURE__ */ g("button", {
121
+ w && J.length === 0 && N.length === 0 && !q.isActive ? /* @__PURE__ */ h(s, {
122
+ onStart: w,
123
+ disabled: b
124
+ }) : /* @__PURE__ */ h("button", {
125
125
  type: "button",
126
- onClick: Z,
127
- disabled: !X,
128
- className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${X ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
129
- "aria-label": w("chatInput.send", "Send message"),
126
+ onClick: Q,
127
+ disabled: !Z,
128
+ className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${Z ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
129
+ "aria-label": T("chatInput.send", "Send message"),
130
130
  "data-testid": "assistant-send",
131
- children: x || N ? /* @__PURE__ */ g(m, { className: "size-4 animate-spin" }) : /* @__PURE__ */ g(p, { className: "size-4" })
131
+ children: b || P ? /* @__PURE__ */ h(ae, { className: "size-4 animate-spin" }) : /* @__PURE__ */ h(m, { className: "size-4" })
132
132
  })
133
133
  ]
134
134
  }),
135
- S.length > 1 && /* @__PURE__ */ g("div", {
135
+ C.length > 1 && /* @__PURE__ */ h("div", {
136
136
  className: "mt-2 px-0.5",
137
- children: /* @__PURE__ */ g(ne, {
138
- mode: oe,
139
- availableModes: S,
137
+ children: /* @__PURE__ */ h(ie, {
138
+ mode: S,
139
+ availableModes: C,
140
140
  onModeChange: se,
141
- disabled: x
141
+ disabled: b
142
142
  })
143
143
  })
144
144
  ]
145
145
  }),
146
- y ? /* @__PURE__ */ g("p", {
146
+ v ? /* @__PURE__ */ h("p", {
147
147
  className: "mt-1.5 px-1 text-center text-[11px] text-status-warning",
148
148
  "data-testid": "assistant-write-access-warning",
149
- children: w("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
149
+ children: T("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
150
150
  }) : null,
151
- /* @__PURE__ */ g("div", {
151
+ /* @__PURE__ */ h("div", {
152
152
  className: "mt-1.5 px-1 text-center text-[11px]",
153
153
  "aria-live": "polite",
154
- children: K.isStarting && !K.isListening ? /* @__PURE__ */ g("p", {
154
+ children: q.isStarting && !q.isListening ? /* @__PURE__ */ h("p", {
155
155
  className: "text-text-muted",
156
156
  "data-testid": "assistant-voice-starting",
157
- children: w("voice.starting", "Starting the microphone…")
158
- }) : K.isListening ? /* @__PURE__ */ _("p", {
157
+ children: T("voice.starting", "Starting the microphone…")
158
+ }) : q.isListening ? /* @__PURE__ */ g("p", {
159
159
  className: "text-status-error-text",
160
160
  "data-testid": "assistant-voice-status",
161
- children: [/* @__PURE__ */ g("span", { className: "mr-1 inline-block size-1.5 rounded-full bg-status-error-text align-middle motion-safe:animate-pulse" }), K.interim || w("voice.listening", "Listening… speak now, tap the square to stop")]
162
- }) : $ ? /* @__PURE__ */ g("p", {
161
+ children: [/* @__PURE__ */ h("span", { className: "mr-1 inline-block size-1.5 rounded-full bg-status-error-text align-middle motion-safe:animate-pulse" }), q.interim || T("voice.listening", "Listening… speak now, tap the square to stop")]
162
+ }) : $ ? /* @__PURE__ */ h("p", {
163
163
  className: "text-status-error-text",
164
164
  "data-testid": "assistant-voice-error",
165
165
  children: $
166
- }) : I ? /* @__PURE__ */ g("button", {
166
+ }) : L ? /* @__PURE__ */ h("button", {
167
167
  type: "button",
168
- onClick: V,
168
+ onClick: H,
169
169
  className: "text-status-error-text underline-offset-2 hover:underline",
170
170
  "data-testid": "assistant-attachment-rejection",
171
- children: he(I)
172
- }) : F === "failed" ? /* @__PURE__ */ g("p", {
171
+ children: ge(L)
172
+ }) : I === "failed" ? /* @__PURE__ */ h("p", {
173
173
  className: "text-status-error-text",
174
174
  "data-testid": "assistant-attachment-blocked",
175
- children: Y.length === 1 ? w("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: Y[0].filename }) : w("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: Y.length })
176
- }) : /* @__PURE__ */ g("p", {
175
+ children: X.length === 1 ? T("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: X[0].filename }) : T("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: X.length })
176
+ }) : /* @__PURE__ */ h("p", {
177
177
  className: "text-text-muted",
178
- children: w("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
178
+ children: T("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
179
179
  })
180
180
  })
181
181
  ]
182
182
  });
183
183
  };
184
184
  //#endregion
185
- export { y as AssistantComposer };
185
+ export { v as AssistantComposer };
186
186
 
187
187
  //# sourceMappingURL=AssistantComposer.js.map