@mindbill/react 0.31.3 → 0.33.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,363 @@ 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
+ var css = `
1319
+ .mbrd-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(15,30,40,.45)}
1320
+ .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)}
1321
+ .mbrd *{box-sizing:border-box}
1322
+ .mbrd-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
1323
+ .mbrd-title{margin:0;font-size:20px;font-weight:760}
1324
+ .mbrd-copy{margin:4px 0 0;color:var(--mb-muted);font-size:14px}
1325
+ .mbrd-close{border:0;background:transparent;color:var(--mb-muted);font-size:22px;line-height:1;cursor:pointer}
1326
+ .mbrd-cards{display:grid;gap:10px}
1327
+ .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}
1328
+ .mbrd-card[data-selected=true]{border-color:var(--mb-accent);background:color-mix(in srgb,var(--mb-accent) 5%,var(--mb-surface))}
1329
+ .mbrd-card[data-disabled=true]{opacity:.55}
1330
+ .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}
1331
+ .mbrd-card[data-disabled=true] .mbrd-card-main{cursor:not-allowed}
1332
+ .mbrd-radio{flex:0 0 auto;width:18px;height:18px;border:2px solid var(--mb-border);border-radius:50%;display:grid;place-items:center}
1333
+ .mbrd-card[data-selected=true] .mbrd-radio{border-color:var(--mb-accent)}
1334
+ .mbrd-card[data-selected=true] .mbrd-radio:after{content:"";width:9px;height:9px;border-radius:50%;background:var(--mb-accent)}
1335
+ .mbrd-card-text{min-width:0;flex:1}
1336
+ .mbrd-card-title{font-weight:700;line-height:1.3;overflow-wrap:anywhere}
1337
+ .mbrd-card-detail{margin-top:2px;color:var(--mb-muted);font-size:13px;line-height:1.35;overflow-wrap:anywhere}
1338
+ .mbrd-badges{display:flex;flex:0 0 auto;gap:6px}
1339
+ .mbrd-badge{padding:2px 8px;border:1px solid var(--mb-border);border-radius:999px;font-size:11px;font-weight:700;white-space:nowrap}
1340
+ .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}
1341
+ .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)}
1342
+ .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)}
1343
+ .mbrd-choice{border:1px solid var(--mb-border);border-radius:calc(var(--mb-control-radius) - 2px);background:var(--mb-surface)}
1344
+ .mbrd-choice[data-selected=true]{border-color:var(--mb-accent)}
1345
+ .mbrd-choice[data-disabled=true]{opacity:.55}
1346
+ .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}
1347
+ .mbrd-choice[data-disabled=true] .mbrd-choice-main{cursor:not-allowed}
1348
+ .mbrd-choice-title{font-weight:650;overflow-wrap:anywhere}
1349
+ .mbrd-choice-detail{margin-top:1px;color:var(--mb-muted);font-size:12px}
1350
+ .mbrd-choice-body{display:grid;gap:8px;padding:10px 11px;border-top:1px solid var(--mb-border)}
1351
+ .mbrd-field{display:grid;gap:5px;font-size:13px}
1352
+ .mbrd-label{font-weight:650}
1353
+ .mbrd-star{color:var(--mb-danger)}
1354
+ .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}
1355
+ .mbrd-textarea{resize:vertical;min-height:74px}
1356
+ .mbrd-input:focus,.mbrd-textarea:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
1357
+ .mbrd-error{color:var(--mb-danger);font-size:12px}
1358
+ .mbrd-help{color:var(--mb-muted);font-size:12px}
1359
+ .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}
1360
+ .mbrd-actions{display:flex;justify-content:flex-end;gap:10px}
1361
+ .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}
1362
+ .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}
1363
+ .mbrd-confirm:disabled,.mbrd-cancel:disabled{opacity:.6;cursor:not-allowed}
1364
+ `;
1365
+ var CONFIRM_LABELS = {
1366
+ ebill: "Send Bill",
1367
+ email: "Email Bill",
1368
+ fax: "Fax Bill",
1369
+ mail: "Mail Bill"
1370
+ };
1371
+ function RouteCard({
1372
+ selected,
1373
+ disabled,
1374
+ title,
1375
+ detail,
1376
+ badges,
1377
+ onSelect,
1378
+ children
1379
+ }) {
1380
+ return /* @__PURE__ */ jsxs3("div", { className: "mbrd-card", "data-selected": selected, "data-disabled": Boolean(disabled), children: [
1381
+ /* @__PURE__ */ jsxs3(
1382
+ "button",
1383
+ {
1384
+ className: "mbrd-card-main",
1385
+ type: "button",
1386
+ role: "radio",
1387
+ "aria-checked": selected,
1388
+ disabled,
1389
+ onClick: onSelect,
1390
+ children: [
1391
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-radio", "aria-hidden": true }),
1392
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-card-text", children: [
1393
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-card-title", children: title }),
1394
+ detail ? /* @__PURE__ */ jsx3("span", { className: "mbrd-card-detail", style: { display: "block" }, children: detail }) : null
1395
+ ] }),
1396
+ badges ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badges", children: badges }) : null
1397
+ ]
1398
+ }
1399
+ ),
1400
+ selected && children ? /* @__PURE__ */ jsx3("div", { className: "mbrd-sub", children }) : null
1401
+ ] });
1402
+ }
1403
+ function RecipientChoice({
1404
+ selected,
1405
+ disabled,
1406
+ title,
1407
+ detail,
1408
+ onSelect,
1409
+ children
1410
+ }) {
1411
+ return /* @__PURE__ */ jsxs3("div", { className: "mbrd-choice", "data-selected": selected, "data-disabled": Boolean(disabled), children: [
1412
+ /* @__PURE__ */ jsxs3(
1413
+ "button",
1414
+ {
1415
+ className: "mbrd-choice-main",
1416
+ type: "button",
1417
+ role: "radio",
1418
+ "aria-checked": selected,
1419
+ disabled,
1420
+ onClick: onSelect,
1421
+ children: [
1422
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-radio", "aria-hidden": true, style: { width: 15, height: 15 } }),
1423
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-card-text", children: [
1424
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-choice-title", children: title }),
1425
+ detail ? /* @__PURE__ */ jsx3("span", { className: "mbrd-choice-detail", style: { display: "block" }, children: detail }) : null
1426
+ ] })
1427
+ ]
1428
+ }
1429
+ ),
1430
+ selected && children ? /* @__PURE__ */ jsx3("div", { className: "mbrd-choice-body", children }) : null
1431
+ ] });
1432
+ }
1433
+ function SendRouteDialog({
1434
+ title = "Send bill",
1435
+ delivery,
1436
+ submitting = false,
1437
+ disabled = false,
1438
+ error = null,
1439
+ onCancel,
1440
+ onConfirm
1441
+ }) {
1442
+ const ebillOption = delivery.options.find((option) => option.route === "ebill");
1443
+ const mailOption = delivery.options.find((option) => option.route === "mail");
1444
+ const recommendedRoute = delivery.recommended.route;
1445
+ const onFileEmail = extractSendRouteEmail(delivery.contacts.claimsEmail);
1446
+ const onFileFax = delivery.contacts.faxNumber?.trim() || null;
1447
+ const onFileFaxDisplay = formatSendRouteFax(onFileFax);
1448
+ const onFileMail = delivery.contacts.mailingAddress?.trim() || "";
1449
+ const [route, setRoute] = useState3(recommendedRoute);
1450
+ const [emailMode, setEmailMode] = useState3(onFileEmail ? "onfile" : "alt");
1451
+ const [faxMode, setFaxMode] = useState3(onFileFax ? "onfile" : "alt");
1452
+ const [emailTo, setEmailTo] = useState3("");
1453
+ const [subject, setSubject] = useState3("");
1454
+ const [faxTo, setFaxTo] = useState3("");
1455
+ const [attention, setAttention] = useState3("");
1456
+ const [mailTo, setMailTo] = useState3(onFileMail);
1457
+ useEffect3(() => {
1458
+ setRoute(recommendedRoute);
1459
+ setEmailMode(onFileEmail ? "onfile" : "alt");
1460
+ setFaxMode(onFileFax ? "onfile" : "alt");
1461
+ setMailTo(onFileMail);
1462
+ }, [recommendedRoute, onFileEmail, onFileFax, onFileMail]);
1463
+ useEffect3(() => {
1464
+ const onKey = (event) => {
1465
+ if (event.key === "Escape" && !submitting) onCancel();
1466
+ };
1467
+ window.addEventListener("keydown", onKey);
1468
+ return () => window.removeEventListener("keydown", onKey);
1469
+ }, [onCancel, submitting]);
1470
+ const effectiveEmail = emailMode === "onfile" && onFileEmail ? onFileEmail : emailTo.trim();
1471
+ const effectiveFax = faxMode === "onfile" && onFileFax ? onFileFax : faxTo;
1472
+ const faxDigits = effectiveFax.replace(/\D/g, "");
1473
+ const emailValid = EMAIL_RE.test(effectiveEmail);
1474
+ const faxValid = faxDigits.length >= 10;
1475
+ const mailValid = mailTo.trim().length > 2;
1476
+ const confirmDisabled = submitting || disabled || route === "email" && !emailValid || route === "fax" && !faxValid || route === "mail" && !mailValid;
1477
+ const submission = useMemo2(() => {
1478
+ if (route === "email") {
1479
+ return {
1480
+ route,
1481
+ destination: { email: effectiveEmail },
1482
+ ...subject.trim() ? { subject: subject.trim() } : {}
1483
+ };
1484
+ }
1485
+ if (route === "fax") {
1486
+ return {
1487
+ route,
1488
+ destination: { faxNumber: effectiveFax.trim() },
1489
+ ...attention.trim() ? { attention: attention.trim() } : {}
1490
+ };
1491
+ }
1492
+ if (route === "mail") {
1493
+ return { route, destination: { mailingAddress: mailTo.trim() } };
1494
+ }
1495
+ return { route };
1496
+ }, [route, effectiveEmail, subject, effectiveFax, attention, mailTo]);
1497
+ return /* @__PURE__ */ jsxs3("div", { className: "mbrd-overlay", role: "presentation", onMouseDown: (event) => {
1498
+ if (event.target === event.currentTarget && !submitting) onCancel();
1499
+ }, children: [
1500
+ /* @__PURE__ */ jsx3("style", { children: css }),
1501
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd", role: "dialog", "aria-modal": "true", "aria-label": typeof title === "string" ? title : "Send bill", children: [
1502
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd-head", children: [
1503
+ /* @__PURE__ */ jsxs3("div", { children: [
1504
+ /* @__PURE__ */ jsx3("h3", { className: "mbrd-title", children: title }),
1505
+ /* @__PURE__ */ jsx3("p", { className: "mbrd-copy", children: "Select the delivery method." })
1506
+ ] }),
1507
+ /* @__PURE__ */ jsx3("button", { className: "mbrd-close", type: "button", "aria-label": "Close", disabled: submitting, onClick: onCancel, children: "\xD7" })
1508
+ ] }),
1509
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd-cards", role: "radiogroup", "aria-label": "Delivery method", children: [
1510
+ ebillOption ? /* @__PURE__ */ jsx3(
1511
+ RouteCard,
1512
+ {
1513
+ selected: route === "ebill",
1514
+ title: ebillOption.printAndMail ? ebillOption.label : `e-Bill to ${ebillOption.payerName || delivery.payerName}`,
1515
+ detail: [
1516
+ ebillOption.detail || null,
1517
+ !ebillOption.printAndMail && ebillOption.label.startsWith("e-bill ") ? ebillOption.label.slice("e-bill ".length) : null
1518
+ ].filter(Boolean).join(" \xB7 "),
1519
+ badges: /* @__PURE__ */ jsxs3(Fragment2, { children: [
1520
+ !ebillOption.fallback ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "verified", children: "Verified Route" }) : null,
1521
+ recommendedRoute === "ebill" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null
1522
+ ] }),
1523
+ onSelect: () => setRoute("ebill")
1524
+ }
1525
+ ) : null,
1526
+ /* @__PURE__ */ jsxs3(
1527
+ RouteCard,
1528
+ {
1529
+ selected: route === "email",
1530
+ title: "Email Bill",
1531
+ detail: onFileEmail ?? "No claims email on file \u2014 enter a recipient.",
1532
+ badges: recommendedRoute === "email" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null,
1533
+ onSelect: () => setRoute("email"),
1534
+ children: [
1535
+ /* @__PURE__ */ jsxs3("div", { role: "radiogroup", "aria-label": "Email recipient", style: { display: "grid", gap: 8 }, children: [
1536
+ /* @__PURE__ */ jsx3(
1537
+ RecipientChoice,
1538
+ {
1539
+ selected: emailMode === "onfile",
1540
+ disabled: !onFileEmail,
1541
+ title: onFileEmail ?? "Claims email on file",
1542
+ detail: onFileEmail ? "Claims contact on file" : "No claims email exists on file for this payer.",
1543
+ onSelect: () => setEmailMode("onfile")
1544
+ }
1545
+ ),
1546
+ /* @__PURE__ */ jsx3(
1547
+ RecipientChoice,
1548
+ {
1549
+ selected: emailMode === "alt",
1550
+ title: "Alternative email recipient",
1551
+ onSelect: () => setEmailMode("alt"),
1552
+ children: /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1553
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-label", children: [
1554
+ "Alternative email address ",
1555
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-star", children: "*" })
1556
+ ] }),
1557
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", type: "email", value: emailTo, placeholder: "user@mail.com", onChange: (event) => setEmailTo(event.target.value) }),
1558
+ emailTo.trim() && !EMAIL_RE.test(emailTo.trim()) ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Enter a valid email address." }) : null
1559
+ ] })
1560
+ }
1561
+ )
1562
+ ] }),
1563
+ /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1564
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-label", children: "Email subject \u2014 optional" }),
1565
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", value: subject, maxLength: 255, onChange: (event) => setSubject(event.target.value) })
1566
+ ] })
1567
+ ]
1568
+ }
1569
+ ),
1570
+ /* @__PURE__ */ jsxs3(
1571
+ RouteCard,
1572
+ {
1573
+ selected: route === "fax",
1574
+ title: "Fax Bill",
1575
+ detail: onFileFax ? `${onFileFaxDisplay} \u2014 payer fax on file` : "No fax on file \u2014 enter a number.",
1576
+ badges: recommendedRoute === "fax" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null,
1577
+ onSelect: () => setRoute("fax"),
1578
+ children: [
1579
+ /* @__PURE__ */ jsxs3("div", { role: "radiogroup", "aria-label": "Fax recipient", style: { display: "grid", gap: 8 }, children: [
1580
+ /* @__PURE__ */ jsx3(
1581
+ RecipientChoice,
1582
+ {
1583
+ selected: faxMode === "onfile",
1584
+ disabled: !onFileFax,
1585
+ title: onFileFax ? onFileFaxDisplay : "Payer fax on file",
1586
+ detail: onFileFax ? "Payer fax on file" : "No fax number exists on file for this payer.",
1587
+ onSelect: () => setFaxMode("onfile")
1588
+ }
1589
+ ),
1590
+ /* @__PURE__ */ jsx3(
1591
+ RecipientChoice,
1592
+ {
1593
+ selected: faxMode === "alt",
1594
+ title: "Alternative fax recipient",
1595
+ onSelect: () => setFaxMode("alt"),
1596
+ children: /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1597
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-label", children: [
1598
+ "Alternative fax number ",
1599
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-star", children: "*" })
1600
+ ] }),
1601
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", inputMode: "tel", value: faxTo, placeholder: "(000) 000-0000", onChange: (event) => setFaxTo(event.target.value) }),
1602
+ faxTo.trim() && faxTo.replace(/\D/g, "").length < 10 ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Enter a valid fax number (10 digits)." }) : null
1603
+ ] })
1604
+ }
1605
+ )
1606
+ ] }),
1607
+ /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1608
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-label", children: "Attention \u2014 optional" }),
1609
+ /* @__PURE__ */ jsx3("input", { className: "mbrd-input", value: attention, maxLength: 120, placeholder: "Recipient name", onChange: (event) => setAttention(event.target.value) }),
1610
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-help", children: "Printed as ATTENTION on the fax cover sheet." })
1611
+ ] })
1612
+ ]
1613
+ }
1614
+ ),
1615
+ /* @__PURE__ */ jsx3(
1616
+ RouteCard,
1617
+ {
1618
+ selected: route === "mail",
1619
+ title: "Mail Bill",
1620
+ detail: onFileMail ? onFileMail.replace(/\n/g, ", ") : "Physical mail \u2014 enter the payer's mailing address.",
1621
+ badges: recommendedRoute === "mail" ? /* @__PURE__ */ jsx3("span", { className: "mbrd-badge", "data-tone": "auto", children: "Auto" }) : null,
1622
+ onSelect: () => setRoute("mail"),
1623
+ children: /* @__PURE__ */ jsxs3("label", { className: "mbrd-field", children: [
1624
+ /* @__PURE__ */ jsxs3("span", { className: "mbrd-label", children: [
1625
+ "Mailing address ",
1626
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-star", children: "*" })
1627
+ ] }),
1628
+ /* @__PURE__ */ jsx3("textarea", { className: "mbrd-textarea", value: mailTo, placeholder: "Payer Claims Dept\nPO Box 1234\nCity, ST 00000", onChange: (event) => setMailTo(event.target.value) }),
1629
+ !mailValid ? /* @__PURE__ */ jsx3("span", { className: "mbrd-error", children: "Enter a mailing address." }) : null,
1630
+ /* @__PURE__ */ jsx3("span", { className: "mbrd-help", children: mailOption?.printAndMail ? mailOption.detail : "Sent as physical mail \u2014 printed and mailed to this address." })
1631
+ ] })
1632
+ }
1633
+ )
1634
+ ] }),
1635
+ error ? /* @__PURE__ */ jsx3("div", { className: "mbrd-alert", role: "alert", children: error }) : null,
1636
+ /* @__PURE__ */ jsxs3("div", { className: "mbrd-actions", children: [
1637
+ /* @__PURE__ */ jsx3("button", { className: "mbrd-cancel", type: "button", disabled: submitting, onClick: onCancel, children: "Cancel" }),
1638
+ /* @__PURE__ */ jsx3(
1639
+ "button",
1640
+ {
1641
+ className: "mbrd-confirm",
1642
+ type: "button",
1643
+ disabled: confirmDisabled,
1644
+ onClick: () => onConfirm(submission),
1645
+ children: submitting ? "Submitting\u2026" : CONFIRM_LABELS[route]
1646
+ }
1647
+ )
1648
+ ] })
1649
+ ] })
1650
+ ] });
1651
+ }
1652
+
1302
1653
  // src/billing-catalog.ts
1303
1654
  var DEFAULT_BILL_SUBMISSION_PROCEDURES = [
1304
1655
  { code: "ML200", description: "Missed appointment for a medical-legal evaluation", allowedAmount: 503.75 },
@@ -1460,7 +1811,7 @@ function calculateBillSubmissionAllowedAmount(line, procedures = DEFAULT_BILL_SU
1460
1811
  }
1461
1812
 
1462
1813
  // src/bill-submission-form.tsx
1463
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1814
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1464
1815
  var BILL_SUBMISSION_DOCUMENT_TYPES = [
1465
1816
  "final_report",
1466
1817
  "proof_of_service",
@@ -1779,7 +2130,7 @@ function validateBillSubmission(bill) {
1779
2130
  });
1780
2131
  return { valid: Object.keys(errors).length === 0, fieldErrors: errors };
1781
2132
  }
