@mindbill/react 0.32.0 → 0.34.0

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.tsx
4
4
  import "@mindbill/embed";
5
- import { createElement, useEffect as useEffect7, useRef as useRef6 } from "react";
5
+ import { createElement, useEffect as useEffect8, useRef as useRef6 } from "react";
6
6
 
7
7
  // src/appearance.ts
8
8
  var mindBillThemePresets = {
@@ -1293,12 +1293,401 @@ var READ_ONLY_STYLES = `
1293
1293
  `;
1294
1294
 
1295
1295
  // src/bill-submission-form.tsx
1296
- import { createContext, useCallback, useContext, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
1296
+ import { createContext, useCallback, useContext, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2, useState as useState4 } from "react";
1297
1297
  import {
1298
1298
  createBillReferenceClient,
1299
1299
  createBillSubmissionClient
1300
1300
  } from "@mindbill/browser";
1301
1301
 
1302
+ // src/send-route-dialog.tsx
1303
+ import { useEffect as useEffect3, useMemo as useMemo2, useState as useState3 } from "react";
1304
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1305
+ var EMAIL_RE = /[A-Za-z0-9._%+'-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/;
1306
+ function extractSendRouteEmail(raw) {
1307
+ if (!raw) return null;
1308
+ const match = raw.match(EMAIL_RE);
1309
+ return match ? match[0] : null;
1310
+ }
1311
+ function formatSendRouteFax(raw) {
1312
+ if (!raw) return "";
1313
+ const digits = raw.replace(/\D/g, "");
1314
+ const ten = digits.length === 11 && digits.startsWith("1") ? digits.slice(1) : digits;
1315
+ if (ten.length === 10) return `(${ten.slice(0, 3)}) ${ten.slice(3, 6)}-${ten.slice(6)}`;
1316
+ return raw.trim();
1317
+ }
1318
+ function formatSendRouteFaxInput(raw) {
1319
+ const trimmed = raw.trimStart();
1320
+ if (trimmed.startsWith("+")) return raw;
1321
+ const all = trimmed.replace(/\D/g, "");
1322
+ const digits = all.length === 11 && all.startsWith("1") ? all.slice(1) : all;
1323
+ if (digits.length > 10 || all.length === 11 && !all.startsWith("1") || all.length > 11) return raw;
1324
+ if (digits.length === 0) return "";
1325
+ if (digits.length <= 3) return `(${digits}`;
1326
+ if (digits.length <= 6) return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
1327
+ return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
1328
+ }
1329
+ var css = `
1330
+ .mbrd-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(15,30,40,.45)}
1331
+ .mbrd{display:grid;gap:16px;width:min(560px,100%);max-height:min(86vh,860px);overflow:auto;overscroll-behavior:contain;padding:24px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);color:var(--mb-text);font-family:var(--mb-font);font-size:15px;box-shadow:0 24px 60px rgba(17,38,49,.28)}
1332
+ .mbrd *{box-sizing:border-box}
1333
+ .mbrd-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
1334
+ .mbrd-title{margin:0;font-size:20px;font-weight:760}
1335
+ .mbrd-copy{margin:4px 0 0;color:var(--mb-muted);font-size:14px}
1336
+ .mbrd-close{border:0;background:transparent;color:var(--mb-muted);font-size:22px;line-height:1;cursor:pointer}
1337
+ .mbrd-cards{display:grid;gap:10px}
1338
+ .mbrd-card{border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);transition:border-color .12s ease,background .12s ease}
1339
+ .mbrd-card[data-selected=true]{border-color:var(--mb-accent);background:color-mix(in srgb,var(--mb-accent) 5%,var(--mb-surface))}
1340
+ .mbrd-card[data-disabled=true]{opacity:.55}
1341
+ .mbrd-card-main{display:flex;align-items:center;gap:12px;width:100%;padding:13px 14px;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
1342
+ .mbrd-card[data-disabled=true] .mbrd-card-main{cursor:not-allowed}
1343
+ .mbrd-radio{flex:0 0 auto;width:18px;height:18px;border:2px solid var(--mb-border);border-radius:50%;display:grid;place-items:center}
1344
+ .mbrd-card[data-selected=true] .mbrd-radio{border-color:var(--mb-accent)}
1345
+ .mbrd-card[data-selected=true] .mbrd-radio:after{content:"";width:9px;height:9px;border-radius:50%;background:var(--mb-accent)}
1346
+ .mbrd-card-text{min-width:0;flex:1}
1347
+ .mbrd-card-title{font-weight:700;line-height:1.3;overflow-wrap:anywhere}
1348
+ .mbrd-card-detail{margin-top:2px;color:var(--mb-muted);font-size:13px;line-height:1.35;overflow-wrap:anywhere}
1349
+ .mbrd-badges{display:flex;flex:0 0 auto;gap:6px}
1350
+ .mbrd-badge{padding:2px 8px;border:1px solid var(--mb-border);border-radius:999px;font-size:11px;font-weight:700;white-space:nowrap}
1351
+ .mbrd-badge[data-tone=verified]{border-color:color-mix(in srgb,#159447 45%,var(--mb-border));background:color-mix(in srgb,#159447 8%,var(--mb-surface));color:#0c7a48}
1352
+ .mbrd-badge[data-tone=auto]{border-color:color-mix(in srgb,var(--mb-accent) 45%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 10%,var(--mb-surface));color:var(--mb-accent)}
1353
+ .mbrd-sub{display:grid;gap:12px;padding:12px 14px;border-top:1px solid var(--mb-border);background:color-mix(in srgb,var(--mb-accent) 2%,var(--mb-surface));border-radius:0 0 var(--mb-control-radius) var(--mb-control-radius)}
1354
+ .mbrd-choice{border:1px solid var(--mb-border);border-radius:calc(var(--mb-control-radius) - 2px);background:var(--mb-surface)}
1355
+ .mbrd-choice[data-selected=true]{border-color:var(--mb-accent)}
1356
+ .mbrd-choice[data-disabled=true]{opacity:.55}
1357
+ .mbrd-choice-main{display:flex;align-items:center;gap:10px;width:100%;padding:9px 11px;border:0;background:transparent;color:inherit;font:inherit;font-size:13px;text-align:left;cursor:pointer}
1358
+ .mbrd-choice[data-disabled=true] .mbrd-choice-main{cursor:not-allowed}
1359
+ .mbrd-choice-title{font-weight:650;overflow-wrap:anywhere}
1360
+ .mbrd-choice-detail{margin-top:1px;color:var(--mb-muted);font-size:12px}
1361
+ .mbrd-choice-body{display:grid;gap:8px;padding:10px 11px;border-top:1px solid var(--mb-border)}
1362
+ .mbrd-field{display:grid;gap:5px;font-size:13px}
1363
+ .mbrd-label{font-weight:650}
1364
+ .mbrd-star{color:var(--mb-danger)}
1365
+ .mbrd-input,.mbrd-textarea{width:100%;padding:9px 11px;border:1px solid var(--mb-border);border-radius:calc(var(--mb-control-radius) - 2px);background:var(--mb-input);color:var(--mb-text);font:inherit;font-size:14px}
1366
+ .mbrd-textarea{resize:vertical;min-height:74px}
1367
+ .mbrd-input:focus,.mbrd-textarea:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
1368
+ .mbrd-error{color:var(--mb-danger);font-size:12px}
1369
+ .mbrd-help{color:var(--mb-muted);font-size:12px}
1370
+ .mbrd-alert{padding:10px 12px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 10%,transparent);color:var(--mb-danger);font-size:13px}
1371
+ .mbrd-actions{display:flex;justify-content:flex-end;gap:10px}
1372
+ .mbrd-cancel{min-height:42px;padding:9px 16px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:var(--mb-text);font:inherit;font-weight:680;cursor:pointer}
1373
+ .mbrd-confirm{min-height:42px;min-width:130px;padding:9px 18px;border:0;border-radius:var(--mb-control-radius);background:var(--mb-accent);color:var(--mb-accent-contrast);font:inherit;font-weight:760;cursor:pointer}
1374
+ .mbrd-confirm:disabled,.mbrd-cancel:disabled{opacity:.6;cursor:not-allowed}
1375
+ `;
1376
+ var CONFIRM_LABELS = {
1377
+ ebill: "Send Bill",
1378
+ email: "Email Bill",
1379
+ fax: "Fax Bill",
1380
+ mail: "Mail Bill"
1381
+ };
1382
+ function RouteCard({
1383
+ selected,
1384
+ disabled,
1385
+ title,
1386
+ detail,
1387
+ badges,
1388
+ onSelect,
1389
+ children
1390
+ }) {
1391
+ return /* @__PURE__ */ jsxs3("div", { className: "mbrd-card", "data-selected": selected, "data-disabled": Boolean(disabled), children: [
1392
+ /* @__PURE__ */ jsxs3(
1393
+ "button",
1394
+ {
1395
+ className: "mbrd-card-main",
1396
+ type: "button",
1397
+ role: "radio",
1398
+ "aria-checked": selected,
1399
+ disabled,
1400
+ onClick: onSelect,
1401
+ children: [
1402
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-radio", "aria-hidden": true }),
1403
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-card-text", children: [
1404
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-card-title", children: title }),
1405
+ detail ? /* @__PURE__ */ jsx3("span", { className: "mbrd-card-detail", style: { display: "block" }, children: detail }) : null
1406
+ ] }),
1407
+ badges ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badges", children: badges }) : null
1408
+ ]
1409
+ }
1410
+ ),
1411
+ selected && children ? /* @__PURE__ */ jsx3("div", { className: "mbrd-sub", children }) : null
1412
+ ] });
1413
+ }
1414
+ function RecipientChoice({
1415
+ selected,
1416
+ disabled,
1417
+ title,
1418
+ detail,
1419
+ onSelect,
1420
+ children
1421
+ }) {
1422
+ return /* @__PURE__ */ jsxs3("div", { className: "mbrd-choice", "data-selected": selected, "data-disabled": Boolean(disabled), children: [
1423
+ /* @__PURE__ */ jsxs3(
1424
+ "button",
1425
+ {
1426
+ className: "mbrd-choice-main",
1427
+ type: "button",
1428
+ role: "radio",
1429
+ "aria-checked": selected,
1430
+ disabled,
1431
+ onClick: onSelect,
1432
+ children: [
1433
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-radio", "aria-hidden": true, style: { width: 15, height: 15 } }),
1434
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-card-text", children: [
1435
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-choice-title", children: title }),
1436
+ detail ? /* @__PURE__ */ jsx3("span", { className: "mbrd-choice-detail", style: { display: "block" }, children: detail }) : null
1437
+ ] })
1438
+ ]
1439
+ }
1440
+ ),
1441
+ selected && children ? /* @__PURE__ */ jsx3("div", { className: "mbrd-choice-body", children }) : null
1442
+ ] });
1443
+ }
1444
+ function SendRouteDialog({
1445
+ title = "Send bill",
1446
+ delivery,
1447
+ submitting = false,
1448
+ disabled = false,
1449
+ error = null,
1450
+ onCancel,
1451
+ onConfirm
1452
+ }) {
1453
+ const ebillOption = delivery.options.find((option) => option.route === "ebill");
1454
+ const mailOption = delivery.options.find((option) => option.route === "mail");
1455
+ const recommendedRoute = delivery.recommended.route;
1456
+ const onFileEmail = extractSendRouteEmail(delivery.contacts.claimsEmail);
1457
+ const onFileFax = delivery.contacts.faxNumber?.trim() || null;
1458
+ const onFileFaxDisplay = formatSendRouteFax(onFileFax);
1459
+ const onFileMail = delivery.contacts.mailingAddress?.trim() || "";
1460
+ const [route, setRoute] = useState3(recommendedRoute);
1461
+ const [emailMode, setEmailMode] = useState3(onFileEmail ? "onfile" : "alt");
1462
+ const [faxMode, setFaxMode] = useState3(onFileFax ? "onfile" : "alt");
1463
+ const [emailTo, setEmailTo] = useState3("");
1464
+ const [subject, setSubject] = useState3("");
1465
+ const [message, setMessage] = useState3("");
1466
+ const [ccInput, setCcInput] = useState3("");
1467
+ const [faxTo, setFaxTo] = useState3("");
1468
+ const [attention, setAttention] = useState3("");
1469
+ const [mailTo, setMailTo] = useState3(onFileMail);
1470
+ useEffect3(() => {
1471
+ setRoute(recommendedRoute);
1472
+ setEmailMode(onFileEmail ? "onfile" : "alt");
1473
+ setFaxMode(onFileFax ? "onfile" : "alt");
1474
+ setMailTo(onFileMail);
1475
+ }, [recommendedRoute, onFileEmail, onFileFax, onFileMail]);
1476
+ useEffect3(() => {
1477
+ const onKey = (event) => {
1478
+ if (event.key === "Escape" && !submitting) onCancel();
1479
+ };
1480
+ window.addEventListener("keydown", onKey);
1481
+ return () => window.removeEventListener("keydown", onKey);
1482
+ }, [onCancel, submitting]);
1483
+ const effectiveEmail = emailMode === "onfile" && onFileEmail ? onFileEmail : emailTo.trim();
1484
+ const effectiveFax = faxMode === "onfile" && onFileFax ? onFileFax : faxTo;
1485
+ const faxDigits = effectiveFax.replace(/\D/g, "");
1486
+ const emailValid = EMAIL_RE.test(effectiveEmail);
1487
+ const ccList = ccInput.split(/[,;]/).map((entry) => entry.trim()).filter(Boolean);
1488
+ const ccValid = ccList.every((entry) => EMAIL_RE.test(entry));
1489
+ const faxValid = faxDigits.length >= 10;
1490
+ const mailValid = mailTo.trim().length > 2;
1491
+ const confirmDisabled = submitting || disabled || route === "email" && (!emailValid || !ccValid) || route === "fax" && !faxValid || route === "mail" && !mailValid;
1492
+ const submission = useMemo2(() => {
1493
+ if (route === "email") {
1494
+ return {
1495
+ route,
1496
+ destination: { email: effectiveEmail },
1497
+ ...subject.trim() ? { subject: subject.trim() } : {},
1498
+ ...message.trim() ? { note: message.trim() } : {},
1499
+ ...ccList.length ? { cc: ccList } : {}
1500
+ };
1501
+ }
1502
+ if (route === "fax") {
1503
+ return {
1504
+ route,
1505
+ destination: { faxNumber: effectiveFax.trim() },
1506
+ ...attention.trim() ? { attention: attention.trim() } : {}
1507
+ };
1508
+ }
1509
+ if (route === "mail") {
1510
+ return { route, destination: { mailingAddress: mailTo.trim() } };
1511
+ }
1512
+ return { route };
1513
+ }, [route, effectiveEmail, subject, message, ccInput, effectiveFax, attention, mailTo]);
1514
+ return /* @__PURE__ */ jsxs3("div", { className: "mbrd-overlay", role: "presentation", onMouseDown: (event) => {
1515
+ if (event.target === event.currentTarget && !submitting) onCancel();
1516
+ }, children: [
1517
+ /* @__PURE__ */ jsx3("style", { children: css }),
1518
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd", role: "dialog", "aria-modal": "true", "aria-label": typeof title === "string" ? title : "Send bill", children: [
1519
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd-head", children: [
1520
+ /* @__PURE__ */ jsxs3("div", { children: [
1521
+ /* @__PURE__ */ jsx3("h3", { className: "mbrd-title", children: title }),
1522
+ /* @__PURE__ */ jsx3("p", { className: "mbrd-copy", children: "Select the delivery method." })
1523
+ ] }),
1524
+ /* @__PURE__ */ jsx3("button", { className: "mbrd-close", type: "button", "aria-label": "Close", disabled: submitting, onClick: onCancel, children: "\xD7" })
1525
+ ] }),
1526
+ /* @__PURE__ */ jsx3("div", { className: "mbrd-cards", role: "radiogroup", "aria-label": "Delivery method", children: (() => {
1527
+ const ebillCard = ebillOption ? /* @__PURE__ */ jsx3(
1528
+ RouteCard,
1529
+ {
1530
+ selected: route === "ebill",
1531
+ title: ebillOption.printAndMail ? ebillOption.label : `e-Bill to ${ebillOption.payerName || delivery.payerName}`,
1532
+ detail: [
1533
+ ebillOption.detail || null,
1534
+ !ebillOption.printAndMail && ebillOption.label.startsWith("e-bill ") ? ebillOption.label.slice("e-bill ".length) : null
1535
+ ].filter(Boolean).join(" \xB7 "),
1536
+ badges: /* @__PURE__ */ jsxs3(Fragment2, { children: [
1537
+ !ebillOption.fallback ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "verified", children: "Verified Route" }) : null,
1538
+ recommendedRoute === "ebill" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null
1539
+ ] }),
1540
+ onSelect: () => setRoute("ebill")
1541
+ },
1542
+ "ebill"
1543
+ ) : null;
1544
+ const emailCard = /* @__PURE__ */ jsxs3(
1545
+ RouteCard,
1546
+ {
1547
+ selected: route === "email",
1548
+ title: "Email Bill",
1549
+ detail: onFileEmail ?? "No claims email on file \u2014 enter a recipient.",
1550
+ badges: recommendedRoute === "email" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null,
1551
+ onSelect: () => setRoute("email"),
1552
+ children: [
1553
+ /* @__PURE__ */ jsxs3("div", { role: "radiogroup", "aria-label": "Email recipient", style: { display: "grid", gap: 8 }, children: [
1554
+ /* @__PURE__ */ jsx3(
1555
+ RecipientChoice,
1556
+ {
1557
+ selected: emailMode === "onfile",
1558
+ disabled: !onFileEmail,
1559
+ title: onFileEmail ?? "Claims email on file",
1560
+ detail: onFileEmail ? "Claims contact on file" : "No claims email exists on file for this payer.",
1561
+ onSelect: () => setEmailMode("onfile")
1562
+ }
1563
+ ),
1564
+ /* @__PURE__ */ jsx3(
1565
+ RecipientChoice,
1566
+ {
1567
+ selected: emailMode === "alt",
1568
+ title: "Alternative email recipient",
1569
+ onSelect: () => setEmailMode("alt"),
1570
+ children: /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1571
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-label", children: [
1572
+ "Alternative email address ",
1573
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-star", children: "*" })
1574
+ ] }),
1575
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", type: "email", value: emailTo, placeholder: "user@mail.com", onChange: (event) => setEmailTo(event.target.value) }),
1576
+ emailTo.trim() && !EMAIL_RE.test(emailTo.trim()) ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Enter a valid email address." }) : null
1577
+ ] })
1578
+ }
1579
+ )
1580
+ ] }),
1581
+ /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1582
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-label", children: "Cc \u2014 optional" }),
1583
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", value: ccInput, placeholder: "adjuster@payer.com, supervisor@payer.com", onChange: (event) => setCcInput(event.target.value) }),
1584
+ !ccValid ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Each Cc entry must be a valid email address (separate with commas)." }) : null
1585
+ ] }),
1586
+ /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1587
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-label", children: "Email subject \u2014 optional" }),
1588
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", value: subject, maxLength: 255, onChange: (event) => setSubject(event.target.value) })
1589
+ ] }),
1590
+ /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1591
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-label", children: "Message \u2014 optional" }),
1592
+ /* @__PURE__ */ jsx3("textarea", { className: "mbrd-textarea", value: message, maxLength: 5e3, placeholder: "Added at the top of the email body, above the bill summary.", onChange: (event) => setMessage(event.target.value) })
1593
+ ] })
1594
+ ]
1595
+ },
1596
+ "email"
1597
+ );
1598
+ const faxCard = /* @__PURE__ */ jsxs3(
1599
+ RouteCard,
1600
+ {
1601
+ selected: route === "fax",
1602
+ title: "Fax Bill",
1603
+ detail: onFileFax ? `${onFileFaxDisplay} \u2014 payer fax on file` : "No fax on file \u2014 enter a number.",
1604
+ badges: recommendedRoute === "fax" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null,
1605
+ onSelect: () => setRoute("fax"),
1606
+ children: [
1607
+ /* @__PURE__ */ jsxs3("div", { role: "radiogroup", "aria-label": "Fax recipient", style: { display: "grid", gap: 8 }, children: [
1608
+ /* @__PURE__ */ jsx3(
1609
+ RecipientChoice,
1610
+ {
1611
+ selected: faxMode === "onfile",
1612
+ disabled: !onFileFax,
1613
+ title: onFileFax ? onFileFaxDisplay : "Payer fax on file",
1614
+ detail: onFileFax ? "Payer fax on file" : "No fax number exists on file for this payer.",
1615
+ onSelect: () => setFaxMode("onfile")
1616
+ }
1617
+ ),
1618
+ /* @__PURE__ */ jsx3(
1619
+ RecipientChoice,
1620
+ {
1621
+ selected: faxMode === "alt",
1622
+ title: "Alternative fax recipient",
1623
+ onSelect: () => setFaxMode("alt"),
1624
+ children: /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1625
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-label", children: [
1626
+ "Alternative fax number ",
1627
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-star", children: "*" })
1628
+ ] }),
1629
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", inputMode: "tel", value: faxTo, placeholder: "(000) 000-0000", onChange: (event) => setFaxTo(formatSendRouteFaxInput(event.target.value)) }),
1630
+ faxTo.trim() && faxTo.replace(/\D/g, "").length < 10 ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Enter a valid fax number (10 digits)." }) : null
1631
+ ] })
1632
+ }
1633
+ )
1634
+ ] }),
1635
+ /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1636
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-label", children: "Attention \u2014 optional" }),
1637
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", value: attention, maxLength: 120, placeholder: "Recipient name", onChange: (event) => setAttention(event.target.value) }),
1638
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-help", children: "Printed as ATTENTION on the fax cover sheet." })
1639
+ ] })
1640
+ ]
1641
+ },
1642
+ "fax"
1643
+ );
1644
+ const mailCard = /* @__PURE__ */ jsx3(
1645
+ RouteCard,
1646
+ {
1647
+ selected: route === "mail",
1648
+ title: "Mail Bill",
1649
+ detail: onFileMail ? onFileMail.replace(/\n/g, ", ") : "Physical mail \u2014 enter the payer's mailing address.",
1650
+ badges: recommendedRoute === "mail" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null,
1651
+ onSelect: () => setRoute("mail"),
1652
+ children: /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1653
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-label", children: [
1654
+ "Mailing address ",
1655
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-star", children: "*" })
1656
+ ] }),
1657
+ /* @__PURE__ */ jsx3("textarea", { className: "mbrd-textarea", value: mailTo, placeholder: "Payer Claims Dept\nPO Box 1234\nCity, ST 00000", onChange: (event) => setMailTo(event.target.value) }),
1658
+ !mailValid ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Enter a mailing address." }) : null,
1659
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-help", children: mailOption?.printAndMail ? mailOption.detail : "Sent as physical mail \u2014 printed and mailed to this address." })
1660
+ ] })
1661
+ },
1662
+ "mail"
1663
+ );
1664
+ const cards = [];
1665
+ if (ebillCard) cards.push(ebillCard);
1666
+ if (onFileFax) cards.push(faxCard);
1667
+ if (onFileEmail) cards.push(emailCard);
1668
+ cards.push(mailCard);
1669
+ if (!onFileFax) cards.push(faxCard);
1670
+ if (!onFileEmail) cards.push(emailCard);
1671
+ return cards;
1672
+ })() }),
1673
+ error ? /* @__PURE__ */ jsx3("div", { className: "mbrd-alert", role: "alert", children: error }) : null,
1674
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd-actions", children: [
1675
+ /* @__PURE__ */ jsx3("button", { className: "mbrd-cancel", type: "button", disabled: submitting, onClick: onCancel, children: "Cancel" }),
1676
+ /* @__PURE__ */ jsx3(
1677
+ "button",
1678
+ {
1679
+ className: "mbrd-confirm",
1680
+ type: "button",
1681
+ disabled: confirmDisabled,
1682
+ onClick: () => onConfirm(submission),
1683
+ children: submitting ? "Submitting\u2026" : CONFIRM_LABELS[route]
1684
+ }
1685
+ )
1686
+ ] })
1687
+ ] })
1688
+ ] });
1689
+ }
1690
+
1302
1691
  // src/billing-catalog.ts
1303
1692
  var DEFAULT_BILL_SUBMISSION_PROCEDURES = [
1304
1693
  { code: "ML200", description: "Missed appointment for a medical-legal evaluation", allowedAmount: 503.75 },
@@ -1460,7 +1849,7 @@ function calculateBillSubmissionAllowedAmount(line, procedures = DEFAULT_BILL_SU
1460
1849
  }
1461
1850
 
1462
1851
  // src/bill-submission-form.tsx
1463
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1852
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1464
1853
  var BILL_SUBMISSION_DOCUMENT_TYPES = [
1465
1854
  "final_report",
1466
1855
  "proof_of_service",
@@ -1779,7 +2168,7 @@ function validateBillSubmission(bill) {
1779
2168
  });
1780
2169
  return { valid: Object.keys(errors).length === 0, fieldErrors: errors };
1781
2170
  }
1782
- var css = `
2171
+ var css2 = `
1783
2172
  .mbsf{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbsf *{box-sizing:border-box}
1784
2173
  .mbsf-head,.mbsf-section-head,.mbsf-attach-row,.mbsf-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}.mbsf-title{margin:0;font-size:24px}.mbsf-copy,.mbsf-help{color:var(--mb-muted);margin:5px 0 0}.mbsf-required{font-size:13px;color:var(--mb-muted);white-space:nowrap}.mbsf-star,.mbsf-error{color:var(--mb-danger)}
