@mieweb/ui 0.11.0-dev.33 → 0.11.0-dev.35

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 (88) hide show
  1. package/dist/{chunk-PJN4HM2X.cjs → chunk-3O3Q3DX7.cjs} +21 -21
  2. package/dist/{chunk-PJN4HM2X.cjs.map → chunk-3O3Q3DX7.cjs.map} +1 -1
  3. package/dist/{chunk-M42FTWY2.cjs → chunk-46RYJYN2.cjs} +6 -6
  4. package/dist/{chunk-M42FTWY2.cjs.map → chunk-46RYJYN2.cjs.map} +1 -1
  5. package/dist/{chunk-JMAZ2GKT.js → chunk-4GSFVD5V.js} +3 -3
  6. package/dist/{chunk-JMAZ2GKT.js.map → chunk-4GSFVD5V.js.map} +1 -1
  7. package/dist/{chunk-2R3ILG4Y.cjs → chunk-4M2KE4O5.cjs} +7 -7
  8. package/dist/{chunk-2R3ILG4Y.cjs.map → chunk-4M2KE4O5.cjs.map} +1 -1
  9. package/dist/{chunk-NAQMIFUF.js → chunk-4SUEBKTY.js} +3 -3
  10. package/dist/{chunk-NAQMIFUF.js.map → chunk-4SUEBKTY.js.map} +1 -1
  11. package/dist/{chunk-X6HEWIYP.cjs → chunk-6O6EYKOG.cjs} +130 -874
  12. package/dist/chunk-6O6EYKOG.cjs.map +1 -0
  13. package/dist/{chunk-ZNYBLM4O.cjs → chunk-DXNVQQYN.cjs} +4 -4
  14. package/dist/{chunk-ZNYBLM4O.cjs.map → chunk-DXNVQQYN.cjs.map} +1 -1
  15. package/dist/{chunk-WEGKY2LY.js → chunk-EWPNM6OO.js} +5 -3
  16. package/dist/chunk-EWPNM6OO.js.map +1 -0
  17. package/dist/{chunk-IBEQ54XW.js → chunk-EX7Q5545.js} +4 -4
  18. package/dist/{chunk-IBEQ54XW.js.map → chunk-EX7Q5545.js.map} +1 -1
  19. package/dist/{chunk-VV2U36T6.cjs → chunk-MZR634HI.cjs} +9 -9
  20. package/dist/{chunk-VV2U36T6.cjs.map → chunk-MZR634HI.cjs.map} +1 -1
  21. package/dist/{chunk-JCO62XMU.cjs → chunk-NCPDUJKJ.cjs} +43 -26
  22. package/dist/chunk-NCPDUJKJ.cjs.map +1 -0
  23. package/dist/{chunk-PYAK7XXD.js → chunk-NW6D6AFL.js} +80 -819
  24. package/dist/chunk-NW6D6AFL.js.map +1 -0
  25. package/dist/{chunk-ZPPMEUGR.cjs → chunk-PGJLW2NO.cjs} +7 -7
  26. package/dist/{chunk-ZPPMEUGR.cjs.map → chunk-PGJLW2NO.cjs.map} +1 -1
  27. package/dist/{chunk-ZFJJMDV3.js → chunk-RTADGBBN.js} +3 -3
  28. package/dist/{chunk-ZFJJMDV3.js.map → chunk-RTADGBBN.js.map} +1 -1
  29. package/dist/{chunk-LJ4CCM3V.cjs → chunk-S2CJ57BX.cjs} +5 -3
  30. package/dist/chunk-S2CJ57BX.cjs.map +1 -0
  31. package/dist/{chunk-KSQQBFDQ.js → chunk-SPGP252Q.js} +43 -26
  32. package/dist/chunk-SPGP252Q.js.map +1 -0
  33. package/dist/{chunk-67SD6VPF.cjs → chunk-SVC7NPQ6.cjs} +6 -6
  34. package/dist/{chunk-67SD6VPF.cjs.map → chunk-SVC7NPQ6.cjs.map} +1 -1
  35. package/dist/{chunk-TWQSMUE6.js → chunk-VMEVLBI3.js} +46 -38
  36. package/dist/chunk-VMEVLBI3.js.map +1 -0
  37. package/dist/{chunk-QNJEDBIN.js → chunk-X5HLVACK.js} +4 -4
  38. package/dist/{chunk-QNJEDBIN.js.map → chunk-X5HLVACK.js.map} +1 -1
  39. package/dist/{chunk-LC3JL2HB.cjs → chunk-XEHD2HA5.cjs} +46 -38
  40. package/dist/chunk-XEHD2HA5.cjs.map +1 -0
  41. package/dist/{chunk-R3MJKY63.js → chunk-YGSPIDE4.js} +3 -3
  42. package/dist/{chunk-R3MJKY63.js.map → chunk-YGSPIDE4.js.map} +1 -1
  43. package/dist/{chunk-7LKTIZLR.js → chunk-YR45POH2.js} +3 -3
  44. package/dist/{chunk-7LKTIZLR.js.map → chunk-YR45POH2.js.map} +1 -1
  45. package/dist/components/AlertDialog/index.cjs +6 -6
  46. package/dist/components/AlertDialog/index.js +2 -2
  47. package/dist/components/EmailEditor/index.cjs +12 -12
  48. package/dist/components/EmailEditor/index.js +3 -3
  49. package/dist/components/KeyboardShortcutsOverlay/index.cjs +4 -4
  50. package/dist/components/KeyboardShortcutsOverlay/index.js +2 -2
  51. package/dist/components/MediaEditor/index.cjs +7 -7
  52. package/dist/components/MediaEditor/index.js +2 -2
  53. package/dist/components/MediaFeed/index.cjs +3 -3
  54. package/dist/components/MediaFeed/index.js +2 -2
  55. package/dist/components/Modal/index.cjs +9 -9
  56. package/dist/components/Modal/index.js +1 -1
  57. package/dist/components/RichTextEditor/index.cjs +4 -4
  58. package/dist/components/RichTextEditor/index.js +1 -1
  59. package/dist/components/SuperChat/index.cjs +3 -3
  60. package/dist/components/SuperChat/index.js +2 -2
  61. package/dist/components/Textarea/index.cjs +5 -5
  62. package/dist/components/Textarea/index.js +2 -2
  63. package/dist/esheet.cjs +462 -1233
  64. package/dist/esheet.cjs.map +1 -1
  65. package/dist/esheet.d.cts +2 -2
  66. package/dist/esheet.d.ts +2 -2
  67. package/dist/esheet.js +375 -1146
  68. package/dist/esheet.js.map +1 -1
  69. package/dist/index.cjs +1011 -239
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +6 -2
  72. package/dist/index.d.ts +6 -2
  73. package/dist/index.js +804 -17
  74. package/dist/index.js.map +1 -1
  75. package/dist/{model-NPW2JMHZ.cjs → model-EFXX5JZN.cjs} +18 -18
  76. package/dist/{model-NPW2JMHZ.cjs.map → model-EFXX5JZN.cjs.map} +1 -1
  77. package/dist/{model-SG5H3TCJ.js → model-TAARSYDY.js} +4 -4
  78. package/dist/{model-SG5H3TCJ.js.map → model-TAARSYDY.js.map} +1 -1
  79. package/dist/styles.css +1 -1
  80. package/package.json +1 -1
  81. package/dist/chunk-JCO62XMU.cjs.map +0 -1
  82. package/dist/chunk-KSQQBFDQ.js.map +0 -1
  83. package/dist/chunk-LC3JL2HB.cjs.map +0 -1
  84. package/dist/chunk-LJ4CCM3V.cjs.map +0 -1
  85. package/dist/chunk-PYAK7XXD.js.map +0 -1
  86. package/dist/chunk-TWQSMUE6.js.map +0 -1
  87. package/dist/chunk-WEGKY2LY.js.map +0 -1
  88. package/dist/chunk-X6HEWIYP.cjs.map +0 -1
package/dist/esheet.cjs CHANGED
@@ -1,24 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  require('./chunk-K2BY7YPJ.cjs');
4
- var chunkM42FTWY2_cjs = require('./chunk-M42FTWY2.cjs');
5
- var chunkX6HEWIYP_cjs = require('./chunk-X6HEWIYP.cjs');
6
- var chunkJCO62XMU_cjs = require('./chunk-JCO62XMU.cjs');
4
+ var chunk46RYJYN2_cjs = require('./chunk-46RYJYN2.cjs');
5
+ var chunk6O6EYKOG_cjs = require('./chunk-6O6EYKOG.cjs');
6
+ var chunkNCPDUJKJ_cjs = require('./chunk-NCPDUJKJ.cjs');
7
7
  require('./chunk-GLG6UE2H.cjs');
8
8
  var chunkSV6YGK4U_cjs = require('./chunk-SV6YGK4U.cjs');
9
- var chunkG7EQ3JPX_cjs = require('./chunk-G7EQ3JPX.cjs');
10
- var chunkAIJAFPGJ_cjs = require('./chunk-AIJAFPGJ.cjs');
9
+ require('./chunk-G7EQ3JPX.cjs');
10
+ require('./chunk-AIJAFPGJ.cjs');
11
11
  var chunkPHUTJKHL_cjs = require('./chunk-PHUTJKHL.cjs');
12
- var chunkZNYBLM4O_cjs = require('./chunk-ZNYBLM4O.cjs');
13
- require('./chunk-LJ4CCM3V.cjs');
12
+ var chunkDXNVQQYN_cjs = require('./chunk-DXNVQQYN.cjs');
13
+ require('./chunk-S2CJ57BX.cjs');
14
14
  var chunkFSLI5IKP_cjs = require('./chunk-FSLI5IKP.cjs');
15
15
  require('./chunk-YP5T6NZD.cjs');
16
16
  var chunkUPWIJC6I_cjs = require('./chunk-UPWIJC6I.cjs');
17
17
  require('./chunk-ZNUMOJOI.cjs');
18
18
  require('./chunk-PINIBEIU.cjs');
19
19
  require('./chunk-MJWFNV3L.cjs');
20
- var chunk7AECNMYV_cjs = require('./chunk-7AECNMYV.cjs');
21
- require('./chunk-LC3JL2HB.cjs');
20
+ require('./chunk-7AECNMYV.cjs');
21
+ require('./chunk-XEHD2HA5.cjs');
22
22
  require('./chunk-I44YNYI6.cjs');
23
23
  var chunkZ5S5JEJD_cjs = require('./chunk-Z5S5JEJD.cjs');
24
24
  require('./chunk-GF2BE4FB.cjs');
@@ -28,7 +28,7 @@ require('./chunk-NNEFAUHV.cjs');
28
28
  var chunkFHY3K6PL_cjs = require('./chunk-FHY3K6PL.cjs');
29
29
  require('./chunk-FSGEDDF2.cjs');
30
30
  require('./chunk-AOHJILLU.cjs');
31
- var chunkCW75IKA6_cjs = require('./chunk-CW75IKA6.cjs');
31
+ require('./chunk-CW75IKA6.cjs');
32
32
  require('./chunk-C7RVKV25.cjs');
33
33
  require('./chunk-SCV7C55E.cjs');
34
34
  require('./chunk-L7L5S2HO.cjs');
