@mindbill/react 0.77.36 → 0.77.37

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
@@ -10049,14 +10049,14 @@ 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 useRef13, useState as useState17 } from "react";
10052
+ import { useEffect as useEffect15, useMemo as useMemo7, useRef as useRef13, useState as useState18 } 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 useRef11, useState as useState15 } from "react";
10056
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState16 } from "react";
10057
10057
 
10058
10058
  // src/rfa-authorization-destination.tsx
10059
- import { useEffect as useEffect12, useRef as useRef10, useState as useState14 } from "react";
10059
+ import { useEffect as useEffect13, useRef as useRef10, useState as useState15 } from "react";
10060
10060
 
10061
10061
  // src/rfa-identity-select.tsx
10062
10062
  import { useId as useId5, useRef as useRef9, useState as useState13 } from "react";
@@ -10120,28 +10120,131 @@ function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, quer
10120
10120
  ] });
10121
10121
  }
10122
10122
 
10123
+ // src/rfa-official-fields.tsx
10124
+ import { useEffect as useEffect12, useState as useState14 } from "react";
10125
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10126
+ var formDate = (value) => {
10127
+ const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(value ?? "");
10128
+ return match ? `${match[2]}/${match[3]}/${match[1]}` : value ?? "";
10129
+ };
10130
+ function RfaRequired() {
10131
+ return /* @__PURE__ */ jsx23("span", { className: "mbrfa-req", title: "Required", children: " *" });
10132
+ }
10133
+ function RfaPicker({ label: label5, children, required: required2 }) {
10134
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-picker", children: [
10135
+ /* @__PURE__ */ jsxs21("span", { children: [
10136
+ label5,
10137
+ required2 ? /* @__PURE__ */ jsx23(RfaRequired, {}) : null
10138
+ ] }),
10139
+ children
10140
+ ] });
10141
+ }
10142
+ function RfaSavedField({ label: label5, value, span }) {
10143
+ return /* @__PURE__ */ jsxs21("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
10144
+ /* @__PURE__ */ jsx23("span", { children: label5 }),
10145
+ /* @__PURE__ */ jsx23("strong", { children: value || "\u2014" })
10146
+ ] });
10147
+ }
10148
+ function RfaEmployeeFields({ name, dateOfInjury, claimNumber, details }) {
10149
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-form-grid", children: [
10150
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 6, label: "Name (Last, First, Middle)", value: details?.formName || name }),
10151
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Date of Injury (MM/DD/YYYY)", value: formDate(dateOfInjury) }),
10152
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Date of Birth (MM/DD/YYYY)", value: formDate(details?.dateOfBirth) }),
10153
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Claim Number", value: claimNumber }),
10154
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Employer", value: details?.employer })
10155
+ ] });
10156
+ }
10157
+ function formatRfaPhone(value) {
10158
+ const raw = value ?? "";
10159
+ if (/[^\d\s().+-]/.test(raw)) return raw;
10160
+ let digits = raw.replace(/\D/g, "");
10161
+ if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1);
10162
+ if (digits.length > 10) return raw;
10163
+ if (digits.length < 4) return digits;
10164
+ return digits.length < 7 ? `(${digits.slice(0, 3)}) ${digits.slice(3)}` : `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
10165
+ }
10166
+ var contactRows = [
10167
+ ["address", "Address", 500, 3],
10168
+ ["city", "City", 100, 2],
10169
+ ["state", "State", 2, 1],
10170
+ ["zip", "Zip Code", 20, 2],
10171
+ ["phone", "Phone", 30, 2],
10172
+ ["fax", "Fax Number", 30, 2]
10173
+ ];
10174
+ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, required: required2 = [], editable = true }) {
10175
+ const dial = (key2) => key2 === "phone" || key2 === "fax";
10176
+ const mark = (key2) => required2.includes(key2) ? /* @__PURE__ */ jsx23(RfaRequired, {}) : null;
10177
+ const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs21("label", { className: `mbrfa-s${span}`, children: [
10178
+ /* @__PURE__ */ jsxs21("span", { children: [
10179
+ label5,
10180
+ mark(key2)
10181
+ ] }),
10182
+ /* @__PURE__ */ jsx23("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: dial(key2) ? formatRfaPhone(event.target.value) : event.target.value }) })
10183
+ ] }, key2) : /* @__PURE__ */ jsxs21("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
10184
+ /* @__PURE__ */ jsxs21("span", { children: [
10185
+ label5,
10186
+ mark(key2)
10187
+ ] }),
10188
+ /* @__PURE__ */ jsx23("strong", { children: (dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2])?.trim() || "\u2014" })
10189
+ ] }, key2);
10190
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-form-grid mbrfa-contact-grid", children: [
10191
+ before,
10192
+ field("name", nameLabel, 200, 3),
10193
+ field("contactName", "Contact Name", 200, 3),
10194
+ contactRows.map(([key2, label5, max, span]) => field(key2, label5, max, span)),
10195
+ beforeEmail,
10196
+ field("email", "E-mail Address", 254, 6)
10197
+ ] });
10198
+ }
10199
+ function RfaManualToggle({ manual, onChange, disabled }) {
10200
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-section-actions", children: [
10201
+ /* @__PURE__ */ jsx23("button", { type: "button", className: manual ? "mbtd-primary" : void 0, disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Save" : "Edit manually" }),
10202
+ manual ? /* @__PURE__ */ jsx23("span", { children: "Applies to this request only. The saved record is not changed." }) : null
10203
+ ] });
10204
+ }
10205
+ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
10206
+ const [details, setDetails] = useState14();
10207
+ useEffect12(() => {
10208
+ let active = true;
10209
+ setDetails(void 0);
10210
+ if (!enabled || !claimId) return;
10211
+ void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
10212
+ if (!active) return;
10213
+ const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
10214
+ 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 } } : {} });
10215
+ }).catch(() => void 0);
10216
+ return () => {
10217
+ active = false;
10218
+ };
10219
+ }, [client, claimId, renderingProviderId, enabled]);
10220
+ return details;
10221
+ }
10222
+
10123
10223
  // src/rfa-authorization-destination.tsx
10124
10224
  import { normalizeRfaFax, rfaAuthorizationDestinations, rfaAuthorizationGuidance as rfaAuthorizationGuidance2 } from "@mindbill/browser";
10125
- import { Fragment as Fragment13, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10126
- function RfaAuthorizationDestination({ contextKey, directory, savedContact, loading = false, error, disabled = false, onChange, onSelectionStart, compact = false, onManualEntry }) {
10225
+ import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10226
+ function RfaAuthorizationDestination({ contextKey, directory, savedContact, loading = false, error, disabled = false, onChange, onSelectionStart, compact = false, onManualEntry, autoSelectSingle = false }) {
10127
10227
  const options = loading || error ? [] : rfaAuthorizationDestinations(directory);
10128
10228
  const fax = savedContact?.fax ? normalizeRfaFax(savedContact.fax) : null;
10129
10229
  const savedLabel = savedContact?.contactName || savedContact?.name || "Saved request contact";
10130
10230
  if (fax && !options.some((option) => option.method === "fax" && option.destination === fax)) options.unshift({ method: "fax", destination: fax, label: savedLabel, ...savedContact?.contactName ? { recipientName: savedContact.contactName } : {} });
10131
10231
  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 } : {} });
10132
10232
  const signature = JSON.stringify([contextKey, directory?.authorizationStatus, options, loading, error]);
10133
- const [selection, setSelection] = useState14("");
10134
- const [manual, setManual] = useState14("");
10135
- const [query, setQuery] = useState14("");
10136
- const [contactName, setContactName] = useState14("");
10233
+ const [selection, setSelection] = useState15("");
10234
+ const [manual, setManual] = useState15("");
10235
+ const [query, setQuery] = useState15("");
10236
+ const [contactName, setContactName] = useState15("");
10137
10237
  const needsAdjuster = directory?.authorizationStatus === "adjuster_specific_required";
10138
10238
  const callback = useRef10(onChange);
10139
10239
  callback.current = onChange;
10140
- useEffect12(() => {
10141
- setSelection("");
10240
+ const auto = useRef10(autoSelectSingle);
10241
+ auto.current = autoSelectSingle;
10242
+ useEffect13(() => {
10142
10243
  setManual("");
10143
- setContactName("");
10144
- callback.current(null);
10244
+ const only = auto.current && !needsAdjuster && options.length === 1 ? options[0] : void 0;
10245
+ setSelection(only ? "0" : "");
10246
+ setContactName(only?.recipientName ?? "");
10247
+ callback.current(only ?? null);
10145
10248
  }, [signature]);
10146
10249
  const chosen = selection !== "" ? options[Number(selection)] : void 0;
10147
10250
  const emit = (nextSelection, value, name) => {
@@ -10164,16 +10267,16 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10164
10267
  setContactName(name);
10165
10268
  emit(value, "", name);
10166
10269
  };
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
10270
+ const guidance = /* @__PURE__ */ jsxs22(Fragment13, { children: [
10271
+ /* @__PURE__ */ jsx24("p", { style: { margin: 0 }, children: loading ? "Loading authorization contacts\u2026" : error ? "Directory details are unavailable. Confirm a destination with the handling adjuster." : rfaAuthorizationGuidance2(directory) }),
10272
+ directory?.authorizationNotice ? /* @__PURE__ */ jsx24("p", { style: { margin: 0 }, children: directory.authorizationNotice }) : null
10170
10273
  ] });
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" }),
10274
+ return /* @__PURE__ */ jsxs22("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: [
10275
+ compact ? null : /* @__PURE__ */ jsxs22(Fragment13, { children: [
10276
+ /* @__PURE__ */ jsx24("legend", { children: "Authorization destination" }),
10174
10277
  guidance
10175
10278
  ] }),
10176
- compact ? /* @__PURE__ */ jsx23(
10279
+ compact ? /* @__PURE__ */ jsx24(
10177
10280
  RfaIdentitySelect,
10178
10281
  {
10179
10282
  label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
@@ -10184,7 +10287,7 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10184
10287
  searchable: true,
10185
10288
  disabled: disabled || loading,
10186
10289
  value: selection,
10187
- options: [...options.map((option, index) => ({ id: String(index), label: option.label, detail: `${option.method === "fax" ? "Fax" : "E-mail"} ${option.destination}` })), ...onManualEntry ? [{ id: "manual-entry", label: needsAdjuster ? "Enter the handling adjuster\u2019s contact manually" : "Enter a different contact manually" }] : [{ 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())),
10290
+ options: [...options.map((option, index) => ({ id: String(index), .../[a-z]/i.test(option.label) ? { label: option.label, detail: option.method === "fax" ? `Fax ${formatRfaPhone(option.destination)}` : option.destination } : { label: option.method === "fax" ? "Authorization fax" : "Authorization e-mail", detail: option.method === "fax" ? formatRfaPhone(option.destination) : option.destination } })), ...onManualEntry ? [{ id: "manual-entry", label: needsAdjuster ? "Enter the handling adjuster\u2019s contact manually" : "Enter a different contact manually" }] : [{ 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
10291
  onSelect: (value) => {
10189
10292
  setQuery("");
10190
10293
  if (value === "manual-entry") {
@@ -10194,115 +10297,115 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10194
10297
  pick(value);
10195
10298
  }
10196
10299
  }
10197
- ) : /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10300
+ ) : /* @__PURE__ */ jsxs22("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10198
10301
  directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10199
- /* @__PURE__ */ jsxs21("select", { value: selection, onChange: (event) => pick(event.target.value), style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10200
- /* @__PURE__ */ jsx23("option", { value: "", children: "Choose a destination\u2026" }),
10201
- options.map((option, index) => /* @__PURE__ */ jsxs21("option", { value: String(index), children: [
10302
+ /* @__PURE__ */ jsxs22("select", { value: selection, onChange: (event) => pick(event.target.value), style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10303
+ /* @__PURE__ */ jsx24("option", { value: "", children: "Choose a destination\u2026" }),
10304
+ options.map((option, index) => /* @__PURE__ */ jsxs22("option", { value: String(index), children: [
10202
10305
  option.label,
10203
10306
  " \xB7 ",
10204
10307
  option.method === "fax" ? "Fax" : "Email",
10205
10308
  ": ",
10206
10309
  option.destination
10207
10310
  ] }, `${option.method}:${option.destination}:${index}`)),
10208
- /* @__PURE__ */ jsx23("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10209
- /* @__PURE__ */ jsx23("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
10311
+ /* @__PURE__ */ jsx24("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10312
+ /* @__PURE__ */ jsx24("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
10210
10313
  ] })
10211
10314
  ] }),
10212
- selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6 }, children: [
10315
+ selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs22("label", { style: { display: "grid", gap: 6 }, children: [
10213
10316
  needsAdjuster ? "Handling adjuster name (required)" : "Recipient / attention (optional)",
10214
- /* @__PURE__ */ jsx23("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10317
+ /* @__PURE__ */ jsx24("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10215
10318
  setContactName(event.target.value);
10216
10319
  emit(selection, manual, event.target.value);
10217
10320
  } })
10218
10321
  ] }) : null,
10219
- selection === "manual-email" ? /* @__PURE__ */ jsxs21("label", { children: [
10322
+ selection === "manual-email" ? /* @__PURE__ */ jsxs22("label", { children: [
10220
10323
  "Authorization email address",
10221
- /* @__PURE__ */ jsx23("input", { type: "email", value: manual, onChange: (event) => {
10324
+ /* @__PURE__ */ jsx24("input", { type: "email", value: manual, onChange: (event) => {
10222
10325
  const value = event.target.value;
10223
10326
  setManual(value);
10224
10327
  emit(selection, value, contactName);
10225
10328
  } })
10226
- ] }) : selection === "manual" ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10329
+ ] }) : selection === "manual" ? /* @__PURE__ */ jsxs22("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10227
10330
  "Authorization fax number",
10228
- /* @__PURE__ */ jsx23("input", { type: "tel", value: manual, onChange: (event) => {
10331
+ /* @__PURE__ */ jsx24("input", { type: "tel", value: manual, onChange: (event) => {
10229
10332
  const value = event.target.value;
10230
10333
  setManual(value);
10231
10334
  emit(selection, value, contactName);
10232
10335
  }, style: { padding: 10, width: "100%", minWidth: 0, boxSizing: "border-box", font: "inherit" } })
10233
- ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10234
- chosen.method === "email" ? /* @__PURE__ */ jsxs21("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10336
+ ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs22(Fragment13, { children: [
10337
+ chosen.method === "email" ? /* @__PURE__ */ jsxs22("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10235
10338
  "Email: ",
10236
10339
  chosen.destination,
10237
10340
  ". Review this recipient before preparing and sending the packet."
10238
10341
  ] }) : null,
10239
- chosen.phone ? /* @__PURE__ */ jsxs21("small", { children: [
10342
+ chosen.phone ? /* @__PURE__ */ jsxs22("small", { children: [
10240
10343
  "Telephone for questions: ",
10241
- chosen.phone
10344
+ formatRfaPhone(chosen.phone)
10242
10345
  ] }) : null
10243
10346
  ] }) : null,
10244
- compact ? /* @__PURE__ */ jsx23("small", { className: "mbrfa-guidance", children: guidance }) : null
10347
+ compact ? /* @__PURE__ */ jsx24("small", { className: "mbrfa-guidance", children: guidance }) : null
10245
10348
  ] });
10246
10349
  }
10247
10350
 
10248
10351
  // src/rfa-delivery-panel.tsx
10249
- import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10352
+ import { Fragment as Fragment14, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10250
10353
  function RfaPdfReview({ blob, title }) {
10251
- const [url, setUrl] = useState15("");
10252
- useEffect13(() => {
10354
+ const [url, setUrl] = useState16("");
10355
+ useEffect14(() => {
10253
10356
  const next = URL.createObjectURL(blob);
10254
10357
  setUrl(next);
10255
10358
  return () => URL.revokeObjectURL(next);
10256
10359
  }, [blob]);
10257
- return /* @__PURE__ */ jsx24("div", { children: url ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10258
- /* @__PURE__ */ jsxs22("div", { className: "mbtd-actions", children: [
10259
- /* @__PURE__ */ jsxs22("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
10360
+ return /* @__PURE__ */ jsx25("div", { children: url ? /* @__PURE__ */ jsxs23(Fragment14, { children: [
10361
+ /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10362
+ /* @__PURE__ */ jsxs23("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
10260
10363
  "Open ",
10261
10364
  title,
10262
10365
  " PDF"
10263
10366
  ] }),
10264
- /* @__PURE__ */ jsx24("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10367
+ /* @__PURE__ */ jsx25("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10265
10368
  ] }),
10266
- /* @__PURE__ */ jsx24("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10369
+ /* @__PURE__ */ jsx25("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10267
10370
  ] }) : null });
10268
10371
  }
10269
10372
  function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoading, directoryError, locked, environment, canSend, run, onUpdated }) {
10270
- const [mode, setMode] = useState15("send");
10271
- const [destination, setDestination] = useState15(null);
10272
- const [message, setMessage] = useState15("");
10273
- const [prepared, setPrepared] = useState15(null);
10274
- const [reviewed, setReviewed] = useState15(false);
10275
- const [confirmed, setConfirmed] = useState15(false);
10373
+ const [mode, setMode] = useState16("send");
10374
+ const [destination, setDestination] = useState16(null);
10375
+ const [message, setMessage] = useState16("");
10376
+ const [prepared, setPrepared] = useState16(null);
10377
+ const [reviewed, setReviewed] = useState16(false);
10378
+ const [confirmed, setConfirmed] = useState16(false);
10276
10379
  const keys = useRef11(/* @__PURE__ */ new Map());
10277
10380
  const fingerprint = JSON.stringify([rfa.id, rfa.contentRevision, documentIds, mode, destination?.method, destination?.destination, destination?.recipientName, message.trim()]);
10278
10381
  const current = useRef11(fingerprint);
10279
10382
  current.current = fingerprint;
10280
- useEffect13(() => {
10383
+ useEffect14(() => {
10281
10384
  setPrepared(null);
10282
10385
  setReviewed(false);
10283
10386
  setConfirmed(false);
10284
10387
  }, [fingerprint]);
10285
10388
  const packet = prepared?.fingerprint === fingerprint ? prepared : null;
10286
- return /* @__PURE__ */ jsxs22("fieldset", { children: [
10287
- /* @__PURE__ */ jsx24("legend", { children: "Review packet and send" }),
10288
- !rfa.readiness.ready ? /* @__PURE__ */ jsxs22("p", { children: [
10389
+ return /* @__PURE__ */ jsxs23("fieldset", { children: [
10390
+ /* @__PURE__ */ jsx25("legend", { children: "Review packet and send" }),
10391
+ !rfa.readiness.ready ? /* @__PURE__ */ jsxs23("p", { children: [
10289
10392
  "Still needed: ",
10290
10393
  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",
10291
10394
  "."
10292
10395
  ] }) : null,
10293
- /* @__PURE__ */ jsxs22("label", { children: [
10396
+ /* @__PURE__ */ jsxs23("label", { children: [
10294
10397
  "Delivery method",
10295
- /* @__PURE__ */ jsxs22("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10296
- /* @__PURE__ */ jsx24("option", { value: "send", children: "Send to claims administrator" }),
10297
- /* @__PURE__ */ jsx24("option", { value: "download", children: "Download for manual submission" })
10398
+ /* @__PURE__ */ jsxs23("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10399
+ /* @__PURE__ */ jsx25("option", { value: "send", children: "Send to claims administrator" }),
10400
+ /* @__PURE__ */ jsx25("option", { value: "download", children: "Download for manual submission" })
10298
10401
  ] })
10299
10402
  ] }),
10300
- 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." }),
10301
- /* @__PURE__ */ jsxs22("label", { children: [
10403
+ mode === "send" ? /* @__PURE__ */ jsx25(RfaAuthorizationDestination, { contextKey: `${rfa.id}:${rfa.claimsAdminId ?? "manual"}`, directory, savedContact: rfa.authorizationContact, loading: directoryLoading, error: directoryError, disabled: locked, onChange: setDestination }) : /* @__PURE__ */ jsx25("p", { children: "Downloading does not mark this request as sent. Keep proof of any submission made outside this dashboard." }),
10404
+ /* @__PURE__ */ jsxs23("label", { children: [
10302
10405
  destination?.method === "email" && mode === "send" ? "Email message (optional)" : "Fax cover sheet message (optional)",
10303
- /* @__PURE__ */ jsx24("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10406
+ /* @__PURE__ */ jsx25("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10304
10407
  ] }),
10305
- /* @__PURE__ */ jsx24("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10408
+ /* @__PURE__ */ jsx25("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10306
10409
  const requestFingerprint = fingerprint;
10307
10410
  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() } : {} });
10308
10411
  const blob = await client.getPacket(rfa.id, preview.packetId);
@@ -10312,25 +10415,25 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10312
10415
  setConfirmed(false);
10313
10416
  }
10314
10417
  }), children: "Prepare packet with cover sheet" }),
10315
- packet ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10316
- /* @__PURE__ */ jsx24(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10317
- /* @__PURE__ */ jsxs22("label", { className: "mbrfa-check", children: [
10318
- /* @__PURE__ */ jsx24("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
10418
+ packet ? /* @__PURE__ */ jsxs23(Fragment14, { children: [
10419
+ /* @__PURE__ */ jsx25(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10420
+ /* @__PURE__ */ jsxs23("label", { className: "mbrfa-check", children: [
10421
+ /* @__PURE__ */ jsx25("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
10319
10422
  setReviewed(event.target.checked);
10320
10423
  setConfirmed(false);
10321
10424
  } }),
10322
10425
  "I reviewed the assembled packet, including the cover sheet and clinical documents."
10323
10426
  ] })
10324
10427
  ] }) : null,
10325
- 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: [
10326
- /* @__PURE__ */ jsxs22("label", { className: "mbrfa-check", children: [
10327
- /* @__PURE__ */ jsx24("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
10428
+ mode === "send" ? environment !== "live" ? /* @__PURE__ */ jsx25("p", { className: "mbtd-note", children: "Sandbox: review and prepare the packet here. External fax delivery is disabled. Email sending is also disabled." }) : !canSend ? /* @__PURE__ */ jsx25("p", { children: "Sending requires permission from your organization." }) : /* @__PURE__ */ jsxs23(Fragment14, { children: [
10429
+ /* @__PURE__ */ jsxs23("label", { className: "mbrfa-check", children: [
10430
+ /* @__PURE__ */ jsx25("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
10328
10431
  "Send this reviewed packet to ",
10329
10432
  destination?.recipientName ? `${destination.recipientName} at ` : "",
10330
10433
  destination?.destination || "the selected authorization recipient",
10331
10434
  ". I verified the recipient for this claim."
10332
10435
  ] }),
10333
- /* @__PURE__ */ jsx24("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10436
+ /* @__PURE__ */ jsx25("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10334
10437
  if (!packet || !destination || !confirmed || !reviewed) return;
10335
10438
  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() } : {} };
10336
10439
  const signature = JSON.stringify(body);
@@ -10346,13 +10449,13 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10346
10449
  }
10347
10450
 
10348
10451
  // src/treatment-draft-shared.tsx
10349
- import { useRef as useRef12, useState as useState16 } from "react";
10350
- import { Fragment as Fragment15, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10452
+ import { useRef as useRef12, useState as useState17 } from "react";
10453
+ import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10351
10454
  function useDraftSave(onSave) {
10352
10455
  const pending = useRef12(false);
10353
- const [busy, setBusy] = useState16(false);
10354
- const [message, setMessage] = useState16("");
10355
- const [error, setError] = useState16(null);
10456
+ const [busy, setBusy] = useState17(false);
10457
+ const [message, setMessage] = useState17("");
10458
+ const [error, setError] = useState17(null);
10356
10459
  const clear = () => {
10357
10460
  setMessage("");
10358
10461
  setError(null);
@@ -10379,8 +10482,8 @@ function useDraftSave(onSave) {
10379
10482
  return { busy, message, error, clear, save };
10380
10483
  }
10381
10484
  function TreatmentDraftShell({ title, description, children, hideHeading = false, appearance, className = "", style }) {
10382
- return /* @__PURE__ */ jsxs23("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10383
- /* @__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}
10485
+ return /* @__PURE__ */ jsxs24("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10486
+ /* @__PURE__ */ jsx26("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}
10384
10487
  .mbtd .mbrfa-request-details>.mbtd-grid{display:flex;flex-direction:column;gap:12px}
10385
10488
  .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)}
10386
10489
  .mbtd .mbrfa-request-details .mbrfa-check{min-height:44px;align-items:flex-start;gap:10px;line-height:20px;cursor:pointer}
@@ -10402,6 +10505,8 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10402
10505
  .mbtd .mbrfa-picker p,.mbtd .mbrfa-guidance p{margin:0;font-size:12px}.mbtd .mbrfa-guidance{display:grid;gap:4px}
10403
10506
  .mbtd .mbrfa-section-actions{display:flex;gap:12px;align-items:center;margin-top:14px;font-size:12px;color:var(--mb-muted)}
10404
10507
  .mbtd .mbrfa-field-hint{font-size:12px;color:var(--mb-muted);font-weight:400}
10508
+ .mbtd .mbrfa-req{color:var(--mb-danger,#c0392b);font-weight:700}
10509
+ .mbtd .mbrfa-contact-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.mbtd .mbrfa-contact-grid>.mbrfa-s3{grid-column:span 2}.mbtd .mbrfa-contact-grid>:is(.mbrfa-s1,.mbrfa-s2){grid-column:span 1}
10405
10510
  .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}
10406
10511
  .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}
10407
10512
  .mbtd fieldset.mbrfa-plain.mbrfa-plain{border:0;padding:0;margin:0;background:none;border-radius:0;min-width:0}
@@ -10431,9 +10536,9 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10431
10536
  @media(max-width:640px){.mbtd .mbrfa-request-types{grid-template-columns:1fr;gap:4px}}
10432
10537
  @media(forced-colors:active){.mbtd .mbrfa-request-types input[type=radio]{appearance:auto}.mbtd .mbrfa-request-types input[type=radio]::after{display:none}}
10433
10538
  .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}}` }),
