@mindbill/react 0.48.1 → 0.50.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
@@ -348,7 +348,7 @@ function organizationProfileOptions(profile) {
348
348
 
349
349
  // src/index.tsx
350
350
  import "@mindbill/embed";
351
- import { createElement, useEffect as useEffect13, useRef as useRef9 } from "react";
351
+ import { createElement, useEffect as useEffect15, useRef as useRef10 } from "react";
352
352
 
353
353
  // src/native-bill-review.tsx
354
354
  import { sanitizeBillReviewSaveInput } from "@mindbill/browser";
@@ -4677,7 +4677,7 @@ function ReportBillStatusDialog({
4677
4677
  }
4678
4678
 
4679
4679
  // src/organization-onboarding.tsx
4680
- import { useCallback as useCallback2, useEffect as useEffect8, useId as useId2, useMemo as useMemo6, useRef as useRef4, useState as useState9 } from "react";
4680
+ import { useCallback as useCallback2, useEffect as useEffect8, useId as useId2, useMemo as useMemo6, useRef as useRef4, useState as useState10 } from "react";
4681
4681
  import {
4682
4682
  createOrganizationClient
4683
4683
  } from "@mindbill/browser";
@@ -4711,8 +4711,103 @@ function TaxIdInput({ label, value, onChange, disabled }) {
4711
4711
  ] });
4712
4712
  }
4713
4713
 