1782
- var css = `
2133
+ var css2 = `
1783
2134
  .mbsf{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbsf *{box-sizing:border-box}
1784
2135
  .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
2136
  .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 +2143,27 @@ var css = `
1792
2143
  @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
2144
  `;
1794
2145
  function RequiredMark() {
1795
- return /* @__PURE__ */ jsx3("span", { className: "mbsf-star", children: " *" });
2146
+ return /* @__PURE__ */ jsx4("span", { className: "mbsf-star", children: " *" });
1796
2147
  }
1797
2148
  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: [
2149
+ return /* @__PURE__ */ jsxs4("label", { className: `mbsf-field${span ? " mbsf-span" : ""}`, "data-field-path": path, "data-invalid": Boolean(error), children: [
2150
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-label", children: [
1800
2151
  label,
1801
- required ? /* @__PURE__ */ jsx3(RequiredMark, {}) : null
2152
+ required ? /* @__PURE__ */ jsx4(RequiredMark, {}) : null
1802
2153
  ] }),
1803
2154
  children,
1804
- error ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: error }) : null
2155
+ error ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", role: "alert", children: error }) : null
1805
2156
  ] });
1806
2157
  }
1807
2158
  function TextDateInput({ value, onChange, disabled, required, ariaLabel }) {
1808
- const [display, setDisplay] = useState3(() => formatBillSubmissionDate(value));
1809
- const [invalid, setInvalid] = useState3(false);
1810
- useEffect3(() => {
2159
+ const [display, setDisplay] = useState4(() => formatBillSubmissionDate(value));
2160
+ const [invalid, setInvalid] = useState4(false);
2161
+ useEffect4(() => {
1811
2162
  setDisplay(formatBillSubmissionDate(value));
1812
2163
  setInvalid(false);
1813
2164
  }, [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) => {
2165
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
2166
+ /* @__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
2167
  const next = event.target.value;
1817
2168
  const parsed = parseBillSubmissionDate(next);
1818
2169
  setDisplay(next);
@@ -1820,21 +2171,21 @@ function TextDateInput({ value, onChange, disabled, required, ariaLabel }) {
1820
2171
  if (!next.trim()) onChange("");
1821
2172
  else if (parsed) onChange(parsed);
1822
2173
  }, onBlur: () => setInvalid(Boolean(display && !parseBillSubmissionDate(display))) }),
1823
- invalid ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", children: "Use MM/DD/YYYY" }) : null
2174
+ invalid ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", children: "Use MM/DD/YYYY" }) : null
1824
2175
  ] });
1825
2176
  }
1826
2177
  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(() => {
2178
+ const [open, setOpen] = useState4(false);
2179
+ const [query, setQuery] = useState4("");
2180
+ const visible = useMemo3(() => {
1830
2181
  const q = query.trim().toLowerCase();
1831
2182
  const matches = q ? options.filter((option) => `${option.id} ${option.label} ${option.detail ?? ""}`.toLowerCase().includes(q)) : options;
1832
2183
  const custom = createOption?.(query) ?? null;
1833
2184
  return custom && !matches.some((option) => option.id.toUpperCase() === custom.id.toUpperCase()) ? [...matches, custom] : matches;
1834
2185
  }, [createOption, options, query]);
1835
2186
  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: () => {
2187
+ return /* @__PURE__ */ jsxs4("div", { className: "mbsf-combo", children: [
2188
+ /* @__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
2189
  const next = preserveValueOnOpen ? value : "";
1839
2190
  setOpen(true);
1840
2191
  setQuery(next);
@@ -1845,19 +2196,19 @@ function ComboBox({ value, placeholder, options, disabled, loading, loadingMore,
1845
2196
  setQuery(event.target.value);
1846
2197
  onQuery?.(event.target.value);
1847
2198
  }, onBlur: () => setTimeout(() => setOpen(false), 120) }),
1848
- showMenu ? /* @__PURE__ */ jsxs3("div", { className: "mbsf-menu", role: "listbox", onScroll: (event) => {
2199
+ showMenu ? /* @__PURE__ */ jsxs4("div", { className: "mbsf-menu", role: "listbox", onScroll: (event) => {
1849
2200
  const menu = event.currentTarget;
1850
2201
  if (menu.scrollHeight - menu.scrollTop - menu.clientHeight < 120) onEndReached?.();
1851
2202
  }, 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: () => {
2203
+ 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
2204
  onSelect(option);
1854
2205
  setOpen(false);
1855
2206
  setQuery("");
1856
2207
  }, 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
2208
+ /* @__PURE__ */ jsx4("strong", { children: option.label }),
2209
+ option.detail ? /* @__PURE__ */ jsx4("small", { children: option.detail }) : null
2210
+ ] }, option.id)) : /* @__PURE__ */ jsx4("div", { className: "mbsf-option", children: "No matches" }),
2211
+ loadingMore ? /* @__PURE__ */ jsx4("div", { className: "mbsf-menu-status", children: "Loading more\u2026" }) : null
1861
2212
  ] }) : null
1862
2213
  ] });
1863
2214
  }
@@ -1907,28 +2258,28 @@ var BillSubmissionSectionsContext = createContext(null);
1907
2258
  function BillSubmissionSection({ id }) {
1908
2259
  const sections = useContext(BillSubmissionSectionsContext);
1909
2260
  if (!sections) throw new Error("Bill submission sections must be rendered inside BillSubmissionForm.");
1910
- return /* @__PURE__ */ jsx3(Fragment2, { children: sections[id] });
2261
+ return /* @__PURE__ */ jsx4(Fragment3, { children: sections[id] });
1911
2262
  }
1912
2263
  function BillSubmissionHeader() {
1913
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "header" });
2264
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "header" });
1914
2265
  }
1915
2266
  function BillSubmissionPatientSection() {
1916
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "patient" });
2267
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "patient" });
1917
2268
  }
1918
2269
  function BillSubmissionClaimSection() {
1919
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "claim" });
2270
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "claim" });
1920
2271
  }
1921
2272
  function BillSubmissionProvidersSection() {
1922
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "providers" });
2273
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "providers" });
1923
2274
  }
1924
2275
  function BillSubmissionServiceLinesSection() {
1925
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "serviceLines" });
2276
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "serviceLines" });
1926
2277
  }
1927
2278
  function BillSubmissionAttachmentsSection() {
1928
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "attachments" });
2279
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "attachments" });
1929
2280
  }
1930
2281
  function BillSubmissionActions() {
1931
- return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "actions" });
2282
+ return /* @__PURE__ */ jsx4(BillSubmissionSection, { id: "actions" });
1932
2283
  }
1933
2284
  function BillSubmissionForm({
1934
2285
  initialBill,
@@ -1946,6 +2297,7 @@ function BillSubmissionForm({
1946
2297
  procedureOptions,
1947
2298
  modifierOptions,
1948
2299
  taxonomyOptions,
2300
+ deliveryRoutePicker = "auto",
1949
2301
  attachmentReportTypeMode = "auto",
1950
2302
  attachmentReportTypes = BILL_SUBMISSION_REPORT_TYPES,
1951
2303
  defaultAttachmentReportType,
@@ -1958,42 +2310,44 @@ function BillSubmissionForm({
1958
2310
  description = "Review the bill details, add attachments, and submit.",
1959
2311
  children
1960
2312
  }) {
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);
2313
+ const [bill, setBill] = useState4(() => cloneInitialBill(initialBill));
2314
+ const [selectedIds, setSelectedIds] = useState4(() => attachments.map((item) => item.id));
2315
+ const [removedSourceIds, setRemovedSourceIds] = useState4([]);
2316
+ const [uploads, setUploads] = useState4([]);
2317
+ const [errors, setErrors] = useState4({});
2318
+ const [sourceAttachmentReportTypes, setSourceAttachmentReportTypes] = useState4(() => Object.fromEntries(attachments.flatMap((item) => item.reportTypeCode ? [[item.id, item.reportTypeCode]] : [])));
2319
+ const [validationActive, setValidationActive] = useState4(false);
2320
+ const [formError, setFormError] = useState4(null);
2321
+ const [submitting, setSubmitting] = useState4(false);
2322
+ const [routeDialog, setRouteDialog] = useState4(null);
2323
+ const [routeError, setRouteError] = useState4(null);
2324
+ const [payerResults, setPayerResults] = useState4([]);
2325
+ const [payerLoading, setPayerLoading] = useState4(false);
2326
+ const [diagnosisResults, setDiagnosisResults] = useState4([]);
2327
+ const [diagnosisLoading, setDiagnosisLoading] = useState4(false);
2328
+ const [diagnosisLoadingMore, setDiagnosisLoadingMore] = useState4(false);
2329
+ const [diagnosisQuery, setDiagnosisQuery] = useState4(null);
2330
+ const [diagnosisHasMore, setDiagnosisHasMore] = useState4(true);
2331
+ const [postalStatus, setPostalStatus] = useState4(null);
2332
+ const [dragActive, setDragActive] = useState4(false);
1979
2333
  const formRef = useRef2(null);
1980
2334
  const fileInput = useRef2(null);
1981
2335
  const diagnosisRequest = useRef2(0);
1982
2336
  const diagnosisAppendPending = useRef2(false);
1983
2337
  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));
2338
+ const procedures = useMemo3(() => mergeOptions(DEFAULT_BILL_SUBMISSION_PROCEDURES, procedureOptions), [procedureOptions]);
2339
+ const modifiers = useMemo3(() => mergeOptions(DEFAULT_BILL_SUBMISSION_MODIFIERS, modifierOptions), [modifierOptions]);
2340
+ const taxonomies = useMemo3(() => mergeOptions(DEFAULT_BILL_SUBMISSION_TAXONOMIES, taxonomyOptions), [taxonomyOptions]);
2341
+ const [evaluationType, setEvaluationType] = useState4(() => initialEvaluationType(initialBill));
1988
2342
  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]);
2343
+ const referenceClient = useMemo3(() => getSession || sessionEndpoint || connected ? createBillReferenceClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
2344
+ const submissionClient = useMemo3(() => connected ? createBillSubmissionClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
1991
2345
  const locked = disabled || submitting;
1992
2346
  const showAttachmentReportTypes = attachmentReportTypeMode === "visible" || attachmentReportTypeMode === "auto" && bill.billingMode !== "med_legal";
1993
2347
  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]);
2348
+ const reportTypeOptions = useMemo3(() => attachmentReportTypes.map((item) => ({ id: item.code, label: item.code.replace(/^OZ:/, ""), detail: item.label })), [attachmentReportTypes]);
1995
2349
  const missingAttachmentReportType = showAttachmentReportTypes && (selectedIds.some((id) => !(sourceAttachmentReportTypes[id] || attachments.find((item) => item.id === id)?.reportTypeCode || defaultAttachmentReportType)) || uploads.some((upload) => !(upload.reportTypeCode || defaultAttachmentReportType)));
1996
- useEffect3(() => {
2350
+ useEffect4(() => {
1997
2351
  setBill(cloneInitialBill(initialBill));
1998
2352
  setEvaluationType(initialEvaluationType(initialBill));
1999
2353
  setSelectedIds(attachments.map((item) => item.id));
@@ -2009,7 +2363,7 @@ function BillSubmissionForm({
2009
2363
  diagnosisRequest.current += 1;
2010
2364
  diagnosisAppendPending.current = false;
2011
2365
  }, [initialBill, attachments]);
2012
- useEffect3(() => {
2366
+ useEffect4(() => {
2013
2367
  if (!validationActive) return;
2014
2368
  const next = validateBillSubmission(bill).fieldErrors;
2015
2369
  setErrors(missingAttachmentReportType ? { ...next, attachments: "Select a report type for every attachment." } : next);
@@ -2027,7 +2381,7 @@ function BillSubmissionForm({
2027
2381
  if (selectedIds.length + uploads.length + files.length > MAX_DOCUMENTS) return setFormError(`A bill can include at most ${MAX_DOCUMENTS} attachments.`);
2028
2382
  setUploads((current) => [...current, ...files.map((file) => ({ file, documentType: "other", ...defaultAttachmentReportType ? { reportTypeCode: defaultAttachmentReportType } : {} }))]);
2029
2383
  }, [defaultAttachmentReportType, selectedIds.length, uploads]);
2030
- useEffect3(() => {
2384
+ useEffect4(() => {
2031
2385
  const over = (event) => {
2032
2386
  if (event.dataTransfer?.types.includes("Files")) {
2033
2387
  event.preventDefault();
@@ -2066,7 +2420,7 @@ function BillSubmissionForm({
2066
2420
  }
2067
2421
  return next;
2068
2422
  })) }));
2069
- const text = (value, onChange, options = {}) => /* @__PURE__ */ jsx3("input", { className: "mbsf-input", disabled: locked, value: value ?? "", onChange: (event) => onChange(event.target.value), ...options });
2423
+ const text = (value, onChange, options = {}) => /* @__PURE__ */ jsx4("input", { className: "mbsf-input", disabled: locked, value: value ?? "", onChange: (event) => onChange(event.target.value), ...options });
2070
2424
  const runPayerSearch = useCallback(async (query, autoSelect) => {
2071
2425
  const trimmed = query.trim();
2072
2426
  if (trimmed.length < 2) {
@@ -2097,7 +2451,7 @@ function BillSubmissionForm({
2097
2451
  });
2098
2452
  void runPayerSearch(query, true);
2099
2453
  };
2100
- useEffect3(() => {
2454
+ useEffect4(() => {
2101
2455
  const payer = bill.claim.claimsAdministrator;
2102
2456
  if (!payer?.name || payer.name.trim().length < 2) return;
2103
2457
  void runPayerSearch(payer.name, !payer.id);
@@ -2138,7 +2492,7 @@ function BillSubmissionForm({
2138
2492
  });
2139
2493
  };
2140
2494
  const searchDiagnoses = (query) => loadDiagnoses(query);
2141
- const diagnosisChoices = useMemo2(() => mergeDiagnosisOptions([...diagnosisOptions, ...diagnosisResults]), [diagnosisOptions, diagnosisResults]);
2495
+ const diagnosisChoices = useMemo3(() => mergeDiagnosisOptions([...diagnosisOptions, ...diagnosisResults]), [diagnosisOptions, diagnosisResults]);
2142
2496
  const updatePostalCode = (postalCode) => {
2143
2497
  setAddress({ postalCode });
2144
2498
  setPostalStatus(null);
@@ -2178,25 +2532,58 @@ function BillSubmissionForm({
2178
2532
  }
2179
2533
  if (selectedIds.length + uploads.length > MAX_DOCUMENTS) return setFormError(`A bill can include at most ${MAX_DOCUMENTS} attachments.`);
2180
2534
  const complete = clean;
2181
- setSubmitting(true);
2182
- try {
2183
- if (onSubmit) {
2535
+ if (onSubmit) {
2536
+ setSubmitting(true);
2537
+ try {
2184
2538
  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 } : {}
2539
+ } catch (caught) {
2540
+ setFormError(caught instanceof Error ? caught.message : "Unable to submit the bill.");
2541
+ } finally {
2542
+ setSubmitting(false);
2543
+ }
2544
+ return;
2545
+ }
2546
+ if (deliveryRoutePicker !== "off" && referenceClient) {
2547
+ setSubmitting(true);
2548
+ try {
2549
+ const delivery = await referenceClient.getDeliveryPreview({
2550
+ claimsAdministratorId: complete.claim.claimsAdministrator.id,
2551
+ ...complete.claim.injuryState ? { injuryState: complete.claim.injuryState } : {}
2194
2552
  });
2195
- const result = await submissionClient.submitBill({ bill: complete, documents });
2196
- await onSubmitted?.(result);
2553
+ setSubmitting(false);
2554
+ setRouteError(null);
2555
+ setRouteDialog({ delivery, complete });
2556
+ return;
2557
+ } catch {
2558
+ setSubmitting(false);
2197
2559
  }
2560
+ }
2561
+ await performConnectedSubmit(complete, void 0);
2562
+ }
2563
+ async function performConnectedSubmit(complete, submission) {
2564
+ setSubmitting(true);
2565
+ try {
2566
+ if (!submissionClient) throw new Error("The connected billing client is unavailable.");
2567
+ const documents = await prepareBillSubmissionDocuments({
2568
+ attachments,
2569
+ selectedIds,
2570
+ uploads,
2571
+ reportTypeCodeByAttachmentId: sourceAttachmentReportTypes,
2572
+ ...forcedAttachmentReportType ? { defaultReportTypeCode: forcedAttachmentReportType } : {},
2573
+ ...fetchOverride ? { fetch: fetchOverride } : {}
2574
+ });
2575
+ const result = await submissionClient.submitBill({
2576
+ bill: complete,
2577
+ ...submission ? { submission } : {},
2578
+ documents
2579
+ });
2580
+ setRouteDialog(null);
2581
+ setRouteError(null);
2582
+ await onSubmitted?.(result);
2198
2583
  } catch (caught) {
2199
- setFormError(caught instanceof Error ? caught.message : "Unable to submit the bill.");
2584
+ const message = caught instanceof Error ? caught.message : "Unable to submit the bill.";
2585
+ if (submission) setRouteError(message);
2586
+ else setFormError(message);
2200
2587
  } finally {
2201
2588
  setSubmitting(false);
2202
2589
  }
@@ -2205,210 +2592,210 @@ function BillSubmissionForm({
2205
2592
  const selectedPayer = payerResults.find((payer) => payer.id === bill.claim.claimsAdministrator?.id);
2206
2593
  const payerRecommendations = bill.claim.claimsAdministrator?.id ? [] : claimsAdministratorRecommendations(payerResults);
2207
2594
  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 })
2595
+ const headerSection = /* @__PURE__ */ jsxs4("div", { className: "mbsf-head", children: [
2596
+ /* @__PURE__ */ jsxs4("div", { children: [
2597
+ /* @__PURE__ */ jsx4("h3", { className: "mbsf-title", children: heading }),
2598
+ /* @__PURE__ */ jsx4("p", { className: "mbsf-copy", children: description })
2212
2599
  ] }),
2213
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-required", children: [
2214
- /* @__PURE__ */ jsx3(RequiredMark, {}),
2600
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-required", children: [
2601
+ /* @__PURE__ */ jsx4(RequiredMark, {}),
2215
2602
  " Required"
2216
2603
  ] })
2217
2604
  ] });
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: [
2605
+ const patientSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2606
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Patient" }),
2607
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-grid", children: [
2608
+ /* @__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 } }))) }),
2609
+ /* @__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 } }))) }),
2610
+ /* @__PURE__ */ jsx4(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
2611
+ /* @__PURE__ */ jsx4(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
2612
+ /* @__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 } })) }) }),
2613
+ /* @__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" }) }),
2614
+ /* @__PURE__ */ jsxs4(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
2228
2615
  text(bill.patient.address.postalCode, updatePostalCode, { maxLength: 10 }),
2229
- postalStatus ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: postalStatus }) : null
2616
+ postalStatus ? /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: postalStatus }) : null
2230
2617
  ] }),
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 }) })
2618
+ /* @__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 })) }),
2619
+ /* @__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
2620
  ] })
2234
2621
  ] });
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: [
2622
+ const claimSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2623
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Injury & claim" }),
2624
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-grid", children: [
2625
+ /* @__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 } })) }) }),
2626
+ /* @__PURE__ */ jsxs4(Field2, { label: "Treatment authorization # (optional)", children: [
2240
2627
  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." })
2628
+ /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Rides on the bill as CMS-1500 Box 23 / 837 REF*G1." })
2242
2629
  ] }),
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:" }),
2630
+ /* @__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 } })) }) }),
2631
+ /* @__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 } }))) }),
2632
+ /* @__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 } }))) }),
2633
+ /* @__PURE__ */ jsx4(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
2634
+ /* @__PURE__ */ jsxs4(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: [
2635
+ /* @__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 }) }),
2636
+ selectedPayer ? /* @__PURE__ */ jsxs4("div", { className: "mbsf-payer-status", role: "status", children: [
2637
+ /* @__PURE__ */ jsx4("strong", { children: "\u2713 Routing match set:" }),
2251
2638
  " ",
2252
2639
  selectedPayer.name
2253
2640
  ] }) : 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: [
2641
+ 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
2642
  signal.state === "match" ? "\u2713" : "!",
2256
2643
  " ",
2257
2644
  signal.label
2258
2645
  ] }, `${signal.kind}-${index}`)) }) : null,
2259
- !selectedPayer && payerRecommendations.length ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
2260
- /* @__PURE__ */ jsxs3("p", { className: "mbsf-payer-intro", children: [
2646
+ !selectedPayer && payerRecommendations.length ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
2647
+ /* @__PURE__ */ jsxs4("p", { className: "mbsf-payer-intro", children: [
2261
2648
  "Confirm the best routing match for ",
2262
- /* @__PURE__ */ jsx3("strong", { children: bill.claim.claimsAdministrator?.name }),
2649
+ /* @__PURE__ */ jsx4("strong", { children: bill.claim.claimsAdministrator?.name }),
2263
2650
  ":"
2264
2651
  ] }),
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: [
2652
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-payer-list", children: payerRecommendations.map((payer) => /* @__PURE__ */ jsxs4("div", { className: "mbsf-payer-option", children: [
2653
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-payer-option-main", children: [
2654
+ /* @__PURE__ */ jsx4("strong", { children: payer.name }),
2655
+ 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
2656
  signal.state === "match" ? "\u2713" : "!",
2270
2657
  " ",
2271
2658
  signal.label
2272
- ] }, `${signal.kind}-${index}`)) }) : /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: "Directory match" })
2659
+ ] }, `${signal.kind}-${index}`)) }) : /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Directory match" })
2273
2660
  ] }),