1785
2174
  .mbsf-card{min-width:0;margin:0;padding:24px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow)}.mbsf-card[data-invalid=true]{border-color:var(--mb-danger)}.mbsf-legend{padding:0 10px;font-size:18px;font-weight:760}.mbsf-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 24px}.mbsf-subhead{grid-column:1/-1;margin:6px 0 -2px;padding-top:14px;border-top:1px solid var(--mb-border);font-size:15px;font-weight:780;letter-spacing:.01em}.mbsf-subhead:first-child{margin-top:0;padding-top:0;border-top:0}.mbsf-span{grid-column:1/-1}.mbsf-field{display:grid;align-content:start;gap:7px;min-width:0}.mbsf-label{font-weight:680}.mbsf-input,.mbsf-select{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbsf-input:focus,.mbsf-select:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}.mbsf-field[data-invalid=true] .mbsf-input,.mbsf-field[data-invalid=true] .mbsf-select,.mbsf-invalid-control .mbsf-input{border-color:var(--mb-danger);background:color-mix(in srgb,var(--mb-danger) 4%,var(--mb-input))}.mbsf-field[data-invalid=true] .mbsf-input:focus,.mbsf-field[data-invalid=true] .mbsf-select:focus{outline-color:color-mix(in srgb,var(--mb-danger) 24%,transparent)}
@@ -1792,27 +2181,27 @@ var css = `
1792
2181
  @media(max-width:820px){.mbsf{gap:16px}.mbsf-grid{grid-template-columns:1fr}.mbsf-span{grid-column:auto}.mbsf-card{padding:18px 16px}.mbsf-line-head{display:none}.mbsf-line{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 86px;gap:14px;padding:18px 16px}.mbsf-line>div:before{display:block;margin-bottom:6px;color:var(--mb-muted);font-size:12px;font-weight:700;content:attr(data-label)}.mbsf-line>div:nth-child(1),.mbsf-line>div:nth-child(2),.mbsf-line>div:nth-child(3){grid-column:1/-1}.mbsf-money{align-self:end;padding:0 0 12px;text-align:right}.mbsf-line .mbsf-icon-btn{position:absolute;right:8px;bottom:3px}.mbsf-total{padding:16px 18px;gap:24px}.mbsf-head{align-items:flex-start}.mbsf-segments{grid-template-columns:repeat(3,minmax(0,1fr))}.mbsf-segment{min-width:0;padding:8px 4px;border-right:1px solid var(--mb-border);border-bottom:0;font-size:13px}.mbsf-segment:last-child{border-right:0}.mbsf-payer-option{align-items:flex-start}.mbsf-attach-row{align-items:flex-start;flex-wrap:wrap}.mbsf-attach-main{align-items:flex-start;flex-basis:calc(100% - 150px)}.mbsf-attach-type{width:100%;flex-basis:100%;order:3}.mbsf-attach-actions{margin-left:auto}.mbsf-drop{min-height:190px;padding:24px 18px}.mbsf-actions{position:sticky;bottom:86px;z-index:10}.mbsf-submit{width:100%}}
1793
2182
  `;
1794
2183
  function RequiredMark() {
1795
- return /* @__PURE__ */ jsx3("span", { className: "mbsf-star", children: " *" });
2184
+ return /* @__PURE__ */ jsx4("span", { className: "mbsf-star", children: " *" });
1796
2185
  }
1797
2186
  function Field2({ label, required, error, path, span, children }) {
1798
- return /* @__PURE__ */ jsxs3("label", { className: `mbsf-field${span ? " mbsf-span" : ""}`, "data-field-path": path, "data-invalid": Boolean(error), children: [
1799
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-label", children: [
2187
+ return /* @__PURE__ */ jsxs4("label", { className: `mbsf-field${span ? " mbsf-span" : ""}`, "data-field-path": path, "data-invalid": Boolean(error), children: [
2188
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-label", children: [
1800
2189
  label,
1801
- required ? /* @__PURE__ */ jsx3(RequiredMark, {}) : null
2190
+ required ? /* @__PURE__ */ jsx4(RequiredMark, {}) : null
1802
2191
  ] }),
1803
2192
  children,
1804
- error ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: error }) : null
2193
+ error ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", role: "alert", children: error }) : null
1805
2194
  ] });
1806
2195
  }
1807
2196
  function TextDateInput({ value, onChange, disabled, required, ariaLabel }) {
1808
- const [display, setDisplay] = useState3(() => formatBillSubmissionDate(value));
1809
- const [invalid, setInvalid] = useState3(false);
1810
- useEffect3(() => {
2197
+ const [display, setDisplay] = useState4(() => formatBillSubmissionDate(value));
2198
+ const [invalid, setInvalid] = useState4(false);
2199
+ useEffect4(() => {
1811
2200
  setDisplay(formatBillSubmissionDate(value));
1812
2201
  setInvalid(false);
1813
2202
  }, [value]);
1814
- return /* @__PURE__ */ jsxs3(Fragment2, { children: [
1815
- /* @__PURE__ */ jsx3("input", { className: "mbsf-input", type: "text", inputMode: "numeric", autoComplete: "off", placeholder: "MM/DD/YYYY", "aria-label": ariaLabel, "aria-invalid": invalid, required, disabled, value: display, onChange: (event) => {
2203
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
2204
+ /* @__PURE__ */ jsx4("input", { className: "mbsf-input", type: "text", inputMode: "numeric", autoComplete: "off", placeholder: "MM/DD/YYYY", "aria-label": ariaLabel, "aria-invalid": invalid, required, disabled, value: display, onChange: (event) => {
1816
2205
  const next = event.target.value;
1817
2206
  const parsed = parseBillSubmissionDate(next);
1818
2207
  setDisplay(next);
@@ -1820,21 +2209,21 @@ function TextDateInput({ value, onChange, disabled, required, ariaLabel }) {
1820
2209
  if (!next.trim()) onChange("");
1821
2210
  else if (parsed) onChange(parsed);
1822
2211
  }, onBlur: () => setInvalid(Boolean(display && !parseBillSubmissionDate(display))) }),
1823
- invalid ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", children: "Use MM/DD/YYYY" }) : null
2212
+ invalid ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", children: "Use MM/DD/YYYY" }) : null
1824
2213
  ] });
1825
2214
  }
1826
2215
  function ComboBox({ value, placeholder, options, disabled, loading, loadingMore, invalid, preserveValueOnOpen = false, onOpen, onQuery, onEndReached, onSelect, createOption, ariaLabel }) {
1827
- const [open, setOpen] = useState3(false);
1828
- const [query, setQuery] = useState3("");
1829
- const visible = useMemo2(() => {
2216
+ const [open, setOpen] = useState4(false);
2217
+ const [query, setQuery] = useState4("");
2218
+ const visible = useMemo3(() => {
1830
2219
  const q = query.trim().toLowerCase();
1831
2220
  const matches = q ? options.filter((option) => `${option.id} ${option.label} ${option.detail ?? ""}`.toLowerCase().includes(q)) : options;
1832
2221
  const custom = createOption?.(query) ?? null;
1833
2222
  return custom && !matches.some((option) => option.id.toUpperCase() === custom.id.toUpperCase()) ? [...matches, custom] : matches;
1834
2223
  }, [createOption, options, query]);
1835
2224
  const showMenu = open && (loading || visible.length > 0 || query.trim().length >= 2);
1836
- return /* @__PURE__ */ jsxs3("div", { className: "mbsf-combo", children: [
1837
- /* @__PURE__ */ jsx3("input", { className: "mbsf-input", role: "combobox", "aria-label": ariaLabel, "aria-invalid": invalid, "aria-expanded": showMenu, autoComplete: "off", disabled, placeholder, value: open ? query : value, onFocus: () => {
2225
+ return /* @__PURE__ */ jsxs4("div", { className: "mbsf-combo", children: [
2226
+ /* @__PURE__ */ jsx4("input", { className: "mbsf-input", role: "combobox", "aria-label": ariaLabel, "aria-invalid": invalid, "aria-expanded": showMenu, autoComplete: "off", disabled, placeholder, value: open ? query : value, onFocus: () => {
1838
2227
  const next = preserveValueOnOpen ? value : "";
1839
2228
  setOpen(true);
1840
2229
  setQuery(next);
@@ -1845,19 +2234,19 @@ function ComboBox({ value, placeholder, options, disabled, loading, loadingMore,
1845
2234
  setQuery(event.target.value);
1846
2235
  onQuery?.(event.target.value);
1847
2236
  }, onBlur: () => setTimeout(() => setOpen(false), 120) }),
1848
- showMenu ? /* @__PURE__ */ jsxs3("div", { className: "mbsf-menu", role: "listbox", onScroll: (event) => {
2237
+ showMenu ? /* @__PURE__ */ jsxs4("div", { className: "mbsf-menu", role: "listbox", onScroll: (event) => {
1849
2238
  const menu = event.currentTarget;
1850
2239
  if (menu.scrollHeight - menu.scrollTop - menu.clientHeight < 120) onEndReached?.();
1851
2240
  }, children: [
1852
- loading && !visible.length ? /* @__PURE__ */ jsx3("div", { className: "mbsf-menu-status", children: "Loading\u2026" }) : visible.length ? visible.map((option) => /* @__PURE__ */ jsxs3("button", { className: "mbsf-option", type: "button", role: "option", onMouseDown: (event) => event.preventDefault(), onClick: () => {
2241
+ loading && !visible.length ? /* @__PURE__ */ jsx4("div", { className: "mbsf-menu-status", children: "Loading\u2026" }) : visible.length ? visible.map((option) => /* @__PURE__ */ jsxs4("button", { className: "mbsf-option", type: "button", role: "option", onMouseDown: (event) => event.preventDefault(), onClick: () => {
1853
2242
  onSelect(option);
1854
2243
  setOpen(false);
1855
2244
  setQuery("");
1856
2245
  }, children: [
1857
- /* @__PURE__ */ jsx3("strong", { children: option.label }),
1858
- option.detail ? /* @__PURE__ */ jsx3("small", { children: option.detail }) : null
1859
- ] }, option.id)) : /* @__PURE__ */ jsx3("div", { className: "mbsf-option", children: "No matches" }),
1860
- loadingMore ? /* @__PURE__ */ jsx3("div", { className: "mbsf-menu-status", children: "Loading more\u2026" }) : null
2246
+ /* @__PURE__ */ jsx4("strong", { children: option.label }),
2247
+ option.detail ? /* @__PURE__ */ jsx4("small", { children: option.detail }) : null
2248
+ ] }, option.id)) : /* @__PURE__ */ jsx4("div", { className: "mbsf-option", children: "No matches" }),
2249
+ loadingMore ? /* @__PURE__ */ jsx4("div", { className: "mbsf-menu-status", children: "Loading more\u2026" }) : null
1861
2250
  ] }) : null
1862
2251
  ] });
1863
2252
  }
@@ -1907,28 +2296,28 @@ var BillSubmissionSectionsContext = createContext(null);
1907
2296
  function BillSubmissionSection({ id }) {
1908
2297
  const sections = useContext(BillSubmissionSectionsContext);
1909
2298
  if (!sections) throw new Error("Bill submission sections must be rendered inside BillSubmissionForm.");
1910
- return /* @__PURE__ */ jsx3(Fragment2, { children: sections[id] });
2299
+ return /* @__PURE__ */ jsx4(Fragment3, { children: sections[id] });
1911
2300
  }
1912
2301
  function BillSubmissionHeader() {
1913
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "header" });
2302
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "header" });
1914
2303
  }
1915
2304
  function BillSubmissionPatientSection() {
1916
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "patient" });
2305
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "patient" });
1917
2306
  }
1918
2307
  function BillSubmissionClaimSection() {
1919
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "claim" });
2308
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "claim" });
1920
2309
  }
1921
2310
  function BillSubmissionProvidersSection() {
1922
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "providers" });
2311
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "providers" });
1923
2312
  }
1924
2313
  function BillSubmissionServiceLinesSection() {
1925
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "serviceLines" });
2314
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "serviceLines" });
1926
2315
  }
1927
2316
  function BillSubmissionAttachmentsSection() {
1928
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "attachments" });
2317
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "attachments" });
1929
2318
  }
1930
2319
  function BillSubmissionActions() {
1931
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "actions" });
2320
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "actions" });
1932
2321
  }
1933
2322
  function BillSubmissionForm({
1934
2323
  initialBill,
@@ -1946,6 +2335,7 @@ function BillSubmissionForm({
1946
2335
  procedureOptions,
1947
2336
  modifierOptions,
1948
2337
  taxonomyOptions,
2338
+ deliveryRoutePicker = "auto",
1949
2339
  attachmentReportTypeMode = "auto",
1950
2340
  attachmentReportTypes = BILL_SUBMISSION_REPORT_TYPES,
1951
2341
  defaultAttachmentReportType,
@@ -1958,42 +2348,44 @@ function BillSubmissionForm({
1958
2348
  description = "Review the bill details, add attachments, and submit.",
1959
2349
  children
1960
2350
  }) {
1961
- const [bill, setBill] = useState3(() => cloneInitialBill(initialBill));
1962
- const [selectedIds, setSelectedIds] = useState3(() => attachments.map((item) => item.id));
1963
- const [removedSourceIds, setRemovedSourceIds] = useState3([]);
1964
- const [uploads, setUploads] = useState3([]);
1965
- const [errors, setErrors] = useState3({});
1966
- const [sourceAttachmentReportTypes, setSourceAttachmentReportTypes] = useState3(() => Object.fromEntries(attachments.flatMap((item) => item.reportTypeCode ? [[item.id, item.reportTypeCode]] : [])));
1967
- const [validationActive, setValidationActive] = useState3(false);
1968
- const [formError, setFormError] = useState3(null);
1969
- const [submitting, setSubmitting] = useState3(false);
1970
- const [payerResults, setPayerResults] = useState3([]);
1971
- const [payerLoading, setPayerLoading] = useState3(false);
1972
- const [diagnosisResults, setDiagnosisResults] = useState3([]);
1973
- const [diagnosisLoading, setDiagnosisLoading] = useState3(false);
1974
- const [diagnosisLoadingMore, setDiagnosisLoadingMore] = useState3(false);
1975
- const [diagnosisQuery, setDiagnosisQuery] = useState3(null);
1976
- const [diagnosisHasMore, setDiagnosisHasMore] = useState3(true);
1977
- const [postalStatus, setPostalStatus] = useState3(null);
1978
- const [dragActive, setDragActive] = useState3(false);
2351
+ const [bill, setBill] = useState4(() => cloneInitialBill(initialBill));
2352
+ const [selectedIds, setSelectedIds] = useState4(() => attachments.map((item) => item.id));
2353
+ const [removedSourceIds, setRemovedSourceIds] = useState4([]);
2354
+ const [uploads, setUploads] = useState4([]);
2355
+ const [errors, setErrors] = useState4({});
2356
+ const [sourceAttachmentReportTypes, setSourceAttachmentReportTypes] = useState4(() => Object.fromEntries(attachments.flatMap((item) => item.reportTypeCode ? [[item.id, item.reportTypeCode]] : [])));
2357
+ const [validationActive, setValidationActive] = useState4(false);
2358
+ const [formError, setFormError] = useState4(null);
2359
+ const [submitting, setSubmitting] = useState4(false);
2360
+ const [routeDialog, setRouteDialog] = useState4(null);
2361
+ const [routeError, setRouteError] = useState4(null);
2362
+ const [payerResults, setPayerResults] = useState4([]);
2363
+ const [payerLoading, setPayerLoading] = useState4(false);
2364
+ const [diagnosisResults, setDiagnosisResults] = useState4([]);
2365
+ const [diagnosisLoading, setDiagnosisLoading] = useState4(false);
2366
+ const [diagnosisLoadingMore, setDiagnosisLoadingMore] = useState4(false);
2367
+ const [diagnosisQuery, setDiagnosisQuery] = useState4(null);
2368
+ const [diagnosisHasMore, setDiagnosisHasMore] = useState4(true);
2369
+ const [postalStatus, setPostalStatus] = useState4(null);
2370
+ const [dragActive, setDragActive] = useState4(false);
1979
2371
  const formRef = useRef2(null);
1980
2372
  const fileInput = useRef2(null);
1981
2373
  const diagnosisRequest = useRef2(0);
1982
2374
  const diagnosisAppendPending = useRef2(false);
1983
2375
  const payerRequest = useRef2(0);
1984
- const procedures = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_PROCEDURES, procedureOptions), [procedureOptions]);
1985
- const modifiers = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_MODIFIERS, modifierOptions), [modifierOptions]);
1986
- const taxonomies = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_TAXONOMIES, taxonomyOptions), [taxonomyOptions]);
1987
- const [evaluationType, setEvaluationType] = useState3(() => initialEvaluationType(initialBill));
2376
+ const procedures = useMemo3(() => mergeOptions(DEFAULT_BILL_SUBMISSION_PROCEDURES, procedureOptions), [procedureOptions]);
2377
+ const modifiers = useMemo3(() => mergeOptions(DEFAULT_BILL_SUBMISSION_MODIFIERS, modifierOptions), [modifierOptions]);
2378
+ const taxonomies = useMemo3(() => mergeOptions(DEFAULT_BILL_SUBMISSION_TAXONOMIES, taxonomyOptions), [taxonomyOptions]);
2379
+ const [evaluationType, setEvaluationType] = useState4(() => initialEvaluationType(initialBill));
1988
2380
  const connected = !onSubmit;