@@ -238,7 +238,7 @@ function EncounterMdyView({ source }) {
238
238
  const [failure2, setFailure] = React11__namespace.useState(null);
239
239
  React11__namespace.useEffect(() => {
240
240
  let cancelled = false;
241
- void chunkM42FTWY2_cjs.renderEncounterMdy(source).then((result) => {
241
+ void chunk46RYJYN2_cjs.renderEncounterMdy(source).then((result) => {
242
242
  if (cancelled) return;
243
243
  const html = createEncounterReportHtml(
244
244
  result.html ?? "",
@@ -389,7 +389,7 @@ function EncounterVitalsField({
389
389
  const [drafts, setDrafts] = React11__namespace.useState({});
390
390
  const readOnly = !(isPreview && isEnabled) || Boolean(isReadOnly) || Boolean(parsed.error);
391
391
  const definition = field.definition;
392
- const issues = chunkM42FTWY2_cjs.validateEncounterVitals(parsed.value, definition.id);
392
+ const issues = chunk46RYJYN2_cjs.validateEncounterVitals(parsed.value, definition.id);
393
393
  const commit = (value) => {
394
394
  if (!readOnly) {
395
395
  const next = { ...response, answer: JSON.stringify(value), _ai: false };
@@ -681,103 +681,6 @@ function EncounterVitalsField({
681
681
  }
682
682
  );
683
683
  }
684
- function FreeClinicalEntry({
685
- placeholder,
686
- translate,
687
- onFreeText
688
- }) {
689
- const [text, setText] = React11__namespace.useState("");
690
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-wrap gap-2", children: [
691
- /* @__PURE__ */ jsxRuntime.jsx(
692
- chunkZ5S5JEJD_cjs.Input,
693
- {
694
- "aria-label": translate("Clinical entry"),
695
- placeholder,
696
- value: text,
697
- onChange: (event) => setText(event.target.value)
698
- }
699
- ),
700
- /* @__PURE__ */ jsxRuntime.jsx(
701
- chunkFSARTLUE_cjs.Button,
702
- {
703
- type: "button",
704
- disabled: !text.trim(),
705
- onClick: () => {
706
- onFreeText?.(text.trim());
707
- setText("");
708
- },
709
- children: translate("Add")
710
- }
711
- )
712
- ] });
713
- }
714
- function codedOrderSearch(config, requireCoding = true, translate = (message) => message) {
715
- const CodedOrderSearch = ({
716
- domains,
717
- preferDomains,
718
- preferCodetypes,
719
- billableOnly,
720
- placeholder,
721
- onPick,
722
- onFreeText
723
- }) => {
724
- if (!config)
725
- return /* @__PURE__ */ jsxRuntime.jsx(
726
- FreeClinicalEntry,
727
- {
728
- placeholder,
729
- translate,
730
- onFreeText
731
- }
732
- );
733
- const Lookup = config.component;
734
- const allowedDomains = domains;
735
- return /* @__PURE__ */ jsxRuntime.jsx(
736
- Lookup,
737
- {
738
- indexUrl: config.indexUrl,
739
- locale: config.locale,
740
- domains: allowedDomains,
741
- preferDomains,
742
- preferCodetypes,
743
- billableOnly,
744
- bare: true,
745
- clearOnSelect: true,
746
- placeholder,
747
- onFreeText: requireCoding ? void 0 : onFreeText,
748
- onSelect: (result) => {
749
- if (!result.fullid?.trim() || !result.codetype?.trim() || !result.fullcode?.trim() || !result.label?.trim() || allowedDomains !== void 0 && !allowedDomains.includes(result.domain))
750
- return;
751
- onPick({
752
- fullid: result.fullid,
753
- label: result.label,
754
- codetype: result.codetype,
755
- fullcode: result.fullcode
756
- });
757
- }
758
- }
759
- );
760
- };
761
- return CodedOrderSearch;
762
- }
763
- var clinicalAssessmentClasses = "rounded-none border-0 bg-transparent shadow-none [&_.border-dashed]:rounded-none [&_.border-dashed]:border-0 [&_.border-dashed]:bg-transparent [&_.border-dashed]:p-0 [&_.min-w-64]:min-w-0 [&_[data-slot=assessment-problem]]:rounded-none [&_[data-slot=assessment-problem]]:border-0 [&_[data-slot=assessment-problem]]:px-0 [&_[data-slot=assessment-problem]>ul]:ms-0 [&_[data-slot=assessment-problem]>ul]:border-0 [&_[data-slot=assessment-problem]>ul]:ps-4 [&_button]:min-h-11 [&_button]:min-w-11 [&_input]:min-h-11 [&_select]:min-h-11 [&>[data-slot=card-content]]:p-0 [&>[data-slot=card-content]>section]:border-0 [&>[data-slot=card-content]>section]:bg-transparent [&>[data-slot=card-content]>section]:px-0";
764
- var clinicalEntryCardClasses = "bg-muted/40 min-w-0 space-y-3 rounded-lg p-3";
765
- function ClinicalAddButton({
766
- label,
767
- onClick
768
- }) {
769
- return /* @__PURE__ */ jsxRuntime.jsx(
770
- chunkFSARTLUE_cjs.Button,
771
- {
772
- type: "button",
773
- variant: "ghost",
774
- leftIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { "aria-hidden": "true" }),
775
- className: "text-primary-800 hover:bg-primary-50 hover:text-primary-900 active:bg-primary-100 dark:text-primary-400 dark:hover:bg-primary-950 dark:hover:text-primary-200 min-h-11",
776
- onClick,
777
- children: label
778
- }
779
- );
780
- }
781
684
  function InvalidClinicalAnswer({
782
685
  label,
783
686
  answer
@@ -828,7 +731,7 @@ function getExternalEncounterConditions(state) {
828
731
  if (!answer) continue;
829
732
  try {
830
733
  const parsed = JSON.parse(answer);
831
- if (chunkM42FTWY2_cjs.validateEncounterConditions(parsed).length > 0) continue;
734
+ if (chunk46RYJYN2_cjs.validateEncounterConditions(parsed).length > 0) continue;
832
735
  for (const concern of parsed.concerns) {
833
736
  if (!byId.has(concern.concernId)) byId.set(concern.concernId, concern);
834
737
  }
@@ -922,18 +825,15 @@ function conditionSystemIdentity(system) {
922
825
  const trimmed = system.trim();
923
826
  if (trimmed === "http://hl7.org/fhir/sid/icd-10-cm") return "ICD-10-CM";
924
827
  if (trimmed === "http://snomed.info/sct") return "SNOMED";
925
- return chunkX6HEWIYP_cjs.normalizeConditionCodingSystem(trimmed);
828
+ return chunk6O6EYKOG_cjs.normalizeConditionCodingSystem(trimmed);
926
829
  }
927
830
  function matchingConditionCode(concern, picked) {
928
831
  return Boolean(
929
- chunkJCO62XMU_cjs.currentAssertion(concern)?.coding?.some(
832
+ chunkNCPDUJKJ_cjs.currentAssertion(concern)?.coding?.some(
930
833
  (coding) => conditionSystemIdentity(coding.system) === conditionSystemIdentity(picked.codetype) && coding.code.trim().toUpperCase() === picked.fullcode.trim().toUpperCase()
931
834
  )
932
835
  );
933
836
  }
934
- function clinicalRequiresCoding(field) {
935
- return field.definition._sourceData?.encounterRequireCoding ?? true;
936
- }
937
837
  function clinicalAnswerResponse(response, answer) {
938
838
  const next = { ...response, answer, _ai: false };
939
839
  delete next.selected;
@@ -945,38 +845,7 @@ function useEncounterAssertionDate(field) {
945
845
  React11__namespace.useEffect(() => {
946
846
  setDate(hostDate ?? "");
947
847
  }, [hostDate]);
948
- return { date, setDate, valid: chunkM42FTWY2_cjs.isEncounterDate(date) };
949
- }
950
- function EncounterAssertionDateInput({
951
- date,
952
- setDate
953
- }) {
954
- const m = chunkFSLI5IKP_cjs.useMessages();
955
- const id = React11__namespace.useId();
956
- const [display, setDisplay] = React11__namespace.useState(() => chunkCW75IKA6_cjs.dateToDisplayFormat(date));
957
- React11__namespace.useEffect(() => {
958
- setDisplay(
959
- (current) => chunkCW75IKA6_cjs.displayFormatToDateString(current) === date ? current : chunkCW75IKA6_cjs.dateToDisplayFormat(date)
960
- );
961
- }, [date]);
962
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
963
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "text-sm font-medium", children: m("Assertion date") }),
964
- /* @__PURE__ */ jsxRuntime.jsx(
965
- chunkPHUTJKHL_cjs.DateInput,
966
- {
967
- id,
968
- value: display,
969
- onChange: (value) => {
970
- setDisplay(value);
971
- setDate(chunkCW75IKA6_cjs.displayFormatToDateString(value));
972
- },
973
- showCalendar: true,
974
- width: "fixed",
975
- className: "min-h-11"
976
- }
977
- ),
978
- !chunkM42FTWY2_cjs.isEncounterDate(date) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: m("Enter the encounter date before adding or changing a diagnosis.") })
979
- ] });
848
+ return { date, setDate, valid: chunk46RYJYN2_cjs.isEncounterDate(date) };
980
849
  }
981
850
  function readAssessment(answer, externalConcerns) {
982
851
  if (!answer) return { value: { concerns: [], items: [], orders: [] } };
@@ -984,13 +853,13 @@ function readAssessment(answer, externalConcerns) {
984
853
  const parsed = JSON.parse(answer);
985
854
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
986
855
  throw new Error();
987
- if (chunkM42FTWY2_cjs.validateEncounterAssessment(parsed, "", "", externalConcerns).length > 0)
856
+ if (chunk46RYJYN2_cjs.validateEncounterAssessment(parsed, "", "", externalConcerns).length > 0)
988
857
  throw new Error();
989
858
  return { value: parsed };
990
859
  } catch {
991
860
  return {
992
861
  value: { concerns: [], items: [], orders: [] },
993
- error: "The saved assessment answer could not be read. The original answer is retained below; correct it through the visit data before editing."
862
+ error: "unreadable"
994
863
  };
995
864
  }
996
865
  }
@@ -1011,11 +880,9 @@ function EncounterAssessmentField({
1011
880
  onResponse
1012
881
  }) {
1013
882
  const m = chunkFSLI5IKP_cjs.useMessages();
1014
- const requireCoding = clinicalRequiresCoding(field);
1015
883
  const assertionDate = useEncounterAssertionDate(field);
1016
884
  const currentDate = React11__namespace.useRef(assertionDate);
1017
885
  currentDate.current = assertionDate;
1018
- const codeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
1019
886
  const state = useClinicalFormState(form);
1020
887
  const externalConcerns = React11__namespace.useMemo(
1021
888
  () => getExternalEncounterConditions(state),
@@ -1040,10 +907,6 @@ function EncounterAssessmentField({
1040
907
  currentValue.current = value;
1041
908
  const canEdit = React11__namespace.useRef(!readOnly);
1042
909
  canEdit.current = !readOnly;
1043
- const renderSearch = React11__namespace.useMemo(
1044
- () => codeLookup || !requireCoding ? codedOrderSearch(codeLookup, requireCoding, m) : void 0,
1045
- [codeLookup, requireCoding, m]
1046
- );
1047
910
  const definition = field.definition;
1048
911
  const commit = (update) => {
1049
912
  if (!canEdit.current || form.getState().readOnly || form.getState().disposed)
@@ -1058,124 +921,92 @@ function EncounterAssessmentField({
1058
921
  );
1059
922
  };
1060
923
  if (error) {
1061
- return /* @__PURE__ */ jsxRuntime.jsx(
1062
- "section",
924
+ return /* @__PURE__ */ jsxRuntime.jsx(InvalidClinicalAnswer, { label: "assessment", answer: response?.answer });
925
+ }
926
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-2", children: [
927
+ /* @__PURE__ */ jsxRuntime.jsx(
928
+ chunk6O6EYKOG_cjs.Assessment,
1063
929
  {
930
+ concerns,
931
+ items: value.items,
932
+ orders: value.orders,
1064
933
  "aria-label": definition.question ?? m("Assessment and plan"),
1065
- className: "space-y-3",
1066
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1067
- "div",
1068
- {
1069
- role: "alert",
1070
- className: "border-destructive text-destructive rounded-lg border p-3",
1071
- children: [
1072
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: m(error) }),
1073
- /* @__PURE__ */ jsxRuntime.jsx(
1074
- "pre",
934
+ readOnly,
935
+ addFormLabel: "Add assessment or order",
936
+ onAddAssessment: !assertionDate.valid ? void 0 : (pick) => {
937
+ if (!currentDate.current.valid) return;
938
+ const existingConcern = pick.code ? concerns.find(
939
+ (concern) => matchingConditionCode(concern, pick.code)
940
+ ) : void 0;
941
+ const existingAssertion = existingConcern && chunkNCPDUJKJ_cjs.currentAssertion(existingConcern);
942
+ if (existingConcern && existingAssertion) {
943
+ commit((next) => ({
944
+ ...next,
945
+ items: [
946
+ ...next.items.filter(
947
+ (item) => item.concernId !== existingConcern.concernId
948
+ ),
1075
949
  {
1076
- tabIndex: 0,
1077
- "aria-label": m("Original assessment answer"),
1078
- className: "mt-2 max-h-48 overflow-auto text-xs break-all whitespace-pre-wrap",
1079
- children: response?.answer
950
+ concernId: existingConcern.concernId,
951
+ assertionId: existingAssertion.id
1080
952
  }
1081
- )
1082
- ]
953
+ ]
954
+ }));
955
+ return;
1083
956
  }
1084
- )
1085
- }
1086
- );
1087
- }
1088
- return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(
1089
- chunkX6HEWIYP_cjs.Assessment,
1090
- {
1091
- concerns,
1092
- items: value.items,
1093
- orders: value.orders,
1094
- title: null,
1095
- addFormStart: !readOnly && /* @__PURE__ */ jsxRuntime.jsx(EncounterAssertionDateInput, { ...assertionDate }),
1096
- "aria-label": definition.question ?? m("Assessment and plan"),
1097
- className: "rounded-none border-0 bg-transparent shadow-none [&_.border-dashed]:rounded-none [&_.border-dashed]:border-0 [&_.border-dashed]:bg-transparent [&_.border-dashed]:p-0 [&_.min-w-64]:min-w-0 [&_[data-slot=assessment-problem]]:rounded-none [&_[data-slot=assessment-problem]]:border-0 [&_[data-slot=assessment-problem]]:px-0 [&_[data-slot=assessment-problem]>ul]:ms-0 [&_[data-slot=assessment-problem]>ul]:border-0 [&_[data-slot=assessment-problem]>ul]:ps-4 [&_button]:min-h-11 [&_button]:min-w-11 [&_input]:min-h-11 [&_select]:min-h-11 [&>[data-slot=card-content]]:p-0 [&>[data-slot=card-content]>section]:border-0 [&>[data-slot=card-content]>section]:bg-transparent [&>[data-slot=card-content]>section]:px-0",
1098
- readOnly,
1099
- defaultAddMode: "problem",
1100
- addFormLabel: "Add assessment or order",
1101
- renderOrderSearch: renderSearch,
1102
- onAddAssessment: (codeLookup || !requireCoding) && assertionDate.valid ? (pick) => {
1103
- if (!currentDate.current.valid || requireCoding && !pick.code)
1104
- return;
1105
- const existingConcern = pick.code ? concerns.find(
1106
- (concern) => matchingConditionCode(concern, pick.code)
1107
- ) : void 0;
1108
- const existingAssertion = existingConcern && chunkJCO62XMU_cjs.currentAssertion(existingConcern);
1109
- if (existingConcern && existingAssertion) {
957
+ const concernId = globalThis.crypto.randomUUID();
958
+ const assertionId = globalThis.crypto.randomUUID();
1110
959
  commit((next) => ({
1111
960
  ...next,
1112
- items: [
1113
- ...next.items.filter(
1114
- (item) => item.concernId !== existingConcern.concernId
1115
- ),
961
+ concerns: [
962
+ ...next.concerns,
1116
963
  {
1117
- concernId: existingConcern.concernId,
1118
- assertionId: existingAssertion.id
964
+ concernId,
965
+ clinicalStatus: "active",
966
+ source: "manuallyAdded",
967
+ assertions: [
968
+ {
969
+ id: assertionId,
970
+ date: currentDate.current.date,
971
+ text: pick.label,
972
+ verificationStatus: "unconfirmed",
973
+ coding: pick.code ? [
974
+ {
975
+ system: pick.code.codetype,
976
+ code: pick.code.fullcode,
977
+ display: pick.label
978
+ }
979
+ ] : void 0
980
+ }
981
+ ]
1119
982
  }
1120
- ]
983
+ ],
984
+ items: [...next.items, { concernId, assertionId }]
1121
985
  }));
1122
- return;
1123
- }
1124
- const concernId = globalThis.crypto.randomUUID();
1125
- const assertionId = globalThis.crypto.randomUUID();
1126
- commit((next) => ({
1127
- ...next,
1128
- concerns: [
1129
- ...next.concerns,
1130
- {
1131
- concernId,
1132
- clinicalStatus: "active",
1133
- source: "manuallyAdded",
1134
- assertions: [
1135
- {
1136
- id: assertionId,
1137
- date: currentDate.current.date,
1138
- text: pick.label,
1139
- verificationStatus: "unconfirmed",
1140
- coding: pick.code ? [
1141
- {
1142
- system: pick.code.codetype,
1143
- code: pick.code.fullcode,
1144
- display: pick.label
1145
- }
1146
- ] : void 0
1147
- }
1148
- ]
1149
- }
1150
- ],
1151
- items: [...next.items, { concernId, assertionId }]
1152
- }));
1153
- } : void 0,
1154
- onRemoveAssessment: (item) => {
1155
- const wasLocal = currentValue.current.concerns.some(
1156
- (concern) => concern.concernId === item.concernId
1157
- );
1158
- commit((next) => ({
1159
- ...next,
1160
- // Removing the row also drops its local concern record — nothing
1161
- // else can reference it once the orders below are unlinked, and an
1162
- // orphaned uncoded concern would block Save with no visible repair.
1163
- concerns: next.concerns.filter(
1164
- (concern) => concern.concernId !== item.concernId
1165
- ),
1166
- items: next.items.filter(
1167
- (candidate) => candidate.concernId !== item.concernId
1168
- ),
1169
- orders: next.orders.map(
1170
- (order) => order.concernId === item.concernId ? { ...order, concernId: void 0 } : order
1171
- )
1172
- }));
1173
- if (wasLocal && canEdit.current)
1174
- repairEncounterConcernReferences(form.getState(), item.concernId);
1175
- },
1176
- onAddOrder: codeLookup || !requireCoding ? (item, order) => {
1177
- if (requireCoding && !order.code) return;
1178
- commit((next) => ({
986
+ },
987
+ onRemoveAssessment: (item) => {
988
+ const wasLocal = currentValue.current.concerns.some(
989
+ (concern) => concern.concernId === item.concernId
990
+ );
991
+ commit((next) => ({
992
+ ...next,
993
+ // Removing the row also drops its local concern record — nothing
994
+ // else can reference it once the orders below are unlinked, and an
995
+ // orphaned uncoded concern would block Save with no visible repair.
996
+ concerns: next.concerns.filter(
997
+ (concern) => concern.concernId !== item.concernId
998
+ ),
999
+ items: next.items.filter(
1000
+ (candidate) => candidate.concernId !== item.concernId
1001
+ ),
1002
+ orders: next.orders.map(
1003
+ (order) => order.concernId === item.concernId ? { ...order, concernId: void 0 } : order
1004
+ )
1005
+ }));
1006
+ if (wasLocal && canEdit.current)
1007
+ repairEncounterConcernReferences(form.getState(), item.concernId);
1008
+ },
1009
+ onAddOrder: (item, order) => commit((next) => ({
1179
1010
  ...next,
1180
1011
  orders: [
1181
1012
  ...next.orders,
@@ -1185,36 +1016,39 @@ function EncounterAssessmentField({
1185
1016
  concernId: item?.concernId
1186
1017
  }
1187
1018
  ]
1188
- }));
1189
- } : void 0,
1190
- onEditOrder: (order, changes) => commit((next) => ({
1191
- ...next,
1192
- orders: next.orders.map(
1193
- (candidate) => candidate.orderId === order.orderId ? { ...candidate, ...changes } : candidate
1194
- )
1195
- })),
1196
- onRemoveOrder: (order) => commit((next) => ({
1197
- ...next,
1198
- orders: next.orders.filter(
1199
- (candidate) => candidate.orderId !== order.orderId
1200
- )
1201
- })),
1202
- onLinkOrder: (order, concernId) => commit((next) => ({
1203
- ...next,
1204
- orders: next.orders.map(
1205
- (candidate) => candidate.orderId === order.orderId ? { ...candidate, concernId } : candidate
1206
- )
1207
- })),
1208
- onReorderItems: (ids) => commit((next) => ({
1209
- ...next,
1210
- items: reorder(next.items, ids, (item) => item.concernId)
1211
- })),
1212
- onReorderOrders: (ids) => commit((next) => ({
1213
- ...next,
1214
- orders: reorder(next.orders, ids, (order) => order.orderId)
1215
- }))
1216
- }
1217
- ) });
1019
+ })),
1020
+ onEditOrder: (order, changes) => commit((next) => ({
1021
+ ...next,
1022
+ orders: next.orders.map(
1023
+ (candidate) => candidate.orderId === order.orderId ? { ...candidate, ...changes } : candidate
1024
+ )
1025
+ })),
1026
+ onRemoveOrder: (order) => commit((next) => ({
1027
+ ...next,
1028
+ orders: next.orders.filter(
1029
+ (candidate) => candidate.orderId !== order.orderId
1030
+ )
1031
+ })),
1032
+ onLinkOrder: (order, concernId) => commit((next) => ({
1033
+ ...next,
1034
+ orders: next.orders.map(
1035
+ (candidate) => candidate.orderId === order.orderId ? { ...candidate, concernId } : candidate
1036
+ )
1037
+ })),
1038
+ onReorderItems: (ids) => commit((next) => ({
1039
+ ...next,
1040
+ items: reorder(next.items, ids, (item) => item.concernId)
1041
+ })),
1042
+ onReorderOrders: (ids) => commit((next) => ({
1043
+ ...next,
1044
+ orders: reorder(next.orders, ids, (order) => order.orderId)
1045
+ }))
1046
+ }
1047
+ ),
1048
+ !readOnly && !assertionDate.valid && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: m(
1049
+ "No encounter date \u2014 new diagnoses are disabled; orders can still be added."
1050
+ ) })
1051
+ ] });
1218
1052
  }