2274
- /* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => choosePayer(payer), children: "Use" })
2661
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-secondary", type: "button", onClick: () => choosePayer(payer), children: "Use" })
2275
2662
  ] }, payer.id)) })
2276
2663
  ] }) : 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
2664
+ !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
2665
  ] }),
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) => {
2666
+ /* @__PURE__ */ jsx4(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
2667
+ /* @__PURE__ */ jsxs4(Field2, { path: "diagnoses", label: "Diagnosis codes (ICD-10)", required: true, span: true, error: errors.diagnoses, children: [
2668
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
2282
2669
  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: [
2670
+ 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
2671
  selected ? "\u2713" : "+",
2285
2672
  " ",
2286
2673
  option.label
2287
2674
  ] }, option.code);
2288
2675
  }) }),
2289
- /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
2676
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
2290
2677
  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 }),
2678
+ return /* @__PURE__ */ jsxs4("span", { className: "mbsf-chip", children: [
2679
+ /* @__PURE__ */ jsx4("strong", { children: code }),
2293
2680
  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" })
2681
+ /* @__PURE__ */ jsx4("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
2295
2682
  ] }, code);
2296
2683
  }) }),
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: () => {
2684
+ /* @__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
2685
  if (diagnosisQuery !== "") loadDiagnoses("");
2299
2686
  }, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
2300
2687
  ] })
2301
2688
  ] })
2302
2689
  ] });
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) => {
2690
+ const providersSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2691
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
2692
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-grid", children: [
2693
+ /* @__PURE__ */ jsx4("h4", { className: "mbsf-subhead", children: "Billing provider" }),
2694
+ /* @__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 } }))) }),
2695
+ /* @__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" }) }),
2696
+ /* @__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 }) }),
2697
+ /* @__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" }) }),
2698
+ /* @__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 ?? "" } } }))) }),
2699
+ /* @__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 ?? "" } } }))) }),
2700
+ /* @__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 ?? "" } } }))) }),
2701
+ /* @__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 }) }),
2702
+ /* @__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 } } }))) }),
2703
+ /* @__PURE__ */ jsx4("h4", { className: "mbsf-subhead", children: "Rendering provider" }),
2704
+ /* @__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 } }))) }),
2705
+ /* @__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 }) }),
2706
+ /* @__PURE__ */ jsxs4(Field2, { path: "renderingProvider.taxonomy", label: "Rendering taxonomy", required: true, error: errors["renderingProvider.taxonomy"], children: [
2707
+ /* @__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
2708
  const code = query.trim().toUpperCase();
2322
2709
  return /^[A-Z0-9]{10}$/.test(code) ? { id: code, label: code, detail: "Use this taxonomy code" } : null;
2323
2710
  }, 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." })
2711
+ /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Search by specialty name or 10-character taxonomy code." })
2325
2712
  ] }),
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 } } }))) })
2713
+ /* @__PURE__ */ jsx4("h4", { className: "mbsf-subhead", children: "Service facility" }),
2714
+ /* @__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" }) }),
2715
+ /* @__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 ?? "" } } }))) }),
2716
+ /* @__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 ?? "" } } }))) }),
2717
+ /* @__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 ?? "" } } }))) }),
2718
+ /* @__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 }) }),
2719
+ /* @__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
2720
  ] })
2334
2721
  ] });
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: [
2722
+ const serviceLinesSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", disabled: locked, children: [
2723
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
2724
+ /* @__PURE__ */ jsx4("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
2725
+ /* @__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)) }),
2726
+ /* @__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." }),
2727
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
2728
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-line-head", children: [
2729
+ /* @__PURE__ */ jsxs4("span", { children: [
2343
2730
  "Procedure code",
2344
- /* @__PURE__ */ jsx3(RequiredMark, {})
2731
+ /* @__PURE__ */ jsx4(RequiredMark, {})
2345
2732
  ] }),
2346
- /* @__PURE__ */ jsx3("span", { children: "Modifiers" }),
2347
- /* @__PURE__ */ jsx3("span", { children: "Dx" }),
2348
- /* @__PURE__ */ jsxs3("span", { children: [
2733
+ /* @__PURE__ */ jsx4("span", { children: "Modifiers" }),
2734
+ /* @__PURE__ */ jsx4("span", { children: "Dx" }),
2735
+ /* @__PURE__ */ jsxs4("span", { children: [
2349
2736
  "Units",
2350
- /* @__PURE__ */ jsx3(RequiredMark, {})
2737
+ /* @__PURE__ */ jsx4(RequiredMark, {})
2351
2738
  ] }),
2352
- /* @__PURE__ */ jsx3("span", { children: "Allowed" }),
2353
- /* @__PURE__ */ jsx3("span", {}),
2739
+ /* @__PURE__ */ jsx4("span", { children: "Allowed" }),
2740
+ /* @__PURE__ */ jsx4("span", {}),
2354
2741
  " "
2355
2742
  ] }),
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) => {
2743
+ bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs4("div", { className: "mbsf-line", children: [
2744
+ /* @__PURE__ */ jsxs4("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
2745
+ /* @__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
2746
  const auto = evaluationModifier(evaluationType, option.id);
2360
2747
  setLine(index, { code: option.id, ...auto ? { modifiers: [auto, ...(line.modifiers ?? []).filter((item) => !["94", "95", "96"].includes(item.replace(/^-/, "")))] } : line.modifiers ? { modifiers: line.modifiers } : {} });
2361
2748
  } }),
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
2749
+ 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,
2750
+ errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
2364
2751
  ] }),
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: [
2752
+ /* @__PURE__ */ jsxs4("div", { "data-label": "Modifiers", children: [
2753
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs4("span", { className: "mbsf-chip", children: [
2367
2754
  "\u2212",
2368
2755
  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" })
2756
+ /* @__PURE__ */ jsx4("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
2370
2757
  ] }, 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])] }) })
2758
+ /* @__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
2759
  ] }),
2373
- /* @__PURE__ */ jsx3("div", { "data-label": "Dx", children: /* @__PURE__ */ jsx3("div", { className: "mbsf-dx", children: (bill.diagnoses ?? []).length ? (bill.diagnoses ?? []).map((code, dxIndex) => {
2760
+ /* @__PURE__ */ jsx4("div", { "data-label": "Dx", children: /* @__PURE__ */ jsx4("div", { className: "mbsf-dx", children: (bill.diagnoses ?? []).length ? (bill.diagnoses ?? []).map((code, dxIndex) => {
2374
2761
  const pointer = dxIndex + 1;
2375
2762
  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
2763
+ 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);
2764
+ }) : /* @__PURE__ */ jsx4("small", { className: "mbsf-help", children: "Add diagnoses above" }) }) }),
2765
+ /* @__PURE__ */ jsxs4("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
2766
+ /* @__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) }) }),
2767
+ errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx4("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
2381
2768
  ] }),
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" })
2769
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
2770
+ /* @__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
2771
  ] }, 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" }) })
2772
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-total", children: [
2773
+ /* @__PURE__ */ jsx4("span", { children: "Total" }),
2774
+ /* @__PURE__ */ jsx4("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
2388
2775
  ] })
2389
2776
  ] }),
2390
- errors.serviceLines ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
2777
+ errors.serviceLines ? /* @__PURE__ */ jsx4("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
2391
2778
  ] });
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: [
2779
+ const attachmentsSection = /* @__PURE__ */ jsxs4("fieldset", { className: "mbsf-card", "data-field-path": "attachments", "data-invalid": Boolean(errors.attachments), disabled: locked, children: [
2780
+ /* @__PURE__ */ jsx4("legend", { className: "mbsf-legend", children: "Attachments" }),
2781
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-list", children: [
2395
2782
  attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
2396
2783
  const auto = attachment.autoAttached || attachment.documentType === "w9";
2397
2784
  const removable = !auto && attachment.removable !== false;
2398
2785
  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]) })
2786
+ return /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
2787
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-main", children: [
2788
+ auto ? /* @__PURE__ */ jsx4("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
2789
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-file", children: [
2790
+ /* @__PURE__ */ jsx4("strong", { children: attachment.fileName }),
2791
+ /* @__PURE__ */ jsx4("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
2792
+ /* @__PURE__ */ jsx4("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
2406
2793
  ] })
2407
2794
  ] }),
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: () => {
2795
+ 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,
2796
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-actions", children: [
2797
+ attachment.previewUrl ? /* @__PURE__ */ jsx4("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
2798
+ removable ? /* @__PURE__ */ jsx4("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
2412
2799
  setSelectedIds((current) => current.filter((id) => id !== attachment.id));
2413
2800
  setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
2414
2801
  }, children: "\xD7" }) : null
@@ -2417,35 +2804,35 @@ function BillSubmissionForm({
2417
2804
  }),
2418
2805
  uploads.map((upload, index) => {
2419
2806
  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: [
2807
+ return /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-row", children: [
2808
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs4("span", { className: "mbsf-file", children: [
2809
+ /* @__PURE__ */ jsx4("strong", { children: upload.file.name }),
2810
+ /* @__PURE__ */ jsxs4("span", { className: "mbsf-help", style: { display: "block" }, children: [
2424
2811
  (upload.file.size / 1024 / 1024).toFixed(1),
2425
2812
  " MB"
2426
2813
  ] })
2427
2814
  ] }) }),
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" })
2815
+ 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,
2816
+ /* @__PURE__ */ jsxs4("div", { className: "mbsf-attach-actions", children: [
2817
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
2818
+ /* @__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
2819
  ] })
2433
2820
  ] }, `${upload.file.name}-${index}`);
2434
2821
  })
2435
2822
  ] }),
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) => {
2823
+ errors.attachments ? /* @__PURE__ */ jsx4("p", { className: "mbsf-error", role: "alert", children: errors.attachments }) : null,
2824
+ /* @__PURE__ */ jsx4("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
2438
2825
  if (event.target.files) addFiles(event.target.files);
2439
2826
  event.target.value = "";
2440
2827
  } }),
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." })
2828
+ /* @__PURE__ */ jsx4("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs4("span", { children: [
2829
+ /* @__PURE__ */ jsx4("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
2830
+ /* @__PURE__ */ jsx4("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
2444
2831
  ] }) })
2445
2832
  ] });
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 }) })
2833
+ const actionsSection = /* @__PURE__ */ jsxs4(Fragment3, { children: [
2834
+ formError ? /* @__PURE__ */ jsx4("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
2835
+ /* @__PURE__ */ jsx4("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx4("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
2449
2836
  ] });
2450
2837
  const sections = {
2451
2838
  header: headerSection,
@@ -2456,28 +2843,46 @@ function BillSubmissionForm({
2456
2843
  attachments: attachmentsSection,
2457
2844
  actions: actionsSection
2458
2845
  };
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, {})
2846
+ const defaultLayout = /* @__PURE__ */ jsxs4(Fragment3, { children: [
2847
+ /* @__PURE__ */ jsx4(BillSubmissionHeader, {}),
2848
+ /* @__PURE__ */ jsx4(BillSubmissionPatientSection, {}),
2849
+ /* @__PURE__ */ jsx4(BillSubmissionClaimSection, {}),
2850
+ /* @__PURE__ */ jsx4(BillSubmissionProvidersSection, {}),
2851
+ /* @__PURE__ */ jsx4(BillSubmissionServiceLinesSection, {}),
2852
+ /* @__PURE__ */ jsx4(BillSubmissionAttachmentsSection, {}),
2853
+ /* @__PURE__ */ jsx4(BillSubmissionActions, {})
2467
2854
  ] });
2468
- return /* @__PURE__ */ jsx3(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs3("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
2855
+ return /* @__PURE__ */ jsx4(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs4("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
2469
2856
  event.preventDefault();
2470
2857
  void submit();
2471
2858
  }, noValidate: true, children: [
2472
- /* @__PURE__ */ jsx3("style", { children: css }),
2473
- children ?? defaultLayout
2859
+ /* @__PURE__ */ jsx4("style", { children: css2 }),
2860
+ children ?? defaultLayout,
2861
+ routeDialog ? /* @__PURE__ */ jsx4(
2862
+ SendRouteDialog,
2863
+ {
2864
+ title: "Send bill",
2865
+ delivery: routeDialog.delivery,
2866
+ submitting,
2867
+ error: routeError,
2868
+ onCancel: () => {
2869
+ if (!submitting) {
2870
+ setRouteDialog(null);
2871
+ setRouteError(null);
2872
+ }
2873
+ },
2874
+ onConfirm: (submission) => {
2875
+ void performConnectedSubmit(routeDialog.complete, submission);
2876
+ }
2877
+ }
2878
+ ) : null
2474
2879
  ] }) });
2475
2880
  }
2476
2881
 
2477
2882
  // 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 = `
2883
+ import { useMemo as useMemo4, useState as useState5 } from "react";
2884
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2885
+ var css3 = `
2481
2886
  .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
2887
  .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
2888
  .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 +2933,63 @@ function summarizeBillingDashboard(bills, now = /* @__PURE__ */ new Date()) {
2528
2933
  return { totalBilled, totalPaid, outstanding, openCount, bills: bills.length, aging };
2529
2934
  }
2530
2935
  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 }),
2936
+ return /* @__PURE__ */ jsxs5("div", { className: `mbdash ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
2937
+ /* @__PURE__ */ jsx5("style", { children: css3 }),
2533
2938
  children
2534
2939
  ] });
2535
2940
  }
2536
2941
  function BillIdentity({ bill }) {
2537
2942
  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 ") })
2943
+ const content = /* @__PURE__ */ jsxs5(Fragment4, { children: [
2944
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-primary", children: label }),
2945
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-secondary", children: [bill.patientName, bill.claimNumber ? `Claim ${bill.claimNumber}` : null].filter(Boolean).join(" \xB7 ") })
2541
2946
  ] });
2542
- return bill.href ? /* @__PURE__ */ jsx4("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx4(Fragment3, { children: content });
2947
+ return bill.href ? /* @__PURE__ */ jsx5("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx5(Fragment4, { children: content });
2543
2948
  }
2544
2949
  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" })
2950
+ if (!bills.length) return /* @__PURE__ */ jsx5("div", { className: "mbdash-card mbdash-empty", children: emptyState });
2951
+ return /* @__PURE__ */ jsxs5("div", { className: "mbdash-card", children: [
2952
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs5("table", { className: "mbdash-table", children: [
2953
+ /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsxs5("tr", { children: [
2954
+ /* @__PURE__ */ jsx5("th", { children: "Bill" }),
2955
+ /* @__PURE__ */ jsx5("th", { children: "Payer" }),
2956
+ /* @__PURE__ */ jsx5("th", { children: "Status" }),
2957
+ /* @__PURE__ */ jsx5("th", { children: "Age" }),
2958
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Billed" }),
2959
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Paid" }),
2960
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Balance" })
2556
2961
  ] }) }),
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: [
2962
+ /* @__PURE__ */ jsx5("tbody", { children: bills.map((bill) => /* @__PURE__ */ jsxs5("tr", { "data-clickable": Boolean(onSelectBill), onClick: () => onSelectBill?.(bill), children: [
2963
+ /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5(BillIdentity, { bill }) }),
2964
+ /* @__PURE__ */ jsx5("td", { children: bill.payerName || "\u2014" }),
2965
+ /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5("span", { className: "mbdash-state", children: stateLabel(bill.state) }) }),
2966
+ /* @__PURE__ */ jsxs5("td", { children: [
2562
2967
  billAgingDays(bill),
2563
2968
  " days"
2564
2969
  ] }),
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) }) })
2970
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(bill.totalCharge) }),
2971
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(bill.totalPaid) }),
2972
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: /* @__PURE__ */ jsx5("strong", { children: money3(bill.balanceDue) }) })
2568
2973
  ] }, bill.id)) })
2569
2974
  ] }) }),
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) })
2975
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-mobile-list", children: bills.map((bill) => /* @__PURE__ */ jsxs5("article", { className: "mbdash-mobile-card", onClick: () => onSelectBill?.(bill), children: [
2976
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-mobile-top", children: [
2977
+ /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(BillIdentity, { bill }) }),
2978
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-state", children: stateLabel(bill.state) })
2574
2979
  ] }),
2575
- /* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-money", children: [
2576
- /* @__PURE__ */ jsxs4("span", { children: [
2577
- /* @__PURE__ */ jsx4("small", { children: "Age" }),
2980
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-mobile-money", children: [
2981
+ /* @__PURE__ */ jsxs5("span", { children: [
2982
+ /* @__PURE__ */ jsx5("small", { children: "Age" }),
2578
2983
  billAgingDays(bill),
2579
2984
  " days"
2580
2985
  ] }),
2581
- /* @__PURE__ */ jsxs4("span", { children: [
2582
- /* @__PURE__ */ jsx4("small", { children: "Paid" }),
2986
+ /* @__PURE__ */ jsxs5("span", { children: [
2987
+ /* @__PURE__ */ jsx5("small", { children: "Paid" }),
2583
2988
  money3(bill.totalPaid)
2584
2989
  ] }),
2585
- /* @__PURE__ */ jsxs4("span", { children: [
2586
- /* @__PURE__ */ jsx4("small", { children: "Balance" }),
2587
- /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) })
2990
+ /* @__PURE__ */ jsxs5("span", { children: [
2991
+ /* @__PURE__ */ jsx5("small", { children: "Balance" }),
2992
+ /* @__PURE__ */ jsx5("strong", { children: money3(bill.balanceDue) })
2588
2993
  ] })
2589
2994
  ] })
2590
2995
  ] }, bill.id)) })
@@ -2596,37 +3001,37 @@ function BillList(props) {
2596
3001
  ...props.className === void 0 ? {} : { className: props.className },
2597
3002
  ...props.style === void 0 ? {} : { style: props.style }
2598
3003
  };