1989
- const referenceClient = useMemo2(() => getSession || sessionEndpoint || connected ? createBillReferenceClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
1990
- const submissionClient = useMemo2(() => connected ? createBillSubmissionClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
2381
+ const referenceClient = useMemo3(() => getSession || sessionEndpoint || connected ? createBillReferenceClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
2382
+ const submissionClient = useMemo3(() => connected ? createBillSubmissionClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
1991
2383
  const locked = disabled || submitting;
1992
2384
  const showAttachmentReportTypes = attachmentReportTypeMode === "visible" || attachmentReportTypeMode === "auto" && bill.billingMode !== "med_legal";
1993
2385
  const forcedAttachmentReportType = showAttachmentReportTypes ? void 0 : defaultAttachmentReportType ?? MED_LEGAL_REPORT_TYPE_CODE;
1994
- const reportTypeOptions = useMemo2(() => attachmentReportTypes.map((item) => ({ id: item.code, label: item.code.replace(/^OZ:/, ""), detail: item.label })), [attachmentReportTypes]);
2386
+ const reportTypeOptions = useMemo3(() => attachmentReportTypes.map((item) => ({ id: item.code, label: item.code.replace(/^OZ:/, ""), detail: item.label })), [attachmentReportTypes]);
1995
2387
  const missingAttachmentReportType = showAttachmentReportTypes && (selectedIds.some((id) => !(sourceAttachmentReportTypes[id] || attachments.find((item) => item.id === id)?.reportTypeCode || defaultAttachmentReportType)) || uploads.some((upload) => !(upload.reportTypeCode || defaultAttachmentReportType)));
1996
- useEffect3(() => {
2388
+ useEffect4(() => {
1997
2389
  setBill(cloneInitialBill(initialBill));
1998
2390
  setEvaluationType(initialEvaluationType(initialBill));
1999
2391
  setSelectedIds(attachments.map((item) => item.id));
@@ -2009,7 +2401,7 @@ function BillSubmissionForm({
2009
2401
  diagnosisRequest.current += 1;
2010
2402
  diagnosisAppendPending.current = false;
2011
2403
  }, [initialBill, attachments]);
2012
- useEffect3(() => {
2404
+ useEffect4(() => {
2013
2405
  if (!validationActive) return;
2014
2406
  const next = validateBillSubmission(bill).fieldErrors;
2015
2407
  setErrors(missingAttachmentReportType ? { ...next, attachments: "Select a report type for every attachment." } : next);
@@ -2027,7 +2419,7 @@ function BillSubmissionForm({
2027
2419
  if (selectedIds.length + uploads.length + files.length > MAX_DOCUMENTS) return setFormError(`A bill can include at most ${MAX_DOCUMENTS} attachments.`);
2028
2420
  setUploads((current) => [...current, ...files.map((file) => ({ file, documentType: "other", ...defaultAttachmentReportType ? { reportTypeCode: defaultAttachmentReportType } : {} }))]);
2029
2421
  }, [defaultAttachmentReportType, selectedIds.length, uploads]);
2030
- useEffect3(() => {
2422
+ useEffect4(() => {
2031
2423
  const over = (event) => {
2032
2424
  if (event.dataTransfer?.types.includes("Files")) {
2033
2425
  event.preventDefault();
@@ -2066,7 +2458,7 @@ function BillSubmissionForm({
2066
2458
  }
2067
2459
  return next;
2068
2460
  })) }));
2069
- const text = (value, onChange, options = {}) => /* @__PURE__ */ jsx3("input", { className: "mbsf-input", disabled: locked, value: value ?? "", onChange: (event) => onChange(event.target.value), ...options });
2461
+ const text = (value, onChange, options = {}) => /* @__PURE__ */ jsx4("input", { className: "mbsf-input", disabled: locked, value: value ?? "", onChange: (event) => onChange(event.target.value), ...options });
2070
2462
  const runPayerSearch = useCallback(async (query, autoSelect) => {
2071
2463
  const trimmed = query.trim();
2072
2464
  if (trimmed.length < 2) {
@@ -2097,7 +2489,7 @@ function BillSubmissionForm({
2097
2489
  });
2098
2490
  void runPayerSearch(query, true);
2099
2491
  };
2100
- useEffect3(() => {
2492
+ useEffect4(() => {
2101
2493
  const payer = bill.claim.claimsAdministrator;
2102
2494
  if (!payer?.name || payer.name.trim().length < 2) return;
2103
2495
  void runPayerSearch(payer.name, !payer.id);
@@ -2138,7 +2530,7 @@ function BillSubmissionForm({
2138
2530
  });
2139
2531
  };
2140
2532
  const searchDiagnoses = (query) => loadDiagnoses(query);
2141
- const diagnosisChoices = useMemo2(() => mergeDiagnosisOptions([...diagnosisOptions, ...diagnosisResults]), [diagnosisOptions, diagnosisResults]);
2533
+ const diagnosisChoices = useMemo3(() => mergeDiagnosisOptions([...diagnosisOptions, ...diagnosisResults]), [diagnosisOptions, diagnosisResults]);
2142
2534
  const updatePostalCode = (postalCode) => {
2143
2535
  setAddress({ postalCode });
2144
2536
  setPostalStatus(null);
@@ -2178,25 +2570,58 @@ function BillSubmissionForm({
2178
2570
  }
2179
2571
  if (selectedIds.length + uploads.length > MAX_DOCUMENTS) return setFormError(`A bill can include at most ${MAX_DOCUMENTS} attachments.`);
2180
2572
  const complete = clean;
2181
- setSubmitting(true);
2182
- try {
2183
- if (onSubmit) {
2573
+ if (onSubmit) {
2574
+ setSubmitting(true);
2575
+ try {
2184
2576
  await onSubmit({ bill: complete, sourceAttachmentIds: selectedIds, sourceAttachmentReportTypes, uploads });
2185
- } else {
2186
- if (!submissionClient) throw new Error("The connected billing client is unavailable.");
2187
- const documents = await prepareBillSubmissionDocuments({
2188
- attachments,
2189
- selectedIds,
2190
- uploads,
2191
- reportTypeCodeByAttachmentId: sourceAttachmentReportTypes,
2192
- ...forcedAttachmentReportType ? { defaultReportTypeCode: forcedAttachmentReportType } : {},
2193
- ...fetchOverride ? { fetch: fetchOverride } : {}
2577
+ } catch (caught) {
2578
+ setFormError(caught instanceof Error ? caught.message : "Unable to submit the bill.");
2579
+ } finally {
2580
+ setSubmitting(false);
2581
+ }
2582
+ return;
2583
+ }
2584
+ if (deliveryRoutePicker !== "off" && referenceClient) {
2585
+ setSubmitting(true);
2586
+ try {
2587
+ const delivery = await referenceClient.getDeliveryPreview({
2588
+ claimsAdministratorId: complete.claim.claimsAdministrator.id,
2589
+ ...complete.claim.injuryState ? { injuryState: complete.claim.injuryState } : {}
2194
2590
  });
2195
- const result = await submissionClient.submitBill({ bill: complete, documents });
2196
- await onSubmitted?.(result);
2591
+ setSubmitting(false);
2592
+ setRouteError(null);
2593
+ setRouteDialog({ delivery, complete });
2594
+ return;
2595
+ } catch {
2596
+ setSubmitting(false);
2197
2597
  }
2598
+ }
2599
+ await performConnectedSubmit(complete, void 0);
2600
+ }
2601
+ async function performConnectedSubmit(complete, submission) {
2602
+ setSubmitting(true);
2603
+ try {
2604
+ if (!submissionClient) throw new Error("The connected billing client is unavailable.");
2605
+ const documents = await prepareBillSubmissionDocuments({
2606
+ attachments,
2607
+ selectedIds,
2608
+ uploads,
2609
+ reportTypeCodeByAttachmentId: sourceAttachmentReportTypes,
2610
+ ...forcedAttachmentReportType ? { defaultReportTypeCode: forcedAttachmentReportType } : {},
2611
+ ...fetchOverride ? { fetch: fetchOverride } : {}
2612
+ });
2613
+ const result = await submissionClient.submitBill({
2614
+ bill: complete,
2615
+ ...submission ? { submission } : {},
2616
+ documents
2617
+ });
2618
+ setRouteDialog(null);
2619
+ setRouteError(null);
2620
+ await onSubmitted?.(result);
2198
2621
  } catch (caught) {
2199
- setFormError(caught instanceof Error ? caught.message : "Unable to submit the bill.");
2622
+ const message = caught instanceof Error ? caught.message : "Unable to submit the bill.";
2623
+ if (submission) setRouteError(message);
2624
+ else setFormError(message);
2200
2625
  } finally {
2201
2626
  setSubmitting(false);
2202
2627
  }
@@ -2205,210 +2630,210 @@ function BillSubmissionForm({
2205
2630
  const selectedPayer = payerResults.find((payer) => payer.id === bill.claim.claimsAdministrator?.id);
2206
2631
  const payerRecommendations = bill.claim.claimsAdministrator?.id ? [] : claimsAdministratorRecommendations(payerResults);
2207
2632
  const choosePayer = (payer) => setBill((current) => ({ ...current, claim: { ...current.claim, claimsAdministrator: { id: payer.id, name: payer.name } } }));
2208
- const headerSection = /* @__PURE__ */ jsxs3("div", { className: "mbsf-head", children: [
2209
- /* @__PURE__ */ jsxs3("div", { children: [
2210
- /* @__PURE__ */ jsx3("h3", { className: "mbsf-title", children: heading }),
2211
- /* @__PURE__ */ jsx3("p", { className: "mbsf-copy", children: description })
2633
+ const headerSection = /* @__PURE__ */ jsxs4("div", { className: "mbsf-head", children: [
2634
+ /* @__PURE__ */ jsxs4("div", { children: [
2635
+ /* @__PURE__ */ jsx4("h3", { className: "mbsf-title", children: heading }),
2636
+ /* @__PURE__ */ jsx4("p", { className: "mbsf-copy", children: description })
2212
2637
  ] }),
2213
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-required", children: [
2214
- /* @__PURE__ */ jsx3(RequiredMark, {}),
2638
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-required", children: [
2639
+ /* @__PURE__ */ jsx4(RequiredMark, {}),
2215
2640
  " Required"
2216
2641
  ] })
2217
2642
  ] });
2218
- const patientSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
2219
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Patient" }),
2220
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
2221
- /* @__PURE__ */ jsx3(Field2, { path: "patient.firstName", label: "First name", required: true, error: errors["patient.firstName"], children: text(bill.patient.firstName, (firstName) => setBill((c) => ({ ...c, patient: { ...c.patient, firstName } }))) }),
2222
- /* @__PURE__ */ jsx3(Field2, { path: "patient.lastName", label: "Last name", required: true, error: errors["patient.lastName"], children: text(bill.patient.lastName, (lastName) => setBill((c) => ({ ...c, patient: { ...c.patient, lastName } }))) }),
2223
- /* @__PURE__ */ jsx3(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
2224
- /* @__PURE__ */ jsx3(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
2225
- /* @__PURE__ */ jsx3(Field2, { path: "patient.dateOfBirth", label: "Date of birth", required: true, error: errors["patient.dateOfBirth"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of birth", value: bill.patient.dateOfBirth, disabled: locked, required: true, onChange: (dateOfBirth) => setBill((c) => ({ ...c, patient: { ...c.patient, dateOfBirth } })) }) }),
2226
- /* @__PURE__ */ jsx3(Field2, { path: "patient.address.line1", label: "Address", required: true, span: true, error: errors["patient.address.line1"], children: text(bill.patient.address.line1, (line1) => setAddress({ line1 }), { placeholder: "Street address" }) }),
2227
- /* @__PURE__ */ jsxs3(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
2643
+ const patientSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2644
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Patient" }),
2645
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-grid", children: [
2646
+ /* @__PURE__ */ jsx4(Field2, { path: "patient.firstName", label: "First name", required: true, error: errors["patient.firstName"], children: text(bill.patient.firstName, (firstName) => setBill((c) => ({ ...c, patient: { ...c.patient, firstName } }))) }),
2647
+ /* @__PURE__ */ jsx4(Field2, { path: "patient.lastName", label: "Last name", required: true, error: errors["patient.lastName"], children: text(bill.patient.lastName, (lastName) => setBill((c) => ({ ...c, patient: { ...c.patient, lastName } }))) }),
2648
+ /* @__PURE__ */ jsx4(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
2649
+ /* @__PURE__ */ jsx4(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
2650
+ /* @__PURE__ */ jsx4(Field2, { path: "patient.dateOfBirth", label: "Date of birth", required: true, error: errors["patient.dateOfBirth"], children: /* @__PURE__ */ jsx4(TextDateInput, { ariaLabel: "Date of birth", value: bill.patient.dateOfBirth, disabled: locked, required: true, onChange: (dateOfBirth) => setBill((c) => ({ ...c, patient: { ...c.patient, dateOfBirth } })) }) }),
2651
+ /* @__PURE__ */ jsx4(Field2, { path: "patient.address.line1", label: "Address", required: true, span: true, error: errors["patient.address.line1"], children: text(bill.patient.address.line1, (line1) => setAddress({ line1 }), { placeholder: "Street address" }) }),
2652
+ /* @__PURE__ */ jsxs4(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
2228
2653
  text(bill.patient.address.postalCode, updatePostalCode, { maxLength: 10 }),
2229
- postalStatus ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: postalStatus }) : null
2654
+ postalStatus ? /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: postalStatus }) : null
2230
2655
  ] }),
2231
- /* @__PURE__ */ jsx3(Field2, { path: "patient.address.city", label: "City", required: true, error: errors["patient.address.city"], children: text(bill.patient.address.city, (city) => setAddress({ city })) }),
2232
- /* @__PURE__ */ jsx3(Field2, { path: "patient.address.state", label: "State", required: true, error: errors["patient.address.state"], children: text(bill.patient.address.state, (state) => setAddress({ state: state.toUpperCase() }), { maxLength: 2 }) })
2656
+ /* @__PURE__ */ jsx4(Field2, { path: "patient.address.city", label: "City", required: true, error: errors["patient.address.city"], children: text(bill.patient.address.city, (city) => setAddress({ city })) }),
2657
+ /* @__PURE__ */ jsx4(Field2, { path: "patient.address.state", label: "State", required: true, error: errors["patient.address.state"], children: text(bill.patient.address.state, (state) => setAddress({ state: state.toUpperCase() }), { maxLength: 2 }) })
2233
2658
  ] })
2234
2659
  ] });
2235
- const claimSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
2236
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Injury & claim" }),
2237
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
2238
- /* @__PURE__ */ jsx3(Field2, { path: "service.date", label: "Date of service", required: true, error: errors["service.date"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of service", value: bill.service.date, disabled: locked, required: true, onChange: (date2) => setBill((c) => ({ ...c, service: { ...c.service, date: date2 } })) }) }),
2239
- /* @__PURE__ */ jsxs3(Field2, { label: "Treatment authorization # (optional)", children: [
2660
+ const claimSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2661
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Injury & claim" }),
2662
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-grid", children: [
2663
+ /* @__PURE__ */ jsx4(Field2, { path: "service.date", label: "Date of service", required: true, error: errors["service.date"], children: /* @__PURE__ */ jsx4(TextDateInput, { ariaLabel: "Date of service", value: bill.service.date, disabled: locked, required: true, onChange: (date2) => setBill((c) => ({ ...c, service: { ...c.service, date: date2 } })) }) }),
2664
+ /* @__PURE__ */ jsxs4(Field2, { label: "Treatment authorization # (optional)", children: [
2240
2665
  text(bill.service.authorizationNumber, (authorizationNumber) => setBill((c) => ({ ...c, service: { ...c.service, authorizationNumber } })), { placeholder: "Utilization-review authorization number" }),
2241
- /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: "Rides on the bill as CMS-1500 Box 23 / 837 REF*G1." })
2666
+ /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Rides on the bill as CMS-1500 Box 23 / 837 REF*G1." })
2242
2667
  ] }),
2243
- /* @__PURE__ */ jsx3(Field2, { path: "claim.dateOfInjury", label: "Date of injury", required: true, error: errors["claim.dateOfInjury"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of injury", value: bill.claim.dateOfInjury, disabled: locked, required: true, onChange: (dateOfInjury) => setBill((c) => ({ ...c, claim: { ...c.claim, dateOfInjury } })) }) }),
2244
- /* @__PURE__ */ jsx3(Field2, { path: "claim.employer", label: "Employer name", required: true, error: errors["claim.employer"], children: text(bill.claim.employer, (employer) => setBill((c) => ({ ...c, claim: { ...c.claim, employer } }))) }),
2245
- /* @__PURE__ */ jsx3(Field2, { path: "claim.claimNumber", label: "Claim number", required: true, error: errors["claim.claimNumber"], children: text(bill.claim.claimNumber, (claimNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, claimNumber } }))) }),
2246
- /* @__PURE__ */ jsx3(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
2247
- /* @__PURE__ */ jsxs3(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: [
2248
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Claims administrator", invalid: Boolean(claimsAdministratorError), disabled: locked, loading: payerLoading, preserveValueOnOpen: true, value: bill.claim.claimsAdministrator?.name ?? "", placeholder: "Search the payer directory\u2026", options: payerResults.map((payer) => ({ id: payer.id, label: payer.name, detail: [payer.hasElectronic ? "Electronic" : "Work comp", ...payer.states ?? []].join(" \xB7 ") })), onQuery: searchPayers, onSelect: (option) => choosePayer({ id: option.id, name: option.label }) }),
2249
- selectedPayer ? /* @__PURE__ */ jsxs3("div", { className: "mbsf-payer-status", role: "status", children: [
2250
- /* @__PURE__ */ jsx3("strong", { children: "\u2713 Routing match set:" }),
2668
+ /* @__PURE__ */ jsx4(Field2, { path: "claim.dateOfInjury", label: "Date of injury", required: true, error: errors["claim.dateOfInjury"], children: /* @__PURE__ */ jsx4(TextDateInput, { ariaLabel: "Date of injury", value: bill.claim.dateOfInjury, disabled: locked, required: true, onChange: (dateOfInjury) => setBill((c) => ({ ...c, claim: { ...c.claim, dateOfInjury } })) }) }),
2669
+ /* @__PURE__ */ jsx4(Field2, { path: "claim.employer", label: "Employer name", required: true, error: errors["claim.employer"], children: text(bill.claim.employer, (employer) => setBill((c) => ({ ...c, claim: { ...c.claim, employer } }))) }),
2670
+ /* @__PURE__ */ jsx4(Field2, { path: "claim.claimNumber", label: "Claim number", required: true, error: errors["claim.claimNumber"], children: text(bill.claim.claimNumber, (claimNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, claimNumber } }))) }),
2671
+ /* @__PURE__ */ jsx4(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
2672
+ /* @__PURE__ */ jsxs4(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: [
2673
+ /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: "Claims administrator", invalid: Boolean(claimsAdministratorError), disabled: locked, loading: payerLoading, preserveValueOnOpen: true, value: bill.claim.claimsAdministrator?.name ?? "", placeholder: "Search the payer directory\u2026", options: payerResults.map((payer) => ({ id: payer.id, label: payer.name, detail: [payer.hasElectronic ? "Electronic" : "Work comp", ...payer.states ?? []].join(" \xB7 ") })), onQuery: searchPayers, onSelect: (option) => choosePayer({ id: option.id, name: option.label }) }),
2674
+ selectedPayer ? /* @__PURE__ */ jsxs4("div", { className: "mbsf-payer-status", role: "status", children: [
2675
+ /* @__PURE__ */ jsx4("strong", { children: "\u2713 Routing match set:" }),
2251
2676
  " ",
2252
2677
  selectedPayer.name
2253
2678
  ] }) : null,
2254
- selectedPayer?.signals?.length ? /* @__PURE__ */ jsx3("div", { className: "mbsf-payer-signals", children: selectedPayer.signals.map((signal, index) => /* @__PURE__ */ jsxs3("span", { "data-state": signal.state, children: [
2679
+ selectedPayer?.signals?.length ? /* @__PURE__ */ jsx4("div", { className: "mbsf-payer-signals", children: selectedPayer.signals.map((signal, index) => /* @__PURE__ */ jsxs4("span", { "data-state": signal.state, children: [
2255
2680
  signal.state === "match" ? "\u2713" : "!",
2256
2681
  " ",
2257
2682
  signal.label
2258
2683
  ] }, `${signal.kind}-${index}`)) }) : null,
2259
- !selectedPayer && payerRecommendations.length ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
2260
- /* @__PURE__ */ jsxs3("p", { className: "mbsf-payer-intro", children: [
2684
+ !selectedPayer && payerRecommendations.length ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
2685
+ /* @__PURE__ */ jsxs4("p", { className: "mbsf-payer-intro", children: [
2261
2686
  "Confirm the best routing match for ",
2262
- /* @__PURE__ */ jsx3("strong", { children: bill.claim.claimsAdministrator?.name }),
2687
+ /* @__PURE__ */ jsx4("strong", { children: bill.claim.claimsAdministrator?.name }),
2263
2688
  ":"
2264
2689
  ] }),
2265
- /* @__PURE__ */ jsx3("div", { className: "mbsf-payer-list", children: payerRecommendations.map((payer) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-payer-option", children: [
2266
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-payer-option-main", children: [
2267
- /* @__PURE__ */ jsx3("strong", { children: payer.name }),
2268
- payer.signals?.length ? /* @__PURE__ */ jsx3("div", { className: "mbsf-payer-signals", children: payer.signals.map((signal, index) => /* @__PURE__ */ jsxs3("span", { "data-state": signal.state, children: [
2690
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-payer-list", children: payerRecommendations.map((payer) => /* @__PURE__ */ jsxs4("div", { className: "mbsf-payer-option", children: [
2691
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-payer-option-main", children: [
2692
+ /* @__PURE__ */ jsx4("strong", { children: payer.name }),
2693
+ payer.signals?.length ? /* @__PURE__ */ jsx4("div", { className: "mbsf-payer-signals", children: payer.signals.map((signal, index) => /* @__PURE__ */ jsxs4("span", { "data-state": signal.state, children: [
2269
2694
  signal.state === "match" ? "\u2713" : "!",
2270
2695
  " ",
2271
2696
  signal.label
2272
- ] }, `${signal.kind}-${index}`)) }) : /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: "Directory match" })
2697
+ ] }, `${signal.kind}-${index}`)) }) : /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Directory match" })
2273
2698
  ] }),
2274
- /* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => choosePayer(payer), children: "Use" })
2699
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-secondary", type: "button", onClick: () => choosePayer(payer), children: "Use" })
2275
2700
  ] }, payer.id)) })
2276
2701
  ] }) : null,
2277
- !selectedPayer && !payerLoading && !payerRecommendations.length && (bill.claim.claimsAdministrator?.name.trim().length ?? 0) >= 2 ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: "No confident route selected yet. Search the directory and choose a claims administrator." }) : null
2702
+ !selectedPayer && !payerLoading && !payerRecommendations.length && (bill.claim.claimsAdministrator?.name.trim().length ?? 0) >= 2 ? /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "No confident route selected yet. Search the directory and choose a claims administrator." }) : null
2278
2703
  ] }),
2279
- /* @__PURE__ */ jsx3(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
2280
- /* @__PURE__ */ jsxs3(Field2, { path: "diagnoses", label: "Diagnosis codes (ICD-10)", required: true, span: true, error: errors.diagnoses, children: [
2281
- /* @__PURE__ */ jsx3("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
2704
+ /* @__PURE__ */ jsx4(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
2705
+ /* @__PURE__ */ jsxs4(Field2, { path: "diagnoses", label: "Diagnosis codes (ICD-10)", required: true, span: true, error: errors.diagnoses, children: [
2706
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
2282
2707
  const selected = (bill.diagnoses ?? []).includes(option.code);
2283
- return /* @__PURE__ */ jsxs3("button", { className: "mbsf-quick-pick", "data-selected": selected, type: "button", "aria-pressed": selected, title: `${option.code} \u2014 ${option.description}`, onClick: () => setBill((current) => ({ ...current, diagnoses: selected ? (current.diagnoses ?? []).filter((code) => code !== option.code) : [.../* @__PURE__ */ new Set([...current.diagnoses ?? [], option.code])] })), children: [
2708
+ return /* @__PURE__ */ jsxs4("button", { className: "mbsf-quick-pick", "data-selected": selected, type: "button", "aria-pressed": selected, title: `${option.code} \u2014 ${option.description}`, onClick: () => setBill((current) => ({ ...current, diagnoses: selected ? (current.diagnoses ?? []).filter((code) => code !== option.code) : [.../* @__PURE__ */ new Set([...current.diagnoses ?? [], option.code])] })), children: [
2284
2709
  selected ? "\u2713" : "+",
2285
2710
  " ",
2286
2711
  option.label
2287
2712
  ] }, option.code);
2288
2713
  }) }),
2289
- /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
2714
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
2290
2715
  const option = [...BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, ...diagnosisChoices].find((item) => item.code === code);
2291
- return /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
2292
- /* @__PURE__ */ jsx3("strong", { children: code }),
2716
+ return /* @__PURE__ */ jsxs4("span", { className: "mbsf-chip", children: [
2717
+ /* @__PURE__ */ jsx4("strong", { children: code }),
2293
2718
  option?.description ? ` ${option.description}` : "",
2294
- /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
2719
+ /* @__PURE__ */ jsx4("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
2295
2720
  ] }, code);
2296
2721
  }) }),
2297
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Add diagnosis code", invalid: Boolean(errors.diagnoses), disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
2722
+ /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: "Add diagnosis code", invalid: Boolean(errors.diagnoses), disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
2298
2723
  if (diagnosisQuery !== "") loadDiagnoses("");
2299
2724
  }, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
2300
2725
  ] })
2301
2726
  ] })
2302
2727
  ] });
2303
- const providersSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
2304
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
2305
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
2306
- /* @__PURE__ */ jsx3("h4", { className: "mbsf-subhead", children: "Billing provider" }),
2307
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.name", label: "Billing provider name", required: true, error: errors["billingProvider.name"], children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
2308
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.taxId", label: "Tax ID (EIN / SSN)", required: true, error: errors["billingProvider.taxId"], children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } })), { inputMode: "numeric" }) }),
2309
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.npi", label: "Billing provider NPI", required: true, error: errors["billingProvider.npi"], children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
2310
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.phone", label: "Billing provider phone", required: true, error: errors["billingProvider.phone"], children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
2311
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.address.line1", label: "Billing address line 1", required: true, span: true, error: errors["billingProvider.address.line1"], children: text(bill.billingProvider?.address?.line1, (line1) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1, line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
2312
- /* @__PURE__ */ jsx3(Field2, { label: "Billing address line 2 (optional)", span: true, children: text(bill.billingProvider?.address?.line2, (line2) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2, city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
2313
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.address.city", label: "Billing city", required: true, error: errors["billingProvider.address.city"], children: text(bill.billingProvider?.address?.city, (city) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city, state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
2314
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.address.state", label: "Billing state", required: true, error: errors["billingProvider.address.state"], children: text(bill.billingProvider?.address?.state, (state) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.billingProvider?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
2315
- /* @__PURE__ */ jsx3(Field2, { path: "billingProvider.address.postalCode", label: "Billing ZIP", required: true, error: errors["billingProvider.address.postalCode"], children: text(bill.billingProvider?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode } } }))) }),
2316
- /* @__PURE__ */ jsx3("h4", { className: "mbsf-subhead", children: "Rendering provider" }),
2317
- /* @__PURE__ */ jsx3(Field2, { path: "renderingProvider.name", label: "Rendering provider name", required: true, error: errors["renderingProvider.name"], children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
2318
- /* @__PURE__ */ jsx3(Field2, { path: "renderingProvider.npi", label: "Rendering provider NPI", required: true, error: errors["renderingProvider.npi"], children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
2319
- /* @__PURE__ */ jsxs3(Field2, { path: "renderingProvider.taxonomy", label: "Rendering taxonomy", required: true, error: errors["renderingProvider.taxonomy"], children: [
2320
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Rendering taxonomy", invalid: Boolean(errors["renderingProvider.taxonomy"]), disabled: locked, preserveValueOnOpen: true, value: bill.renderingProvider?.taxonomy ?? "", placeholder: "Search specialty name or taxonomy code\u2026", options: taxonomies.map((item) => ({ id: item.code, label: item.description, detail: item.code })), createOption: (query) => {
2728
+ const providersSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2729
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
2730
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-grid", children: [
2731
+ /* @__PURE__ */ jsx4("h4", { className: "mbsf-subhead", children: "Billing provider" }),
2732
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.name", label: "Billing provider name", required: true, error: errors["billingProvider.name"], children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
2733
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.taxId", label: "Tax ID (EIN / SSN)", required: true, error: errors["billingProvider.taxId"], children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } })), { inputMode: "numeric" }) }),
2734
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.npi", label: "Billing provider NPI", required: true, error: errors["billingProvider.npi"], children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
2735
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.phone", label: "Billing provider phone", required: true, error: errors["billingProvider.phone"], children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
2736
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.address.line1", label: "Billing address line 1", required: true, span: true, error: errors["billingProvider.address.line1"], children: text(bill.billingProvider?.address?.line1, (line1) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1, line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
2737
+ /* @__PURE__ */ jsx4(Field2, { label: "Billing address line 2 (optional)", span: true, children: text(bill.billingProvider?.address?.line2, (line2) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2, city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
2738
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.address.city", label: "Billing city", required: true, error: errors["billingProvider.address.city"], children: text(bill.billingProvider?.address?.city, (city) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city, state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
2739
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.address.state", label: "Billing state", required: true, error: errors["billingProvider.address.state"], children: text(bill.billingProvider?.address?.state, (state) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.billingProvider?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
2740
+ /* @__PURE__ */ jsx4(Field2, { path: "billingProvider.address.postalCode", label: "Billing ZIP", required: true, error: errors["billingProvider.address.postalCode"], children: text(bill.billingProvider?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode } } }))) }),
2741
+ /* @__PURE__ */ jsx4("h4", { className: "mbsf-subhead", children: "Rendering provider" }),
2742
+ /* @__PURE__ */ jsx4(Field2, { path: "renderingProvider.name", label: "Rendering provider name", required: true, error: errors["renderingProvider.name"], children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
2743
+ /* @__PURE__ */ jsx4(Field2, { path: "renderingProvider.npi", label: "Rendering provider NPI", required: true, error: errors["renderingProvider.npi"], children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
2744
+ /* @__PURE__ */ jsxs4(Field2, { path: "renderingProvider.taxonomy", label: "Rendering taxonomy", required: true, error: errors["renderingProvider.taxonomy"], children: [
2745
+ /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: "Rendering taxonomy", invalid: Boolean(errors["renderingProvider.taxonomy"]), disabled: locked, preserveValueOnOpen: true, value: bill.renderingProvider?.taxonomy ?? "", placeholder: "Search specialty name or taxonomy code\u2026", options: taxonomies.map((item) => ({ id: item.code, label: item.description, detail: item.code })), createOption: (query) => {
2321
2746
  const code = query.trim().toUpperCase();
2322
2747
  return /^[A-Z0-9]{10}$/.test(code) ? { id: code, label: code, detail: "Use this taxonomy code" } : null;
2323
2748
  }, onSelect: (option) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, taxonomy: option.id } })) }),
2324
- /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: "Search by specialty name or 10-character taxonomy code." })
2749
+ /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Search by specialty name or 10-character taxonomy code." })
2325
2750
  ] }),
2326
- /* @__PURE__ */ jsx3("h4", { className: "mbsf-subhead", children: "Service facility" }),
2327
- /* @__PURE__ */ jsx3(Field2, { path: "serviceLocation.placeOfServiceCode", label: "Place of service code", required: true, error: errors["serviceLocation.placeOfServiceCode"], children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { inputMode: "numeric", maxLength: 2, placeholder: "11" }) }),
2328
- /* @__PURE__ */ jsx3(Field2, { path: "serviceLocation.address.line1", label: "Service address line 1", required: true, span: true, error: errors["serviceLocation.address.line1"], children: text(bill.serviceLocation?.address?.line1, (line1) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1, line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
2329
- /* @__PURE__ */ jsx3(Field2, { label: "Service address line 2 (optional)", span: true, children: text(bill.serviceLocation?.address?.line2, (line2) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2, city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
2330
- /* @__PURE__ */ jsx3(Field2, { path: "serviceLocation.address.city", label: "Service city", required: true, error: errors["serviceLocation.address.city"], children: text(bill.serviceLocation?.address?.city, (city) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city, state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
2331
- /* @__PURE__ */ jsx3(Field2, { path: "serviceLocation.address.state", label: "Service state", required: true, error: errors["serviceLocation.address.state"], children: text(bill.serviceLocation?.address?.state, (state) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.serviceLocation?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
2332
- /* @__PURE__ */ jsx3(Field2, { path: "serviceLocation.address.postalCode", label: "Service ZIP", required: true, error: errors["serviceLocation.address.postalCode"], children: text(bill.serviceLocation?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode } } }))) })
2751
+ /* @__PURE__ */ jsx4("h4", { className: "mbsf-subhead", children: "Service facility" }),
2752
+ /* @__PURE__ */ jsx4(Field2, { path: "serviceLocation.placeOfServiceCode", label: "Place of service code", required: true, error: errors["serviceLocation.placeOfServiceCode"], children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { inputMode: "numeric", maxLength: 2, placeholder: "11" }) }),
2753
+ /* @__PURE__ */ jsx4(Field2, { path: "serviceLocation.address.line1", label: "Service address line 1", required: true, span: true, error: errors["serviceLocation.address.line1"], children: text(bill.serviceLocation?.address?.line1, (line1) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1, line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
2754
+ /* @__PURE__ */ jsx4(Field2, { label: "Service address line 2 (optional)", span: true, children: text(bill.serviceLocation?.address?.line2, (line2) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2, city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
2755
+ /* @__PURE__ */ jsx4(Field2, { path: "serviceLocation.address.city", label: "Service city", required: true, error: errors["serviceLocation.address.city"], children: text(bill.serviceLocation?.address?.city, (city) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city, state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
2756
+ /* @__PURE__ */ jsx4(Field2, { path: "serviceLocation.address.state", label: "Service state", required: true, error: errors["serviceLocation.address.state"], children: text(bill.serviceLocation?.address?.state, (state) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.serviceLocation?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
2757
+ /* @__PURE__ */ jsx4(Field2, { path: "serviceLocation.address.postalCode", label: "Service ZIP", required: true, error: errors["serviceLocation.address.postalCode"], children: text(bill.serviceLocation?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode } } }))) })
2333
2758
  ] })
2334
2759
  ] });
2335
- const serviceLinesSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
2336
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
2337
- /* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
2338
- /* @__PURE__ */ jsx3("div", { className: "mbsf-segments", role: "group", "aria-label": "Evaluation type", children: [["qme", "QME (default)"], ["ame", "AME"], ["psych_qme", "Psych QME"]].map(([type, label]) => /* @__PURE__ */ jsx3("button", { className: "mbsf-segment", type: "button", "aria-pressed": evaluationType === type, onClick: () => changeEvaluation(type), children: label }, type)) }),
2339
- /* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: evaluationType === "ame" ? "Agreed Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -94." : evaluationType === "psych_qme" ? "Psychiatric QME \u2014 eligible ML evaluation codes default to modifier -96 (-95 for ML200)." : "Qualified Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -95." }),
2340
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
2341
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-line-head", children: [
2342
- /* @__PURE__ */ jsxs3("span", { children: [
2760
+ const serviceLinesSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2761
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
2762
+ /* @__PURE__ */ jsx4("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
2763
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-segments", role: "group", "aria-label": "Evaluation type", children: [["qme", "QME (default)"], ["ame", "AME"], ["psych_qme", "Psych QME"]].map(([type, label]) => /* @__PURE__ */ jsx4("button", { className: "mbsf-segment", type: "button", "aria-pressed": evaluationType === type, onClick: () => changeEvaluation(type), children: label }, type)) }),
2764
+ /* @__PURE__ */ jsx4("p", { className: "mbsf-help", children: evaluationType === "ame" ? "Agreed Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -94." : evaluationType === "psych_qme" ? "Psychiatric QME \u2014 eligible ML evaluation codes default to modifier -96 (-95 for ML200)." : "Qualified Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -95." }),
2765
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
2766
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-line-head", children: [
2767
+ /* @__PURE__ */ jsxs4("span", { children: [
2343
2768
  "Procedure code",
2344
- /* @__PURE__ */ jsx3(RequiredMark, {})
2769
+ /* @__PURE__ */ jsx4(RequiredMark, {})
2345
2770
  ] }),
2346
- /* @__PURE__ */ jsx3("span", { children: "Modifiers" }),
2347
- /* @__PURE__ */ jsx3("span", { children: "Dx" }),
2348
- /* @__PURE__ */ jsxs3("span", { children: [
2771
+ /* @__PURE__ */ jsx4("span", { children: "Modifiers" }),
2772
+ /* @__PURE__ */ jsx4("span", { children: "Dx" }),
2773
+ /* @__PURE__ */ jsxs4("span", { children: [
2349
2774
  "Units",
2350
- /* @__PURE__ */ jsx3(RequiredMark, {})
2775
+ /* @__PURE__ */ jsx4(RequiredMark, {})
2351
2776
  ] }),
2352
- /* @__PURE__ */ jsx3("span", { children: "Allowed" }),
2353
- /* @__PURE__ */ jsx3("span", {}),
2777
+ /* @__PURE__ */ jsx4("span", { children: "Allowed" }),
2778
+ /* @__PURE__ */ jsx4("span", {}),
2354
2779
  " "
2355
2780
  ] }),
2356
- bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-line", children: [
2357
- /* @__PURE__ */ jsxs3("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
2358
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Procedure code ${index + 1}`, invalid: Boolean(errors[`serviceLines.${index}.code`]), disabled: locked, value: line.code, placeholder: "Search or enter code\u2026", options: procedures.map((item) => ({ id: item.code, label: item.code, detail: item.description })), createOption: customProcedureOption, onSelect: (option) => {
2781
+ bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs4("div", { className: "mbsf-line", children: [
2782
+ /* @__PURE__ */ jsxs4("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
2783
+ /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: `Procedure code ${index + 1}`, invalid: Boolean(errors[`serviceLines.${index}.code`]), disabled: locked, value: line.code, placeholder: "Search or enter code\u2026", options: procedures.map((item) => ({ id: item.code, label: item.code, detail: item.description })), createOption: customProcedureOption, onSelect: (option) => {
2359
2784
  const auto = evaluationModifier(evaluationType, option.id);
2360
2785
  setLine(index, { code: option.id, ...auto ? { modifiers: [auto, ...(line.modifiers ?? []).filter((item) => !["94", "95", "96"].includes(item.replace(/^-/, "")))] } : line.modifiers ? { modifiers: line.modifiers } : {} });
2361
2786
  } }),
2362
- line.code ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: procedures.find((item) => item.code === line.code)?.description ?? "Custom CPT, HCPCS, or medical-legal code" }) : null,
2363
- errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
2787
+ line.code ? /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: procedures.find((item) => item.code === line.code)?.description ?? "Custom CPT, HCPCS, or medical-legal code" }) : null,
2788
+ errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
2364
2789
  ] }),
2365
- /* @__PURE__ */ jsxs3("div", { "data-label": "Modifiers", children: [
2366
- /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
2790
+ /* @__PURE__ */ jsxs4("div", { "data-label": "Modifiers", children: [
2791
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs4("span", { className: "mbsf-chip", children: [
2367
2792
  "\u2212",
2368
2793
  modifier.replace(/^-/, ""),
2369
- /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
2794
+ /* @__PURE__ */ jsx4("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
2370
2795
  ] }, modifier)) }),
2371
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Modifiers ${index + 1}`, disabled: locked, value: "", placeholder: line.modifiers?.length ?? 0 ? `${line.modifiers.length} modifier${line.modifiers.length === 1 ? "" : "s"}` : "Add modifiers\u2026", options: modifiers.filter((item) => !(line.modifiers ?? []).includes(item.code)).map((item) => ({ id: item.code, label: `\u2212${item.code}`, detail: item.description })), onSelect: (option) => setLine(index, { modifiers: [.../* @__PURE__ */ new Set([...line.modifiers ?? [], option.id])] }) })
2796
+ /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: `Modifiers ${index + 1}`, disabled: locked, value: "", placeholder: line.modifiers?.length ?? 0 ? `${line.modifiers.length} modifier${line.modifiers.length === 1 ? "" : "s"}` : "Add modifiers\u2026", options: modifiers.filter((item) => !(line.modifiers ?? []).includes(item.code)).map((item) => ({ id: item.code, label: `\u2212${item.code}`, detail: item.description })), onSelect: (option) => setLine(index, { modifiers: [.../* @__PURE__ */ new Set([...line.modifiers ?? [], option.id])] }) })
2372
2797
  ] }),
2373
- /* @__PURE__ */ jsx3("div", { "data-label": "Dx", children: /* @__PURE__ */ jsx3("div", { className: "mbsf-dx", children: (bill.diagnoses ?? []).length ? (bill.diagnoses ?? []).map((code, dxIndex) => {
2798
+ /* @__PURE__ */ jsx4("div", { "data-label": "Dx", children: /* @__PURE__ */ jsx4("div", { className: "mbsf-dx", children: (bill.diagnoses ?? []).length ? (bill.diagnoses ?? []).map((code, dxIndex) => {
2374
2799
  const pointer = dxIndex + 1;
2375
2800
  const active = (line.diagnosisPointers ?? []).includes(pointer);
2376
- return /* @__PURE__ */ jsx3("button", { type: "button", className: "mbsf-dx-chip", "data-active": active, title: `${String.fromCharCode(64 + pointer)} \u2014 ${code}`, "aria-pressed": active, "aria-label": `Point line ${index + 1} at diagnosis ${code}`, onClick: () => setLine(index, { diagnosisPointers: active ? (line.diagnosisPointers ?? []).filter((item) => item !== pointer) : [...line.diagnosisPointers ?? [], pointer].sort((left, right) => left - right) }), children: String.fromCharCode(64 + pointer) }, code);
2377
- }) : /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: "Add diagnoses above" }) }) }),
2378
- /* @__PURE__ */ jsxs3("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
2379
- /* @__PURE__ */ jsx3("input", { className: "mbsf-input", "aria-label": `Units ${index + 1}`, "aria-invalid": Boolean(errors[`serviceLines.${index}.units`]), type: "number", min: 1, value: line.units ?? 1, onChange: (event) => setLine(index, { units: Number(event.target.value) }) }),
2380
- errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
2801
+ return /* @__PURE__ */ jsx4("button", { type: "button", className: "mbsf-dx-chip", "data-active": active, title: `${String.fromCharCode(64 + pointer)} \u2014 ${code}`, "aria-pressed": active, "aria-label": `Point line ${index + 1} at diagnosis ${code}`, onClick: () => setLine(index, { diagnosisPointers: active ? (line.diagnosisPointers ?? []).filter((item) => item !== pointer) : [...line.diagnosisPointers ?? [], pointer].sort((left, right) => left - right) }), children: String.fromCharCode(64 + pointer) }, code);
2802
+ }) : /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Add diagnoses above" }) }) }),
2803
+ /* @__PURE__ */ jsxs4("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
2804
+ /* @__PURE__ */ jsx4("input", { className: "mbsf-input", "aria-label": `Units ${index + 1}`, "aria-invalid": Boolean(errors[`serviceLines.${index}.units`]), type: "number", min: 1, value: line.units ?? 1, onChange: (event) => setLine(index, { units: Number(event.target.value) }) }),
2805
+ errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
2381
2806
  ] }),
2382
- /* @__PURE__ */ jsx3("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
2383
- /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove service line ${index + 1}`, disabled: locked || !lineHasContent(line) && index === bill.serviceLines.length - 1, onClick: () => setBill((c) => ({ ...c, serviceLines: ensureTrailingBillSubmissionLine(c.serviceLines.filter((_, itemIndex) => itemIndex !== index)) })), children: "\xD7" })
2807
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
2808
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove service line ${index + 1}`, disabled: locked || !lineHasContent(line) && index === bill.serviceLines.length - 1, onClick: () => setBill((c) => ({ ...c, serviceLines: ensureTrailingBillSubmissionLine(c.serviceLines.filter((_, itemIndex) => itemIndex !== index)) })), children: "\xD7" })
2384
2809
  ] }, index)),
2385
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-total", children: [
2386
- /* @__PURE__ */ jsx3("span", { children: "Total" }),
2387
- /* @__PURE__ */ jsx3("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
2810
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-total", children: [
2811
+ /* @__PURE__ */ jsx4("span", { children: "Total" }),
2812
+ /* @__PURE__ */ jsx4("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
2388
2813
  ] })
2389
2814
  ] }),
2390
- errors.serviceLines ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
2815
+ errors.serviceLines ? /* @__PURE__ */ jsx4("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
2391
2816
  ] });
2392
- const attachmentsSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", "data-field-path": "attachments", "data-invalid": Boolean(errors.attachments), disabled: locked, children: [
2393
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Attachments" }),
2394
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-list", children: [
2817
+ const attachmentsSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", "data-field-path": "attachments", "data-invalid": Boolean(errors.attachments), disabled: locked, children: [
2818
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Attachments" }),
2819
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-list", children: [
2395
2820
  attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
2396
2821
  const auto = attachment.autoAttached || attachment.documentType === "w9";
2397
2822
  const removable = !auto && attachment.removable !== false;
2398
2823
  const reportTypeCode = sourceAttachmentReportTypes[attachment.id] || attachment.reportTypeCode || defaultAttachmentReportType || "";
2399
- return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
2400
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-main", children: [
2401
- auto ? /* @__PURE__ */ jsx3("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
2402
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
2403
- /* @__PURE__ */ jsx3("strong", { children: attachment.fileName }),
2404
- /* @__PURE__ */ jsx3("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
2405
- /* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
2824
+ return /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
2825
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-main", children: [
2826
+ auto ? /* @__PURE__ */ jsx4("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
2827
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-file", children: [
2828
+ /* @__PURE__ */ jsx4("strong", { children: attachment.fileName }),
2829
+ /* @__PURE__ */ jsx4("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
2830
+ /* @__PURE__ */ jsx4("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
2406
2831
  ] })
2407
2832
  ] }),
2408
- showAttachmentReportTypes ? /* @__PURE__ */ jsx3("div", { className: "mbsf-attach-type", children: /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Report type for ${attachment.fileName}`, invalid: !reportTypeCode, disabled: locked, preserveValueOnOpen: true, value: reportTypeCode, placeholder: "Select report type\u2026", options: reportTypeOptions, onSelect: (option) => setSourceAttachmentReportTypes((current) => ({ ...current, [attachment.id]: option.id })) }) }) : null,
2409
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
2410
- attachment.previewUrl ? /* @__PURE__ */ jsx3("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
2411
- removable ? /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
2833
+ showAttachmentReportTypes ? /* @__PURE__ */ jsx4("div", { className: "mbsf-attach-type", children: /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: `Report type for ${attachment.fileName}`, invalid: !reportTypeCode, disabled: locked, preserveValueOnOpen: true, value: reportTypeCode, placeholder: "Select report type\u2026", options: reportTypeOptions, onSelect: (option) => setSourceAttachmentReportTypes((current) => ({ ...current, [attachment.id]: option.id })) }) }) : null,
2834
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-actions", children: [
2835
+ attachment.previewUrl ? /* @__PURE__ */ jsx4("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
2836
+ removable ? /* @__PURE__ */ jsx4("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
2412
2837
  setSelectedIds((current) => current.filter((id) => id !== attachment.id));
2413
2838
  setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
2414
2839
  }, children: "\xD7" }) : null
@@ -2417,35 +2842,35 @@ function BillSubmissionForm({
2417
2842
  }),
2418
2843
  uploads.map((upload, index) => {
2419
2844
  const reportTypeCode = upload.reportTypeCode || defaultAttachmentReportType || "";
2420
- return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", children: [
2421
- /* @__PURE__ */ jsx3("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
2422
- /* @__PURE__ */ jsx3("strong", { children: upload.file.name }),
2423
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-help", style: { display: "block" }, children: [
2845
+ return /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-row", children: [
2846
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs4("span", { className: "mbsf-file", children: [
2847
+ /* @__PURE__ */ jsx4("strong", { children: upload.file.name }),
2848
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-help", style: { display: "block" }, children: [
2424
2849
  (upload.file.size / 1024 / 1024).toFixed(1),
2425
2850
  " MB"
2426
2851
  ] })
2427
2852
  ] }) }),
2428
- showAttachmentReportTypes ? /* @__PURE__ */ jsx3("div", { className: "mbsf-attach-type", children: /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Report type for ${upload.file.name}`, invalid: !reportTypeCode, disabled: locked, preserveValueOnOpen: true, value: reportTypeCode, placeholder: "Select report type\u2026", options: reportTypeOptions, onSelect: (option) => setUploads((current) => current.map((item, itemIndex) => itemIndex === index ? { ...item, reportTypeCode: option.id } : item)) }) }) : null,
2429
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
2430
- /* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
2431
- /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${upload.file.name}`, onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
2853
+ showAttachmentReportTypes ? /* @__PURE__ */ jsx4("div", { className: "mbsf-attach-type", children: /* @__PURE__ */ jsx4(ComboBox, { ariaLabel: `Report type for ${upload.file.name}`, invalid: !reportTypeCode, disabled: locked, preserveValueOnOpen: true, value: reportTypeCode, placeholder: "Select report type\u2026", options: reportTypeOptions, onSelect: (option) => setUploads((current) => current.map((item, itemIndex) => itemIndex === index ? { ...item, reportTypeCode: option.id } : item)) }) }) : null,
2854
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-actions", children: [
2855
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
2856
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${upload.file.name}`, onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
2432
2857
  ] })
2433
2858
  ] }, `${upload.file.name}-${index}`);
2434
2859
  })
2435
2860
  ] }),
2436
- errors.attachments ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.attachments }) : null,
2437
- /* @__PURE__ */ jsx3("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
2861
+ errors.attachments ? /* @__PURE__ */ jsx4("p", { className: "mbsf-error", role: "alert", children: errors.attachments }) : null,
2862
+ /* @__PURE__ */ jsx4("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
2438
2863
  if (event.target.files) addFiles(event.target.files);
2439
2864
  event.target.value = "";
2440
2865
  } }),
2441
- /* @__PURE__ */ jsx3("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs3("span", { children: [
2442
- /* @__PURE__ */ jsx3("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
2443
- /* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
2866
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs4("span", { children: [
2867
+ /* @__PURE__ */ jsx4("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
2868
+ /* @__PURE__ */ jsx4("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
2444
2869
  ] }) })
2445
2870
  ] });
2446
- const actionsSection = /* @__PURE__ */ jsxs3(Fragment2, { children: [
2447
- formError ? /* @__PURE__ */ jsx3("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
2448
- /* @__PURE__ */ jsx3("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx3("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
2871
+ const actionsSection = /* @__PURE__ */ jsxs4(Fragment3, { children: [
2872
+ formError ? /* @__PURE__ */ jsx4("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
2873
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx4("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
2449
2874
  ] });
2450
2875
  const sections = {
2451
2876
  header: headerSection,
@@ -2456,28 +2881,46 @@ function BillSubmissionForm({
2456
2881
  attachments: attachmentsSection,
2457
2882
  actions: actionsSection
2458
2883
  };
2459
- const defaultLayout = /* @__PURE__ */ jsxs3(Fragment2, { children: [
2460
- /* @__PURE__ */ jsx3(BillSubmissionHeader, {}),
2461
- /* @__PURE__ */ jsx3(BillSubmissionPatientSection, {}),
2462
- /* @__PURE__ */ jsx3(BillSubmissionClaimSection, {}),
2463
- /* @__PURE__ */ jsx3(BillSubmissionProvidersSection, {}),
2464
- /* @__PURE__ */ jsx3(BillSubmissionServiceLinesSection, {}),
2465
- /* @__PURE__ */ jsx3(BillSubmissionAttachmentsSection, {}),
2466
- /* @__PURE__ */ jsx3(BillSubmissionActions, {})
2884
+ const defaultLayout = /* @__PURE__ */ jsxs4(Fragment3, { children: [
2885
+ /* @__PURE__ */ jsx4(BillSubmissionHeader, {}),
2886
+ /* @__PURE__ */ jsx4(BillSubmissionPatientSection, {}),
2887
+ /* @__PURE__ */ jsx4(BillSubmissionClaimSection, {}),
2888
+ /* @__PURE__ */ jsx4(BillSubmissionProvidersSection, {}),
2889
+ /* @__PURE__ */ jsx4(BillSubmissionServiceLinesSection, {}),
2890
+ /* @__PURE__ */ jsx4(BillSubmissionAttachmentsSection, {}),
2891
+ /* @__PURE__ */ jsx4(BillSubmissionActions, {})
2467
2892
  ] });
2468
- return /* @__PURE__ */ jsx3(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs3("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
2893
+ return /* @__PURE__ */ jsx4(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs4("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
2469
2894
  event.preventDefault();
2470
2895
  void submit();
2471
2896
  }, noValidate: true, children: [
2472
- /* @__PURE__ */ jsx3("style", { children: css }),
2473
- children ?? defaultLayout
2897
+ /* @__PURE__ */ jsx4("style", { children: css2 }),
2898
+ children ?? defaultLayout,
2899
+ routeDialog ? /* @__PURE__ */ jsx4(
2900
+ SendRouteDialog,
2901
+ {
2902
+ title: "Send bill",
2903
+ delivery: routeDialog.delivery,
2904
+ submitting,
2905
+ error: routeError,
2906
+ onCancel: () => {
2907
+ if (!submitting) {
2908
+ setRouteDialog(null);
2909
+ setRouteError(null);
2910
+ }
2911
+ },
2912
+ onConfirm: (submission) => {
2913
+ void performConnectedSubmit(routeDialog.complete, submission);
2914
+ }
2915
+ }
2916
+ ) : null
2474
2917
  ] }) });
2475
2918
  }
2476
2919
 
2477
2920
  // src/billing-dashboard.tsx
2478
- import { useMemo as useMemo3, useState as useState4 } from "react";
2479
- import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
2480
- var css2 = `
2921
+ import { useMemo as useMemo4, useState as useState5 } from "react";
2922
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2923
+ var css3 = `
2481
2924
  .mbdash{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbdash *{box-sizing:border-box}.mbdash h2,.mbdash h3,.mbdash p{margin:0}.mbdash-copy{color:var(--mb-muted);margin-top:5px!important}.mbdash-card{min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow)}
2482
2925
  .mbdash-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}.mbdash-head h2{font-size:24px}.mbdash-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden}.mbdash-stat{display:grid;gap:7px;padding:20px 22px;border-right:1px solid var(--mb-border)}.mbdash-stat:last-child{border:0}.mbdash-label{color:var(--mb-muted);font-size:12px;font-weight:760;letter-spacing:.06em;text-transform:uppercase}.mbdash-value{font-size:24px;font-weight:780;font-variant-numeric:tabular-nums}.mbdash-aging{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden}.mbdash-aging-item{display:grid;gap:5px;padding:16px 20px;border-right:1px solid var(--mb-border)}.mbdash-aging-item:last-child{border:0}.mbdash-aging-item strong{font-size:18px;font-variant-numeric:tabular-nums}.mbdash-aging-item span:last-child{color:var(--mb-muted);font-size:13px}
2483
2926
  .mbdash-filters{display:grid;grid-template-columns:minmax(240px,1fr) minmax(180px,260px);gap:12px}.mbdash-control{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbdash-control:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
@@ -2528,63 +2971,63 @@ function summarizeBillingDashboard(bills, now = /* @__PURE__ */ new Date()) {
2528
2971
  return { totalBilled, totalPaid, outstanding, openCount, bills: bills.length, aging };
2529
2972
  }
2530
2973
  function Shell({ appearance, className = "", style, children }) {
2531
- return /* @__PURE__ */ jsxs4("div", { className: `mbdash ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
2532
- /* @__PURE__ */ jsx4("style", { children: css2 }),
2974
+ return /* @__PURE__ */ jsxs5("div", { className: `mbdash ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
2975
+ /* @__PURE__ */ jsx5("style", { children: css3 }),
2533
2976
  children
2534
2977
  ] });
2535
2978
  }
2536
2979
  function BillIdentity({ bill }) {
2537
2980
  const label = bill.billNumber == null ? bill.externalId ?? "Bill" : `Bill #${bill.billNumber}`;
2538
- const content = /* @__PURE__ */ jsxs4(Fragment3, { children: [
2539
- /* @__PURE__ */ jsx4("span", { className: "mbdash-primary", children: label }),
2540
- /* @__PURE__ */ jsx4("span", { className: "mbdash-secondary", children: [bill.patientName, bill.claimNumber ? `Claim ${bill.claimNumber}` : null].filter(Boolean).join(" \xB7 ") })
2981
+ const content = /* @__PURE__ */ jsxs5(Fragment4, { children: [
2982
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-primary", children: label }),
2983
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-secondary", children: [bill.patientName, bill.claimNumber ? `Claim ${bill.claimNumber}` : null].filter(Boolean).join(" \xB7 ") })
2541
2984
  ] });
2542
- return bill.href ? /* @__PURE__ */ jsx4("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx4(Fragment3, { children: content });
2985
+ return bill.href ? /* @__PURE__ */ jsx5("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx5(Fragment4, { children: content });
2543
2986
  }
2544
2987
  function BillListContent({ bills, onSelectBill, emptyState = "No bills match these filters." }) {
2545
- if (!bills.length) return /* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-empty", children: emptyState });
2546
- return /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
2547
- /* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
2548
- /* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
2549
- /* @__PURE__ */ jsx4("th", { children: "Bill" }),
2550
- /* @__PURE__ */ jsx4("th", { children: "Payer" }),
2551
- /* @__PURE__ */ jsx4("th", { children: "Status" }),
2552
- /* @__PURE__ */ jsx4("th", { children: "Age" }),
2553
- /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
2554
- /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
2555
- /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
2988
+ if (!bills.length) return /* @__PURE__ */ jsx5("div", { className: "mbdash-card mbdash-empty", children: emptyState });
2989
+ return /* @__PURE__ */ jsxs5("div", { className: "mbdash-card", children: [
2990
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs5("table", { className: "mbdash-table", children: [
2991
+ /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsxs5("tr", { children: [
2992
+ /* @__PURE__ */ jsx5("th", { children: "Bill" }),
2993
+ /* @__PURE__ */ jsx5("th", { children: "Payer" }),
2994
+ /* @__PURE__ */ jsx5("th", { children: "Status" }),
2995
+ /* @__PURE__ */ jsx5("th", { children: "Age" }),
2996
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Billed" }),
2997
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Paid" }),
2998
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Balance" })
2556
2999
  ] }) }),
2557
- /* @__PURE__ */ jsx4("tbody", { children: bills.map((bill) => /* @__PURE__ */ jsxs4("tr", { "data-clickable": Boolean(onSelectBill), onClick: () => onSelectBill?.(bill), children: [
2558
- /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
2559
- /* @__PURE__ */ jsx4("td", { children: bill.payerName || "\u2014" }),
2560
- /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) }) }),
2561
- /* @__PURE__ */ jsxs4("td", { children: [
3000
+ /* @__PURE__ */ jsx5("tbody", { children: bills.map((bill) => /* @__PURE__ */ jsxs5("tr", { "data-clickable": Boolean(onSelectBill), onClick: () => onSelectBill?.(bill), children: [
3001
+ /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5(BillIdentity, { bill }) }),
3002
+ /* @__PURE__ */ jsx5("td", { children: bill.payerName || "\u2014" }),
3003
+ /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5("span", { className: "mbdash-state", children: stateLabel(bill.state) }) }),
3004
+ /* @__PURE__ */ jsxs5("td", { children: [
2562
3005
  billAgingDays(bill),
2563
3006
  " days"
2564
3007
  ] }),
2565
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalCharge) }),
2566
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalPaid) }),
2567
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) }) })
3008
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(bill.totalCharge) }),
3009
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(bill.totalPaid) }),
3010
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: /* @__PURE__ */ jsx5("strong", { children: money3(bill.balanceDue) }) })
2568
3011
  ] }, bill.id)) })
2569
3012
  ] }) }),
2570
- /* @__PURE__ */ jsx4("div", { className: "mbdash-mobile-list", children: bills.map((bill) => /* @__PURE__ */ jsxs4("article", { className: "mbdash-mobile-card", onClick: () => onSelectBill?.(bill), children: [
2571
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-top", children: [
2572
- /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
2573
- /* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) })
3013
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-mobile-list", children: bills.map((bill) => /* @__PURE__ */ jsxs5("article", { className: "mbdash-mobile-card", onClick: () => onSelectBill?.(bill), children: [
3014
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-mobile-top", children: [
3015
+ /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(BillIdentity, { bill }) }),
3016
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-state", children: stateLabel(bill.state) })
2574
3017
  ] }),
2575
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-money", children: [
2576
- /* @__PURE__ */ jsxs4("span", { children: [
2577
- /* @__PURE__ */ jsx4("small", { children: "Age" }),
3018
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-mobile-money", children: [
3019
+ /* @__PURE__ */ jsxs5("span", { children: [
3020
+ /* @__PURE__ */ jsx5("small", { children: "Age" }),
2578
3021
  billAgingDays(bill),
2579
3022
  " days"
2580
3023
  ] }),
2581
- /* @__PURE__ */ jsxs4("span", { children: [
2582
- /* @__PURE__ */ jsx4("small", { children: "Paid" }),
3024
+ /* @__PURE__ */ jsxs5("span", { children: [
3025
+ /* @__PURE__ */ jsx5("small", { children: "Paid" }),
2583
3026
  money3(bill.totalPaid)
2584
3027
  ] }),
2585
- /* @__PURE__ */ jsxs4("span", { children: [
2586
- /* @__PURE__ */ jsx4("small", { children: "Balance" }),
2587
- /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) })
3028
+ /* @__PURE__ */ jsxs5("span", { children: [
3029
+ /* @__PURE__ */ jsx5("small", { children: "Balance" }),
3030
+ /* @__PURE__ */ jsx5("strong", { children: money3(bill.balanceDue) })
2588
3031
  ] })
2589
3032
  ] })
2590
3033
  ] }, bill.id)) })
@@ -2596,37 +3039,37 @@ function BillList(props) {
2596
3039
  ...props.className === void 0 ? {} : { className: props.className },
2597
3040
  ...props.style === void 0 ? {} : { style: props.style }
2598
3041
  };
2599
- return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(BillListContent, { ...props }) });
3042
+ return /* @__PURE__ */ jsx5(Shell, { ...shellProps, children: /* @__PURE__ */ jsx5(BillListContent, { ...props }) });
2600
3043
  }
2601
3044
  function AgingContent({ bills, heading = "Accounts receivable" }) {
2602
- const summary = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
2603
- return /* @__PURE__ */ jsxs4(Fragment3, { children: [
2604
- /* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
2605
- /* @__PURE__ */ jsx4("h2", { children: heading }),
2606
- /* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: "Current balances and aging at a glance." })
3045
+ const summary = useMemo4(() => summarizeBillingDashboard(bills), [bills]);
3046
+ return /* @__PURE__ */ jsxs5(Fragment4, { children: [
3047
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs5("div", { children: [
3048
+ /* @__PURE__ */ jsx5("h2", { children: heading }),
3049
+ /* @__PURE__ */ jsx5("p", { className: "mbdash-copy", children: "Current balances and aging at a glance." })
2607
3050
  ] }) }),
2608
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-card mbdash-summary", children: [
2609
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2610
- /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Outstanding" }),
2611
- /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.outstanding) })
3051
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-card mbdash-summary", children: [
3052
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3053
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Outstanding" }),
3054
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: money3(summary.outstanding) })
2612
3055
  ] }),
2613
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2614
- /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Open bills" }),
2615
- /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: summary.openCount })
3056
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3057
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Open bills" }),
3058
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: summary.openCount })
2616
3059
  ] }),
2617
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2618
- /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Collected" }),
2619
- /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalPaid) })
3060
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3061
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Collected" }),
3062
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: money3(summary.totalPaid) })
2620
3063
  ] }),
