@mindbill/react 0.77.30 → 0.77.32

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.
package/dist/index.js CHANGED
@@ -1077,7 +1077,7 @@ function organizationProfileOptions(profile) {
1077
1077
 
1078
1078
  // src/index.tsx
1079
1079
  import "@mindbill/embed";
1080
- import { createElement, useEffect as useEffect34, useRef as useRef28 } from "react";
1080
+ import { createElement, useEffect as useEffect35, useRef as useRef29 } from "react";
1081
1081
 
1082
1082
  // src/claim-form-summary.tsx
1083
1083
  import { jsx as jsx5 } from "react/jsx-runtime";
@@ -10031,7 +10031,7 @@ function BillSubmissionForm({
10031
10031
  import { useId as useId9, useMemo as useMemo13, useState as useState31 } from "react";
10032
10032
 
10033
10033
  // src/rfa-dashboard.tsx
10034
- import { useEffect as useEffect25, useId as useId8, useMemo as useMemo12, useRef as useRef21, useState as useState30 } from "react";
10034
+ import { useEffect as useEffect26, useId as useId8, useMemo as useMemo12, useRef as useRef22, useState as useState30 } from "react";
10035
10035
  import { getRfaLifecycleStatus as getRfaLifecycleStatus4, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS5, createRfaClient as createRfaClient4, createBillReferenceClient as createBillReferenceClient2, createOrganizationClient as createOrganizationClient4 } from "@mindbill/browser";
10036
10036
 
10037
10037
  // src/rfa-display.tsx
@@ -10049,16 +10049,80 @@ function RfaLink({ href, children, onSelect }) {
10049
10049
  }
10050
10050
 
10051
10051
  // src/rfa-task-board.tsx
10052
- import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef12, useState as useState16 } from "react";
10052
+ import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef13, useState as useState17 } from "react";
10053
10053
  import { createRfaClient, createRfaLifecycleClient } from "@mindbill/browser";
10054
10054
 
10055
10055
  // src/rfa-delivery-panel.tsx
10056
- import { useEffect as useEffect13, useRef as useRef10, useState as useState14 } from "react";
10056
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState15 } from "react";
10057
10057
 
10058
10058
  // src/rfa-authorization-destination.tsx
10059
- import { useEffect as useEffect12, useRef as useRef9, useState as useState13 } from "react";
10060
- import { normalizeRfaFax, rfaAuthorizationDestinations, rfaAuthorizationGuidance as rfaAuthorizationGuidance2 } from "@mindbill/browser";
10059
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState14 } from "react";
10060
+
10061
+ // src/rfa-identity-select.tsx
10062
+ import { useId as useId5, useRef as useRef9, useState as useState13 } from "react";
10061
10063
  import { Fragment as Fragment12, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
10064
+ function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, query, searchable, disabled = false, loading = false, error = "", value, options, onSearch, onSelect }) {
10065
+ const id = useId5();
10066
+ const trigger = useRef9(null);
10067
+ const [open, setOpen] = useState13(false);
10068
+ const [active, setActive] = useState13(0);
10069
+ const selected = options.find((option) => option.id === value);
10070
+ const choose = (option) => {
10071
+ onSelect(option.id);
10072
+ setOpen(false);
10073
+ trigger.current?.focus();
10074
+ };
10075
+ return /* @__PURE__ */ jsxs20("div", { className: "mbrfa-identity-select", onBlur: (event) => {
10076
+ if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);
10077
+ }, onKeyDown: (event) => {
10078
+ if (event.key === "Escape") {
10079
+ event.preventDefault();
10080
+ setOpen(false);
10081
+ trigger.current?.focus();
10082
+ }
10083
+ }, children: [
10084
+ /* @__PURE__ */ jsx22("style", { children: `.mbrfa-identity-select{position:relative;min-width:0}.mbrfa-identity-select>button{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left;gap:12px;min-height:44px}.mbrfa-identity-select small{display:block;opacity:.75;font-size:12px;margin-top:3px}.mbrfa-identity-select>button{height:44px}.mbrfa-identity-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mbrfa-identity-value small{display:inline;margin:0}.mbrfa-identity-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;padding:10px;background:var(--mbtd-surface,#fff);color:inherit;border:1px solid var(--mbtd-border,#d6d3cc);border-radius:8px;box-shadow:0 8px 24px #0002}.mbrfa-identity-menu input{width:100%;box-sizing:border-box}.mbrfa-identity-options{max-height:280px;overflow:auto;margin-top:6px}.mbrfa-identity-options button{display:block;width:100%;text-align:left;padding:10px 12px;border:0;border-radius:4px;min-height:44px}.mbrfa-identity-options button:hover,.mbrfa-identity-options button[data-active=true]{background:#1c595918}.mbrfa-identity-menu p{padding:8px;margin:0}` }),
10085
+ /* @__PURE__ */ jsxs20("button", { ref: trigger, type: "button", "aria-label": label5, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? `${id}-list` : void 0, disabled, onClick: () => {
10086
+ setOpen(!open);
10087
+ setActive(0);
10088
+ }, children: [
10089
+ /* @__PURE__ */ jsx22("span", { className: "mbrfa-identity-value", children: selected ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
10090
+ selected.label,
10091
+ selected.detail ? /* @__PURE__ */ jsxs20("small", { children: [
10092
+ " \xB7 ",
10093
+ selected.detail
10094
+ ] }) : null
10095
+ ] }) : placeholder }),
10096
+ /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", children: "\u2304" })
10097
+ ] }),
10098
+ open ? /* @__PURE__ */ jsxs20("div", { className: "mbrfa-identity-menu", children: [
10099
+ searchable ? /* @__PURE__ */ jsx22("input", { autoFocus: true, role: "combobox", "aria-label": searchPlaceholder, "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": `${id}-list`, "aria-activedescendant": !loading && !error && options[active] ? `${id}-${active}` : void 0, type: "search", autoComplete: "off", maxLength: 200, placeholder: searchPlaceholder, value: query, onChange: (event) => {
10100
+ setActive(0);
10101
+ onSearch(event.target.value);
10102
+ }, onKeyDown: (event) => {
10103
+ if (loading || error || !options.length) return;
10104
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
10105
+ event.preventDefault();
10106
+ const next = (active + (event.key === "ArrowDown" ? 1 : -1) + options.length) % options.length;
10107
+ setActive(next);
10108
+ document.getElementById(`${id}-${next}`)?.scrollIntoView({ block: "nearest" });
10109
+ }
10110
+ if (event.key === "Enter" && options[active]) {
10111
+ event.preventDefault();
10112
+ choose(options[active]);
10113
+ }
10114
+ } }) : null,
10115
+ /* @__PURE__ */ jsx22("div", { className: "mbrfa-identity-options", id: `${id}-list`, role: "listbox", "aria-label": label5, "aria-busy": loading, children: loading ? /* @__PURE__ */ jsx22("p", { role: "status", children: "Searching\u2026" }) : error ? /* @__PURE__ */ jsx22("p", { role: "alert", children: error }) : options.length ? options.map((option, index) => /* @__PURE__ */ jsxs20("button", { type: "button", role: "option", id: `${id}-${index}`, "aria-selected": option.id === value, "data-active": index === active, onMouseDown: (event) => event.preventDefault(), onClick: () => choose(option), children: [
10116
+ option.label,
10117
+ option.detail ? /* @__PURE__ */ jsx22("small", { children: option.detail }) : null
10118
+ ] }, option.id)) : /* @__PURE__ */ jsx22("p", { children: "No matches. Try another search." }) })
10119
+ ] }) : null
10120
+ ] });
10121
+ }
10122
+
10123
+ // src/rfa-authorization-destination.tsx
10124
+ import { normalizeRfaFax, rfaAuthorizationDestinations, rfaAuthorizationGuidance as rfaAuthorizationGuidance2 } from "@mindbill/browser";
10125
+ import { Fragment as Fragment13, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10062
10126
  function RfaAuthorizationDestination({ contextKey, directory, savedContact, loading = false, error, disabled = false, onChange, onSelectionStart, compact = false }) {
10063
10127
  const options = loading || error ? [] : rfaAuthorizationDestinations(directory);
10064
10128
  const fax = savedContact?.fax ? normalizeRfaFax(savedContact.fax) : null;
@@ -10066,11 +10130,12 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10066
10130
  if (fax && !options.some((option) => option.method === "fax" && option.destination === fax)) options.unshift({ method: "fax", destination: fax, label: savedLabel, ...savedContact?.contactName ? { recipientName: savedContact.contactName } : {} });
10067
10131
  if (savedContact?.email?.trim() && !options.some((option) => option.method === "email" && option.destination === savedContact.email?.trim())) options.unshift({ method: "email", destination: savedContact.email.trim(), label: savedLabel, ...savedContact?.contactName ? { recipientName: savedContact.contactName } : {} });
10068
10132
  const signature = JSON.stringify([contextKey, directory?.authorizationStatus, options, loading, error]);
10069
- const [selection, setSelection] = useState13("");
10070
- const [manual, setManual] = useState13("");
10071
- const [contactName, setContactName] = useState13("");
10133
+ const [selection, setSelection] = useState14("");
10134
+ const [manual, setManual] = useState14("");
10135
+ const [query, setQuery] = useState14("");
10136
+ const [contactName, setContactName] = useState14("");
10072
10137
  const needsAdjuster = directory?.authorizationStatus === "adjuster_specific_required";
10073
- const callback = useRef9(onChange);
10138
+ const callback = useRef10(onChange);
10074
10139
  callback.current = onChange;
10075
10140
  useEffect12(() => {
10076
10141
  setSelection("");
@@ -10092,104 +10157,121 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10092
10157
  })() : nextSelection === "manual-email" ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim()) ? { method: "email", destination: value.trim(), label: "Confirmed authorization email" } : null : nextSelection === "" ? null : options[Number(nextSelection)] ?? null;
10093
10158
  onChange(selected ? { ...selected, ...recipientName ? { recipientName } : {} } : null);
10094
10159
  };