2599
- return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(BillListContent, { ...props }) });
3004
+ return /* @__PURE__ */ jsx5(Shell, { ...shellProps, children: /* @__PURE__ */ jsx5(BillListContent, { ...props }) });
2600
3005
  }
2601
3006
  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." })
3007
+ const summary = useMemo4(() => summarizeBillingDashboard(bills), [bills]);
3008
+ return /* @__PURE__ */ jsxs5(Fragment4, { children: [
3009
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs5("div", { children: [
3010
+ /* @__PURE__ */ jsx5("h2", { children: heading }),
3011
+ /* @__PURE__ */ jsx5("p", { className: "mbdash-copy", children: "Current balances and aging at a glance." })
2607
3012
  ] }) }),
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) })
3013
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-card mbdash-summary", children: [
3014
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3015
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Outstanding" }),
3016
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: money3(summary.outstanding) })
2612
3017
  ] }),
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 })
3018
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3019
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Open bills" }),
3020
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: summary.openCount })
2616
3021
  ] }),
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) })
3022
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3023
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Collected" }),
3024
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: money3(summary.totalPaid) })
2620
3025
  ] }),
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) })
3026
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-stat", children: [
3027
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: "Total billed" }),
3028
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-value", children: money3(summary.totalBilled) })
2624
3029
  ] })
2625
3030
  ] }),
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: [
3031
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-card mbdash-aging", children: summary.aging.map((bucket) => /* @__PURE__ */ jsxs5("div", { className: "mbdash-aging-item", children: [
3032
+ /* @__PURE__ */ jsx5("span", { className: "mbdash-label", children: bucket.label }),
3033
+ /* @__PURE__ */ jsx5("strong", { children: money3(bucket.balance) }),
3034
+ /* @__PURE__ */ jsxs5("span", { children: [
2630
3035
  bucket.count,
2631
3036
  " bill",
2632
3037
  bucket.count === 1 ? "" : "s"
@@ -2640,13 +3045,13 @@ function BillAgingSummary(props) {
2640
3045
  ...props.className === void 0 ? {} : { className: props.className },
2641
3046
  ...props.style === void 0 ? {} : { style: props.style }
2642
3047
  };
2643
- return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
3048
+ return /* @__PURE__ */ jsx5(Shell, { ...shellProps, children: /* @__PURE__ */ jsx5(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
2644
3049
  }
2645
3050
  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(() => {
3051
+ const [search, setSearch] = useState5(initialSearch);
3052
+ const [state, setState] = useState5(initialState);
3053
+ const states = useMemo4(() => [...new Set(bills.map((bill) => bill.state))].sort((a, b) => a.localeCompare(b)), [bills]);
3054
+ const filtered = useMemo4(() => {
2650
3055
  const query = search.trim().toLowerCase();
2651
3056
  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
3057
  }, [bills, search, state]);
@@ -2656,20 +3061,20 @@ function BillingDashboard({ bills, heading = "Billing", description = "Track sub
2656
3061
  ...style === void 0 ? {} : { style }
2657
3062
  };
2658
3063
  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 })
3064
+ return /* @__PURE__ */ jsxs5(Shell, { ...shellProps, children: [
3065
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs5("div", { children: [
3066
+ /* @__PURE__ */ jsx5("h2", { children: heading }),
3067
+ /* @__PURE__ */ jsx5("p", { className: "mbdash-copy", children: description })
2663
3068
  ] }) }),
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))
3069
+ /* @__PURE__ */ jsx5(AgingContent, { bills: filtered, heading: "Receivables" }),
3070
+ hideFilters ? null : /* @__PURE__ */ jsxs5("div", { className: "mbdash-filters", children: [
3071
+ /* @__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" }),
3072
+ /* @__PURE__ */ jsxs5("select", { className: "mbdash-control", value: state, onChange: (event) => setState(event.target.value), "aria-label": "Filter bills by status", children: [
3073
+ /* @__PURE__ */ jsx5("option", { value: "all", children: "All statuses" }),
3074
+ states.map((item) => /* @__PURE__ */ jsx5("option", { value: item, children: stateLabel(item) }, item))
2670
3075
  ] })
2671
3076
  ] }),
2672
- /* @__PURE__ */ jsx4(BillListContent, { ...listProps })
3077
+ /* @__PURE__ */ jsx5(BillListContent, { ...listProps })
2673
3078
  ] });
2674
3079
  }
2675
3080
  function buildBillingReportRows(bills, groupBy = "status") {
@@ -2691,46 +3096,46 @@ function buildBillingReportCsv(bills, groupBy = "status") {
2691
3096
  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
3097
  }
2693
3098
  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]);
3099
+ const rows = useMemo4(() => buildBillingReportRows(bills, groupBy), [bills, groupBy]);
3100
+ const total = useMemo4(() => summarizeBillingDashboard(bills), [bills]);
2696
3101
  const shellProps = {
2697
3102
  ...appearance === void 0 ? {} : { appearance },
2698
3103
  className: `mbdash-report ${className ?? ""}`.trim(),
2699
3104
  ...style === void 0 ? {} : { style }
2700
3105
  };
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 })
3106
+ return /* @__PURE__ */ jsx5(Shell, { ...shellProps, children: /* @__PURE__ */ jsxs5("div", { className: "mbdash-card", children: [
3107
+ /* @__PURE__ */ jsxs5("div", { className: "mbdash-report-head", children: [
3108
+ /* @__PURE__ */ jsxs5("div", { children: [
3109
+ /* @__PURE__ */ jsx5("h2", { children: heading }),
3110
+ /* @__PURE__ */ jsx5("p", { className: "mbdash-copy", children: description })
2706
3111
  ] }),
2707
- /* @__PURE__ */ jsxs4("span", { className: "mbdash-state", children: [
3112
+ /* @__PURE__ */ jsxs5("span", { className: "mbdash-state", children: [
2708
3113
  "By ",
2709
3114
  groupBy
2710
3115
  ] })
2711
3116
  ] }),
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" })
3117
+ /* @__PURE__ */ jsx5("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs5("table", { className: "mbdash-table", children: [
3118
+ /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsxs5("tr", { children: [
3119
+ /* @__PURE__ */ jsx5("th", { children: "Group" }),
3120
+ /* @__PURE__ */ jsx5("th", { children: "Bills" }),
3121
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Billed" }),
3122
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Paid" }),
3123
+ /* @__PURE__ */ jsx5("th", { className: "mbdash-money", children: "Balance" })
2719
3124
  ] }) }),
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) })
3125
+ /* @__PURE__ */ jsxs5("tbody", { children: [
3126
+ rows.map((row) => /* @__PURE__ */ jsxs5("tr", { children: [
3127
+ /* @__PURE__ */ jsx5("td", { children: /* @__PURE__ */ jsx5("strong", { children: row.label }) }),
3128
+ /* @__PURE__ */ jsx5("td", { children: row.billCount }),
3129
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(row.totalBilled) }),
3130
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(row.totalPaid) }),
3131
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(row.balanceDue) })
2727
3132
  ] }, 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) })
3133
+ /* @__PURE__ */ jsxs5("tr", { className: "mbdash-report-total", children: [
3134
+ /* @__PURE__ */ jsx5("td", { children: "Total" }),
3135
+ /* @__PURE__ */ jsx5("td", { children: total.bills }),
3136
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(total.totalBilled) }),
3137
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(total.totalPaid) }),
3138
+ /* @__PURE__ */ jsx5("td", { className: "mbdash-money", children: money3(total.outstanding) })
2734
3139
  ] })
2735
3140
  ] })
2736
3141
  ] }) })
