@eka-care/medical-records-ui 1.2.13 → 1.2.16

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 (51) hide show
  1. package/dist/{OriginalRecordPanel-EYOVIYJH.mjs → OriginalRecordPanel-HBEPXX4Y.mjs} +3 -3
  2. package/dist/{OriginalRecordPanel-M6IZWRUF.js → OriginalRecordPanel-PCFL4KRH.js} +19 -19
  3. package/dist/{OriginalRecordPanel-M6IZWRUF.js.map → OriginalRecordPanel-PCFL4KRH.js.map} +1 -1
  4. package/dist/SmartUploadModal-3P2GAWXM.js +11 -0
  5. package/dist/{SmartUploadModal-RQ5W33OE.js.map → SmartUploadModal-3P2GAWXM.js.map} +1 -1
  6. package/dist/{SmartUploadModal-IOLZU6YA.mjs → SmartUploadModal-4TEHAM5P.mjs} +3 -3
  7. package/dist/VitalHistoryPanel-L43PLXTX.js +12 -0
  8. package/dist/{VitalHistoryPanel-FHY27XA5.js.map → VitalHistoryPanel-L43PLXTX.js.map} +1 -1
  9. package/dist/VitalHistoryPanel-US2HXGCR.mjs +12 -0
  10. package/dist/{chunk-36KDDCWU.mjs → chunk-5V3A6NJU.mjs} +2 -2
  11. package/dist/{chunk-2SFND57U.js → chunk-H2DKQ6IE.js} +14 -14
  12. package/dist/{chunk-2SFND57U.js.map → chunk-H2DKQ6IE.js.map} +1 -1
  13. package/dist/{chunk-6EN4LTIT.mjs → chunk-MPOY25TA.mjs} +3 -2
  14. package/dist/chunk-MPOY25TA.mjs.map +1 -0
  15. package/dist/{chunk-7XNJKV4H.js → chunk-NTFOVMHN.js} +3 -2
  16. package/dist/chunk-NTFOVMHN.js.map +1 -0
  17. package/dist/{chunk-FXAL6MAX.mjs → chunk-PIQG3RZA.mjs} +3 -3
  18. package/dist/{chunk-U4JSEP3G.js → chunk-VA2ZDYP2.js} +16 -15
  19. package/dist/chunk-VA2ZDYP2.js.map +1 -0
  20. package/dist/{chunk-LG6SPPD4.js → chunk-VHE5O2AM.js} +21 -21
  21. package/dist/{chunk-LG6SPPD4.js.map → chunk-VHE5O2AM.js.map} +1 -1
  22. package/dist/{chunk-LLBFSULS.mjs → chunk-ZRNPUDQY.mjs} +7 -6
  23. package/dist/chunk-ZRNPUDQY.mjs.map +1 -0
  24. package/dist/index.css +7 -1
  25. package/dist/index.css.map +1 -1
  26. package/dist/index.d.mts +42 -9
  27. package/dist/index.d.ts +42 -9
  28. package/dist/index.js +269 -153
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +389 -273
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/styles.css +7 -1
  33. package/dist/styles.css.map +1 -1
  34. package/dist/widgets-J6JCO5NX.js +51 -0
  35. package/dist/{widgets-3MZCYTPF.js.map → widgets-J6JCO5NX.js.map} +1 -1
  36. package/dist/{widgets-NJ2AXABO.mjs → widgets-V22RS7VB.mjs} +2 -2
  37. package/package.json +2 -2
  38. package/dist/SmartUploadModal-RQ5W33OE.js +0 -11
  39. package/dist/VitalHistoryPanel-FHY27XA5.js +0 -12
  40. package/dist/VitalHistoryPanel-XTATAJHE.mjs +0 -12
  41. package/dist/chunk-6EN4LTIT.mjs.map +0 -1
  42. package/dist/chunk-7XNJKV4H.js.map +0 -1
  43. package/dist/chunk-LLBFSULS.mjs.map +0 -1
  44. package/dist/chunk-U4JSEP3G.js.map +0 -1
  45. package/dist/widgets-3MZCYTPF.js +0 -51
  46. /package/dist/{OriginalRecordPanel-EYOVIYJH.mjs.map → OriginalRecordPanel-HBEPXX4Y.mjs.map} +0 -0
  47. /package/dist/{SmartUploadModal-IOLZU6YA.mjs.map → SmartUploadModal-4TEHAM5P.mjs.map} +0 -0
  48. /package/dist/{VitalHistoryPanel-XTATAJHE.mjs.map → VitalHistoryPanel-US2HXGCR.mjs.map} +0 -0
  49. /package/dist/{chunk-36KDDCWU.mjs.map → chunk-5V3A6NJU.mjs.map} +0 -0
  50. /package/dist/{chunk-FXAL6MAX.mjs.map → chunk-PIQG3RZA.mjs.map} +0 -0
  51. /package/dist/{widgets-NJ2AXABO.mjs.map → widgets-V22RS7VB.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import "./chunk-FXAL6MAX.mjs";
3
- import "./chunk-36KDDCWU.mjs";
2
+ import "./chunk-PIQG3RZA.mjs";
3
+ import "./chunk-5V3A6NJU.mjs";
4
4
  import {
5
5
  SmartSparkles_default,
6
6
  latestTrendCells,
@@ -12,7 +12,7 @@ import {
12
12
  useRecordPanelTable,
13
13
  useRecordPreview,
14
14
  useSmartRecordsActions
15
- } from "./chunk-LLBFSULS.mjs";
15
+ } from "./chunk-ZRNPUDQY.mjs";
16
16
  import {
17
17
  isHttpUrl
18
18
  } from "./chunk-LFLPB6DK.mjs";
@@ -55,7 +55,7 @@ import {
55
55
  useCasesConnection,
56
56
  useSdk,
57
57
  writeVitalTrendCache
58
- } from "./chunk-6EN4LTIT.mjs";
58
+ } from "./chunk-MPOY25TA.mjs";
59
59
  import {
60
60
  stripEmptyLeadingTables
61
61
  } from "./chunk-RWRJSQ2U.mjs";
@@ -753,10 +753,10 @@ function SdkProvider({
753
753
  import {
754
754
  lazy as lazy3,
755
755
  Suspense as Suspense3,
756
- useEffect as useEffect15,
756
+ useEffect as useEffect16,
757
757
  useMemo as useMemo11,
758
- useState as useState14,
759
- useCallback as useCallback23,
758
+ useState as useState16,
759
+ useCallback as useCallback24,
760
760
  useRef as useRef13
761
761
  } from "react";
762
762
  import { useStore as useStore16 } from "zustand";
@@ -1898,7 +1898,7 @@ function SmartRecordSmartPanel({
1898
1898
  }
1899
1899
 
1900
1900
  // src/views/containers/smart-records/RecordPanel.tsx
1901
- import { useCallback as useCallback10, useMemo as useMemo5 } from "react";
1901
+ import { useCallback as useCallback11, useEffect as useEffect6, useMemo as useMemo5, useState as useState9 } from "react";
1902
1902
  import { LoaderCircle as LoaderCircle4 } from "lucide-react";
1903
1903
  import { useStore as useStore5 } from "zustand";
1904
1904
 
@@ -2778,36 +2778,141 @@ function PrescriptionPanel({ conversion, onBack, onViewOriginal, onAttach }) {
2778
2778
  ] });
2779
2779
  }
2780
2780
 