2621
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2622
- /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Total billed" }),
2623
- /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalBilled) })
3064
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3065
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Total billed" }),
3066
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: money3(summary.totalBilled) })
2624
3067
  ] })
2625
3068
  ] }),
2626
- /* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-aging", children: summary.aging.map((bucket) => /* @__PURE__ */ jsxs4("div", { className: "mbdash-aging-item", children: [
2627
- /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: bucket.label }),
2628
- /* @__PURE__ */ jsx4("strong", { children: money3(bucket.balance) }),
2629
- /* @__PURE__ */ jsxs4("span", { children: [
3069
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-card mbdash-aging", children: summary.aging.map((bucket) => /* @__PURE__ */ jsxs5("div", { className: "mbdash-aging-item", children: [
3070
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: bucket.label }),
3071
+ /* @__PURE__ */ jsx5("strong", { children: money3(bucket.balance) }),
3072
+ /* @__PURE__ */ jsxs5("span", { children: [
2630
3073
  bucket.count,
2631
3074
  " bill",
2632
3075
  bucket.count === 1 ? "" : "s"
@@ -2640,13 +3083,13 @@ function BillAgingSummary(props) {
2640
3083
  ...props.className === void 0 ? {} : { className: props.className },
2641
3084
  ...props.style === void 0 ? {} : { style: props.style }
2642
3085
  };
2643
- return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
3086
+ return /* @__PURE__ */ jsx5(Shell, { ...shellProps, children: /* @__PURE__ */ jsx5(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
2644
3087
  }
2645
3088
  function BillingDashboard({ bills, heading = "Billing", description = "Track submitted bills, payments, and outstanding balances.", onSelectBill, initialSearch = "", initialState = "all", hideFilters = false, appearance, className, style }) {
2646
- const [search, setSearch] = useState4(initialSearch);
2647
- const [state, setState] = useState4(initialState);
2648
- const states = useMemo3(() => [...new Set(bills.map((bill) => bill.state))].sort((a, b) => a.localeCompare(b)), [bills]);
2649
- const filtered = useMemo3(() => {
3089
+ const [search, setSearch] = useState5(initialSearch);
3090
+ const [state, setState] = useState5(initialState);
3091
+ const states = useMemo4(() => [...new Set(bills.map((bill) => bill.state))].sort((a, b) => a.localeCompare(b)), [bills]);
3092
+ const filtered = useMemo4(() => {
2650
3093
  const query = search.trim().toLowerCase();
2651
3094
  return bills.filter((bill) => (state === "all" || bill.state === state) && (!query || [bill.billNumber, bill.externalId, bill.patientName, bill.claimNumber, bill.payerName, bill.workItemLabel].some((value) => String(value ?? "").toLowerCase().includes(query))));
2652
3095
  }, [bills, search, state]);
@@ -2656,20 +3099,20 @@ function BillingDashboard({ bills, heading = "Billing", description = "Track sub
2656
3099
  ...style === void 0 ? {} : { style }
2657
3100
  };
2658
3101
  const listProps = { bills: filtered, ...onSelectBill === void 0 ? {} : { onSelectBill } };
2659
- return /* @__PURE__ */ jsxs4(Shell, { ...shellProps, children: [
2660
- /* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
2661
- /* @__PURE__ */ jsx4("h2", { children: heading }),
2662
- /* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
3102
+ return /* @__PURE__ */ jsxs5(Shell, { ...shellProps, children: [
3103
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs5("div", { children: [
3104
+ /* @__PURE__ */ jsx5("h2", { children: heading }),
3105
+ /* @__PURE__ */ jsx5("p", { className: "mbdash-copy", children: description })
2663
3106
  ] }) }),
2664
- /* @__PURE__ */ jsx4(AgingContent, { bills: filtered, heading: "Receivables" }),
2665
- hideFilters ? null : /* @__PURE__ */ jsxs4("div", { className: "mbdash-filters", children: [
2666
- /* @__PURE__ */ jsx4("input", { className: "mbdash-control", type: "search", value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search patient, claim, payer, or bill\u2026", "aria-label": "Search bills" }),
2667
- /* @__PURE__ */ jsxs4("select", { className: "mbdash-control", value: state, onChange: (event) => setState(event.target.value), "aria-label": "Filter bills by status", children: [
2668
- /* @__PURE__ */ jsx4("option", { value: "all", children: "All statuses" }),
2669
- states.map((item) => /* @__PURE__ */ jsx4("option", { value: item, children: stateLabel(item) }, item))
3107
+ /* @__PURE__ */ jsx5(AgingContent, { bills: filtered, heading: "Receivables" }),
3108
+ hideFilters ? null : /* @__PURE__ */ jsxs5("div", { className: "mbdash-filters", children: [
3109
+ /* @__PURE__ */ jsx5("input", { className: "mbdash-control", type: "search", value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search patient, claim, payer, or bill\u2026", "aria-label": "Search bills" }),
3110
+ /* @__PURE__ */ jsxs5("select", { className: "mbdash-control", value: state, onChange: (event) => setState(event.target.value), "aria-label": "Filter bills by status", children: [
3111
+ /* @__PURE__ */ jsx5("option", { value: "all", children: "All statuses" }),
3112
+ states.map((item) => /* @__PURE__ */ jsx5("option", { value: item, children: stateLabel(item) }, item))
2670
3113
  ] })
2671
3114
  ] }),
2672
- /* @__PURE__ */ jsx4(BillListContent, { ...listProps })
3115
+ /* @__PURE__ */ jsx5(BillListContent, { ...listProps })
2673
3116
  ] });
2674
3117
  }
2675
3118
  function buildBillingReportRows(bills, groupBy = "status") {
@@ -2691,46 +3134,46 @@ function buildBillingReportCsv(bills, groupBy = "status") {
2691
3134
  return [["Group", "Bills", "Total billed", "Total paid", "Balance due"].map(escape).join(","), ...buildBillingReportRows(bills, groupBy).map((row) => [row.label, row.billCount, row.totalBilled.toFixed(2), row.totalPaid.toFixed(2), row.balanceDue.toFixed(2)].map(escape).join(","))].join("\n");
2692
3135
  }
2693
3136
  function BillingReport({ bills, groupBy = "status", heading = "Billing report", description = "Billed, paid, and outstanding totals.", appearance, className, style }) {
2694
- const rows = useMemo3(() => buildBillingReportRows(bills, groupBy), [bills, groupBy]);
2695
- const total = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
3137
+ const rows = useMemo4(() => buildBillingReportRows(bills, groupBy), [bills, groupBy]);
3138
+ const total = useMemo4(() => summarizeBillingDashboard(bills), [bills]);
2696
3139
  const shellProps = {
2697
3140
  ...appearance === void 0 ? {} : { appearance },
2698
3141
  className: `mbdash-report ${className ?? ""}`.trim(),
2699
3142
  ...style === void 0 ? {} : { style }
2700
3143
  };
2701
- return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
2702
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-report-head", children: [
2703
- /* @__PURE__ */ jsxs4("div", { children: [
2704
- /* @__PURE__ */ jsx4("h2", { children: heading }),
2705
- /* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
3144
+ return /* @__PURE__ */ jsx5(Shell, { ...shellProps, children: /* @__PURE__ */ jsxs5("div", { className: "mbdash-card", children: [
3145
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-report-head", children: [
3146
+ /* @__PURE__ */ jsxs5("div", { children: [
3147
+ /* @__PURE__ */ jsx5("h2", { children: heading }),
3148
+ /* @__PURE__ */ jsx5("p", { className: "mbdash-copy", children: description })
2706
3149
  ] }),
2707
- /* @__PURE__ */ jsxs4("span", { className: "mbdash-state", children: [
3150
+ /* @__PURE__ */ jsxs5("span", { className: "mbdash-state", children: [
2708
3151
  "By ",
2709
3152
  groupBy
2710
3153
  ] })
2711
3154
  ] }),
2712
- /* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
2713
- /* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
2714
- /* @__PURE__ */ jsx4("th", { children: "Group" }),
2715
- /* @__PURE__ */ jsx4("th", { children: "Bills" }),
2716
- /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
2717
- /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
2718
- /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
3155
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs5("table", { className: "mbdash-table", children: [
3156
+ /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsxs5("tr", { children: [
3157
+ /* @__PURE__ */ jsx5("th", { children: "Group" }),
3158
+ /* @__PURE__ */ jsx5("th", { children: "Bills" }),
3159
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Billed" }),
3160
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Paid" }),
3161
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Balance" })
2719
3162
  ] }) }),
2720
- /* @__PURE__ */ jsxs4("tbody", { children: [
2721
- rows.map((row) => /* @__PURE__ */ jsxs4("tr", { children: [
2722
- /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("strong", { children: row.label }) }),
2723
- /* @__PURE__ */ jsx4("td", { children: row.billCount }),
2724
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalBilled) }),
2725
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalPaid) }),
2726
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.balanceDue) })
3163
+ /* @__PURE__ */ jsxs5("tbody", { children: [
3164
+ rows.map((row) => /* @__PURE__ */ jsxs5("tr", { children: [
3165
+ /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5("strong", { children: row.label }) }),
3166
+ /* @__PURE__ */ jsx5("td", { children: row.billCount }),
3167
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(row.totalBilled) }),
3168
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(row.totalPaid) }),
3169
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(row.balanceDue) })
2727
3170
  ] }, row.key)),
2728
- /* @__PURE__ */ jsxs4("tr", { className: "mbdash-report-total", children: [
2729
- /* @__PURE__ */ jsx4("td", { children: "Total" }),
2730
- /* @__PURE__ */ jsx4("td", { children: total.bills }),
2731
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalBilled) }),
2732
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalPaid) }),
2733
- /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.outstanding) })
3171
+ /* @__PURE__ */ jsxs5("tr", { className: "mbdash-report-total", children: [
3172
+ /* @__PURE__ */ jsx5("td", { children: "Total" }),
3173
+ /* @__PURE__ */ jsx5("td", { children: total.bills }),
3174
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(total.totalBilled) }),
3175
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(total.totalPaid) }),
3176
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(total.outstanding) })
2734
3177
  ] })
2735
3178
  ] })
2736
3179
  ] }) })
@@ -2738,8 +3181,8 @@ function BillingReport({ bills, groupBy = "status", heading = "Billing report",
2738
3181
  }
2739
3182
 
2740
3183
  // src/status-aging-matrix.tsx
2741
- import { useMemo as useMemo4 } from "react";
2742
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
3184
+ import { useMemo as useMemo5 } from "react";
3185
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2743
3186
  var BILL_STATUS_AGING_BUCKETS = [
2744
3187
  { id: "current", label: "0\u201330 days" },
2745
3188
  { id: "31-60", label: "31\u201360 days" },
@@ -2802,7 +3245,7 @@ function buildBillStatusAgingCsv(bills, stateOrder) {
2802
3245
  lines.push(["Total", ...matrix.columnTotals.map((cell) => cell.count), matrix.grandTotal.count]);
2803
3246
  return [header, ...lines].map((line) => line.map(escape).join(",")).join("\n");
2804
3247
  }
2805
- var css3 = `
3248
+ var css4 = `
2806
3249
  .mbmx{color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbmx *{box-sizing:border-box}.mbmx h2,.mbmx p{margin:0}
2807
3250
  .mbmx-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:16px}.mbmx-head h2{font-size:24px}.mbmx-copy{color:var(--mb-muted);margin-top:5px!important}
2808
3251
  .mbmx-card{border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow);overflow:auto}
@@ -2831,9 +3274,9 @@ function BillStatusAgingMatrix({
2831
3274
  className = "",
2832
3275
  style
2833
3276
  }) {
2834
- const matrix = useMemo4(() => buildBillStatusAgingMatrix(bills, stateOrder), [bills, stateOrder]);
3277
+ const matrix = useMemo5(() => buildBillStatusAgingMatrix(bills, stateOrder), [bills, stateOrder]);
2835
3278
  const clickable = Boolean(onSelectCell);
2836
- const cell = (data, key, isTotal = false) => /* @__PURE__ */ jsx5("td", { className: isTotal ? "mbmx-rowtotal" : void 0, children: /* @__PURE__ */ jsxs5(
3279
+ const cell = (data, key, isTotal = false) => /* @__PURE__ */ jsx6("td", { className: isTotal ? "mbmx-rowtotal" : void 0, children: /* @__PURE__ */ jsxs6(
2837
3280
  "button",
2838
3281
  {
2839
3282
  type: "button",
@@ -2843,31 +3286,31 @@ function BillStatusAgingMatrix({
2843
3286
  disabled: !clickable || data.count === 0,
2844
3287
  "aria-label": `${stateLabel2(data.state)} \xB7 ${data.bucket === "total" ? "all ages" : data.bucket}: ${data.count} bills`,
2845
3288
  children: [
2846
- /* @__PURE__ */ jsx5("span", { className: `mbmx-count ${data.count === 0 ? "mbmx-zero" : ""}`.trim(), children: data.count === 0 ? "\u2014" : data.count }),
2847
- showBalances && data.count > 0 ? /* @__PURE__ */ jsx5("span", { className: "mbmx-balance", children: money4(data.balance) }) : null
3289
+ /* @__PURE__ */ jsx6("span", { className: `mbmx-count ${data.count === 0 ? "mbmx-zero" : ""}`.trim(), children: data.count === 0 ? "\u2014" : data.count }),
3290
+ showBalances && data.count > 0 ? /* @__PURE__ */ jsx6("span", { className: "mbmx-balance", children: money4(data.balance) }) : null
2848
3291
  ]
2849
3292
  }
2850
3293
  ) }, key);
2851
- return /* @__PURE__ */ jsxs5("div", { className: `mbmx ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
2852
- /* @__PURE__ */ jsx5("style", { children: css3 }),
2853
- /* @__PURE__ */ jsx5("div", { className: "mbmx-head", children: /* @__PURE__ */ jsxs5("div", { children: [
2854
- /* @__PURE__ */ jsx5("h2", { children: heading }),
2855
- /* @__PURE__ */ jsx5("p", { className: "mbmx-copy", children: description })
3294
+ return /* @__PURE__ */ jsxs6("div", { className: `mbmx ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
3295
+ /* @__PURE__ */ jsx6("style", { children: css4 }),
3296
+ /* @__PURE__ */ jsx6("div", { className: "mbmx-head", children: /* @__PURE__ */ jsxs6("div", { children: [
3297
+ /* @__PURE__ */ jsx6("h2", { children: heading }),
3298
+ /* @__PURE__ */ jsx6("p", { className: "mbmx-copy", children: description })
2856
3299
  ] }) }),
2857
- /* @__PURE__ */ jsx5("div", { className: "mbmx-card", children: /* @__PURE__ */ jsxs5("table", { className: "mbmx-table", children: [
2858
- /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsxs5("tr", { children: [
2859
- /* @__PURE__ */ jsx5("th", { children: "Status" }),
2860
- BILL_STATUS_AGING_BUCKETS.map((bucket) => /* @__PURE__ */ jsx5("th", { children: bucket.label }, bucket.id)),
2861
- /* @__PURE__ */ jsx5("th", { children: "Total" })
3300
+ /* @__PURE__ */ jsx6("div", { className: "mbmx-card", children: /* @__PURE__ */ jsxs6("table", { className: "mbmx-table", children: [
3301
+ /* @__PURE__ */ jsx6("thead", { children: /* @__PURE__ */ jsxs6("tr", { children: [
3302
+ /* @__PURE__ */ jsx6("th", { children: "Status" }),
3303
+ BILL_STATUS_AGING_BUCKETS.map((bucket) => /* @__PURE__ */ jsx6("th", { children: bucket.label }, bucket.id)),
3304
+ /* @__PURE__ */ jsx6("th", { children: "Total" })
2862
3305
  ] }) }),
2863
- /* @__PURE__ */ jsxs5("tbody", { children: [
2864
- matrix.rows.map((row) => /* @__PURE__ */ jsxs5("tr", { children: [
2865
- /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5("span", { className: "mbmx-state", children: row.label }) }),
3306
+ /* @__PURE__ */ jsxs6("tbody", { children: [
3307
+ matrix.rows.map((row) => /* @__PURE__ */ jsxs6("tr", { children: [
3308
+ /* @__PURE__ */ jsx6("td", { children: /* @__PURE__ */ jsx6("span", { className: "mbmx-state", children: row.label }) }),
2866
3309
  row.cells.map((data) => cell(data, `${row.state}-${data.bucket}`)),
2867
3310
  cell(row.total, `${row.state}-total`, true)
2868
3311
  ] }, row.state)),
2869
- /* @__PURE__ */ jsxs5("tr", { className: "mbmx-total", children: [
2870
- /* @__PURE__ */ jsx5("td", { children: "Total" }),
3312
+ /* @__PURE__ */ jsxs6("tr", { className: "mbmx-total", children: [
3313
+ /* @__PURE__ */ jsx6("td", { children: "Total" }),
2871
3314
  matrix.columnTotals.map((data) => cell(data, `all-${data.bucket}`)),
2872
3315
  cell(matrix.grandTotal, "all-total", true)
2873
3316
  ] })
@@ -2877,18 +3320,18 @@ function BillStatusAgingMatrix({
2877
3320
  }
2878
3321
 
2879
3322
  // src/organization-onboarding.tsx
2880
- import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef3, useState as useState5 } from "react";
3323
+ import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, useState as useState6 } from "react";
2881
3324
  import {
2882
3325
  createOrganizationClient
2883
3326
  } from "@mindbill/browser";
2884
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
3327
+ import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2885
3328
  var STEPS = [
2886
3329
  { id: "practice", label: "Practice & billing" },
2887
3330
  { id: "locations", label: "Locations" },
2888
3331
  { id: "w9", label: "W-9" },
2889
3332
  { id: "review", label: "Review" }
2890
3333
  ];
2891
- var css4 = `
3334
+ var css5 = `
2892
3335
  .mbob{color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbob *{box-sizing:border-box}.mbob h2,.mbob h3,.mbob p{margin:0}
2893
3336
  .mbob-card{border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow);padding:24px}
2894
3337
  .mbob-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:18px}.mbob-head h2{font-size:22px}.mbob-copy{color:var(--mb-muted);margin-top:5px!important}
@@ -2944,7 +3387,7 @@ function OrganizationOnboarding({
2944
3387
  onCompleted,
2945
3388
  onError
2946
3389
  }) {
2947
- const client = useMemo5(
3390
+ const client = useMemo6(
2948
3391
  () => createOrganizationClient({
2949
3392
  sessionEndpoint,
2950
3393
  ...getSession ? { getSession } : {},
@@ -2952,16 +3395,16 @@ function OrganizationOnboarding({
2952
3395
  }),
2953
3396
  [sessionEndpoint, getSession, apiBaseUrl]
2954
3397
  );
2955
- const [profile, setProfile] = useState5(null);
2956
- const [loadError, setLoadError] = useState5(null);
2957
- const [step, setStep] = useState5("practice");
2958
- const [identity, setIdentity] = useState5({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
2959
- const [provider, setProvider] = useState5({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
2960
- const [locations, setLocations] = useState5([blankLocation()]);
2961
- const [w9File, setW9File] = useState5(null);
2962
- const [saving, setSaving] = useState5(false);
2963
- const [error, setError] = useState5(null);
2964
- const [savedStep, setSavedStep] = useState5({});
3398
+ const [profile, setProfile] = useState6(null);
3399
+ const [loadError, setLoadError] = useState6(null);
3400
+ const [step, setStep] = useState6("practice");
3401
+ const [identity, setIdentity] = useState6({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
3402
+ const [provider, setProvider] = useState6({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
3403
+ const [locations, setLocations] = useState6([blankLocation()]);
3404
+ const [w9File, setW9File] = useState6(null);
3405
+ const [saving, setSaving] = useState6(false);
3406
+ const [error, setError] = useState6(null);
3407
+ const [savedStep, setSavedStep] = useState6({});
2965
3408
  const completedFired = useRef3(false);
2966
3409
  const adoptProfile = useCallback2((next) => {
2967
3410
  setProfile(next);
@@ -2980,7 +3423,7 @@ function OrganizationOnboarding({
2980
3423
  onCompleted?.(next);
2981
3424
  }
2982
3425
  }, [onCompleted]);
2983
- useEffect4(() => {
3426
+ useEffect5(() => {
2984
3427
  let alive = true;
2985
3428
  client.getOrganization().then((next) => {
2986
3429
  if (alive) {
@@ -3027,16 +3470,16 @@ function OrganizationOnboarding({
3027
3470
  if (!w9File) throw new Error("Choose the practice W-9 PDF first.");
3028
3471
  return client.saveW9({ filename: w9File.name, contentBase64: await fileToBase64(w9File) });
3029
3472
  }, "w9");
3030
- const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs6("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
3473
+ const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs7("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
3031
3474
  label,
3032
- /* @__PURE__ */ jsx6("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
3475
+ /* @__PURE__ */ jsx7("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
3033
3476
  ] });
3034
3477
  const setLocation = (index, patch) => setLocations((current) => current.map((item, itemIndex) => {
3035
3478
  if (itemIndex !== index) return patch.isPrimary ? { ...item, isPrimary: false } : item;
3036
3479
  return { ...item, ...patch };
3037
3480
  }));
3038
- const practiceSection = /* @__PURE__ */ jsxs6("div", { children: [
3039
- /* @__PURE__ */ jsxs6("div", { className: "mbob-grid", children: [
3481
+ const practiceSection = /* @__PURE__ */ jsxs7("div", { children: [
3482
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-grid", children: [
3040
3483
  field("Practice name", identity.name, (name) => setIdentity((c) => ({ ...c, name }))),
3041
3484
  field("Legal name", identity.legalName, (legalName) => setIdentity((c) => ({ ...c, legalName }))),
3042
3485
  field("Tax ID (EIN)", identity.taxId, (taxId) => setIdentity((c) => ({ ...c, taxId })), false, "94-1234567"),
@@ -3044,8 +3487,8 @@ function OrganizationOnboarding({
3044
3487
  field("Phone", identity.phone, (phone) => setIdentity((c) => ({ ...c, phone }))),
3045
3488
  field("Email", identity.email, (email) => setIdentity((c) => ({ ...c, email })))
3046
3489
  ] }),
3047
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
3048
- /* @__PURE__ */ jsxs6("div", { className: "mbob-grid", children: [
3490
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
3491
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-grid", children: [
3049
3492
  field("Billing provider name", provider.name, (name) => setProvider((c) => ({ ...c, name }))),
3050
3493
  field("Billing tax ID", provider.taxId, (taxId) => setProvider((c) => ({ ...c, taxId }))),
3051
3494
  field("Billing NPI", provider.npi, (npi) => setProvider((c) => ({ ...c, npi }))),
@@ -3055,88 +3498,88 @@ function OrganizationOnboarding({
3055
3498
  field("State", provider.billingState ?? "", (billingState) => setProvider((c) => ({ ...c, billingState: billingState.toUpperCase().slice(0, 2) }))),
3056
3499
  field("ZIP", provider.billingZip ?? "", (billingZip) => setProvider((c) => ({ ...c, billingZip })))
3057
3500
  ] }),
3058
- /* @__PURE__ */ jsxs6("div", { className: "mbob-actions", children: [
3059
- /* @__PURE__ */ jsx6("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
3060
- /* @__PURE__ */ jsx6("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
3501
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-actions", children: [
3502
+ /* @__PURE__ */ jsx7("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
3503
+ /* @__PURE__ */ jsx7("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
3061
3504
  ] })
3062
3505
  ] });
3063
- const locationsSection = /* @__PURE__ */ jsxs6("div", { children: [
3064
- locations.map((location, index) => /* @__PURE__ */ jsxs6("div", { className: "mbob-loc", children: [
3506
+ const locationsSection = /* @__PURE__ */ jsxs7("div", { children: [
3507
+ locations.map((location, index) => /* @__PURE__ */ jsxs7("div", { className: "mbob-loc", children: [
3065
3508
  field("Name", location.name, (name) => setLocation(index, { name })),
3066
3509
  field("Street", location.street, (street) => setLocation(index, { street })),
3067
3510
  field("City", location.city, (city) => setLocation(index, { city })),
3068
3511
  field("State", location.state, (state) => setLocation(index, { state: state.toUpperCase().slice(0, 2) })),
3069
3512
  field("ZIP", location.zip, (zip) => setLocation(index, { zip })),
3070
- /* @__PURE__ */ jsxs6("label", { className: "mbob-primary", children: [
3071
- /* @__PURE__ */ jsx6("input", { type: "radio", name: "mbob-primary", checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
3513
+ /* @__PURE__ */ jsxs7("label", { className: "mbob-primary", children: [
3514
+ /* @__PURE__ */ jsx7("input", { type: "radio", name: "mbob-primary", checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
3072
3515
  " Primary"
3073
3516
  ] }),
3074
- /* @__PURE__ */ jsx6("button", { className: "mbob-remove", type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
3517
+ /* @__PURE__ */ jsx7("button", { className: "mbob-remove", type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
3075
3518
  ] }, location.id ?? index)),
3076
- /* @__PURE__ */ jsx6("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
3077
- /* @__PURE__ */ jsxs6("div", { className: "mbob-actions", children: [
3078
- /* @__PURE__ */ jsx6("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
3079
- /* @__PURE__ */ jsx6("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
3519
+ /* @__PURE__ */ jsx7("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
3520
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-actions", children: [
3521
+ /* @__PURE__ */ jsx7("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
3522
+ /* @__PURE__ */ jsx7("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
3080
3523
  ] })
3081
3524
  ] });
3082
- const w9Section = /* @__PURE__ */ jsxs6("div", { children: [
3083
- profile?.w9 ? /* @__PURE__ */ jsxs6("div", { className: "mbob-w9-current", children: [
3084
- /* @__PURE__ */ jsxs6("div", { children: [
3085
- /* @__PURE__ */ jsx6("strong", { children: profile.w9.filename }),
3086
- /* @__PURE__ */ jsxs6("span", { children: [
3525
+ const w9Section = /* @__PURE__ */ jsxs7("div", { children: [
3526
+ profile?.w9 ? /* @__PURE__ */ jsxs7("div", { className: "mbob-w9-current", children: [
3527
+ /* @__PURE__ */ jsxs7("div", { children: [
3528
+ /* @__PURE__ */ jsx7("strong", { children: profile.w9.filename }),
3529
+ /* @__PURE__ */ jsxs7("span", { children: [
3087
3530
  " \xB7 added ",
3088
3531
  profile.w9.addDate
3089
3532
  ] })
3090
3533
  ] }),
3091
- /* @__PURE__ */ jsx6("span", { children: "Rides on every bill automatically" })
3534
+ /* @__PURE__ */ jsx7("span", { children: "Rides on every bill automatically" })
3092
3535
  ] }) : null,
3093
- /* @__PURE__ */ jsxs6("label", { className: "mbob-drop", children: [
3094
- /* @__PURE__ */ jsx6("input", { type: "file", accept: "application/pdf,.pdf", onChange: (event) => setW9File(event.target.files?.[0] ?? null) }),
3095
- /* @__PURE__ */ jsx6("strong", { children: w9File ? w9File.name : profile?.w9 ? "Replace the W-9 PDF" : "Drop the practice W-9 PDF here, or click to choose" }),
3096
- /* @__PURE__ */ jsx6("span", { children: "The W-9 is auto-attached to every submission." })
3536
+ /* @__PURE__ */ jsxs7("label", { className: "mbob-drop", children: [
3537
+ /* @__PURE__ */ jsx7("input", { type: "file", accept: "application/pdf,.pdf", onChange: (event) => setW9File(event.target.files?.[0] ?? null) }),
3538
+ /* @__PURE__ */ jsx7("strong", { children: w9File ? w9File.name : profile?.w9 ? "Replace the W-9 PDF" : "Drop the practice W-9 PDF here, or click to choose" }),
3539
+ /* @__PURE__ */ jsx7("span", { children: "The W-9 is auto-attached to every submission." })
3097
3540
  ] }),
3098
- /* @__PURE__ */ jsxs6("div", { className: "mbob-actions", children: [
3099
- /* @__PURE__ */ jsx6("span", { className: "mbob-status", children: savedStep["w9"] ? "Saved to MindBill." : "" }),
3100
- /* @__PURE__ */ jsx6("button", { className: "mbob-save", type: "button", disabled: saving || !w9File, onClick: saveW9, children: saving ? "Uploading\u2026" : "Save W-9" })
3541
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-actions", children: [
3542
+ /* @__PURE__ */ jsx7("span", { className: "mbob-status", children: savedStep["w9"] ? "Saved to MindBill." : "" }),
3543
+ /* @__PURE__ */ jsx7("button", { className: "mbob-save", type: "button", disabled: saving || !w9File, onClick: saveW9, children: saving ? "Uploading\u2026" : "Save W-9" })
3101
3544
  ] })
3102
3545
  ] });
3103
- const reviewSection = /* @__PURE__ */ jsxs6("div", { className: "mbob-check", children: [
3104
- (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs6("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
3105
- /* @__PURE__ */ jsx6("i", { children: item.complete ? "\u2713" : "\u2022" }),
3106
- /* @__PURE__ */ jsx6("span", { children: item.label })
3546
+ const reviewSection = /* @__PURE__ */ jsxs7("div", { className: "mbob-check", children: [
3547
+ (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs7("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
3548
+ /* @__PURE__ */ jsx7("i", { children: item.complete ? "\u2713" : "\u2022" }),
3549
+ /* @__PURE__ */ jsx7("span", { children: item.label })
3107
3550
  ] }, item.id)),
3108
- profile?.onboarding.complete ? /* @__PURE__ */ jsx6("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx6("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
3551
+ profile?.onboarding.complete ? /* @__PURE__ */ jsx7("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx7("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
3109
3552
  ] });
3110
3553
  const sections = { practice: practiceSection, locations: locationsSection, w9: w9Section, review: reviewSection };
3111
- return /* @__PURE__ */ jsxs6("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
3112
- /* @__PURE__ */ jsx6("style", { children: css4 }),
3113
- /* @__PURE__ */ jsxs6("div", { className: "mbob-card", children: [
3114
- /* @__PURE__ */ jsx6("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs6("div", { children: [
3115
- /* @__PURE__ */ jsx6("h2", { children: heading }),
3116
- /* @__PURE__ */ jsx6("p", { className: "mbob-copy", children: description })
3554
+ return /* @__PURE__ */ jsxs7("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
3555
+ /* @__PURE__ */ jsx7("style", { children: css5 }),
3556
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-card", children: [
3557
+ /* @__PURE__ */ jsx7("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs7("div", { children: [
3558
+ /* @__PURE__ */ jsx7("h2", { children: heading }),
3559
+ /* @__PURE__ */ jsx7("p", { className: "mbob-copy", children: description })
3117
3560
  ] }) }),
3118
- loadError ? /* @__PURE__ */ jsx6("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
3119
- variant === "onboarding" ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
3120
- /* @__PURE__ */ jsx6("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs6("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
3121
- /* @__PURE__ */ jsx6("i", { children: savedStep[item.id] ? "\u2713" : "" }),
3561
+ loadError ? /* @__PURE__ */ jsx7("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
3562
+ variant === "onboarding" ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
3563
+ /* @__PURE__ */ jsx7("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs7("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
3564
+ /* @__PURE__ */ jsx7("i", { children: savedStep[item.id] ? "\u2713" : "" }),
3122
3565
  item.label
3123
3566
  ] }, item.id)) }),
3124
3567
  sections[step]
3125
- ] }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
3568
+ ] }) : /* @__PURE__ */ jsxs7(Fragment5, { children: [
3126
3569
  practiceSection,
3127
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Locations" }),
3570
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Locations" }),
3128
3571
  locationsSection,
3129
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Practice W-9" }),
3572
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Practice W-9" }),
3130
3573
  w9Section,
3131
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Checklist" }),
3574
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Checklist" }),
3132
3575
  reviewSection
3133
3576
  ] }),
3134
- error ? /* @__PURE__ */ jsx6("div", { className: "mbob-error", role: "alert", children: error }) : null
3577
+ error ? /* @__PURE__ */ jsx7("div", { className: "mbob-error", role: "alert", children: error }) : null
3135
3578
  ] })
3136
3579
  ] });
3137
3580
  }
3138
3581
  function BillingSettings(props) {
3139
- return /* @__PURE__ */ jsx6(
3582
+ return /* @__PURE__ */ jsx7(
3140
3583
  OrganizationOnboarding,
3141
3584
  {
3142
3585
  heading: "Billing settings",
@@ -3150,16 +3593,16 @@ function BillingSettings(props) {
3150
3593
  // src/connected-bill-status.tsx
3151
3594
  import {
3152
3595
  useCallback as useCallback3,
3153
- useEffect as useEffect5,
3154
- useMemo as useMemo6,
3596
+ useEffect as useEffect6,
3597
+ useMemo as useMemo7,
3155
3598
  useRef as useRef4,
3156
- useState as useState6
3599
+ useState as useState7
3157
3600
  } from "react";
3158
3601
  import {
3159
3602
  DEFAULT_API_BASE_URL,
3160
3603
  DEFAULT_SESSION_ENDPOINT
3161
3604
  } from "@mindbill/browser";
3162
- import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
3605
+ import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3163
3606
  var DEFAULT_REFRESH_INTERVAL = 6e4;
3164
3607
  async function responseError(response, fallback) {
3165
3608
  const body = await response.json().catch(() => null);
@@ -3292,23 +3735,23 @@ function useBillStatus({
3292
3735
  initialData = null,
3293
3736
  fetch: fetchOverride
3294
3737
  }) {
3295
- const client = useMemo6(() => createBillStatusClient({
3738
+ const client = useMemo7(() => createBillStatusClient({
3296
3739
  billId,
3297
3740
  sessionEndpoint,
3298
3741
  ...getSession ? { getSession } : {},
3299
3742
  apiBaseUrl,
3300
3743
  ...fetchOverride ? { fetch: fetchOverride } : {}
3301
3744
  }), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
3302
- const [data, setData] = useState6(initialData);
3303
- const [error, setError] = useState6(null);
3304
- const [isLoading, setIsLoading] = useState6(enabled && !initialData);
3305
- const [isRefreshing, setIsRefreshing] = useState6(false);
3745
+ const [data, setData] = useState7(initialData);
3746
+ const [error, setError] = useState7(null);
3747
+ const [isLoading, setIsLoading] = useState7(enabled && !initialData);
3748
+ const [isRefreshing, setIsRefreshing] = useState7(false);
3306
3749
  const dataRef = useRef4(initialData);
3307
3750
  const initialDataRef = useRef4(initialData);
3308
3751
  initialDataRef.current = initialData;
3309
3752
  const activeControllerRef = useRef4(null);
3310
3753
  const requestSequence = useRef4(0);
3311
- useEffect5(() => {
3754
+ useEffect6(() => {
3312
3755
  const seed = initialDataRef.current;
3313
3756
  dataRef.current = seed;
3314
3757
  setData(seed);
@@ -3349,10 +3792,10 @@ function useBillStatus({
3349
3792
  }
3350
3793
  }
3351
3794
  }, [billId, client, enabled]);
3352
- useEffect5(() => {
3795
+ useEffect6(() => {
3353
3796
  if (enabled) void load();
3354
3797
  }, [enabled, load]);
3355
- useEffect5(() => {
3798
+ useEffect6(() => {
3356
3799
  if (!enabled || refreshInterval <= 0) return;
3357
3800
  const timer = window.setInterval(() => void load(), refreshInterval);
3358
3801
  const onFocus = () => void load();
@@ -3380,17 +3823,17 @@ function ConnectedBillStatus({
3380
3823
  }) {
3381
3824
  const status = useBillStatus(options);
3382
3825
  if (status.isLoading && !status.data) {
3383
- return /* @__PURE__ */ jsx7(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx7("div", { role: "status", children: "Loading bill status\u2026" }) });
3826
+ return /* @__PURE__ */ jsx8(Fragment6, { children: loadingFallback ?? /* @__PURE__ */ jsx8("div", { role: "status", children: "Loading bill status\u2026" }) });
3384
3827
  }
3385
3828
  if (status.error && !status.data) {
3386
- return /* @__PURE__ */ jsx7(Fragment5, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs7("div", { role: "alert", children: [
3829
+ return /* @__PURE__ */ jsx8(Fragment6, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs8("div", { role: "alert", children: [
3387
3830
  status.error.message,
3388
3831
  " ",
3389
- /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
3832
+ /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
3390
3833
  ] }) });
3391
3834
  }
3392
3835
  if (!status.data) return null;
3393
- return /* @__PURE__ */ jsx7(
3836
+ return /* @__PURE__ */ jsx8(
3394
3837
  BillStatusSummary,
3395
3838
  {
3396
3839
  status: status.data.state,
@@ -3409,8 +3852,8 @@ function ConnectedBillStatus({
3409
3852
  }
3410
3853
 
3411
3854
  // src/bill-lifecycle-surfaces.tsx
3412
- import { useState as useState7 } from "react";
3413
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3855
+ import { useState as useState8 } from "react";
3856
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3414
3857
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
3415
3858
  return actions.filter((action) => action.enabled || showUnavailable);
3416
3859
  }
@@ -3425,11 +3868,11 @@ function BillLifecycleActions({
3425
3868
  }) {
3426
3869
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
3427
3870
  if (!visible.length) return null;
3428
- return /* @__PURE__ */ jsxs8("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
3429
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3430
- visible.map((action) => /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-action", children: [
3431
- /* @__PURE__ */ jsx8("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
3432
- !action.enabled && action.reason ? /* @__PURE__ */ jsx8("span", { className: "mb-action-reason", children: action.reason }) : null
3871
+ return /* @__PURE__ */ jsxs9("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
3872
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
3873
+ visible.map((action) => /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-action", children: [
3874
+ /* @__PURE__ */ jsx9("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
3875
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx9("span", { className: "mb-action-reason", children: action.reason }) : null
3433
3876
  ] }, action.id))
3434
3877
  ] });
3435
3878
  }
@@ -3459,18 +3902,18 @@ function defaultFormatDate(createdAt) {
3459
3902
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
3460
3903
  }
3461
3904
  function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
3462
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
3463
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3464
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3465
- /* @__PURE__ */ jsx8("strong", { children: "Bill history" }),
3466
- /* @__PURE__ */ jsx8("span", { children: "Submission, payer responses, follow-up, and payments." })
3905
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
3906
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
3907
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
3908
+ /* @__PURE__ */ jsx9("strong", { children: "Bill history" }),
3909
+ /* @__PURE__ */ jsx9("span", { children: "Submission, payer responses, follow-up, and payments." })
3467
3910
  ] }) }),
3468
- !events.length ? /* @__PURE__ */ jsx8("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx8("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs8("li", { className: "mb-activity-item", children: [
3469
- /* @__PURE__ */ jsx8("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
3470
- /* @__PURE__ */ jsxs8("div", { className: "mb-activity-content", children: [
3471
- /* @__PURE__ */ jsx8("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
3472
- event.description ? /* @__PURE__ */ jsx8("p", { children: event.description }) : null,
3473
- /* @__PURE__ */ jsxs8("span", { children: [
3911
+ !events.length ? /* @__PURE__ */ jsx9("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx9("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs9("li", { className: "mb-activity-item", children: [
3912
+ /* @__PURE__ */ jsx9("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
3913
+ /* @__PURE__ */ jsxs9("div", { className: "mb-activity-content", children: [
3914
+ /* @__PURE__ */ jsx9("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
3915
+ event.description ? /* @__PURE__ */ jsx9("p", { children: event.description }) : null,
3916
+ /* @__PURE__ */ jsxs9("span", { children: [
3474
3917
  formatDate(event.createdAt),
3475
3918
  event.actor ? ` \xB7 ${event.actor}` : ""
3476
3919
  ] })
@@ -3484,26 +3927,26 @@ function historyDate(iso) {
3484
3927
  return new Intl.DateTimeFormat("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }).format(parsed);
3485
3928
  }
3486
3929
  function BillHistoryTable({ entries, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref }) {
3487
- const [expanded, setExpanded] = useState7({});
3488
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
3489
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3490
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3491
- /* @__PURE__ */ jsx8("strong", { children: "Bill history" }),
3492
- /* @__PURE__ */ jsx8("span", { children: "Submissions, payer responses, follow-up, and payments." })
3930
+ const [expanded, setExpanded] = useState8({});
3931
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
3932
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
3933
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
3934
+ /* @__PURE__ */ jsx9("strong", { children: "Bill history" }),
3935
+ /* @__PURE__ */ jsx9("span", { children: "Submissions, payer responses, follow-up, and payments." })
3493
3936
  ] }) }),
3494
- !entries.length ? /* @__PURE__ */ jsx8("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs8("div", { className: "mb-history-table", children: [
3495
- /* @__PURE__ */ jsxs8("div", { className: "mb-history-head", "aria-hidden": "true", children: [
3496
- /* @__PURE__ */ jsx8("span", { children: "Date" }),
3497
- /* @__PURE__ */ jsx8("span", { children: "Action" }),
3498
- /* @__PURE__ */ jsx8("span", { children: "User" }),
3499
- /* @__PURE__ */ jsx8("span", { children: "Details" })
3937
+ !entries.length ? /* @__PURE__ */ jsx9("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs9("div", { className: "mb-history-table", children: [
3938
+ /* @__PURE__ */ jsxs9("div", { className: "mb-history-head", "aria-hidden": "true", children: [
3939
+ /* @__PURE__ */ jsx9("span", { children: "Date" }),
3940
+ /* @__PURE__ */ jsx9("span", { children: "Action" }),
3941
+ /* @__PURE__ */ jsx9("span", { children: "User" }),
3942
+ /* @__PURE__ */ jsx9("span", { children: "Details" })
3500
3943
  ] }),
3501
- /* @__PURE__ */ jsx8("ul", { className: "mb-history-rows", children: entries.map((entry) => {
3944
+ /* @__PURE__ */ jsx9("ul", { className: "mb-history-rows", children: entries.map((entry) => {
3502
3945
  const expandable = Boolean(entry.details);
3503
3946
  const isOpen = expandable && Boolean(expanded[entry.id]);
3504
3947
  const details = entry.details;
3505
- return /* @__PURE__ */ jsxs8("li", { className: `mb-history-row is-${entry.tone}`, children: [
3506
- /* @__PURE__ */ jsxs8(
3948
+ return /* @__PURE__ */ jsxs9("li", { className: `mb-history-row is-${entry.tone}`, children: [
3949
+ /* @__PURE__ */ jsxs9(
3507
3950
  "button",
3508
3951
  {
3509
3952
  type: "button",
@@ -3512,40 +3955,40 @@ function BillHistoryTable({ entries, emptyLabel = "No bill history yet.", appear
3512
3955
  "aria-expanded": expandable ? isOpen : void 0,
3513
3956
  onClick: expandable ? () => setExpanded((current) => ({ ...current, [entry.id]: !current[entry.id] })) : void 0,
3514
3957
  children: [
3515
- /* @__PURE__ */ jsx8("span", { className: "mb-history-date", children: formatDate(entry.date) }),
3516
- /* @__PURE__ */ jsx8("span", { className: "mb-history-action", children: entry.action }),
3517
- /* @__PURE__ */ jsx8("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
3518
- /* @__PURE__ */ jsxs8("span", { className: "mb-history-summary", children: [
3519
- expandable ? /* @__PURE__ */ jsx8("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
3958
+ /* @__PURE__ */ jsx9("span", { className: "mb-history-date", children: formatDate(entry.date) }),
3959
+ /* @__PURE__ */ jsx9("span", { className: "mb-history-action", children: entry.action }),
3960
+ /* @__PURE__ */ jsx9("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
3961
+ /* @__PURE__ */ jsxs9("span", { className: "mb-history-summary", children: [
3962
+ expandable ? /* @__PURE__ */ jsx9("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
3520
3963
  entry.summary
3521
3964
  ] })
3522
3965
  ]
3523
3966
  }
3524
3967
  ),
3525
- isOpen && details ? /* @__PURE__ */ jsxs8("div", { className: "mb-history-details", children: [
3526
- details.rows?.length ? /* @__PURE__ */ jsx8("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs8("div", { children: [
3527
- /* @__PURE__ */ jsx8("dt", { children: row.label }),
3528
- /* @__PURE__ */ jsx8("dd", { children: row.value })
3968
+ isOpen && details ? /* @__PURE__ */ jsxs9("div", { className: "mb-history-details", children: [
3969
+ details.rows?.length ? /* @__PURE__ */ jsx9("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs9("div", { children: [
3970
+ /* @__PURE__ */ jsx9("dt", { children: row.label }),
3971
+ /* @__PURE__ */ jsx9("dd", { children: row.value })
3529
3972
  ] }, `${row.label}-${row.value}`)) }) : null,
3530
- details.documents?.length ? /* @__PURE__ */ jsx8("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs8("div", { children: [
3531
- /* @__PURE__ */ jsx8("dt", { children: "Documents" }),
3532
- /* @__PURE__ */ jsx8("dd", { children: details.documents.map((doc) => {
3973
+ details.documents?.length ? /* @__PURE__ */ jsx9("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs9("div", { children: [
3974
+ /* @__PURE__ */ jsx9("dt", { children: "Documents" }),
3975
+ /* @__PURE__ */ jsx9("dd", { children: details.documents.map((doc) => {
3533
3976
  const href = documentHref?.(doc) ?? null;
3534
- return href ? /* @__PURE__ */ jsx8("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : /* @__PURE__ */ jsx8("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
3977
+ return href ? /* @__PURE__ */ jsx9("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : /* @__PURE__ */ jsx9("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
3535
3978
  }) })
3536
3979
  ] }) }) : null,
3537
- details.codes?.length ? /* @__PURE__ */ jsx8("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs8("div", { children: [
3538
- /* @__PURE__ */ jsx8("dt", { children: code.code }),
3539
- /* @__PURE__ */ jsx8("dd", { children: code.text })
3980
+ details.codes?.length ? /* @__PURE__ */ jsx9("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs9("div", { children: [
3981
+ /* @__PURE__ */ jsx9("dt", { children: code.code }),
3982
+ /* @__PURE__ */ jsx9("dd", { children: code.text })
3540
3983
  ] }, code.code)) }) : null,
3541
- details.complianceDueDates?.length ? /* @__PURE__ */ jsxs8("div", { className: "mb-history-due", children: [
3542
- /* @__PURE__ */ jsx8("em", { children: "Compliance Due Dates" }),
3543
- /* @__PURE__ */ jsx8("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs8("div", { children: [
3544
- /* @__PURE__ */ jsx8("dt", { children: formatDate(due.date) }),
3545
- /* @__PURE__ */ jsx8("dd", { children: due.text })
3984
+ details.complianceDueDates?.length ? /* @__PURE__ */ jsxs9("div", { className: "mb-history-due", children: [
3985
+ /* @__PURE__ */ jsx9("em", { children: "Compliance Due Dates" }),
3986
+ /* @__PURE__ */ jsx9("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs9("div", { children: [
3987
+ /* @__PURE__ */ jsx9("dt", { children: formatDate(due.date) }),
3988
+ /* @__PURE__ */ jsx9("dd", { children: due.text })
3546
3989
  ] }, `${due.date}-${due.text}`)) })
3547
3990
  ] }) : null,
3548
- details.text ? /* @__PURE__ */ jsx8("p", { className: "mb-history-text", children: details.text }) : null
3991
+ details.text ? /* @__PURE__ */ jsx9("p", { className: "mb-history-text", children: details.text }) : null
3549
3992
  ] }) : null
3550
3993
  ] }, entry.id);
3551
3994
  }) })
@@ -3593,15 +4036,15 @@ function billLifecycleDisplayLabel(state, nativeStatus) {
3593
4036
  function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
3594
4037
  const rejected = state.toLowerCase() === "rejected";
3595
4038
  const steps = billLifecycleProgressSteps(state);
3596
- return /* @__PURE__ */ jsxs8("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
3597
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3598
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3599
- /* @__PURE__ */ jsx8("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
3600
- /* @__PURE__ */ jsx8("span", { children: rejected ? "The payer rejected this submission." : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
4039
+ return /* @__PURE__ */ jsxs9("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
4040
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4041
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4042
+ /* @__PURE__ */ jsx9("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
4043
+ /* @__PURE__ */ jsx9("span", { children: rejected ? "The payer rejected this submission." : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
3601
4044
  ] }) }),
3602
- /* @__PURE__ */ jsx8("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs8("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
3603
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
3604
- /* @__PURE__ */ jsx8("b", { children: step.label })
4045
+ /* @__PURE__ */ jsx9("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs9("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
4046
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
4047
+ /* @__PURE__ */ jsx9("b", { children: step.label })
3605
4048
  ] }, step.id)) })
3606
4049
  ] });
3607
4050
  }
@@ -3615,48 +4058,48 @@ function billRejectionIssueSummary(rejection, count) {
3615
4058
  function BillRejectionNotice({ rejection, title = "Rejected \u2014 action required", submittedAt, appearance, className, style, formatDate = defaultFormatDate }) {
3616
4059
  const issues = rejection.issues?.length ? rejection.issues : [{ code: rejection.code, description: rejection.reason }];
3617
4060
  const hasCodes = issues.some((issue) => Boolean(issue.code));
3618
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
3619
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3620
- /* @__PURE__ */ jsxs8("div", { className: "mb-rejection-overview", children: [
3621
- /* @__PURE__ */ jsxs8("header", { className: "mb-rejection-heading", children: [
3622
- /* @__PURE__ */ jsx8("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
3623
- /* @__PURE__ */ jsxs8("div", { children: [
3624
- /* @__PURE__ */ jsx8("strong", { children: title }),
3625
- /* @__PURE__ */ jsxs8("span", { children: [
4061
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
4062
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4063
+ /* @__PURE__ */ jsxs9("div", { className: "mb-rejection-overview", children: [
4064
+ /* @__PURE__ */ jsxs9("header", { className: "mb-rejection-heading", children: [
4065
+ /* @__PURE__ */ jsx9("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
4066
+ /* @__PURE__ */ jsxs9("div", { children: [
4067
+ /* @__PURE__ */ jsx9("strong", { children: title }),
4068
+ /* @__PURE__ */ jsxs9("span", { children: [
3626
4069
  "Fix the ",
3627
4070
  issues.length === 1 ? "issue" : "issues",
3628
4071
  " below, then resubmit."
3629
4072
  ] })
3630
4073
  ] })
3631
4074
  ] }),
3632
- /* @__PURE__ */ jsxs8("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
3633
- /* @__PURE__ */ jsxs8("li", { className: "is-complete", children: [
3634
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "\u2713" }),
3635
- /* @__PURE__ */ jsx8("b", { children: "Sent" }),
3636
- submittedAt ? /* @__PURE__ */ jsx8("small", { children: formatDate(submittedAt) }) : null
4075
+ /* @__PURE__ */ jsxs9("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
4076
+ /* @__PURE__ */ jsxs9("li", { className: "is-complete", children: [
4077
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2713" }),
4078
+ /* @__PURE__ */ jsx9("b", { children: "Sent" }),
4079
+ submittedAt ? /* @__PURE__ */ jsx9("small", { children: formatDate(submittedAt) }) : null
3637
4080
  ] }),
3638
- /* @__PURE__ */ jsxs8("li", { className: "is-rejected", "aria-current": "step", children: [
3639
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "!" }),
3640
- /* @__PURE__ */ jsx8("b", { children: "Rejected" }),
3641
- rejection.receivedAt ? /* @__PURE__ */ jsx8("small", { children: formatDate(rejection.receivedAt) }) : null
4081
+ /* @__PURE__ */ jsxs9("li", { className: "is-rejected", "aria-current": "step", children: [
4082
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "!" }),
4083
+ /* @__PURE__ */ jsx9("b", { children: "Rejected" }),
4084
+ rejection.receivedAt ? /* @__PURE__ */ jsx9("small", { children: formatDate(rejection.receivedAt) }) : null
3642
4085
  ] })
3643
4086
  ] })
3644
4087
  ] }),
3645
- /* @__PURE__ */ jsxs8("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
3646
- /* @__PURE__ */ jsxs8("div", { className: "mb-rejection-issues-heading", children: [
3647
- /* @__PURE__ */ jsxs8("strong", { children: [
3648
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "\u25B3" }),
4088
+ /* @__PURE__ */ jsxs9("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
4089
+ /* @__PURE__ */ jsxs9("div", { className: "mb-rejection-issues-heading", children: [
4090
+ /* @__PURE__ */ jsxs9("strong", { children: [
4091
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u25B3" }),
3649
4092
  " Rejection reasons"
3650
4093
  ] }),
3651
- /* @__PURE__ */ jsx8("span", { children: billRejectionIssueSummary(rejection, issues.length) })
4094
+ /* @__PURE__ */ jsx9("span", { children: billRejectionIssueSummary(rejection, issues.length) })
3652
4095
  ] }),
3653
- /* @__PURE__ */ jsx8("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs8("li", { children: [
3654
- /* @__PURE__ */ jsx8("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
3655
- /* @__PURE__ */ jsx8("p", { children: issue.description }),
3656
- issue.code ? /* @__PURE__ */ jsx8("span", { className: "mb-rejection-code", children: issue.code }) : null
4096
+ /* @__PURE__ */ jsx9("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs9("li", { children: [
4097
+ /* @__PURE__ */ jsx9("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
4098
+ /* @__PURE__ */ jsx9("p", { children: issue.description }),
4099
+ issue.code ? /* @__PURE__ */ jsx9("span", { className: "mb-rejection-code", children: issue.code }) : null
3657
4100
  ] }, `${issue.code ?? "issue"}-${index}`)) }),
3658
- hasCodes ? /* @__PURE__ */ jsxs8("p", { className: "mb-rejection-code-note", children: [
3659
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "i" }),
4101
+ hasCodes ? /* @__PURE__ */ jsxs9("p", { className: "mb-rejection-code-note", children: [
4102
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "i" }),
3660
4103
  " Technical error codes are included for support and auditability."
3661
4104
  ] }) : null
3662
4105
  ] })
@@ -3671,18 +4114,18 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
3671
4114
  ["Charged", currency(bill.totalCharge)],
3672
4115
  ["Balance", currency(bill.balanceDue)]
3673
4116
  ];
3674
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
3675
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3676
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3677
- /* @__PURE__ */ jsx8("strong", { children: "Bill snapshot" }),
3678
- /* @__PURE__ */ jsxs8("span", { children: [
4117
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
4118
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4119
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4120
+ /* @__PURE__ */ jsx9("strong", { children: "Bill snapshot" }),
4121
+ /* @__PURE__ */ jsxs9("span", { children: [
3679
4122
  "Bill #",
3680
4123
  bill.billNumber
3681
4124
  ] })
3682
4125
  ] }) }),
3683
- /* @__PURE__ */ jsx8("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs8("div", { children: [
3684
- /* @__PURE__ */ jsx8("dt", { children: label }),
3685
- /* @__PURE__ */ jsx8("dd", { children: value })
4126
+ /* @__PURE__ */ jsx9("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs9("div", { children: [
4127
+ /* @__PURE__ */ jsx9("dt", { children: label }),
4128
+ /* @__PURE__ */ jsx9("dd", { children: value })
3686
4129
  ] }, label)) })
3687
4130
  ] });
3688
4131
  }
@@ -3697,140 +4140,140 @@ function BillExplanationOfReview({
3697
4140
  style
3698
4141
  }) {
3699
4142
  const rows = payments.length ? payments : [null];
3700
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
3701
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3702
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3703
- /* @__PURE__ */ jsx8("strong", { children: "Explanation of Review" }),
3704
- /* @__PURE__ */ jsx8("span", { children: "Payer response and payment reconciliation." })
4143
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
4144
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4145
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4146
+ /* @__PURE__ */ jsx9("strong", { children: "Explanation of Review" }),
4147
+ /* @__PURE__ */ jsx9("span", { children: "Payer response and payment reconciliation." })
3705
4148
  ] }) }),
3706
- /* @__PURE__ */ jsxs8("dl", { className: "mb-eor-metrics", children: [
3707
- /* @__PURE__ */ jsxs8("div", { children: [
3708
- /* @__PURE__ */ jsx8("dt", { children: "Amount billed" }),
3709
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.billedAmount) })
4149
+ /* @__PURE__ */ jsxs9("dl", { className: "mb-eor-metrics", children: [
4150
+ /* @__PURE__ */ jsxs9("div", { children: [
4151
+ /* @__PURE__ */ jsx9("dt", { children: "Amount billed" }),
4152
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.billedAmount) })
3710
4153
  ] }),
3711
- /* @__PURE__ */ jsxs8("div", { children: [
3712
- /* @__PURE__ */ jsx8("dt", { children: "Payer allowed" }),
3713
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
4154
+ /* @__PURE__ */ jsxs9("div", { children: [
4155
+ /* @__PURE__ */ jsx9("dt", { children: "Payer allowed" }),
4156
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3714
4157
  ] }),
3715
- /* @__PURE__ */ jsxs8("div", { children: [
3716
- /* @__PURE__ */ jsx8("dt", { children: "Payer reported paid" }),
3717
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
4158
+ /* @__PURE__ */ jsxs9("div", { children: [
4159
+ /* @__PURE__ */ jsx9("dt", { children: "Payer reported paid" }),
4160
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3718
4161
  ] }),
3719
- /* @__PURE__ */ jsxs8("div", { className: "is-balance", children: [
3720
- /* @__PURE__ */ jsx8("dt", { children: "Balance due" }),
3721
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.balanceDue) })
4162
+ /* @__PURE__ */ jsxs9("div", { className: "is-balance", children: [
4163
+ /* @__PURE__ */ jsx9("dt", { children: "Balance due" }),
4164
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.balanceDue) })
3722
4165
  ] }),
3723
- /* @__PURE__ */ jsxs8("div", { children: [
3724
- /* @__PURE__ */ jsx8("dt", { children: "Payment posted" }),
3725
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedPrincipal) })
4166
+ /* @__PURE__ */ jsxs9("div", { children: [
4167
+ /* @__PURE__ */ jsx9("dt", { children: "Payment posted" }),
4168
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedPrincipal) })
3726
4169
  ] }),
3727
- /* @__PURE__ */ jsxs8("div", { children: [
3728
- /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3729
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedAdditional) })
4170
+ /* @__PURE__ */ jsxs9("div", { children: [
4171
+ /* @__PURE__ */ jsx9("dt", { children: "Penalty & interest" }),
4172
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedAdditional) })
3730
4173
  ] }),
3731
- /* @__PURE__ */ jsxs8("div", { children: [
3732
- /* @__PURE__ */ jsx8("dt", { children: "Total received" }),
3733
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.totalPostedCash) })
4174
+ /* @__PURE__ */ jsxs9("div", { children: [
4175
+ /* @__PURE__ */ jsx9("dt", { children: "Total received" }),
4176
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.totalPostedCash) })
3734
4177
  ] }),
3735
- /* @__PURE__ */ jsxs8("div", { children: [
3736
- /* @__PURE__ */ jsx8("dt", { children: "Expected" }),
3737
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.expectedAmount) })
4178
+ /* @__PURE__ */ jsxs9("div", { children: [
4179
+ /* @__PURE__ */ jsx9("dt", { children: "Expected" }),
4180
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.expectedAmount) })
3738
4181
  ] })
3739
4182
  ] }),
3740
- remittance.denialReason ? /* @__PURE__ */ jsxs8("div", { className: "mb-denial", children: [
3741
- /* @__PURE__ */ jsx8("strong", { children: "Denial reason" }),
3742
- /* @__PURE__ */ jsx8("p", { children: remittance.denialReason })
4183
+ remittance.denialReason ? /* @__PURE__ */ jsxs9("div", { className: "mb-denial", children: [
4184
+ /* @__PURE__ */ jsx9("strong", { children: "Denial reason" }),
4185
+ /* @__PURE__ */ jsx9("p", { children: remittance.denialReason })
3743
4186
  ] }) : null,
3744
- /* @__PURE__ */ jsx8("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs8("table", { className: "mb-eor-table", children: [
3745
- /* @__PURE__ */ jsxs8("thead", { children: [
3746
- /* @__PURE__ */ jsxs8("tr", { className: "mb-eor-groups", children: [
3747
- /* @__PURE__ */ jsx8("th", { colSpan: 2, children: "Submission" }),
3748
- /* @__PURE__ */ jsx8("th", { colSpan: 5, children: "EOR payment information" }),
3749
- /* @__PURE__ */ jsx8("th", { colSpan: 2, children: "EOR post" }),
3750
- /* @__PURE__ */ jsx8("th", { children: "EOR" })
4187
+ /* @__PURE__ */ jsx9("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs9("table", { className: "mb-eor-table", children: [
4188
+ /* @__PURE__ */ jsxs9("thead", { children: [
4189
+ /* @__PURE__ */ jsxs9("tr", { className: "mb-eor-groups", children: [
4190
+ /* @__PURE__ */ jsx9("th", { colSpan: 2, children: "Submission" }),
4191
+ /* @__PURE__ */ jsx9("th", { colSpan: 5, children: "EOR payment information" }),
4192
+ /* @__PURE__ */ jsx9("th", { colSpan: 2, children: "EOR post" }),
4193
+ /* @__PURE__ */ jsx9("th", { children: "EOR" })
3751
4194
  ] }),
3752
- /* @__PURE__ */ jsxs8("tr", { children: [
3753
- /* @__PURE__ */ jsx8("th", { children: "Submission" }),
3754
- /* @__PURE__ */ jsx8("th", { children: "Submission payment" }),
3755
- /* @__PURE__ */ jsx8("th", { children: "Payment method" }),
3756
- /* @__PURE__ */ jsx8("th", { children: "Reference" }),
3757
- /* @__PURE__ */ jsx8("th", { children: "Effective date" }),
3758
- /* @__PURE__ */ jsx8("th", { children: "Payment total" }),
3759
- /* @__PURE__ */ jsx8("th", { children: "Deposit date" }),
3760
- /* @__PURE__ */ jsx8("th", { children: "Post date" }),
3761
- /* @__PURE__ */ jsx8("th", { children: "Source" }),
3762
- /* @__PURE__ */ jsx8("th", { children: "Document" })
4195
+ /* @__PURE__ */ jsxs9("tr", { children: [
4196
+ /* @__PURE__ */ jsx9("th", { children: "Submission" }),
4197
+ /* @__PURE__ */ jsx9("th", { children: "Submission payment" }),
4198
+ /* @__PURE__ */ jsx9("th", { children: "Payment method" }),
4199
+ /* @__PURE__ */ jsx9("th", { children: "Reference" }),
4200
+ /* @__PURE__ */ jsx9("th", { children: "Effective date" }),
4201
+ /* @__PURE__ */ jsx9("th", { children: "Payment total" }),
4202
+ /* @__PURE__ */ jsx9("th", { children: "Deposit date" }),
4203
+ /* @__PURE__ */ jsx9("th", { children: "Post date" }),
4204
+ /* @__PURE__ */ jsx9("th", { children: "Source" }),
4205
+ /* @__PURE__ */ jsx9("th", { children: "Document" })
3763
4206
  ] })
3764
4207
  ] }),
3765
- /* @__PURE__ */ jsx8("tbody", { children: rows.map((payment, index) => {
4208
+ /* @__PURE__ */ jsx9("tbody", { children: rows.map((payment, index) => {
3766
4209
  const eor = eors[index] ?? eors[0];
3767
- return /* @__PURE__ */ jsxs8("tr", { children: [
3768
- /* @__PURE__ */ jsxs8("td", { "data-label": "Submission", children: [
3769
- /* @__PURE__ */ jsx8("strong", { children: "Original bill" }),
3770
- submittedAt ? /* @__PURE__ */ jsxs8("span", { children: [
4210
+ return /* @__PURE__ */ jsxs9("tr", { children: [
4211
+ /* @__PURE__ */ jsxs9("td", { "data-label": "Submission", children: [
4212
+ /* @__PURE__ */ jsx9("strong", { children: "Original bill" }),
4213
+ submittedAt ? /* @__PURE__ */ jsxs9("span", { children: [
3771
4214
  "Sent ",
3772
4215
  defaultFormatDate(submittedAt)
3773
4216
  ] }) : null
3774
4217
  ] }),
3775
- /* @__PURE__ */ jsx8("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
3776
- /* @__PURE__ */ jsx8("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
3777
- /* @__PURE__ */ jsx8("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
3778
- /* @__PURE__ */ jsx8("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
3779
- /* @__PURE__ */ jsx8("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
3780
- /* @__PURE__ */ jsx8("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
3781
- /* @__PURE__ */ jsx8("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
3782
- /* @__PURE__ */ jsx8("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
3783
- /* @__PURE__ */ jsx8("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
4218
+ /* @__PURE__ */ jsx9("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
4219
+ /* @__PURE__ */ jsx9("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
4220
+ /* @__PURE__ */ jsx9("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
4221
+ /* @__PURE__ */ jsx9("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
4222
+ /* @__PURE__ */ jsx9("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
4223
+ /* @__PURE__ */ jsx9("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
4224
+ /* @__PURE__ */ jsx9("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
4225
+ /* @__PURE__ */ jsx9("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
4226
+ /* @__PURE__ */ jsx9("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
3784
4227
  ] }, payment?.id ?? `empty-${index}`);
3785
4228
  }) })
3786
4229
  ] }) }),
3787
- eors.length > rows.length ? /* @__PURE__ */ jsx8("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
4230
+ eors.length > rows.length ? /* @__PURE__ */ jsx9("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
3788
4231
  ] });
3789
4232
  }
3790
4233
  function BillRemittanceCard({ remittance, appearance, className, style }) {
3791
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
3792
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3793
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3794
- /* @__PURE__ */ jsx8("strong", { children: "Remittance" }),
3795
- /* @__PURE__ */ jsx8("span", { children: "Amounts reported by the payer and posted to the bill." })
4234
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
4235
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4236
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4237
+ /* @__PURE__ */ jsx9("strong", { children: "Remittance" }),
4238
+ /* @__PURE__ */ jsx9("span", { children: "Amounts reported by the payer and posted to the bill." })
3796
4239
  ] }) }),
3797
- /* @__PURE__ */ jsxs8("dl", { children: [
3798
- /* @__PURE__ */ jsxs8("div", { children: [
3799
- /* @__PURE__ */ jsx8("dt", { children: "Amount billed" }),
3800
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.billedAmount) })
4240
+ /* @__PURE__ */ jsxs9("dl", { children: [
4241
+ /* @__PURE__ */ jsxs9("div", { children: [
4242
+ /* @__PURE__ */ jsx9("dt", { children: "Amount billed" }),
4243
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.billedAmount) })
3801
4244
  ] }),
3802
- /* @__PURE__ */ jsxs8("div", { children: [
3803
- /* @__PURE__ */ jsx8("dt", { children: "Expected" }),
3804
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.expectedAmount) })
4245
+ /* @__PURE__ */ jsxs9("div", { children: [
4246
+ /* @__PURE__ */ jsx9("dt", { children: "Expected" }),
4247
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.expectedAmount) })
3805
4248
  ] }),
3806
- /* @__PURE__ */ jsxs8("div", { children: [
3807
- /* @__PURE__ */ jsx8("dt", { children: "Payer allowed" }),
3808
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
4249
+ /* @__PURE__ */ jsxs9("div", { children: [
4250
+ /* @__PURE__ */ jsx9("dt", { children: "Payer allowed" }),
4251
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3809
4252
  ] }),
3810
- /* @__PURE__ */ jsxs8("div", { children: [
3811
- /* @__PURE__ */ jsx8("dt", { children: "Payer reported paid" }),
3812
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
4253
+ /* @__PURE__ */ jsxs9("div", { children: [
4254
+ /* @__PURE__ */ jsx9("dt", { children: "Payer reported paid" }),
4255
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3813
4256
  ] }),
3814
- /* @__PURE__ */ jsxs8("div", { children: [
3815
- /* @__PURE__ */ jsx8("dt", { children: "Payment posted" }),
3816
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedPrincipal) })
4257
+ /* @__PURE__ */ jsxs9("div", { children: [
4258
+ /* @__PURE__ */ jsx9("dt", { children: "Payment posted" }),
4259
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedPrincipal) })
3817
4260
  ] }),
3818
- /* @__PURE__ */ jsxs8("div", { children: [
3819
- /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3820
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedAdditional) })
4261
+ /* @__PURE__ */ jsxs9("div", { children: [
4262
+ /* @__PURE__ */ jsx9("dt", { children: "Penalty & interest" }),
4263
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedAdditional) })
3821
4264
  ] }),
3822
- /* @__PURE__ */ jsxs8("div", { children: [
3823
- /* @__PURE__ */ jsx8("dt", { children: "Total received" }),
3824
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.totalPostedCash) })
4265
+ /* @__PURE__ */ jsxs9("div", { children: [
4266
+ /* @__PURE__ */ jsx9("dt", { children: "Total received" }),
4267
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.totalPostedCash) })
3825
4268
  ] }),
3826
- /* @__PURE__ */ jsxs8("div", { children: [
3827
- /* @__PURE__ */ jsx8("dt", { children: "Balance due" }),
3828
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.balanceDue) })
4269
+ /* @__PURE__ */ jsxs9("div", { children: [
4270
+ /* @__PURE__ */ jsx9("dt", { children: "Balance due" }),
4271
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.balanceDue) })
3829
4272
  ] })
3830
4273
  ] }),
3831
- remittance.denialReason ? /* @__PURE__ */ jsxs8("div", { className: "mb-denial", children: [
3832
- /* @__PURE__ */ jsx8("strong", { children: "Denial reason" }),
3833
- /* @__PURE__ */ jsx8("p", { children: remittance.denialReason })
4274
+ remittance.denialReason ? /* @__PURE__ */ jsxs9("div", { className: "mb-denial", children: [
4275
+ /* @__PURE__ */ jsx9("strong", { children: "Denial reason" }),
4276
+ /* @__PURE__ */ jsx9("p", { children: remittance.denialReason })
3834
4277
  ] }) : null
3835
4278
  ] });
3836
4279
  }
@@ -3845,72 +4288,72 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
3845
4288
  delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
3846
4289
  ].filter(Boolean);
3847
4290
  if (!delivery.payerName && !contacts.length) return null;
3848
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
3849
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3850
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3851
- /* @__PURE__ */ jsx8("strong", { children: delivery.payerName || "Claims administrator" }),
3852
- /* @__PURE__ */ jsx8("span", { children: "Billing and follow-up contacts." })
4291
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
4292
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4293
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4294
+ /* @__PURE__ */ jsx9("strong", { children: delivery.payerName || "Claims administrator" }),
4295
+ /* @__PURE__ */ jsx9("span", { children: "Billing and follow-up contacts." })
3853
4296
  ] }) }),
3854
- !contacts.length ? /* @__PURE__ */ jsx8("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx8("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs8("div", { children: [
3855
- /* @__PURE__ */ jsx8("dt", { children: label }),
3856
- /* @__PURE__ */ jsx8("dd", { children: href ? /* @__PURE__ */ jsx8("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
4297
+ !contacts.length ? /* @__PURE__ */ jsx9("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx9("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs9("div", { children: [
4298
+ /* @__PURE__ */ jsx9("dt", { children: label }),
4299
+ /* @__PURE__ */ jsx9("dd", { children: href ? /* @__PURE__ */ jsx9("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
3857
4300
  ] }, label)) })
3858
4301
  ] });
3859
4302
  }
3860
4303
  function BillPaymentLedger({ payments, appearance, className, style }) {
3861
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
3862
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3863
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3864
- /* @__PURE__ */ jsx8("strong", { children: "Payments" }),
3865
- /* @__PURE__ */ jsx8("span", { children: "Funds recorded against this bill." })
4304
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
4305
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4306
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4307
+ /* @__PURE__ */ jsx9("strong", { children: "Payments" }),
4308
+ /* @__PURE__ */ jsx9("span", { children: "Funds recorded against this bill." })
3866
4309
  ] }) }),
3867
- !payments.length ? /* @__PURE__ */ jsx8("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx8("div", { className: "mb-payment-list", children: payments.map((payment) => {
4310
+ !payments.length ? /* @__PURE__ */ jsx9("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx9("div", { className: "mb-payment-list", children: payments.map((payment) => {
3868
4311
  const additional = payment.feeAmount ?? 0;
3869
- return /* @__PURE__ */ jsxs8("article", { children: [
3870
- /* @__PURE__ */ jsxs8("div", { className: "mb-payment-amount", children: [
3871
- /* @__PURE__ */ jsx8("strong", { children: currency(payment.amount) }),
3872
- /* @__PURE__ */ jsx8("span", { children: "Total received" })
4312
+ return /* @__PURE__ */ jsxs9("article", { children: [
4313
+ /* @__PURE__ */ jsxs9("div", { className: "mb-payment-amount", children: [
4314
+ /* @__PURE__ */ jsx9("strong", { children: currency(payment.amount) }),
4315
+ /* @__PURE__ */ jsx9("span", { children: "Total received" })
3873
4316
  ] }),
3874
- /* @__PURE__ */ jsxs8("dl", { children: [
3875
- /* @__PURE__ */ jsxs8("div", { children: [
3876
- /* @__PURE__ */ jsx8("dt", { children: "Applied to bill" }),
3877
- /* @__PURE__ */ jsx8("dd", { children: currency(payment.principalAmount) })
4317
+ /* @__PURE__ */ jsxs9("dl", { children: [
4318
+ /* @__PURE__ */ jsxs9("div", { children: [
4319
+ /* @__PURE__ */ jsx9("dt", { children: "Applied to bill" }),
4320
+ /* @__PURE__ */ jsx9("dd", { children: currency(payment.principalAmount) })
3878
4321
  ] }),
3879
- additional > 0 ? /* @__PURE__ */ jsxs8("div", { children: [
3880
- /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3881
- /* @__PURE__ */ jsx8("dd", { children: currency(additional) })
4322
+ additional > 0 ? /* @__PURE__ */ jsxs9("div", { children: [
4323
+ /* @__PURE__ */ jsx9("dt", { children: "Penalty & interest" }),
4324
+ /* @__PURE__ */ jsx9("dd", { children: currency(additional) })
3882
4325
  ] }) : null,
3883
- /* @__PURE__ */ jsxs8("div", { children: [
3884
- /* @__PURE__ */ jsx8("dt", { children: "Method" }),
3885
- /* @__PURE__ */ jsx8("dd", { children: payment.method.toUpperCase() })
4326
+ /* @__PURE__ */ jsxs9("div", { children: [
4327
+ /* @__PURE__ */ jsx9("dt", { children: "Method" }),
4328
+ /* @__PURE__ */ jsx9("dd", { children: payment.method.toUpperCase() })
3886
4329
  ] }),
3887
- /* @__PURE__ */ jsxs8("div", { children: [
3888
- /* @__PURE__ */ jsx8("dt", { children: "Reference" }),
3889
- /* @__PURE__ */ jsx8("dd", { children: payment.checkNumber || "\u2014" })
4330
+ /* @__PURE__ */ jsxs9("div", { children: [
4331
+ /* @__PURE__ */ jsx9("dt", { children: "Reference" }),
4332
+ /* @__PURE__ */ jsx9("dd", { children: payment.checkNumber || "\u2014" })
3890
4333
  ] }),
3891
- /* @__PURE__ */ jsxs8("div", { children: [
3892
- /* @__PURE__ */ jsx8("dt", { children: "Effective date" }),
3893
- /* @__PURE__ */ jsx8("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
4334
+ /* @__PURE__ */ jsxs9("div", { children: [
4335
+ /* @__PURE__ */ jsx9("dt", { children: "Effective date" }),
4336
+ /* @__PURE__ */ jsx9("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
3894
4337
  ] }),
3895
- /* @__PURE__ */ jsxs8("div", { children: [
3896
- /* @__PURE__ */ jsx8("dt", { children: "Deposit date" }),
3897
- /* @__PURE__ */ jsx8("dd", { children: payment.depositDate || "Not recorded" })
4338
+ /* @__PURE__ */ jsxs9("div", { children: [
4339
+ /* @__PURE__ */ jsx9("dt", { children: "Deposit date" }),
4340
+ /* @__PURE__ */ jsx9("dd", { children: payment.depositDate || "Not recorded" })
3898
4341
  ] }),
3899
- /* @__PURE__ */ jsxs8("div", { children: [
3900
- /* @__PURE__ */ jsx8("dt", { children: "Posted" }),
3901
- /* @__PURE__ */ jsxs8("dd", { children: [
4342
+ /* @__PURE__ */ jsxs9("div", { children: [
4343
+ /* @__PURE__ */ jsx9("dt", { children: "Posted" }),
4344
+ /* @__PURE__ */ jsxs9("dd", { children: [
3902
4345
  defaultFormatDate(payment.postedAt),
3903
4346
  " \xB7 ",
3904
4347
  payment.source.toUpperCase()
3905
4348
  ] })
3906
4349
  ] }),
3907
- /* @__PURE__ */ jsxs8("div", { children: [
3908
- /* @__PURE__ */ jsx8("dt", { children: "Status" }),
3909
- /* @__PURE__ */ jsx8("dd", { children: humanize(payment.status || "posted") })
4350
+ /* @__PURE__ */ jsxs9("div", { children: [
4351
+ /* @__PURE__ */ jsx9("dt", { children: "Status" }),
4352
+ /* @__PURE__ */ jsx9("dd", { children: humanize(payment.status || "posted") })
3910
4353
  ] })
3911
4354
  ] }),
3912
- payment.feeReason ? /* @__PURE__ */ jsx8("p", { children: payment.feeReason }) : null,
3913
- payment.note ? /* @__PURE__ */ jsx8("p", { children: payment.note }) : null
4355
+ payment.feeReason ? /* @__PURE__ */ jsx9("p", { children: payment.feeReason }) : null,
4356
+ payment.note ? /* @__PURE__ */ jsx9("p", { children: payment.note }) : null
3914
4357
  ] }, payment.id);
3915
4358
  }) })
3916
4359
  ] });
@@ -3965,10 +4408,10 @@ var lifecycleSurfaceStyles = `
3965
4408
  // src/connected-bill-lifecycle.tsx
3966
4409
  import {
3967
4410
  useCallback as useCallback4,
3968
- useEffect as useEffect6,
3969
- useMemo as useMemo7,
4411
+ useEffect as useEffect7,
4412
+ useMemo as useMemo8,
3970
4413
  useRef as useRef5,
3971
- useState as useState8
4414
+ useState as useState9
3972
4415
  } from "react";
3973
4416
  import {
3974
4417
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
@@ -3976,7 +4419,7 @@ import {
3976
4419
  createBillLifecycleClient
3977
4420
  } from "@mindbill/browser";
3978
4421
  import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
3979
- import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
4422
+ import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3980
4423
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
3981
4424
  function reservePreviewWindow() {
3982
4425
  const preview = window.open("about:blank", "_blank");
@@ -4018,25 +4461,25 @@ function useBillLifecycle({
4018
4461
  enabled = true,
4019
4462
  fetch: fetchOverride
4020
4463
  }) {
4021
- const [data, setData] = useState8(null);
4022
- const [error, setError] = useState8(null);
4023
- const [isLoading, setIsLoading] = useState8(enabled);
4024
- const [isRefreshing, setIsRefreshing] = useState8(false);
4025
- const [isMutating, setIsMutating] = useState8(false);
4464
+ const [data, setData] = useState9(null);
4465
+ const [error, setError] = useState9(null);
4466
+ const [isLoading, setIsLoading] = useState9(enabled);
4467
+ const [isRefreshing, setIsRefreshing] = useState9(false);
4468
+ const [isMutating, setIsMutating] = useState9(false);
4026
4469
  const mounted = useRef5(true);
4027
- const client = useMemo7(() => createBillLifecycleClient({
4470
+ const client = useMemo8(() => createBillLifecycleClient({
4028
4471
  billId: providedBillId,
4029
4472
  sessionEndpoint,
4030
4473
  getSession,
4031
4474
  apiBaseUrl,
4032
4475
  fetch: fetchOverride
4033
4476
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
4034
- useEffect6(() => {
4477
+ useEffect7(() => {
4035
4478
  setData(null);
4036
4479
  setError(null);
4037
4480
  setIsLoading(enabled);
4038
4481
  }, [enabled, providedBillId]);
4039
- useEffect6(() => {
4482
+ useEffect7(() => {
4040
4483
  mounted.current = true;
4041
4484
  return () => {
4042
4485
  mounted.current = false;
@@ -4060,7 +4503,7 @@ function useBillLifecycle({
4060
4503
  }
4061
4504
  }
4062
4505
  }, [client, enabled]);
4063
- useEffect6(() => {
4506
+ useEffect7(() => {
4064
4507
  if (!enabled) return;
4065
4508
  void refresh();
4066
4509
  const interval = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -4125,7 +4568,7 @@ function useBillLifecycle({
4125
4568
  }
4126
4569
  function LifecycleDialog({ children, title, onClose }) {
4127
4570
  const dialog = useRef5(null);
4128
- useEffect6(() => {
4571
+ useEffect7(() => {
4129
4572
  const previous = document.activeElement;
4130
4573
  dialog.current?.focus();
4131
4574
  const onKeyDown = (event) => event.key === "Escape" && onClose();
@@ -4135,8 +4578,8 @@ function LifecycleDialog({ children, title, onClose }) {
4135
4578
  previous?.focus();
4136
4579
  };
4137
4580
  }, [onClose]);
4138
- return /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs9("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
4139
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
4581
+ return /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs10("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
4582
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
4140
4583
  children
4141
4584
  ] }) });
4142
4585
  }
@@ -4169,14 +4612,14 @@ function shouldShowSandboxControls(environment, enabled = false) {
4169
4612
  function ConnectedBillLifecycle({ appearance, sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
4170
4613
  const lifecycle = useBillLifecycle(options);
4171
4614
  const { data } = lifecycle;
4172
- const [tab, setTab] = useState8("details");
4173
- const [panel, setPanel] = useState8("");
4174
- const [notice, setNotice] = useState8("");
4175
- const [reason, setReason] = useState8("");
4176
- const [payment, setPayment] = useState8({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
4177
- const [review, setReview] = useState8({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
4615
+ const [tab, setTab] = useState9("details");
4616
+ const [panel, setPanel] = useState9("");
4617
+ const [notice, setNotice] = useState9("");
4618
+ const [reason, setReason] = useState9("");
4619
+ const [payment, setPayment] = useState9({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
4620
+ const [review, setReview] = useState9({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
4178
4621
  const lastData = useRef5(null);
4179
- useEffect6(() => {
4622
+ useEffect7(() => {
4180
4623
  if (!data || data === lastData.current) return;
4181
4624
  lastData.current = data;
4182
4625
  onChanged?.(data);
@@ -4193,13 +4636,13 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
4193
4636
  attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
4194
4637
  }));
4195
4638
  }, [data, onChanged]);
4196
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx9(Fragment6, { children: loadingFallback ?? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
4639
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx10(Fragment7, { children: loadingFallback ?? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
4197
4640
  if (!data) {
4198
4641
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
4199
- return /* @__PURE__ */ jsx9(Fragment6, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-error", role: "alert", children: [
4200
- /* @__PURE__ */ jsx9("strong", { children: "Billing is unavailable." }),
4201
- /* @__PURE__ */ jsx9("span", { children: error.message }),
4202
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
4642
+ return /* @__PURE__ */ jsx10(Fragment7, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-error", role: "alert", children: [
4643
+ /* @__PURE__ */ jsx10("strong", { children: "Billing is unavailable." }),
4644
+ /* @__PURE__ */ jsx10("span", { children: error.message }),
4645
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
4203
4646
  ] }) });
4204
4647
  }
4205
4648
  const complete = async (message, task) => {
@@ -4217,170 +4660,170 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
4217
4660
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
4218
4661
  const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
4219
4662
  const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
4220
- return /* @__PURE__ */ jsxs9("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
4221
- /* @__PURE__ */ jsx9("style", { children: CONNECTED_LIFECYCLE_STYLES }),
4222
- data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx9(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx9(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
4223
- /* @__PURE__ */ jsxs9("header", { className: "mb-lifecycle-head", children: [
4224
- /* @__PURE__ */ jsxs9("div", { children: [
4225
- /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs9("h2", { children: [
4663
+ return /* @__PURE__ */ jsxs10("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
4664
+ /* @__PURE__ */ jsx10("style", { children: CONNECTED_LIFECYCLE_STYLES }),
4665
+ data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx10(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx10(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
4666
+ /* @__PURE__ */ jsxs10("header", { className: "mb-lifecycle-head", children: [
4667
+ /* @__PURE__ */ jsxs10("div", { children: [
4668
+ /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs10("h2", { children: [
4226
4669
  "Bill #",
4227
4670
  data.bill.billNumber
4228
4671
  ] }) }),
4229
- /* @__PURE__ */ jsxs9("p", { children: [
4672
+ /* @__PURE__ */ jsxs10("p", { children: [
4230
4673
  "Claim ",
4231
4674
  data.injury.claimNumber || "\u2014",
4232
4675
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
4233
4676
  ] })
4234
4677
  ] }),
4235
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
4678
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
4236
4679
  ] }),
4237
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
4238
- /* @__PURE__ */ jsx9("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
4239
- /* @__PURE__ */ jsx9("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
4680
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
4681
+ /* @__PURE__ */ jsx10("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
4682
+ /* @__PURE__ */ jsx10("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
4240
4683
  ] }),
4241
- tab === "details" ? /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
4242
- data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx9(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
4243
- showSandboxControls ? /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
4244
- /* @__PURE__ */ jsxs9("div", { children: [
4245
- /* @__PURE__ */ jsx9("span", { children: "Sandbox demo controls" }),
4246
- /* @__PURE__ */ jsx9("h3", { children: "Simulate the next payer response" }),
4247
- /* @__PURE__ */ jsx9("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
4684
+ tab === "details" ? /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
4685
+ data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx10(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
4686
+ showSandboxControls ? /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
4687
+ /* @__PURE__ */ jsxs10("div", { children: [
4688
+ /* @__PURE__ */ jsx10("span", { children: "Sandbox demo controls" }),
4689
+ /* @__PURE__ */ jsx10("h3", { children: "Simulate the next payer response" }),
4690
+ /* @__PURE__ */ jsx10("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
4248
4691
  ] }),
4249
- simulations.length ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs9("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
4250
- /* @__PURE__ */ jsx9("strong", { children: scenario.label }),
4251
- /* @__PURE__ */ jsx9("span", { children: scenario.detail })
4252
- ] }, scenario.id)) }) : /* @__PURE__ */ jsx9("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
4692
+ simulations.length ? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs10("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
4693
+ /* @__PURE__ */ jsx10("strong", { children: scenario.label }),
4694
+ /* @__PURE__ */ jsx10("span", { children: scenario.detail })
4695
+ ] }, scenario.id)) }) : /* @__PURE__ */ jsx10("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
4253
4696
  ] }) : null,
4254
- /* @__PURE__ */ jsx9(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
4255
- ] }) : /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx9(BillHistoryTable, { entries: data.history, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx9(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
4256
- viewEor || actions.length ? /* @__PURE__ */ jsxs9("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
4257
- viewEor && data.eors[0] ? /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
4258
- actions.map((action) => /* @__PURE__ */ jsx9("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
4697
+ /* @__PURE__ */ jsx10(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
4698
+ ] }) : /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx10(BillHistoryTable, { entries: data.history, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx10(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
4699
+ viewEor || actions.length ? /* @__PURE__ */ jsxs10("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
4700
+ viewEor && data.eors[0] ? /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
4701
+ actions.map((action) => /* @__PURE__ */ jsx10("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
4259
4702
  const next = actionPanel(action);
4260
4703
  if (next) setPanel(next);
4261
4704
  }, children: action.label }, action.id))
4262
4705
  ] }) : null,
4263
- panel === "resubmit" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4264
- /* @__PURE__ */ jsxs9("div", { children: [
4265
- /* @__PURE__ */ jsx9("h3", { children: "Correct and resubmit" }),
4266
- /* @__PURE__ */ jsx9("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
4706
+ panel === "resubmit" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4707
+ /* @__PURE__ */ jsxs10("div", { children: [
4708
+ /* @__PURE__ */ jsx10("h3", { children: "Correct and resubmit" }),
4709
+ /* @__PURE__ */ jsx10("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
4267
4710
  ] }),
4268
- /* @__PURE__ */ jsxs9("label", { children: [
4269
- /* @__PURE__ */ jsx9("span", { children: "Correction note (optional)" }),
4270
- /* @__PURE__ */ jsx9("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
4711
+ /* @__PURE__ */ jsxs10("label", { children: [
4712
+ /* @__PURE__ */ jsx10("span", { children: "Correction note (optional)" }),
4713
+ /* @__PURE__ */ jsx10("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
4271
4714
  ] }),
4272
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4273
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4274
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
4715
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4716
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4717
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
4275
4718
  ] })
4276
4719
  ] }) }) : null,
4277
- panel === "second_review" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4278
- /* @__PURE__ */ jsxs9("div", { children: [
4279
- /* @__PURE__ */ jsx9("h3", { children: "Submit Second Review" }),
4280
- /* @__PURE__ */ jsx9("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
4720
+ panel === "second_review" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4721
+ /* @__PURE__ */ jsxs10("div", { children: [
4722
+ /* @__PURE__ */ jsx10("h3", { children: "Submit Second Review" }),
4723
+ /* @__PURE__ */ jsx10("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
4281
4724
  ] }),
4282
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-fields two", children: [
4283
- /* @__PURE__ */ jsxs9("label", { className: "full", children: [
4284
- /* @__PURE__ */ jsx9("span", { children: "Reason" }),
4285
- /* @__PURE__ */ jsx9("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
4725
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-fields two", children: [
4726
+ /* @__PURE__ */ jsxs10("label", { className: "full", children: [
4727
+ /* @__PURE__ */ jsx10("span", { children: "Reason" }),
4728
+ /* @__PURE__ */ jsx10("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
4286
4729
  ] }),
4287
- /* @__PURE__ */ jsxs9("label", { children: [
4288
- /* @__PURE__ */ jsx9("span", { children: "Payer claim control number" }),
4289
- /* @__PURE__ */ jsx9("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
4730
+ /* @__PURE__ */ jsxs10("label", { children: [
4731
+ /* @__PURE__ */ jsx10("span", { children: "Payer claim control number" }),
4732
+ /* @__PURE__ */ jsx10("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
4290
4733
  ] }),
4291
- /* @__PURE__ */ jsxs9("label", { children: [
4292
- /* @__PURE__ */ jsx9("span", { children: "Disputed amount" }),
4293
- /* @__PURE__ */ jsx9("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
4734
+ /* @__PURE__ */ jsxs10("label", { children: [
4735
+ /* @__PURE__ */ jsx10("span", { children: "Disputed amount" }),
4736
+ /* @__PURE__ */ jsx10("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
4294
4737
  ] }),
4295
- /* @__PURE__ */ jsxs9("label", { children: [
4296
- /* @__PURE__ */ jsx9("span", { children: "Send via" }),
4297
- /* @__PURE__ */ jsxs9("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
4298
- /* @__PURE__ */ jsx9("option", { value: "ebill", children: "E-bill" }),
4299
- /* @__PURE__ */ jsx9("option", { value: "fax", children: "Fax" }),
4300
- /* @__PURE__ */ jsx9("option", { value: "mail", children: "Mail" }),
4301
- /* @__PURE__ */ jsx9("option", { value: "email", children: "Email" })
4738
+ /* @__PURE__ */ jsxs10("label", { children: [
4739
+ /* @__PURE__ */ jsx10("span", { children: "Send via" }),
4740
+ /* @__PURE__ */ jsxs10("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
4741
+ /* @__PURE__ */ jsx10("option", { value: "ebill", children: "E-bill" }),
4742
+ /* @__PURE__ */ jsx10("option", { value: "fax", children: "Fax" }),
4743
+ /* @__PURE__ */ jsx10("option", { value: "mail", children: "Mail" }),
4744
+ /* @__PURE__ */ jsx10("option", { value: "email", children: "Email" })
4302
4745
  ] })
4303
4746
  ] })
4304
4747
  ] }),
4305
- /* @__PURE__ */ jsxs9("fieldset", { className: "mb-lifecycle-packet", children: [
4306
- /* @__PURE__ */ jsx9("legend", { children: "Supporting packet" }),
4307
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs9("label", { children: [
4308
- /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
4309
- /* @__PURE__ */ jsxs9("span", { children: [
4310
- /* @__PURE__ */ jsx9("strong", { children: attachment.filename }),
4311
- /* @__PURE__ */ jsx9("small", { children: attachment.description || attachment.documentType })
4748
+ /* @__PURE__ */ jsxs10("fieldset", { className: "mb-lifecycle-packet", children: [
4749
+ /* @__PURE__ */ jsx10("legend", { children: "Supporting packet" }),
4750
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs10("label", { children: [
4751
+ /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
4752
+ /* @__PURE__ */ jsxs10("span", { children: [
4753
+ /* @__PURE__ */ jsx10("strong", { children: attachment.filename }),
4754
+ /* @__PURE__ */ jsx10("small", { children: attachment.description || attachment.documentType })
4312
4755
  ] }),
4313
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
4756
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
4314
4757
  ] }, attachment.id))
4315
4758
  ] }),
4316
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4317
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4318
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
4759
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4760
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4761
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
4319
4762
  ] })
4320
4763
  ] }) }) : null,
4321
- panel === "payment" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4322
- /* @__PURE__ */ jsxs9("div", { children: [
4323
- /* @__PURE__ */ jsx9("h3", { children: "Post payment" }),
4324
- /* @__PURE__ */ jsx9("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
4764
+ panel === "payment" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4765
+ /* @__PURE__ */ jsxs10("div", { children: [
4766
+ /* @__PURE__ */ jsx10("h3", { children: "Post payment" }),
4767
+ /* @__PURE__ */ jsx10("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
4325
4768
  ] }),
4326
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-fields two", children: [
4327
- /* @__PURE__ */ jsxs9("label", { children: [
4328
- /* @__PURE__ */ jsx9("span", { children: "Amount applied to bill" }),
4329
- /* @__PURE__ */ jsx9("input", { type: "number", min: "0.01", max: data.bill.balanceDue, step: "0.01", value: payment.amount || "", onChange: (event) => setPayment((current) => ({ ...current, amount: Number(event.target.value) })) })
4769
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-fields two", children: [
4770
+ /* @__PURE__ */ jsxs10("label", { children: [
4771
+ /* @__PURE__ */ jsx10("span", { children: "Amount applied to bill" }),
4772
+ /* @__PURE__ */ jsx10("input", { type: "number", min: "0.01", max: data.bill.balanceDue, step: "0.01", value: payment.amount || "", onChange: (event) => setPayment((current) => ({ ...current, amount: Number(event.target.value) })) })
4330
4773
  ] }),
4331
- /* @__PURE__ */ jsxs9("label", { children: [
4332
- /* @__PURE__ */ jsx9("span", { children: "Penalty" }),
4333
- /* @__PURE__ */ jsx9("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
4774
+ /* @__PURE__ */ jsxs10("label", { children: [
4775
+ /* @__PURE__ */ jsx10("span", { children: "Penalty" }),
4776
+ /* @__PURE__ */ jsx10("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
4334
4777
  ] }),
4335
- /* @__PURE__ */ jsxs9("label", { children: [
4336
- /* @__PURE__ */ jsx9("span", { children: "Interest" }),
4337
- /* @__PURE__ */ jsx9("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
4778
+ /* @__PURE__ */ jsxs10("label", { children: [
4779
+ /* @__PURE__ */ jsx10("span", { children: "Interest" }),
4780
+ /* @__PURE__ */ jsx10("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
4338
4781
  ] }),
4339
- /* @__PURE__ */ jsxs9("label", { children: [
4340
- /* @__PURE__ */ jsx9("span", { children: "Method" }),
4341
- /* @__PURE__ */ jsxs9("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
4342
- /* @__PURE__ */ jsx9("option", { value: "check", children: "Check" }),
4343
- /* @__PURE__ */ jsx9("option", { value: "eft", children: "EFT" })
4782
+ /* @__PURE__ */ jsxs10("label", { children: [
4783
+ /* @__PURE__ */ jsx10("span", { children: "Method" }),
4784
+ /* @__PURE__ */ jsxs10("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
4785
+ /* @__PURE__ */ jsx10("option", { value: "check", children: "Check" }),
4786
+ /* @__PURE__ */ jsx10("option", { value: "eft", children: "EFT" })
4344
4787
  ] })
4345
4788
  ] }),
4346
- /* @__PURE__ */ jsxs9("label", { children: [
4347
- /* @__PURE__ */ jsx9("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
4348
- /* @__PURE__ */ jsx9("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
4789
+ /* @__PURE__ */ jsxs10("label", { children: [
4790
+ /* @__PURE__ */ jsx10("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
4791
+ /* @__PURE__ */ jsx10("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
4349
4792
  ] }),
4350
- /* @__PURE__ */ jsxs9("label", { children: [
4351
- /* @__PURE__ */ jsx9("span", { children: "Deposit date" }),
4352
- /* @__PURE__ */ jsx9("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
4793
+ /* @__PURE__ */ jsxs10("label", { children: [
4794
+ /* @__PURE__ */ jsx10("span", { children: "Deposit date" }),
4795
+ /* @__PURE__ */ jsx10("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
4353
4796
  ] }),
4354
- /* @__PURE__ */ jsxs9("label", { className: "full", children: [
4355
- /* @__PURE__ */ jsx9("span", { children: "Note (optional)" }),
4356
- /* @__PURE__ */ jsx9("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
4797
+ /* @__PURE__ */ jsxs10("label", { className: "full", children: [
4798
+ /* @__PURE__ */ jsx10("span", { children: "Note (optional)" }),
4799
+ /* @__PURE__ */ jsx10("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
4357
4800
  ] })
4358
4801
  ] }),
4359
- /* @__PURE__ */ jsxs9("div", { className: "mb-payment-total", children: [
4360
- /* @__PURE__ */ jsx9("span", { children: "Total received" }),
4361
- /* @__PURE__ */ jsx9("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
4802
+ /* @__PURE__ */ jsxs10("div", { className: "mb-payment-total", children: [
4803
+ /* @__PURE__ */ jsx10("span", { children: "Total received" }),
4804
+ /* @__PURE__ */ jsx10("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
4362
4805
  ] }),
4363
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4364
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4365
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || (payment.penaltyAmount ?? 0) < 0 || (payment.interestAmount ?? 0) < 0 || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment(payment)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
4806
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4807
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4808
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || (payment.penaltyAmount ?? 0) < 0 || (payment.interestAmount ?? 0) < 0 || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment(payment)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
4366
4809
  ] })
4367
4810
  ] }) }) : null,
4368
- panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4369
- /* @__PURE__ */ jsxs9("div", { children: [
4370
- /* @__PURE__ */ jsx9("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
4371
- /* @__PURE__ */ jsx9("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
4811
+ panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4812
+ /* @__PURE__ */ jsxs10("div", { children: [
4813
+ /* @__PURE__ */ jsx10("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
4814
+ /* @__PURE__ */ jsx10("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
4372
4815
  ] }),
4373
- /* @__PURE__ */ jsxs9("label", { children: [
4374
- /* @__PURE__ */ jsx9("span", { children: "Reason" }),
4375
- /* @__PURE__ */ jsx9("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
4816
+ /* @__PURE__ */ jsxs10("label", { children: [
4817
+ /* @__PURE__ */ jsx10("span", { children: "Reason" }),
4818
+ /* @__PURE__ */ jsx10("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
4376
4819
  ] }),
4377
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4378
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4379
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
4820
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4821
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4822
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
4380
4823
  ] })
4381
4824
  ] }) }) : null,
4382
- notice ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
4383
- lifecycle.error ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
4825
+ notice ? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
4826
+ lifecycle.error ? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
4384
4827
  ] });
4385
4828
  }
4386
4829
  var CONNECTED_LIFECYCLE_STYLES = `
@@ -4394,7 +4837,7 @@ var CONNECTED_LIFECYCLE_STYLES = `
4394
4837
  function widget(tagName, props) {
4395
4838
  const ref = useRef6(null);
4396
4839
  const { onMindBill, onMindBillError } = props;
4397
- useEffect7(() => {
4840
+ useEffect8(() => {
4398
4841
  const element = ref.current;
4399
4842
  if (!element) return;
4400
4843
  const handleEvent = (event) => onMindBill?.(event);
@@ -4473,6 +4916,7 @@ export {
4473
4916
  MindBillBillTimeline,
4474
4917
  OrganizationOnboarding,
4475
4918
  PSYCH_QME_DEFAULT_DIAGNOSIS,
4919
+ SendRouteDialog,
4476
4920
  applyBillSubmissionEvaluationDiagnoses,
4477
4921
  applyBillSubmissionEvaluationModifiers,
4478
4922
  billActivityEventLabel,
@@ -4492,7 +4936,9 @@ export {
4492
4936
  ensureTrailingBillSubmissionLine,
4493
4937
  ensureTrailingProcedureLine,
4494
4938
  exactClaimsAdministratorMatch,
4939
+ extractSendRouteEmail,
4495
4940
  formatBillSubmissionDate,
4941
+ formatSendRouteFax,
4496
4942
  mindBillAppearanceStyle,
4497
4943
  mindBillThemePresets,
4498
4944
  normalizeClaimsAdministratorName,