1219
1053
 
1220
1054
  // src/esheet-fields/narrativeFindings.ts
@@ -1480,7 +1314,7 @@ function EsheetNarrativeField({
1480
1314
  }
1481
1315
  ),
1482
1316
  /* @__PURE__ */ jsxRuntime.jsx(
1483
- chunkZNYBLM4O_cjs.TextAreaRich,
1317
+ chunkDXNVQQYN_cjs.TextAreaRich,
1484
1318
  {
1485
1319
  ref: editorRef,
1486
1320
  value: html,
@@ -1594,7 +1428,7 @@ function readValue(answer) {
1594
1428
  if (!answer) return { value: { medications: [] } };
1595
1429
  try {
1596
1430
  const value = JSON.parse(answer);
1597
- if (chunkM42FTWY2_cjs.validateEncounterMedicationValue(value).length) throw new Error();
1431
+ if (chunk46RYJYN2_cjs.validateEncounterMedicationValue(value).length) throw new Error();
1598
1432
  return { value };
1599
1433
  } catch {
1600
1434
  return {
@@ -1603,250 +1437,6 @@ function readValue(answer) {
1603
1437
  };
1604
1438
  }
1605
1439
  }
1606
- function parseAnswerDate(value) {
1607
- const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value ?? "");
1608
- return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
1609
- }
1610
- function toAnswerDate(date) {
1611
- if (!date) return void 0;
1612
- const pad = (part) => String(part).padStart(2, "0");
1613
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
1614
- }
1615
- function MedicationCard({
1616
- index,
1617
- medication,
1618
- readOnly,
1619
- requireCoding,
1620
- codeLookup,
1621
- onPatch,
1622
- onRemove
1623
- }) {
1624
- const m = chunkFSLI5IKP_cjs.useMessages();
1625
- const id = React11__namespace.useId();
1626
- const Lookup = codeLookup?.component;
1627
- const text = (value) => value.trim() && value;
1628
- return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: clinicalEntryCardClasses, children: [
1629
- /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "sr-only", children: m("Medication {number}", { number: index }) }),
1630
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1631
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold", children: m("Medication {number}", { number: index }) }),
1632
- !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
1633
- chunkFSARTLUE_cjs.Button,
1634
- {
1635
- type: "button",
1636
- variant: "ghost",
1637
- size: "icon",
1638
- className: "shrink-0",
1639
- "aria-label": m("Remove medication {number}", { number: index }),
1640
- onClick: onRemove,
1641
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4", "aria-hidden": "true" })
1642
- }
1643
- )
1644
- ] }),
1645
- !readOnly && Lookup && codeLookup ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
1646
- /* @__PURE__ */ jsxRuntime.jsx(
1647
- Lookup,
1648
- {
1649
- indexUrl: codeLookup.indexUrl,
1650
- locale: codeLookup.locale,
1651
- domains: ["med"],
1652
- bare: true,
1653
- clearOnSelect: false,
1654
- initialQuery: medication.name || void 0,
1655
- initialSearch: false,
1656
- "aria-label": m("Medication"),
1657
- placeholder: m("Search RxNorm / FDB \u2014 e.g. lisinopril"),
1658
- onSelect: (pick) => {
1659
- if (requireCoding && (!pick.codetype.trim() || !pick.fullcode.trim()))
1660
- return;
1661
- onPatch(chunkX6HEWIYP_cjs.lookupToMedicationFields(pick));
1662
- },
1663
- onFreeText: requireCoding ? void 0 : (name) => {
1664
- if (name.trim()) onPatch({ name, code: void 0 });
1665
- }
1666
- }
1667
- ),
1668
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: medication.code ? m("Coded: {system} {code}", {
1669
- system: medication.code.system,
1670
- code: medication.code.code
1671
- }) : medication.name ? m('Uncoded free text: "{name}" \u2014 pick a result to code it', {
1672
- name: medication.name
1673
- }) : requireCoding ? m("Pick a catalog result to code the medication") : m(
1674
- "Pick a result to code the medication, or press Enter for free text"
1675
- ) })
1676
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
1677
- chunkZ5S5JEJD_cjs.Input,
1678
- {
1679
- label: m("Medication"),
1680
- className: "min-h-11",
1681
- value: medication.name,
1682
- readOnly: readOnly || requireCoding,
1683
- onChange: (event) => {
1684
- if (event.target.value.trim())
1685
- onPatch({ name: event.target.value, code: void 0 });
1686
- }
1687
- }
1688
- ),
1689
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-3", children: [
1690
- /* @__PURE__ */ jsxRuntime.jsx(
1691
- chunkZ5S5JEJD_cjs.Input,
1692
- {
1693
- label: m("Strength"),
1694
- className: "min-h-11",
1695
- value: medication.strength ?? "",
1696
- readOnly,
1697
- onChange: (event) => onPatch({ strength: text(event.target.value) || void 0 })
1698
- }
1699
- ),
1700
- /* @__PURE__ */ jsxRuntime.jsx(
1701
- chunkZ5S5JEJD_cjs.Input,
1702
- {
1703
- label: m("Dose form"),
1704
- className: "min-h-11",
1705
- value: medication.doseForm ?? "",
1706
- readOnly,
1707
- onChange: (event) => (
1708
- // Quantity unit follows the dose form (tablet → tablet,
1709
- // solution → milliliter, …)
1710
- onPatch({
1711
- doseForm: event.target.value || void 0,
1712
- quantityUnit: chunkX6HEWIYP_cjs.doseFormToQuantityUnit(event.target.value)
1713
- })
1714
- )
1715
- }
1716
- ),
1717
- /* @__PURE__ */ jsxRuntime.jsx(
1718
- chunkZ5S5JEJD_cjs.Input,
1719
- {
1720
- label: medication.quantityUnit ? `${m("Quantity")} (${medication.quantityUnit}s)` : m("Quantity"),
1721
- className: "min-h-11",
1722
- inputMode: "decimal",
1723
- value: medication.quantity ?? "",
1724
- readOnly,
1725
- onChange: (event) => onPatch({ quantity: text(event.target.value) || void 0 })
1726
- }
1727
- )
1728
- ] }),
1729
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-3", children: [
1730
- /* @__PURE__ */ jsxRuntime.jsx(
1731
- chunkZ5S5JEJD_cjs.Input,
1732
- {
1733
- label: m("Days supply"),
1734
- className: "min-h-11",
1735
- inputMode: "numeric",
1736
- value: medication.daysSupply ?? "",
1737
- readOnly,
1738
- onChange: (event) => onPatch({ daysSupply: text(event.target.value) || void 0 })
1739
- }
1740
- ),
1741
- /* @__PURE__ */ jsxRuntime.jsx(
1742
- chunkZ5S5JEJD_cjs.Input,
1743
- {
1744
- label: m("Refills"),
1745
- className: "min-h-11",
1746
- inputMode: "numeric",
1747
- value: medication.refills ?? "",
1748
- readOnly,
1749
- onChange: (event) => onPatch({ refills: text(event.target.value) || void 0 })
1750
- }
1751
- ),
1752
- readOnly ? /* @__PURE__ */ jsxRuntime.jsx(
1753
- chunkZ5S5JEJD_cjs.Input,
1754
- {
1755
- label: m("Start \u2013 end date"),
1756
- className: "min-h-11",
1757
- value: [medication.startDate, medication.endDate].filter(Boolean).join(" \u2013 "),
1758
- readOnly: true
1759
- }
1760
- ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-1.5", children: [
1761
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground block text-sm font-medium", children: m("Start \u2013 end date") }),
1762
- /* @__PURE__ */ jsxRuntime.jsx(
1763
- chunkX6HEWIYP_cjs.DateRangePicker,
1764
- {
1765
- className: "w-full [&_[data-slot=date-range-trigger]]:min-h-11 [&_[data-slot=date-range-trigger]]:w-full",
1766
- variant: "responsive",
1767
- showPresets: false,
1768
- placeholder: m("Start \u2013 end date"),
1769
- value: {
1770
- start: parseAnswerDate(medication.startDate),
1771
- end: parseAnswerDate(medication.endDate)
1772
- },
1773
- onChange: (range) => onPatch({
1774
- startDate: toAnswerDate(range.start),
1775
- endDate: toAnswerDate(range.end)
1776
- })
1777
- }
1778
- )
1779
- ] })
1780
- ] }),
1781
- /* @__PURE__ */ jsxRuntime.jsxs(
1782
- chunkG7EQ3JPX_cjs.RadioGroup,
1783
- {
1784
- name: `${id}-substitution`,
1785
- label: m("Substitution"),
1786
- value: medication.substitution ?? "0",
1787
- onValueChange: (value) => {
1788
- if (!readOnly) onPatch({ substitution: value });
1789
- },
1790
- orientation: "horizontal",
1791
- size: "sm",
1792
- disabled: readOnly,
1793
- children: [
1794
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "0", label: m("Substitution permitted") }),
1795
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "1", label: m("Dispense as written (DAW)") })
1796
- ]
1797
- }
1798
- ),
1799
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
1800
- /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: `${id}-sig`, children: m("Sig (patient directions)") }),
1801
- /* @__PURE__ */ jsxRuntime.jsx(
1802
- chunkZNYBLM4O_cjs.Textarea,
1803
- {
1804
- id: `${id}-sig`,
1805
- rows: 2,
1806
- value: medication.sig ?? "",
1807
- readOnly,
1808
- onChange: (event) => {
1809
- const sig = event.target.value;
1810
- const { route, frequency, prn } = chunkX6HEWIYP_cjs.parseSig(sig);
1811
- onPatch({ sig, route, frequency, prn: prn || void 0 });
1812
- }
1813
- }
1814
- ),
1815
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", "aria-live": "polite", children: medication.route || medication.frequency || medication.prn ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1816
- m("Derived:"),
1817
- " ",
1818
- [
1819
- medication.route && m("route {route}", { route: medication.route }),
1820
- medication.frequency && m(medication.frequency.toLowerCase()),
1821
- medication.prn && m("PRN (as needed)")
1822
- ].filter(Boolean).join(" \xB7 ")
1823
- ] }) : m("Route, frequency, and PRN are derived from the directions") })
1824
- ] }),
1825
- /* @__PURE__ */ jsxRuntime.jsx(
1826
- chunkZ5S5JEJD_cjs.Input,
1827
- {
1828
- label: m("Indication"),
1829
- className: "min-h-11",
1830
- value: medication.indication ?? "",
1831
- readOnly,
1832
- onChange: (event) => onPatch({ indication: text(event.target.value) || void 0 })
1833
- }
1834
- ),
1835
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
1836
- /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: `${id}-pharmacy-notes`, children: m("Pharmacy notes") }),
1837
- /* @__PURE__ */ jsxRuntime.jsx(
1838
- chunkZNYBLM4O_cjs.Textarea,
1839
- {
1840
- id: `${id}-pharmacy-notes`,
1841
- rows: 2,
1842
- value: medication.pharmacyNotes ?? "",
1843
- readOnly,
1844
- onChange: (event) => onPatch({ pharmacyNotes: event.target.value || void 0 })
1845
- }
1846
- )
1847
- ] })
1848
- ] });
1849
- }
1850
1440
  function EncounterMedicationField({
1851
1441
  field,
1852
1442
  form,
@@ -1860,24 +1450,16 @@ function EncounterMedicationField({
1860
1450
  () => readValue(response?.answer),
1861
1451
  [response?.answer]
1862
1452
  );
1863
- const m = chunkFSLI5IKP_cjs.useMessages();
1864
- const requireCoding = clinicalRequiresCoding(field);
1865
- const codeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
1866
1453
  const state = useClinicalFormState(form);
1867
- const [draft, setDraft] = React11__namespace.useState(null);
1868
1454
  const readOnly = !(isPreview && isEnabled) || Boolean(isReadOnly) || state.readOnly || state.disposed || Boolean(error);
1869
1455
  const canEdit = React11__namespace.useRef(!readOnly);
1870
1456
  canEdit.current = !readOnly;
1871
1457
  const currentValue = React11__namespace.useRef(value);
1872
1458
  currentValue.current = value;
1873
- const definition = field.definition;
1874
- const commit = (update) => {
1459
+ const commit = (medications) => {
1875
1460
  if (!canEdit.current || form.getState().readOnly || form.getState().disposed)
1876
1461
  return;
1877
- const next = {
1878
- ...currentValue.current,
1879
- medications: update(currentValue.current)
1880
- };
1462
+ const next = { ...currentValue.current, medications };
1881
1463
  currentValue.current = next;
1882
1464
  onResponse(
1883
1465
  clinicalAnswerResponse(
@@ -1886,77 +1468,15 @@ function EncounterMedicationField({
1886
1468
  )
1887
1469
  );
1888
1470
  };
1889
- const patchMedication = (medication, patch) => {
1890
- if (draft && medication.id === draft.id) {
1891
- const next = { ...draft, ...patch };
1892
- if (next.name.trim()) {
1893
- setDraft(null);
1894
- commit((current) => [...current.medications, next]);
1895
- } else setDraft(next);
1896
- } else {
1897
- commit(
1898
- (current) => current.medications.map(
1899
- (candidate) => candidate.id === medication.id ? { ...candidate, ...patch } : candidate
1900
- )
1901
- );
1902
- }
1903
- };
1904
- const cards = !readOnly && draft ? [...value.medications, draft] : value.medications;
1471
+ if (error)
1472
+ return /* @__PURE__ */ jsxRuntime.jsx(InvalidClinicalAnswer, { label: "medication", answer: response?.answer });
1905
1473
  return /* @__PURE__ */ jsxRuntime.jsx(
1906
- "section",
1474
+ chunk6O6EYKOG_cjs.MedicationReconciliation,
1907
1475
  {
1908
- "aria-label": definition.question ?? m("Presenting medications"),
1909
- className: "min-w-0 space-y-3",
1910
- children: error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "alert", className: "text-destructive space-y-2 text-sm", children: [
1911
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: m(error) }),
1912
- /* @__PURE__ */ jsxRuntime.jsx(
1913
- "pre",
1914
- {
1915
- tabIndex: 0,
1916
- "aria-label": m("Original medication answer"),
1917
- className: "max-h-48 overflow-auto text-xs break-all whitespace-pre-wrap",
1918
- children: response?.answer
1919
- }
1920
- )
1921
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1922
- !readOnly && requireCoding && !codeLookup && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m(
1923
- "Connect a medication terminology catalog to add coded medications."
1924
- ) }),
1925
- requireCoding && value.medications.some((medication) => !medication.code) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m(
1926
- "Imported medications without a code are retained. Pick a catalog result to code them."
1927
- ) }),
1928
- readOnly && value.medications.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m("No medications recorded.") }),
1929
- cards.map((medication, index) => /* @__PURE__ */ jsxRuntime.jsx(
1930
- MedicationCard,
1931
- {
1932
- index: index + 1,
1933
- medication,
1934
- readOnly,
1935
- requireCoding,
1936
- codeLookup,
1937
- onPatch: (patch) => patchMedication(medication, patch),
1938
- onRemove: () => {
1939
- if (draft && medication.id === draft.id) setDraft(null);
1940
- else
1941
- commit(
1942
- (current) => current.medications.filter(({ id }) => id !== medication.id)
1943
- );
1944
- }
1945
- },
1946
- medication.id
1947
- )),
1948
- !readOnly && !draft && (codeLookup || !requireCoding) && /* @__PURE__ */ jsxRuntime.jsx(
1949
- ClinicalAddButton,
1950
- {
1951
- label: cards.length > 0 ? m("Add another medication") : m("Add medication"),
1952
- onClick: () => setDraft({
1953
- id: globalThis.crypto.randomUUID(),
1954
- name: "",
1955
- status: "unreconciled"
1956
- })
1957
- }
1958
- )
1959
- ] })
1476
+ medications: value.medications,
1477
+ onChange: commit,
1478
+ inlineAddSearch: true,
1479
+ readOnly
1960
1480
  }