2781
- // src/views/containers/smart-records/RecordPanel.tsx
2781
+ // src/prescription/components/ScribeDocumentPanel.tsx
2782
+ import { useCallback as useCallback10, useState as useState8 } from "react";
2783
+ import { Check as Check2, ChevronLeft as ChevronLeft6, ChevronRight as ChevronRight5 } from "lucide-react";
2782
2784
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2785
+ function ScribeDocumentPanel({
2786
+ documentId,
2787
+ recordId,
2788
+ title,
2789
+ date,
2790
+ renderDocument,
2791
+ onUnavailable,
2792
+ onBack,
2793
+ onViewOriginal
2794
+ }) {
2795
+ const [copyState, setCopyState] = useState8(null);
2796
+ const handleCopyFooter = useCallback10(
2797
+ (e) => {
2798
+ const rect = e.currentTarget.getBoundingClientRect();
2799
+ void copyState?.copy({ x: rect.left + rect.width / 2, y: rect.bottom });
2800
+ },
2801
+ [copyState]
2802
+ );
2803
+ const handleSelectAllKeyDown = useCallback10(
2804
+ (e) => {
2805
+ if (e.key !== " " && e.key !== "Enter") return;
2806
+ e.preventDefault();
2807
+ copyState?.toggleAll();
2808
+ },
2809
+ [copyState]
2810
+ );
2811
+ const canCopy = !!copyState && copyState.total > 0;
2812
+ const someSelected = (copyState?.selectedCount ?? 0) > 0;
2813
+ return /* @__PURE__ */ jsxs11("div", { className: "mr-sv__panel", children: [
2814
+ onBack && /* @__PURE__ */ jsx12("div", { className: "mr-sv__back-row", children: /* @__PURE__ */ jsxs11("button", { type: "button", className: "mr-sv__back-btn", onClick: onBack, children: [
2815
+ /* @__PURE__ */ jsx12(ChevronLeft6, { size: 16, "aria-hidden": true }),
2816
+ "Back"
2817
+ ] }) }),
2818
+ /* @__PURE__ */ jsxs11("div", { className: "mr-cc-panel__header", children: [
2819
+ /* @__PURE__ */ jsx12("div", { className: "mr-cc-panel__header-left", children: /* @__PURE__ */ jsxs11("div", { className: "mr-cc-panel__info", children: [
2820
+ /* @__PURE__ */ jsx12("div", { className: "mr-cc-panel__name-row", children: /* @__PURE__ */ jsx12(Typography_default, { variant: "label", as: "span", className: "mr-cc-panel__name", children: title }) }),
2821
+ /* @__PURE__ */ jsx12("span", { className: "mr-cc-panel__sub", children: date })
2822
+ ] }) }),
2823
+ onViewOriginal && /* @__PURE__ */ jsxs11("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: onViewOriginal, children: [
2824
+ "View original",
2825
+ /* @__PURE__ */ jsx12(ChevronRight5, { size: 16, "aria-hidden": true })
2826
+ ] })
2827
+ ] }),
2828
+ /* @__PURE__ */ jsx12("div", { className: "mr-sv__panel-body mr-rx-body", children: /* @__PURE__ */ jsx12("div", { className: "mr-rx-scroll mr-scribe-doc", children: renderDocument({ documentId, recordId, setCopyState, onUnavailable }) }) }),
2829
+ canCopy && copyState && /* @__PURE__ */ jsxs11("div", { className: "mr-cc-table__footer", children: [
2830
+ /* @__PURE__ */ jsx12(
2831
+ "span",
2832
+ {
2833
+ className: `mr-sv__checkbox mr-cc-table__footer-check${copyState.allSelected ? " mr-sv__checkbox--checked" : ""}`,
2834
+ role: "checkbox",
2835
+ "aria-checked": copyState.allSelected,
2836
+ "aria-label": "Select all sections",
2837
+ tabIndex: 0,
2838
+ onClick: copyState.toggleAll,
2839
+ onKeyDown: handleSelectAllKeyDown,
2840
+ children: copyState.allSelected && /* @__PURE__ */ jsx12(Check2, { size: 10, strokeWidth: 3 })
2841
+ }
2842
+ ),
2843
+ /* @__PURE__ */ jsx12("span", { className: "mr-cc-table__footer-label", onClick: copyState.toggleAll, children: "Select all" }),
2844
+ /* @__PURE__ */ jsxs11("span", { className: "mr-cc-table__footer-count", children: [
2845
+ copyState.selectedCount,
2846
+ " of ",
2847
+ copyState.total,
2848
+ " selected"
2849
+ ] }),
2850
+ /* @__PURE__ */ jsx12(
2851
+ "button",
2852
+ {
2853
+ type: "button",
2854
+ className: "mr-cc-table__copy-note-btn",
2855
+ disabled: !someSelected,
2856
+ onClick: handleCopyFooter,
2857
+ children: "Copy to note"
2858
+ }
2859
+ )
2860
+ ] })
2861
+ ] });
2862
+ }
2863
+
2864
+ // src/views/containers/smart-records/RecordPanel.tsx
2865
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2866
+ var SCRIBE_SOURCE = "scribe";
2783
2867
  function RecordPanel({ recordId, caseId, onBack }) {
2784
2868
  const { store } = useSdk();
2785
2869
  const record = useStore5(store, (s) => s.records.byId[recordId]);
2786
- const { openOriginal, attachToContext } = useSmartRecordsActions();
2870
+ const { openOriginal, attachToContext, renderScribeDocument } = useSmartRecordsActions();
2787
2871
  const preview = useRecordPreview(recordId);
2872
+ const source = record?.source ?? preview.source;
2873
+ const [unavailableFor, setUnavailableFor] = useState9(null);
2874
+ useEffect6(() => setUnavailableFor(null), [recordId]);
2875
+ const handleScribeUnavailable = useCallback11(() => setUnavailableFor(recordId), [recordId]);
2876
+ const isScribeNote = !!preview.fhirBundle && source === SCRIBE_SOURCE && !!renderScribeDocument && unavailableFor !== recordId;
2788
2877
  const conversion = useMemo5(
2789
- () => preview.fhirBundle ? convertPrescriptionBundle(preview.fhirBundle) : null,
2790
- [preview.fhirBundle]
2878
+ () => preview.fhirBundle && !isScribeNote ? convertPrescriptionBundle(preview.fhirBundle) : null,
2879
+ [preview.fhirBundle, isScribeNote]
2791
2880
  );
2792
- const handleViewOriginal = useCallback10(
2881
+ const handleViewOriginal = useCallback11(
2793
2882
  () => openOriginal(recordId, "smart", void 0, caseId),
2794
2883
  [openOriginal, recordId, caseId]
2795
2884
  );
2796
- const handleAttach = useCallback10(
2885
+ const handleAttach = useCallback11(
2797
2886
  (name) => void attachToContext?.(recordId, name, recordId),
2798
2887
  [attachToContext, recordId]
2799
2888
  );
2800
2889
  if (preview.status === "loading") {
2801
- return /* @__PURE__ */ jsx12("div", { className: "mr-sv__panel", children: /* @__PURE__ */ jsx12("div", { className: "mr-sv__panel-body", children: /* @__PURE__ */ jsxs11("div", { className: "mr-sv__loading-panel", children: [
2802
- /* @__PURE__ */ jsx12(LoaderCircle4, { size: 44, className: "mr-sv__loading-spinner", "aria-hidden": true }),
2803
- /* @__PURE__ */ jsxs11("div", { className: "mr-sv__empty-text", children: [
2804
- /* @__PURE__ */ jsx12(Typography_default, { variant: "heading", children: "Loading record..." }),
2805
- /* @__PURE__ */ jsx12(Typography_default, { variant: "muted", children: "Fetching the record details" })
2890
+ return /* @__PURE__ */ jsx13("div", { className: "mr-sv__panel", children: /* @__PURE__ */ jsx13("div", { className: "mr-sv__panel-body", children: /* @__PURE__ */ jsxs12("div", { className: "mr-sv__loading-panel", children: [
2891
+ /* @__PURE__ */ jsx13(LoaderCircle4, { size: 44, className: "mr-sv__loading-spinner", "aria-hidden": true }),
2892
+ /* @__PURE__ */ jsxs12("div", { className: "mr-sv__empty-text", children: [
2893
+ /* @__PURE__ */ jsx13(Typography_default, { variant: "heading", children: "Loading record..." }),
2894
+ /* @__PURE__ */ jsx13(Typography_default, { variant: "muted", children: "Fetching the record details" })
2806
2895
  ] })
2807
2896
  ] }) }) });
2808
2897
  }
2898
+ if (isScribeNote) {
2899
+ const documentId = recordId;
2900
+ return /* @__PURE__ */ jsx13(
2901
+ ScribeDocumentPanel,
2902
+ {
2903
+ documentId,
2904
+ recordId,
2905
+ title: record?.title ?? "Prescription",
2906
+ date: record ? epochToDisplay(record.createdAtEpoch) : "",
2907
+ renderDocument: renderScribeDocument,
2908
+ onUnavailable: handleScribeUnavailable,
2909
+ onBack,
2910
+ onViewOriginal: preview.files.length > 0 ? handleViewOriginal : void 0
2911
+ }
2912
+ );
2913
+ }
2809
2914
  if (conversion) {
2810
- return /* @__PURE__ */ jsx12(
2915
+ return /* @__PURE__ */ jsx13(
2811
2916
  PrescriptionPanel,
2812
2917
  {
2813
2918
  conversion,
@@ -2817,25 +2922,25 @@ function RecordPanel({ recordId, caseId, onBack }) {
2817
2922
  }
2818
2923
  );
2819
2924
  }
2820
- if (record?.isSmart) return /* @__PURE__ */ jsx12(SmartRecordSmartPanel, { recordId, caseId, onBack });
2821
- return /* @__PURE__ */ jsx12(SmartRecordPreviewPanel, { recordId, preview, onBack });
2925
+ if (record?.isSmart) return /* @__PURE__ */ jsx13(SmartRecordSmartPanel, { recordId, caseId, onBack });
2926
+ return /* @__PURE__ */ jsx13(SmartRecordPreviewPanel, { recordId, preview, onBack });
2822
2927
  }
2823
2928
 
2824
2929
  // src/views/containers/smart-records/SmartRecordsSidebar.tsx
2825
- import { memo as memo9, useCallback as useCallback22, useEffect as useEffect14, useMemo as useMemo10, useRef as useRef12, useState as useState13 } from "react";
2826
- import { ArrowUp, ArrowDown, ChevronLeft as ChevronLeft6, ChevronRight as ChevronRight5, Funnel, RefreshCw } from "lucide-react";
2930
+ import { memo as memo9, useCallback as useCallback23, useEffect as useEffect15, useMemo as useMemo10, useRef as useRef12, useState as useState15 } from "react";
2931
+ import { ArrowUp, ArrowDown, ChevronLeft as ChevronLeft7, ChevronRight as ChevronRight6, Funnel, RefreshCw } from "lucide-react";
2827
2932
  import { useStore as useStore15 } from "zustand";
2828
2933
 
2829
2934
  // src/views/hooks/shared/useJumpToSelected.ts
2830
- import { useCallback as useCallback11, useEffect as useEffect6, useState as useState8 } from "react";
2935
+ import { useCallback as useCallback12, useEffect as useEffect7, useState as useState10 } from "react";
2831
2936
  var HIDDEN = { visible: false, direction: "down" };
2832
2937
  function useJumpToSelected(activeId, listKey) {
2833
- const [body, setBody] = useState8(null);
2834
- const scrollBodyRef = useCallback11((node) => {
2938
+ const [body, setBody] = useState10(null);
2939
+ const scrollBodyRef = useCallback12((node) => {
2835
2940
  setBody(node);
2836
2941
  }, []);
2837
- const [state, setState] = useState8(HIDDEN);
2838
- const evaluate = useCallback11(() => {
2942
+ const [state, setState] = useState10(HIDDEN);
2943
+ const evaluate = useCallback12(() => {
2839
2944
  const active = body?.querySelector(".mr-sv__record-item--active") ?? null;
2840
2945
  if (!body || !active) {
2841
2946
  setState((s) => s.visible ? HIDDEN : s);
@@ -2851,7 +2956,7 @@ function useJumpToSelected(activeId, listKey) {
2851
2956
  setState((s) => s.visible ? HIDDEN : s);
2852
2957
  }
2853
2958
  }, [body, activeId]);
2854
- useEffect6(() => {
2959
+ useEffect7(() => {
2855
2960
  if (!body) return;
2856
2961
  body.addEventListener("scroll", evaluate, { passive: true });
2857
2962
  window.addEventListener("resize", evaluate);
@@ -2860,10 +2965,10 @@ function useJumpToSelected(activeId, listKey) {
2860
2965
  window.removeEventListener("resize", evaluate);
2861
2966
  };
2862
2967
  }, [body, evaluate]);
2863
- useEffect6(() => {
2968
+ useEffect7(() => {
2864
2969
  evaluate();
2865
2970
  }, [evaluate, listKey]);
2866
- const jumpToSelected = useCallback11(() => {
2971
+ const jumpToSelected = useCallback12(() => {
2867
2972
  body?.querySelector(".mr-sv__record-item--active")?.scrollIntoView({ behavior: "smooth", block: "center" });
2868
2973
  }, [body]);
2869
2974
  return {
@@ -2875,12 +2980,12 @@ function useJumpToSelected(activeId, listKey) {
2875
2980
  }
2876
2981
 
2877
2982
  // src/views/hooks/shared/useLoadMoreSentinel.ts
2878
- import { useEffect as useEffect7, useRef as useRef7 } from "react";
2983
+ import { useEffect as useEffect8, useRef as useRef7 } from "react";
2879
2984
  function useLoadMoreSentinel(enabled, onReach, key) {
2880
2985
  const ref = useRef7(null);
2881
2986
  const onReachRef = useRef7(onReach);
2882
2987
  onReachRef.current = onReach;
2883
- useEffect7(() => {
2988
+ useEffect8(() => {
2884
2989
  if (!enabled) return;
2885
2990
  const el = ref.current;
2886
2991
  if (!el) return;
@@ -3068,21 +3173,21 @@ function useSidebarCollection({ limit } = {}) {
3068
3173
  }
3069
3174
 
3070
3175
  // src/connection/useRecordsConnection.ts
3071
- import { useCallback as useCallback12, useEffect as useEffect8, useRef as useRef8, useState as useState9 } from "react";
3176
+ import { useCallback as useCallback13, useEffect as useEffect9, useRef as useRef8, useState as useState11 } from "react";
3072
3177
  function useRecordsConnection() {
3073
3178
  const { bid, patientId, store, labelOf } = useSdk();
3074
3179
  const toMs = (s) => s != null ? s * 1e3 : null;
3075
- const [sourceRefreshedAt, setSourceRefreshedAt] = useState9(
3180
+ const [sourceRefreshedAt, setSourceRefreshedAt] = useState11(
3076
3181
  () => toMs(getCore().sourceRefreshedAt)
3077
3182
  );
3078
3183
  const loadedKeyRef = useRef8(null);
3079
- const applyItems = useCallback12(
3184
+ const applyItems = useCallback13(
3080
3185
  (items) => {
3081
3186
  store.getState().records.setAll(items.map((d) => documentItemToUi(d, labelOf)));
3082
3187
  },
3083
3188
  [store, labelOf]
3084
3189
  );
3085
- const load = useCallback12(async () => {
3190
+ const load = useCallback13(async () => {
3086
3191
  const records = store.getState().records;
3087
3192
  records.setStatus("loading");
3088
3193
  try {
@@ -3101,13 +3206,13 @@ function useRecordsConnection() {
3101
3206
  records.setStatus("idle");
3102
3207
  }
3103
3208
  }, [bid, patientId, store, applyItems]);
3104
- useEffect8(() => {
3209
+ useEffect9(() => {
3105
3210
  const key = `${bid}::${patientId}`;
3106
3211
  if (loadedKeyRef.current === key) return;
3107
3212
  loadedKeyRef.current = key;
3108
3213
  void load();
3109
3214
  }, [bid, patientId, load]);
3110
- useEffect8(() => {
3215
+ useEffect9(() => {
3111
3216
  const unsubscribe = getCore().subscribe("documents:changed", () => {
3112
3217
  clearVitalTrendCacheForPatient(bid, patientId);
3113
3218
  void getCore().listLocalDocuments({ bid, patientId }).then(applyItems).catch(() => {
@@ -3115,13 +3220,13 @@ function useRecordsConnection() {
3115
3220
  });
3116
3221
  return unsubscribe;
3117
3222
  }, [bid, patientId, applyItems]);
3118
- const editRecord = useCallback12(
3223
+ const editRecord = useCallback13(
3119
3224
  async (documentId, data) => {
3120
3225
  await getCore().editDocument({ documentId, data, bid, patientId });
3121
3226
  },
3122
3227
  [bid, patientId]
3123
3228
  );
3124
- const deleteRecord = useCallback12(
3229
+ const deleteRecord = useCallback13(
3125
3230
  async (documentId) => {
3126
3231
  const records = store.getState().records;
3127
3232
  records.markPending(documentId);
@@ -3136,7 +3241,7 @@ function useRecordsConnection() {
3136
3241
  },
3137
3242
  [bid, patientId, store]
3138
3243
  );
3139
- const refresh = useCallback12(async () => {
3244
+ const refresh = useCallback13(async () => {
3140
3245
  store.getState().records.setStatus("loading");
3141
3246
  try {
3142
3247
  const fresh = await getCore().refreshDocumentSource({ bid, patientId, preferenceType: "HTML" });
@@ -3148,7 +3253,7 @@ function useRecordsConnection() {
3148
3253
  store.getState().records.setStatus("stale");
3149
3254
  }
3150
3255
  }, [bid, patientId, store, applyItems]);
3151
- const retry = useCallback12(async () => {
3256
+ const retry = useCallback13(async () => {
3152
3257
  loadedKeyRef.current = null;
3153
3258
  await load();
3154
3259
  }, [load]);
@@ -3156,15 +3261,15 @@ function useRecordsConnection() {
3156
3261
  }
3157
3262
 
3158
3263
  // src/connection/useRecordDetail.ts
3159
- import { useEffect as useEffect9 } from "react";
3264
+ import { useEffect as useEffect10 } from "react";
3160
3265
  import { useStore as useStore7 } from "zustand";
3161
3266
 
3162
3267
  // src/connection/useAllRecordTags.ts
3163
- import { useEffect as useEffect10, useState as useState10 } from "react";
3268
+ import { useEffect as useEffect11, useState as useState12 } from "react";
3164
3269
  import { useStore as useStore8 } from "zustand";
3165
3270
 
3166
3271
  // src/connection/useCollectionConnection.ts
3167
- import { useCallback as useCallback13, useEffect as useEffect11, useRef as useRef9 } from "react";
3272
+ import { useCallback as useCallback14, useEffect as useEffect12, useRef as useRef9 } from "react";
3168
3273
  import { useStore as useStore9 } from "zustand";
3169
3274
  function useCollectionConnection(enabled = true) {
3170
3275
  const { bid, patientId, store } = useSdk();
@@ -3174,11 +3279,11 @@ function useCollectionConnection(enabled = true) {
3174
3279
  const documentDateTo = useStore9(store, (s) => s.filters.documentDateTo);
3175
3280
  const filterRef = useRef9(toCollectionFilter({ types, documentDateFrom, documentDateTo }));
3176
3281
  filterRef.current = toCollectionFilter({ types, documentDateFrom, documentDateTo });
3177
- const apply = useCallback13(
3282
+ const apply = useCallback14(
3178
3283
  (groups) => store.getState().collection.setGroups(groups),
3179
3284
  [store]
3180
3285
  );
3181
- const load = useCallback13(async () => {
3286
+ const load = useCallback14(async () => {
3182
3287
  const collection = store.getState().collection;
3183
3288
  collection.setStatus("loading");
3184
3289
  try {
@@ -3187,26 +3292,21 @@ function useCollectionConnection(enabled = true) {
3187
3292
  patientId,
3188
3293
  filter: filterRef.current,
3189
3294
  onStale: (cached) => {
3190
- console.log("[mr-ui] groupCollectionItems stale", { bid, patientId, filter: filterRef.current, groups: cached });
3191
3295
  apply(cached);
3192
3296
  store.getState().collection.setStatus("stale");
3193
3297
  }
3194
3298
  });
3195
- console.log("[mr-ui] groupCollectionItems fresh", { bid, patientId, filter: filterRef.current, groups: fresh });
3196
3299
  apply(fresh);
3197
3300
  store.getState().collection.setStatus("fresh");
3198
3301
  } catch (e) {
3199
3302
  store.getState().collection.setError(e instanceof Error ? e.message : "Failed to load records");
3200
3303
  }
3201
3304
  }, [bid, patientId, store, apply]);
3202
- const reload = useCallback13(() => {
3203
- void getCore().groupCollectionItems({ bid, patientId, localOnly: true, filter: filterRef.current }).then((groups) => {
3204
- console.log("[mr-ui] groupCollectionItems localOnly", { bid, patientId, filter: filterRef.current, groups });
3205
- apply(groups);
3206
- }).catch(() => {
3305
+ const reload = useCallback14(() => {
3306
+ void getCore().groupCollectionItems({ bid, patientId, localOnly: true, filter: filterRef.current }).then(apply).catch(() => {
3207
3307
  });
3208
3308
  }, [bid, patientId, apply]);
3209
- useEffect11(() => {
3309
+ useEffect12(() => {
3210
3310
  if (!enabled) return;
3211
3311
  const key = `${bid}::${patientId}`;
3212
3312
  if (loadedKeyRef.current === key) return;
@@ -3214,7 +3314,7 @@ function useCollectionConnection(enabled = true) {
3214
3314
  void load();
3215
3315
  }, [enabled, bid, patientId, load]);
3216
3316
  const firstFilterRef = useRef9(true);
3217
- useEffect11(() => {
3317
+ useEffect12(() => {
3218
3318
  if (!enabled) return;
3219
3319
  if (firstFilterRef.current) {
3220
3320
  firstFilterRef.current = false;
@@ -3222,7 +3322,7 @@ function useCollectionConnection(enabled = true) {
3222
3322
  }
3223
3323
  reload();
3224
3324
  }, [enabled, types, documentDateFrom, documentDateTo, reload]);
3225
- useEffect11(() => {
3325
+ useEffect12(() => {
3226
3326
  if (!enabled) return;
3227
3327
  const unsubscribeDocs = getCore().subscribe("documents:changed", reload);
3228
3328
  const unsubscribeCases = getCore().subscribe("cases:changed", reload);
@@ -3235,7 +3335,7 @@ function useCollectionConnection(enabled = true) {
3235
3335
  }
3236
3336
 
3237
3337
  // src/connection/useUploadConnection.ts
3238
- import { useCallback as useCallback14, useRef as useRef10 } from "react";
3338
+ import { useCallback as useCallback15, useRef as useRef10 } from "react";
3239
3339
  function resolveContentType(file) {
3240
3340
  const t = file.type.toLowerCase();
3241
3341
  if (t === "image/jpeg" || t === "image/jpg" || t === "image/png" || t === "application/pdf") {
@@ -3250,7 +3350,7 @@ function resolveContentType(file) {
3250
3350
  function useUploadConnection() {
3251
3351
  const { bid, patientId, store } = useSdk();
3252
3352
  const seq = useRef10(0);
3253
- const upload = useCallback14(
3353
+ const upload = useCallback15(
3254
3354
  async (items) => {
3255
3355
  if (items.length === 0) return;
3256
3356
  const localIds = items.map(({ file }) => {
@@ -3306,9 +3406,9 @@ function useUploadConnection() {
3306
3406
  }
3307
3407
 
3308
3408
  // src/connection/useLogout.ts
3309
- import { useCallback as useCallback15 } from "react";
3409
+ import { useCallback as useCallback16 } from "react";
3310
3410
  function useLogout() {
3311
- return useCallback15(() => {
3411
+ return useCallback16(() => {
3312
3412
  teardownWorkerClient();
3313
3413
  }, []);
3314
3414
  }
@@ -3422,25 +3522,25 @@ function useFilteredRecordIds2() {
3422
3522
  }
3423
3523
 
3424
3524
  // src/views/containers/smart-records/components/SidebarCaseItem.tsx
3425
- import { memo as memo5, useCallback as useCallback16 } from "react";
3525
+ import { memo as memo5, useCallback as useCallback17 } from "react";
3426
3526
 
3427
3527
  // src/views/containers/smart-records/components/HighlightedText.tsx
3428
3528
  import { memo as memo4 } from "react";
3429
- import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
3529
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
3430
3530
  var HighlightedText = memo4(function HighlightedText2({ text, query }) {
3431
3531
  const q = query?.trim().toLowerCase() ?? "";
3432
3532
  const start = q ? text.toLowerCase().indexOf(q) : -1;
3433
- if (start < 0) return /* @__PURE__ */ jsx13(Fragment5, { children: text });
3533
+ if (start < 0) return /* @__PURE__ */ jsx14(Fragment5, { children: text });
3434
3534
  const end = start + q.length;
3435
- return /* @__PURE__ */ jsxs12(Fragment5, { children: [
3535
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
3436
3536
  text.slice(0, start),
3437
- /* @__PURE__ */ jsx13("mark", { className: "mr-sv__search-mark", children: text.slice(start, end) }),
3537
+ /* @__PURE__ */ jsx14("mark", { className: "mr-sv__search-mark", children: text.slice(start, end) }),
3438
3538
  text.slice(end)
3439
3539
  ] });
3440
3540
  });
3441
3541
 
3442
3542
  // src/views/containers/smart-records/components/SidebarCaseItem.tsx
3443
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
3543
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
3444
3544
  var AVATAR_LABELS = { EM: "ER" };
3445
3545
  function avatarLabel(typeCode) {
3446
3546
  const code = typeCode.toUpperCase();
@@ -3458,8 +3558,8 @@ var SidebarCaseItem = memo5(function SidebarCaseItem2({
3458
3558
  highlight,
3459
3559
  onSelect
3460
3560
  }) {
3461
- const handleClick = useCallback16(() => onSelect(caseId), [onSelect, caseId]);
3462
- const handleKeyDown = useCallback16(
3561
+ const handleClick = useCallback17(() => onSelect(caseId), [onSelect, caseId]);
3562
+ const handleKeyDown = useCallback17(
3463
3563
  (e) => {
3464
3564
  if (e.key === "Enter" || e.key === " ") handleClick();
3465
3565
  },
@@ -3469,44 +3569,44 @@ var SidebarCaseItem = memo5(function SidebarCaseItem2({
3469
3569
  const countLabel = `${count} record${count !== 1 ? "s" : ""}`;
3470
3570
  const subline = isEmpty ? "No records available" : matchCount !== void 0 ? `${matchCount} of ${countLabel} match` : dateEpoch ? `Updated ${epochToDisplay(dateEpoch)} \xB7 ${countLabel}` : countLabel;
3471
3571
  const interactive = isEmpty ? { "aria-disabled": true } : { role: "button", tabIndex: 0, "aria-selected": isActive, onClick: handleClick, onKeyDown: handleKeyDown };
3472
- return /* @__PURE__ */ jsxs13(
3572
+ return /* @__PURE__ */ jsxs14(
3473
3573
  "div",
3474
3574
  {
3475
3575
  className: `mr-sv__record-item mr-sv__case-row${isActive ? " mr-sv__record-item--active" : ""}${isEmpty ? " mr-sv__record-item--empty" : ""}`,
3476
3576
  "data-row-id": caseId,
3477
3577
  ...interactive,
3478
3578
  children: [
3479
- /* @__PURE__ */ jsx14("div", { className: "mr-sv__case-avatar", children: avatarLabel(typeCode) }),
3480
- /* @__PURE__ */ jsxs13("div", { className: "mr-sv__record-text", children: [
3481
- /* @__PURE__ */ jsxs13("span", { className: "mr-sv__record-row-title", children: [
3482
- /* @__PURE__ */ jsx14("span", { className: "mr-sv__record-name", children: /* @__PURE__ */ jsx14(HighlightedText, { text: name, query: highlight }) }),
3483
- isLatest && /* @__PURE__ */ jsx14("span", { className: "mr-sv__latest-badge", children: "Latest" })
3579
+ /* @__PURE__ */ jsx15("div", { className: "mr-sv__case-avatar", children: avatarLabel(typeCode) }),
3580
+ /* @__PURE__ */ jsxs14("div", { className: "mr-sv__record-text", children: [
3581
+ /* @__PURE__ */ jsxs14("span", { className: "mr-sv__record-row-title", children: [
3582
+ /* @__PURE__ */ jsx15("span", { className: "mr-sv__record-name", children: /* @__PURE__ */ jsx15(HighlightedText, { text: name, query: highlight }) }),
3583
+ isLatest && /* @__PURE__ */ jsx15("span", { className: "mr-sv__latest-badge", children: "Latest" })
3484
3584
  ] }),
3485
- /* @__PURE__ */ jsx14("div", { className: "mr-sv__record-sub", children: subline })
3585
+ /* @__PURE__ */ jsx15("div", { className: "mr-sv__record-sub", children: subline })
3486
3586
  ] }),
3487
- isActive && /* @__PURE__ */ jsx14("span", { className: "mr-sidebar-item__indicator", "aria-hidden": true })
3587
+ isActive && /* @__PURE__ */ jsx15("span", { className: "mr-sidebar-item__indicator", "aria-hidden": true })
3488
3588
  ]
3489
3589
  }
3490
3590
  );
3491
3591
  });
3492
3592
 
3493
3593
  // src/views/containers/smart-records/components/SidebarRecordRow.tsx
3494
- import { memo as memo6, useCallback as useCallback17 } from "react";
3594
+ import { memo as memo6, useCallback as useCallback18 } from "react";
3495
3595
 
3496
3596
  // src/views/containers/smart-records/components/SmartStar.tsx
3497
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
3597
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
3498
3598
  function SmartStar({ className }) {
3499
- return /* @__PURE__ */ jsxs14("span", { className: `mr-sv__smart-star${className ? ` ${className}` : ""}`, children: [
3500
- /* @__PURE__ */ jsx15(SmartSparkles_default, { "aria-label": "Smart report" }),
3501
- /* @__PURE__ */ jsxs14("span", { className: "mr-sv__smart-pill", "aria-hidden": true, children: [
3502
- /* @__PURE__ */ jsx15(SmartSparkles_default, { "aria-hidden": true }),
3599
+ return /* @__PURE__ */ jsxs15("span", { className: `mr-sv__smart-star${className ? ` ${className}` : ""}`, children: [
3600
+ /* @__PURE__ */ jsx16(SmartSparkles_default, { "aria-label": "Smart report" }),
3601
+ /* @__PURE__ */ jsxs15("span", { className: "mr-sv__smart-pill", "aria-hidden": true, children: [
3602
+ /* @__PURE__ */ jsx16(SmartSparkles_default, { "aria-hidden": true }),
3503
3603
  "Smart Report"
3504
3604
  ] })
3505
3605
  ] });
3506
3606
  }
3507
3607
 
3508
3608
  // src/views/containers/smart-records/components/SidebarRecordRow.tsx
3509
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
3609
+ import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
3510
3610
  var SidebarRecordRow = memo6(function SidebarRecordRow2({
3511
3611
  id,
3512
3612
  title,
@@ -3517,16 +3617,16 @@ var SidebarRecordRow = memo6(function SidebarRecordRow2({
3517
3617
  highlight,
3518
3618
  onSelect
3519
3619
  }) {
3520
- const handleClick = useCallback17(() => {
3620
+ const handleClick = useCallback18(() => {
3521
3621
  if (!isActive) onSelect(id);
3522
3622
  }, [isActive, onSelect, id]);
3523
- const handleKeyDown = useCallback17(
3623
+ const handleKeyDown = useCallback18(
3524
3624
  (e) => {
3525
3625
  if (e.key === "Enter" || e.key === " ") handleClick();
3526
3626
  },
3527
3627
  [handleClick]
3528
3628
  );
3529
- return /* @__PURE__ */ jsxs15(
3629
+ return /* @__PURE__ */ jsxs16(
3530
3630
  "div",
3531
3631
  {
3532
3632
  className: `mr-sv__record-item mr-sv__record-row${isActive ? " mr-sv__record-item--active" : ""}`,
@@ -3537,40 +3637,40 @@ var SidebarRecordRow = memo6(function SidebarRecordRow2({
3537
3637
  onClick: handleClick,
3538
3638
  onKeyDown: handleKeyDown,
3539
3639
  children: [
3540
- dateEpoch !== null ? /* @__PURE__ */ jsx16(DateTile_default, { epoch: dateEpoch, sub: "month" }) : /* @__PURE__ */ jsx16("div", { className: "mr-date-tile", "aria-hidden": true }),
3541
- /* @__PURE__ */ jsx16("div", { className: "mr-sv__record-text", children: /* @__PURE__ */ jsxs15("span", { className: "mr-sv__record-row-title", children: [
3542
- /* @__PURE__ */ jsx16("span", { className: "mr-sv__record-row-name", children: /* @__PURE__ */ jsx16(HighlightedText, { text: title, query: highlight }) }),
3543
- isSmart && /* @__PURE__ */ jsx16(SmartStar, {}),
3544
- isLatest && /* @__PURE__ */ jsx16("span", { className: "mr-sv__latest-badge", children: "Latest" })
3640
+ dateEpoch !== null ? /* @__PURE__ */ jsx17(DateTile_default, { epoch: dateEpoch, sub: "month" }) : /* @__PURE__ */ jsx17("div", { className: "mr-date-tile", "aria-hidden": true }),
3641
+ /* @__PURE__ */ jsx17("div", { className: "mr-sv__record-text", children: /* @__PURE__ */ jsxs16("span", { className: "mr-sv__record-row-title", children: [
3642
+ /* @__PURE__ */ jsx17("span", { className: "mr-sv__record-row-name", children: /* @__PURE__ */ jsx17(HighlightedText, { text: title, query: highlight }) }),
3643
+ isSmart && /* @__PURE__ */ jsx17(SmartStar, {}),
3644
+ isLatest && /* @__PURE__ */ jsx17("span", { className: "mr-sv__latest-badge", children: "Latest" })
3545
3645
  ] }) }),
3546
- isActive && /* @__PURE__ */ jsx16("span", { className: "mr-sidebar-item__indicator", "aria-hidden": true })
3646
+ isActive && /* @__PURE__ */ jsx17("span", { className: "mr-sidebar-item__indicator", "aria-hidden": true })
3547
3647
  ]
3548
3648
  }
3549
3649
  );
3550
3650
  });
3551
3651
 
3552
3652
  // src/views/containers/smart-records/components/SidebarSearchField.tsx
3553
- import { memo as memo7, useCallback as useCallback18 } from "react";
3653
+ import { memo as memo7, useCallback as useCallback19 } from "react";
3554
3654
  import { Search, X } from "lucide-react";
3555
- import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
3655
+ import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
3556
3656
  var SidebarSearchField = memo7(function SidebarSearchField2({ value, onChange, onFocusChange }) {
3557
- const handleChange = useCallback18(
3657
+ const handleChange = useCallback19(
3558
3658
  (e) => onChange(e.target.value),
3559
3659
  [onChange]
3560
3660
  );
3561
- const handleKeyDown = useCallback18(
3661
+ const handleKeyDown = useCallback19(
3562
3662
  (e) => {
3563
3663
  e.stopPropagation();
3564
3664
  if (e.key === "Escape") onChange("");
3565
3665
  },
3566
3666
  [onChange]
3567
3667
  );
3568
- const handleFocus = useCallback18(() => onFocusChange(true), [onFocusChange]);
3569
- const handleBlur = useCallback18(() => onFocusChange(false), [onFocusChange]);
3570
- const handleClear = useCallback18(() => onChange(""), [onChange]);
3571
- return /* @__PURE__ */ jsxs16("div", { className: "mr-sv__sidebar-search", children: [
3572
- /* @__PURE__ */ jsx17(Search, { size: 16, "aria-hidden": true }),
3573
- /* @__PURE__ */ jsx17(
3668
+ const handleFocus = useCallback19(() => onFocusChange(true), [onFocusChange]);
3669
+ const handleBlur = useCallback19(() => onFocusChange(false), [onFocusChange]);
3670
+ const handleClear = useCallback19(() => onChange(""), [onChange]);
3671
+ return /* @__PURE__ */ jsxs17("div", { className: "mr-sv__sidebar-search", children: [
3672
+ /* @__PURE__ */ jsx18(Search, { size: 16, "aria-hidden": true }),
3673
+ /* @__PURE__ */ jsx18(
3574
3674
  "input",
3575
3675
  {
3576
3676
  type: "text",
@@ -3582,28 +3682,28 @@ var SidebarSearchField = memo7(function SidebarSearchField2({ value, onChange, o
3582
3682
  onBlur: handleBlur
3583
3683
  }
3584
3684
  ),
3585
- value !== "" && /* @__PURE__ */ jsx17("button", { type: "button", className: "mr-sv__sidebar-search-clear", "aria-label": "Clear search text", onClick: handleClear, children: /* @__PURE__ */ jsx17(X, { size: 10, "aria-hidden": true }) })
3685
+ value !== "" && /* @__PURE__ */ jsx18("button", { type: "button", className: "mr-sv__sidebar-search-clear", "aria-label": "Clear search text", onClick: handleClear, children: /* @__PURE__ */ jsx18(X, { size: 10, "aria-hidden": true }) })
3586
3686
  ] });
3587
3687
  });
3588
3688
 
3589
3689
  // src/views/containers/smart-records/components/SidebarFilterPopover.tsx
3590
- import { useCallback as useCallback20, useEffect as useEffect13, useState as useState12 } from "react";
3690
+ import { useCallback as useCallback21, useEffect as useEffect14, useState as useState14 } from "react";
3591
3691
  import { useStore as useStore13 } from "zustand";
3592
3692
 
3593
3693
  // src/views/containers/smart-records/components/SidebarTypeSelect.tsx
3594
- import { useCallback as useCallback19, useEffect as useEffect12, useMemo as useMemo9, useRef as useRef11, useState as useState11 } from "react";
3595
- import { Check as Check2, ChevronDown } from "lucide-react";
3596
- import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
3694
+ import { useCallback as useCallback20, useEffect as useEffect13, useMemo as useMemo9, useRef as useRef11, useState as useState13 } from "react";
3695
+ import { Check as Check3, ChevronDown } from "lucide-react";
3696
+ import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
3597
3697
  function summarize(options, value) {
3598
3698
  if (value.length === 0) return "All";
3599
3699
  if (value.length > 2) return `${value.length} types`;
3600
3700
  return value.map((id) => options.find((o) => o.id === id)?.display_name ?? id).join(", ");
3601
3701
  }
3602
3702
  function SidebarTypeSelect({ options, value, onChange }) {
3603
- const [open, setOpen] = useState11(false);
3604
- const [query, setQuery] = useState11("");
3703
+ const [open, setOpen] = useState13(false);
3704
+ const [query, setQuery] = useState13("");
3605
3705
  const rootRef = useRef11(null);
3606
- useEffect12(() => {
3706
+ useEffect13(() => {
3607
3707
  if (!open) return;
3608
3708
  const onMouseDown = (e) => {
3609
3709
  if (!rootRef.current?.contains(e.target)) setOpen(false);
@@ -3611,26 +3711,26 @@ function SidebarTypeSelect({ options, value, onChange }) {
3611
3711
  document.addEventListener("mousedown", onMouseDown);
3612
3712
  return () => document.removeEventListener("mousedown", onMouseDown);
3613
3713
  }, [open]);
3614
- const toggleOpen = useCallback19(() => {
3714
+ const toggleOpen = useCallback20(() => {
3615
3715
  setQuery("");
3616
3716
  setOpen((o) => !o);
3617
3717
  }, []);
3618
- const handleAll = useCallback19(() => onChange([]), [onChange]);
3619
- const handleToggle = useCallback19(
3718
+ const handleAll = useCallback20(() => onChange([]), [onChange]);
3719
+ const handleToggle = useCallback20(
3620
3720
  (e) => {
3621
3721
  const id = e.target.value;
3622
3722
  onChange(value.includes(id) ? value.filter((v) => v !== id) : [...value, id]);
3623
3723
  },
3624
3724
  [value, onChange]
3625
3725
  );
3626
- const handleQuery = useCallback19((e) => setQuery(e.target.value), []);
3726
+ const handleQuery = useCallback20((e) => setQuery(e.target.value), []);
3627
3727
  const visible = useMemo9(() => {
3628
3728
  const q = query.trim().toLowerCase();
3629
3729
  return q ? options.filter((o) => o.display_name.toLowerCase().includes(q)) : options;
3630
3730
  }, [options, query]);
3631
3731
  const summary = summarize(options, value);
3632
- return /* @__PURE__ */ jsxs17("div", { className: "mr-sv__type-select", ref: rootRef, children: [
3633
- /* @__PURE__ */ jsxs17(
3732
+ return /* @__PURE__ */ jsxs18("div", { className: "mr-sv__type-select", ref: rootRef, children: [
3733
+ /* @__PURE__ */ jsxs18(
3634
3734
  "button",
3635
3735
  {
3636
3736
  type: "button",
@@ -3640,25 +3740,25 @@ function SidebarTypeSelect({ options, value, onChange }) {
3640
3740
  "aria-label": `Type: ${summary}`,
3641
3741
  onClick: toggleOpen,
3642
3742
  children: [
3643
- /* @__PURE__ */ jsx18("span", { className: "mr-sv__type-value", children: summary }),
3644
- /* @__PURE__ */ jsx18(ChevronDown, { size: 14, "aria-hidden": true })
3743
+ /* @__PURE__ */ jsx19("span", { className: "mr-sv__type-value", children: summary }),
3744
+ /* @__PURE__ */ jsx19(ChevronDown, { size: 14, "aria-hidden": true })
3645
3745
  ]
3646
3746
  }
3647
3747
  ),
3648
- open && /* @__PURE__ */ jsxs17("div", { className: "mr-sv__type-menu", children: [
3649
- /* @__PURE__ */ jsx18("input", { type: "text", className: "mr-sv__type-search", placeholder: "Search types", value: query, autoFocus: true, onChange: handleQuery }),
3650
- /* @__PURE__ */ jsxs17("div", { className: "mr-sv__type-options", role: "listbox", "aria-multiselectable": true, children: [
3651
- /* @__PURE__ */ jsxs17("label", { className: "mr-sv__type-option", children: [
3652
- /* @__PURE__ */ jsx18("input", { type: "checkbox", checked: value.length === 0, onChange: handleAll }),
3653
- /* @__PURE__ */ jsx18("span", { children: "All" }),
3654
- value.length === 0 && /* @__PURE__ */ jsx18(Check2, { size: 14, "aria-hidden": true })
3748
+ open && /* @__PURE__ */ jsxs18("div", { className: "mr-sv__type-menu", children: [
3749
+ /* @__PURE__ */ jsx19("input", { type: "text", className: "mr-sv__type-search", placeholder: "Search types", value: query, autoFocus: true, onChange: handleQuery }),
3750
+ /* @__PURE__ */ jsxs18("div", { className: "mr-sv__type-options", role: "listbox", "aria-multiselectable": true, children: [
3751
+ /* @__PURE__ */ jsxs18("label", { className: "mr-sv__type-option", children: [
3752
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", checked: value.length === 0, onChange: handleAll }),
3753
+ /* @__PURE__ */ jsx19("span", { children: "All" }),
3754
+ value.length === 0 && /* @__PURE__ */ jsx19(Check3, { size: 14, "aria-hidden": true })
3655
3755
  ] }),
3656
3756
  visible.map((o) => {
3657
3757
  const checked = value.includes(o.id);
3658
- return /* @__PURE__ */ jsxs17("label", { className: "mr-sv__type-option", children: [
3659
- /* @__PURE__ */ jsx18("input", { type: "checkbox", value: o.id, checked, onChange: handleToggle }),
3660
- /* @__PURE__ */ jsx18("span", { children: o.display_name }),
3661
- checked && /* @__PURE__ */ jsx18(Check2, { size: 14, "aria-hidden": true })
3758
+ return /* @__PURE__ */ jsxs18("label", { className: "mr-sv__type-option", children: [
3759
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", value: o.id, checked, onChange: handleToggle }),
3760
+ /* @__PURE__ */ jsx19("span", { children: o.display_name }),
3761
+ checked && /* @__PURE__ */ jsx19(Check3, { size: 14, "aria-hidden": true })
3662
3762
  ] }, o.id);
3663
3763
  })
3664
3764
  ] })
@@ -3667,18 +3767,18 @@ function SidebarTypeSelect({ options, value, onChange }) {
3667
3767
  }
3668
3768
 
3669
3769
  // src/views/containers/smart-records/components/SidebarFilterPopover.tsx
3670
- import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
3770
+ import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
3671
3771
  var EMPTY_DRAFT = { preset: "anytime", from: "", to: "", types: [] };
3672
3772
  function SidebarFilterPopover({ containerRef, onClose }) {
3673
3773
  const { store, documentTypes } = useSdk();
3674
3774
  const applied = useStore13(store, (s) => s.filters);
3675
- const [draft, setDraft] = useState12(() => ({
3775
+ const [draft, setDraft] = useState14(() => ({
3676
3776
  preset: applied.documentDatePreset,
3677
3777
  from: applied.documentDatePreset === "custom" ? epochToDateInput(applied.documentDateFrom) : "",
3678
3778
  to: applied.documentDatePreset === "custom" ? epochToDateInput(applied.documentDateTo) : "",
3679
3779
  types: applied.types
3680
3780
  }));
3681
- useEffect13(() => {
3781
+ useEffect14(() => {
3682
3782
  const handler = (e) => {
3683
3783
  if (containerRef.current?.contains(e.target)) return;
3684
3784
  onClose();
@@ -3686,15 +3786,15 @@ function SidebarFilterPopover({ containerRef, onClose }) {
3686
3786
  document.addEventListener("mousedown", handler);
3687
3787
  return () => document.removeEventListener("mousedown", handler);
3688
3788
  }, [containerRef, onClose]);
3689
- const handlePreset = useCallback20((e) => {
3789
+ const handlePreset = useCallback21((e) => {
3690
3790
  const preset = e.target.value;
3691
3791
  setDraft((d) => ({ ...d, preset }));
3692
3792
  }, []);
3693
- const handleFrom = useCallback20((from) => setDraft((d) => ({ ...d, from })), []);
3694
- const handleTo = useCallback20((to) => setDraft((d) => ({ ...d, to })), []);
3695
- const handleTypes = useCallback20((types) => setDraft((d) => ({ ...d, types })), []);
3696
- const handleClearAll = useCallback20(() => setDraft(EMPTY_DRAFT), []);
3697
- const handleApply = useCallback20(() => {
3793
+ const handleFrom = useCallback21((from) => setDraft((d) => ({ ...d, from })), []);
3794
+ const handleTo = useCallback21((to) => setDraft((d) => ({ ...d, to })), []);
3795
+ const handleTypes = useCallback21((types) => setDraft((d) => ({ ...d, types })), []);
3796
+ const handleClearAll = useCallback21(() => setDraft(EMPTY_DRAFT), []);
3797
+ const handleApply = useCallback21(() => {
3698
3798
  const customTo = dateInputToEpoch(draft.to);
3699
3799
  const range = draft.preset === "custom" ? { from: dateInputToEpoch(draft.from), to: customTo === null ? null : endOfDay(customTo) } : presetRange(draft.preset);
3700
3800
  store.getState().filters.applyPopoverFilters({
@@ -3710,46 +3810,46 @@ function SidebarFilterPopover({ containerRef, onClose }) {
3710
3810
  });
3711
3811
  onClose();
3712
3812
  }, [draft, store, onClose]);
3713
- return /* @__PURE__ */ jsxs18("div", { className: "mr-sv__filter-popover", role: "dialog", "aria-label": "Filter", children: [
3714
- /* @__PURE__ */ jsxs18("div", { className: "mr-sv__filter-head", children: [
3715
- /* @__PURE__ */ jsx19(Typography_default, { variant: "label", as: "span", children: "Filter" }),
3716
- /* @__PURE__ */ jsx19("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: handleClearAll, children: "Clear all" })
3813
+ return /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-popover", role: "dialog", "aria-label": "Filter", children: [
3814
+ /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-head", children: [
3815
+ /* @__PURE__ */ jsx20(Typography_default, { variant: "label", as: "span", children: "Filter" }),
3816
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: handleClearAll, children: "Clear all" })
3717
3817
  ] }),
3718
- /* @__PURE__ */ jsx19(Typography_default, { variant: "eyebrow", className: "mr-sv__filter-label", children: "Date" }),
3719
- /* @__PURE__ */ jsx19("div", { className: "mr-sv__filter-presets", children: DATE_PRESET_OPTIONS.map((o) => /* @__PURE__ */ jsxs18("label", { className: "mr-sv__filter-preset", children: [
3720
- /* @__PURE__ */ jsx19("input", { type: "radio", name: "mr-sv-date-preset", value: o.value, checked: draft.preset === o.value, onChange: handlePreset }),
3721
- /* @__PURE__ */ jsx19("span", { children: o.label })
3818
+ /* @__PURE__ */ jsx20(Typography_default, { variant: "eyebrow", className: "mr-sv__filter-label", children: "Date" }),
3819
+ /* @__PURE__ */ jsx20("div", { className: "mr-sv__filter-presets", children: DATE_PRESET_OPTIONS.map((o) => /* @__PURE__ */ jsxs19("label", { className: "mr-sv__filter-preset", children: [
3820
+ /* @__PURE__ */ jsx20("input", { type: "radio", name: "mr-sv-date-preset", value: o.value, checked: draft.preset === o.value, onChange: handlePreset }),
3821
+ /* @__PURE__ */ jsx20("span", { children: o.label })
3722
3822
  ] }, o.value)) }),
3723
- draft.preset === "custom" && /* @__PURE__ */ jsxs18("div", { className: "mr-sv__filter-range", children: [
3724
- /* @__PURE__ */ jsxs18("div", { className: "mr-sv__filter-range-field", children: [
3725
- /* @__PURE__ */ jsx19("span", { className: "mr-sv__filter-to", children: "From" }),
3726
- /* @__PURE__ */ jsx19(DateField_default, { label: "From", value: draft.from, max: draft.to || void 0, onChange: handleFrom })
3823
+ draft.preset === "custom" && /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-range", children: [
3824
+ /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-range-field", children: [
3825
+ /* @__PURE__ */ jsx20("span", { className: "mr-sv__filter-to", children: "From" }),
3826
+ /* @__PURE__ */ jsx20(DateField_default, { label: "From", value: draft.from, max: draft.to || void 0, onChange: handleFrom })
3727
3827
  ] }),
3728
- /* @__PURE__ */ jsxs18("div", { className: "mr-sv__filter-range-field", children: [
3729
- /* @__PURE__ */ jsx19("span", { className: "mr-sv__filter-to", children: "To" }),
3730
- /* @__PURE__ */ jsx19(DateField_default, { label: "To", value: draft.to, min: draft.from || void 0, onChange: handleTo })
3828
+ /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-range-field", children: [
3829
+ /* @__PURE__ */ jsx20("span", { className: "mr-sv__filter-to", children: "To" }),
3830
+ /* @__PURE__ */ jsx20(DateField_default, { label: "To", value: draft.to, min: draft.from || void 0, onChange: handleTo })
3731
3831
  ] })
3732
3832
  ] }),
3733
- /* @__PURE__ */ jsx19(Typography_default, { variant: "eyebrow", className: "mr-sv__filter-label", children: "Type" }),
3734
- /* @__PURE__ */ jsx19(SidebarTypeSelect, { options: documentTypes, value: draft.types, onChange: handleTypes }),
3735
- /* @__PURE__ */ jsxs18("div", { className: "mr-sv__filter-actions", children: [
3736
- /* @__PURE__ */ jsx19("button", { type: "button", className: "mr-sv__filter-cancel", onClick: onClose, children: "Cancel" }),
3737
- /* @__PURE__ */ jsx19("button", { type: "button", className: "mr-sv__filter-apply", onClick: handleApply, children: "Apply" })
3833
+ /* @__PURE__ */ jsx20(Typography_default, { variant: "eyebrow", className: "mr-sv__filter-label", children: "Type" }),
3834
+ /* @__PURE__ */ jsx20(SidebarTypeSelect, { options: documentTypes, value: draft.types, onChange: handleTypes }),
3835
+ /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-actions", children: [
3836
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mr-sv__filter-cancel", onClick: onClose, children: "Cancel" }),
3837
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mr-sv__filter-apply", onClick: handleApply, children: "Apply" })
3738
3838
  ] })
3739
3839
  ] });
3740
3840
  }
3741
3841
 
3742
3842
  // src/views/containers/smart-records/components/SidebarFilterChips.tsx
3743
- import { memo as memo8, useCallback as useCallback21 } from "react";
3843
+ import { memo as memo8, useCallback as useCallback22 } from "react";
3744
3844
  import { X as X2 } from "lucide-react";
3745
3845
  import { useStore as useStore14 } from "zustand";
3746
- import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
3846
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
3747
3847
  var SidebarFilterChips = memo8(function SidebarFilterChips2({ count }) {
3748
3848
  const { store, labelOf } = useSdk();
3749
3849
  const filters = useStore14(store, (s) => s.filters);
3750
3850
  const hasDate = filters.documentDateFrom != null || filters.documentDateTo != null;
3751
3851
  const dateLabel = filters.documentDatePreset === "custom" ? customRangeLabel(filters.documentDateFrom, filters.documentDateTo) : presetLabel(filters.documentDatePreset);
3752
- const write = useCallback21(
3852
+ const write = useCallback22(
3753
3853
  (patch) => {
3754
3854
  const f = store.getState().filters;
3755
3855
  f.applyPopoverFilters({
@@ -3766,9 +3866,9 @@ var SidebarFilterChips = memo8(function SidebarFilterChips2({ count }) {
3766
3866
  },
3767
3867
  [store]
3768
3868
  );
3769
- const removeDate = useCallback21(() => write({ clearDate: true }), [write]);
3770
- const clearAll = useCallback21(() => store.getState().filters.clearPopoverFilters(), [store]);
3771
- const removeType = useCallback21(
3869
+ const removeDate = useCallback22(() => write({ clearDate: true }), [write]);
3870
+ const clearAll = useCallback22(() => store.getState().filters.clearPopoverFilters(), [store]);
3871
+ const removeType = useCallback22(
3772
3872
  (e) => {
3773
3873
  const id = e.currentTarget.value;
3774
3874
  write({ types: store.getState().filters.types.filter((t) => t !== id) });
@@ -3776,29 +3876,29 @@ var SidebarFilterChips = memo8(function SidebarFilterChips2({ count }) {
3776
3876
  [write, store]
3777
3877
  );
3778
3878
  if (!hasSidebarFilter(filters)) return null;
3779
- return /* @__PURE__ */ jsxs19("div", { className: "mr-sv__filter-chips", children: [
3780
- hasDate && /* @__PURE__ */ jsxs19("span", { className: "mr-sv__filter-chip", children: [
3879
+ return /* @__PURE__ */ jsxs20("div", { className: "mr-sv__filter-chips", children: [
3880
+ hasDate && /* @__PURE__ */ jsxs20("span", { className: "mr-sv__filter-chip", children: [
3781
3881
  dateLabel,
3782
- /* @__PURE__ */ jsx20("button", { type: "button", className: "mr-sv__filter-chip-x", "aria-label": `Remove ${dateLabel}`, onClick: removeDate, children: /* @__PURE__ */ jsx20(X2, { size: 12, "aria-hidden": true }) })
3882
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__filter-chip-x", "aria-label": `Remove ${dateLabel}`, onClick: removeDate, children: /* @__PURE__ */ jsx21(X2, { size: 12, "aria-hidden": true }) })
3783
3883
  ] }),
3784
3884
  filters.types.map((id) => {
3785
3885
  const label = labelOf(id);
3786
- return /* @__PURE__ */ jsxs19("span", { className: "mr-sv__filter-chip", children: [
3886
+ return /* @__PURE__ */ jsxs20("span", { className: "mr-sv__filter-chip", children: [
3787
3887
  label,
3788
- /* @__PURE__ */ jsx20("button", { type: "button", className: "mr-sv__filter-chip-x", "aria-label": `Remove ${label}`, value: id, onClick: removeType, children: /* @__PURE__ */ jsx20(X2, { size: 12, "aria-hidden": true }) })
3888
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__filter-chip-x", "aria-label": `Remove ${label}`, value: id, onClick: removeType, children: /* @__PURE__ */ jsx21(X2, { size: 12, "aria-hidden": true }) })
3789
3889
  ] }, id);
3790
3890
  }),
3791
- /* @__PURE__ */ jsxs19("span", { className: "mr-sv__filter-count", children: [
3891
+ /* @__PURE__ */ jsxs20("span", { className: "mr-sv__filter-count", children: [
3792
3892
  count,
3793
3893
  " record",
3794
3894
  count !== 1 ? "s" : ""
3795
3895
  ] }),
3796
- /* @__PURE__ */ jsx20("button", { type: "button", className: "mr-sv__ghost-link-btn mr-sv__filter-clear", onClick: clearAll, children: "Clear" })
3896
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__ghost-link-btn mr-sv__filter-clear", onClick: clearAll, children: "Clear" })
3797
3897
  ] });
3798
3898
  });
3799
3899
 
3800
3900
  // src/views/containers/smart-records/SmartRecordsSidebar.tsx
3801
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
3901
+ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
3802
3902
  var PAGE_SIZE = 30;
3803
3903
  var SKELETON_ROWS = [0, 1, 2];
3804
3904
  var SmartRecordsSidebar = memo9(function SmartRecordsSidebar2({
@@ -3815,33 +3915,33 @@ var SmartRecordsSidebar = memo9(function SmartRecordsSidebar2({
3815
3915
  const filterTypes = useStore15(store, (s) => s.filters.types);
3816
3916
  const filterFrom = useStore15(store, (s) => s.filters.documentDateFrom);
3817
3917
  const filterTo = useStore15(store, (s) => s.filters.documentDateTo);
3818
- const [visibleCount, setVisibleCount] = useState13(PAGE_SIZE);
3819
- const [collapsed, setCollapsed] = useState13(false);
3820
- const [searchFocused, setSearchFocused] = useState13(false);
3821
- const [filterOpen, setFilterOpen] = useState13(false);
3918
+ const [visibleCount, setVisibleCount] = useState15(PAGE_SIZE);
3919
+ const [collapsed, setCollapsed] = useState15(false);
3920
+ const [searchFocused, setSearchFocused] = useState15(false);
3921
+ const [filterOpen, setFilterOpen] = useState15(false);
3822
3922
  const filterWrapRef = useRef12(null);
3823
3923
  const { rows, months, latestId, matchingRecordCount, hasActiveFilter, search } = useSidebarCollection({ limit: visibleCount });
3824
3924
  const rowsById = useMemo10(() => new Map(rows.map((r) => [r.id, r])), [rows]);
3825
3925
  const searchQuery = search.trim();
3826
3926
  const isSearching = searchQuery !== "";
3827
3927
  const isLoading = collectionStatus === "idle" || collectionStatus === "loading";
3828
- useEffect14(() => {
3928
+ useEffect15(() => {
3829
3929
  setVisibleCount(PAGE_SIZE);
3830
3930
  }, [search, filterTypes, filterFrom, filterTo]);
3831
3931
  const canReveal = visibleCount < rows.length;
3832
- const handleReach = useCallback22(() => setVisibleCount((c) => c + PAGE_SIZE), []);
3932
+ const handleReach = useCallback23(() => setVisibleCount((c) => c + PAGE_SIZE), []);
3833
3933
  const sentinelRef = useLoadMoreSentinel(canReveal, handleReach, visibleCount);
3834
3934
  const { scrollBodyRef, showChip, direction, jumpToSelected } = useJumpToSelected(selectedCaseId ?? openRecordId ?? null, rows);
3835
- const toggleCollapsed = useCallback22(() => {
3935
+ const toggleCollapsed = useCallback23(() => {
3836
3936
  setFilterOpen(false);
3837
3937
  setCollapsed((c) => !c);
3838
3938
  }, []);
3839
- const toggleFilter = useCallback22(() => setFilterOpen((o) => !o), []);
3840
- const closeFilter = useCallback22(() => setFilterOpen(false), []);
3841
- const setSearch = useCallback22((q) => store.getState().filters.setSearch(q), [store]);
3842
- const clearSearch = useCallback22(() => setSearch(""), [setSearch]);
3843
- const clearFilters = useCallback22(() => store.getState().filters.clearPopoverFilters(), [store]);
3844
- const handleListKeyDown = useCallback22((e) => {
3939
+ const toggleFilter = useCallback23(() => setFilterOpen((o) => !o), []);
3940
+ const closeFilter = useCallback23(() => setFilterOpen(false), []);
3941
+ const setSearch = useCallback23((q) => store.getState().filters.setSearch(q), [store]);
3942
+ const clearSearch = useCallback23(() => setSearch(""), [setSearch]);
3943
+ const clearFilters = useCallback23(() => store.getState().filters.clearPopoverFilters(), [store]);
3944
+ const handleListKeyDown = useCallback23((e) => {
3845
3945
  if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
3846
3946
  const rows2 = Array.from(e.currentTarget.querySelectorAll('[data-row-id][role="button"]'));
3847
3947
  const index = rows2.indexOf(document.activeElement);
@@ -3851,7 +3951,7 @@ var SmartRecordsSidebar = memo9(function SmartRecordsSidebar2({
3851
3951
  e.preventDefault();
3852
3952
  next.focus();
3853
3953
  }, []);
3854
- const handleRowSelect = useCallback22(
3954
+ const handleRowSelect = useCallback23(
3855
3955
  (id) => {
3856
3956
  const row = rowsById.get(id);
3857
3957
  if (!row || row.kind !== ROW_KIND.Record) return;
@@ -3862,7 +3962,7 @@ var SmartRecordsSidebar = memo9(function SmartRecordsSidebar2({
3862
3962
  );
3863
3963
  const renderRow = (row) => {
3864
3964
  if (row.kind === ROW_KIND.Case) {
3865
- return /* @__PURE__ */ jsx21(
3965
+ return /* @__PURE__ */ jsx22(
3866
3966
  SidebarCaseItem,
3867
3967
  {
3868
3968
  caseId: row.id,
@@ -3879,7 +3979,7 @@ var SmartRecordsSidebar = memo9(function SmartRecordsSidebar2({
3879
3979
  row.id
3880
3980
  );
3881
3981
  }
3882
- return /* @__PURE__ */ jsx21(
3982
+ return /* @__PURE__ */ jsx22(
3883
3983
  SidebarRecordRow,
3884
3984
  {
3885
3985
  id: row.id,
@@ -3896,90 +3996,90 @@ var SmartRecordsSidebar = memo9(function SmartRecordsSidebar2({
3896
3996
  };
3897
3997
  const renderEmpty = () => {
3898
3998
  if (isSearching) {
3899
- return /* @__PURE__ */ jsxs20("div", { className: "mr-sv__list-empty", children: [
3900
- /* @__PURE__ */ jsxs20("span", { className: "mr-sv__list-empty-title", children: [
3999
+ return /* @__PURE__ */ jsxs21("div", { className: "mr-sv__list-empty", children: [
4000
+ /* @__PURE__ */ jsxs21("span", { className: "mr-sv__list-empty-title", children: [
3901
4001
  "No results for \u201C",
3902
4002
  searchQuery,
3903
4003
  "\u201D"
3904
4004
  ] }),
3905
- /* @__PURE__ */ jsx21("span", { className: "mr-sv__list-empty-text", children: "Check the spelling, or search by care context name." }),
3906
- /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: clearSearch, children: "Clear search" })
4005
+ /* @__PURE__ */ jsx22("span", { className: "mr-sv__list-empty-text", children: "Check the spelling, or search by care context name." }),
4006
+ /* @__PURE__ */ jsx22("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: clearSearch, children: "Clear search" })
3907
4007
  ] });
3908
4008
  }
3909
4009
  if (hasActiveFilter) {
3910
- return /* @__PURE__ */ jsxs20("div", { className: "mr-sv__list-empty", children: [
3911
- /* @__PURE__ */ jsx21("span", { className: "mr-sv__list-empty-title", children: "No records match" }),
3912
- /* @__PURE__ */ jsx21("span", { className: "mr-sv__list-empty-text", children: "Try another date range or record type." }),
3913
- /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: clearFilters, children: "Clear filters" })
4010
+ return /* @__PURE__ */ jsxs21("div", { className: "mr-sv__list-empty", children: [
4011
+ /* @__PURE__ */ jsx22("span", { className: "mr-sv__list-empty-title", children: "No records match" }),
4012
+ /* @__PURE__ */ jsx22("span", { className: "mr-sv__list-empty-text", children: "Try another date range or record type." }),
4013
+ /* @__PURE__ */ jsx22("button", { type: "button", className: "mr-sv__ghost-link-btn", onClick: clearFilters, children: "Clear filters" })
3914
4014
  ] });
3915
4015
  }
3916
- return /* @__PURE__ */ jsx21(Typography_default, { variant: "muted", className: "mr-sv__sidebar-empty", children: "No records yet." });
4016
+ return /* @__PURE__ */ jsx22(Typography_default, { variant: "muted", className: "mr-sv__sidebar-empty", children: "No records yet." });
3917
4017
  };
3918
- const renderSkeleton = () => SKELETON_ROWS.map((i) => /* @__PURE__ */ jsxs20("div", { className: "mr-sv__list-skeleton", "aria-hidden": true, children: [
3919
- /* @__PURE__ */ jsx21("div", { className: "mr-sv__list-skeleton-date" }),
3920
- /* @__PURE__ */ jsxs20("div", { className: "mr-sv__record-text", children: [
3921
- /* @__PURE__ */ jsx21("span", { className: "mr-sv__list-skeleton-line", style: { width: 110 } }),
3922
- /* @__PURE__ */ jsx21("span", { className: "mr-sv__list-skeleton-line", style: { width: 74 } })
4018
+ const renderSkeleton = () => SKELETON_ROWS.map((i) => /* @__PURE__ */ jsxs21("div", { className: "mr-sv__list-skeleton", "aria-hidden": true, children: [
4019
+ /* @__PURE__ */ jsx22("div", { className: "mr-sv__list-skeleton-date" }),
4020
+ /* @__PURE__ */ jsxs21("div", { className: "mr-sv__record-text", children: [
4021
+ /* @__PURE__ */ jsx22("span", { className: "mr-sv__list-skeleton-line", style: { width: 110 } }),
4022
+ /* @__PURE__ */ jsx22("span", { className: "mr-sv__list-skeleton-line", style: { width: 74 } })
3923
4023
  ] })
3924
4024
  ] }, i));
3925
4025
  const noteText2 = isSearching ? `${rows.length} result${rows.length !== 1 ? "s" : ""}` : searchFocused ? "Search by care context name" : null;
3926
4026
  const filterBtnClass = `mr-sv__top-bar-btn${hasActiveFilter ? " mr-sv__top-bar-btn--active" : ""}${filterOpen ? " mr-sv__top-bar-btn--pressed" : ""}`;
3927
- return /* @__PURE__ */ jsx21("div", { className: "mr-sv__sidebar-outer", children: /* @__PURE__ */ jsxs20("div", { className: `mr-sv__sidebar${collapsed ? " mr-sv__sidebar--collapsed" : ""}`, children: [
3928
- !collapsed && /* @__PURE__ */ jsxs20(Fragment6, { children: [
3929
- /* @__PURE__ */ jsxs20("div", { className: "mr-sv__top-bar", children: [
3930
- /* @__PURE__ */ jsx21(SidebarSearchField, { value: search, onChange: setSearch, onFocusChange: setSearchFocused }),
3931
- /* @__PURE__ */ jsxs20("div", { className: "mr-sv__filter-wrap", ref: filterWrapRef, children: [
3932
- /* @__PURE__ */ jsxs20("button", { type: "button", className: filterBtnClass, onClick: toggleFilter, "aria-label": "Filter", "aria-pressed": filterOpen, children: [
3933
- /* @__PURE__ */ jsx21(Funnel, { size: 16, "aria-hidden": true }),
3934
- hasActiveFilter && /* @__PURE__ */ jsx21("span", { className: "mr-sv__filter-dot", "aria-hidden": true })
4027
+ return /* @__PURE__ */ jsx22("div", { className: "mr-sv__sidebar-outer", children: /* @__PURE__ */ jsxs21("div", { className: `mr-sv__sidebar${collapsed ? " mr-sv__sidebar--collapsed" : ""}`, children: [
4028
+ !collapsed && /* @__PURE__ */ jsxs21(Fragment6, { children: [
4029
+ /* @__PURE__ */ jsxs21("div", { className: "mr-sv__top-bar", children: [
4030
+ /* @__PURE__ */ jsx22(SidebarSearchField, { value: search, onChange: setSearch, onFocusChange: setSearchFocused }),
4031
+ /* @__PURE__ */ jsxs21("div", { className: "mr-sv__filter-wrap", ref: filterWrapRef, children: [
4032
+ /* @__PURE__ */ jsxs21("button", { type: "button", className: filterBtnClass, onClick: toggleFilter, "aria-label": "Filter", "aria-pressed": filterOpen, children: [
4033
+ /* @__PURE__ */ jsx22(Funnel, { size: 16, "aria-hidden": true }),
4034
+ hasActiveFilter && /* @__PURE__ */ jsx22("span", { className: "mr-sv__filter-dot", "aria-hidden": true })
3935
4035
  ] }),
3936
- filterOpen && /* @__PURE__ */ jsx21(SidebarFilterPopover, { containerRef: filterWrapRef, onClose: closeFilter })
4036
+ filterOpen && /* @__PURE__ */ jsx22(SidebarFilterPopover, { containerRef: filterWrapRef, onClose: closeFilter })
3937
4037
  ] }),
3938
- /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__top-bar-btn", onClick: onRefresh, "aria-label": "Refresh records", children: /* @__PURE__ */ jsx21(RefreshCw, { size: 16, "aria-hidden": true, className: isRefreshing ? "mr-sv__loading-spinner" : void 0 }) }),
3939
- /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__top-bar-btn", onClick: toggleCollapsed, "aria-label": "Collapse sidebar", "aria-expanded": true, children: /* @__PURE__ */ jsx21(ChevronLeft6, { size: 16, "aria-hidden": true }) })
4038
+ /* @__PURE__ */ jsx22("button", { type: "button", className: "mr-sv__top-bar-btn", onClick: onRefresh, "aria-label": "Refresh records", children: /* @__PURE__ */ jsx22(RefreshCw, { size: 16, "aria-hidden": true, className: isRefreshing ? "mr-sv__loading-spinner" : void 0 }) }),
4039
+ /* @__PURE__ */ jsx22("button", { type: "button", className: "mr-sv__top-bar-btn", onClick: toggleCollapsed, "aria-label": "Collapse sidebar", "aria-expanded": true, children: /* @__PURE__ */ jsx22(ChevronLeft7, { size: 16, "aria-hidden": true }) })
3940
4040
  ] }),
3941
- noteText2 && /* @__PURE__ */ jsx21("div", { className: "mr-sv__sidebar-note", children: noteText2 }),
3942
- /* @__PURE__ */ jsx21(SidebarFilterChips, { count: matchingRecordCount }),
3943
- /* @__PURE__ */ jsxs20("div", { className: "mr-records-sidebar__body", ref: scrollBodyRef, onKeyDown: handleListKeyDown, children: [
4041
+ noteText2 && /* @__PURE__ */ jsx22("div", { className: "mr-sv__sidebar-note", children: noteText2 }),
4042
+ /* @__PURE__ */ jsx22(SidebarFilterChips, { count: matchingRecordCount }),
4043
+ /* @__PURE__ */ jsxs21("div", { className: "mr-records-sidebar__body", ref: scrollBodyRef, onKeyDown: handleListKeyDown, children: [
3944
4044
  rows.length === 0 && (isLoading ? renderSkeleton() : renderEmpty()),
3945
- months.map((month) => /* @__PURE__ */ jsxs20("div", { className: "mr-sv__month-group", children: [
3946
- /* @__PURE__ */ jsx21("div", { className: "mr-sv__month-label", children: month.label }),
4045
+ months.map((month) => /* @__PURE__ */ jsxs21("div", { className: "mr-sv__month-group", children: [
4046
+ /* @__PURE__ */ jsx22("div", { className: "mr-sv__month-label", children: month.label }),
3947
4047
  month.rows.map(renderRow)
3948
4048
  ] }, month.key)),
3949
- canReveal && /* @__PURE__ */ jsx21("div", { ref: sentinelRef, className: "mr-sv__list-sentinel", "aria-hidden": true }),
3950
- !canReveal && rows.length > 0 && /* @__PURE__ */ jsx21("div", { className: "mr-sv__list-end", children: "You have reached the oldest record" })
4049
+ canReveal && /* @__PURE__ */ jsx22("div", { ref: sentinelRef, className: "mr-sv__list-sentinel", "aria-hidden": true }),
4050
+ !canReveal && rows.length > 0 && /* @__PURE__ */ jsx22("div", { className: "mr-sv__list-end", children: "You have reached the oldest record" })
3951
4051
  ] }),
3952
- showChip && /* @__PURE__ */ jsxs20("button", { type: "button", className: `mr-sv__jump-chip mr-sv__jump-chip--${direction}`, onClick: jumpToSelected, children: [
3953
- direction === "up" ? /* @__PURE__ */ jsx21(ArrowUp, { size: 14, "aria-hidden": true }) : /* @__PURE__ */ jsx21(ArrowDown, { size: 14, "aria-hidden": true }),
4052
+ showChip && /* @__PURE__ */ jsxs21("button", { type: "button", className: `mr-sv__jump-chip mr-sv__jump-chip--${direction}`, onClick: jumpToSelected, children: [
4053
+ direction === "up" ? /* @__PURE__ */ jsx22(ArrowUp, { size: 14, "aria-hidden": true }) : /* @__PURE__ */ jsx22(ArrowDown, { size: 14, "aria-hidden": true }),
3954
4054
  "Jump to selected"
3955
4055
  ] })
3956
4056
  ] }),
3957
- collapsed && /* @__PURE__ */ jsx21("button", { type: "button", className: "mr-sv__sidebar-collapse-btn", onClick: toggleCollapsed, "aria-label": "Expand sidebar", "aria-expanded": false, children: /* @__PURE__ */ jsx21(ChevronRight5, { size: 16, "aria-hidden": true }) })
4057
+ collapsed && /* @__PURE__ */ jsx22("button", { type: "button", className: "mr-sv__sidebar-collapse-btn", onClick: toggleCollapsed, "aria-label": "Expand sidebar", "aria-expanded": false, children: /* @__PURE__ */ jsx22(ChevronRight6, { size: 16, "aria-hidden": true }) })
3958
4058
  ] }) });
3959
4059
  });
3960
4060
 
3961
4061
  // src/views/SmartRecordsView/components/CareContextEmptyState.tsx
3962
- import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
4062
+ import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
3963
4063
  function CareContextEmptyState({ noCareContext }) {
3964
- return /* @__PURE__ */ jsxs21("div", { className: "mr-sv__empty", children: [
3965
- /* @__PURE__ */ jsx22(EmptyIllustration, {}),
3966
- /* @__PURE__ */ jsxs21("div", { className: "mr-sv__empty-text", children: [
3967
- /* @__PURE__ */ jsx22(Typography_default, { variant: "heading", as: "h2", children: noCareContext ? "Select a record" : "Select a care context" }),
3968
- /* @__PURE__ */ jsx22(Typography_default, { variant: "muted", children: noCareContext ? "Pick a record on the left, or use the search bar to find one." : "Pick a record on the left to see its vitals or use the search bar." })
4064
+ return /* @__PURE__ */ jsxs22("div", { className: "mr-sv__empty", children: [
4065
+ /* @__PURE__ */ jsx23(EmptyIllustration, {}),
4066
+ /* @__PURE__ */ jsxs22("div", { className: "mr-sv__empty-text", children: [
4067
+ /* @__PURE__ */ jsx23(Typography_default, { variant: "heading", as: "h2", children: noCareContext ? "Select a record" : "Select a care context" }),
4068
+ /* @__PURE__ */ jsx23(Typography_default, { variant: "muted", children: noCareContext ? "Pick a record on the left, or use the search bar to find one." : "Pick a record on the left to see its vitals or use the search bar." })
3969
4069
  ] })
3970
4070
  ] });
3971
4071
  }
3972
4072
 
3973
4073
  // src/views/SmartRecordsView/components/MainPanel.tsx
3974
4074
  import { memo as memo10, Suspense as Suspense2, lazy as lazy2 } from "react";
3975
- import { jsx as jsx23 } from "react/jsx-runtime";
4075
+ import { jsx as jsx24 } from "react/jsx-runtime";
3976
4076
  var VitalHistoryPanel2 = lazy2(
3977
- () => import("./VitalHistoryPanel-XTATAJHE.mjs").then((m) => ({
4077
+ () => import("./VitalHistoryPanel-US2HXGCR.mjs").then((m) => ({
3978
4078
  default: m.VitalHistoryPanel
3979
4079
  }))
3980
4080
  );
3981
4081
  var OriginalRecordPanel = lazy2(
3982
- () => import("./OriginalRecordPanel-EYOVIYJH.mjs").then((m) => ({
4082
+ () => import("./OriginalRecordPanel-HBEPXX4Y.mjs").then((m) => ({
3983
4083
  default: m.OriginalRecordPanel
3984
4084
  }))
3985
4085
  );
@@ -3988,13 +4088,13 @@ var MainPanel = memo10(function MainPanel2({
3988
4088
  canGoBack,
3989
4089
  onBack
3990
4090
  }) {
3991
- if (mainView.kind === "empty") return /* @__PURE__ */ jsx23(EmptyState, {});
4091
+ if (mainView.kind === "empty") return /* @__PURE__ */ jsx24(EmptyState, {});
3992
4092
  if (mainView.kind === "smart")
3993
- return /* @__PURE__ */ jsx23(RecordPanel, { recordId: mainView.recordId, caseId: mainView.caseId, onBack: canGoBack ? onBack : void 0 });
4093
+ return /* @__PURE__ */ jsx24(RecordPanel, { recordId: mainView.recordId, caseId: mainView.caseId, onBack: canGoBack ? onBack : void 0 });
3994
4094
  if (mainView.kind === "preview")
3995
- return /* @__PURE__ */ jsx23(RecordPanel, { recordId: mainView.recordId, onBack: canGoBack ? onBack : void 0 });
4095
+ return /* @__PURE__ */ jsx24(RecordPanel, { recordId: mainView.recordId, onBack: canGoBack ? onBack : void 0 });
3996
4096
  if (mainView.kind === "history")
3997
- return /* @__PURE__ */ jsx23(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx23(
4097
+ return /* @__PURE__ */ jsx24(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx24(
3998
4098
  VitalHistoryPanel2,
3999
4099
  {
4000
4100
  recordId: mainView.recordId,
@@ -4004,17 +4104,17 @@ var MainPanel = memo10(function MainPanel2({
4004
4104
  }
4005
4105
  ) });
4006
4106
  if (mainView.kind === "original")
4007
- return /* @__PURE__ */ jsx23(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx23(OriginalRecordPanel, { recordId: mainView.recordId, caseId: mainView.caseId, onBack }) });
4107
+ return /* @__PURE__ */ jsx24(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx24(OriginalRecordPanel, { recordId: mainView.recordId, caseId: mainView.caseId, onBack }) });
4008
4108
  return null;
4009
4109
  });
4010
4110
 
4011
4111
  // src/views/SmartRecordsView/SmartRecordsView.tsx
4012
- import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
4112
+ import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
4013
4113
  var DeleteConfirmModal = lazy3(
4014
- () => import("./widgets-NJ2AXABO.mjs").then((m) => ({ default: m.DeleteConfirmModal }))
4114
+ () => import("./widgets-V22RS7VB.mjs").then((m) => ({ default: m.DeleteConfirmModal }))
4015
4115
  );
4016
4116
  var SmartUploadModal2 = lazy3(
4017
- () => import("./SmartUploadModal-IOLZU6YA.mjs").then((m) => ({
4117
+ () => import("./SmartUploadModal-4TEHAM5P.mjs").then((m) => ({
4018
4118
  default: m.SmartUploadModal
4019
4119
  }))
4020
4120
  );
@@ -4022,7 +4122,7 @@ function newestSidebarRow(state, labelOf) {
4022
4122
  return buildSidebarRows(state.collection.groups, labelOf)[0] ?? null;
4023
4123
  }
4024
4124
  function SmartRecordsView(props) {
4025
- return /* @__PURE__ */ jsx24(SmartRecordsViewInner, { ...props });
4125
+ return /* @__PURE__ */ jsx25(SmartRecordsViewInner, { ...props });
4026
4126
  }
4027
4127
  function SmartRecordsViewInner({
4028
4128
  className,
@@ -4036,7 +4136,8 @@ function SmartRecordsViewInner({
4036
4136
  onCopyVitalsToNote,
4037
4137
  onToast,
4038
4138
  onViewChange,
4039
- hideOpenInNewTab = false
4139
+ hideOpenInNewTab = false,
4140
+ renderScribeDocument
4040
4141
  }) {
4041
4142
  const {
4042
4143
  mainView,
@@ -4062,55 +4163,65 @@ function SmartRecordsViewInner({
4062
4163
  const recordsCount = useStore16(store, (s) => s.records.ids.length);
4063
4164
  const casesCount = useStore16(store, (s) => s.cases.ids.length);
4064
4165
  const collectionStatus = useStore16(store, (s) => s.collection.status);
4166
+ const collectionItemCount = useStore16(
4167
+ store,
4168
+ (s) => s.collection.groups.reduce((count, group) => count + group.items.length, 0)
4169
+ );
4065
4170
  const rootRef = useRef13(null);
4066
4171
  const onCopyToNoteRef = useRef13(onCopyToNote);
4067
4172
  const onCopyVitalsToNoteRef = useRef13(onCopyVitalsToNote);
4068
4173
  const onAddToContextRef = useRef13(onAddToContext);
4069
4174
  const onToastRef = useRef13(onToast);
4070
4175
  const onViewChangeRef = useRef13(onViewChange);
4176
+ const renderScribeDocumentRef = useRef13(renderScribeDocument);
4071
4177
  onCopyToNoteRef.current = onCopyToNote;
4072
4178
  onCopyVitalsToNoteRef.current = onCopyVitalsToNote;
4073
4179
  onAddToContextRef.current = onAddToContext;
4074
4180
  onToastRef.current = onToast;
4075
4181
  onViewChangeRef.current = onViewChange;
4076
- useEffect15(() => {
4182
+ renderScribeDocumentRef.current = renderScribeDocument;
4183
+ useEffect16(() => {
4077
4184
  onViewChangeRef.current?.(mainView);
4078
4185
  }, [mainView]);
4079
- const [selectedCaseId, setSelectedCaseId] = useState14(null);
4080
- const [uploadOpen, setUploadOpen] = useState14(false);
4081
- const stableCopyToNote = useCallback23(
4186
+ const [selectedCaseId, setSelectedCaseId] = useState16(null);
4187
+ const [uploadOpen, setUploadOpen] = useState16(false);
4188
+ const stableCopyToNote = useCallback24(
4082
4189
  (text, anchor, vitalsRows) => onCopyToNoteRef.current?.(text, anchor, vitalsRows),
4083
4190
  []
4084
4191
  );
4085
- const stableCopyVitalsToNote = useCallback23(
4192
+ const stableCopyVitalsToNote = useCallback24(
4086
4193
  (text) => onCopyVitalsToNoteRef.current?.(text),
4087
4194
  []
4088
4195
  );
4089
- const stableToast = useCallback23(
4196
+ const stableToast = useCallback24(
4090
4197
  (message, type) => onToastRef.current?.(message, type),
4091
4198
  []
4092
4199
  );
4093
- const attachToContext = useCallback23((documentId, name, visitId) => {
4200
+ const stableRenderScribeDocument = useCallback24(
4201
+ (args) => renderScribeDocumentRef.current?.(args) ?? null,
4202
+ []
4203
+ );
4204
+ const attachToContext = useCallback24((documentId, name, visitId) => {
4094
4205
  void onAddToContextRef.current?.([visitId ? { documentId, name, visitId } : { documentId, name }]);
4095
4206
  }, []);
4096
- const handleSelectCase = useCallback23(
4207
+ const handleSelectCase = useCallback24(
4097
4208
  (caseId) => {
4098
4209
  setSelectedCaseId(caseId);
4099
4210
  resetStack();
4100
4211
  },
4101
4212
  [resetStack]
4102
4213
  );
4103
- const handleClearCaseSelection = useCallback23(() => {
4214
+ const handleClearCaseSelection = useCallback24(() => {
4104
4215
  setSelectedCaseId(null);
4105
4216
  resetStack();
4106
4217
  }, [resetStack]);
4107
- const handleRefresh = useCallback23(() => {
4218
+ const handleRefresh = useCallback24(() => {
4108
4219
  void refresh();
4109
4220
  void refreshCollection();
4110
4221
  }, [refresh, refreshCollection]);
4111
4222
  const didInitRef = useRef13(false);
4112
- useEffect15(() => {
4113
- if (didInitRef.current || recordsCount === 0) return;
4223
+ useEffect16(() => {
4224
+ if (didInitRef.current || recordsCount === 0 || collectionItemCount === 0) return;
4114
4225
  if (collectionStatus === "idle" || collectionStatus === "loading") return;
4115
4226
  const first = newestSidebarRow(store.getState(), labelOf);
4116
4227
  if (!first) return;
@@ -4120,10 +4231,10 @@ function SmartRecordsViewInner({
4120
4231
  } else {
4121
4232
  selectRecord(first.id, first.isSmart);
4122
4233
  }
4123
- }, [recordsCount, store, labelOf, handleSelectCase, selectRecord, collectionStatus]);
4124
- const openUpload = useCallback23(() => setUploadOpen(true), []);
4125
- const closeUpload = useCallback23(() => setUploadOpen(false), []);
4126
- const handleConfirmDelete = useCallback23(async () => {
4234
+ }, [recordsCount, collectionItemCount, store, labelOf, handleSelectCase, selectRecord, collectionStatus]);
4235
+ const openUpload = useCallback24(() => setUploadOpen(true), []);
4236
+ const closeUpload = useCallback24(() => setUploadOpen(false), []);
4237
+ const handleConfirmDelete = useCallback24(async () => {
4127
4238
  if (!deleteTarget) return;
4128
4239
  try {
4129
4240
  await deleteRecord(deleteTarget);
@@ -4131,7 +4242,7 @@ function SmartRecordsViewInner({
4131
4242
  } catch {
4132
4243
  }
4133
4244
  }, [deleteTarget, deleteRecord, confirmDelete]);
4134
- const handleUpload = useCallback23(
4245
+ const handleUpload = useCallback24(
4135
4246
  async (items) => {
4136
4247
  try {
4137
4248
  if (onUploadFiles) {
@@ -4152,6 +4263,7 @@ function SmartRecordsViewInner({
4152
4263
  [onUploadFiles, upload]
4153
4264
  );
4154
4265
  const hasCopyToNote = !!onCopyToNote;
4266
+ const hasScribeRenderer = !!renderScribeDocument;
4155
4267
  const rootClass = `mr-sv${className ? ` ${className}` : ""}`;
4156
4268
  const hideSidebar = mainView.kind === "original";
4157
4269
  const actions = useMemo11(
@@ -4168,9 +4280,12 @@ function SmartRecordsViewInner({
4168
4280
  back,
4169
4281
  attachToContext: onAddToContext ? attachToContext : void 0,
4170
4282
  requestDelete,
4171
- onToast: stableToast
4283
+ onToast: stableToast,
4284
+ renderScribeDocument: hasScribeRenderer ? stableRenderScribeDocument : void 0
4172
4285
  }),
4173
4286
  [
4287
+ hasScribeRenderer,
4288
+ stableRenderScribeDocument,
4174
4289
  stableCopyToNote,
4175
4290
  hasCopyToNote,
4176
4291
  hideOpenInNewTab,
@@ -4189,15 +4304,15 @@ function SmartRecordsViewInner({
4189
4304
  ]
4190
4305
  );
4191
4306
  if ((recordsStatus === "idle" || recordsStatus === "loading" || recordsStatus === "stale") && recordsCount === 0)
4192
- return /* @__PURE__ */ jsx24("div", { className: rootClass, children: /* @__PURE__ */ jsx24(RecordsLoadingState, { patientName }) });
4307
+ return /* @__PURE__ */ jsx25("div", { className: rootClass, children: /* @__PURE__ */ jsx25(RecordsLoadingState, { patientName }) });
4193
4308
  if (recordsCount === 0)
4194
- return /* @__PURE__ */ jsxs22("div", { className: rootClass, children: [
4195
- /* @__PURE__ */ jsx24(NoRecordsState, { onUpload: allowUpload ? openUpload : void 0 }),
4196
- uploadOpen && /* @__PURE__ */ jsx24(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx24(SmartUploadModal2, { onUpload: handleUpload, onClose: closeUpload }) })
4309
+ return /* @__PURE__ */ jsxs23("div", { className: rootClass, children: [
4310
+ /* @__PURE__ */ jsx25(NoRecordsState, { onUpload: allowUpload ? openUpload : void 0 }),
4311
+ uploadOpen && /* @__PURE__ */ jsx25(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx25(SmartUploadModal2, { onUpload: handleUpload, onClose: closeUpload }) })
4197
4312
  ] });
4198
- return /* @__PURE__ */ jsx24(SmartRecordsActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsxs22("div", { ref: rootRef, className: rootClass, children: [
4199
- /* @__PURE__ */ jsx24("div", { className: "mr-sv__body", children: /* @__PURE__ */ jsx24("div", { className: "mr-sv__card", children: /* @__PURE__ */ jsxs22(Fragment7, { children: [
4200
- !hideSidebar && /* @__PURE__ */ jsx24(
4313
+ return /* @__PURE__ */ jsx25(SmartRecordsActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsxs23("div", { ref: rootRef, className: rootClass, children: [
4314
+ /* @__PURE__ */ jsx25("div", { className: "mr-sv__body", children: /* @__PURE__ */ jsx25("div", { className: "mr-sv__card", children: /* @__PURE__ */ jsxs23(Fragment7, { children: [
4315
+ !hideSidebar && /* @__PURE__ */ jsx25(
4201
4316
  SmartRecordsSidebar,
4202
4317
  {
4203
4318
  selectedCaseId,
@@ -4208,7 +4323,7 @@ function SmartRecordsViewInner({
4208
4323
  isRefreshing: recordsStatus === "loading"
4209
4324
  }
4210
4325
  ),
4211
- /* @__PURE__ */ jsx24("div", { className: "mr-sv__main", children: mainView.kind === "empty" ? selectedCaseId ? /* @__PURE__ */ jsx24(CareContextPanel, { caseId: selectedCaseId }, selectedCaseId) : /* @__PURE__ */ jsx24(CareContextEmptyState, { noCareContext: casesCount === 0 }) : /* @__PURE__ */ jsx24(
4326
+ /* @__PURE__ */ jsx25("div", { className: "mr-sv__main", children: mainView.kind === "empty" ? selectedCaseId ? /* @__PURE__ */ jsx25(CareContextPanel, { caseId: selectedCaseId }, selectedCaseId) : /* @__PURE__ */ jsx25(CareContextEmptyState, { noCareContext: casesCount === 0 }) : /* @__PURE__ */ jsx25(
4212
4327
  MainPanel,
4213
4328
  {
4214
4329
  mainView,
@@ -4219,7 +4334,7 @@ function SmartRecordsViewInner({
4219
4334
  ] }) }) }),
4220
4335
  deleteTarget && (() => {
4221
4336
  const rec = store.getState().records.byId[deleteTarget];
4222
- return rec ? /* @__PURE__ */ jsx24(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx24(
4337
+ return rec ? /* @__PURE__ */ jsx25(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx25(
4223
4338
  DeleteConfirmModal,
4224
4339
  {
4225
4340
  recordLabel: rec.title,
@@ -4229,7 +4344,7 @@ function SmartRecordsViewInner({
4229
4344
  }
4230
4345
  ) }) : null;
4231
4346
  })(),
4232
- uploadOpen && /* @__PURE__ */ jsx24(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx24(SmartUploadModal2, { onUpload: handleUpload, onClose: closeUpload }) })
4347
+ uploadOpen && /* @__PURE__ */ jsx25(Suspense3, { fallback: null, children: /* @__PURE__ */ jsx25(SmartUploadModal2, { onUpload: handleUpload, onClose: closeUpload }) })
4233
4348
  ] }) });
4234
4349
  }
4235
4350
  export {
@@ -4239,6 +4354,7 @@ export {
4239
4354
  IconButton,
4240
4355
  PrescriptionPanel,
4241
4356
  SHOW_CUSTOM_SECTIONS,
4357
+ ScribeDocumentPanel,
4242
4358
  SdkProvider,
4243
4359
  SidebarItem_default as SidebarItem,
4244
4360
  Skeleton,