10434
- !hideHeading ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
10435
- /* @__PURE__ */ jsx25("h2", { children: title }),
10436
- /* @__PURE__ */ jsx25("p", { children: description })
10539
+ !hideHeading ? /* @__PURE__ */ jsxs24(Fragment15, { children: [
10540
+ /* @__PURE__ */ jsx26("h2", { children: title }),
10541
+ /* @__PURE__ */ jsx26("p", { children: description })
10437
10542
  ] }) : null,
10438
10543
  children
10439
10544
  ] });
@@ -10443,7 +10548,7 @@ function isDraftDate(value) {
10443
10548
  }
10444
10549
 
10445
10550
  // src/rfa-task-board.tsx
10446
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10551
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
10447
10552
  function rfaTaskState(task, now = Date.now()) {
10448
10553
  if (task.status === "resolved" || task.resolvedAt) return "Completed";
10449
10554
  return Date.parse(task.snoozedUntil ?? task.dueAt) > now ? "Scheduled" : "Due";
@@ -10485,37 +10590,37 @@ var date3 = (value) => new Date(value).toLocaleString();
10485
10590
  function RfaTaskBoard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
10486
10591
  const options = useMemo7(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
10487
10592
  const identity = useMemo7(() => crypto.randomUUID(), [options]);
10488
- return /* @__PURE__ */ jsx26(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10593
+ return /* @__PURE__ */ jsx27(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10489
10594
  }
10490
10595
  function TaskBoardContent({ options, patientId, claimId, renderingProviderId, permissions = [], onSelect, embedded = false, presentation = "dashboard", query, getTaskHref, onNavigate, renderTaskIdentity, ...appearance }) {
10491
10596
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10492
10597
  const requests = useMemo7(() => createRfaClient(options), [options]);
10493
- const [requestIdentities, setRequestIdentities] = useState17({});
10494
- const [tasks, setTasks] = useState17([]);
10495
- const [error, setError] = useState17("");
10496
- const [loading, setLoading] = useState17(true);
10497
- const [now, setNow] = useState17(Date.now);
10498
- const [inboxCount, setInboxCount] = useState17(null);
10499
- useEffect14(() => {
10598
+ const [requestIdentities, setRequestIdentities] = useState18({});
10599
+ const [tasks, setTasks] = useState18([]);
10600
+ const [error, setError] = useState18("");
10601
+ const [loading, setLoading] = useState18(true);
10602
+ const [now, setNow] = useState18(Date.now);
10603
+ const [inboxCount, setInboxCount] = useState18(null);
10604
+ useEffect15(() => {
10500
10605
  const timer = setInterval(() => setNow(Date.now()), 6e4);
10501
10606
  return () => clearInterval(timer);
10502
10607
  }, []);
10503
- const [view, setView] = useState17(query?.state ?? "Due");
10504
- const [selection, setSelection] = useState17(null);
10608
+ const [view, setView] = useState18(query?.state ?? "Due");
10609
+ const [selection, setSelection] = useState18(null);
10505
10610
  const list3 = presentation === "list";
10506
- useEffect14(() => {
10611
+ useEffect15(() => {
10507
10612
  setView(query?.state ?? "Due");
10508
10613
  setSelection(null);
10509
10614
  }, [query]);
10510
10615
  const activeSelection = list3 ? query ?? {} : selection;
10511
10616
  const drilldown = useRef13(null);
10512
- useEffect14(() => {
10617
+ useEffect15(() => {
10513
10618
  if (selection) {
10514
10619
  drilldown.current?.scrollIntoView?.({ block: "nearest" });
10515
10620
  drilldown.current?.focus({ preventScroll: true });
10516
10621
  }
10517
10622
  }, [selection]);
10518
- useEffect14(() => {
10623
+ useEffect15(() => {
10519
10624
  let active = true;
10520
10625
  let pending = false;
10521
10626
  const load = async (background = false) => {
@@ -10565,7 +10670,7 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10565
10670
  const stateTasks = tasks.filter((task) => rfaTaskState(task, now) === view);
10566
10671
  const filtered = stateTasks.filter((task) => (!activeSelection?.kind || task.kind === activeSelection.kind) && (!activeSelection?.kinds || activeSelection.kinds.includes(task.kind)) && (!activeSelection?.bucket || rfaTaskAgeBucket(task.createdAt, now) === activeSelection.bucket));
10567
10672
  const visibleRequests = JSON.stringify(list3 && !renderTaskIdentity ? [...new Map(filtered.map((task) => [task.rfaId, task.claimId])).entries()].sort(([a], [b]) => a.localeCompare(b)) : []);
10568
- useEffect14(() => {
10673
+ useEffect15(() => {
10569
10674
  let active = true;
10570
10675
  setRequestIdentities({});
10571
10676
  const load = async () => {
@@ -10591,15 +10696,15 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10591
10696
  if (renderTaskIdentity) return renderTaskIdentity(task);
10592
10697
  if (!list3) return null;
10593
10698
  const record2 = requestIdentities[task.rfaId];
10594
- return record2 ? /* @__PURE__ */ jsxs24("div", { className: "mbrfa-task-identity", children: [
10595
- /* @__PURE__ */ jsx26("span", { children: record2.employeeName }),
10596
- /* @__PURE__ */ jsxs24("small", { children: [
10699
+ return record2 ? /* @__PURE__ */ jsxs25("div", { className: "mbrfa-task-identity", children: [
10700
+ /* @__PURE__ */ jsx27("span", { children: record2.employeeName }),
10701
+ /* @__PURE__ */ jsxs25("small", { children: [
10597
10702
  "Claim ",
10598
10703
  record2.claimNumber || record2.claimId,
10599
10704
  record2.displayReference ? ` \xB7 ${record2.displayReference}` : ""
10600
10705
  ] }),
10601
- /* @__PURE__ */ jsx26("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10602
- ] }) : /* @__PURE__ */ jsxs24("small", { children: [
10706
+ /* @__PURE__ */ jsx27("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10707
+ ] }) : /* @__PURE__ */ jsxs25("small", { children: [
10603
10708
  "Request ",
10604
10709
  task.rfaId,
10605
10710
  " \xB7 Claim ",
@@ -10611,19 +10716,19 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10611
10716
  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");
10612
10717
  const selectionControl = (next, text3, ariaLabel) => {
10613
10718
  const target = { ...next, state: view };
10614
- if (!getTaskHref) return /* @__PURE__ */ jsx26("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10719
+ if (!getTaskHref) return /* @__PURE__ */ jsx27("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10615
10720
  const href = getTaskHref(target);
10616
- return /* @__PURE__ */ jsx26("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10721
+ return /* @__PURE__ */ jsx27("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10617
10722
  if (!onNavigate || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
10618
10723
  event.preventDefault();
10619
10724
  onNavigate(href);
10620
10725
  }, children: text3 });
10621
10726
  };
10622
- 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" });
10623
- 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: [
10624
- /* @__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}}` }),
10625
- /* @__PURE__ */ jsx26("strong", { children: "Task status" }),
10626
- /* @__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: () => {
10727
+ 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__ */ jsx27("span", { className: "mbrfa-task-zero", children: "0" });
10728
+ return /* @__PURE__ */ jsxs25(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: [
10729
+ /* @__PURE__ */ jsx27("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}}` }),
10730
+ /* @__PURE__ */ jsx27("strong", { children: "Task status" }),
10731
+ /* @__PURE__ */ jsx27("div", { className: "mbrfa-task-tabs", role: "group", "aria-label": "Task status", children: ["Due", "Scheduled", "Completed"].map((state) => /* @__PURE__ */ jsxs25("button", { type: "button", "aria-pressed": view === state, onClick: () => {
10627
10732
  if (list3 && getTaskHref) {
10628
10733
  const href = getTaskHref({ ...query, state });
10629
10734
  if (onNavigate) onNavigate(href);
@@ -10638,112 +10743,112 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10638
10743
  tasks.filter((task) => rfaTaskState(task, now) === state).length,
10639
10744
  ")"
10640
10745
  ] }, state)) }),
10641
- /* @__PURE__ */ jsx26("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10642
- error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10643
- loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs24("p", { children: [
10746
+ /* @__PURE__ */ jsx27("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10747
+ error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: error }) : null,
10748
+ loading ? /* @__PURE__ */ jsx27("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs25("p", { children: [
10644
10749
  "No ",
10645
10750
  view.toLowerCase(),
10646
10751
  " tasks."
10647
10752
  ] }) : null,
10648
- !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,
10753
+ !list3 && !loading && stateTasks.length ? /* @__PURE__ */ jsx27("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,
10649
10754
  !list3 ? groups2.map((group) => {
10650
10755
  const groupTasks = stateTasks.filter((task) => group.kinds.includes(task.kind));
10651
- return /* @__PURE__ */ jsx26("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs24("table", { children: [
10652
- /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10653
- /* @__PURE__ */ jsxs24("th", { scope: "col", children: [
10756
+ return /* @__PURE__ */ jsx27("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs25("table", { children: [
10757
+ /* @__PURE__ */ jsx27("thead", { children: /* @__PURE__ */ jsxs25("tr", { children: [
10758
+ /* @__PURE__ */ jsxs25("th", { scope: "col", children: [
10654
10759
  group.title,
10655
- /* @__PURE__ */ jsx26("small", { children: "By date task opened" })
10760
+ /* @__PURE__ */ jsx27("small", { children: "By date task opened" })
10656
10761
  ] }),
10657
- columns.map((column) => /* @__PURE__ */ jsx26("th", { scope: "col", children: /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10658
- /* @__PURE__ */ jsx26("th", { scope: "col", children: "Task total" })
10762
+ columns.map((column) => /* @__PURE__ */ jsx27("th", { scope: "col", children: /* @__PURE__ */ jsx27("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10763
+ /* @__PURE__ */ jsx27("th", { scope: "col", children: "Task total" })
10659
10764
  ] }) }),
10660
- /* @__PURE__ */ jsx26("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10765
+ /* @__PURE__ */ jsx27("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10661
10766
  const items = groupTasks.filter((task) => task.kind === kind);
10662
- return /* @__PURE__ */ jsxs24("tr", { children: [
10663
- /* @__PURE__ */ jsxs24("th", { scope: "row", children: [
10767
+ return /* @__PURE__ */ jsxs25("tr", { children: [
10768
+ /* @__PURE__ */ jsxs25("th", { scope: "row", children: [
10664
10769
  rfaTaskLabel(kind),
10665
- descriptions[kind] && /* @__PURE__ */ jsx26("small", { children: descriptions[kind] })
10770
+ descriptions[kind] && /* @__PURE__ */ jsx27("small", { children: descriptions[kind] })
10666
10771
  ] }),
10667
- columns.map((column) => /* @__PURE__ */ jsx26("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10668
- /* @__PURE__ */ jsx26("td", { children: countCell(items, kind) })
10772
+ columns.map((column) => /* @__PURE__ */ jsx27("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10773
+ /* @__PURE__ */ jsx27("td", { children: countCell(items, kind) })
10669
10774
  ] }, kind);
10670
10775
  }) }),
10671
- /* @__PURE__ */ jsx26("tfoot", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10672
- /* @__PURE__ */ jsx26("th", { scope: "row", children: "Total" }),
10776
+ /* @__PURE__ */ jsx27("tfoot", { children: /* @__PURE__ */ jsxs25("tr", { children: [
10777
+ /* @__PURE__ */ jsx27("th", { scope: "row", children: "Total" }),
10673
10778
  [...columns, { key: "total", label: "Total" }].map((column) => {
10674
10779
  const items = column.key === "total" ? groupTasks : groupTasks.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key);
10675
- 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);
10780
+ return /* @__PURE__ */ jsx27("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__ */ jsx27("span", { className: "mbrfa-task-zero", children: "0" }) }, column.key);
10676
10781
  })
10677
10782
  ] }) })
10678
10783
  ] }) }, group.title);
10679
10784
  }) : null,
10680
- !list3 && stateTasks.length ? /* @__PURE__ */ jsx26("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10681
- list3 || selection ? /* @__PURE__ */ jsxs24("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10682
- /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10683
- /* @__PURE__ */ jsxs24("h3", { children: [
10785
+ !list3 && stateTasks.length ? /* @__PURE__ */ jsx27("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10786
+ list3 || selection ? /* @__PURE__ */ jsxs25("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10787
+ /* @__PURE__ */ jsxs25("div", { className: "mbtd-actions", children: [
10788
+ /* @__PURE__ */ jsxs25("h3", { children: [
10684
10789
  selectedTitle,
10685
10790
  activeSelection?.bucket ? ` \xB7 ${[...taskAgeColumns, { key: "unknown", label: "Unknown age" }].find((column) => column.key === activeSelection.bucket)?.label}` : "",
10686
10791
  " (",
10687
10792
  filtered.length,
10688
10793
  ")"
10689
10794
  ] }),
10690
- !list3 ? /* @__PURE__ */ jsx26("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10795
+ !list3 ? /* @__PURE__ */ jsx27("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10691
10796
  ] }),
10692
- /* @__PURE__ */ jsx26("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs24("table", { children: [
10693
- /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10694
- /* @__PURE__ */ jsx26("th", { children: "Task / request" }),
10695
- /* @__PURE__ */ jsx26("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10696
- /* @__PURE__ */ jsx26("th", { children: "Assigned to" }),
10697
- /* @__PURE__ */ jsx26("th", { children: "Action" })
10797
+ /* @__PURE__ */ jsx27("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs25("table", { children: [
10798
+ /* @__PURE__ */ jsx27("thead", { children: /* @__PURE__ */ jsxs25("tr", { children: [
10799
+ /* @__PURE__ */ jsx27("th", { children: "Task / request" }),
10800
+ /* @__PURE__ */ jsx27("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10801
+ /* @__PURE__ */ jsx27("th", { children: "Assigned to" }),
10802
+ /* @__PURE__ */ jsx27("th", { children: "Action" })
10698
10803
  ] }) }),
10699
- /* @__PURE__ */ jsx26("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs24("tr", { children: [
10700
- /* @__PURE__ */ jsxs24("td", { children: [
10701
- /* @__PURE__ */ jsx26("strong", { children: rfaTaskLabel(task.kind) }),
10804
+ /* @__PURE__ */ jsx27("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs25("tr", { children: [
10805
+ /* @__PURE__ */ jsxs25("td", { children: [
10806
+ /* @__PURE__ */ jsx27("strong", { children: rfaTaskLabel(task.kind) }),
10702
10807
  taskIdentity(task),
10703
- task.responseFilename ? /* @__PURE__ */ jsx26("small", { children: task.responseFilename }) : null,
10704
- task.lastOutcome ? /* @__PURE__ */ jsxs24("small", { children: [
10808
+ task.responseFilename ? /* @__PURE__ */ jsx27("small", { children: task.responseFilename }) : null,
10809
+ task.lastOutcome ? /* @__PURE__ */ jsxs25("small", { children: [
10705
10810
  "Last outcome: ",
10706
10811
  task.lastOutcome.replaceAll("_", " ")
10707
10812
  ] }) : null,
10708
- task.lastNote ? /* @__PURE__ */ jsx26("small", { children: task.lastNote }) : null
10813
+ task.lastNote ? /* @__PURE__ */ jsx27("small", { children: task.lastNote }) : null
10709
10814
  ] }),
10710
- /* @__PURE__ */ jsx26("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10711
- /* @__PURE__ */ jsx26("td", { children: task.assigneeReference || "Unassigned" }),
10712
- /* @__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" }) })
10815
+ /* @__PURE__ */ jsx27("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10816
+ /* @__PURE__ */ jsx27("td", { children: task.assigneeReference || "Unassigned" }),
10817
+ /* @__PURE__ */ jsx27("td", { children: /* @__PURE__ */ jsx27("button", { type: "button", onClick: () => onSelect(task.rfaId, task.responseDocumentId ?? void 0), children: task.kind === "post_ur_decision" ? "Review response" : "Open request" }) })
10713
10818
  ] }, task.id)) })
10714
10819
  ] }) }),
10715
- !filtered.length ? /* @__PURE__ */ jsx26("p", { children: "No tasks match this selection." }) : null
10820
+ !filtered.length ? /* @__PURE__ */ jsx27("p", { children: "No tasks match this selection." }) : null
10716
10821
  ] }) : null,
10717
- !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs24("details", { className: "mbrfa-match-disclosure", children: [
10718
- /* @__PURE__ */ jsxs24("summary", { children: [
10822
+ !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs25("details", { className: "mbrfa-match-disclosure", children: [
10823
+ /* @__PURE__ */ jsxs25("summary", { children: [
10719
10824
  "Match UR \xB7 Incoming responses",
10720
10825
  inboxCount !== null ? ` (${inboxCount})` : ""
10721
10826
  ] }),
10722
- /* @__PURE__ */ jsx26(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10723
- ] }) : /* @__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
10827
+ /* @__PURE__ */ jsx27(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10828
+ ] }) : /* @__PURE__ */ jsx27("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
10724
10829
  ] });
10725
10830
  }
10726
10831
  function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10727
10832
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10728
10833
  const records = useMemo7(() => createRfaClient(options), [options]);
10729
- const [faxes, setFaxes] = useState17([]);
10730
- const [fax, setFax] = useState17(null);
10731
- const [pdf, setPdf] = useState17(null);
10732
- const [choices, setChoices] = useState17([]);
10733
- const [selected, setSelected] = useState17("");
10734
- const [search, setSearch] = useState17("");
10735
- const [error, setError] = useState17("");
10736
- const [busy, setBusy] = useState17(false);
10737
- const [loading, setLoading] = useState17(true);
10738
- const [reload, setReload] = useState17(0);
10739
- const [nextCursor, setNextCursor] = useState17(null);
10740
- const [pages, setPages] = useState17([void 0]);
10741
- const [confirmed, setConfirmed] = useState17(false);
10834
+ const [faxes, setFaxes] = useState18([]);
10835
+ const [fax, setFax] = useState18(null);
10836
+ const [pdf, setPdf] = useState18(null);
10837
+ const [choices, setChoices] = useState18([]);
10838
+ const [selected, setSelected] = useState18("");
10839
+ const [search, setSearch] = useState18("");
10840
+ const [error, setError] = useState18("");
10841
+ const [busy, setBusy] = useState18(false);
10842
+ const [loading, setLoading] = useState18(true);
10843
+ const [reload, setReload] = useState18(0);
10844
+ const [nextCursor, setNextCursor] = useState18(null);
10845
+ const [pages, setPages] = useState18([void 0]);
10846
+ const [confirmed, setConfirmed] = useState18(false);
10742
10847
  const keys = useRef13(/* @__PURE__ */ new Map());
10743
10848
  const alive = useRef13(true);
10744
10849
  const pending = useRef13(false);
10745
10850
  const generation = useRef13(0);
10746
- useEffect14(() => {
10851
+ useEffect15(() => {
10747
10852
  alive.current = true;
10748
10853
  return () => {
10749
10854
  alive.current = false;
@@ -10751,7 +10856,7 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10751
10856
  }, []);
10752
10857
  const reviewingFax = useRef13(false);
10753
10858
  reviewingFax.current = Boolean(fax);
10754
- useEffect14(() => {
10859
+ useEffect15(() => {
10755
10860
  let active = true;
10756
10861
  let refreshing = false;
10757
10862
  setFax(null);
@@ -10811,35 +10916,35 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10811
10916
  if (alive.current) setBusy(false);
10812
10917
  }
10813
10918
  };
10814
- return /* @__PURE__ */ jsxs24("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10815
- /* @__PURE__ */ jsx26("h3", { children: "Response inbox \xB7 Match UR" }),
10816
- /* @__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." }),
10817
- error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10818
- loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx26("p", { children: "No unmatched response faxes." }) : null,
10819
- pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10820
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10821
- /* @__PURE__ */ jsxs24("span", { children: [
10919
+ return /* @__PURE__ */ jsxs25("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10920
+ /* @__PURE__ */ jsx27("h3", { children: "Response inbox \xB7 Match UR" }),
10921
+ /* @__PURE__ */ jsx27("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." }),
10922
+ error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: error }) : null,
10923
+ loading ? /* @__PURE__ */ jsx27("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx27("p", { children: "No unmatched response faxes." }) : null,
10924
+ pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs25("div", { className: "mbtd-actions", children: [
10925
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10926
+ /* @__PURE__ */ jsxs25("span", { children: [
10822
10927
  "Page ",
10823
10928
  pages.length
10824
10929
  ] }),
10825
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10930
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10826
10931
  if (nextCursor) setPages((value) => [...value, nextCursor]);
10827
10932
  }, children: "Next fax page" })
10828
10933
  ] }) : null,
10829
- /* @__PURE__ */ jsx26("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs24("article", { className: "mbrfa-card", children: [
10830
- /* @__PURE__ */ jsxs24("div", { children: [
10831
- /* @__PURE__ */ jsxs24("strong", { children: [
10934
+ /* @__PURE__ */ jsx27("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs25("article", { className: "mbrfa-card", children: [
10935
+ /* @__PURE__ */ jsxs25("div", { children: [
10936
+ /* @__PURE__ */ jsxs25("strong", { children: [
10832
10937
  "Response fax \xB7 ",
10833
10938
  date3(item.receivedAt)
10834
10939
  ] }),
10835
- /* @__PURE__ */ jsxs24("span", { children: [
10940
+ /* @__PURE__ */ jsxs25("span", { children: [
10836
10941
  item.fromName || item.fromFax || "Sender not identified",
10837
10942
  " \xB7 ",
10838
10943
  item.pages ?? "Unknown",
10839
10944
  " pages"
10840
10945
  ] })
10841
10946
  ] }),
10842
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => {
10947
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: busy || disabled, onClick: () => {
10843
10948
  const current = ++generation.current;
10844
10949
  setFax(item);
10845
10950
  setPdf(null);
@@ -10856,18 +10961,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10856
10961
  });
10857
10962
  }, children: "Review fax" })
10858
10963
  ] }, item.id)) }),
10859
- fax ? /* @__PURE__ */ jsxs24("div", { style: { display: "grid", gap: 16 }, children: [
10860
- /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10861
- /* @__PURE__ */ jsx26("h4", { children: "Match response fax" }),
10862
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy, onClick: () => {
10964
+ fax ? /* @__PURE__ */ jsxs25("div", { style: { display: "grid", gap: 16 }, children: [
10965
+ /* @__PURE__ */ jsxs25("div", { className: "mbtd-actions", children: [
10966
+ /* @__PURE__ */ jsx27("h4", { children: "Match response fax" }),
10967
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: busy, onClick: () => {
10863
10968
  generation.current += 1;
10864
10969
  setFax(null);
10865
10970
  setPdf(null);
10866
10971
  setReload((value) => value + 1);
10867
10972
  }, children: "Close review" })
10868
10973
  ] }),
10869
- pdf ? /* @__PURE__ */ jsx26(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10870
- /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
10974
+ pdf ? /* @__PURE__ */ jsx27(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10975
+ /* @__PURE__ */ jsxs25("form", { onSubmit: (event) => {
10871
10976
  event.preventDefault();
10872
10977
  void run(async () => {
10873
10978
  const result = await records.list({ search: search.trim(), limit: 50 });
@@ -10877,20 +10982,20 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10877
10982
  }
10878
10983
  });
10879
10984
  }, children: [
10880
- /* @__PURE__ */ jsxs24("label", { children: [
10985
+ /* @__PURE__ */ jsxs25("label", { children: [
10881
10986
  "Find patient, claim or RFA",
10882
- /* @__PURE__ */ jsx26("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10987
+ /* @__PURE__ */ jsx27("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10883
10988
  ] }),
10884
- /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10989
+ /* @__PURE__ */ jsx27("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10885
10990
  ] }),
10886
- /* @__PURE__ */ jsxs24("label", { children: [
10991
+ /* @__PURE__ */ jsxs25("label", { children: [
10887
10992
  "Matching request",
10888
- /* @__PURE__ */ jsxs24("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10993
+ /* @__PURE__ */ jsxs25("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10889
10994
  setSelected(event.target.value);
10890
10995
  setConfirmed(false);
10891
10996
  }, children: [
10892
- /* @__PURE__ */ jsx26("option", { value: "", children: "Choose after reviewing the response" }),
10893
- choices.map((record2) => /* @__PURE__ */ jsxs24("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10997
+ /* @__PURE__ */ jsx27("option", { value: "", children: "Choose after reviewing the response" }),
10998
+ choices.map((record2) => /* @__PURE__ */ jsxs25("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10894
10999
  record2.employeeName,
10895
11000
  " \xB7 ",
10896
11001
  record2.claimNumber || "Claim not recorded",
@@ -10902,8 +11007,8 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10902
11007
  ] }, record2.id))
10903
11008
  ] })
10904
11009
  ] }),
10905
- selected ? /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
10906
- editable ? /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
11010
+ selected ? /* @__PURE__ */ jsx27("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
11011
+ editable ? /* @__PURE__ */ jsxs25("form", { onSubmit: (event) => {
10907
11012
  event.preventDefault();
10908
11013
  if (!selected || !pdf || !confirmed || !editable || !choices.some((record2) => record2.id === selected && canMatchResponse(record2))) return;
10909
11014
  void run(async () => {
@@ -10922,18 +11027,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10922
11027
  }
10923
11028
  });
10924
11029
  }, children: [
10925
- /* @__PURE__ */ jsxs24("label", { children: [
10926
- /* @__PURE__ */ jsx26("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
11030
+ /* @__PURE__ */ jsxs25("label", { children: [
11031
+ /* @__PURE__ */ jsx27("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
10927
11032
  " I reviewed the response and confirmed its patient, claim, and requested treatment match this request."
10928
11033
  ] }),
10929
- /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
10930
- ] }) : /* @__PURE__ */ jsx26("p", { children: "Matching responses requires authorization from your administrator." })
11034
+ /* @__PURE__ */ jsx27("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
11035
+ ] }) : /* @__PURE__ */ jsx27("p", { children: "Matching responses requires authorization from your administrator." })
10931
11036
  ] }) : null
10932
11037
  ] });
10933
11038
  }
10934
11039
 
10935
11040
  // src/rfa-tracking-panel.tsx
10936
- import { Fragment as Fragment17, useEffect as useEffect15, useMemo as useMemo8, useRef as useRef14, useState as useState18 } from "react";
11041
+ import { Fragment as Fragment17, useEffect as useEffect16, useMemo as useMemo8, useRef as useRef14, useState as useState19 } from "react";
10937
11042
  import { createRfaClient as createRfaClient2, createRfaLifecycleClient as createRfaLifecycleClient2 } from "@mindbill/browser";
10938
11043
 
10939
11044
  // src/rfa-detail-header.tsx
@@ -10956,43 +11061,43 @@ function rfaDecisionDueText(rfa) {
10956
11061
  }
10957
11062
 
10958
11063
  // src/rfa-detail-header.tsx
10959
- import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
11064
+ import { Fragment as Fragment16, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
10960
11065
  function RfaDetailHeader({ rfa, getPatientHref, getClaimHref, getProviderHref, compact = false }) {
10961
11066
  const status = getRfaLifecycleStatus(rfa);
10962
11067
  const stages = ["Incomplete", "Sent", "Received", "Closed"];
10963
11068
  const current = status === "closed" ? 3 : status === "received" || rfa.receivedAt ? 2 : status === "sent" || rfa.submittedAt ? 1 : 0;
10964
- return /* @__PURE__ */ jsxs25(Fragment16, { children: [
10965
- /* @__PURE__ */ jsxs25("div", { className: "mbrfa-context", children: [
10966
- /* @__PURE__ */ jsxs25("div", { children: [
10967
- /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
10968
- /* @__PURE__ */ jsx27("span", { children: /* @__PURE__ */ jsxs25(RfaLink, { href: getClaimHref?.(rfa), children: [
11069
+ return /* @__PURE__ */ jsxs26(Fragment16, { children: [
11070
+ /* @__PURE__ */ jsxs26("div", { className: "mbrfa-context", children: [
11071
+ /* @__PURE__ */ jsxs26("div", { children: [
11072
+ /* @__PURE__ */ jsx28("strong", { children: /* @__PURE__ */ jsx28(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
11073
+ /* @__PURE__ */ jsx28("span", { children: /* @__PURE__ */ jsxs26(RfaLink, { href: getClaimHref?.(rfa), children: [
10969
11074
  "Claim ",
10970
11075
  rfa.claimNumber || "Not recorded"
10971
11076
  ] }) })
10972
11077
  ] }),
10973
- /* @__PURE__ */ jsxs25("div", { children: [
10974
- /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
10975
- /* @__PURE__ */ jsx27("span", { children: "Requesting physician" })
11078
+ /* @__PURE__ */ jsxs26("div", { children: [
11079
+ /* @__PURE__ */ jsx28("strong", { children: /* @__PURE__ */ jsx28(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
11080
+ /* @__PURE__ */ jsx28("span", { children: "Requesting physician" })
10976
11081
  ] }),
10977
- /* @__PURE__ */ jsxs25("div", { children: [
10978
- /* @__PURE__ */ jsx27("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
10979
- /* @__PURE__ */ jsx27("span", { className: "mbrfa-update-note", children: "Updates automatically" })
11082
+ /* @__PURE__ */ jsxs26("div", { children: [
11083
+ /* @__PURE__ */ jsx28("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
11084
+ /* @__PURE__ */ jsx28("span", { className: "mbrfa-update-note", children: "Updates automatically" })
10980
11085
  ] })
10981
11086
  ] }),
10982
- !compact ? /* @__PURE__ */ jsxs25("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
10983
- /* @__PURE__ */ jsxs25("div", { className: "mbrfa-progress-heading", children: [
10984
- /* @__PURE__ */ jsxs25("div", { children: [
10985
- /* @__PURE__ */ jsx27("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
10986
- /* @__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" })
11087
+ !compact ? /* @__PURE__ */ jsxs26("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
11088
+ /* @__PURE__ */ jsxs26("div", { className: "mbrfa-progress-heading", children: [
11089
+ /* @__PURE__ */ jsxs26("div", { children: [
11090
+ /* @__PURE__ */ jsx28("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
11091
+ /* @__PURE__ */ jsx28("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" })
10987
11092
  ] }),
10988
- /* @__PURE__ */ jsxs25("div", { className: "mbrfa-deadline", children: [
10989
- /* @__PURE__ */ jsx27("span", { children: "Decision due" }),
10990
- /* @__PURE__ */ jsx27("strong", { children: rfaDecisionDueText(rfa) })
11093
+ /* @__PURE__ */ jsxs26("div", { className: "mbrfa-deadline", children: [
11094
+ /* @__PURE__ */ jsx28("span", { children: "Decision due" }),
11095
+ /* @__PURE__ */ jsx28("strong", { children: rfaDecisionDueText(rfa) })
10991
11096
  ] })
10992
11097
  ] }),
10993
- /* @__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: [
10994
- /* @__PURE__ */ jsx27("span", { children: index < current ? "\u2713" : index + 1 }),
10995
- /* @__PURE__ */ jsx27("strong", { children: stage })
11098
+ /* @__PURE__ */ jsx28("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs26("li", { className: index <= current ? "is-complete" : "", "aria-current": index === current ? "step" : void 0, children: [
11099
+ /* @__PURE__ */ jsx28("span", { children: index < current ? "\u2713" : index + 1 }),
11100
+ /* @__PURE__ */ jsx28("strong", { children: stage })
10996
11101
  ] }, stage)) })
10997
11102
  ] }) : null
10998
11103
  ] });
@@ -11006,7 +11111,7 @@ var rfaPolishCss = `
11006
11111
  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}}`;
11007
11112
 
11008
11113
  // src/rfa-history-entry.tsx
11009
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
11114
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11010
11115
  var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
11011
11116
  var string = (value) => typeof value === "string" && value.trim() ? value : void 0;
11012
11117
  var words = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
@@ -11080,9 +11185,9 @@ function rows2(value, omit = []) {
11080
11185
  });
11081
11186
  }
11082
11187
  function DefinitionList({ entries }) {
11083
- return /* @__PURE__ */ jsx28("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs26("div", { children: [
11084
- /* @__PURE__ */ jsx28("dt", { children: label5 }),
11085
- /* @__PURE__ */ jsx28("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
11188
+ return /* @__PURE__ */ jsx29("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11189
+ /* @__PURE__ */ jsx29("dt", { children: label5 }),
11190
+ /* @__PURE__ */ jsx29("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
11086
11191
  ] }, label5)) });
11087
11192
  }
11088
11193
  function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
@@ -11107,12 +11212,12 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
11107
11212
  }
11108
11213
  const treatment = (id) => {
11109
11214
  const index = rfa.items.findIndex((value) => value.id === id);
11110
- return index >= 0 ? /* @__PURE__ */ jsxs26("a", { href: `#rfa-treatment-${id}`, children: [
11215
+ return index >= 0 ? /* @__PURE__ */ jsxs27("a", { href: `#rfa-treatment-${id}`, children: [
11111
11216
  "Treatment ",
11112
11217
  index + 1,
11113
11218
  ": ",
11114
11219
  rfa.items[index].serviceDescription
11115
- ] }) : /* @__PURE__ */ jsxs26("span", { children: [
11220
+ ] }) : /* @__PURE__ */ jsxs27("span", { children: [
11116
11221
  "Treatment reference: ",
11117
11222
  id
11118
11223
  ] });
@@ -11139,50 +11244,50 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
11139
11244
  const hasDetails = entries.length || appointment.length || decisionSections.length || evidence.length || changed.length;
11140
11245
  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;
11141
11246
  const action = string(payload.action) ?? event.eventType.replace(/^rfa\./, "");
11142
- return /* @__PURE__ */ jsxs26("tr", { children: [
11143
- /* @__PURE__ */ jsx28("td", { children: /* @__PURE__ */ jsx28("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11144
- /* @__PURE__ */ jsx28("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11145
- /* @__PURE__ */ jsxs26("td", { children: [
11146
- /* @__PURE__ */ jsx28("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11247
+ return /* @__PURE__ */ jsxs27("tr", { children: [
11248
+ /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11249
+ /* @__PURE__ */ jsx29("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11250
+ /* @__PURE__ */ jsxs27("td", { children: [
11251
+ /* @__PURE__ */ jsx29("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11147
11252
  actor
11148
11253
  ] }),
11149
- /* @__PURE__ */ jsxs26("td", { children: [
11150
- ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx28("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11151
- ids.size ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx28("li", { children: treatment(id) }, id)) }) : null,
11152
- hasDetails ? /* @__PURE__ */ jsxs26("details", { children: [
11153
- /* @__PURE__ */ jsx28("summary", { children: "Event details" }),
11154
- entries.length ? /* @__PURE__ */ jsx28(DefinitionList, { entries }) : null,
11155
- changed.length ? /* @__PURE__ */ jsxs26("p", { children: [
11254
+ /* @__PURE__ */ jsxs27("td", { children: [
11255
+ ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx29("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11256
+ ids.size ? /* @__PURE__ */ jsx29("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx29("li", { children: treatment(id) }, id)) }) : null,
11257
+ hasDetails ? /* @__PURE__ */ jsxs27("details", { children: [
11258
+ /* @__PURE__ */ jsx29("summary", { children: "Event details" }),
11259
+ entries.length ? /* @__PURE__ */ jsx29(DefinitionList, { entries }) : null,
11260
+ changed.length ? /* @__PURE__ */ jsxs27("p", { children: [
11156
11261
  "Changed fields: ",
11157
11262
  changed.join(", ")
11158
11263
  ] }) : null,
11159
- appointment.length ? /* @__PURE__ */ jsxs26("section", { children: [
11160
- /* @__PURE__ */ jsx28("h4", { children: "Appointment details" }),
11161
- /* @__PURE__ */ jsx28(DefinitionList, { entries: appointment })
11264
+ appointment.length ? /* @__PURE__ */ jsxs27("section", { children: [
11265
+ /* @__PURE__ */ jsx29("h4", { children: "Appointment details" }),
11266
+ /* @__PURE__ */ jsx29(DefinitionList, { entries: appointment })
11162
11267
  ] }) : null,
11163
- decisionSections.map((group) => /* @__PURE__ */ jsxs26("section", { children: [
11164
- /* @__PURE__ */ jsx28("h4", { children: group.title }),
11165
- group.value !== payload ? /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11166
- group.decisions.map((value, index) => /* @__PURE__ */ jsxs26("div", { children: [
11268
+ decisionSections.map((group) => /* @__PURE__ */ jsxs27("section", { children: [
11269
+ /* @__PURE__ */ jsx29("h4", { children: group.title }),
11270
+ group.value !== payload ? /* @__PURE__ */ jsx29(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11271
+ group.decisions.map((value, index) => /* @__PURE__ */ jsxs27("div", { children: [
11167
11272
  string(value.itemId) ? treatment(String(value.itemId)) : null,
11168
- /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(value) })
11273
+ /* @__PURE__ */ jsx29(DefinitionList, { entries: rows2(value) })
11169
11274
  ] }, index))
11170
11275
  ] }, group.title)),
11171
- evidence.length ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11276
+ evidence.length ? /* @__PURE__ */ jsx29("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11172
11277
  const filename = rfa.documents.find((document2) => document2.id === value.id)?.filename;
11173
- 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: [
11278
+ return /* @__PURE__ */ jsx29("li", { children: /* @__PURE__ */ jsxs27("button", { type: "button", disabled, onClick: () => onDownload(value.kind, value.id, filename ?? (value.kind === "packet" ? "RFA submission.pdf" : "RFA evidence.pdf")), children: [
11174
11279
  value.label,
11175
11280
  filename ? `: ${filename}` : ""
11176
11281
  ] }) }, `${value.kind}:${value.id}`);
11177
11282
  }) }) : null
11178
- ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx28("span", { children: "\u2014" }) : null
11283
+ ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx29("span", { children: "\u2014" }) : null
11179
11284
  ] })
11180
11285
  ] });
11181
11286
  }
11182
11287
 
11183
11288
  // src/rfa-detail-cards.tsx
11184
11289
  import { getRfaLifecycleStatus as getRfaLifecycleStatus2, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS2 } from "@mindbill/browser";
11185
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11290
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11186
11291
  var DECIDED = ["approved", "modified", "denied", "mixed", "closed"];
11187
11292
  var rfaShortDate = (value) => value && Number.isFinite(Date.parse(value)) ? new Date(value).toLocaleString(void 0, { dateStyle: "short", timeStyle: "short" }) : "\u2014";
11188
11293
  var rfaCalendarDate = (value) => {
@@ -11201,7 +11306,7 @@ function rfaOutcome(item) {
11201
11306
  return { label: sentence(item.outcome || "pending"), tone: "muted" };
11202
11307
  }
11203
11308
  function RfaPill({ tone = "muted", children }) {
11204
- return /* @__PURE__ */ jsx29("span", { className: "mbrfa-pill", "data-tone": tone, children });
11309
+ return /* @__PURE__ */ jsx30("span", { className: "mbrfa-pill", "data-tone": tone, children });
11205
11310
  }
11206
11311
  function rfaLifecycleTone(rfa) {
11207
11312
  const status = getRfaLifecycleStatus2(rfa);
@@ -11218,41 +11323,41 @@ function RfaStatusCard({ rfa }) {
11218
11323
  const current = rfa.submittedAt && decided ? 4 : rfa.receivedAt ? 3 : rfa.submittedAt ? 2 : rfa.signedAt ? 1 : 0;
11219
11324
  const stopped = status === "canceled" || status === "failed";
11220
11325
  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";
11221
- return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11222
- /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-heading", children: [
11223
- /* @__PURE__ */ jsxs27("div", { children: [
11224
- /* @__PURE__ */ jsx29("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11225
- /* @__PURE__ */ jsx29("p", { children: detail })
11326
+ return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11327
+ /* @__PURE__ */ jsxs28("div", { className: "mbrfa-status-heading", children: [
11328
+ /* @__PURE__ */ jsxs28("div", { children: [
11329
+ /* @__PURE__ */ jsx30("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11330
+ /* @__PURE__ */ jsx30("p", { children: detail })
11226
11331
  ] }),
11227
- rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-due", children: [
11228
- /* @__PURE__ */ jsx29("span", { children: "Decision due" }),
11229
- /* @__PURE__ */ jsx29("strong", { children: rfaDecisionDueText(rfa) })
11332
+ rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs28("div", { className: "mbrfa-status-due", children: [
11333
+ /* @__PURE__ */ jsx30("span", { children: "Decision due" }),
11334
+ /* @__PURE__ */ jsx30("strong", { children: rfaDecisionDueText(rfa) })
11230
11335
  ] }) : null
11231
11336
  ] }),
11232
- /* @__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: [
11233
- /* @__PURE__ */ jsx29("span", { children: index < current ? "\u2713" : index + 1 }),
11234
- /* @__PURE__ */ jsx29("strong", { children: stage })
11337
+ /* @__PURE__ */ jsx30("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs28("li", { "data-state": index < current ? "done" : index === current ? "current" : "todo", "aria-current": index === current ? "step" : void 0, children: [
11338
+ /* @__PURE__ */ jsx30("span", { children: index < current ? "\u2713" : index + 1 }),
11339
+ /* @__PURE__ */ jsx30("strong", { children: stage })
11235
11340
  ] }, stage)) })
11236
11341
  ] });
11237
11342
  }
11238
11343
  function RfaCard({ title, count, action, children, id, flush = false }) {
11239
- return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11240
- /* @__PURE__ */ jsxs27("header", { children: [
11241
- /* @__PURE__ */ jsxs27("h3", { children: [
11344
+ return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11345
+ /* @__PURE__ */ jsxs28("header", { children: [
11346
+ /* @__PURE__ */ jsxs28("h3", { children: [
11242
11347
  title,
11243
- count !== void 0 ? /* @__PURE__ */ jsx29("span", { className: "mbrfa-count", children: count }) : null
11348
+ count !== void 0 ? /* @__PURE__ */ jsx30("span", { className: "mbrfa-count", children: count }) : null
11244
11349
  ] }),
11245
- action ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-sheet-action", children: action }) : null
11350
+ action ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-sheet-action", children: action }) : null
11246
11351
  ] }),
11247
- /* @__PURE__ */ jsx29("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11352
+ /* @__PURE__ */ jsx30("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11248
11353
  ] });
11249
11354
  }
11250
11355
  function RfaFacts({ entries }) {
11251
11356
  const shown = entries.filter(([, value]) => value !== null && value !== void 0 && value !== "" && value !== false);
11252
- return shown.length ? /* @__PURE__ */ jsx29("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11253
- /* @__PURE__ */ jsx29("dt", { children: name }),
11254
- /* @__PURE__ */ jsx29("dd", { children: value })
11255
- ] }, name)) }) : /* @__PURE__ */ jsx29("p", { className: "mbrfa-empty", children: "Not recorded." });
11357
+ return shown.length ? /* @__PURE__ */ jsx30("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs28("div", { children: [
11358
+ /* @__PURE__ */ jsx30("dt", { children: name }),
11359
+ /* @__PURE__ */ jsx30("dd", { children: value })
11360
+ ] }, name)) }) : /* @__PURE__ */ jsx30("p", { className: "mbrfa-empty", children: "Not recorded." });
11256
11361
  }
11257
11362
  var rfaAddress = (contact) => [contact?.address, [contact?.city, [contact?.state, contact?.zip].filter(Boolean).join(" ")].filter(Boolean).join(", ")].filter(Boolean).join(", ");
11258
11363
  var rfaRequestTypeLabel = (rfa) => rfa.requestType === "resubmission_material_change" ? "Resubmission \u2013 Change in Material Facts" : "New Request";
@@ -11338,7 +11443,7 @@ var rfaCardsCss = `
11338
11443
  `;
11339
11444
 
11340
11445
  // src/rfa-tracking-panel.tsx
11341
- import { Fragment as Fragment18, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11446
+ import { Fragment as Fragment18, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
11342
11447
  var words2 = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
11343
11448
  var capital = (value) => value.charAt(0).toUpperCase() + value.slice(1);
11344
11449
  var date5 = (value) => value ? new Date(value).toLocaleString() : "Not recorded";
@@ -11360,32 +11465,32 @@ var localTime = (value) => {
11360
11465
  };
11361
11466
  function RfaTrackingPanel(props) {
11362
11467
  const identity = useMemo8(() => crypto.randomUUID(), [props.options]);
11363
- return /* @__PURE__ */ jsx30(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11468
+ return /* @__PURE__ */ jsx31(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11364
11469
  }
11365
11470
  function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdated, view = "all", embedded = false, cards = false, ...appearance }) {
11366
- const [rfa, setRfa] = useState18(provided);
11367
- useEffect15(() => setRfa(provided), [provided]);
11471
+ const [rfa, setRfa] = useState19(provided);
11472
+ useEffect16(() => setRfa(provided), [provided]);
11368
11473
  const client = useMemo8(() => createRfaLifecycleClient2(options), [options]);
11369
11474
  const records = useMemo8(() => createRfaClient2(options), [options]);
11370
- const [scheduling, setScheduling] = useState18([]);
11371
- const [history, setHistory] = useState18([]);
11372
- const [loadErrors, setLoadErrors] = useState18([]);
11373
- const [loading, setLoading] = useState18(true);
11374
- const [reload, setReload] = useState18(0);
11375
- const [busy, setBusy] = useState18(false);
11376
- const [error, setError] = useState18("");
11377
- const [message, setMessage] = useState18("");
11378
- const [noteOpen, setNoteOpen] = useState18(false);
11475
+ const [scheduling, setScheduling] = useState19([]);
11476
+ const [history, setHistory] = useState19([]);
11477
+ const [loadErrors, setLoadErrors] = useState19([]);
11478
+ const [loading, setLoading] = useState19(true);
11479
+ const [reload, setReload] = useState19(0);
11480
+ const [busy, setBusy] = useState19(false);
11481
+ const [error, setError] = useState19("");
11482
+ const [message, setMessage] = useState19("");
11483
+ const [noteOpen, setNoteOpen] = useState19(false);
11379
11484
  const alive = useRef14(true);
11380
11485
  const pending = useRef14(false);
11381
11486
  const keys = useRef14(/* @__PURE__ */ new Map());
11382
- useEffect15(() => {
11487
+ useEffect16(() => {
11383
11488
  alive.current = true;
11384
11489
  return () => {
11385
11490
  alive.current = false;
11386
11491
  };
11387
11492
  }, []);
11388
- useEffect15(() => {
11493
+ useEffect16(() => {
11389
11494
  let active = true;
11390
11495
  void Promise.allSettled([client.listScheduling(rfa.id), client.listHistory(rfa.id)]).then(([appointments, events]) => {
11391
11496
  if (!active) return;
@@ -11401,7 +11506,7 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11401
11506
  active = false;
11402
11507
  };
11403
11508
  }, [client, rfa.id, rfa.updatedAt, reload]);
11404
- useEffect15(() => {
11509
+ useEffect16(() => {
11405
11510
  const refresh = () => {
11406
11511
  if (!pending.current && document.visibilityState !== "hidden") setReload((value) => value + 1);
11407
11512
  };
@@ -11461,11 +11566,11 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11461
11566
  if (alive.current) setError(reason instanceof Error ? reason.message : "The evidence could not be opened.");
11462
11567
  }
11463
11568
  };
11464
- 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;
11569
+ const evidence = (id, title) => id ? /* @__PURE__ */ jsx31("button", { type: "button", disabled, onClick: () => void download(id, rfa.documents.find((document2) => document2.id === id)?.filename ?? `${title}.pdf`), children: title }) : null;
11465
11570
  const canCorrect = permissions.includes("act") && ["received", "under_review", "information_requested", "approved", "modified", "denied", "mixed"].includes(rfa.status);
11466
11571
  const canClose = permissions.includes("edit") && ["submitted", "received", "under_review", "information_requested", "incomplete", "deferred"].includes(rfa.status);
11467
11572
  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("; ");
11468
- const noteForm = /* @__PURE__ */ jsxs28("form", { className: "mbrfa-row", onSubmit: (event) => {
11573
+ const noteForm = /* @__PURE__ */ jsxs29("form", { className: "mbrfa-row", onSubmit: (event) => {
11469
11574
  event.preventDefault();
11470
11575
  const form = event.currentTarget;
11471
11576
  try {
@@ -11483,77 +11588,77 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11483
11588
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11484
11589
  }
11485
11590
  }, children: [
11486
- /* @__PURE__ */ jsxs28("label", { children: [
11591
+ /* @__PURE__ */ jsxs29("label", { children: [
11487
11592
  "Note",
11488
- /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11593
+ /* @__PURE__ */ jsx31("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11489
11594
  ] }),
11490
- /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11491
- /* @__PURE__ */ jsx30("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11492
- /* @__PURE__ */ jsx30("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11595
+ /* @__PURE__ */ jsxs29("div", { className: "mbtd-actions", children: [
11596
+ /* @__PURE__ */ jsx31("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11597
+ /* @__PURE__ */ jsx31("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11493
11598
  ] })
11494
11599
  ] });
11495
- const cardContent = /* @__PURE__ */ jsxs28("div", { className: "mbrfa-stack", children: [
11496
- error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11497
- message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11498
- loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11499
- 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: [
11500
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11501
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "#" }),
11502
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Service/Good Requested" }),
11503
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Diagnosis" }),
11504
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "CPT/HCPCS" }),
11505
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Other Information" }),
11506
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Decision" })
11600
+ const cardContent = /* @__PURE__ */ jsxs29("div", { className: "mbrfa-stack", children: [
11601
+ error ? /* @__PURE__ */ jsx31("p", { role: "alert", children: error }) : null,
11602
+ message ? /* @__PURE__ */ jsx31("p", { role: "status", children: message }) : null,
11603
+ loadErrors.map((value) => /* @__PURE__ */ jsx31("p", { role: "alert", children: value }, value)),
11604
+ view !== "history" ? /* @__PURE__ */ jsx31(RfaCard, { title: "Requested Treatment", count: rfa.items.length, flush: true, children: rfa.items.length ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-grid-table mbrfa-treatment-table", children: [
11605
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11606
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "#" }),
11607
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Service/Good Requested" }),
11608
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Diagnosis" }),
11609
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "CPT/HCPCS" }),
11610
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Other Information" }),
11611
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Decision" })
11507
11612
  ] }) }),
11508
- /* @__PURE__ */ jsx30("tbody", { children: rfa.items.map((item, index) => {
11613
+ /* @__PURE__ */ jsx31("tbody", { children: rfa.items.map((item, index) => {
11509
11614
  const appointment = scheduling.find((value) => value.itemId === item.id);
11510
11615
  const outcome = rfaOutcome(item);
11511
11616
  const showAppointment = !!appointment && (appointment.eligible || appointment.version > 0);
11512
11617
  const closable = canClose && item.outcome === "pending" && !item.decidedAt;
11513
11618
  const correctable = canCorrect && !!item.currentDecisionEventId && item.outcome !== "pending";
11514
- return /* @__PURE__ */ jsxs28(Fragment17, { children: [
11515
- /* @__PURE__ */ jsxs28("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11516
- /* @__PURE__ */ jsx30("td", { children: index + 1 }),
11517
- /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("strong", { children: item.serviceDescription }) }),
11518
- /* @__PURE__ */ jsxs28("td", { children: [
11519
- /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11520
- item.diagnosisDescription ? /* @__PURE__ */ jsx30("small", { children: item.diagnosisDescription }) : null
11619
+ return /* @__PURE__ */ jsxs29(Fragment17, { children: [
11620
+ /* @__PURE__ */ jsxs29("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11621
+ /* @__PURE__ */ jsx31("td", { children: index + 1 }),
11622
+ /* @__PURE__ */ jsx31("td", { children: /* @__PURE__ */ jsx31("strong", { children: item.serviceDescription }) }),
11623
+ /* @__PURE__ */ jsxs29("td", { children: [
11624
+ /* @__PURE__ */ jsx31("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11625
+ item.diagnosisDescription ? /* @__PURE__ */ jsx31("small", { children: item.diagnosisDescription }) : null
11521
11626
  ] }),
11522
- /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11523
- /* @__PURE__ */ jsx30("td", { children: otherInformation(item) || "\u2014" }),
11524
- /* @__PURE__ */ jsxs28("td", { children: [
11525
- /* @__PURE__ */ jsx30(RfaPill, { tone: outcome.tone, children: outcome.label }),
11526
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11527
- item.authorizationNumber ? /* @__PURE__ */ jsxs28("small", { children: [
11627
+ /* @__PURE__ */ jsx31("td", { children: /* @__PURE__ */ jsx31("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11628
+ /* @__PURE__ */ jsx31("td", { children: otherInformation(item) || "\u2014" }),
11629
+ /* @__PURE__ */ jsxs29("td", { children: [
11630
+ /* @__PURE__ */ jsx31(RfaPill, { tone: outcome.tone, children: outcome.label }),
11631
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11632
+ item.authorizationNumber ? /* @__PURE__ */ jsxs29("small", { children: [
11528
11633
  "Authorization ",
11529
11634
  item.authorizationNumber
11530
11635
  ] }) : null,
11531
- item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs28("small", { children: [
11636
+ item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs29("small", { children: [
11532
11637
  "Authorized ",
11533
11638
  [item.authorizedProcedureCode || item.procedureCode, item.authorizedQuantity != null ? `quantity ${item.authorizedQuantity}` : "", item.authorizedUnits != null ? `units ${item.authorizedUnits}` : ""].filter(Boolean).join(" \xB7 ")
11534
11639
  ] }) : null,
11535
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("small", { children: [
11640
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs29("small", { children: [
11536
11641
  rfaCalendarDate(item.effectiveFrom) || "Not specified",
11537
11642
  " \u2013 ",
11538
11643
  rfaCalendarDate(item.effectiveTo) || "Not specified"
11539
11644
  ] }) : null,
11540
- /* @__PURE__ */ jsxs28("small", { children: [
11645
+ /* @__PURE__ */ jsxs29("small", { children: [
11541
11646
  "Decided ",
11542
11647
  rfaShortDate(item.decidedAt)
11543
11648
  ] })
11544
11649
  ] }) : null
11545
11650
  ] })
11546
11651
  ] }),
11547
- item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("tr", { className: "mbrfa-subrow", children: [
11548
- /* @__PURE__ */ jsx30("td", {}),
11549
- /* @__PURE__ */ jsx30("td", { colSpan: 5, children: /* @__PURE__ */ jsxs28("div", { className: "mbrfa-manage", children: [
11550
- item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11551
- item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11652
+ item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs29("tr", { className: "mbrfa-subrow", children: [
11653
+ /* @__PURE__ */ jsx31("td", {}),
11654
+ /* @__PURE__ */ jsx31("td", { colSpan: 5, children: /* @__PURE__ */ jsxs29("div", { className: "mbrfa-manage", children: [
11655
+ item.decisionReason ? /* @__PURE__ */ jsx31("p", { children: item.decisionReason }) : null,
11656
+ item.reviewerName ? /* @__PURE__ */ jsxs29("p", { children: [
11552
11657
  "Reviewer: ",
11553
11658
  item.reviewerName,
11554
11659
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
11555
11660
  ] }) : null,
11556
- item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11661
+ item.decisionClosure ? /* @__PURE__ */ jsxs29("p", { children: [
11557
11662
  item.decisionClosure.closed ? "Closed" : "Reopened",
11558
11663
  " by ",
11559
11664
  item.decisionClosure.updatedBy,
@@ -11562,125 +11667,125 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11562
11667
  " \u2014 ",
11563
11668
  item.decisionClosure.reason
11564
11669
  ] }) : null,
11565
- item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11670
+ item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs29("div", { className: "mbtd-actions", children: [
11566
11671
  evidence(item.currentResponseDocumentId, "View decision evidence"),
11567
11672
  evidence(item.currentImrDocumentId, "View independent medical review form")
11568
11673
  ] }) : null,
11569
- 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) => {
11674
+ showAppointment ? /* @__PURE__ */ jsx31(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) => {
11570
11675
  await client.updateScheduling(rfa.id, item.id, input, key2);
11571
11676
  return records.get(rfa.id);
11572
11677
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11573
- 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,
11574
- correctable ? /* @__PURE__ */ jsxs28("details", { children: [
11575
- /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11576
- /* @__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." }),
11577
- /* @__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}`)
11678
+ closable ? /* @__PURE__ */ jsx31(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,
11679
+ correctable ? /* @__PURE__ */ jsxs29("details", { children: [
11680
+ /* @__PURE__ */ jsx31("summary", { children: "Correct this decision" }),
11681
+ /* @__PURE__ */ jsx31("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." }),
11682
+ /* @__PURE__ */ jsx31(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}`)
11578
11683
  ] }) : null
11579
11684
  ] }) })
11580
11685
  ] }) : null
11581
11686
  ] }, item.id);
11582
11687
  }) })
11583
- ] }) }) : /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11584
- view !== "treatments" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11585
- /* @__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: [
11586
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11587
- 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: [
11588
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11589
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11590
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11591
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11592
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11688
+ ] }) }) : /* @__PURE__ */ jsx31("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11689
+ view !== "treatments" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11690
+ /* @__PURE__ */ jsxs29(RfaCard, { title: "History", action: permissions.includes("edit") && !noteOpen ? /* @__PURE__ */ jsx31("button", { type: "button", disabled, onClick: () => setNoteOpen(true), children: "Add note" }) : null, flush: true, children: [
11691
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11692
+ loading ? /* @__PURE__ */ jsx31("p", { className: "mbrfa-sheet-body", children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-history-table", children: [
11693
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11694
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Date" }),
11695
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Action" }),
11696
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "User" }),
11697
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Details" })
11593
11698
  ] }) }),
11594
- /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11595
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11699
+ /* @__PURE__ */ jsx31("tbody", { children: history.map((event) => /* @__PURE__ */ jsx31(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11700
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx31("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11596
11701
  ] }),
11597
- 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: [
11598
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11599
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11600
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Method" }),
11601
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Status" }),
11602
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Recipient" }),
11603
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Confirmed receipt" }),
11604
- /* @__PURE__ */ jsx30("th", { scope: "col", children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11702
+ rfa.transmissions.length ? /* @__PURE__ */ jsx31(RfaCard, { title: "Delivery", count: rfa.transmissions.length, flush: true, children: /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-grid-table", children: [
11703
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11704
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Date" }),
11705
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Method" }),
11706
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Status" }),
11707
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Recipient" }),
11708
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Confirmed receipt" }),
11709
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: /* @__PURE__ */ jsx31("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11605
11710
  ] }) }),
11606
- /* @__PURE__ */ jsx30("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("tr", { children: [
11607
- /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.occurredAt) }),
11608
- /* @__PURE__ */ jsxs28("td", { children: [
11711
+ /* @__PURE__ */ jsx31("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs29("tr", { children: [
11712
+ /* @__PURE__ */ jsx31("td", { children: rfaShortDate(transmission.occurredAt) }),
11713
+ /* @__PURE__ */ jsxs29("td", { children: [
11609
11714
  capital(words2(transmission.channel)),
11610
- /* @__PURE__ */ jsxs28("small", { children: [
11715
+ /* @__PURE__ */ jsxs29("small", { children: [
11611
11716
  capital(words2(transmission.direction)),
11612
11717
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : ""
11613
11718
  ] })
11614
11719
  ] }),
11615
- /* @__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)) }) }),
11616
- /* @__PURE__ */ jsxs28("td", { children: [
11720
+ /* @__PURE__ */ jsx31("td", { children: /* @__PURE__ */ jsx31(RfaPill, { tone: ["delivered", "received", "sent"].includes(transmission.status) ? "ok" : transmission.status === "failed" ? "bad" : "muted", children: capital(words2(transmission.status)) }) }),
11721
+ /* @__PURE__ */ jsxs29("td", { children: [
11617
11722
  transmission.destination || "\u2014",
11618
- transmission.providerMessageId ? /* @__PURE__ */ jsxs28("small", { children: [
11723
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs29("small", { children: [
11619
11724
  "Reference ",
11620
11725
  transmission.providerMessageId
11621
11726
  ] }) : null
11622
11727
  ] }),
11623
- /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.receivedAt) }),
11624
- /* @__PURE__ */ jsx30("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11728
+ /* @__PURE__ */ jsx31("td", { children: rfaShortDate(transmission.receivedAt) }),
11729
+ /* @__PURE__ */ jsx31("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11625
11730
  ] }, transmission.id)) })
11626
11731
  ] }) }) }) : null
11627
11732
  ] }) : null
11628
11733
  ] });
11629
- const content = /* @__PURE__ */ jsx30(Fragment18, { children: /* @__PURE__ */ jsxs28("div", { style: { display: "grid", gap: 16 }, children: [
11630
- error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11631
- message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11632
- loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11633
- /* @__PURE__ */ jsxs28("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11634
- /* @__PURE__ */ jsx30("h3", { children: "Requested treatments" }),
11734
+ const content = /* @__PURE__ */ jsx31(Fragment18, { children: /* @__PURE__ */ jsxs29("div", { style: { display: "grid", gap: 16 }, children: [
11735
+ error ? /* @__PURE__ */ jsx31("p", { role: "alert", children: error }) : null,
11736
+ message ? /* @__PURE__ */ jsx31("p", { role: "status", children: message }) : null,
11737
+ loadErrors.map((value) => /* @__PURE__ */ jsx31("p", { role: "alert", children: value }, value)),
11738
+ /* @__PURE__ */ jsxs29("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11739
+ /* @__PURE__ */ jsx31("h3", { children: "Requested treatments" }),
11635
11740
  rfa.items.map((item, index) => {
11636
11741
  const appointment = scheduling.find((value) => value.itemId === item.id);
11637
- return /* @__PURE__ */ jsxs28("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11638
- /* @__PURE__ */ jsxs28("legend", { children: [
11742
+ return /* @__PURE__ */ jsxs29("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11743
+ /* @__PURE__ */ jsxs29("legend", { children: [
11639
11744
  index + 1,
11640
11745
  ". ",
11641
11746
  item.serviceDescription
11642
11747
  ] }),
11643
- /* @__PURE__ */ jsxs28("p", { children: [
11748
+ /* @__PURE__ */ jsxs29("p", { children: [
11644
11749
  item.procedureCode || "No procedure code",
11645
11750
  " \xB7 Diagnosis ",
11646
11751
  item.diagnosisCode,
11647
11752
  " \xB7 ",
11648
11753
  item.decisionClosure?.closed ? "Decision no longer required" : words2(item.outcome)
11649
11754
  ] }),
11650
- /* @__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: [
11651
- /* @__PURE__ */ jsx30("dt", { children: title }),
11652
- /* @__PURE__ */ jsx30("dd", { children: value })
11755
+ /* @__PURE__ */ jsx31("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__ */ jsxs29("div", { children: [
11756
+ /* @__PURE__ */ jsx31("dt", { children: title }),
11757
+ /* @__PURE__ */ jsx31("dd", { children: value })
11653
11758
  ] }, title)) }),
11654
- item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11759
+ item.decisionClosure ? /* @__PURE__ */ jsxs29("p", { children: [
11655
11760
  item.decisionClosure.closed ? "Closed" : "Reopened",
11656
11761
  " by ",
11657
11762
  item.decisionClosure.updatedBy,
11658
11763
  " \xB7 ",
11659
11764
  date5(item.decisionClosure.updatedAt),
11660
- /* @__PURE__ */ jsx30("br", {}),
11765
+ /* @__PURE__ */ jsx31("br", {}),
11661
11766
  item.decisionClosure.reason
11662
11767
  ] }) : null,
11663
- 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,
11664
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11665
- /* @__PURE__ */ jsxs28("p", { children: [
11768
+ canClose && item.outcome === "pending" && !item.decidedAt ? /* @__PURE__ */ jsx31(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,
11769
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11770
+ /* @__PURE__ */ jsxs29("p", { children: [
11666
11771
  "Decision: ",
11667
11772
  date5(item.decidedAt),
11668
11773
  item.authorizationNumber ? ` \xB7 Authorization ${item.authorizationNumber}` : ""
11669
11774
  ] }),
11670
- item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs28("p", { children: [
11775
+ item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs29("p", { children: [
11671
11776
  "Authorized: ",
11672
11777
  item.authorizedProcedureCode || item.procedureCode || "Treatment",
11673
11778
  item.authorizedQuantity != null ? ` \xB7 Quantity ${item.authorizedQuantity}` : "",
11674
11779
  item.authorizedUnits != null ? ` \xB7 Units ${item.authorizedUnits}` : ""
11675
11780
  ] }) : null,
11676
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("p", { children: [
11781
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs29("p", { children: [
11677
11782
  "Authorization dates: ",
11678
11783
  item.effectiveFrom ?? "Not specified",
11679
11784
  " through ",
11680
11785
  item.effectiveTo ?? "Not specified"
11681
11786
  ] }) : null,
11682
- item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11683
- item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11787
+ item.decisionReason ? /* @__PURE__ */ jsx31("p", { children: item.decisionReason }) : null,
11788
+ item.reviewerName ? /* @__PURE__ */ jsxs29("p", { children: [
11684
11789
  "Reviewer: ",
11685
11790
  item.reviewerName,
11686
11791
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
@@ -11689,57 +11794,57 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11689
11794
  " ",
11690
11795
  evidence(item.currentImrDocumentId, "View independent medical review form")
11691
11796
  ] }) : null,
11692
- 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) => {
11797
+ loading ? /* @__PURE__ */ jsx31("p", { children: "Loading appointment\u2026" }) : appointment ? /* @__PURE__ */ jsx31(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) => {
11693
11798
  await client.updateScheduling(rfa.id, item.id, input, key2);
11694
11799
  return records.get(rfa.id);
11695
11800
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11696
- canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs28("details", { children: [
11697
- /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11698
- /* @__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." }),
11699
- /* @__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}`)
11801
+ canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs29("details", { children: [
11802
+ /* @__PURE__ */ jsx31("summary", { children: "Correct this decision" }),
11803
+ /* @__PURE__ */ jsx31("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." }),
11804
+ /* @__PURE__ */ jsx31(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}`)
11700
11805
  ] }) : null
11701
11806
  ] }, item.id);
11702
11807
  })
11703
11808
  ] }),
11704
- /* @__PURE__ */ jsxs28("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11705
- /* @__PURE__ */ jsxs28("details", { className: "mbrfa-delivery-evidence", children: [
11706
- /* @__PURE__ */ jsxs28("summary", { children: [
11809
+ /* @__PURE__ */ jsxs29("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11810
+ /* @__PURE__ */ jsxs29("details", { className: "mbrfa-delivery-evidence", children: [
11811
+ /* @__PURE__ */ jsxs29("summary", { children: [
11707
11812
  "Delivery evidence (",
11708
11813
  rfa.transmissions.length,
11709
11814
  ")"
11710
11815
  ] }),
11711
- rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("article", { style: { paddingBlock: 8 }, children: [
11712
- /* @__PURE__ */ jsxs28("strong", { children: [
11816
+ rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs29("article", { style: { paddingBlock: 8 }, children: [
11817
+ /* @__PURE__ */ jsxs29("strong", { children: [
11713
11818
  words2(transmission.channel),
11714
11819
  " \xB7 ",
11715
11820
  words2(transmission.status)
11716
11821
  ] }),
11717
- /* @__PURE__ */ jsxs28("p", { children: [
11822
+ /* @__PURE__ */ jsxs29("p", { children: [
11718
11823
  words2(transmission.direction),
11719
11824
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : "",
11720
11825
  " \xB7 ",
11721
11826
  date5(transmission.occurredAt)
11722
11827
  ] }),
11723
- transmission.destination ? /* @__PURE__ */ jsxs28("p", { children: [
11828
+ transmission.destination ? /* @__PURE__ */ jsxs29("p", { children: [
11724
11829
  "Recipient: ",
11725
11830
  transmission.destination
11726
11831
  ] }) : null,
11727
- transmission.providerMessageId ? /* @__PURE__ */ jsxs28("p", { children: [
11832
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs29("p", { children: [
11728
11833
  "Delivery reference: ",
11729
11834
  transmission.providerMessageId
11730
11835
  ] }) : null,
11731
- transmission.receivedAt ? /* @__PURE__ */ jsxs28("p", { children: [
11836
+ transmission.receivedAt ? /* @__PURE__ */ jsxs29("p", { children: [
11732
11837
  "Confirmed receipt: ",
11733
11838
  date5(transmission.receivedAt)
11734
11839
  ] }) : null,
11735
11840
  evidence(transmission.proofDocumentId, "Download transmission receipt")
11736
- ] }, transmission.id)) : /* @__PURE__ */ jsx30("p", { children: "No transmission evidence has been recorded." })
11841
+ ] }, transmission.id)) : /* @__PURE__ */ jsx31("p", { children: "No transmission evidence has been recorded." })
11737
11842
  ] }),
11738
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11739
- /* @__PURE__ */ jsx30("h3", { children: "History and notes" }),
11740
- permissions.includes("edit") ? /* @__PURE__ */ jsxs28("details", { className: "mbrfa-note-form", children: [
11741
- /* @__PURE__ */ jsx30("summary", { children: "Add a note" }),
11742
- /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11843
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11844
+ /* @__PURE__ */ jsx31("h3", { children: "History and notes" }),
11845
+ permissions.includes("edit") ? /* @__PURE__ */ jsxs29("details", { className: "mbrfa-note-form", children: [
11846
+ /* @__PURE__ */ jsx31("summary", { children: "Add a note" }),
11847
+ /* @__PURE__ */ jsx31("form", { onSubmit: (event) => {
11743
11848
  event.preventDefault();
11744
11849
  const form = event.currentTarget;
11745
11850
  try {
@@ -11753,51 +11858,51 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11753
11858
  } catch (reason) {
11754
11859
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11755
11860
  }
11756
- }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11757
- /* @__PURE__ */ jsx30("legend", { children: "Add a note" }),
11758
- /* @__PURE__ */ jsxs28("label", { children: [
11861
+ }, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
11862
+ /* @__PURE__ */ jsx31("legend", { children: "Add a note" }),
11863
+ /* @__PURE__ */ jsxs29("label", { children: [
11759
11864
  "Note",
11760
- /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4 })
11865
+ /* @__PURE__ */ jsx31("textarea", { name: "note", required: true, maxLength: 1e4 })
11761
11866
  ] }),
11762
- /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save note" })
11867
+ /* @__PURE__ */ jsx31("button", { type: "submit", children: "Save note" })
11763
11868
  ] }) })
11764
11869
  ] }) : null,
11765
- 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: [
11766
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11767
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11768
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11769
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11770
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11870
+ loading ? /* @__PURE__ */ jsx31("p", { children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-history-table", children: [
11871
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11872
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Date" }),
11873
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Action" }),
11874
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "User" }),
11875
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Details" })
11771
11876
  ] }) }),
11772
- /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11773
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { children: "No history entries have been recorded." }) : null
11877
+ /* @__PURE__ */ jsx31("tbody", { children: history.map((event) => /* @__PURE__ */ jsx31(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11878
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx31("p", { children: "No history entries have been recorded." }) : null
11774
11879
  ] })
11775
11880
  ] })
11776
11881
  ] }) });
11777
- if (cards) return /* @__PURE__ */ jsx30("div", { className: "mbrfa-tracking", children: cardContent });
11778
- 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: [
11779
- /* @__PURE__ */ jsx30("style", { children: rfaDetailCss }),
11882
+ if (cards) return /* @__PURE__ */ jsx31("div", { className: "mbrfa-tracking", children: cardContent });
11883
+ return embedded ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-tracking", children: content }) : /* @__PURE__ */ jsxs29(TreatmentDraftShell, { ...appearance, title: "Treatments and history", description: "Review each treatment's authorization, appointments, delivery evidence, and notes.", children: [
11884
+ /* @__PURE__ */ jsx31("style", { children: rfaDetailCss }),
11780
11885
  content
11781
11886
  ] });
11782
11887
  }
11783
11888
  function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11784
- const [disposition, setDisposition] = useState18(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11785
- return /* @__PURE__ */ jsxs28("section", { children: [
11786
- /* @__PURE__ */ jsx30("h4", { children: "Appointment" }),
11787
- /* @__PURE__ */ jsxs28("p", { children: [
11889
+ const [disposition, setDisposition] = useState19(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11890
+ return /* @__PURE__ */ jsxs29("section", { children: [
11891
+ /* @__PURE__ */ jsx31("h4", { children: "Appointment" }),
11892
+ /* @__PURE__ */ jsxs29("p", { children: [
11788
11893
  words2(appointment.disposition),
11789
11894
  appointment.appointmentAt ? ` \xB7 ${date5(appointment.appointmentAt)}` : ""
11790
11895
  ] }),
11791
- appointment.providerName ? /* @__PURE__ */ jsxs28("p", { children: [
11896
+ appointment.providerName ? /* @__PURE__ */ jsxs29("p", { children: [
11792
11897
  appointment.providerName,
11793
11898
  " \xB7 ",
11794
11899
  appointment.location
11795
11900
  ] }) : null,
11796
- appointment.reason ? /* @__PURE__ */ jsx30("p", { children: appointment.reason }) : null,
11797
- appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx30("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11798
- editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs28("details", { children: [
11799
- /* @__PURE__ */ jsx30("summary", { children: "Update appointment" }),
11800
- /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11901
+ appointment.reason ? /* @__PURE__ */ jsx31("p", { children: appointment.reason }) : null,
11902
+ appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx31("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11903
+ editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs29("details", { children: [
11904
+ /* @__PURE__ */ jsx31("summary", { children: "Update appointment" }),
11905
+ /* @__PURE__ */ jsx31("form", { onSubmit: (event) => {
11801
11906
  event.preventDefault();
11802
11907
  if (disabled) return;
11803
11908
  try {
@@ -11808,42 +11913,42 @@ function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11808
11913
  } catch (reason) {
11809
11914
  onError(reason instanceof Error ? reason.message : "Review the appointment details.");
11810
11915
  }
11811
- }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11812
- /* @__PURE__ */ jsx30("legend", { children: "Appointment details" }),
11813
- /* @__PURE__ */ jsxs28("label", { children: [
11916
+ }, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
11917
+ /* @__PURE__ */ jsx31("legend", { children: "Appointment details" }),
11918
+ /* @__PURE__ */ jsxs29("label", { children: [
11814
11919
  "Disposition",
11815
- /* @__PURE__ */ jsxs28("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11816
- appointment.eligible ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11817
- /* @__PURE__ */ jsx30("option", { value: "scheduled", children: "Scheduled" }),
11818
- /* @__PURE__ */ jsx30("option", { value: "no_appointment", children: "No appointment needed" })
11920
+ /* @__PURE__ */ jsxs29("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11921
+ appointment.eligible ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11922
+ /* @__PURE__ */ jsx31("option", { value: "scheduled", children: "Scheduled" }),
11923
+ /* @__PURE__ */ jsx31("option", { value: "no_appointment", children: "No appointment needed" })
11819
11924
  ] }) : null,
11820
- appointment.version > 0 ? /* @__PURE__ */ jsx30("option", { value: "canceled", children: "Canceled" }) : null
11925
+ appointment.version > 0 ? /* @__PURE__ */ jsx31("option", { value: "canceled", children: "Canceled" }) : null
11821
11926
  ] })
11822
11927
  ] }),
11823
- disposition === "scheduled" ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11824
- /* @__PURE__ */ jsxs28("label", { children: [
11928
+ disposition === "scheduled" ? /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11929
+ /* @__PURE__ */ jsxs29("label", { children: [
11825
11930
  "Date and time (your local time)",
11826
- /* @__PURE__ */ jsx30("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11931
+ /* @__PURE__ */ jsx31("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11827
11932
  ] }),
11828
- /* @__PURE__ */ jsxs28("label", { children: [
11933
+ /* @__PURE__ */ jsxs29("label", { children: [
11829
11934
  "Provider name",
11830
- /* @__PURE__ */ jsx30("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11935
+ /* @__PURE__ */ jsx31("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11831
11936
  ] }),
11832
- /* @__PURE__ */ jsxs28("label", { children: [
11937
+ /* @__PURE__ */ jsxs29("label", { children: [
11833
11938
  "Location",
11834
- /* @__PURE__ */ jsx30("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11939
+ /* @__PURE__ */ jsx31("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11835
11940
  ] })
11836
- ] }) : /* @__PURE__ */ jsxs28("label", { children: [
11941
+ ] }) : /* @__PURE__ */ jsxs29("label", { children: [
11837
11942
  "Reason",
11838
- /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11943
+ /* @__PURE__ */ jsx31("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11839
11944
  ] }),
11840
- /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save appointment" })
11945
+ /* @__PURE__ */ jsx31("button", { type: "submit", children: "Save appointment" })
11841
11946
  ] }) })
11842
- ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx30("p", { children: "Appointments become available after treatment is authorized." }) : null
11947
+ ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx31("p", { children: "Appointments become available after treatment is authorized." }) : null
11843
11948
  ] });
11844
11949
  }
11845
11950
  function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11846
- const [outcome, setOutcome] = useState18(item.outcome);
11951
+ const [outcome, setOutcome] = useState19(item.outcome);
11847
11952
  const submit = (event) => {
11848
11953
  event.preventDefault();
11849
11954
  if (disabled) return;
@@ -11867,90 +11972,90 @@ function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11867
11972
  onError(reason instanceof Error ? reason.message : "Review the correction details.");
11868
11973
  }
11869
11974
  };
11870
- return /* @__PURE__ */ jsx30("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11871
- /* @__PURE__ */ jsx30("legend", { children: "Decision correction" }),
11872
- /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11873
- /* @__PURE__ */ jsxs28("label", { children: [
11975
+ return /* @__PURE__ */ jsx31("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
11976
+ /* @__PURE__ */ jsx31("legend", { children: "Decision correction" }),
11977
+ /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11978
+ /* @__PURE__ */ jsxs29("label", { children: [
11874
11979
  "Correction reason",
11875
- /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e4 })
11980
+ /* @__PURE__ */ jsx31("textarea", { name: "reason", required: true, maxLength: 2e4 })
11876
11981
  ] }),
11877
- /* @__PURE__ */ jsxs28("label", { children: [
11982
+ /* @__PURE__ */ jsxs29("label", { children: [
11878
11983
  "Corrected decision",
11879
- /* @__PURE__ */ jsxs28("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11880
- /* @__PURE__ */ jsx30("option", { value: "approved", children: "Approved" }),
11881
- /* @__PURE__ */ jsx30("option", { value: "modified", children: "Modified" }),
11882
- /* @__PURE__ */ jsx30("option", { value: "denied", children: "Denied" })
11984
+ /* @__PURE__ */ jsxs29("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11985
+ /* @__PURE__ */ jsx31("option", { value: "approved", children: "Approved" }),
11986
+ /* @__PURE__ */ jsx31("option", { value: "modified", children: "Modified" }),
11987
+ /* @__PURE__ */ jsx31("option", { value: "denied", children: "Denied" })
11883
11988
  ] })
11884
11989
  ] }),
11885
- /* @__PURE__ */ jsxs28("label", { children: [
11990
+ /* @__PURE__ */ jsxs29("label", { children: [
11886
11991
  "Decision time",
11887
- /* @__PURE__ */ jsx30("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11992
+ /* @__PURE__ */ jsx31("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11888
11993
  ] }),
11889
- /* @__PURE__ */ jsxs28("label", { children: [
11994
+ /* @__PURE__ */ jsxs29("label", { children: [
11890
11995
  "Decision response evidence",
11891
- /* @__PURE__ */ jsxs28("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11892
- /* @__PURE__ */ jsx30("option", { value: "", children: "Choose evidence" }),
11893
- documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
11996
+ /* @__PURE__ */ jsxs29("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11997
+ /* @__PURE__ */ jsx31("option", { value: "", children: "Choose evidence" }),
11998
+ documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx31("option", { value: document2.id, children: document2.filename }, document2.id))
11894
11999
  ] })
11895
12000
  ] }),
11896
- outcome !== "approved" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11897
- /* @__PURE__ */ jsxs28("label", { children: [
12001
+ outcome !== "approved" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
12002
+ /* @__PURE__ */ jsxs29("label", { children: [
11898
12003
  "Independent medical review form",
11899
- /* @__PURE__ */ jsxs28("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
11900
- /* @__PURE__ */ jsx30("option", { value: "", children: "Choose a form" }),
11901
- documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
12004
+ /* @__PURE__ */ jsxs29("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
12005
+ /* @__PURE__ */ jsx31("option", { value: "", children: "Choose a form" }),
12006
+ documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx31("option", { value: document2.id, children: document2.filename }, document2.id))
11902
12007
  ] })
11903
12008
  ] }),
11904
- /* @__PURE__ */ jsxs28("label", { children: [
12009
+ /* @__PURE__ */ jsxs29("label", { children: [
11905
12010
  "Decision reason",
11906
- /* @__PURE__ */ jsx30("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
12011
+ /* @__PURE__ */ jsx31("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
11907
12012
  ] }),
11908
- /* @__PURE__ */ jsxs28("label", { children: [
12013
+ /* @__PURE__ */ jsxs29("label", { children: [
11909
12014
  "Reviewer name",
11910
- /* @__PURE__ */ jsx30("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
12015
+ /* @__PURE__ */ jsx31("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
11911
12016
  ] }),
11912
- /* @__PURE__ */ jsxs28("label", { children: [
12017
+ /* @__PURE__ */ jsxs29("label", { children: [
11913
12018
  "Reviewer phone",
11914
- /* @__PURE__ */ jsx30("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
12019
+ /* @__PURE__ */ jsx31("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
11915
12020
  ] })
11916
12021
  ] }) : null,
11917
- outcome !== "denied" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11918
- /* @__PURE__ */ jsxs28("label", { children: [
12022
+ outcome !== "denied" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
12023
+ /* @__PURE__ */ jsxs29("label", { children: [
11919
12024
  "Authorization number",
11920
- /* @__PURE__ */ jsx30("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
12025
+ /* @__PURE__ */ jsx31("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
11921
12026
  ] }),
11922
- /* @__PURE__ */ jsxs28("label", { children: [
12027
+ /* @__PURE__ */ jsxs29("label", { children: [
11923
12028
  "Authorized procedure code",
11924
- /* @__PURE__ */ jsx30("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
12029
+ /* @__PURE__ */ jsx31("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
11925
12030
  ] }),
11926
- /* @__PURE__ */ jsxs28("label", { children: [
12031
+ /* @__PURE__ */ jsxs29("label", { children: [
11927
12032
  "Authorized quantity",
11928
- /* @__PURE__ */ jsx30("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
12033
+ /* @__PURE__ */ jsx31("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
11929
12034
  ] }),
11930
- /* @__PURE__ */ jsxs28("label", { children: [
12035
+ /* @__PURE__ */ jsxs29("label", { children: [
11931
12036
  "Authorized units",
11932
- /* @__PURE__ */ jsx30("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
12037
+ /* @__PURE__ */ jsx31("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
11933
12038
  ] }),
11934
- /* @__PURE__ */ jsxs28("label", { children: [
12039
+ /* @__PURE__ */ jsxs29("label", { children: [
11935
12040
  "Effective from",
11936
- /* @__PURE__ */ jsx30("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
12041
+ /* @__PURE__ */ jsx31("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
11937
12042
  ] }),
11938
- /* @__PURE__ */ jsxs28("label", { children: [
12043
+ /* @__PURE__ */ jsxs29("label", { children: [
11939
12044
  "Effective through",
11940
- /* @__PURE__ */ jsx30("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
12045
+ /* @__PURE__ */ jsx31("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
11941
12046
  ] })
11942
12047
  ] }) : null
11943
12048
  ] }),
11944
- /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save decision correction" })
12049
+ /* @__PURE__ */ jsx31("button", { type: "submit", children: "Save decision correction" })
11945
12050
  ] }) });
11946
12051
  }
11947
12052
  function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11948
12053
  const closed = Boolean(item.decisionClosure?.closed);
11949
12054
  const title = closed ? "Reopen treatment follow-up" : "Decision no longer required";
11950
- return /* @__PURE__ */ jsxs28("details", { children: [
11951
- /* @__PURE__ */ jsx30("summary", { children: title }),
11952
- /* @__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." }),
11953
- /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
12055
+ return /* @__PURE__ */ jsxs29("details", { children: [
12056
+ /* @__PURE__ */ jsx31("summary", { children: title }),
12057
+ /* @__PURE__ */ jsx31("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." }),
12058
+ /* @__PURE__ */ jsx31("form", { onSubmit: (event) => {
11954
12059
  event.preventDefault();
11955
12060
  if (disabled) return;
11956
12061
  try {
@@ -11959,112 +12064,112 @@ function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11959
12064
  } catch (reason) {
11960
12065
  onError(reason instanceof Error ? reason.message : "Enter a reason.");
11961
12066
  }
11962
- }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11963
- /* @__PURE__ */ jsx30("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
11964
- /* @__PURE__ */ jsxs28("label", { children: [
12067
+ }, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
12068
+ /* @__PURE__ */ jsx31("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
12069
+ /* @__PURE__ */ jsxs29("label", { children: [
11965
12070
  closed ? "Reason for reopening" : "Reason a decision is no longer required",
11966
- /* @__PURE__ */ jsx30("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
12071
+ /* @__PURE__ */ jsx31("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
11967
12072
  ] }),
11968
- /* @__PURE__ */ jsx30("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx30("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
12073
+ /* @__PURE__ */ jsx31("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx31("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
11969
12074
  ] }) })
11970
12075
  ] });
11971
12076
  }
11972
12077
 
11973
12078
  // src/rfa-request-summary.tsx
11974
- import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
12079
+ import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
11975
12080
  var readable = (value) => value.replaceAll("_", " ");
11976
12081
  var calendarDate = (value) => value?.match(/^\d{4}-\d{2}-\d{2}/)?.[0] ?? value;
11977
12082
  function Details({ entries }) {
11978
- 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: [
11979
- /* @__PURE__ */ jsx31("dt", { children: name }),
11980
- /* @__PURE__ */ jsx31("dd", { children: value })
12083
+ return /* @__PURE__ */ jsx32("dl", { className: "mbrfa-request-details", children: entries.filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([name, value]) => /* @__PURE__ */ jsxs30("div", { children: [
12084
+ /* @__PURE__ */ jsx32("dt", { children: name }),
12085
+ /* @__PURE__ */ jsx32("dd", { children: value })
11981
12086
  ] }, name)) });
11982
12087
  }
11983
12088
  function Contact({ title, contact }) {
11984
12089
  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]];
11985
- return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11986
- /* @__PURE__ */ jsx31("h3", { children: title }),
11987
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx31(Details, { entries }) : /* @__PURE__ */ jsx31("p", { children: "Not recorded." }) })
12090
+ return /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12091
+ /* @__PURE__ */ jsx32("h3", { children: title }),
12092
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx32(Details, { entries }) : /* @__PURE__ */ jsx32("p", { children: "Not recorded." }) })
11988
12093
  ] });
11989
12094
  }
11990
12095
  function RfaRequestSummary({ rfa, onViewClaimsAdministrator, getPatientHref, getClaimHref, getProviderHref, hideTreatments = false, collapseContacts = false }) {
11991
- const contacts2 = /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11992
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11993
- /* @__PURE__ */ jsx31("h3", { children: "Patient and injury" }),
11994
- /* @__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"]] }) })
12096
+ const contacts2 = /* @__PURE__ */ jsxs30("div", { className: "mbtd-grid", children: [
12097
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12098
+ /* @__PURE__ */ jsx32("h3", { children: "Patient and injury" }),
12099
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Patient", /* @__PURE__ */ jsx32(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName })], ["Claim number", /* @__PURE__ */ jsx32(RfaLink, { href: getClaimHref?.(rfa), children: rfa.claimNumber || "Not recorded" })], ["Injury", rfa.injuryDescription ? /* @__PURE__ */ jsx32(RfaLink, { href: getClaimHref?.(rfa), children: rfa.injuryDescription }) : null], ["Date of injury", calendarDate(rfa.dateOfInjury) || "Not recorded"]] }) })
11995
12100
  ] }),
11996
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11997
- /* @__PURE__ */ jsx31("h3", { children: "Requesting physician" }),
11998
- /* @__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]] }) })
12101
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12102
+ /* @__PURE__ */ jsx32("h3", { children: "Requesting physician" }),
12103
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Name", /* @__PURE__ */ jsx32(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName })], ["NPI", rfa.providerNpi], ["Phone", rfa.providerPhone], ["Fax", rfa.providerFax]] }) })
11999
12104
  ] }),
12000
- /* @__PURE__ */ jsx31(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
12001
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
12002
- /* @__PURE__ */ jsx31("h3", { children: "Claims administrator" }),
12003
- /* @__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(", ")]] }) })
12105
+ /* @__PURE__ */ jsx32(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
12106
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12107
+ /* @__PURE__ */ jsx32("h3", { children: "Claims administrator" }),
12108
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Name", /* @__PURE__ */ jsx32(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(", ")]] }) })
12004
12109
  ] })
12005
12110
  ] });
12006
- return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
12007
- /* @__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)}}` }),
12111
+ return /* @__PURE__ */ jsxs30("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
12112
+ /* @__PURE__ */ jsx32("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)}}` }),
12008
12113
  !collapseContacts ? contacts2 : null,
12009
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
12010
- /* @__PURE__ */ jsx31("h3", { children: "Request information" }),
12011
- /* @__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]] }) })
12114
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12115
+ /* @__PURE__ */ jsx32("h3", { children: "Request information" }),
12116
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(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]] }) })
12012
12117
  ] }),
12013
- collapseContacts ? /* @__PURE__ */ jsxs29("details", { className: "mbrfa-detail-card", children: [
12014
- /* @__PURE__ */ jsx31("summary", { children: "Patient, physician & claim details" }),
12118
+ collapseContacts ? /* @__PURE__ */ jsxs30("details", { className: "mbrfa-detail-card", children: [
12119
+ /* @__PURE__ */ jsx32("summary", { children: "Patient, physician & claim details" }),
12015
12120
  contacts2
12016
12121
  ] }) : null,
12017
- !hideTreatments ? /* @__PURE__ */ jsxs29("fieldset", { children: [
12018
- /* @__PURE__ */ jsx31("legend", { children: "Requested services" }),
12019
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs29("article", { children: [
12020
- /* @__PURE__ */ jsxs29("h4", { children: [
12122
+ !hideTreatments ? /* @__PURE__ */ jsxs30("fieldset", { children: [
12123
+ /* @__PURE__ */ jsx32("legend", { children: "Requested services" }),
12124
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs30("article", { children: [
12125
+ /* @__PURE__ */ jsxs30("h4", { children: [
12021
12126
  index + 1,
12022
12127
  ". ",
12023
12128
  item.serviceDescription
12024
12129
  ] }),
12025
- /* @__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)]] })
12130
+ /* @__PURE__ */ jsx32(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)]] })
12026
12131
  ] }, item.id)) }),
12027
- rfa.items.length === 0 ? /* @__PURE__ */ jsx31("p", { children: "No services recorded." }) : null
12132
+ rfa.items.length === 0 ? /* @__PURE__ */ jsx32("p", { children: "No services recorded." }) : null
12028
12133
  ] }) : null
12029
12134
  ] });
12030
12135
  }
12031
12136
 
12032
12137
  // src/rfa-packets.tsx
12033
- import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef15, useState as useState19 } from "react";
12138
+ import { useEffect as useEffect17, useMemo as useMemo9, useRef as useRef15, useState as useState20 } from "react";
12034
12139
  import { createRfaPacketsClient } from "@mindbill/browser";
12035
- import { Fragment as Fragment19, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
12140
+ import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12036
12141
  function RfaPacketsPanel({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
12037
12142
  const options = useMemo9(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
12038
12143
  const identity = useMemo9(() => crypto.randomUUID(), [options]);
12039
- return /* @__PURE__ */ jsx32(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
12144
+ return /* @__PURE__ */ jsx33(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
12040
12145
  }
12041
12146
  function PacketsContent({ rfa, options, permissions = [], environment = "sandbox", disabled = false, onForwarded }) {
12042
12147
  const client = useMemo9(() => createRfaPacketsClient(options), [options]);
12043
- const [history, setHistory] = useState19(null);
12044
- const [selected, setSelected] = useState19("");
12045
- const [prepared, setPrepared] = useState19(null);
12046
- const [channel, setChannel] = useState19("fax");
12047
- const [recipient, setRecipient] = useState19("");
12048
- const [reviewed, setReviewed] = useState19(false);
12049
- const [confirmed, setConfirmed] = useState19(false);
12050
- const [loading, setLoading] = useState19(true);
12051
- const [busy, setBusy] = useState19(false);
12052
- const [error, setError] = useState19("");
12053
- const [notice, setNotice] = useState19("");
12054
- const [reload, setReload] = useState19(0);
12148
+ const [history, setHistory] = useState20(null);
12149
+ const [selected, setSelected] = useState20("");
12150
+ const [prepared, setPrepared] = useState20(null);
12151
+ const [channel, setChannel] = useState20("fax");
12152
+ const [recipient, setRecipient] = useState20("");
12153
+ const [reviewed, setReviewed] = useState20(false);
12154
+ const [confirmed, setConfirmed] = useState20(false);
12155
+ const [loading, setLoading] = useState20(true);
12156
+ const [busy, setBusy] = useState20(false);
12157
+ const [error, setError] = useState20("");
12158
+ const [notice, setNotice] = useState20("");
12159
+ const [reload, setReload] = useState20(0);
12055
12160
  const pending = useRef15(false);
12056
12161
  const keys = useRef15(/* @__PURE__ */ new Map());
12057
12162
  const completed = useRef15(/* @__PURE__ */ new Set());
12058
12163
  const alive = useRef15(true);
12059
12164
  const currentSelection = useRef15(selected);
12060
12165
  currentSelection.current = selected;
12061
- useEffect16(() => {
12166
+ useEffect17(() => {
12062
12167
  alive.current = true;
12063
12168
  return () => {
12064
12169
  alive.current = false;
12065
12170
  };
12066
12171
  }, []);
12067
- useEffect16(() => {
12172
+ useEffect17(() => {
12068
12173
  let active = true;
12069
12174
  setLoading(true);
12070
12175
  setError("");
@@ -12140,23 +12245,23 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12140
12245
  if (alive.current) setBusy(false);
12141
12246
  }
12142
12247
  };
12143
- return /* @__PURE__ */ jsxs30("section", { "aria-label": "Saved RFA packets", children: [
12144
- /* @__PURE__ */ jsx32("h3", { children: "Saved packets" }),
12145
- /* @__PURE__ */ jsx32("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12146
- error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: error }) : null,
12147
- notice ? /* @__PURE__ */ jsx32("p", { role: "status", children: notice }) : null,
12148
- loading ? /* @__PURE__ */ jsx32("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12149
- !loading && !history ? /* @__PURE__ */ jsx32("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12150
- history?.packets.length === 0 ? /* @__PURE__ */ jsx32("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs30(Fragment19, { children: [
12151
- /* @__PURE__ */ jsxs30("label", { children: [
12248
+ return /* @__PURE__ */ jsxs31("section", { "aria-label": "Saved RFA packets", children: [
12249
+ /* @__PURE__ */ jsx33("h3", { children: "Saved packets" }),
12250
+ /* @__PURE__ */ jsx33("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12251
+ error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: error }) : null,
12252
+ notice ? /* @__PURE__ */ jsx33("p", { role: "status", children: notice }) : null,
12253
+ loading ? /* @__PURE__ */ jsx33("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12254
+ !loading && !history ? /* @__PURE__ */ jsx33("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12255
+ history?.packets.length === 0 ? /* @__PURE__ */ jsx33("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs31(Fragment19, { children: [
12256
+ /* @__PURE__ */ jsxs31("label", { children: [
12152
12257
  "Saved packet",
12153
- /* @__PURE__ */ jsxs30("select", { disabled: locked, value: selected, onChange: (event) => {
12258
+ /* @__PURE__ */ jsxs31("select", { disabled: locked, value: selected, onChange: (event) => {
12154
12259
  setSelected(event.target.value);
12155
12260
  setPrepared(null);
12156
12261
  resetReview();
12157
12262
  }, children: [
12158
- /* @__PURE__ */ jsx32("option", { value: "", children: "Choose a saved packet" }),
12159
- history.packets.map((value) => /* @__PURE__ */ jsxs30("option", { value: value.id, children: [
12263
+ /* @__PURE__ */ jsx33("option", { value: "", children: "Choose a saved packet" }),
12264
+ history.packets.map((value) => /* @__PURE__ */ jsxs31("option", { value: value.id, children: [
12160
12265
  value.source === "submission" ? "Submission" : "Download",
12161
12266
  " \xB7 revision ",
12162
12267
  value.contentRevision,
@@ -12165,68 +12270,68 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12165
12270
  ] }, value.id))
12166
12271
  ] })
12167
12272
  ] }),
12168
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12169
- blob ? /* @__PURE__ */ jsx32(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12170
- !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: [
12171
- /* @__PURE__ */ jsx32("legend", { children: "Forward saved packet" }),
12172
- /* @__PURE__ */ jsx32("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12173
- /* @__PURE__ */ jsxs30("label", { children: [
12273
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12274
+ blob ? /* @__PURE__ */ jsx33(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12275
+ !canForward ? /* @__PURE__ */ jsx33("p", { children: environment !== "live" ? "Sandbox: saved PDFs are available for review. External forwarding is disabled." : "Forwarding requires permission from your organization." }) : selected && !eligible ? /* @__PURE__ */ jsx33("p", { children: "This packet is not eligible for forwarding. Submission packets require a successful original dispatch." }) : /* @__PURE__ */ jsxs31("fieldset", { disabled: locked, children: [
12276
+ /* @__PURE__ */ jsx33("legend", { children: "Forward saved packet" }),
12277
+ /* @__PURE__ */ jsx33("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12278
+ /* @__PURE__ */ jsxs31("label", { children: [
12174
12279
  "Forward by",
12175
- /* @__PURE__ */ jsxs30("select", { value: channel, onChange: (event) => {
12280
+ /* @__PURE__ */ jsxs31("select", { value: channel, onChange: (event) => {
12176
12281
  setChannel(event.target.value);
12177
12282
  resetReview();
12178
12283
  }, children: [
12179
- /* @__PURE__ */ jsx32("option", { value: "fax", children: "Fax" }),
12180
- /* @__PURE__ */ jsx32("option", { value: "email", children: "Email" })
12284
+ /* @__PURE__ */ jsx33("option", { value: "fax", children: "Fax" }),
12285
+ /* @__PURE__ */ jsx33("option", { value: "email", children: "Email" })
12181
12286
  ] })
12182
12287
  ] }),
12183
- 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,
12184
- /* @__PURE__ */ jsxs30("label", { children: [
12288
+ channel === "email" ? /* @__PURE__ */ jsx33("p", { children: "Email forwarding requires email delivery to be enabled for your organization. The server will reject requests when it is unavailable." }) : null,
12289
+ /* @__PURE__ */ jsxs31("label", { children: [
12185
12290
  channel === "fax" ? "Recipient fax (with country code)" : "Recipient email",
12186
- /* @__PURE__ */ jsx32("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12291
+ /* @__PURE__ */ jsx33("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12187
12292
  setRecipient(event.target.value);
12188
12293
  resetReview();
12189
12294
  } })
12190
12295
  ] }),
12191
- /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12192
- /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12296
+ /* @__PURE__ */ jsxs31("label", { className: "mbrfa-check", children: [
12297
+ /* @__PURE__ */ jsx33("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12193
12298
  setReviewed(event.target.checked);
12194
12299
  setConfirmed(false);
12195
12300
  } }),
12196
12301
  "I reviewed this saved packet and its attachments."
12197
12302
  ] }),
12198
- /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12199
- /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12303
+ /* @__PURE__ */ jsxs31("label", { className: "mbrfa-check", children: [
12304
+ /* @__PURE__ */ jsx33("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12200
12305
  "I verified that ",
12201
12306
  destination || "this recipient",
12202
12307
  " is authorized to receive this patient\u2019s packet."
12203
12308
  ] }),
12204
- alreadyForwarded ? /* @__PURE__ */ jsx32("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12205
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12309
+ alreadyForwarded ? /* @__PURE__ */ jsx33("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12310
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12206
12311
  ] })
12207
12312
  ] }) : null
12208
12313
  ] });
12209
12314
  }
12210
12315
 
12211
12316
  // src/rfa-draft-actions.tsx
12212
- import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef16, useState as useState20 } from "react";
12317
+ import { useEffect as useEffect18, useMemo as useMemo10, useRef as useRef16, useState as useState21 } from "react";
12213
12318
  import { createRfaDraftActionsClient } from "@mindbill/browser";
12214
- import { Fragment as Fragment20, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12319
+ import { Fragment as Fragment20, jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12215
12320
  function RfaDraftActions({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
12216
12321
  const options = useMemo10(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
12217
12322
  const identity = useMemo10(() => crypto.randomUUID(), [options]);
12218
- return /* @__PURE__ */ jsx33(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12323
+ return /* @__PURE__ */ jsx34(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12219
12324
  }
12220
12325
  function DraftActionsContent({ rfa, options, permissions = [], disabled = false, onCopied, onCanceled }) {
12221
12326
  const client = useMemo10(() => createRfaDraftActionsClient(options), [options]);
12222
- const [confirming, setConfirming] = useState20(null);
12223
- const [busy, setBusy] = useState20(false);
12224
- const [error, setError] = useState20("");
12225
- const [completed, setCompleted] = useState20(null);
12327
+ const [confirming, setConfirming] = useState21(null);
12328
+ const [busy, setBusy] = useState21(false);
12329
+ const [error, setError] = useState21("");
12330
+ const [completed, setCompleted] = useState21(null);
12226
12331
  const pending = useRef16(false);
12227
12332
  const keys = useRef16({});
12228
12333
  const alive = useRef16(true);
12229
- useEffect17(() => {
12334
+ useEffect18(() => {
12230
12335
  alive.current = true;
12231
12336
  return () => {
12232
12337
  alive.current = false;
@@ -12255,112 +12360,112 @@ function DraftActionsContent({ rfa, options, permissions = [], disabled = false,
12255
12360
  if (alive.current) setBusy(false);
12256
12361
  }
12257
12362
  };
12258
- return /* @__PURE__ */ jsxs31("section", { "aria-label": "RFA draft actions", children: [
12259
- error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: error }) : null,
12260
- 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: [
12261
- confirming === "copy" ? /* @__PURE__ */ jsxs31(Fragment20, { children: [
12262
- /* @__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." }),
12263
- /* @__PURE__ */ jsx33("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12264
- ] }) : /* @__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." }),
12265
- /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12266
- /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => {
12363
+ return /* @__PURE__ */ jsxs32("section", { "aria-label": "RFA draft actions", children: [
12364
+ error ? /* @__PURE__ */ jsx34("p", { role: "alert", children: error }) : null,
12365
+ completed ? /* @__PURE__ */ jsx34("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__ */ jsxs32("div", { className: "mbtd-note", children: [
12366
+ confirming === "copy" ? /* @__PURE__ */ jsxs32(Fragment20, { children: [
12367
+ /* @__PURE__ */ jsx34("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." }),
12368
+ /* @__PURE__ */ jsx34("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12369
+ ] }) : /* @__PURE__ */ jsx34("p", { children: "Cancel this unsigned draft? It will no longer be available for submission. The request and its audit history will be retained." }),
12370
+ /* @__PURE__ */ jsxs32("div", { className: "mbtd-actions", children: [
12371
+ /* @__PURE__ */ jsx34("button", { type: "button", disabled: disabled || busy, onClick: () => {
12267
12372
  void mutate(confirming);
12268
12373
  }, children: busy ? "Saving\u2026" : confirming === "copy" ? "Create draft copy" : "Confirm cancellation" }),
12269
- /* @__PURE__ */ jsx33("button", { type: "button", disabled: busy, onClick: () => {
12374
+ /* @__PURE__ */ jsx34("button", { type: "button", disabled: busy, onClick: () => {
12270
12375
  setConfirming(null);
12271
12376
  setError("");
12272
12377
  }, children: "Keep current request" })
12273
12378
  ] })
12274
- ] }) : /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12275
- canCopy ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12276
- canCancel ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12379
+ ] }) : /* @__PURE__ */ jsxs32("div", { className: "mbtd-actions", children: [
12380
+ canCopy ? /* @__PURE__ */ jsx34("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12381
+ canCancel ? /* @__PURE__ */ jsx34("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12277
12382
  ] })
12278
12383
  ] });
12279
12384
  }
12280
12385
 
12281
12386
  // src/rfa-list-view.tsx
12282
12387
  import { getRfaLifecycleStatus as getRfaLifecycleStatus3, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS3 } from "@mindbill/browser";
12283
- import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12388
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12284
12389
  var date6 = (value) => value ? new Date(value).toLocaleDateString() : "\u2014";
12285
12390
  var label2 = (value) => value.replaceAll("_", " ");
12286
12391
  function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSort, onSelect, lifecycleAvailable = true, hideViewSwitch = false, getRfaHref, getPatientHref, getClaimHref, getProviderHref }) {
12287
- 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: [
12392
+ const heading = (field, title) => /* @__PURE__ */ jsx35("th", { scope: "col", "aria-sort": sortBy === field ? sortDirection === "asc" ? "ascending" : "descending" : "none", children: /* @__PURE__ */ jsxs33("button", { type: "button", onClick: () => onSort(field), children: [
12288
12393
  title,
12289
12394
  sortBy === field ? sortDirection === "asc" ? " \u2191" : " \u2193" : " \u2195"
12290
12395
  ] }) });
12291
- return /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list", children: [
12292
- /* @__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}` }),
12293
- !hideViewSwitch ? /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list-mode", children: [
12294
- /* @__PURE__ */ jsxs32("label", { children: [
12396
+ return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-list", children: [
12397
+ /* @__PURE__ */ jsx35("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}` }),
12398
+ !hideViewSwitch ? /* @__PURE__ */ jsxs33("div", { className: "mbrfa-list-mode", children: [
12399
+ /* @__PURE__ */ jsxs33("label", { children: [
12295
12400
  "Show",
12296
- /* @__PURE__ */ jsxs32("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12297
- /* @__PURE__ */ jsx34("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12298
- /* @__PURE__ */ jsx34("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12401
+ /* @__PURE__ */ jsxs33("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12402
+ /* @__PURE__ */ jsx35("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12403
+ /* @__PURE__ */ jsx35("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12299
12404
  ] })
12300
12405
  ] }),
12301
- /* @__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." })
12406
+ /* @__PURE__ */ jsx35("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." })
12302
12407
  ] }) : null,
12303
- !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: [
12304
- /* @__PURE__ */ jsx34("thead", { children: /* @__PURE__ */ jsxs32("tr", { children: [
12305
- /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12408
+ !records.length ? /* @__PURE__ */ jsx35("p", { children: "No requests match this view." }) : /* @__PURE__ */ jsx35("div", { className: "mbrfa-table-scroll", tabIndex: 0, role: "region", "aria-label": view === "rfas" ? "RFA table" : "Requested treatments table", children: /* @__PURE__ */ jsxs33("table", { className: "mbrfa-table", children: [
12409
+ /* @__PURE__ */ jsx35("thead", { children: /* @__PURE__ */ jsxs33("tr", { children: [
12410
+ /* @__PURE__ */ jsx35("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12306
12411
  heading("employeeName", "Patient"),
12307
12412
  heading("providerName", "Requesting physician"),
12308
- /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12413
+ /* @__PURE__ */ jsx35("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12309
12414
  heading("submittedAt", "Sent"),
12310
- /* @__PURE__ */ jsx34("th", { scope: "col", children: "Decision due" }),
12311
- view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx34("th", { scope: "col", children: "Treatment decision" }),
12415
+ /* @__PURE__ */ jsx35("th", { scope: "col", children: "Decision due" }),
12416
+ view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx35("th", { scope: "col", children: "Treatment decision" }),
12312
12417
  heading("createdAt", "Created")
12313
12418
  ] }) }),
12314
- /* @__PURE__ */ jsx34("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs32("tr", { children: [
12315
- /* @__PURE__ */ jsxs32("td", { children: [
12316
- /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12317
- rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12419
+ /* @__PURE__ */ jsx35("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs33("tr", { children: [
12420
+ /* @__PURE__ */ jsxs33("td", { children: [
12421
+ /* @__PURE__ */ jsx35(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12422
+ rfa.displayReference ? /* @__PURE__ */ jsx35("small", { children: rfa.displayReference }) : null
12318
12423
  ] }),
12319
- /* @__PURE__ */ jsxs32("td", { children: [
12320
- /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12321
- /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12424
+ /* @__PURE__ */ jsxs33("td", { children: [
12425
+ /* @__PURE__ */ jsx35(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12426
+ /* @__PURE__ */ jsx35("small", { children: /* @__PURE__ */ jsxs33(RfaLink, { href: getClaimHref?.(rfa), children: [
12322
12427
  "Claim ",
12323
12428
  rfa.claimNumber || "not recorded"
12324
12429
  ] }) })
12325
12430
  ] }),
12326
- /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12327
- /* @__PURE__ */ jsx34("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12328
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12329
- /* @__PURE__ */ jsx34("td", { children: rfaDecisionDueText(rfa) }),
12330
- /* @__PURE__ */ jsx34("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12331
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12332
- ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs32("tr", { children: [
12333
- /* @__PURE__ */ jsxs32("td", { children: [
12334
- /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12335
- rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12431
+ /* @__PURE__ */ jsx35("td", { children: /* @__PURE__ */ jsx35(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12432
+ /* @__PURE__ */ jsx35("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12433
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.submittedAt) }),
12434
+ /* @__PURE__ */ jsx35("td", { children: rfaDecisionDueText(rfa) }),
12435
+ /* @__PURE__ */ jsx35("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12436
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.createdAt) })
12437
+ ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs33("tr", { children: [
12438
+ /* @__PURE__ */ jsxs33("td", { children: [
12439
+ /* @__PURE__ */ jsx35(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12440
+ rfa.displayReference ? /* @__PURE__ */ jsx35("small", { children: rfa.displayReference }) : null
12336
12441
  ] }),
12337
- /* @__PURE__ */ jsxs32("td", { children: [
12338
- /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12339
- /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12442
+ /* @__PURE__ */ jsxs33("td", { children: [
12443
+ /* @__PURE__ */ jsx35(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12444
+ /* @__PURE__ */ jsx35("small", { children: /* @__PURE__ */ jsxs33(RfaLink, { href: getClaimHref?.(rfa), children: [
12340
12445
  "Claim ",
12341
12446
  rfa.claimNumber || "not recorded"
12342
12447
  ] }) })
12343
12448
  ] }),
12344
- /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12345
- /* @__PURE__ */ jsxs32("td", { children: [
12449
+ /* @__PURE__ */ jsx35("td", { children: /* @__PURE__ */ jsx35(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12450
+ /* @__PURE__ */ jsxs33("td", { children: [
12346
12451
  item.serviceDescription,
12347
- /* @__PURE__ */ jsxs32("small", { children: [
12452
+ /* @__PURE__ */ jsxs33("small", { children: [
12348
12453
  item.procedureCode || "No procedure code",
12349
12454
  " \xB7 ",
12350
12455
  item.diagnosisCode
12351
12456
  ] })
12352
12457
  ] }),
12353
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12354
- /* @__PURE__ */ jsx34("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12355
- /* @__PURE__ */ jsxs32("td", { children: [
12458
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.submittedAt) }),
12459
+ /* @__PURE__ */ jsx35("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12460
+ /* @__PURE__ */ jsxs33("td", { children: [
12356
12461
  item.decisionClosure?.closed ? "Decision no longer required" : label2(item.outcome),
12357
- /* @__PURE__ */ jsx34("small", { children: date6(item.decidedAt) }),
12358
- item.authorizationNumber ? /* @__PURE__ */ jsxs32("small", { children: [
12462
+ /* @__PURE__ */ jsx35("small", { children: date6(item.decidedAt) }),
12463
+ item.authorizationNumber ? /* @__PURE__ */ jsxs33("small", { children: [
12359
12464
  "Authorization ",
12360
12465
  item.authorizationNumber
12361
12466
  ] }) : null
12362
12467
  ] }),
12363
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12468
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.createdAt) })
12364
12469
  ] }, `${rfa.id}:${item.id}`))) })
12365
12470
  ] }) })
12366
12471
  ] });
@@ -12368,58 +12473,58 @@ function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSor
12368
12473
 
12369
12474
  // src/rfa-overview.tsx
12370
12475
  import { RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS4 } from "@mindbill/browser";
12371
- import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12476
+ import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
12372
12477
  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" }];
12373
12478
  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"] }];
12374
12479
  function RfaOverview({ summary, onSelect, combined = false }) {
12375
12480
  const aging = summary.aging;
12376
- 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" });
12377
- if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs33("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12378
- /* @__PURE__ */ jsx35("h3", { children: "Clinical review counts" }),
12379
- /* @__PURE__ */ jsx35("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs33("button", { type: "button", onClick: () => onSelect(status), children: [
12380
- /* @__PURE__ */ jsx35("span", { children: status.replaceAll("_", " ") }),
12381
- /* @__PURE__ */ jsx35("strong", { children: count })
12481
+ const countButton = (count, title, status, bucket) => count ? /* @__PURE__ */ jsx36("button", { type: "button", className: "mbrfa-count", "aria-label": `${title}: ${count} requests`, onClick: () => onSelect(status, bucket), children: count.toLocaleString() }) : /* @__PURE__ */ jsx36("span", { className: "mbrfa-zero", children: "0" });
12482
+ if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs34("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12483
+ /* @__PURE__ */ jsx36("h3", { children: "Clinical review counts" }),
12484
+ /* @__PURE__ */ jsx36("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs34("button", { type: "button", onClick: () => onSelect(status), children: [
12485
+ /* @__PURE__ */ jsx36("span", { children: status.replaceAll("_", " ") }),
12486
+ /* @__PURE__ */ jsx36("strong", { children: count })
12382
12487
  ] }, status)) })
12383
12488
  ] });
12384
- return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview", children: [
12385
- /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview-title", children: [
12386
- /* @__PURE__ */ jsxs33("div", { children: [
12387
- /* @__PURE__ */ jsx35("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12388
- /* @__PURE__ */ jsx35("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12489
+ return /* @__PURE__ */ jsxs34("div", { className: "mbrfa-overview", children: [
12490
+ /* @__PURE__ */ jsxs34("div", { className: "mbrfa-overview-title", children: [
12491
+ /* @__PURE__ */ jsxs34("div", { children: [
12492
+ /* @__PURE__ */ jsx36("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12493
+ /* @__PURE__ */ jsx36("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12389
12494
  ] }),
12390
- /* @__PURE__ */ jsxs33("span", { children: [
12495
+ /* @__PURE__ */ jsxs34("span", { children: [
12391
12496
  summary.total.toLocaleString(),
12392
12497
  " total requests"
12393
12498
  ] })
12394
12499
  ] }),
12395
- groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs33("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12396
- /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12397
- /* @__PURE__ */ jsxs33("h4", { children: [
12398
- /* @__PURE__ */ jsx35("i", { "aria-hidden": "true" }),
12500
+ groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs34("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12501
+ /* @__PURE__ */ jsxs34("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12502
+ /* @__PURE__ */ jsxs34("h4", { children: [
12503
+ /* @__PURE__ */ jsx36("i", { "aria-hidden": "true" }),
12399
12504
  group.title
12400
12505
  ] }),
12401
- buckets.map((bucket) => /* @__PURE__ */ jsx35("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12402
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-total-heading", children: "Total" })
12506
+ buckets.map((bucket) => /* @__PURE__ */ jsx36("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12507
+ /* @__PURE__ */ jsx36("span", { className: "mbrfa-total-heading", children: "Total" })
12403
12508
  ] }),
12404
- group.states.map((status) => /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12405
- /* @__PURE__ */ jsx35("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12406
- buckets.map((bucket) => /* @__PURE__ */ jsxs33("span", { className: "mbrfa-age-cell", children: [
12407
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12408
- 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" })
12509
+ group.states.map((status) => /* @__PURE__ */ jsxs34("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12510
+ /* @__PURE__ */ jsx36("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12511
+ buckets.map((bucket) => /* @__PURE__ */ jsxs34("span", { className: "mbrfa-age-cell", children: [
12512
+ /* @__PURE__ */ jsx36("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12513
+ group.tone === "waiting" && aging ? countButton(aging.byLifecycleStatus[status]?.[bucket.id] ?? 0, `${RFA_LIFECYCLE_LABELS4[status]} \xB7 ${bucket.label} since submission`, status, bucket.id) : /* @__PURE__ */ jsx36("span", { className: "mbrfa-zero", "aria-label": "Not applicable", children: "\u2014" })
12409
12514
  ] }, bucket.id)),
12410
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12515
+ /* @__PURE__ */ jsx36("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12411
12516
  ] }, status))
12412
12517
  ] }, group.title)),
12413
- /* @__PURE__ */ jsxs33("p", { className: "mbrfa-overview-footnote", children: [
12518
+ /* @__PURE__ */ jsxs34("p", { className: "mbrfa-overview-footnote", children: [
12414
12519
  "Aging counts calendar days since submission, separately from the decision deadline. Only requests awaiting a treatment decision are aged.",
12415
12520
  !aging ? " Aging is unavailable from this server." : ""
12416
12521
  ] }),
12417
- /* @__PURE__ */ jsxs33("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12418
- /* @__PURE__ */ jsx35("strong", { children: "All requests" }),
12419
- /* @__PURE__ */ jsxs33("span", { children: [
12522
+ /* @__PURE__ */ jsxs34("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12523
+ /* @__PURE__ */ jsx36("strong", { children: "All requests" }),
12524
+ /* @__PURE__ */ jsxs34("span", { children: [
12420
12525
  summary.total.toLocaleString(),
12421
12526
  " ",
12422
- /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2192" })
12527
+ /* @__PURE__ */ jsx36("span", { "aria-hidden": "true", children: "\u2192" })
12423
12528
  ] })
12424
12529
  ] })
12425
12530
  ] });
@@ -12439,21 +12544,21 @@ var rfaDashboardCss = `
12439
12544
  import { useCallback as useCallback3, useEffect as useEffect24, useState as useState27 } from "react";
12440
12545
 
12441
12546
  // src/rfa-claim-setup.tsx
12442
- import { useEffect as useEffect18, useRef as useRef17, useState as useState21 } from "react";
12443
- import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
12547
+ import { useEffect as useEffect19, useRef as useRef17, useState as useState22 } from "react";
12548
+ import { jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
12444
12549
  function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12445
- const [fields2, setFields] = useState21({ firstName: "", lastName: "", dateOfBirth: "", phone: "", line1: "", line2: "", city: "", state: "CA", postalCode: "", claimNumber: "", employer: "", dateOfInjury: "", injuryState: "CA", description: "" });
12446
- const [search, setSearch] = useState21("");
12447
- const [administrators, setAdministrators] = useState21([]);
12448
- const [administratorId, setAdministratorId] = useState21("");
12449
- const [payerId, setPayerId] = useState21("");
12450
- const [busy, setBusy] = useState21(false);
12451
- const [searching, setSearching] = useState21(false);
12452
- const [error, setError] = useState21("");
12453
- const [searched, setSearched] = useState21(false);
12550
+ const [fields2, setFields] = useState22({ firstName: "", lastName: "", dateOfBirth: "", phone: "", line1: "", line2: "", city: "", state: "CA", postalCode: "", claimNumber: "", employer: "", dateOfInjury: "", injuryState: "CA", description: "" });
12551
+ const [search, setSearch] = useState22("");
12552
+ const [administrators, setAdministrators] = useState22([]);
12553
+ const [administratorId, setAdministratorId] = useState22("");
12554
+ const [payerId, setPayerId] = useState22("");
12555
+ const [busy, setBusy] = useState22(false);
12556
+ const [searching, setSearching] = useState22(false);
12557
+ const [error, setError] = useState22("");
12558
+ const [searched, setSearched] = useState22(false);
12454
12559
  const identities = useRef17(null);
12455
12560
  const attempt = useRef17(null);
12456
- useEffect18(() => {
12561
+ useEffect19(() => {
12457
12562
  let active = true;
12458
12563
  const term = search.trim();
12459
12564
  setAdministrators([]);
@@ -12485,11 +12590,11 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12485
12590
  const administrator = administrators.find((value) => value.id === administratorId);
12486
12591
  const availablePayers = administrator?.payers?.filter((value) => value.active !== false) ?? [];
12487
12592
  const locked = disabled || busy;
12488
- const input = (name, label5, maxLength, required2 = true, type = "text") => /* @__PURE__ */ jsxs34("label", { children: [
12593
+ const input = (name, label5, maxLength, required2 = true, type = "text") => /* @__PURE__ */ jsxs35("label", { children: [
12489
12594
  label5,
12490
- /* @__PURE__ */ jsx36("input", { required: required2, type, maxLength, value: fields2[name], onChange: (event) => setFields((value) => ({ ...value, [name]: event.target.value })) })
12595
+ /* @__PURE__ */ jsx37("input", { required: required2, type, maxLength, value: fields2[name], onChange: (event) => setFields((value) => ({ ...value, [name]: event.target.value })) })
12491
12596
  ] });
12492
- return /* @__PURE__ */ jsx36("form", { onSubmit: async (event) => {
12597
+ return /* @__PURE__ */ jsx37("form", { onSubmit: async (event) => {
12493
12598
  event.preventDefault();
12494
12599
  if (locked || !administrator || !client.provisionClaim || administrator.payerSelectionRequired && !payerId) return;
12495
12600
  setBusy(true);
@@ -12509,10 +12614,10 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12509
12614
  } finally {
12510
12615
  setBusy(false);
12511
12616
  }
12512
- }, children: /* @__PURE__ */ jsxs34("fieldset", { disabled: locked, children: [
12513
- /* @__PURE__ */ jsx36("legend", { children: "New patient and injury" }),
12514
- /* @__PURE__ */ jsx36("p", { children: "Save the patient and injury to use for this authorization request. No bill is required." }),
12515
- /* @__PURE__ */ jsxs34("div", { className: "mbtd-grid", children: [
12617
+ }, children: /* @__PURE__ */ jsxs35("fieldset", { disabled: locked, children: [
12618
+ /* @__PURE__ */ jsx37("legend", { children: "New patient and injury" }),
12619
+ /* @__PURE__ */ jsx37("p", { children: "Save the patient and injury to use for this authorization request. No bill is required." }),
12620
+ /* @__PURE__ */ jsxs35("div", { className: "mbtd-grid", children: [
12516
12621
  input("firstName", "Patient first name", 100),
12517
12622
  input("lastName", "Patient last name", 100),
12518
12623
  input("dateOfBirth", "Date of birth", 10, true, "date"),
@@ -12528,138 +12633,46 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12528
12633
  input("injuryState", "Injury state", 2),
12529
12634
  input("description", "Injury description (optional)", 1e3, false)
12530
12635
  ] }),
12531
- /* @__PURE__ */ jsxs34("label", { children: [
12636
+ /* @__PURE__ */ jsxs35("label", { children: [
12532
12637
  "Search claims administrators",
12533
- /* @__PURE__ */ jsx36("input", { type: "search", maxLength: 200, value: search, onChange: (event) => {
12638
+ /* @__PURE__ */ jsx37("input", { type: "search", maxLength: 200, value: search, onChange: (event) => {
12534
12639
  setSearch(event.target.value);
12535
12640
  setAdministratorId("");
12536
12641
  setPayerId("");
12537
12642
  setError("");
12538
12643
  } })
12539
12644
  ] }),
12540
- searching ? /* @__PURE__ */ jsx36("p", { role: "status", children: "Searching claims administrators\u2026" }) : null,
12541
- /* @__PURE__ */ jsxs34("label", { children: [
12645
+ searching ? /* @__PURE__ */ jsx37("p", { role: "status", children: "Searching claims administrators\u2026" }) : null,
12646
+ /* @__PURE__ */ jsxs35("label", { children: [
12542
12647
  "Claims administrator",
12543
- /* @__PURE__ */ jsxs34("select", { required: true, disabled: searching, value: administratorId, onChange: (event) => {
12648
+ /* @__PURE__ */ jsxs35("select", { required: true, disabled: searching, value: administratorId, onChange: (event) => {
12544
12649
  setAdministratorId(event.target.value);
12545
12650
  setPayerId("");
12546
12651
  }, children: [
12547
- /* @__PURE__ */ jsx36("option", { value: "", children: "Choose a claims administrator" }),
12548
- administrators.map((value) => /* @__PURE__ */ jsx36("option", { value: value.id, children: value.name }, value.id))
12652
+ /* @__PURE__ */ jsx37("option", { value: "", children: "Choose a claims administrator" }),
12653
+ administrators.map((value) => /* @__PURE__ */ jsx37("option", { value: value.id, children: value.name }, value.id))
12549
12654
  ] })
12550
12655
  ] }),
12551
- searched && !administrators.length ? /* @__PURE__ */ jsx36("p", { children: "No administrators match this search. Try another name, or add a custom claims administrator in Settings." }) : null,
12552
- availablePayers.length ? /* @__PURE__ */ jsxs34("label", { children: [
12656
+ searched && !administrators.length ? /* @__PURE__ */ jsx37("p", { children: "No administrators match this search. Try another name, or add a custom claims administrator in Settings." }) : null,
12657
+ availablePayers.length ? /* @__PURE__ */ jsxs35("label", { children: [
12553
12658
  "Payer",
12554
12659
  administrator?.payerSelectionRequired ? "" : " (optional)",
12555
- /* @__PURE__ */ jsxs34("select", { required: administrator?.payerSelectionRequired, value: payerId, onChange: (event) => setPayerId(event.target.value), children: [
12556
- /* @__PURE__ */ jsx36("option", { value: "", children: "Choose a payer" }),
12557
- availablePayers.map((value) => /* @__PURE__ */ jsx36("option", { value: value.id, children: value.label }, value.id))
12660
+ /* @__PURE__ */ jsxs35("select", { required: administrator?.payerSelectionRequired, value: payerId, onChange: (event) => setPayerId(event.target.value), children: [
12661
+ /* @__PURE__ */ jsx37("option", { value: "", children: "Choose a payer" }),
12662
+ availablePayers.map((value) => /* @__PURE__ */ jsx37("option", { value: value.id, children: value.label }, value.id))
12558
12663
  ] })
12559
12664
  ] }) : null,
12560
- administrator?.payerSelectionRequired && !availablePayers.length ? /* @__PURE__ */ jsx36("p", { role: "alert", children: "This administrator needs a payer selection, but no active payers are available. Choose another administrator or contact your administrator." }) : null,
12561
- error ? /* @__PURE__ */ jsx36("p", { role: "alert", children: error }) : null,
12562
- /* @__PURE__ */ jsxs34("div", { className: "mbtd-actions", children: [
12563
- /* @__PURE__ */ jsx36("button", { type: "button", onClick: onCancel, children: "Cancel new patient" }),
12564
- /* @__PURE__ */ jsx36("button", { className: "mbtd-primary", type: "submit", disabled: !administrator || !client.provisionClaim || !!(administrator.payerSelectionRequired && !payerId), children: busy ? "Saving patient and injury\u2026" : "Save patient and injury" })
12665
+ administrator?.payerSelectionRequired && !availablePayers.length ? /* @__PURE__ */ jsx37("p", { role: "alert", children: "This administrator needs a payer selection, but no active payers are available. Choose another administrator or contact your administrator." }) : null,
12666
+ error ? /* @__PURE__ */ jsx37("p", { role: "alert", children: error }) : null,
12667
+ /* @__PURE__ */ jsxs35("div", { className: "mbtd-actions", children: [
12668
+ /* @__PURE__ */ jsx37("button", { type: "button", onClick: onCancel, children: "Cancel new patient" }),
12669
+ /* @__PURE__ */ jsx37("button", { className: "mbtd-primary", type: "submit", disabled: !administrator || !client.provisionClaim || !!(administrator.payerSelectionRequired && !payerId), children: busy ? "Saving patient and injury\u2026" : "Save patient and injury" })
12565
12670
  ] })
12566
12671
  ] }) });
12567
12672
  }
12568
12673
 
12569
12674
  // src/rfa-practice-picker.tsx
12570
12675
  import { useEffect as useEffect20, useRef as useRef18, useState as useState23 } from "react";
12571
-
12572
- // src/rfa-official-fields.tsx
12573
- import { useEffect as useEffect19, useState as useState22 } from "react";
12574
- import { jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
12575
- var formDate = (value) => {
12576
- const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(value ?? "");
12577
- return match ? `${match[2]}/${match[3]}/${match[1]}` : value ?? "";
12578
- };
12579
- function RfaPicker({ label: label5, children }) {
12580
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-picker", children: [
12581
- /* @__PURE__ */ jsx37("span", { children: label5 }),
12582
- children
12583
- ] });
12584
- }
12585
- function RfaSavedField({ label: label5, value, span }) {
12586
- return /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12587
- /* @__PURE__ */ jsx37("span", { children: label5 }),
12588
- /* @__PURE__ */ jsx37("strong", { children: value || "\u2014" })
12589
- ] });
12590
- }
12591
- function RfaEmployeeFields({ name, dateOfInjury, claimNumber, details }) {
12592
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
12593
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 6, label: "Name (Last, First, Middle)", value: details?.formName || name }),
12594
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Date of Injury (MM/DD/YYYY)", value: formDate(dateOfInjury) }),
12595
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Date of Birth (MM/DD/YYYY)", value: formDate(details?.dateOfBirth) }),
12596
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Claim Number", value: claimNumber }),
12597
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Employer", value: details?.employer })
12598
- ] });
12599
- }
12600
- function formatRfaPhone(value) {
12601
- const raw = value ?? "";
12602
- if (/[^\d\s().+-]/.test(raw)) return raw;
12603
- let digits = raw.replace(/\D/g, "");
12604
- if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1);
12605
- if (digits.length > 10) return raw;
12606
- if (digits.length < 4) return digits;
12607
- return digits.length < 7 ? `(${digits.slice(0, 3)}) ${digits.slice(3)}` : `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
12608
- }
12609
- var contactRows = [
12610
- ["address", "Address", 500, 3],
12611
- ["city", "City", 100, 2],
12612
- ["state", "State", 2, 1],
12613
- ["zip", "Zip Code", 20, 2],
12614
- ["phone", "Phone", 30, 2],
12615
- ["fax", "Fax Number", 30, 2]
12616
- ];
12617
- function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, faxHint, editable = true }) {
12618
- const dial = (key2) => key2 === "phone" || key2 === "fax";
12619
- const hint = (key2) => key2 === "fax" && faxHint && !value?.fax?.trim() ? /* @__PURE__ */ jsx37("small", { className: "mbrfa-field-hint", children: faxHint }) : null;
12620
- const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12621
- label5,
12622
- /* @__PURE__ */ jsx37("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: dial(key2) ? formatRfaPhone(event.target.value) : event.target.value }) }),
12623
- hint(key2)
12624
- ] }, key2) : /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12625
- /* @__PURE__ */ jsx37("span", { children: label5 }),
12626
- /* @__PURE__ */ jsx37("strong", { children: (dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2])?.trim() || "\u2014" }),
12627
- hint(key2)
12628
- ] }, key2);
12629
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
12630
- before,
12631
- field("name", nameLabel, 200, 3),
12632
- field("contactName", "Contact Name", 200, 3),
12633
- contactRows.map(([key2, label5, max, span]) => field(key2, label5, max, span)),
12634
- beforeEmail,
12635
- field("email", "E-mail Address", 254, 6)
12636
- ] });
12637
- }
12638
- function RfaManualToggle({ manual, onChange, disabled }) {
12639
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-section-actions", children: [
12640
- /* @__PURE__ */ jsx37("button", { type: "button", className: manual ? "mbtd-primary" : void 0, disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Save" : "Edit manually" }),
12641
- manual ? /* @__PURE__ */ jsx37("span", { children: "Applies to this request only. The saved record is not changed." }) : null
12642
- ] });
12643
- }
12644
- function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12645
- const [details, setDetails] = useState22();
12646
- useEffect19(() => {
12647
- let active = true;
12648
- setDetails(void 0);
12649
- if (!enabled || !claimId) return;
12650
- void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
12651
- if (!active) return;
12652
- const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
12653
- 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 } } : {} });
12654
- }).catch(() => void 0);
12655
- return () => {
12656
- active = false;
12657
- };
12658
- }, [client, claimId, renderingProviderId, enabled]);
12659
- return details;
12660
- }
12661
-
12662
- // src/rfa-practice-picker.tsx
12663
12676
  import { Fragment as Fragment21, jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
12664
12677
  function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref, onEditPractice, onEditLocation, onChosen }) {
12665
12678
  const practices = profile?.billingProviders ?? [];
@@ -12769,11 +12782,17 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12769
12782
  setQuery("");
12770
12783
  }, error }) }) }) : null,
12771
12784
  /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s4", children: [
12772
- "Diagnosis (Required)",
12785
+ /* @__PURE__ */ jsxs37("span", { children: [
12786
+ "Diagnosis",
12787
+ /* @__PURE__ */ jsx39(RfaRequired, {})
12788
+ ] }),
12773
12789
  /* @__PURE__ */ jsx39("input", { required: true, maxLength: 1e3, value: description ?? "", onChange: (event) => onChange({ diagnosisCode: code, diagnosisDescription: event.target.value }) })
12774
12790
  ] }),
12775
12791
  /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s2", children: [
12776
- "ICD-Code (Required)",
12792
+ /* @__PURE__ */ jsxs37("span", { children: [
12793
+ "ICD-Code",
12794
+ /* @__PURE__ */ jsx39(RfaRequired, {})
12795
+ ] }),
12777
12796
  /* @__PURE__ */ jsx39("input", { required: true, maxLength: 16, value: code, onChange: (event) => onChange({ diagnosisCode: event.target.value, diagnosisDescription: description ?? "" }) })
12778
12797
  ] })
12779
12798
  ] });
@@ -12864,7 +12883,9 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12864
12883
  };
12865
12884
  }, [query, claimNumber, searchClaimsAdministrators]);
12866
12885
  if (officialForm) {
12867
- const shown = value ?? { ...directory?.name ? { name: directory.name } : {}, ...directory?.mailingAddresses?.[0]?.address ? { address: directory.mailingAddresses[0].address } : {}, ...directory?.telephoneNumbers?.[0] ? { phone: directory.telephoneNumbers[0] } : {} };
12886
+ const mailing = directory?.mailingAddresses?.[0]?.address?.trim(), parts = mailing ? /^(.+?),\s*([^,]+),\s*([A-Za-z]{2})\.?\s+(\d{5}(?:-\d{4})?)$/.exec(mailing) : null;
12887
+ const named = (text3) => text3 && /[a-z]/i.test(text3) ? text3 : void 0;
12888
+ const shown = value ?? { ...directory?.name ? { name: directory.name } : {}, ...parts ? { address: parts[1], city: parts[2], state: parts[3].toUpperCase(), zip: parts[4] } : mailing ? { address: mailing } : {}, ...directory?.telephoneNumbers?.[0] ? { phone: directory.telephoneNumbers[0] } : {} };
12868
12889
  return /* @__PURE__ */ jsxs38("fieldset", { children: [
12869
12890
  /* @__PURE__ */ jsx40("legend", { children: "Claims Administrator Information" }),
12870
12891
  /* @__PURE__ */ jsxs38("div", { className: "mbrfa-pickers", "data-columns": "2", children: [
@@ -12872,12 +12893,14 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12872
12893
  const option = options.find((item) => item.id === id);
12873
12894
  if (option) choose(option);
12874
12895
  } }) }) : null,
12875
- /* @__PURE__ */ jsx40(RfaPicker, { label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact", children: /* @__PURE__ */ jsx40(RfaAuthorizationDestination, { compact: true, onManualEntry: () => setManual(true), contextKey: `${contextKey}:${administratorId ?? ""}`, directory, loading, error, disabled, onChange: (destination) => {
12896
+ /* @__PURE__ */ jsx40(RfaPicker, { label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact", children: /* @__PURE__ */ jsx40(RfaAuthorizationDestination, { compact: true, autoSelectSingle: !value, onManualEntry: () => setManual(true), contextKey: `${contextKey}:${administratorId ?? ""}`, directory, loading, error, disabled, onChange: (destination) => {
12876
12897
  if (!destination) return;
12877
12898
  const kept = { ...shown };
12878
12899
  delete kept.fax;
12879
12900
  delete kept.email;
12880
- onChange(administratorId, { ...kept, name: directory?.name ?? shown.name ?? "", contactName: destination.recipientName ?? destination.label, ...destination.phone ? { phone: destination.phone } : {}, ...destination.method === "fax" ? { fax: destination.destination } : { email: destination.destination } });
12901
+ delete kept.contactName;
12902
+ const contactName = named(destination.recipientName) ?? named(destination.label);
12903
+ onChange(administratorId, { ...kept, name: directory?.name ?? shown.name ?? "", ...contactName ? { contactName } : {}, ...destination.phone ? { phone: destination.phone } : {}, ...destination.method === "fax" ? { fax: destination.destination } : { email: destination.destination } });
12881
12904
  } }) })
12882
12905
  ] }),
12883
12906
  /* @__PURE__ */ jsx40("fieldset", { className: "mbrfa-plain", disabled, children: /* @__PURE__ */ jsx40(RfaOfficialContactFields, { editable: manual, nameLabel: "Company Name", value: shown, onChange: (contact) => onChange(administratorId, contact) }) }),
@@ -13091,7 +13114,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13091
13114
  event.preventDefault();
13092
13115
  if (locked) return;
13093
13116
  const next = normalizeRfaDraft(draft2);
13094
- 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));
13117
+ void action.save(next, validateRfaDraft(next) ?? (officialForm && intentRef.current === "review" && !next.requestingPractice?.fax?.trim() ? "Requesting Physician fax number is required." : null));
13095
13118
  };
13096
13119
  const saveError = action.error ? /* @__PURE__ */ jsxs39("p", { role: "alert", children: [
13097
13120
  action.error,
@@ -13135,7 +13158,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13135
13158
  /* @__PURE__ */ jsxs39("fieldset", { children: [
13136
13159
  /* @__PURE__ */ jsx41("legend", { children: "Requesting Physician Information" }),
13137
13160
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-pickers", "data-columns": selectors?.physician ? 3 : 2, children: [
13138
- selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { label: "Requesting physician", children: selectors.physician }) : null,
13161
+ selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { required: true, label: "Requesting physician", children: selectors.physician }) : null,
13139
13162
  /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onEditPractice, onEditLocation, onChosen: () => setPracticeManual(false) })
13140
13163
  ] }),
13141
13164
  /* @__PURE__ */ jsx41("fieldset", { className: "mbrfa-plain", disabled: locked, children: /* @__PURE__ */ jsx41(
@@ -13145,7 +13168,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13145
13168
  nameLabel: "Practice Name",
13146
13169
  value: draft2.requestingPractice,
13147
13170
  onChange: (requestingPractice) => update({ requestingPractice }),
13148
- faxHint: "Required to send. The decision is faxed back here. Save it on the practice location to fill it automatically.",
13171
+ required: ["fax"],
13149
13172
  before: /* @__PURE__ */ jsx41(RfaSavedField, { span: 6, label: "Physician Name", value: draft2.providerName }),
13150
13173
  beforeEmail: /* @__PURE__ */ jsxs39(Fragment23, { children: [
13151
13174
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "Specialty", value: formDetails?.physician?.specialty ?? savedPhysician?.specialty }),
@@ -13166,7 +13189,10 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13166
13189
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-form-grid", children: [
13167
13190
  /* @__PURE__ */ jsx41(RfaDiagnosisFields, { officialForm: true, code: item.diagnosisCode, ...item.diagnosisDescription !== void 0 ? { description: item.diagnosisDescription } : {}, ...searchDiagnosisCodes ? { search: searchDiagnosisCodes } : {}, onChange: (value) => updateItem(index, value) }),
13168
13191
  /* @__PURE__ */ jsxs39("label", { className: "mbrfa-s4", children: [
13169
- "Service/Good Requested (Required)",
13192
+ /* @__PURE__ */ jsxs39("span", { children: [
13193
+ "Service/Good Requested",
13194
+ /* @__PURE__ */ jsx41(RfaRequired, {})
13195
+ ] }),
13170
13196
  /* @__PURE__ */ jsx41("textarea", { required: true, maxLength: 1e3, value: item.serviceDescription, onChange: (event) => updateItem(index, { serviceDescription: event.target.value }) })
13171
13197
  ] }),
13172
13198
  /* @__PURE__ */ jsxs39("label", { className: "mbrfa-s2", children: [