1961
1481
  );
1962
1482
  }
@@ -1964,7 +1484,7 @@ function readValue2(answer) {
1964
1484
  if (!answer) return { value: { allergies: [] } };
1965
1485
  try {
1966
1486
  const value = JSON.parse(answer);
1967
- if (chunkM42FTWY2_cjs.validateEncounterAllergyValue(value).length) throw new Error();
1487
+ if (chunk46RYJYN2_cjs.validateEncounterAllergyValue(value).length) throw new Error();
1968
1488
  return { value };
1969
1489
  } catch {
1970
1490
  return {
@@ -1973,201 +1493,6 @@ function readValue2(answer) {
1973
1493
  };
1974
1494
  }
1975
1495
  }
1976
- function AllergyCard({
1977
- index,
1978
- allergy,
1979
- readOnly,
1980
- requireCoding,
1981
- codeLookup,
1982
- onPatch,
1983
- onRemove
1984
- }) {
1985
- const m = chunkFSLI5IKP_cjs.useMessages();
1986
- const id = React11__namespace.useId();
1987
- const Lookup = codeLookup?.component;
1988
- const isDrug = (allergy.type ?? "drug") === "drug";
1989
- const text = (value) => value.trim() && value;
1990
- return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: clinicalEntryCardClasses, children: [
1991
- /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "sr-only", children: m("Allergy {number}", { number: index }) }),
1992
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1993
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold", children: m("Allergy {number}", { number: index }) }),
1994
- !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
1995
- chunkFSARTLUE_cjs.Button,
1996
- {
1997
- type: "button",
1998
- variant: "ghost",
1999
- size: "icon",
2000
- className: "shrink-0",
2001
- "aria-label": m("Remove allergy {number}", { number: index }),
2002
- onClick: onRemove,
2003
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4", "aria-hidden": "true" })
2004
- }
2005
- )
2006
- ] }),
2007
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-3", children: [
2008
- readOnly ? /* @__PURE__ */ jsxRuntime.jsx(
2009
- chunkZ5S5JEJD_cjs.Input,
2010
- {
2011
- label: m("Type"),
2012
- className: "min-h-11",
2013
- value: m(chunkX6HEWIYP_cjs.ALLERGY_TYPE_LABELS[allergy.type ?? "drug"]),
2014
- readOnly: true
2015
- }
2016
- ) : /* @__PURE__ */ jsxRuntime.jsx(
2017
- chunkUPWIJC6I_cjs.Select,
2018
- {
2019
- label: m("Type"),
2020
- className: "[&_[data-slot=select-trigger]]:min-h-11",
2021
- options: Object.keys(chunkX6HEWIYP_cjs.ALLERGY_TYPE_LABELS).map(
2022
- (type) => ({ value: type, label: m(chunkX6HEWIYP_cjs.ALLERGY_TYPE_LABELS[type]) })
2023
- ),
2024
- value: allergy.type ?? "drug",
2025
- onValueChange: (next) => {
2026
- const type = next;
2027
- onPatch({
2028
- type,
2029
- ...type !== (allergy.type ?? "drug") && { code: void 0 }
2030
- });
2031
- }
2032
- }
2033
- ),
2034
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 sm:col-span-2", children: !readOnly && Lookup && codeLookup && (isDrug || requireCoding) ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2035
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground block text-sm font-medium", children: m("Allergen") }),
2036
- /* @__PURE__ */ jsxRuntime.jsx(
2037
- Lookup,
2038
- {
2039
- indexUrl: codeLookup.indexUrl,
2040
- locale: codeLookup.locale,
2041
- domains: isDrug ? ["med"] : ["condition"],
2042
- searchCodetypes: isDrug ? void 0 : ["SNOMED US"],
2043
- bare: true,
2044
- clearOnSelect: false,
2045
- initialQuery: allergy.allergen || void 0,
2046
- initialSearch: false,
2047
- "aria-label": m("Allergen"),
2048
- placeholder: isDrug ? m("Search drug allergens \u2014 e.g. penicillin") : m("Search SNOMED allergen substances"),
2049
- onSelect: (pick) => {
2050
- if (requireCoding && (!pick.codetype.trim() || !pick.fullcode.trim()))
2051
- return;
2052
- onPatch({
2053
- allergen: pick.label,
2054
- code: {
2055
- system: pick.codetype,
2056
- code: pick.fullcode,
2057
- display: pick.label
2058
- }
2059
- });
2060
- },
2061
- onFreeText: requireCoding ? void 0 : (allergen) => {
2062
- if (allergen.trim())
2063
- onPatch({ allergen, code: void 0 });
2064
- }
2065
- }
2066
- ),
2067
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: allergy.code ? m("Coded: {system} {code}", {
2068
- system: allergy.code.system,
2069
- code: allergy.code.code
2070
- }) : allergy.allergen ? m(
2071
- 'Uncoded free text: "{name}" \u2014 pick a result to code it',
2072
- { name: allergy.allergen }
2073
- ) : requireCoding ? m("Pick a catalog result to code the allergen") : m(
2074
- "Pick a result to code the allergen, or press Enter for free text"
2075
- ) })
2076
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
2077
- chunkZ5S5JEJD_cjs.Input,
2078
- {
2079
- label: m("Allergen"),
2080
- className: "min-h-11",
2081
- value: allergy.allergen,
2082
- readOnly: readOnly || requireCoding,
2083
- onChange: (event) => {
2084
- if (event.target.value.trim())
2085
- onPatch({ allergen: event.target.value, code: void 0 });
2086
- }
2087
- }
2088
- ) })
2089
- ] }),
2090
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [
2091
- /* @__PURE__ */ jsxRuntime.jsx(
2092
- chunkZ5S5JEJD_cjs.Input,
2093
- {
2094
- label: m("Reaction"),
2095
- className: "min-h-11",
2096
- value: allergy.reaction ?? "",
2097
- readOnly,
2098
- onChange: (event) => onPatch({ reaction: text(event.target.value) || void 0 })
2099
- }
2100
- ),
2101
- /* @__PURE__ */ jsxRuntime.jsx(
2102
- chunkPHUTJKHL_cjs.DateInput,
2103
- {
2104
- label: m("Onset date"),
2105
- className: "min-h-11",
2106
- value: allergy.onsetDate ?? "",
2107
- onChange: (next) => {
2108
- if (!readOnly) onPatch({ onsetDate: next || void 0 });
2109
- }
2110
- }
2111
- )
2112
- ] }),
2113
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [
2114
- /* @__PURE__ */ jsxRuntime.jsxs(
2115
- chunkG7EQ3JPX_cjs.RadioGroup,
2116
- {
2117
- name: `${id}-kind`,
2118
- label: m("Mechanism"),
2119
- description: m(
2120
- "A true immune-mediated allergy, or a non-immune intolerance (e.g. GI upset)"
2121
- ),
2122
- value: allergy.kind ?? "allergy",
2123
- onValueChange: (next) => {
2124
- if (!readOnly) onPatch({ kind: next });
2125
- },
2126
- orientation: "horizontal",
2127
- size: "sm",
2128
- disabled: readOnly,
2129
- children: [
2130
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "allergy", label: m("Allergy") }),
2131
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "intolerance", label: m("Intolerance") })
2132
- ]
2133
- }
2134
- ),
2135
- /* @__PURE__ */ jsxRuntime.jsxs(
2136
- chunkG7EQ3JPX_cjs.RadioGroup,
2137
- {
2138
- name: `${id}-severity`,
2139
- label: m("Severity"),
2140
- value: allergy.severity ?? "",
2141
- onValueChange: (next) => {
2142
- if (!readOnly)
2143
- onPatch({ severity: next || void 0 });
2144
- },
2145
- orientation: "horizontal",
2146
- size: "sm",
2147
- disabled: readOnly,
2148
- children: [
2149
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "mild", label: m("Mild") }),
2150
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "moderate", label: m("Moderate") }),
2151
- /* @__PURE__ */ jsxRuntime.jsx(chunkG7EQ3JPX_cjs.Radio, { value: "severe", label: m("Severe") })
2152
- ]
2153
- }
2154
- )
2155
- ] }),
2156
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2157
- /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: `${id}-note`, children: m("Note") }),
2158
- /* @__PURE__ */ jsxRuntime.jsx(
2159
- chunkZNYBLM4O_cjs.Textarea,
2160
- {
2161
- id: `${id}-note`,
2162
- rows: 2,
2163
- value: allergy.note ?? "",
2164
- readOnly,
2165
- onChange: (event) => onPatch({ note: event.target.value || void 0 })
2166
- }
2167
- )
2168
- ] })
2169
- ] });
2170
- }
2171
1496
  function EncounterAllergyField({
2172
1497
  field,
2173
1498
  form,
@@ -2181,17 +1506,12 @@ function EncounterAllergyField({
2181
1506
  () => readValue2(response?.answer),
2182
1507
  [response?.answer]
2183
1508
  );
2184
- const m = chunkFSLI5IKP_cjs.useMessages();
2185
- const requireCoding = clinicalRequiresCoding(field);
2186
- const codeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
2187
1509
  const state = useClinicalFormState(form);
2188
- const [draft, setDraft] = React11__namespace.useState(null);
2189
1510
  const readOnly = !(isPreview && isEnabled) || Boolean(isReadOnly) || state.readOnly || state.disposed || Boolean(error);
2190
1511
  const canEdit = React11__namespace.useRef(!readOnly);
2191
1512
  canEdit.current = !readOnly;
2192
1513
  const currentValue = React11__namespace.useRef(value);
2193
1514
  currentValue.current = value;
2194
- const definition = field.definition;
2195
1515
  const commitValue = (update) => {
2196
1516
  if (!canEdit.current || form.getState().readOnly || form.getState().disposed)
2197
1517
  return;
@@ -2204,97 +1524,25 @@ function EncounterAllergyField({
2204
1524
  )
2205
1525
  );
2206
1526
  };
2207
- const commit = (update) => commitValue((current) => {
2208
- const allergies = update(current);
2209
- return {
2210
- ...current,
2211
- allergies,
2212
- // Any recorded allergy clears the no-known-allergies flag.
2213
- noKnownAllergies: allergies.length > 0 ? void 0 : current.noKnownAllergies
2214
- };
2215
- });
2216
- const patchAllergy = (allergy, patch) => {
2217
- if (draft && allergy.id === draft.id) {
2218
- const next = { ...draft, ...patch };
2219
- if (next.allergen.trim()) {
2220
- setDraft(null);
2221
- commit((current) => [...current.allergies, next]);
2222
- } else setDraft(next);
2223
- } else {
2224
- commit(
2225
- (current) => current.allergies.map(
2226
- (candidate) => candidate.id === allergy.id ? { ...candidate, ...patch } : candidate
2227
- )
2228
- );
2229
- }
2230
- };
2231
- const cards = !readOnly && draft ? [...value.allergies, draft] : value.allergies;
1527
+ if (error)
1528
+ return /* @__PURE__ */ jsxRuntime.jsx(InvalidClinicalAnswer, { label: "allergy", answer: response?.answer });
2232
1529
  return /* @__PURE__ */ jsxRuntime.jsx(
2233
- "section",
1530
+ chunk6O6EYKOG_cjs.AllergyManager,
2234
1531
  {
2235
- "aria-label": definition.question ?? m("Allergies and intolerances"),
2236
- className: "min-w-0 space-y-3",
2237
- children: error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "alert", className: "text-destructive space-y-2 text-sm", children: [
2238
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: m(error) }),
2239
- /* @__PURE__ */ jsxRuntime.jsx(
2240
- "pre",
2241
- {
2242
- tabIndex: 0,
2243
- "aria-label": m("Original allergy answer"),
2244
- className: "max-h-48 overflow-auto text-xs break-all whitespace-pre-wrap",
2245
- children: response?.answer
2246
- }
2247
- )
2248
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2249
- !readOnly && requireCoding && !codeLookup && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m(
2250
- "Connect an allergen terminology catalog to add coded allergies."
2251
- ) }),
2252
- requireCoding && value.allergies.some((allergy) => !allergy.code) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m(
2253
- "Imported allergies without a code are retained. Pick a catalog result to code them."
2254
- ) }),
2255
- readOnly && value.allergies.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: value.noKnownAllergies ? m("No known allergies (NKA).") : m("No allergies recorded.") }),
2256
- cards.map((allergy, index) => /* @__PURE__ */ jsxRuntime.jsx(
2257
- AllergyCard,
2258
- {
2259
- index: index + 1,
2260
- allergy,
2261
- readOnly,
2262
- requireCoding,
2263
- codeLookup,
2264
- onPatch: (patch) => patchAllergy(allergy, patch),
2265
- onRemove: () => {
2266
- if (draft && allergy.id === draft.id) setDraft(null);
2267
- else
2268
- commit(
2269
- (current) => current.allergies.filter(({ id }) => id !== allergy.id)
2270
- );
2271
- }
2272
- },
2273
- allergy.id
2274
- )),
2275
- !readOnly && value.allergies.length === 0 && !draft && /* @__PURE__ */ jsxRuntime.jsx(
2276
- chunk7AECNMYV_cjs.Checkbox,
2277
- {
2278
- label: m("No known allergies (NKA)"),
2279
- checked: value.noKnownAllergies ?? false,
2280
- onChange: (event) => commitValue((current) => ({
2281
- ...current,
2282
- noKnownAllergies: event.target.checked
2283
- }))
2284
- }
2285
- ),
2286
- !readOnly && !draft && (codeLookup || !requireCoding) && /* @__PURE__ */ jsxRuntime.jsx(
2287
- ClinicalAddButton,
2288
- {
2289
- label: cards.length > 0 ? m("Add another allergy") : m("Add allergy"),
2290
- onClick: () => setDraft({
2291
- id: globalThis.crypto.randomUUID(),
2292
- allergen: "",
2293
- type: "drug"
2294
- })
2295
- }
2296
- )
2297
- ] })
1532
+ allergies: value.allergies,
1533
+ onChange: (allergies) => commitValue((current) => ({
1534
+ ...current,
1535
+ allergies,
1536
+ // Any recorded allergy clears the no-known-allergies flag.
1537
+ noKnownAllergies: allergies.length > 0 ? void 0 : current.noKnownAllergies
1538
+ })),
1539
+ noKnownAllergies: value.noKnownAllergies ?? false,
1540
+ onNoKnownAllergiesChange: (noKnownAllergies) => commitValue((current) => ({
1541
+ ...current,
1542
+ noKnownAllergies: current.allergies.length > 0 ? void 0 : noKnownAllergies
1543
+ })),
1544
+ inlineAddSearch: true,
1545
+ readOnly
2298
1546
  }