4714
+ // src/w9-upload.tsx
4715
+ import { useState as useState9 } from "react";
4716
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4717
+ function validateW9File(file, maxSizeBytes = 20 * 1024 * 1024) {
4718
+ if (!file.name.toLowerCase().endsWith(".pdf") || file.type && file.type !== "application/pdf") return "Choose a PDF file for the W-9.";
4719
+ if (file.size === 0) return "The selected PDF is empty.";
4720
+ if (file.size > maxSizeBytes) return `Choose a PDF smaller than ${Math.round(maxSizeBytes / 1024 / 1024)} MB.`;
4721
+ return null;
4722
+ }
4723
+ var extractionLabels = {
4724
+ idle: "",
4725
+ queued: "W-9 saved. Tax ID and address extraction is queued.",
4726
+ processing: "Reading the tax ID and remittance address\u2026",
4727
+ complete: "Extraction complete. Review the tax ID and remittance address before saving your billing settings.",
4728
+ not_found: "The tax ID or address could not be read. Enter the missing billing details manually.",
4729
+ failed: "Extraction failed. Your W-9 is still saved; enter the billing details manually or retry."
4730
+ };
4731
+ function W9Upload({ document: document2, extractionStatus = "idle", onUpload, onView, onRetryExtraction, maxSizeBytes = 20 * 1024 * 1024, disabled = false, appearance, className = "", style }) {
4732
+ const [file, setFile] = useState9(null);
4733
+ const [busy, setBusy] = useState9(false);
4734
+ const [error, setError] = useState9(null);
4735
+ const [saved, setSaved] = useState9(false);
4736
+ const choose = (next) => {
4737
+ if (busy || disabled) return;
4738
+ const failure = next ? validateW9File(next, maxSizeBytes) : null;
4739
+ setError(failure);
4740
+ setSaved(false);
4741
+ setFile(failure ? null : next);
4742
+ };
4743
+ const upload = async () => {
4744
+ if (!file || busy || disabled) return;
4745
+ setBusy(true);
4746
+ setError(null);
4747
+ setSaved(false);
4748
+ try {
4749
+ await onUpload(file);
4750
+ setFile(null);
4751
+ setSaved(true);
4752
+ } catch {
4753
+ setError("The W-9 could not be uploaded. Please try again.");
4754
+ } finally {
4755
+ setBusy(false);
4756
+ }
4757
+ };
4758
+ const retry = async () => {
4759
+ setBusy(true);
4760
+ setError(null);
4761
+ try {
4762
+ await onRetryExtraction?.();
4763
+ } catch {
4764
+ setError("Extraction could not be restarted. Please try again.");
4765
+ } finally {
4766
+ setBusy(false);
4767
+ }
4768
+ };
4769
+ return /* @__PURE__ */ jsxs13("section", { className: `mbw9 ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-label": "Practice W-9", children: [
4770
+ /* @__PURE__ */ jsx13("style", { children: `.mbw9{font:inherit;color:var(--mb-text)}.mbw9 *{box-sizing:border-box}.mbw9 p{margin:0;color:var(--mb-muted);font-size:13px;line-height:1.6}.mbw9-current,.mbw9-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.mbw9-current{padding:12px 14px;background:var(--mb-soft);border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);margin-bottom:12px}.mbw9-current strong{overflow-wrap:anywhere}.mbw9 button{font:inherit;color:var(--mb-text);background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:9px 14px;cursor:pointer}.mbw9 button:disabled{opacity:.55;cursor:default}.mbw9-drop{display:grid;gap:8px;padding:20px;border:1px dashed var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface)}.mbw9-drop input{font:inherit;max-width:100%;color:var(--mb-muted)}.mbw9-actions{margin-top:12px}.mbw9 button.mbw9-primary{background:var(--mb-accent);color:var(--mb-accent-contrast);border-color:var(--mb-accent)}.mbw9 [role=alert]{color:var(--mb-danger);margin-top:12px}.mbw9 button:focus-visible,.mbw9 input:focus-visible{outline:2px solid var(--mb-accent);outline-offset:3px}.mbw9{min-width:0}.mbw9-drop{grid-template-columns:minmax(0,1fr);min-width:0;white-space:normal}.mbw9-drop>*{min-width:0;overflow-wrap:anywhere}.mbw9-drop input{width:100%}.mbw9-current>div{min-width:0;max-width:100%}` }),
4771
+ document2 ? /* @__PURE__ */ jsxs13("div", { className: "mbw9-current", children: [
4772
+ /* @__PURE__ */ jsxs13("div", { children: [
4773
+ /* @__PURE__ */ jsx13("strong", { children: document2.filename }),
4774
+ document2.addedAt ? /* @__PURE__ */ jsxs13("p", { children: [
4775
+ "Added ",
4776
+ document2.addedAt
4777
+ ] }) : null
4778
+ ] }),
4779
+ onView ? /* @__PURE__ */ jsx13("button", { type: "button", disabled: busy || disabled, onClick: onView, children: "View W-9" }) : null
4780
+ ] }) : null,
4781
+ /* @__PURE__ */ jsxs13("label", { className: "mbw9-drop", onDragOver: (event) => event.preventDefault(), onDrop: (event) => {
4782
+ event.preventDefault();
4783
+ choose(event.dataTransfer.files[0] ?? null);
4784
+ }, children: [
4785
+ /* @__PURE__ */ jsx13("strong", { children: document2 ? "Replace practice W-9" : "Upload practice W-9" }),
4786
+ /* @__PURE__ */ jsxs13("p", { children: [
4787
+ "Choose or drop a PDF, up to ",
4788
+ Math.round(maxSizeBytes / 1024 / 1024),
4789
+ " MB. Your server securely stores the document for billing."
4790
+ ] }),
4791
+ /* @__PURE__ */ jsx13("input", { "aria-label": "W-9 PDF", type: "file", accept: "application/pdf,.pdf", disabled: busy || disabled, onChange: (event) => {
4792
+ choose(event.target.files?.[0] ?? null);
4793
+ event.target.value = "";
4794
+ } }),
4795
+ file ? /* @__PURE__ */ jsx13("p", { children: file.name }) : null
4796
+ ] }),
4797
+ /* @__PURE__ */ jsxs13("div", { className: "mbw9-actions", children: [
4798
+ /* @__PURE__ */ jsx13("p", { role: "status", children: busy ? "Working\u2026" : extractionLabels[extractionStatus] || (saved ? "W-9 saved." : "") }),
4799
+ /* @__PURE__ */ jsxs13("div", { children: [
4800
+ onRetryExtraction && (extractionStatus === "failed" || extractionStatus === "not_found") ? /* @__PURE__ */ jsx13("button", { type: "button", disabled: busy || disabled, onClick: () => void retry(), children: "Retry extraction" }) : null,
4801
+ " ",
4802
+ /* @__PURE__ */ jsx13("button", { className: "mbw9-primary", type: "button", disabled: !file || busy || disabled, onClick: () => void upload(), children: busy ? "Please wait\u2026" : "Upload W-9" })
4803
+ ] })
4804
+ ] }),
4805
+ error ? /* @__PURE__ */ jsx13("p", { role: "alert", children: error }) : null
4806
+ ] });
4807
+ }
4808
+
4714
4809
  // src/organization-onboarding.tsx
4715
- import { Fragment as Fragment10, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4810
+ import { Fragment as Fragment10, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
4716
4811
  var STEPS = [
4717
4812
  { id: "practice", label: "Practice & billing" },
4718
4813
  { id: "rendering", label: "Rendering providers" },
@@ -4786,18 +4881,17 @@ function OrganizationOnboarding({
4786
4881
  }),
4787
4882
  [sessionEndpoint, getSession, apiBaseUrl]
4788
4883
  );
4789
- const [profile, setProfile] = useState9(null);
4790
- const [loadError, setLoadError] = useState9(null);
4791
- const [step, setStep] = useState9("practice");
4792
- const [identity, setIdentity] = useState9({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
4793
- const [provider, setProvider] = useState9({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
4794
- const [locations, setLocations] = useState9([blankLocation()]);
4795
- const [rendering, setRendering] = useState9(blankRendering);
4884
+ const [profile, setProfile] = useState10(null);
4885
+ const [loadError, setLoadError] = useState10(null);
4886
+ const [step, setStep] = useState10("practice");
4887
+ const [identity, setIdentity] = useState10({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
4888
+ const [provider, setProvider] = useState10({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
4889
+ const [locations, setLocations] = useState10([blankLocation()]);
4890
+ const [rendering, setRendering] = useState10(blankRendering);
4796
4891
  const primaryGroup = useId2();
4797
- const [w9File, setW9File] = useState9(null);
4798
- const [saving, setSaving] = useState9(false);
4799
- const [error, setError] = useState9(null);
4800
- const [savedStep, setSavedStep] = useState9({});
4892
+ const [saving, setSaving] = useState10(false);
4893
+ const [error, setError] = useState10(null);
4894
+ const [savedStep, setSavedStep] = useState10({});
4801
4895
  const completedFired = useRef4(false);
4802
4896
  const adoptProfile = useCallback2((next) => {
4803
4897
  setProfile(next);
@@ -4865,39 +4959,50 @@ function OrganizationOnboarding({
4865
4959
  });
4866
4960
  }, "practice");
4867
4961
  const saveLocations = () => run(() => client.saveLocations(locations.filter((item) => item.name.trim() || item.street.trim())), "locations");
4868
- const saveW9 = () => run(async () => {
4869
- if (!w9File) throw new Error("Choose the practice W-9 PDF first.");
4870
- return client.saveW9({ filename: w9File.name, contentBase64: await fileToBase64(w9File) });
4871
- }, "w9");
4872
- const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs13("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
4962
+ const saveW9 = async (file) => {
4963
+ setSaving(true);
4964
+ try {
4965
+ const next = await client.saveW9({ filename: file.name, contentBase64: await fileToBase64(file) });
4966
+ adoptProfile(next);
4967
+ setSavedStep((current) => ({ ...current, w9: true }));
4968
+ onSaved?.(next);
4969
+ if (variant === "onboarding") setStep("review");
4970
+ } catch (error2) {
4971
+ onError?.(error2 instanceof Error ? error2 : new Error("The W-9 could not be saved."));
4972
+ throw error2;
4973
+ } finally {
4974
+ setSaving(false);
4975
+ }
4976
+ };
4977
+ const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs14("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
4873
4978
  label,
4874
- /* @__PURE__ */ jsx13("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
4979
+ /* @__PURE__ */ jsx14("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
4875
4980
  ] });
4876
4981
  const setLocation = (index, patch) => setLocations((current) => current.map((item, itemIndex) => {
4877
4982
  if (itemIndex !== index) return patch.isPrimary ? { ...item, isPrimary: false } : item;
4878
4983
  return { ...item, ...patch };
4879
4984
  }));
4880
- const practiceSection = /* @__PURE__ */ jsxs13("div", { children: [
4881
- /* @__PURE__ */ jsx13("p", { className: "mbob-status", children: "Choose EIN for a business or SSN for an individual. Saved SSNs are encrypted and shown only by their last four digits." }),
4882
- /* @__PURE__ */ jsxs13("div", { className: "mbob-grid", children: [
4985
+ const practiceSection = /* @__PURE__ */ jsxs14("div", { children: [
4986
+ /* @__PURE__ */ jsx14("p", { className: "mbob-status", children: "Choose EIN for a business or SSN for an individual. Saved SSNs are encrypted and shown only by their last four digits." }),
4987
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-grid", children: [
4883
4988
  field("Practice name", identity.name, (name) => setIdentity((c) => ({ ...c, name }))),
4884
4989
  field("Legal name", identity.legalName, (legalName) => setIdentity((c) => ({ ...c, legalName }))),
4885
- /* @__PURE__ */ jsx13(TaxIdInput, { label: "Practice tax ID", value: identity, disabled: saving, onChange: (patch) => setIdentity((c) => ({ ...c, ...patch })) }),
4990
+ /* @__PURE__ */ jsx14(TaxIdInput, { label: "Practice tax ID", value: identity, disabled: saving, onChange: (patch) => setIdentity((c) => ({ ...c, ...patch })) }),
4886
4991
  field("Group NPI", identity.npi, (npi) => setIdentity((c) => ({ ...c, npi }))),
4887
4992
  field("Phone", identity.phone, (phone) => setIdentity((c) => ({ ...c, phone }))),
4888
4993
  field("Email", identity.email, (email) => setIdentity((c) => ({ ...c, email })))
4889
4994
  ] }),
4890
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
4891
- /* @__PURE__ */ jsxs13("label", { className: "mbob-field", children: [
4995
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
4996
+ /* @__PURE__ */ jsxs14("label", { className: "mbob-field", children: [
4892
4997
  "Saved billing provider",
4893
- /* @__PURE__ */ jsxs13("select", { disabled: saving, value: provider.id ?? "", onChange: (event) => setProvider({ ...profile?.billingProviders.find((item) => item.id === event.target.value) ?? { name: "", taxId: "", npi: "" } }), children: [
4894
- /* @__PURE__ */ jsx13("option", { value: "", children: "Add a billing provider" }),
4895
- profile?.billingProviders.map((item) => /* @__PURE__ */ jsx13("option", { value: item.id, children: item.name }, item.id))
4998
+ /* @__PURE__ */ jsxs14("select", { disabled: saving, value: provider.id ?? "", onChange: (event) => setProvider({ ...profile?.billingProviders.find((item) => item.id === event.target.value) ?? { name: "", taxId: "", npi: "" } }), children: [
4999
+ /* @__PURE__ */ jsx14("option", { value: "", children: "Add a billing provider" }),
5000
+ profile?.billingProviders.map((item) => /* @__PURE__ */ jsx14("option", { value: item.id, children: item.name }, item.id))
4896
5001
  ] })
4897
5002
  ] }),
4898
- /* @__PURE__ */ jsxs13("div", { className: "mbob-grid", children: [
5003
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-grid", children: [
4899
5004
  field("Billing provider name", provider.name, (name) => setProvider((c) => ({ ...c, name }))),
4900
- /* @__PURE__ */ jsx13(TaxIdInput, { label: "Billing tax ID", value: provider, disabled: saving, onChange: (patch) => setProvider((c) => ({ ...c, ...patch })) }),
5005
+ /* @__PURE__ */ jsx14(TaxIdInput, { label: "Billing tax ID", value: provider, disabled: saving, onChange: (patch) => setProvider((c) => ({ ...c, ...patch })) }),
4901
5006
  field("Billing NPI", provider.npi, (npi) => setProvider((c) => ({ ...c, npi }))),
4902
5007
  field("Billing phone", provider.phone ?? "", (phone) => setProvider((c) => ({ ...c, phone }))),
4903
5008
  field("Street", provider.billingStreet ?? "", (billingStreet) => setProvider((c) => ({ ...c, billingStreet })), true),
@@ -4905,119 +5010,102 @@ function OrganizationOnboarding({
4905
5010
  field("State", provider.billingState ?? "", (billingState) => setProvider((c) => ({ ...c, billingState: billingState.toUpperCase().slice(0, 2) }))),
4906
5011
  field("ZIP", provider.billingZip ?? "", (billingZip) => setProvider((c) => ({ ...c, billingZip })))
4907
5012
  ] }),
4908
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4909
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
4910
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
5013
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-actions", children: [
5014
+ /* @__PURE__ */ jsx14("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
5015
+ /* @__PURE__ */ jsx14("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
4911
5016
  ] })
4912
5017
  ] });
4913
- const renderingSection = /* @__PURE__ */ jsxs13("div", { children: [
4914
- /* @__PURE__ */ jsxs13("label", { className: "mbob-field", children: [
5018
+ const renderingSection = /* @__PURE__ */ jsxs14("div", { children: [
5019
+ /* @__PURE__ */ jsxs14("label", { className: "mbob-field", children: [
4915
5020
  "Saved rendering provider",
4916
- /* @__PURE__ */ jsxs13("select", { disabled: saving, value: rendering.id ?? "", onChange: (event) => setRendering({ ...profile?.renderingProviders?.find((item) => item.id === event.target.value) ?? blankRendering() }), children: [
4917
- /* @__PURE__ */ jsx13("option", { value: "", children: "Add a rendering provider" }),
4918
- profile?.renderingProviders?.map((item) => /* @__PURE__ */ jsxs13("option", { value: item.id, children: [
5021
+ /* @__PURE__ */ jsxs14("select", { disabled: saving, value: rendering.id ?? "", onChange: (event) => setRendering({ ...profile?.renderingProviders?.find((item) => item.id === event.target.value) ?? blankRendering() }), children: [
5022
+ /* @__PURE__ */ jsx14("option", { value: "", children: "Add a rendering provider" }),
5023
+ profile?.renderingProviders?.map((item) => /* @__PURE__ */ jsxs14("option", { value: item.id, children: [
4919
5024
  item.name,
4920
5025
  item.active === false ? " (inactive)" : ""
4921
5026
  ] }, item.id))
4922
5027
  ] })
4923
5028
  ] }),
4924
- /* @__PURE__ */ jsxs13("div", { className: "mbob-grid", style: { marginTop: 16 }, children: [
5029
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-grid", style: { marginTop: 16 }, children: [
4925
5030
  field("Rendering provider name", rendering.name, (name) => setRendering((c) => ({ ...c, name }))),
4926
5031
  field("Rendering NPI", rendering.npi, (npi) => setRendering((c) => ({ ...c, npi }))),
4927
5032
  field("Taxonomy", rendering.taxonomy ?? "", (taxonomy) => setRendering((c) => ({ ...c, taxonomy }))),
4928
5033
  field("Specialty", rendering.specialty ?? "", (specialty) => setRendering((c) => ({ ...c, specialty }))),
4929
5034
  field("License number", rendering.licenseNumber ?? "", (licenseNumber) => setRendering((c) => ({ ...c, licenseNumber }))),
4930
5035
  field("License state", rendering.licenseState ?? "", (licenseState) => setRendering((c) => ({ ...c, licenseState: licenseState.toUpperCase().slice(0, 2) }))),
4931
- /* @__PURE__ */ jsxs13("label", { children: [
4932
- /* @__PURE__ */ jsx13("input", { disabled: saving, type: "checkbox", checked: rendering.active !== false, onChange: (event) => setRendering((c) => ({ ...c, active: event.target.checked })) }),
5036
+ /* @__PURE__ */ jsxs14("label", { children: [
5037
+ /* @__PURE__ */ jsx14("input", { disabled: saving, type: "checkbox", checked: rendering.active !== false, onChange: (event) => setRendering((c) => ({ ...c, active: event.target.checked })) }),
4933
5038
  " Available for new bills"
4934
5039
  ] })
4935
5040
  ] }),
4936
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4937
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["rendering"] ? "Saved to MindBill." : "Saved profiles do not change previously submitted bills." }),
4938
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving || !rendering.name.trim(), onClick: () => run(() => client.saveBillingProfile({ renderingProviders: [rendering] }), "rendering"), children: saving ? "Saving\u2026" : "Save rendering provider" })
5041
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-actions", children: [
5042
+ /* @__PURE__ */ jsx14("span", { className: "mbob-status", children: savedStep["rendering"] ? "Saved to MindBill." : "Saved profiles do not change previously submitted bills." }),
5043
+ /* @__PURE__ */ jsx14("button", { className: "mbob-save", type: "button", disabled: saving || !rendering.name.trim(), onClick: () => run(() => client.saveBillingProfile({ renderingProviders: [rendering] }), "rendering"), children: saving ? "Saving\u2026" : "Save rendering provider" })
4939
5044
  ] })
4940
5045
  ] });
4941
- const locationsSection = /* @__PURE__ */ jsxs13("div", { children: [
4942
- locations.map((location, index) => /* @__PURE__ */ jsxs13("div", { className: "mbob-loc", children: [
5046
+ const locationsSection = /* @__PURE__ */ jsxs14("div", { children: [
5047
+ locations.map((location, index) => /* @__PURE__ */ jsxs14("div", { className: "mbob-loc", children: [
4943
5048
  field("Name", location.name ?? "", (name) => setLocation(index, { name })),
4944
5049
  field("Street", location.street, (street) => setLocation(index, { street })),
4945
5050
  field("City", location.city, (city) => setLocation(index, { city })),
4946
5051
  field("State", location.state, (state) => setLocation(index, { state: state.toUpperCase().slice(0, 2) })),
4947
5052
  field("ZIP", location.zip, (zip) => setLocation(index, { zip })),
4948
5053
  field("Place of service code", location.posCode ?? "", (posCode) => setLocation(index, { posCode }), false, "11"),
4949
- /* @__PURE__ */ jsxs13("label", { className: "mbob-primary", children: [
4950
- /* @__PURE__ */ jsx13("input", { disabled: saving || location.active === false, type: "radio", name: primaryGroup, checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
5054
+ /* @__PURE__ */ jsxs14("label", { className: "mbob-primary", children: [
5055
+ /* @__PURE__ */ jsx14("input", { disabled: saving || location.active === false, type: "radio", name: primaryGroup, checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
4951
5056
  " Primary"
4952
5057
  ] }),
4953
- location.id ? /* @__PURE__ */ jsx13("button", { className: "mbob-secondary", disabled: saving, type: "button", onClick: () => setLocation(index, { active: location.active === false, ...location.active !== false ? { isPrimary: false } : {} }), children: location.active === false ? "Restore" : "Archive" }) : /* @__PURE__ */ jsx13("button", { className: "mbob-remove", disabled: saving, type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
5058
+ location.id ? /* @__PURE__ */ jsx14("button", { className: "mbob-secondary", disabled: saving, type: "button", onClick: () => setLocation(index, { active: location.active === false, ...location.active !== false ? { isPrimary: false } : {} }), children: location.active === false ? "Restore" : "Archive" }) : /* @__PURE__ */ jsx14("button", { className: "mbob-remove", disabled: saving, type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
4954
5059
  ] }, location.id ?? index)),
4955
- /* @__PURE__ */ jsx13("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
4956
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4957
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
4958
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
5060
+ /* @__PURE__ */ jsx14("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
5061
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-actions", children: [
5062
+ /* @__PURE__ */ jsx14("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
5063
+ /* @__PURE__ */ jsx14("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
4959
5064
  ] })
4960
5065
  ] });
4961
- const w9Section = /* @__PURE__ */ jsxs13("div", { children: [
4962
- profile?.w9 ? /* @__PURE__ */ jsxs13("div", { className: "mbob-w9-current", children: [
4963
- /* @__PURE__ */ jsxs13("div", { children: [
4964
- /* @__PURE__ */ jsx13("strong", { children: profile.w9.filename }),
4965
- /* @__PURE__ */ jsxs13("span", { children: [
4966
- " \xB7 added ",
4967
- profile.w9.addDate
4968
- ] })
4969
- ] }),
4970
- /* @__PURE__ */ jsx13("span", { children: "Rides on every bill automatically" })
4971
- ] }) : null,
4972
- /* @__PURE__ */ jsxs13("label", { className: "mbob-drop", children: [
4973
- /* @__PURE__ */ jsx13("input", { type: "file", accept: "application/pdf,.pdf", onChange: (event) => setW9File(event.target.files?.[0] ?? null) }),
4974
- /* @__PURE__ */ jsx13("strong", { children: w9File ? w9File.name : profile?.w9 ? "Replace the W-9 PDF" : "Drop the practice W-9 PDF here, or click to choose" }),
4975
- /* @__PURE__ */ jsx13("span", { children: "The W-9 is auto-attached to every submission." })
4976
- ] }),
4977
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4978
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["w9"] ? "Saved to MindBill." : "" }),
4979
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving || !w9File, onClick: saveW9, children: saving ? "Uploading\u2026" : "Save W-9" })
4980
- ] })
5066
+ const w9Section = /* @__PURE__ */ jsxs14("div", { children: [
5067
+ /* @__PURE__ */ jsx14("p", { className: "mbob-status", children: "The saved W-9 is auto-attached to every submission." }),
5068
+ /* @__PURE__ */ jsx14(W9Upload, { ...appearance ? { appearance } : {}, ...profile?.w9 ? { document: { filename: profile.w9.filename, addedAt: profile.w9.addDate } } : {}, onUpload: saveW9, disabled: saving })
4981
5069
  ] });
4982
- const reviewSection = /* @__PURE__ */ jsxs13("div", { className: "mbob-check", children: [
4983
- (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs13("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
4984
- /* @__PURE__ */ jsx13("i", { children: item.complete ? "\u2713" : "\u2022" }),
4985
- /* @__PURE__ */ jsx13("span", { children: item.label })
5070
+ const reviewSection = /* @__PURE__ */ jsxs14("div", { className: "mbob-check", children: [
5071
+ (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs14("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
5072
+ /* @__PURE__ */ jsx14("i", { children: item.complete ? "\u2713" : "\u2022" }),
5073
+ /* @__PURE__ */ jsx14("span", { children: item.label })
4986
5074
  ] }, item.id)),
4987
- profile?.onboarding.complete ? /* @__PURE__ */ jsx13("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx13("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
5075
+ profile?.onboarding.complete ? /* @__PURE__ */ jsx14("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx14("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
4988
5076
  ] });
4989
5077
  const sections = { practice: practiceSection, rendering: renderingSection, locations: locationsSection, w9: w9Section, review: reviewSection };
4990
- return /* @__PURE__ */ jsxs13("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
4991
- /* @__PURE__ */ jsx13("style", { children: css9 }),
4992
- /* @__PURE__ */ jsxs13("div", { className: "mbob-card", children: [
4993
- /* @__PURE__ */ jsx13("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs13("div", { children: [
4994
- /* @__PURE__ */ jsx13("h2", { children: heading }),
4995
- /* @__PURE__ */ jsx13("p", { className: "mbob-copy", children: description })
5078
+ return /* @__PURE__ */ jsxs14("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
5079
+ /* @__PURE__ */ jsx14("style", { children: css9 }),
5080
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-card", children: [
5081
+ /* @__PURE__ */ jsx14("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs14("div", { children: [
5082
+ /* @__PURE__ */ jsx14("h2", { children: heading }),
5083
+ /* @__PURE__ */ jsx14("p", { className: "mbob-copy", children: description })
4996
5084
  ] }) }),
4997
- loadError ? /* @__PURE__ */ jsx13("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
4998
- variant === "onboarding" ? /* @__PURE__ */ jsxs13(Fragment10, { children: [
4999
- /* @__PURE__ */ jsx13("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs13("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
5000
- /* @__PURE__ */ jsx13("i", { children: savedStep[item.id] ? "\u2713" : "" }),
5085
+ loadError ? /* @__PURE__ */ jsx14("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
5086
+ variant === "onboarding" ? /* @__PURE__ */ jsxs14(Fragment10, { children: [
5087
+ /* @__PURE__ */ jsx14("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs14("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
5088
+ /* @__PURE__ */ jsx14("i", { children: savedStep[item.id] ? "\u2713" : "" }),
5001
5089
  item.label
5002
5090
  ] }, item.id)) }),
5003
5091
  sections[step]
5004
- ] }) : /* @__PURE__ */ jsxs13(Fragment10, { children: [
5092
+ ] }) : /* @__PURE__ */ jsxs14(Fragment10, { children: [
5005
5093
  practiceSection,
5006
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Rendering providers" }),
5094
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Rendering providers" }),
5007
5095
  renderingSection,
5008
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Locations" }),
5096
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Locations" }),
5009
5097
  locationsSection,
5010
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Practice W-9" }),
5098
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Practice W-9" }),
5011
5099
  w9Section,
5012
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Checklist" }),
5100
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Checklist" }),
5013
5101
  reviewSection
5014
5102
  ] }),
5015
- error ? /* @__PURE__ */ jsx13("div", { className: "mbob-error", role: "alert", children: error }) : null
5103
+ error ? /* @__PURE__ */ jsx14("div", { className: "mbob-error", role: "alert", children: error }) : null
5016
5104
  ] })
5017
5105
  ] });
5018
5106
  }
5019
5107
  function BillingSettings(props) {
5020
- return /* @__PURE__ */ jsx13(
5108
+ return /* @__PURE__ */ jsx14(
5021
5109
  OrganizationOnboarding,
5022
5110
  {
5023
5111
  heading: "Billing settings",
@@ -5028,21 +5116,497 @@ function BillingSettings(props) {
5028
5116
  );
5029
5117
  }
5030
5118
 
5119
+ // src/payment-review.tsx
5120
+ import { useEffect as useEffect9, useMemo as useMemo7, useState as useState11 } from "react";
5121
+
5122
+ // src/billing-operations-client.ts
5123
+ import {
5124
+ DEFAULT_API_BASE_URL,
5125
+ DEFAULT_SESSION_ENDPOINT
5126
+ } from "@mindbill/browser";
5127
+ async function responseError(response, fallback) {
5128
+ const body = await response.json().catch(() => null);
5129
+ const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
5130
+ return new Error(typeof detail === "string" ? detail : fallback);
5131
+ }
5132
+ function normalizeSession(value) {
5133
+ if (!value || typeof value !== "object") throw new Error("The MindBill session endpoint returned an invalid response.");
5134
+ const candidate = value;
5135
+ const nested = candidate.session ?? candidate.data;
5136
+ const session = nested && typeof nested === "object" ? nested : candidate;
5137
+ if (typeof session.token !== "string" || session.token.length < 8) {
5138
+ throw new Error("The MindBill session endpoint did not return a browser session token.");
5139
+ }
5140
+ return {
5141
+ token: session.token,
5142
+ ...typeof session.expiresAt === "string" ? { expiresAt: session.expiresAt } : {},
5143
+ ...typeof session.apiBaseUrl === "string" ? { apiBaseUrl: session.apiBaseUrl } : {}
5144
+ };
5145
+ }
5146
+ function isFresh(session) {
5147
+ if (!session) return false;
5148
+ if (!session.expiresAt) return true;
5149
+ const expiresAt = Date.parse(session.expiresAt);
5150
+ return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
5151
+ }
5152
+ function queryString(values) {
5153
+ const params = new URLSearchParams();
5154
+ for (const [key, value] of Object.entries(values)) {
5155
+ if (value !== void 0 && value !== "") params.set(key, String(value));
5156
+ }
5157
+ const text = params.toString();
5158
+ return text ? `?${text}` : "";
5159
+ }
5160
+ function createBillingOperationsClient({
5161
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT,
5162
+ getSession,
5163
+ apiBaseUrl = DEFAULT_API_BASE_URL,
5164
+ fetch: fetchOverride
5165
+ } = {}) {
5166
+ const fetcher = fetchOverride ?? globalThis.fetch;
5167
+ if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
5168
+ let session = null;
5169
+ let pendingSession = null;
5170
+ let pendingSessionSignal = null;
5171
+ const mintSession = async (signal, force = false) => {
5172
+ if (!force && isFresh(session)) return session;
5173
+ if (!force && pendingSession && !pendingSessionSignal?.aborted) return pendingSession;
5174
+ const pending = getSession ? getSession({ signal }) : fetcher(sessionEndpoint, {
5175
+ method: "POST",
5176
+ credentials: "same-origin",
5177
+ headers: { "content-type": "application/json" },
5178
+ body: JSON.stringify({}),
5179
+ signal
5180
+ }).then(async (response) => {
5181
+ if (!response.ok) throw await responseError(response, "MindBill browser session could not be created.");
5182
+ return response.json();
5183
+ });
5184
+ const request = Promise.resolve(pending).then(normalizeSession).then((next) => {
5185
+ session = next;
5186
+ return next;
5187
+ }).finally(() => {
5188
+ if (pendingSession === request) {
5189
+ pendingSession = null;
5190
+ pendingSessionSignal = null;
5191
+ }
5192
+ });
5193
+ pendingSession = request;
5194
+ pendingSessionSignal = signal;
5195
+ return request;
5196
+ };
5197
+ const get = async (path, signal) => {
5198
+ const controller = signal ? null : new AbortController();
5199
+ const requestSignal = signal ?? controller?.signal;
5200
+ if (!requestSignal) throw new Error("An AbortSignal could not be created.");
5201
+ let browserSession = await mintSession(requestSignal);
5202
+ const request = (active) => {
5203
+ const base = (active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
5204
+ return fetcher(`${base}${path}`, {
5205
+ headers: { authorization: `Bearer ${active.token}` },
5206
+ signal: requestSignal
5207
+ });
5208
+ };
5209
+ let response = await request(browserSession);
5210
+ if (response.status === 401) {
5211
+ session = null;
5212
+ browserSession = await mintSession(requestSignal, true);
5213
+ response = await request(browserSession);
5214
+ }
5215
+ if (!response.ok) throw await responseError(response, "MindBill data could not be loaded.");
5216
+ const body = await response.json();
5217
+ return body.data ?? body;
5218
+ };
5219
+ return {
5220
+ clearSession() {
5221
+ session = null;
5222
+ pendingSession = null;
5223
+ pendingSessionSignal = null;
5224
+ },
5225
+ getBills(query = {}, signal) {
5226
+ const { claimsAdministrator, taskType, taskSection: _taskSection, sort, status, ...filters } = query;
5227
+ void _taskSection;
5228
+ const sortKey = sort?.startsWith("balance_") ? "balanceDue" : sort?.startsWith("patient_") ? "patient" : sort ? "submitted" : void 0;
5229
+ return get(`/partner/v2/bill-dashboard${queryString({
5230
+ ...filters,
5231
+ status: status === "submitted" ? "sent" : status,
5232
+ claimsAdminId: claimsAdministrator,
5233
+ taskKind: taskType,
5234
+ sort: sortKey,
5235
+ dir: sort ? sort.endsWith("_asc") ? "asc" : "desc" : void 0
5236
+ })}`, signal);
5237
+ },
5238
+ getBillTasks(claimsAdministrator, signal, renderingProviderId) {
5239
+ return get(
5240
+ `/partner/v2/bill-tasks${queryString({ claimsAdminId: claimsAdministrator, renderingProviderId })}`,
5241
+ signal
5242
+ );
5243
+ },
5244
+ getServiceLineItems(range, signal) {
5245
+ return get(
5246
+ `/partner/v2/reports/service-line-items${queryString(range)}`,
5247
+ signal
5248
+ );
5249
+ },
5250
+ getPaymentReview(query = {}, signal) {
5251
+ return get(`/partner/v2/reports/payments${queryString(query)}`, signal);
5252
+ },
5253
+ getProductivity(range, signal) {
5254
+ return get(`/partner/v2/reports/productivity${queryString(range)}`, signal);
5255
+ }
5256
+ };
5257
+ }
5258
+
5259
+ // src/payment-review.tsx
5260
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
5261
+ var localDate = (date2) => `${date2.getFullYear()}-${String(date2.getMonth() + 1).padStart(2, "0")}-${String(date2.getDate()).padStart(2, "0")}`;
5262
+ function paymentReviewDateRange(range, now = /* @__PURE__ */ new Date()) {
5263
+ if (range === "all") return {};
5264
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate());
5265
+ if (range === "week") start.setDate(start.getDate() - (start.getDay() + 6) % 7);
5266
+ if (range === "month") start.setDate(1);
5267
+ if (range === "year") {
5268
+ start.setMonth(0);
5269
+ start.setDate(1);
5270
+ }
5271
+ return { receivedFrom: localDate(start), receivedTo: localDate(now) };
5272
+ }
5273
+ var money5 = (value) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
5274
+ var dateLabel = (value) => value ? value.slice(0, 10) : "\u2014";
5275
+ var paymentReviewRowKey = (item) => JSON.stringify([item.billId, item.id]);
5276
+ function paymentReviewCsv(items) {
5277
+ const escape = (value) => {
5278
+ let text = value == null ? "" : String(value);
5279
+ if (/^[\s]*[=+@-]/.test(text) || /^[\t\r\n]/.test(text)) text = `'${text}`;
5280
+ return `"${text.replaceAll('"', '""')}"`;
5281
+ };
5282
+ return [["Patient", "Bill", "Claim", "Date of service", "Received", "Posted", "Status", "Method", "Source", "Check / trace", "Amount"], ...items.map((item) => [item.patientName, item.billNumber, item.claimNumber, item.dateOfService, item.receivedDate, item.postedDate, "Received", item.method, item.source, item.checkNumber, item.amount])].map((row) => row.map(escape).join(",")).join("\r\n");
5283
+ }
5284
+ var css10 = `.mbpr{font:14px/1.5 var(--mb-font);color:var(--mb-text);min-width:0}.mbpr *{box-sizing:border-box}.mbpr h2,.mbpr p{margin:0}.mbpr h2{font-size:21px}.mbpr-head,.mbpr-actions,.mbpr-toolbar,.mbpr-pager{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.mbpr-head,.mbpr-pager{justify-content:space-between}.mbpr small,.mbpr-sub{color:var(--mb-muted)}.mbpr small{display:block;font-size:12px}.mbpr-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0}.mbpr-metric,.mbpr-card{background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius)}.mbpr-metric{padding:16px}.mbpr-metric strong{display:block;font-size:24px;line-height:1.4;font-variant-numeric:tabular-nums}.mbpr-card{overflow:hidden}.mbpr-controls{padding:14px;display:grid;gap:12px}.mbpr label{display:grid;gap:4px;font-size:12px}.mbpr input,.mbpr button{font:inherit;color:var(--mb-text);background:var(--mb-input);border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:8px 10px;min-height:38px}.mbpr button{cursor:pointer;white-space:nowrap}.mbpr button:disabled{opacity:.55;cursor:default}.mbpr button.active,.mbpr button.primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbpr button:focus-visible,.mbpr input:focus-visible{outline:2px solid var(--mb-accent);outline-offset:2px}.mbpr-search{flex:1;min-width:210px}.mbpr-scroll{overflow:auto}.mbpr table{width:100%;min-width:900px;border-collapse:collapse}.mbpr th,.mbpr td{padding:11px 13px;text-align:left;border-top:1px solid var(--mb-border)}.mbpr th{background:var(--mb-soft);color:var(--mb-muted);font-size:12px;font-weight:600}.mbpr .mbpr-money{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}.mbpr .mbpr-link{color:var(--mb-accent);border:0;background:none;padding:0;min-height:30px}.mbpr-status{display:inline-block;background:color-mix(in srgb,var(--mb-success) 10%,var(--mb-surface));color:var(--mb-success);border-radius:var(--mb-control-radius);padding:2px 7px;font-size:12px}.mbpr-state{padding:30px;text-align:center;color:var(--mb-muted)}.mbpr-error{color:var(--mb-danger)}.mbpr-pager{padding:12px;border-top:1px solid var(--mb-border);color:var(--mb-muted);font-size:12px}@media(max-width:640px){.mbpr-metrics{gap:8px}.mbpr-metric{padding:10px}.mbpr-metric strong{font-size:20px}.mbpr-head{align-items:flex-start}.mbpr-toolbar label{flex:1}.mbpr-search{min-width:100%}.mbpr input{width:100%;min-width:0}}`;
5285
+ function ConnectedPaymentReview({ initialQuery, onSelectBill, onPostPayment, appearance, className = "", style, ...options }) {
5286
+ const client = useMemo7(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
5287
+ const [query, setQuery] = useState11(() => ({ ...paymentReviewDateRange("month"), page: 1, pageSize: 25, ...initialQuery }));
5288
+ const [range, setRange] = useState11(initialQuery?.receivedFrom || initialQuery?.receivedTo ? null : "month");
5289
+ const [search, setSearch] = useState11(initialQuery?.q ?? "");
5290
+ const [result, setResult] = useState11(null);
5291
+ const [loading, setLoading] = useState11(true);
5292
+ const [error, setError] = useState11(false);
5293
+ const [retry, setRetry] = useState11(0);
5294
+ const invalidRange = Boolean(query.receivedFrom && query.receivedTo && query.receivedFrom > query.receivedTo);
5295
+ useEffect9(() => {
5296
+ const controller = new AbortController();
5297
+ setResult(null);
5298
+ setError(false);
5299
+ if (invalidRange) {
5300
+ setLoading(false);
5301
+ return () => controller.abort();
5302
+ }
5303
+ setLoading(true);
5304
+ client.getPaymentReview(query, controller.signal).then((next) => {
5305
+ if (!controller.signal.aborted) setResult(next);
5306
+ }).catch(() => {
5307
+ if (!controller.signal.aborted) setError(true);
5308
+ }).finally(() => {
5309
+ if (!controller.signal.aborted) setLoading(false);
5310
+ });
5311
+ return () => controller.abort();
5312
+ }, [client, query, retry, invalidRange]);
5313
+ const update = (patch) => setQuery((current) => ({ ...current, ...patch, page: 1 }));
5314
+ const exportPage = () => {
5315
+ if (!result?.items.length || loading) return;
5316
+ const url = URL.createObjectURL(new Blob([paymentReviewCsv(result.items)], { type: "text/csv;charset=utf-8" }));
5317
+ const anchor = document.createElement("a");
5318
+ anchor.href = url;
5319
+ anchor.download = "payment-review-page.csv";
5320
+ anchor.click();
5321
+ URL.revokeObjectURL(url);
5322
+ };
5323
+ return /* @__PURE__ */ jsxs15("section", { className: `mbpr ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-label": "Payment review", children: [
5324
+ /* @__PURE__ */ jsx15("style", { children: css10 + `.mbpr{font-family:var(--mb-font,ui-sans-serif,system-ui,sans-serif)}@media(max-width:640px){.mbpr-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.mbpr-metric:first-child{grid-column:1/-1}.mbpr-metric strong{overflow-wrap:anywhere}}` }),
5325
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-head", children: [
5326
+ /* @__PURE__ */ jsxs15("div", { children: [
5327
+ /* @__PURE__ */ jsx15("h2", { children: "Payment review" }),
5328
+ /* @__PURE__ */ jsx15("p", { className: "mbpr-sub", children: "Review confirmed payments, check details, and cash totals." })
5329
+ ] }),
5330
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-actions", children: [
5331
+ /* @__PURE__ */ jsx15("button", { type: "button", disabled: !result?.items.length || loading, onClick: exportPage, children: "Export page" }),
5332
+ onPostPayment ? /* @__PURE__ */ jsx15("button", { className: "primary", type: "button", onClick: onPostPayment, children: "+ Post payment" }) : null
5333
+ ] })
5334
+ ] }),
5335
+ /* @__PURE__ */ jsx15("small", { children: "Pending EOR and 835 amounts are excluded until funds are confirmed. Historical legacy payments are also excluded." }),
5336
+ /* @__PURE__ */ jsx15("div", { className: "mbpr-metrics", children: [["Posted total", result ? money5(result.summary.postedTotal) : "\u2014"], ["Payment entries", result?.summary.entryCount ?? "\u2014"], ["Unique patients", result?.summary.uniquePatients ?? "\u2014"]].map(([label, value]) => /* @__PURE__ */ jsxs15("div", { className: "mbpr-metric", children: [
5337
+ /* @__PURE__ */ jsx15("small", { children: label }),
5338
+ /* @__PURE__ */ jsx15("strong", { children: value })
5339
+ ] }, label)) }),
5340
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-card", children: [
5341
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-controls", children: [
5342
+ /* @__PURE__ */ jsx15("div", { className: "mbpr-toolbar", "aria-label": "Quick range", children: [["today", "Today"], ["week", "This week"], ["month", "This month"], ["year", "This year"], ["all", "All dates"]].map(([id, label]) => /* @__PURE__ */ jsx15("button", { type: "button", className: range === id ? "active" : "", "aria-pressed": range === id, onClick: () => {
5343
+ setRange(id);
5344
+ setQuery((current) => {
5345
+ const next = { ...current };
5346
+ delete next.receivedFrom;
5347
+ delete next.receivedTo;
5348
+ return { ...next, ...paymentReviewDateRange(id), page: 1 };
5349
+ });
5350
+ }, children: label }, id)) }),
5351
+ /* @__PURE__ */ jsxs15("form", { className: "mbpr-toolbar", onSubmit: (event) => {
5352
+ event.preventDefault();
5353
+ update({ q: search });
5354
+ }, children: [
5355
+ /* @__PURE__ */ jsxs15("label", { className: "mbpr-search", children: [
5356
+ "Search",
5357
+ /* @__PURE__ */ jsx15("input", { type: "search", placeholder: "Patient, bill, claim, payer, or check\u2026", value: search, onChange: (event) => setSearch(event.target.value) })
5358
+ ] }),
5359
+ /* @__PURE__ */ jsx15("button", { type: "submit", children: "Search" }),
5360
+ /* @__PURE__ */ jsxs15("label", { children: [
5361
+ "Received from",
5362
+ /* @__PURE__ */ jsx15("input", { type: "date", value: query.receivedFrom ?? "", onChange: (event) => {
5363
+ setRange(null);
5364
+ update({ receivedFrom: event.target.value });
5365
+ } })
5366
+ ] }),
5367
+ /* @__PURE__ */ jsxs15("label", { children: [
5368
+ "Received through",
5369
+ /* @__PURE__ */ jsx15("input", { type: "date", value: query.receivedTo ?? "", onChange: (event) => {
5370
+ setRange(null);
5371
+ update({ receivedTo: event.target.value });
5372
+ } })
5373
+ ] })
5374
+ ] })
5375
+ ] }),
5376
+ invalidRange ? /* @__PURE__ */ jsx15("p", { className: "mbpr-state mbpr-error", role: "alert", children: "The received-through date must be on or after the received-from date." }) : loading ? /* @__PURE__ */ jsx15("p", { className: "mbpr-state", role: "status", children: "Loading payments\u2026" }) : error ? /* @__PURE__ */ jsxs15("div", { className: "mbpr-state mbpr-error", role: "alert", children: [
5377
+ "Payments could not be loaded. ",
5378
+ /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => setRetry((value) => value + 1), children: "Retry" })
5379
+ ] }) : !result?.items.length ? /* @__PURE__ */ jsx15("p", { className: "mbpr-state", children: "No confirmed payments match these filters." }) : /* @__PURE__ */ jsx15("div", { className: "mbpr-scroll", tabIndex: 0, role: "region", "aria-label": "Payment entries", children: /* @__PURE__ */ jsxs15("table", { children: [
5380
+ /* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsx15("tr", { children: ["Patient", "Bill / DOS", "Received", "Posted", "Status", "Method / source", "Check / trace", "Amount"].map((label) => /* @__PURE__ */ jsx15("th", { scope: "col", className: label === "Amount" ? "mbpr-money" : "", children: label }, label)) }) }),
5381
+ /* @__PURE__ */ jsx15("tbody", { children: result.items.map((item) => /* @__PURE__ */ jsxs15("tr", { children: [
5382
+ /* @__PURE__ */ jsxs15("td", { children: [
5383
+ item.patientName,
5384
+ /* @__PURE__ */ jsx15("small", { children: item.claimNumber })
5385
+ ] }),
5386
+ /* @__PURE__ */ jsxs15("td", { children: [
5387
+ onSelectBill ? /* @__PURE__ */ jsx15("button", { type: "button", className: "mbpr-link", onClick: () => onSelectBill(item.billId), children: item.billNumber == null ? "View bill" : `Bill #${item.billNumber}` }) : item.billNumber == null ? "\u2014" : `Bill #${item.billNumber}`,
5388
+ /* @__PURE__ */ jsxs15("small", { children: [
5389
+ "DOS ",
5390
+ dateLabel(item.dateOfService)
5391
+ ] })
5392
+ ] }),
5393
+ /* @__PURE__ */ jsx15("td", { children: dateLabel(item.receivedDate) }),
5394
+ /* @__PURE__ */ jsx15("td", { children: dateLabel(item.postedDate) }),
5395
+ /* @__PURE__ */ jsx15("td", { children: /* @__PURE__ */ jsx15("span", { className: "mbpr-status", children: "Received" }) }),
5396
+ /* @__PURE__ */ jsxs15("td", { children: [
5397
+ item.method || "\u2014",
5398
+ /* @__PURE__ */ jsx15("small", { children: item.source })
5399
+ ] }),
5400
+ /* @__PURE__ */ jsx15("td", { children: item.checkNumber || "\u2014" }),
5401
+ /* @__PURE__ */ jsx15("td", { className: "mbpr-money", children: money5(item.amount) })
5402
+ ] }, paymentReviewRowKey(item))) })
5403
+ ] }) }),
5404
+ result ? /* @__PURE__ */ jsxs15("div", { className: "mbpr-pager", children: [
5405
+ /* @__PURE__ */ jsxs15("span", { children: [
5406
+ result.total,
5407
+ " entries \xB7 Page ",
5408
+ result.page,
5409
+ " of ",
5410
+ Math.max(1, Math.ceil(result.total / result.pageSize))
5411
+ ] }),
5412
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-actions", children: [
5413
+ /* @__PURE__ */ jsx15("button", { type: "button", disabled: result.page <= 1, onClick: () => setQuery((current) => ({ ...current, page: Math.max(1, result.page - 1) })), children: "Previous" }),
5414
+ /* @__PURE__ */ jsx15("button", { type: "button", disabled: result.page * result.pageSize >= result.total, onClick: () => setQuery((current) => ({ ...current, page: result.page + 1 })), children: "Next" })
5415
+ ] })
5416
+ ] }) : null
5417
+ ] })
5418
+ ] });
5419
+ }
5420
+
5421
+ // src/notification-settings.tsx
5422
+ import { useEffect as useEffect10, useId as useId3, useRef as useRef5, useState as useState12 } from "react";
5423
+ import { Fragment as Fragment11, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
5424
+ function defaultNotificationPreferences() {
5425
+ return { enabled: false, statusUpdates: false, agingDays: [], quietHours: true };
5426
+ }
5427
+ function notificationSettingsUpdate(preferences, consent) {
5428
+ return {
5429
+ enabled: preferences.enabled === true,
5430
+ statusUpdates: preferences.statusUpdates === true,
5431
+ agingDays: [30, 60, 90].filter((day) => preferences.agingDays.includes(day)),
5432
+ quietHours: preferences.quietHours === true,
5433
+ consent: consent === true
5434
+ };
5435
+ }
5436
+ function notificationSettingsNeedsConsent(previous, next) {
5437
+ if (!next.enabled) return false;
5438
+ if (!previous?.enabled || previous.statusUpdates !== next.statusUpdates || previous.quietHours !== next.quietHours) return true;
5439
+ return JSON.stringify(notificationSettingsUpdate(previous, false).agingDays) !== JSON.stringify(notificationSettingsUpdate(next, false).agingDays);
5440
+ }
5441
+ var css11 = `
5442
+ .mbns{color:var(--mb-text);font-family:var(--mb-font);font-size:14px;line-height:1.5;min-width:0}.mbns *{box-sizing:border-box}.mbns h2,.mbns p{margin:0}.mbns-card{padding:24px;background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow)}
5443
+ .mbns-header{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;margin-bottom:24px}.mbns h2{font-size:20px;line-height:1.3;font-weight:700}.mbns-muted{color:var(--mb-muted)}.mbns-header p{margin-top:6px;max-width:56ch}.mbns-badge{flex-shrink:0;background:var(--mb-soft);color:var(--mb-muted);padding:4px 9px;border-radius:var(--mb-control-radius);font-size:12px;font-weight:650}
5444
+ .mbns-account{padding:14px 16px;background:var(--mb-soft);border-radius:var(--mb-control-radius);margin-bottom:20px;overflow-wrap:anywhere}.mbns-account strong{display:block;font-weight:650}.mbns-account p{margin-top:3px;font-size:13px}
5445
+ .mbns-check{display:flex;gap:12px;align-items:flex-start;cursor:pointer;min-height:44px;padding:8px 0}.mbns-check input{flex-shrink:0;margin:3px 0 0;width:18px;height:18px;accent-color:var(--mb-accent)}.mbns-check strong{display:block;font-weight:650}.mbns-check small{display:block;color:var(--mb-muted);font-size:13px;margin-top:2px}.mbns fieldset{margin:14px 0 0;padding:16px 0 0;border:0;border-top:1px solid var(--mb-border);min-width:0}.mbns legend{padding:0 8px 0 0;font-size:13px;font-weight:650}.mbns-days{display:flex;flex-wrap:wrap;gap:8px 24px}.mbns-consent{border-top:1px solid var(--mb-border);margin-top:16px;padding-top:16px}.mbns-actions{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-top:24px;padding-top:20px;border-top:1px solid var(--mb-border)}
5446
+ .mbns button{font:inherit;min-height:44px;padding:10px 16px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:var(--mb-text);font-weight:650;cursor:pointer}.mbns button.mbns-save{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbns button:disabled{opacity:.5;cursor:not-allowed}.mbns input:focus-visible,.mbns button:focus-visible{outline:2px solid var(--mb-accent);outline-offset:3px}.mbns-notice{margin-top:16px!important;color:var(--mb-muted)}.mbns-error{color:var(--mb-danger)}.mbns :disabled+span{opacity:.6}@media(max-width:540px){.mbns-card{padding:18px}.mbns-header{gap:8px}.mbns-actions button{flex:1 1 auto}.mbns-days{gap:4px 18px}}
5447
+ `;
5448
+ function NotificationSettings(props) {
5449
+ return /* @__PURE__ */ jsx16(NotificationSettingsSession, { ...props }, props.identityKey);
5450
+ }
5451
+ var ConnectedNotificationSettings = NotificationSettings;
5452
+ function NotificationSettingsSession({ adapter, appearance, className, style, onSaved }) {
5453
+ const titleId = useId3();
5454
+ const [snapshot, setSnapshot] = useState12(null);
5455
+ const [draft, setDraft] = useState12(defaultNotificationPreferences);
5456
+ const [consent, setConsent] = useState12(false);
5457
+ const [phase, setPhase] = useState12("loading");
5458
+ const [notice, setNotice] = useState12("");
5459
+ const [failed, setFailed] = useState12(false);
5460
+ const [reload, setReload] = useState12(0);
5461
+ const request = useRef5(0);
5462
+ useEffect10(() => {
5463
+ const current = ++request.current;
5464
+ setPhase("loading");
5465
+ setSnapshot(null);
5466
+ setDraft(defaultNotificationPreferences());
5467
+ setConsent(false);
5468
+ setNotice("");
5469
+ setFailed(false);
5470
+ void Promise.resolve().then(() => adapter.load()).then((result) => {
5471
+ if (current !== request.current) return;
5472
+ setSnapshot(result);
5473
+ setDraft(result.preferences ?? defaultNotificationPreferences());
5474
+ setPhase("ready");
5475
+ }).catch(() => {
5476
+ if (current !== request.current) return;
5477
+ setPhase("error");
5478
+ });
5479
+ return () => {
5480
+ request.current++;
5481
+ };
5482
+ }, [adapter, reload]);
5483
+ const needsConsent = notificationSettingsNeedsConsent(snapshot?.preferences ?? null, draft);
5484
+ const hasCategory = draft.statusUpdates || draft.agingDays.length > 0;
5485
+ const changed = JSON.stringify(notificationSettingsUpdate(draft, false)) !== JSON.stringify(notificationSettingsUpdate(snapshot?.preferences ?? defaultNotificationPreferences(), false));
5486
+ const busy = phase !== "ready";
5487
+ const canSave = !busy && changed && (!draft.enabled || !!snapshot?.canEnable && hasCategory && (!needsConsent || consent));
5488
+ const update = (value) => {
5489
+ setDraft((previous) => ({ ...previous, ...value }));
5490
+ setConsent(false);
5491
+ setNotice("");
5492
+ setFailed(false);
5493
+ };
5494
+ const save = async (unsubscribe) => {
5495
+ if (busy || !unsubscribe && !canSave) return;
5496
+ const current = ++request.current;
5497
+ setPhase("saving");
5498
+ setNotice("");
5499
+ setFailed(false);
5500
+ try {
5501
+ const result = await (unsubscribe ? adapter.unsubscribe() : adapter.save(notificationSettingsUpdate(draft, consent)));
5502
+ if (current !== request.current) return;
5503
+ setSnapshot(result);
5504
+ setDraft(result.preferences ?? defaultNotificationPreferences());
5505
+ setConsent(false);
5506
+ setPhase("ready");
5507
+ setNotice(result.preferences?.enabled ? "Notification preferences saved." : "Email notifications are off.");
5508
+ try {
5509
+ onSaved?.(result);
5510
+ } catch {
5511
+ }
5512
+ } catch {
5513
+ if (current !== request.current) return;
5514
+ setPhase("ready");
5515
+ setConsent(false);
5516
+ setFailed(true);
5517
+ setNotice("We couldn't confirm your changes. Retry, or reload settings to check their current state.");
5518
+ }
5519
+ };
5520
+ return /* @__PURE__ */ jsxs16("section", { className: `mbns ${className ?? ""}`, style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-labelledby": titleId, "aria-busy": phase === "loading" || phase === "saving", children: [
5521
+ /* @__PURE__ */ jsx16("style", { children: css11 }),
5522
+ /* @__PURE__ */ jsxs16("div", { className: "mbns-card", children: [
5523
+ /* @__PURE__ */ jsxs16("header", { className: "mbns-header", children: [
5524
+ /* @__PURE__ */ jsxs16("div", { children: [
5525
+ /* @__PURE__ */ jsx16("h2", { id: titleId, children: "Email notifications" }),
5526
+ /* @__PURE__ */ jsx16("p", { className: "mbns-muted", children: "Choose which billing updates reach your inbox. Notifications are off until you opt in." })
5527
+ ] }),
5528
+ /* @__PURE__ */ jsx16("span", { className: "mbns-badge", children: !snapshot ? "\u2014" : snapshot.preferences?.enabled ? "On" : "Off" })
5529
+ ] }),
5530
+ phase === "loading" ? /* @__PURE__ */ jsx16("p", { role: "status", className: "mbns-muted", children: "Loading notification preferences\u2026" }) : phase === "error" ? /* @__PURE__ */ jsxs16("div", { children: [
5531
+ /* @__PURE__ */ jsx16("p", { role: "alert", className: "mbns-error", children: "We couldn't load your preferences. No settings have been changed." }),
5532
+ /* @__PURE__ */ jsx16("div", { className: "mbns-actions", children: /* @__PURE__ */ jsx16("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading" }) })
5533
+ ] }) : snapshot ? /* @__PURE__ */ jsxs16(Fragment11, { children: [
5534
+ /* @__PURE__ */ jsxs16("div", { className: "mbns-account", children: [
5535
+ /* @__PURE__ */ jsx16("strong", { children: snapshot.email || "No verified email address" }),
5536
+ /* @__PURE__ */ jsxs16("p", { className: "mbns-muted", children: [
5537
+ snapshot.audience === "practice" ? "Updates for this practice's bills" : "Updates only for bills assigned to you",
5538
+ ". Your application manages this address and access."
5539
+ ] })
5540
+ ] }),
5541
+ snapshot.environment === "sandbox" && /* @__PURE__ */ jsx16("p", { className: "mbns-notice", children: "Sandbox preview only. No notification emails will be sent." }),
5542
+ !snapshot.canEnable && /* @__PURE__ */ jsx16("p", { className: "mbns-notice", children: "Notifications aren't available for this account yet. Ask your administrator to confirm email verification, billing access and notification availability. You can still turn existing notifications off." }),
5543
+ /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5544
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.enabled, disabled: busy || !snapshot.canEnable && !draft.enabled, onChange: (event) => update({ enabled: event.target.checked }) }),
5545
+ /* @__PURE__ */ jsxs16("span", { children: [
5546
+ /* @__PURE__ */ jsx16("strong", { children: "Send me billing updates" }),
5547
+ /* @__PURE__ */ jsx16("small", { children: "Emails contain a general alert, not patient details or attachments." })
5548
+ ] })
5549
+ ] }),
5550
+ /* @__PURE__ */ jsxs16("fieldset", { disabled: busy || !draft.enabled || !snapshot.canEnable, children: [
5551
+ /* @__PURE__ */ jsx16("legend", { children: "Updates to receive" }),
5552
+ /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5553
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.statusUpdates, onChange: (event) => update({ statusUpdates: event.target.checked }) }),
5554
+ /* @__PURE__ */ jsxs16("span", { children: [
5555
+ /* @__PURE__ */ jsx16("strong", { children: "Bill status changes" }),
5556
+ /* @__PURE__ */ jsx16("small", { children: "Follow accepted, rejected, processed and payment updates." })
5557
+ ] })
5558
+ ] }),
5559
+ /* @__PURE__ */ jsx16("p", { className: "mbns-muted", children: "Remind me when a bill is still waiting for a payer:" }),
5560
+ /* @__PURE__ */ jsx16("div", { className: "mbns-days", children: [30, 60, 90].map((day) => /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5561
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.agingDays.includes(day), onChange: (event) => update({ agingDays: event.target.checked ? [...draft.agingDays, day] : draft.agingDays.filter((value) => value !== day) }) }),
5562
+ /* @__PURE__ */ jsxs16("span", { children: [
5563
+ day,
5564
+ " days"
5565
+ ] })
5566
+ ] }, day)) }),
5567
+ /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5568
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.quietHours, onChange: (event) => update({ quietHours: event.target.checked }) }),
5569
+ /* @__PURE__ */ jsxs16("span", { children: [
5570
+ /* @__PURE__ */ jsx16("strong", { children: "Quiet hours" }),
5571
+ /* @__PURE__ */ jsx16("small", { children: "Hold emails from 7 pm to 7 am Pacific time." })
5572
+ ] })
5573
+ ] })
5574
+ ] }),
5575
+ draft.enabled && !hasCategory && /* @__PURE__ */ jsx16("p", { className: "mbns-notice", children: "Select at least one update type to enable notifications." }),
5576
+ needsConsent && /* @__PURE__ */ jsxs16("label", { className: "mbns-check mbns-consent", children: [
5577
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: consent, disabled: busy || !snapshot.canEnable, onChange: (event) => setConsent(event.target.checked) }),
5578
+ /* @__PURE__ */ jsxs16("span", { children: [
5579
+ "I agree to receive the selected billing emails ",
5580
+ snapshot.audience === "practice" ? "for this practice" : "for bills assigned to me",
5581
+ " at the address above. I can unsubscribe at any time."
5582
+ ] })
5583
+ ] }),
5584
+ /* @__PURE__ */ jsxs16("div", { className: "mbns-actions", children: [
5585
+ /* @__PURE__ */ jsx16("button", { type: "button", className: "mbns-save", disabled: !canSave, onClick: () => void save(false), children: phase === "saving" ? "Saving\u2026" : "Save preferences" }),
5586
+ snapshot.preferences?.enabled && /* @__PURE__ */ jsx16("button", { type: "button", disabled: busy, onClick: () => void save(true), children: "Unsubscribe from all" }),
5587
+ failed && /* @__PURE__ */ jsx16("button", { type: "button", disabled: busy, onClick: () => setReload((value) => value + 1), children: "Reload settings" })
5588
+ ] }),
5589
+ notice && /* @__PURE__ */ jsx16("p", { className: `mbns-notice ${failed ? "mbns-error" : ""}`, role: failed ? "alert" : "status", children: notice })
5590
+ ] }) : null
5591
+ ] })
5592
+ ] });
5593
+ }
5594
+
5031
5595
  // src/connected-bill-status.tsx