@@ -2738,8 +3143,8 @@ function BillingReport({ bills, groupBy = "status", heading = "Billing report",
2738
3143
  }
2739
3144
 
2740
3145
  // src/status-aging-matrix.tsx
2741
- import { useMemo as useMemo4 } from "react";
2742
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
3146
+ import { useMemo as useMemo5 } from "react";
3147
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2743
3148
  var BILL_STATUS_AGING_BUCKETS = [
2744
3149
  { id: "current", label: "0\u201330 days" },
2745
3150
  { id: "31-60", label: "31\u201360 days" },
@@ -2802,7 +3207,7 @@ function buildBillStatusAgingCsv(bills, stateOrder) {
2802
3207
  lines.push(["Total", ...matrix.columnTotals.map((cell) => cell.count), matrix.grandTotal.count]);
2803
3208
  return [header, ...lines].map((line) => line.map(escape).join(",")).join("\n");
2804
3209
  }
2805
- var css3 = `
3210
+ var css4 = `
2806
3211
  .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
3212
  .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
3213
  .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 +3236,9 @@ function BillStatusAgingMatrix({
2831
3236
  className = "",
2832
3237
  style
2833
3238
  }) {
2834
- const matrix = useMemo4(() => buildBillStatusAgingMatrix(bills, stateOrder), [bills, stateOrder]);
3239
+ const matrix = useMemo5(() => buildBillStatusAgingMatrix(bills, stateOrder), [bills, stateOrder]);
2835
3240
  const clickable = Boolean(onSelectCell);
2836
- const cell = (data, key, isTotal = false) => /* @__PURE__ */ jsx5("td", { className: isTotal ? "mbmx-rowtotal" : void 0, children: /* @__PURE__ */ jsxs5(
3241
+ const cell = (data, key, isTotal = false) => /* @__PURE__ */ jsx6("td", { className: isTotal ? "mbmx-rowtotal" : void 0, children: /* @__PURE__ */ jsxs6(
2837
3242
  "button",
2838
3243
  {
2839
3244
  type: "button",
@@ -2843,31 +3248,31 @@ function BillStatusAgingMatrix({
2843
3248
  disabled: !clickable || data.count === 0,
2844
3249
  "aria-label": `${stateLabel2(data.state)} \xB7 ${data.bucket === "total" ? "all ages" : data.bucket}: ${data.count} bills`,
2845
3250
  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
3251
+ /* @__PURE__ */ jsx6("span", { className: `mbmx-count ${data.count === 0 ? "mbmx-zero" : ""}`.trim(), children: data.count === 0 ? "\u2014" : data.count }),
3252
+ showBalances && data.count > 0 ? /* @__PURE__ */ jsx6("span", { className: "mbmx-balance", children: money4(data.balance) }) : null
2848
3253
  ]
2849
3254
  }
2850
3255
  ) }, 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 })
3256
+ return /* @__PURE__ */ jsxs6("div", { className: `mbmx ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
3257
+ /* @__PURE__ */ jsx6("style", { children: css4 }),
3258
+ /* @__PURE__ */ jsx6("div", { className: "mbmx-head", children: /* @__PURE__ */ jsxs6("div", { children: [
3259
+ /* @__PURE__ */ jsx6("h2", { children: heading }),
3260
+ /* @__PURE__ */ jsx6("p", { className: "mbmx-copy", children: description })
2856
3261
  ] }) }),
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" })
3262
+ /* @__PURE__ */ jsx6("div", { className: "mbmx-card", children: /* @__PURE__ */ jsxs6("table", { className: "mbmx-table", children: [
3263
+ /* @__PURE__ */ jsx6("thead", { children: /* @__PURE__ */ jsxs6("tr", { children: [
3264
+ /* @__PURE__ */ jsx6("th", { children: "Status" }),
3265
+ BILL_STATUS_AGING_BUCKETS.map((bucket) => /* @__PURE__ */ jsx6("th", { children: bucket.label }, bucket.id)),
3266
+ /* @__PURE__ */ jsx6("th", { children: "Total" })
2862
3267
  ] }) }),
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 }) }),
3268
+ /* @__PURE__ */ jsxs6("tbody", { children: [
3269
+ matrix.rows.map((row) => /* @__PURE__ */ jsxs6("tr", { children: [
3270
+ /* @__PURE__ */ jsx6("td", { children: /* @__PURE__ */ jsx6("span", { className: "mbmx-state", children: row.label }) }),
2866
3271
  row.cells.map((data) => cell(data, `${row.state}-${data.bucket}`)),
2867
3272
  cell(row.total, `${row.state}-total`, true)
2868
3273
  ] }, row.state)),
2869
- /* @__PURE__ */ jsxs5("tr", { className: "mbmx-total", children: [
2870
- /* @__PURE__ */ jsx5("td", { children: "Total" }),
3274
+ /* @__PURE__ */ jsxs6("tr", { className: "mbmx-total", children: [
3275
+ /* @__PURE__ */ jsx6("td", { children: "Total" }),
2871
3276
  matrix.columnTotals.map((data) => cell(data, `all-${data.bucket}`)),
2872
3277
  cell(matrix.grandTotal, "all-total", true)
2873
3278
  ] })
@@ -2877,18 +3282,18 @@ function BillStatusAgingMatrix({
2877
3282
  }
2878
3283
 
2879
3284
  // src/organization-onboarding.tsx
2880
- import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef3, useState as useState5 } from "react";
3285
+ import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, useState as useState6 } from "react";
2881
3286
  import {
2882
3287
  createOrganizationClient
2883
3288
  } from "@mindbill/browser";
2884
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
3289
+ import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2885
3290
  var STEPS = [
2886
3291
  { id: "practice", label: "Practice & billing" },
2887
3292
  { id: "locations", label: "Locations" },
2888
3293
  { id: "w9", label: "W-9" },
2889
3294
  { id: "review", label: "Review" }
2890
3295
  ];
2891
- var css4 = `
3296
+ var css5 = `
2892
3297
  .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
3298
  .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
3299
  .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 +3349,7 @@ function OrganizationOnboarding({
2944
3349
  onCompleted,
2945
3350
  onError
2946
3351
  }) {
2947
- const client = useMemo5(
3352
+ const client = useMemo6(
2948
3353
  () => createOrganizationClient({
2949
3354
  sessionEndpoint,
2950
3355
  ...getSession ? { getSession } : {},
@@ -2952,16 +3357,16 @@ function OrganizationOnboarding({
2952
3357
  }),
2953
3358
  [sessionEndpoint, getSession, apiBaseUrl]
2954
3359
  );
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({});
3360
+ const [profile, setProfile] = useState6(null);
3361
+ const [loadError, setLoadError] = useState6(null);
3362
+ const [step, setStep] = useState6("practice");
3363
+ const [identity, setIdentity] = useState6({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
3364
+ const [provider, setProvider] = useState6({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
3365
+ const [locations, setLocations] = useState6([blankLocation()]);
3366
+ const [w9File, setW9File] = useState6(null);
3367
+ const [saving, setSaving] = useState6(false);
3368
+ const [error, setError] = useState6(null);
3369
+ const [savedStep, setSavedStep] = useState6({});
2965
3370
  const completedFired = useRef3(false);
2966
3371
  const adoptProfile = useCallback2((next) => {
2967
3372
  setProfile(next);
@@ -2980,7 +3385,7 @@ function OrganizationOnboarding({
2980
3385
  onCompleted?.(next);
2981
3386
  }
2982
3387
  }, [onCompleted]);
2983
- useEffect4(() => {
3388
+ useEffect5(() => {
2984
3389
  let alive = true;
2985
3390
  client.getOrganization().then((next) => {
2986
3391
  if (alive) {
@@ -3027,16 +3432,16 @@ function OrganizationOnboarding({
3027
3432
  if (!w9File) throw new Error("Choose the practice W-9 PDF first.");
3028
3433
  return client.saveW9({ filename: w9File.name, contentBase64: await fileToBase64(w9File) });
3029
3434
  }, "w9");
3030
- const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs6("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
3435
+ const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs7("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
3031
3436
  label,
3032
- /* @__PURE__ */ jsx6("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
3437
+ /* @__PURE__ */ jsx7("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
3033
3438
  ] });
3034
3439
  const setLocation = (index, patch) => setLocations((current) => current.map((item, itemIndex) => {
3035
3440
  if (itemIndex !== index) return patch.isPrimary ? { ...item, isPrimary: false } : item;
3036
3441
  return { ...item, ...patch };
3037
3442
  }));
3038
- const practiceSection = /* @__PURE__ */ jsxs6("div", { children: [
3039
- /* @__PURE__ */ jsxs6("div", { className: "mbob-grid", children: [
3443
+ const practiceSection = /* @__PURE__ */ jsxs7("div", { children: [
3444
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-grid", children: [
3040
3445
  field("Practice name", identity.name, (name) => setIdentity((c) => ({ ...c, name }))),
3041
3446
  field("Legal name", identity.legalName, (legalName) => setIdentity((c) => ({ ...c, legalName }))),
3042
3447
  field("Tax ID (EIN)", identity.taxId, (taxId) => setIdentity((c) => ({ ...c, taxId })), false, "94-1234567"),
@@ -3044,8 +3449,8 @@ function OrganizationOnboarding({
3044
3449
  field("Phone", identity.phone, (phone) => setIdentity((c) => ({ ...c, phone }))),
3045
3450
  field("Email", identity.email, (email) => setIdentity((c) => ({ ...c, email })))
3046
3451
  ] }),
3047
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
3048
- /* @__PURE__ */ jsxs6("div", { className: "mbob-grid", children: [
3452
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
3453
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-grid", children: [
3049
3454
  field("Billing provider name", provider.name, (name) => setProvider((c) => ({ ...c, name }))),
3050
3455
  field("Billing tax ID", provider.taxId, (taxId) => setProvider((c) => ({ ...c, taxId }))),
3051
3456
  field("Billing NPI", provider.npi, (npi) => setProvider((c) => ({ ...c, npi }))),
@@ -3055,88 +3460,88 @@ function OrganizationOnboarding({
3055
3460
  field("State", provider.billingState ?? "", (billingState) => setProvider((c) => ({ ...c, billingState: billingState.toUpperCase().slice(0, 2) }))),
3056
3461
  field("ZIP", provider.billingZip ?? "", (billingZip) => setProvider((c) => ({ ...c, billingZip })))
3057
3462
  ] }),
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" })
3463
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-actions", children: [
3464
+ /* @__PURE__ */ jsx7("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
3465
+ /* @__PURE__ */ jsx7("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
3061
3466
  ] })
3062
3467
  ] });
3063
- const locationsSection = /* @__PURE__ */ jsxs6("div", { children: [
3064
- locations.map((location, index) => /* @__PURE__ */ jsxs6("div", { className: "mbob-loc", children: [
3468
+ const locationsSection = /* @__PURE__ */ jsxs7("div", { children: [
3469
+ locations.map((location, index) => /* @__PURE__ */ jsxs7("div", { className: "mbob-loc", children: [
3065
3470
  field("Name", location.name, (name) => setLocation(index, { name })),
3066
3471
  field("Street", location.street, (street) => setLocation(index, { street })),
3067
3472
  field("City", location.city, (city) => setLocation(index, { city })),
3068
3473
  field("State", location.state, (state) => setLocation(index, { state: state.toUpperCase().slice(0, 2) })),
3069
3474
  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 }) }),
3475
+ /* @__PURE__ */ jsxs7("label", { className: "mbob-primary", children: [
3476
+ /* @__PURE__ */ jsx7("input", { type: "radio", name: "mbob-primary", checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
3072
3477
  " Primary"
3073
3478
  ] }),
3074
- /* @__PURE__ */ jsx6("button", { className: "mbob-remove", type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
3479
+ /* @__PURE__ */ jsx7("button", { className: "mbob-remove", type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
3075
3480
  ] }, 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" })
3481
+ /* @__PURE__ */ jsx7("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
3482
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-actions", children: [
3483
+ /* @__PURE__ */ jsx7("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
3484
+ /* @__PURE__ */ jsx7("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
3080
3485
  ] })
3081
3486
  ] });
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: [
3487
+ const w9Section = /* @__PURE__ */ jsxs7("div", { children: [
3488
+ profile?.w9 ? /* @__PURE__ */ jsxs7("div", { className: "mbob-w9-current", children: [
3489
+ /* @__PURE__ */ jsxs7("div", { children: [
3490
+ /* @__PURE__ */ jsx7("strong", { children: profile.w9.filename }),
3491
+ /* @__PURE__ */ jsxs7("span", { children: [
3087
3492
  " \xB7 added ",
3088
3493
  profile.w9.addDate
3089
3494
  ] })
3090
3495
  ] }),
3091
- /* @__PURE__ */ jsx6("span", { children: "Rides on every bill automatically" })
3496
+ /* @__PURE__ */ jsx7("span", { children: "Rides on every bill automatically" })
3092
3497
  ] }) : 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." })
3498
+ /* @__PURE__ */ jsxs7("label", { className: "mbob-drop", children: [
3499
+ /* @__PURE__ */ jsx7("input", { type: "file", accept: "application/pdf,.pdf", onChange: (event) => setW9File(event.target.files?.[0] ?? null) }),
3500
+ /* @__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" }),
3501
+ /* @__PURE__ */ jsx7("span", { children: "The W-9 is auto-attached to every submission." })
3097
3502
  ] }),
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" })
3503
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-actions", children: [
3504
+ /* @__PURE__ */ jsx7("span", { className: "mbob-status", children: savedStep["w9"] ? "Saved to MindBill." : "" }),
3505
+ /* @__PURE__ */ jsx7("button", { className: "mbob-save", type: "button", disabled: saving || !w9File, onClick: saveW9, children: saving ? "Uploading\u2026" : "Save W-9" })
3101
3506
  ] })
3102
3507
  ] });
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 })
3508
+ const reviewSection = /* @__PURE__ */ jsxs7("div", { className: "mbob-check", children: [
3509
+ (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs7("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
3510
+ /* @__PURE__ */ jsx7("i", { children: item.complete ? "\u2713" : "\u2022" }),
3511
+ /* @__PURE__ */ jsx7("span", { children: item.label })
3107
3512
  ] }, 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." })
3513
+ 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
3514
  ] });
3110
3515
  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 })
3516
+ return /* @__PURE__ */ jsxs7("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
3517
+ /* @__PURE__ */ jsx7("style", { children: css5 }),
3518
+ /* @__PURE__ */ jsxs7("div", { className: "mbob-card", children: [
3519
+ /* @__PURE__ */ jsx7("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs7("div", { children: [
3520
+ /* @__PURE__ */ jsx7("h2", { children: heading }),
3521
+ /* @__PURE__ */ jsx7("p", { className: "mbob-copy", children: description })
3117
3522
  ] }) }),
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" : "" }),
3523
+ loadError ? /* @__PURE__ */ jsx7("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
3524
+ variant === "onboarding" ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
3525
+ /* @__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: [
3526
+ /* @__PURE__ */ jsx7("i", { children: savedStep[item.id] ? "\u2713" : "" }),
3122
3527
  item.label
3123
3528
  ] }, item.id)) }),
3124
3529
  sections[step]
3125
- ] }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
3530
+ ] }) : /* @__PURE__ */ jsxs7(Fragment5, { children: [
3126
3531
  practiceSection,
3127
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Locations" }),
3532
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Locations" }),
3128
3533
  locationsSection,
3129
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Practice W-9" }),
3534
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Practice W-9" }),
3130
3535
  w9Section,
3131
- /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Checklist" }),
3536
+ /* @__PURE__ */ jsx7("h3", { className: "mbob-subhead", children: "Checklist" }),
3132
3537
  reviewSection
3133
3538
  ] }),
3134
- error ? /* @__PURE__ */ jsx6("div", { className: "mbob-error", role: "alert", children: error }) : null
3539
+ error ? /* @__PURE__ */ jsx7("div", { className: "mbob-error", role: "alert", children: error }) : null
3135
3540
  ] })
3136
3541
  ] });
3137
3542
  }
3138
3543
  function BillingSettings(props) {
3139
- return /* @__PURE__ */ jsx6(
3544
+ return /* @__PURE__ */ jsx7(
3140
3545
  OrganizationOnboarding,
3141
3546
  {
3142
3547
  heading: "Billing settings",
@@ -3150,16 +3555,16 @@ function BillingSettings(props) {
3150
3555
  // src/connected-bill-status.tsx
3151
3556
  import {
3152
3557
  useCallback as useCallback3,
3153
- useEffect as useEffect5,
3154
- useMemo as useMemo6,
3558
+ useEffect as useEffect6,
3559
+ useMemo as useMemo7,
3155
3560
  useRef as useRef4,
3156
- useState as useState6
3561
+ useState as useState7
3157
3562
  } from "react";
3158
3563
  import {
3159
3564
  DEFAULT_API_BASE_URL,
3160
3565
  DEFAULT_SESSION_ENDPOINT
3161
3566
  } from "@mindbill/browser";
3162
- import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
3567
+ import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3163
3568
  var DEFAULT_REFRESH_INTERVAL = 6e4;
3164
3569
  async function responseError(response, fallback) {
3165
3570
  const body = await response.json().catch(() => null);
@@ -3292,23 +3697,23 @@ function useBillStatus({
3292
3697
  initialData = null,
3293
3698
  fetch: fetchOverride
3294
3699
  }) {
3295
- const client = useMemo6(() => createBillStatusClient({
3700
+ const client = useMemo7(() => createBillStatusClient({
3296
3701
  billId,
3297
3702
  sessionEndpoint,
3298
3703
  ...getSession ? { getSession } : {},
3299
3704
  apiBaseUrl,
3300
3705
  ...fetchOverride ? { fetch: fetchOverride } : {}
3301
3706
  }), [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);
3707
+ const [data, setData] = useState7(initialData);
3708
+ const [error, setError] = useState7(null);
3709
+ const [isLoading, setIsLoading] = useState7(enabled && !initialData);
3710
+ const [isRefreshing, setIsRefreshing] = useState7(false);
3306
3711
  const dataRef = useRef4(initialData);
3307
3712
  const initialDataRef = useRef4(initialData);
3308
3713
  initialDataRef.current = initialData;
3309
3714
  const activeControllerRef = useRef4(null);
3310
3715
  const requestSequence = useRef4(0);
3311
- useEffect5(() => {
3716
+ useEffect6(() => {
3312
3717
  const seed = initialDataRef.current;
3313
3718
  dataRef.current = seed;
3314
3719
  setData(seed);
@@ -3349,10 +3754,10 @@ function useBillStatus({
3349
3754
  }
3350
3755
  }
3351
3756
  }, [billId, client, enabled]);
3352
- useEffect5(() => {
3757
+ useEffect6(() => {
3353
3758
  if (enabled) void load();
3354
3759
  }, [enabled, load]);
3355
- useEffect5(() => {
3760
+ useEffect6(() => {
3356
3761
  if (!enabled || refreshInterval <= 0) return;
3357
3762
  const timer = window.setInterval(() => void load(), refreshInterval);
3358
3763
  const onFocus = () => void load();
@@ -3380,17 +3785,17 @@ function ConnectedBillStatus({
3380
3785
  }) {
3381
3786
  const status = useBillStatus(options);
3382
3787
  if (status.isLoading && !status.data) {
3383
- return /* @__PURE__ */ jsx7(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx7("div", { role: "status", children: "Loading bill status\u2026" }) });
3788
+ return /* @__PURE__ */ jsx8(Fragment6, { children: loadingFallback ?? /* @__PURE__ */ jsx8("div", { role: "status", children: "Loading bill status\u2026" }) });
3384
3789
  }
3385
3790
  if (status.error && !status.data) {
3386
- return /* @__PURE__ */ jsx7(Fragment5, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs7("div", { role: "alert", children: [
3791
+ return /* @__PURE__ */ jsx8(Fragment6, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs8("div", { role: "alert", children: [
3387
3792
  status.error.message,
3388
3793
  " ",
3389
- /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
3794
+ /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
3390
3795
  ] }) });
3391
3796
  }
3392
3797
  if (!status.data) return null;
3393
- return /* @__PURE__ */ jsx7(
3798
+ return /* @__PURE__ */ jsx8(
3394
3799
  BillStatusSummary,
3395
3800
  {
3396
3801
  status: status.data.state,
@@ -3409,7 +3814,8 @@ function ConnectedBillStatus({
3409
3814
  }
3410
3815
 
3411
3816
  // src/bill-lifecycle-surfaces.tsx
3412
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3817
+ import { useState as useState8 } from "react";
3818
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3413
3819
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
3414
3820
  return actions.filter((action) => action.enabled || showUnavailable);
3415
3821
  }
@@ -3424,11 +3830,11 @@ function BillLifecycleActions({
3424
3830
  }) {
3425
3831
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
3426
3832
  if (!visible.length) return null;
3427
- return /* @__PURE__ */ jsxs8("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
3428
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3429
- visible.map((action) => /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-action", children: [
3430
- /* @__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 }),
3431
- !action.enabled && action.reason ? /* @__PURE__ */ jsx8("span", { className: "mb-action-reason", children: action.reason }) : null
3833
+ return /* @__PURE__ */ jsxs9("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
3834
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
3835
+ visible.map((action) => /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-action", children: [
3836
+ /* @__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 }),
3837
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx9("span", { className: "mb-action-reason", children: action.reason }) : null
3432
3838
  ] }, action.id))
3433
3839
  ] });
3434
3840
  }
@@ -3458,18 +3864,18 @@ function defaultFormatDate(createdAt) {
3458
3864
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
3459
3865
  }
3460
3866
  function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
3461
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
3462
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3463
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3464
- /* @__PURE__ */ jsx8("strong", { children: "Bill history" }),
3465
- /* @__PURE__ */ jsx8("span", { children: "Submission, payer responses, follow-up, and payments." })
3867
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
3868
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
3869
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
3870
+ /* @__PURE__ */ jsx9("strong", { children: "Bill history" }),
3871
+ /* @__PURE__ */ jsx9("span", { children: "Submission, payer responses, follow-up, and payments." })
3466
3872
  ] }) }),
3467
- !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: [
3468
- /* @__PURE__ */ jsx8("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
3469
- /* @__PURE__ */ jsxs8("div", { className: "mb-activity-content", children: [
3470
- /* @__PURE__ */ jsx8("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
3471
- event.description ? /* @__PURE__ */ jsx8("p", { children: event.description }) : null,
3472
- /* @__PURE__ */ jsxs8("span", { children: [
3873
+ !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: [
3874
+ /* @__PURE__ */ jsx9("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
3875
+ /* @__PURE__ */ jsxs9("div", { className: "mb-activity-content", children: [
3876
+ /* @__PURE__ */ jsx9("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
3877
+ event.description ? /* @__PURE__ */ jsx9("p", { children: event.description }) : null,
3878
+ /* @__PURE__ */ jsxs9("span", { children: [
3473
3879
  formatDate(event.createdAt),
3474
3880
  event.actor ? ` \xB7 ${event.actor}` : ""
3475
3881
  ] })
@@ -3477,6 +3883,80 @@ function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", ap
3477
3883
  ] }, event.id)) })
3478
3884
  ] });
3479
3885
  }
3886
+ function historyDate(iso) {
3887
+ const parsed = new Date(iso);
3888
+ if (Number.isNaN(parsed.getTime())) return iso;
3889
+ return new Intl.DateTimeFormat("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }).format(parsed);
3890
+ }
3891
+ function BillHistoryTable({ entries, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref }) {
3892
+ const [expanded, setExpanded] = useState8({});
3893
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
3894
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
3895
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
3896
+ /* @__PURE__ */ jsx9("strong", { children: "Bill history" }),
3897
+ /* @__PURE__ */ jsx9("span", { children: "Submissions, payer responses, follow-up, and payments." })
3898
+ ] }) }),
3899
+ !entries.length ? /* @__PURE__ */ jsx9("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs9("div", { className: "mb-history-table", children: [
3900
+ /* @__PURE__ */ jsxs9("div", { className: "mb-history-head", "aria-hidden": "true", children: [
3901
+ /* @__PURE__ */ jsx9("span", { children: "Date" }),
3902
+ /* @__PURE__ */ jsx9("span", { children: "Action" }),
3903
+ /* @__PURE__ */ jsx9("span", { children: "User" }),
3904
+ /* @__PURE__ */ jsx9("span", { children: "Details" })
3905
+ ] }),
3906
+ /* @__PURE__ */ jsx9("ul", { className: "mb-history-rows", children: entries.map((entry) => {
3907
+ const expandable = Boolean(entry.details);
3908
+ const isOpen = expandable && Boolean(expanded[entry.id]);
3909
+ const details = entry.details;
3910
+ return /* @__PURE__ */ jsxs9("li", { className: `mb-history-row is-${entry.tone}`, children: [
3911
+ /* @__PURE__ */ jsxs9(
3912
+ "button",
3913
+ {
3914
+ type: "button",
3915
+ className: "mb-history-line",
3916
+ disabled: !expandable,
3917
+ "aria-expanded": expandable ? isOpen : void 0,
3918
+ onClick: expandable ? () => setExpanded((current) => ({ ...current, [entry.id]: !current[entry.id] })) : void 0,
3919
+ children: [
3920
+ /* @__PURE__ */ jsx9("span", { className: "mb-history-date", children: formatDate(entry.date) }),
3921
+ /* @__PURE__ */ jsx9("span", { className: "mb-history-action", children: entry.action }),
3922
+ /* @__PURE__ */ jsx9("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
3923
+ /* @__PURE__ */ jsxs9("span", { className: "mb-history-summary", children: [
3924
+ expandable ? /* @__PURE__ */ jsx9("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
3925
+ entry.summary
3926
+ ] })
3927
+ ]
3928
+ }
3929
+ ),
3930
+ isOpen && details ? /* @__PURE__ */ jsxs9("div", { className: "mb-history-details", children: [
3931
+ details.rows?.length ? /* @__PURE__ */ jsx9("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs9("div", { children: [
3932
+ /* @__PURE__ */ jsx9("dt", { children: row.label }),
3933
+ /* @__PURE__ */ jsx9("dd", { children: row.value })
3934
+ ] }, `${row.label}-${row.value}`)) }) : null,
3935
+ details.documents?.length ? /* @__PURE__ */ jsx9("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs9("div", { children: [
3936
+ /* @__PURE__ */ jsx9("dt", { children: "Documents" }),
3937
+ /* @__PURE__ */ jsx9("dd", { children: details.documents.map((doc) => {
3938
+ const href = documentHref?.(doc) ?? null;
3939
+ 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);
3940
+ }) })
3941
+ ] }) }) : null,
3942
+ details.codes?.length ? /* @__PURE__ */ jsx9("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs9("div", { children: [
3943
+ /* @__PURE__ */ jsx9("dt", { children: code.code }),
3944
+ /* @__PURE__ */ jsx9("dd", { children: code.text })
3945
+ ] }, code.code)) }) : null,
3946
+ details.complianceDueDates?.length ? /* @__PURE__ */ jsxs9("div", { className: "mb-history-due", children: [
3947
+ /* @__PURE__ */ jsx9("em", { children: "Compliance Due Dates" }),
3948
+ /* @__PURE__ */ jsx9("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs9("div", { children: [
3949
+ /* @__PURE__ */ jsx9("dt", { children: formatDate(due.date) }),
3950
+ /* @__PURE__ */ jsx9("dd", { children: due.text })
3951
+ ] }, `${due.date}-${due.text}`)) })
3952
+ ] }) : null,
3953
+ details.text ? /* @__PURE__ */ jsx9("p", { className: "mb-history-text", children: details.text }) : null
3954
+ ] }) : null
3955
+ ] }, entry.id);
3956
+ }) })
3957
+ ] })
3958
+ ] });
3959
+ }
3480
3960
  var lifecycleStages = [
3481
3961
  { id: "submitted", label: "Sent" },
3482
3962
  { id: "accepted", label: "Accepted" },
@@ -3518,15 +3998,15 @@ function billLifecycleDisplayLabel(state, nativeStatus) {
3518
3998
  function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
3519
3999
  const rejected = state.toLowerCase() === "rejected";
3520
4000
  const steps = billLifecycleProgressSteps(state);
3521
- return /* @__PURE__ */ jsxs8("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
3522
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3523
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3524
- /* @__PURE__ */ jsx8("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
3525
- /* @__PURE__ */ jsx8("span", { children: rejected ? "The payer rejected this submission." : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
4001
+ return /* @__PURE__ */ jsxs9("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
4002
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4003
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4004
+ /* @__PURE__ */ jsx9("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
4005
+ /* @__PURE__ */ jsx9("span", { children: rejected ? "The payer rejected this submission." : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
3526
4006
  ] }) }),
3527
- /* @__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: [
3528
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
3529
- /* @__PURE__ */ jsx8("b", { children: step.label })
4007
+ /* @__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: [
4008
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
4009
+ /* @__PURE__ */ jsx9("b", { children: step.label })
3530
4010
  ] }, step.id)) })
3531
4011
  ] });
3532
4012
  }
@@ -3540,48 +4020,48 @@ function billRejectionIssueSummary(rejection, count) {
3540
4020
  function BillRejectionNotice({ rejection, title = "Rejected \u2014 action required", submittedAt, appearance, className, style, formatDate = defaultFormatDate }) {
3541
4021
  const issues = rejection.issues?.length ? rejection.issues : [{ code: rejection.code, description: rejection.reason }];
3542
4022
  const hasCodes = issues.some((issue) => Boolean(issue.code));
3543
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
3544
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3545
- /* @__PURE__ */ jsxs8("div", { className: "mb-rejection-overview", children: [
3546
- /* @__PURE__ */ jsxs8("header", { className: "mb-rejection-heading", children: [
3547
- /* @__PURE__ */ jsx8("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
3548
- /* @__PURE__ */ jsxs8("div", { children: [
3549
- /* @__PURE__ */ jsx8("strong", { children: title }),
3550
- /* @__PURE__ */ jsxs8("span", { children: [
4023
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
4024
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4025
+ /* @__PURE__ */ jsxs9("div", { className: "mb-rejection-overview", children: [
4026
+ /* @__PURE__ */ jsxs9("header", { className: "mb-rejection-heading", children: [
4027
+ /* @__PURE__ */ jsx9("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
4028
+ /* @__PURE__ */ jsxs9("div", { children: [
4029
+ /* @__PURE__ */ jsx9("strong", { children: title }),
4030
+ /* @__PURE__ */ jsxs9("span", { children: [
3551
4031
  "Fix the ",
3552
4032
  issues.length === 1 ? "issue" : "issues",
3553
4033
  " below, then resubmit."
3554
4034
  ] })
3555
4035
  ] })
3556
4036
  ] }),
3557
- /* @__PURE__ */ jsxs8("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
3558
- /* @__PURE__ */ jsxs8("li", { className: "is-complete", children: [
3559
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "\u2713" }),
3560
- /* @__PURE__ */ jsx8("b", { children: "Sent" }),
3561
- submittedAt ? /* @__PURE__ */ jsx8("small", { children: formatDate(submittedAt) }) : null
4037
+ /* @__PURE__ */ jsxs9("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
4038
+ /* @__PURE__ */ jsxs9("li", { className: "is-complete", children: [
4039
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2713" }),
4040
+ /* @__PURE__ */ jsx9("b", { children: "Sent" }),
4041
+ submittedAt ? /* @__PURE__ */ jsx9("small", { children: formatDate(submittedAt) }) : null
3562
4042
  ] }),
3563
- /* @__PURE__ */ jsxs8("li", { className: "is-rejected", "aria-current": "step", children: [
3564
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "!" }),
3565
- /* @__PURE__ */ jsx8("b", { children: "Rejected" }),
3566
- rejection.receivedAt ? /* @__PURE__ */ jsx8("small", { children: formatDate(rejection.receivedAt) }) : null
4043
+ /* @__PURE__ */ jsxs9("li", { className: "is-rejected", "aria-current": "step", children: [
4044
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "!" }),
4045
+ /* @__PURE__ */ jsx9("b", { children: "Rejected" }),
4046
+ rejection.receivedAt ? /* @__PURE__ */ jsx9("small", { children: formatDate(rejection.receivedAt) }) : null
3567
4047
  ] })
3568
4048
  ] })
3569
4049
  ] }),
3570
- /* @__PURE__ */ jsxs8("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
3571
- /* @__PURE__ */ jsxs8("div", { className: "mb-rejection-issues-heading", children: [
3572
- /* @__PURE__ */ jsxs8("strong", { children: [
3573
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "\u25B3" }),
4050
+ /* @__PURE__ */ jsxs9("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
4051
+ /* @__PURE__ */ jsxs9("div", { className: "mb-rejection-issues-heading", children: [
4052
+ /* @__PURE__ */ jsxs9("strong", { children: [
4053
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u25B3" }),
3574
4054
  " Rejection reasons"
3575
4055
  ] }),
3576
- /* @__PURE__ */ jsx8("span", { children: billRejectionIssueSummary(rejection, issues.length) })
4056
+ /* @__PURE__ */ jsx9("span", { children: billRejectionIssueSummary(rejection, issues.length) })
3577
4057
  ] }),
3578
- /* @__PURE__ */ jsx8("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs8("li", { children: [
3579
- /* @__PURE__ */ jsx8("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
3580
- /* @__PURE__ */ jsx8("p", { children: issue.description }),
3581
- issue.code ? /* @__PURE__ */ jsx8("span", { className: "mb-rejection-code", children: issue.code }) : null
4058
+ /* @__PURE__ */ jsx9("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs9("li", { children: [
4059
+ /* @__PURE__ */ jsx9("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
4060
+ /* @__PURE__ */ jsx9("p", { children: issue.description }),
4061
+ issue.code ? /* @__PURE__ */ jsx9("span", { className: "mb-rejection-code", children: issue.code }) : null
3582
4062
  ] }, `${issue.code ?? "issue"}-${index}`)) }),
3583
- hasCodes ? /* @__PURE__ */ jsxs8("p", { className: "mb-rejection-code-note", children: [
3584
- /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: "i" }),
4063
+ hasCodes ? /* @__PURE__ */ jsxs9("p", { className: "mb-rejection-code-note", children: [
4064
+ /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "i" }),
3585
4065
  " Technical error codes are included for support and auditability."
3586
4066
  ] }) : null
3587
4067
  ] })
@@ -3596,18 +4076,18 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
3596
4076
  ["Charged", currency(bill.totalCharge)],
3597
4077
  ["Balance", currency(bill.balanceDue)]
3598
4078
  ];
3599
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
3600
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3601
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3602
- /* @__PURE__ */ jsx8("strong", { children: "Bill snapshot" }),
3603
- /* @__PURE__ */ jsxs8("span", { children: [
4079
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
4080
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4081
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4082
+ /* @__PURE__ */ jsx9("strong", { children: "Bill snapshot" }),
4083
+ /* @__PURE__ */ jsxs9("span", { children: [
3604
4084
  "Bill #",
3605
4085
  bill.billNumber
3606
4086
  ] })
3607
4087
  ] }) }),
3608
- /* @__PURE__ */ jsx8("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs8("div", { children: [
3609
- /* @__PURE__ */ jsx8("dt", { children: label }),
3610
- /* @__PURE__ */ jsx8("dd", { children: value })
4088
+ /* @__PURE__ */ jsx9("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs9("div", { children: [
4089
+ /* @__PURE__ */ jsx9("dt", { children: label }),
4090
+ /* @__PURE__ */ jsx9("dd", { children: value })
3611
4091
  ] }, label)) })
3612
4092
  ] });
3613
4093
  }
@@ -3622,140 +4102,140 @@ function BillExplanationOfReview({
3622
4102
  style
3623
4103
  }) {
3624
4104
  const rows = payments.length ? payments : [null];
3625
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
3626
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3627
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3628
- /* @__PURE__ */ jsx8("strong", { children: "Explanation of Review" }),
3629
- /* @__PURE__ */ jsx8("span", { children: "Payer response and payment reconciliation." })
4105
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
4106
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4107
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4108
+ /* @__PURE__ */ jsx9("strong", { children: "Explanation of Review" }),
4109
+ /* @__PURE__ */ jsx9("span", { children: "Payer response and payment reconciliation." })
3630
4110
  ] }) }),
3631
- /* @__PURE__ */ jsxs8("dl", { className: "mb-eor-metrics", children: [
3632
- /* @__PURE__ */ jsxs8("div", { children: [
3633
- /* @__PURE__ */ jsx8("dt", { children: "Amount billed" }),
3634
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.billedAmount) })
4111
+ /* @__PURE__ */ jsxs9("dl", { className: "mb-eor-metrics", children: [
4112
+ /* @__PURE__ */ jsxs9("div", { children: [
4113
+ /* @__PURE__ */ jsx9("dt", { children: "Amount billed" }),
4114
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.billedAmount) })
3635
4115
  ] }),
3636
- /* @__PURE__ */ jsxs8("div", { children: [
3637
- /* @__PURE__ */ jsx8("dt", { children: "Payer allowed" }),
3638
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
4116
+ /* @__PURE__ */ jsxs9("div", { children: [
4117
+ /* @__PURE__ */ jsx9("dt", { children: "Payer allowed" }),
4118
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3639
4119
  ] }),
3640
- /* @__PURE__ */ jsxs8("div", { children: [
3641
- /* @__PURE__ */ jsx8("dt", { children: "Payer reported paid" }),
3642
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
4120
+ /* @__PURE__ */ jsxs9("div", { children: [
4121
+ /* @__PURE__ */ jsx9("dt", { children: "Payer reported paid" }),
4122
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3643
4123
  ] }),
3644
- /* @__PURE__ */ jsxs8("div", { className: "is-balance", children: [
3645
- /* @__PURE__ */ jsx8("dt", { children: "Balance due" }),
3646
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.balanceDue) })
4124
+ /* @__PURE__ */ jsxs9("div", { className: "is-balance", children: [
4125
+ /* @__PURE__ */ jsx9("dt", { children: "Balance due" }),
4126
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.balanceDue) })
3647
4127
  ] }),
3648
- /* @__PURE__ */ jsxs8("div", { children: [
3649
- /* @__PURE__ */ jsx8("dt", { children: "Payment posted" }),
3650
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedPrincipal) })
4128
+ /* @__PURE__ */ jsxs9("div", { children: [
4129
+ /* @__PURE__ */ jsx9("dt", { children: "Payment posted" }),
4130
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedPrincipal) })
3651
4131
  ] }),
3652
- /* @__PURE__ */ jsxs8("div", { children: [
3653
- /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3654
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedAdditional) })
4132
+ /* @__PURE__ */ jsxs9("div", { children: [
4133
+ /* @__PURE__ */ jsx9("dt", { children: "Penalty & interest" }),
4134
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedAdditional) })
3655
4135
  ] }),
3656
- /* @__PURE__ */ jsxs8("div", { children: [
3657
- /* @__PURE__ */ jsx8("dt", { children: "Total received" }),
3658
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.totalPostedCash) })
4136
+ /* @__PURE__ */ jsxs9("div", { children: [
4137
+ /* @__PURE__ */ jsx9("dt", { children: "Total received" }),
4138
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.totalPostedCash) })
3659
4139
  ] }),
3660
- /* @__PURE__ */ jsxs8("div", { children: [
3661
- /* @__PURE__ */ jsx8("dt", { children: "Expected" }),
3662
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.expectedAmount) })
4140
+ /* @__PURE__ */ jsxs9("div", { children: [
4141
+ /* @__PURE__ */ jsx9("dt", { children: "Expected" }),
4142
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.expectedAmount) })
3663
4143
  ] })
3664
4144
  ] }),
3665
- remittance.denialReason ? /* @__PURE__ */ jsxs8("div", { className: "mb-denial", children: [
3666
- /* @__PURE__ */ jsx8("strong", { children: "Denial reason" }),
3667
- /* @__PURE__ */ jsx8("p", { children: remittance.denialReason })
4145
+ remittance.denialReason ? /* @__PURE__ */ jsxs9("div", { className: "mb-denial", children: [
4146
+ /* @__PURE__ */ jsx9("strong", { children: "Denial reason" }),
4147
+ /* @__PURE__ */ jsx9("p", { children: remittance.denialReason })
3668
4148
  ] }) : null,
3669
- /* @__PURE__ */ jsx8("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs8("table", { className: "mb-eor-table", children: [
3670
- /* @__PURE__ */ jsxs8("thead", { children: [
3671
- /* @__PURE__ */ jsxs8("tr", { className: "mb-eor-groups", children: [
3672
- /* @__PURE__ */ jsx8("th", { colSpan: 2, children: "Submission" }),
3673
- /* @__PURE__ */ jsx8("th", { colSpan: 5, children: "EOR payment information" }),
3674
- /* @__PURE__ */ jsx8("th", { colSpan: 2, children: "EOR post" }),
3675
- /* @__PURE__ */ jsx8("th", { children: "EOR" })
4149
+ /* @__PURE__ */ jsx9("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs9("table", { className: "mb-eor-table", children: [
4150
+ /* @__PURE__ */ jsxs9("thead", { children: [
4151
+ /* @__PURE__ */ jsxs9("tr", { className: "mb-eor-groups", children: [
4152
+ /* @__PURE__ */ jsx9("th", { colSpan: 2, children: "Submission" }),
4153
+ /* @__PURE__ */ jsx9("th", { colSpan: 5, children: "EOR payment information" }),
4154
+ /* @__PURE__ */ jsx9("th", { colSpan: 2, children: "EOR post" }),
4155
+ /* @__PURE__ */ jsx9("th", { children: "EOR" })
3676
4156
  ] }),
3677
- /* @__PURE__ */ jsxs8("tr", { children: [
3678
- /* @__PURE__ */ jsx8("th", { children: "Submission" }),
3679
- /* @__PURE__ */ jsx8("th", { children: "Submission payment" }),
3680
- /* @__PURE__ */ jsx8("th", { children: "Payment method" }),
3681
- /* @__PURE__ */ jsx8("th", { children: "Reference" }),
3682
- /* @__PURE__ */ jsx8("th", { children: "Effective date" }),
3683
- /* @__PURE__ */ jsx8("th", { children: "Payment total" }),
3684
- /* @__PURE__ */ jsx8("th", { children: "Deposit date" }),
3685
- /* @__PURE__ */ jsx8("th", { children: "Post date" }),
3686
- /* @__PURE__ */ jsx8("th", { children: "Source" }),
3687
- /* @__PURE__ */ jsx8("th", { children: "Document" })
4157
+ /* @__PURE__ */ jsxs9("tr", { children: [
4158
+ /* @__PURE__ */ jsx9("th", { children: "Submission" }),
4159
+ /* @__PURE__ */ jsx9("th", { children: "Submission payment" }),
4160
+ /* @__PURE__ */ jsx9("th", { children: "Payment method" }),
4161
+ /* @__PURE__ */ jsx9("th", { children: "Reference" }),
4162
+ /* @__PURE__ */ jsx9("th", { children: "Effective date" }),
4163
+ /* @__PURE__ */ jsx9("th", { children: "Payment total" }),
4164
+ /* @__PURE__ */ jsx9("th", { children: "Deposit date" }),
4165
+ /* @__PURE__ */ jsx9("th", { children: "Post date" }),
4166
+ /* @__PURE__ */ jsx9("th", { children: "Source" }),
4167
+ /* @__PURE__ */ jsx9("th", { children: "Document" })
3688
4168
  ] })
3689
4169
  ] }),
3690
- /* @__PURE__ */ jsx8("tbody", { children: rows.map((payment, index) => {
4170
+ /* @__PURE__ */ jsx9("tbody", { children: rows.map((payment, index) => {
3691
4171
  const eor = eors[index] ?? eors[0];
3692
- return /* @__PURE__ */ jsxs8("tr", { children: [
3693
- /* @__PURE__ */ jsxs8("td", { "data-label": "Submission", children: [
3694
- /* @__PURE__ */ jsx8("strong", { children: "Original bill" }),
3695
- submittedAt ? /* @__PURE__ */ jsxs8("span", { children: [
4172
+ return /* @__PURE__ */ jsxs9("tr", { children: [
4173
+ /* @__PURE__ */ jsxs9("td", { "data-label": "Submission", children: [
4174
+ /* @__PURE__ */ jsx9("strong", { children: "Original bill" }),
4175
+ submittedAt ? /* @__PURE__ */ jsxs9("span", { children: [
3696
4176
  "Sent ",
3697
4177
  defaultFormatDate(submittedAt)
3698
4178
  ] }) : null
3699
4179
  ] }),
3700
- /* @__PURE__ */ jsx8("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
3701
- /* @__PURE__ */ jsx8("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
3702
- /* @__PURE__ */ jsx8("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
3703
- /* @__PURE__ */ jsx8("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
3704
- /* @__PURE__ */ jsx8("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
3705
- /* @__PURE__ */ jsx8("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
3706
- /* @__PURE__ */ jsx8("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
3707
- /* @__PURE__ */ jsx8("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
3708
- /* @__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" })
4180
+ /* @__PURE__ */ jsx9("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
4181
+ /* @__PURE__ */ jsx9("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
4182
+ /* @__PURE__ */ jsx9("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
4183
+ /* @__PURE__ */ jsx9("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
4184
+ /* @__PURE__ */ jsx9("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
4185
+ /* @__PURE__ */ jsx9("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
4186
+ /* @__PURE__ */ jsx9("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
4187
+ /* @__PURE__ */ jsx9("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
4188
+ /* @__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" })
3709
4189
  ] }, payment?.id ?? `empty-${index}`);
3710
4190
  }) })
3711
4191
  ] }) }),
3712
- 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
4192
+ 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
3713
4193
  ] });
3714
4194
  }
3715
4195
  function BillRemittanceCard({ remittance, appearance, className, style }) {
3716
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
3717
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3718
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3719
- /* @__PURE__ */ jsx8("strong", { children: "Remittance" }),
3720
- /* @__PURE__ */ jsx8("span", { children: "Amounts reported by the payer and posted to the bill." })
4196
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
4197
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4198
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4199
+ /* @__PURE__ */ jsx9("strong", { children: "Remittance" }),
4200
+ /* @__PURE__ */ jsx9("span", { children: "Amounts reported by the payer and posted to the bill." })
3721
4201
  ] }) }),
3722
- /* @__PURE__ */ jsxs8("dl", { children: [
3723
- /* @__PURE__ */ jsxs8("div", { children: [
3724
- /* @__PURE__ */ jsx8("dt", { children: "Amount billed" }),
3725
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.billedAmount) })
4202
+ /* @__PURE__ */ jsxs9("dl", { children: [
4203
+ /* @__PURE__ */ jsxs9("div", { children: [
4204
+ /* @__PURE__ */ jsx9("dt", { children: "Amount billed" }),
4205
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.billedAmount) })
3726
4206
  ] }),
3727
- /* @__PURE__ */ jsxs8("div", { children: [
3728
- /* @__PURE__ */ jsx8("dt", { children: "Expected" }),
3729
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.expectedAmount) })
4207
+ /* @__PURE__ */ jsxs9("div", { children: [
4208
+ /* @__PURE__ */ jsx9("dt", { children: "Expected" }),
4209
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.expectedAmount) })
3730
4210
  ] }),
3731
- /* @__PURE__ */ jsxs8("div", { children: [
3732
- /* @__PURE__ */ jsx8("dt", { children: "Payer allowed" }),
3733
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
4211
+ /* @__PURE__ */ jsxs9("div", { children: [
4212
+ /* @__PURE__ */ jsx9("dt", { children: "Payer allowed" }),
4213
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3734
4214
  ] }),
3735
- /* @__PURE__ */ jsxs8("div", { children: [
3736
- /* @__PURE__ */ jsx8("dt", { children: "Payer reported paid" }),
3737
- /* @__PURE__ */ jsx8("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
4215
+ /* @__PURE__ */ jsxs9("div", { children: [
4216
+ /* @__PURE__ */ jsx9("dt", { children: "Payer reported paid" }),
4217
+ /* @__PURE__ */ jsx9("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3738
4218
  ] }),
3739
- /* @__PURE__ */ jsxs8("div", { children: [
3740
- /* @__PURE__ */ jsx8("dt", { children: "Payment posted" }),
3741
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedPrincipal) })
4219
+ /* @__PURE__ */ jsxs9("div", { children: [
4220
+ /* @__PURE__ */ jsx9("dt", { children: "Payment posted" }),
4221
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedPrincipal) })
3742
4222
  ] }),
3743
- /* @__PURE__ */ jsxs8("div", { children: [
3744
- /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3745
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedAdditional) })
4223
+ /* @__PURE__ */ jsxs9("div", { children: [
4224
+ /* @__PURE__ */ jsx9("dt", { children: "Penalty & interest" }),
4225
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.postedAdditional) })
3746
4226
  ] }),
3747
- /* @__PURE__ */ jsxs8("div", { children: [
3748
- /* @__PURE__ */ jsx8("dt", { children: "Total received" }),
3749
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.totalPostedCash) })
4227
+ /* @__PURE__ */ jsxs9("div", { children: [
4228
+ /* @__PURE__ */ jsx9("dt", { children: "Total received" }),
4229
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.totalPostedCash) })
3750
4230
  ] }),
3751
- /* @__PURE__ */ jsxs8("div", { children: [
3752
- /* @__PURE__ */ jsx8("dt", { children: "Balance due" }),
3753
- /* @__PURE__ */ jsx8("dd", { children: currency(remittance.balanceDue) })
4231
+ /* @__PURE__ */ jsxs9("div", { children: [
4232
+ /* @__PURE__ */ jsx9("dt", { children: "Balance due" }),
4233
+ /* @__PURE__ */ jsx9("dd", { children: currency(remittance.balanceDue) })
3754
4234
  ] })
3755
4235
  ] }),
3756
- remittance.denialReason ? /* @__PURE__ */ jsxs8("div", { className: "mb-denial", children: [
3757
- /* @__PURE__ */ jsx8("strong", { children: "Denial reason" }),
3758
- /* @__PURE__ */ jsx8("p", { children: remittance.denialReason })
4236
+ remittance.denialReason ? /* @__PURE__ */ jsxs9("div", { className: "mb-denial", children: [
4237
+ /* @__PURE__ */ jsx9("strong", { children: "Denial reason" }),
4238
+ /* @__PURE__ */ jsx9("p", { children: remittance.denialReason })
3759
4239
  ] }) : null
3760
4240
  ] });
3761
4241
  }
@@ -3770,72 +4250,72 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
3770
4250
  delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
3771
4251
  ].filter(Boolean);
3772
4252
  if (!delivery.payerName && !contacts.length) return null;
3773
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
3774
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3775
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3776
- /* @__PURE__ */ jsx8("strong", { children: delivery.payerName || "Claims administrator" }),
3777
- /* @__PURE__ */ jsx8("span", { children: "Billing and follow-up contacts." })
4253
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
4254
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4255
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4256
+ /* @__PURE__ */ jsx9("strong", { children: delivery.payerName || "Claims administrator" }),
4257
+ /* @__PURE__ */ jsx9("span", { children: "Billing and follow-up contacts." })
3778
4258
  ] }) }),
3779
- !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: [
3780
- /* @__PURE__ */ jsx8("dt", { children: label }),
3781
- /* @__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 })
4259
+ !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: [
4260
+ /* @__PURE__ */ jsx9("dt", { children: label }),
4261
+ /* @__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 })
3782
4262
  ] }, label)) })
3783
4263
  ] });
3784
4264
  }
3785
4265
  function BillPaymentLedger({ payments, appearance, className, style }) {
3786
- return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
3787
- /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3788
- /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3789
- /* @__PURE__ */ jsx8("strong", { children: "Payments" }),
3790
- /* @__PURE__ */ jsx8("span", { children: "Funds recorded against this bill." })
4266
+ return /* @__PURE__ */ jsxs9("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
4267
+ /* @__PURE__ */ jsx9("style", { children: lifecycleSurfaceStyles }),
4268
+ /* @__PURE__ */ jsx9("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs9("div", { children: [
4269
+ /* @__PURE__ */ jsx9("strong", { children: "Payments" }),
4270
+ /* @__PURE__ */ jsx9("span", { children: "Funds recorded against this bill." })
3791
4271
  ] }) }),
3792
- !payments.length ? /* @__PURE__ */ jsx8("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx8("div", { className: "mb-payment-list", children: payments.map((payment) => {
4272
+ !payments.length ? /* @__PURE__ */ jsx9("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx9("div", { className: "mb-payment-list", children: payments.map((payment) => {
3793
4273
  const additional = payment.feeAmount ?? 0;
3794
- return /* @__PURE__ */ jsxs8("article", { children: [
3795
- /* @__PURE__ */ jsxs8("div", { className: "mb-payment-amount", children: [
3796
- /* @__PURE__ */ jsx8("strong", { children: currency(payment.amount) }),
3797
- /* @__PURE__ */ jsx8("span", { children: "Total received" })
4274
+ return /* @__PURE__ */ jsxs9("article", { children: [
4275
+ /* @__PURE__ */ jsxs9("div", { className: "mb-payment-amount", children: [
4276
+ /* @__PURE__ */ jsx9("strong", { children: currency(payment.amount) }),
4277
+ /* @__PURE__ */ jsx9("span", { children: "Total received" })
3798
4278
  ] }),
3799
- /* @__PURE__ */ jsxs8("dl", { children: [
3800
- /* @__PURE__ */ jsxs8("div", { children: [
3801
- /* @__PURE__ */ jsx8("dt", { children: "Applied to bill" }),
3802
- /* @__PURE__ */ jsx8("dd", { children: currency(payment.principalAmount) })
4279
+ /* @__PURE__ */ jsxs9("dl", { children: [
4280
+ /* @__PURE__ */ jsxs9("div", { children: [
4281
+ /* @__PURE__ */ jsx9("dt", { children: "Applied to bill" }),
4282
+ /* @__PURE__ */ jsx9("dd", { children: currency(payment.principalAmount) })
3803
4283
  ] }),
3804
- additional > 0 ? /* @__PURE__ */ jsxs8("div", { children: [
3805
- /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3806
- /* @__PURE__ */ jsx8("dd", { children: currency(additional) })
4284
+ additional > 0 ? /* @__PURE__ */ jsxs9("div", { children: [
4285
+ /* @__PURE__ */ jsx9("dt", { children: "Penalty & interest" }),
4286
+ /* @__PURE__ */ jsx9("dd", { children: currency(additional) })
3807
4287
  ] }) : null,
3808
- /* @__PURE__ */ jsxs8("div", { children: [
3809
- /* @__PURE__ */ jsx8("dt", { children: "Method" }),
3810
- /* @__PURE__ */ jsx8("dd", { children: payment.method.toUpperCase() })
4288
+ /* @__PURE__ */ jsxs9("div", { children: [
4289
+ /* @__PURE__ */ jsx9("dt", { children: "Method" }),
4290
+ /* @__PURE__ */ jsx9("dd", { children: payment.method.toUpperCase() })
3811
4291
  ] }),
3812
- /* @__PURE__ */ jsxs8("div", { children: [
3813
- /* @__PURE__ */ jsx8("dt", { children: "Reference" }),
3814
- /* @__PURE__ */ jsx8("dd", { children: payment.checkNumber || "\u2014" })
4292
+ /* @__PURE__ */ jsxs9("div", { children: [
4293
+ /* @__PURE__ */ jsx9("dt", { children: "Reference" }),
4294
+ /* @__PURE__ */ jsx9("dd", { children: payment.checkNumber || "\u2014" })
3815
4295
  ] }),
3816
- /* @__PURE__ */ jsxs8("div", { children: [
3817
- /* @__PURE__ */ jsx8("dt", { children: "Effective date" }),
3818
- /* @__PURE__ */ jsx8("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
4296
+ /* @__PURE__ */ jsxs9("div", { children: [
4297
+ /* @__PURE__ */ jsx9("dt", { children: "Effective date" }),
4298
+ /* @__PURE__ */ jsx9("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
3819
4299
  ] }),
3820
- /* @__PURE__ */ jsxs8("div", { children: [
3821
- /* @__PURE__ */ jsx8("dt", { children: "Deposit date" }),
3822
- /* @__PURE__ */ jsx8("dd", { children: payment.depositDate || "Not recorded" })
4300
+ /* @__PURE__ */ jsxs9("div", { children: [
4301
+ /* @__PURE__ */ jsx9("dt", { children: "Deposit date" }),
4302
+ /* @__PURE__ */ jsx9("dd", { children: payment.depositDate || "Not recorded" })
3823
4303
  ] }),
3824
- /* @__PURE__ */ jsxs8("div", { children: [
3825
- /* @__PURE__ */ jsx8("dt", { children: "Posted" }),
3826
- /* @__PURE__ */ jsxs8("dd", { children: [
4304
+ /* @__PURE__ */ jsxs9("div", { children: [
4305
+ /* @__PURE__ */ jsx9("dt", { children: "Posted" }),
4306
+ /* @__PURE__ */ jsxs9("dd", { children: [
3827
4307
  defaultFormatDate(payment.postedAt),
3828
4308
  " \xB7 ",
3829
4309
  payment.source.toUpperCase()
3830
4310
  ] })
3831
4311
  ] }),
3832
- /* @__PURE__ */ jsxs8("div", { children: [
3833
- /* @__PURE__ */ jsx8("dt", { children: "Status" }),
3834
- /* @__PURE__ */ jsx8("dd", { children: humanize(payment.status || "posted") })
4312
+ /* @__PURE__ */ jsxs9("div", { children: [
4313
+ /* @__PURE__ */ jsx9("dt", { children: "Status" }),
4314
+ /* @__PURE__ */ jsx9("dd", { children: humanize(payment.status || "posted") })
3835
4315
  ] })
3836
4316
  ] }),
3837
- payment.feeReason ? /* @__PURE__ */ jsx8("p", { children: payment.feeReason }) : null,
3838
- payment.note ? /* @__PURE__ */ jsx8("p", { children: payment.note }) : null
4317
+ payment.feeReason ? /* @__PURE__ */ jsx9("p", { children: payment.feeReason }) : null,
4318
+ payment.note ? /* @__PURE__ */ jsx9("p", { children: payment.note }) : null
3839
4319
  ] }, payment.id);
3840
4320
  }) })
3841
4321
  ] });
@@ -3861,16 +4341,39 @@ var lifecycleSurfaceStyles = `
3861
4341
  .mb-snapshot dl,.mb-remittance dl,.mb-contacts dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0;margin:0}.mb-remittance dl{grid-template-columns:repeat(4,minmax(0,1fr));row-gap:1px;background:var(--mb-border)}.mb-snapshot dl>div,.mb-remittance dl>div,.mb-contacts dl>div{display:grid;gap:3px;padding:10px 14px;border-left:1px solid var(--mb-border)}.mb-remittance dl>div{border:0;background:var(--mb-surface)}.mb-snapshot dl>div:nth-child(3n+1),.mb-contacts dl>div:first-child{border-left:0}.mb-snapshot dt,.mb-remittance dt,.mb-contacts dt,.mb-payment-list dt{color:var(--mb-muted);font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.mb-snapshot dd,.mb-remittance dd,.mb-contacts dd,.mb-payment-list dd{font-size:14px;font-weight:750;margin:0;overflow-wrap:anywhere}.mb-contacts a{color:var(--mb-accent)}.mb-denial{margin-top:16px;border-left:4px solid var(--mb-danger);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 8%,var(--mb-surface));padding:12px 14px}.mb-denial p{margin:4px 0 0}
3862
4342
  .mb-payment-list{display:grid}.mb-payment-list article{display:grid;grid-template-columns:minmax(120px,.35fr) 1fr;gap:14px 24px;padding:16px 0;border-top:1px solid var(--mb-border)}.mb-payment-list article:first-child{border-top:0}.mb-payment-amount{display:grid;align-content:start;gap:2px}.mb-payment-amount strong{font-size:1.2rem}.mb-payment-list article>dl{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0}.mb-payment-list article>dl>div{display:grid;align-content:start;gap:3px}.mb-payment-list article span{color:var(--mb-muted);font-size:12px}.mb-payment-list article p{grid-column:1/-1;margin:0;color:var(--mb-muted);font-size:13px}
3863
4343
  .mb-eor-review{border-top:4px solid var(--mb-accent);padding-top:17px}.mb-eor-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:0 0 18px;border:1px solid var(--mb-border);border-radius:10px;overflow:hidden}.mb-eor-metrics>div{display:grid;gap:4px;padding:13px 15px;border-left:1px solid var(--mb-border);border-top:1px solid var(--mb-border)}.mb-eor-metrics>div:nth-child(-n+4){border-top:0}.mb-eor-metrics>div:nth-child(4n+1){border-left:0}.mb-eor-metrics dt{color:var(--mb-muted);font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.mb-eor-metrics dd{margin:0;font-size:15px;font-weight:800}.mb-eor-metrics .is-balance{background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface))}.mb-eor-table-wrap{overflow-x:auto;border:1px solid var(--mb-border);border-radius:10px}.mb-eor-table{width:100%;min-width:1080px;border-collapse:collapse;font-size:12px}.mb-eor-table th,.mb-eor-table td{padding:10px 12px;border-left:1px solid var(--mb-border);border-top:1px solid var(--mb-border);text-align:left;vertical-align:top}.mb-eor-table th:first-child,.mb-eor-table td:first-child{border-left:0}.mb-eor-table thead th{background:var(--mb-soft);color:var(--mb-muted);font-weight:800}.mb-eor-table .mb-eor-groups th{border-top:0;background:color-mix(in srgb,var(--mb-accent) 13%,var(--mb-surface));color:var(--mb-text);text-align:center}.mb-eor-table td>strong,.mb-eor-table td>span{display:block}.mb-eor-table td>span{margin-top:3px;color:var(--mb-muted)}.mb-eor-link,.mb-eor-documents button{border:0;background:transparent;color:var(--mb-accent);font:inherit;font-weight:750;padding:0;text-align:left;text-decoration:underline;cursor:pointer;overflow-wrap:anywhere}.mb-eor-documents{display:flex;flex-wrap:wrap;gap:12px;margin-top:12px}
4344
+ .mb-history-table{border:1px solid var(--mb-border);border-radius:10px;overflow:hidden}
4345
+ .mb-history-head{display:grid;grid-template-columns:96px 160px 140px minmax(0,1fr);gap:12px;padding:8px 14px;background:var(--mb-soft);color:var(--mb-muted);font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
4346
+ .mb-history-rows{list-style:none;margin:0;padding:0}.mb-history-row{border-top:1px solid var(--mb-border)}
4347
+ .mb-history-row.is-submission{background:color-mix(in srgb,var(--mb-accent) 9%,var(--mb-surface))}
4348
+ .mb-history-row.is-note{background:color-mix(in srgb,#f2c344 13%,var(--mb-surface))}
4349
+ .mb-history-line{display:grid;grid-template-columns:96px 160px 140px minmax(0,1fr);gap:12px;width:100%;padding:10px 14px;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:default}
4350
+ .mb-history-line:not(:disabled){cursor:pointer}.mb-history-line:not(:disabled):hover .mb-history-summary{text-decoration:underline}
4351
+ .mb-history-date{color:var(--mb-muted);font-size:13px}.mb-history-action{font-size:13.5px;font-weight:750}
4352
+ .mb-history-row.is-problem .mb-history-action{color:var(--mb-danger)}
4353
+ .mb-history-actor{color:var(--mb-muted);font-size:13px;overflow-wrap:anywhere}
4354
+ .mb-history-summary{display:flex;align-items:flex-start;gap:7px;min-width:0;font-size:13.5px;line-height:1.45;overflow-wrap:anywhere}
4355
+ .mb-history-caret{flex:0 0 auto;margin-top:5px;width:0;height:0;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:6px solid var(--mb-muted);transition:transform .12s ease}
4356
+ .mb-history-caret.is-open{transform:rotate(90deg)}
4357
+ .mb-history-details{padding:4px 14px 14px 122px;font-size:13.5px;line-height:1.5}
4358
+ .mb-history-kv,.mb-history-codes,.mb-history-due dl{display:grid;gap:4px;margin:0}
4359
+ .mb-history-kv>div{display:grid;grid-template-columns:180px minmax(0,1fr);gap:12px;border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);padding-top:4px}
4360
+ .mb-history-kv dt{font-weight:750}.mb-history-kv dd{margin:0;overflow-wrap:anywhere}.mb-history-kv dd a{color:var(--mb-accent)}.mb-history-doc{display:block}
4361
+ .mb-history-codes>div{display:grid;grid-template-columns:56px minmax(0,1fr);gap:12px}.mb-history-codes dt{font-weight:800}.mb-history-codes dd{margin:0}
4362
+ .mb-history-due{margin-top:8px}.mb-history-due em{display:block;color:var(--mb-muted);font-size:12.5px;margin-bottom:4px}
4363
+ .mb-history-due dl>div{display:grid;grid-template-columns:96px minmax(0,1fr);gap:12px;border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);padding-top:4px}
4364
+ .mb-history-due dt{font-weight:750}.mb-history-due dd{margin:0}
4365
+ .mb-history-text{margin:8px 0 0;color:var(--mb-text);white-space:pre-wrap}
4366
+ @media(max-width:700px){.mb-history-head{display:none}.mb-history-line{grid-template-columns:1fr;gap:2px;padding:10px 12px}.mb-history-details{padding:4px 12px 12px}.mb-history-kv>div,.mb-history-due dl>div{grid-template-columns:1fr}}
3864
4367
  @media(max-width:700px){.mb-surface.mb-progress{padding:16px 10px}.mb-progress-list{grid-template-columns:repeat(4,minmax(0,1fr))}.mb-progress-list li{display:grid;grid-template-columns:1fr;align-items:start;gap:6px;text-align:center;font-size:10px;min-width:0}.mb-progress-list li b{font-size:10px;white-space:nowrap}.mb-progress-list li:not(:last-child)::after{left:calc(50% + 12px);right:calc(-50% + 12px);top:11px;bottom:auto;width:auto;height:2px}.mb-progress-list li>span{grid-row:auto;width:24px;height:24px;font-size:11px}.mb-rejection-notice{padding:18px 14px 14px}.mb-rejection-overview{grid-template-columns:1fr;gap:18px}.mb-rejection-heading strong{font-size:17px}.mb-rejection-icon{width:36px;height:36px}.mb-rejection-progress{margin:0 0 4px}.mb-rejection-issues-heading{align-items:flex-start;flex-direction:column;gap:4px}.mb-rejection-issues-heading>span{text-align:left}.mb-rejection-issues li{grid-template-columns:8px minmax(0,1fr);gap:8px 10px}.mb-rejection-code{grid-column:2;justify-self:start}.mb-snapshot dl,.mb-remittance dl,.mb-contacts dl{grid-template-columns:1fr 1fr}.mb-snapshot dl>div,.mb-remittance dl>div,.mb-contacts dl>div{border:0;border-top:1px solid var(--mb-border);padding:10px 0}.mb-snapshot dl>div:nth-child(-n+2),.mb-remittance dl>div:nth-child(-n+2),.mb-contacts dl>div:nth-child(-n+2){border-top:0}.mb-payment-list article{grid-template-columns:1fr}.mb-payment-list article>dl{grid-template-columns:1fr 1fr}}
3865
4368
  `;
3866
4369
 
3867
4370
  // src/connected-bill-lifecycle.tsx
3868
4371
  import {
3869
4372
  useCallback as useCallback4,
3870
- useEffect as useEffect6,
3871
- useMemo as useMemo7,
4373
+ useEffect as useEffect7,
4374
+ useMemo as useMemo8,
3872
4375
  useRef as useRef5,
3873
- useState as useState7
4376
+ useState as useState9
3874
4377
  } from "react";
3875
4378
  import {
3876
4379
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
@@ -3878,7 +4381,7 @@ import {
3878
4381
  createBillLifecycleClient
3879
4382
  } from "@mindbill/browser";
3880
4383
  import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
3881
- import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
4384
+ import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3882
4385
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
3883
4386
  function reservePreviewWindow() {
3884
4387
  const preview = window.open("about:blank", "_blank");
@@ -3920,25 +4423,25 @@ function useBillLifecycle({
3920
4423
  enabled = true,
3921
4424
  fetch: fetchOverride
3922
4425
  }) {
3923
- const [data, setData] = useState7(null);
3924
- const [error, setError] = useState7(null);
3925
- const [isLoading, setIsLoading] = useState7(enabled);
3926
- const [isRefreshing, setIsRefreshing] = useState7(false);
3927
- const [isMutating, setIsMutating] = useState7(false);
4426
+ const [data, setData] = useState9(null);
4427
+ const [error, setError] = useState9(null);
4428
+ const [isLoading, setIsLoading] = useState9(enabled);
4429
+ const [isRefreshing, setIsRefreshing] = useState9(false);
4430
+ const [isMutating, setIsMutating] = useState9(false);
3928
4431
  const mounted = useRef5(true);
3929
- const client = useMemo7(() => createBillLifecycleClient({
4432
+ const client = useMemo8(() => createBillLifecycleClient({
3930
4433
  billId: providedBillId,
3931
4434
  sessionEndpoint,
3932
4435
  getSession,
3933
4436
  apiBaseUrl,
3934
4437
  fetch: fetchOverride
3935
4438
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
3936
- useEffect6(() => {
4439
+ useEffect7(() => {
3937
4440
  setData(null);
3938
4441
  setError(null);
3939
4442
  setIsLoading(enabled);
3940
4443
  }, [enabled, providedBillId]);
3941
- useEffect6(() => {
4444
+ useEffect7(() => {
3942
4445
  mounted.current = true;
3943
4446
  return () => {
3944
4447
  mounted.current = false;
@@ -3962,7 +4465,7 @@ function useBillLifecycle({
3962
4465
  }
3963
4466
  }
3964
4467
  }, [client, enabled]);
3965
- useEffect6(() => {
4468
+ useEffect7(() => {
3966
4469
  if (!enabled) return;
3967
4470
  void refresh();
3968
4471
  const interval = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -4027,7 +4530,7 @@ function useBillLifecycle({
4027
4530
  }
4028
4531
  function LifecycleDialog({ children, title, onClose }) {
4029
4532
  const dialog = useRef5(null);
4030
- useEffect6(() => {
4533
+ useEffect7(() => {
4031
4534
  const previous = document.activeElement;
4032
4535
  dialog.current?.focus();
4033
4536
  const onKeyDown = (event) => event.key === "Escape" && onClose();
@@ -4037,8 +4540,8 @@ function LifecycleDialog({ children, title, onClose }) {
4037
4540
  previous?.focus();
4038
4541
  };
4039
4542
  }, [onClose]);
4040
- 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: [
4041
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
4543
+ 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: [
4544
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
4042
4545
  children
4043
4546
  ] }) });
4044
4547
  }
@@ -4071,14 +4574,14 @@ function shouldShowSandboxControls(environment, enabled = false) {
4071
4574
  function ConnectedBillLifecycle({ appearance, sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
4072
4575
  const lifecycle = useBillLifecycle(options);
4073
4576
  const { data } = lifecycle;
4074
- const [tab, setTab] = useState7("details");
4075
- const [panel, setPanel] = useState7("");
4076
- const [notice, setNotice] = useState7("");
4077
- const [reason, setReason] = useState7("");
4078
- const [payment, setPayment] = useState7({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
4079
- const [review, setReview] = useState7({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
4577
+ const [tab, setTab] = useState9("details");
4578
+ const [panel, setPanel] = useState9("");
4579
+ const [notice, setNotice] = useState9("");
4580
+ const [reason, setReason] = useState9("");
4581
+ const [payment, setPayment] = useState9({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
4582
+ const [review, setReview] = useState9({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
4080
4583
  const lastData = useRef5(null);
4081
- useEffect6(() => {
4584
+ useEffect7(() => {
4082
4585
  if (!data || data === lastData.current) return;
4083
4586
  lastData.current = data;
4084
4587
  onChanged?.(data);
@@ -4095,13 +4598,13 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
4095
4598
  attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
4096
4599
  }));
4097
4600
  }, [data, onChanged]);
4098
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx9(Fragment6, { children: loadingFallback ?? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
4601
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx10(Fragment7, { children: loadingFallback ?? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
4099
4602
  if (!data) {
4100
4603
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
4101
- return /* @__PURE__ */ jsx9(Fragment6, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-error", role: "alert", children: [
4102
- /* @__PURE__ */ jsx9("strong", { children: "Billing is unavailable." }),
4103
- /* @__PURE__ */ jsx9("span", { children: error.message }),
4104
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
4604
+ return /* @__PURE__ */ jsx10(Fragment7, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-error", role: "alert", children: [
4605
+ /* @__PURE__ */ jsx10("strong", { children: "Billing is unavailable." }),
4606
+ /* @__PURE__ */ jsx10("span", { children: error.message }),
4607
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
4105
4608
  ] }) });
4106
4609
  }
4107
4610
  const complete = async (message, task) => {
@@ -4119,170 +4622,170 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
4119
4622
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
4120
4623
  const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
4121
4624
  const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
4122
- return /* @__PURE__ */ jsxs9("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
4123
- /* @__PURE__ */ jsx9("style", { children: CONNECTED_LIFECYCLE_STYLES }),
4124
- 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 } : {} }),
4125
- /* @__PURE__ */ jsxs9("header", { className: "mb-lifecycle-head", children: [
4126
- /* @__PURE__ */ jsxs9("div", { children: [
4127
- /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs9("h2", { children: [
4625
+ return /* @__PURE__ */ jsxs10("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
4626
+ /* @__PURE__ */ jsx10("style", { children: CONNECTED_LIFECYCLE_STYLES }),
4627
+ 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 } : {} }),
4628
+ /* @__PURE__ */ jsxs10("header", { className: "mb-lifecycle-head", children: [
4629
+ /* @__PURE__ */ jsxs10("div", { children: [
4630
+ /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs10("h2", { children: [
4128
4631
  "Bill #",
4129
4632
  data.bill.billNumber
4130
4633
  ] }) }),
4131
- /* @__PURE__ */ jsxs9("p", { children: [
4634
+ /* @__PURE__ */ jsxs10("p", { children: [
4132
4635
  "Claim ",
4133
4636
  data.injury.claimNumber || "\u2014",
4134
4637
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
4135
4638
  ] })
4136
4639
  ] }),
4137
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
4640
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
4138
4641
  ] }),
4139
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
4140
- /* @__PURE__ */ jsx9("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
4141
- /* @__PURE__ */ jsx9("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
4642
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
4643
+ /* @__PURE__ */ jsx10("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
4644
+ /* @__PURE__ */ jsx10("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
4142
4645
  ] }),
4143
- tab === "details" ? /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
4144
- 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,
4145
- showSandboxControls ? /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
4146
- /* @__PURE__ */ jsxs9("div", { children: [
4147
- /* @__PURE__ */ jsx9("span", { children: "Sandbox demo controls" }),
4148
- /* @__PURE__ */ jsx9("h3", { children: "Simulate the next payer response" }),
4149
- /* @__PURE__ */ jsx9("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
4646
+ tab === "details" ? /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
4647
+ 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,
4648
+ showSandboxControls ? /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
4649
+ /* @__PURE__ */ jsxs10("div", { children: [
4650
+ /* @__PURE__ */ jsx10("span", { children: "Sandbox demo controls" }),
4651
+ /* @__PURE__ */ jsx10("h3", { children: "Simulate the next payer response" }),
4652
+ /* @__PURE__ */ jsx10("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
4150
4653
  ] }),
4151
- 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: [
4152
- /* @__PURE__ */ jsx9("strong", { children: scenario.label }),
4153
- /* @__PURE__ */ jsx9("span", { children: scenario.detail })
4154
- ] }, 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." })
4654
+ 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: [
4655
+ /* @__PURE__ */ jsx10("strong", { children: scenario.label }),
4656
+ /* @__PURE__ */ jsx10("span", { children: scenario.detail })
4657
+ ] }, 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." })
4155
4658
  ] }) : null,
4156
- /* @__PURE__ */ jsx9(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
4157
- ] }) : /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx9(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
4158
- viewEor || actions.length ? /* @__PURE__ */ jsxs9("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
4159
- 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,
4160
- actions.map((action) => /* @__PURE__ */ jsx9("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
4659
+ /* @__PURE__ */ jsx10(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
4660
+ ] }) : /* @__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 } : {} }) }),
4661
+ viewEor || actions.length ? /* @__PURE__ */ jsxs10("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
4662
+ 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,
4663
+ actions.map((action) => /* @__PURE__ */ jsx10("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
4161
4664
  const next = actionPanel(action);
4162
4665
  if (next) setPanel(next);
4163
4666
  }, children: action.label }, action.id))
4164
4667
  ] }) : null,
4165
- panel === "resubmit" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4166
- /* @__PURE__ */ jsxs9("div", { children: [
4167
- /* @__PURE__ */ jsx9("h3", { children: "Correct and resubmit" }),
4168
- /* @__PURE__ */ jsx9("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
4668
+ panel === "resubmit" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4669
+ /* @__PURE__ */ jsxs10("div", { children: [
4670
+ /* @__PURE__ */ jsx10("h3", { children: "Correct and resubmit" }),
4671
+ /* @__PURE__ */ jsx10("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
4169
4672
  ] }),
4170
- /* @__PURE__ */ jsxs9("label", { children: [
4171
- /* @__PURE__ */ jsx9("span", { children: "Correction note (optional)" }),
4172
- /* @__PURE__ */ jsx9("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
4673
+ /* @__PURE__ */ jsxs10("label", { children: [
4674
+ /* @__PURE__ */ jsx10("span", { children: "Correction note (optional)" }),
4675
+ /* @__PURE__ */ jsx10("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
4173
4676
  ] }),
4174
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4175
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4176
- /* @__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" })
4677
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4678
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4679
+ /* @__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" })
4177
4680
  ] })
4178
4681
  ] }) }) : null,
4179
- panel === "second_review" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4180
- /* @__PURE__ */ jsxs9("div", { children: [
4181
- /* @__PURE__ */ jsx9("h3", { children: "Submit Second Review" }),
4182
- /* @__PURE__ */ jsx9("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
4682
+ panel === "second_review" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4683
+ /* @__PURE__ */ jsxs10("div", { children: [
4684
+ /* @__PURE__ */ jsx10("h3", { children: "Submit Second Review" }),
4685
+ /* @__PURE__ */ jsx10("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
4183
4686
  ] }),
4184
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-fields two", children: [
4185
- /* @__PURE__ */ jsxs9("label", { className: "full", children: [
4186
- /* @__PURE__ */ jsx9("span", { children: "Reason" }),
4187
- /* @__PURE__ */ jsx9("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
4687
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-fields two", children: [
4688
+ /* @__PURE__ */ jsxs10("label", { className: "full", children: [
4689
+ /* @__PURE__ */ jsx10("span", { children: "Reason" }),
4690
+ /* @__PURE__ */ jsx10("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
4188
4691
  ] }),
4189
- /* @__PURE__ */ jsxs9("label", { children: [
4190
- /* @__PURE__ */ jsx9("span", { children: "Payer claim control number" }),
4191
- /* @__PURE__ */ jsx9("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
4692
+ /* @__PURE__ */ jsxs10("label", { children: [
4693
+ /* @__PURE__ */ jsx10("span", { children: "Payer claim control number" }),
4694
+ /* @__PURE__ */ jsx10("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
4192
4695
  ] }),
4193
- /* @__PURE__ */ jsxs9("label", { children: [
4194
- /* @__PURE__ */ jsx9("span", { children: "Disputed amount" }),
4195
- /* @__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 })) })
4696
+ /* @__PURE__ */ jsxs10("label", { children: [
4697
+ /* @__PURE__ */ jsx10("span", { children: "Disputed amount" }),
4698
+ /* @__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 })) })
4196
4699
  ] }),
4197
- /* @__PURE__ */ jsxs9("label", { children: [
4198
- /* @__PURE__ */ jsx9("span", { children: "Send via" }),
4199
- /* @__PURE__ */ jsxs9("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
4200
- /* @__PURE__ */ jsx9("option", { value: "ebill", children: "E-bill" }),
4201
- /* @__PURE__ */ jsx9("option", { value: "fax", children: "Fax" }),
4202
- /* @__PURE__ */ jsx9("option", { value: "mail", children: "Mail" }),
4203
- /* @__PURE__ */ jsx9("option", { value: "email", children: "Email" })
4700
+ /* @__PURE__ */ jsxs10("label", { children: [
4701
+ /* @__PURE__ */ jsx10("span", { children: "Send via" }),
4702
+ /* @__PURE__ */ jsxs10("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
4703
+ /* @__PURE__ */ jsx10("option", { value: "ebill", children: "E-bill" }),
4704
+ /* @__PURE__ */ jsx10("option", { value: "fax", children: "Fax" }),
4705
+ /* @__PURE__ */ jsx10("option", { value: "mail", children: "Mail" }),
4706
+ /* @__PURE__ */ jsx10("option", { value: "email", children: "Email" })
4204
4707
  ] })
4205
4708
  ] })
4206
4709
  ] }),
4207
- /* @__PURE__ */ jsxs9("fieldset", { className: "mb-lifecycle-packet", children: [
4208
- /* @__PURE__ */ jsx9("legend", { children: "Supporting packet" }),
4209
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs9("label", { children: [
4210
- /* @__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) })) }),
4211
- /* @__PURE__ */ jsxs9("span", { children: [
4212
- /* @__PURE__ */ jsx9("strong", { children: attachment.filename }),
4213
- /* @__PURE__ */ jsx9("small", { children: attachment.description || attachment.documentType })
4710
+ /* @__PURE__ */ jsxs10("fieldset", { className: "mb-lifecycle-packet", children: [
4711
+ /* @__PURE__ */ jsx10("legend", { children: "Supporting packet" }),
4712
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs10("label", { children: [
4713
+ /* @__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) })) }),
4714
+ /* @__PURE__ */ jsxs10("span", { children: [
4715
+ /* @__PURE__ */ jsx10("strong", { children: attachment.filename }),
4716
+ /* @__PURE__ */ jsx10("small", { children: attachment.description || attachment.documentType })
4214
4717
  ] }),
4215
- /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
4718
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
4216
4719
  ] }, attachment.id))
4217
4720
  ] }),
4218
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4219
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4220
- /* @__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" })
4721
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4722
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4723
+ /* @__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" })
4221
4724
  ] })
4222
4725
  ] }) }) : null,
4223
- panel === "payment" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4224
- /* @__PURE__ */ jsxs9("div", { children: [
4225
- /* @__PURE__ */ jsx9("h3", { children: "Post payment" }),
4226
- /* @__PURE__ */ jsx9("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
4726
+ panel === "payment" ? /* @__PURE__ */ jsx10(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs10("section", { className: "mb-lifecycle-panel", children: [
4727
+ /* @__PURE__ */ jsxs10("div", { children: [
4728
+ /* @__PURE__ */ jsx10("h3", { children: "Post payment" }),
4729
+ /* @__PURE__ */ jsx10("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
4227
4730
  ] }),
4228
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-fields two", children: [
4229
- /* @__PURE__ */ jsxs9("label", { children: [
4230
- /* @__PURE__ */ jsx9("span", { children: "Amount applied to bill" }),
4231
- /* @__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) })) })
4731
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-fields two", children: [
4732
+ /* @__PURE__ */ jsxs10("label", { children: [
4733
+ /* @__PURE__ */ jsx10("span", { children: "Amount applied to bill" }),
4734
+ /* @__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) })) })
4232
4735
  ] }),
4233
- /* @__PURE__ */ jsxs9("label", { children: [
4234
- /* @__PURE__ */ jsx9("span", { children: "Penalty" }),
4235
- /* @__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) })) })
4736
+ /* @__PURE__ */ jsxs10("label", { children: [
4737
+ /* @__PURE__ */ jsx10("span", { children: "Penalty" }),
4738
+ /* @__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) })) })
4236
4739
  ] }),
4237
- /* @__PURE__ */ jsxs9("label", { children: [
4238
- /* @__PURE__ */ jsx9("span", { children: "Interest" }),
4239
- /* @__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) })) })
4740
+ /* @__PURE__ */ jsxs10("label", { children: [
4741
+ /* @__PURE__ */ jsx10("span", { children: "Interest" }),
4742
+ /* @__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) })) })
4240
4743
  ] }),
4241
- /* @__PURE__ */ jsxs9("label", { children: [
4242
- /* @__PURE__ */ jsx9("span", { children: "Method" }),
4243
- /* @__PURE__ */ jsxs9("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
4244
- /* @__PURE__ */ jsx9("option", { value: "check", children: "Check" }),
4245
- /* @__PURE__ */ jsx9("option", { value: "eft", children: "EFT" })
4744
+ /* @__PURE__ */ jsxs10("label", { children: [
4745
+ /* @__PURE__ */ jsx10("span", { children: "Method" }),
4746
+ /* @__PURE__ */ jsxs10("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
4747
+ /* @__PURE__ */ jsx10("option", { value: "check", children: "Check" }),
4748
+ /* @__PURE__ */ jsx10("option", { value: "eft", children: "EFT" })
4246
4749
  ] })
4247
4750
  ] }),
4248
- /* @__PURE__ */ jsxs9("label", { children: [
4249
- /* @__PURE__ */ jsx9("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
4250
- /* @__PURE__ */ jsx9("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
4751
+ /* @__PURE__ */ jsxs10("label", { children: [
4752
+ /* @__PURE__ */ jsx10("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
4753
+ /* @__PURE__ */ jsx10("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
4251
4754
  ] }),
4252
- /* @__PURE__ */ jsxs9("label", { children: [
4253
- /* @__PURE__ */ jsx9("span", { children: "Deposit date" }),
4254
- /* @__PURE__ */ jsx9("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
4755
+ /* @__PURE__ */ jsxs10("label", { children: [
4756
+ /* @__PURE__ */ jsx10("span", { children: "Deposit date" }),
4757
+ /* @__PURE__ */ jsx10("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
4255
4758
  ] }),
4256
- /* @__PURE__ */ jsxs9("label", { className: "full", children: [
4257
- /* @__PURE__ */ jsx9("span", { children: "Note (optional)" }),
4258
- /* @__PURE__ */ jsx9("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
4759
+ /* @__PURE__ */ jsxs10("label", { className: "full", children: [
4760
+ /* @__PURE__ */ jsx10("span", { children: "Note (optional)" }),
4761
+ /* @__PURE__ */ jsx10("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
4259
4762
  ] })
4260
4763
  ] }),
4261
- /* @__PURE__ */ jsxs9("div", { className: "mb-payment-total", children: [
4262
- /* @__PURE__ */ jsx9("span", { children: "Total received" }),
4263
- /* @__PURE__ */ jsx9("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
4764
+ /* @__PURE__ */ jsxs10("div", { className: "mb-payment-total", children: [
4765
+ /* @__PURE__ */ jsx10("span", { children: "Total received" }),
4766
+ /* @__PURE__ */ jsx10("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
4264
4767
  ] }),
4265
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4266
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4267
- /* @__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" })
4768
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4769
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4770
+ /* @__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" })
4268
4771
  ] })
4269
4772
  ] }) }) : null,
4270
- 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: [
4271
- /* @__PURE__ */ jsxs9("div", { children: [
4272
- /* @__PURE__ */ jsx9("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
4273
- /* @__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." })
4773
+ 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: [
4774
+ /* @__PURE__ */ jsxs10("div", { children: [
4775
+ /* @__PURE__ */ jsx10("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
4776
+ /* @__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." })
4274
4777
  ] }),
4275
- /* @__PURE__ */ jsxs9("label", { children: [
4276
- /* @__PURE__ */ jsx9("span", { children: "Reason" }),
4277
- /* @__PURE__ */ jsx9("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
4778
+ /* @__PURE__ */ jsxs10("label", { children: [
4779
+ /* @__PURE__ */ jsx10("span", { children: "Reason" }),
4780
+ /* @__PURE__ */ jsx10("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
4278
4781
  ] }),
4279
- /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4280
- /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4281
- /* @__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" })
4782
+ /* @__PURE__ */ jsxs10("div", { className: "mb-lifecycle-panel-actions", children: [
4783
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4784
+ /* @__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" })
4282
4785
  ] })
4283
4786
  ] }) }) : null,
4284
- notice ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
4285
- lifecycle.error ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
4787
+ notice ? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
4788
+ lifecycle.error ? /* @__PURE__ */ jsx10("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
4286
4789
  ] });
4287
4790
  }
4288
4791
  var CONNECTED_LIFECYCLE_STYLES = `
@@ -4296,7 +4799,7 @@ var CONNECTED_LIFECYCLE_STYLES = `
4296
4799
  function widget(tagName, props) {
4297
4800
  const ref = useRef6(null);
4298
4801
  const { onMindBill, onMindBillError } = props;
4299
- useEffect7(() => {
4802
+ useEffect8(() => {
4300
4803
  const element = ref.current;
4301
4804
  if (!element) return;
4302
4805
  const handleEvent = (event) => onMindBill?.(event);
@@ -4341,6 +4844,7 @@ export {
4341
4844
  BillActivityTimeline,
4342
4845
  BillAgingSummary,
4343
4846
  BillExplanationOfReview,
4847
+ BillHistoryTable,
4344
4848
  BillLifecycleActions,
4345
4849
  BillLifecycleProgress,
4346
4850
  BillList,
@@ -4374,6 +4878,7 @@ export {
4374
4878
  MindBillBillTimeline,
4375
4879
  OrganizationOnboarding,
4376
4880
  PSYCH_QME_DEFAULT_DIAGNOSIS,
4881
+ SendRouteDialog,
4377
4882
  applyBillSubmissionEvaluationDiagnoses,
4378
4883
  applyBillSubmissionEvaluationModifiers,
4379
4884
  billActivityEventLabel,
@@ -4393,7 +4898,9 @@ export {
4393
4898
  ensureTrailingBillSubmissionLine,
4394
4899
  ensureTrailingProcedureLine,
4395
4900
  exactClaimsAdministratorMatch,
4901
+ extractSendRouteEmail,
4396
4902
  formatBillSubmissionDate,
4903
+ formatSendRouteFax,
4397
4904
  mindBillAppearanceStyle,
4398
4905
  mindBillThemePresets,
4399
4906
  normalizeClaimsAdministratorName,