2299
1547
  );
2300
1548
  }
@@ -2302,7 +1550,7 @@ function readConditions(answer) {
2302
1550
  if (!answer) return { concerns: [] };
2303
1551
  try {
2304
1552
  const parsed = JSON.parse(answer);
2305
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || !("concerns" in parsed) || chunkM42FTWY2_cjs.validateEncounterConditions(parsed).length > 0)
1553
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || !("concerns" in parsed) || chunk46RYJYN2_cjs.validateEncounterConditions(parsed).length > 0)
2306
1554
  return void 0;
2307
1555
  return parsed;
2308
1556
  } catch {
@@ -2323,14 +1571,11 @@ function EncounterConditionsField({
2323
1571
  [response?.answer]
2324
1572
  );
2325
1573
  const m = chunkFSLI5IKP_cjs.useMessages();
2326
- const requireCoding = clinicalRequiresCoding(field);
1574
+ const codeLookup = chunk6O6EYKOG_cjs.useCodeLookupConfig();
2327
1575
  const assertionDate = useEncounterAssertionDate(field);
2328
1576
  const currentDate = React11__namespace.useRef(assertionDate);
2329
1577
  currentDate.current = assertionDate;
2330
- const [adding, setAdding] = React11__namespace.useState(false);
2331
- const [manualEditing, setManualEditing] = React11__namespace.useState(false);
2332
1578
  const state = useClinicalFormState(form);
2333
- const codeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
2334
1579
  const readOnly = !(isPreview && isEnabled) || Boolean(isReadOnly) || state.readOnly || state.disposed || !value;
2335
1580
  const currentValue = React11__namespace.useRef(value);
2336
1581
  const currentResponse = React11__namespace.useRef(response);
@@ -2338,211 +1583,210 @@ function EncounterConditionsField({
2338
1583
  const canEdit = React11__namespace.useRef(!readOnly);
2339
1584
  currentValue.current = value;
2340
1585
  canEdit.current = !readOnly;
2341
- const [editing, setEditing] = React11__namespace.useState(
2342
- null
2343
- );
2344
- const definition = field.definition;
2345
- const label = definition.question ?? m("Conditions");
1586
+ const [editor, setEditor] = React11__namespace.useState(null);
2346
1587
  const commit = (update) => {
2347
1588
  if (!canEdit.current || form.getState().readOnly || form.getState().disposed || !currentValue.current)
2348
1589
  return;
1590
+ const next = update(currentValue.current);
1591
+ currentValue.current = next;
2349
1592
  onResponse(
2350
1593
  clinicalAnswerResponse(
2351
1594
  form.getState().responses[field.definition.id] ?? currentResponse.current,
2352
- JSON.stringify(update(currentValue.current))
1595
+ JSON.stringify(next)
2353
1596
  )
2354
1597
  );
2355
1598
  };
2356
- const recordAssertion = (draft, pick) => {
2357
- if (!currentDate.current.valid || requireCoding && !draft.coding?.length)
2358
- return;
1599
+ const saveAssertion = (concernId, draft) => {
1600
+ if (!currentDate.current.valid) return;
1601
+ const assertion = {
1602
+ ...draft,
1603
+ id: globalThis.crypto.randomUUID(),
1604
+ date: currentDate.current.date
1605
+ };
2359
1606
  commit((next) => {
2360
- const assertion = {
2361
- ...draft,
2362
- id: globalThis.crypto.randomUUID(),
2363
- date: currentDate.current.date
2364
- };
2365
- if (editing)
1607
+ if (!concernId)
2366
1608
  return {
2367
1609
  ...next,
2368
- concerns: next.concerns.map(
2369
- (concern) => concern.concernId === editing.concernId ? {
2370
- ...concern,
2371
- assertions: [
2372
- ...concern.assertions,
2373
- {
2374
- ...assertion,
2375
- changeType: draft.changeType ?? "refinement",
2376
- supersedes: chunkJCO62XMU_cjs.currentAssertion(concern)?.id
2377
- }
2378
- ]
2379
- } : concern
2380
- )
1610
+ concerns: [
1611
+ ...next.concerns,
1612
+ {
1613
+ concernId: globalThis.crypto.randomUUID(),
1614
+ clinicalStatus: "active",
1615
+ source: "manuallyAdded",
1616
+ assertions: [assertion]
1617
+ }
1618
+ ]
2381
1619
  };
2382
- if (pick && next.concerns.some((concern) => matchingConditionCode(concern, pick)))
2383
- return next;
2384
1620
  return {
2385
1621
  ...next,
2386
- concerns: [
2387
- ...next.concerns,
2388
- {
2389
- concernId: globalThis.crypto.randomUUID(),
2390
- clinicalStatus: "active",
2391
- source: "manuallyAdded",
2392
- assertions: [assertion]
2393
- }
2394
- ]
1622
+ concerns: next.concerns.map((concern) => {
1623
+ if (concern.concernId !== concernId) return concern;
1624
+ const prior = chunkNCPDUJKJ_cjs.currentAssertion(concern);
1625
+ const assertions = draft.changeType === "revision" && prior ? concern.assertions.map(
1626
+ (candidate) => candidate.id === prior.id ? { ...candidate, verificationStatus: "refuted" } : candidate
1627
+ ) : concern.assertions;
1628
+ return {
1629
+ ...concern,
1630
+ assertions: [
1631
+ ...assertions,
1632
+ { ...assertion, supersedes: prior?.id }
1633
+ ]
1634
+ };
1635
+ })
2395
1636
  };
2396
1637
  });
2397
- if (canEdit.current) {
2398
- setEditing(null);
2399
- setManualEditing(false);
2400
- }
2401
1638
  };
2402
1639
  if (!value)
2403
- return /* @__PURE__ */ jsxRuntime.jsx(InvalidClinicalAnswer, { label, answer: response?.answer });
2404
- const editingConcern = editing ? value.concerns.find(({ concernId }) => concernId === editing.concernId) : void 0;
2405
- const Lookup = codeLookup?.component;
2406
- const problemList = /* @__PURE__ */ jsxRuntime.jsx(
2407
- chunkJCO62XMU_cjs.ProblemList,
1640
+ return /* @__PURE__ */ jsxRuntime.jsx(InvalidClinicalAnswer, { label: "condition", answer: response?.answer });
1641
+ const editorConcern = editor?.concernId ? value.concerns.find(({ concernId }) => concernId === editor.concernId) : void 0;
1642
+ const canAssert = assertionDate.valid;
1643
+ const addSearch = codeLookup && !readOnly && canAssert ? /* @__PURE__ */ jsxRuntime.jsx(
1644
+ codeLookup.component,
2408
1645
  {
2409
- concerns: value.concerns,
2410
- title: null,
2411
- readOnly,
2412
- actions: [
2413
- ...assertionDate.valid && (codeLookup || !requireCoding) ? ["refine"] : [],
2414
- "remove"
2415
- ],
2416
- inlineActions: true,
2417
- className: "rounded-none border-0 bg-transparent shadow-none [&_[data-slot=clinical-list-heading]]:hidden [&_button]:min-h-11 [&_button]:min-w-11 [&>[data-slot=card-content]]:space-y-2 [&>[data-slot=card-content]]:p-0",
2418
- onAction: (concern, action) => {
2419
- if (readOnly) return;
2420
- if (action === "remove") {
2421
- setEditing(
2422
- (current) => current?.concernId === concern.concernId ? null : current
2423
- );
2424
- commit((next) => ({
2425
- ...next,
2426
- concerns: next.concerns.filter(
2427
- (candidate) => candidate.concernId !== concern.concernId
2428
- )
2429
- }));
2430
- if (canEdit.current)
2431
- repairEncounterConcernReferences(
2432
- form.getState(),
2433
- concern.concernId
2434
- );
2435
- } else if (action === "refine") {
2436
- setEditing({ concernId: concern.concernId });
2437
- if (!codeLookup) setManualEditing(true);
2438
- }
1646
+ indexUrl: codeLookup.indexUrl,
1647
+ locale: codeLookup.locale,
1648
+ domains: ["condition"],
1649
+ preferCodetypes: ["ICD10"],
1650
+ bare: true,
1651
+ clearOnSelect: true,
1652
+ placeholder: m("Search conditions to add"),
1653
+ onSelect: (result) => {
1654
+ const coded = result.codetype.trim() && result.fullcode.trim();
1655
+ if (coded && (currentValue.current ?? value).concerns.some(
1656
+ (concern) => matchingConditionCode(concern, result)
1657
+ ))
1658
+ return;
1659
+ saveAssertion(void 0, {
1660
+ text: result.label,
1661
+ verificationStatus: "unconfirmed",
1662
+ ...coded ? {
1663
+ coding: [
1664
+ {
1665
+ system: result.codetype,
1666
+ code: result.fullcode,
1667
+ display: result.label,
1668
+ primary: true
1669
+ }
1670
+ ]
1671
+ } : {}
1672
+ });
2439
1673
  },
2440
- onReorder: (ids) => commit((next) => ({
2441
- ...next,
2442
- concerns: reorderClinicalEntries(
2443
- next.concerns,
2444
- ids,
2445
- ({ concernId }) => concernId
2446
- )
2447
- }))
1674
+ onFreeText: (text) => saveAssertion(void 0, {
1675
+ text,
1676
+ verificationStatus: "unconfirmed"
1677
+ })
2448
1678
  }
2449
- );
2450
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": label, className: "min-w-0 space-y-2", children: [
2451
- !readOnly && (adding || editingConcern || value.concerns.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clinicalEntryCardClasses, children: [
2452
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2453
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "min-w-0 font-semibold break-words", children: editingConcern ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2454
- m("Refine"),
2455
- " ",
2456
- chunkJCO62XMU_cjs.currentAssertion(editingConcern)?.text
2457
- ] }) : m("Add condition") }),
2458
- (editingConcern || value.concerns.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(
2459
- chunkFSARTLUE_cjs.Button,
2460
- {
2461
- type: "button",
2462
- variant: "ghost",
2463
- size: "icon",
2464
- className: "shrink-0",
2465
- "aria-label": m("Cancel"),
2466
- onClick: () => {
2467
- setEditing(null);
2468
- setAdding(false);
2469
- setManualEditing(false);
2470
- },
2471
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4", "aria-hidden": "true" })
1679
+ ) : void 0;
1680
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1681
+ /* @__PURE__ */ jsxRuntime.jsx(
1682
+ chunkNCPDUJKJ_cjs.ProblemList,
1683
+ {
1684
+ concerns: value.concerns,
1685
+ readOnly,
1686
+ actions: canAssert ? ["observe", "refine", "revise", "relate", "resolve", "remove"] : ["relate", "resolve", "remove"],
1687
+ onAction: (concern, action) => {
1688
+ if (action === "remove") {
1689
+ setEditor(null);
1690
+ commit((next) => ({
1691
+ ...next,
1692
+ concerns: next.concerns.filter(
1693
+ (candidate) => candidate.concernId !== concern.concernId
1694
+ )
1695
+ }));
1696
+ if (canEdit.current)
1697
+ repairEncounterConcernReferences(
1698
+ form.getState(),
1699
+ concern.concernId
1700
+ );
1701
+ } else if (action === "resolve") {
1702
+ commit((next) => ({
1703
+ ...next,
1704
+ concerns: next.concerns.map(
1705
+ (candidate) => candidate.concernId === concern.concernId ? { ...candidate, clinicalStatus: "resolved" } : candidate
1706
+ )
1707
+ }));
1708
+ } else if (action === "observe" || action === "refine" || action === "revise" || action === "relate") {
1709
+ setEditor({ mode: action, concernId: concern.concernId });
2472
1710
  }
2473
- )
2474
- ] }),
2475
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end", children: [
2476
- /* @__PURE__ */ jsxRuntime.jsx(EncounterAssertionDateInput, { ...assertionDate }),
2477
- assertionDate.valid && Lookup && codeLookup && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1 sm:basis-56", children: /* @__PURE__ */ jsxRuntime.jsx(
2478
- Lookup,
2479
- {
2480
- indexUrl: codeLookup.indexUrl,
2481
- locale: codeLookup.locale,
2482
- domains: ["condition"],
2483
- preferCodetypes: ["ICD10"],
2484
- bare: true,
2485
- clearOnSelect: true,
2486
- initialQuery: editingConcern ? chunkJCO62XMU_cjs.currentAssertion(editingConcern)?.text : "",
2487
- "aria-label": editingConcern ? m("Recode condition") : m("Add condition"),
2488
- placeholder: editingConcern ? m("Search replacement diagnosis\u2026") : m("Search conditions\u2026"),
2489
- onSelect: (pick) => {
2490
- if (!pick.fullid?.trim() || !pick.codetype?.trim() || !pick.fullcode?.trim() || !pick.label?.trim() || pick.domain !== "condition")
2491
- return;
2492
- recordAssertion(
2493
- {
2494
- text: pick.label,
2495
- verificationStatus: "unconfirmed",
2496
- coding: [
1711
+ },
1712
+ addSearch,
1713
+ onAddProblem: addSearch || !canAssert ? void 0 : (text) => saveAssertion(void 0, {
1714
+ text,
1715
+ verificationStatus: "unconfirmed"
1716
+ }),
1717
+ onAdd: canAssert ? () => setEditor({ mode: "add" }) : void 0,
1718
+ onReorder: (ids) => commit((next) => ({
1719
+ ...next,
1720
+ concerns: reorderClinicalEntries(
1721
+ next.concerns,
1722
+ ids,
1723
+ ({ concernId }) => concernId
1724
+ )
1725
+ }))
1726
+ }
1727
+ ),
1728
+ /* @__PURE__ */ jsxRuntime.jsx(
1729
+ chunk6O6EYKOG_cjs.ConditionEditor,
1730
+ {
1731
+ mode: editor?.mode ?? "add",
1732
+ open: editor !== null,
1733
+ onOpenChange: (open) => {
1734
+ if (!open) setEditor(null);
1735
+ },
1736
+ concern: editor?.mode === "add" ? void 0 : editorConcern,
1737
+ relatableConcerns: value.concerns.filter(
1738
+ ({ concernId }) => concernId !== editor?.concernId
1739
+ ),
1740
+ onSave: (draft) => {
1741
+ saveAssertion(
1742
+ editor?.mode === "add" ? void 0 : editor?.concernId,
1743
+ draft
1744
+ );
1745
+ setEditor(null);
1746
+ },
1747
+ onRelate: (relationship) => {
1748
+ const target = editor?.concernId;
1749
+ if (target)
1750
+ commit((next) => ({
1751
+ ...next,
1752
+ concerns: next.concerns.map(
1753
+ (concern) => concern.concernId === target ? {
1754
+ ...concern,
1755
+ relationships: [
1756
+ ...concern.relationships ?? [],
1757
+ relationship
1758
+ ]
1759
+ } : concern
1760
+ )
1761
+ }));
1762
+ setEditor(null);
1763
+ },
1764
+ onAddObservation: (text) => {
1765
+ const target = editor?.concernId;
1766
+ if (target && currentDate.current.valid)
1767
+ commit((next) => ({
1768
+ ...next,
1769
+ concerns: next.concerns.map(
1770
+ (concern) => concern.concernId === target ? {
1771
+ ...concern,
1772
+ observations: [
1773
+ ...concern.observations ?? [],
2497
1774
  {
2498
- system: pick.codetype,
2499
- code: pick.fullcode,
2500
- display: pick.label,
2501
- primary: true
1775
+ id: globalThis.crypto.randomUUID(),
1776
+ date: currentDate.current.date,
1777
+ text
2502
1778
  }
2503
1779
  ]
2504
- },
2505
- pick
2506
- );
2507
- }
2508
- },
2509
- editing ? editing.concernId : "add"
2510
- ) })
2511
- ] }),
2512
- assertionDate.valid && !requireCoding && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2513
- /* @__PURE__ */ jsxRuntime.jsx(
2514
- chunkFSARTLUE_cjs.Button,
2515
- {
2516
- type: "button",
2517
- onClick: () => {
2518
- setManualEditing(true);
2519
- },
2520
- children: m("Other\u2026")
2521
- }
2522
- ),
2523
- /* @__PURE__ */ jsxRuntime.jsx(
2524
- chunkX6HEWIYP_cjs.ConditionEditor,
2525
- {
2526
- mode: editing ? "refine" : "add",
2527
- open: manualEditing,
2528
- onOpenChange: setManualEditing,
2529
- concern: editingConcern,
2530
- renderCodeSearch: false,
2531
- onSave: (draft) => recordAssertion(draft)
2532
- }
2533
- )
2534
- ] }),
2535
- value.concerns.length > 0 && problemList
2536
- ] }),
2537
- !readOnly && !adding && !editingConcern && value.concerns.length === 0 && (codeLookup || !requireCoding) && /* @__PURE__ */ jsxRuntime.jsx(
2538
- ClinicalAddButton,
2539
- {
2540
- label: m("Add condition"),
2541
- onClick: () => setAdding(true)
1780
+ } : concern
1781
+ )
1782
+ }));
1783
+ setEditor(null);
1784
+ }
2542
1785
  }