10095
- const guidance = /* @__PURE__ */ jsxs20(Fragment12, { children: [
10096
- /* @__PURE__ */ jsx22("p", { style: { margin: 0 }, children: loading ? "Loading authorization contacts\u2026" : error ? "Directory details are unavailable. Confirm a destination with the handling adjuster." : rfaAuthorizationGuidance2(directory) }),
10097
- directory?.authorizationNotice ? /* @__PURE__ */ jsx22("p", { style: { margin: 0 }, children: directory.authorizationNotice }) : null
10160
+ const pick = (value) => {
10161
+ setSelection(value);
10162
+ setManual("");
10163
+ const name = options[Number(value)]?.recipientName ?? "";
10164
+ setContactName(name);
10165
+ emit(value, "", name);
10166
+ };
10167
+ const guidance = /* @__PURE__ */ jsxs21(Fragment13, { children: [
10168
+ /* @__PURE__ */ jsx23("p", { style: { margin: 0 }, children: loading ? "Loading authorization contacts\u2026" : error ? "Directory details are unavailable. Confirm a destination with the handling adjuster." : rfaAuthorizationGuidance2(directory) }),
10169
+ directory?.authorizationNotice ? /* @__PURE__ */ jsx23("p", { style: { margin: 0 }, children: directory.authorizationNotice }) : null
10098
10170
  ] });
10099
- return /* @__PURE__ */ jsxs20("fieldset", { className: compact ? "mb-rfa-destination mbrfa-plain" : "mb-rfa-destination", disabled: disabled || loading, style: compact ? { display: "grid", gap: 8, minWidth: 0, overflowWrap: "anywhere" } : { border: "1px solid var(--mb-border, #d7e0df)", borderRadius: 10, padding: 16, display: "grid", gap: 12, minWidth: 0, overflowWrap: "anywhere" }, children: [
10100
- compact ? null : /* @__PURE__ */ jsxs20(Fragment12, { children: [
10101
- /* @__PURE__ */ jsx22("legend", { children: "Authorization destination" }),
10171
+ return /* @__PURE__ */ jsxs21("fieldset", { className: compact ? "mb-rfa-destination mbrfa-plain" : "mb-rfa-destination", disabled: disabled || loading, style: compact ? { display: "grid", gap: 8, minWidth: 0, overflowWrap: "anywhere" } : { border: "1px solid var(--mb-border, #d7e0df)", borderRadius: 10, padding: 16, display: "grid", gap: 12, minWidth: 0, overflowWrap: "anywhere" }, children: [
10172
+ compact ? null : /* @__PURE__ */ jsxs21(Fragment13, { children: [
10173
+ /* @__PURE__ */ jsx23("legend", { children: "Authorization destination" }),
10102
10174
  guidance
10103
10175
  ] }),
10104
- /* @__PURE__ */ jsxs20("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10105
- compact ? /* @__PURE__ */ jsx22("span", { className: "mbrfa-visually-hidden", children: "Authorization contact" }) : directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10106
- /* @__PURE__ */ jsxs20("select", { value: selection, onChange: (event) => {
10107
- const value = event.target.value;
10108
- setSelection(value);
10109
- setManual("");
10110
- const name = options[Number(value)]?.recipientName ?? "";
10111
- setContactName(name);
10112
- emit(value, "", name);
10113
- }, style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10114
- /* @__PURE__ */ jsx22("option", { value: "", children: "Choose a destination\u2026" }),
10115
- options.map((option, index) => /* @__PURE__ */ jsxs20("option", { value: String(index), children: [
10176
+ compact ? /* @__PURE__ */ jsx23(
10177
+ RfaIdentitySelect,
10178
+ {
10179
+ label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10180
+ placeholder: "Choose a destination",
10181
+ searchPlaceholder: "Search offices, fax numbers or e-mail",
10182
+ query,
10183
+ onSearch: setQuery,
10184
+ searchable: true,
10185
+ disabled: disabled || loading,
10186
+ value: selection,
10187
+ options: [...options.map((option, index) => ({ id: String(index), label: option.label, detail: `${option.method === "fax" ? "Fax" : "E-mail"} ${option.destination}` })), { id: "manual", label: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }, { id: "manual-email", label: "Enter a confirmed authorization e-mail" }].filter((option) => option.id === selection || `${option.label} ${"detail" in option ? option.detail : ""}`.toLowerCase().includes(query.trim().toLowerCase())),
10188
+ onSelect: (value) => {
10189
+ setQuery("");
10190
+ pick(value);
10191
+ }
10192
+ }
10193
+ ) : /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10194
+ directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10195
+ /* @__PURE__ */ jsxs21("select", { value: selection, onChange: (event) => pick(event.target.value), style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10196
+ /* @__PURE__ */ jsx23("option", { value: "", children: "Choose a destination\u2026" }),
10197
+ options.map((option, index) => /* @__PURE__ */ jsxs21("option", { value: String(index), children: [
10116
10198
  option.label,
10117
10199
  " \xB7 ",
10118
10200
  option.method === "fax" ? "Fax" : "Email",
10119
10201
  ": ",
10120
10202
  option.destination
10121
10203
  ] }, `${option.method}:${option.destination}:${index}`)),
10122
- /* @__PURE__ */ jsx22("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10123
- /* @__PURE__ */ jsx22("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
10204
+ /* @__PURE__ */ jsx23("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10205
+ /* @__PURE__ */ jsx23("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
10124
10206
  ] })
10125
10207
  ] }),
10126
- selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs20("label", { style: { display: "grid", gap: 6 }, children: [
10208
+ selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6 }, children: [
10127
10209
  needsAdjuster ? "Handling adjuster name (required)" : "Recipient / attention (optional)",
10128
- /* @__PURE__ */ jsx22("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10210
+ /* @__PURE__ */ jsx23("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10129
10211
  setContactName(event.target.value);
10130
10212
  emit(selection, manual, event.target.value);
10131
10213
  } })
10132
10214
  ] }) : null,
10133
- selection === "manual-email" ? /* @__PURE__ */ jsxs20("label", { children: [
10215
+ selection === "manual-email" ? /* @__PURE__ */ jsxs21("label", { children: [
10134
10216
  "Authorization email address",
10135
- /* @__PURE__ */ jsx22("input", { type: "email", value: manual, onChange: (event) => {
10217
+ /* @__PURE__ */ jsx23("input", { type: "email", value: manual, onChange: (event) => {
10136
10218
  const value = event.target.value;
10137
10219
  setManual(value);
10138
10220
  emit(selection, value, contactName);
10139
10221
  } })
10140
- ] }) : selection === "manual" ? /* @__PURE__ */ jsxs20("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10222
+ ] }) : selection === "manual" ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10141
10223
  "Authorization fax number",
10142
- /* @__PURE__ */ jsx22("input", { type: "tel", value: manual, onChange: (event) => {
10224
+ /* @__PURE__ */ jsx23("input", { type: "tel", value: manual, onChange: (event) => {
10143
10225
  const value = event.target.value;
10144
10226
  setManual(value);
10145
10227
  emit(selection, value, contactName);
10146
10228
  }, style: { padding: 10, width: "100%", minWidth: 0, boxSizing: "border-box", font: "inherit" } })
10147
- ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
10148
- chosen.method === "email" ? /* @__PURE__ */ jsxs20("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10229
+ ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10230
+ chosen.method === "email" ? /* @__PURE__ */ jsxs21("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10149
10231
  "Email: ",
10150
10232
  chosen.destination,
10151
10233
  ". Review this recipient before preparing and sending the packet."
10152
10234
  ] }) : null,
10153
- chosen.phone ? /* @__PURE__ */ jsxs20("small", { children: [
10235
+ chosen.phone ? /* @__PURE__ */ jsxs21("small", { children: [
10154
10236
  "Telephone for questions: ",
10155
10237
  chosen.phone
10156
10238
  ] }) : null
10157
10239
  ] }) : null,
10158
- compact ? /* @__PURE__ */ jsx22("small", { className: "mbrfa-guidance", children: guidance }) : null
10240
+ compact ? /* @__PURE__ */ jsx23("small", { className: "mbrfa-guidance", children: guidance }) : null
10159
10241
  ] });
10160
10242
  }
10161
10243
 
10162
10244
  // src/rfa-delivery-panel.tsx
10163
- import { Fragment as Fragment13, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10245
+ import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10164
10246
  function RfaPdfReview({ blob, title }) {
10165
- const [url, setUrl] = useState14("");
10247
+ const [url, setUrl] = useState15("");
10166
10248
  useEffect13(() => {
10167
10249
  const next = URL.createObjectURL(blob);
10168
10250
  setUrl(next);
10169
10251
  return () => URL.revokeObjectURL(next);
10170
10252
  }, [blob]);
10171
- return /* @__PURE__ */ jsx23("div", { children: url ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10172
- /* @__PURE__ */ jsxs21("div", { className: "mbtd-actions", children: [
10173
- /* @__PURE__ */ jsxs21("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
10253
+ return /* @__PURE__ */ jsx24("div", { children: url ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10254
+ /* @__PURE__ */ jsxs22("div", { className: "mbtd-actions", children: [
10255
+ /* @__PURE__ */ jsxs22("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
10174
10256
  "Open ",
10175
10257
  title,
10176
10258
  " PDF"
10177
10259
  ] }),
10178
- /* @__PURE__ */ jsx23("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10260
+ /* @__PURE__ */ jsx24("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10179
10261
  ] }),
10180
- /* @__PURE__ */ jsx23("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10262
+ /* @__PURE__ */ jsx24("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10181
10263
  ] }) : null });
10182
10264
  }
10183
10265
  function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoading, directoryError, locked, environment, canSend, run, onUpdated }) {
10184
- const [mode, setMode] = useState14("send");
10185
- const [destination, setDestination] = useState14(null);
10186
- const [message, setMessage] = useState14("");
10187
- const [prepared, setPrepared] = useState14(null);
10188
- const [reviewed, setReviewed] = useState14(false);
10189
- const [confirmed, setConfirmed] = useState14(false);
10190
- const keys = useRef10(/* @__PURE__ */ new Map());
10266
+ const [mode, setMode] = useState15("send");
10267
+ const [destination, setDestination] = useState15(null);
10268
+ const [message, setMessage] = useState15("");
10269
+ const [prepared, setPrepared] = useState15(null);
10270
+ const [reviewed, setReviewed] = useState15(false);
10271
+ const [confirmed, setConfirmed] = useState15(false);
10272
+ const keys = useRef11(/* @__PURE__ */ new Map());
10191
10273
  const fingerprint = JSON.stringify([rfa.id, rfa.contentRevision, documentIds, mode, destination?.method, destination?.destination, destination?.recipientName, message.trim()]);
10192
- const current = useRef10(fingerprint);
10274
+ const current = useRef11(fingerprint);
10193
10275
  current.current = fingerprint;
10194
10276
  useEffect13(() => {
10195
10277
  setPrepared(null);
@@ -10197,26 +10279,26 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10197
10279
  setConfirmed(false);
10198
10280
  }, [fingerprint]);
10199
10281
  const packet = prepared?.fingerprint === fingerprint ? prepared : null;
10200
- return /* @__PURE__ */ jsxs21("fieldset", { children: [
10201
- /* @__PURE__ */ jsx23("legend", { children: "Review packet and send" }),
10202
- !rfa.readiness.ready ? /* @__PURE__ */ jsxs21("p", { children: [
10282
+ return /* @__PURE__ */ jsxs22("fieldset", { children: [
10283
+ /* @__PURE__ */ jsx24("legend", { children: "Review packet and send" }),
10284
+ !rfa.readiness.ready ? /* @__PURE__ */ jsxs22("p", { children: [
10203
10285
  "Still needed: ",
10204
10286
  rfa.readiness.missing.map((value) => value === "signedAt" ? "physician signature" : value.replace(/([a-z])([A-Z])/g, "$1 $2").replaceAll("_", " ").toLowerCase()).join(", ") || "Complete the request details",
10205
10287
  "."
10206
10288
  ] }) : null,
10207
- /* @__PURE__ */ jsxs21("label", { children: [
10289
+ /* @__PURE__ */ jsxs22("label", { children: [
10208
10290
  "Delivery method",
10209
- /* @__PURE__ */ jsxs21("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10210
- /* @__PURE__ */ jsx23("option", { value: "send", children: "Send to claims administrator" }),
10211
- /* @__PURE__ */ jsx23("option", { value: "download", children: "Download for manual submission" })
10291
+ /* @__PURE__ */ jsxs22("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10292
+ /* @__PURE__ */ jsx24("option", { value: "send", children: "Send to claims administrator" }),
10293
+ /* @__PURE__ */ jsx24("option", { value: "download", children: "Download for manual submission" })
10212
10294
  ] })
10213
10295
  ] }),
10214
- mode === "send" ? /* @__PURE__ */ jsx23(RfaAuthorizationDestination, { contextKey: `${rfa.id}:${rfa.claimsAdminId ?? "manual"}`, directory, savedContact: rfa.authorizationContact, loading: directoryLoading, error: directoryError, disabled: locked, onChange: setDestination }) : /* @__PURE__ */ jsx23("p", { children: "Downloading does not mark this request as sent. Keep proof of any submission made outside this dashboard." }),
10215
- /* @__PURE__ */ jsxs21("label", { children: [
10296
+ mode === "send" ? /* @__PURE__ */ jsx24(RfaAuthorizationDestination, { contextKey: `${rfa.id}:${rfa.claimsAdminId ?? "manual"}`, directory, savedContact: rfa.authorizationContact, loading: directoryLoading, error: directoryError, disabled: locked, onChange: setDestination }) : /* @__PURE__ */ jsx24("p", { children: "Downloading does not mark this request as sent. Keep proof of any submission made outside this dashboard." }),
10297
+ /* @__PURE__ */ jsxs22("label", { children: [
10216
10298
  destination?.method === "email" && mode === "send" ? "Email message (optional)" : "Fax cover sheet message (optional)",
10217
- /* @__PURE__ */ jsx23("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10299
+ /* @__PURE__ */ jsx24("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10218
10300
  ] }),
10219
- /* @__PURE__ */ jsx23("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10301
+ /* @__PURE__ */ jsx24("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10220
10302
  const requestFingerprint = fingerprint;
10221
10303
  const preview = await client.prepareDelivery(rfa.id, { documentIds, channel: mode === "download" ? "download" : destination.method, ...mode === "send" ? { to: destination.destination, ...destination.recipientName ? { recipientName: destination.recipientName } : {} } : {}, ...message.trim() ? { message: message.trim() } : {} });
10222
10304
  const blob = await client.getPacket(rfa.id, preview.packetId);
@@ -10226,25 +10308,25 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10226
10308
  setConfirmed(false);
10227
10309
  }
10228
10310
  }), children: "Prepare packet with cover sheet" }),
10229
- packet ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10230
- /* @__PURE__ */ jsx23(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10231
- /* @__PURE__ */ jsxs21("label", { className: "mbrfa-check", children: [
10232
- /* @__PURE__ */ jsx23("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
10311
+ packet ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10312
+ /* @__PURE__ */ jsx24(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10313
+ /* @__PURE__ */ jsxs22("label", { className: "mbrfa-check", children: [
10314
+ /* @__PURE__ */ jsx24("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
10233
10315
  setReviewed(event.target.checked);
10234
10316
  setConfirmed(false);
10235
10317
  } }),
10236
10318
  "I reviewed the assembled packet, including the cover sheet and clinical documents."
10237
10319
  ] })
10238
10320
  ] }) : null,
10239
- mode === "send" ? environment !== "live" ? /* @__PURE__ */ jsx23("p", { className: "mbtd-note", children: "Sandbox: review and prepare the packet here. External fax delivery is disabled. Email sending is also disabled." }) : !canSend ? /* @__PURE__ */ jsx23("p", { children: "Sending requires permission from your organization." }) : /* @__PURE__ */ jsxs21(Fragment13, { children: [
10240
- /* @__PURE__ */ jsxs21("label", { className: "mbrfa-check", children: [
10241
- /* @__PURE__ */ jsx23("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
10321
+ mode === "send" ? environment !== "live" ? /* @__PURE__ */ jsx24("p", { className: "mbtd-note", children: "Sandbox: review and prepare the packet here. External fax delivery is disabled. Email sending is also disabled." }) : !canSend ? /* @__PURE__ */ jsx24("p", { children: "Sending requires permission from your organization." }) : /* @__PURE__ */ jsxs22(Fragment14, { children: [
10322
+ /* @__PURE__ */ jsxs22("label", { className: "mbrfa-check", children: [
10323
+ /* @__PURE__ */ jsx24("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
10242
10324
  "Send this reviewed packet to ",
10243
10325
  destination?.recipientName ? `${destination.recipientName} at ` : "",
10244
10326
  destination?.destination || "the selected authorization recipient",
10245
10327
  ". I verified the recipient for this claim."
10246
10328
  ] }),
10247
- /* @__PURE__ */ jsx23("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10329
+ /* @__PURE__ */ jsx24("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10248
10330
  if (!packet || !destination || !confirmed || !reviewed) return;
10249
10331
  const body = { packetId: packet.preview.packetId, sha256: packet.preview.sha256, channel: destination.method, to: destination.destination, ...destination.recipientName ? { recipientName: destination.recipientName } : {}, ...message.trim() ? { message: message.trim() } : {} };
10250
10332
  const signature = JSON.stringify(body);
@@ -10260,13 +10342,13 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10260
10342
  }
10261
10343
 
10262
10344
  // src/treatment-draft-shared.tsx
10263
- import { useRef as useRef11, useState as useState15 } from "react";
10264
- import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10345
+ import { useRef as useRef12, useState as useState16 } from "react";
10346
+ import { Fragment as Fragment15, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10265
10347
  function useDraftSave(onSave) {
10266
- const pending = useRef11(false);
10267
- const [busy, setBusy] = useState15(false);
10268
- const [message, setMessage] = useState15("");
10269
- const [error, setError] = useState15(null);
10348
+ const pending = useRef12(false);
10349
+ const [busy, setBusy] = useState16(false);
10350
+ const [message, setMessage] = useState16("");
10351
+ const [error, setError] = useState16(null);
10270
10352
  const clear = () => {
10271
10353
  setMessage("");
10272
10354
  setError(null);
@@ -10293,8 +10375,8 @@ function useDraftSave(onSave) {
10293
10375
  return { busy, message, error, clear, save };
10294
10376
  }
10295
10377
  function TreatmentDraftShell({ title, description, children, hideHeading = false, appearance, className = "", style }) {
10296
- return /* @__PURE__ */ jsxs22("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10297
- /* @__PURE__ */ jsx24("style", { children: `.mbtd{font:14px/1.5 ui-sans-serif,system-ui,sans-serif;color:var(--mb-text);min-width:0}.mbtd *{box-sizing:border-box}.mbtd h2{font-size:22px;margin:0 0 6px}.mbtd p{margin:6px 0 16px;color:var(--mb-muted)}.mbtd form{display:grid;gap:16px}.mbtd fieldset{margin:0;padding:16px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);min-width:0}.mbtd legend{font-weight:600;padding:0 6px}.mbtd .mbtd-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mbtd label{display:grid;gap:5px;font-size:13px;min-width:0}.mbtd input,.mbtd select,.mbtd textarea,.mbtd button{font:inherit;max-width:100%;min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:9px 11px;color:var(--mb-text);background:var(--mb-input);min-height:40px}.mbtd .mbrfa-check{display:flex;align-items:flex-start;gap:8px}.mbtd .mbrfa-check input[type=checkbox]{width:16px;height:16px;min-height:16px;margin:2px 0 0;padding:0;flex-shrink:0}
10378
+ return /* @__PURE__ */ jsxs23("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10379
+ /* @__PURE__ */ jsx25("style", { children: `.mbtd{font:14px/1.5 ui-sans-serif,system-ui,sans-serif;color:var(--mb-text);min-width:0}.mbtd *{box-sizing:border-box}.mbtd h2{font-size:22px;margin:0 0 6px}.mbtd p{margin:6px 0 16px;color:var(--mb-muted)}.mbtd form{display:grid;gap:16px}.mbtd fieldset{margin:0;padding:16px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);min-width:0}.mbtd legend{font-weight:600;padding:0 6px}.mbtd .mbtd-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mbtd label{display:grid;gap:5px;font-size:13px;min-width:0}.mbtd input,.mbtd select,.mbtd textarea,.mbtd button{font:inherit;max-width:100%;min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:9px 11px;color:var(--mb-text);background:var(--mb-input);min-height:40px}.mbtd .mbrfa-check{display:flex;align-items:flex-start;gap:8px}.mbtd .mbrfa-check input[type=checkbox]{width:16px;height:16px;min-height:16px;margin:2px 0 0;padding:0;flex-shrink:0}
10298
10380
  .mbtd .mbrfa-request-details>.mbtd-grid{display:flex;flex-direction:column;gap:12px}
10299
10381
  .mbtd .mbrfa-request-types{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding-bottom:12px;border-bottom:1px solid var(--mb-border)}
10300
10382
  .mbtd .mbrfa-request-details .mbrfa-check{min-height:44px;align-items:flex-start;gap:10px;line-height:20px;cursor:pointer}
@@ -10312,18 +10394,20 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10312
10394
  .mbtd .mbrfa-pickers[data-columns="1"]{grid-template-columns:minmax(0,1fr)}.mbtd .mbrfa-pickers[data-columns="2"]{grid-template-columns:repeat(2,minmax(0,1fr))}
10313
10395
  .mbtd .mbrfa-picker{display:grid;gap:5px;min-width:0;font-size:13px;align-content:start}.mbtd .mbrfa-picker>span:first-child{font-weight:600}
10314
10396
  .mbtd .mbrfa-form-grid .mbrfa-picker{padding-bottom:2px}
10315
- .mbtd .mbrfa-picker a,.mbtd .mbrfa-picker-links{font-size:12px}.mbtd .mbrfa-picker-links{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
10397
+ .mbtd .mbrfa-picker a,.mbtd .mbrfa-picker-links{font-size:12px}.mbtd .mbrfa-picker-links{display:flex;gap:12px;flex-wrap:wrap;align-items:center;min-height:18px}
10316
10398
  .mbtd .mbrfa-picker p,.mbtd .mbrfa-guidance p{margin:0;font-size:12px}.mbtd .mbrfa-guidance{display:grid;gap:4px}
10317
- .mbtd button.mbrfa-link.mbrfa-link{border:0;background:none;padding:0;min-height:0;color:var(--mb-accent);font-size:12px;text-decoration:underline}
10399
+ .mbtd .mbrfa-field-hint{font-size:12px;color:var(--mb-muted);font-weight:400}
10400
+ .mbtd .mbrfa-link-out{color:var(--mb-muted)!important;text-decoration:none}.mbtd .mbrfa-link-out:hover{text-decoration:underline}.mbtd .mbrfa-picker-links a{text-decoration:none}
10401
+ .mbtd button.mbrfa-link.mbrfa-link{border:0;background:none;padding:0;min-height:0;color:var(--mb-accent);font-size:12px;text-decoration:none}.mbtd button.mbrfa-link.mbrfa-link:hover,.mbtd .mbrfa-picker-links a:hover{text-decoration:underline}
10318
10402
  .mbtd fieldset.mbrfa-plain.mbrfa-plain{border:0;padding:0;margin:0;background:none;border-radius:0;min-width:0}
10319
10403
  .mbtd .mbrfa-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
10320
10404
  @media(max-width:760px){.mbtd .mbrfa-pickers,.mbtd .mbrfa-pickers[data-columns="2"]{grid-template-columns:minmax(0,1fr)}.mbtd .mbrfa-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.mbtd .mbrfa-form-grid>*{grid-column:1/-1}.mbtd .mbrfa-form-grid>.mbrfa-s1,.mbtd .mbrfa-form-grid>.mbrfa-s2{grid-column:span 1}}
10321
10405
  @media(max-width:640px){.mbtd .mbrfa-request-types{grid-template-columns:1fr;gap:4px}}
10322
10406
  @media(forced-colors:active){.mbtd .mbrfa-request-types input[type=radio]{appearance:auto}.mbtd .mbrfa-request-types input[type=radio]::after{display:none}}
10323
10407
  .mbtd textarea{resize:vertical;min-height:76px}.mbtd button{cursor:pointer;background:var(--mb-surface)}.mbtd button:disabled{opacity:.55;cursor:default}.mbtd .mbtd-primary{background:var(--mb-accent);color:var(--mb-accent-contrast);border-color:var(--mb-accent)}.mbtd .mbtd-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:12px}.mbtd .mbtd-wide{grid-column:1/-1}.mbtd [role=alert]{color:var(--mb-danger)}.mbtd [role=status]{margin:0}.mbtd :is(input,select,textarea,button):focus-visible{outline:2px solid var(--mb-accent);outline-offset:2px}.mbtd .mbtd-note{padding:12px;background:var(--mb-soft);border-radius:var(--mb-control-radius)}.mbtd a{color:var(--mb-accent)}@media(max-width:520px){.mbtd .mbtd-grid{grid-template-columns:minmax(0,1fr)}.mbtd fieldset{padding:12px}}` }),
10324
- !hideHeading ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10325
- /* @__PURE__ */ jsx24("h2", { children: title }),
10326
- /* @__PURE__ */ jsx24("p", { children: description })
10408
+ !hideHeading ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
10409
+ /* @__PURE__ */ jsx25("h2", { children: title }),
10410
+ /* @__PURE__ */ jsx25("p", { children: description })
10327
10411
  ] }) : null,
10328
10412
  children
10329
10413
  ] });
@@ -10333,7 +10417,7 @@ function isDraftDate(value) {
10333
10417
  }
10334
10418
 
10335
10419
  // src/rfa-task-board.tsx
10336
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10420
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10337
10421
  function rfaTaskState(task, now = Date.now()) {
10338
10422
  if (task.status === "resolved" || task.resolvedAt) return "Completed";
10339
10423
  return Date.parse(task.snoozedUntil ?? task.dueAt) > now ? "Scheduled" : "Due";
@@ -10375,30 +10459,30 @@ var date3 = (value) => new Date(value).toLocaleString();
10375
10459
  function RfaTaskBoard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
10376
10460
  const options = useMemo7(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
10377
10461
  const identity = useMemo7(() => crypto.randomUUID(), [options]);
10378
- return /* @__PURE__ */ jsx25(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10462
+ return /* @__PURE__ */ jsx26(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10379
10463
  }
10380
10464
  function TaskBoardContent({ options, patientId, claimId, renderingProviderId, permissions = [], onSelect, embedded = false, presentation = "dashboard", query, getTaskHref, onNavigate, renderTaskIdentity, ...appearance }) {
10381
10465
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10382
10466
  const requests = useMemo7(() => createRfaClient(options), [options]);
10383
- const [requestIdentities, setRequestIdentities] = useState16({});
10384
- const [tasks, setTasks] = useState16([]);
10385
- const [error, setError] = useState16("");
10386
- const [loading, setLoading] = useState16(true);
10387
- const [now, setNow] = useState16(Date.now);
10388
- const [inboxCount, setInboxCount] = useState16(null);
10467
+ const [requestIdentities, setRequestIdentities] = useState17({});
10468
+ const [tasks, setTasks] = useState17([]);
10469
+ const [error, setError] = useState17("");
10470
+ const [loading, setLoading] = useState17(true);
10471
+ const [now, setNow] = useState17(Date.now);
10472
+ const [inboxCount, setInboxCount] = useState17(null);
10389
10473
  useEffect14(() => {
10390
10474
  const timer = setInterval(() => setNow(Date.now()), 6e4);
10391
10475
  return () => clearInterval(timer);
10392
10476
  }, []);
10393
- const [view, setView] = useState16(query?.state ?? "Due");
10394
- const [selection, setSelection] = useState16(null);
10477
+ const [view, setView] = useState17(query?.state ?? "Due");
10478
+ const [selection, setSelection] = useState17(null);
10395
10479
  const list3 = presentation === "list";
10396
10480
  useEffect14(() => {
10397
10481
  setView(query?.state ?? "Due");
10398
10482
  setSelection(null);
10399
10483
  }, [query]);
10400
10484
  const activeSelection = list3 ? query ?? {} : selection;
10401
- const drilldown = useRef12(null);
10485
+ const drilldown = useRef13(null);
10402
10486
  useEffect14(() => {
10403
10487
  if (selection) {
10404
10488
  drilldown.current?.scrollIntoView?.({ block: "nearest" });
@@ -10481,15 +10565,15 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10481
10565
  if (renderTaskIdentity) return renderTaskIdentity(task);
10482
10566
  if (!list3) return null;
10483
10567
  const record2 = requestIdentities[task.rfaId];
10484
- return record2 ? /* @__PURE__ */ jsxs23("div", { className: "mbrfa-task-identity", children: [
10485
- /* @__PURE__ */ jsx25("span", { children: record2.employeeName }),
10486
- /* @__PURE__ */ jsxs23("small", { children: [
10568
+ return record2 ? /* @__PURE__ */ jsxs24("div", { className: "mbrfa-task-identity", children: [
10569
+ /* @__PURE__ */ jsx26("span", { children: record2.employeeName }),
10570
+ /* @__PURE__ */ jsxs24("small", { children: [
10487
10571
  "Claim ",
10488
10572
  record2.claimNumber || record2.claimId,
10489
10573
  record2.displayReference ? ` \xB7 ${record2.displayReference}` : ""
10490
10574
  ] }),
10491
- /* @__PURE__ */ jsx25("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10492
- ] }) : /* @__PURE__ */ jsxs23("small", { children: [
10575
+ /* @__PURE__ */ jsx26("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10576
+ ] }) : /* @__PURE__ */ jsxs24("small", { children: [
10493
10577
  "Request ",
10494
10578
  task.rfaId,
10495
10579
  " \xB7 Claim ",
@@ -10501,19 +10585,19 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10501
10585
  const selectedTitle = activeSelection?.kind ? rfaTaskLabel(activeSelection.kind) : activeSelection?.title ?? (activeSelection?.kinds ? taskGroups.find((group) => group.kinds.length === activeSelection.kinds.length && group.kinds.every((kind) => activeSelection.kinds.includes(kind)))?.title ?? activeSelection.kinds.map(rfaTaskLabel).join(", ") : "All tasks");
10502
10586
  const selectionControl = (next, text3, ariaLabel) => {
10503
10587
  const target = { ...next, state: view };
10504
- if (!getTaskHref) return /* @__PURE__ */ jsx25("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10588
+ if (!getTaskHref) return /* @__PURE__ */ jsx26("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10505
10589
  const href = getTaskHref(target);
10506
- return /* @__PURE__ */ jsx25("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10590
+ return /* @__PURE__ */ jsx26("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10507
10591
  if (!onNavigate || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
10508
10592
  event.preventDefault();
10509
10593
  onNavigate(href);
10510
10594
  }, children: text3 });
10511
10595
  };
10512
- const countCell = (items, kind, bucket) => items.length ? selectionControl({ ...kind ? { kind } : {}, ...bucket ? { bucket } : {} }, items.length, `${rfaTaskLabel(kind ?? "all_tasks")}, ${bucket ? columns.find((column) => column.key === bucket)?.label : "total"}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx25("span", { className: "mbrfa-task-zero", children: "0" });
10513
- return /* @__PURE__ */ jsxs23(TreatmentDraftShell, { ...appearance, hideHeading: embedded, title: list3 ? "RFA task list" : "RFA tasks", description: list3 ? "Follow-up tasks matching the selected status, action and age." : "Open follow-up work, grouped by next action and age.", children: [
10514
- /* @__PURE__ */ jsx25("style", { children: `.mbrfa-task-tabs{display:flex;gap:8px;margin:12px 0 18px;flex-wrap:wrap}.mbtd .mbrfa-task-tabs button[aria-pressed=true]{border-color:var(--mb-accent);background:var(--mb-soft);color:var(--mb-accent);font-weight:650}.mbrfa-task-group{border:1px solid var(--mb-border);border-radius:var(--mb-radius);overflow:auto;margin:14px 0;background:var(--mb-surface)}.mbrfa-task-group table{width:100%;border-collapse:collapse;min-width:620px;table-layout:fixed}.mbrfa-task-group th,.mbrfa-task-group td{padding:8px 14px;border-bottom:1px solid var(--mb-border);text-align:center}.mbrfa-task-group th:first-child,.mbrfa-task-group td:first-child{text-align:left;width:31%}.mbrfa-task-group thead th{font-size:12px;background:var(--mb-soft)}.mbrfa-task-group thead th:first-child{font-size:14px}.mbrfa-task-group th small{display:block;font-weight:400;color:var(--mb-muted)}.mbrfa-task-group tfoot{font-weight:650;background:var(--mb-soft)}.mbrfa-task-group tfoot td,.mbrfa-task-group tfoot th{border:0}.mbtd .mbrfa-task-count{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:0;background:transparent;color:var(--mb-accent);font-weight:650;min-height:28px;padding:2px 10px}.mbrfa-task-zero{color:var(--mb-muted)}.mbrfa-task-drilldown{margin:20px 0}.mbrfa-task-drilldown table{width:100%;border-collapse:collapse}.mbrfa-task-drilldown th,.mbrfa-task-drilldown td{text-align:left;border-bottom:1px solid var(--mb-border);padding:10px;vertical-align:top}.mbrfa-task-drilldown td small{display:block;color:var(--mb-muted);overflow-wrap:anywhere}.mbrfa-task-scroll{overflow:auto}.mbrfa-task-drilldown h3{margin:0}.mbrfa-inbox{border-top:1px solid var(--mb-border);padding-top:18px;margin-top:20px}.mbrfa-inbox h3{margin-top:0}.mbrfa-list{display:grid;gap:8px;margin:12px 0}.mbrfa-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px;border:1px solid var(--mb-border);border-radius:8px}.mbrfa-card span{display:block;margin-top:4px}.mbrfa-card p{margin:6px 0}.mbrfa-match-disclosure{margin-top:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);padding:14px;background:var(--mb-surface)}.mbrfa-match-disclosure>summary{cursor:pointer;font-weight:650;color:var(--mb-accent)}@media(max-width:600px){.mbrfa-card{align-items:stretch;flex-direction:column}}` }),
10515
- /* @__PURE__ */ jsx25("strong", { children: "Task status" }),
10516
- /* @__PURE__ */ jsx25("div", { className: "mbrfa-task-tabs", role: "group", "aria-label": "Task status", children: ["Due", "Scheduled", "Completed"].map((state) => /* @__PURE__ */ jsxs23("button", { type: "button", "aria-pressed": view === state, onClick: () => {
10596
+ const countCell = (items, kind, bucket) => items.length ? selectionControl({ ...kind ? { kind } : {}, ...bucket ? { bucket } : {} }, items.length, `${rfaTaskLabel(kind ?? "all_tasks")}, ${bucket ? columns.find((column) => column.key === bucket)?.label : "total"}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-zero", children: "0" });
10597
+ return /* @__PURE__ */ jsxs24(TreatmentDraftShell, { ...appearance, hideHeading: embedded, title: list3 ? "RFA task list" : "RFA tasks", description: list3 ? "Follow-up tasks matching the selected status, action and age." : "Open follow-up work, grouped by next action and age.", children: [
10598
+ /* @__PURE__ */ jsx26("style", { children: `.mbrfa-task-tabs{display:flex;gap:8px;margin:12px 0 18px;flex-wrap:wrap}.mbtd .mbrfa-task-tabs button[aria-pressed=true]{border-color:var(--mb-accent);background:var(--mb-soft);color:var(--mb-accent);font-weight:650}.mbrfa-task-group{border:1px solid var(--mb-border);border-radius:var(--mb-radius);overflow:auto;margin:14px 0;background:var(--mb-surface)}.mbrfa-task-group table{width:100%;border-collapse:collapse;min-width:620px;table-layout:fixed}.mbrfa-task-group th,.mbrfa-task-group td{padding:8px 14px;border-bottom:1px solid var(--mb-border);text-align:center}.mbrfa-task-group th:first-child,.mbrfa-task-group td:first-child{text-align:left;width:31%}.mbrfa-task-group thead th{font-size:12px;background:var(--mb-soft)}.mbrfa-task-group thead th:first-child{font-size:14px}.mbrfa-task-group th small{display:block;font-weight:400;color:var(--mb-muted)}.mbrfa-task-group tfoot{font-weight:650;background:var(--mb-soft)}.mbrfa-task-group tfoot td,.mbrfa-task-group tfoot th{border:0}.mbtd .mbrfa-task-count{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:0;background:transparent;color:var(--mb-accent);font-weight:650;min-height:28px;padding:2px 10px}.mbrfa-task-zero{color:var(--mb-muted)}.mbrfa-task-drilldown{margin:20px 0}.mbrfa-task-drilldown table{width:100%;border-collapse:collapse}.mbrfa-task-drilldown th,.mbrfa-task-drilldown td{text-align:left;border-bottom:1px solid var(--mb-border);padding:10px;vertical-align:top}.mbrfa-task-drilldown td small{display:block;color:var(--mb-muted);overflow-wrap:anywhere}.mbrfa-task-scroll{overflow:auto}.mbrfa-task-drilldown h3{margin:0}.mbrfa-inbox{border-top:1px solid var(--mb-border);padding-top:18px;margin-top:20px}.mbrfa-inbox h3{margin-top:0}.mbrfa-list{display:grid;gap:8px;margin:12px 0}.mbrfa-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px;border:1px solid var(--mb-border);border-radius:8px}.mbrfa-card span{display:block;margin-top:4px}.mbrfa-card p{margin:6px 0}.mbrfa-match-disclosure{margin-top:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);padding:14px;background:var(--mb-surface)}.mbrfa-match-disclosure>summary{cursor:pointer;font-weight:650;color:var(--mb-accent)}@media(max-width:600px){.mbrfa-card{align-items:stretch;flex-direction:column}}` }),
10599
+ /* @__PURE__ */ jsx26("strong", { children: "Task status" }),
10600
+ /* @__PURE__ */ jsx26("div", { className: "mbrfa-task-tabs", role: "group", "aria-label": "Task status", children: ["Due", "Scheduled", "Completed"].map((state) => /* @__PURE__ */ jsxs24("button", { type: "button", "aria-pressed": view === state, onClick: () => {
10517
10601
  if (list3 && getTaskHref) {
10518
10602
  const href = getTaskHref({ ...query, state });
10519
10603
  if (onNavigate) onNavigate(href);
@@ -10528,118 +10612,118 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10528
10612
  tasks.filter((task) => rfaTaskState(task, now) === state).length,
10529
10613
  ")"
10530
10614
  ] }, state)) }),
10531
- /* @__PURE__ */ jsx25("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10532
- error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: error }) : null,
10533
- loading ? /* @__PURE__ */ jsx25("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs23("p", { children: [
10615
+ /* @__PURE__ */ jsx26("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10616
+ error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10617
+ loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs24("p", { children: [
10534
10618
  "No ",
10535
10619
  view.toLowerCase(),
10536
10620
  " tasks."
10537
10621
  ] }) : null,
10538
- !list3 && !loading && stateTasks.length ? /* @__PURE__ */ jsx25("p", { children: "Calendar days since task opened. Select a count to see the tasks. Counts represent tasks, so one RFA may appear more than once." }) : null,
10622
+ !list3 && !loading && stateTasks.length ? /* @__PURE__ */ jsx26("p", { children: "Calendar days since task opened. Select a count to see the tasks. Counts represent tasks, so one RFA may appear more than once." }) : null,
10539
10623
  !list3 ? groups2.map((group) => {
10540
10624
  const groupTasks = stateTasks.filter((task) => group.kinds.includes(task.kind));
10541
- return /* @__PURE__ */ jsx25("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs23("table", { children: [
10542
- /* @__PURE__ */ jsx25("thead", { children: /* @__PURE__ */ jsxs23("tr", { children: [
10543
- /* @__PURE__ */ jsxs23("th", { scope: "col", children: [
10625
+ return /* @__PURE__ */ jsx26("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs24("table", { children: [
10626
+ /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10627
+ /* @__PURE__ */ jsxs24("th", { scope: "col", children: [
10544
10628
  group.title,
10545
- /* @__PURE__ */ jsx25("small", { children: "By date task opened" })
10629
+ /* @__PURE__ */ jsx26("small", { children: "By date task opened" })
10546
10630
  ] }),
10547
- columns.map((column) => /* @__PURE__ */ jsx25("th", { scope: "col", children: /* @__PURE__ */ jsx25("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10548
- /* @__PURE__ */ jsx25("th", { scope: "col", children: "Task total" })
10631
+ columns.map((column) => /* @__PURE__ */ jsx26("th", { scope: "col", children: /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10632
+ /* @__PURE__ */ jsx26("th", { scope: "col", children: "Task total" })
10549
10633
  ] }) }),
10550
- /* @__PURE__ */ jsx25("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10634
+ /* @__PURE__ */ jsx26("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10551
10635
  const items = groupTasks.filter((task) => task.kind === kind);
10552
- return /* @__PURE__ */ jsxs23("tr", { children: [
10553
- /* @__PURE__ */ jsxs23("th", { scope: "row", children: [
10636
+ return /* @__PURE__ */ jsxs24("tr", { children: [
10637
+ /* @__PURE__ */ jsxs24("th", { scope: "row", children: [
10554
10638
  rfaTaskLabel(kind),
10555
- descriptions[kind] && /* @__PURE__ */ jsx25("small", { children: descriptions[kind] })
10639
+ descriptions[kind] && /* @__PURE__ */ jsx26("small", { children: descriptions[kind] })
10556
10640
  ] }),
10557
- columns.map((column) => /* @__PURE__ */ jsx25("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10558
- /* @__PURE__ */ jsx25("td", { children: countCell(items, kind) })
10641
+ columns.map((column) => /* @__PURE__ */ jsx26("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10642
+ /* @__PURE__ */ jsx26("td", { children: countCell(items, kind) })
10559
10643
  ] }, kind);
10560
10644
  }) }),
10561
- /* @__PURE__ */ jsx25("tfoot", { children: /* @__PURE__ */ jsxs23("tr", { children: [
10562
- /* @__PURE__ */ jsx25("th", { scope: "row", children: "Total" }),
10645
+ /* @__PURE__ */ jsx26("tfoot", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10646
+ /* @__PURE__ */ jsx26("th", { scope: "row", children: "Total" }),
10563
10647
  [...columns, { key: "total", label: "Total" }].map((column) => {
10564
10648
  const items = column.key === "total" ? groupTasks : groupTasks.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key);
10565
- return /* @__PURE__ */ jsx25("td", { children: items.length ? selectionControl({ kinds: group.kinds, title: group.title, ...column.key !== "total" ? { bucket: column.key } : {} }, items.length, `${group.title}, ${column.label}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx25("span", { className: "mbrfa-task-zero", children: "0" }) }, column.key);
10649
+ return /* @__PURE__ */ jsx26("td", { children: items.length ? selectionControl({ kinds: group.kinds, title: group.title, ...column.key !== "total" ? { bucket: column.key } : {} }, items.length, `${group.title}, ${column.label}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-zero", children: "0" }) }, column.key);
10566
10650
  })
10567
10651
  ] }) })
10568
10652
  ] }) }, group.title);
10569
10653
  }) : null,
10570
- !list3 && stateTasks.length ? /* @__PURE__ */ jsx25("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10571
- list3 || selection ? /* @__PURE__ */ jsxs23("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10572
- /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10573
- /* @__PURE__ */ jsxs23("h3", { children: [
10654
+ !list3 && stateTasks.length ? /* @__PURE__ */ jsx26("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10655
+ list3 || selection ? /* @__PURE__ */ jsxs24("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10656
+ /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10657
+ /* @__PURE__ */ jsxs24("h3", { children: [
10574
10658
  selectedTitle,
10575
10659
  activeSelection?.bucket ? ` \xB7 ${[...taskAgeColumns, { key: "unknown", label: "Unknown age" }].find((column) => column.key === activeSelection.bucket)?.label}` : "",
10576
10660
  " (",
10577
10661
  filtered.length,
10578
10662
  ")"
10579
10663
  ] }),
10580
- !list3 ? /* @__PURE__ */ jsx25("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10664
+ !list3 ? /* @__PURE__ */ jsx26("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10581
10665
  ] }),
10582
- /* @__PURE__ */ jsx25("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs23("table", { children: [
10583
- /* @__PURE__ */ jsx25("thead", { children: /* @__PURE__ */ jsxs23("tr", { children: [
10584
- /* @__PURE__ */ jsx25("th", { children: "Task / request" }),
10585
- /* @__PURE__ */ jsx25("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10586
- /* @__PURE__ */ jsx25("th", { children: "Assigned to" }),
10587
- /* @__PURE__ */ jsx25("th", { children: "Action" })
10666
+ /* @__PURE__ */ jsx26("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs24("table", { children: [
10667
+ /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10668
+ /* @__PURE__ */ jsx26("th", { children: "Task / request" }),
10669
+ /* @__PURE__ */ jsx26("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10670
+ /* @__PURE__ */ jsx26("th", { children: "Assigned to" }),
10671
+ /* @__PURE__ */ jsx26("th", { children: "Action" })
10588
10672
  ] }) }),
10589
- /* @__PURE__ */ jsx25("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs23("tr", { children: [
10590
- /* @__PURE__ */ jsxs23("td", { children: [
10591
- /* @__PURE__ */ jsx25("strong", { children: rfaTaskLabel(task.kind) }),
10673
+ /* @__PURE__ */ jsx26("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs24("tr", { children: [
10674
+ /* @__PURE__ */ jsxs24("td", { children: [
10675
+ /* @__PURE__ */ jsx26("strong", { children: rfaTaskLabel(task.kind) }),
10592
10676
  taskIdentity(task),
10593
- task.responseFilename ? /* @__PURE__ */ jsx25("small", { children: task.responseFilename }) : null,
10594
- task.lastOutcome ? /* @__PURE__ */ jsxs23("small", { children: [
10677
+ task.responseFilename ? /* @__PURE__ */ jsx26("small", { children: task.responseFilename }) : null,
10678
+ task.lastOutcome ? /* @__PURE__ */ jsxs24("small", { children: [
10595
10679
  "Last outcome: ",
10596
10680
  task.lastOutcome.replaceAll("_", " ")
10597
10681
  ] }) : null,
10598
- task.lastNote ? /* @__PURE__ */ jsx25("small", { children: task.lastNote }) : null
10682
+ task.lastNote ? /* @__PURE__ */ jsx26("small", { children: task.lastNote }) : null
10599
10683
  ] }),
10600
- /* @__PURE__ */ jsx25("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10601
- /* @__PURE__ */ jsx25("td", { children: task.assigneeReference || "Unassigned" }),
10602
- /* @__PURE__ */ jsx25("td", { children: /* @__PURE__ */ jsx25("button", { type: "button", onClick: () => onSelect(task.rfaId, task.responseDocumentId ?? void 0), children: task.kind === "post_ur_decision" ? "Review response" : "Open request" }) })
10684
+ /* @__PURE__ */ jsx26("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10685
+ /* @__PURE__ */ jsx26("td", { children: task.assigneeReference || "Unassigned" }),
10686
+ /* @__PURE__ */ jsx26("td", { children: /* @__PURE__ */ jsx26("button", { type: "button", onClick: () => onSelect(task.rfaId, task.responseDocumentId ?? void 0), children: task.kind === "post_ur_decision" ? "Review response" : "Open request" }) })
10603
10687
  ] }, task.id)) })
10604
10688
  ] }) }),
10605
- !filtered.length ? /* @__PURE__ */ jsx25("p", { children: "No tasks match this selection." }) : null
10689
+ !filtered.length ? /* @__PURE__ */ jsx26("p", { children: "No tasks match this selection." }) : null
10606
10690
  ] }) : null,
10607
- !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs23("details", { className: "mbrfa-match-disclosure", children: [
10608
- /* @__PURE__ */ jsxs23("summary", { children: [
10691
+ !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs24("details", { className: "mbrfa-match-disclosure", children: [
10692
+ /* @__PURE__ */ jsxs24("summary", { children: [
10609
10693
  "Match UR \xB7 Incoming responses",
10610
10694
  inboxCount !== null ? ` (${inboxCount})` : ""
10611
10695
  ] }),
10612
- /* @__PURE__ */ jsx25(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10613
- ] }) : /* @__PURE__ */ jsx25("p", { className: "mbtd-note", children: "Open the organization-wide RFA dashboard to match incoming faxes that do not yet belong to a patient or claim." }) : null
10696
+ /* @__PURE__ */ jsx26(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10697
+ ] }) : /* @__PURE__ */ jsx26("p", { className: "mbtd-note", children: "Open the organization-wide RFA dashboard to match incoming faxes that do not yet belong to a patient or claim." }) : null
10614
10698
  ] });
10615
10699
  }
10616
10700
  function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10617
10701
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10618
10702
  const records = useMemo7(() => createRfaClient(options), [options]);
10619
- const [faxes, setFaxes] = useState16([]);
10620
- const [fax, setFax] = useState16(null);
10621
- const [pdf, setPdf] = useState16(null);
10622
- const [choices, setChoices] = useState16([]);
10623
- const [selected, setSelected] = useState16("");
10624
- const [search, setSearch] = useState16("");
10625
- const [error, setError] = useState16("");
10626
- const [busy, setBusy] = useState16(false);
10627
- const [loading, setLoading] = useState16(true);
10628
- const [reload, setReload] = useState16(0);
10629
- const [nextCursor, setNextCursor] = useState16(null);
10630
- const [pages, setPages] = useState16([void 0]);
10631
- const [confirmed, setConfirmed] = useState16(false);
10632
- const keys = useRef12(/* @__PURE__ */ new Map());
10633
- const alive = useRef12(true);
10634
- const pending = useRef12(false);
10635
- const generation = useRef12(0);
10703
+ const [faxes, setFaxes] = useState17([]);
10704
+ const [fax, setFax] = useState17(null);
10705
+ const [pdf, setPdf] = useState17(null);
10706
+ const [choices, setChoices] = useState17([]);
10707
+ const [selected, setSelected] = useState17("");
10708
+ const [search, setSearch] = useState17("");
10709
+ const [error, setError] = useState17("");
10710
+ const [busy, setBusy] = useState17(false);
10711
+ const [loading, setLoading] = useState17(true);
10712
+ const [reload, setReload] = useState17(0);
10713
+ const [nextCursor, setNextCursor] = useState17(null);
10714
+ const [pages, setPages] = useState17([void 0]);
10715
+ const [confirmed, setConfirmed] = useState17(false);
10716
+ const keys = useRef13(/* @__PURE__ */ new Map());
10717
+ const alive = useRef13(true);
10718
+ const pending = useRef13(false);
10719
+ const generation = useRef13(0);
10636
10720
  useEffect14(() => {
10637
10721
  alive.current = true;
10638
10722
  return () => {
10639
10723
  alive.current = false;
10640
10724
  };
10641
10725
  }, []);
10642
- const reviewingFax = useRef12(false);
10726
+ const reviewingFax = useRef13(false);
10643
10727
  reviewingFax.current = Boolean(fax);
10644
10728
  useEffect14(() => {
10645
10729
  let active = true;
@@ -10701,35 +10785,35 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10701
10785
  if (alive.current) setBusy(false);
10702
10786
  }
10703
10787
  };
10704
- return /* @__PURE__ */ jsxs23("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10705
- /* @__PURE__ */ jsx25("h3", { children: "Response inbox \xB7 Match UR" }),
10706
- /* @__PURE__ */ jsx25("p", { children: "Review incoming response faxes, then choose the matching request. Matching adds the response document and creates a Post UR task; it does not record a treatment decision." }),
10707
- error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: error }) : null,
10708
- loading ? /* @__PURE__ */ jsx25("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx25("p", { children: "No unmatched response faxes." }) : null,
10709
- pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10710
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10711
- /* @__PURE__ */ jsxs23("span", { children: [
10788
+ return /* @__PURE__ */ jsxs24("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10789
+ /* @__PURE__ */ jsx26("h3", { children: "Response inbox \xB7 Match UR" }),
10790
+ /* @__PURE__ */ jsx26("p", { children: "Review incoming response faxes, then choose the matching request. Matching adds the response document and creates a Post UR task; it does not record a treatment decision." }),
10791
+ error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10792
+ loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx26("p", { children: "No unmatched response faxes." }) : null,
10793
+ pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10794
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10795
+ /* @__PURE__ */ jsxs24("span", { children: [
10712
10796
  "Page ",
10713
10797
  pages.length
10714
10798
  ] }),
10715
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10799
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10716
10800
  if (nextCursor) setPages((value) => [...value, nextCursor]);
10717
10801
  }, children: "Next fax page" })
10718
10802
  ] }) : null,
10719
- /* @__PURE__ */ jsx25("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs23("article", { className: "mbrfa-card", children: [
10720
- /* @__PURE__ */ jsxs23("div", { children: [
10721
- /* @__PURE__ */ jsxs23("strong", { children: [
10803
+ /* @__PURE__ */ jsx26("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs24("article", { className: "mbrfa-card", children: [
10804
+ /* @__PURE__ */ jsxs24("div", { children: [
10805
+ /* @__PURE__ */ jsxs24("strong", { children: [
10722
10806
  "Response fax \xB7 ",
10723
10807
  date3(item.receivedAt)
10724
10808
  ] }),
10725
- /* @__PURE__ */ jsxs23("span", { children: [
10809
+ /* @__PURE__ */ jsxs24("span", { children: [
10726
10810
  item.fromName || item.fromFax || "Sender not identified",
10727
10811
  " \xB7 ",
10728
10812
  item.pages ?? "Unknown",
10729
10813
  " pages"
10730
10814
  ] })
10731
10815
  ] }),
10732
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: busy || disabled, onClick: () => {
10816
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => {
10733
10817
  const current = ++generation.current;
10734
10818
  setFax(item);
10735
10819
  setPdf(null);
@@ -10746,18 +10830,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10746
10830
  });
10747
10831
  }, children: "Review fax" })
10748
10832
  ] }, item.id)) }),
10749
- fax ? /* @__PURE__ */ jsxs23("div", { style: { display: "grid", gap: 16 }, children: [
10750
- /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10751
- /* @__PURE__ */ jsx25("h4", { children: "Match response fax" }),
10752
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: busy, onClick: () => {
10833
+ fax ? /* @__PURE__ */ jsxs24("div", { style: { display: "grid", gap: 16 }, children: [
10834
+ /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10835
+ /* @__PURE__ */ jsx26("h4", { children: "Match response fax" }),
10836
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy, onClick: () => {
10753
10837
  generation.current += 1;
10754
10838
  setFax(null);
10755
10839
  setPdf(null);
10756
10840
  setReload((value) => value + 1);
10757
10841
  }, children: "Close review" })
10758
10842
  ] }),
10759
- pdf ? /* @__PURE__ */ jsx25(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10760
- /* @__PURE__ */ jsxs23("form", { onSubmit: (event) => {
10843
+ pdf ? /* @__PURE__ */ jsx26(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10844
+ /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
10761
10845
  event.preventDefault();
10762
10846
  void run(async () => {
10763
10847
  const result = await records.list({ search: search.trim(), limit: 50 });
@@ -10767,20 +10851,20 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10767
10851
  }
10768
10852
  });
10769
10853
  }, children: [
10770
- /* @__PURE__ */ jsxs23("label", { children: [
10854
+ /* @__PURE__ */ jsxs24("label", { children: [
10771
10855
  "Find patient, claim or RFA",
10772
- /* @__PURE__ */ jsx25("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10856
+ /* @__PURE__ */ jsx26("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10773
10857
  ] }),
10774
- /* @__PURE__ */ jsx25("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10858
+ /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10775
10859
  ] }),
10776
- /* @__PURE__ */ jsxs23("label", { children: [
10860
+ /* @__PURE__ */ jsxs24("label", { children: [
10777
10861
  "Matching request",
10778
- /* @__PURE__ */ jsxs23("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10862
+ /* @__PURE__ */ jsxs24("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10779
10863
  setSelected(event.target.value);
10780
10864
  setConfirmed(false);
10781
10865
  }, children: [
10782
- /* @__PURE__ */ jsx25("option", { value: "", children: "Choose after reviewing the response" }),
10783
- choices.map((record2) => /* @__PURE__ */ jsxs23("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10866
+ /* @__PURE__ */ jsx26("option", { value: "", children: "Choose after reviewing the response" }),
10867
+ choices.map((record2) => /* @__PURE__ */ jsxs24("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10784
10868
  record2.employeeName,
10785
10869
  " \xB7 ",
10786
10870
  record2.claimNumber || "Claim not recorded",
@@ -10792,8 +10876,8 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10792
10876
  ] }, record2.id))
10793
10877
  ] })
10794
10878
  ] }),
10795
- selected ? /* @__PURE__ */ jsx25("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
10796
- editable ? /* @__PURE__ */ jsxs23("form", { onSubmit: (event) => {
10879
+ selected ? /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
10880
+ editable ? /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
10797
10881
  event.preventDefault();
10798
10882
  if (!selected || !pdf || !confirmed || !editable || !choices.some((record2) => record2.id === selected && canMatchResponse(record2))) return;
10799
10883
  void run(async () => {
@@ -10812,18 +10896,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10812
10896
  }
10813
10897
  });
10814
10898
  }, children: [
10815
- /* @__PURE__ */ jsxs23("label", { children: [
10816
- /* @__PURE__ */ jsx25("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
10899
+ /* @__PURE__ */ jsxs24("label", { children: [
10900
+ /* @__PURE__ */ jsx26("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
10817
10901
  " I reviewed the response and confirmed its patient, claim, and requested treatment match this request."
10818
10902
  ] }),
10819
- /* @__PURE__ */ jsx25("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
10820
- ] }) : /* @__PURE__ */ jsx25("p", { children: "Matching responses requires authorization from your administrator." })
10903
+ /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
10904
+ ] }) : /* @__PURE__ */ jsx26("p", { children: "Matching responses requires authorization from your administrator." })
10821
10905
  ] }) : null
10822
10906
  ] });
10823
10907
  }
10824
10908
 
10825
10909
  // src/rfa-tracking-panel.tsx
10826
- import { Fragment as Fragment16, useEffect as useEffect15, useMemo as useMemo8, useRef as useRef13, useState as useState17 } from "react";
10910
+ import { Fragment as Fragment17, useEffect as useEffect15, useMemo as useMemo8, useRef as useRef14, useState as useState18 } from "react";
10827
10911
  import { createRfaClient as createRfaClient2, createRfaLifecycleClient as createRfaLifecycleClient2 } from "@mindbill/browser";
10828
10912
 
10829
10913
  // src/rfa-detail-header.tsx
@@ -10846,43 +10930,43 @@ function rfaDecisionDueText(rfa) {
10846
10930
  }
10847
10931
 
10848
10932
  // src/rfa-detail-header.tsx
10849
- import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10933
+ import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
10850
10934
  function RfaDetailHeader({ rfa, getPatientHref, getClaimHref, getProviderHref, compact = false }) {
10851
10935
  const status = getRfaLifecycleStatus(rfa);
10852
10936
  const stages = ["Incomplete", "Sent", "Received", "Closed"];
10853
10937
  const current = status === "closed" ? 3 : status === "received" || rfa.receivedAt ? 2 : status === "sent" || rfa.submittedAt ? 1 : 0;
10854
- return /* @__PURE__ */ jsxs24(Fragment15, { children: [
10855
- /* @__PURE__ */ jsxs24("div", { className: "mbrfa-context", children: [
10856
- /* @__PURE__ */ jsxs24("div", { children: [
10857
- /* @__PURE__ */ jsx26("strong", { children: /* @__PURE__ */ jsx26(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
10858
- /* @__PURE__ */ jsx26("span", { children: /* @__PURE__ */ jsxs24(RfaLink, { href: getClaimHref?.(rfa), children: [
10938
+ return /* @__PURE__ */ jsxs25(Fragment16, { children: [
10939
+ /* @__PURE__ */ jsxs25("div", { className: "mbrfa-context", children: [
10940
+ /* @__PURE__ */ jsxs25("div", { children: [
10941
+ /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
10942
+ /* @__PURE__ */ jsx27("span", { children: /* @__PURE__ */ jsxs25(RfaLink, { href: getClaimHref?.(rfa), children: [
10859
10943
  "Claim ",
10860
10944
  rfa.claimNumber || "Not recorded"
10861
10945
  ] }) })
10862
10946
  ] }),
10863
- /* @__PURE__ */ jsxs24("div", { children: [
10864
- /* @__PURE__ */ jsx26("strong", { children: /* @__PURE__ */ jsx26(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
10865
- /* @__PURE__ */ jsx26("span", { children: "Requesting physician" })
10947
+ /* @__PURE__ */ jsxs25("div", { children: [
10948
+ /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
10949
+ /* @__PURE__ */ jsx27("span", { children: "Requesting physician" })
10866
10950
  ] }),
10867
- /* @__PURE__ */ jsxs24("div", { children: [
10868
- /* @__PURE__ */ jsx26("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
10869
- /* @__PURE__ */ jsx26("span", { className: "mbrfa-update-note", children: "Updates automatically" })
10951
+ /* @__PURE__ */ jsxs25("div", { children: [
10952
+ /* @__PURE__ */ jsx27("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
10953
+ /* @__PURE__ */ jsx27("span", { className: "mbrfa-update-note", children: "Updates automatically" })
10870
10954
  ] })
10871
10955
  ] }),
10872
- !compact ? /* @__PURE__ */ jsxs24("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
10873
- /* @__PURE__ */ jsxs24("div", { className: "mbrfa-progress-heading", children: [
10874
- /* @__PURE__ */ jsxs24("div", { children: [
10875
- /* @__PURE__ */ jsx26("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
10876
- /* @__PURE__ */ jsx26("p", { children: status === "failed" ? "Delivery needs attention. Review the delivery evidence before retrying." : status === "canceled" ? "This request was canceled." : rfa.submittedAt ? `Submitted ${new Date(rfa.submittedAt).toLocaleDateString()}` : "Not yet submitted" })
10956
+ !compact ? /* @__PURE__ */ jsxs25("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
10957
+ /* @__PURE__ */ jsxs25("div", { className: "mbrfa-progress-heading", children: [
10958
+ /* @__PURE__ */ jsxs25("div", { children: [
10959
+ /* @__PURE__ */ jsx27("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
10960
+ /* @__PURE__ */ jsx27("p", { children: status === "failed" ? "Delivery needs attention. Review the delivery evidence before retrying." : status === "canceled" ? "This request was canceled." : rfa.submittedAt ? `Submitted ${new Date(rfa.submittedAt).toLocaleDateString()}` : "Not yet submitted" })
10877
10961
  ] }),
10878
- /* @__PURE__ */ jsxs24("div", { className: "mbrfa-deadline", children: [
10879
- /* @__PURE__ */ jsx26("span", { children: "Decision due" }),
10880
- /* @__PURE__ */ jsx26("strong", { children: rfaDecisionDueText(rfa) })
10962
+ /* @__PURE__ */ jsxs25("div", { className: "mbrfa-deadline", children: [
10963
+ /* @__PURE__ */ jsx27("span", { children: "Decision due" }),
10964
+ /* @__PURE__ */ jsx27("strong", { children: rfaDecisionDueText(rfa) })
10881
10965
  ] })
10882
10966
  ] }),
10883
- /* @__PURE__ */ jsx26("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs24("li", { className: index <= current ? "is-complete" : "", "aria-current": index === current ? "step" : void 0, children: [
10884
- /* @__PURE__ */ jsx26("span", { children: index < current ? "\u2713" : index + 1 }),
10885
- /* @__PURE__ */ jsx26("strong", { children: stage })
10967
+ /* @__PURE__ */ jsx27("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs25("li", { className: index <= current ? "is-complete" : "", "aria-current": index === current ? "step" : void 0, children: [
10968
+ /* @__PURE__ */ jsx27("span", { children: index < current ? "\u2713" : index + 1 }),
10969
+ /* @__PURE__ */ jsx27("strong", { children: stage })
10886
10970
  ] }, stage)) })
10887
10971
  ] }) : null
10888
10972
  ] });
@@ -10896,7 +10980,7 @@ var rfaPolishCss = `
10896
10980
  var rfaSimpleCss = `.mbrfa-simple .mbrfa-detail-tabs{display:flex;overflow-x:auto;gap:4px}.mbrfa-simple .mbrfa-detail-tabs button{flex:1;white-space:nowrap}.mbrfa-simple [hidden]{display:none!important}.mbrfa-next-action{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-soft)}.mbrfa-next-action p{margin:5px 0 0}.mbrfa-simple .mbrfa-bottom-actions{position:static}.mbrfa-simple .mbrfa-bottom-actions>.mbrfa-badge{display:none}@media(max-width:600px){.mbrfa-next-action{align-items:flex-start;flex-direction:column}.mbrfa-simple .mbrfa-detail-tabs button{padding:8px}}`;
10897
10981
 
10898
10982
  // src/rfa-history-entry.tsx
10899
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
10983
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
10900
10984
  var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
10901
10985
  var string = (value) => typeof value === "string" && value.trim() ? value : void 0;
10902
10986
  var words = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
@@ -10970,9 +11054,9 @@ function rows2(value, omit = []) {
10970
11054
  });
10971
11055
  }
10972
11056
  function DefinitionList({ entries }) {
10973
- return /* @__PURE__ */ jsx27("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs25("div", { children: [
10974
- /* @__PURE__ */ jsx27("dt", { children: label5 }),
10975
- /* @__PURE__ */ jsx27("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
11057
+ return /* @__PURE__ */ jsx28("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs26("div", { children: [
11058
+ /* @__PURE__ */ jsx28("dt", { children: label5 }),
11059
+ /* @__PURE__ */ jsx28("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
10976
11060
  ] }, label5)) });
10977
11061
  }
10978
11062
  function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
@@ -10997,12 +11081,12 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
10997
11081
  }
10998
11082
  const treatment = (id) => {
10999
11083
  const index = rfa.items.findIndex((value) => value.id === id);
11000
- return index >= 0 ? /* @__PURE__ */ jsxs25("a", { href: `#rfa-treatment-${id}`, children: [
11084
+ return index >= 0 ? /* @__PURE__ */ jsxs26("a", { href: `#rfa-treatment-${id}`, children: [
11001
11085
  "Treatment ",
11002
11086
  index + 1,
11003
11087
  ": ",
11004
11088
  rfa.items[index].serviceDescription
11005
- ] }) : /* @__PURE__ */ jsxs25("span", { children: [
11089
+ ] }) : /* @__PURE__ */ jsxs26("span", { children: [
11006
11090
  "Treatment reference: ",
11007
11091
  id
11008
11092
  ] });
@@ -11029,50 +11113,50 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
11029
11113
  const hasDetails = entries.length || appointment.length || decisionSections.length || evidence.length || changed.length;
11030
11114
  const actor = /^(system:|system$)/.test(event.actor) ? "System" : /^(native-user:|user:)/.test(event.actor) || /^partner:[^:]+:browser:/.test(event.actor) ? "Team member" : /^partner:/.test(event.actor) ? "Integration" : /^(developer:|integration:|api:)/.test(event.actor) ? "Integration" : event.actor;
11031
11115
  const action = string(payload.action) ?? event.eventType.replace(/^rfa\./, "");
11032
- return /* @__PURE__ */ jsxs25("tr", { children: [
11033
- /* @__PURE__ */ jsx27("td", { children: /* @__PURE__ */ jsx27("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11034
- /* @__PURE__ */ jsx27("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11035
- /* @__PURE__ */ jsxs25("td", { children: [
11036
- /* @__PURE__ */ jsx27("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11116
+ return /* @__PURE__ */ jsxs26("tr", { children: [
11117
+ /* @__PURE__ */ jsx28("td", { children: /* @__PURE__ */ jsx28("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11118
+ /* @__PURE__ */ jsx28("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11119
+ /* @__PURE__ */ jsxs26("td", { children: [
11120
+ /* @__PURE__ */ jsx28("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11037
11121
  actor
11038
11122
  ] }),
11039
- /* @__PURE__ */ jsxs25("td", { children: [
11040
- ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx27("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11041
- ids.size ? /* @__PURE__ */ jsx27("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx27("li", { children: treatment(id) }, id)) }) : null,
11042
- hasDetails ? /* @__PURE__ */ jsxs25("details", { children: [
11043
- /* @__PURE__ */ jsx27("summary", { children: "Event details" }),
11044
- entries.length ? /* @__PURE__ */ jsx27(DefinitionList, { entries }) : null,
11045
- changed.length ? /* @__PURE__ */ jsxs25("p", { children: [
11123
+ /* @__PURE__ */ jsxs26("td", { children: [
11124
+ ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx28("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11125
+ ids.size ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx28("li", { children: treatment(id) }, id)) }) : null,
11126
+ hasDetails ? /* @__PURE__ */ jsxs26("details", { children: [
11127
+ /* @__PURE__ */ jsx28("summary", { children: "Event details" }),
11128
+ entries.length ? /* @__PURE__ */ jsx28(DefinitionList, { entries }) : null,
11129
+ changed.length ? /* @__PURE__ */ jsxs26("p", { children: [
11046
11130
  "Changed fields: ",
11047
11131
  changed.join(", ")
11048
11132
  ] }) : null,
11049
- appointment.length ? /* @__PURE__ */ jsxs25("section", { children: [
11050
- /* @__PURE__ */ jsx27("h4", { children: "Appointment details" }),
11051
- /* @__PURE__ */ jsx27(DefinitionList, { entries: appointment })
11133
+ appointment.length ? /* @__PURE__ */ jsxs26("section", { children: [
11134
+ /* @__PURE__ */ jsx28("h4", { children: "Appointment details" }),
11135
+ /* @__PURE__ */ jsx28(DefinitionList, { entries: appointment })
11052
11136
  ] }) : null,
11053
- decisionSections.map((group) => /* @__PURE__ */ jsxs25("section", { children: [
11054
- /* @__PURE__ */ jsx27("h4", { children: group.title }),
11055
- group.value !== payload ? /* @__PURE__ */ jsx27(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11056
- group.decisions.map((value, index) => /* @__PURE__ */ jsxs25("div", { children: [
11137
+ decisionSections.map((group) => /* @__PURE__ */ jsxs26("section", { children: [
11138
+ /* @__PURE__ */ jsx28("h4", { children: group.title }),
11139
+ group.value !== payload ? /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11140
+ group.decisions.map((value, index) => /* @__PURE__ */ jsxs26("div", { children: [
11057
11141
  string(value.itemId) ? treatment(String(value.itemId)) : null,
11058
- /* @__PURE__ */ jsx27(DefinitionList, { entries: rows2(value) })
11142
+ /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(value) })
11059
11143
  ] }, index))
11060
11144
  ] }, group.title)),
11061
- evidence.length ? /* @__PURE__ */ jsx27("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11145
+ evidence.length ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11062
11146
  const filename = rfa.documents.find((document2) => document2.id === value.id)?.filename;
11063
- return /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsxs25("button", { type: "button", disabled, onClick: () => onDownload(value.kind, value.id, filename ?? (value.kind === "packet" ? "RFA submission.pdf" : "RFA evidence.pdf")), children: [
11147
+ return /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsxs26("button", { type: "button", disabled, onClick: () => onDownload(value.kind, value.id, filename ?? (value.kind === "packet" ? "RFA submission.pdf" : "RFA evidence.pdf")), children: [
11064
11148
  value.label,
11065
11149
  filename ? `: ${filename}` : ""
11066
11150
  ] }) }, `${value.kind}:${value.id}`);
11067
11151
  }) }) : null
11068
- ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx27("span", { children: "\u2014" }) : null
11152
+ ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx28("span", { children: "\u2014" }) : null
11069
11153
  ] })
11070
11154
  ] });
11071
11155
  }
11072
11156
 
11073
11157
  // src/rfa-detail-cards.tsx
11074
11158
  import { getRfaLifecycleStatus as getRfaLifecycleStatus2, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS2 } from "@mindbill/browser";
11075
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
11159
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11076
11160
  var DECIDED = ["approved", "modified", "denied", "mixed", "closed"];
11077
11161
  var rfaShortDate = (value) => value && Number.isFinite(Date.parse(value)) ? new Date(value).toLocaleString(void 0, { dateStyle: "short", timeStyle: "short" }) : "\u2014";
11078
11162
  var rfaCalendarDate = (value) => {
@@ -11091,7 +11175,7 @@ function rfaOutcome(item) {
11091
11175
  return { label: sentence(item.outcome || "pending"), tone: "muted" };
11092
11176
  }
11093
11177
  function RfaPill({ tone = "muted", children }) {
11094
- return /* @__PURE__ */ jsx28("span", { className: "mbrfa-pill", "data-tone": tone, children });
11178
+ return /* @__PURE__ */ jsx29("span", { className: "mbrfa-pill", "data-tone": tone, children });
11095
11179
  }
11096
11180
  function rfaLifecycleTone(rfa) {
11097
11181
  const status = getRfaLifecycleStatus2(rfa);
@@ -11108,41 +11192,41 @@ function RfaStatusCard({ rfa }) {
11108
11192
  const current = rfa.submittedAt && decided ? 4 : rfa.receivedAt ? 3 : rfa.submittedAt ? 2 : rfa.signedAt ? 1 : 0;
11109
11193
  const stopped = status === "canceled" || status === "failed";
11110
11194
  const detail = status === "canceled" ? "This request was canceled" : status === "failed" ? "Delivery needs attention" : rfa.submittedAt ? `Sent ${rfaShortDate(rfa.submittedAt)}` : rfa.signedAt ? "Signed, not yet sent" : "Not yet signed";
11111
- return /* @__PURE__ */ jsxs26("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11112
- /* @__PURE__ */ jsxs26("div", { className: "mbrfa-status-heading", children: [
11113
- /* @__PURE__ */ jsxs26("div", { children: [
11114
- /* @__PURE__ */ jsx28("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11115
- /* @__PURE__ */ jsx28("p", { children: detail })
11195
+ return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11196
+ /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-heading", children: [
11197
+ /* @__PURE__ */ jsxs27("div", { children: [
11198
+ /* @__PURE__ */ jsx29("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11199
+ /* @__PURE__ */ jsx29("p", { children: detail })
11116
11200
  ] }),
11117
- rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs26("div", { className: "mbrfa-status-due", children: [
11118
- /* @__PURE__ */ jsx28("span", { children: "Decision due" }),
11119
- /* @__PURE__ */ jsx28("strong", { children: rfaDecisionDueText(rfa) })
11201
+ rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-due", children: [
11202
+ /* @__PURE__ */ jsx29("span", { children: "Decision due" }),
11203
+ /* @__PURE__ */ jsx29("strong", { children: rfaDecisionDueText(rfa) })
11120
11204
  ] }) : null
11121
11205
  ] }),
11122
- /* @__PURE__ */ jsx28("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs26("li", { "data-state": index < current ? "done" : index === current ? "current" : "todo", "aria-current": index === current ? "step" : void 0, children: [
11123
- /* @__PURE__ */ jsx28("span", { children: index < current ? "\u2713" : index + 1 }),
11124
- /* @__PURE__ */ jsx28("strong", { children: stage })
11206
+ /* @__PURE__ */ jsx29("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs27("li", { "data-state": index < current ? "done" : index === current ? "current" : "todo", "aria-current": index === current ? "step" : void 0, children: [
11207
+ /* @__PURE__ */ jsx29("span", { children: index < current ? "\u2713" : index + 1 }),
11208
+ /* @__PURE__ */ jsx29("strong", { children: stage })
11125
11209
  ] }, stage)) })
11126
11210
  ] });
11127
11211
  }
11128
11212
  function RfaCard({ title, count, action, children, id, flush = false }) {
11129
- return /* @__PURE__ */ jsxs26("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11130
- /* @__PURE__ */ jsxs26("header", { children: [
11131
- /* @__PURE__ */ jsxs26("h3", { children: [
11213
+ return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11214
+ /* @__PURE__ */ jsxs27("header", { children: [
11215
+ /* @__PURE__ */ jsxs27("h3", { children: [
11132
11216
  title,
11133
- count !== void 0 ? /* @__PURE__ */ jsx28("span", { className: "mbrfa-count", children: count }) : null
11217
+ count !== void 0 ? /* @__PURE__ */ jsx29("span", { className: "mbrfa-count", children: count }) : null
11134
11218
  ] }),
11135
- action ? /* @__PURE__ */ jsx28("div", { className: "mbrfa-sheet-action", children: action }) : null
11219
+ action ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-sheet-action", children: action }) : null
11136
11220
  ] }),
11137
- /* @__PURE__ */ jsx28("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11221
+ /* @__PURE__ */ jsx29("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11138
11222
  ] });
11139
11223
  }
11140
11224
  function RfaFacts({ entries }) {
11141
11225
  const shown = entries.filter(([, value]) => value !== null && value !== void 0 && value !== "" && value !== false);
11142
- return shown.length ? /* @__PURE__ */ jsx28("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs26("div", { children: [
11143
- /* @__PURE__ */ jsx28("dt", { children: name }),
11144
- /* @__PURE__ */ jsx28("dd", { children: value })
11145
- ] }, name)) }) : /* @__PURE__ */ jsx28("p", { className: "mbrfa-empty", children: "Not recorded." });
11226
+ return shown.length ? /* @__PURE__ */ jsx29("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11227
+ /* @__PURE__ */ jsx29("dt", { children: name }),
11228
+ /* @__PURE__ */ jsx29("dd", { children: value })
11229
+ ] }, name)) }) : /* @__PURE__ */ jsx29("p", { className: "mbrfa-empty", children: "Not recorded." });
11146
11230
  }
11147
11231
  var rfaAddress = (contact) => [contact?.address, [contact?.city, [contact?.state, contact?.zip].filter(Boolean).join(" ")].filter(Boolean).join(", ")].filter(Boolean).join(", ");
11148
11232
  var rfaRequestTypeLabel = (rfa) => rfa.requestType === "resubmission_material_change" ? "Resubmission \u2013 Change in Material Facts" : "New Request";
@@ -11228,7 +11312,7 @@ var rfaCardsCss = `
11228
11312
  `;
11229
11313
 
11230
11314
  // src/rfa-tracking-panel.tsx
11231
- import { Fragment as Fragment17, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11315
+ import { Fragment as Fragment18, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11232
11316
  var words2 = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
11233
11317
  var capital = (value) => value.charAt(0).toUpperCase() + value.slice(1);
11234
11318
  var date5 = (value) => value ? new Date(value).toLocaleString() : "Not recorded";
@@ -11250,25 +11334,25 @@ var localTime = (value) => {
11250
11334
  };
11251
11335
  function RfaTrackingPanel(props) {
11252
11336
  const identity = useMemo8(() => crypto.randomUUID(), [props.options]);
11253
- return /* @__PURE__ */ jsx29(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11337
+ return /* @__PURE__ */ jsx30(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11254
11338
  }
11255
11339
  function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdated, view = "all", embedded = false, cards = false, ...appearance }) {
11256
- const [rfa, setRfa] = useState17(provided);
11340
+ const [rfa, setRfa] = useState18(provided);
11257
11341
  useEffect15(() => setRfa(provided), [provided]);
11258
11342
  const client = useMemo8(() => createRfaLifecycleClient2(options), [options]);
11259
11343
  const records = useMemo8(() => createRfaClient2(options), [options]);
11260
- const [scheduling, setScheduling] = useState17([]);
11261
- const [history, setHistory] = useState17([]);
11262
- const [loadErrors, setLoadErrors] = useState17([]);
11263
- const [loading, setLoading] = useState17(true);
11264
- const [reload, setReload] = useState17(0);
11265
- const [busy, setBusy] = useState17(false);
11266
- const [error, setError] = useState17("");
11267
- const [message, setMessage] = useState17("");
11268
- const [noteOpen, setNoteOpen] = useState17(false);
11269
- const alive = useRef13(true);
11270
- const pending = useRef13(false);
11271
- const keys = useRef13(/* @__PURE__ */ new Map());
11344
+ const [scheduling, setScheduling] = useState18([]);
11345
+ const [history, setHistory] = useState18([]);
11346
+ const [loadErrors, setLoadErrors] = useState18([]);
11347
+ const [loading, setLoading] = useState18(true);
11348
+ const [reload, setReload] = useState18(0);
11349
+ const [busy, setBusy] = useState18(false);
11350
+ const [error, setError] = useState18("");
11351
+ const [message, setMessage] = useState18("");
11352
+ const [noteOpen, setNoteOpen] = useState18(false);
11353
+ const alive = useRef14(true);
11354
+ const pending = useRef14(false);
11355
+ const keys = useRef14(/* @__PURE__ */ new Map());
11272
11356
  useEffect15(() => {
11273
11357
  alive.current = true;
11274
11358
  return () => {
@@ -11351,11 +11435,11 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11351
11435
  if (alive.current) setError(reason instanceof Error ? reason.message : "The evidence could not be opened.");
11352
11436
  }
11353
11437
  };
11354
- const evidence = (id, title) => id ? /* @__PURE__ */ jsx29("button", { type: "button", disabled, onClick: () => void download(id, rfa.documents.find((document2) => document2.id === id)?.filename ?? `${title}.pdf`), children: title }) : null;
11438
+ const evidence = (id, title) => id ? /* @__PURE__ */ jsx30("button", { type: "button", disabled, onClick: () => void download(id, rfa.documents.find((document2) => document2.id === id)?.filename ?? `${title}.pdf`), children: title }) : null;
11355
11439
  const canCorrect = permissions.includes("act") && ["received", "under_review", "information_requested", "approved", "modified", "denied", "mixed"].includes(rfa.status);
11356
11440
  const canClose = permissions.includes("edit") && ["submitted", "received", "under_review", "information_requested", "incomplete", "deferred"].includes(rfa.status);
11357
11441
  const otherInformation = (item) => typeof item.metadata?.otherInformation === "string" && item.metadata.otherInformation.trim() ? item.metadata.otherInformation : [item.quantity != null ? `Quantity: ${item.quantity}` : "", item.units != null ? `Units: ${item.units}` : "", item.frequency, item.duration, item.requestedFrom ? `From: ${rfaCalendarDate(item.requestedFrom)}` : "", item.requestedTo ? `Through: ${rfaCalendarDate(item.requestedTo)}` : ""].filter(Boolean).join("; ");
11358
- const noteForm = /* @__PURE__ */ jsxs27("form", { className: "mbrfa-row", onSubmit: (event) => {
11442
+ const noteForm = /* @__PURE__ */ jsxs28("form", { className: "mbrfa-row", onSubmit: (event) => {
11359
11443
  event.preventDefault();
11360
11444
  const form = event.currentTarget;
11361
11445
  try {
@@ -11373,77 +11457,77 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11373
11457
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11374
11458
  }
11375
11459
  }, children: [
11376
- /* @__PURE__ */ jsxs27("label", { children: [
11460
+ /* @__PURE__ */ jsxs28("label", { children: [
11377
11461
  "Note",
11378
- /* @__PURE__ */ jsx29("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11462
+ /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11379
11463
  ] }),
11380
- /* @__PURE__ */ jsxs27("div", { className: "mbtd-actions", children: [
11381
- /* @__PURE__ */ jsx29("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11382
- /* @__PURE__ */ jsx29("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11464
+ /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11465
+ /* @__PURE__ */ jsx30("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11466
+ /* @__PURE__ */ jsx30("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11383
11467
  ] })
11384
11468
  ] });
11385
- const cardContent = /* @__PURE__ */ jsxs27("div", { className: "mbrfa-stack", children: [
11386
- error ? /* @__PURE__ */ jsx29("p", { role: "alert", children: error }) : null,
11387
- message ? /* @__PURE__ */ jsx29("p", { role: "status", children: message }) : null,
11388
- loadErrors.map((value) => /* @__PURE__ */ jsx29("p", { role: "alert", children: value }, value)),
11389
- view !== "history" ? /* @__PURE__ */ jsx29(RfaCard, { title: "Requested Treatment", count: rfa.items.length, flush: true, children: rfa.items.length ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-grid-table mbrfa-treatment-table", children: [
11390
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11391
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "#" }),
11392
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Service/Good Requested" }),
11393
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Diagnosis" }),
11394
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "CPT/HCPCS" }),
11395
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Other Information" }),
11396
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Decision" })
11469
+ const cardContent = /* @__PURE__ */ jsxs28("div", { className: "mbrfa-stack", children: [
11470
+ error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11471
+ message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11472
+ loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11473
+ view !== "history" ? /* @__PURE__ */ jsx30(RfaCard, { title: "Requested Treatment", count: rfa.items.length, flush: true, children: rfa.items.length ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-grid-table mbrfa-treatment-table", children: [
11474
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11475
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "#" }),
11476
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Service/Good Requested" }),
11477
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Diagnosis" }),
11478
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "CPT/HCPCS" }),
11479
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Other Information" }),
11480
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Decision" })
11397
11481
  ] }) }),
11398
- /* @__PURE__ */ jsx29("tbody", { children: rfa.items.map((item, index) => {
11482
+ /* @__PURE__ */ jsx30("tbody", { children: rfa.items.map((item, index) => {
11399
11483
  const appointment = scheduling.find((value) => value.itemId === item.id);
11400
11484
  const outcome = rfaOutcome(item);
11401
11485
  const showAppointment = !!appointment && (appointment.eligible || appointment.version > 0);
11402
11486
  const closable = canClose && item.outcome === "pending" && !item.decidedAt;
11403
11487
  const correctable = canCorrect && !!item.currentDecisionEventId && item.outcome !== "pending";
11404
- return /* @__PURE__ */ jsxs27(Fragment16, { children: [
11405
- /* @__PURE__ */ jsxs27("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11406
- /* @__PURE__ */ jsx29("td", { children: index + 1 }),
11407
- /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29("strong", { children: item.serviceDescription }) }),
11408
- /* @__PURE__ */ jsxs27("td", { children: [
11409
- /* @__PURE__ */ jsx29("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11410
- item.diagnosisDescription ? /* @__PURE__ */ jsx29("small", { children: item.diagnosisDescription }) : null
11488
+ return /* @__PURE__ */ jsxs28(Fragment17, { children: [
11489
+ /* @__PURE__ */ jsxs28("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11490
+ /* @__PURE__ */ jsx30("td", { children: index + 1 }),
11491
+ /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("strong", { children: item.serviceDescription }) }),
11492
+ /* @__PURE__ */ jsxs28("td", { children: [
11493
+ /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11494
+ item.diagnosisDescription ? /* @__PURE__ */ jsx30("small", { children: item.diagnosisDescription }) : null
11411
11495
  ] }),
11412
- /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11413
- /* @__PURE__ */ jsx29("td", { children: otherInformation(item) || "\u2014" }),
11414
- /* @__PURE__ */ jsxs27("td", { children: [
11415
- /* @__PURE__ */ jsx29(RfaPill, { tone: outcome.tone, children: outcome.label }),
11416
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11417
- item.authorizationNumber ? /* @__PURE__ */ jsxs27("small", { children: [
11496
+ /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11497
+ /* @__PURE__ */ jsx30("td", { children: otherInformation(item) || "\u2014" }),
11498
+ /* @__PURE__ */ jsxs28("td", { children: [
11499
+ /* @__PURE__ */ jsx30(RfaPill, { tone: outcome.tone, children: outcome.label }),
11500
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11501
+ item.authorizationNumber ? /* @__PURE__ */ jsxs28("small", { children: [
11418
11502
  "Authorization ",
11419
11503
  item.authorizationNumber
11420
11504
  ] }) : null,
11421
- item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs27("small", { children: [
11505
+ item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs28("small", { children: [
11422
11506
  "Authorized ",
11423
11507
  [item.authorizedProcedureCode || item.procedureCode, item.authorizedQuantity != null ? `quantity ${item.authorizedQuantity}` : "", item.authorizedUnits != null ? `units ${item.authorizedUnits}` : ""].filter(Boolean).join(" \xB7 ")
11424
11508
  ] }) : null,
11425
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs27("small", { children: [
11509
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("small", { children: [
11426
11510
  rfaCalendarDate(item.effectiveFrom) || "Not specified",
11427
11511
  " \u2013 ",
11428
11512
  rfaCalendarDate(item.effectiveTo) || "Not specified"
11429
11513
  ] }) : null,
11430
- /* @__PURE__ */ jsxs27("small", { children: [
11514
+ /* @__PURE__ */ jsxs28("small", { children: [
11431
11515
  "Decided ",
11432
11516
  rfaShortDate(item.decidedAt)
11433
11517
  ] })
11434
11518
  ] }) : null
11435
11519
  ] })
11436
11520
  ] }),
11437
- item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs27("tr", { className: "mbrfa-subrow", children: [
11438
- /* @__PURE__ */ jsx29("td", {}),
11439
- /* @__PURE__ */ jsx29("td", { colSpan: 5, children: /* @__PURE__ */ jsxs27("div", { className: "mbrfa-manage", children: [
11440
- item.decisionReason ? /* @__PURE__ */ jsx29("p", { children: item.decisionReason }) : null,
11441
- item.reviewerName ? /* @__PURE__ */ jsxs27("p", { children: [
11521
+ item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("tr", { className: "mbrfa-subrow", children: [
11522
+ /* @__PURE__ */ jsx30("td", {}),
11523
+ /* @__PURE__ */ jsx30("td", { colSpan: 5, children: /* @__PURE__ */ jsxs28("div", { className: "mbrfa-manage", children: [
11524
+ item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11525
+ item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11442
11526
  "Reviewer: ",
11443
11527
  item.reviewerName,
11444
11528
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
11445
11529
  ] }) : null,
11446
- item.decisionClosure ? /* @__PURE__ */ jsxs27("p", { children: [
11530
+ item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11447
11531
  item.decisionClosure.closed ? "Closed" : "Reopened",
11448
11532
  " by ",
11449
11533
  item.decisionClosure.updatedBy,
@@ -11452,125 +11536,125 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11452
11536
  " \u2014 ",
11453
11537
  item.decisionClosure.reason
11454
11538
  ] }) : null,
11455
- item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs27("div", { className: "mbtd-actions", children: [
11539
+ item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11456
11540
  evidence(item.currentResponseDocumentId, "View decision evidence"),
11457
11541
  evidence(item.currentImrDocumentId, "View independent medical review form")
11458
11542
  ] }) : null,
11459
- showAppointment ? /* @__PURE__ */ jsx29(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11543
+ showAppointment ? /* @__PURE__ */ jsx30(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11460
11544
  await client.updateScheduling(rfa.id, item.id, input, key2);
11461
11545
  return records.get(rfa.id);
11462
11546
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11463
- closable ? /* @__PURE__ */ jsx29(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11464
- correctable ? /* @__PURE__ */ jsxs27("details", { children: [
11465
- /* @__PURE__ */ jsx29("summary", { children: "Correct this decision" }),
11466
- /* @__PURE__ */ jsx29("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11467
- /* @__PURE__ */ jsx29(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11547
+ closable ? /* @__PURE__ */ jsx30(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11548
+ correctable ? /* @__PURE__ */ jsxs28("details", { children: [
11549
+ /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11550
+ /* @__PURE__ */ jsx30("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11551
+ /* @__PURE__ */ jsx30(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11468
11552
  ] }) : null
11469
11553
  ] }) })
11470
11554
  ] }) : null
11471
11555
  ] }, item.id);
11472
11556
  }) })
11473
- ] }) }) : /* @__PURE__ */ jsx29("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11474
- view !== "treatments" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11475
- /* @__PURE__ */ jsxs27(RfaCard, { title: "History", action: permissions.includes("edit") && !noteOpen ? /* @__PURE__ */ jsx29("button", { type: "button", disabled, onClick: () => setNoteOpen(true), children: "Add note" }) : null, flush: true, children: [
11476
- /* @__PURE__ */ jsx29("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11477
- loading ? /* @__PURE__ */ jsx29("p", { className: "mbrfa-sheet-body", children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-history-table", children: [
11478
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11479
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Date" }),
11480
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Action" }),
11481
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "User" }),
11482
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Details" })
11557
+ ] }) }) : /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11558
+ view !== "treatments" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11559
+ /* @__PURE__ */ jsxs28(RfaCard, { title: "History", action: permissions.includes("edit") && !noteOpen ? /* @__PURE__ */ jsx30("button", { type: "button", disabled, onClick: () => setNoteOpen(true), children: "Add note" }) : null, flush: true, children: [
11560
+ /* @__PURE__ */ jsx30("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11561
+ loading ? /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body", children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-history-table", children: [
11562
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11563
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11564
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11565
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11566
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11483
11567
  ] }) }),
11484
- /* @__PURE__ */ jsx29("tbody", { children: history.map((event) => /* @__PURE__ */ jsx29(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11485
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx29("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11568
+ /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11569
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11486
11570
  ] }),
11487
- rfa.transmissions.length ? /* @__PURE__ */ jsx29(RfaCard, { title: "Delivery", count: rfa.transmissions.length, flush: true, children: /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-grid-table", children: [
11488
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11489
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Date" }),
11490
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Method" }),
11491
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Status" }),
11492
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Recipient" }),
11493
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Confirmed receipt" }),
11494
- /* @__PURE__ */ jsx29("th", { scope: "col", children: /* @__PURE__ */ jsx29("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11571
+ rfa.transmissions.length ? /* @__PURE__ */ jsx30(RfaCard, { title: "Delivery", count: rfa.transmissions.length, flush: true, children: /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-grid-table", children: [
11572
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11573
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11574
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Method" }),
11575
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Status" }),
11576
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Recipient" }),
11577
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Confirmed receipt" }),
11578
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11495
11579
  ] }) }),
11496
- /* @__PURE__ */ jsx29("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs27("tr", { children: [
11497
- /* @__PURE__ */ jsx29("td", { children: rfaShortDate(transmission.occurredAt) }),
11498
- /* @__PURE__ */ jsxs27("td", { children: [
11580
+ /* @__PURE__ */ jsx30("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("tr", { children: [
11581
+ /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.occurredAt) }),
11582
+ /* @__PURE__ */ jsxs28("td", { children: [
11499
11583
  capital(words2(transmission.channel)),
11500
- /* @__PURE__ */ jsxs27("small", { children: [
11584
+ /* @__PURE__ */ jsxs28("small", { children: [
11501
11585
  capital(words2(transmission.direction)),
11502
11586
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : ""
11503
11587
  ] })
11504
11588
  ] }),
11505
- /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29(RfaPill, { tone: ["delivered", "received", "sent"].includes(transmission.status) ? "ok" : transmission.status === "failed" ? "bad" : "muted", children: capital(words2(transmission.status)) }) }),
11506
- /* @__PURE__ */ jsxs27("td", { children: [
11589
+ /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30(RfaPill, { tone: ["delivered", "received", "sent"].includes(transmission.status) ? "ok" : transmission.status === "failed" ? "bad" : "muted", children: capital(words2(transmission.status)) }) }),
11590
+ /* @__PURE__ */ jsxs28("td", { children: [
11507
11591
  transmission.destination || "\u2014",
11508
- transmission.providerMessageId ? /* @__PURE__ */ jsxs27("small", { children: [
11592
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs28("small", { children: [
11509
11593
  "Reference ",
11510
11594
  transmission.providerMessageId
11511
11595
  ] }) : null
11512
11596
  ] }),
11513
- /* @__PURE__ */ jsx29("td", { children: rfaShortDate(transmission.receivedAt) }),
11514
- /* @__PURE__ */ jsx29("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11597
+ /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.receivedAt) }),
11598
+ /* @__PURE__ */ jsx30("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11515
11599
  ] }, transmission.id)) })
11516
11600
  ] }) }) }) : null
11517
11601
  ] }) : null
11518
11602
  ] });
11519
- const content = /* @__PURE__ */ jsx29(Fragment17, { children: /* @__PURE__ */ jsxs27("div", { style: { display: "grid", gap: 16 }, children: [
11520
- error ? /* @__PURE__ */ jsx29("p", { role: "alert", children: error }) : null,
11521
- message ? /* @__PURE__ */ jsx29("p", { role: "status", children: message }) : null,
11522
- loadErrors.map((value) => /* @__PURE__ */ jsx29("p", { role: "alert", children: value }, value)),
11523
- /* @__PURE__ */ jsxs27("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11524
- /* @__PURE__ */ jsx29("h3", { children: "Requested treatments" }),
11603
+ const content = /* @__PURE__ */ jsx30(Fragment18, { children: /* @__PURE__ */ jsxs28("div", { style: { display: "grid", gap: 16 }, children: [
11604
+ error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11605
+ message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11606
+ loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11607
+ /* @__PURE__ */ jsxs28("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11608
+ /* @__PURE__ */ jsx30("h3", { children: "Requested treatments" }),
11525
11609
  rfa.items.map((item, index) => {
11526
11610
  const appointment = scheduling.find((value) => value.itemId === item.id);
11527
- return /* @__PURE__ */ jsxs27("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11528
- /* @__PURE__ */ jsxs27("legend", { children: [
11611
+ return /* @__PURE__ */ jsxs28("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11612
+ /* @__PURE__ */ jsxs28("legend", { children: [
11529
11613
  index + 1,
11530
11614
  ". ",
11531
11615
  item.serviceDescription
11532
11616
  ] }),
11533
- /* @__PURE__ */ jsxs27("p", { children: [
11617
+ /* @__PURE__ */ jsxs28("p", { children: [
11534
11618
  item.procedureCode || "No procedure code",
11535
11619
  " \xB7 Diagnosis ",
11536
11620
  item.diagnosisCode,
11537
11621
  " \xB7 ",
11538
11622
  item.decisionClosure?.closed ? "Decision no longer required" : words2(item.outcome)
11539
11623
  ] }),
11540
- /* @__PURE__ */ jsx29("dl", { className: "mbrfa-request-details", children: [["Diagnosis description", item.diagnosisDescription], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", item.requestedFrom], ["Requested through", item.requestedTo]].filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([title, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11541
- /* @__PURE__ */ jsx29("dt", { children: title }),
11542
- /* @__PURE__ */ jsx29("dd", { children: value })
11624
+ /* @__PURE__ */ jsx30("dl", { className: "mbrfa-request-details", children: [["Diagnosis description", item.diagnosisDescription], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", item.requestedFrom], ["Requested through", item.requestedTo]].filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([title, value]) => /* @__PURE__ */ jsxs28("div", { children: [
11625
+ /* @__PURE__ */ jsx30("dt", { children: title }),
11626
+ /* @__PURE__ */ jsx30("dd", { children: value })
11543
11627
  ] }, title)) }),
11544
- item.decisionClosure ? /* @__PURE__ */ jsxs27("p", { children: [
11628
+ item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11545
11629
  item.decisionClosure.closed ? "Closed" : "Reopened",
11546
11630
  " by ",
11547
11631
  item.decisionClosure.updatedBy,
11548
11632
  " \xB7 ",
11549
11633
  date5(item.decisionClosure.updatedAt),
11550
- /* @__PURE__ */ jsx29("br", {}),
11634
+ /* @__PURE__ */ jsx30("br", {}),
11551
11635
  item.decisionClosure.reason
11552
11636
  ] }) : null,
11553
- canClose && item.outcome === "pending" && !item.decidedAt ? /* @__PURE__ */ jsx29(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11554
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11555
- /* @__PURE__ */ jsxs27("p", { children: [
11637
+ canClose && item.outcome === "pending" && !item.decidedAt ? /* @__PURE__ */ jsx30(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11638
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11639
+ /* @__PURE__ */ jsxs28("p", { children: [
11556
11640
  "Decision: ",
11557
11641
  date5(item.decidedAt),
11558
11642
  item.authorizationNumber ? ` \xB7 Authorization ${item.authorizationNumber}` : ""
11559
11643
  ] }),
11560
- item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs27("p", { children: [
11644
+ item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs28("p", { children: [
11561
11645
  "Authorized: ",
11562
11646
  item.authorizedProcedureCode || item.procedureCode || "Treatment",
11563
11647
  item.authorizedQuantity != null ? ` \xB7 Quantity ${item.authorizedQuantity}` : "",
11564
11648
  item.authorizedUnits != null ? ` \xB7 Units ${item.authorizedUnits}` : ""
11565
11649
  ] }) : null,
11566
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs27("p", { children: [
11650
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("p", { children: [
11567
11651
  "Authorization dates: ",
11568
11652
  item.effectiveFrom ?? "Not specified",
11569
11653
  " through ",
11570
11654
  item.effectiveTo ?? "Not specified"
11571
11655
  ] }) : null,
11572
- item.decisionReason ? /* @__PURE__ */ jsx29("p", { children: item.decisionReason }) : null,
11573
- item.reviewerName ? /* @__PURE__ */ jsxs27("p", { children: [
11656
+ item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11657
+ item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11574
11658
  "Reviewer: ",
11575
11659
  item.reviewerName,
11576
11660
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
@@ -11579,57 +11663,57 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11579
11663
  " ",
11580
11664
  evidence(item.currentImrDocumentId, "View independent medical review form")
11581
11665
  ] }) : null,
11582
- loading ? /* @__PURE__ */ jsx29("p", { children: "Loading appointment\u2026" }) : appointment ? /* @__PURE__ */ jsx29(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11666
+ loading ? /* @__PURE__ */ jsx30("p", { children: "Loading appointment\u2026" }) : appointment ? /* @__PURE__ */ jsx30(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11583
11667
  await client.updateScheduling(rfa.id, item.id, input, key2);
11584
11668
  return records.get(rfa.id);
11585
11669
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11586
- canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs27("details", { children: [
11587
- /* @__PURE__ */ jsx29("summary", { children: "Correct this decision" }),
11588
- /* @__PURE__ */ jsx29("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11589
- /* @__PURE__ */ jsx29(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11670
+ canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs28("details", { children: [
11671
+ /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11672
+ /* @__PURE__ */ jsx30("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11673
+ /* @__PURE__ */ jsx30(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11590
11674
  ] }) : null
11591
11675
  ] }, item.id);
11592
11676
  })
11593
11677
  ] }),
11594
- /* @__PURE__ */ jsxs27("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11595
- /* @__PURE__ */ jsxs27("details", { className: "mbrfa-delivery-evidence", children: [
11596
- /* @__PURE__ */ jsxs27("summary", { children: [
11678
+ /* @__PURE__ */ jsxs28("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11679
+ /* @__PURE__ */ jsxs28("details", { className: "mbrfa-delivery-evidence", children: [
11680
+ /* @__PURE__ */ jsxs28("summary", { children: [
11597
11681
  "Delivery evidence (",
11598
11682
  rfa.transmissions.length,
11599
11683
  ")"
11600
11684
  ] }),
11601
- rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs27("article", { style: { paddingBlock: 8 }, children: [
11602
- /* @__PURE__ */ jsxs27("strong", { children: [
11685
+ rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("article", { style: { paddingBlock: 8 }, children: [
11686
+ /* @__PURE__ */ jsxs28("strong", { children: [
11603
11687
  words2(transmission.channel),
11604
11688
  " \xB7 ",
11605
11689
  words2(transmission.status)
11606
11690
  ] }),
11607
- /* @__PURE__ */ jsxs27("p", { children: [
11691
+ /* @__PURE__ */ jsxs28("p", { children: [
11608
11692
  words2(transmission.direction),
11609
11693
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : "",
11610
11694
  " \xB7 ",
11611
11695
  date5(transmission.occurredAt)
11612
11696
  ] }),
11613
- transmission.destination ? /* @__PURE__ */ jsxs27("p", { children: [
11697
+ transmission.destination ? /* @__PURE__ */ jsxs28("p", { children: [
11614
11698
  "Recipient: ",
11615
11699
  transmission.destination
11616
11700
  ] }) : null,
11617
- transmission.providerMessageId ? /* @__PURE__ */ jsxs27("p", { children: [
11701
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs28("p", { children: [
11618
11702
  "Delivery reference: ",
11619
11703
  transmission.providerMessageId
11620
11704
  ] }) : null,
11621
- transmission.receivedAt ? /* @__PURE__ */ jsxs27("p", { children: [
11705
+ transmission.receivedAt ? /* @__PURE__ */ jsxs28("p", { children: [
11622
11706
  "Confirmed receipt: ",
11623
11707
  date5(transmission.receivedAt)
11624
11708
  ] }) : null,
11625
11709
  evidence(transmission.proofDocumentId, "Download transmission receipt")
11626
- ] }, transmission.id)) : /* @__PURE__ */ jsx29("p", { children: "No transmission evidence has been recorded." })
11710
+ ] }, transmission.id)) : /* @__PURE__ */ jsx30("p", { children: "No transmission evidence has been recorded." })
11627
11711
  ] }),
11628
- /* @__PURE__ */ jsxs27("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11629
- /* @__PURE__ */ jsx29("h3", { children: "History and notes" }),
11630
- permissions.includes("edit") ? /* @__PURE__ */ jsxs27("details", { className: "mbrfa-note-form", children: [
11631
- /* @__PURE__ */ jsx29("summary", { children: "Add a note" }),
11632
- /* @__PURE__ */ jsx29("form", { onSubmit: (event) => {
11712
+ /* @__PURE__ */ jsxs28("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11713
+ /* @__PURE__ */ jsx30("h3", { children: "History and notes" }),
11714
+ permissions.includes("edit") ? /* @__PURE__ */ jsxs28("details", { className: "mbrfa-note-form", children: [
11715
+ /* @__PURE__ */ jsx30("summary", { children: "Add a note" }),
11716
+ /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11633
11717
  event.preventDefault();
11634
11718
  const form = event.currentTarget;
11635
11719
  try {
@@ -11643,51 +11727,51 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11643
11727
  } catch (reason) {
11644
11728
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11645
11729
  }
11646
- }, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11647
- /* @__PURE__ */ jsx29("legend", { children: "Add a note" }),
11648
- /* @__PURE__ */ jsxs27("label", { children: [
11730
+ }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11731
+ /* @__PURE__ */ jsx30("legend", { children: "Add a note" }),
11732
+ /* @__PURE__ */ jsxs28("label", { children: [
11649
11733
  "Note",
11650
- /* @__PURE__ */ jsx29("textarea", { name: "note", required: true, maxLength: 1e4 })
11734
+ /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4 })
11651
11735
  ] }),
11652
- /* @__PURE__ */ jsx29("button", { type: "submit", children: "Save note" })
11736
+ /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save note" })
11653
11737
  ] }) })
11654
11738
  ] }) : null,
11655
- loading ? /* @__PURE__ */ jsx29("p", { children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-history-table", children: [
11656
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11657
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Date" }),
11658
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Action" }),
11659
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "User" }),
11660
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Details" })
11739
+ loading ? /* @__PURE__ */ jsx30("p", { children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-history-table", children: [
11740
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11741
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11742
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11743
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11744
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11661
11745
  ] }) }),
11662
- /* @__PURE__ */ jsx29("tbody", { children: history.map((event) => /* @__PURE__ */ jsx29(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11663
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx29("p", { children: "No history entries have been recorded." }) : null
11746
+ /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11747
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { children: "No history entries have been recorded." }) : null
11664
11748
  ] })
11665
11749
  ] })
11666
11750
  ] }) });
11667
- if (cards) return /* @__PURE__ */ jsx29("div", { className: "mbrfa-tracking", children: cardContent });
11668
- return embedded ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-tracking", children: content }) : /* @__PURE__ */ jsxs27(TreatmentDraftShell, { ...appearance, title: "Treatments and history", description: "Review each treatment's authorization, appointments, delivery evidence, and notes.", children: [
11669
- /* @__PURE__ */ jsx29("style", { children: rfaDetailCss }),
11751
+ if (cards) return /* @__PURE__ */ jsx30("div", { className: "mbrfa-tracking", children: cardContent });
11752
+ return embedded ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-tracking", children: content }) : /* @__PURE__ */ jsxs28(TreatmentDraftShell, { ...appearance, title: "Treatments and history", description: "Review each treatment's authorization, appointments, delivery evidence, and notes.", children: [
11753
+ /* @__PURE__ */ jsx30("style", { children: rfaDetailCss }),
11670
11754
  content
11671
11755
  ] });
11672
11756
  }
11673
11757
  function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11674
- const [disposition, setDisposition] = useState17(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11675
- return /* @__PURE__ */ jsxs27("section", { children: [
11676
- /* @__PURE__ */ jsx29("h4", { children: "Appointment" }),
11677
- /* @__PURE__ */ jsxs27("p", { children: [
11758
+ const [disposition, setDisposition] = useState18(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11759
+ return /* @__PURE__ */ jsxs28("section", { children: [
11760
+ /* @__PURE__ */ jsx30("h4", { children: "Appointment" }),
11761
+ /* @__PURE__ */ jsxs28("p", { children: [
11678
11762
  words2(appointment.disposition),
11679
11763
  appointment.appointmentAt ? ` \xB7 ${date5(appointment.appointmentAt)}` : ""
11680
11764
  ] }),
11681
- appointment.providerName ? /* @__PURE__ */ jsxs27("p", { children: [
11765
+ appointment.providerName ? /* @__PURE__ */ jsxs28("p", { children: [
11682
11766
  appointment.providerName,
11683
11767
  " \xB7 ",
11684
11768
  appointment.location
11685
11769
  ] }) : null,
11686
- appointment.reason ? /* @__PURE__ */ jsx29("p", { children: appointment.reason }) : null,
11687
- appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx29("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11688
- editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs27("details", { children: [
11689
- /* @__PURE__ */ jsx29("summary", { children: "Update appointment" }),
11690
- /* @__PURE__ */ jsx29("form", { onSubmit: (event) => {
11770
+ appointment.reason ? /* @__PURE__ */ jsx30("p", { children: appointment.reason }) : null,
11771
+ appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx30("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11772
+ editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs28("details", { children: [
11773
+ /* @__PURE__ */ jsx30("summary", { children: "Update appointment" }),
11774
+ /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11691
11775
  event.preventDefault();
11692
11776
  if (disabled) return;
11693
11777
  try {
@@ -11698,42 +11782,42 @@ function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11698
11782
  } catch (reason) {
11699
11783
  onError(reason instanceof Error ? reason.message : "Review the appointment details.");
11700
11784
  }
11701
- }, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11702
- /* @__PURE__ */ jsx29("legend", { children: "Appointment details" }),
11703
- /* @__PURE__ */ jsxs27("label", { children: [
11785
+ }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11786
+ /* @__PURE__ */ jsx30("legend", { children: "Appointment details" }),
11787
+ /* @__PURE__ */ jsxs28("label", { children: [
11704
11788
  "Disposition",
11705
- /* @__PURE__ */ jsxs27("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11706
- appointment.eligible ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11707
- /* @__PURE__ */ jsx29("option", { value: "scheduled", children: "Scheduled" }),
11708
- /* @__PURE__ */ jsx29("option", { value: "no_appointment", children: "No appointment needed" })
11789
+ /* @__PURE__ */ jsxs28("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11790
+ appointment.eligible ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11791
+ /* @__PURE__ */ jsx30("option", { value: "scheduled", children: "Scheduled" }),
11792
+ /* @__PURE__ */ jsx30("option", { value: "no_appointment", children: "No appointment needed" })
11709
11793
  ] }) : null,
11710
- appointment.version > 0 ? /* @__PURE__ */ jsx29("option", { value: "canceled", children: "Canceled" }) : null
11794
+ appointment.version > 0 ? /* @__PURE__ */ jsx30("option", { value: "canceled", children: "Canceled" }) : null
11711
11795
  ] })
11712
11796
  ] }),
11713
- disposition === "scheduled" ? /* @__PURE__ */ jsxs27("div", { className: "mbtd-grid", children: [
11714
- /* @__PURE__ */ jsxs27("label", { children: [
11797
+ disposition === "scheduled" ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11798
+ /* @__PURE__ */ jsxs28("label", { children: [
11715
11799
  "Date and time (your local time)",
11716
- /* @__PURE__ */ jsx29("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11800
+ /* @__PURE__ */ jsx30("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11717
11801
  ] }),
11718
- /* @__PURE__ */ jsxs27("label", { children: [
11802
+ /* @__PURE__ */ jsxs28("label", { children: [
11719
11803
  "Provider name",
11720
- /* @__PURE__ */ jsx29("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11804
+ /* @__PURE__ */ jsx30("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11721
11805
  ] }),
11722
- /* @__PURE__ */ jsxs27("label", { children: [
11806
+ /* @__PURE__ */ jsxs28("label", { children: [
11723
11807
  "Location",
11724
- /* @__PURE__ */ jsx29("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11808
+ /* @__PURE__ */ jsx30("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11725
11809
  ] })
11726
- ] }) : /* @__PURE__ */ jsxs27("label", { children: [
11810
+ ] }) : /* @__PURE__ */ jsxs28("label", { children: [
11727
11811
  "Reason",
11728
- /* @__PURE__ */ jsx29("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11812
+ /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11729
11813
  ] }),
11730
- /* @__PURE__ */ jsx29("button", { type: "submit", children: "Save appointment" })
11814
+ /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save appointment" })
11731
11815
  ] }) })
11732
- ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx29("p", { children: "Appointments become available after treatment is authorized." }) : null
11816
+ ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx30("p", { children: "Appointments become available after treatment is authorized." }) : null
11733
11817
  ] });
11734
11818
  }
11735
11819
  function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11736
- const [outcome, setOutcome] = useState17(item.outcome);
11820
+ const [outcome, setOutcome] = useState18(item.outcome);
11737
11821
  const submit = (event) => {
11738
11822
  event.preventDefault();
11739
11823
  if (disabled) return;
@@ -11757,90 +11841,90 @@ function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11757
11841
  onError(reason instanceof Error ? reason.message : "Review the correction details.");
11758
11842
  }
11759
11843
  };
11760
- return /* @__PURE__ */ jsx29("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11761
- /* @__PURE__ */ jsx29("legend", { children: "Decision correction" }),
11762
- /* @__PURE__ */ jsxs27("div", { className: "mbtd-grid", children: [
11763
- /* @__PURE__ */ jsxs27("label", { children: [
11844
+ return /* @__PURE__ */ jsx30("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11845
+ /* @__PURE__ */ jsx30("legend", { children: "Decision correction" }),
11846
+ /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11847
+ /* @__PURE__ */ jsxs28("label", { children: [
11764
11848
  "Correction reason",
11765
- /* @__PURE__ */ jsx29("textarea", { name: "reason", required: true, maxLength: 2e4 })
11849
+ /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e4 })
11766
11850
  ] }),
11767
- /* @__PURE__ */ jsxs27("label", { children: [
11851
+ /* @__PURE__ */ jsxs28("label", { children: [
11768
11852
  "Corrected decision",
11769
- /* @__PURE__ */ jsxs27("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11770
- /* @__PURE__ */ jsx29("option", { value: "approved", children: "Approved" }),
11771
- /* @__PURE__ */ jsx29("option", { value: "modified", children: "Modified" }),
11772
- /* @__PURE__ */ jsx29("option", { value: "denied", children: "Denied" })
11853
+ /* @__PURE__ */ jsxs28("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11854
+ /* @__PURE__ */ jsx30("option", { value: "approved", children: "Approved" }),
11855
+ /* @__PURE__ */ jsx30("option", { value: "modified", children: "Modified" }),
11856
+ /* @__PURE__ */ jsx30("option", { value: "denied", children: "Denied" })
11773
11857
  ] })
11774
11858
  ] }),
11775
- /* @__PURE__ */ jsxs27("label", { children: [
11859
+ /* @__PURE__ */ jsxs28("label", { children: [
11776
11860
  "Decision time",
11777
- /* @__PURE__ */ jsx29("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11861
+ /* @__PURE__ */ jsx30("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11778
11862
  ] }),
11779
- /* @__PURE__ */ jsxs27("label", { children: [
11863
+ /* @__PURE__ */ jsxs28("label", { children: [
11780
11864
  "Decision response evidence",
11781
- /* @__PURE__ */ jsxs27("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11782
- /* @__PURE__ */ jsx29("option", { value: "", children: "Choose evidence" }),
11783
- documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx29("option", { value: document2.id, children: document2.filename }, document2.id))
11865
+ /* @__PURE__ */ jsxs28("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11866
+ /* @__PURE__ */ jsx30("option", { value: "", children: "Choose evidence" }),
11867
+ documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
11784
11868
  ] })
11785
11869
  ] }),
11786
- outcome !== "approved" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11787
- /* @__PURE__ */ jsxs27("label", { children: [
11870
+ outcome !== "approved" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11871
+ /* @__PURE__ */ jsxs28("label", { children: [
11788
11872
  "Independent medical review form",
11789
- /* @__PURE__ */ jsxs27("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
11790
- /* @__PURE__ */ jsx29("option", { value: "", children: "Choose a form" }),
11791
- documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx29("option", { value: document2.id, children: document2.filename }, document2.id))
11873
+ /* @__PURE__ */ jsxs28("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
11874
+ /* @__PURE__ */ jsx30("option", { value: "", children: "Choose a form" }),
11875
+ documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
11792
11876
  ] })
11793
11877
  ] }),
11794
- /* @__PURE__ */ jsxs27("label", { children: [
11878
+ /* @__PURE__ */ jsxs28("label", { children: [
11795
11879
  "Decision reason",
11796
- /* @__PURE__ */ jsx29("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
11880
+ /* @__PURE__ */ jsx30("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
11797
11881
  ] }),
11798
- /* @__PURE__ */ jsxs27("label", { children: [
11882
+ /* @__PURE__ */ jsxs28("label", { children: [
11799
11883
  "Reviewer name",
11800
- /* @__PURE__ */ jsx29("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
11884
+ /* @__PURE__ */ jsx30("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
11801
11885
  ] }),
11802
- /* @__PURE__ */ jsxs27("label", { children: [
11886
+ /* @__PURE__ */ jsxs28("label", { children: [
11803
11887
  "Reviewer phone",
11804
- /* @__PURE__ */ jsx29("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
11888
+ /* @__PURE__ */ jsx30("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
11805
11889
  ] })
11806
11890
  ] }) : null,
11807
- outcome !== "denied" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11808
- /* @__PURE__ */ jsxs27("label", { children: [
11891
+ outcome !== "denied" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11892
+ /* @__PURE__ */ jsxs28("label", { children: [
11809
11893
  "Authorization number",
11810
- /* @__PURE__ */ jsx29("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
11894
+ /* @__PURE__ */ jsx30("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
11811
11895
  ] }),
11812
- /* @__PURE__ */ jsxs27("label", { children: [
11896
+ /* @__PURE__ */ jsxs28("label", { children: [
11813
11897
  "Authorized procedure code",
11814
- /* @__PURE__ */ jsx29("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
11898
+ /* @__PURE__ */ jsx30("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
11815
11899
  ] }),
11816
- /* @__PURE__ */ jsxs27("label", { children: [
11900
+ /* @__PURE__ */ jsxs28("label", { children: [
11817
11901
  "Authorized quantity",
11818
- /* @__PURE__ */ jsx29("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
11902
+ /* @__PURE__ */ jsx30("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
11819
11903
  ] }),
11820
- /* @__PURE__ */ jsxs27("label", { children: [
11904
+ /* @__PURE__ */ jsxs28("label", { children: [
11821
11905
  "Authorized units",
11822
- /* @__PURE__ */ jsx29("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
11906
+ /* @__PURE__ */ jsx30("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
11823
11907
  ] }),
11824
- /* @__PURE__ */ jsxs27("label", { children: [
11908
+ /* @__PURE__ */ jsxs28("label", { children: [
11825
11909
  "Effective from",
11826
- /* @__PURE__ */ jsx29("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
11910
+ /* @__PURE__ */ jsx30("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
11827
11911
  ] }),
11828
- /* @__PURE__ */ jsxs27("label", { children: [
11912
+ /* @__PURE__ */ jsxs28("label", { children: [
11829
11913
  "Effective through",
11830
- /* @__PURE__ */ jsx29("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
11914
+ /* @__PURE__ */ jsx30("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
11831
11915
  ] })
11832
11916
  ] }) : null
11833
11917
  ] }),
11834
- /* @__PURE__ */ jsx29("button", { type: "submit", children: "Save decision correction" })
11918
+ /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save decision correction" })
11835
11919
  ] }) });
11836
11920
  }
11837
11921
  function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11838
11922
  const closed = Boolean(item.decisionClosure?.closed);
11839
11923
  const title = closed ? "Reopen treatment follow-up" : "Decision no longer required";
11840
- return /* @__PURE__ */ jsxs27("details", { children: [
11841
- /* @__PURE__ */ jsx29("summary", { children: title }),
11842
- /* @__PURE__ */ jsx29("p", { children: closed ? "Resume waiting for a decision on this treatment. Its original review deadline still applies." : "Close follow-up for this treatment without recording an approval or denial. Other treatments remain active. This does not withdraw the request with the claims administrator." }),
11843
- /* @__PURE__ */ jsx29("form", { onSubmit: (event) => {
11924
+ return /* @__PURE__ */ jsxs28("details", { children: [
11925
+ /* @__PURE__ */ jsx30("summary", { children: title }),
11926
+ /* @__PURE__ */ jsx30("p", { children: closed ? "Resume waiting for a decision on this treatment. Its original review deadline still applies." : "Close follow-up for this treatment without recording an approval or denial. Other treatments remain active. This does not withdraw the request with the claims administrator." }),
11927
+ /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11844
11928
  event.preventDefault();
11845
11929
  if (disabled) return;
11846
11930
  try {
@@ -11849,104 +11933,104 @@ function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11849
11933
  } catch (reason) {
11850
11934
  onError(reason instanceof Error ? reason.message : "Enter a reason.");
11851
11935
  }
11852
- }, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11853
- /* @__PURE__ */ jsx29("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
11854
- /* @__PURE__ */ jsxs27("label", { children: [
11936
+ }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11937
+ /* @__PURE__ */ jsx30("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
11938
+ /* @__PURE__ */ jsxs28("label", { children: [
11855
11939
  closed ? "Reason for reopening" : "Reason a decision is no longer required",
11856
- /* @__PURE__ */ jsx29("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
11940
+ /* @__PURE__ */ jsx30("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
11857
11941
  ] }),
11858
- /* @__PURE__ */ jsx29("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx29("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
11942
+ /* @__PURE__ */ jsx30("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx30("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
11859
11943
  ] }) })
11860
11944
  ] });
11861
11945
  }
11862
11946
 
11863
11947
  // src/rfa-request-summary.tsx
11864
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11948
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
11865
11949
  var readable = (value) => value.replaceAll("_", " ");
11866
11950
  var calendarDate = (value) => value?.match(/^\d{4}-\d{2}-\d{2}/)?.[0] ?? value;
11867
11951
  function Details({ entries }) {
11868
- return /* @__PURE__ */ jsx30("dl", { className: "mbrfa-request-details", children: entries.filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([name, value]) => /* @__PURE__ */ jsxs28("div", { children: [
11869
- /* @__PURE__ */ jsx30("dt", { children: name }),
11870
- /* @__PURE__ */ jsx30("dd", { children: value })
11952
+ return /* @__PURE__ */ jsx31("dl", { className: "mbrfa-request-details", children: entries.filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([name, value]) => /* @__PURE__ */ jsxs29("div", { children: [
11953
+ /* @__PURE__ */ jsx31("dt", { children: name }),
11954
+ /* @__PURE__ */ jsx31("dd", { children: value })
11871
11955
  ] }, name)) });
11872
11956
  }
11873
11957
  function Contact({ title, contact }) {
11874
11958
  const entries = [["Name", contact?.name], ["Contact", contact?.contactName], ["Address", contact?.address], ["City", contact?.city], ["State", contact?.state], ["ZIP", contact?.zip], ["Phone", contact?.phone], ["Fax", contact?.fax], ["Email", contact?.email]];
11875
- return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11876
- /* @__PURE__ */ jsx30("h3", { children: title }),
11877
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx30(Details, { entries }) : /* @__PURE__ */ jsx30("p", { children: "Not recorded." }) })
11959
+ return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11960
+ /* @__PURE__ */ jsx31("h3", { children: title }),
11961
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx31(Details, { entries }) : /* @__PURE__ */ jsx31("p", { children: "Not recorded." }) })
11878
11962
  ] });
11879
11963
  }
11880
11964
  function RfaRequestSummary({ rfa, onViewClaimsAdministrator, getPatientHref, getClaimHref, getProviderHref, hideTreatments = false, collapseContacts = false }) {
11881
- const contacts2 = /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11882
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11883
- /* @__PURE__ */ jsx30("h3", { children: "Patient and injury" }),
11884
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Patient", /* @__PURE__ */ jsx30(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName })], ["Claim number", /* @__PURE__ */ jsx30(RfaLink, { href: getClaimHref?.(rfa), children: rfa.claimNumber || "Not recorded" })], ["Injury", rfa.injuryDescription ? /* @__PURE__ */ jsx30(RfaLink, { href: getClaimHref?.(rfa), children: rfa.injuryDescription }) : null], ["Date of injury", calendarDate(rfa.dateOfInjury) || "Not recorded"]] }) })
11965
+ const contacts2 = /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11966
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11967
+ /* @__PURE__ */ jsx31("h3", { children: "Patient and injury" }),
11968
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Patient", /* @__PURE__ */ jsx31(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName })], ["Claim number", /* @__PURE__ */ jsx31(RfaLink, { href: getClaimHref?.(rfa), children: rfa.claimNumber || "Not recorded" })], ["Injury", rfa.injuryDescription ? /* @__PURE__ */ jsx31(RfaLink, { href: getClaimHref?.(rfa), children: rfa.injuryDescription }) : null], ["Date of injury", calendarDate(rfa.dateOfInjury) || "Not recorded"]] }) })
11885
11969
  ] }),
11886
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11887
- /* @__PURE__ */ jsx30("h3", { children: "Requesting physician" }),
11888
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Name", /* @__PURE__ */ jsx30(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName })], ["NPI", rfa.providerNpi], ["Phone", rfa.providerPhone], ["Fax", rfa.providerFax]] }) })
11970
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11971
+ /* @__PURE__ */ jsx31("h3", { children: "Requesting physician" }),
11972
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Name", /* @__PURE__ */ jsx31(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName })], ["NPI", rfa.providerNpi], ["Phone", rfa.providerPhone], ["Fax", rfa.providerFax]] }) })
11889
11973
  ] }),
11890
- /* @__PURE__ */ jsx30(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
11891
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11892
- /* @__PURE__ */ jsx30("h3", { children: "Claims administrator" }),
11893
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Name", /* @__PURE__ */ jsx30(RfaLink, { onSelect: onViewClaimsAdministrator, children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" })], ["Contact", rfa.authorizationContact?.contactName], ["Phone", rfa.authorizationContact?.phone], ["Fax", rfa.authorizationContact?.fax], ["Email", rfa.authorizationContact?.email], ["Address", [rfa.authorizationContact?.address, rfa.authorizationContact?.city, rfa.authorizationContact?.state, rfa.authorizationContact?.zip].filter(Boolean).join(", ")]] }) })
11974
+ /* @__PURE__ */ jsx31(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
11975
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11976
+ /* @__PURE__ */ jsx31("h3", { children: "Claims administrator" }),
11977
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Name", /* @__PURE__ */ jsx31(RfaLink, { onSelect: onViewClaimsAdministrator, children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" })], ["Contact", rfa.authorizationContact?.contactName], ["Phone", rfa.authorizationContact?.phone], ["Fax", rfa.authorizationContact?.fax], ["Email", rfa.authorizationContact?.email], ["Address", [rfa.authorizationContact?.address, rfa.authorizationContact?.city, rfa.authorizationContact?.state, rfa.authorizationContact?.zip].filter(Boolean).join(", ")]] }) })
11894
11978
  ] })
11895
11979
  ] });
11896
- return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
11897
- /* @__PURE__ */ jsx30("style", { children: `.mbrfa-request-details{display:grid;gap:9px;margin:0}.mbrfa-request-details>div{min-width:0}.mbrfa-request-details dt{font-size:12px;color:var(--mb-muted)}.mbrfa-request-details dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.mbrfa-request h3{font-size:16px;margin:0}.mbrfa-request-treatments{display:grid;gap:14px}.mbrfa-request-treatments article{border-top:1px solid var(--mb-border);padding-top:12px}.mbrfa-request-treatments article:first-child{border-top:0;padding-top:0}.mbrfa-request-treatments h4{margin:0 0 10px;overflow-wrap:anywhere}.mbrfa-request-treatments dl{grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:520px){.mbrfa-request-treatments dl{grid-template-columns:minmax(0,1fr)}}` }),
11980
+ return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
11981
+ /* @__PURE__ */ jsx31("style", { children: `.mbrfa-request-details{display:grid;gap:9px;margin:0}.mbrfa-request-details>div{min-width:0}.mbrfa-request-details dt{font-size:12px;color:var(--mb-muted)}.mbrfa-request-details dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.mbrfa-request h3{font-size:16px;margin:0}.mbrfa-request-treatments{display:grid;gap:14px}.mbrfa-request-treatments article{border-top:1px solid var(--mb-border);padding-top:12px}.mbrfa-request-treatments article:first-child{border-top:0;padding-top:0}.mbrfa-request-treatments h4{margin:0 0 10px;overflow-wrap:anywhere}.mbrfa-request-treatments dl{grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:520px){.mbrfa-request-treatments dl{grid-template-columns:minmax(0,1fr)}}` }),
11898
11982
  !collapseContacts ? contacts2 : null,
11899
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11900
- /* @__PURE__ */ jsx30("h3", { children: "Request information" }),
11901
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Request", rfa.requestType ? readable(rfa.requestType) : "Not recorded"], ["Review type", readable(rfa.reviewType)], ["Expedited review", rfa.expedited ? "Yes" : "No"], ["Written confirmation of prior oral request", rfa.writtenConfirmation || rfa.requestType === "oral_authorization_confirmation" ? "Yes" : "No"], ["Place of service", rfa.placeOfServiceCode], ["Clinical rationale", rfa.rationale], ["Change in material facts", rfa.materialChange]] }) })
11983
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11984
+ /* @__PURE__ */ jsx31("h3", { children: "Request information" }),
11985
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Request", rfa.requestType ? readable(rfa.requestType) : "Not recorded"], ["Review type", readable(rfa.reviewType)], ["Expedited review", rfa.expedited ? "Yes" : "No"], ["Written confirmation of prior oral request", rfa.writtenConfirmation || rfa.requestType === "oral_authorization_confirmation" ? "Yes" : "No"], ["Place of service", rfa.placeOfServiceCode], ["Clinical rationale", rfa.rationale], ["Change in material facts", rfa.materialChange]] }) })
11902
11986
  ] }),
11903
- collapseContacts ? /* @__PURE__ */ jsxs28("details", { className: "mbrfa-detail-card", children: [
11904
- /* @__PURE__ */ jsx30("summary", { children: "Patient, physician & claim details" }),
11987
+ collapseContacts ? /* @__PURE__ */ jsxs29("details", { className: "mbrfa-detail-card", children: [
11988
+ /* @__PURE__ */ jsx31("summary", { children: "Patient, physician & claim details" }),
11905
11989
  contacts2
11906
11990
  ] }) : null,
11907
- !hideTreatments ? /* @__PURE__ */ jsxs28("fieldset", { children: [
11908
- /* @__PURE__ */ jsx30("legend", { children: "Requested services" }),
11909
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs28("article", { children: [
11910
- /* @__PURE__ */ jsxs28("h4", { children: [
11991
+ !hideTreatments ? /* @__PURE__ */ jsxs29("fieldset", { children: [
11992
+ /* @__PURE__ */ jsx31("legend", { children: "Requested services" }),
11993
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs29("article", { children: [
11994
+ /* @__PURE__ */ jsxs29("h4", { children: [
11911
11995
  index + 1,
11912
11996
  ". ",
11913
11997
  item.serviceDescription
11914
11998
  ] }),
11915
- /* @__PURE__ */ jsx30(Details, { entries: [["Diagnosis", item.diagnosisCode], ["Diagnosis description", item.diagnosisDescription], ["CPT / HCPCS", item.procedureCode || "Not specified"], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", calendarDate(item.requestedFrom)], ["Requested through", calendarDate(item.requestedTo)]] })
11999
+ /* @__PURE__ */ jsx31(Details, { entries: [["Diagnosis", item.diagnosisCode], ["Diagnosis description", item.diagnosisDescription], ["CPT / HCPCS", item.procedureCode || "Not specified"], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", calendarDate(item.requestedFrom)], ["Requested through", calendarDate(item.requestedTo)]] })
11916
12000
  ] }, item.id)) }),
11917
- rfa.items.length === 0 ? /* @__PURE__ */ jsx30("p", { children: "No services recorded." }) : null
12001
+ rfa.items.length === 0 ? /* @__PURE__ */ jsx31("p", { children: "No services recorded." }) : null
11918
12002
  ] }) : null
11919
12003
  ] });
11920
12004
  }
11921
12005
 
11922
12006
  // src/rfa-packets.tsx
11923
- import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef14, useState as useState18 } from "react";
12007
+ import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef15, useState as useState19 } from "react";
11924
12008
  import { createRfaPacketsClient } from "@mindbill/browser";
11925
- import { Fragment as Fragment18, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
12009
+ import { Fragment as Fragment19, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
11926
12010
  function RfaPacketsPanel({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
11927
12011
  const options = useMemo9(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
11928
12012
  const identity = useMemo9(() => crypto.randomUUID(), [options]);
11929
- return /* @__PURE__ */ jsx31(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
12013
+ return /* @__PURE__ */ jsx32(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
11930
12014
  }
11931
12015
  function PacketsContent({ rfa, options, permissions = [], environment = "sandbox", disabled = false, onForwarded }) {
11932
12016
  const client = useMemo9(() => createRfaPacketsClient(options), [options]);
11933
- const [history, setHistory] = useState18(null);
11934
- const [selected, setSelected] = useState18("");
11935
- const [prepared, setPrepared] = useState18(null);
11936
- const [channel, setChannel] = useState18("fax");
11937
- const [recipient, setRecipient] = useState18("");
11938
- const [reviewed, setReviewed] = useState18(false);
11939
- const [confirmed, setConfirmed] = useState18(false);
11940
- const [loading, setLoading] = useState18(true);
11941
- const [busy, setBusy] = useState18(false);
11942
- const [error, setError] = useState18("");
11943
- const [notice, setNotice] = useState18("");
11944
- const [reload, setReload] = useState18(0);
11945
- const pending = useRef14(false);
11946
- const keys = useRef14(/* @__PURE__ */ new Map());
11947
- const completed = useRef14(/* @__PURE__ */ new Set());
11948
- const alive = useRef14(true);
11949
- const currentSelection = useRef14(selected);
12017
+ const [history, setHistory] = useState19(null);
12018
+ const [selected, setSelected] = useState19("");
12019
+ const [prepared, setPrepared] = useState19(null);
12020
+ const [channel, setChannel] = useState19("fax");
12021
+ const [recipient, setRecipient] = useState19("");
12022
+ const [reviewed, setReviewed] = useState19(false);
12023
+ const [confirmed, setConfirmed] = useState19(false);
12024
+ const [loading, setLoading] = useState19(true);
12025
+ const [busy, setBusy] = useState19(false);
12026
+ const [error, setError] = useState19("");
12027
+ const [notice, setNotice] = useState19("");
12028
+ const [reload, setReload] = useState19(0);
12029
+ const pending = useRef15(false);
12030
+ const keys = useRef15(/* @__PURE__ */ new Map());
12031
+ const completed = useRef15(/* @__PURE__ */ new Set());
12032
+ const alive = useRef15(true);
12033
+ const currentSelection = useRef15(selected);
11950
12034
  currentSelection.current = selected;
11951
12035
  useEffect16(() => {
11952
12036
  alive.current = true;
@@ -12030,23 +12114,23 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12030
12114
  if (alive.current) setBusy(false);
12031
12115
  }
12032
12116
  };
12033
- return /* @__PURE__ */ jsxs29("section", { "aria-label": "Saved RFA packets", children: [
12034
- /* @__PURE__ */ jsx31("h3", { children: "Saved packets" }),
12035
- /* @__PURE__ */ jsx31("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12036
- error ? /* @__PURE__ */ jsx31("p", { role: "alert", children: error }) : null,
12037
- notice ? /* @__PURE__ */ jsx31("p", { role: "status", children: notice }) : null,
12038
- loading ? /* @__PURE__ */ jsx31("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12039
- !loading && !history ? /* @__PURE__ */ jsx31("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12040
- history?.packets.length === 0 ? /* @__PURE__ */ jsx31("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
12041
- /* @__PURE__ */ jsxs29("label", { children: [
12117
+ return /* @__PURE__ */ jsxs30("section", { "aria-label": "Saved RFA packets", children: [
12118
+ /* @__PURE__ */ jsx32("h3", { children: "Saved packets" }),
12119
+ /* @__PURE__ */ jsx32("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12120
+ error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: error }) : null,
12121
+ notice ? /* @__PURE__ */ jsx32("p", { role: "status", children: notice }) : null,
12122
+ loading ? /* @__PURE__ */ jsx32("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12123
+ !loading && !history ? /* @__PURE__ */ jsx32("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12124
+ history?.packets.length === 0 ? /* @__PURE__ */ jsx32("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs30(Fragment19, { children: [
12125
+ /* @__PURE__ */ jsxs30("label", { children: [
12042
12126
  "Saved packet",
12043
- /* @__PURE__ */ jsxs29("select", { disabled: locked, value: selected, onChange: (event) => {
12127
+ /* @__PURE__ */ jsxs30("select", { disabled: locked, value: selected, onChange: (event) => {
12044
12128
  setSelected(event.target.value);
12045
12129
  setPrepared(null);
12046
12130
  resetReview();
12047
12131
  }, children: [
12048
- /* @__PURE__ */ jsx31("option", { value: "", children: "Choose a saved packet" }),
12049
- history.packets.map((value) => /* @__PURE__ */ jsxs29("option", { value: value.id, children: [
12132
+ /* @__PURE__ */ jsx32("option", { value: "", children: "Choose a saved packet" }),
12133
+ history.packets.map((value) => /* @__PURE__ */ jsxs30("option", { value: value.id, children: [
12050
12134
  value.source === "submission" ? "Submission" : "Download",
12051
12135
  " \xB7 revision ",
12052
12136
  value.contentRevision,
@@ -12055,67 +12139,67 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12055
12139
  ] }, value.id))
12056
12140
  ] })
12057
12141
  ] }),
12058
- /* @__PURE__ */ jsx31("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12059
- blob ? /* @__PURE__ */ jsx31(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12060
- !canForward ? /* @__PURE__ */ jsx31("p", { children: environment !== "live" ? "Sandbox: saved PDFs are available for review. External forwarding is disabled." : "Forwarding requires permission from your organization." }) : selected && !eligible ? /* @__PURE__ */ jsx31("p", { children: "This packet is not eligible for forwarding. Submission packets require a successful original dispatch." }) : /* @__PURE__ */ jsxs29("fieldset", { disabled: locked, children: [
12061
- /* @__PURE__ */ jsx31("legend", { children: "Forward saved packet" }),
12062
- /* @__PURE__ */ jsx31("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12063
- /* @__PURE__ */ jsxs29("label", { children: [
12142
+ /* @__PURE__ */ jsx32("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12143
+ blob ? /* @__PURE__ */ jsx32(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12144
+ !canForward ? /* @__PURE__ */ jsx32("p", { children: environment !== "live" ? "Sandbox: saved PDFs are available for review. External forwarding is disabled." : "Forwarding requires permission from your organization." }) : selected && !eligible ? /* @__PURE__ */ jsx32("p", { children: "This packet is not eligible for forwarding. Submission packets require a successful original dispatch." }) : /* @__PURE__ */ jsxs30("fieldset", { disabled: locked, children: [
12145
+ /* @__PURE__ */ jsx32("legend", { children: "Forward saved packet" }),
12146
+ /* @__PURE__ */ jsx32("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12147
+ /* @__PURE__ */ jsxs30("label", { children: [
12064
12148
  "Forward by",
12065
- /* @__PURE__ */ jsxs29("select", { value: channel, onChange: (event) => {
12149
+ /* @__PURE__ */ jsxs30("select", { value: channel, onChange: (event) => {
12066
12150
  setChannel(event.target.value);
12067
12151
  resetReview();
12068
12152
  }, children: [
12069
- /* @__PURE__ */ jsx31("option", { value: "fax", children: "Fax" }),
12070
- /* @__PURE__ */ jsx31("option", { value: "email", children: "Email" })
12153
+ /* @__PURE__ */ jsx32("option", { value: "fax", children: "Fax" }),
12154
+ /* @__PURE__ */ jsx32("option", { value: "email", children: "Email" })
12071
12155
  ] })
12072
12156
  ] }),
12073
- channel === "email" ? /* @__PURE__ */ jsx31("p", { children: "Email forwarding requires email delivery to be enabled for your organization. The server will reject requests when it is unavailable." }) : null,
12074
- /* @__PURE__ */ jsxs29("label", { children: [
12157
+ channel === "email" ? /* @__PURE__ */ jsx32("p", { children: "Email forwarding requires email delivery to be enabled for your organization. The server will reject requests when it is unavailable." }) : null,
12158
+ /* @__PURE__ */ jsxs30("label", { children: [
12075
12159
  channel === "fax" ? "Recipient fax (with country code)" : "Recipient email",
12076
- /* @__PURE__ */ jsx31("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12160
+ /* @__PURE__ */ jsx32("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12077
12161
  setRecipient(event.target.value);
12078
12162
  resetReview();
12079
12163
  } })
12080
12164
  ] }),
12081
- /* @__PURE__ */ jsxs29("label", { className: "mbrfa-check", children: [
12082
- /* @__PURE__ */ jsx31("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12165
+ /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12166
+ /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12083
12167
  setReviewed(event.target.checked);
12084
12168
  setConfirmed(false);
12085
12169
  } }),
12086
12170
  "I reviewed this saved packet and its attachments."
12087
12171
  ] }),
12088
- /* @__PURE__ */ jsxs29("label", { className: "mbrfa-check", children: [
12089
- /* @__PURE__ */ jsx31("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12172
+ /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12173
+ /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12090
12174
  "I verified that ",
12091
12175
  destination || "this recipient",
12092
12176
  " is authorized to receive this patient\u2019s packet."
12093
12177
  ] }),
12094
- alreadyForwarded ? /* @__PURE__ */ jsx31("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12095
- /* @__PURE__ */ jsx31("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12178
+ alreadyForwarded ? /* @__PURE__ */ jsx32("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12179
+ /* @__PURE__ */ jsx32("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12096
12180
  ] })
12097
12181
  ] }) : null
12098
12182
  ] });
12099
12183
  }
12100
12184
 
12101
12185
  // src/rfa-draft-actions.tsx
12102
- import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef15, useState as useState19 } from "react";
12186
+ import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef16, useState as useState20 } from "react";
12103
12187
  import { createRfaDraftActionsClient } from "@mindbill/browser";
12104
- import { Fragment as Fragment19, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
12188
+ import { Fragment as Fragment20, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12105
12189
  function RfaDraftActions({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
12106
12190
  const options = useMemo10(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
12107
12191
  const identity = useMemo10(() => crypto.randomUUID(), [options]);
12108
- return /* @__PURE__ */ jsx32(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12192
+ return /* @__PURE__ */ jsx33(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12109
12193
  }
12110
12194
  function DraftActionsContent({ rfa, options, permissions = [], disabled = false, onCopied, onCanceled }) {
12111
12195
  const client = useMemo10(() => createRfaDraftActionsClient(options), [options]);
12112
- const [confirming, setConfirming] = useState19(null);
12113
- const [busy, setBusy] = useState19(false);
12114
- const [error, setError] = useState19("");
12115
- const [completed, setCompleted] = useState19(null);
12116
- const pending = useRef15(false);
12117
- const keys = useRef15({});
12118
- const alive = useRef15(true);
12196
+ const [confirming, setConfirming] = useState20(null);
12197
+ const [busy, setBusy] = useState20(false);
12198
+ const [error, setError] = useState20("");
12199
+ const [completed, setCompleted] = useState20(null);
12200
+ const pending = useRef16(false);
12201
+ const keys = useRef16({});
12202
+ const alive = useRef16(true);
12119
12203
  useEffect17(() => {
12120
12204
  alive.current = true;
12121
12205
  return () => {
@@ -12145,112 +12229,112 @@ function DraftActionsContent({ rfa, options, permissions = [], disabled = false,
12145
12229
  if (alive.current) setBusy(false);
12146
12230
  }
12147
12231
  };
12148
- return /* @__PURE__ */ jsxs30("section", { "aria-label": "RFA draft actions", children: [
12149
- error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: error }) : null,
12150
- completed ? /* @__PURE__ */ jsx32("p", { role: "status", children: completed === "copy" ? "A new unsigned draft was created." : "The draft was canceled. Its audit history is retained." }) : confirming && (confirming === "copy" ? canCopy : canCancel) ? /* @__PURE__ */ jsxs30("div", { className: "mbtd-note", children: [
12151
- confirming === "copy" ? /* @__PURE__ */ jsxs30(Fragment19, { children: [
12152
- /* @__PURE__ */ jsx32("p", { children: "Create a new draft with this patient, injury, physician, and requested treatments? Review the new draft and attach supporting documents before signing it." }),
12153
- /* @__PURE__ */ jsx32("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12154
- ] }) : /* @__PURE__ */ jsx32("p", { children: "Cancel this unsigned draft? It will no longer be available for submission. The request and its audit history will be retained." }),
12155
- /* @__PURE__ */ jsxs30("div", { className: "mbtd-actions", children: [
12156
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: disabled || busy, onClick: () => {
12232
+ return /* @__PURE__ */ jsxs31("section", { "aria-label": "RFA draft actions", children: [
12233
+ error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: error }) : null,
12234
+ completed ? /* @__PURE__ */ jsx33("p", { role: "status", children: completed === "copy" ? "A new unsigned draft was created." : "The draft was canceled. Its audit history is retained." }) : confirming && (confirming === "copy" ? canCopy : canCancel) ? /* @__PURE__ */ jsxs31("div", { className: "mbtd-note", children: [
12235
+ confirming === "copy" ? /* @__PURE__ */ jsxs31(Fragment20, { children: [
12236
+ /* @__PURE__ */ jsx33("p", { children: "Create a new draft with this patient, injury, physician, and requested treatments? Review the new draft and attach supporting documents before signing it." }),
12237
+ /* @__PURE__ */ jsx33("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12238
+ ] }) : /* @__PURE__ */ jsx33("p", { children: "Cancel this unsigned draft? It will no longer be available for submission. The request and its audit history will be retained." }),
12239
+ /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12240
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => {
12157
12241
  void mutate(confirming);
12158
12242
  }, children: busy ? "Saving\u2026" : confirming === "copy" ? "Create draft copy" : "Confirm cancellation" }),
12159
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: busy, onClick: () => {
12243
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: busy, onClick: () => {
12160
12244
  setConfirming(null);
12161
12245
  setError("");
12162
12246
  }, children: "Keep current request" })
12163
12247
  ] })
12164
- ] }) : /* @__PURE__ */ jsxs30("div", { className: "mbtd-actions", children: [
12165
- canCopy ? /* @__PURE__ */ jsx32("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12166
- canCancel ? /* @__PURE__ */ jsx32("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12248
+ ] }) : /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12249
+ canCopy ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12250
+ canCancel ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12167
12251
  ] })
12168
12252
  ] });
12169
12253
  }
12170
12254
 
12171
12255
  // src/rfa-list-view.tsx
12172
12256
  import { getRfaLifecycleStatus as getRfaLifecycleStatus3, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS3 } from "@mindbill/browser";
12173
- import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12257
+ import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12174
12258
  var date6 = (value) => value ? new Date(value).toLocaleDateString() : "\u2014";
12175
12259
  var label2 = (value) => value.replaceAll("_", " ");
12176
12260
  function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSort, onSelect, lifecycleAvailable = true, hideViewSwitch = false, getRfaHref, getPatientHref, getClaimHref, getProviderHref }) {
12177
- const heading = (field, title) => /* @__PURE__ */ jsx33("th", { scope: "col", "aria-sort": sortBy === field ? sortDirection === "asc" ? "ascending" : "descending" : "none", children: /* @__PURE__ */ jsxs31("button", { type: "button", onClick: () => onSort(field), children: [
12261
+ const heading = (field, title) => /* @__PURE__ */ jsx34("th", { scope: "col", "aria-sort": sortBy === field ? sortDirection === "asc" ? "ascending" : "descending" : "none", children: /* @__PURE__ */ jsxs32("button", { type: "button", onClick: () => onSort(field), children: [
12178
12262
  title,
12179
12263
  sortBy === field ? sortDirection === "asc" ? " \u2191" : " \u2193" : " \u2195"
12180
12264
  ] }) });
12181
- return /* @__PURE__ */ jsxs31("div", { className: "mbrfa-list", children: [
12182
- /* @__PURE__ */ jsx33("style", { children: `.mbrfa-table-scroll{overflow-x:auto;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}.mbrfa-table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}.mbrfa-table th,.mbrfa-table td{padding:12px;border-bottom:1px solid var(--mb-border);vertical-align:top;min-width:110px}.mbrfa-table th{background:var(--mb-soft)}.mbrfa-table td small{display:block;color:var(--mb-muted);margin-top:4px}.mbrfa-table tr:last-child td{border-bottom:0}.mbtd .mbrfa-table th button{white-space:nowrap;border:0;background:transparent;padding:0;min-height:28px;font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table th{font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table tbody tr:hover{background:var(--mb-soft)}.mbrfa-table td{overflow-wrap:anywhere}.mbrfa-table td:first-child button{color:var(--mb-accent);font-weight:600;background:transparent;border-color:var(--mb-border)}.mbtd .mbrfa-text-link{border:0;background:transparent;padding:0;min-height:0;color:var(--mb-accent);font-weight:600;text-decoration:none;text-align:left;line-height:1.5}.mbtd .mbrfa-text-link:hover{text-decoration:underline}.mbrfa-view button[aria-pressed=true]{background:var(--mb-soft);font-weight:600}` }),
12183
- !hideViewSwitch ? /* @__PURE__ */ jsxs31("div", { className: "mbrfa-list-mode", children: [
12184
- /* @__PURE__ */ jsxs31("label", { children: [
12265
+ return /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list", children: [
12266
+ /* @__PURE__ */ jsx34("style", { children: `.mbrfa-table-scroll{overflow-x:auto;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}.mbrfa-table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}.mbrfa-table th,.mbrfa-table td{padding:12px;border-bottom:1px solid var(--mb-border);vertical-align:top;min-width:110px}.mbrfa-table th{background:var(--mb-soft)}.mbrfa-table td small{display:block;color:var(--mb-muted);margin-top:4px}.mbrfa-table tr:last-child td{border-bottom:0}.mbtd .mbrfa-table th button{white-space:nowrap;border:0;background:transparent;padding:0;min-height:28px;font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table th{font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table tbody tr:hover{background:var(--mb-soft)}.mbrfa-table td{overflow-wrap:anywhere}.mbrfa-table td:first-child button{color:var(--mb-accent);font-weight:600;background:transparent;border-color:var(--mb-border)}.mbtd .mbrfa-text-link{border:0;background:transparent;padding:0;min-height:0;color:var(--mb-accent);font-weight:600;text-decoration:none;text-align:left;line-height:1.5}.mbtd .mbrfa-text-link:hover{text-decoration:underline}.mbrfa-view button[aria-pressed=true]{background:var(--mb-soft);font-weight:600}` }),
12267
+ !hideViewSwitch ? /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list-mode", children: [
12268
+ /* @__PURE__ */ jsxs32("label", { children: [
12185
12269
  "Show",
12186
- /* @__PURE__ */ jsxs31("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12187
- /* @__PURE__ */ jsx33("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12188
- /* @__PURE__ */ jsx33("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12270
+ /* @__PURE__ */ jsxs32("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12271
+ /* @__PURE__ */ jsx34("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12272
+ /* @__PURE__ */ jsx34("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12189
12273
  ] })
12190
12274
  ] }),
12191
- /* @__PURE__ */ jsx33("p", { children: view === "rfas" ? "One RFA can request several treatments. Open a request to review its treatments and decisions." : "Each treatment belongs to an RFA and can receive its own decision. Page controls move between requests." })
12275
+ /* @__PURE__ */ jsx34("p", { children: view === "rfas" ? "One RFA can request several treatments. Open a request to review its treatments and decisions." : "Each treatment belongs to an RFA and can receive its own decision. Page controls move between requests." })
12192
12276
  ] }) : null,
12193
- !records.length ? /* @__PURE__ */ jsx33("p", { children: "No requests match this view." }) : /* @__PURE__ */ jsx33("div", { className: "mbrfa-table-scroll", tabIndex: 0, role: "region", "aria-label": view === "rfas" ? "RFA table" : "Requested treatments table", children: /* @__PURE__ */ jsxs31("table", { className: "mbrfa-table", children: [
12194
- /* @__PURE__ */ jsx33("thead", { children: /* @__PURE__ */ jsxs31("tr", { children: [
12195
- /* @__PURE__ */ jsx33("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12277
+ !records.length ? /* @__PURE__ */ jsx34("p", { children: "No requests match this view." }) : /* @__PURE__ */ jsx34("div", { className: "mbrfa-table-scroll", tabIndex: 0, role: "region", "aria-label": view === "rfas" ? "RFA table" : "Requested treatments table", children: /* @__PURE__ */ jsxs32("table", { className: "mbrfa-table", children: [
12278
+ /* @__PURE__ */ jsx34("thead", { children: /* @__PURE__ */ jsxs32("tr", { children: [
12279
+ /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12196
12280
  heading("employeeName", "Patient"),
12197
12281
  heading("providerName", "Requesting physician"),
12198
- /* @__PURE__ */ jsx33("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12282
+ /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12199
12283
  heading("submittedAt", "Sent"),
12200
- /* @__PURE__ */ jsx33("th", { scope: "col", children: "Decision due" }),
12201
- view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx33("th", { scope: "col", children: "Treatment decision" }),
12284
+ /* @__PURE__ */ jsx34("th", { scope: "col", children: "Decision due" }),
12285
+ view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx34("th", { scope: "col", children: "Treatment decision" }),
12202
12286
  heading("createdAt", "Created")
12203
12287
  ] }) }),
12204
- /* @__PURE__ */ jsx33("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs31("tr", { children: [
12205
- /* @__PURE__ */ jsxs31("td", { children: [
12206
- /* @__PURE__ */ jsx33(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12207
- rfa.displayReference ? /* @__PURE__ */ jsx33("small", { children: rfa.displayReference }) : null
12288
+ /* @__PURE__ */ jsx34("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs32("tr", { children: [
12289
+ /* @__PURE__ */ jsxs32("td", { children: [
12290
+ /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12291
+ rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12208
12292
  ] }),
12209
- /* @__PURE__ */ jsxs31("td", { children: [
12210
- /* @__PURE__ */ jsx33(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12211
- /* @__PURE__ */ jsx33("small", { children: /* @__PURE__ */ jsxs31(RfaLink, { href: getClaimHref?.(rfa), children: [
12293
+ /* @__PURE__ */ jsxs32("td", { children: [
12294
+ /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12295
+ /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12212
12296
  "Claim ",
12213
12297
  rfa.claimNumber || "not recorded"
12214
12298
  ] }) })
12215
12299
  ] }),
12216
- /* @__PURE__ */ jsx33("td", { children: /* @__PURE__ */ jsx33(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12217
- /* @__PURE__ */ jsx33("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12218
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.submittedAt) }),
12219
- /* @__PURE__ */ jsx33("td", { children: rfaDecisionDueText(rfa) }),
12220
- /* @__PURE__ */ jsx33("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12221
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.createdAt) })
12222
- ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs31("tr", { children: [
12223
- /* @__PURE__ */ jsxs31("td", { children: [
12224
- /* @__PURE__ */ jsx33(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12225
- rfa.displayReference ? /* @__PURE__ */ jsx33("small", { children: rfa.displayReference }) : null
12300
+ /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12301
+ /* @__PURE__ */ jsx34("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12302
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12303
+ /* @__PURE__ */ jsx34("td", { children: rfaDecisionDueText(rfa) }),
12304
+ /* @__PURE__ */ jsx34("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12305
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12306
+ ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs32("tr", { children: [
12307
+ /* @__PURE__ */ jsxs32("td", { children: [
12308
+ /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12309
+ rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12226
12310
  ] }),
12227
- /* @__PURE__ */ jsxs31("td", { children: [
12228
- /* @__PURE__ */ jsx33(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12229
- /* @__PURE__ */ jsx33("small", { children: /* @__PURE__ */ jsxs31(RfaLink, { href: getClaimHref?.(rfa), children: [
12311
+ /* @__PURE__ */ jsxs32("td", { children: [
12312
+ /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12313
+ /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12230
12314
  "Claim ",
12231
12315
  rfa.claimNumber || "not recorded"
12232
12316
  ] }) })
12233
12317
  ] }),
12234
- /* @__PURE__ */ jsx33("td", { children: /* @__PURE__ */ jsx33(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12235
- /* @__PURE__ */ jsxs31("td", { children: [
12318
+ /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12319
+ /* @__PURE__ */ jsxs32("td", { children: [
12236
12320
  item.serviceDescription,
12237
- /* @__PURE__ */ jsxs31("small", { children: [
12321
+ /* @__PURE__ */ jsxs32("small", { children: [
12238
12322
  item.procedureCode || "No procedure code",
12239
12323
  " \xB7 ",
12240
12324
  item.diagnosisCode
12241
12325
  ] })
12242
12326
  ] }),
12243
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.submittedAt) }),
12244
- /* @__PURE__ */ jsx33("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12245
- /* @__PURE__ */ jsxs31("td", { children: [
12327
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12328
+ /* @__PURE__ */ jsx34("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12329
+ /* @__PURE__ */ jsxs32("td", { children: [
12246
12330
  item.decisionClosure?.closed ? "Decision no longer required" : label2(item.outcome),
12247
- /* @__PURE__ */ jsx33("small", { children: date6(item.decidedAt) }),
12248
- item.authorizationNumber ? /* @__PURE__ */ jsxs31("small", { children: [
12331
+ /* @__PURE__ */ jsx34("small", { children: date6(item.decidedAt) }),
12332
+ item.authorizationNumber ? /* @__PURE__ */ jsxs32("small", { children: [
12249
12333
  "Authorization ",
12250
12334
  item.authorizationNumber
12251
12335
  ] }) : null
12252
12336
  ] }),
12253
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.createdAt) })
12337
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12254
12338
  ] }, `${rfa.id}:${item.id}`))) })
12255
12339
  ] }) })
12256
12340
  ] });
@@ -12258,58 +12342,58 @@ function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSor
12258
12342
 
12259
12343
  // src/rfa-overview.tsx
12260
12344
  import { RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS4 } from "@mindbill/browser";
12261
- import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12345
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12262
12346
  var buckets = [{ id: "0_5", label: "0\u20135 days" }, { id: "6_14", label: "6\u201314 days" }, { id: "15_30", label: "15\u201330 days" }, { id: "31_plus", label: "31+ days" }];
12263
12347
  var groups = [{ title: "Needs attention", tone: "attention", states: ["incomplete", "failed"] }, { title: "Awaiting decision", tone: "waiting", states: ["sent", "received"] }, { title: "Finished", tone: "finished", states: ["closed", "canceled"] }];
12264
12348
  function RfaOverview({ summary, onSelect, combined = false }) {
12265
12349
  const aging = summary.aging;
12266
- const countButton = (count, title, status, bucket) => count ? /* @__PURE__ */ jsx34("button", { type: "button", className: "mbrfa-count", "aria-label": `${title}: ${count} requests`, onClick: () => onSelect(status, bucket), children: count.toLocaleString() }) : /* @__PURE__ */ jsx34("span", { className: "mbrfa-zero", children: "0" });
12267
- if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs32("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12268
- /* @__PURE__ */ jsx34("h3", { children: "Clinical review counts" }),
12269
- /* @__PURE__ */ jsx34("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs32("button", { type: "button", onClick: () => onSelect(status), children: [
12270
- /* @__PURE__ */ jsx34("span", { children: status.replaceAll("_", " ") }),
12271
- /* @__PURE__ */ jsx34("strong", { children: count })
12350
+ const countButton = (count, title, status, bucket) => count ? /* @__PURE__ */ jsx35("button", { type: "button", className: "mbrfa-count", "aria-label": `${title}: ${count} requests`, onClick: () => onSelect(status, bucket), children: count.toLocaleString() }) : /* @__PURE__ */ jsx35("span", { className: "mbrfa-zero", children: "0" });
12351
+ if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs33("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12352
+ /* @__PURE__ */ jsx35("h3", { children: "Clinical review counts" }),
12353
+ /* @__PURE__ */ jsx35("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs33("button", { type: "button", onClick: () => onSelect(status), children: [
12354
+ /* @__PURE__ */ jsx35("span", { children: status.replaceAll("_", " ") }),
12355
+ /* @__PURE__ */ jsx35("strong", { children: count })
12272
12356
  ] }, status)) })
12273
12357
  ] });
12274
- return /* @__PURE__ */ jsxs32("div", { className: "mbrfa-overview", children: [
12275
- /* @__PURE__ */ jsxs32("div", { className: "mbrfa-overview-title", children: [
12276
- /* @__PURE__ */ jsxs32("div", { children: [
12277
- /* @__PURE__ */ jsx34("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12278
- /* @__PURE__ */ jsx34("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12358
+ return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview", children: [
12359
+ /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview-title", children: [
12360
+ /* @__PURE__ */ jsxs33("div", { children: [
12361
+ /* @__PURE__ */ jsx35("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12362
+ /* @__PURE__ */ jsx35("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12279
12363
  ] }),
12280
- /* @__PURE__ */ jsxs32("span", { children: [
12364
+ /* @__PURE__ */ jsxs33("span", { children: [
12281
12365
  summary.total.toLocaleString(),
12282
12366
  " total requests"
12283
12367
  ] })
12284
12368
  ] }),
12285
- groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs32("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12286
- /* @__PURE__ */ jsxs32("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12287
- /* @__PURE__ */ jsxs32("h4", { children: [
12288
- /* @__PURE__ */ jsx34("i", { "aria-hidden": "true" }),
12369
+ groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs33("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12370
+ /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12371
+ /* @__PURE__ */ jsxs33("h4", { children: [
12372
+ /* @__PURE__ */ jsx35("i", { "aria-hidden": "true" }),
12289
12373
  group.title
12290
12374
  ] }),
12291
- buckets.map((bucket) => /* @__PURE__ */ jsx34("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12292
- /* @__PURE__ */ jsx34("span", { className: "mbrfa-total-heading", children: "Total" })
12375
+ buckets.map((bucket) => /* @__PURE__ */ jsx35("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12376
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-total-heading", children: "Total" })
12293
12377
  ] }),
12294
- group.states.map((status) => /* @__PURE__ */ jsxs32("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12295
- /* @__PURE__ */ jsx34("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12296
- buckets.map((bucket) => /* @__PURE__ */ jsxs32("span", { className: "mbrfa-age-cell", children: [
12297
- /* @__PURE__ */ jsx34("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12298
- group.tone === "waiting" && aging ? countButton(aging.byLifecycleStatus[status]?.[bucket.id] ?? 0, `${RFA_LIFECYCLE_LABELS4[status]} \xB7 ${bucket.label} since submission`, status, bucket.id) : /* @__PURE__ */ jsx34("span", { className: "mbrfa-zero", "aria-label": "Not applicable", children: "\u2014" })
12378
+ group.states.map((status) => /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12379
+ /* @__PURE__ */ jsx35("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12380
+ buckets.map((bucket) => /* @__PURE__ */ jsxs33("span", { className: "mbrfa-age-cell", children: [
12381
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12382
+ group.tone === "waiting" && aging ? countButton(aging.byLifecycleStatus[status]?.[bucket.id] ?? 0, `${RFA_LIFECYCLE_LABELS4[status]} \xB7 ${bucket.label} since submission`, status, bucket.id) : /* @__PURE__ */ jsx35("span", { className: "mbrfa-zero", "aria-label": "Not applicable", children: "\u2014" })
12299
12383
  ] }, bucket.id)),
12300
- /* @__PURE__ */ jsx34("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12384
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12301
12385
  ] }, status))
12302
12386
  ] }, group.title)),
12303
- /* @__PURE__ */ jsxs32("p", { className: "mbrfa-overview-footnote", children: [
12387
+ /* @__PURE__ */ jsxs33("p", { className: "mbrfa-overview-footnote", children: [
12304
12388
  "Aging counts calendar days since submission, separately from the decision deadline. Only requests awaiting a treatment decision are aged.",
12305
12389
  !aging ? " Aging is unavailable from this server." : ""
12306
12390
  ] }),
12307
- /* @__PURE__ */ jsxs32("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12308
- /* @__PURE__ */ jsx34("strong", { children: "All requests" }),
12309
- /* @__PURE__ */ jsxs32("span", { children: [
12391
+ /* @__PURE__ */ jsxs33("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12392
+ /* @__PURE__ */ jsx35("strong", { children: "All requests" }),
12393
+ /* @__PURE__ */ jsxs33("span", { children: [
12310
12394
  summary.total.toLocaleString(),
12311
12395
  " ",
12312
- /* @__PURE__ */ jsx34("span", { "aria-hidden": "true", children: "\u2192" })
12396
+ /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2192" })
12313
12397
  ] })
12314
12398
  ] })
12315
12399
  ] });
@@ -12326,66 +12410,7 @@ var rfaDashboardCss = `
12326
12410
  `;
12327
12411
 
12328
12412
  // src/rfa-create-form.tsx
12329
- import { useCallback as useCallback3, useEffect as useEffect23, useState as useState27 } from "react";
12330
-
12331
- // src/rfa-identity-select.tsx
12332
- import { useId as useId5, useRef as useRef16, useState as useState20 } from "react";
12333
- import { Fragment as Fragment20, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12334
- function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, query, searchable, disabled = false, loading = false, error = "", value, options, onSearch, onSelect }) {
12335
- const id = useId5();
12336
- const trigger = useRef16(null);
12337
- const [open, setOpen] = useState20(false);
12338
- const [active, setActive] = useState20(0);
12339
- const selected = options.find((option) => option.id === value);
12340
- const choose = (option) => {
12341
- onSelect(option.id);
12342
- setOpen(false);
12343
- trigger.current?.focus();
12344
- };
12345
- return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-identity-select", onBlur: (event) => {
12346
- if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);
12347
- }, onKeyDown: (event) => {
12348
- if (event.key === "Escape") {
12349
- event.preventDefault();
12350
- setOpen(false);
12351
- trigger.current?.focus();
12352
- }
12353
- }, children: [
12354
- /* @__PURE__ */ jsx35("style", { children: `.mbrfa-identity-select{position:relative;min-width:0}.mbrfa-identity-select>button{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left;gap:12px;min-height:44px}.mbrfa-identity-select small{display:block;opacity:.75;font-size:12px;margin-top:3px}.mbrfa-identity-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;padding:10px;background:var(--mbtd-surface,#fff);color:inherit;border:1px solid var(--mbtd-border,#d6d3cc);border-radius:8px;box-shadow:0 8px 24px #0002}.mbrfa-identity-menu input{width:100%;box-sizing:border-box}.mbrfa-identity-options{max-height:280px;overflow:auto;margin-top:6px}.mbrfa-identity-options button{display:block;width:100%;text-align:left;padding:10px 12px;border:0;border-radius:4px;min-height:44px}.mbrfa-identity-options button:hover,.mbrfa-identity-options button[data-active=true]{background:#1c595918}.mbrfa-identity-menu p{padding:8px;margin:0}` }),
12355
- /* @__PURE__ */ jsxs33("button", { ref: trigger, type: "button", "aria-label": label5, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? `${id}-list` : void 0, disabled, onClick: () => {
12356
- setOpen(!open);
12357
- setActive(0);
12358
- }, children: [
12359
- /* @__PURE__ */ jsx35("span", { children: selected ? /* @__PURE__ */ jsxs33(Fragment20, { children: [
12360
- selected.label,
12361
- selected.detail ? /* @__PURE__ */ jsx35("small", { children: selected.detail }) : null
12362
- ] }) : placeholder }),
12363
- /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2304" })
12364
- ] }),
12365
- open ? /* @__PURE__ */ jsxs33("div", { className: "mbrfa-identity-menu", children: [
12366
- searchable ? /* @__PURE__ */ jsx35("input", { autoFocus: true, role: "combobox", "aria-label": searchPlaceholder, "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": `${id}-list`, "aria-activedescendant": !loading && !error && options[active] ? `${id}-${active}` : void 0, type: "search", autoComplete: "off", maxLength: 200, placeholder: searchPlaceholder, value: query, onChange: (event) => {
12367
- setActive(0);
12368
- onSearch(event.target.value);
12369
- }, onKeyDown: (event) => {
12370
- if (loading || error || !options.length) return;
12371
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
12372
- event.preventDefault();
12373
- const next = (active + (event.key === "ArrowDown" ? 1 : -1) + options.length) % options.length;
12374
- setActive(next);
12375
- document.getElementById(`${id}-${next}`)?.scrollIntoView({ block: "nearest" });
12376
- }
12377
- if (event.key === "Enter" && options[active]) {
12378
- event.preventDefault();
12379
- choose(options[active]);
12380
- }
12381
- } }) : null,
12382
- /* @__PURE__ */ jsx35("div", { className: "mbrfa-identity-options", id: `${id}-list`, role: "listbox", "aria-label": label5, "aria-busy": loading, children: loading ? /* @__PURE__ */ jsx35("p", { role: "status", children: "Searching\u2026" }) : error ? /* @__PURE__ */ jsx35("p", { role: "alert", children: error }) : options.length ? options.map((option, index) => /* @__PURE__ */ jsxs33("button", { type: "button", role: "option", id: `${id}-${index}`, "aria-selected": option.id === value, "data-active": index === active, onMouseDown: (event) => event.preventDefault(), onClick: () => choose(option), children: [
12383
- option.label,
12384
- option.detail ? /* @__PURE__ */ jsx35("small", { children: option.detail }) : null
12385
- ] }, option.id)) : /* @__PURE__ */ jsx35("p", { children: "No matches. Try another search." }) })
12386
- ] }) : null
12387
- ] });
12388
- }
12413
+ import { useCallback as useCallback3, useEffect as useEffect24, useState as useState27 } from "react";
12389
12414
 
12390
12415
  // src/rfa-claim-setup.tsx
12391
12416
  import { useEffect as useEffect18, useRef as useRef17, useState as useState21 } from "react";
@@ -12516,7 +12541,7 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12516
12541
  }
12517
12542
 
12518
12543
  // src/rfa-practice-picker.tsx
12519
- import { useState as useState23 } from "react";
12544
+ import { useEffect as useEffect20, useRef as useRef18, useState as useState23 } from "react";
12520
12545
 
12521
12546
  // src/rfa-official-fields.tsx
12522
12547
  import { useEffect as useEffect19, useState as useState22 } from "react";
@@ -12554,10 +12579,11 @@ var contactRows = [
12554
12579
  ["phone", "Phone", 30, 2],
12555
12580
  ["fax", "Fax Number", 30, 2]
12556
12581
  ];
12557
- function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail }) {
12582
+ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, faxHint }) {
12558
12583
  const field = (key2, label5, max, span) => /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12559
12584
  label5,
12560
- /* @__PURE__ */ jsx37("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: event.target.value }) })
12585
+ /* @__PURE__ */ jsx37("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: event.target.value }) }),
12586
+ key2 === "fax" && faxHint && !value?.fax?.trim() ? /* @__PURE__ */ jsx37("small", { className: "mbrfa-field-hint", children: faxHint }) : null
12561
12587
  ] }, key2);
12562
12588
  return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
12563
12589
  before,
@@ -12577,7 +12603,7 @@ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12577
12603
  void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
12578
12604
  if (!active) return;
12579
12605
  const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
12580
- setDetails({ ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
12606
+ setDetails({ ...context.returnFax ? { returnFax: context.returnFax } : {}, ...context.returnEmail ? { returnEmail: context.returnEmail } : {}, ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
12581
12607
  }).catch(() => void 0);
12582
12608
  return () => {
12583
12609
  active = false;
@@ -12588,15 +12614,22 @@ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12588
12614
 
12589
12615
  // src/rfa-practice-picker.tsx
12590
12616
  import { Fragment as Fragment21, jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
12591
- function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref, onRefreshProfile }) {
12617
+ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref, onEditPractice, onEditLocation }) {
12592
12618
  const practices = profile?.billingProviders ?? [];
12593
12619
  const [practice, setPractice] = useState23(() => practices.find((item) => item.name === value?.name)?.id ?? "");
12594
12620
  const [location, setLocation] = useState23(() => practice ? (profile?.locations ?? []).find((item) => item.active !== false && item.street === value?.address && (!item.billingProviderId || item.billingProviderId === practice))?.id ?? "" : "");
12595
12621
  const located = (chosen, phone) => ({ address: chosen.street, city: chosen.city, state: chosen.state, zip: chosen.zip, ...chosen.contact?.name ? { contactName: chosen.contact.name } : {}, ...chosen.contact?.phone || phone ? { phone: chosen.contact?.phone || phone } : {}, ...chosen.contact?.fax ? { fax: chosen.contact.fax } : {}, ...chosen.contact?.email ? { email: chosen.contact.email } : {} });
12622
+ const savedPractice = practices.find((item) => item.id === practice), savedLocation = (profile?.locations ?? []).find((item) => item.id === location);
12623
+ const savedKey = JSON.stringify([savedPractice?.name, savedPractice?.phone, savedPractice?.billingStreet, savedPractice?.billingCity, savedPractice?.billingState, savedPractice?.billingZip, savedLocation?.street, savedLocation?.city, savedLocation?.state, savedLocation?.zip, savedLocation?.contact]);
12624
+ const appliedKey = useRef18(savedKey);
12625
+ useEffect20(() => {
12626
+ if (appliedKey.current === savedKey) return;
12627
+ appliedKey.current = savedKey;
12628
+ if (!savedPractice) return;
12629
+ onChange({ ...value, name: savedPractice.name, phone: savedPractice.phone ?? "", address: savedPractice.billingStreet ?? "", city: savedPractice.billingCity ?? "", state: savedPractice.billingState ?? "", zip: savedPractice.billingZip ?? "", ...savedLocation ? located(savedLocation, savedPractice.phone) : {} });
12630
+ }, [savedKey]);
12596
12631
  const [practiceQuery, setPracticeQuery] = useState23("");
12597
12632
  const [locationQuery, setLocationQuery] = useState23("");
12598
- const [refreshing, setRefreshing] = useState23(false);
12599
- const [error, setError] = useState23("");
12600
12633
  const locations = (profile?.locations ?? []).filter((item) => item.active !== false && (item.billingProviderId ? item.billingProviderId === practice : practices.length <= 1));
12601
12634
  return /* @__PURE__ */ jsxs36(Fragment21, { children: [
12602
12635
  /* @__PURE__ */ jsxs36(RfaPicker, { label: "Practice", children: [
@@ -12611,7 +12644,10 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12611
12644
  setLocation(chosen?.id ?? "");
12612
12645
  onChange({ ...value, name: provider.name, phone: provider.phone ?? "", address: provider.billingStreet ?? "", city: provider.billingCity ?? "", state: provider.billingState ?? "", zip: provider.billingZip ?? "", ...chosen ? located(chosen, provider.phone) : {} });
12613
12646
  } }),
12614
- managePracticeHref ? /* @__PURE__ */ jsx38("a", { href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage practices" }) : null
12647
+ /* @__PURE__ */ jsxs36("span", { className: "mbrfa-picker-links", children: [
12648
+ onEditPractice && practice ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", onClick: () => onEditPractice(practice), children: "Edit practice" }) : null,
12649
+ managePracticeHref ? /* @__PURE__ */ jsx38("a", { className: "mbrfa-link-out", href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: onEditPractice ? "Manage practices \u2197" : "Add / manage practices" }) : null
12650
+ ] })
12615
12651
  ] }),
12616
12652
  /* @__PURE__ */ jsxs36(RfaPicker, { label: "Practice location", children: [
12617
12653
  /* @__PURE__ */ jsx38(RfaIdentitySelect, { label: "Practice location", placeholder: practice ? "Choose a location" : "Choose a practice first", searchPlaceholder: "Search locations", query: locationQuery, onSearch: setLocationQuery, searchable: true, disabled: !practice, value: location, options: locations.filter((item) => item.id === location || item.name.toLowerCase().includes(locationQuery.toLowerCase())).map((item) => ({ id: item.id, label: item.name, detail: `${item.street}, ${item.city}` })), onSelect: (id) => {
@@ -12622,23 +12658,19 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12622
12658
  onChange({ ...value, ...located(chosen, practices.find((item) => item.id === practice)?.phone) });
12623
12659
  } }),
12624
12660
  /* @__PURE__ */ jsxs36("span", { className: "mbrfa-picker-links", children: [
12625
- manageLocationsHref ? /* @__PURE__ */ jsx38("a", { href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage locations" }) : null,
12626
- onRefreshProfile ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", disabled: refreshing, onClick: () => {
12627
- setRefreshing(true);
12628
- setError("");
12629
- void onRefreshProfile().catch(() => setError("Could not refresh saved practices. Try again.")).finally(() => setRefreshing(false));
12630
- }, children: refreshing ? "Refreshing\u2026" : "Refresh saved choices" }) : null
12631
- ] }),
12632
- error ? /* @__PURE__ */ jsx38("p", { role: "alert", children: error }) : null
12661
+ onEditLocation && practice && location ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", onClick: () => onEditLocation(location, practice), children: "Edit location" }) : null,
12662
+ onEditLocation && practice ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", onClick: () => onEditLocation(null, practice), children: "Add location" }) : null,
12663
+ manageLocationsHref ? /* @__PURE__ */ jsx38("a", { className: "mbrfa-link-out", href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: onEditLocation ? "Manage locations \u2197" : "Add / manage locations" }) : null
12664
+ ] })
12633
12665
  ] })
12634
12666
  ] });
12635
12667
  }
12636
12668
 
12637
12669
  // src/rfa-contact-picker.tsx
12638
- import { useEffect as useEffect21, useId as useId7, useState as useState25 } from "react";
12670
+ import { useEffect as useEffect22, useId as useId7, useState as useState25 } from "react";
12639
12671
 
12640
12672
  // src/rfa-draft-fields.tsx
12641
- import { useEffect as useEffect20, useId as useId6, useState as useState24 } from "react";
12673
+ import { useEffect as useEffect21, useId as useId6, useState as useState24 } from "react";
12642
12674
  import { Fragment as Fragment22, jsx as jsx39, jsxs as jsxs37 } from "react/jsx-runtime";
12643
12675
  function RfaContactFields({ title, value, onChange }) {
12644
12676
  return /* @__PURE__ */ jsxs37("fieldset", { children: [
@@ -12664,7 +12696,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12664
12696
  const [query, setQuery] = useState24("");
12665
12697
  const [results, setResults] = useState24([]);
12666
12698
  const [error, setError] = useState24("");
12667
- useEffect20(() => {
12699
+ useEffect21(() => {
12668
12700
  let active = true;
12669
12701
  setResults([]);
12670
12702
  setError("");
@@ -12739,7 +12771,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12739
12771
  setActiveIndex(-1);
12740
12772
  if (option.id !== administratorId) onChange(option.id, null);
12741
12773
  };
12742
- useEffect21(() => {
12774
+ useEffect22(() => {
12743
12775
  let active = true;
12744
12776
  setDirectory(null);
12745
12777
  setError("");
@@ -12760,7 +12792,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12760
12792
  active = false;
12761
12793
  };
12762
12794
  }, [administratorId, contextKey, getClaimsAdministratorDirectory]);
12763
- useEffect21(() => {
12795
+ useEffect22(() => {
12764
12796
  let active = true;
12765
12797
  setOptions([]);
12766
12798
  setSearchError("");
@@ -12841,7 +12873,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12841
12873
  }
12842
12874
 
12843
12875
  // src/rfa-draft-form.tsx
12844
- import { useEffect as useEffect22, useRef as useRef18, useState as useState26 } from "react";
12876
+ import { useEffect as useEffect23, useRef as useRef19, useState as useState26 } from "react";
12845
12877
  import { Fragment as Fragment23, jsx as jsx41, jsxs as jsxs39 } from "react/jsx-runtime";
12846
12878
  function normalizeRfaDraft(draft2) {
12847
12879
  const copy = structuredClone(draft2);
@@ -12889,9 +12921,9 @@ function validateRfaDraft(draft2) {
12889
12921
  }
12890
12922
  return null;
12891
12923
  }
12892
- function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetails, selectors, managePracticeHref, manageLocationsHref, onRefreshProfile, onReview, onPreview, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded = false, onSave, onBack, mode = "create", searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes = [], supportingDocuments, disabled = false, ...appearance }) {
12924
+ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetails, selectors, onEditPractice, onEditLocation, managePracticeHref, manageLocationsHref, onRefreshProfile, onReview, onPreview, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded = false, onSave, onBack, mode = "create", searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes = [], supportingDocuments, disabled = false, ...appearance }) {
12893
12925
  const [savedDraft, setDraft] = useState26(() => normalizeRfaDraft(initialDraft));
12894
- useEffect22(() => {
12926
+ useEffect23(() => {
12895
12927
  if (identity) setDraft((current) => {
12896
12928
  const next = { ...current };
12897
12929
  delete next.providerPhone;
@@ -12901,17 +12933,40 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12901
12933
  }, [identity?.renderingProviderId]);
12902
12934
  const savedPhysician = organizationProfile?.renderingProviders?.find((provider) => provider.id === (identity?.renderingProviderId ?? savedDraft.renderingProviderId));
12903
12935
  const physicianEmail = savedPhysician?.email;
12904
- const filledEmail = useRef18(void 0);
12905
- useEffect22(() => {
12936
+ const returnFax = formDetails?.returnFax;
12937
+ useEffect23(() => {
12938
+ if (officialForm && returnFax) setDraft((current) => current.requestingPractice?.fax?.trim() ? current : { ...current, requestingPractice: { ...current.requestingPractice, fax: returnFax } });
12939
+ }, [officialForm, returnFax, savedDraft.requestingPractice?.fax]);
12940
+ const returnEmail = formDetails?.returnEmail;
12941
+ useEffect23(() => {
12942
+ if (officialForm && returnEmail && !physicianEmail) setDraft((current) => current.requestingPractice?.email?.trim() ? current : { ...current, requestingPractice: { ...current.requestingPractice, email: returnEmail } });
12943
+ }, [officialForm, returnEmail, physicianEmail, savedDraft.requestingPractice?.email]);
12944
+ const filledEmail = useRef19(void 0);
12945
+ useEffect23(() => {
12906
12946
  if (!officialForm || !physicianEmail) return;
12907
12947
  const previous = filledEmail.current;
12908
12948
  filledEmail.current = physicianEmail;
12909
12949
  setDraft((current) => current.requestingPractice?.email && current.requestingPractice.email !== previous ? current : { ...current, requestingPractice: { ...current.requestingPractice, email: physicianEmail } });
12910
12950
  }, [officialForm, physicianEmail]);
12951
+ useEffect23(() => {
12952
+ if (!officialForm || !onRefreshProfile) return;
12953
+ let last = Date.now();
12954
+ const refresh = () => {
12955
+ if (document.visibilityState === "hidden" || Date.now() - last < 2e3) return;
12956
+ last = Date.now();
12957
+ void onRefreshProfile().catch(() => void 0);
12958
+ };
12959
+ window.addEventListener("focus", refresh);
12960
+ document.addEventListener("visibilitychange", refresh);
12961
+ return () => {
12962
+ window.removeEventListener("focus", refresh);
12963
+ document.removeEventListener("visibilitychange", refresh);
12964
+ };
12965
+ }, [officialForm, onRefreshProfile]);
12911
12966
  const [administratorOverride, setAdministratorOverride] = useState26(null);
12912
12967
  const identityKey = `${identity?.claimId ?? ""}:${identity?.claimsAdminId ?? ""}`;
12913
- const previousClaim = useRef18(identityKey);
12914
- useEffect22(() => {
12968
+ const previousClaim = useRef19(identityKey);
12969
+ useEffect23(() => {
12915
12970
  if (previousClaim.current !== identityKey) {
12916
12971
  setAdministratorOverride(null);
12917
12972
  setDraft((current) => ({ ...current, authorizationContact: null, ...officialForm ? { items: [{ diagnosisCode: savedDiagnosisCodes[0] ?? "", serviceDescription: "" }] } : {} }));
@@ -12931,7 +12986,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12931
12986
  else delete draft2.claimsAdminId;
12932
12987
  }
12933
12988
  const [intent, setIntent] = useState26("save");
12934
- const intentRef = useRef18(intent);
12989
+ const intentRef = useRef19(intent);
12935
12990
  const chooseIntent = (value) => {
12936
12991
  intentRef.current = value;
12937
12992
  setIntent(value);
@@ -12981,7 +13036,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12981
13036
  event.preventDefault();
12982
13037
  if (locked) return;
12983
13038
  const next = normalizeRfaDraft(draft2);
12984
- void action.save(next, validateRfaDraft(next));
13039
+ void action.save(next, validateRfaDraft(next) ?? (officialForm && intentRef.current === "review" && !next.requestingPractice?.fax?.trim() ? "Enter the Requesting Physician fax number. The claims administrator faxes the decision back to it." : null));
12985
13040
  };
12986
13041
  const saveError = action.error ? /* @__PURE__ */ jsxs39("p", { role: "alert", children: [
12987
13042
  action.error,
@@ -13026,7 +13081,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13026
13081
  /* @__PURE__ */ jsx41("legend", { children: "Requesting Physician Information" }),
13027
13082
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-pickers", "data-columns": selectors?.physician ? 3 : 2, children: [
13028
13083
  selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { label: "Requesting physician", children: selectors.physician }) : null,
13029
- /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, ...onRefreshProfile ? { onRefreshProfile } : {} })
13084
+ /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onEditPractice, onEditLocation })
13030
13085
  ] }),
13031
13086
  /* @__PURE__ */ jsx41("fieldset", { className: "mbrfa-plain", disabled: locked, children: /* @__PURE__ */ jsx41(
13032
13087
  RfaOfficialContactFields,
@@ -13034,7 +13089,8 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13034
13089
  nameLabel: "Practice Name",
13035
13090
  value: draft2.requestingPractice,
13036
13091
  onChange: (requestingPractice) => update({ requestingPractice }),
13037
- before: /* @__PURE__ */ jsx41(RfaSavedField, { span: 6, label: "Name", value: draft2.providerName }),
13092
+ faxHint: "Required to send. The decision is faxed back here. Save it on the practice location to fill it automatically.",
13093
+ before: /* @__PURE__ */ jsx41(RfaSavedField, { span: 6, label: "Physician Name", value: draft2.providerName }),
13038
13094
  beforeEmail: /* @__PURE__ */ jsxs39(Fragment23, { children: [
13039
13095
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "Specialty", value: formDetails?.physician?.specialty ?? savedPhysician?.specialty }),
13040
13096
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "NPI Number", value: draft2.providerNpi })
@@ -13273,7 +13329,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13273
13329
  const [loading, setLoading] = useState27(true);
13274
13330
  const [error, setError] = useState27("");
13275
13331
  const [reload, setReload] = useState27(0);
13276
- useEffect23(() => {
13332
+ useEffect24(() => {
13277
13333
  let active = true;
13278
13334
  setLoading(true);
13279
13335
  setError("");
@@ -13312,16 +13368,14 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13312
13368
  active = false;
13313
13369
  };
13314
13370
  }, [client, query, effectiveClaimId, effectiveProviderId, renderingProviderId, reload]);
13315
- const refreshProfile = draftFormProps?.officialForm ? draftFormProps.onRefreshProfile : void 0;
13316
13371
  const refreshOnReturn = !!draftFormProps?.officialForm;
13317
- useEffect23(() => {
13372
+ useEffect24(() => {
13318
13373
  if (!refreshOnReturn) return;
13319
13374
  let last = Date.now();
13320
13375
  const refresh = () => {
13321
13376
  if (document.visibilityState === "hidden" || Date.now() - last < 2e3) return;
13322
13377
  last = Date.now();
13323
13378
  setReload((value) => value + 1);
13324
- void refreshProfile?.().catch(() => void 0);
13325
13379
  };
13326
13380
  window.addEventListener("focus", refresh);
13327
13381
  document.addEventListener("visibilitychange", refresh);
@@ -13329,15 +13383,15 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13329
13383
  window.removeEventListener("focus", refresh);
13330
13384
  document.removeEventListener("visibilitychange", refresh);
13331
13385
  };
13332
- }, [refreshOnReturn, refreshProfile]);
13386
+ }, [refreshOnReturn]);
13333
13387
  const claim = context?.claims.find((value) => value.claimId === selectedClaim);
13334
13388
  const provider = context?.renderingProviders.find((value) => value.id === selectedProvider);
13335
13389
  const locked = disabled || loading;
13336
- useEffect23(() => {
13390
+ useEffect24(() => {
13337
13391
  const timer = setTimeout(() => setQuery((value) => value.search === searchInput.trim() ? value : { ...value, search: searchInput.trim(), cursor: "" }), 300);
13338
13392
  return () => clearTimeout(timer);
13339
13393
  }, [searchInput]);
13340
- useEffect23(() => {
13394
+ useEffect24(() => {
13341
13395
  const timer = setTimeout(() => setQuery((value) => value.providerSearch === providerSearchInput.trim() ? value : { ...value, providerSearch: providerSearchInput.trim(), providerCursor: "" }), 300);
13342
13396
  return () => clearTimeout(timer);
13343
13397
  }, [providerSearchInput]);
@@ -13479,7 +13533,9 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13479
13533
  const selectedDetails = useRfaFormDetails(client, claim?.claimId ?? "", provider?.id ?? "", official && !!claim && !effectiveClaimId);
13480
13534
  const formDetails = {
13481
13535
  ...claim ? { employee: selectedDetails?.employee ?? { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {},
13482
- ...provider ? { physician: { specialty: provider.specialty } } : {}
13536
+ ...provider ? { physician: { specialty: provider.specialty } } : {},
13537
+ ...context?.returnFax ? { returnFax: context.returnFax } : {},
13538
+ ...context?.returnEmail ? { returnEmail: context.returnEmail } : {}
13483
13539
  };
13484
13540
  return /* @__PURE__ */ jsxs40(TreatmentDraftShell, { ...appearance, title: "New authorization request", description: official ? "DWC Form RFA" : renderClaimSelector ? "Choose a patient, then select their injury / claim. Complete the treatment and attach supporting documents below." : "Choose an existing claim or add a new patient and injury here. Complete the treatment and attach supporting documents below.", children: [
13485
13541
  addingClaim ? /* @__PURE__ */ jsx42(RfaClaimSetup, { client, disabled, onCancel: () => setAddingClaim(false), onCreated: (result) => {
@@ -13590,7 +13646,7 @@ function rfaDraftReplacement(draft2, expectedRevision) {
13590
13646
  }
13591
13647
 
13592
13648
  // src/rfa-lifecycle-controls.tsx
13593
- import { useEffect as useEffect24, useMemo as useMemo11, useRef as useRef19, useState as useState28 } from "react";
13649
+ import { useEffect as useEffect25, useMemo as useMemo11, useRef as useRef20, useState as useState28 } from "react";
13594
13650
  import { createRfaClient as createRfaClient3, createRfaLifecycleClient as createRfaLifecycleClient3 } from "@mindbill/browser";
13595
13651
  import { Fragment as Fragment25, jsx as jsx43, jsxs as jsxs41 } from "react/jsx-runtime";
13596
13652
  var text2 = (form, name) => String(form.get(name) ?? "").trim();
@@ -13609,7 +13665,7 @@ function RfaLifecycleControls({ sessionEndpoint, getSession, apiBaseUrl, fetch:
13609
13665
  }
13610
13666
  function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdated, selectedResponseDocumentId, rows: rows3 = false, ...appearance }) {
13611
13667
  const [rfa, setRfa] = useState28(providedRfa);
13612
- useEffect24(() => {
13668
+ useEffect25(() => {
13613
13669
  setRfa(providedRfa);
13614
13670
  }, [providedRfa]);
13615
13671
  const client = useMemo11(() => createRfaLifecycleClient3(options), [options]);
@@ -13625,7 +13681,7 @@ function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdat
13625
13681
  const [responsePdf, setResponsePdf] = useState28(null);
13626
13682
  const [previewError, setPreviewError] = useState28("");
13627
13683
  const [previewReload, setPreviewReload] = useState28(0);
13628
- useEffect24(() => {
13684
+ useEffect25(() => {
13629
13685
  let active = true;
13630
13686
  setResponsePdf(null);
13631
13687
  setPreviewError("");
@@ -13641,16 +13697,16 @@ function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdat
13641
13697
  };
13642
13698
  }, [records, rfa.id, responseDocument, rfa.documents, previewReload]);
13643
13699
  const [outcomes, setOutcomes] = useState28({});
13644
- const alive = useRef19(true);
13645
- const pending = useRef19(false);
13646
- const keys = useRef19(/* @__PURE__ */ new Map());
13647
- useEffect24(() => {
13700
+ const alive = useRef20(true);
13701
+ const pending = useRef20(false);
13702
+ const keys = useRef20(/* @__PURE__ */ new Map());
13703
+ useEffect25(() => {
13648
13704
  alive.current = true;
13649
13705
  return () => {
13650
13706
  alive.current = false;
13651
13707
  };
13652
13708
  }, []);
13653
- useEffect24(() => {
13709
+ useEffect25(() => {
13654
13710
  let active = true;
13655
13711
  (async () => {
13656
13712
  const found = [];
@@ -13676,7 +13732,7 @@ function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdat
13676
13732
  active = false;
13677
13733
  };
13678
13734
  }, [client, rfa.claimId, rfa.id, rfa.updatedAt, reload]);
13679
- useEffect24(() => {
13735
+ useEffect25(() => {
13680
13736
  const refresh = () => {
13681
13737
  if (!pending.current && document.visibilityState !== "hidden" && !document.activeElement?.closest("form")) setReload((value) => value + 1);
13682
13738
  };
@@ -14074,7 +14130,7 @@ function FollowUpForm({ task, selected, editable, disabled, onSave, onReview, ha
14074
14130
  }
14075
14131
 
14076
14132
  // src/rfa-provider-signature-setup.tsx
14077
- import { useRef as useRef20, useState as useState29 } from "react";
14133
+ import { useRef as useRef21, useState as useState29 } from "react";
14078
14134
  import { jsx as jsx44, jsxs as jsxs42 } from "react/jsx-runtime";
14079
14135
  function RfaProviderSignatureSetup(props) {
14080
14136
  return /* @__PURE__ */ jsx44(SignatureForm, { ...props }, props.renderingProviderId);
@@ -14085,7 +14141,7 @@ function SignatureForm({ client, renderingProviderId, providerName, disabled, on
14085
14141
  const [authorized, setAuthorized] = useState29(false);
14086
14142
  const [busy, setBusy] = useState29(false);
14087
14143
  const [error, setError] = useState29("");
14088
- const attempt = useRef20(null);
14144
+ const attempt = useRef21(null);
14089
14145
  return /* @__PURE__ */ jsx44("form", { onSubmit: async (event) => {
14090
14146
  event.preventDefault();
14091
14147
  if (busy || disabled || !file || !authorized || !actor.trim() || !client.saveProviderSignature) return;
@@ -14163,9 +14219,9 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
14163
14219
  const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
14164
14220
  return /* @__PURE__ */ jsx45(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
14165
14221
  }
14166
- function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, manageLocationsHref, onPreviewRequest, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14167
- const active = useRef21(true);
14168
- useEffect25(() => {
14222
+ function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onEditLocation, manageLocationsHref, onPreviewRequest, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14223
+ const active = useRef22(true);
14224
+ useEffect26(() => {
14169
14225
  active.current = true;
14170
14226
  return () => {
14171
14227
  active.current = false;
@@ -14173,7 +14229,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14173
14229
  }, []);
14174
14230
  const references = useMemo12(() => createBillReferenceClient2(options), [options]);
14175
14231
  const [profile, setProfile] = useState30();
14176
- const draftFormProps = { officialForm, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14232
+ const draftFormProps = { officialForm, ...onEditPractice ? { onEditPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14177
14233
  const next = await createOrganizationClient4(options).getBillingProfile();
14178
14234
  if (active.current) setProfile(next);
14179
14235
  }, ...client.searchClaimsAdministrators ? { searchClaimsAdministrators: client.searchClaimsAdministrators } : {}, ...client.getClaimsAdministratorDirectory ? { getClaimsAdministratorDirectory: client.getClaimsAdministratorDirectory } : {}, searchDiagnosisCodes: references.searchDiagnosisCodes, ...profile ? { organizationProfile: profile } : {} };
@@ -14213,7 +14269,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14213
14269
  setSelectedResponseDocumentId(context?.responseDocumentId);
14214
14270
  setSelected(id);
14215
14271
  };
14216
- useEffect25(() => {
14272
+ useEffect26(() => {
14217
14273
  if (!creating && !selected) return;
14218
14274
  let active2 = true;
14219
14275
  createOrganizationClient4(options).getBillingProfile().then((value) => {
@@ -14225,8 +14281,8 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14225
14281
  };
14226
14282
  }, [options, creating, selected]);
14227
14283
  const [loading, setLoading] = useState30(true);
14228
- const createKeys = useRef21(/* @__PURE__ */ new Map());
14229
- useEffect25(() => {
14284
+ const createKeys = useRef22(/* @__PURE__ */ new Map());
14285
+ useEffect26(() => {
14230
14286
  const timer = setTimeout(() => {
14231
14287
  setSearch(searchInput.trim());
14232
14288
  setCursor(void 0);
@@ -14234,7 +14290,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14234
14290
  }, 300);
14235
14291
  return () => clearTimeout(timer);
14236
14292
  }, [searchInput]);
14237
- useEffect25(() => {
14293
+ useEffect26(() => {
14238
14294
  if (selected || creating) return;
14239
14295
  let alive = true;
14240
14296
  let pending = false;
@@ -14432,20 +14488,20 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14432
14488
  setDetailTab("details");
14433
14489
  setTimeout(() => document.getElementById(`${tabId}-${suffix}`)?.scrollIntoView?.({ block: "start", behavior: "smooth" }), 0);
14434
14490
  };
14435
- useEffect25(() => {
14491
+ useEffect26(() => {
14436
14492
  if (selectedItem || selectedResponseDocumentId) setDetailTab("details");
14437
14493
  }, [selectedResponseDocumentId, selectedItem]);
14438
- const responseFocused = useRef21(false);
14439
- useEffect25(() => {
14494
+ const responseFocused = useRef22(false);
14495
+ useEffect26(() => {
14440
14496
  if (simple && rfa && selectedResponseDocumentId && !responseFocused.current) {
14441
14497
  responseFocused.current = true;
14442
14498
  document.getElementById(`${tabId}-review`)?.scrollIntoView?.({ block: "start" });
14443
14499
  }
14444
14500
  }, [simple, rfa, selectedResponseDocumentId, tabId]);
14445
- const alive = useRef21(true);
14446
- const pending = useRef21(false);
14447
- const loadGeneration = useRef21(0);
14448
- const keys = useRef21(/* @__PURE__ */ new Map());
14501
+ const alive = useRef22(true);
14502
+ const pending = useRef22(false);
14503
+ const loadGeneration = useRef22(0);
14504
+ const keys = useRef22(/* @__PURE__ */ new Map());
14449
14505
  const [descriptions2, setDescriptions] = useState30({});
14450
14506
  const [preview, setPreview] = useState30(null);
14451
14507
  const [previewPdf, setPreviewPdf] = useState30(null);
@@ -14457,7 +14513,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14457
14513
  const [directoryError, setDirectoryError] = useState30(null);
14458
14514
  const [directoryOpen, setDirectoryOpen] = useState30(false);
14459
14515
  const [openedDocument, setOpenedDocument] = useState30(null);
14460
- useEffect25(() => {
14516
+ useEffect26(() => {
14461
14517
  alive.current = true;
14462
14518
  return () => {
14463
14519
  alive.current = false;
@@ -14475,7 +14531,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14475
14531
  const currentForm = forms.sort((a, b) => (b.createdAt ?? "").localeCompare(a.createdAt ?? ""))[0];
14476
14532
  setDocumentIds(value.documents.filter((document2) => document2.id === currentForm?.id || ["clinical_report", "supporting_record"].includes(document2.documentType)).map((document2) => document2.id));
14477
14533
  };
14478
- useEffect25(() => {
14534
+ useEffect26(() => {
14479
14535
  let active = true;
14480
14536
  const generation = ++loadGeneration.current;
14481
14537
  setError("");
@@ -14488,9 +14544,9 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14488
14544
  active = false;
14489
14545
  };
14490
14546
  }, [client, id, reload]);
14491
- const currentRfa = useRef21(rfa);
14547
+ const currentRfa = useRef22(rfa);
14492
14548
  currentRfa.current = rfa;
14493
- useEffect25(() => {
14549
+ useEffect26(() => {
14494
14550
  let active = true;
14495
14551
  let reading = false;
14496
14552
  const refresh = async () => {
@@ -14520,8 +14576,8 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14520
14576
  document.removeEventListener("visibilitychange", resume);
14521
14577
  };
14522
14578
  }, [client, id, editing]);
14523
- const focusedTreatment = useRef21(null);
14524
- useEffect25(() => {
14579
+ const focusedTreatment = useRef22(null);
14580
+ useEffect26(() => {
14525
14581
  if (!rfa || !selectedItem || focusedTreatment.current === selectedItem) return;
14526
14582
  const element = document.getElementById(`rfa-treatment-${selectedItem}`);
14527
14583
  if (element) {
@@ -14531,7 +14587,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14531
14587
  }
14532
14588
  }, [rfa, selectedItem, detailTab]);
14533
14589
  const claimsAdminId = rfa?.claimsAdminId;
14534
- useEffect25(() => {
14590
+ useEffect26(() => {
14535
14591
  let active = true;
14536
14592
  setDirectory(null);
14537
14593
  setDirectoryError(null);
@@ -15897,7 +15953,7 @@ function BillSubmissionsRibbon({
15897
15953
  }
15898
15954
 
15899
15955
  // src/report-bill-status-dialog.tsx
15900
- import { useEffect as useEffect26, useState as useState32 } from "react";
15956
+ import { useEffect as useEffect27, useState as useState32 } from "react";
15901
15957
  import {
15902
15958
  REPORT_BILL_STATUS_OPTIONS
15903
15959
  } from "@mindbill/browser";
@@ -16118,7 +16174,7 @@ function ReportBillStatusDialog({
16118
16174
  const [phone, setPhone] = useState32("");
16119
16175
  const [callReference, setCallReference] = useState32("");
16120
16176
  const [note, setNote] = useState32("");
16121
- useEffect26(() => {
16177
+ useEffect27(() => {
16122
16178
  const onKey = (event) => {
16123
16179
  if (event.key === "Escape" && !submitting) onCancel();
16124
16180
  };
@@ -16253,7 +16309,7 @@ function ReportBillStatusDialog({
16253
16309
  }
16254
16310
 
16255
16311
  // src/payment-review.tsx
16256
- import { useEffect as useEffect27, useMemo as useMemo15, useState as useState33 } from "react";
16312
+ import { useEffect as useEffect28, useMemo as useMemo15, useState as useState33 } from "react";
16257
16313
 
16258
16314
  // src/billing-operations-client.ts
16259
16315
  import {
@@ -16428,7 +16484,7 @@ function ConnectedPaymentReview({ initialQuery, onSelectBill, onPostPayment, app
16428
16484
  const [error, setError] = useState33(false);
16429
16485
  const [retry, setRetry] = useState33(0);
16430
16486
  const invalidRange = Boolean(query.receivedFrom && query.receivedTo && query.receivedFrom > query.receivedTo);
16431
- useEffect27(() => {
16487
+ useEffect28(() => {
16432
16488
  const controller = new AbortController();
16433
16489
  setResult(null);
16434
16490
  setError(false);
@@ -16555,7 +16611,7 @@ function ConnectedPaymentReview({ initialQuery, onSelectBill, onPostPayment, app
16555
16611
  }
16556
16612
 
16557
16613
  // src/notification-settings.tsx
16558
- import { useEffect as useEffect28, useId as useId10, useRef as useRef22, useState as useState34 } from "react";
16614
+ import { useEffect as useEffect29, useId as useId10, useRef as useRef23, useState as useState34 } from "react";
16559
16615
  import { Fragment as Fragment31, jsx as jsx54, jsxs as jsxs51 } from "react/jsx-runtime";
16560
16616
  function defaultNotificationPreferences() {
16561
16617
  return { enabled: false, statusUpdates: false, agingDays: [], quietHours: true, reportDigest: "off" };
@@ -16597,8 +16653,8 @@ function NotificationSettingsSession({ adapter, appearance, className, style, on
16597
16653
  const [notice, setNotice] = useState34("");
16598
16654
  const [failed, setFailed] = useState34(false);
16599
16655
  const [reload, setReload] = useState34(0);
16600
- const request = useRef22(0);
16601
- useEffect28(() => {
16656
+ const request = useRef23(0);
16657
+ useEffect29(() => {
16602
16658
  const current = ++request.current;
16603
16659
  setPhase("loading");
16604
16660
  setSnapshot(null);
@@ -16741,7 +16797,7 @@ function NotificationSettingsSession({ adapter, appearance, className, style, on
16741
16797
  }
16742
16798
 
16743
16799
  // src/notification-recipients.tsx
16744
- import { useEffect as useEffect29, useId as useId11, useRef as useRef23, useState as useState35 } from "react";
16800
+ import { useEffect as useEffect30, useId as useId11, useRef as useRef24, useState as useState35 } from "react";
16745
16801
  import { jsx as jsx55, jsxs as jsxs52 } from "react/jsx-runtime";
16746
16802
  function notificationRecipientInvitation(input, requestId) {
16747
16803
  const preferences = notificationSettingsUpdate({ ...input, enabled: false }, false);
@@ -16782,9 +16838,9 @@ function RecipientSettingsSession({ adapter, appearance, className, style }) {
16782
16838
  const [notice, setNotice] = useState35("");
16783
16839
  const [failed, setFailed] = useState35(false);
16784
16840
  const [hasReceipt, setHasReceipt] = useState35(false);
16785
- const generation = useRef23(0);
16786
- const pending = useRef23(null);
16787
- useEffect29(() => {
16841
+ const generation = useRef24(0);
16842
+ const pending = useRef24(null);
16843
+ useEffect30(() => {
16788
16844
  const current = ++generation.current;
16789
16845
  setBusy(true);
16790
16846
  setSnapshot(null);
@@ -16939,9 +16995,9 @@ function RecipientSettingsSession({ adapter, appearance, className, style }) {
16939
16995
  // src/connected-bill-status.tsx
16940
16996
  import {
16941
16997
  useCallback as useCallback4,
16942
- useEffect as useEffect30,
16998
+ useEffect as useEffect31,
16943
16999
  useMemo as useMemo16,
16944
- useRef as useRef24,
17000
+ useRef as useRef25,
16945
17001
  useState as useState36
16946
17002
  } from "react";
16947
17003
  import {
@@ -17092,12 +17148,12 @@ function useBillStatus({
17092
17148
  const [error, setError] = useState36(null);
17093
17149
  const [isLoading, setIsLoading] = useState36(enabled && !initialData);
17094
17150
  const [isRefreshing, setIsRefreshing] = useState36(false);
17095
- const dataRef = useRef24(initialData);
17096
- const initialDataRef = useRef24(initialData);
17151
+ const dataRef = useRef25(initialData);
17152
+ const initialDataRef = useRef25(initialData);
17097
17153
  initialDataRef.current = initialData;
17098
- const activeControllerRef = useRef24(null);
17099
- const requestSequence = useRef24(0);
17100
- useEffect30(() => {
17154
+ const activeControllerRef = useRef25(null);
17155
+ const requestSequence = useRef25(0);
17156
+ useEffect31(() => {
17101
17157
  const seed = initialDataRef.current;
17102
17158
  dataRef.current = seed;
17103
17159
  setData(seed);
@@ -17138,10 +17194,10 @@ function useBillStatus({
17138
17194
  }
17139
17195
  }
17140
17196
  }, [billId, client, enabled]);
17141
- useEffect30(() => {
17197
+ useEffect31(() => {
17142
17198
  if (enabled) void load();
17143
17199
  }, [enabled, load]);
17144
- useEffect30(() => {
17200
+ useEffect31(() => {
17145
17201
  if (!enabled || refreshInterval <= 0) return;
17146
17202
  const timer = window.setInterval(() => void load(), refreshInterval);
17147
17203
  const onFocus = () => void load();
@@ -17199,7 +17255,7 @@ function ConnectedBillStatus({
17199
17255
  }
17200
17256
 
17201
17257
  // src/bill-lifecycle-surfaces.tsx
17202
- import { useEffect as useEffect31, useRef as useRef25, useState as useState37 } from "react";
17258
+ import { useEffect as useEffect32, useRef as useRef26, useState as useState37 } from "react";
17203
17259
  import { Fragment as Fragment33, jsx as jsx57, jsxs as jsxs54 } from "react/jsx-runtime";
17204
17260
  function visibleBillLifecycleActions(actions2, showUnavailable = false, maxVisible) {
17205
17261
  const visible = actions2.filter((action) => action.enabled || showUnavailable);
@@ -17277,8 +17333,8 @@ function historyDate(iso) {
17277
17333
  }
17278
17334
  function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref, onOpenDocument }) {
17279
17335
  const [expanded, setExpanded] = useState37({});
17280
- const selectedRowRef = useRef25(null);
17281
- useEffect31(() => {
17336
+ const selectedRowRef = useRef26(null);
17337
+ useEffect32(() => {
17282
17338
  if (!selectedEntryId) return;
17283
17339
  const selected = entries.find((entry) => entry.id === selectedEntryId);
17284
17340
  if (selected?.details) setExpanded((current) => current[selectedEntryId] ? current : { ...current, [selectedEntryId]: true });
@@ -17837,9 +17893,9 @@ var lifecycleSurfaceStyles = `
17837
17893
  // src/connected-bill-lifecycle.tsx
17838
17894
  import {
17839
17895
  useCallback as useCallback5,
17840
- useEffect as useEffect32,
17896
+ useEffect as useEffect33,
17841
17897
  useMemo as useMemo18,
17842
- useRef as useRef26,
17898
+ useRef as useRef27,
17843
17899
  useState as useState39
17844
17900
  } from "react";
17845
17901
  import {
@@ -18231,7 +18287,7 @@ function useBillLifecycle({
18231
18287
  const [isLoading, setIsLoading] = useState39(enabled);
18232
18288
  const [isRefreshing, setIsRefreshing] = useState39(false);
18233
18289
  const [isMutating, setIsMutating] = useState39(false);
18234
- const mounted = useRef26(true);
18290
+ const mounted = useRef27(true);
18235
18291
  const client = useMemo18(() => createBillLifecycleClient({
18236
18292
  billId: providedBillId,
18237
18293
  sessionEndpoint,
@@ -18239,12 +18295,12 @@ function useBillLifecycle({
18239
18295
  apiBaseUrl,
18240
18296
  fetch: fetchOverride
18241
18297
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
18242
- useEffect32(() => {
18298
+ useEffect33(() => {
18243
18299
  setData(null);
18244
18300
  setError(null);
18245
18301
  setIsLoading(enabled);
18246
18302
  }, [enabled, providedBillId]);
18247
- useEffect32(() => {
18303
+ useEffect33(() => {
18248
18304
  mounted.current = true;
18249
18305
  return () => {
18250
18306
  mounted.current = false;
@@ -18268,7 +18324,7 @@ function useBillLifecycle({
18268
18324
  }
18269
18325
  }
18270
18326
  }, [client, enabled]);
18271
- useEffect32(() => {
18327
+ useEffect33(() => {
18272
18328
  if (!enabled) return;
18273
18329
  void refresh();
18274
18330
  const interval2 = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -18394,10 +18450,10 @@ function useBillLifecycle({
18394
18450
  };
18395
18451
  }
18396
18452
  function LifecycleDialog({ children, title, wide = false, onClose }) {
18397
- const dialog = useRef26(null);
18398
- const onCloseRef = useRef26(onClose);
18453
+ const dialog = useRef27(null);
18454
+ const onCloseRef = useRef27(onClose);
18399
18455
  onCloseRef.current = onClose;
18400
- useEffect32(() => {
18456
+ useEffect33(() => {
18401
18457
  const previous = document.activeElement;
18402
18458
  dialog.current?.focus();
18403
18459
  const onKeyDown = (event) => event.key === "Escape" && onCloseRef.current();
@@ -18689,11 +18745,11 @@ function ConnectedBillLifecycle({
18689
18745
  const [payment, setPayment] = useState39({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
18690
18746
  const [duplicateError, setDuplicateError] = useState39("");
18691
18747
  const currentAttemptKey = data?.attempts?.find((attempt) => attempt.isCurrent)?.id ?? data?.history?.filter((entry) => entry.kind === "submission").at(-1)?.id ?? data?.bill.id;
18692
- useEffect32(() => {
18748
+ useEffect33(() => {
18693
18749
  setPanel("");
18694
18750
  }, [currentAttemptKey]);
18695
18751
  const actor = actorName?.trim() ? { actorName: actorName.trim() } : {};
18696
- const lastData = useRef26(null);
18752
+ const lastData = useRef27(null);
18697
18753
  const correctionInitialBill = useMemo18(() => data ? correctionBill(data) : null, [data]);
18698
18754
  const correctionAttachments = useMemo18(() => data ? data.bill.attachments.map((attachment) => {
18699
18755
  const documentType = correctionDocumentType(attachment.documentType);
@@ -18710,7 +18766,7 @@ function ConnectedBillLifecycle({
18710
18766
  };
18711
18767
  }) : [], [data, lifecycle]);
18712
18768
  const correctionAttentionFields = useMemo18(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields2) => fields2.indexOf(path) === index) || [], [data]);
18713
- useEffect32(() => {
18769
+ useEffect33(() => {
18714
18770
  if (!data || data === lastData.current) return;
18715
18771
  lastData.current = data;
18716
18772
  onChanged?.(data);
@@ -19204,11 +19260,11 @@ var CONNECTED_LIFECYCLE_STYLES = `
19204
19260
  // src/connected-billing-workspace.tsx
19205
19261
  import {
19206
19262
  useCallback as useCallback6,
19207
- useEffect as useEffect33,
19263
+ useEffect as useEffect34,
19208
19264
  useId as useId12,
19209
19265
  useLayoutEffect,
19210
19266
  useMemo as useMemo19,
19211
- useRef as useRef27,
19267
+ useRef as useRef28,
19212
19268
  useState as useState40
19213
19269
  } from "react";
19214
19270
  import { Fragment as Fragment36, jsx as jsx60, jsxs as jsxs57 } from "react/jsx-runtime";
@@ -19264,7 +19320,7 @@ function Surface({ appearance, className = "", style, children, surfaceRef }) {
19264
19320
  ] });
19265
19321
  }
19266
19322
  function useAvailableViewportHeight() {
19267
- const workspaceRef = useRef27(null);
19323
+ const workspaceRef = useRef28(null);
19268
19324
  const [availableHeight, setAvailableHeight] = useState40(null);
19269
19325
  useLayoutEffect(() => {
19270
19326
  const element = workspaceRef.current;
@@ -19321,7 +19377,7 @@ function BillSearchContent({
19321
19377
  if (!signal?.aborted) setLoading(false);
19322
19378
  }
19323
19379
  }, [client, query]);
19324
- useEffect33(() => {
19380
+ useEffect34(() => {
19325
19381
  const controller = new AbortController();
19326
19382
  void load(controller.signal);
19327
19383
  return () => controller.abort();
@@ -19452,7 +19508,7 @@ function BillTasksContent({ client, onDrillDown, appearance }) {
19452
19508
  if (!signal?.aborted) setLoading(false);
19453
19509
  }
19454
19510
  }, [claimsAdminId, renderingProviderId, client]);
19455
- useEffect33(() => {
19511
+ useEffect34(() => {
19456
19512
  const controller = new AbortController();
19457
19513
  void load(controller.signal);
19458
19514
  return () => controller.abort();
@@ -19516,7 +19572,7 @@ function ConnectedServiceLineItemsReport({ appearance, className, style, initial
19516
19572
  const [to, setTo] = useState40(initialTo ?? defaults.to);
19517
19573
  const [data, setData] = useState40(null);
19518
19574
  const [error, setError] = useState40(null);
19519
- useEffect33(() => {
19575
+ useEffect34(() => {
19520
19576
  const controller = new AbortController();
19521
19577
  setError(null);
19522
19578
  void client.getServiceLineItems({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -19601,7 +19657,7 @@ function ConnectedProductivityReport({ appearance, className, style, initialFrom
19601
19657
  const [to, setTo] = useState40(initialTo ?? defaults.to);
19602
19658
  const [data, setData] = useState40(null);
19603
19659
  const [error, setError] = useState40(null);
19604
- useEffect33(() => {
19660
+ useEffect34(() => {
19605
19661
  const controller = new AbortController();
19606
19662
  setError(null);
19607
19663
  void client.getProductivity({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -19885,9 +19941,9 @@ function DentalDraftEditor({ initialContent, onSave, disabled = false, ...appear
19885
19941
 
19886
19942
  // src/index.tsx
19887
19943
  function widget(tagName, props) {
19888
- const ref = useRef28(null);
19944
+ const ref = useRef29(null);
19889
19945
  const { onMindBill, onMindBillError } = props;
19890
- useEffect34(() => {
19946
+ useEffect35(() => {
19891
19947
  const element = ref.current;
19892
19948
  if (!element) return;
19893
19949
  const handleEvent = (event) => onMindBill?.(event);