5032
5596
  import {
5033
5597
  useCallback as useCallback3,
5034
- useEffect as useEffect9,
5035
- useMemo as useMemo7,
5036
- useRef as useRef5,
5037
- useState as useState10
5598
+ useEffect as useEffect11,
5599
+ useMemo as useMemo8,
5600
+ useRef as useRef6,
5601
+ useState as useState13
5038
5602
  } from "react";
5039
5603
  import {
5040
- DEFAULT_API_BASE_URL,
5041
- DEFAULT_SESSION_ENDPOINT
5604
+ DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
5605
+ DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2
5042
5606
  } from "@mindbill/browser";
5043
- import { Fragment as Fragment11, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
5607
+ import { Fragment as Fragment12, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
5044
5608
  var DEFAULT_REFRESH_INTERVAL = 6e4;
5045
- async function responseError(response, fallback) {
5609
+ async function responseError2(response, fallback) {
5046
5610
  const body = await response.json().catch(() => null);
5047
5611
  const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
5048
5612
  return new Error(typeof detail === "string" ? detail : fallback);
@@ -5053,7 +5617,7 @@ function isSessionFresh(session) {
5053
5617
  const expiresAt = new Date(session.expiresAt).getTime();
5054
5618
  return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
5055
5619
  }
5056
- function normalizeSession(value) {
5620
+ function normalizeSession2(value) {
5057
5621
  if (!value || typeof value !== "object") {
5058
5622
  throw new Error("The MindBill session endpoint returned an invalid response.");
5059
5623
  }
@@ -5094,9 +5658,9 @@ function normalizeStatus(value, billId) {
5094
5658
  }
5095
5659
  function createBillStatusClient({
5096
5660
  billId,
5097
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT,
5661
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
5098
5662
  getSession,
5099
- apiBaseUrl = DEFAULT_API_BASE_URL,
5663
+ apiBaseUrl = DEFAULT_API_BASE_URL2,
5100
5664
  fetch: fetchOverride
5101
5665
  }) {
5102
5666
  const fetcher = fetchOverride ?? globalThis.fetch;
@@ -5116,14 +5680,14 @@ function createBillStatusClient({
5116
5680
  signal
5117
5681
  }).then(async (response) => {
5118
5682
  if (!response.ok) {
5119
- throw await responseError(
5683
+ throw await responseError2(
5120
5684
  response,
5121
5685
  "MindBill browser session could not be created."
5122
5686
  );
5123
5687
  }
5124
5688
  return response.json();
5125
5689
  });
5126
- const request = Promise.resolve(pending).then(normalizeSession).then((nextSession) => {
5690
+ const request = Promise.resolve(pending).then(normalizeSession2).then((nextSession) => {
5127
5691
  session = nextSession;
5128
5692
  return nextSession;
5129
5693
  }).finally(() => {
@@ -5156,7 +5720,7 @@ function createBillStatusClient({
5156
5720
  response = await requestStatus(browserSession, signal);
5157
5721
  }
5158
5722
  if (!response.ok) {
5159
- throw await responseError(response, "Bill status could not be loaded.");
5723
+ throw await responseError2(response, "Bill status could not be loaded.");
5160
5724
  }
5161
5725
  const body = await response.json();
5162
5726
  return normalizeStatus(body.data, billId);
@@ -5165,31 +5729,31 @@ function createBillStatusClient({
5165
5729
  }
5166
5730
  function useBillStatus({
5167
5731
  billId,
5168
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT,
5732
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
5169
5733
  getSession,
5170
- apiBaseUrl = DEFAULT_API_BASE_URL,
5734
+ apiBaseUrl = DEFAULT_API_BASE_URL2,
5171
5735
  refreshInterval = DEFAULT_REFRESH_INTERVAL,
5172
5736
  enabled = true,
5173
5737
  initialData = null,
5174
5738
  fetch: fetchOverride
5175
5739
  }) {
5176
- const client = useMemo7(() => createBillStatusClient({
5740
+ const client = useMemo8(() => createBillStatusClient({
5177
5741
  billId,
5178
5742
  sessionEndpoint,
5179
5743
  ...getSession ? { getSession } : {},
5180
5744
  apiBaseUrl,
5181
5745
  ...fetchOverride ? { fetch: fetchOverride } : {}
5182
5746
  }), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
5183
- const [data, setData] = useState10(initialData);
5184
- const [error, setError] = useState10(null);
5185
- const [isLoading, setIsLoading] = useState10(enabled && !initialData);
5186
- const [isRefreshing, setIsRefreshing] = useState10(false);
5187
- const dataRef = useRef5(initialData);
5188
- const initialDataRef = useRef5(initialData);
5747
+ const [data, setData] = useState13(initialData);
5748
+ const [error, setError] = useState13(null);
5749
+ const [isLoading, setIsLoading] = useState13(enabled && !initialData);
5750
+ const [isRefreshing, setIsRefreshing] = useState13(false);
5751
+ const dataRef = useRef6(initialData);
5752
+ const initialDataRef = useRef6(initialData);
5189
5753
  initialDataRef.current = initialData;
5190
- const activeControllerRef = useRef5(null);
5191
- const requestSequence = useRef5(0);
5192
- useEffect9(() => {
5754
+ const activeControllerRef = useRef6(null);
5755
+ const requestSequence = useRef6(0);
5756
+ useEffect11(() => {
5193
5757
  const seed = initialDataRef.current;
5194
5758
  dataRef.current = seed;
5195
5759
  setData(seed);
@@ -5230,10 +5794,10 @@ function useBillStatus({
5230
5794
  }
5231
5795
  }
5232
5796
  }, [billId, client, enabled]);
5233
- useEffect9(() => {
5797
+ useEffect11(() => {
5234
5798
  if (enabled) void load();
5235
5799
  }, [enabled, load]);
5236
- useEffect9(() => {
5800
+ useEffect11(() => {
5237
5801
  if (!enabled || refreshInterval <= 0) return;
5238
5802
  const timer = window.setInterval(() => void load(), refreshInterval);
5239
5803
  const onFocus = () => void load();
@@ -5261,17 +5825,17 @@ function ConnectedBillStatus({
5261
5825
  }) {
5262
5826
  const status = useBillStatus(options);
5263
5827
  if (status.isLoading && !status.data) {
5264
- return /* @__PURE__ */ jsx14(Fragment11, { children: loadingFallback ?? /* @__PURE__ */ jsx14("div", { role: "status", children: "Loading bill status\u2026" }) });
5828
+ return /* @__PURE__ */ jsx17(Fragment12, { children: loadingFallback ?? /* @__PURE__ */ jsx17("div", { role: "status", children: "Loading bill status\u2026" }) });
5265
5829
  }
5266
5830
  if (status.error && !status.data) {
5267
- return /* @__PURE__ */ jsx14(Fragment11, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs14("div", { role: "alert", children: [
5831
+ return /* @__PURE__ */ jsx17(Fragment12, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs17("div", { role: "alert", children: [
5268
5832
  status.error.message,
5269
5833
  " ",
5270
- /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
5834
+ /* @__PURE__ */ jsx17("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
5271
5835
  ] }) });
5272
5836
  }
5273
5837
  if (!status.data) return null;
5274
- return /* @__PURE__ */ jsx14(
5838
+ return /* @__PURE__ */ jsx17(
5275
5839
  BillStatusSummary,
5276
5840
  {
5277
5841
  status: status.data.state,
@@ -5290,8 +5854,8 @@ function ConnectedBillStatus({
5290
5854
  }
5291
5855
 
5292
5856
  // src/bill-lifecycle-surfaces.tsx
5293
- import { useEffect as useEffect10, useRef as useRef6, useState as useState11 } from "react";
5294
- import { Fragment as Fragment12, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
5857
+ import { useEffect as useEffect12, useRef as useRef7, useState as useState14 } from "react";
5858
+ import { Fragment as Fragment13, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
5295
5859
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
5296
5860
  return actions.filter((action) => action.enabled || showUnavailable);
5297
5861
  }
@@ -5306,11 +5870,11 @@ function BillLifecycleActions({
5306
5870
  }) {
5307
5871
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
5308
5872
  if (!visible.length) return null;
5309
- return /* @__PURE__ */ jsxs15("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
5310
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5311
- visible.map((action) => /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-action", children: [
5312
- /* @__PURE__ */ jsx15("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
5313
- !action.enabled && action.reason ? /* @__PURE__ */ jsx15("span", { className: "mb-action-reason", children: action.reason }) : null
5873
+ return /* @__PURE__ */ jsxs18("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
5874
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
5875
+ visible.map((action) => /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-action", children: [
5876
+ /* @__PURE__ */ jsx18("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
5877
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx18("span", { className: "mb-action-reason", children: action.reason }) : null
5314
5878
  ] }, action.id))
5315
5879
  ] });
5316
5880
  }
@@ -5340,18 +5904,18 @@ function defaultFormatDate(createdAt) {
5340
5904
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
5341
5905
  }
5342
5906
  function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
5343
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
5344
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5345
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5346
- /* @__PURE__ */ jsx15("strong", { children: "Bill history" }),
5347
- /* @__PURE__ */ jsx15("span", { children: "Submission, payer responses, follow-up, and payments." })
5907
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
5908
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
5909
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
5910
+ /* @__PURE__ */ jsx18("strong", { children: "Bill history" }),
5911
+ /* @__PURE__ */ jsx18("span", { children: "Submission, payer responses, follow-up, and payments." })
5348
5912
  ] }) }),
5349
- !events.length ? /* @__PURE__ */ jsx15("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx15("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs15("li", { className: "mb-activity-item", children: [
5350
- /* @__PURE__ */ jsx15("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
5351
- /* @__PURE__ */ jsxs15("div", { className: "mb-activity-content", children: [
5352
- /* @__PURE__ */ jsx15("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
5353
- event.description ? /* @__PURE__ */ jsx15("p", { children: event.description }) : null,
5354
- /* @__PURE__ */ jsxs15("span", { children: [
5913
+ !events.length ? /* @__PURE__ */ jsx18("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx18("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs18("li", { className: "mb-activity-item", children: [
5914
+ /* @__PURE__ */ jsx18("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
5915
+ /* @__PURE__ */ jsxs18("div", { className: "mb-activity-content", children: [
5916
+ /* @__PURE__ */ jsx18("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
5917
+ event.description ? /* @__PURE__ */ jsx18("p", { children: event.description }) : null,
5918
+ /* @__PURE__ */ jsxs18("span", { children: [
5355
5919
  formatDate(event.createdAt),
5356
5920
  event.actor ? ` \xB7 ${event.actor}` : ""
5357
5921
  ] })
@@ -5365,49 +5929,49 @@ function historyDate(iso) {
5365
5929
  return new Intl.DateTimeFormat("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }).format(parsed);
5366
5930
  }
5367
5931
  function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref, onOpenDocument }) {
5368
- const [expanded, setExpanded] = useState11({});
5369
- const selectedRowRef = useRef6(null);
5370
- useEffect10(() => {
5932
+ const [expanded, setExpanded] = useState14({});
5933
+ const selectedRowRef = useRef7(null);
5934
+ useEffect12(() => {
5371
5935
  if (!selectedEntryId) return;
5372
5936
  const selected = entries.find((entry) => entry.id === selectedEntryId);
5373
5937
  if (selected?.details) setExpanded((current) => current[selectedEntryId] ? current : { ...current, [selectedEntryId]: true });
5374
5938
  selectedRowRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
5375
5939
  }, [entries, selectedEntryId]);
5376
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
5377
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5378
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5379
- /* @__PURE__ */ jsx15("strong", { children: "Bill history" }),
5380
- /* @__PURE__ */ jsx15("span", { children: "Submissions, payer responses, follow-up, and payments." })
5940
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
5941
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
5942
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
5943
+ /* @__PURE__ */ jsx18("strong", { children: "Bill history" }),
5944
+ /* @__PURE__ */ jsx18("span", { children: "Submissions, payer responses, follow-up, and payments." })
5381
5945
  ] }) }),
5382
- !entries.length ? /* @__PURE__ */ jsx15("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs15("div", { className: "mb-history-table", children: [
5383
- /* @__PURE__ */ jsxs15("div", { className: "mb-history-head", "aria-hidden": "true", children: [
5384
- /* @__PURE__ */ jsx15("span", { children: "Date" }),
5385
- /* @__PURE__ */ jsx15("span", { children: "Action" }),
5386
- /* @__PURE__ */ jsx15("span", { children: "User" }),
5387
- /* @__PURE__ */ jsx15("span", { children: "Details" })
5946
+ !entries.length ? /* @__PURE__ */ jsx18("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs18("div", { className: "mb-history-table", children: [
5947
+ /* @__PURE__ */ jsxs18("div", { className: "mb-history-head", "aria-hidden": "true", children: [
5948
+ /* @__PURE__ */ jsx18("span", { children: "Date" }),
5949
+ /* @__PURE__ */ jsx18("span", { children: "Action" }),
5950
+ /* @__PURE__ */ jsx18("span", { children: "User" }),
5951
+ /* @__PURE__ */ jsx18("span", { children: "Details" })
5388
5952
  ] }),
5389
- /* @__PURE__ */ jsx15("ul", { className: "mb-history-rows", children: entries.map((entry) => {
5953
+ /* @__PURE__ */ jsx18("ul", { className: "mb-history-rows", children: entries.map((entry) => {
5390
5954
  const isSelected = entry.id === selectedEntryId;
5391
5955
  const expandable = Boolean(entry.details);
5392
5956
  const isOpen = expandable && Boolean(expanded[entry.id]);
5393
5957
  const details = entry.details;
5394
- const lineContents = /* @__PURE__ */ jsxs15(Fragment12, { children: [
5395
- /* @__PURE__ */ jsx15("span", { className: "mb-history-date", children: formatDate(entry.date) }),
5396
- /* @__PURE__ */ jsx15("span", { className: "mb-history-action", children: entry.action }),
5397
- /* @__PURE__ */ jsx15("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
5398
- /* @__PURE__ */ jsxs15("span", { className: "mb-history-summary", children: [
5399
- expandable ? /* @__PURE__ */ jsx15("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
5958
+ const lineContents = /* @__PURE__ */ jsxs18(Fragment13, { children: [
5959
+ /* @__PURE__ */ jsx18("span", { className: "mb-history-date", children: formatDate(entry.date) }),
5960
+ /* @__PURE__ */ jsx18("span", { className: "mb-history-action", children: entry.action }),
5961
+ /* @__PURE__ */ jsx18("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
5962
+ /* @__PURE__ */ jsxs18("span", { className: "mb-history-summary", children: [
5963
+ expandable ? /* @__PURE__ */ jsx18("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
5400
5964
  entry.summary
5401
5965
  ] })
5402
5966
  ] });
5403
- return /* @__PURE__ */ jsxs15(
5967
+ return /* @__PURE__ */ jsxs18(
5404
5968
  "li",
5405
5969
  {
5406
5970
  ref: isSelected ? selectedRowRef : void 0,
5407
5971
  className: `mb-history-row is-${entry.tone}${isSelected ? " is-selected" : ""}`,
5408
5972
  "aria-current": isSelected ? "true" : void 0,
5409
5973
  children: [
5410
- expandable ? /* @__PURE__ */ jsx15(
5974
+ expandable ? /* @__PURE__ */ jsx18(
5411
5975
  "button",
5412
5976
  {
5413
5977
  type: "button",
@@ -5416,31 +5980,31 @@ function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill hist
5416
5980
  onClick: () => setExpanded((current) => ({ ...current, [entry.id]: !current[entry.id] })),
5417
5981
  children: lineContents
5418
5982
  }
5419
- ) : /* @__PURE__ */ jsx15("div", { className: "mb-history-line", children: lineContents }),
5420
- isOpen && details ? /* @__PURE__ */ jsxs15("div", { className: "mb-history-details", children: [
5421
- details.rows?.length ? /* @__PURE__ */ jsx15("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs15("div", { children: [
5422
- /* @__PURE__ */ jsx15("dt", { children: row.label }),
5423
- /* @__PURE__ */ jsx15("dd", { children: row.value })
5983
+ ) : /* @__PURE__ */ jsx18("div", { className: "mb-history-line", children: lineContents }),
5984
+ isOpen && details ? /* @__PURE__ */ jsxs18("div", { className: "mb-history-details", children: [
5985
+ details.rows?.length ? /* @__PURE__ */ jsx18("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs18("div", { children: [
5986
+ /* @__PURE__ */ jsx18("dt", { children: row.label }),
5987
+ /* @__PURE__ */ jsx18("dd", { children: row.value })
5424
5988
  ] }, `${row.label}-${row.value}`)) }) : null,
5425
- details.documents?.length ? /* @__PURE__ */ jsx15("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs15("div", { children: [
5426
- /* @__PURE__ */ jsx15("dt", { children: "Documents" }),
5427
- /* @__PURE__ */ jsx15("dd", { children: details.documents.map((doc) => {
5989
+ details.documents?.length ? /* @__PURE__ */ jsx18("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs18("div", { children: [
5990
+ /* @__PURE__ */ jsx18("dt", { children: "Documents" }),
5991
+ /* @__PURE__ */ jsx18("dd", { children: details.documents.map((doc) => {
5428
5992
  const href = documentHref?.(doc) ?? null;
5429
- return href ? /* @__PURE__ */ jsx15("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : onOpenDocument ? /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-history-doc", onClick: () => void onOpenDocument(doc), children: doc.filename }, doc.id) : /* @__PURE__ */ jsx15("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
5993
+ return href ? /* @__PURE__ */ jsx18("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : onOpenDocument ? /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-history-doc", onClick: () => void onOpenDocument(doc), children: doc.filename }, doc.id) : /* @__PURE__ */ jsx18("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
5430
5994
  }) })
5431
5995
  ] }) }) : null,
5432
- details.codes?.length ? /* @__PURE__ */ jsx15("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs15("div", { children: [
5433
- /* @__PURE__ */ jsx15("dt", { children: code.code }),
5434
- /* @__PURE__ */ jsx15("dd", { children: code.text })
5996
+ details.codes?.length ? /* @__PURE__ */ jsx18("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs18("div", { children: [
5997
+ /* @__PURE__ */ jsx18("dt", { children: code.code }),
5998
+ /* @__PURE__ */ jsx18("dd", { children: code.text })
5435
5999
  ] }, code.code)) }) : null,
5436
- details.complianceDueDates?.length ? /* @__PURE__ */ jsxs15("div", { className: "mb-history-due", children: [
5437
- /* @__PURE__ */ jsx15("em", { children: "Compliance Due Dates" }),
5438
- /* @__PURE__ */ jsx15("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs15("div", { children: [
5439
- /* @__PURE__ */ jsx15("dt", { children: formatDate(due.date) }),
5440
- /* @__PURE__ */ jsx15("dd", { children: due.text })
6000
+ details.complianceDueDates?.length ? /* @__PURE__ */ jsxs18("div", { className: "mb-history-due", children: [
6001
+ /* @__PURE__ */ jsx18("em", { children: "Compliance Due Dates" }),
6002
+ /* @__PURE__ */ jsx18("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs18("div", { children: [
6003
+ /* @__PURE__ */ jsx18("dt", { children: formatDate(due.date) }),
6004
+ /* @__PURE__ */ jsx18("dd", { children: due.text })
5441
6005
  ] }, `${due.date}-${due.text}`)) })
5442
6006
  ] }) : null,
5443
- details.text ? /* @__PURE__ */ jsx15("p", { className: "mb-history-text", children: details.text }) : null
6007
+ details.text ? /* @__PURE__ */ jsx18("p", { className: "mb-history-text", children: details.text }) : null
5444
6008
  ] }) : null
5445
6009
  ]
5446
6010
  },
@@ -5501,15 +6065,15 @@ function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, dr
5501
6065
  const rejected = state.toLowerCase() === "rejected";
5502
6066
  const draft = Boolean(draftStage) && isBillLifecycleDraft(state);
5503
6067
  const steps = billLifecycleProgressSteps(state, { draftStage: Boolean(draftStage) });
5504
- return /* @__PURE__ */ jsxs15("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
5505
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5506
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5507
- /* @__PURE__ */ jsx15("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
5508
- /* @__PURE__ */ jsx15("span", { children: rejected ? "The payer rejected this submission." : draft ? "Not yet sent" : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
6068
+ return /* @__PURE__ */ jsxs18("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
6069
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6070
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
6071
+ /* @__PURE__ */ jsx18("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
6072
+ /* @__PURE__ */ jsx18("span", { children: rejected ? "The payer rejected this submission." : draft ? "Not yet sent" : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
5509
6073
  ] }) }),
5510
- /* @__PURE__ */ jsx15("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs15("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
5511
- /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
5512
- /* @__PURE__ */ jsx15("b", { children: step.label })
6074
+ /* @__PURE__ */ jsx18("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs18("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
6075
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
6076
+ /* @__PURE__ */ jsx18("b", { children: step.label })
5513
6077
  ] }, step.id)) })
5514
6078
  ] });
5515
6079
  }
@@ -5523,48 +6087,48 @@ function billRejectionIssueSummary(rejection, count) {
5523
6087
  function BillRejectionNotice({ rejection, title = "Rejected \u2014 action required", submittedAt, appearance, className, style, formatDate = defaultFormatDate }) {
5524
6088
  const issues = rejection.issues?.length ? rejection.issues : [{ code: rejection.code, description: rejection.reason }];
5525
6089
  const hasCodes = issues.some((issue) => Boolean(issue.code));
5526
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
5527
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5528
- /* @__PURE__ */ jsxs15("div", { className: "mb-rejection-overview", children: [
5529
- /* @__PURE__ */ jsxs15("header", { className: "mb-rejection-heading", children: [
5530
- /* @__PURE__ */ jsx15("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
5531
- /* @__PURE__ */ jsxs15("div", { children: [
5532
- /* @__PURE__ */ jsx15("strong", { children: title }),
5533
- /* @__PURE__ */ jsxs15("span", { children: [
6090
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
6091
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6092
+ /* @__PURE__ */ jsxs18("div", { className: "mb-rejection-overview", children: [
6093
+ /* @__PURE__ */ jsxs18("header", { className: "mb-rejection-heading", children: [
6094
+ /* @__PURE__ */ jsx18("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
6095
+ /* @__PURE__ */ jsxs18("div", { children: [
6096
+ /* @__PURE__ */ jsx18("strong", { children: title }),
6097
+ /* @__PURE__ */ jsxs18("span", { children: [
5534
6098
  "Fix the ",
5535
6099
  issues.length === 1 ? "issue" : "issues",
5536
6100
  " below, then resubmit."
5537
6101
  ] })
5538
6102
  ] })
5539
6103
  ] }),
5540
- /* @__PURE__ */ jsxs15("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
5541
- /* @__PURE__ */ jsxs15("li", { className: "is-complete", children: [
5542
- /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "\u2713" }),
5543
- /* @__PURE__ */ jsx15("b", { children: "Sent" }),
5544
- submittedAt ? /* @__PURE__ */ jsx15("small", { children: formatDate(submittedAt) }) : null
6104
+ /* @__PURE__ */ jsxs18("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
6105
+ /* @__PURE__ */ jsxs18("li", { className: "is-complete", children: [
6106
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: "\u2713" }),
6107
+ /* @__PURE__ */ jsx18("b", { children: "Sent" }),
6108
+ submittedAt ? /* @__PURE__ */ jsx18("small", { children: formatDate(submittedAt) }) : null
5545
6109
  ] }),
5546
- /* @__PURE__ */ jsxs15("li", { className: "is-rejected", "aria-current": "step", children: [
5547
- /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "!" }),
5548
- /* @__PURE__ */ jsx15("b", { children: "Rejected" }),
5549
- rejection.receivedAt ? /* @__PURE__ */ jsx15("small", { children: formatDate(rejection.receivedAt) }) : null
6110
+ /* @__PURE__ */ jsxs18("li", { className: "is-rejected", "aria-current": "step", children: [
6111
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: "!" }),
6112
+ /* @__PURE__ */ jsx18("b", { children: "Rejected" }),
6113
+ rejection.receivedAt ? /* @__PURE__ */ jsx18("small", { children: formatDate(rejection.receivedAt) }) : null
5550
6114
  ] })
5551
6115
  ] })
5552
6116
  ] }),
5553
- /* @__PURE__ */ jsxs15("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
5554
- /* @__PURE__ */ jsxs15("div", { className: "mb-rejection-issues-heading", children: [
5555
- /* @__PURE__ */ jsxs15("strong", { children: [
5556
- /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "\u25B3" }),
6117
+ /* @__PURE__ */ jsxs18("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
6118
+ /* @__PURE__ */ jsxs18("div", { className: "mb-rejection-issues-heading", children: [
6119
+ /* @__PURE__ */ jsxs18("strong", { children: [
6120
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: "\u25B3" }),
5557
6121
  " Rejection reasons"
5558
6122
  ] }),
5559
- /* @__PURE__ */ jsx15("span", { children: billRejectionIssueSummary(rejection, issues.length) })
6123
+ /* @__PURE__ */ jsx18("span", { children: billRejectionIssueSummary(rejection, issues.length) })
5560
6124
  ] }),
5561
- /* @__PURE__ */ jsx15("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs15("li", { children: [
5562
- /* @__PURE__ */ jsx15("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
5563
- /* @__PURE__ */ jsx15("p", { children: issue.description }),
5564
- issue.code ? /* @__PURE__ */ jsx15("span", { className: "mb-rejection-code", children: issue.code }) : null
6125
+ /* @__PURE__ */ jsx18("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs18("li", { children: [
6126
+ /* @__PURE__ */ jsx18("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
6127
+ /* @__PURE__ */ jsx18("p", { children: issue.description }),
6128
+ issue.code ? /* @__PURE__ */ jsx18("span", { className: "mb-rejection-code", children: issue.code }) : null
5565
6129
  ] }, `${issue.code ?? "issue"}-${index}`)) }),
5566
- hasCodes ? /* @__PURE__ */ jsxs15("p", { className: "mb-rejection-code-note", children: [
5567
- /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "i" }),
6130
+ hasCodes ? /* @__PURE__ */ jsxs18("p", { className: "mb-rejection-code-note", children: [
6131
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: "i" }),
5568
6132
  " Technical error codes are included for support and auditability."
5569
6133
  ] }) : null
5570
6134
  ] })
@@ -5579,18 +6143,18 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
5579
6143
  ["Charged", currency(bill.totalCharge)],
5580
6144
  ["Balance", currency(bill.balanceDue)]
5581
6145
  ];
5582
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
5583
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5584
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5585
- /* @__PURE__ */ jsx15("strong", { children: "Bill snapshot" }),
5586
- /* @__PURE__ */ jsxs15("span", { children: [
6146
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
6147
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6148
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
6149
+ /* @__PURE__ */ jsx18("strong", { children: "Bill snapshot" }),
6150
+ /* @__PURE__ */ jsxs18("span", { children: [
5587
6151
  "Bill #",
5588
6152
  bill.billNumber
5589
6153
  ] })
5590
6154
  ] }) }),
5591
- /* @__PURE__ */ jsx15("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs15("div", { children: [
5592
- /* @__PURE__ */ jsx15("dt", { children: label }),
5593
- /* @__PURE__ */ jsx15("dd", { children: value })
6155
+ /* @__PURE__ */ jsx18("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs18("div", { children: [
6156
+ /* @__PURE__ */ jsx18("dt", { children: label }),
6157
+ /* @__PURE__ */ jsx18("dd", { children: value })
5594
6158
  ] }, label)) })
5595
6159
  ] });
5596
6160
  }
@@ -5605,140 +6169,140 @@ function BillExplanationOfReview({
5605
6169
  style
5606
6170
  }) {
5607
6171
  const rows = payments.length ? payments : [null];
5608
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
5609
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5610
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5611
- /* @__PURE__ */ jsx15("strong", { children: "Explanation of Review" }),
5612
- /* @__PURE__ */ jsx15("span", { children: "Payer response and payment reconciliation." })
6172
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
6173
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6174
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
6175
+ /* @__PURE__ */ jsx18("strong", { children: "Explanation of Review" }),
6176
+ /* @__PURE__ */ jsx18("span", { children: "Payer response and payment reconciliation." })
5613
6177
  ] }) }),
5614
- /* @__PURE__ */ jsxs15("dl", { className: "mb-eor-metrics", children: [
5615
- /* @__PURE__ */ jsxs15("div", { children: [
5616
- /* @__PURE__ */ jsx15("dt", { children: "Amount billed" }),
5617
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.billedAmount) })
6178
+ /* @__PURE__ */ jsxs18("dl", { className: "mb-eor-metrics", children: [
6179
+ /* @__PURE__ */ jsxs18("div", { children: [
6180
+ /* @__PURE__ */ jsx18("dt", { children: "Amount billed" }),
6181
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.billedAmount) })
5618
6182
  ] }),
5619
- /* @__PURE__ */ jsxs15("div", { children: [
5620
- /* @__PURE__ */ jsx15("dt", { children: "Payer allowed" }),
5621
- /* @__PURE__ */ jsx15("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
6183
+ /* @__PURE__ */ jsxs18("div", { children: [
6184
+ /* @__PURE__ */ jsx18("dt", { children: "Payer allowed" }),
6185
+ /* @__PURE__ */ jsx18("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
5622
6186
  ] }),
5623
- /* @__PURE__ */ jsxs15("div", { children: [
5624
- /* @__PURE__ */ jsx15("dt", { children: "Payer reported paid" }),
5625
- /* @__PURE__ */ jsx15("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
6187
+ /* @__PURE__ */ jsxs18("div", { children: [
6188
+ /* @__PURE__ */ jsx18("dt", { children: "Payer reported paid" }),
6189
+ /* @__PURE__ */ jsx18("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
5626
6190
  ] }),
5627
- /* @__PURE__ */ jsxs15("div", { className: "is-balance", children: [
5628
- /* @__PURE__ */ jsx15("dt", { children: "Balance due" }),
5629
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.balanceDue) })
6191
+ /* @__PURE__ */ jsxs18("div", { className: "is-balance", children: [
6192
+ /* @__PURE__ */ jsx18("dt", { children: "Balance due" }),
6193
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.balanceDue) })
5630
6194
  ] }),
5631
- /* @__PURE__ */ jsxs15("div", { children: [
5632
- /* @__PURE__ */ jsx15("dt", { children: "Payment posted" }),
5633
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.postedPrincipal) })
6195
+ /* @__PURE__ */ jsxs18("div", { children: [
6196
+ /* @__PURE__ */ jsx18("dt", { children: "Payment posted" }),
6197
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.postedPrincipal) })
5634
6198
  ] }),
5635
- /* @__PURE__ */ jsxs15("div", { children: [
5636
- /* @__PURE__ */ jsx15("dt", { children: "Penalty & interest" }),
5637
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.postedAdditional) })
6199
+ /* @__PURE__ */ jsxs18("div", { children: [
6200
+ /* @__PURE__ */ jsx18("dt", { children: "Penalty & interest" }),
6201
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.postedAdditional) })
5638
6202
  ] }),
5639
- /* @__PURE__ */ jsxs15("div", { children: [
5640
- /* @__PURE__ */ jsx15("dt", { children: "Total received" }),
5641
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.totalPostedCash) })
6203
+ /* @__PURE__ */ jsxs18("div", { children: [
6204
+ /* @__PURE__ */ jsx18("dt", { children: "Total received" }),
6205
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.totalPostedCash) })
5642
6206
  ] }),
5643
- /* @__PURE__ */ jsxs15("div", { children: [
5644
- /* @__PURE__ */ jsx15("dt", { children: "Expected" }),
5645
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.expectedAmount) })
6207
+ /* @__PURE__ */ jsxs18("div", { children: [
6208
+ /* @__PURE__ */ jsx18("dt", { children: "Expected" }),
6209
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.expectedAmount) })
5646
6210
  ] })
5647
6211
  ] }),
5648
- remittance.denialReason ? /* @__PURE__ */ jsxs15("div", { className: "mb-denial", children: [
5649
- /* @__PURE__ */ jsx15("strong", { children: "Denial reason" }),
5650
- /* @__PURE__ */ jsx15("p", { children: remittance.denialReason })
6212
+ remittance.denialReason ? /* @__PURE__ */ jsxs18("div", { className: "mb-denial", children: [
6213
+ /* @__PURE__ */ jsx18("strong", { children: "Denial reason" }),
6214
+ /* @__PURE__ */ jsx18("p", { children: remittance.denialReason })
5651
6215
  ] }) : null,
5652
- /* @__PURE__ */ jsx15("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs15("table", { className: "mb-eor-table", children: [
5653
- /* @__PURE__ */ jsxs15("thead", { children: [
5654
- /* @__PURE__ */ jsxs15("tr", { className: "mb-eor-groups", children: [
5655
- /* @__PURE__ */ jsx15("th", { colSpan: 2, children: "Submission" }),
5656
- /* @__PURE__ */ jsx15("th", { colSpan: 5, children: "EOR payment information" }),
5657
- /* @__PURE__ */ jsx15("th", { colSpan: 2, children: "EOR post" }),
5658
- /* @__PURE__ */ jsx15("th", { children: "EOR" })
6216
+ /* @__PURE__ */ jsx18("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs18("table", { className: "mb-eor-table", children: [
6217
+ /* @__PURE__ */ jsxs18("thead", { children: [
6218
+ /* @__PURE__ */ jsxs18("tr", { className: "mb-eor-groups", children: [
6219
+ /* @__PURE__ */ jsx18("th", { colSpan: 2, children: "Submission" }),
6220
+ /* @__PURE__ */ jsx18("th", { colSpan: 5, children: "EOR payment information" }),
6221
+ /* @__PURE__ */ jsx18("th", { colSpan: 2, children: "EOR post" }),
6222
+ /* @__PURE__ */ jsx18("th", { children: "EOR" })
5659
6223
  ] }),
5660
- /* @__PURE__ */ jsxs15("tr", { children: [
5661
- /* @__PURE__ */ jsx15("th", { children: "Submission" }),
5662
- /* @__PURE__ */ jsx15("th", { children: "Submission payment" }),
5663
- /* @__PURE__ */ jsx15("th", { children: "Payment method" }),
5664
- /* @__PURE__ */ jsx15("th", { children: "Reference" }),
5665
- /* @__PURE__ */ jsx15("th", { children: "Effective date" }),
5666
- /* @__PURE__ */ jsx15("th", { children: "Payment total" }),
5667
- /* @__PURE__ */ jsx15("th", { children: "Deposit date" }),
5668
- /* @__PURE__ */ jsx15("th", { children: "Post date" }),
5669
- /* @__PURE__ */ jsx15("th", { children: "Source" }),
5670
- /* @__PURE__ */ jsx15("th", { children: "Document" })
6224
+ /* @__PURE__ */ jsxs18("tr", { children: [
6225
+ /* @__PURE__ */ jsx18("th", { children: "Submission" }),
6226
+ /* @__PURE__ */ jsx18("th", { children: "Submission payment" }),
6227
+ /* @__PURE__ */ jsx18("th", { children: "Payment method" }),
6228
+ /* @__PURE__ */ jsx18("th", { children: "Reference" }),
6229
+ /* @__PURE__ */ jsx18("th", { children: "Effective date" }),
6230
+ /* @__PURE__ */ jsx18("th", { children: "Payment total" }),
6231
+ /* @__PURE__ */ jsx18("th", { children: "Deposit date" }),
6232
+ /* @__PURE__ */ jsx18("th", { children: "Post date" }),
6233
+ /* @__PURE__ */ jsx18("th", { children: "Source" }),
6234
+ /* @__PURE__ */ jsx18("th", { children: "Document" })
5671
6235
  ] })
5672
6236
  ] }),
5673
- /* @__PURE__ */ jsx15("tbody", { children: rows.map((payment, index) => {
6237
+ /* @__PURE__ */ jsx18("tbody", { children: rows.map((payment, index) => {
5674
6238
  const eor = eors[index] ?? eors[0];
5675
- return /* @__PURE__ */ jsxs15("tr", { children: [
5676
- /* @__PURE__ */ jsxs15("td", { "data-label": "Submission", children: [
5677
- /* @__PURE__ */ jsx15("strong", { children: "Original bill" }),
5678
- submittedAt ? /* @__PURE__ */ jsxs15("span", { children: [
6239
+ return /* @__PURE__ */ jsxs18("tr", { children: [
6240
+ /* @__PURE__ */ jsxs18("td", { "data-label": "Submission", children: [
6241
+ /* @__PURE__ */ jsx18("strong", { children: "Original bill" }),
6242
+ submittedAt ? /* @__PURE__ */ jsxs18("span", { children: [
5679
6243
  "Sent ",
5680
6244
  defaultFormatDate(submittedAt)
5681
6245
  ] }) : null
5682
6246
  ] }),
5683
- /* @__PURE__ */ jsx15("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
5684
- /* @__PURE__ */ jsx15("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
5685
- /* @__PURE__ */ jsx15("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
5686
- /* @__PURE__ */ jsx15("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
5687
- /* @__PURE__ */ jsx15("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
5688
- /* @__PURE__ */ jsx15("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
5689
- /* @__PURE__ */ jsx15("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
5690
- /* @__PURE__ */ jsx15("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
5691
- /* @__PURE__ */ jsx15("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
6247
+ /* @__PURE__ */ jsx18("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
6248
+ /* @__PURE__ */ jsx18("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
6249
+ /* @__PURE__ */ jsx18("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
6250
+ /* @__PURE__ */ jsx18("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
6251
+ /* @__PURE__ */ jsx18("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
6252
+ /* @__PURE__ */ jsx18("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
6253
+ /* @__PURE__ */ jsx18("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
6254
+ /* @__PURE__ */ jsx18("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
6255
+ /* @__PURE__ */ jsx18("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
5692
6256
  ] }, payment?.id ?? `empty-${index}`);
5693
6257
  }) })
5694
6258
  ] }) }),
5695
- eors.length > rows.length ? /* @__PURE__ */ jsx15("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
6259
+ eors.length > rows.length ? /* @__PURE__ */ jsx18("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx18("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
5696
6260
  ] });
5697
6261
  }
5698
6262
  function BillRemittanceCard({ remittance, appearance, className, style }) {
5699
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
5700
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5701
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5702
- /* @__PURE__ */ jsx15("strong", { children: "Remittance" }),
5703
- /* @__PURE__ */ jsx15("span", { children: "Amounts reported by the payer and posted to the bill." })
6263
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
6264
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6265
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
6266
+ /* @__PURE__ */ jsx18("strong", { children: "Remittance" }),
6267
+ /* @__PURE__ */ jsx18("span", { children: "Amounts reported by the payer and posted to the bill." })
5704
6268
  ] }) }),
5705
- /* @__PURE__ */ jsxs15("dl", { children: [
5706
- /* @__PURE__ */ jsxs15("div", { children: [
5707
- /* @__PURE__ */ jsx15("dt", { children: "Amount billed" }),
5708
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.billedAmount) })
6269
+ /* @__PURE__ */ jsxs18("dl", { children: [
6270
+ /* @__PURE__ */ jsxs18("div", { children: [
6271
+ /* @__PURE__ */ jsx18("dt", { children: "Amount billed" }),
6272
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.billedAmount) })
5709
6273
  ] }),
5710
- /* @__PURE__ */ jsxs15("div", { children: [
5711
- /* @__PURE__ */ jsx15("dt", { children: "Expected" }),
5712
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.expectedAmount) })
6274
+ /* @__PURE__ */ jsxs18("div", { children: [
6275
+ /* @__PURE__ */ jsx18("dt", { children: "Expected" }),
6276
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.expectedAmount) })
5713
6277
  ] }),
5714
- /* @__PURE__ */ jsxs15("div", { children: [
5715
- /* @__PURE__ */ jsx15("dt", { children: "Payer allowed" }),
5716
- /* @__PURE__ */ jsx15("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
6278
+ /* @__PURE__ */ jsxs18("div", { children: [
6279
+ /* @__PURE__ */ jsx18("dt", { children: "Payer allowed" }),
6280
+ /* @__PURE__ */ jsx18("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
5717
6281
  ] }),
5718
- /* @__PURE__ */ jsxs15("div", { children: [
5719
- /* @__PURE__ */ jsx15("dt", { children: "Payer reported paid" }),
5720
- /* @__PURE__ */ jsx15("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
6282
+ /* @__PURE__ */ jsxs18("div", { children: [
6283
+ /* @__PURE__ */ jsx18("dt", { children: "Payer reported paid" }),
6284
+ /* @__PURE__ */ jsx18("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
5721
6285
  ] }),
5722
- /* @__PURE__ */ jsxs15("div", { children: [
5723
- /* @__PURE__ */ jsx15("dt", { children: "Payment posted" }),
5724
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.postedPrincipal) })
6286
+ /* @__PURE__ */ jsxs18("div", { children: [
6287
+ /* @__PURE__ */ jsx18("dt", { children: "Payment posted" }),
6288
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.postedPrincipal) })
5725
6289
  ] }),
5726
- /* @__PURE__ */ jsxs15("div", { children: [
5727
- /* @__PURE__ */ jsx15("dt", { children: "Penalty & interest" }),
5728
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.postedAdditional) })
6290
+ /* @__PURE__ */ jsxs18("div", { children: [
6291
+ /* @__PURE__ */ jsx18("dt", { children: "Penalty & interest" }),
6292
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.postedAdditional) })
5729
6293
  ] }),
5730
- /* @__PURE__ */ jsxs15("div", { children: [
5731
- /* @__PURE__ */ jsx15("dt", { children: "Total received" }),
5732
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.totalPostedCash) })
6294
+ /* @__PURE__ */ jsxs18("div", { children: [
6295
+ /* @__PURE__ */ jsx18("dt", { children: "Total received" }),
6296
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.totalPostedCash) })
5733
6297
  ] }),
5734
- /* @__PURE__ */ jsxs15("div", { children: [
5735
- /* @__PURE__ */ jsx15("dt", { children: "Balance due" }),
5736
- /* @__PURE__ */ jsx15("dd", { children: currency(remittance.balanceDue) })
6298
+ /* @__PURE__ */ jsxs18("div", { children: [
6299
+ /* @__PURE__ */ jsx18("dt", { children: "Balance due" }),
6300
+ /* @__PURE__ */ jsx18("dd", { children: currency(remittance.balanceDue) })
5737
6301
  ] })
5738
6302
  ] }),
5739
- remittance.denialReason ? /* @__PURE__ */ jsxs15("div", { className: "mb-denial", children: [
5740
- /* @__PURE__ */ jsx15("strong", { children: "Denial reason" }),
5741
- /* @__PURE__ */ jsx15("p", { children: remittance.denialReason })
6303
+ remittance.denialReason ? /* @__PURE__ */ jsxs18("div", { className: "mb-denial", children: [
6304
+ /* @__PURE__ */ jsx18("strong", { children: "Denial reason" }),
6305
+ /* @__PURE__ */ jsx18("p", { children: remittance.denialReason })
5742
6306
  ] }) : null
5743
6307
  ] });
5744
6308
  }
@@ -5753,72 +6317,72 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
5753
6317
  delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
5754
6318
  ].filter(Boolean);
5755
6319
  if (!delivery.payerName && !contacts2.length) return null;
5756
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
5757
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5758
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5759
- /* @__PURE__ */ jsx15("strong", { children: delivery.payerName || "Claims administrator" }),
5760
- /* @__PURE__ */ jsx15("span", { children: "Billing and follow-up contacts." })
6320
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
6321
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6322
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
6323
+ /* @__PURE__ */ jsx18("strong", { children: delivery.payerName || "Claims administrator" }),
6324
+ /* @__PURE__ */ jsx18("span", { children: "Billing and follow-up contacts." })
5761
6325
  ] }) }),
5762
- !contacts2.length ? /* @__PURE__ */ jsx15("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx15("dl", { children: contacts2.map(([label, value, href]) => /* @__PURE__ */ jsxs15("div", { children: [
5763
- /* @__PURE__ */ jsx15("dt", { children: label }),
5764
- /* @__PURE__ */ jsx15("dd", { children: href ? /* @__PURE__ */ jsx15("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
6326
+ !contacts2.length ? /* @__PURE__ */ jsx18("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx18("dl", { children: contacts2.map(([label, value, href]) => /* @__PURE__ */ jsxs18("div", { children: [
6327
+ /* @__PURE__ */ jsx18("dt", { children: label }),
6328
+ /* @__PURE__ */ jsx18("dd", { children: href ? /* @__PURE__ */ jsx18("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
5765
6329
  ] }, label)) })
5766
6330
  ] });
5767
6331
  }
5768
6332
  function BillPaymentLedger({ payments, appearance, className, style }) {
5769
- return /* @__PURE__ */ jsxs15("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
5770
- /* @__PURE__ */ jsx15("style", { children: lifecycleSurfaceStyles }),
5771
- /* @__PURE__ */ jsx15("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs15("div", { children: [
5772
- /* @__PURE__ */ jsx15("strong", { children: "Payments" }),
5773
- /* @__PURE__ */ jsx15("span", { children: "Funds recorded against this bill." })
6333
+ return /* @__PURE__ */ jsxs18("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
6334
+ /* @__PURE__ */ jsx18("style", { children: lifecycleSurfaceStyles }),
6335
+ /* @__PURE__ */ jsx18("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs18("div", { children: [
6336
+ /* @__PURE__ */ jsx18("strong", { children: "Payments" }),
6337
+ /* @__PURE__ */ jsx18("span", { children: "Funds recorded against this bill." })
5774
6338
  ] }) }),
5775
- !payments.length ? /* @__PURE__ */ jsx15("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx15("div", { className: "mb-payment-list", children: payments.map((payment) => {
6339
+ !payments.length ? /* @__PURE__ */ jsx18("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx18("div", { className: "mb-payment-list", children: payments.map((payment) => {
5776
6340
  const additional = payment.feeAmount ?? 0;
5777
- return /* @__PURE__ */ jsxs15("article", { children: [
5778
- /* @__PURE__ */ jsxs15("div", { className: "mb-payment-amount", children: [
5779
- /* @__PURE__ */ jsx15("strong", { children: currency(payment.amount) }),
5780
- /* @__PURE__ */ jsx15("span", { children: "Total received" })
6341
+ return /* @__PURE__ */ jsxs18("article", { children: [
6342
+ /* @__PURE__ */ jsxs18("div", { className: "mb-payment-amount", children: [
6343
+ /* @__PURE__ */ jsx18("strong", { children: currency(payment.amount) }),
6344
+ /* @__PURE__ */ jsx18("span", { children: "Total received" })
5781
6345
  ] }),
5782
- /* @__PURE__ */ jsxs15("dl", { children: [
5783
- /* @__PURE__ */ jsxs15("div", { children: [
5784
- /* @__PURE__ */ jsx15("dt", { children: "Applied to bill" }),
5785
- /* @__PURE__ */ jsx15("dd", { children: currency(payment.principalAmount) })
6346
+ /* @__PURE__ */ jsxs18("dl", { children: [
6347
+ /* @__PURE__ */ jsxs18("div", { children: [
6348
+ /* @__PURE__ */ jsx18("dt", { children: "Applied to bill" }),
6349
+ /* @__PURE__ */ jsx18("dd", { children: currency(payment.principalAmount) })
5786
6350
  ] }),
5787
- additional > 0 ? /* @__PURE__ */ jsxs15("div", { children: [
5788
- /* @__PURE__ */ jsx15("dt", { children: "Penalty & interest" }),
5789
- /* @__PURE__ */ jsx15("dd", { children: currency(additional) })
6351
+ additional > 0 ? /* @__PURE__ */ jsxs18("div", { children: [
6352
+ /* @__PURE__ */ jsx18("dt", { children: "Penalty & interest" }),
6353
+ /* @__PURE__ */ jsx18("dd", { children: currency(additional) })
5790
6354
  ] }) : null,
5791
- /* @__PURE__ */ jsxs15("div", { children: [
5792
- /* @__PURE__ */ jsx15("dt", { children: "Method" }),
5793
- /* @__PURE__ */ jsx15("dd", { children: payment.method.toUpperCase() })
6355
+ /* @__PURE__ */ jsxs18("div", { children: [
6356
+ /* @__PURE__ */ jsx18("dt", { children: "Method" }),
6357
+ /* @__PURE__ */ jsx18("dd", { children: payment.method.toUpperCase() })
5794
6358
  ] }),
5795
- /* @__PURE__ */ jsxs15("div", { children: [
5796
- /* @__PURE__ */ jsx15("dt", { children: "Reference" }),
5797
- /* @__PURE__ */ jsx15("dd", { children: payment.checkNumber || "\u2014" })
6359
+ /* @__PURE__ */ jsxs18("div", { children: [
6360
+ /* @__PURE__ */ jsx18("dt", { children: "Reference" }),
6361
+ /* @__PURE__ */ jsx18("dd", { children: payment.checkNumber || "\u2014" })
5798
6362
  ] }),
5799
- /* @__PURE__ */ jsxs15("div", { children: [
5800
- /* @__PURE__ */ jsx15("dt", { children: "Effective date" }),
5801
- /* @__PURE__ */ jsx15("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
6363
+ /* @__PURE__ */ jsxs18("div", { children: [
6364
+ /* @__PURE__ */ jsx18("dt", { children: "Effective date" }),
6365
+ /* @__PURE__ */ jsx18("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
5802
6366
  ] }),
5803
- /* @__PURE__ */ jsxs15("div", { children: [
5804
- /* @__PURE__ */ jsx15("dt", { children: "Deposit date" }),
5805
- /* @__PURE__ */ jsx15("dd", { children: payment.depositDate || "Not recorded" })
6367
+ /* @__PURE__ */ jsxs18("div", { children: [
6368
+ /* @__PURE__ */ jsx18("dt", { children: "Deposit date" }),
6369
+ /* @__PURE__ */ jsx18("dd", { children: payment.depositDate || "Not recorded" })
5806
6370
  ] }),
5807
- /* @__PURE__ */ jsxs15("div", { children: [
5808
- /* @__PURE__ */ jsx15("dt", { children: "Posted" }),
5809
- /* @__PURE__ */ jsxs15("dd", { children: [
6371
+ /* @__PURE__ */ jsxs18("div", { children: [
6372
+ /* @__PURE__ */ jsx18("dt", { children: "Posted" }),
6373
+ /* @__PURE__ */ jsxs18("dd", { children: [
5810
6374
  defaultFormatDate(payment.postedAt),
5811
6375
  " \xB7 ",
5812
6376
  payment.source.toUpperCase()
5813
6377
  ] })
5814
6378
  ] }),
5815
- /* @__PURE__ */ jsxs15("div", { children: [
5816
- /* @__PURE__ */ jsx15("dt", { children: "Status" }),
5817
- /* @__PURE__ */ jsx15("dd", { children: humanize(payment.status || "posted") })
6379
+ /* @__PURE__ */ jsxs18("div", { children: [
6380
+ /* @__PURE__ */ jsx18("dt", { children: "Status" }),
6381
+ /* @__PURE__ */ jsx18("dd", { children: humanize(payment.status || "posted") })
5818
6382
  ] })
5819
6383
  ] }),
5820
- payment.feeReason ? /* @__PURE__ */ jsx15("p", { children: payment.feeReason }) : null,
5821
- payment.note ? /* @__PURE__ */ jsx15("p", { children: payment.note }) : null
6384
+ payment.feeReason ? /* @__PURE__ */ jsx18("p", { children: payment.feeReason }) : null,
6385
+ payment.note ? /* @__PURE__ */ jsx18("p", { children: payment.note }) : null
5822
6386
  ] }, payment.id);
5823
6387
  }) })
5824
6388
  ] });
@@ -5867,6 +6431,7 @@ var lifecycleSurfaceStyles = `
5867
6431
  .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}
5868
6432
  .mb-history-due dt{font-weight:750}.mb-history-due dd{margin:0}
5869
6433
  .mb-history-text{margin:8px 0 0;color:var(--mb-text);white-space:pre-wrap}
6434
+ @media(max-width:500px){.mb-eor-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-eor-metrics>div:nth-child(n){border-top:1px solid var(--mb-border);border-left:1px solid var(--mb-border)}.mb-eor-metrics>div:nth-child(-n+2){border-top:0}.mb-eor-metrics>div:nth-child(odd){border-left:0}.mb-eor-metrics dd{overflow-wrap:anywhere}}
5870
6435
  @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}}
5871
6436
  @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}}
5872
6437
  `;
@@ -5874,43 +6439,27 @@ var lifecycleSurfaceStyles = `
5874
6439
  // src/connected-bill-lifecycle.tsx
5875
6440
  import {
5876
6441
  useCallback as useCallback4,
5877
- useEffect as useEffect11,
5878
- useMemo as useMemo9,
5879
- useRef as useRef7,
5880
- useState as useState13
6442
+ useEffect as useEffect13,
6443
+ useMemo as useMemo10,
6444
+ useRef as useRef8,
6445
+ useState as useState16
5881
6446
  } from "react";
5882
6447
  import {
5883
- DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
5884
- DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2,
6448
+ DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL3,
6449
+ DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT3,
5885
6450
  createBillLifecycleClient,
5886
6451
  reportBillStatusContacts,
5887
6452
  secondReviewDeadline
5888
6453
  } from "@mindbill/browser";
5889
6454
 
5890
6455
  // src/second-review-form.tsx
5891
- import { useMemo as useMemo8, useState as useState12 } from "react";
6456
+ import { useMemo as useMemo9, useState as useState15 } from "react";
5892
6457
 
5893
6458
  // src/second-review-corrections.ts
5894
- function parseSecondReviewCorrection(draft) {
5895
- if (!draft.correctBilling) return void 0;
5896
- const units = Number(draft.units);
5897
- const charge = Number(draft.charge);
5898
- const modifiers = draft.modifiers.trim().toUpperCase().split(/[\s,]+/).filter(Boolean);
5899
- if (!draft.units.trim() || !Number.isInteger(units) || units < 1 || units > 1e4) {
5900
- throw new Error("Corrected units must be a whole number from 1 to 10,000.");
5901
- }
5902
- if (modifiers.length > 4 || new Set(modifiers).size !== modifiers.length || modifiers.some((value) => !/^[A-Z0-9]{2}$/.test(value))) {
5903
- throw new Error("Enter up to four unique two-character modifiers, separated by commas. Leave blank to remove modifiers.");
5904
- }
5905
- if (!draft.charge.trim() || !Number.isFinite(charge) || charge < 0 || charge > 999999.99 || Math.abs(charge * 100 - Math.round(charge * 100)) > 1e-6) {
5906
- throw new Error("Enter the corrected charge in dollars and cents.");
5907
- }
5908
- if (!draft.chargeReviewed) throw new Error("Confirm that you reviewed the corrected charge. It is not recalculated automatically.");
5909
- return { units, modifiers, charge };
5910
- }
6459
+ import { parseSecondReviewCorrection } from "@mindbill/browser";
5911
6460
 
5912
6461
  // src/second-review-form.tsx
5913
- import { Fragment as Fragment13, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
6462
+ import { Fragment as Fragment14, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
5914
6463
  var SECOND_REVIEW_REASON_TEMPLATES = [
5915
6464
  {
5916
6465
  label: "Med-legal report denied",
@@ -5945,7 +6494,7 @@ var SECOND_REVIEW_REASON_TEMPLATES = [
5945
6494
  value: "This service was provided before the claims administrator accepted or denied liability and was authorized under California Labor Code section 5402(c). Please reprocess this service and issue payment."
5946
6495
  }
5947
6496
  ];
5948
- var css10 = `
6497
+ var css12 = `
5949
6498
  .mb-second-review{display:grid;gap:18px;padding:22px;color:var(--mb-text);font-family:var(--mb-font);background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow)}
5950
6499
  .mb-second-review *{box-sizing:border-box}.mb-second-review h3{margin:0;font-size:22px}.mb-second-review p{margin:4px 0 0;color:var(--mb-muted)}
5951
6500
  .mb-second-review-deadline{padding:12px 14px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-warning) 10%,var(--mb-surface));color:var(--mb-text)!important}
@@ -5958,7 +6507,7 @@ var css10 = `
5958
6507
  .mb-second-review-corrections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.mb-second-review-correction-note{font-size:13px}
5959
6508
  @media(max-width:680px){.mb-second-review{padding:16px}.mb-second-review-line-head{align-items:flex-start;flex-direction:column}.mb-second-review-metrics{flex-wrap:wrap}.mb-second-review-corrections{grid-template-columns:1fr}}
5960
6509
  `;
5961
- function money5(value) {
6510
+ function money6(value) {
5962
6511
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
5963
6512
  }
5964
6513
  function initialLineDrafts(data) {
@@ -5983,13 +6532,13 @@ function SecondReviewForm({
5983
6532
  onCancel,
5984
6533
  onSubmit
5985
6534
  }) {
5986
- const [lines, setLines] = useState12(() => initialLineDrafts(data));
5987
- const [attachmentIds, setAttachmentIds] = useState12(() => data.bill.attachments.map((attachment) => attachment.id));
5988
- const [uploads, setUploads] = useState12([]);
5989
- const [formError, setFormError] = useState12("");
5990
- const [preparing, setPreparing] = useState12(false);
5991
- const [delivery, setDelivery] = useState12(null);
5992
- const selectableLines = useMemo8(() => data.bill.lineItems.filter((line) => Boolean(line.id)), [data.bill.lineItems]);
6535
+ const [lines, setLines] = useState15(() => initialLineDrafts(data));
6536
+ const [attachmentIds, setAttachmentIds] = useState15(() => data.bill.attachments.map((attachment) => attachment.id));
6537
+ const [uploads, setUploads] = useState15([]);
6538
+ const [formError, setFormError] = useState15("");
6539
+ const [preparing, setPreparing] = useState15(false);
6540
+ const [delivery, setDelivery] = useState15(null);
6541
+ const selectableLines = useMemo9(() => data.bill.lineItems.filter((line) => Boolean(line.id)), [data.bill.lineItems]);
5993
6542
  const selected = selectableLines.filter((line) => lines[line.id]?.selected);
5994
6543
  const invalidReason = selected.some((line) => !lines[line.id]?.reason.trim());
5995
6544
  const correctionErrors = Object.fromEntries(selected.map((line) => {
@@ -6088,118 +6637,118 @@ function SecondReviewForm({
6088
6637
  setPreparing(false);
6089
6638
  }
6090
6639
  };
6091
- return /* @__PURE__ */ jsxs16(Fragment13, { children: [
6092
- /* @__PURE__ */ jsx16("style", { children: css10 }),
6093
- /* @__PURE__ */ jsxs16("section", { className: "mb-second-review", children: [
6094
- /* @__PURE__ */ jsxs16("div", { children: [
6095
- /* @__PURE__ */ jsx16("h3", { children: "Submit Second Review" }),
6096
- /* @__PURE__ */ jsx16("p", { children: "Select each disputed service and explain why it should be reconsidered." })
6640
+ return /* @__PURE__ */ jsxs19(Fragment14, { children: [
6641
+ /* @__PURE__ */ jsx19("style", { children: css12 }),
6642
+ /* @__PURE__ */ jsxs19("section", { className: "mb-second-review", children: [
6643
+ /* @__PURE__ */ jsxs19("div", { children: [
6644
+ /* @__PURE__ */ jsx19("h3", { children: "Submit Second Review" }),
6645
+ /* @__PURE__ */ jsx19("p", { children: "Select each disputed service and explain why it should be reconsidered." })
6097
6646
  ] }),
6098
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-template", children: [
6099
- /* @__PURE__ */ jsx16("span", { className: "mb-second-review-label", children: "Apply a saved reason to selected lines" }),
6100
- /* @__PURE__ */ jsxs16("select", { className: "mb-second-review-select", defaultValue: "", onChange: (event) => {
6647
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-template", children: [
6648
+ /* @__PURE__ */ jsx19("span", { className: "mb-second-review-label", children: "Apply a saved reason to selected lines" }),
6649
+ /* @__PURE__ */ jsxs19("select", { className: "mb-second-review-select", defaultValue: "", onChange: (event) => {
6101
6650
  applyTemplate(event.target.value);
6102
6651
  event.target.value = "";
6103
6652
  }, children: [
6104
- /* @__PURE__ */ jsx16("option", { value: "", children: "Choose a reason template (optional)" }),
6105
- SECOND_REVIEW_REASON_TEMPLATES.map((template) => /* @__PURE__ */ jsx16("option", { value: template.value, children: template.label }, template.label))
6653
+ /* @__PURE__ */ jsx19("option", { value: "", children: "Choose a reason template (optional)" }),
6654
+ SECOND_REVIEW_REASON_TEMPLATES.map((template) => /* @__PURE__ */ jsx19("option", { value: template.value, children: template.label }, template.label))
6106
6655
  ] })
6107
6656
  ] }),
6108
- /* @__PURE__ */ jsxs16("section", { className: "mb-second-review-lines", "aria-label": "Service lines in dispute", children: [
6657
+ /* @__PURE__ */ jsxs19("section", { className: "mb-second-review-lines", "aria-label": "Service lines in dispute", children: [
6109
6658
  selectableLines.map((line) => {
6110
6659
  const draft = lines[line.id];
6111
- return /* @__PURE__ */ jsxs16("article", { className: "mb-second-review-line", "data-selected": draft?.selected, children: [
6112
- /* @__PURE__ */ jsxs16("div", { className: "mb-second-review-line-head", children: [
6113
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-check", children: [
6114
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: Boolean(draft?.selected), onChange: (event) => patchLine(line.id, { selected: event.target.checked }) }),
6115
- /* @__PURE__ */ jsxs16("span", { children: [
6660
+ return /* @__PURE__ */ jsxs19("article", { className: "mb-second-review-line", "data-selected": draft?.selected, children: [
6661
+ /* @__PURE__ */ jsxs19("div", { className: "mb-second-review-line-head", children: [
6662
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-check", children: [
6663
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", checked: Boolean(draft?.selected), onChange: (event) => patchLine(line.id, { selected: event.target.checked }) }),
6664
+ /* @__PURE__ */ jsxs19("span", { children: [
6116
6665
  line.code,
6117
6666
  line.modifiers.length ? `-${line.modifiers.join("-")}` : ""
6118
6667
  ] })
6119
6668
  ] }),
6120
- /* @__PURE__ */ jsxs16("span", { className: "mb-second-review-metrics", children: [
6121
- /* @__PURE__ */ jsxs16("span", { children: [
6669
+ /* @__PURE__ */ jsxs19("span", { className: "mb-second-review-metrics", children: [
6670
+ /* @__PURE__ */ jsxs19("span", { children: [
6122
6671
  line.units,
6123
6672
  " unit",
6124
6673
  line.units === 1 ? "" : "s"
6125
6674
  ] }),
6126
- /* @__PURE__ */ jsx16("span", { children: money5(line.charge) })
6675
+ /* @__PURE__ */ jsx19("span", { children: money6(line.charge) })
6127
6676
  ] })
6128
6677
  ] }),
6129
- draft?.selected ? /* @__PURE__ */ jsxs16(Fragment13, { children: [
6130
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-field", children: [
6131
- /* @__PURE__ */ jsx16("span", { className: "mb-second-review-label", children: "Reason for requesting Second Review" }),
6132
- /* @__PURE__ */ jsx16("textarea", { className: "mb-second-review-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
6678
+ draft?.selected ? /* @__PURE__ */ jsxs19(Fragment14, { children: [
6679
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-field", children: [
6680
+ /* @__PURE__ */ jsx19("span", { className: "mb-second-review-label", children: "Reason for requesting Second Review" }),
6681
+ /* @__PURE__ */ jsx19("textarea", { className: "mb-second-review-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
6133
6682
  ] }),
6134
- /* @__PURE__ */ jsxs16("div", { className: "mb-second-review-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
6135
- /* @__PURE__ */ jsx16("strong", { children: "Service/Good Authorized?" }),
6136
- [["yes", "Yes"], ["no", "No"], ["", "Not specified"]].map(([value, label]) => /* @__PURE__ */ jsxs16("label", { children: [
6137
- /* @__PURE__ */ jsx16("input", { type: "radio", name: `authorized-${line.id}`, checked: draft.serviceAuthorized === value, onChange: () => patchLine(line.id, { serviceAuthorized: value }) }),
6683
+ /* @__PURE__ */ jsxs19("div", { className: "mb-second-review-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
6684
+ /* @__PURE__ */ jsx19("strong", { children: "Service/Good Authorized?" }),
6685
+ [["yes", "Yes"], ["no", "No"], ["", "Not specified"]].map(([value, label]) => /* @__PURE__ */ jsxs19("label", { children: [
6686
+ /* @__PURE__ */ jsx19("input", { type: "radio", name: `authorized-${line.id}`, checked: draft.serviceAuthorized === value, onChange: () => patchLine(line.id, { serviceAuthorized: value }) }),
6138
6687
  label
6139
6688
  ] }, label))
6140
6689
  ] })
6141
6690
  ] }) : null,
6142
- draft?.selected ? /* @__PURE__ */ jsxs16(Fragment13, { children: [
6143
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-check", children: [
6144
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.correctBilling, onChange: (event) => patchLine(line.id, { correctBilling: event.target.checked, chargeReviewed: false }) }),
6691
+ draft?.selected ? /* @__PURE__ */ jsxs19(Fragment14, { children: [
6692
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-check", children: [
6693
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", checked: draft.correctBilling, onChange: (event) => patchLine(line.id, { correctBilling: event.target.checked, chargeReviewed: false }) }),
6145
6694
  "Correct units or modifiers on this submission"
6146
6695
  ] }),
6147
- draft.correctBilling ? /* @__PURE__ */ jsxs16(Fragment13, { children: [
6148
- /* @__PURE__ */ jsx16("p", { className: "mb-second-review-correction-note", children: "Earlier submissions stay unchanged. Review the charge explicitly; changing units or modifiers does not recalculate it." }),
6149
- /* @__PURE__ */ jsxs16("div", { className: "mb-second-review-corrections", children: [
6150
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-field", children: [
6151
- /* @__PURE__ */ jsx16("span", { className: "mb-second-review-label", children: "Corrected units" }),
6152
- /* @__PURE__ */ jsx16("input", { className: "mb-second-review-select", type: "number", min: "1", max: "10000", step: "1", value: draft.units, onChange: (event) => patchLine(line.id, { units: event.target.value, chargeReviewed: false }) })
6696
+ draft.correctBilling ? /* @__PURE__ */ jsxs19(Fragment14, { children: [
6697
+ /* @__PURE__ */ jsx19("p", { className: "mb-second-review-correction-note", children: "Earlier submissions stay unchanged. Review the charge explicitly; changing units or modifiers does not recalculate it." }),
6698
+ /* @__PURE__ */ jsxs19("div", { className: "mb-second-review-corrections", children: [
6699
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-field", children: [
6700
+ /* @__PURE__ */ jsx19("span", { className: "mb-second-review-label", children: "Corrected units" }),
6701
+ /* @__PURE__ */ jsx19("input", { className: "mb-second-review-select", type: "number", min: "1", max: "10000", step: "1", value: draft.units, onChange: (event) => patchLine(line.id, { units: event.target.value, chargeReviewed: false }) })
6153
6702
  ] }),
6154
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-field", children: [
6155
- /* @__PURE__ */ jsx16("span", { className: "mb-second-review-label", children: "Corrected modifiers" }),
6156
- /* @__PURE__ */ jsx16("input", { className: "mb-second-review-select", placeholder: "95, 93 \u2014 or leave blank", value: draft.modifiers, onChange: (event) => patchLine(line.id, { modifiers: event.target.value, chargeReviewed: false }) })
6703
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-field", children: [
6704
+ /* @__PURE__ */ jsx19("span", { className: "mb-second-review-label", children: "Corrected modifiers" }),
6705
+ /* @__PURE__ */ jsx19("input", { className: "mb-second-review-select", placeholder: "95, 93 \u2014 or leave blank", value: draft.modifiers, onChange: (event) => patchLine(line.id, { modifiers: event.target.value, chargeReviewed: false }) })
6157
6706
  ] }),
6158
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-field", children: [
6159
- /* @__PURE__ */ jsx16("span", { className: "mb-second-review-label", children: "Corrected charge ($)" }),
6160
- /* @__PURE__ */ jsx16("input", { className: "mb-second-review-select", type: "number", min: "0", max: "999999.99", step: "0.01", value: draft.charge, onChange: (event) => patchLine(line.id, { charge: event.target.value, chargeReviewed: false }) })
6707
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-field", children: [
6708
+ /* @__PURE__ */ jsx19("span", { className: "mb-second-review-label", children: "Corrected charge ($)" }),
6709
+ /* @__PURE__ */ jsx19("input", { className: "mb-second-review-select", type: "number", min: "0", max: "999999.99", step: "0.01", value: draft.charge, onChange: (event) => patchLine(line.id, { charge: event.target.value, chargeReviewed: false }) })
6161
6710
  ] })
6162
6711
  ] }),
6163
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-check", children: [
6164
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.chargeReviewed, onChange: (event) => patchLine(line.id, { chargeReviewed: event.target.checked }) }),
6712
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-check", children: [
6713
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", checked: draft.chargeReviewed, onChange: (event) => patchLine(line.id, { chargeReviewed: event.target.checked }) }),
6165
6714
  "I reviewed the corrected charge"
6166
6715
  ] }),
6167
- correctionErrors[line.id] ? /* @__PURE__ */ jsx16("p", { className: "mb-second-review-correction-note", role: "status", children: correctionErrors[line.id] }) : null
6716
+ correctionErrors[line.id] ? /* @__PURE__ */ jsx19("p", { className: "mb-second-review-correction-note", role: "status", children: correctionErrors[line.id] }) : null
6168
6717
  ] }) : null
6169
6718
  ] }) : null
6170
6719
  ] }, line.id);
6171
6720
  }),
6172
- !selectableLines.length ? /* @__PURE__ */ jsx16("div", { className: "mb-second-review-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
6721
+ !selectableLines.length ? /* @__PURE__ */ jsx19("div", { className: "mb-second-review-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
6173
6722
  ] }),
6174
- /* @__PURE__ */ jsxs16("fieldset", { className: "mb-second-review-packet", children: [
6175
- /* @__PURE__ */ jsx16("legend", { children: "Supporting packet" }),
6176
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-document", children: [
6177
- /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: attachmentIds.includes(attachment.id), onChange: (event) => setAttachmentIds((current) => event.target.checked ? [...current, attachment.id] : current.filter((id) => id !== attachment.id)) }),
6178
- /* @__PURE__ */ jsxs16("span", { children: [
6179
- /* @__PURE__ */ jsx16("strong", { children: attachment.filename }),
6180
- /* @__PURE__ */ jsx16("small", { children: attachment.description || attachment.documentType })
6723
+ /* @__PURE__ */ jsxs19("fieldset", { className: "mb-second-review-packet", children: [
6724
+ /* @__PURE__ */ jsx19("legend", { children: "Supporting packet" }),
6725
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-document", children: [
6726
+ /* @__PURE__ */ jsx19("input", { type: "checkbox", checked: attachmentIds.includes(attachment.id), onChange: (event) => setAttachmentIds((current) => event.target.checked ? [...current, attachment.id] : current.filter((id) => id !== attachment.id)) }),
6727
+ /* @__PURE__ */ jsxs19("span", { children: [
6728
+ /* @__PURE__ */ jsx19("strong", { children: attachment.filename }),
6729
+ /* @__PURE__ */ jsx19("small", { children: attachment.description || attachment.documentType })
6181
6730
  ] }),
6182
- /* @__PURE__ */ jsx16("button", { className: "mb-second-review-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
6731
+ /* @__PURE__ */ jsx19("button", { className: "mb-second-review-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
6183
6732
  ] }, attachment.id)),
6184
- /* @__PURE__ */ jsxs16("label", { className: "mb-second-review-upload", children: [
6185
- /* @__PURE__ */ jsx16("input", { type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: addUploads }),
6186
- /* @__PURE__ */ jsxs16("span", { children: [
6187
- /* @__PURE__ */ jsx16("strong", { children: "Choose one or more PDF files" }),
6733
+ /* @__PURE__ */ jsxs19("label", { className: "mb-second-review-upload", children: [
6734
+ /* @__PURE__ */ jsx19("input", { type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: addUploads }),
6735
+ /* @__PURE__ */ jsxs19("span", { children: [
6736
+ /* @__PURE__ */ jsx19("strong", { children: "Choose one or more PDF files" }),
6188
6737
  " to attach"
6189
6738
  ] })
6190
6739
  ] }),
6191
- uploads.map((upload, index) => /* @__PURE__ */ jsxs16("div", { className: "mb-second-review-uploaded", children: [
6192
- /* @__PURE__ */ jsx16("span", { children: upload.file.name }),
6193
- /* @__PURE__ */ jsx16("button", { className: "mb-second-review-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
6740
+ uploads.map((upload, index) => /* @__PURE__ */ jsxs19("div", { className: "mb-second-review-uploaded", children: [
6741
+ /* @__PURE__ */ jsx19("span", { children: upload.file.name }),
6742
+ /* @__PURE__ */ jsx19("button", { className: "mb-second-review-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
6194
6743
  ] }, `${upload.file.name}-${index}`))
6195
6744
  ] }),
6196
- formError || error?.message ? /* @__PURE__ */ jsx16("div", { className: "mb-second-review-error", role: "alert", children: formError || error?.message }) : null,
6197
- /* @__PURE__ */ jsxs16("div", { className: "mb-second-review-actions", children: [
6198
- /* @__PURE__ */ jsx16("button", { className: "mb-second-review-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
6199
- /* @__PURE__ */ jsx16("button", { className: "mb-second-review-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason || invalidCorrection, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
6745
+ formError || error?.message ? /* @__PURE__ */ jsx19("div", { className: "mb-second-review-error", role: "alert", children: formError || error?.message }) : null,
6746
+ /* @__PURE__ */ jsxs19("div", { className: "mb-second-review-actions", children: [
6747
+ /* @__PURE__ */ jsx19("button", { className: "mb-second-review-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
6748
+ /* @__PURE__ */ jsx19("button", { className: "mb-second-review-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason || invalidCorrection, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
6200
6749
  ] })
6201
6750
  ] }),
6202
- delivery ? /* @__PURE__ */ jsx16(SendRouteDialog, { title: "Confirm Second Review delivery", delivery, submitting: submitting || preparing, error: formError || error?.message || null, onCancel: () => setDelivery(null), onConfirm: (route) => void submit(route) }) : null
6751
+ delivery ? /* @__PURE__ */ jsx19(SendRouteDialog, { title: "Confirm Second Review delivery", delivery, submitting: submitting || preparing, error: formError || error?.message || null, onCancel: () => setDelivery(null), onConfirm: (route) => void submit(route) }) : null
6203
6752
  ] });
6204
6753
  }
6205
6754
 
@@ -6211,7 +6760,7 @@ import {
6211
6760
  reportBillStatusContacts as reportBillStatusContacts2,
6212
6761
  secondReviewDeadline as secondReviewDeadline2
6213
6762
  } from "@mindbill/browser";
6214
- import { Fragment as Fragment14, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
6763
+ import { Fragment as Fragment15, jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
6215
6764
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
6216
6765
  function billTeamNotes(data) {
6217
6766
  const notes = data.notes ?? [];
@@ -6252,32 +6801,32 @@ async function openPdfFromUserGesture(loadPdf) {
6252
6801
  }
6253
6802
  function useBillLifecycle({
6254
6803
  billId: providedBillId,
6255
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
6804
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT3,
6256
6805
  getSession,
6257
- apiBaseUrl = DEFAULT_API_BASE_URL2,
6806
+ apiBaseUrl = DEFAULT_API_BASE_URL3,
6258
6807
  refreshInterval = DEFAULT_REFRESH_INTERVAL2,
6259
6808
  enabled = true,
6260
6809
  fetch: fetchOverride
6261
6810
  }) {
6262
- const [data, setData] = useState13(null);
6263
- const [error, setError] = useState13(null);
6264
- const [isLoading, setIsLoading] = useState13(enabled);
6265
- const [isRefreshing, setIsRefreshing] = useState13(false);
6266
- const [isMutating, setIsMutating] = useState13(false);
6267
- const mounted = useRef7(true);
6268
- const client = useMemo9(() => createBillLifecycleClient({
6811
+ const [data, setData] = useState16(null);
6812
+ const [error, setError] = useState16(null);
6813
+ const [isLoading, setIsLoading] = useState16(enabled);
6814
+ const [isRefreshing, setIsRefreshing] = useState16(false);
6815
+ const [isMutating, setIsMutating] = useState16(false);
6816
+ const mounted = useRef8(true);
6817
+ const client = useMemo10(() => createBillLifecycleClient({
6269
6818
  billId: providedBillId,
6270
6819
  sessionEndpoint,
6271
6820
  getSession,
6272
6821
  apiBaseUrl,
6273
6822
  fetch: fetchOverride
6274
6823
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
6275
- useEffect11(() => {
6824
+ useEffect13(() => {
6276
6825
  setData(null);
6277
6826
  setError(null);
6278
6827
  setIsLoading(enabled);
6279
6828
  }, [enabled, providedBillId]);
6280
- useEffect11(() => {
6829
+ useEffect13(() => {
6281
6830
  mounted.current = true;
6282
6831
  return () => {
6283
6832
  mounted.current = false;
@@ -6301,7 +6850,7 @@ function useBillLifecycle({
6301
6850
  }
6302
6851
  }
6303
6852
  }, [client, enabled]);
6304
- useEffect11(() => {
6853
+ useEffect13(() => {
6305
6854
  if (!enabled) return;
6306
6855
  void refresh();
6307
6856
  const interval = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -6343,6 +6892,35 @@ function useBillLifecycle({
6343
6892
  throw nextError;
6344
6893
  }
6345
6894
  }, [client]);
6895
+ const downloadSubmissionArtifact = useCallback4(async (attemptId, artifactId, label) => {
6896
+ setError(null);
6897
+ try {
6898
+ const blob = await client.getSubmissionArtifact(attemptId, artifactId);
6899
+ const url = URL.createObjectURL(blob);
6900
+ const link = document.createElement("a");
6901
+ link.href = url;
6902
+ link.download = label.replace(/[\\/]/g, "_");
6903
+ link.click();
6904
+ setTimeout(() => URL.revokeObjectURL(url), 6e4);
6905
+ } catch (cause) {
6906
+ const nextError = cause instanceof Error ? cause : new Error("Submission file could not be downloaded.");
6907
+ if (mounted.current) setError(nextError);
6908
+ throw nextError;
6909
+ }
6910
+ }, [client]);
6911
+ const downloadIbrPacket = useCallback4(async () => {
6912
+ setError(null);
6913
+ setIsMutating(true);
6914
+ try {
6915
+ await openPdfFromUserGesture(() => client.prepareIbrPacket());
6916
+ } catch (cause) {
6917
+ const nextError = cause instanceof Error ? cause : new Error("IBR packet could not be prepared.");
6918
+ if (mounted.current) setError(nextError);
6919
+ throw nextError;
6920
+ } finally {
6921
+ if (mounted.current) setIsMutating(false);
6922
+ }
6923
+ }, [client]);
6346
6924
  return {
6347
6925
  billId: providedBillId,
6348
6926
  data,
@@ -6358,6 +6936,8 @@ function useBillLifecycle({
6358
6936
  openAttachment,
6359
6937
  openEor,
6360
6938
  downloadPacket,
6939
+ downloadSubmissionArtifact,
6940
+ downloadIbrPacket,
6361
6941
  addNote: (input) => mutate(() => client.addNote(input)),
6362
6942
  previewCourtesyCopy: (input) => client.previewCourtesyCopy(input),
6363
6943
  sendCourtesyCopy: (input, key) => client.sendCourtesyCopy(input, key),
@@ -6373,10 +6953,10 @@ function useBillLifecycle({
6373
6953
  };
6374
6954
  }
6375
6955
  function LifecycleDialog({ children, title, wide = false, onClose }) {
6376
- const dialog = useRef7(null);
6377
- const onCloseRef = useRef7(onClose);
6956
+ const dialog = useRef8(null);
6957
+ const onCloseRef = useRef8(onClose);
6378
6958
  onCloseRef.current = onClose;
6379
- useEffect11(() => {
6959
+ useEffect13(() => {
6380
6960
  const previous = document.activeElement;
6381
6961
  dialog.current?.focus();
6382
6962
  const onKeyDown = (event) => event.key === "Escape" && onCloseRef.current();
@@ -6386,8 +6966,8 @@ function LifecycleDialog({ children, title, wide = false, onClose }) {
6386
6966
  previous?.focus();
6387
6967
  };
6388
6968
  }, []);
6389
- return /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs17("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
6390
- /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
6969
+ return /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs20("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
6970
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
6391
6971
  children
6392
6972
  ] }) });
6393
6973
  }
@@ -6426,22 +7006,22 @@ function correctionRejectionSummary(rejection) {
6426
7006
  function CorrectionRejectionReason({ rejection }) {
6427
7007
  const summary = correctionRejectionSummary(rejection);
6428
7008
  const details = rejection.issues?.filter((issue) => issue.description.trim() !== summary.description || Boolean(issue.code?.trim() && issue.code.trim() !== summary.code)) ?? [];
6429
- return /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-correction-reason", role: "alert", children: [
6430
- summary.code ? /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-correction-reason-code", children: [
6431
- /* @__PURE__ */ jsx17("span", { children: "Rejection code" }),
6432
- /* @__PURE__ */ jsx17("code", { children: summary.code }),
6433
- summary.clearinghouseDetail ? /* @__PURE__ */ jsxs17("small", { children: [
6434
- /* @__PURE__ */ jsx17("span", { children: "Clearinghouse detail" }),
7009
+ return /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-correction-reason", role: "alert", children: [
7010
+ summary.code ? /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-correction-reason-code", children: [
7011
+ /* @__PURE__ */ jsx20("span", { children: "Rejection code" }),
7012
+ /* @__PURE__ */ jsx20("code", { children: summary.code }),
7013
+ summary.clearinghouseDetail ? /* @__PURE__ */ jsxs20("small", { children: [
7014
+ /* @__PURE__ */ jsx20("span", { children: "Clearinghouse detail" }),
6435
7015
  summary.clearinghouseDetail
6436
7016
  ] }) : null
6437
7017
  ] }) : null,
6438
- /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-correction-reason-description", children: [
6439
- /* @__PURE__ */ jsx17("span", { children: "Reason" }),
6440
- /* @__PURE__ */ jsx17("strong", { children: summary.description })
7018
+ /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-correction-reason-description", children: [
7019
+ /* @__PURE__ */ jsx20("span", { children: "Reason" }),
7020
+ /* @__PURE__ */ jsx20("strong", { children: summary.description })
6441
7021
  ] }),
6442
- details.length ? /* @__PURE__ */ jsx17("ul", { "aria-label": "Additional rejection details", children: details.map((issue, index) => /* @__PURE__ */ jsxs17("li", { children: [
6443
- issue.code ? /* @__PURE__ */ jsx17("code", { children: issue.code }) : null,
6444
- /* @__PURE__ */ jsx17("span", { children: issue.description })
7022
+ details.length ? /* @__PURE__ */ jsx20("ul", { "aria-label": "Additional rejection details", children: details.map((issue, index) => /* @__PURE__ */ jsxs20("li", { children: [
7023
+ issue.code ? /* @__PURE__ */ jsx20("code", { children: issue.code }) : null,
7024
+ /* @__PURE__ */ jsx20("span", { children: issue.description })
6445
7025
  ] }, `${issue.code || "issue"}-${index}`)) }) : null
6446
7026
  ] });
6447
7027
  }
@@ -6482,16 +7062,16 @@ function CorrectionVerificationContact({ delivery }) {
6482
7062
  { label: "Mail", values: mailingAddresses }
6483
7063
  ].filter((method) => method.values.length);
6484
7064
  if (!methods.length) return null;
6485
- return /* @__PURE__ */ jsxs17("aside", { className: "mb-lifecycle-correction-contact", children: [
6486
- /* @__PURE__ */ jsx17("strong", { children: "Need to verify the rejected information?" }),
6487
- /* @__PURE__ */ jsxs17("span", { children: [
7065
+ return /* @__PURE__ */ jsxs20("aside", { className: "mb-lifecycle-correction-contact", children: [
7066
+ /* @__PURE__ */ jsx20("strong", { children: "Need to verify the rejected information?" }),
7067
+ /* @__PURE__ */ jsxs20("span", { children: [
6488
7068
  "Contact ",
6489
7069
  delivery.payerName,
6490
7070
  " using any available method:"
6491
7071
  ] }),
6492
- /* @__PURE__ */ jsx17("dl", { children: methods.map((method) => /* @__PURE__ */ jsxs17("div", { children: [
6493
- /* @__PURE__ */ jsx17("dt", { children: method.label }),
6494
- /* @__PURE__ */ jsx17("dd", { children: /* @__PURE__ */ jsx17("ul", { children: method.values.map((value) => /* @__PURE__ */ jsx17("li", { children: method.href ? /* @__PURE__ */ jsx17("a", { href: method.href(value), ...method.label === "Portal" ? { target: "_blank", rel: "noreferrer" } : {}, children: value }) : value }, value)) }) })
7072
+ /* @__PURE__ */ jsx20("dl", { children: methods.map((method) => /* @__PURE__ */ jsxs20("div", { children: [
7073
+ /* @__PURE__ */ jsx20("dt", { children: method.label }),
7074
+ /* @__PURE__ */ jsx20("dd", { children: /* @__PURE__ */ jsx20("ul", { children: method.values.map((value) => /* @__PURE__ */ jsx20("li", { children: method.href ? /* @__PURE__ */ jsx20("a", { href: method.href(value), ...method.label === "Portal" ? { target: "_blank", rel: "noreferrer" } : {}, children: value }) : value }, value)) }) })
6495
7075
  ] }, method.label)) })
6496
7076
  ] });
6497
7077
  }
@@ -6585,6 +7165,7 @@ function actionPanel(action) {
6585
7165
  if (action.id === "resubmit") return "resubmit";
6586
7166
  if (action.id === "submit_new_bill") return "submit_new_bill";
6587
7167
  if (action.id === "second_review") return "second_review";
7168
+ if (action.id === "independent_bill_review") return "ibr";
6588
7169
  if (action.id === "post_payment") return "payment";
6589
7170
  if (action.id === "close") return "close";
6590
7171
  if (action.id === "reopen") return "reopen";
@@ -6609,24 +7190,24 @@ function shouldShowSandboxControls(environment, enabled = false) {
6609
7190
  function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint, claimsAdministratorSources, courtesyCopyRecipientOptions: courtesyCopyRecipientOptions2 = [], sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
6610
7191
  const lifecycle = useBillLifecycle(options);
6611
7192
  const { data } = lifecycle;
6612
- const [tab, setTab] = useState13("details");
6613
- const [selectedSubmissionId, setSelectedSubmissionId] = useState13();
6614
- const [panel, setPanel] = useState13("");
6615
- const [notice, setNotice] = useState13("");
6616
- const [note, setNote] = useState13("");
6617
- const [reason, setReason] = useState13("");
6618
- const [correctionError, setCorrectionError] = useState13("");
6619
- const [newBillError, setNewBillError] = useState13("");
6620
- const [payment, setPayment] = useState13({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
6621
- const [duplicateError, setDuplicateError] = useState13("");
7193
+ const [tab, setTab] = useState16("details");
7194
+ const [selectedSubmissionId, setSelectedSubmissionId] = useState16();
7195
+ const [panel, setPanel] = useState16("");
7196
+ const [notice, setNotice] = useState16("");
7197
+ const [note, setNote] = useState16("");
7198
+ const [reason, setReason] = useState16("");
7199
+ const [correctionError, setCorrectionError] = useState16("");
7200
+ const [newBillError, setNewBillError] = useState16("");
7201
+ const [payment, setPayment] = useState16({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
7202
+ const [duplicateError, setDuplicateError] = useState16("");
6622
7203
  const currentAttemptKey = data?.attempts?.find((attempt) => attempt.isCurrent)?.id ?? data?.history?.filter((entry) => entry.kind === "submission").at(-1)?.id ?? data?.bill.id;
6623
- useEffect11(() => {
7204
+ useEffect13(() => {
6624
7205
  setPanel("");
6625
7206
  }, [currentAttemptKey]);
6626
7207
  const actor = actorName?.trim() ? { actorName: actorName.trim() } : {};
6627
- const lastData = useRef7(null);
6628
- const correctionInitialBill = useMemo9(() => data ? correctionBill(data) : null, [data]);
6629
- const correctionAttachments = useMemo9(() => data ? data.bill.attachments.map((attachment) => {
7208
+ const lastData = useRef8(null);
7209
+ const correctionInitialBill = useMemo10(() => data ? correctionBill(data) : null, [data]);
7210
+ const correctionAttachments = useMemo10(() => data ? data.bill.attachments.map((attachment) => {
6630
7211
  const documentType = correctionDocumentType(attachment.documentType);
6631
7212
  const isW9 = documentType === "w9";
6632
7213
  return {
@@ -6639,8 +7220,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6639
7220
  ...isW9 ? { autoAttached: true, removable: false } : { removable: true }
6640
7221
  };
6641
7222
  }) : [], [data, lifecycle]);
6642
- const correctionAttentionFields = useMemo9(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
6643
- useEffect11(() => {
7223
+ const correctionAttentionFields = useMemo10(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
7224
+ useEffect13(() => {
6644
7225
  if (!data || data === lastData.current) return;
6645
7226
  lastData.current = data;
6646
7227
  onChanged?.(data);
@@ -6652,13 +7233,13 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6652
7233
  interestAmount: 0
6653
7234
  }));
6654
7235
  }, [data, onChanged]);
6655
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx17(Fragment14, { children: loadingFallback ?? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
7236
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx20(Fragment15, { children: loadingFallback ?? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
6656
7237
  if (!data) {
6657
7238
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
6658
- return /* @__PURE__ */ jsx17(Fragment14, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-error", role: "alert", children: [
6659
- /* @__PURE__ */ jsx17("strong", { children: "Billing is unavailable." }),
6660
- /* @__PURE__ */ jsx17("span", { children: error.message }),
6661
- /* @__PURE__ */ jsx17("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
7239
+ return /* @__PURE__ */ jsx20(Fragment15, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-error", role: "alert", children: [
7240
+ /* @__PURE__ */ jsx20("strong", { children: "Billing is unavailable." }),
7241
+ /* @__PURE__ */ jsx20("span", { children: error.message }),
7242
+ /* @__PURE__ */ jsx20("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
6662
7243
  ] }) });
6663
7244
  }
6664
7245
  const complete = async (message, task) => {
@@ -6765,7 +7346,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6765
7346
  setNotice("Duplicate bill sent.");
6766
7347
  };
6767
7348
  const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
6768
- const supportedActions = /* @__PURE__ */ new Set(["resubmit", "submit_new_bill", "second_review", "post_payment", "close", "reopen", "send_duplicate", "report_bill_status"]);
7349
+ const supportedActions = /* @__PURE__ */ new Set(["resubmit", "submit_new_bill", "second_review", "independent_bill_review", "post_payment", "close", "reopen", "send_duplicate", "report_bill_status"]);
6769
7350
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
6770
7351
  const mappedRibbonItems = data.history ? billSubmissionsRibbonFromHistory(data.history, data.attempts) : [];
6771
7352
  const activeSubmissionId = (mappedRibbonItems.some((item) => item.id === selectedSubmissionId) ? selectedSubmissionId : null) ?? mappedRibbonItems.find((item) => item.active)?.id ?? mappedRibbonItems[mappedRibbonItems.length - 1]?.id;
@@ -6781,111 +7362,121 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6781
7362
  const statusContacts = reportBillStatusContacts(data.delivery);
6782
7363
  const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
6783
7364
  const reviewDeadline = secondReviewDeadline(data.eors);
6784
- return /* @__PURE__ */ jsxs17("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
6785
- /* @__PURE__ */ jsx17("style", { children: CONNECTED_LIFECYCLE_STYLES }),
6786
- ribbonItems.length >= 2 ? /* @__PURE__ */ jsx17(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
7365
+ return /* @__PURE__ */ jsxs20("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
7366
+ /* @__PURE__ */ jsx20("style", { children: CONNECTED_LIFECYCLE_STYLES }),
7367
+ ribbonItems.length >= 2 ? /* @__PURE__ */ jsx20(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
6787
7368
  setSelectedSubmissionId(item.id);
6788
7369
  setTab("details");
6789
7370
  setPanel("");
6790
7371
  }, ...appearance ? { appearance } : {} }) : null,
6791
- historical ? null : data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx17(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx17(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
6792
- /* @__PURE__ */ jsxs17("header", { className: "mb-lifecycle-head", children: [
6793
- /* @__PURE__ */ jsxs17("div", { children: [
6794
- /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsx17("h2", { children: historical && !selectedAttempt ? "Previous submission" : `Bill #${historical ? selectedAttempt?.billNumber : data.bill.billNumber}` }) }),
6795
- /* @__PURE__ */ jsxs17("p", { children: [
7372
+ historical ? null : data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx20(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx20(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
7373
+ /* @__PURE__ */ jsxs20("header", { className: "mb-lifecycle-head", children: [
7374
+ /* @__PURE__ */ jsxs20("div", { children: [
7375
+ /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsx20("h2", { children: historical && !selectedAttempt ? "Previous submission" : `Bill #${historical ? selectedAttempt?.billNumber : data.bill.billNumber}` }) }),
7376
+ /* @__PURE__ */ jsxs20("p", { children: [
6796
7377
  displayedData ? `Claim ${displayedData.injury.claimNumber || "\u2014"}` : "Previous submission",
6797
7378
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
6798
7379
  ] })
6799
7380
  ] }),
6800
- !historical ? /* @__PURE__ */ jsxs17(Fragment14, { children: [
6801
- /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" }),
6802
- /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel("courtesy_copy"), children: "Forward copy" })
7381
+ !historical ? /* @__PURE__ */ jsxs20(Fragment15, { children: [
7382
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" }),
7383
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel("courtesy_copy"), children: "Forward copy" })
6803
7384
  ] }) : null
6804
7385
  ] }),
6805
- /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
6806
- /* @__PURE__ */ jsx17("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
6807
- /* @__PURE__ */ jsx17("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
7386
+ /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
7387
+ /* @__PURE__ */ jsx20("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
7388
+ /* @__PURE__ */ jsx20("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
6808
7389
  ] }),
6809
- tab === "details" ? /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
6810
- selectedAttempt && ribbonItems.length >= 2 ? /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-attempt-detail", "aria-label": "Selected submission detail", children: [
6811
- /* @__PURE__ */ jsxs17("header", { children: [
6812
- /* @__PURE__ */ jsxs17("div", { children: [
6813
- /* @__PURE__ */ jsx17("span", { children: "Selected submission" }),
6814
- /* @__PURE__ */ jsx17("h3", { children: selectedAttempt.label })
7390
+ tab === "details" ? /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
7391
+ selectedAttempt && ribbonItems.length >= 2 ? /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-attempt-detail", "aria-label": "Selected submission detail", children: [
7392
+ /* @__PURE__ */ jsxs20("header", { children: [
7393
+ /* @__PURE__ */ jsxs20("div", { children: [
7394
+ /* @__PURE__ */ jsx20("span", { children: "Selected submission" }),
7395
+ /* @__PURE__ */ jsx20("h3", { children: selectedAttempt.label })
6815
7396
  ] }),
6816
- /* @__PURE__ */ jsx17("strong", { children: selectedAttempt.isCurrent ? "Current" : "Previous" })
7397
+ /* @__PURE__ */ jsx20("strong", { children: selectedAttempt.isCurrent ? "Current" : "Previous" })
6817
7398
  ] }),
6818
- /* @__PURE__ */ jsxs17("dl", { children: [
6819
- /* @__PURE__ */ jsxs17("div", { children: [
6820
- /* @__PURE__ */ jsx17("dt", { children: "Bill" }),
6821
- /* @__PURE__ */ jsxs17("dd", { children: [
7399
+ /* @__PURE__ */ jsxs20("dl", { children: [
7400
+ /* @__PURE__ */ jsxs20("div", { children: [
7401
+ /* @__PURE__ */ jsx20("dt", { children: "Bill" }),
7402
+ /* @__PURE__ */ jsxs20("dd", { children: [
6822
7403
  "#",
6823
7404
  selectedAttempt.billNumber || data.bill.billNumber
6824
7405
  ] })
6825
7406
  ] }),
6826
- /* @__PURE__ */ jsxs17("div", { children: [
6827
- /* @__PURE__ */ jsx17("dt", { children: "Delivery" }),
6828
- /* @__PURE__ */ jsx17("dd", { children: selectedAttempt.deliveryLabel || "\u2014" })
7407
+ /* @__PURE__ */ jsxs20("div", { children: [
7408
+ /* @__PURE__ */ jsx20("dt", { children: "Delivery" }),
7409
+ /* @__PURE__ */ jsx20("dd", { children: selectedAttempt.deliveryLabel || "\u2014" })
6829
7410
  ] }),
6830
- /* @__PURE__ */ jsxs17("div", { children: [
6831
- /* @__PURE__ */ jsx17("dt", { children: "Sent" }),
6832
- /* @__PURE__ */ jsx17("dd", { children: selectedAttempt.sentAt ? new Date(selectedAttempt.sentAt).toLocaleString() : "\u2014" })
7411
+ /* @__PURE__ */ jsxs20("div", { children: [
7412
+ /* @__PURE__ */ jsx20("dt", { children: "Sent" }),
7413
+ /* @__PURE__ */ jsx20("dd", { children: selectedAttempt.sentAt ? new Date(selectedAttempt.sentAt).toLocaleString() : "\u2014" })
6833
7414
  ] }),
6834
- /* @__PURE__ */ jsxs17("div", { children: [
6835
- /* @__PURE__ */ jsx17("dt", { children: "Status" }),
6836
- /* @__PURE__ */ jsx17("dd", { children: selectedAttempt.status || selectedAttempt.ackLabel || "Submitted" })
7415
+ /* @__PURE__ */ jsxs20("div", { children: [
7416
+ /* @__PURE__ */ jsx20("dt", { children: "Status" }),
7417
+ /* @__PURE__ */ jsx20("dd", { children: selectedAttempt.status || selectedAttempt.ackLabel || "Submitted" })
6837
7418
  ] }),
6838
- selectedAttempt.complianceLabel ? /* @__PURE__ */ jsxs17("div", { children: [
6839
- /* @__PURE__ */ jsx17("dt", { children: selectedAttempt.complianceLabel }),
6840
- /* @__PURE__ */ jsx17("dd", { children: selectedAttempt.complianceAt ? new Date(selectedAttempt.complianceAt).toLocaleDateString() : "\u2014" })
7419
+ selectedAttempt.complianceLabel ? /* @__PURE__ */ jsxs20("div", { children: [
7420
+ /* @__PURE__ */ jsx20("dt", { children: selectedAttempt.complianceLabel }),
7421
+ /* @__PURE__ */ jsx20("dd", { children: selectedAttempt.complianceAt ? new Date(selectedAttempt.complianceAt).toLocaleDateString() : "\u2014" })
6841
7422
  ] }) : null
6842
7423
  ] })
6843
7424
  ] }) : null,
6844
- !historical && (data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state)) ? /* @__PURE__ */ jsx17(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
6845
- showSandboxControls ? /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
6846
- /* @__PURE__ */ jsxs17("div", { children: [
6847
- /* @__PURE__ */ jsx17("span", { children: "Sandbox demo controls" }),
6848
- /* @__PURE__ */ jsx17("h3", { children: "Simulate the next payer response" }),
6849
- /* @__PURE__ */ jsx17("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
7425
+ !historical && (data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state)) ? /* @__PURE__ */ jsx20(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
7426
+ showSandboxControls ? /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
7427
+ /* @__PURE__ */ jsxs20("div", { children: [
7428
+ /* @__PURE__ */ jsx20("span", { children: "Sandbox demo controls" }),
7429
+ /* @__PURE__ */ jsx20("h3", { children: "Simulate the next payer response" }),
7430
+ /* @__PURE__ */ jsx20("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
6850
7431
  ] }),
6851
- simulations.length ? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs17("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
6852
- /* @__PURE__ */ jsx17("strong", { children: scenario.label }),
6853
- /* @__PURE__ */ jsx17("span", { children: scenario.detail })
6854
- ] }, scenario.id)) }) : /* @__PURE__ */ jsx17("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
7432
+ simulations.length ? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs20("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
7433
+ /* @__PURE__ */ jsx20("strong", { children: scenario.label }),
7434
+ /* @__PURE__ */ jsx20("span", { children: scenario.detail })
7435
+ ] }, scenario.id)) }) : /* @__PURE__ */ jsx20("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
7436
+ ] }) : null,
7437
+ historical ? /* @__PURE__ */ jsx20("p", { className: "mb-lifecycle-card", children: selectedDetail?.source === "submission_snapshot" ? "Saved as submitted. This previous submission is read-only; payment balances and current actions are shown on the current bill." : displayedData ? "Historical bill record. An exact as-submitted snapshot was not recorded for this older attempt; these are the stored bill values, not a guaranteed copy of the original packet." : "Detailed values were not saved for this historical submission. Select the current submission to see the current bill. We will not substitute current data for this older attempt." }) : null,
7438
+ displayedData ? /* @__PURE__ */ jsx20(BillReadOnlyForm, { data: displayedData, ...!historical ? { onOpenAttachment: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }, activeSubmissionId) : null,
7439
+ historical && selectedAttempt ? /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-card", "aria-label": "Retained submission files", children: [
7440
+ /* @__PURE__ */ jsx20("h3", { children: "Retained submission files" }),
7441
+ /* @__PURE__ */ jsx20("p", { children: "Exact files saved for this submission. These downloads do not include a regenerated current bill or a later EOR." }),
7442
+ selectedDetail?.artifacts?.length ? selectedDetail.artifacts.map((artifact) => /* @__PURE__ */ jsxs20("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.downloadSubmissionArtifact(selectedAttempt.id, artifact.id, artifact.label).catch(() => void 0), children: [
7443
+ "Download ",
7444
+ artifact.kind === "submitted_edi" ? "submitted EDI" : "submitted attachment",
7445
+ ": ",
7446
+ artifact.label
7447
+ ] }, artifact.id)) : /* @__PURE__ */ jsx20("p", { children: "No retained files are available for this submission." })
6855
7448
  ] }) : null,
6856
- historical ? /* @__PURE__ */ jsx17("p", { className: "mb-lifecycle-card", children: selectedDetail?.source === "submission_snapshot" ? "Saved as submitted. This previous submission is read-only; payment balances and current actions are shown on the current bill." : displayedData ? "Historical bill record. An exact as-submitted snapshot was not recorded for this older attempt; these are the stored bill values, not a guaranteed copy of the original packet." : "Detailed values were not saved for this historical submission. Select the current submission to see the current bill. We will not substitute current data for this older attempt." }) : null,
6857
- displayedData ? /* @__PURE__ */ jsx17(BillReadOnlyForm, { data: displayedData, ...!historical ? { onOpenAttachment: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }, activeSubmissionId) : null,
6858
- !historical ? /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-notes", "aria-label": "Bill notes", children: [
6859
- /* @__PURE__ */ jsxs17("header", { children: [
6860
- /* @__PURE__ */ jsxs17("div", { children: [
6861
- /* @__PURE__ */ jsx17("h3", { children: "Team notes" }),
6862
- /* @__PURE__ */ jsx17("p", { children: "Shared with your workspace\u2019s billing team. Never sent to the payer." })
7449
+ !historical ? /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-notes", "aria-label": "Bill notes", children: [
7450
+ /* @__PURE__ */ jsxs20("header", { children: [
7451
+ /* @__PURE__ */ jsxs20("div", { children: [
7452
+ /* @__PURE__ */ jsx20("h3", { children: "Team notes" }),
7453
+ /* @__PURE__ */ jsx20("p", { children: "Shared with your workspace\u2019s billing team. Never sent to the payer." })
6863
7454
  ] }),
6864
- /* @__PURE__ */ jsx17("span", { children: billNotes.length })
7455
+ /* @__PURE__ */ jsx20("span", { children: billNotes.length })
6865
7456
  ] }),
6866
- billNotes.length ? /* @__PURE__ */ jsx17("ol", { children: billNotes.map((entry) => /* @__PURE__ */ jsxs17("li", { children: [
6867
- /* @__PURE__ */ jsx17("p", { children: entry.summary }),
6868
- /* @__PURE__ */ jsxs17("small", { children: [
7457
+ billNotes.length ? /* @__PURE__ */ jsx20("ol", { children: billNotes.map((entry) => /* @__PURE__ */ jsxs20("li", { children: [
7458
+ /* @__PURE__ */ jsx20("p", { children: entry.summary }),
7459
+ /* @__PURE__ */ jsxs20("small", { children: [
6869
7460
  entry.actor || "System",
6870
7461
  " \xB7 ",
6871
7462
  usDate(entry.date)
6872
7463
  ] })
6873
- ] }, entry.id)) }) : /* @__PURE__ */ jsx17("p", { className: "mb-lifecycle-notes-empty", children: "No notes yet." }),
6874
- /* @__PURE__ */ jsxs17("form", { onSubmit: (event) => {
7464
+ ] }, entry.id)) }) : /* @__PURE__ */ jsx20("p", { className: "mb-lifecycle-notes-empty", children: "No notes yet." }),
7465
+ /* @__PURE__ */ jsxs20("form", { onSubmit: (event) => {
6875
7466
  event.preventDefault();
6876
7467
  void addNote();
6877
7468
  }, children: [
6878
- /* @__PURE__ */ jsxs17("label", { children: [
6879
- /* @__PURE__ */ jsx17("span", { children: "Add a note" }),
6880
- /* @__PURE__ */ jsx17("textarea", { value: note, maxLength: 2e3, placeholder: "Add context for the billing team\u2026", onChange: (event) => setNote(event.target.value) })
7469
+ /* @__PURE__ */ jsxs20("label", { children: [
7470
+ /* @__PURE__ */ jsx20("span", { children: "Add a note" }),
7471
+ /* @__PURE__ */ jsx20("textarea", { value: note, maxLength: 2e3, placeholder: "Add context for the billing team\u2026", onChange: (event) => setNote(event.target.value) })
6881
7472
  ] }),
6882
- /* @__PURE__ */ jsx17("button", { type: "submit", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !note.trim(), children: lifecycle.isMutating ? "Adding\u2026" : "Add note" })
7473
+ /* @__PURE__ */ jsx20("button", { type: "submit", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !note.trim(), children: lifecycle.isMutating ? "Adding\u2026" : "Add note" })
6883
7474
  ] })
6884
7475
  ] }) : null
6885
- ] }) : /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx17(BillHistoryTable, { entries: data.history, ...!historical ? { onOpenDocument: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx17(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
6886
- !historical && (viewEor || actions.length) ? /* @__PURE__ */ jsxs17("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
6887
- viewEor && data.eors[0] ? /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
6888
- actions.map((action) => /* @__PURE__ */ jsx17("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
7476
+ ] }) : /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx20(BillHistoryTable, { entries: data.history, ...!historical ? { onOpenDocument: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx20(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
7477
+ !historical && (viewEor || actions.length) ? /* @__PURE__ */ jsxs20("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
7478
+ viewEor && data.eors[0] ? /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
7479
+ actions.map((action) => /* @__PURE__ */ jsx20("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
6889
7480
  const next = actionPanel(action);
6890
7481
  if (!next) return;
6891
7482
  if (next === "resubmit") setCorrectionError("");
@@ -6894,25 +7485,37 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6894
7485
  setPanel(next);
6895
7486
  }, children: action.label }, action.id))
6896
7487
  ] }) : null,
6897
- activePanel === "courtesy_copy" ? /* @__PURE__ */ jsx17(LifecycleDialog, { title: "Forward courtesy copy", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsx17(BillCourtesyCopyForm, { documents: data.bill.attachments, recipientOptions: courtesyCopyRecipientOptions2, subject: `Courtesy copy \u2014 bill #${data.bill.billNumber}`, environment: data.environment, onPreview: lifecycle.previewCourtesyCopy, onSend: lifecycle.sendCourtesyCopy, onSent: () => {
7488
+ activePanel === "courtesy_copy" ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: "Forward courtesy copy", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsx20(BillCourtesyCopyForm, { documents: data.bill.attachments, recipientOptions: courtesyCopyRecipientOptions2, subject: `Courtesy copy \u2014 bill #${data.bill.billNumber}`, environment: data.environment, onPreview: lifecycle.previewCourtesyCopy, onSend: lifecycle.sendCourtesyCopy, onSent: () => {
6898
7489
  void lifecycle.refresh();
6899
7490
  }, ...appearance ? { appearance } : {} }) }) : null,
6900
- activePanel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx17(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-correction", children: [
6901
- /* @__PURE__ */ jsx17("header", { children: /* @__PURE__ */ jsxs17("div", { children: [
6902
- /* @__PURE__ */ jsx17("h3", { children: "Correct and resubmit" }),
6903
- /* @__PURE__ */ jsx17("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
7491
+ activePanel === "ibr" ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: "Prepare Independent Bill Review packet", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-panel", children: [
7492
+ /* @__PURE__ */ jsx20("header", { style: { paddingRight: 44 }, children: /* @__PURE__ */ jsx20("h3", { children: "Prepare Independent Bill Review packet" }) }),
7493
+ /* @__PURE__ */ jsx20("p", { children: "Download a PDF packet for self-filing Independent Bill Review (IBR). Preparing this packet does not file the review, send it to a payer, or change the bill status." }),
7494
+ lifecycle.error ? /* @__PURE__ */ jsx20("p", { role: "alert", className: "mb-lifecycle-message error", children: lifecycle.error.message }) : null,
7495
+ /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-panel-actions", children: [
7496
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel(""), children: "Cancel" }),
7497
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadIbrPacket().then(() => {
7498
+ setPanel("");
7499
+ setNotice("IBR packet prepared for self-filing. The review has not been filed.");
7500
+ }).catch(() => void 0), children: lifecycle.isMutating ? "Preparing\u2026" : "Prepare IBR packet" })
7501
+ ] })
7502
+ ] }) }) : null,
7503
+ activePanel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-correction", children: [
7504
+ /* @__PURE__ */ jsx20("header", { children: /* @__PURE__ */ jsxs20("div", { children: [
7505
+ /* @__PURE__ */ jsx20("h3", { children: "Correct and resubmit" }),
7506
+ /* @__PURE__ */ jsx20("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
6904
7507
  ] }) }),
6905
- data.environment === "live" ? /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-live-warning", children: [
6906
- /* @__PURE__ */ jsx17("strong", { children: "Live clearinghouse submission" }),
6907
- /* @__PURE__ */ jsx17("span", { children: "Resubmitting sends a real bill. Confirm the corrected information before continuing." })
7508
+ data.environment === "live" ? /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-live-warning", children: [
7509
+ /* @__PURE__ */ jsx20("strong", { children: "Live clearinghouse submission" }),
7510
+ /* @__PURE__ */ jsx20("span", { children: "Resubmitting sends a real bill. Confirm the corrected information before continuing." })
6908
7511
  ] }) : null,
6909
- data.rejection ? /* @__PURE__ */ jsx17(CorrectionRejectionReason, { rejection: data.rejection }) : null,
6910
- /* @__PURE__ */ jsx17(CorrectionVerificationContact, { delivery: data.delivery }),
6911
- /* @__PURE__ */ jsxs17("label", { className: "mb-lifecycle-correction-note", children: [
6912
- /* @__PURE__ */ jsx17("span", { children: "Correction note (optional)" }),
6913
- /* @__PURE__ */ jsx17("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
7512
+ data.rejection ? /* @__PURE__ */ jsx20(CorrectionRejectionReason, { rejection: data.rejection }) : null,
7513
+ /* @__PURE__ */ jsx20(CorrectionVerificationContact, { delivery: data.delivery }),
7514
+ /* @__PURE__ */ jsxs20("label", { className: "mb-lifecycle-correction-note", children: [
7515
+ /* @__PURE__ */ jsx20("span", { children: "Correction note (optional)" }),
7516
+ /* @__PURE__ */ jsx20("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
6914
7517
  ] }),
6915
- /* @__PURE__ */ jsx17(
7518
+ /* @__PURE__ */ jsx20(
6916
7519
  BillSubmissionForm,
6917
7520
  {
6918
7521
  className: "mbsf-lifecycle-correction",
@@ -6938,18 +7541,18 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6938
7541
  ...appearance ? { appearance } : {}
6939
7542
  }
6940
7543
  ),
6941
- correctionError ? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
7544
+ correctionError ? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
6942
7545
  ] }) }) : null,
6943
- activePanel === "submit_new_bill" && correctionInitialBill ? /* @__PURE__ */ jsx17(LifecycleDialog, { title: "Submit New Bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-correction", children: [
6944
- /* @__PURE__ */ jsx17("header", { children: /* @__PURE__ */ jsxs17("div", { children: [
6945
- /* @__PURE__ */ jsx17("h3", { children: "Submit New Bill" }),
6946
- /* @__PURE__ */ jsx17("p", { children: "This closed bill stays closed and keeps its record. Review the carried-over snapshot below and submit a fresh bill \u2014 both bills stay linked in the submissions timeline." })
7546
+ activePanel === "submit_new_bill" && correctionInitialBill ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: "Submit New Bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-correction", children: [
7547
+ /* @__PURE__ */ jsx20("header", { children: /* @__PURE__ */ jsxs20("div", { children: [
7548
+ /* @__PURE__ */ jsx20("h3", { children: "Submit New Bill" }),
7549
+ /* @__PURE__ */ jsx20("p", { children: "This closed bill stays closed and keeps its record. Review the carried-over snapshot below and submit a fresh bill \u2014 both bills stay linked in the submissions timeline." })
6947
7550
  ] }) }),
6948
- /* @__PURE__ */ jsxs17("label", { className: "mb-lifecycle-correction-note", children: [
6949
- /* @__PURE__ */ jsx17("span", { children: "Submission note (optional)" }),
6950
- /* @__PURE__ */ jsx17("textarea", { value: reason, placeholder: "Why is a new bill being submitted?", onChange: (event) => setReason(event.target.value) })
7551
+ /* @__PURE__ */ jsxs20("label", { className: "mb-lifecycle-correction-note", children: [
7552
+ /* @__PURE__ */ jsx20("span", { children: "Submission note (optional)" }),
7553
+ /* @__PURE__ */ jsx20("textarea", { value: reason, placeholder: "Why is a new bill being submitted?", onChange: (event) => setReason(event.target.value) })
6951
7554
  ] }),
6952
- /* @__PURE__ */ jsx17(
7555
+ /* @__PURE__ */ jsx20(
6953
7556
  BillSubmissionForm,
6954
7557
  {
6955
7558
  className: "mbsf-lifecycle-correction",
@@ -6974,10 +7577,10 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6974
7577
  ...appearance ? { appearance } : {}
6975
7578
  }
6976
7579
  ),
6977
- newBillError ? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-message error", role: "alert", children: newBillError }) : null
7580
+ newBillError ? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-message error", role: "alert", children: newBillError }) : null
6978
7581
  ] }) }) : null,
6979
- activePanel === "second_review" ? /* @__PURE__ */ jsxs17(LifecycleDialog, { title: "Submit Second Review", wide: true, onClose: () => setPanel(""), children: [
6980
- /* @__PURE__ */ jsx17(
7582
+ activePanel === "second_review" ? /* @__PURE__ */ jsxs20(LifecycleDialog, { title: "Submit Second Review", wide: true, onClose: () => setPanel(""), children: [
7583
+ /* @__PURE__ */ jsx20(
6981
7584
  SecondReviewForm,
6982
7585
  {
6983
7586
  data,
@@ -6990,86 +7593,86 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6990
7593
  onSubmit: (input) => complete("Second Review submitted.", () => lifecycle.submitSecondReview({ ...input, ...actor }))
6991
7594
  }
6992
7595
  ),
6993
- reviewDeadline ? /* @__PURE__ */ jsxs17("p", { className: "mb-lifecycle-deadline-hint", children: [
7596
+ reviewDeadline ? /* @__PURE__ */ jsxs20("p", { className: "mb-lifecycle-deadline-hint", children: [
6994
7597
  "Second Review must be requested within 90 days of the denial EOR (dated ",
6995
7598
  usDate(reviewDeadline.eorDate),
6996
7599
  ") \u2014 file by ",
6997
- /* @__PURE__ */ jsx17("strong", { children: usDate(reviewDeadline.deadline) }),
7600
+ /* @__PURE__ */ jsx20("strong", { children: usDate(reviewDeadline.deadline) }),
6998
7601
  "."
6999
7602
  ] }) : null
7000
7603
  ] }) : null,
7001
- activePanel === "payment" ? /* @__PURE__ */ jsx17(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-panel", children: [
7002
- /* @__PURE__ */ jsxs17("div", { children: [
7003
- /* @__PURE__ */ jsx17("h3", { children: "Post payment" }),
7004
- /* @__PURE__ */ jsx17("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
7604
+ activePanel === "payment" ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-panel", children: [
7605
+ /* @__PURE__ */ jsxs20("div", { children: [
7606
+ /* @__PURE__ */ jsx20("h3", { children: "Post payment" }),
7607
+ /* @__PURE__ */ jsx20("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
7005
7608
  ] }),
7006
- /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-fields two", children: [
7007
- /* @__PURE__ */ jsxs17("label", { children: [
7008
- /* @__PURE__ */ jsx17("span", { children: "Amount applied to bill" }),
7009
- /* @__PURE__ */ jsx17("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) })) })
7609
+ /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-fields two", children: [
7610
+ /* @__PURE__ */ jsxs20("label", { children: [
7611
+ /* @__PURE__ */ jsx20("span", { children: "Amount applied to bill" }),
7612
+ /* @__PURE__ */ jsx20("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) })) })
7010
7613
  ] }),
7011
- /* @__PURE__ */ jsxs17("label", { children: [
7012
- /* @__PURE__ */ jsx17("span", { children: "Penalty" }),
7013
- /* @__PURE__ */ jsx17("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
7614
+ /* @__PURE__ */ jsxs20("label", { children: [
7615
+ /* @__PURE__ */ jsx20("span", { children: "Penalty" }),
7616
+ /* @__PURE__ */ jsx20("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
7014
7617
  ] }),
7015
- /* @__PURE__ */ jsxs17("label", { children: [
7016
- /* @__PURE__ */ jsx17("span", { children: "Interest" }),
7017
- /* @__PURE__ */ jsx17("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
7618
+ /* @__PURE__ */ jsxs20("label", { children: [
7619
+ /* @__PURE__ */ jsx20("span", { children: "Interest" }),
7620
+ /* @__PURE__ */ jsx20("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
7018
7621
  ] }),
7019
- /* @__PURE__ */ jsxs17("label", { children: [
7020
- /* @__PURE__ */ jsx17("span", { children: "Method" }),
7021
- /* @__PURE__ */ jsxs17("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
7022
- /* @__PURE__ */ jsx17("option", { value: "check", children: "Check" }),
7023
- /* @__PURE__ */ jsx17("option", { value: "eft", children: "EFT" })
7622
+ /* @__PURE__ */ jsxs20("label", { children: [
7623
+ /* @__PURE__ */ jsx20("span", { children: "Method" }),
7624
+ /* @__PURE__ */ jsxs20("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
7625
+ /* @__PURE__ */ jsx20("option", { value: "check", children: "Check" }),
7626
+ /* @__PURE__ */ jsx20("option", { value: "eft", children: "EFT" })
7024
7627
  ] })
7025
7628
  ] }),
7026
- /* @__PURE__ */ jsxs17("label", { children: [
7027
- /* @__PURE__ */ jsx17("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
7028
- /* @__PURE__ */ jsx17("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
7629
+ /* @__PURE__ */ jsxs20("label", { children: [
7630
+ /* @__PURE__ */ jsx20("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
7631
+ /* @__PURE__ */ jsx20("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
7029
7632
  ] }),
7030
- /* @__PURE__ */ jsxs17("label", { children: [
7031
- /* @__PURE__ */ jsx17("span", { children: "Deposit date" }),
7032
- /* @__PURE__ */ jsx17("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
7633
+ /* @__PURE__ */ jsxs20("label", { children: [
7634
+ /* @__PURE__ */ jsx20("span", { children: "Deposit date" }),
7635
+ /* @__PURE__ */ jsx20("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
7033
7636
  ] }),
7034
- /* @__PURE__ */ jsxs17("label", { className: "full", children: [
7035
- /* @__PURE__ */ jsx17("span", { children: "Note (optional)" }),
7036
- /* @__PURE__ */ jsx17("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
7637
+ /* @__PURE__ */ jsxs20("label", { className: "full", children: [
7638
+ /* @__PURE__ */ jsx20("span", { children: "Note (optional)" }),
7639
+ /* @__PURE__ */ jsx20("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
7037
7640
  ] })
7038
7641
  ] }),
7039
- /* @__PURE__ */ jsxs17("div", { className: "mb-payment-total", children: [
7040
- /* @__PURE__ */ jsx17("span", { children: "Total received" }),
7041
- /* @__PURE__ */ jsx17("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
7642
+ /* @__PURE__ */ jsxs20("div", { className: "mb-payment-total", children: [
7643
+ /* @__PURE__ */ jsx20("span", { children: "Total received" }),
7644
+ /* @__PURE__ */ jsx20("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
7042
7645
  ] }),
7043
- /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-panel-actions", children: [
7044
- /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7045
- /* @__PURE__ */ jsx17("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, ...actor })), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
7646
+ /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-panel-actions", children: [
7647
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7648
+ /* @__PURE__ */ jsx20("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, ...actor })), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
7046
7649
  ] })
7047
7650
  ] }) }) : null,
7048
- activePanel === "close" || activePanel === "reopen" ? /* @__PURE__ */ jsx17(LifecycleDialog, { title: activePanel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-panel", children: [
7049
- /* @__PURE__ */ jsxs17("div", { children: [
7050
- /* @__PURE__ */ jsx17("h3", { children: activePanel === "close" ? "Close bill" : "Reopen bill" }),
7051
- /* @__PURE__ */ jsx17("p", { children: activePanel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
7651
+ activePanel === "close" || activePanel === "reopen" ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: activePanel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-panel", children: [
7652
+ /* @__PURE__ */ jsxs20("div", { children: [
7653
+ /* @__PURE__ */ jsx20("h3", { children: activePanel === "close" ? "Close bill" : "Reopen bill" }),
7654
+ /* @__PURE__ */ jsx20("p", { children: activePanel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
7052
7655
  ] }),
7053
- /* @__PURE__ */ jsxs17("label", { children: [
7054
- /* @__PURE__ */ jsx17("span", { children: "Reason" }),
7055
- /* @__PURE__ */ jsx17("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
7656
+ /* @__PURE__ */ jsxs20("label", { children: [
7657
+ /* @__PURE__ */ jsx20("span", { children: "Reason" }),
7658
+ /* @__PURE__ */ jsx20("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
7056
7659
  ] }),
7057
- /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-panel-actions", children: [
7058
- /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7059
- /* @__PURE__ */ jsx17("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(activePanel === "close" ? "Bill closed." : "Bill reopened.", () => activePanel === "close" ? lifecycle.closeBill({ reason, ...actor }) : lifecycle.reopenBill({ reason, ...actor })), children: lifecycle.isMutating ? "Saving\u2026" : activePanel === "close" ? "Close bill" : "Reopen bill" })
7660
+ /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-panel-actions", children: [
7661
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7662
+ /* @__PURE__ */ jsx20("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(activePanel === "close" ? "Bill closed." : "Bill reopened.", () => activePanel === "close" ? lifecycle.closeBill({ reason, ...actor }) : lifecycle.reopenBill({ reason, ...actor })), children: lifecycle.isMutating ? "Saving\u2026" : activePanel === "close" ? "Close bill" : "Reopen bill" })
7060
7663
  ] })
7061
7664
  ] }) }) : null,
7062
- activePanel === "send_duplicate" && correctionInitialBill ? /* @__PURE__ */ jsx17(LifecycleDialog, { title: "Send duplicate bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs17("section", { className: "mb-lifecycle-correction", children: [
7063
- /* @__PURE__ */ jsx17("header", { children: /* @__PURE__ */ jsxs17("div", { children: [
7064
- /* @__PURE__ */ jsx17("h3", { children: "Send duplicate bill" }),
7065
- /* @__PURE__ */ jsx17("p", { children: "Review and edit any bill field before creating a duplicate submission. The original bill and its history stay unchanged." })
7665
+ activePanel === "send_duplicate" && correctionInitialBill ? /* @__PURE__ */ jsx20(LifecycleDialog, { title: "Send duplicate bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs20("section", { className: "mb-lifecycle-correction", children: [
7666
+ /* @__PURE__ */ jsx20("header", { children: /* @__PURE__ */ jsxs20("div", { children: [
7667
+ /* @__PURE__ */ jsx20("h3", { children: "Send duplicate bill" }),
7668
+ /* @__PURE__ */ jsx20("p", { children: "Review and edit any bill field before creating a duplicate submission. The original bill and its history stay unchanged." })
7066
7669
  ] }) }),
7067
- data.environment === "live" ? /* @__PURE__ */ jsxs17("div", { className: "mb-lifecycle-live-warning", children: [
7068
- /* @__PURE__ */ jsx17("strong", { children: "Live clearinghouse submission" }),
7069
- /* @__PURE__ */ jsx17("span", { children: "The duplicate will be sent only after you confirm its delivery route in the next dialog." })
7670
+ data.environment === "live" ? /* @__PURE__ */ jsxs20("div", { className: "mb-lifecycle-live-warning", children: [
7671
+ /* @__PURE__ */ jsx20("strong", { children: "Live clearinghouse submission" }),
7672
+ /* @__PURE__ */ jsx20("span", { children: "The duplicate will be sent only after you confirm its delivery route in the next dialog." })
7070
7673
  ] }) : null,
7071
- /* @__PURE__ */ jsx17(CorrectionVerificationContact, { delivery: data.delivery }),
7072
- /* @__PURE__ */ jsx17(
7674
+ /* @__PURE__ */ jsx20(CorrectionVerificationContact, { delivery: data.delivery }),
7675
+ /* @__PURE__ */ jsx20(
7073
7676
  BillSubmissionForm,
7074
7677
  {
7075
7678
  className: "mbsf-lifecycle-correction",
@@ -7094,15 +7697,15 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7094
7697
  ...appearance ? { appearance } : {}
7095
7698
  }
7096
7699
  ),
7097
- duplicateError ? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-message error", role: "alert", children: duplicateError }) : null
7700
+ duplicateError ? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-message error", role: "alert", children: duplicateError }) : null
7098
7701
  ] }) }) : null,
7099
- activePanel === "report_status" ? /* @__PURE__ */ jsx17(
7702
+ activePanel === "report_status" ? /* @__PURE__ */ jsx20(
7100
7703
  ReportBillStatusDialog,
7101
7704
  {
7102
7705
  ...data.delivery.directory ? { directory: data.delivery.directory } : {},
7103
7706
  ...statusContacts.claimsAdmin ? { claimsAdmin: statusContacts.claimsAdmin } : {},
7104
7707
  ...statusContacts.billReview ? { billReview: statusContacts.billReview } : {},
7105
- ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx17(BillHistoryTable, { entries: receiptEntries, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) } : {},
7708
+ ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx20(BillHistoryTable, { entries: receiptEntries, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) } : {},
7106
7709
  submitting: lifecycle.isMutating,
7107
7710
  error: lifecycle.error?.message ?? null,
7108
7711
  onCancel: () => setPanel(""),
@@ -7110,11 +7713,12 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7110
7713
  ...appearance ? { appearance } : {}
7111
7714
  }
7112
7715
  ) : null,
7113
- notice ? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
7114
- lifecycle.error ? /* @__PURE__ */ jsx17("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
7716
+ notice ? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
7717
+ lifecycle.error ? /* @__PURE__ */ jsx20("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
7115
7718
  ] });
7116
7719
  }
7117
7720
  var CONNECTED_LIFECYCLE_STYLES = `
7721
+ .mb-connected-lifecycle{grid-template-columns:minmax(0,1fr);min-width:0}.mb-lifecycle-tabpanel{min-width:0;grid-template-columns:minmax(0,1fr)}.mb-lifecycle-tabpanel>*{min-width:0}
7118
7722
  .mb-lifecycle-attempt-detail{display:grid;gap:15px;padding:18px;border:1px solid color-mix(in srgb,var(--mb-accent) 38%,var(--mb-border));border-radius:var(--mb-radius,14px);background:color-mix(in srgb,var(--mb-accent) 5%,var(--mb-surface))}.mb-lifecycle-attempt-detail>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.mb-lifecycle-attempt-detail>header span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase}.mb-lifecycle-attempt-detail h3{margin:3px 0 0;font-size:1.08rem}.mb-lifecycle-attempt-detail>header>strong{padding:4px 9px;border:1px solid color-mix(in srgb,var(--mb-accent) 35%,var(--mb-border));border-radius:999px;background:var(--mb-surface);color:var(--mb-accent);font-size:.75rem}.mb-lifecycle-attempt-detail dl{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0}.mb-lifecycle-attempt-detail dl>div{display:grid;gap:2px;min-width:0}.mb-lifecycle-attempt-detail dt{color:var(--mb-muted);font-size:.7rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase}.mb-lifecycle-attempt-detail dd{min-width:0;margin:0;font-weight:700;overflow-wrap:anywhere}
7119
7723
  .mb-lifecycle-notes{display:grid;gap:14px;padding:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius,14px);background:var(--mb-surface)}.mb-lifecycle-notes>header{display:flex;align-items:center;justify-content:space-between;gap:16px}.mb-lifecycle-notes h3{margin:0;font-size:1.08rem}.mb-lifecycle-notes header p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-notes>header>span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:999px;background:var(--mb-soft);font-weight:750}.mb-lifecycle-notes ol{display:grid;gap:9px;margin:0;padding:0;list-style:none}.mb-lifecycle-notes li{padding:11px 13px;border-left:3px solid color-mix(in srgb,var(--mb-accent) 52%,var(--mb-border));border-radius:0 8px 8px 0;background:var(--mb-soft)}.mb-lifecycle-notes li p{margin:0;white-space:pre-wrap}.mb-lifecycle-notes li small{display:block;margin-top:4px;color:var(--mb-muted)}.mb-lifecycle-notes-empty{margin:0;color:var(--mb-muted)}.mb-lifecycle-notes form{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px}.mb-lifecycle-notes label{display:grid;gap:6px;font-size:.82rem;font-weight:750}.mb-lifecycle-notes textarea{width:100%;min-height:76px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;resize:vertical}
7120
7724
  .mb-lifecycle-simulator{display:grid;gap:14px;padding:18px;border:1px solid #b8dadd;border-radius:var(--mb-radius,14px);background:#f2fbfb}.mb-lifecycle-simulator>div:first-child>span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.09em;text-transform:uppercase}.mb-lifecycle-simulator h3{margin:3px 0 0;font-size:1.05rem}.mb-lifecycle-simulator p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-simulator-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}.mb-lifecycle-simulator-actions button{min-height:76px;border:1px solid #a9cccf;border-radius:10px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;padding:12px 14px;text-align:left;font:inherit}.mb-lifecycle-simulator-actions button:hover{border-color:var(--mb-accent);box-shadow:0 3px 14px rgba(23,108,112,.1)}.mb-lifecycle-simulator-actions button:disabled{cursor:not-allowed;opacity:.55}.mb-lifecycle-simulator-actions button strong,.mb-lifecycle-simulator-actions button span{display:block}.mb-lifecycle-simulator-actions button span{margin-top:3px;color:var(--mb-muted);font-size:.83rem}.mb-lifecycle-simulator-idle{padding:10px 12px;border-radius:8px;background:rgba(255,255,255,.72)}
@@ -7128,151 +7732,16 @@ var CONNECTED_LIFECYCLE_STYLES = `
7128
7732
  // src/connected-billing-workspace.tsx
7129
7733
  import {
7130
7734
  useCallback as useCallback5,
7131
- useEffect as useEffect12,
7735
+ useEffect as useEffect14,
7132
7736
  useLayoutEffect,
7133
- useMemo as useMemo10,
7134
- useRef as useRef8,
7135
- useState as useState14
7737
+ useMemo as useMemo11,
7738
+ useRef as useRef9,
7739
+ useState as useState17
7136
7740
  } from "react";
7137
-
7138
- // src/billing-operations-client.ts
7139
- import {
7140
- DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL3,
7141
- DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT3
7142
- } from "@mindbill/browser";
7143
- async function responseError2(response, fallback) {
7144
- const body = await response.json().catch(() => null);
7145
- const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
7146
- return new Error(typeof detail === "string" ? detail : fallback);
7147
- }
7148
- function normalizeSession2(value) {
7149
- if (!value || typeof value !== "object") throw new Error("The MindBill session endpoint returned an invalid response.");
7150
- const candidate = value;
7151
- const nested = candidate.session ?? candidate.data;
7152
- const session = nested && typeof nested === "object" ? nested : candidate;
7153
- if (typeof session.token !== "string" || session.token.length < 8) {
7154
- throw new Error("The MindBill session endpoint did not return a browser session token.");
7155
- }
7156
- return {
7157
- token: session.token,
7158
- ...typeof session.expiresAt === "string" ? { expiresAt: session.expiresAt } : {},
7159
- ...typeof session.apiBaseUrl === "string" ? { apiBaseUrl: session.apiBaseUrl } : {}
7160
- };
7161
- }
7162
- function isFresh(session) {
7163
- if (!session) return false;
7164
- if (!session.expiresAt) return true;
7165
- const expiresAt = Date.parse(session.expiresAt);
7166
- return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
7167
- }
7168
- function queryString(values) {
7169
- const params = new URLSearchParams();
7170
- for (const [key, value] of Object.entries(values)) {
7171
- if (value !== void 0 && value !== "") params.set(key, String(value));
7172
- }
7173
- const text = params.toString();
7174
- return text ? `?${text}` : "";
7175
- }
7176
- function createBillingOperationsClient({
7177
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT3,
7178
- getSession,
7179
- apiBaseUrl = DEFAULT_API_BASE_URL3,
7180
- fetch: fetchOverride
7181
- } = {}) {
7182
- const fetcher = fetchOverride ?? globalThis.fetch;
7183
- if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
7184
- let session = null;
7185
- let pendingSession = null;
7186
- let pendingSessionSignal = null;
7187
- const mintSession = async (signal, force = false) => {
7188
- if (!force && isFresh(session)) return session;
7189
- if (!force && pendingSession && !pendingSessionSignal?.aborted) return pendingSession;
7190
- const pending = getSession ? getSession({ signal }) : fetcher(sessionEndpoint, {
7191
- method: "POST",
7192
- credentials: "same-origin",
7193
- headers: { "content-type": "application/json" },
7194
- body: JSON.stringify({}),
7195
- signal
7196
- }).then(async (response) => {
7197
- if (!response.ok) throw await responseError2(response, "MindBill browser session could not be created.");
7198
- return response.json();
7199
- });
7200
- const request = Promise.resolve(pending).then(normalizeSession2).then((next) => {
7201
- session = next;
7202
- return next;
7203
- }).finally(() => {
7204
- if (pendingSession === request) {
7205
- pendingSession = null;
7206
- pendingSessionSignal = null;
7207
- }
7208
- });
7209
- pendingSession = request;
7210
- pendingSessionSignal = signal;
7211
- return request;
7212
- };
7213
- const get = async (path, signal) => {
7214
- const controller = signal ? null : new AbortController();
7215
- const requestSignal = signal ?? controller?.signal;
7216
- if (!requestSignal) throw new Error("An AbortSignal could not be created.");
7217
- let browserSession = await mintSession(requestSignal);
7218
- const request = (active) => {
7219
- const base = (active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
7220
- return fetcher(`${base}${path}`, {
7221
- headers: { authorization: `Bearer ${active.token}` },
7222
- signal: requestSignal
7223
- });
7224
- };
7225
- let response = await request(browserSession);
7226
- if (response.status === 401) {
7227
- session = null;
7228
- browserSession = await mintSession(requestSignal, true);
7229
- response = await request(browserSession);
7230
- }
7231
- if (!response.ok) throw await responseError2(response, "MindBill data could not be loaded.");
7232
- const body = await response.json();
7233
- return body.data ?? body;
7234
- };
7235
- return {
7236
- clearSession() {
7237
- session = null;
7238
- pendingSession = null;
7239
- pendingSessionSignal = null;
7240
- },
7241
- getBills(query = {}, signal) {
7242
- const { claimsAdministrator, taskType, taskSection: _taskSection, sort, status, ...filters } = query;
7243
- void _taskSection;
7244
- const sortKey = sort?.startsWith("balance_") ? "balanceDue" : sort?.startsWith("patient_") ? "patient" : sort ? "submitted" : void 0;
7245
- return get(`/partner/v2/bill-dashboard${queryString({
7246
- ...filters,
7247
- status: status === "submitted" ? "sent" : status,
7248
- claimsAdminId: claimsAdministrator,
7249
- taskKind: taskType,
7250
- sort: sortKey,
7251
- dir: sort ? sort.endsWith("_asc") ? "asc" : "desc" : void 0
7252
- })}`, signal);
7253
- },
7254
- getBillTasks(claimsAdministrator, signal) {
7255
- return get(
7256
- `/partner/v2/bill-tasks${queryString({ claimsAdminId: claimsAdministrator })}`,
7257
- signal
7258
- );
7259
- },
7260
- getServiceLineItems(range, signal) {
7261
- return get(
7262
- `/partner/v2/reports/service-line-items${queryString(range)}`,
7263
- signal
7264
- );
7265
- },
7266
- getProductivity(range, signal) {
7267
- return get(`/partner/v2/reports/productivity${queryString(range)}`, signal);
7268
- }
7269
- };
7270
- }
7271
-
7272
- // src/connected-billing-workspace.tsx
7273
- import { Fragment as Fragment15, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
7274
- var css11 = `
7275
- .mbow{color:var(--mb-text);font:14px/1.45 var(--mb-font);background:var(--mb-soft);border-radius:var(--mb-radius);padding:20px}.mbow *{box-sizing:border-box}.mbow h2,.mbow h3,.mbow p{margin:0}.mbow a{color:var(--mb-accent)}
7741
+ import { Fragment as Fragment16, jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
7742
+ var css13 = `
7743
+ .mbow-select{max-width:100%}
7744
+ .mbow{color:var(--mb-text);font:14px/1.45 var(--mb-font);background:var(--mb-soft);border-radius:var(--mb-radius);padding:20px}.mbow,.mbow *{box-sizing:border-box}.mbow h2,.mbow h3,.mbow p{margin:0}.mbow a{color:var(--mb-accent)}
7276
7745
  .mbow-workspace{width:100%;height:100%;max-height:var(--mbow-available-height,100dvh);min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
7277
7746
  .mbow-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}.mbow-head h2{font-size:24px;line-height:1.2}.mbow-sub{color:var(--mb-muted);margin-top:4px!important}.mbow-actions{display:flex;gap:8px;flex-wrap:wrap}
7278
7747
  .mbow-button,.mbow-input,.mbow-select{min-height:38px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbow-button{padding:7px 12px;cursor:pointer;font-weight:650}.mbow-button:hover{border-color:var(--mb-accent)}.mbow-button.primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbow-button:disabled{opacity:.55;cursor:not-allowed}.mbow-input,.mbow-select{padding:7px 10px}.mbow-input{min-width:260px;flex:1}
@@ -7283,9 +7752,17 @@ var css11 = `
7283
7752
  .mbow-back{margin-bottom:12px}.mbow-task-note{color:var(--mb-muted);font-size:13px;margin-bottom:14px!important}.mbow-bar{height:7px;min-width:70px;background:var(--mb-soft);border-radius:99px;overflow:hidden}.mbow-bar i{display:block;height:100%;background:var(--mb-accent);border-radius:inherit}
7284
7753
  @media(max-width:760px){.mbow{padding:14px}.mbow-head{display:block}.mbow-actions{margin-top:12px}.mbow-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.mbow-input{min-width:100%}}
7285
7754
  `;
7286
- function money6(value) {
7755
+ function money7(value) {
7287
7756
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
7288
7757
  }
7758
+ function RenderingProviderFilter({ value, options, onChange }) {
7759
+ if (!options && !value) return null;
7760
+ return /* @__PURE__ */ jsxs21("select", { className: "mbow-select", "aria-label": "Rendering provider filter", value, onChange: (event) => onChange(event.target.value), children: [
7761
+ /* @__PURE__ */ jsx21("option", { value: "", children: "All rendering providers" }),
7762
+ value && !options?.some((option) => option.id === value) ? /* @__PURE__ */ jsx21("option", { value, children: "Selected rendering provider" }) : null,
7763
+ options?.map((option) => /* @__PURE__ */ jsx21("option", { value: option.id, children: option.name }, option.id))
7764
+ ] });
7765
+ }
7289
7766
  function shortDate(value) {
7290
7767
  if (!value) return "\u2014";
7291
7768
  const date2 = /* @__PURE__ */ new Date(`${value.slice(0, 10)}T12:00:00`);
@@ -7299,14 +7776,14 @@ function defaultRange(days = 29) {
7299
7776
  return { from: iso(from), to: iso(to) };
7300
7777
  }
7301
7778
  function Surface({ appearance, className = "", style, children, surfaceRef }) {
7302
- return /* @__PURE__ */ jsxs18("div", { ref: surfaceRef, className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
7303
- /* @__PURE__ */ jsx18("style", { children: css11 }),
7779
+ return /* @__PURE__ */ jsxs21("div", { ref: surfaceRef, className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
7780
+ /* @__PURE__ */ jsx21("style", { children: css13 }),
7304
7781
  children
7305
7782
  ] });
7306
7783
  }
7307
7784
  function useAvailableViewportHeight() {
7308
- const workspaceRef = useRef8(null);
7309
- const [availableHeight, setAvailableHeight] = useState14(null);
7785
+ const workspaceRef = useRef9(null);
7786
+ const [availableHeight, setAvailableHeight] = useState17(null);
7310
7787
  useLayoutEffect(() => {
7311
7788
  const element = workspaceRef.current;
7312
7789
  if (!element || typeof window === "undefined") return;
@@ -7333,7 +7810,7 @@ function useAvailableViewportHeight() {
7333
7810
  return { workspaceRef, availableHeight };
7334
7811
  }
7335
7812
  function useClient(options) {
7336
- return useMemo10(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
7813
+ return useMemo11(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
7337
7814
  }
7338
7815
  function BillSearchContent({
7339
7816
  client,
@@ -7341,11 +7818,11 @@ function BillSearchContent({
7341
7818
  onSelectBill,
7342
7819
  heading
7343
7820
  }) {
7344
- const [query, setQuery] = useState14({ age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery, status: initialQuery?.status === "submitted" ? "sent" : initialQuery?.status ?? "all" });
7345
- const [draft, setDraft] = useState14(initialQuery?.q ?? "");
7346
- const [result, setResult] = useState14(null);
7347
- const [error, setError] = useState14(null);
7348
- const [loading, setLoading] = useState14(true);
7821
+ const [query, setQuery] = useState17({ age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery, status: initialQuery?.status === "submitted" ? "sent" : initialQuery?.status ?? "all" });
7822
+ const [draft, setDraft] = useState17(initialQuery?.q ?? "");
7823
+ const [result, setResult] = useState17(null);
7824
+ const [error, setError] = useState17(null);
7825
+ const [loading, setLoading] = useState17(true);
7349
7826
  const load = useCallback5(async (signal) => {
7350
7827
  setLoading(true);
7351
7828
  setError(null);
@@ -7357,77 +7834,78 @@ function BillSearchContent({
7357
7834
  if (!signal?.aborted) setLoading(false);
7358
7835
  }
7359
7836
  }, [client, query]);
7360
- useEffect12(() => {
7837
+ useEffect14(() => {
7361
7838
  const controller = new AbortController();
7362
7839
  void load(controller.signal);
7363
7840
  return () => controller.abort();
7364
7841
  }, [load]);
7365
7842
  const update = (next) => setQuery((current) => ({ ...current, ...next, page: next.page ?? 1 }));
7366
7843
  const pageCount = Math.max(1, Math.ceil((result?.total ?? 0) / (result?.pageSize ?? 25)));
7367
- return /* @__PURE__ */ jsxs18(Fragment15, { children: [
7368
- heading ? /* @__PURE__ */ jsx18("div", { className: "mbow-head", children: /* @__PURE__ */ jsx18("div", { children: typeof heading === "string" ? /* @__PURE__ */ jsx18("h2", { children: heading }) : heading }) }) : null,
7369
- /* @__PURE__ */ jsxs18("form", { className: "mbow-toolbar", onSubmit: (event) => {
7844
+ return /* @__PURE__ */ jsxs21(Fragment16, { children: [
7845
+ heading ? /* @__PURE__ */ jsx21("div", { className: "mbow-head", children: /* @__PURE__ */ jsx21("div", { children: typeof heading === "string" ? /* @__PURE__ */ jsx21("h2", { children: heading }) : heading }) }) : null,
7846
+ /* @__PURE__ */ jsxs21("form", { className: "mbow-toolbar", onSubmit: (event) => {
7370
7847
  event.preventDefault();
7371
7848
  update({ q: draft.trim() });
7372
7849
  }, children: [
7373
- /* @__PURE__ */ jsx18("input", { className: "mbow-input", value: draft, onChange: (event) => setDraft(event.target.value), placeholder: "Search patient, bill ID, claim, or external ID\u2026", "aria-label": "Search bills" }),
7374
- /* @__PURE__ */ jsxs18("select", { className: "mbow-select", value: query.status ?? "all", onChange: (event) => update({ status: event.target.value }), "aria-label": "Bill status", children: [
7375
- /* @__PURE__ */ jsx18("option", { value: "all", children: "All statuses" }),
7376
- /* @__PURE__ */ jsx18("option", { value: "incomplete", children: "Incomplete" }),
7377
- /* @__PURE__ */ jsx18("option", { value: "sent", children: "Sent" }),
7378
- /* @__PURE__ */ jsx18("option", { value: "accepted", children: "Accepted" }),
7379
- /* @__PURE__ */ jsx18("option", { value: "accepted_no_response", children: "Accepted \u2014 response overdue" }),
7380
- /* @__PURE__ */ jsx18("option", { value: "rejected", children: "Rejected" }),
7381
- /* @__PURE__ */ jsx18("option", { value: "processed", children: "Processed" }),
7382
- /* @__PURE__ */ jsx18("option", { value: "paid", children: "Paid" }),
7383
- /* @__PURE__ */ jsx18("option", { value: "closed", children: "Closed" })
7850
+ /* @__PURE__ */ jsx21("input", { className: "mbow-input", value: draft, onChange: (event) => setDraft(event.target.value), placeholder: "Search patient, bill ID, claim, or external ID\u2026", "aria-label": "Search bills" }),
7851
+ /* @__PURE__ */ jsxs21("select", { className: "mbow-select", value: query.status ?? "all", onChange: (event) => update({ status: event.target.value }), "aria-label": "Bill status", children: [
7852
+ /* @__PURE__ */ jsx21("option", { value: "all", children: "All statuses" }),
7853
+ /* @__PURE__ */ jsx21("option", { value: "incomplete", children: "Incomplete" }),
7854
+ /* @__PURE__ */ jsx21("option", { value: "sent", children: "Sent" }),
7855
+ /* @__PURE__ */ jsx21("option", { value: "accepted", children: "Accepted" }),
7856
+ /* @__PURE__ */ jsx21("option", { value: "accepted_no_response", children: "Accepted \u2014 response overdue" }),
7857
+ /* @__PURE__ */ jsx21("option", { value: "rejected", children: "Rejected" }),
7858
+ /* @__PURE__ */ jsx21("option", { value: "processed", children: "Processed" }),
7859
+ /* @__PURE__ */ jsx21("option", { value: "paid", children: "Paid" }),
7860
+ /* @__PURE__ */ jsx21("option", { value: "closed", children: "Closed" })
7384
7861
  ] }),
7385
- /* @__PURE__ */ jsxs18("select", { className: "mbow-select", value: query.age ?? "all", onChange: (event) => update({ age: event.target.value }), "aria-label": "A/R age", children: [
7386
- /* @__PURE__ */ jsx18("option", { value: "all", children: "All A/R ages" }),
7387
- /* @__PURE__ */ jsx18("option", { value: "0-30", children: "0\u201330 days" }),
7388
- /* @__PURE__ */ jsx18("option", { value: "31-60", children: "31\u201360 days" }),
7389
- /* @__PURE__ */ jsx18("option", { value: "61-90", children: "61\u201390 days" }),
7390
- /* @__PURE__ */ jsx18("option", { value: "91+", children: "91+ days" }),
7391
- /* @__PURE__ */ jsx18("option", { value: "91-180", children: "91\u2013180 days" }),
7392
- /* @__PURE__ */ jsx18("option", { value: "181+", children: "181+ days" })
7862
+ /* @__PURE__ */ jsxs21("select", { className: "mbow-select", value: query.age ?? "all", onChange: (event) => update({ age: event.target.value }), "aria-label": "A/R age", children: [
7863
+ /* @__PURE__ */ jsx21("option", { value: "all", children: "All A/R ages" }),
7864
+ /* @__PURE__ */ jsx21("option", { value: "0-30", children: "0\u201330 days" }),
7865
+ /* @__PURE__ */ jsx21("option", { value: "31-60", children: "31\u201360 days" }),
7866
+ /* @__PURE__ */ jsx21("option", { value: "61-90", children: "61\u201390 days" }),
7867
+ /* @__PURE__ */ jsx21("option", { value: "91+", children: "91+ days" }),
7868
+ /* @__PURE__ */ jsx21("option", { value: "91-180", children: "91\u2013180 days" }),
7869
+ /* @__PURE__ */ jsx21("option", { value: "181+", children: "181+ days" })
7393
7870
  ] }),
7394
- /* @__PURE__ */ jsx18("button", { className: "mbow-button", type: "submit", children: "Search" })
7871
+ /* @__PURE__ */ jsx21("button", { className: "mbow-button", type: "submit", children: "Search" }),
7872
+ /* @__PURE__ */ jsx21(RenderingProviderFilter, { value: query.renderingProviderId ?? "", options: result?.filters?.renderingProviders, onChange: (value) => update({ renderingProviderId: value }) })
7395
7873
  ] }),
7396
- /* @__PURE__ */ jsxs18("div", { className: "mbow-card mbow-scroll", children: [
7397
- loading ? /* @__PURE__ */ jsx18("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error ? /* @__PURE__ */ jsxs18("div", { className: "mbow-state mbow-error", role: "alert", children: [
7874
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-card mbow-scroll", children: [
7875
+ loading ? /* @__PURE__ */ jsx21("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error ? /* @__PURE__ */ jsxs21("div", { className: "mbow-state mbow-error", role: "alert", children: [
7398
7876
  error.message,
7399
7877
  " ",
7400
- /* @__PURE__ */ jsx18("button", { className: "mbow-button", type: "button", onClick: () => void load(), children: "Retry" })
7401
- ] }) : result?.items.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "mbow-state", children: "No bills match these filters." }) : /* @__PURE__ */ jsxs18("table", { className: "mbow-table", children: [
7402
- /* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsxs18("tr", { children: [
7403
- /* @__PURE__ */ jsx18("th", { children: "Bill" }),
7404
- /* @__PURE__ */ jsx18("th", { children: "Patient" }),
7405
- /* @__PURE__ */ jsx18("th", { children: "DOS" }),
7406
- /* @__PURE__ */ jsx18("th", { children: "Codes" }),
7407
- /* @__PURE__ */ jsx18("th", { children: "Claims administrator" }),
7408
- /* @__PURE__ */ jsx18("th", { children: "Status" }),
7409
- /* @__PURE__ */ jsx18("th", { children: "Submitted / A/R age" }),
7410
- /* @__PURE__ */ jsx18("th", { className: "mbow-money", children: "Balance due" })
7878
+ /* @__PURE__ */ jsx21("button", { className: "mbow-button", type: "button", onClick: () => void load(), children: "Retry" })
7879
+ ] }) : result?.items.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "mbow-state", children: "No bills match these filters." }) : /* @__PURE__ */ jsxs21("table", { className: "mbow-table", children: [
7880
+ /* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
7881
+ /* @__PURE__ */ jsx21("th", { children: "Bill" }),
7882
+ /* @__PURE__ */ jsx21("th", { children: "Patient" }),
7883
+ /* @__PURE__ */ jsx21("th", { children: "DOS" }),
7884
+ /* @__PURE__ */ jsx21("th", { children: "Codes" }),
7885
+ /* @__PURE__ */ jsx21("th", { children: "Claims administrator" }),
7886
+ /* @__PURE__ */ jsx21("th", { children: "Status" }),
7887
+ /* @__PURE__ */ jsx21("th", { children: "Submitted / A/R age" }),
7888
+ /* @__PURE__ */ jsx21("th", { className: "mbow-money", children: "Balance due" })
7411
7889
  ] }) }),
7412
- /* @__PURE__ */ jsx18("tbody", { children: result?.items.map((bill) => /* @__PURE__ */ jsxs18("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(bill), children: [
7413
- /* @__PURE__ */ jsxs18("td", { className: "mbow-strong", children: [
7890
+ /* @__PURE__ */ jsx21("tbody", { children: result?.items.map((bill) => /* @__PURE__ */ jsxs21("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(bill), children: [
7891
+ /* @__PURE__ */ jsxs21("td", { className: "mbow-strong", children: [
7414
7892
  "#",
7415
7893
  bill.billNumber
7416
7894
  ] }),
7417
- /* @__PURE__ */ jsx18("td", { children: bill.patientName }),
7418
- /* @__PURE__ */ jsx18("td", { children: shortDate(bill.dateOfService) }),
7419
- /* @__PURE__ */ jsx18("td", { children: bill.procedureCodes.join(", ") || "\u2014" }),
7420
- /* @__PURE__ */ jsx18("td", { children: bill.claimsAdministrator || "\u2014" }),
7421
- /* @__PURE__ */ jsx18("td", { children: /* @__PURE__ */ jsx18("span", { className: `mbow-badge ${bill.status.tone ?? ""}`, children: bill.status.label }) }),
7422
- /* @__PURE__ */ jsxs18("td", { children: [
7895
+ /* @__PURE__ */ jsx21("td", { children: bill.patientName }),
7896
+ /* @__PURE__ */ jsx21("td", { children: shortDate(bill.dateOfService) }),
7897
+ /* @__PURE__ */ jsx21("td", { children: bill.procedureCodes.join(", ") || "\u2014" }),
7898
+ /* @__PURE__ */ jsx21("td", { children: bill.claimsAdministrator || "\u2014" }),
7899
+ /* @__PURE__ */ jsx21("td", { children: /* @__PURE__ */ jsx21("span", { className: `mbow-badge ${bill.status.tone ?? ""}`, children: bill.status.label }) }),
7900
+ /* @__PURE__ */ jsxs21("td", { children: [
7423
7901
  shortDate(bill.submittedAt),
7424
- /* @__PURE__ */ jsx18("div", { className: "mbow-muted", children: bill.arAgeDays == null ? "\u2014" : `${bill.arAgeDays} days` })
7902
+ /* @__PURE__ */ jsx21("div", { className: "mbow-muted", children: bill.arAgeDays == null ? "\u2014" : `${bill.arAgeDays} days` })
7425
7903
  ] }),
7426
- /* @__PURE__ */ jsx18("td", { className: "mbow-money mbow-strong", children: money6(bill.balanceDue) })
7904
+ /* @__PURE__ */ jsx21("td", { className: "mbow-money mbow-strong", children: money7(bill.balanceDue) })
7427
7905
  ] }, bill.id)) })
7428
7906
  ] }),
7429
- result && !loading && !error ? /* @__PURE__ */ jsxs18("div", { className: "mbow-pager", children: [
7430
- /* @__PURE__ */ jsxs18("span", { children: [
7907
+ result && !loading && !error ? /* @__PURE__ */ jsxs21("div", { className: "mbow-pager", children: [
7908
+ /* @__PURE__ */ jsxs21("span", { children: [
7431
7909
  "Showing ",
7432
7910
  result.total === 0 ? 0 : (result.page - 1) * result.pageSize + 1,
7433
7911
  "\u2013",
@@ -7435,14 +7913,14 @@ function BillSearchContent({
7435
7913
  " of ",
7436
7914
  result.total
7437
7915
  ] }),
7438
- /* @__PURE__ */ jsxs18("span", { children: [
7439
- /* @__PURE__ */ jsx18("button", { className: "mbow-button", type: "button", disabled: result.page <= 1, onClick: () => update({ page: result.page - 1 }), children: "Previous" }),
7916
+ /* @__PURE__ */ jsxs21("span", { children: [
7917
+ /* @__PURE__ */ jsx21("button", { className: "mbow-button", type: "button", disabled: result.page <= 1, onClick: () => update({ page: result.page - 1 }), children: "Previous" }),
7440
7918
  " ",
7441
7919
  result.page,
7442
7920
  " / ",
7443
7921
  pageCount,
7444
7922
  " ",
7445
- /* @__PURE__ */ jsx18("button", { className: "mbow-button", type: "button", disabled: result.page >= pageCount, onClick: () => update({ page: result.page + 1 }), children: "Next" })
7923
+ /* @__PURE__ */ jsx21("button", { className: "mbow-button", type: "button", disabled: result.page >= pageCount, onClick: () => update({ page: result.page + 1 }), children: "Next" })
7446
7924
  ] })
7447
7925
  ] }) : null
7448
7926
  ] })
@@ -7450,7 +7928,7 @@ function BillSearchContent({
7450
7928
  }
7451
7929
  function ConnectedBillSearch({ appearance, className, style, initialQuery, onSelectBill, heading = "All bills", ...options }) {
7452
7930
  const client = useClient(options);
7453
- return /* @__PURE__ */ jsx18(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx18(BillSearchContent, { client, initialQuery, onSelectBill, heading }) });
7931
+ return /* @__PURE__ */ jsx21(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx21(BillSearchContent, { client, initialQuery, onSelectBill, heading }) });
7454
7932
  }
7455
7933
  function taskQuery(cell) {
7456
7934
  const [taskType, taskLabel] = cell.rowId.split("::", 2);
@@ -7461,44 +7939,48 @@ function taskQuery(cell) {
7461
7939
  return { status: "all", taskSection: cell.sectionId, ...taskType ? { taskType } : {}, ...taskLabel ? { taskLabel } : {}, ...age ? { age } : {} };
7462
7940
  }
7463
7941
  function BillTasksContent({ client, onDrillDown, appearance }) {
7464
- const [claimsAdminId, setClaimsAdminId] = useState14("");
7465
- const [result, setResult] = useState14(null);
7466
- const [error, setError] = useState14(null);
7467
- const [loading, setLoading] = useState14(true);
7942
+ const [claimsAdminId, setClaimsAdminId] = useState17("");
7943
+ const [renderingProviderId, setRenderingProviderId] = useState17("");
7944
+ const [result, setResult] = useState17(null);
7945
+ const [error, setError] = useState17(null);
7946
+ const [loading, setLoading] = useState17(true);
7468
7947
  const load = useCallback5(async (signal) => {
7469
7948
  setLoading(true);
7470
7949
  setError(null);
7471
7950
  try {
7472
- setResult(await client.getBillTasks(claimsAdminId || void 0, signal));
7951
+ setResult(await client.getBillTasks(claimsAdminId || void 0, signal, renderingProviderId || void 0));
7473
7952
  } catch (cause) {
7474
7953
  if (!signal?.aborted) setError(cause instanceof Error ? cause : new Error("Bill tasks could not be loaded."));
7475
7954
  } finally {
7476
7955
  if (!signal?.aborted) setLoading(false);
7477
7956
  }
7478
- }, [claimsAdminId, client]);
7479
- useEffect12(() => {
7957
+ }, [claimsAdminId, renderingProviderId, client]);
7958
+ useEffect14(() => {
7480
7959
  const controller = new AbortController();
7481
7960
  void load(controller.signal);
7482
7961
  return () => controller.abort();
7483
7962
  }, [load]);
7484
- if (loading && !result) return /* @__PURE__ */ jsx18("div", { className: "mbow-state", children: "Loading bill tasks\u2026" });
7485
- if (error && !result) return /* @__PURE__ */ jsx18("div", { className: "mbow-state mbow-error", children: error.message });
7486
- if (!result) return /* @__PURE__ */ jsx18(Fragment15, {});
7963
+ if (loading && !result) return /* @__PURE__ */ jsx21("div", { className: "mbow-state", children: "Loading bill tasks\u2026" });
7964
+ if (error && !result) return /* @__PURE__ */ jsx21("div", { className: "mbow-state mbow-error", children: error.message });
7965
+ if (!result) return /* @__PURE__ */ jsx21(Fragment16, {});
7487
7966
  const selectionProps = loading || error ? {} : {
7488
- onSelectCell: (cell) => onDrillDown?.({ ...taskQuery(cell), ...claimsAdminId ? { claimsAdministrator: claimsAdminId } : {} })
7967
+ onSelectCell: (cell) => onDrillDown?.({ ...taskQuery(cell), ...claimsAdminId ? { claimsAdministrator: claimsAdminId } : {}, ...renderingProviderId ? { renderingProviderId } : {} })
7489
7968
  };
7490
- return /* @__PURE__ */ jsxs18(Fragment15, { children: [
7491
- /* @__PURE__ */ jsxs18("p", { className: "mbow-task-note", children: [
7969
+ return /* @__PURE__ */ jsxs21(Fragment16, { children: [
7970
+ /* @__PURE__ */ jsxs21("p", { className: "mbow-task-note", children: [
7492
7971
  "Open follow-up work grouped by task and age. ",
7493
7972
  result.waiting ? "Sent and accepted bills waiting for a payer are shown below." : "Find sent and accepted bills in All bills."
7494
7973
  ] }),
7495
- loading ? /* @__PURE__ */ jsx18("p", { role: "status", children: "Updating bill tasks\u2026" }) : null,
7496
- error ? /* @__PURE__ */ jsx18("p", { role: "alert", className: "mbow-error", children: error.message }) : null,
7497
- /* @__PURE__ */ jsx18(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs18("select", { "aria-label": "Claims administrator filter", className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
7498
- /* @__PURE__ */ jsx18("option", { value: "", children: "All claims administrators" }),
7499
- result.filters.claimsAdministrators.map((item) => /* @__PURE__ */ jsx18("option", { value: item.id, children: item.name }, item.id))
7974
+ loading ? /* @__PURE__ */ jsx21("p", { role: "status", children: "Updating bill tasks\u2026" }) : null,
7975
+ error ? /* @__PURE__ */ jsx21("p", { role: "alert", className: "mbow-error", children: error.message }) : null,
7976
+ /* @__PURE__ */ jsx21(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs21("div", { className: "mbow-toolbar", children: [
7977
+ /* @__PURE__ */ jsxs21("select", { "aria-label": "Claims administrator filter", className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
7978
+ /* @__PURE__ */ jsx21("option", { value: "", children: "All claims administrators" }),
7979
+ result.filters.claimsAdministrators.map((item) => /* @__PURE__ */ jsx21("option", { value: item.id, children: item.name }, item.id))
7980
+ ] }),
7981
+ /* @__PURE__ */ jsx21(RenderingProviderFilter, { value: renderingProviderId, options: result.filters.renderingProviders, onChange: setRenderingProviderId })
7500
7982
  ] }), ...selectionProps }),
7501
- result.waiting ? /* @__PURE__ */ jsx18(
7983
+ result.waiting ? /* @__PURE__ */ jsx21(
7502
7984
  BillTasksDashboard,
7503
7985
  {
7504
7986
  data: result.waiting,
@@ -7516,28 +7998,28 @@ function BillTasksContent({ client, onDrillDown, appearance }) {
7516
7998
  }
7517
7999
  function ConnectedBillTasksDashboard({ appearance, className, style, onDrillDown, ...options }) {
7518
8000
  const client = useClient(options);
7519
- return /* @__PURE__ */ jsx18(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx18(BillTasksContent, { client, onDrillDown, appearance }) });
8001
+ return /* @__PURE__ */ jsx21(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx21(BillTasksContent, { client, onDrillDown, appearance }) });
7520
8002
  }
7521
8003
  function RangeToolbar({ from, to, setFrom, setTo }) {
7522
- return /* @__PURE__ */ jsxs18("div", { className: "mbow-toolbar", children: [
7523
- /* @__PURE__ */ jsxs18("label", { children: [
8004
+ return /* @__PURE__ */ jsxs21("div", { className: "mbow-toolbar", children: [
8005
+ /* @__PURE__ */ jsxs21("label", { children: [
7524
8006
  "From ",
7525
- /* @__PURE__ */ jsx18("input", { className: "mbow-input", type: "date", value: from, onChange: (event) => setFrom(event.target.value) })
8007
+ /* @__PURE__ */ jsx21("input", { className: "mbow-input", type: "date", value: from, onChange: (event) => setFrom(event.target.value) })
7526
8008
  ] }),
7527
- /* @__PURE__ */ jsxs18("label", { children: [
8009
+ /* @__PURE__ */ jsxs21("label", { children: [
7528
8010
  "To ",
7529
- /* @__PURE__ */ jsx18("input", { className: "mbow-input", type: "date", value: to, onChange: (event) => setTo(event.target.value) })
8011
+ /* @__PURE__ */ jsx21("input", { className: "mbow-input", type: "date", value: to, onChange: (event) => setTo(event.target.value) })
7530
8012
  ] })
7531
8013
  ] });
7532
8014
  }
7533
8015
  function ConnectedServiceLineItemsReport({ appearance, className, style, initialFrom, initialTo, onSelectBill, ...options }) {
7534
- const defaults = useMemo10(() => defaultRange(), []);
8016
+ const defaults = useMemo11(() => defaultRange(), []);
7535
8017
  const client = useClient(options);
7536
- const [from, setFrom] = useState14(initialFrom ?? defaults.from);
7537
- const [to, setTo] = useState14(initialTo ?? defaults.to);
7538
- const [data, setData] = useState14(null);
7539
- const [error, setError] = useState14(null);
7540
- useEffect12(() => {
8018
+ const [from, setFrom] = useState17(initialFrom ?? defaults.from);
8019
+ const [to, setTo] = useState17(initialTo ?? defaults.to);
8020
+ const [data, setData] = useState17(null);
8021
+ const [error, setError] = useState17(null);
8022
+ useEffect14(() => {
7541
8023
  const controller = new AbortController();
7542
8024
  setError(null);
7543
8025
  void client.getServiceLineItems({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -7545,64 +8027,64 @@ function ConnectedServiceLineItemsReport({ appearance, className, style, initial
7545
8027
  });
7546
8028
  return () => controller.abort();
7547
8029
  }, [client, from, to]);
7548
- return /* @__PURE__ */ jsxs18(Surface, { appearance, className, style, children: [
7549
- /* @__PURE__ */ jsx18("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs18("div", { children: [
7550
- /* @__PURE__ */ jsx18("h2", { children: "Original submissions by procedure" }),
7551
- /* @__PURE__ */ jsx18("p", { className: "mbow-sub", children: "First payer submission for each patient and date of service." })
8030
+ return /* @__PURE__ */ jsxs21(Surface, { appearance, className, style, children: [
8031
+ /* @__PURE__ */ jsx21("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs21("div", { children: [
8032
+ /* @__PURE__ */ jsx21("h2", { children: "Original submissions by procedure" }),
8033
+ /* @__PURE__ */ jsx21("p", { className: "mbow-sub", children: "First payer submission for each patient and date of service." })
7552
8034
  ] }) }),
7553
- /* @__PURE__ */ jsx18(RangeToolbar, { from, to, setFrom, setTo }),
7554
- error ? /* @__PURE__ */ jsx18("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx18("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs18(Fragment15, { children: [
7555
- /* @__PURE__ */ jsxs18("div", { className: "mbow-metrics", children: [
7556
- /* @__PURE__ */ jsx18(Metric, { label: "Original bills", value: String(data.totalBills) }),
7557
- /* @__PURE__ */ jsx18(Metric, { label: "Service lines", value: String(data.totalLines) }),
7558
- /* @__PURE__ */ jsx18(Metric, { label: "Total billed", value: money6(data.totalBilled) }),
7559
- /* @__PURE__ */ jsx18(Metric, { label: "Report window", value: data.windowLabel })
8035
+ /* @__PURE__ */ jsx21(RangeToolbar, { from, to, setFrom, setTo }),
8036
+ error ? /* @__PURE__ */ jsx21("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx21("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs21(Fragment16, { children: [
8037
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-metrics", children: [
8038
+ /* @__PURE__ */ jsx21(Metric, { label: "Original bills", value: String(data.totalBills) }),
8039
+ /* @__PURE__ */ jsx21(Metric, { label: "Service lines", value: String(data.totalLines) }),
8040
+ /* @__PURE__ */ jsx21(Metric, { label: "Total billed", value: money7(data.totalBilled) }),
8041
+ /* @__PURE__ */ jsx21(Metric, { label: "Report window", value: data.windowLabel })
7560
8042
  ] }),
7561
- /* @__PURE__ */ jsxs18("div", { className: "mbow-card mbow-scroll", children: [
7562
- /* @__PURE__ */ jsx18("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx18("h3", { children: "Procedure summary" }) }),
7563
- /* @__PURE__ */ jsxs18("table", { className: "mbow-table", children: [
7564
- /* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsxs18("tr", { children: [
7565
- /* @__PURE__ */ jsx18("th", { children: "Procedure code" }),
7566
- /* @__PURE__ */ jsx18("th", { children: "Bills" }),
7567
- /* @__PURE__ */ jsx18("th", { children: "Service lines" }),
7568
- /* @__PURE__ */ jsx18("th", { className: "mbow-money", children: "Total billed" })
8043
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-card mbow-scroll", children: [
8044
+ /* @__PURE__ */ jsx21("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx21("h3", { children: "Procedure summary" }) }),
8045
+ /* @__PURE__ */ jsxs21("table", { className: "mbow-table", children: [
8046
+ /* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
8047
+ /* @__PURE__ */ jsx21("th", { children: "Procedure code" }),
8048
+ /* @__PURE__ */ jsx21("th", { children: "Bills" }),
8049
+ /* @__PURE__ */ jsx21("th", { children: "Service lines" }),
8050
+ /* @__PURE__ */ jsx21("th", { className: "mbow-money", children: "Total billed" })
7569
8051
  ] }) }),
7570
- /* @__PURE__ */ jsx18("tbody", { children: data.cptRows.map((row) => /* @__PURE__ */ jsxs18("tr", { children: [
7571
- /* @__PURE__ */ jsx18("td", { className: "mbow-strong", children: row.code }),
7572
- /* @__PURE__ */ jsx18("td", { children: row.bills }),
7573
- /* @__PURE__ */ jsx18("td", { children: row.lines }),
7574
- /* @__PURE__ */ jsx18("td", { className: "mbow-money", children: money6(row.billed) })
8052
+ /* @__PURE__ */ jsx21("tbody", { children: data.cptRows.map((row) => /* @__PURE__ */ jsxs21("tr", { children: [
8053
+ /* @__PURE__ */ jsx21("td", { className: "mbow-strong", children: row.code }),
8054
+ /* @__PURE__ */ jsx21("td", { children: row.bills }),
8055
+ /* @__PURE__ */ jsx21("td", { children: row.lines }),
8056
+ /* @__PURE__ */ jsx21("td", { className: "mbow-money", children: money7(row.billed) })
7575
8057
  ] }, row.code)) })
7576
8058
  ] })
7577
8059
  ] }),
7578
- /* @__PURE__ */ jsxs18("div", { className: "mbow-card mbow-scroll", style: { marginTop: 16 }, children: [
7579
- /* @__PURE__ */ jsx18("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx18("h3", { children: "All original bills" }) }),
7580
- /* @__PURE__ */ jsxs18("table", { className: "mbow-table", children: [
7581
- /* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsxs18("tr", { children: [
7582
- /* @__PURE__ */ jsx18("th", { children: "Bill" }),
7583
- /* @__PURE__ */ jsx18("th", { children: "First submitted" }),
7584
- /* @__PURE__ */ jsx18("th", { children: "Patient \xB7 Claim" }),
7585
- /* @__PURE__ */ jsx18("th", { children: "DOS" }),
7586
- /* @__PURE__ */ jsx18("th", { children: "Claims administrator" }),
7587
- /* @__PURE__ */ jsx18("th", { children: "Codes" }),
7588
- /* @__PURE__ */ jsx18("th", { className: "mbow-money", children: "Billed" }),
7589
- /* @__PURE__ */ jsx18("th", { children: "Status" })
8060
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-card mbow-scroll", style: { marginTop: 16 }, children: [
8061
+ /* @__PURE__ */ jsx21("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx21("h3", { children: "All original bills" }) }),
8062
+ /* @__PURE__ */ jsxs21("table", { className: "mbow-table", children: [
8063
+ /* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
8064
+ /* @__PURE__ */ jsx21("th", { children: "Bill" }),
8065
+ /* @__PURE__ */ jsx21("th", { children: "First submitted" }),
8066
+ /* @__PURE__ */ jsx21("th", { children: "Patient \xB7 Claim" }),
8067
+ /* @__PURE__ */ jsx21("th", { children: "DOS" }),
8068
+ /* @__PURE__ */ jsx21("th", { children: "Claims administrator" }),
8069
+ /* @__PURE__ */ jsx21("th", { children: "Codes" }),
8070
+ /* @__PURE__ */ jsx21("th", { className: "mbow-money", children: "Billed" }),
8071
+ /* @__PURE__ */ jsx21("th", { children: "Status" })
7590
8072
  ] }) }),
7591
- /* @__PURE__ */ jsx18("tbody", { children: data.billRows.map((row) => /* @__PURE__ */ jsxs18("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(row.billId), children: [
7592
- /* @__PURE__ */ jsxs18("td", { className: "mbow-strong", children: [
8073
+ /* @__PURE__ */ jsx21("tbody", { children: data.billRows.map((row) => /* @__PURE__ */ jsxs21("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(row.billId), children: [
8074
+ /* @__PURE__ */ jsxs21("td", { className: "mbow-strong", children: [
7593
8075
  "#",
7594
8076
  row.billNumber
7595
8077
  ] }),
7596
- /* @__PURE__ */ jsx18("td", { children: shortDate(row.submittedDate) }),
7597
- /* @__PURE__ */ jsxs18("td", { children: [
8078
+ /* @__PURE__ */ jsx21("td", { children: shortDate(row.submittedDate) }),
8079
+ /* @__PURE__ */ jsxs21("td", { children: [
7598
8080
  row.patient,
7599
- /* @__PURE__ */ jsx18("div", { className: "mbow-muted", children: row.claim })
8081
+ /* @__PURE__ */ jsx21("div", { className: "mbow-muted", children: row.claim })
7600
8082
  ] }),
7601
- /* @__PURE__ */ jsx18("td", { children: shortDate(row.dos) }),
7602
- /* @__PURE__ */ jsx18("td", { children: row.claimsAdmin }),
7603
- /* @__PURE__ */ jsx18("td", { children: row.codes.join(", ") }),
7604
- /* @__PURE__ */ jsx18("td", { className: "mbow-money", children: money6(row.billed) }),
7605
- /* @__PURE__ */ jsx18("td", { children: row.status })
8083
+ /* @__PURE__ */ jsx21("td", { children: shortDate(row.dos) }),
8084
+ /* @__PURE__ */ jsx21("td", { children: row.claimsAdmin }),
8085
+ /* @__PURE__ */ jsx21("td", { children: row.codes.join(", ") }),
8086
+ /* @__PURE__ */ jsx21("td", { className: "mbow-money", children: money7(row.billed) }),
8087
+ /* @__PURE__ */ jsx21("td", { children: row.status })
7606
8088
  ] }, row.billId)) })
7607
8089
  ] })
7608
8090
  ] })
@@ -7610,19 +8092,19 @@ function ConnectedServiceLineItemsReport({ appearance, className, style, initial
7610
8092
  ] });
7611
8093
  }
7612
8094
  function Metric({ label, value }) {
7613
- return /* @__PURE__ */ jsxs18("div", { className: "mbow-metric", children: [
7614
- /* @__PURE__ */ jsx18("span", { children: label }),
7615
- /* @__PURE__ */ jsx18("strong", { children: value })
8095
+ return /* @__PURE__ */ jsxs21("div", { className: "mbow-metric", children: [
8096
+ /* @__PURE__ */ jsx21("span", { children: label }),
8097
+ /* @__PURE__ */ jsx21("strong", { children: value })
7616
8098
  ] });
7617
8099
  }
7618
8100
  function ConnectedProductivityReport({ appearance, className, style, initialFrom, initialTo, ...options }) {
7619
- const defaults = useMemo10(() => defaultRange(13), []);
8101
+ const defaults = useMemo11(() => defaultRange(13), []);
7620
8102
  const client = useClient(options);
7621
- const [from, setFrom] = useState14(initialFrom ?? defaults.from);
7622
- const [to, setTo] = useState14(initialTo ?? defaults.to);
7623
- const [data, setData] = useState14(null);
7624
- const [error, setError] = useState14(null);
7625
- useEffect12(() => {
8103
+ const [from, setFrom] = useState17(initialFrom ?? defaults.from);
8104
+ const [to, setTo] = useState17(initialTo ?? defaults.to);
8105
+ const [data, setData] = useState17(null);
8106
+ const [error, setError] = useState17(null);
8107
+ useEffect14(() => {
7626
8108
  const controller = new AbortController();
7627
8109
  setError(null);
7628
8110
  void client.getProductivity({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -7631,41 +8113,41 @@ function ConnectedProductivityReport({ appearance, className, style, initialFrom
7631
8113
  return () => controller.abort();
7632
8114
  }, [client, from, to]);
7633
8115
  const maxSent = data ? Math.max(1, ...Object.values(data.sentTotal)) : 1;
7634
- return /* @__PURE__ */ jsxs18(Surface, { appearance, className, style, children: [
7635
- /* @__PURE__ */ jsx18("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs18("div", { children: [
7636
- /* @__PURE__ */ jsx18("h2", { children: "Productivity" }),
7637
- /* @__PURE__ */ jsx18("p", { className: "mbow-sub", children: "Bills created and sent per biller, plus accepted-first-try rate." })
8116
+ return /* @__PURE__ */ jsxs21(Surface, { appearance, className, style, children: [
8117
+ /* @__PURE__ */ jsx21("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs21("div", { children: [
8118
+ /* @__PURE__ */ jsx21("h2", { children: "Productivity" }),
8119
+ /* @__PURE__ */ jsx21("p", { className: "mbow-sub", children: "Bills created and sent per biller, plus accepted-first-try rate." })
7638
8120
  ] }) }),
7639
- /* @__PURE__ */ jsx18(RangeToolbar, { from, to, setFrom, setTo }),
7640
- error ? /* @__PURE__ */ jsx18("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx18("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs18(Fragment15, { children: [
7641
- /* @__PURE__ */ jsxs18("div", { className: "mbow-metrics", children: [
7642
- /* @__PURE__ */ jsx18(Metric, { label: "Bills created", value: String(data.totalCreated) }),
7643
- /* @__PURE__ */ jsx18(Metric, { label: "Transmissions", value: String(data.totalSent) }),
7644
- /* @__PURE__ */ jsx18(Metric, { label: "Bills submitted", value: String(data.totalSubmitted) }),
7645
- /* @__PURE__ */ jsx18(Metric, { label: "Accepted first try", value: data.totalSubmitted ? `${Math.round(data.totalClean / data.totalSubmitted * 100)}%` : "\u2014" })
8121
+ /* @__PURE__ */ jsx21(RangeToolbar, { from, to, setFrom, setTo }),
8122
+ error ? /* @__PURE__ */ jsx21("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx21("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs21(Fragment16, { children: [
8123
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-metrics", children: [
8124
+ /* @__PURE__ */ jsx21(Metric, { label: "Bills created", value: String(data.totalCreated) }),
8125
+ /* @__PURE__ */ jsx21(Metric, { label: "Transmissions", value: String(data.totalSent) }),
8126
+ /* @__PURE__ */ jsx21(Metric, { label: "Bills submitted", value: String(data.totalSubmitted) }),
8127
+ /* @__PURE__ */ jsx21(Metric, { label: "Accepted first try", value: data.totalSubmitted ? `${Math.round(data.totalClean / data.totalSubmitted * 100)}%` : "\u2014" })
7646
8128
  ] }),
7647
- /* @__PURE__ */ jsxs18("div", { className: "mbow-card mbow-scroll", children: [
7648
- /* @__PURE__ */ jsx18("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx18("h3", { children: "Per-biller summary" }) }),
7649
- /* @__PURE__ */ jsxs18("table", { className: "mbow-table", children: [
7650
- /* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsxs18("tr", { children: [
7651
- /* @__PURE__ */ jsx18("th", { children: "Biller" }),
7652
- /* @__PURE__ */ jsx18("th", { children: "Created" }),
7653
- /* @__PURE__ */ jsx18("th", { children: "Transmissions" }),
7654
- /* @__PURE__ */ jsx18("th", { children: "Submitted" }),
7655
- /* @__PURE__ */ jsx18("th", { children: "Accepted first try" }),
7656
- /* @__PURE__ */ jsx18("th", { children: "Volume" })
8129
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-card mbow-scroll", children: [
8130
+ /* @__PURE__ */ jsx21("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx21("h3", { children: "Per-biller summary" }) }),
8131
+ /* @__PURE__ */ jsxs21("table", { className: "mbow-table", children: [
8132
+ /* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
8133
+ /* @__PURE__ */ jsx21("th", { children: "Biller" }),
8134
+ /* @__PURE__ */ jsx21("th", { children: "Created" }),
8135
+ /* @__PURE__ */ jsx21("th", { children: "Transmissions" }),
8136
+ /* @__PURE__ */ jsx21("th", { children: "Submitted" }),
8137
+ /* @__PURE__ */ jsx21("th", { children: "Accepted first try" }),
8138
+ /* @__PURE__ */ jsx21("th", { children: "Volume" })
7657
8139
  ] }) }),
7658
- /* @__PURE__ */ jsx18("tbody", { children: data.billers.map((biller) => {
8140
+ /* @__PURE__ */ jsx21("tbody", { children: data.billers.map((biller) => {
7659
8141
  const sent = data.sentTotal[biller.name] ?? 0;
7660
8142
  const submitted = data.submittedTotal[biller.name] ?? 0;
7661
8143
  const clean = data.cleanTotal[biller.name] ?? 0;
7662
- return /* @__PURE__ */ jsxs18("tr", { children: [
7663
- /* @__PURE__ */ jsx18("td", { className: "mbow-strong", children: biller.name }),
7664
- /* @__PURE__ */ jsx18("td", { children: data.createdTotal[biller.name] ?? 0 }),
7665
- /* @__PURE__ */ jsx18("td", { children: sent }),
7666
- /* @__PURE__ */ jsx18("td", { children: submitted }),
7667
- /* @__PURE__ */ jsx18("td", { children: submitted ? `${Math.round(clean / submitted * 100)}%` : "\u2014" }),
7668
- /* @__PURE__ */ jsx18("td", { children: /* @__PURE__ */ jsx18("div", { className: "mbow-bar", children: /* @__PURE__ */ jsx18("i", { style: { width: `${sent / maxSent * 100}%` } }) }) })
8144
+ return /* @__PURE__ */ jsxs21("tr", { children: [
8145
+ /* @__PURE__ */ jsx21("td", { className: "mbow-strong", children: biller.name }),
8146
+ /* @__PURE__ */ jsx21("td", { children: data.createdTotal[biller.name] ?? 0 }),
8147
+ /* @__PURE__ */ jsx21("td", { children: sent }),
8148
+ /* @__PURE__ */ jsx21("td", { children: submitted }),
8149
+ /* @__PURE__ */ jsx21("td", { children: submitted ? `${Math.round(clean / submitted * 100)}%` : "\u2014" }),
8150
+ /* @__PURE__ */ jsx21("td", { children: /* @__PURE__ */ jsx21("div", { className: "mbow-bar", children: /* @__PURE__ */ jsx21("i", { style: { width: `${sent / maxSent * 100}%` } }) }) })
7669
8151
  ] }, biller.name);
7670
8152
  }) })
7671
8153
  ] })
@@ -7673,45 +8155,45 @@ function ConnectedProductivityReport({ appearance, className, style, initialFrom
7673
8155
  ] })
7674
8156
  ] });
7675
8157
  }
7676
- function ConnectedBillingWorkspace({ appearance, className, style, initialView = "tasks", onCreateBill, getCourtesyCopyRecipientOptions, ...options }) {
8158
+ function ConnectedBillingWorkspace({ appearance, className, style, initialView = "tasks", onCreateBill, onPostPayment, sandboxControls = false, getCourtesyCopyRecipientOptions, ...options }) {
7677
8159
  const client = useClient(options);
7678
- const [view, setView] = useState14(initialView);
7679
- const [billQuery, setBillQuery] = useState14({ status: "all" });
7680
- const [selectedBillId, setSelectedBillId] = useState14(null);
8160
+ const [view, setView] = useState17(initialView);
8161
+ const [billQuery, setBillQuery] = useState17({ status: "all" });
8162
+ const [selectedBillId, setSelectedBillId] = useState17(null);
7681
8163
  const { workspaceRef, availableHeight } = useAvailableViewportHeight();
7682
8164
  const workspaceClassName = ["mbow-workspace", className].filter(Boolean).join(" ");
7683
8165
  const hasExplicitHeight = style?.height != null || style?.maxHeight != null;
7684
8166
  const workspaceStyle = availableHeight == null || hasExplicitHeight ? style : { ...style, maxHeight: availableHeight };
7685
- if (selectedBillId) return /* @__PURE__ */ jsxs18(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
7686
- /* @__PURE__ */ jsx18("button", { className: "mbow-button mbow-back", type: "button", onClick: () => setSelectedBillId(null), children: "\u2190 Back to bills" }),
7687
- /* @__PURE__ */ jsx18(ConnectedBillLifecycle, { billId: selectedBillId, courtesyCopyRecipientOptions: getCourtesyCopyRecipientOptions?.(selectedBillId) ?? [], ...options, ...appearance ? { appearance } : {} })
8167
+ if (selectedBillId) return /* @__PURE__ */ jsxs21(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
8168
+ /* @__PURE__ */ jsx21("button", { className: "mbow-button mbow-back", type: "button", onClick: () => setSelectedBillId(null), children: "\u2190 Back to bills" }),
8169
+ /* @__PURE__ */ jsx21(ConnectedBillLifecycle, { billId: selectedBillId, sandboxControls, courtesyCopyRecipientOptions: getCourtesyCopyRecipientOptions?.(selectedBillId) ?? [], ...options, ...appearance ? { appearance } : {} })
7688
8170
  ] });
7689
8171
  const selectView = (next) => {
7690
8172
  setView(next);
7691
8173
  setSelectedBillId(null);
7692
8174
  };
7693
8175
  const appearanceProps = appearance ? { appearance } : {};
7694
- return /* @__PURE__ */ jsxs18(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
7695
- /* @__PURE__ */ jsxs18("div", { className: "mbow-head", children: [
7696
- /* @__PURE__ */ jsxs18("div", { children: [
7697
- /* @__PURE__ */ jsx18("h2", { children: "Billing" }),
7698
- /* @__PURE__ */ jsx18("p", { className: "mbow-sub", children: "Follow up on open work or find any bill and its current status." })
8176
+ return /* @__PURE__ */ jsxs21(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
8177
+ /* @__PURE__ */ jsxs21("div", { className: "mbow-head", children: [
8178
+ /* @__PURE__ */ jsxs21("div", { children: [
8179
+ /* @__PURE__ */ jsx21("h2", { children: "Billing" }),
8180
+ /* @__PURE__ */ jsx21("p", { className: "mbow-sub", children: "Follow up on open work or find any bill and its current status." })
7699
8181
  ] }),
7700
- onCreateBill ? /* @__PURE__ */ jsx18("div", { className: "mbow-actions", children: /* @__PURE__ */ jsx18("button", { className: "mbow-button primary", type: "button", onClick: onCreateBill, children: "+ Add bill" }) }) : null
8182
+ onCreateBill ? /* @__PURE__ */ jsx21("div", { className: "mbow-actions", children: /* @__PURE__ */ jsx21("button", { className: "mbow-button primary", type: "button", onClick: onCreateBill, children: "+ Add bill" }) }) : null
7701
8183
  ] }),
7702
- /* @__PURE__ */ jsx18("div", { className: "mbow-tabs", role: "tablist", children: [["tasks", "Bill tasks"], ["bills", "All bills"], ["procedures", "Procedures"], ["productivity", "Productivity"]].map(([id, label]) => /* @__PURE__ */ jsx18("button", { className: `mbow-tab ${view === id ? "active" : ""}`, type: "button", role: "tab", "aria-selected": view === id, onClick: () => selectView(id), children: label }, id)) }),
7703
- view === "tasks" ? /* @__PURE__ */ jsx18(BillTasksContent, { client, onDrillDown: (query) => {
8184
+ /* @__PURE__ */ jsx21("div", { className: "mbow-tabs", role: "tablist", children: [["tasks", "Bill tasks"], ["bills", "All bills"], ["procedures", "Procedures"], ["productivity", "Productivity"], ["payments", "Payment review"]].map(([id, label]) => /* @__PURE__ */ jsx21("button", { className: `mbow-tab ${view === id ? "active" : ""}`, type: "button", role: "tab", "aria-selected": view === id, onClick: () => selectView(id), children: label }, id)) }),
8185
+ view === "tasks" ? /* @__PURE__ */ jsx21(BillTasksContent, { client, onDrillDown: (query) => {
7704
8186
  setBillQuery(query);
7705
8187
  setView("bills");
7706
- }, appearance }) : view === "bills" ? /* @__PURE__ */ jsx18(BillSearchContent, { client, initialQuery: billQuery, onSelectBill: (bill) => setSelectedBillId(bill.id) }) : view === "procedures" ? /* @__PURE__ */ jsx18(ConnectedServiceLineItemsReport, { ...options, ...appearanceProps, onSelectBill: setSelectedBillId }) : /* @__PURE__ */ jsx18(ConnectedProductivityReport, { ...options, ...appearanceProps })
8188
+ }, appearance }) : view === "bills" ? /* @__PURE__ */ jsx21(BillSearchContent, { client, initialQuery: billQuery, onSelectBill: (bill) => setSelectedBillId(bill.id) }) : view === "procedures" ? /* @__PURE__ */ jsx21(ConnectedServiceLineItemsReport, { ...options, ...appearanceProps, onSelectBill: setSelectedBillId }) : view === "payments" ? /* @__PURE__ */ jsx21(ConnectedPaymentReview, { ...options, ...appearanceProps, ...onPostPayment ? { onPostPayment } : {}, onSelectBill: setSelectedBillId }) : /* @__PURE__ */ jsx21(ConnectedProductivityReport, { ...options, ...appearanceProps })
7707
8189
  ] });
7708
8190
  }
7709
8191
 
7710
8192
  // src/index.tsx
7711
8193
  function widget(tagName, props) {
7712
- const ref = useRef9(null);
8194
+ const ref = useRef10(null);
7713
8195
  const { onMindBill, onMindBillError } = props;
7714
- useEffect13(() => {
8196
+ useEffect15(() => {
7715
8197
  const element = ref.current;
7716
8198
  if (!element) return;
7717
8199
  const handleEvent = (event) => onMindBill?.(event);
@@ -7790,6 +8272,8 @@ export {
7790
8272
  ConnectedBillStatus,
7791
8273
  ConnectedBillTasksDashboard,
7792
8274
  ConnectedBillingWorkspace,
8275
+ ConnectedNotificationSettings,
8276
+ ConnectedPaymentReview,
7793
8277
  ConnectedProductivityReport,
7794
8278
  ConnectedServiceLineItemsReport,
7795
8279
  DEFAULT_BILL_SUBMISSION_MODIFIERS,
@@ -7798,6 +8282,7 @@ export {
7798
8282
  MED_LEGAL_REPORT_TYPE_CODE,
7799
8283
  MindBillBillReview,
7800
8284
  MindBillBillTimeline,
8285
+ NotificationSettings,
7801
8286
  OrganizationOnboarding,
7802
8287
  PSYCH_QME_DEFAULT_DIAGNOSIS,
7803
8288
  REPORT_BILL_STATUS_OPTIONS2 as REPORT_BILL_STATUS_OPTIONS,
@@ -7807,6 +8292,7 @@ export {
7807
8292
  SECOND_REVIEW_WINDOW_DAYS,
7808
8293
  SecondReviewForm,
7809
8294
  SendRouteDialog,
8295
+ W9Upload,
7810
8296
  applyBillSubmissionEvaluationDiagnoses,
7811
8297
  applyBillSubmissionEvaluationModifiers,
7812
8298
  billActivityEventLabel,