2543
1786
  ),
2544
- !readOnly && requireCoding && !codeLookup && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m("Coded condition search is unavailable.") }),
2545
- readOnly && problemList
1787
+ !readOnly && !canAssert && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-2 text-xs", children: m(
1788
+ "No encounter date \u2014 conditions cannot be added or revised until the visit provides one."
1789
+ ) })
2546
1790
  ] });
2547
1791
  }
2548
1792
  function readPlan(answer) {
@@ -2551,7 +1795,7 @@ function readPlan(answer) {
2551
1795
  const parsed = JSON.parse(answer);
2552
1796
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || !("orders" in parsed) || !Array.isArray(parsed.orders))
2553
1797
  return void 0;
2554
- if (chunkM42FTWY2_cjs.validateEncounterPlan(parsed).length > 0) return void 0;
1798
+ if (chunk46RYJYN2_cjs.validateEncounterPlan(parsed).length > 0) return void 0;
2555
1799
  return parsed;
2556
1800
  } catch {
2557
1801
  return void 0;
@@ -2574,11 +1818,11 @@ function getPlanConcerns(state) {
2574
1818
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
2575
1819
  continue;
2576
1820
  const assessment = parsed;
2577
- if (chunkM42FTWY2_cjs.validateEncounterConditions({ concerns: assessment.concerns }).length > 0)
1821
+ if (chunk46RYJYN2_cjs.validateEncounterConditions({ concerns: assessment.concerns }).length > 0)
2578
1822
  continue;
2579
1823
  for (const concern of assessment.concerns ?? []) {
2580
1824
  if (concerns.has(concern.concernId)) continue;
2581
- const assertion = chunkJCO62XMU_cjs.currentAssertion(concern);
1825
+ const assertion = chunkNCPDUJKJ_cjs.currentAssertion(concern);
2582
1826
  concerns.set(concern.concernId, concern);
2583
1827
  if (assertion) {
2584
1828
  items.set(concern.concernId, {
@@ -2588,7 +1832,7 @@ function getPlanConcerns(state) {
2588
1832
  }
2589
1833
  }
2590
1834
  for (const item of assessment.items ?? []) {
2591
- if (!chunkM42FTWY2_cjs.validAssessmentItem(item)) continue;
1835
+ if (!chunk46RYJYN2_cjs.validAssessmentItem(item)) continue;
2592
1836
  if (concerns.get(item.concernId)?.assertions.some(({ id }) => id === item.assertionId))
2593
1837
  items.set(item.concernId, item);
2594
1838
  }
@@ -2611,9 +1855,7 @@ function EncounterPlanField({
2611
1855
  [response?.answer]
2612
1856
  );
2613
1857
  const m = chunkFSLI5IKP_cjs.useMessages();
2614
- const requireCoding = clinicalRequiresCoding(field);
2615
1858
  const state = useClinicalFormState(form);
2616
- const codeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
2617
1859
  const readOnly = !(isPreview && isEnabled) || Boolean(isReadOnly) || state.readOnly || state.disposed || !value;
2618
1860
  const currentValue = React11__namespace.useRef(value);
2619
1861
  const currentResponse = React11__namespace.useRef(response);
@@ -2639,71 +1881,58 @@ function EncounterPlanField({
2639
1881
  )
2640
1882
  );
2641
1883
  };
2642
- const renderSearch = React11__namespace.useMemo(
2643
- () => codeLookup || !requireCoding ? codedOrderSearch(codeLookup, requireCoding, m) : void 0,
2644
- [codeLookup, requireCoding, m]
2645
- );
2646
1884
  if (!value)
2647
1885
  return /* @__PURE__ */ jsxRuntime.jsx(InvalidClinicalAnswer, { label, answer: response?.answer });
2648
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": label, className: "min-w-0 space-y-2", children: [
2649
- /* @__PURE__ */ jsxRuntime.jsx(
2650
- chunkX6HEWIYP_cjs.Assessment,
2651
- {
2652
- concerns,
2653
- items,
2654
- orders: value.orders,
2655
- title: null,
2656
- className: clinicalAssessmentClasses,
2657
- readOnly,
2658
- rowActions: codeLookup || !requireCoding ? ["add-order"] : [],
2659
- addModes: ["order"],
2660
- addFormLabel: "Add plan order",
2661
- defaultAddMode: "order",
2662
- renderOrderSearch: renderSearch,
2663
- onAddOrder: codeLookup || !requireCoding ? (item, order) => {
2664
- if (requireCoding && !order.code) return;
2665
- commit((next) => ({
2666
- ...next,
2667
- orders: [
2668
- ...next.orders,
2669
- {
2670
- ...order,
2671
- orderId: globalThis.crypto.randomUUID(),
2672
- concernId: item?.concernId
2673
- }
2674
- ]
2675
- }));
2676
- } : void 0,
2677
- onEditOrder: (order, changes) => commit((next) => ({
2678
- ...next,
2679
- orders: next.orders.map(
2680
- (candidate) => candidate.orderId === order.orderId ? { ...candidate, ...changes } : candidate
2681
- )
2682
- })),
2683
- onRemoveOrder: (order) => commit((next) => ({
2684
- ...next,
2685
- orders: next.orders.filter(
2686
- (candidate) => candidate.orderId !== order.orderId
2687
- )
2688
- })),
2689
- onLinkOrder: (order, concernId) => commit((next) => ({
2690
- ...next,
2691
- orders: next.orders.map(
2692
- (candidate) => candidate.orderId === order.orderId ? { ...candidate, concernId } : candidate
2693
- )
2694
- })),
2695
- onReorderOrders: (ids) => commit((next) => ({
2696
- ...next,
2697
- orders: reorderClinicalEntries(
2698
- next.orders,
2699
- ids,
2700
- ({ orderId }) => orderId
2701
- )
2702
- }))
2703
- }
2704
- ),
2705
- !readOnly && requireCoding && !codeLookup && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: m("Coded order search is unavailable.") })
2706
- ] });
1886
+ return /* @__PURE__ */ jsxRuntime.jsx("section", { "aria-label": label, className: "min-w-0 space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(
1887
+ chunk6O6EYKOG_cjs.Assessment,
1888
+ {
1889
+ concerns,
1890
+ items,
1891
+ orders: value.orders,
1892
+ title: label,
1893
+ readOnly,
1894
+ rowActions: ["add-order"],
1895
+ addModes: ["order"],
1896
+ addFormLabel: "Add plan order",
1897
+ onAddOrder: (item, order) => commit((next) => ({
1898
+ ...next,
1899
+ orders: [
1900
+ ...next.orders,
1901
+ {
1902
+ ...order,
1903
+ orderId: globalThis.crypto.randomUUID(),
1904
+ concernId: item?.concernId
1905
+ }
1906
+ ]
1907
+ })),
1908
+ onEditOrder: (order, changes) => commit((next) => ({
1909
+ ...next,
1910
+ orders: next.orders.map(
1911
+ (candidate) => candidate.orderId === order.orderId ? { ...candidate, ...changes } : candidate
1912
+ )
1913
+ })),
1914
+ onRemoveOrder: (order) => commit((next) => ({
1915
+ ...next,
1916
+ orders: next.orders.filter(
1917
+ (candidate) => candidate.orderId !== order.orderId
1918
+ )
1919
+ })),
1920
+ onLinkOrder: (order, concernId) => commit((next) => ({
1921
+ ...next,
1922
+ orders: next.orders.map(
1923
+ (candidate) => candidate.orderId === order.orderId ? { ...candidate, concernId } : candidate
1924
+ )
1925
+ })),
1926
+ onReorderOrders: (ids) => commit((next) => ({
1927
+ ...next,
1928
+ orders: reorderClinicalEntries(
1929
+ next.orders,
1930
+ ids,
1931
+ ({ orderId }) => orderId
1932
+ )
1933
+ }))
1934
+ }
1935
+ ) });
2707
1936
  }
2708
1937
 
2709
1938
  // src/components/EncounterVisit/fields.ts
@@ -2850,7 +2079,7 @@ function createEncounterVisitTools(options) {
2850
2079
  }
2851
2080
  function definition() {
2852
2081
  const current = options.getDefinition();
2853
- chunkM42FTWY2_cjs.validateEncounterDefinition(current);
2082
+ chunk46RYJYN2_cjs.validateEncounterDefinition(current);
2854
2083
  return current;
2855
2084
  }
2856
2085
  function section(sectionId) {
@@ -2870,7 +2099,7 @@ function createEncounterVisitTools(options) {
2870
2099
  throw new ToolError("READ_ONLY", "This visit is read-only.");
2871
2100
  }
2872
2101
  function snapshot() {
2873
- return chunkM42FTWY2_cjs.createEncounterSnapshot(definition(), options.getResponses());
2102
+ return chunk46RYJYN2_cjs.createEncounterSnapshot(definition(), options.getResponses());
2874
2103
  }
2875
2104
  function write(sectionId, fieldId, response, targetReadingId) {
2876
2105
  const currentDefinition = definition();
@@ -2880,7 +2109,7 @@ function createEncounterVisitTools(options) {
2880
2109
  ({ id }) => id === sectionId
2881
2110
  );
2882
2111
  const isChoice = target?.observations?.some(
2883
- (observation) => chunkM42FTWY2_cjs.getEncounterFieldId(sectionId, observation.id) === fieldId && observation.type === "choice"
2112
+ (observation) => chunk46RYJYN2_cjs.getEncounterFieldId(sectionId, observation.id) === fieldId && observation.type === "choice"
2884
2113
  );
2885
2114
  if (!isChoice) delete replacement.selected;
2886
2115
  const next = { ...previous, [fieldId]: replacement };
@@ -2892,19 +2121,19 @@ function createEncounterVisitTools(options) {
2892
2121
  issue.message
2893
2122
  ]);
2894
2123
  const previousIssueKeys = new Set(
2895
- chunkM42FTWY2_cjs.validateEncounterResponses(currentDefinition, previous).map(issueKey)
2124
+ chunk46RYJYN2_cjs.validateEncounterResponses(currentDefinition, previous).map(issueKey)
2896
2125
  );
2897
- const issues = chunkM42FTWY2_cjs.validateEncounterResponses(currentDefinition, next).filter(
2126
+ const issues = chunk46RYJYN2_cjs.validateEncounterResponses(currentDefinition, next).filter(
2898
2127
  (issue) => issue.sectionId === sectionId && issue.fieldId === fieldId && issue.code !== "required" && (!targetReadingId || !issue.readingId || issue.readingId === targetReadingId) || issue.fieldId !== fieldId && issue.code !== "required" && !previousIssueKeys.has(issueKey(issue))
2899
2128
  );
2900
2129
  if (issues.length)
2901
2130
  throw new ToolError("INVALID_RESPONSE", issues[0].message, issues);
2902
2131
  options.setResponses(next);
2903
- return chunkM42FTWY2_cjs.createEncounterSnapshot(currentDefinition, next);
2132
+ return chunk46RYJYN2_cjs.createEncounterSnapshot(currentDefinition, next);
2904
2133
  }
2905
2134
  function structured(sectionId, value, targetReadingId) {
2906
2135
  assertJsonValue(value);
2907
- const fieldId = chunkM42FTWY2_cjs.getEncounterFieldId(sectionId, "value");
2136
+ const fieldId = chunk46RYJYN2_cjs.getEncounterFieldId(sectionId, "value");
2908
2137
  return write(
2909
2138
  sectionId,
2910
2139
  fieldId,
@@ -2916,7 +2145,7 @@ function createEncounterVisitTools(options) {
2916
2145
  );
2917
2146
  }
2918
2147
  function vitalValue(sectionId) {
2919
- const fieldId = chunkM42FTWY2_cjs.getEncounterFieldId(sectionId, "value");
2148
+ const fieldId = chunk46RYJYN2_cjs.getEncounterFieldId(sectionId, "value");
2920
2149
  const answer = options.getResponses()[fieldId]?.answer;
2921
2150
  if (!answer?.trim()) return { readings: [] };
2922
2151
  let value;
@@ -2965,7 +2194,7 @@ function createEncounterVisitTools(options) {
2965
2194
  }
2966
2195
  if (typeof text !== "string")
2967
2196
  throw new ToolError("INVALID_ARGUMENT", "text must be a string.");
2968
- const fieldId = chunkM42FTWY2_cjs.getEncounterFieldId(sectionId);
2197
+ const fieldId = chunk46RYJYN2_cjs.getEncounterFieldId(sectionId);
2969
2198
  return write(sectionId, fieldId, {
2970
2199
  ...options.getResponses()[fieldId],
2971
2200
  answer: text
@@ -2975,7 +2204,7 @@ function createEncounterVisitTools(options) {
2975
2204
  writable();
2976
2205
  const current = section(sectionId);
2977
2206
  requireId(findingId, "findingId");
2978
- let fieldId = chunkM42FTWY2_cjs.getEncounterFieldId(sectionId);
2207
+ let fieldId = chunk46RYJYN2_cjs.getEncounterFieldId(sectionId);
2979
2208
  let findings = current.findings;
2980
2209
  if (observationId !== void 0) {
2981
2210
  requireId(observationId, "observationId");
@@ -2987,7 +2216,7 @@ function createEncounterVisitTools(options) {
2987
2216
  "UNKNOWN_OBSERVATION",
2988
2217
  "Common findings require a configured text observation."
2989
2218
  );
2990
- fieldId = chunkM42FTWY2_cjs.getEncounterFieldId(sectionId, observationId);
2219
+ fieldId = chunk46RYJYN2_cjs.getEncounterFieldId(sectionId, observationId);
2991
2220
  findings = observation.findings;
2992
2221
  } else if (current.kind !== "narrative" && !current.narrative) {
2993
2222
  throw new ToolError(
@@ -3027,7 +2256,7 @@ function createEncounterVisitTools(options) {
3027
2256
  "UNKNOWN_OBSERVATION",
3028
2257
  `Unknown observation: ${observationId}.`
3029
2258
  );
3030
- const fieldId = chunkM42FTWY2_cjs.getEncounterFieldId(sectionId, observationId);
2259
+ const fieldId = chunk46RYJYN2_cjs.getEncounterFieldId(sectionId, observationId);
3031
2260
  const response = { ...options.getResponses()[fieldId] };
3032
2261
  delete response.answer;
3033
2262
  delete response.selected;
@@ -3069,9 +2298,9 @@ function createEncounterVisitTools(options) {
3069
2298
  throw new ToolError("INVALID_ARGUMENT", "reading must be an object.");
3070
2299
  requireId(reading.id, "reading.id");
3071
2300
  assertJsonValue(reading);
3072
- const issues = chunkM42FTWY2_cjs.validateEncounterVitals(
2301
+ const issues = chunk46RYJYN2_cjs.validateEncounterVitals(
3073
2302
  { readings: [reading] },
3074
- chunkM42FTWY2_cjs.getEncounterFieldId(sectionId, "value"),
2303
+ chunk46RYJYN2_cjs.getEncounterFieldId(sectionId, "value"),
3075
2304
  sectionId
3076
2305
  );
3077
2306
  if (issues.length)
@@ -3142,7 +2371,7 @@ function createEncounterVisitTools(options) {
3142
2371
  return structured(sectionId, parsed);
3143
2372
  }),
3144
2373
  validateVisit: () => run(() => {
3145
- const issues = chunkM42FTWY2_cjs.validateEncounterResponses(
2374
+ const issues = chunk46RYJYN2_cjs.validateEncounterResponses(
3146
2375
  definition(),
3147
2376
  options.getResponses()
3148
2377
  );
@@ -3155,11 +2384,11 @@ function createEncounterVisitTools(options) {
3155
2384
  if (typeof body !== "string")
3156
2385
  throw new ToolError("INVALID_ARGUMENT", "body must be a string.");
3157
2386
  const currentDefinition = definition();
3158
- const next = chunkM42FTWY2_cjs.updateEncounterDocumentBody(options.getResponses(), body, {
2387
+ const next = chunk46RYJYN2_cjs.updateEncounterDocumentBody(options.getResponses(), body, {
3159
2388
  _ai: true
3160
2389
  });
3161
2390
  options.setResponses(next);
3162
- return chunkM42FTWY2_cjs.createEncounterSnapshot(currentDefinition, next);
2391
+ return chunk46RYJYN2_cjs.createEncounterSnapshot(currentDefinition, next);
3163
2392
  }),
3164
2393
  navigateToSection: (sectionId) => run(() => {
3165
2394
  section(sectionId);
@@ -3480,12 +2709,12 @@ function ensureFields() {
3480
2709
  }
3481
2710
  var esheetDefaultsSettled = false;
3482
2711
  var EncounterVisit = React11__namespace.forwardRef(function EncounterVisit2({ definition, initialMdy, codeLookup, messages, ...props }, ref) {
3483
- const inheritedCodeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
2712
+ const inheritedCodeLookup = chunk6O6EYKOG_cjs.useCodeLookupConfig();
3484
2713
  const parsed = React11__namespace.useMemo(
3485
- () => initialMdy === void 0 ? null : chunkM42FTWY2_cjs.parseEncounterMdy(initialMdy),
2714
+ () => initialMdy === void 0 ? null : chunk46RYJYN2_cjs.parseEncounterMdy(initialMdy),
3486
2715
  [initialMdy]
3487
2716
  );
3488
- const visitDefinition = definition ?? parsed?.definition ?? chunkM42FTWY2_cjs.DEFAULT_ENCOUNTER_VISIT_DEFINITION;
2717
+ const visitDefinition = definition ?? parsed?.definition ?? chunk46RYJYN2_cjs.DEFAULT_ENCOUNTER_VISIT_DEFINITION;
3489
2718
  const loadErrors = parsed?.diagnostics.filter(
3490
2719
  (diagnostic) => diagnostic.severity === "error" && diagnostic.code !== "dangling-link"
3491
2720
  ) ?? [];
@@ -3531,7 +2760,7 @@ var EncounterVisit = React11__namespace.forwardRef(function EncounterVisit2({ de
3531
2760
  form.pages.forEach((page) => visitFields(page.fields));
3532
2761
  return JSON.stringify(shapes.sort((a, b) => a.id.localeCompare(b.id)));
3533
2762
  };
3534
- if (fieldShapes(parsed.form) !== fieldShapes(chunkM42FTWY2_cjs.createEncounterFormDefinition(visitDefinition))) {
2763
+ if (fieldShapes(parsed.form) !== fieldShapes(chunk46RYJYN2_cjs.createEncounterFormDefinition(visitDefinition))) {
3535
2764
  throw new Error(
3536
2765
  "The MDY fields do not match the supplied encounter definition."
3537
2766
  );
@@ -3547,7 +2776,7 @@ var EncounterVisit = React11__namespace.forwardRef(function EncounterVisit2({ de
3547
2776
  },
3548
2777
  visitDefinition.id
3549
2778
  );
3550
- return /* @__PURE__ */ jsxRuntime.jsx(chunkX6HEWIYP_cjs.CodeLookupContext.Provider, { value: codeLookup ?? inheritedCodeLookup, children: /* @__PURE__ */ jsxRuntime.jsx(chunkFSLI5IKP_cjs.MessagesProvider, { messages, children: session }) });
2779
+ return /* @__PURE__ */ jsxRuntime.jsx(chunk6O6EYKOG_cjs.CodeLookupContext.Provider, { value: codeLookup ?? inheritedCodeLookup, children: /* @__PURE__ */ jsxRuntime.jsx(chunkFSLI5IKP_cjs.MessagesProvider, { messages, children: session }) });
3551
2780
  });
3552
2781
  var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisitSession2({
3553
2782
  definition,
@@ -3580,22 +2809,22 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3580
2809
  [definitionJson]
3581
2810
  );
3582
2811
  const form = React11__namespace.useMemo(
3583
- () => chunkM42FTWY2_cjs.createEncounterFormDefinition(stableDefinition),
2812
+ () => chunk46RYJYN2_cjs.createEncounterFormDefinition(stableDefinition),
3584
2813
  [stableDefinition]
3585
2814
  );
3586
2815
  const [initialSeed] = React11__namespace.useState(() => {
3587
2816
  if (initialMdy === void 0) return initialResponses ?? {};
3588
- const document2 = chunkM42FTWY2_cjs.parseEncounterMdy(initialMdy);
2817
+ const document2 = chunk46RYJYN2_cjs.parseEncounterMdy(initialMdy);
3589
2818
  return {
3590
2819
  ...document2.response ?? {},
3591
- [chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID]: chunkM42FTWY2_cjs.encounterDocumentResponse(initialMdy)
2820
+ [chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID]: chunk46RYJYN2_cjs.encounterDocumentResponse(initialMdy)
3592
2821
  };
3593
2822
  });
3594
2823
  const [snapshot, setSnapshot] = React11__namespace.useState(
3595
- () => chunkM42FTWY2_cjs.createEncounterSnapshot(stableDefinition, initialSeed)
2824
+ () => chunk46RYJYN2_cjs.createEncounterSnapshot(stableDefinition, initialSeed)
3596
2825
  );
3597
2826
  const [richBodySeed] = React11__namespace.useState(
3598
- () => chunkM42FTWY2_cjs.parseEncounterMdy(snapshot.mdy).body
2827
+ () => chunk46RYJYN2_cjs.parseEncounterMdy(snapshot.mdy).body
3599
2828
  );
3600
2829
  const [activeSection, setActiveSection] = React11__namespace.useState(
3601
2830
  stableDefinition.sections[0].id
@@ -3643,18 +2872,18 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3643
2872
  const store = renderer$1.current?.getFormStore();
3644
2873
  if (!store) return;
3645
2874
  const current = store.getState().responses;
3646
- if (current[chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID]?.answer === body) return;
3647
- const next = chunkM42FTWY2_cjs.updateEncounterDocumentBody(current, body, { _ai: false });
2875
+ if (current[chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID]?.answer === body) return;
2876
+ const next = chunk46RYJYN2_cjs.updateEncounterDocumentBody(current, body, { _ai: false });
3648
2877
  store.getState().setResponse(
3649
- chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID,
3650
- next[chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID]
2878
+ chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID,
2879
+ next[chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID]
3651
2880
  );
3652
2881
  }, []);
3653
2882
  const flushEditor = React11__namespace.useCallback(async () => {
3654
2883
  if (richEditor.current && latest.current.mode === "rich" && !latest.current.readOnly && !latest.current.saving) {
3655
- const before = renderer$1.current?.getRawResponse()[chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID];
2884
+ const before = renderer$1.current?.getRawResponse()[chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID];
3656
2885
  const body = await richEditor.current.getContent();
3657
- const after = renderer$1.current?.getRawResponse()[chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID];
2886
+ const after = renderer$1.current?.getRawResponse()[chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID];
3658
2887
  if (after !== before && after?.answer !== before?.answer) return;
3659
2888
  writeBody(body);
3660
2889
  }
@@ -3696,7 +2925,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3696
2925
  );
3697
2926
  React11__namespace.useLayoutEffect(() => {
3698
2927
  if (mode !== "esheet" || pendingSection === null) return;
3699
- const fieldId = chunkM42FTWY2_cjs.getEncounterSectionFieldId(pendingSection);
2928
+ const fieldId = chunk46RYJYN2_cjs.getEncounterSectionFieldId(pendingSection);
3700
2929
  const section = Array.from(
3701
2930
  root.current?.querySelectorAll("[data-field-id]") ?? []
3702
2931
  ).find((element) => element.dataset.fieldId === fieldId);
@@ -3738,7 +2967,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3738
2967
  React11__namespace.useImperativeHandle(
3739
2968
  ref,
3740
2969
  () => ({
3741
- getSnapshot: () => chunkM42FTWY2_cjs.createEncounterSnapshot(
2970
+ getSnapshot: () => chunk46RYJYN2_cjs.createEncounterSnapshot(
3742
2971
  latest.current.definition,
3743
2972
  renderer$1.current?.getRawResponse() ?? responses.current
3744
2973
  ),
@@ -3831,7 +3060,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3831
3060
  previousFocus.focus();
3832
3061
  };
3833
3062
  }, [resolverField]);
3834
- const mdyFields = chunkM42FTWY2_cjs.getEncounterMdyFields(snapshot);
3063
+ const mdyFields = chunk46RYJYN2_cjs.getEncounterMdyFields(snapshot);
3835
3064
  const resolvedField = mdyFields.find((field) => field.id === resolverField);
3836
3065
  const resolvedNativeFieldId = resolvedField?.fieldId;
3837
3066
  const resolvedSectionId = resolvedField?.sectionId;
@@ -3841,7 +3070,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3841
3070
  );
3842
3071
  sections?.forEach((element) => {
3843
3072
  const wrapper2 = element.closest("[data-field-id]");
3844
- const focused = resolvedSectionId && wrapper2?.dataset.fieldId === chunkM42FTWY2_cjs.getEncounterSectionFieldId(resolvedSectionId);
3073
+ const focused = resolvedSectionId && wrapper2?.dataset.fieldId === chunk46RYJYN2_cjs.getEncounterSectionFieldId(resolvedSectionId);
3845
3074
  element.toggleAttribute("data-encounter-focus", Boolean(focused));
3846
3075
  wrapper2?.toggleAttribute("data-encounter-focus", Boolean(focused));
3847
3076
  });
@@ -3857,7 +3086,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3857
3086
  unsubscribe.current?.();
3858
3087
  const publish = () => {
3859
3088
  responses.current = store.getState().responses;
3860
- const next = chunkM42FTWY2_cjs.createEncounterSnapshot(
3089
+ const next = chunk46RYJYN2_cjs.createEncounterSnapshot(
3861
3090
  latest.current.definition,
3862
3091
  responses.current
3863
3092
  );
@@ -3901,7 +3130,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3901
3130
  }
3902
3131
  if (!latest.current.onSubmit || latest.current.readOnly || latest.current.saving)
3903
3132
  return;
3904
- const next = chunkM42FTWY2_cjs.createEncounterSnapshot(
3133
+ const next = chunk46RYJYN2_cjs.createEncounterSnapshot(
3905
3134
  latest.current.definition,
3906
3135
  renderer$1.current?.getRawResponse() ?? responses.current
3907
3136
  );
@@ -3935,7 +3164,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
3935
3164
  }
3936
3165
  };
3937
3166
  const documentedSections = snapshot.definition.sections.filter(
3938
- (section) => chunkM42FTWY2_cjs.getEncounterSectionFieldIds(section).some(
3167
+ (section) => chunk46RYJYN2_cjs.getEncounterSectionFieldIds(section).some(
3939
3168
  (fieldId) => snapshot.observations.some(
3940
3169
  (observation) => observation.fieldId === fieldId
3941
3170
  )
@@ -4031,7 +3260,7 @@ var EncounterVisitSession = React11__namespace.forwardRef(function EncounterVisi
4031
3260
  EncounterMdyEditor,
4032
3261
  {
4033
3262
  ref: richEditor,
4034
- body: chunkM42FTWY2_cjs.getEncounterDocumentBody(snapshot.responses) ?? richBodySeed,
3263
+ body: chunk46RYJYN2_cjs.getEncounterDocumentBody(snapshot.responses) ?? richBodySeed,
4035
3264
  fieldIds: mdyFields.map((field) => field.id),
4036
3265
  fields: mdyFields.map((field) => ({
4037
3266
  id: field.id,
@@ -4645,7 +3874,7 @@ function MedicationListField({
4645
3874
  return definition.medications ?? [];
4646
3875
  }, [response?.answer, definition.medications]);
4647
3876
  return /* @__PURE__ */ jsxRuntime.jsx(
4648
- chunkX6HEWIYP_cjs.MedicationReconciliation,
3877
+ chunk6O6EYKOG_cjs.MedicationReconciliation,
4649
3878
  {
4650
3879
  medications,
4651
3880
  onChange: (next) => onResponse({ answer: JSON.stringify({ medications: next }) }),
@@ -4703,7 +3932,7 @@ function AllergyListField({
4703
3932
  codeLookup
4704
3933
  }) {
4705
3934
  const definition = field.definition;
4706
- const ambientCodeLookup = chunkX6HEWIYP_cjs.useCodeLookupConfig();
3935
+ const ambientCodeLookup = chunk6O6EYKOG_cjs.useCodeLookupConfig();
4707
3936
  const effectiveCodeLookup = codeLookup === false ? void 0 : codeLookup ?? ambientCodeLookup ?? void 0;
4708
3937
  const value = React11__namespace.useMemo(() => {
4709
3938
  if (response?.answer) return parseValue2(response.answer);
@@ -4713,7 +3942,7 @@ function AllergyListField({
4713
3942
  onResponse({ answer: JSON.stringify(next) });
4714
3943
  };
4715
3944
  return /* @__PURE__ */ jsxRuntime.jsx(
4716
- chunkX6HEWIYP_cjs.AllergyManager,
3945
+ chunk6O6EYKOG_cjs.AllergyManager,
4717
3946
  {
4718
3947
  allergies: value.allergies,
4719
3948
  onChange: (allergies) => commit({
@@ -4755,123 +3984,123 @@ function registerMieEsheetFields(options) {
4755
3984
 
4756
3985
  Object.defineProperty(exports, "DEFAULT_ENCOUNTER_VISIT_DEFINITION", {
4757
3986
  enumerable: true,
4758
- get: function () { return chunkM42FTWY2_cjs.DEFAULT_ENCOUNTER_VISIT_DEFINITION; }
3987
+ get: function () { return chunk46RYJYN2_cjs.DEFAULT_ENCOUNTER_VISIT_DEFINITION; }
4759
3988
  });
4760
3989
  Object.defineProperty(exports, "ENCOUNTER_DOCUMENT_FIELD_ID", {
4761
3990
  enumerable: true,
4762
- get: function () { return chunkM42FTWY2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID; }
3991
+ get: function () { return chunk46RYJYN2_cjs.ENCOUNTER_DOCUMENT_FIELD_ID; }
4763
3992
  });
4764
3993
  Object.defineProperty(exports, "EXAMPLE_ENCOUNTER_VISIT_RESPONSES", {
4765
3994
  enumerable: true,
4766
- get: function () { return chunkM42FTWY2_cjs.EXAMPLE_ENCOUNTER_VISIT_RESPONSES; }
3995
+ get: function () { return chunk46RYJYN2_cjs.EXAMPLE_ENCOUNTER_VISIT_RESPONSES; }
4767
3996
  });
4768
3997
  Object.defineProperty(exports, "createEncounterFormDefinition", {
4769
3998
  enumerable: true,
4770
- get: function () { return chunkM42FTWY2_cjs.createEncounterFormDefinition; }
3999
+ get: function () { return chunk46RYJYN2_cjs.createEncounterFormDefinition; }
4771
4000
  });
4772
4001
  Object.defineProperty(exports, "createEncounterMdy", {
4773
4002
  enumerable: true,
4774
- get: function () { return chunkM42FTWY2_cjs.createEncounterMdy; }
4003
+ get: function () { return chunk46RYJYN2_cjs.createEncounterMdy; }
4775
4004
  });
4776
4005
  Object.defineProperty(exports, "createEncounterSnapshot", {
4777
4006
  enumerable: true,
4778
- get: function () { return chunkM42FTWY2_cjs.createEncounterSnapshot; }
4007
+ get: function () { return chunk46RYJYN2_cjs.createEncounterSnapshot; }
4779
4008
  });
4780
4009
  Object.defineProperty(exports, "encounterDocumentResponse", {
4781
4010
  enumerable: true,
4782
- get: function () { return chunkM42FTWY2_cjs.encounterDocumentResponse; }
4011
+ get: function () { return chunk46RYJYN2_cjs.encounterDocumentResponse; }
4783
4012
  });
4784
4013
  Object.defineProperty(exports, "getEncounterConcerns", {
4785
4014
  enumerable: true,
4786
- get: function () { return chunkM42FTWY2_cjs.getEncounterConcerns; }
4015
+ get: function () { return chunk46RYJYN2_cjs.getEncounterConcerns; }
4787
4016
  });
4788
4017
  Object.defineProperty(exports, "getEncounterDocumentBody", {
4789
4018
  enumerable: true,
4790
- get: function () { return chunkM42FTWY2_cjs.getEncounterDocumentBody; }
4019
+ get: function () { return chunk46RYJYN2_cjs.getEncounterDocumentBody; }
4791
4020
  });
4792
4021
  Object.defineProperty(exports, "getEncounterFieldId", {
4793
4022
  enumerable: true,
4794
- get: function () { return chunkM42FTWY2_cjs.getEncounterFieldId; }
4023
+ get: function () { return chunk46RYJYN2_cjs.getEncounterFieldId; }
4795
4024
  });
4796
4025
  Object.defineProperty(exports, "getEncounterMdyFields", {
4797
4026
  enumerable: true,
4798
- get: function () { return chunkM42FTWY2_cjs.getEncounterMdyFields; }
4027
+ get: function () { return chunk46RYJYN2_cjs.getEncounterMdyFields; }
4799
4028
  });
4800
4029
  Object.defineProperty(exports, "getEncounterSectionFieldId", {
4801
4030
  enumerable: true,
4802
- get: function () { return chunkM42FTWY2_cjs.getEncounterSectionFieldId; }
4031
+ get: function () { return chunk46RYJYN2_cjs.getEncounterSectionFieldId; }
4803
4032
  });
4804
4033
  Object.defineProperty(exports, "getEncounterSectionFieldIds", {
4805
4034
  enumerable: true,
4806
- get: function () { return chunkM42FTWY2_cjs.getEncounterSectionFieldIds; }
4035
+ get: function () { return chunk46RYJYN2_cjs.getEncounterSectionFieldIds; }
4807
4036
  });
4808
4037
  Object.defineProperty(exports, "parseEncounterAssessment", {
4809
4038
  enumerable: true,
4810
- get: function () { return chunkM42FTWY2_cjs.parseEncounterAssessment; }
4039
+ get: function () { return chunk46RYJYN2_cjs.parseEncounterAssessment; }
4811
4040
  });
4812
4041
  Object.defineProperty(exports, "parseEncounterConditions", {
4813
4042
  enumerable: true,
4814
- get: function () { return chunkM42FTWY2_cjs.parseEncounterConditions; }
4043
+ get: function () { return chunk46RYJYN2_cjs.parseEncounterConditions; }
4815
4044
  });
4816
4045
  Object.defineProperty(exports, "parseEncounterMdy", {
4817
4046
  enumerable: true,
4818
- get: function () { return chunkM42FTWY2_cjs.parseEncounterMdy; }
4047
+ get: function () { return chunk46RYJYN2_cjs.parseEncounterMdy; }
4819
4048
  });
4820
4049
  Object.defineProperty(exports, "parseEncounterPlan", {
4821
4050
  enumerable: true,
4822
- get: function () { return chunkM42FTWY2_cjs.parseEncounterPlan; }
4051
+ get: function () { return chunk46RYJYN2_cjs.parseEncounterPlan; }
4823
4052
  });
4824
4053
  Object.defineProperty(exports, "parseEncounterVitals", {
4825
4054
  enumerable: true,
4826
- get: function () { return chunkM42FTWY2_cjs.parseEncounterVitals; }
4055
+ get: function () { return chunk46RYJYN2_cjs.parseEncounterVitals; }
4827
4056
  });
4828
4057
  Object.defineProperty(exports, "refreshEncounterMdyLinks", {
4829
4058
  enumerable: true,
4830
- get: function () { return chunkM42FTWY2_cjs.refreshEncounterMdyLinks; }
4059
+ get: function () { return chunk46RYJYN2_cjs.refreshEncounterMdyLinks; }
4831
4060
  });
4832
4061
  Object.defineProperty(exports, "renderEncounterMdy", {
4833
4062
  enumerable: true,
4834
- get: function () { return chunkM42FTWY2_cjs.renderEncounterMdy; }
4063
+ get: function () { return chunk46RYJYN2_cjs.renderEncounterMdy; }
4835
4064
  });
4836
4065
  Object.defineProperty(exports, "updateEncounterDocumentBody", {
4837
4066
  enumerable: true,
4838
- get: function () { return chunkM42FTWY2_cjs.updateEncounterDocumentBody; }
4067
+ get: function () { return chunk46RYJYN2_cjs.updateEncounterDocumentBody; }
4839
4068
  });
4840
4069
  Object.defineProperty(exports, "validAssessmentItem", {
4841
4070
  enumerable: true,
4842
- get: function () { return chunkM42FTWY2_cjs.validAssessmentItem; }
4071
+ get: function () { return chunk46RYJYN2_cjs.validAssessmentItem; }
4843
4072
  });
4844
4073
  Object.defineProperty(exports, "validateEncounterAllergyValue", {
4845
4074
  enumerable: true,
4846
- get: function () { return chunkM42FTWY2_cjs.validateEncounterAllergyValue; }
4075
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterAllergyValue; }
4847
4076
  });
4848
4077
  Object.defineProperty(exports, "validateEncounterAssessment", {
4849
4078
  enumerable: true,
4850
- get: function () { return chunkM42FTWY2_cjs.validateEncounterAssessment; }
4079
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterAssessment; }
4851
4080
  });
4852
4081
  Object.defineProperty(exports, "validateEncounterConditions", {
4853
4082
  enumerable: true,
4854
- get: function () { return chunkM42FTWY2_cjs.validateEncounterConditions; }
4083
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterConditions; }
4855
4084
  });
4856
4085
  Object.defineProperty(exports, "validateEncounterDefinition", {
4857
4086
  enumerable: true,
4858
- get: function () { return chunkM42FTWY2_cjs.validateEncounterDefinition; }
4087
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterDefinition; }
4859
4088
  });
4860
4089
  Object.defineProperty(exports, "validateEncounterMedicationValue", {
4861
4090
  enumerable: true,
4862
- get: function () { return chunkM42FTWY2_cjs.validateEncounterMedicationValue; }
4091
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterMedicationValue; }
4863
4092
  });
4864
4093
  Object.defineProperty(exports, "validateEncounterPlan", {
4865
4094
  enumerable: true,
4866
- get: function () { return chunkM42FTWY2_cjs.validateEncounterPlan; }
4095
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterPlan; }
4867
4096
  });
4868
4097
  Object.defineProperty(exports, "validateEncounterResponses", {
4869
4098
  enumerable: true,
4870
- get: function () { return chunkM42FTWY2_cjs.validateEncounterResponses; }
4099
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterResponses; }
4871
4100
  });
4872
4101
  Object.defineProperty(exports, "validateEncounterVitals", {
4873
4102
  enumerable: true,
4874
- get: function () { return chunkM42FTWY2_cjs.validateEncounterVitals; }
4103
+ get: function () { return chunk46RYJYN2_cjs.validateEncounterVitals; }
4875
4104
  });
4876
4105
  Object.defineProperty(exports, "EsheetRenderer", {
4877
4106
  enumerable: true,