@trajectonomics/tax 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +48 -2
- package/dist/clamp-BKG7kjVf.cjs +509 -0
- package/dist/clamp-BKG7kjVf.cjs.map +1 -0
- package/dist/clamp-Bse4u0H-.mjs +426 -0
- package/dist/clamp-Bse4u0H-.mjs.map +1 -0
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +102 -0
- package/dist/index.d.mts +102 -0
- package/dist/index.mjs +15 -0
- package/dist/index.mjs.map +1 -0
- package/dist/th/index.cjs +1480 -0
- package/dist/th/index.cjs.map +1 -0
- package/dist/th/index.d.cts +636 -0
- package/dist/th/index.d.mts +636 -0
- package/dist/th/index.mjs +1473 -0
- package/dist/th/index.mjs.map +1 -0
- package/dist/types-798sLpt6.d.cts +170 -0
- package/dist/types-798sLpt6.d.mts +170 -0
- package/dist/us/index.cjs +2921 -0
- package/dist/us/index.cjs.map +1 -0
- package/dist/us/index.d.cts +649 -0
- package/dist/us/index.d.mts +649 -0
- package/dist/us/index.mjs +2897 -0
- package/dist/us/index.mjs.map +1 -0
- package/package.json +78 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["toMinorUnits","STATES","STATES","usd","fromMinorUnits","toMinorUnits","clampCap","fromMinorUnits","usd","toMinorUnits","usd","fromMinorUnits","toMinorUnits","usd","fromMinorUnits","toMinorUnits","fromMinorUnits","usd","usd","fromMinorUnits","toMinorUnits","toMinorUnits","toMinorUnits","usd","fromMinorUnits","fromMinorUnits","usd","toMinorUnits","fromMinorUnits","usd","toMinorUnits","applyPercentage","fromMinorUnits","clampCap","usd","toMinorUnits","usd","fromMinorUnits","usd","fromMinorUnits","usd","fromMinorUnits","toMinorUnits","toMinorUnits","applyPercentage","usd","fromMinorUnits","applyPercentage","usd","fromMinorUnits","usd","fromMinorUnits","toMinorUnits","toMinorUnits","applyPercentage","toMinorUnits","multiplySafeInteger","toMinorUnits","applyPercentage","evaluateBrackets","TaxValidationError","evaluateBrackets","toMinorUnits"],"sources":["../../src/us/parameters/amt.ts","../../src/us/parameters/brackets.ts","../../src/us/parameters/constants.ts","../../src/us/parameters/credits-eitc.ts","../../src/us/parameters/credits.ts","../../src/us/parameters/payroll.ts","../../src/us/parameters.ts","../../src/us/types/state-fields.ts","../../src/us/state/parameters/helpers.ts","../../src/us/state/parameters/flat/flat-a.ts","../../src/us/state/parameters/flat/flat-b.ts","../../src/us/state/parameters/flat/flat-c.ts","../../src/us/state/parameters/flat/index.ts","../../src/us/state/parameters/none.ts","../../src/us/state/parameters/progressive/al.ts","../../src/us/state/parameters/progressive/ar.ts","../../src/us/state/parameters/progressive/ca.ts","../../src/us/state/parameters/progressive/ct.ts","../../src/us/state/parameters/progressive/dc.ts","../../src/us/state/parameters/progressive/de.ts","../../src/us/state/parameters/progressive/hi.ts","../../src/us/state/parameters/progressive/ks.ts","../../src/us/state/parameters/progressive/md.ts","../../src/us/state/parameters/progressive/me.ts","../../src/us/state/parameters/progressive/mn.ts","../../src/us/state/parameters/progressive/mo.ts","../../src/us/state/parameters/progressive/mt.ts","../../src/us/state/parameters/progressive/nd.ts","../../src/us/state/parameters/progressive/ne.ts","../../src/us/state/parameters/progressive/nj.ts","../../src/us/state/parameters/progressive/nm.ts","../../src/us/state/parameters/progressive/ny.ts","../../src/us/state/parameters/progressive/ok.ts","../../src/us/state/parameters/progressive/or.ts","../../src/us/state/parameters/progressive/ri.ts","../../src/us/state/parameters/progressive/sc.ts","../../src/us/state/parameters/progressive/va.ts","../../src/us/state/parameters/progressive/vt.ts","../../src/us/state/parameters/progressive/wi.ts","../../src/us/state/parameters/progressive/wv.ts","../../src/us/state/parameters/progressive/index.ts","../../src/us/state/parameters/index.ts","../../src/us/calculate-result.ts","../../src/us/stages/adjustments.ts","../../src/us/stages/agi.ts","../../src/us/types/fields.ts","../../src/us/stages/amt.ts","../../src/us/stages/credits-child.ts","../../src/us/stages/credits-eitc.ts","../../src/us/stages/credits-care.ts","../../src/us/stages/credits-other.ts","../../src/us/stages/se.ts","../../src/us/stages/credits.ts","../../src/us/stages/itemized-deduction.ts","../../src/us/stages/standard-deduction.ts","../../src/us/stages/deductions.ts","../../src/us/stages/fica.ts","../../src/us/stages/niit.ts","../../src/us/stages/preferential.ts","../../src/us/state/breakdown.ts","../../src/us/state/credits.ts","../../src/us/state/phase-out.ts","../../src/us/state/deductions.ts","../../src/us/state/surtax.ts","../../src/us/stages/state.ts","../../src/us/types/state.ts","../../src/us/validate.ts","../../src/us/calculate.ts","../../src/us/system.ts"],"sourcesContent":["import type { UsFilingStatus } from \"../types\"\n\nexport interface UsAmtParameters {\n\treadonly baseExemptions: Record<UsFilingStatus, number>\n\treadonly phaseoutThresholds: Record<UsFilingStatus, number>\n\treadonly phaseoutRate: number\n\treadonly rate26Thresholds: Record<UsFilingStatus, number>\n\treadonly rate26: number\n\treadonly rate28: number\n}\n\n/**\n * Statutory 2026 Alternative Minimum Tax (AMT) exemptions, phaseouts, and rates.\n *\n * @statute IRC § 55\n */\nexport const US_2026_AMT: UsAmtParameters = {\n\tbaseExemptions: {\n\t\tsingle: 90_100,\n\t\tmarried_filing_jointly: 140_200,\n\t\tmarried_filing_separately: 70_100,\n\t\thead_of_household: 90_100,\n\t},\n\tphaseoutThresholds: {\n\t\tsingle: 643_250,\n\t\tmarried_filing_jointly: 1_286_500,\n\t\tmarried_filing_separately: 643_250,\n\t\thead_of_household: 643_250,\n\t},\n\tphaseoutRate: 0.25,\n\trate26Thresholds: {\n\t\tsingle: 239_100,\n\t\tmarried_filing_jointly: 239_100,\n\t\tmarried_filing_separately: 119_550,\n\t\thead_of_household: 239_100,\n\t},\n\trate26: 0.26,\n\trate28: 0.28,\n}\n","import type { TaxBracket } from \"../../core/brackets\"\nimport type { UsFilingStatus } from \"../types\"\n\n/**\n * Statutory 2026 US Federal ordinary income progressive brackets in minor units (cents).\n *\n * @statute IRC § 1(j), Rev. Proc. 2025-XX\n */\nexport const US_2026_ORDINARY_BRACKETS: Record<UsFilingStatus, readonly TaxBracket[]> = {\n\tsingle: [\n\t\t{ upTo: 1_240_000, rate: 0.1 },\n\t\t{ upTo: 5_040_000, rate: 0.12 },\n\t\t{ upTo: 10_570_000, rate: 0.22 },\n\t\t{ upTo: 20_177_500, rate: 0.24 },\n\t\t{ upTo: 25_622_500, rate: 0.32 },\n\t\t{ upTo: 64_060_000, rate: 0.35 },\n\t\t{ upTo: null, rate: 0.37 },\n\t],\n\tmarried_filing_jointly: [\n\t\t{ upTo: 2_480_000, rate: 0.1 },\n\t\t{ upTo: 10_080_000, rate: 0.12 },\n\t\t{ upTo: 21_140_000, rate: 0.22 },\n\t\t{ upTo: 40_355_000, rate: 0.24 },\n\t\t{ upTo: 51_245_000, rate: 0.32 },\n\t\t{ upTo: 76_870_000, rate: 0.35 },\n\t\t{ upTo: null, rate: 0.37 },\n\t],\n\tmarried_filing_separately: [\n\t\t{ upTo: 1_240_000, rate: 0.1 },\n\t\t{ upTo: 5_040_000, rate: 0.12 },\n\t\t{ upTo: 10_570_000, rate: 0.22 },\n\t\t{ upTo: 20_177_500, rate: 0.24 },\n\t\t{ upTo: 25_622_500, rate: 0.32 },\n\t\t{ upTo: 38_435_000, rate: 0.35 },\n\t\t{ upTo: null, rate: 0.37 },\n\t],\n\thead_of_household: [\n\t\t{ upTo: 1_770_000, rate: 0.1 },\n\t\t{ upTo: 6_745_000, rate: 0.12 },\n\t\t{ upTo: 10_570_000, rate: 0.22 },\n\t\t{ upTo: 20_175_000, rate: 0.24 },\n\t\t{ upTo: 25_620_000, rate: 0.32 },\n\t\t{ upTo: 64_060_000, rate: 0.35 },\n\t\t{ upTo: null, rate: 0.37 },\n\t],\n}\n\n/**\n * Statutory 2026 US Federal preferential capital gains brackets in minor units (cents).\n *\n * @statute IRC § 1(h), Rev. Proc. 2025-XX\n */\nexport const US_2026_PREFERENTIAL_BRACKETS: Record<UsFilingStatus, readonly TaxBracket[]> = {\n\tsingle: [\n\t\t{ upTo: 4_945_000, rate: 0.0 },\n\t\t{ upTo: 54_550_000, rate: 0.15 },\n\t\t{ upTo: null, rate: 0.2 },\n\t],\n\tmarried_filing_jointly: [\n\t\t{ upTo: 9_890_000, rate: 0.0 },\n\t\t{ upTo: 61_370_000, rate: 0.15 },\n\t\t{ upTo: null, rate: 0.2 },\n\t],\n\tmarried_filing_separately: [\n\t\t{ upTo: 4_945_000, rate: 0.0 },\n\t\t{ upTo: 30_685_000, rate: 0.15 },\n\t\t{ upTo: null, rate: 0.2 },\n\t],\n\thead_of_household: [\n\t\t{ upTo: 6_620_000, rate: 0.0 },\n\t\t{ upTo: 57_960_000, rate: 0.15 },\n\t\t{ upTo: null, rate: 0.2 },\n\t],\n}\n","import type { UsFilingStatus } from \"../types\"\n\nexport interface UsAdditionalStandardDeduction {\n\treadonly unmarried: number\n\treadonly married: number\n}\n\nexport interface UsAboveTheLineCaps {\n\treadonly educatorSingle: number\n\treadonly educatorMfjBoth: number\n\treadonly studentLoanInterest: number\n\treadonly traditional401kBase: number\n\treadonly traditional401kCatchUpAge50: number\n\treadonly traditionalIraBase: number\n\treadonly traditionalIraCatchUpAge50: number\n\treadonly hsaSelfOnlyBase: number\n\treadonly hsaFamilyBase: number\n\treadonly hsaCatchUpAge55: number\n}\n\nexport interface UsItemizedParameters {\n\treadonly medicalFloorRate: number\n\treadonly saltCap: number\n\treadonly saltCapMfs: number\n\treadonly charityCeilingRate: number\n}\n\nexport interface UsNiitParameters {\n\treadonly rate: number\n\treadonly thresholds: Record<UsFilingStatus, number>\n}\n\n/**\n * Statutory 2026 US Federal base standard deduction amounts in major dollars.\n *\n * @statute IRC § 63(c)(2), Rev. Proc. 2025-XX\n */\nexport const US_2026_STANDARD_DEDUCTION: Record<UsFilingStatus, number> = {\n\tsingle: 16_100,\n\tmarried_filing_jointly: 32_200,\n\tmarried_filing_separately: 16_100,\n\thead_of_household: 24_150,\n}\n\n/**\n * Statutory 2026 additional standard deduction for age 65+ and blindness per condition.\n *\n * @statute IRC § 63(f), Rev. Proc. 2025-XX\n */\nexport const US_2026_ADDITIONAL_STANDARD_DEDUCTION: UsAdditionalStandardDeduction = {\n\tunmarried: 2_050,\n\tmarried: 1_650,\n}\n\n/**\n * Statutory 2026 Schedule 1 Above-the-Line deduction limits in major dollars.\n *\n * @statute IRC § 62, § 219, § 221, § 223, § 402(g)\n */\nexport const US_2026_ABOVE_THE_LINE_CAPS: UsAboveTheLineCaps = {\n\teducatorSingle: 350,\n\teducatorMfjBoth: 700,\n\tstudentLoanInterest: 2_500,\n\ttraditional401kBase: 24_500,\n\ttraditional401kCatchUpAge50: 8_000,\n\ttraditionalIraBase: 7_500,\n\ttraditionalIraCatchUpAge50: 1_100,\n\thsaSelfOnlyBase: 4_400,\n\thsaFamilyBase: 8_750,\n\thsaCatchUpAge55: 1_000,\n}\n\n/**\n * Statutory 2026 Schedule A Itemized Deduction thresholds and caps.\n *\n * @statute IRC §§ 164, 170, 213\n */\nexport const US_2026_ITEMIZED: UsItemizedParameters = {\n\tmedicalFloorRate: 0.075,\n\tsaltCap: 10_000,\n\tsaltCapMfs: 5_000,\n\tcharityCeilingRate: 0.6,\n}\n\n/**\n * Statutory Net Investment Income Tax (NIIT) rates and MAGI thresholds.\n *\n * @statute IRC § 1411\n */\nexport const US_2026_NIIT: UsNiitParameters = {\n\trate: 0.038,\n\tthresholds: {\n\t\tsingle: 200_000,\n\t\thead_of_household: 200_000,\n\t\tmarried_filing_jointly: 250_000,\n\t\tmarried_filing_separately: 125_000,\n\t},\n}\n","export interface UsEitcTier {\n\treadonly creditRate: number\n\treadonly maxEarnedIncome: number\n\treadonly maxCredit: number\n\treadonly phaseoutThresholdSingle: number\n\treadonly phaseoutThresholdMfj: number\n\treadonly phaseoutRate: number\n}\n\nexport const US_2026_EITC_TIERS: Record<0 | 1 | 2 | 3, UsEitcTier> = {\n\t0: {\n\t\tcreditRate: 0.0765,\n\t\tmaxEarnedIncome: 8_490,\n\t\tmaxCredit: 649,\n\t\tphaseoutThresholdSingle: 10_620,\n\t\tphaseoutThresholdMfj: 17_990,\n\t\tphaseoutRate: 0.0765,\n\t},\n\t1: {\n\t\tcreditRate: 0.34,\n\t\tmaxEarnedIncome: 12_730,\n\t\tmaxCredit: 4_328,\n\t\tphaseoutThresholdSingle: 23_340,\n\t\tphaseoutThresholdMfj: 30_710,\n\t\tphaseoutRate: 0.1598,\n\t},\n\t2: {\n\t\tcreditRate: 0.4,\n\t\tmaxEarnedIncome: 17_880,\n\t\tmaxCredit: 7_152,\n\t\tphaseoutThresholdSingle: 23_340,\n\t\tphaseoutThresholdMfj: 30_710,\n\t\tphaseoutRate: 0.2106,\n\t},\n\t3: {\n\t\tcreditRate: 0.45,\n\t\tmaxEarnedIncome: 17_880,\n\t\tmaxCredit: 8_046,\n\t\tphaseoutThresholdSingle: 23_340,\n\t\tphaseoutThresholdMfj: 30_710,\n\t\tphaseoutRate: 0.2106,\n\t},\n}\n","import type { UsFilingStatus } from \"../types\"\nimport { US_2026_EITC_TIERS, type UsEitcTier } from \"./credits-eitc\"\n\nexport type { UsEitcTier }\n\nexport interface UsCreditsParameters {\n\treadonly ctcAmountPerChild: number\n\treadonly actcMaxPerChild: number\n\treadonly actcEarnedIncomeThreshold: number\n\treadonly actcRate: number\n\treadonly ctcPhaseoutThresholds: Record<UsFilingStatus, number>\n\treadonly ctcPhaseoutStepAmount: number\n\treadonly ctcPhaseoutStepRate: number\n\treadonly odcAmountPerDependent: number\n\treadonly eitcInvestmentIncomeLimit: number\n\treadonly eitcTiers: Record<0 | 1 | 2 | 3, UsEitcTier>\n\treadonly careMaxExpenseOne: number\n\treadonly careMaxExpenseTwoPlus: number\n\treadonly careBaseRate: number\n\treadonly careFloorRate: number\n\treadonly carePhaseoutAgiThreshold: number\n\treadonly carePhaseoutStepAgi: number\n\treadonly carePhaseoutStepRate: number\n\treadonly aotcMaxPerStudent: number\n\treadonly aotcTier1MaxExpense: number\n\treadonly aotcTier1Rate: number\n\treadonly aotcTier2MaxExpense: number\n\treadonly aotcTier2Rate: number\n\treadonly aotcRefundableRate: number\n\treadonly aotcPhaseoutMin: Record<UsFilingStatus, number>\n\treadonly aotcPhaseoutMax: Record<UsFilingStatus, number>\n\treadonly llcMaxExpensePerReturn: number\n\treadonly llcRate: number\n}\n\n/**\n * Statutory 2026 Federal Tax Credits parameters.\n *\n * @statute IRC § 21, § 24, § 25A, § 32\n */\nexport const US_2026_CREDITS: UsCreditsParameters = {\n\tctcAmountPerChild: 2_000,\n\tactcMaxPerChild: 1_700,\n\tactcEarnedIncomeThreshold: 2_500,\n\tactcRate: 0.15,\n\tctcPhaseoutThresholds: {\n\t\tsingle: 200_000,\n\t\tmarried_filing_jointly: 400_000,\n\t\tmarried_filing_separately: 200_000,\n\t\thead_of_household: 200_000,\n\t},\n\tctcPhaseoutStepAmount: 1_000,\n\tctcPhaseoutStepRate: 50,\n\todcAmountPerDependent: 500,\n\teitcInvestmentIncomeLimit: 11_950,\n\teitcTiers: US_2026_EITC_TIERS,\n\tcareMaxExpenseOne: 3_000,\n\tcareMaxExpenseTwoPlus: 6_000,\n\tcareBaseRate: 0.35,\n\tcareFloorRate: 0.2,\n\tcarePhaseoutAgiThreshold: 15_000,\n\tcarePhaseoutStepAgi: 2_000,\n\tcarePhaseoutStepRate: 0.01,\n\taotcMaxPerStudent: 2_500,\n\taotcTier1MaxExpense: 2_000,\n\taotcTier1Rate: 1.0,\n\taotcTier2MaxExpense: 2_000,\n\taotcTier2Rate: 0.25,\n\taotcRefundableRate: 0.4,\n\taotcPhaseoutMin: {\n\t\tsingle: 80_000,\n\t\thead_of_household: 80_000,\n\t\tmarried_filing_jointly: 160_000,\n\t\tmarried_filing_separately: 0,\n\t},\n\taotcPhaseoutMax: {\n\t\tsingle: 90_000,\n\t\thead_of_household: 90_000,\n\t\tmarried_filing_jointly: 180_000,\n\t\tmarried_filing_separately: 0,\n\t},\n\tllcMaxExpensePerReturn: 10_000,\n\tllcRate: 0.2,\n}\n","import type { UsFilingStatus } from \"../types\"\n\nexport interface UsPayrollParameters {\n\treadonly socialSecurityWageBase: number\n\treadonly ficaSocialSecurityRate: number\n\treadonly ficaMedicareRate: number\n\treadonly additionalMedicareRate: number\n\treadonly additionalMedicareThresholds: Record<UsFilingStatus, number>\n\treadonly seNetEarningsFactor: number\n\treadonly seThresholdFloor: number\n\treadonly seSocialSecurityRate: number\n\treadonly seMedicareRate: number\n\treadonly seDeductibleRate: number\n}\n\n/**\n * Statutory 2026 FICA & SECA Payroll parameters.\n *\n * @statute IRC § 1401, § 1402, § 3101\n */\nexport const US_2026_PAYROLL: UsPayrollParameters = {\n\tsocialSecurityWageBase: 181_800,\n\tficaSocialSecurityRate: 0.062,\n\tficaMedicareRate: 0.0145,\n\tadditionalMedicareRate: 0.009,\n\tadditionalMedicareThresholds: {\n\t\tsingle: 200_000,\n\t\tmarried_filing_jointly: 250_000,\n\t\tmarried_filing_separately: 125_000,\n\t\thead_of_household: 200_000,\n\t},\n\tseNetEarningsFactor: 0.9235,\n\tseThresholdFloor: 400,\n\tseSocialSecurityRate: 0.124,\n\tseMedicareRate: 0.029,\n\tseDeductibleRate: 0.5,\n}\n","import type { TaxBracket } from \"../core/brackets\"\nimport { US_2026_AMT, type UsAmtParameters } from \"./parameters/amt\"\nimport { US_2026_ORDINARY_BRACKETS, US_2026_PREFERENTIAL_BRACKETS } from \"./parameters/brackets\"\nimport {\n\tUS_2026_ABOVE_THE_LINE_CAPS,\n\tUS_2026_ADDITIONAL_STANDARD_DEDUCTION,\n\tUS_2026_ITEMIZED,\n\tUS_2026_NIIT,\n\tUS_2026_STANDARD_DEDUCTION,\n\ttype UsAboveTheLineCaps,\n\ttype UsAdditionalStandardDeduction,\n\ttype UsItemizedParameters,\n\ttype UsNiitParameters,\n} from \"./parameters/constants\"\nimport { US_2026_CREDITS, type UsCreditsParameters } from \"./parameters/credits\"\nimport { US_2026_PAYROLL, type UsPayrollParameters } from \"./parameters/payroll\"\nimport type { UsFilingStatus } from \"./types\"\n\nexport interface UsTaxParameters {\n\treadonly taxYear: 2026\n\treadonly currency: \"USD\"\n\treadonly standardDeduction: Record<UsFilingStatus, number>\n\treadonly additionalStandardDeduction: UsAdditionalStandardDeduction\n\treadonly aboveTheLineCaps: UsAboveTheLineCaps\n\treadonly itemized: UsItemizedParameters\n\treadonly niit: UsNiitParameters\n\treadonly ordinaryBrackets: Record<UsFilingStatus, readonly TaxBracket[]>\n\treadonly preferentialBrackets: Record<UsFilingStatus, readonly TaxBracket[]>\n\treadonly payroll: UsPayrollParameters\n\treadonly amt: UsAmtParameters\n\treadonly credits: UsCreditsParameters\n}\n\n/**\n * Consolidated statutory parameter table for US Federal Income Tax (Tax Year 2026).\n *\n * @statute IRC § 1 et seq.\n */\nexport const US_2026_PARAMETERS: UsTaxParameters = {\n\ttaxYear: 2026,\n\tcurrency: \"USD\",\n\tstandardDeduction: US_2026_STANDARD_DEDUCTION,\n\tadditionalStandardDeduction: US_2026_ADDITIONAL_STANDARD_DEDUCTION,\n\taboveTheLineCaps: US_2026_ABOVE_THE_LINE_CAPS,\n\titemized: US_2026_ITEMIZED,\n\tniit: US_2026_NIIT,\n\tordinaryBrackets: US_2026_ORDINARY_BRACKETS,\n\tpreferentialBrackets: US_2026_PREFERENTIAL_BRACKETS,\n\tpayroll: US_2026_PAYROLL,\n\tamt: US_2026_AMT,\n\tcredits: US_2026_CREDITS,\n}\n\nexport {\n\tUS_2026_ABOVE_THE_LINE_CAPS,\n\tUS_2026_ADDITIONAL_STANDARD_DEDUCTION,\n\tUS_2026_AMT,\n\tUS_2026_CREDITS,\n\tUS_2026_ITEMIZED,\n\tUS_2026_NIIT,\n\tUS_2026_ORDINARY_BRACKETS,\n\tUS_2026_PAYROLL,\n\tUS_2026_PREFERENTIAL_BRACKETS,\n\tUS_2026_STANDARD_DEDUCTION,\n}\n","/**\n * Diagnostic and reporting field identifiers for state income tax calculations.\n */\nexport enum UsStateField {\n\tBracketBound = \"state.bracketBound\",\n\tAgi = \"state.agi\",\n\tStandardDeduction = \"state.standardDeduction\",\n\tPersonalExemption = \"state.personalExemption\",\n\tDependentExemption = \"state.dependentExemption\",\n\tTaxableIncome = \"state.taxableIncome\",\n\tBracketTax = \"state.bracketTax\",\n\tSurtax = \"state.surtax\",\n\tSurtaxThreshold = \"state.surtaxThreshold\",\n\tPhaseOutThreshold = \"state.phaseOutThreshold\",\n\tCreditsPersonal = \"state.credits.personal\",\n\tCreditsDependent = \"state.credits.dependent\",\n\tCreditsClaimedNonRefundable = \"state.credits.claimedNonRefundable\",\n\tCreditsNonRefundable = \"state.credits.nonRefundable\",\n\tCreditsRefundable = \"state.credits.refundable\",\n\tWithholding = \"state.withholding\",\n\tTaxBeforeCredits = \"state.taxBeforeCredits\",\n\tTotalTax = \"state.totalTax\",\n\tNetTaxPayable = \"state.netTaxPayable\",\n}\n","import type { TaxBracket } from \"../../../core/brackets\"\nimport { toMinorUnits } from \"../../../core/money\"\nimport { US_2026_PARAMETERS } from \"../../parameters\"\nimport type { UsFilingStatus, UsStateCode } from \"../../types\"\nimport { UsStateField } from \"../../types/state-fields\"\nimport type { UsStateBracketTiers, UsStateDefinition, UsStateParameters } from \"./types\"\n\nfunction tiersToBrackets(tiers: UsStateBracketTiers): readonly TaxBracket[] {\n\tconst bounds = tiers.map(([lower]) =>\n\t\ttoMinorUnits(lower, US_2026_PARAMETERS.currency, UsStateField.BracketBound),\n\t)\n\tconst brackets: TaxBracket[] = []\n\tconst first = bounds[0] ?? 0\n\tif (first > 0) brackets.push({ upTo: first, rate: 0 })\n\tfor (let index = 0; index < tiers.length; index++) {\n\t\tconst tier = tiers[index]\n\t\tif (!tier) continue\n\t\tbrackets.push({ upTo: bounds[index + 1] ?? null, rate: tier[1] })\n\t}\n\treturn brackets\n}\n\nfunction standardAmounts(\n\tsingle: number,\n\tmfj: number,\n\thoh: number | undefined,\n\tmfs: number | undefined,\n): Record<UsFilingStatus, number> {\n\treturn {\n\t\tsingle,\n\t\tmarried_filing_jointly: mfj,\n\t\tmarried_filing_separately: mfs ?? (mfj === single ? single : Math.round(mfj / 2)),\n\t\thead_of_household: hoh ?? (single > 0 ? Math.round(single * 1.5) : 0),\n\t}\n}\n\nfunction exemptionAmounts(\n\tsingle: number,\n\tmfj: number,\n\thoh: number | undefined,\n\tmfs: number | undefined = undefined,\n): Record<UsFilingStatus, number> {\n\treturn {\n\t\tsingle,\n\t\tmarried_filing_jointly: mfj,\n\t\tmarried_filing_separately: mfs ?? single,\n\t\thead_of_household: hoh ?? single,\n\t}\n}\n\nfunction resolveMfsTiers(def: UsStateDefinition): UsStateBracketTiers {\n\tif (def.mfs === \"half-mfj\") return def.mfj.map(([lower, rate]) => [lower / 2, rate] as const)\n\treturn def.mfs ?? def.single\n}\n\nfunction resolveHohTiers(def: UsStateDefinition): UsStateBracketTiers {\n\tif (def.hoh === \"mfj\") return def.mfj\n\treturn def.hoh ?? def.single\n}\n\nfunction optionalRules(def: UsStateDefinition): Partial<UsStateParameters> {\n\treturn {\n\t\t...(def.surtax ? { surtax: def.surtax } : {}),\n\t\t...(def.standardDeductionPhaseOut\n\t\t\t? { standardDeductionPhaseOut: def.standardDeductionPhaseOut }\n\t\t\t: {}),\n\t\t...(def.dependentExemptionPhaseOut\n\t\t\t? { dependentExemptionPhaseOut: def.dependentExemptionPhaseOut }\n\t\t\t: {}),\n\t}\n}\n\n/**\n * Builds a complete state parameter table from a compact statutory definition.\n *\n * Math: Converts dollar thresholds to integer cents; derives vertical-equity defaults\n * (MFS uses single brackets, HoH uses single brackets and 1.5x single standard deduction).\n * Units: Definition amounts are major dollars; emitted bracket bounds are integer cents.\n * Throws: TaxValidationError if a threshold cannot be represented as safe integer cents.\n *\n * @param def Compact state statutory definition.\n * @returns Complete state parameter table.\n */\nexport function defineState(def: UsStateDefinition): UsStateParameters {\n\tconst personalExemption = def.personalExemption ?? [0, 0]\n\tconst personalCredit = def.personalCredit ?? [0, 0]\n\treturn {\n\t\tcode: def.code,\n\t\tname: def.name,\n\t\ttype: def.type,\n\t\tbrackets: {\n\t\t\tsingle: tiersToBrackets(def.single),\n\t\t\tmarried_filing_jointly: tiersToBrackets(def.mfj),\n\t\t\tmarried_filing_separately: tiersToBrackets(resolveMfsTiers(def)),\n\t\t\thead_of_household: tiersToBrackets(resolveHohTiers(def)),\n\t\t},\n\t\tstandardDeduction: standardAmounts(def.std[0], def.std[1], def.std[2], def.stdMfs),\n\t\tpersonalExemption: exemptionAmounts(\n\t\t\tpersonalExemption[0],\n\t\t\tpersonalExemption[1],\n\t\t\tpersonalExemption[2],\n\t\t\tdef.personalExemptionMfs,\n\t\t),\n\t\tpersonalCredit: exemptionAmounts(personalCredit[0], personalCredit[1], personalCredit[2]),\n\t\tdependentExemption: def.dependentExemption ?? 0,\n\t\tdependentCredit: def.dependentCredit ?? 0,\n\t\t...optionalRules(def),\n\t}\n}\n\n/**\n * Indexes a complete list of state parameter tables by state code.\n *\n * @param states All supported state parameter tables.\n * @returns Record keyed by every supported state code.\n */\nexport function indexStates(\n\tstates: readonly UsStateParameters[],\n): Record<UsStateCode, UsStateParameters> {\n\tconst record: Partial<Record<UsStateCode, UsStateParameters>> = {}\n\tfor (const state of states) record[state.code] = state\n\treturn record as Record<UsStateCode, UsStateParameters>\n}\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n\n/**\n * 2026 Arizona individual income tax parameters.\n *\n * Federal-conforming standard deduction; $100 dependent credit.\n *\n * @statute Ariz. Rev. Stat. § 43-1011\n */\nconst ARIZONA: UsStateParameters = defineState({\n\tcode: \"AZ\",\n\tname: \"Arizona\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.025]],\n\tmfj: [[0, 0.025]],\n\tstd: [16100, 32200, 24150],\n\tdependentCredit: 100,\n})\n\n/**\n * 2026 Colorado individual income tax parameters.\n *\n * @statute Colo. Rev. Stat. § 39-22-104\n */\nconst COLORADO: UsStateParameters = defineState({\n\tcode: \"CO\",\n\tname: \"Colorado\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.044]],\n\tmfj: [[0, 0.044]],\n\tstd: [16100, 32200],\n})\n\n/**\n * 2026 Georgia individual income tax parameters.\n *\n * 4.99% flat, $15,000 / $30,000 standard deduction and $5,000 dependent allowance per the Georgia\n * DOR revised 2026 Employer's Tax Guide (June 2026; HB 463).\n *\n * @statute Ga. Code Ann. § 48-7-20\n */\nconst GEORGIA: UsStateParameters = defineState({\n\tcode: \"GA\",\n\tname: \"Georgia\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0499]],\n\tmfj: [[0, 0.0499]],\n\tstd: [15000, 30000, 15000],\n\tdependentExemption: 5_000,\n})\n\n/**\n * 2026 Idaho individual income tax parameters.\n *\n * Zero-rate bracket below the statutory threshold.\n *\n * @statute Idaho Code § 63-3024\n */\nconst IDAHO: UsStateParameters = defineState({\n\tcode: \"ID\",\n\tname: \"Idaho\",\n\ttype: \"flat\",\n\tsingle: [[4_811, 0.053]],\n\tmfj: [[9_622, 0.053]],\n\tstd: [16100, 32200],\n})\n\n/**\n * 2026 Illinois individual income tax parameters.\n *\n * @statute 35 Ill. Comp. Stat. 5/201\n */\nconst ILLINOIS: UsStateParameters = defineState({\n\tcode: \"IL\",\n\tname: \"Illinois\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0495]],\n\tmfj: [[0, 0.0495]],\n\tstd: [0, 0],\n\tpersonalExemption: [2925, 5850],\n\tdependentExemption: 2_925,\n})\n\n/**\n * 2026 Indiana individual income tax parameters.\n *\n * @statute Ind. Code § 6-3-2-1\n */\nconst INDIANA: UsStateParameters = defineState({\n\tcode: \"IN\",\n\tname: \"Indiana\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0295]],\n\tmfj: [[0, 0.0295]],\n\tstd: [0, 0],\n\tpersonalExemption: [1000, 2000],\n\tdependentExemption: 1_000,\n})\n\n/**\n * 2026 Iowa individual income tax parameters.\n *\n * @statute Iowa Code § 422.5\n */\nconst IOWA: UsStateParameters = defineState({\n\tcode: \"IA\",\n\tname: \"Iowa\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.038]],\n\tmfj: [[0, 0.038]],\n\tstd: [16100, 32200],\n\tpersonalCredit: [40, 80],\n\tdependentCredit: 40,\n})\n\nconst STATES: readonly UsStateParameters[] = [\n\tARIZONA,\n\tCOLORADO,\n\tGEORGIA,\n\tIDAHO,\n\tILLINOIS,\n\tINDIANA,\n\tIOWA,\n]\n\n/** Statutory parameter table for the 2026 flat-rate states in group A. */\nexport const FLAT_STATES_A: readonly UsStateParameters[] = STATES\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n\n/**\n * 2026 Kentucky individual income tax parameters.\n *\n * @statute Ky. Rev. Stat. § 141.020\n */\nconst KENTUCKY: UsStateParameters = defineState({\n\tcode: \"KY\",\n\tname: \"Kentucky\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.035]],\n\tmfj: [[0, 0.035]],\n\tstd: [3360, 3360, 3360],\n})\n\n/**\n * 2026 Massachusetts individual income tax parameters.\n *\n * 4% millionaire surtax on taxable income above $1,107,750.\n *\n * @statute Mass. Gen. Laws ch. 62, § 4\n */\nconst MASSACHUSETTS: UsStateParameters = defineState({\n\tcode: \"MA\",\n\tname: \"Massachusetts\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.05]],\n\tmfj: [[0, 0.05]],\n\tstd: [0, 0],\n\tpersonalExemption: [4400, 8800, 6_800],\n\tdependentExemption: 1_000,\n\tsurtax: { threshold: 1_107_750, rate: 0.04 },\n})\n\n/**\n * 2026 Michigan individual income tax parameters.\n *\n * @statute Mich. Comp. Laws § 206.51\n */\nconst MICHIGAN: UsStateParameters = defineState({\n\tcode: \"MI\",\n\tname: \"Michigan\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0425]],\n\tmfj: [[0, 0.0425]],\n\tstd: [0, 0],\n\tpersonalExemption: [5900, 11800],\n\tdependentExemption: 5_900,\n})\n\n/**\n * 2026 Mississippi individual income tax parameters.\n *\n * Zero-rate bracket below $10,000.\n *\n * @statute Miss. Code Ann. § 27-7-5\n */\nconst MISSISSIPPI: UsStateParameters = defineState({\n\tcode: \"MS\",\n\tname: \"Mississippi\",\n\ttype: \"flat\",\n\tsingle: [[10_000, 0.04]],\n\tmfj: [[10_000, 0.04]],\n\tstd: [2300, 4600],\n\tpersonalExemption: [6000, 12000],\n\tdependentExemption: 1_500,\n})\n\n/**\n * 2026 North Carolina individual income tax parameters.\n *\n * @statute N.C. Gen. Stat. § 105-153.7\n */\nconst NORTH_CAROLINA: UsStateParameters = defineState({\n\tcode: \"NC\",\n\tname: \"North Carolina\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0399]],\n\tmfj: [[0, 0.0399]],\n\tstd: [12750, 25500],\n})\n\n/**\n * 2026 Pennsylvania individual income tax parameters.\n *\n * @statute 72 Pa. Cons. Stat. § 7302\n */\nconst PENNSYLVANIA: UsStateParameters = defineState({\n\tcode: \"PA\",\n\tname: \"Pennsylvania\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0307]],\n\tmfj: [[0, 0.0307]],\n\tstd: [0, 0],\n})\n\n/**\n * 2026 Utah individual income tax parameters.\n *\n * Utah starts from federal taxable income; the 6% federal standard-deduction credit is modeled as a non-refundable credit.\n *\n * @statute Utah Code § 59-10-104\n */\nconst UTAH: UsStateParameters = defineState({\n\tcode: \"UT\",\n\tname: \"Utah\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.0445]],\n\tmfj: [[0, 0.0445]],\n\tstd: [0, 0],\n\tpersonalCredit: [966, 1932, 1449],\n\tdependentCredit: 126.66,\n})\n\nconst STATES: readonly UsStateParameters[] = [\n\tKENTUCKY,\n\tMASSACHUSETTS,\n\tMICHIGAN,\n\tMISSISSIPPI,\n\tNORTH_CAROLINA,\n\tPENNSYLVANIA,\n\tUTAH,\n]\n\n/** Statutory parameter table for the 2026 flat-rate states in group B. */\nexport const FLAT_STATES_B: readonly UsStateParameters[] = STATES\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n\n/**\n * 2026 Louisiana individual income tax parameters.\n *\n * 2025 Act 1 flattened the schedule to a single 3% tier. Standard deduction per RIB 26-005\n * (CPI-U estimate as of 2025-12-01; head of household equals the joint amount, R.S. 47:294).\n *\n * @statute La. Stat. Ann. § 47:32\n */\nconst LOUISIANA: UsStateParameters = defineState({\n\tcode: \"LA\",\n\tname: \"Louisiana\",\n\ttype: \"flat\",\n\tsingle: [[0, 0.03]],\n\tmfj: [[0, 0.03]],\n\tstd: [12875, 25750, 25750],\n})\n\n/**\n * 2026 Ohio individual income tax parameters.\n *\n * Single 2.75% rate above a $26,050 zero-rate threshold.\n *\n * @statute Ohio Rev. Code § 5747.02\n */\nconst OHIO: UsStateParameters = defineState({\n\tcode: \"OH\",\n\tname: \"Ohio\",\n\ttype: \"flat\",\n\tsingle: [[26_050, 0.0275]],\n\tmfj: [[26_050, 0.0275]],\n\tstd: [0, 0],\n\tpersonalExemption: [2400, 4800],\n\tdependentExemption: 2_400,\n})\n\n/** Statutory parameter table for Louisiana and Ohio flat-rate individual income taxes. */\nexport const FLAT_STATES_C: readonly UsStateParameters[] = [LOUISIANA, OHIO]\n","import type { UsStateParameters } from \"../types\"\nimport { FLAT_STATES_A } from \"./flat-a\"\nimport { FLAT_STATES_B } from \"./flat-b\"\nimport { FLAT_STATES_C } from \"./flat-c\"\n\n/** Statutory parameter table for all 2026 flat-rate state individual income taxes. */\nexport const FLAT_STATES: readonly UsStateParameters[] = [\n\t...FLAT_STATES_A,\n\t...FLAT_STATES_B,\n\t...FLAT_STATES_C,\n]\n","import type { UsStateCode } from \"../../types\"\nimport { defineState } from \"./helpers\"\nimport type { UsStateParameters } from \"./types\"\n\n/**\n * Builds the zero-rate parameter table for a state with no 2026 wage income tax.\n *\n * Units: All amounts are zero major dollars.\n */\nfunction noTaxState(code: UsStateCode, name: string): UsStateParameters {\n\treturn defineState({\n\t\tcode,\n\t\tname,\n\t\ttype: \"none\",\n\t\tsingle: [[0, 0]],\n\t\tmfj: [[0, 0]],\n\t\tstd: [0, 0],\n\t})\n}\n\n/**\n * Statutory parameter table for the nine states with no 2026 wage income tax.\n *\n * Washington taxes only long-term capital gains above a high threshold, and New Hampshire and\n * Tennessee repealed their interest and dividends taxes, so none taxes wage or ordinary income.\n *\n * @statute State constitutions and statutes repealing or prohibiting an individual income tax.\n */\nexport const NO_TAX_STATES: readonly UsStateParameters[] = [\n\tnoTaxState(\"AK\", \"Alaska\"),\n\tnoTaxState(\"FL\", \"Florida\"),\n\tnoTaxState(\"NV\", \"Nevada\"),\n\tnoTaxState(\"NH\", \"New Hampshire\"),\n\tnoTaxState(\"SD\", \"South Dakota\"),\n\tnoTaxState(\"TN\", \"Tennessee\"),\n\tnoTaxState(\"TX\", \"Texas\"),\n\tnoTaxState(\"WA\", \"Washington\"),\n\tnoTaxState(\"WY\", \"Wyoming\"),\n]\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Alabama individual income tax parameters.\n *\n * @statute Ala. Code § 40-18-5\n */\nexport const US_2026_STATE_AL: UsStateParameters = defineState({\n\tcode: \"AL\",\n\tname: \"Alabama\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.02],\n\t\t[500, 0.04],\n\t\t[3_000, 0.05],\n\t],\n\tmfj: [\n\t\t[0, 0.02],\n\t\t[1_000, 0.04],\n\t\t[6_000, 0.05],\n\t],\n\tstd: [3000, 8500, 5_200],\n\tpersonalExemption: [1500, 3000, 3000],\n\tdependentExemption: 1_000,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Arkansas individual income tax parameters.\n *\n * Brackets from the DFA 2026 withholding formula (0% to $5,599, then 2%, 3%, 3.4%); the top rate is\n * 3.7% after H.B. 1001 (retroactive to 2026-01-01), as reported by EY and Bloomberg Tax.\n *\n * @statute Ark. Code Ann. § 26-51-201\n */\nexport const US_2026_STATE_AR: UsStateParameters = defineState({\n\tcode: \"AR\",\n\tname: \"Arkansas\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[5_600, 0.02],\n\t\t[11_200, 0.03],\n\t\t[16_000, 0.034],\n\t\t[26_400, 0.037],\n\t],\n\tmfj: [\n\t\t[5_600, 0.02],\n\t\t[11_200, 0.03],\n\t\t[16_000, 0.034],\n\t\t[26_400, 0.037],\n\t],\n\tstd: [2470, 4940],\n\tpersonalCredit: [29, 58],\n\tdependentCredit: 29,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 California individual income tax parameters.\n *\n * FTB 2026 indexed schedules, deduction ($5,900/$11,800) and exemption credits ($158/$316,\n * $491 per dependent). 1% mental health services surtax above $1,000,000.\n *\n * @statute Cal. Rev. & Tax. Code § 17041\n */\nexport const US_2026_STATE_CA: UsStateParameters = defineState({\n\tcode: \"CA\",\n\tname: \"California\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.01],\n\t\t[11_456, 0.02],\n\t\t[27_157, 0.04],\n\t\t[42_861, 0.06],\n\t\t[59_498, 0.08],\n\t\t[75_197, 0.093],\n\t\t[384_109, 0.103],\n\t\t[460_927, 0.113],\n\t\t[768_213, 0.123],\n\t],\n\tmfj: [\n\t\t[0, 0.01],\n\t\t[22_912, 0.02],\n\t\t[54_314, 0.04],\n\t\t[85_722, 0.06],\n\t\t[118_996, 0.08],\n\t\t[150_394, 0.093],\n\t\t[768_218, 0.103],\n\t\t[921_854, 0.113],\n\t\t[1_536_426, 0.123],\n\t],\n\thoh: [\n\t\t[0, 0.01],\n\t\t[22_927, 0.02],\n\t\t[54_316, 0.04],\n\t\t[70_018, 0.06],\n\t\t[86_654, 0.08],\n\t\t[102_356, 0.093],\n\t\t[522_385, 0.103],\n\t\t[626_864, 0.113],\n\t\t[1_044_771, 0.123],\n\t],\n\tstd: [5900, 11800, 11800],\n\tpersonalCredit: [158, 316],\n\tdependentCredit: 491,\n\tsurtax: { threshold: 1_000_000, rate: 0.01 },\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Connecticut individual income tax parameters.\n *\n * @statute Conn. Gen. Stat. § 12-700\n */\nexport const US_2026_STATE_CT: UsStateParameters = defineState({\n\tcode: \"CT\",\n\tname: \"Connecticut\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.02],\n\t\t[10_000, 0.045],\n\t\t[50_000, 0.055],\n\t\t[100_000, 0.06],\n\t\t[200_000, 0.065],\n\t\t[250_000, 0.069],\n\t\t[500_000, 0.0699],\n\t],\n\tmfj: [\n\t\t[0, 0.02],\n\t\t[20_000, 0.045],\n\t\t[100_000, 0.055],\n\t\t[200_000, 0.06],\n\t\t[400_000, 0.065],\n\t\t[500_000, 0.069],\n\t\t[1_000_000, 0.0699],\n\t],\n\thoh: [\n\t\t[0, 0.02],\n\t\t[16_000, 0.045],\n\t\t[80_000, 0.055],\n\t\t[160_000, 0.06],\n\t\t[320_000, 0.065],\n\t\t[400_000, 0.069],\n\t\t[800_000, 0.0699],\n\t],\n\tstd: [0, 0],\n\tpersonalExemptionMfs: 12_000,\n\tpersonalExemption: [15000, 24000, 19000],\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 District of Columbia individual income tax parameters.\n *\n * @statute D.C. Code § 47-1806.03\n */\nexport const US_2026_STATE_DC: UsStateParameters = defineState({\n\tcode: \"DC\",\n\tname: \"District of Columbia\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.04],\n\t\t[10_000, 0.06],\n\t\t[40_000, 0.065],\n\t\t[60_000, 0.085],\n\t\t[250_000, 0.0925],\n\t\t[500_000, 0.0975],\n\t\t[1_000_000, 0.1075],\n\t],\n\tmfj: [\n\t\t[0, 0.04],\n\t\t[10_000, 0.06],\n\t\t[40_000, 0.065],\n\t\t[60_000, 0.085],\n\t\t[250_000, 0.0925],\n\t\t[500_000, 0.0975],\n\t\t[1_000_000, 0.1075],\n\t],\n\tstd: [16100, 32200, 24150],\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Delaware individual income tax parameters.\n *\n * @statute Del. Code Ann. tit. 30, § 1102\n */\nexport const US_2026_STATE_DE: UsStateParameters = defineState({\n\tcode: \"DE\",\n\tname: \"Delaware\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[2_000, 0.022],\n\t\t[5_000, 0.039],\n\t\t[10_000, 0.048],\n\t\t[20_000, 0.052],\n\t\t[25_000, 0.0555],\n\t\t[60_000, 0.066],\n\t],\n\tmfj: [\n\t\t[2_000, 0.022],\n\t\t[5_000, 0.039],\n\t\t[10_000, 0.048],\n\t\t[20_000, 0.052],\n\t\t[25_000, 0.0555],\n\t\t[60_000, 0.066],\n\t],\n\tstd: [3250, 6500, 3250],\n\tpersonalCredit: [110, 220],\n\tdependentCredit: 110,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Hawaii individual income tax parameters.\n *\n * @statute Haw. Rev. Stat. § 235-51\n */\nexport const US_2026_STATE_HI: UsStateParameters = defineState({\n\tcode: \"HI\",\n\tname: \"Hawaii\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.014],\n\t\t[9_600, 0.032],\n\t\t[14_400, 0.055],\n\t\t[19_200, 0.064],\n\t\t[24_000, 0.068],\n\t\t[36_000, 0.072],\n\t\t[48_000, 0.076],\n\t\t[125_000, 0.079],\n\t\t[175_000, 0.0825],\n\t\t[225_000, 0.09],\n\t\t[275_000, 0.1],\n\t\t[325_000, 0.11],\n\t],\n\tmfj: [\n\t\t[0, 0.014],\n\t\t[19_200, 0.032],\n\t\t[28_800, 0.055],\n\t\t[38_400, 0.064],\n\t\t[48_000, 0.068],\n\t\t[72_000, 0.072],\n\t\t[96_000, 0.076],\n\t\t[250_000, 0.079],\n\t\t[350_000, 0.0825],\n\t\t[450_000, 0.09],\n\t\t[550_000, 0.1],\n\t\t[650_000, 0.11],\n\t],\n\thoh: [\n\t\t[0, 0.014],\n\t\t[14_400, 0.032],\n\t\t[21_600, 0.055],\n\t\t[28_800, 0.064],\n\t\t[36_000, 0.068],\n\t\t[54_000, 0.072],\n\t\t[72_000, 0.076],\n\t\t[187_500, 0.079],\n\t\t[262_500, 0.0825],\n\t\t[337_500, 0.09],\n\t\t[412_500, 0.1],\n\t\t[487_500, 0.11],\n\t],\n\tstd: [8000, 16000, 12000],\n\tpersonalExemption: [1144, 2288],\n\tdependentExemption: 1_144,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Kansas individual income tax parameters.\n *\n * @statute Kan. Stat. Ann. § 79-32,110\n */\nexport const US_2026_STATE_KS: UsStateParameters = defineState({\n\tcode: \"KS\",\n\tname: \"Kansas\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.052],\n\t\t[23_000, 0.0558],\n\t],\n\tmfj: [\n\t\t[0, 0.052],\n\t\t[46_000, 0.0558],\n\t],\n\tstd: [3605, 8240, 6180],\n\tpersonalExemption: [9160, 18320],\n\tdependentExemption: 2_320,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Maryland individual income tax parameters.\n *\n * @statute Md. Code, Tax-Gen. § 10-105\n */\nexport const US_2026_STATE_MD: UsStateParameters = defineState({\n\tcode: \"MD\",\n\tname: \"Maryland\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.02],\n\t\t[1_000, 0.03],\n\t\t[2_000, 0.04],\n\t\t[3_000, 0.0475],\n\t\t[100_000, 0.05],\n\t\t[125_000, 0.0525],\n\t\t[150_000, 0.055],\n\t\t[250_000, 0.0575],\n\t\t[500_000, 0.0625],\n\t\t[1_000_000, 0.065],\n\t],\n\tmfj: [\n\t\t[0, 0.02],\n\t\t[1_000, 0.03],\n\t\t[2_000, 0.04],\n\t\t[3_000, 0.0475],\n\t\t[150_000, 0.05],\n\t\t[175_000, 0.0525],\n\t\t[225_000, 0.055],\n\t\t[300_000, 0.0575],\n\t\t[600_000, 0.0625],\n\t\t[1_200_000, 0.065],\n\t],\n\thoh: \"mfj\",\n\tstd: [3400, 6800, 6800],\n\tpersonalExemption: [3200, 6400],\n\tdependentExemption: 3_200,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Maine individual income tax parameters.\n *\n * Standard deduction phased out linearly over $75,000 (single, separate), $112,500 (head of\n * household) and $150,000 (joint) of AGI above $102,250, $153,400 and $204,550; the head of\n * household start is the statutory $120,000 indexed with the single and joint starts.\n * 2% surcharge on Maine taxable income above $1,000,000 (single), $1,500,000 (joint and head\n * of household) and $750,000 (separate), effective for tax years beginning in 2026.\n *\n * @statute Me. Rev. Stat. tit. 36, § 5111, sub-§ 7 (P.L. 2025, c. 650, Pt. DDDD)\n */\nexport const US_2026_STATE_ME: UsStateParameters = defineState({\n\tcode: \"ME\",\n\tname: \"Maine\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.058],\n\t\t[27_400, 0.0675],\n\t\t[64_850, 0.0715],\n\t],\n\tmfj: [\n\t\t[0, 0.058],\n\t\t[54_850, 0.0675],\n\t\t[129_750, 0.0715],\n\t],\n\thoh: [\n\t\t[0, 0.058],\n\t\t[41_100, 0.0675],\n\t\t[97_300, 0.0715],\n\t],\n\tstd: [15700, 31400, 23550],\n\tpersonalExemption: [5300, 10600],\n\tdependentCredit: 305,\n\tstandardDeductionPhaseOut: {\n\t\tkind: \"linear\",\n\t\tstart: {\n\t\t\tsingle: 102_250,\n\t\t\tmarried_filing_jointly: 204_550,\n\t\t\tmarried_filing_separately: 102_250,\n\t\t\thead_of_household: 153_400,\n\t\t},\n\t\twidth: {\n\t\t\tsingle: 75_000,\n\t\t\tmarried_filing_jointly: 150_000,\n\t\t\tmarried_filing_separately: 75_000,\n\t\t\thead_of_household: 112_500,\n\t\t},\n\t},\n\tsurtax: {\n\t\tthreshold: {\n\t\t\tsingle: 1_000_000,\n\t\t\tmarried_filing_jointly: 1_500_000,\n\t\t\tmarried_filing_separately: 750_000,\n\t\t\thead_of_household: 1_500_000,\n\t\t},\n\t\trate: 0.02,\n\t},\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Minnesota individual income tax parameters.\n *\n * Standard deduction reduced by 3% of AGI over $244,400 plus 10% over $337,800 (halved for\n * separate filers), capped at 80% of the deduction; the dependent exemption is disallowed 2%\n * per $2,500 (separate: $1,250) of AGI over the threshold. Amounts are the 2026 values published\n * by the Minnesota Department of Revenue. The statutory 80% cut-off above $1,107,750 is always\n * reached earlier through the 80% cap and is not modeled separately.\n *\n * @statute Minn. Stat. §§ 290.06, 290.0121 subd. 2, 290.0123 subd. 5\n */\nexport const US_2026_STATE_MN: UsStateParameters = defineState({\n\tcode: \"MN\",\n\tname: \"Minnesota\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.0535],\n\t\t[33_310, 0.068],\n\t\t[109_430, 0.0785],\n\t\t[203_150, 0.0985],\n\t],\n\tmfj: [\n\t\t[0, 0.0535],\n\t\t[48_700, 0.068],\n\t\t[193_480, 0.0785],\n\t\t[337_930, 0.0985],\n\t],\n\thoh: [\n\t\t[0, 0.0535],\n\t\t[41_010, 0.068],\n\t\t[164_800, 0.0785],\n\t\t[270_060, 0.0985],\n\t],\n\tstd: [15300, 30600, 23000],\n\tmfs: \"half-mfj\",\n\tdependentExemption: 5_300,\n\tstandardDeductionPhaseOut: {\n\t\tkind: \"tiered\",\n\t\tstart: {\n\t\t\tsingle: 244_400,\n\t\t\tmarried_filing_jointly: 244_400,\n\t\t\tmarried_filing_separately: 122_200,\n\t\t\thead_of_household: 244_400,\n\t\t},\n\t\tsecond: {\n\t\t\tsingle: 337_800,\n\t\t\tmarried_filing_jointly: 337_800,\n\t\t\tmarried_filing_separately: 168_900,\n\t\t\thead_of_household: 337_800,\n\t\t},\n\t\trate: 0.03,\n\t\tsecondRate: 0.1,\n\t\tmaxShare: 0.8,\n\t},\n\tdependentExemptionPhaseOut: {\n\t\tkind: \"stepped\",\n\t\tstart: {\n\t\t\tsingle: 244_500,\n\t\t\tmarried_filing_jointly: 366_700,\n\t\t\tmarried_filing_separately: 183_350,\n\t\t\thead_of_household: 305_600,\n\t\t},\n\t\tstep: {\n\t\t\tsingle: 2_500,\n\t\t\tmarried_filing_jointly: 2_500,\n\t\t\tmarried_filing_separately: 1_250,\n\t\t\thead_of_household: 2_500,\n\t\t},\n\t\tratePerStep: 0.02,\n\t},\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Missouri individual income tax parameters.\n *\n * @statute Mo. Rev. Stat. § 143.011\n */\nexport const US_2026_STATE_MO: UsStateParameters = defineState({\n\tcode: \"MO\",\n\tname: \"Missouri\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[1_348, 0.02],\n\t\t[2_696, 0.025],\n\t\t[4_044, 0.03],\n\t\t[5_392, 0.035],\n\t\t[6_740, 0.04],\n\t\t[8_088, 0.045],\n\t\t[9_436, 0.047],\n\t],\n\t// Combined returns tax each spouse's half separately, i.e. the single thresholds doubled.\n\tmfj: [\n\t\t[2_696, 0.02],\n\t\t[5_392, 0.025],\n\t\t[8_088, 0.03],\n\t\t[10_784, 0.035],\n\t\t[13_480, 0.04],\n\t\t[16_176, 0.045],\n\t\t[18_872, 0.047],\n\t],\n\tstd: [16100, 32200],\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Montana individual income tax parameters.\n *\n * @statute Mont. Code Ann. § 15-30-2103\n */\nexport const US_2026_STATE_MT: UsStateParameters = defineState({\n\tcode: \"MT\",\n\tname: \"Montana\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.047],\n\t\t[47_500, 0.0565],\n\t],\n\tmfj: [\n\t\t[0, 0.047],\n\t\t[95_000, 0.0565],\n\t],\n\tstd: [16100, 32200],\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 North Dakota individual income tax parameters.\n *\n * @statute N.D. Cent. Code § 57-38-30.3\n */\nexport const US_2026_STATE_ND: UsStateParameters = defineState({\n\tcode: \"ND\",\n\tname: \"North Dakota\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[48_475, 0.0195],\n\t\t[244_825, 0.025],\n\t],\n\tmfj: [\n\t\t[80_975, 0.0195],\n\t\t[298_075, 0.025],\n\t],\n\tmfs: [\n\t\t[40_475, 0.0195],\n\t\t[149_025, 0.025],\n\t],\n\thoh: [\n\t\t[64_950, 0.0195],\n\t\t[271_450, 0.025],\n\t],\n\tstd: [16100, 32200],\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Nebraska individual income tax parameters.\n *\n * @statute Neb. Rev. Stat. § 77-2715.03\n */\nexport const US_2026_STATE_NE: UsStateParameters = defineState({\n\tcode: \"NE\",\n\tname: \"Nebraska\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.0246],\n\t\t[4_130, 0.0351],\n\t\t[24_760, 0.0455],\n\t],\n\tmfj: [\n\t\t[0, 0.0246],\n\t\t[8_250, 0.0351],\n\t\t[49_530, 0.0455],\n\t],\n\tstd: [8850, 17700],\n\tpersonalCredit: [176, 352],\n\tdependentCredit: 176,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 New Jersey individual income tax parameters.\n *\n * @statute N.J. Stat. Ann. § 54A:2-1\n */\nexport const US_2026_STATE_NJ: UsStateParameters = defineState({\n\tcode: \"NJ\",\n\tname: \"New Jersey\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.014],\n\t\t[20_000, 0.0175],\n\t\t[35_000, 0.035],\n\t\t[40_000, 0.05525],\n\t\t[75_000, 0.0637],\n\t\t[500_000, 0.0897],\n\t\t[1_000_000, 0.1075],\n\t],\n\tmfj: [\n\t\t[0, 0.014],\n\t\t[20_000, 0.0175],\n\t\t[50_000, 0.0245],\n\t\t[70_000, 0.035],\n\t\t[80_000, 0.05525],\n\t\t[150_000, 0.0637],\n\t\t[500_000, 0.0897],\n\t\t[1_000_000, 0.1075],\n\t],\n\thoh: \"mfj\",\n\tstd: [0, 0],\n\tpersonalExemption: [1000, 2000],\n\tdependentExemption: 1_500,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 New Mexico individual income tax parameters.\n *\n * @statute N.M. Stat. Ann. § 7-2-7\n */\nexport const US_2026_STATE_NM: UsStateParameters = defineState({\n\tcode: \"NM\",\n\tname: \"New Mexico\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.015],\n\t\t[5_500, 0.032],\n\t\t[16_500, 0.043],\n\t\t[33_500, 0.047],\n\t\t[66_500, 0.049],\n\t\t[210_000, 0.059],\n\t],\n\tmfj: [\n\t\t[0, 0.015],\n\t\t[8_000, 0.032],\n\t\t[25_000, 0.043],\n\t\t[50_000, 0.047],\n\t\t[100_000, 0.049],\n\t\t[315_000, 0.059],\n\t],\n\tmfs: \"half-mfj\",\n\thoh: \"mfj\",\n\tstd: [16100, 32200],\n\tdependentExemption: 4_000,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 New York individual income tax parameters.\n *\n * @statute N.Y. Tax Law § 601\n */\nexport const US_2026_STATE_NY: UsStateParameters = defineState({\n\tcode: \"NY\",\n\tname: \"New York\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.039],\n\t\t[8_500, 0.044],\n\t\t[11_700, 0.0515],\n\t\t[13_900, 0.054],\n\t\t[80_650, 0.059],\n\t\t[215_400, 0.0685],\n\t\t[1_077_550, 0.0965],\n\t\t[5_000_000, 0.103],\n\t\t[25_000_000, 0.109],\n\t],\n\tmfj: [\n\t\t[0, 0.039],\n\t\t[17_150, 0.044],\n\t\t[23_600, 0.0515],\n\t\t[27_900, 0.054],\n\t\t[161_550, 0.059],\n\t\t[323_200, 0.0685],\n\t\t[2_155_350, 0.0965],\n\t\t[5_000_000, 0.103],\n\t\t[25_000_000, 0.109],\n\t],\n\thoh: [\n\t\t[0, 0.039],\n\t\t[12_800, 0.044],\n\t\t[17_650, 0.0515],\n\t\t[20_900, 0.054],\n\t\t[107_650, 0.059],\n\t\t[269_300, 0.0685],\n\t\t[1_616_450, 0.0965],\n\t\t[5_000_000, 0.103],\n\t\t[25_000_000, 0.109],\n\t],\n\tstd: [8000, 16050, 11200],\n\tstdMfs: 8000,\n\tdependentExemption: 1_000,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Oklahoma individual income tax parameters.\n *\n * @statute Okla. Stat. tit. 68, § 2355\n */\nexport const US_2026_STATE_OK: UsStateParameters = defineState({\n\tcode: \"OK\",\n\tname: \"Oklahoma\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[3_750, 0.025],\n\t\t[4_900, 0.035],\n\t\t[7_200, 0.045],\n\t],\n\tmfj: [\n\t\t[7_500, 0.025],\n\t\t[9_800, 0.035],\n\t\t[14_400, 0.045],\n\t],\n\thoh: \"mfj\",\n\tstd: [6350, 12700, 9350],\n\tpersonalExemption: [1000, 2000],\n\tdependentExemption: 1_000,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Oregon individual income tax parameters.\n *\n * @statute Or. Rev. Stat. § 316.037\n */\nexport const US_2026_STATE_OR: UsStateParameters = defineState({\n\tcode: \"OR\",\n\tname: \"Oregon\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.0475],\n\t\t[4_550, 0.0675],\n\t\t[11_400, 0.0875],\n\t\t[125_000, 0.099],\n\t],\n\tmfj: [\n\t\t[0, 0.0475],\n\t\t[9_100, 0.0675],\n\t\t[22_800, 0.0875],\n\t\t[250_000, 0.099],\n\t],\n\thoh: \"mfj\",\n\tstd: [2910, 5820, 4_420],\n\tpersonalCredit: [256, 512],\n\tdependentCredit: 256,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Rhode Island individual income tax parameters.\n *\n * @statute R.I. Gen. Laws § 44-30-2.6\n */\nexport const US_2026_STATE_RI: UsStateParameters = defineState({\n\tcode: \"RI\",\n\tname: \"Rhode Island\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.0375],\n\t\t[82_050, 0.0475],\n\t\t[186_450, 0.0599],\n\t],\n\tmfj: [\n\t\t[0, 0.0375],\n\t\t[82_050, 0.0475],\n\t\t[186_450, 0.0599],\n\t],\n\tstd: [11200, 22400],\n\tpersonalExemption: [5250, 10500],\n\tdependentExemption: 5_250,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 South Carolina individual income tax parameters.\n *\n * @statute S.C. Code Ann. § 12-6-510\n */\nexport const US_2026_STATE_SC: UsStateParameters = defineState({\n\tcode: \"SC\",\n\tname: \"South Carolina\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0],\n\t\t[3_640, 0.03],\n\t\t[18_230, 0.06],\n\t],\n\tmfj: [\n\t\t[0, 0],\n\t\t[3_640, 0.03],\n\t\t[18_230, 0.06],\n\t],\n\tstd: [16100, 32200, 24150],\n\tdependentExemption: 4_930,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Virginia individual income tax parameters.\n *\n * @statute Va. Code Ann. § 58.1-320\n */\nexport const US_2026_STATE_VA: UsStateParameters = defineState({\n\tcode: \"VA\",\n\tname: \"Virginia\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.02],\n\t\t[3_000, 0.03],\n\t\t[5_000, 0.05],\n\t\t[17_000, 0.0575],\n\t],\n\tmfj: [\n\t\t[0, 0.02],\n\t\t[3_000, 0.03],\n\t\t[5_000, 0.05],\n\t\t[17_000, 0.0575],\n\t],\n\tstd: [8750, 17500, 8_750],\n\tpersonalExemption: [930, 1860],\n\tdependentExemption: 930,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Vermont individual income tax parameters.\n *\n * @statute Vt. Stat. Ann. tit. 32, § 5822\n */\nexport const US_2026_STATE_VT: UsStateParameters = defineState({\n\tcode: \"VT\",\n\tname: \"Vermont\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.0335],\n\t\t[49_400, 0.066],\n\t\t[119_700, 0.076],\n\t\t[249_700, 0.0875],\n\t],\n\tmfj: [\n\t\t[0, 0.0335],\n\t\t[82_500, 0.066],\n\t\t[199_450, 0.076],\n\t\t[304_000, 0.0875],\n\t],\n\tmfs: \"half-mfj\",\n\tstd: [7650, 15300],\n\tpersonalExemption: [5300, 10600],\n\tdependentExemption: 5_300,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 Wisconsin individual income tax parameters.\n *\n * @statute Wis. Stat. § 71.06\n */\nexport const US_2026_STATE_WI: UsStateParameters = defineState({\n\tcode: \"WI\",\n\tname: \"Wisconsin\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.035],\n\t\t[15_110, 0.044],\n\t\t[51_950, 0.053],\n\t\t[332_720, 0.0765],\n\t],\n\tmfj: [\n\t\t[0, 0.035],\n\t\t[20_150, 0.044],\n\t\t[69_260, 0.053],\n\t\t[443_630, 0.0765],\n\t],\n\tmfs: \"half-mfj\",\n\tstd: [13960, 25840, 17_950],\n\tpersonalExemption: [700, 1400],\n\tdependentExemption: 700,\n})\n","import { defineState } from \"../helpers\"\nimport type { UsStateParameters } from \"../types\"\n/**\n * 2026 West Virginia individual income tax parameters.\n *\n * Rates 2.11% to 4.58% per W. Va. Code § 11-21-4j (S.B. 392, taxable years from 2026-01-01).\n *\n * @statute W. Va. Code § 11-21-4\n */\nexport const US_2026_STATE_WV: UsStateParameters = defineState({\n\tcode: \"WV\",\n\tname: \"West Virginia\",\n\ttype: \"progressive\",\n\tsingle: [\n\t\t[0, 0.0211],\n\t\t[10_000, 0.0281],\n\t\t[25_000, 0.0316],\n\t\t[40_000, 0.0422],\n\t\t[60_000, 0.0458],\n\t],\n\tmfj: [\n\t\t[0, 0.0211],\n\t\t[10_000, 0.0281],\n\t\t[25_000, 0.0316],\n\t\t[40_000, 0.0422],\n\t\t[60_000, 0.0458],\n\t],\n\tmfs: \"half-mfj\",\n\tstd: [0, 0],\n\tpersonalExemption: [2000, 4000],\n\tdependentExemption: 2_000,\n})\n","import type { UsStateParameters } from \"../types\"\nimport { US_2026_STATE_AL } from \"./al\"\nimport { US_2026_STATE_AR } from \"./ar\"\nimport { US_2026_STATE_CA } from \"./ca\"\nimport { US_2026_STATE_CT } from \"./ct\"\nimport { US_2026_STATE_DC } from \"./dc\"\nimport { US_2026_STATE_DE } from \"./de\"\nimport { US_2026_STATE_HI } from \"./hi\"\nimport { US_2026_STATE_KS } from \"./ks\"\nimport { US_2026_STATE_MD } from \"./md\"\nimport { US_2026_STATE_ME } from \"./me\"\nimport { US_2026_STATE_MN } from \"./mn\"\nimport { US_2026_STATE_MO } from \"./mo\"\nimport { US_2026_STATE_MT } from \"./mt\"\nimport { US_2026_STATE_ND } from \"./nd\"\nimport { US_2026_STATE_NE } from \"./ne\"\nimport { US_2026_STATE_NJ } from \"./nj\"\nimport { US_2026_STATE_NM } from \"./nm\"\nimport { US_2026_STATE_NY } from \"./ny\"\nimport { US_2026_STATE_OK } from \"./ok\"\nimport { US_2026_STATE_OR } from \"./or\"\nimport { US_2026_STATE_RI } from \"./ri\"\nimport { US_2026_STATE_SC } from \"./sc\"\nimport { US_2026_STATE_VA } from \"./va\"\nimport { US_2026_STATE_VT } from \"./vt\"\nimport { US_2026_STATE_WI } from \"./wi\"\nimport { US_2026_STATE_WV } from \"./wv\"\n\nconst STATES: readonly UsStateParameters[] = [\n\tUS_2026_STATE_AL,\n\tUS_2026_STATE_AR,\n\tUS_2026_STATE_CA,\n\tUS_2026_STATE_CT,\n\tUS_2026_STATE_DE,\n\tUS_2026_STATE_DC,\n\tUS_2026_STATE_HI,\n\tUS_2026_STATE_KS,\n\tUS_2026_STATE_ME,\n\tUS_2026_STATE_MD,\n\tUS_2026_STATE_MN,\n\tUS_2026_STATE_MO,\n\tUS_2026_STATE_MT,\n\tUS_2026_STATE_NE,\n\tUS_2026_STATE_NJ,\n\tUS_2026_STATE_NM,\n\tUS_2026_STATE_NY,\n\tUS_2026_STATE_ND,\n\tUS_2026_STATE_OK,\n\tUS_2026_STATE_OR,\n\tUS_2026_STATE_RI,\n\tUS_2026_STATE_SC,\n\tUS_2026_STATE_VT,\n\tUS_2026_STATE_VA,\n\tUS_2026_STATE_WV,\n\tUS_2026_STATE_WI,\n]\n\n/** Statutory parameter table for all 2026 graduated-rate state individual income taxes. */\nexport const PROGRESSIVE_STATES: readonly UsStateParameters[] = STATES\n","import type { UsStateCode } from \"../../types\"\nimport { FLAT_STATES } from \"./flat\"\nimport { indexStates } from \"./helpers\"\nimport { NO_TAX_STATES } from \"./none\"\nimport { PROGRESSIVE_STATES } from \"./progressive\"\nimport type { UsStateParameters } from \"./types\"\n\n/**\n * Consolidated statutory parameter table for all 50 US states and the District of Columbia\n * for Tax Year 2026.\n *\n * @statute State individual income tax statutes; 2026 schedules as published by the\n * state revenue departments and compiled by the Tax Foundation (February 2026).\n */\nexport const US_2026_STATE_PARAMETERS: Record<UsStateCode, UsStateParameters> = indexStates([\n\t...NO_TAX_STATES,\n\t...FLAT_STATES,\n\t...PROGRESSIVE_STATES,\n])\n\nexport type { UsStateParameters, UsStateSurtax } from \"./types\"\n","import type { BracketSlice } from \"../core/brackets\"\nimport { fromMinorUnits, usd } from \"../core/money\"\nimport type { TaxResult } from \"../core/system\"\nimport type { UsAgiStageResult } from \"./stages/agi\"\nimport type { UsAmtResult } from \"./stages/amt\"\nimport type { UsCreditsResult } from \"./stages/credits\"\nimport type { UsDeductionsStageResult } from \"./stages/deductions\"\nimport type { UsFicaResult } from \"./stages/fica\"\nimport type { UsNiitStageResult } from \"./stages/niit\"\nimport type { UsPreferentialStageResult } from \"./stages/preferential\"\nimport type { UsScheduleSeResult } from \"./stages/se\"\nimport type { UsStateResult } from \"./stages/state\"\nimport type { UsTaxBreakdown } from \"./types\"\n\nexport interface BuildTaxResultParams {\n\treadonly agiRes: UsAgiStageResult\n\treadonly dedRes: UsDeductionsStageResult\n\treadonly ordTaxCents: number\n\treadonly ordMarginalRate: number\n\treadonly ordSlices: readonly BracketSlice[]\n\treadonly prefRes: UsPreferentialStageResult\n\treadonly regularTaxCents: number\n\treadonly amtRes: UsAmtResult\n\treadonly niitRes: UsNiitStageResult\n\treadonly ficaRes: UsFicaResult\n\treadonly seRes: UsScheduleSeResult\n\treadonly creditsRes: UsCreditsResult\n\treadonly stateRes: UsStateResult\n\treadonly totalTaxCents: number\n\treadonly withhCents: number\n\treadonly netTaxCents: number\n}\n\nexport function buildUsTaxResult(p: BuildTaxResultParams): TaxResult<\"USD\", UsTaxBreakdown> {\n\tconst effRate =\n\t\tp.agiRes.grossIncomeCents > 0 ? Math.max(0, p.totalTaxCents) / p.agiRes.grossIncomeCents : 0\n\tconst netPayable = usd(\n\t\tfromMinorUnits(p.netTaxCents, \"USD\", \"netTaxPayable\", { allowNegative: true }),\n\t\t\"netTaxPayable\",\n\t\t{ allowNegative: true },\n\t)\n\treturn {\n\t\tjurisdiction: \"US\",\n\t\ttaxYear: 2026,\n\t\tcurrency: \"USD\",\n\t\tgrossIncome: p.agiRes.grossIncome,\n\t\ttaxableIncome: p.dedRes.taxableIncome,\n\t\ttotalTax: usd(fromMinorUnits(p.totalTaxCents, \"USD\")),\n\t\teffectiveRate: effRate,\n\t\tmarginalRate: p.ordMarginalRate + (p.stateRes.breakdown?.marginalRate ?? 0),\n\t\tnetTaxPayable: netPayable,\n\t\tbreakdown: {\n\t\t\tordinaryGrossIncome: p.agiRes.ordinaryGrossIncome,\n\t\t\tpreferentialGrossIncome: p.agiRes.preferentialGrossIncome,\n\t\t\tgrossIncome: p.agiRes.grossIncome,\n\t\t\tadjustments: p.agiRes.adjustments,\n\t\t\tagi: p.agiRes.agi,\n\t\t\telectedDeduction: p.dedRes.electedDeduction,\n\t\t\tstandardDeduction: p.dedRes.standardBreakdown,\n\t\t\titemizedDeductions: p.dedRes.itemizedBreakdown,\n\t\t\tallowableDeduction: p.dedRes.allowableDeduction,\n\t\t\tordinaryTaxableIncome: p.dedRes.ordinaryTaxableIncome,\n\t\t\tpreferentialTaxableIncome: p.dedRes.preferentialTaxableIncome,\n\t\t\ttaxableIncome: p.dedRes.taxableIncome,\n\t\t\tordinaryTax: usd(fromMinorUnits(p.ordTaxCents, \"USD\")),\n\t\t\tordinarySlices: p.ordSlices,\n\t\t\tpreferentialTax: p.prefRes.preferentialTax,\n\t\t\tpreferentialSlices: p.prefRes.slices,\n\t\t\tregularIncomeTax: usd(fromMinorUnits(p.regularTaxCents, \"USD\")),\n\t\t\tamt: p.amtRes.breakdown,\n\t\t\tniit: p.niitRes.breakdown,\n\t\t\tfica: p.ficaRes.breakdown,\n\t\t\tscheduleSe: p.seRes.breakdown,\n\t\t\tcredits: p.creditsRes.breakdown,\n\t\t\tstate: p.stateRes.breakdown,\n\t\t\ttotalTax: usd(fromMinorUnits(p.totalTaxCents, \"USD\")),\n\t\t\twithholding: usd(fromMinorUnits(p.withhCents, \"USD\")),\n\t\t\tnetTaxPayable: netPayable,\n\t\t},\n\t}\n}\n","import { type ClampedAmount, clampCap } from \"../../core/caps\"\nimport { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsAdjustmentsBreakdown, UsAdjustmentsInput, UsFilingStatus } from \"../types\"\n\nexport interface UsAdjustmentsResult {\n\treadonly totalAdjCents: number\n\treadonly breakdown: UsAdjustmentsBreakdown\n}\n\nfunction resolveAdjustmentClamped(\n\tamount: number | undefined,\n\tcapDollars: number,\n\tfield: string,\n): { cents: number; clamped: ClampedAmount } {\n\tconst reqCents = toMinorUnits(amount ?? 0, \"USD\", field)\n\tconst capCents = toMinorUnits(capDollars, \"USD\", `${field}Cap`)\n\tconst clampedCents = clampCap(reqCents, capCents, field)\n\treturn {\n\t\tcents: clampedCents.allowed,\n\t\tclamped: {\n\t\t\trequested: fromMinorUnits(clampedCents.requested, \"USD\"),\n\t\t\tallowed: fromMinorUnits(clampedCents.allowed, \"USD\"),\n\t\t\tcap: fromMinorUnits(clampedCents.cap, \"USD\"),\n\t\t\twasClamped: clampedCents.wasClamped,\n\t\t},\n\t}\n}\n\nfunction resolveCaps(\n\tadj: UsAdjustmentsInput | undefined,\n\tstatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n) {\n\tconst p = params.aboveTheLineCaps\n\tconst educator =\n\t\tstatus === \"married_filing_jointly\" && adj?.bothSpousesEducators\n\t\t\t? p.educatorMfjBoth\n\t\t\t: p.educatorSingle\n\tconst hsaBase = adj?.hsaCoverageType === \"family\" ? p.hsaFamilyBase : p.hsaSelfOnlyBase\n\tconst hsa = hsaBase + (adj?.age55OrOlder ? p.hsaCatchUpAge55 : 0)\n\tconst ira = p.traditionalIraBase + (adj?.age50OrOlder ? p.traditionalIraCatchUpAge50 : 0)\n\tconst k401 = p.traditional401kBase + (adj?.age50OrOlder ? p.traditional401kCatchUpAge50 : 0)\n\treturn { educator, hsa, ira, k401, student: p.studentLoanInterest }\n}\n\n/**\n * Evaluates Schedule 1 Above-the-Line Adjustments clamped to statutory caps.\n *\n * @statute IRC § 62, § 219, § 221, § 223, § 402(g)\n */\nexport function calculateUsAdjustments(\n\tadjustments: UsAdjustmentsInput | undefined,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsAdjustmentsResult {\n\tconst caps = resolveCaps(adjustments, filingStatus, params)\n\tconst edu = resolveAdjustmentClamped(\n\t\tadjustments?.educatorExpenses,\n\t\tcaps.educator,\n\t\t\"educatorExpenses\",\n\t)\n\tconst hsa = resolveAdjustmentClamped(adjustments?.hsaContributions, caps.hsa, \"hsaContributions\")\n\tconst ira = resolveAdjustmentClamped(\n\t\tadjustments?.traditionalIraContributions,\n\t\tcaps.ira,\n\t\t\"traditionalIra\",\n\t)\n\tconst sl = resolveAdjustmentClamped(\n\t\tadjustments?.studentLoanInterest,\n\t\tcaps.student,\n\t\t\"studentLoanInterest\",\n\t)\n\tconst k401 = resolveAdjustmentClamped(\n\t\tadjustments?.preTaxDeferrals401k,\n\t\tcaps.k401,\n\t\t\"preTaxDeferrals401k\",\n\t)\n\tconst seCents = toMinorUnits(\n\t\tadjustments?.deductibleSelfEmploymentTax ?? 0,\n\t\t\"USD\",\n\t\t\"deductibleSeTax\",\n\t)\n\n\tconst totalAdjCents = edu.cents + hsa.cents + ira.cents + sl.cents + k401.cents + seCents\n\treturn {\n\t\ttotalAdjCents,\n\t\tbreakdown: {\n\t\t\teducatorExpenses: edu.clamped,\n\t\t\thsa: hsa.clamped,\n\t\t\ttraditionalIra: ira.clamped,\n\t\t\tstudentLoanInterest: sl.clamped,\n\t\t\tpreTaxDeferrals401k: k401.clamped,\n\t\t\tdeductibleSelfEmploymentTax: usd(fromMinorUnits(seCents, \"USD\")),\n\t\t\ttotalAdjustments: usd(fromMinorUnits(totalAdjCents, \"USD\")),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, type Money, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type {\n\tUsAdjustmentsBreakdown,\n\tUsAdjustmentsInput,\n\tUsFilingStatus,\n\tUsIncomeInput,\n} from \"../types\"\nimport { calculateUsAdjustments } from \"./adjustments\"\n\nexport interface UsAgiStageResult {\n\treadonly ordinaryGrossCents: number\n\treadonly preferentialGrossCents: number\n\treadonly grossIncomeCents: number\n\treadonly totalAdjustmentsCents: number\n\treadonly agiCents: number\n\treadonly ordinaryGrossIncome: Money<\"USD\">\n\treadonly preferentialGrossIncome: Money<\"USD\">\n\treadonly grossIncome: Money<\"USD\">\n\treadonly agi: Money<\"USD\">\n\treadonly adjustments: UsAdjustmentsBreakdown\n}\n\nfunction sumOrdinaryIncomeCents(income: UsIncomeInput): number {\n\treturn (\n\t\ttoMinorUnits(income.w2Wages ?? 0, \"USD\", \"w2Wages\") +\n\t\ttoMinorUnits(income.selfEmploymentNetEarnings ?? 0, \"USD\", \"selfEmploymentNetEarnings\", {\n\t\t\tallowNegative: true,\n\t\t}) +\n\t\ttoMinorUnits(income.ordinaryInterest ?? 0, \"USD\", \"ordinaryInterest\") +\n\t\ttoMinorUnits(income.ordinaryDividends ?? 0, \"USD\", \"ordinaryDividends\") +\n\t\ttoMinorUnits(income.shortTermCapitalGains ?? 0, \"USD\", \"shortTermCapitalGains\") +\n\t\ttoMinorUnits(income.rentalAndOtherOrdinaryIncome ?? 0, \"USD\", \"rentalAndOtherOrdinaryIncome\")\n\t)\n}\n\nfunction sumPreferentialIncomeCents(income: UsIncomeInput): number {\n\treturn (\n\t\ttoMinorUnits(income.longTermCapitalGains ?? 0, \"USD\", \"longTermCapitalGains\") +\n\t\ttoMinorUnits(income.qualifiedDividends ?? 0, \"USD\", \"qualifiedDividends\")\n\t)\n}\n\n/**\n * Computes Gross Income, clamped Schedule 1 Adjustments, and AGI in minor units.\n *\n * @statute IRC § 61, § 62\n */\nexport function calculateUsAgi(\n\tincome: UsIncomeInput,\n\tadjustments: UsAdjustmentsInput | undefined,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsAgiStageResult {\n\tconst ordinaryCents = sumOrdinaryIncomeCents(income)\n\tconst prefCents = sumPreferentialIncomeCents(income)\n\tconst grossCents = ordinaryCents + prefCents\n\n\tconst adjResult = calculateUsAdjustments(adjustments, filingStatus, params)\n\tconst agiCents = Math.max(0, grossCents - adjResult.totalAdjCents)\n\n\treturn {\n\t\tordinaryGrossCents: ordinaryCents,\n\t\tpreferentialGrossCents: prefCents,\n\t\tgrossIncomeCents: grossCents,\n\t\ttotalAdjustmentsCents: adjResult.totalAdjCents,\n\t\tagiCents,\n\t\tordinaryGrossIncome: usd(\n\t\t\tfromMinorUnits(ordinaryCents, \"USD\", \"ordinaryGrossIncome\", { allowNegative: true }),\n\t\t\t\"ordinaryGrossIncome\",\n\t\t\t{ allowNegative: true },\n\t\t),\n\t\tpreferentialGrossIncome: usd(fromMinorUnits(prefCents, \"USD\")),\n\t\tgrossIncome: usd(\n\t\t\tfromMinorUnits(grossCents, \"USD\", \"grossIncome\", { allowNegative: true }),\n\t\t\t\"grossIncome\",\n\t\t\t{ allowNegative: true },\n\t\t),\n\t\tagi: usd(fromMinorUnits(agiCents, \"USD\")),\n\t\tadjustments: adjResult.breakdown,\n\t}\n}\n","/**\n * Diagnostic and reporting field identifiers for US income sources.\n */\nexport enum UsIncomeField {\n\tW2Wages = \"income.w2Wages\",\n\tSelfEmploymentNetEarnings = \"income.selfEmploymentNetEarnings\",\n\tOrdinaryInterest = \"income.ordinaryInterest\",\n\tOrdinaryDividends = \"income.ordinaryDividends\",\n\tShortTermCapitalGains = \"income.shortTermCapitalGains\",\n\tRentalAndOtherOrdinaryIncome = \"income.rentalAndOtherOrdinaryIncome\",\n\tLongTermCapitalGains = \"income.longTermCapitalGains\",\n\tQualifiedDividends = \"income.qualifiedDividends\",\n}\n\n/**\n * Diagnostic and reporting field identifiers for Schedule 1 adjustments.\n */\nexport enum UsAdjustmentField {\n\tEducatorExpenses = \"adjustments.educatorExpenses\",\n\tHsaContributions = \"adjustments.hsaContributions\",\n\tTraditionalIra = \"adjustments.traditionalIra\",\n\tStudentLoanInterest = \"adjustments.studentLoanInterest\",\n\tPreTaxDeferrals401k = \"adjustments.preTaxDeferrals401k\",\n\tDeductibleSeTax = \"adjustments.deductibleSeTax\",\n}\n\n/**\n * Diagnostic and reporting field identifiers for Schedule A itemized deductions.\n */\nexport enum UsDeductionField {\n\tMedicalExpenses = \"itemized.medicalExpenses\",\n\tStateAndLocalTaxes = \"itemized.stateAndLocalTaxes\",\n\tMortgageInterest = \"itemized.mortgageInterest\",\n\tCharitableContributions = \"itemized.charitableContributions\",\n\tStandardDeduction = \"deductions.standard\",\n}\n\n/**\n * Diagnostic and reporting field identifiers for Payroll and Self-Employment taxes.\n */\nexport enum UsPayrollField {\n\tFicaSocialSecurity = \"payroll.fica.socialSecurity\",\n\tFicaMedicare = \"payroll.fica.medicare\",\n\tFicaAdditionalMedicare = \"payroll.fica.additionalMedicare\",\n\tSeSocialSecurity = \"payroll.se.socialSecurity\",\n\tSeMedicare = \"payroll.se.medicare\",\n\tSeDeductiblePortion = \"payroll.se.deductiblePortion\",\n}\n\nexport { UsPayrollField as UsFicaField }\n\n/**\n * Diagnostic and reporting field identifiers for Alternative Minimum Tax.\n */\nexport enum UsAmtField {\n\tAmti = \"amt.amti\",\n\tExemption = \"amt.exemption\",\n\tPreferences = \"amt.preferences\",\n\tTentativeMinimumTax = \"amt.tentativeMinimumTax\",\n\tAmtTax = \"amt.tax\",\n}\n\n/**\n * Diagnostic and reporting field identifiers for Federal Tax Credits.\n */\nexport enum UsCreditField {\n\tChildTaxCredit = \"credits.ctc\",\n\tAdditionalChildTaxCredit = \"credits.actc\",\n\tOtherDependentCredit = \"credits.odc\",\n\tEarnedIncomeTaxCredit = \"credits.eitc\",\n\tChildAndDependentCare = \"credits.care\",\n\tAotc = \"credits.aotc\",\n\tLlc = \"credits.llc\",\n\tForeignTaxCredit = \"credits.ftc\",\n\tCustomNonRefundable = \"credits.customNonRefundable\",\n\tCustomRefundable = \"credits.customRefundable\",\n}\n\n/**\n * Diagnostic and reporting field identifiers for US federal tax totals.\n */\nexport enum UsTaxField {\n\tGrossIncome = \"grossIncome\",\n\tTaxableIncome = \"taxableIncome\",\n\tRegularIncomeTax = \"regularIncomeTax\",\n\tTotalTax = \"totalTax\",\n\tWithholding = \"withholding\",\n\tNetTaxPayable = \"netTaxPayable\",\n}\n","import { fromMinorUnits, type TaxSupportedCurrency, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsAmtBreakdown, UsFilingStatus } from \"../types\"\nimport { UsAmtField } from \"../types/fields\"\nimport type { UsDeductionsStageResult } from \"./deductions\"\n\n/**\n * Resolves the Schedule A SALT add-back for Form 6251.\n *\n * @param deductions Deduction stage result carrying the elected method and Schedule A.\n * @param currency Supported statutory currency threaded for minor-unit conversion.\n * @returns Allowed SALT deduction in integer cents (0 unless itemizing).\n * @throws {TaxValidationError} if the allowed SALT amount is not representable as cents.\n * @statute IRC § 56(b)(1)(A)(ii)\n */\nexport function resolveAmtSaltCents(\n\tdeductions: UsDeductionsStageResult,\n\tcurrency: TaxSupportedCurrency,\n): number {\n\treturn deductions.electedDeduction === \"itemized\" && deductions.itemizedBreakdown\n\t\t? toMinorUnits(deductions.itemizedBreakdown.salt.allowed, currency)\n\t\t: 0\n}\n\nexport interface UsAmtResult {\n\treadonly amtTaxCents: number\n\treadonly tentativeMinimumTaxCents: number\n\treadonly breakdown: UsAmtBreakdown\n}\n\n/**\n * Computes Form 6251 Alternative Minimum Tax (AMT).\n *\n * @statute IRC § 55\n */\nexport function calculateUsAmt(\n\ttaxableIncomeCents: number,\n\tsaltDeductionCents: number,\n\tpreferencesDollars: number | undefined,\n\tregularTaxCents: number,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsAmtResult {\n\tconst prefCents = toMinorUnits(preferencesDollars ?? 0, params.currency, UsAmtField.Preferences)\n\tconst amtiCents = taxableIncomeCents + saltDeductionCents + prefCents\n\n\tconst baseExemptionCents = toMinorUnits(params.amt.baseExemptions[filingStatus], params.currency)\n\tconst phaseoutCents = toMinorUnits(params.amt.phaseoutThresholds[filingStatus], params.currency)\n\tconst excessAmtiCents = Math.max(0, amtiCents - phaseoutCents)\n\tconst reductionCents = Math.round(excessAmtiCents * params.amt.phaseoutRate)\n\tconst allowedExemptionCents = Math.max(0, baseExemptionCents - reductionCents)\n\n\tconst amtBaseCents = Math.max(0, amtiCents - allowedExemptionCents)\n\tconst cap26Cents = toMinorUnits(params.amt.rate26Thresholds[filingStatus], params.currency)\n\n\tlet tmtCents: number\n\tif (amtBaseCents <= cap26Cents) {\n\t\ttmtCents = Math.round(amtBaseCents * params.amt.rate26)\n\t} else {\n\t\ttmtCents = Math.round(\n\t\t\tcap26Cents * params.amt.rate26 + (amtBaseCents - cap26Cents) * params.amt.rate28,\n\t\t)\n\t}\n\n\tconst amtTaxCents = Math.max(0, tmtCents - regularTaxCents)\n\n\treturn {\n\t\tamtTaxCents,\n\t\ttentativeMinimumTaxCents: tmtCents,\n\t\tbreakdown: {\n\t\t\ttaxableIncome: usd(fromMinorUnits(taxableIncomeCents, params.currency)),\n\t\t\tsaltAddBack: usd(fromMinorUnits(saltDeductionCents, params.currency)),\n\t\t\tpreferences: usd(fromMinorUnits(prefCents, params.currency, UsAmtField.Preferences)),\n\t\t\tamti: usd(fromMinorUnits(amtiCents, params.currency, UsAmtField.Amti)),\n\t\t\tbaseExemption: usd(fromMinorUnits(baseExemptionCents, params.currency)),\n\t\t\tphaseoutThreshold: usd(fromMinorUnits(phaseoutCents, params.currency)),\n\t\t\texemptionReduction: usd(fromMinorUnits(reductionCents, params.currency)),\n\t\t\tallowedExemption: usd(\n\t\t\t\tfromMinorUnits(allowedExemptionCents, params.currency, UsAmtField.Exemption),\n\t\t\t),\n\t\t\tamtTaxableBase: usd(fromMinorUnits(amtBaseCents, params.currency)),\n\t\t\ttentativeMinimumTax: usd(\n\t\t\t\tfromMinorUnits(tmtCents, params.currency, UsAmtField.TentativeMinimumTax),\n\t\t\t),\n\t\t\tregularTax: usd(fromMinorUnits(regularTaxCents, params.currency)),\n\t\t\tamtTax: usd(fromMinorUnits(amtTaxCents, params.currency, UsAmtField.AmtTax)),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsChildCreditsBreakdown, UsCreditsInput, UsFilingStatus } from \"../types\"\nimport { UsCreditField } from \"../types/fields\"\n\nexport interface UsChildCreditsResult {\n\treadonly nonRefundableUsedCents: number\n\treadonly actcRefundableCents: number\n\treadonly breakdown: UsChildCreditsBreakdown\n}\n\nfunction resolveCtcAllocation(initialCtc: number, initialOdc: number, reduction: number) {\n\tif (reduction <= initialOdc) {\n\t\treturn { allowedCtc: initialCtc, allowedOdc: initialOdc - reduction }\n\t}\n\tconst remReduction = reduction - initialOdc\n\treturn { allowedCtc: Math.max(0, initialCtc - remReduction), allowedOdc: 0 }\n}\n\n/**\n * Computes Child Tax Credit (CTC), ODC, and refundable Additional Child Tax Credit (ACTC).\n *\n * @statute IRC § 24\n */\nexport function calculateUsChildCredits(\n\tcredits: UsCreditsInput | undefined,\n\tmagiDollars: number,\n\tearnedIncomeDollars: number,\n\ttaxAvailableCents: number,\n\tstatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsChildCreditsResult {\n\tconst children = Math.max(0, Math.floor(credits?.qualifyingChildrenForChildTaxCredit ?? 0))\n\tconst otherDeps = Math.max(0, Math.floor(credits?.otherDependents ?? 0))\n\tconst initCtc = children * params.credits.ctcAmountPerChild\n\tconst initOdc = otherDeps * params.credits.odcAmountPerDependent\n\n\tconst thresh = params.credits.ctcPhaseoutThresholds[status]\n\tconst excessMagi = Math.max(0, magiDollars - thresh)\n\tconst steps = Math.ceil(excessMagi / params.credits.ctcPhaseoutStepAmount)\n\tconst reduction = steps * params.credits.ctcPhaseoutStepRate\n\tconst { allowedCtc, allowedOdc } = resolveCtcAllocation(initCtc, initOdc, reduction)\n\n\tconst ctcCents = toMinorUnits(allowedCtc, params.currency)\n\tconst odcCents = toMinorUnits(allowedOdc, params.currency)\n\tconst nonRefCtcUsed = Math.min(ctcCents, taxAvailableCents)\n\tconst nonRefOdcUsed = Math.min(odcCents, taxAvailableCents - nonRefCtcUsed)\n\n\tconst unusedCtcDollars = allowedCtc - fromMinorUnits(nonRefCtcUsed, params.currency)\n\tconst excessEarned = Math.max(0, earnedIncomeDollars - params.credits.actcEarnedIncomeThreshold)\n\tconst earnedFormula = excessEarned * params.credits.actcRate\n\tconst maxActc = children * params.credits.actcMaxPerChild\n\tconst actcDollars = Math.min(unusedCtcDollars, maxActc, earnedFormula)\n\tconst actcCents = toMinorUnits(actcDollars, params.currency)\n\n\treturn {\n\t\tnonRefundableUsedCents: nonRefCtcUsed + nonRefOdcUsed,\n\t\tactcRefundableCents: actcCents,\n\t\tbreakdown: {\n\t\t\tqualifyingChildren: children,\n\t\t\totherDependents: otherDeps,\n\t\t\tinitialCtc: usd(fromMinorUnits(toMinorUnits(initCtc, params.currency), params.currency)),\n\t\t\tinitialOdc: usd(fromMinorUnits(toMinorUnits(initOdc, params.currency), params.currency)),\n\t\t\tphaseoutReduction: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(reduction, params.currency), params.currency),\n\t\t\t),\n\t\t\tallowedCtc: usd(fromMinorUnits(ctcCents, params.currency)),\n\t\t\tallowedOdc: usd(fromMinorUnits(odcCents, params.currency)),\n\t\t\tnonRefundableCtcUsed: usd(\n\t\t\t\tfromMinorUnits(nonRefCtcUsed, params.currency, UsCreditField.ChildTaxCredit),\n\t\t\t),\n\t\t\tnonRefundableOdcUsed: usd(\n\t\t\t\tfromMinorUnits(nonRefOdcUsed, params.currency, UsCreditField.OtherDependentCredit),\n\t\t\t),\n\t\t\tactcRefundable: usd(\n\t\t\t\tfromMinorUnits(actcCents, params.currency, UsCreditField.AdditionalChildTaxCredit),\n\t\t\t),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsCreditsInput, UsEitcBreakdown, UsFilingStatus } from \"../types\"\nimport { UsCreditField } from \"../types/fields\"\n\nexport interface UsEitcResult {\n\treadonly creditCents: number\n\treadonly breakdown: UsEitcBreakdown\n}\n\nfunction resolveTierKey(count: number): 0 | 1 | 2 | 3 {\n\tif (count <= 0) return 0\n\tif (count === 1) return 1\n\tif (count === 2) return 2\n\treturn 3\n}\n\n/**\n * Computes Earned Income Tax Credit (EITC) across child tiers 0, 1, 2, 3+.\n *\n * @statute IRC § 32\n */\nexport function calculateUsEitc(\n\tcredits: UsCreditsInput | undefined,\n\tearnedIncomeDollars: number,\n\tinvestmentIncomeDollars: number,\n\tagiDollars: number,\n\tstatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsEitcResult {\n\tconst children = Math.max(0, Math.floor(credits?.eitcQualifyingChildren ?? 0))\n\tconst invLimit = params.credits.eitcInvestmentIncomeLimit\n\tconst isDisqualified =\n\t\tinvestmentIncomeDollars > invLimit || status === \"married_filing_separately\"\n\n\tif (isDisqualified || earnedIncomeDollars <= 0) {\n\t\treturn {\n\t\t\tcreditCents: 0,\n\t\t\tbreakdown: {\n\t\t\t\tqualifyingChildren: children,\n\t\t\t\tearnedIncome: usd(\n\t\t\t\t\tfromMinorUnits(\n\t\t\t\t\t\ttoMinorUnits(Math.max(0, earnedIncomeDollars), params.currency),\n\t\t\t\t\t\tparams.currency,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tdisqualifiedByInvestmentIncome: investmentIncomeDollars > invLimit,\n\t\t\t\tcredit: usd(0),\n\t\t\t},\n\t\t}\n\t}\n\n\tconst tierKey = resolveTierKey(children)\n\tconst tier = params.credits.eitcTiers[tierKey]\n\tconst tentative = Math.min(earnedIncomeDollars * tier.creditRate, tier.maxCredit)\n\n\tconst phaseoutBasis = Math.max(earnedIncomeDollars, agiDollars)\n\tconst thresh =\n\t\tstatus === \"married_filing_jointly\" ? tier.phaseoutThresholdMfj : tier.phaseoutThresholdSingle\n\tconst excess = Math.max(0, phaseoutBasis - thresh)\n\tconst reduction = excess * tier.phaseoutRate\n\tconst creditDollars = Math.max(0, tentative - reduction)\n\tconst creditCents = toMinorUnits(creditDollars, params.currency)\n\n\treturn {\n\t\tcreditCents,\n\t\tbreakdown: {\n\t\t\tqualifyingChildren: children,\n\t\t\tearnedIncome: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(earnedIncomeDollars, params.currency), params.currency),\n\t\t\t),\n\t\t\tdisqualifiedByInvestmentIncome: false,\n\t\t\tcredit: usd(\n\t\t\t\tfromMinorUnits(creditCents, params.currency, UsCreditField.EarnedIncomeTaxCredit),\n\t\t\t),\n\t\t},\n\t}\n}\n","import { toMinorUnits } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsCreditsInput } from \"../types\"\n\n/**\n * Calculates Child and Dependent Care Credit (IRC § 21).\n *\n * @statute IRC § 21\n */\nexport function calculateUsCareCredit(\n\tcredits: UsCreditsInput | undefined,\n\tearnedDollars: number,\n\tagiDollars: number,\n\tparams: typeof US_2026_PARAMETERS,\n): number {\n\tconst individuals = Math.max(0, credits?.qualifyingIndividualsForCare ?? 0)\n\tif (individuals <= 0) return 0\n\tconst maxExp =\n\t\tindividuals >= 2 ? params.credits.careMaxExpenseTwoPlus : params.credits.careMaxExpenseOne\n\tconst expenses = Math.min(\n\t\tMath.max(0, credits?.childAndDependentCareExpenses ?? 0),\n\t\tmaxExp,\n\t\tearnedDollars,\n\t)\n\tconst excessAgi = Math.max(0, agiDollars - params.credits.carePhaseoutAgiThreshold)\n\tconst rateReduction =\n\t\tMath.ceil(excessAgi / params.credits.carePhaseoutStepAgi) * params.credits.carePhaseoutStepRate\n\tconst rate = Math.max(params.credits.careFloorRate, params.credits.careBaseRate - rateReduction)\n\treturn toMinorUnits(expenses * rate, params.currency)\n}\n","import { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsCreditsInput, UsEducationCreditsBreakdown, UsFilingStatus } from \"../types\"\nimport { calculateUsCareCredit } from \"./credits-care\"\n\nexport interface UsOtherCreditsResult {\n\treadonly careNonRefundableCents: number\n\treadonly aotcNonRefundableCents: number\n\treadonly aotcRefundableCents: number\n\treadonly llcNonRefundableCents: number\n\treadonly foreignTaxCreditCents: number\n\treadonly customNonRefundableCents: number\n\treadonly customRefundableCents: number\n\treadonly educationBreakdown: UsEducationCreditsBreakdown\n}\n\nfunction calculateEducationCredits(\n\tcredits: UsCreditsInput | undefined,\n\tmagiDollars: number,\n\tstatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n) {\n\tif (status === \"married_filing_separately\") return { nonRefAotc: 0, refAotc: 0, nonRefLlc: 0 }\n\tconst pMin = params.credits.aotcPhaseoutMin[status]\n\tconst pMax = params.credits.aotcPhaseoutMax[status]\n\tconst factor =\n\t\tmagiDollars <= pMin ? 1 : magiDollars >= pMax ? 0 : (pMax - magiDollars) / (pMax - pMin)\n\tlet rawAotc = 0\n\tlet llcExp = 0\n\tfor (const student of credits?.educationStudents ?? []) {\n\t\tif (student.type === \"aotc\") {\n\t\t\tconst exp = Math.max(0, student.qualifiedExpenses)\n\t\t\tconst tier1 = Math.min(exp, params.credits.aotcTier1MaxExpense) * params.credits.aotcTier1Rate\n\t\t\tconst tier2 =\n\t\t\t\tMath.max(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.min(exp - params.credits.aotcTier1MaxExpense, params.credits.aotcTier2MaxExpense),\n\t\t\t\t) * params.credits.aotcTier2Rate\n\t\t\tconst cappedStudentAotc = Math.min(tier1 + tier2, params.credits.aotcMaxPerStudent)\n\t\t\trawAotc += cappedStudentAotc * factor\n\t\t} else {\n\t\t\tllcExp += Math.max(0, student.qualifiedExpenses)\n\t\t}\n\t}\n\tconst refAotc = toMinorUnits(rawAotc * params.credits.aotcRefundableRate, params.currency)\n\tconst nonRefAotc = toMinorUnits(\n\t\trawAotc * (1 - params.credits.aotcRefundableRate),\n\t\tparams.currency,\n\t)\n\tconst rawLlc =\n\t\tMath.min(llcExp, params.credits.llcMaxExpensePerReturn) * params.credits.llcRate * factor\n\treturn { nonRefAotc, refAotc, nonRefLlc: toMinorUnits(rawLlc, params.currency) }\n}\n\n/**\n * Computes Child and Dependent Care, Education, Foreign Tax, and Custom credits.\n *\n * @statute IRC §§ 21, 25A, 901\n */\nexport function calculateUsOtherCredits(\n\tcredits: UsCreditsInput | undefined,\n\tearnedDollars: number,\n\tagiDollars: number,\n\tmagiDollars: number,\n\tstatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsOtherCreditsResult {\n\tconst careCents = calculateUsCareCredit(credits, earnedDollars, agiDollars, params)\n\tconst edu = calculateEducationCredits(credits, magiDollars, status, params)\n\tconst ftcCents = toMinorUnits(Math.max(0, credits?.foreignTaxCredit ?? 0), params.currency)\n\tconst custNonRefCents = toMinorUnits(\n\t\tMath.max(0, credits?.customNonRefundableCredits ?? 0),\n\t\tparams.currency,\n\t)\n\tconst custRefCents = toMinorUnits(\n\t\tMath.max(0, credits?.customRefundableCredits ?? 0),\n\t\tparams.currency,\n\t)\n\n\treturn {\n\t\tcareNonRefundableCents: careCents,\n\t\taotcNonRefundableCents: edu.nonRefAotc,\n\t\taotcRefundableCents: edu.refAotc,\n\t\tllcNonRefundableCents: edu.nonRefLlc,\n\t\tforeignTaxCreditCents: ftcCents,\n\t\tcustomNonRefundableCents: custNonRefCents,\n\t\tcustomRefundableCents: custRefCents,\n\t\teducationBreakdown: {\n\t\t\taotcNonRefundable: usd(fromMinorUnits(edu.nonRefAotc, params.currency)),\n\t\t\taotcRefundable: usd(fromMinorUnits(edu.refAotc, params.currency)),\n\t\t\tllcNonRefundable: usd(fromMinorUnits(edu.nonRefLlc, params.currency)),\n\t\t\ttotalNonRefundable: usd(fromMinorUnits(edu.nonRefAotc + edu.nonRefLlc, params.currency)),\n\t\t\ttotalRefundable: usd(fromMinorUnits(edu.refAotc, params.currency)),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsIncomeInput, UsScheduleSeBreakdown } from \"../types\"\nimport { UsPayrollField } from \"../types/fields\"\n\nexport interface UsScheduleSeResult {\n\treadonly totalSeTaxCents: number\n\treadonly deductiblePortionCents: number\n\treadonly deductiblePortionDollars: number\n\treadonly breakdown: UsScheduleSeBreakdown\n}\n\n/**\n * Calculates net earnings from self-employment subject to SECA/FICA tax (IRC § 1402(a)).\n *\n * @statute IRC § 1402(a)\n */\nexport function calculateNetSelfEmploymentEarnings(\n\tearnings: number | undefined,\n\tseNetEarningsFactor: number,\n): number {\n\treturn Math.max(0, (earnings ?? 0) * seNetEarningsFactor)\n}\n\n/**\n * Computes Schedule SE Self-Employment Tax (SECA).\n *\n * @statute IRC § 1401, § 1402\n */\nexport function calculateUsScheduleSe(\n\tincome: UsIncomeInput,\n\tparams: typeof US_2026_PARAMETERS,\n): UsScheduleSeResult {\n\tconst rawNetEarnings = Math.max(0, income.selfEmploymentNetEarnings ?? 0)\n\tconst factor = params.payroll.seNetEarningsFactor\n\tconst subjectAmount = calculateNetSelfEmploymentEarnings(rawNetEarnings, factor)\n\tconst applies = subjectAmount >= params.payroll.seThresholdFloor\n\n\tconst w2Dollars = Math.max(0, income.w2Wages ?? 0)\n\tconst remainingWageBase = Math.max(0, params.payroll.socialSecurityWageBase - w2Dollars)\n\tconst ssTaxableDollars = applies ? Math.min(subjectAmount, remainingWageBase) : 0\n\n\tconst ssTaxCents = Math.round(ssTaxableDollars * params.payroll.seSocialSecurityRate * 100)\n\tconst medTaxCents = applies ? Math.round(subjectAmount * params.payroll.seMedicareRate * 100) : 0\n\tconst totalSeTaxCents = ssTaxCents + medTaxCents\n\tconst deductibleCents = Math.round(totalSeTaxCents * params.payroll.seDeductibleRate)\n\n\treturn {\n\t\ttotalSeTaxCents,\n\t\tdeductiblePortionCents: deductibleCents,\n\t\tdeductiblePortionDollars: fromMinorUnits(deductibleCents, params.currency),\n\t\tbreakdown: {\n\t\t\tnetEarnings: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(rawNetEarnings, params.currency), params.currency),\n\t\t\t),\n\t\t\tnetEarningsMultiplier: factor,\n\t\t\tsubjectEarnings: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(applies ? subjectAmount : 0, params.currency), params.currency),\n\t\t\t),\n\t\t\tsocialSecurityTaxable: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(ssTaxableDollars, params.currency), params.currency),\n\t\t\t),\n\t\t\tsocialSecurityTax: usd(\n\t\t\t\tfromMinorUnits(ssTaxCents, params.currency, UsPayrollField.SeSocialSecurity),\n\t\t\t),\n\t\t\tmedicareTax: usd(fromMinorUnits(medTaxCents, params.currency, UsPayrollField.SeMedicare)),\n\t\t\ttotalSelfEmploymentTax: usd(fromMinorUnits(totalSeTaxCents, params.currency)),\n\t\t\tdeductiblePortion: usd(\n\t\t\t\tfromMinorUnits(deductibleCents, params.currency, UsPayrollField.SeDeductiblePortion),\n\t\t\t),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsCreditsBreakdown, UsTaxInput } from \"../types\"\nimport { calculateUsChildCredits } from \"./credits-child\"\nimport { calculateUsEitc } from \"./credits-eitc\"\nimport { calculateUsOtherCredits } from \"./credits-other\"\nimport { calculateNetSelfEmploymentEarnings } from \"./se\"\n\nexport interface UsCreditsResult {\n\treadonly allowedNonRefundableCents: number\n\treadonly totalRefundableCents: number\n\treadonly breakdown: UsCreditsBreakdown\n}\n\n/**\n * Coordinates and computes all statutory federal tax credits.\n *\n * @statute IRC §§ 21, 24, 25A, 32, 901\n */\nexport function calculateUsCredits(\n\tinput: UsTaxInput,\n\tagiCents: number,\n\ttaxAvailableCents: number,\n\tparams: typeof US_2026_PARAMETERS,\n): UsCreditsResult {\n\tconst agiDollars = fromMinorUnits(agiCents, params.currency)\n\tconst magiDollars = input.magi ?? agiDollars\n\tconst w2 = Math.max(0, input.income.w2Wages ?? 0)\n\tconst se = calculateNetSelfEmploymentEarnings(\n\t\tinput.income.selfEmploymentNetEarnings,\n\t\tparams.payroll.seNetEarningsFactor,\n\t)\n\tconst earnedDollars = w2 + se\n\tconst invDollars =\n\t\t(input.credits?.eitcInvestmentIncome ?? 0) +\n\t\tMath.max(0, input.income.ordinaryInterest ?? 0) +\n\t\tMath.max(0, input.income.ordinaryDividends ?? 0) +\n\t\tMath.max(0, input.income.longTermCapitalGains ?? 0)\n\n\tconst child = calculateUsChildCredits(\n\t\tinput.credits,\n\t\tmagiDollars,\n\t\tearnedDollars,\n\t\ttaxAvailableCents,\n\t\tinput.filingStatus,\n\t\tparams,\n\t)\n\tconst eitc = calculateUsEitc(\n\t\tinput.credits,\n\t\tearnedDollars,\n\t\tinvDollars,\n\t\tagiDollars,\n\t\tinput.filingStatus,\n\t\tparams,\n\t)\n\tconst other = calculateUsOtherCredits(\n\t\tinput.credits,\n\t\tearnedDollars,\n\t\tagiDollars,\n\t\tmagiDollars,\n\t\tinput.filingStatus,\n\t\tparams,\n\t)\n\n\tconst totalNonRefClaimed =\n\t\tchild.nonRefundableUsedCents +\n\t\tother.careNonRefundableCents +\n\t\tother.aotcNonRefundableCents +\n\t\tother.llcNonRefundableCents +\n\t\tother.foreignTaxCreditCents +\n\t\tother.customNonRefundableCents\n\tconst allowedNonRefCents = Math.min(totalNonRefClaimed, taxAvailableCents)\n\tconst totalRefCents =\n\t\tchild.actcRefundableCents +\n\t\teitc.creditCents +\n\t\tother.aotcRefundableCents +\n\t\tother.customRefundableCents\n\n\treturn {\n\t\tallowedNonRefundableCents: allowedNonRefCents,\n\t\ttotalRefundableCents: totalRefCents,\n\t\tbreakdown: {\n\t\t\tchildCredits: child.breakdown,\n\t\t\teitc: eitc.breakdown,\n\t\t\tchildAndDependentCare: usd(fromMinorUnits(other.careNonRefundableCents, params.currency)),\n\t\t\teducation: other.educationBreakdown,\n\t\t\tforeignTaxCredit: usd(fromMinorUnits(other.foreignTaxCreditCents, params.currency)),\n\t\t\tcustomNonRefundable: usd(fromMinorUnits(other.customNonRefundableCents, params.currency)),\n\t\t\tcustomRefundable: usd(fromMinorUnits(other.customRefundableCents, params.currency)),\n\t\t\ttotalNonRefundableClaimed: usd(fromMinorUnits(totalNonRefClaimed, params.currency)),\n\t\t\ttotalNonRefundableAllowed: usd(fromMinorUnits(allowedNonRefCents, params.currency)),\n\t\t\ttotalRefundable: usd(fromMinorUnits(totalRefCents, params.currency)),\n\t\t},\n\t}\n}\n","import { type ClampedAmount, clampCap } from \"../../core/caps\"\nimport { applyPercentage, fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsFilingStatus, UsItemizedBreakdown, UsItemizedDeductionsInput } from \"../types\"\n\nexport interface UsItemizedDeductionResult {\n\treadonly totalCents: number\n\treadonly breakdown: UsItemizedBreakdown\n}\n\nfunction resolveMedical(\n\tmedDollars: number | undefined,\n\tagiCents: number,\n\tfloorRate: number,\n): { cents: number; clamped: ClampedAmount } {\n\tconst reqCents = toMinorUnits(medDollars ?? 0, \"USD\", \"medicalExpenses\")\n\tconst floorCents = applyPercentage(agiCents, floorRate)\n\tconst allowedCents = Math.max(0, reqCents - floorCents)\n\treturn {\n\t\tcents: allowedCents,\n\t\tclamped: {\n\t\t\trequested: fromMinorUnits(reqCents, \"USD\"),\n\t\t\tallowed: fromMinorUnits(allowedCents, \"USD\"),\n\t\t\tcap: fromMinorUnits(floorCents, \"USD\"),\n\t\t\twasClamped: reqCents > 0 && allowedCents < reqCents,\n\t\t},\n\t}\n}\n\nfunction resolveCharity(\n\tcharityDollars: number | undefined,\n\tagiCents: number,\n\tceilRate: number,\n): { cents: number; clamped: ClampedAmount } {\n\tconst reqCents = toMinorUnits(charityDollars ?? 0, \"USD\", \"charitableContributions\")\n\tconst ceilCents = applyPercentage(agiCents, ceilRate)\n\tconst clamped = clampCap(reqCents, ceilCents, \"charitableContributions\")\n\treturn {\n\t\tcents: clamped.allowed,\n\t\tclamped: {\n\t\t\trequested: fromMinorUnits(clamped.requested, \"USD\"),\n\t\t\tallowed: fromMinorUnits(clamped.allowed, \"USD\"),\n\t\t\tcap: fromMinorUnits(clamped.cap, \"USD\"),\n\t\t\twasClamped: clamped.wasClamped,\n\t\t},\n\t}\n}\n\n/**\n * Computes Schedule A Itemized Deductions subject to floors and statutory caps.\n *\n * @statute IRC §§ 164, 170, 213\n */\nexport function calculateUsItemizedDeductions(\n\titemized: UsItemizedDeductionsInput,\n\tagiCents: number,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsItemizedDeductionResult {\n\tconst med = resolveMedical(itemized.medicalExpenses, agiCents, params.itemized.medicalFloorRate)\n\tconst saltCapDollars =\n\t\tfilingStatus === \"married_filing_separately\"\n\t\t\t? params.itemized.saltCapMfs\n\t\t\t: params.itemized.saltCap\n\tconst saltReqCents = toMinorUnits(itemized.stateAndLocalTaxes ?? 0, \"USD\", \"stateAndLocalTaxes\")\n\tconst saltCapCents = toMinorUnits(saltCapDollars, \"USD\")\n\tconst saltClamped = clampCap(saltReqCents, saltCapCents, \"stateAndLocalTaxes\")\n\n\tconst mortCents = toMinorUnits(itemized.mortgageInterest ?? 0, \"USD\", \"mortgageInterest\")\n\tconst charity = resolveCharity(\n\t\titemized.charitableContributions,\n\t\tagiCents,\n\t\tparams.itemized.charityCeilingRate,\n\t)\n\n\tconst totalCents = med.cents + saltClamped.allowed + mortCents + charity.cents\n\treturn {\n\t\ttotalCents,\n\t\tbreakdown: {\n\t\t\tmedical: med.clamped,\n\t\t\tsalt: {\n\t\t\t\trequested: fromMinorUnits(saltClamped.requested, \"USD\"),\n\t\t\t\tallowed: fromMinorUnits(saltClamped.allowed, \"USD\"),\n\t\t\t\tcap: fromMinorUnits(saltClamped.cap, \"USD\"),\n\t\t\t\twasClamped: saltClamped.wasClamped,\n\t\t\t},\n\t\t\tmortgageInterest: usd(fromMinorUnits(mortCents, \"USD\")),\n\t\t\tcharity: charity.clamped,\n\t\t\ttotal: usd(fromMinorUnits(totalCents, \"USD\")),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsFilingStatus, UsStandardDeductionBreakdown, UsTaxInput } from \"../types\"\n\nexport interface UsStandardDeductionResult {\n\treadonly totalCents: number\n\treadonly breakdown: UsStandardDeductionBreakdown\n}\n\nfunction countAdditionalConditions(input: UsTaxInput, isUnmarried: boolean): number {\n\tlet count = 0\n\tif (input.taxpayerAge65OrOlder) count++\n\tif (input.taxpayerBlind) count++\n\tif (!isUnmarried) {\n\t\tif (input.spouseAge65OrOlder) count++\n\t\tif (input.spouseBlind) count++\n\t}\n\treturn count\n}\n\n/**\n * Computes base and additional standard deduction for age and blindness in minor units.\n *\n * @statute IRC § 63(c), § 63(f)\n */\nexport function calculateUsStandardDeduction(\n\tinput: UsTaxInput,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsStandardDeductionResult {\n\tconst baseDollars = params.standardDeduction[filingStatus]\n\tconst baseCents = toMinorUnits(baseDollars, \"USD\")\n\tconst isUnmarried = filingStatus === \"single\" || filingStatus === \"head_of_household\"\n\tconst perCondDollars = isUnmarried\n\t\t? params.additionalStandardDeduction.unmarried\n\t\t: params.additionalStandardDeduction.married\n\tconst perCondCents = toMinorUnits(perCondDollars, \"USD\")\n\n\tconst condCount = countAdditionalConditions(input, isUnmarried)\n\tconst addTotalCents = condCount * perCondCents\n\tconst totalCents = baseCents + addTotalCents\n\n\treturn {\n\t\ttotalCents,\n\t\tbreakdown: {\n\t\t\tbase: usd(fromMinorUnits(baseCents, \"USD\")),\n\t\t\tadditionalConditionsCount: condCount,\n\t\t\tadditionalPerCondition: usd(fromMinorUnits(perCondCents, \"USD\")),\n\t\t\tadditionalTotal: usd(fromMinorUnits(addTotalCents, \"USD\")),\n\t\t\ttotal: usd(fromMinorUnits(totalCents, \"USD\")),\n\t\t},\n\t}\n}\n","import { fromMinorUnits, type Money, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type {\n\tUsFilingStatus,\n\tUsItemizedBreakdown,\n\tUsStandardDeductionBreakdown,\n\tUsTaxInput,\n} from \"../types\"\nimport { calculateUsItemizedDeductions } from \"./itemized-deduction\"\nimport { calculateUsStandardDeduction } from \"./standard-deduction\"\n\nexport interface UsDeductionsStageResult {\n\treadonly electedDeduction: \"standard\" | \"itemized\"\n\treadonly allowableDeductionCents: number\n\treadonly allowableDeduction: Money<\"USD\">\n\treadonly taxableIncomeCents: number\n\treadonly taxableIncome: Money<\"USD\">\n\treadonly ordinaryTaxableCents: number\n\treadonly ordinaryTaxableIncome: Money<\"USD\">\n\treadonly preferentialTaxableCents: number\n\treadonly preferentialTaxableIncome: Money<\"USD\">\n\treadonly standardBreakdown: UsStandardDeductionBreakdown\n\treadonly itemizedBreakdown?: UsItemizedBreakdown | undefined\n}\n\nfunction resolveElectedMethod(\n\telection: \"auto\" | \"standard\" | \"itemized\" | undefined,\n\titemizedCents: number,\n\tstandardCents: number,\n\thasItemized: boolean,\n): \"standard\" | \"itemized\" {\n\tif (election === \"itemized\") return \"itemized\"\n\tif (election === \"standard\") return \"standard\"\n\treturn hasItemized && itemizedCents > standardCents ? \"itemized\" : \"standard\"\n}\n\n/**\n * Evaluates Standard vs. Schedule A Itemized Deduction election and slices taxable income.\n *\n * @statute IRC § 63, § 1(h)\n */\nexport function calculateUsDeductions(\n\tinput: UsTaxInput,\n\tagiCents: number,\n\tpreferentialGrossCents: number,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsDeductionsStageResult {\n\tconst std = calculateUsStandardDeduction(input, filingStatus, params)\n\tconst hasItemized = input.itemizedDeductions !== undefined\n\tconst itm = hasItemized\n\t\t? calculateUsItemizedDeductions(input.itemizedDeductions!, agiCents, filingStatus, params)\n\t\t: undefined\n\n\tconst elected = resolveElectedMethod(\n\t\tinput.deductionElection,\n\t\titm?.totalCents ?? 0,\n\t\tstd.totalCents,\n\t\thasItemized,\n\t)\n\tconst allowableCents = elected === \"itemized\" && itm ? itm.totalCents : std.totalCents\n\tconst taxableCents = Math.max(0, agiCents - allowableCents)\n\tconst ordinaryTaxableCents = Math.max(0, taxableCents - preferentialGrossCents)\n\tconst preferentialTaxableCents = taxableCents - ordinaryTaxableCents\n\n\treturn {\n\t\telectedDeduction: elected,\n\t\tallowableDeductionCents: allowableCents,\n\t\tallowableDeduction: usd(fromMinorUnits(allowableCents, \"USD\")),\n\t\ttaxableIncomeCents: taxableCents,\n\t\ttaxableIncome: usd(fromMinorUnits(taxableCents, \"USD\")),\n\t\tordinaryTaxableCents,\n\t\tordinaryTaxableIncome: usd(fromMinorUnits(ordinaryTaxableCents, \"USD\")),\n\t\tpreferentialTaxableCents,\n\t\tpreferentialTaxableIncome: usd(fromMinorUnits(preferentialTaxableCents, \"USD\")),\n\t\tstandardBreakdown: std.breakdown,\n\t\titemizedBreakdown: itm?.breakdown,\n\t}\n}\n","import { fromMinorUnits, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsFicaBreakdown, UsFilingStatus, UsIncomeInput } from \"../types\"\nimport { UsPayrollField } from \"../types/fields\"\nimport { calculateNetSelfEmploymentEarnings } from \"./se\"\n\nexport interface UsFicaResult {\n\treadonly totalFicaCents: number\n\treadonly breakdown: UsFicaBreakdown\n}\n\n/**\n * Computes W-2 FICA payroll taxes and Additional Medicare Tax on earned income.\n *\n * @statute IRC § 3101, § 1401(b)(2)\n */\nexport function calculateUsFica(\n\tincome: UsIncomeInput,\n\tfilingStatus: UsFilingStatus,\n\tincludeFica: boolean,\n\tparams: typeof US_2026_PARAMETERS,\n): UsFicaResult {\n\tif (!includeFica) {\n\t\treturn {\n\t\t\ttotalFicaCents: 0,\n\t\t\tbreakdown: {\n\t\t\t\tenabled: false,\n\t\t\t\tsocialSecurityWages: usd(0),\n\t\t\t\tsocialSecurityTax: usd(0),\n\t\t\t\tmedicareWages: usd(0),\n\t\t\t\tmedicareTax: usd(0),\n\t\t\t\tadditionalMedicareSubject: usd(0),\n\t\t\t\tadditionalMedicareTax: usd(0),\n\t\t\t\ttotalFicaTax: usd(0),\n\t\t\t},\n\t\t}\n\t}\n\n\tconst w2 = Math.max(0, income.w2Wages ?? 0)\n\tconst ssWages = Math.min(w2, params.payroll.socialSecurityWageBase)\n\tconst ssTaxCents = Math.round(ssWages * params.payroll.ficaSocialSecurityRate * 100)\n\tconst medTaxCents = Math.round(w2 * params.payroll.ficaMedicareRate * 100)\n\n\tconst seSubject = calculateNetSelfEmploymentEarnings(\n\t\tincome.selfEmploymentNetEarnings,\n\t\tparams.payroll.seNetEarningsFactor,\n\t)\n\tconst combinedEarned = w2 + seSubject\n\tconst threshold = params.payroll.additionalMedicareThresholds[filingStatus]\n\tconst addMedSubject = Math.max(0, combinedEarned - threshold)\n\tconst addMedTaxCents = Math.round(addMedSubject * params.payroll.additionalMedicareRate * 100)\n\n\tconst totalCents = ssTaxCents + medTaxCents + addMedTaxCents\n\n\treturn {\n\t\ttotalFicaCents: totalCents,\n\t\tbreakdown: {\n\t\t\tenabled: true,\n\t\t\tsocialSecurityWages: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(ssWages, params.currency), params.currency),\n\t\t\t),\n\t\t\tsocialSecurityTax: usd(\n\t\t\t\tfromMinorUnits(ssTaxCents, params.currency, UsPayrollField.FicaSocialSecurity),\n\t\t\t),\n\t\t\tmedicareWages: usd(fromMinorUnits(toMinorUnits(w2, params.currency), params.currency)),\n\t\t\tmedicareTax: usd(fromMinorUnits(medTaxCents, params.currency, UsPayrollField.FicaMedicare)),\n\t\t\tadditionalMedicareSubject: usd(\n\t\t\t\tfromMinorUnits(toMinorUnits(addMedSubject, params.currency), params.currency),\n\t\t\t),\n\t\t\tadditionalMedicareTax: usd(\n\t\t\t\tfromMinorUnits(addMedTaxCents, params.currency, UsPayrollField.FicaAdditionalMedicare),\n\t\t\t),\n\t\t\ttotalFicaTax: usd(fromMinorUnits(totalCents, params.currency)),\n\t\t},\n\t}\n}\n","import { applyPercentage, fromMinorUnits, type Money, toMinorUnits, usd } from \"../../core/money\"\nimport type { US_2026_PARAMETERS } from \"../parameters\"\nimport type { UsFilingStatus, UsIncomeInput, UsNiitBreakdown, UsTaxInput } from \"../types\"\n\nexport interface UsNiitStageResult {\n\treadonly taxCents: number\n\treadonly tax: Money<\"USD\">\n\treadonly breakdown: UsNiitBreakdown\n}\n\nfunction resolveNiiCents(income: UsIncomeInput, override?: number): number {\n\tif (override !== undefined) {\n\t\treturn toMinorUnits(override, \"USD\", \"netInvestmentIncome\")\n\t}\n\treturn (\n\t\ttoMinorUnits(income.ordinaryInterest ?? 0, \"USD\", \"ordinaryInterest\") +\n\t\ttoMinorUnits(income.ordinaryDividends ?? 0, \"USD\", \"ordinaryDividends\") +\n\t\ttoMinorUnits(income.qualifiedDividends ?? 0, \"USD\", \"qualifiedDividends\") +\n\t\ttoMinorUnits(income.shortTermCapitalGains ?? 0, \"USD\", \"shortTermCapitalGains\") +\n\t\ttoMinorUnits(income.longTermCapitalGains ?? 0, \"USD\", \"longTermCapitalGains\") +\n\t\ttoMinorUnits(income.rentalAndOtherOrdinaryIncome ?? 0, \"USD\", \"rentalAndOtherOrdinaryIncome\")\n\t)\n}\n\n/**\n * Computes 3.8% Net Investment Income Tax (NIIT) on the lesser of NII or excess MAGI.\n *\n * @statute IRC § 1411\n */\nexport function calculateUsNiit(\n\tinput: UsTaxInput,\n\tagiCents: number,\n\tfilingStatus: UsFilingStatus,\n\tparams: typeof US_2026_PARAMETERS,\n): UsNiitStageResult {\n\tconst niiCents = resolveNiiCents(input.income, input.netInvestmentIncome)\n\tconst magiCents = input.magi !== undefined ? toMinorUnits(input.magi, \"USD\", \"magi\") : agiCents\n\n\tconst thresholdDollars = params.niit.thresholds[filingStatus]\n\tconst thresholdCents = toMinorUnits(thresholdDollars, \"USD\")\n\tconst excessMagiCents = Math.max(0, magiCents - thresholdCents)\n\n\tconst subjectCents = Math.min(niiCents, excessMagiCents)\n\tconst taxCents = applyPercentage(subjectCents, params.niit.rate)\n\n\treturn {\n\t\ttaxCents,\n\t\ttax: usd(fromMinorUnits(taxCents, \"USD\")),\n\t\tbreakdown: {\n\t\t\tnetInvestmentIncome: usd(fromMinorUnits(niiCents, \"USD\")),\n\t\t\tmagi: usd(fromMinorUnits(magiCents, \"USD\")),\n\t\t\tthreshold: usd(fromMinorUnits(thresholdCents, \"USD\")),\n\t\t\texcessMagi: usd(fromMinorUnits(excessMagiCents, \"USD\")),\n\t\t\tsubjectAmount: usd(fromMinorUnits(subjectCents, \"USD\")),\n\t\t\ttax: usd(fromMinorUnits(taxCents, \"USD\")),\n\t\t},\n\t}\n}\n","import type { TaxBracket } from \"../../core/brackets\"\nimport { applyPercentage, fromMinorUnits, type Money, usd } from \"../../core/money\"\nimport type { UsPreferentialSlice } from \"../types\"\n\nexport interface UsPreferentialStageResult {\n\treadonly preferentialTaxCents: number\n\treadonly preferentialTax: Money<\"USD\">\n\treadonly slices: readonly UsPreferentialSlice[]\n}\n\nfunction computePreferentialTier(\n\ttier: number,\n\tbracket: TaxBracket,\n\ttierLower: number,\n\tordinaryTaxableCents: number,\n\ttaxableIncomeCents: number,\n): { slice: UsPreferentialSlice; taxCents: number; tierUpper: number } {\n\tconst tierUpper = bracket.upTo ?? Number.POSITIVE_INFINITY\n\tconst overlapStart = Math.max(ordinaryTaxableCents, tierLower)\n\tconst overlapEnd = Math.min(taxableIncomeCents, tierUpper)\n\tconst taxableInTier = Math.max(0, overlapEnd - overlapStart)\n\tconst taxCents = taxableInTier > 0 ? applyPercentage(taxableInTier, bracket.rate) : 0\n\n\treturn {\n\t\tslice: {\n\t\t\ttier,\n\t\t\trate: bracket.rate,\n\t\t\ttaxableAmount: usd(fromMinorUnits(taxableInTier, \"USD\")),\n\t\t\ttax: usd(fromMinorUnits(taxCents, \"USD\")),\n\t\t},\n\t\ttaxCents,\n\t\ttierUpper,\n\t}\n}\n\n/**\n * Evaluates preferential stacking for Long-Term Capital Gains and Qualified Dividends.\n *\n * @statute IRC § 1(h)\n */\nexport function calculateUsPreferentialStacking(\n\tordinaryTaxableCents: number,\n\ttaxableIncomeCents: number,\n\tbrackets: readonly TaxBracket[],\n): UsPreferentialStageResult {\n\tlet totalTaxCents = 0\n\tlet tierLower = 0\n\tconst slices: UsPreferentialSlice[] = []\n\n\tfor (let i = 0; i < brackets.length; i++) {\n\t\tconst bracket = brackets[i]\n\t\tif (!bracket) continue\n\t\tconst result = computePreferentialTier(\n\t\t\ti,\n\t\t\tbracket,\n\t\t\ttierLower,\n\t\t\tordinaryTaxableCents,\n\t\t\ttaxableIncomeCents,\n\t\t)\n\t\tslices.push(result.slice)\n\t\ttotalTaxCents += result.taxCents\n\t\tif (bracket.upTo === null) break\n\t\ttierLower = result.tierUpper\n\t}\n\n\treturn {\n\t\tpreferentialTaxCents: totalTaxCents,\n\t\tpreferentialTax: usd(fromMinorUnits(totalTaxCents, \"USD\")),\n\t\tslices,\n\t}\n}\n","import type { BracketEvaluationResult } from \"../../core/brackets\"\nimport { fromMinorUnits, type Money, type TaxSupportedCurrency, usd } from \"../../core/money\"\nimport type { UsStateBreakdown } from \"../types\"\nimport { UsStateField } from \"../types/state-fields\"\nimport type { UsStateCreditsResult } from \"./credits\"\nimport type { UsStateDeductionsResult } from \"./deductions\"\nimport type { UsStateParameters } from \"./parameters/types\"\n\n/** Inputs required to assemble a state tax audit breakdown. */\nexport interface BuildUsStateBreakdownParams {\n\treadonly params: UsStateParameters\n\treadonly agiCents: number\n\treadonly deductions: UsStateDeductionsResult\n\treadonly evaluation: BracketEvaluationResult\n\treadonly surtaxCents: number\n\treadonly taxBeforeCreditsCents: number\n\treadonly credits: UsStateCreditsResult\n\treadonly effectiveRate: number\n\treadonly marginalRate: number\n\treadonly currency: TaxSupportedCurrency\n}\n\n/**\n * Converts integer cents to non-negative USD Money tagged with its diagnostic field.\n *\n * Units: Input is integer minor units; output is major-unit Money.\n * Throws: TaxValidationError if the amount is negative or not a safe integer.\n */\nfunction money(cents: number, currency: TaxSupportedCurrency, field: UsStateField): Money<\"USD\"> {\n\treturn usd(fromMinorUnits(cents, currency, field), field)\n}\n\n/**\n * Assembles the audit breakdown for one state individual income tax calculation.\n *\n * Purpose: Packages every deduction, exemption, bracket slice, surtax, credit, and withholding\n * figure so callers can audit the state liability.\n * Units: All monetary inputs are integer cents; outputs are major-unit Money.\n * Throws: TaxValidationError if any component amount is negative or not a safe integer\n * (net payable may be negative).\n *\n * @param p State calculation amounts and statutory parameters.\n * @returns Complete state tax audit breakdown.\n * @statute State individual income tax statutes; see per-state parameter tables.\n */\nexport function buildUsStateBreakdown(p: BuildUsStateBreakdownParams): UsStateBreakdown {\n\tconst { currency, deductions: d, credits: c } = p\n\treturn {\n\t\tcode: p.params.code,\n\t\tname: p.params.name,\n\t\ttype: p.params.type,\n\t\tagi: money(p.agiCents, currency, UsStateField.Agi),\n\t\tstandardDeduction: money(d.standardDeductionCents, currency, UsStateField.StandardDeduction),\n\t\tpersonalExemption: money(d.personalExemptionCents, currency, UsStateField.PersonalExemption),\n\t\tdependentExemption: money(d.dependentExemptionCents, currency, UsStateField.DependentExemption),\n\t\ttaxableIncome: money(d.taxableIncomeCents, currency, UsStateField.TaxableIncome),\n\t\tslices: p.evaluation.slices,\n\t\tbracketTax: money(p.evaluation.totalTax, currency, UsStateField.BracketTax),\n\t\tsurtax: money(p.surtaxCents, currency, UsStateField.Surtax),\n\t\ttaxBeforeCredits: money(p.taxBeforeCreditsCents, currency, UsStateField.TaxBeforeCredits),\n\t\tcredits: {\n\t\t\tpersonal: money(d.personalCreditCents, currency, UsStateField.CreditsPersonal),\n\t\t\tdependent: money(d.dependentCreditCents, currency, UsStateField.CreditsDependent),\n\t\t\tclaimedNonRefundable: money(\n\t\t\t\tc.claimedNonRefundableCents,\n\t\t\t\tcurrency,\n\t\t\t\tUsStateField.CreditsClaimedNonRefundable,\n\t\t\t),\n\t\t\tallowedNonRefundable: money(\n\t\t\t\tc.allowedNonRefundableCents,\n\t\t\t\tcurrency,\n\t\t\t\tUsStateField.CreditsNonRefundable,\n\t\t\t),\n\t\t\trefundable: money(c.refundableCents, currency, UsStateField.CreditsRefundable),\n\t\t},\n\t\ttotalTax: money(c.totalTaxCents, currency, UsStateField.TotalTax),\n\t\twithholding: money(c.withholdingCents, currency, UsStateField.Withholding),\n\t\tnetTaxPayable: usd(\n\t\t\tfromMinorUnits(c.netTaxCents, currency, UsStateField.NetTaxPayable, { allowNegative: true }),\n\t\t\tUsStateField.NetTaxPayable,\n\t\t\t{ allowNegative: true },\n\t\t),\n\t\teffectiveRate: p.effectiveRate,\n\t\tmarginalRate: p.marginalRate,\n\t}\n}\n","import { type TaxSupportedCurrency, toMinorUnits } from \"../../core/money\"\nimport type { UsStateCreditsInput } from \"../types\"\nimport { UsStateField } from \"../types/state-fields\"\n\n/** State credits, withholding, and net-tax amounts in integer cents. */\nexport interface UsStateCreditsResult {\n\treadonly claimedNonRefundableCents: number\n\treadonly allowedNonRefundableCents: number\n\treadonly totalTaxCents: number\n\treadonly refundableCents: number\n\treadonly withholdingCents: number\n\treadonly netTaxCents: number\n}\n\n/**\n * Applies state personal, dependent, and caller-supplied credits plus state withholding.\n *\n * Math: non-refundable credits are capped at tax before credits; refundable credits and\n * withholding reduce net tax payable (possibly below zero).\n * Units: All amounts are integer cents; caller credit and withholding inputs are major dollars.\n * Throws: TaxValidationError if a credit or withholding amount is negative or not representable\n * as safe integer cents.\n *\n * @param taxBeforeCreditsCents State bracket tax plus surtax in integer cents.\n * @param personalCreditCents State personal non-refundable credit in cents.\n * @param dependentCreditCents State dependent non-refundable credit in cents.\n * @param credits Caller-supplied state non-refundable and refundable credits.\n * @param withholding Caller-supplied state income tax withholding in major dollars.\n * @param currency Supported statutory currency threaded for minor-unit conversion.\n * @returns Allowed non-refundable credits, total state tax, refundable credits,\n * withholding, and net state tax payable in integer cents.\n * @statute State individual income tax statutes; see per-state parameter tables.\n */\nexport function calculateUsStateCredits(\n\ttaxBeforeCreditsCents: number,\n\tpersonalCreditCents: number,\n\tdependentCreditCents: number,\n\tcredits: UsStateCreditsInput | undefined,\n\twithholding: number | undefined,\n\tcurrency: TaxSupportedCurrency,\n): UsStateCreditsResult {\n\tconst claimedNonRefundableCents =\n\t\tpersonalCreditCents +\n\t\tdependentCreditCents +\n\t\ttoMinorUnits(credits?.nonRefundable ?? 0, currency, UsStateField.CreditsNonRefundable)\n\tconst allowedNonRefundableCents = Math.min(taxBeforeCreditsCents, claimedNonRefundableCents)\n\tconst totalTaxCents = taxBeforeCreditsCents - allowedNonRefundableCents\n\tconst refundableCents = toMinorUnits(\n\t\tcredits?.refundable ?? 0,\n\t\tcurrency,\n\t\tUsStateField.CreditsRefundable,\n\t)\n\tconst withholdingCents = toMinorUnits(withholding ?? 0, currency, UsStateField.Withholding)\n\tconst netTaxCents = totalTaxCents - refundableCents - withholdingCents\n\treturn {\n\t\tclaimedNonRefundableCents,\n\t\tallowedNonRefundableCents,\n\t\ttotalTaxCents,\n\t\trefundableCents,\n\t\twithholdingCents,\n\t\tnetTaxCents,\n\t}\n}\n","import { applyPercentage, type TaxSupportedCurrency, toMinorUnits } from \"../../core/money\"\nimport type { UsFilingStatus } from \"../types\"\nimport { UsStateField } from \"../types/state-fields\"\nimport type {\n\tUsStateLinearPhaseOut,\n\tUsStatePerStatus,\n\tUsStatePhaseOut,\n\tUsStateSteppedPhaseOut,\n\tUsStateTieredPhaseOut,\n} from \"./parameters/phase-out-types\"\n\nfunction cents(\n\tamounts: UsStatePerStatus,\n\tstatus: UsFilingStatus,\n\tcurrency: TaxSupportedCurrency,\n): number {\n\treturn toMinorUnits(amounts[status], currency, UsStateField.PhaseOutThreshold)\n}\n\nfunction linearReduction(\n\tamountCents: number,\n\texcessCents: number,\n\trule: UsStateLinearPhaseOut,\n\tstatus: UsFilingStatus,\n\tcurrency: TaxSupportedCurrency,\n): number {\n\tconst widthCents = cents(rule.width, status, currency)\n\tif (excessCents >= widthCents) return amountCents\n\treturn Math.round((amountCents * excessCents) / widthCents)\n}\n\nfunction steppedReduction(\n\tamountCents: number,\n\texcessCents: number,\n\trule: UsStateSteppedPhaseOut,\n\tstatus: UsFilingStatus,\n\tcurrency: TaxSupportedCurrency,\n): number {\n\tconst steps = Math.ceil(excessCents / cents(rule.step, status, currency))\n\treturn applyPercentage(amountCents, Math.min(1, steps * rule.ratePerStep))\n}\n\nfunction tieredReduction(\n\tamountCents: number,\n\tagiCents: number,\n\trule: UsStateTieredPhaseOut,\n\tstatus: UsFilingStatus,\n\tcurrency: TaxSupportedCurrency,\n): number {\n\tconst startCents = cents(rule.start, status, currency)\n\tconst secondCents = cents(rule.second, status, currency)\n\tconst lower = applyPercentage(Math.min(agiCents, secondCents) - startCents, rule.rate)\n\tconst upper = applyPercentage(Math.max(0, agiCents - secondCents), rule.secondRate)\n\treturn Math.min(lower + upper, applyPercentage(amountCents, rule.maxShare))\n}\n\n/**\n * Applies a statutory income-based phase-out to a deduction or exemption.\n *\n * Math: linear removes amount x (AGI - start) / width; stepped removes ratePerStep of the\n * amount for each step or fraction above start (capped at 100%); tiered removes\n * rate x (AGI up to second - start) + secondRate x (AGI - second), capped at maxShare of the\n * amount. Nothing is removed at or below the start threshold.\n * Units: AGI and amounts are integer cents; thresholds are major dollars converted to cents.\n * Throws: TaxValidationError if a threshold cannot be represented as safe integer cents.\n *\n * @param amountCents Deduction or exemption before the phase-out, in integer cents.\n * @param agiCents Federal adjusted gross income in integer cents.\n * @param status Filing status selecting the thresholds.\n * @param phaseOut Optional statutory phase-out rule.\n * @param currency Supported statutory currency threaded for minor-unit conversion.\n * @returns The amount still allowed after the phase-out, in integer cents.\n * @statute 36 M.R.S. § 5124-C(2); Minn. Stat. §§ 290.0121 subd. 2, 290.0123 subd. 5.\n */\nexport function applyUsStatePhaseOut(\n\tamountCents: number,\n\tagiCents: number,\n\tstatus: UsFilingStatus,\n\tphaseOut: UsStatePhaseOut | undefined,\n\tcurrency: TaxSupportedCurrency,\n): number {\n\tif (!phaseOut) return amountCents\n\tconst excessCents = agiCents - cents(phaseOut.start, status, currency)\n\tif (excessCents <= 0) return amountCents\n\tif (phaseOut.kind === \"tiered\") {\n\t\treturn amountCents - tieredReduction(amountCents, agiCents, phaseOut, status, currency)\n\t}\n\tconst reduction =\n\t\tphaseOut.kind === \"linear\"\n\t\t\t? linearReduction(amountCents, excessCents, phaseOut, status, currency)\n\t\t\t: steppedReduction(amountCents, excessCents, phaseOut, status, currency)\n\treturn amountCents - reduction\n}\n","import { multiplySafeInteger, type TaxSupportedCurrency, toMinorUnits } from \"../../core/money\"\nimport type { UsFilingStatus } from \"../types\"\nimport { UsStateField } from \"../types/state-fields\"\nimport type { UsStateParameters } from \"./parameters/types\"\nimport { applyUsStatePhaseOut } from \"./phase-out\"\n\n/** Resolved state standard deduction, exemptions, and personal/dependent credits in cents. */\nexport interface UsStateDeductionsResult {\n\treadonly standardDeductionCents: number\n\treadonly personalExemptionCents: number\n\treadonly dependentExemptionCents: number\n\treadonly personalCreditCents: number\n\treadonly dependentCreditCents: number\n\treadonly taxableIncomeCents: number\n}\n\n/**\n * Resolves state standard deductions, personal/dependent exemptions, and credits.\n *\n * Math: taxable = max(0, AGI - standard deduction - personal exemption - dependent exemptions),\n * where the standard deduction and dependent exemptions first pass any statutory phase-out.\n * Units: AGI is integer cents; parameter amounts are major dollars converted to integer cents.\n * Throws: TaxValidationError if a parameter amount or the dependent product is not a safe\n * integer number of cents.\n *\n * @param agiCents Federal adjusted gross income in integer cents.\n * @param status Filing status.\n * @param dependents Validated non-negative dependent count.\n * @param params State statutory parameter table.\n * @param currency Supported statutory currency threaded for minor-unit conversion.\n * @returns Resolved deduction, exemption, credit, and taxable-income amounts.\n * @statute State individual income tax statutes; see per-state parameter tables.\n */\nexport function calculateUsStateDeductions(\n\tagiCents: number,\n\tstatus: UsFilingStatus,\n\tdependents: number,\n\tparams: UsStateParameters,\n\tcurrency: TaxSupportedCurrency,\n): UsStateDeductionsResult {\n\tconst standardDeductionCents = applyUsStatePhaseOut(\n\t\ttoMinorUnits(params.standardDeduction[status], currency, UsStateField.StandardDeduction),\n\t\tagiCents,\n\t\tstatus,\n\t\tparams.standardDeductionPhaseOut,\n\t\tcurrency,\n\t)\n\tconst personalExemptionCents = toMinorUnits(\n\t\tparams.personalExemption[status],\n\t\tcurrency,\n\t\tUsStateField.PersonalExemption,\n\t)\n\tconst dependentExemptionCents = applyUsStatePhaseOut(\n\t\tmultiplySafeInteger(\n\t\t\ttoMinorUnits(params.dependentExemption, currency, UsStateField.DependentExemption),\n\t\t\tdependents,\n\t\t\tUsStateField.DependentExemption,\n\t\t),\n\t\tagiCents,\n\t\tstatus,\n\t\tparams.dependentExemptionPhaseOut,\n\t\tcurrency,\n\t)\n\tconst personalCreditCents = toMinorUnits(\n\t\tparams.personalCredit[status],\n\t\tcurrency,\n\t\tUsStateField.CreditsPersonal,\n\t)\n\tconst dependentCreditCents = multiplySafeInteger(\n\t\ttoMinorUnits(params.dependentCredit, currency, UsStateField.CreditsDependent),\n\t\tdependents,\n\t\tUsStateField.CreditsDependent,\n\t)\n\tconst taxableIncomeCents = Math.max(\n\t\t0,\n\t\tagiCents - standardDeductionCents - personalExemptionCents - dependentExemptionCents,\n\t)\n\n\treturn {\n\t\tstandardDeductionCents,\n\t\tpersonalExemptionCents,\n\t\tdependentExemptionCents,\n\t\tpersonalCreditCents,\n\t\tdependentCreditCents,\n\t\ttaxableIncomeCents,\n\t}\n}\n","import { applyPercentage, type TaxSupportedCurrency, toMinorUnits } from \"../../core/money\"\nimport type { UsFilingStatus } from \"../types\"\nimport { UsStateField } from \"../types/state-fields\"\nimport type { UsStateSurtax } from \"./parameters/types\"\n\n/** Computed state surtax amount and whether the taxpayer is inside the surtax band. */\nexport interface UsStateSurtaxResult {\n\treadonly taxCents: number\n\treadonly rate: number\n\treadonly active: boolean\n}\n\n/**\n * Computes a state high-income or millionaire surtax above a taxable-income threshold.\n *\n * Math: surtax = rate * max(0, taxable income - threshold); active when taxable income\n * reaches the threshold. A per-status threshold is looked up by filing status.\n * Units: Taxable income and result are integer cents; threshold is major dollars.\n * Throws: TaxValidationError if the threshold or rate cannot be converted or is invalid.\n *\n * @param taxableIncomeCents State taxable income in integer cents.\n * @param surtax Optional statutory surtax threshold and rate.\n * @param status Filing status, used when the threshold varies by status.\n * @param currency Supported statutory currency threaded for minor-unit conversion.\n * @returns Surtax amount in cents, statutory rate, and whether it applies.\n */\nexport function calculateUsStateSurtax(\n\ttaxableIncomeCents: number,\n\tsurtax: UsStateSurtax | undefined,\n\tstatus: UsFilingStatus,\n\tcurrency: TaxSupportedCurrency,\n): UsStateSurtaxResult {\n\tif (!surtax) return { taxCents: 0, rate: 0, active: false }\n\tconst threshold =\n\t\ttypeof surtax.threshold === \"number\" ? surtax.threshold : surtax.threshold[status]\n\tconst thresholdCents = toMinorUnits(threshold, currency, UsStateField.SurtaxThreshold)\n\tconst baseCents = Math.max(0, taxableIncomeCents - thresholdCents)\n\treturn {\n\t\ttaxCents: applyPercentage(baseCents, surtax.rate),\n\t\trate: surtax.rate,\n\t\tactive: taxableIncomeCents >= thresholdCents,\n\t}\n}\n","import { evaluateBrackets } from \"../../core/brackets\"\nimport type { TaxSupportedCurrency } from \"../../core/money\"\nimport { buildUsStateBreakdown } from \"../state/breakdown\"\nimport { calculateUsStateCredits } from \"../state/credits\"\nimport { calculateUsStateDeductions } from \"../state/deductions\"\nimport { US_2026_STATE_PARAMETERS } from \"../state/parameters\"\nimport { calculateUsStateSurtax } from \"../state/surtax\"\nimport type { UsFilingStatus, UsStateBreakdown, UsTaxInput } from \"../types\"\nimport { UsStateField } from \"../types/state-fields\"\n\n/** State income tax amounts in integer cents plus the audit breakdown. */\nexport interface UsStateResult {\n\treadonly totalTaxCents: number\n\treadonly netTaxCents: number\n\treadonly breakdown: UsStateBreakdown | undefined\n}\n\nconst EMPTY_RESULT: UsStateResult = {\n\ttotalTaxCents: 0,\n\tnetTaxCents: 0,\n\tbreakdown: undefined,\n}\n\n/**\n * Computes 2026 state individual income tax from federal AGI, state deductions,\n * personal/dependent exemptions and credits, state surtaxes, and state withholding.\n *\n * Math: state taxable income = max(0, AGI - state standard deduction - exemptions);\n * tax = progressive bracket tax + surtax - non-refundable credits.\n * Units: AGI and all outputs are integer cents; parameter amounts are major dollars.\n *\n * @param input Complete US tax input including optional state code and state credits.\n * @param agiCents Federal adjusted gross income in integer cents.\n * @param filingStatus Federal and state filing status.\n * @param currency Supported statutory currency threaded for minor-unit conversion.\n * @returns State tax, refundable credits, withholding, net payable, and audit breakdown.\n * @statute State individual income tax statutes; see per-state parameter tables.\n */\nexport function calculateUsStateTax(\n\tinput: UsTaxInput,\n\tagiCents: number,\n\tfilingStatus: UsFilingStatus,\n\tcurrency: TaxSupportedCurrency,\n): UsStateResult {\n\tif (input.state === undefined) return EMPTY_RESULT\n\n\tconst params = US_2026_STATE_PARAMETERS[input.state]\n\tconst deductions = calculateUsStateDeductions(\n\t\tagiCents,\n\t\tfilingStatus,\n\t\tinput.stateDependents ?? 0,\n\t\tparams,\n\t\tcurrency,\n\t)\n\tconst evaluation = evaluateBrackets(\n\t\tdeductions.taxableIncomeCents,\n\t\tparams.brackets[filingStatus],\n\t\tundefined,\n\t\tUsStateField.TaxableIncome,\n\t)\n\tconst surtax = calculateUsStateSurtax(\n\t\tdeductions.taxableIncomeCents,\n\t\tparams.surtax,\n\t\tfilingStatus,\n\t\tcurrency,\n\t)\n\tconst taxBeforeCreditsCents = evaluation.totalTax + surtax.taxCents\n\tconst credits = calculateUsStateCredits(\n\t\ttaxBeforeCreditsCents,\n\t\tdeductions.personalCreditCents,\n\t\tdeductions.dependentCreditCents,\n\t\tinput.stateCredits,\n\t\tinput.stateWithholding,\n\t\tcurrency,\n\t)\n\tconst effectiveRate = agiCents > 0 ? credits.totalTaxCents / agiCents : 0\n\tconst marginalRate = surtax.active\n\t\t? evaluation.marginalRate + surtax.rate\n\t\t: evaluation.marginalRate\n\n\treturn {\n\t\ttotalTaxCents: credits.totalTaxCents,\n\t\tnetTaxCents: credits.netTaxCents,\n\t\tbreakdown: buildUsStateBreakdown({\n\t\t\tparams,\n\t\t\tagiCents,\n\t\t\tdeductions,\n\t\t\tevaluation,\n\t\t\tsurtaxCents: surtax.taxCents,\n\t\t\ttaxBeforeCreditsCents,\n\t\t\tcredits,\n\t\t\teffectiveRate,\n\t\t\tmarginalRate,\n\t\t\tcurrency,\n\t\t}),\n\t}\n}\n","import type { BracketSlice } from \"../../core/brackets\"\nimport type { Money } from \"../../core/money\"\n\nconst STATE_CODES = [\n\t\"AL\",\n\t\"AK\",\n\t\"AZ\",\n\t\"AR\",\n\t\"CA\",\n\t\"CO\",\n\t\"CT\",\n\t\"DE\",\n\t\"DC\",\n\t\"FL\",\n\t\"GA\",\n\t\"HI\",\n\t\"ID\",\n\t\"IL\",\n\t\"IN\",\n\t\"IA\",\n\t\"KS\",\n\t\"KY\",\n\t\"LA\",\n\t\"ME\",\n\t\"MD\",\n\t\"MA\",\n\t\"MI\",\n\t\"MN\",\n\t\"MS\",\n\t\"MO\",\n\t\"MT\",\n\t\"NE\",\n\t\"NV\",\n\t\"NH\",\n\t\"NJ\",\n\t\"NM\",\n\t\"NY\",\n\t\"NC\",\n\t\"ND\",\n\t\"OH\",\n\t\"OK\",\n\t\"OR\",\n\t\"PA\",\n\t\"RI\",\n\t\"SC\",\n\t\"SD\",\n\t\"TN\",\n\t\"TX\",\n\t\"UT\",\n\t\"VT\",\n\t\"VA\",\n\t\"WA\",\n\t\"WV\",\n\t\"WI\",\n\t\"WY\",\n] as const\n\n/** ISO 3166-2 state code for all 50 US states plus the District of Columbia. */\nexport type UsStateCode = (typeof STATE_CODES)[number]\n\n/** Read-only runtime registry of every supported US state code. */\nexport const US_STATE_CODES: readonly UsStateCode[] = STATE_CODES\n\n/** Statutory structure of a state individual income tax schedule. */\nexport type UsStateTaxType = \"none\" | \"flat\" | \"progressive\"\n\n/** Caller-supplied state non-refundable and refundable credits in major dollars. */\nexport interface UsStateCreditsInput {\n\treadonly nonRefundable?: number\n\treadonly refundable?: number\n}\n\n/** Audit trail for state personal, dependent, and caller-supplied credits. */\nexport interface UsStateCreditsBreakdown {\n\treadonly personal: Money<\"USD\">\n\treadonly dependent: Money<\"USD\">\n\treadonly claimedNonRefundable: Money<\"USD\">\n\treadonly allowedNonRefundable: Money<\"USD\">\n\treadonly refundable: Money<\"USD\">\n}\n\n/** Detailed audit trail for a state individual income tax calculation. */\nexport interface UsStateBreakdown {\n\treadonly code: UsStateCode\n\treadonly name: string\n\treadonly type: UsStateTaxType\n\treadonly agi: Money<\"USD\">\n\treadonly standardDeduction: Money<\"USD\">\n\treadonly personalExemption: Money<\"USD\">\n\treadonly dependentExemption: Money<\"USD\">\n\treadonly taxableIncome: Money<\"USD\">\n\treadonly slices: readonly BracketSlice[]\n\treadonly bracketTax: Money<\"USD\">\n\treadonly surtax: Money<\"USD\">\n\treadonly taxBeforeCredits: Money<\"USD\">\n\treadonly credits: UsStateCreditsBreakdown\n\treadonly totalTax: Money<\"USD\">\n\treadonly withholding: Money<\"USD\">\n\treadonly netTaxPayable: Money<\"USD\">\n\treadonly effectiveRate: number\n\treadonly marginalRate: number\n}\n","import { TaxValidationError } from \"../core/money\"\nimport type { UsFilingStatus, UsStateCreditsInput, UsTaxInput } from \"./types\"\nimport { US_STATE_CODES } from \"./types\"\n\nconst VALID_STATUSES: readonly UsFilingStatus[] = [\n\t\"single\",\n\t\"married_filing_jointly\",\n\t\"married_filing_separately\",\n\t\"head_of_household\",\n]\n\nfunction checkFiniteNumber(field: string, val: number | undefined): void {\n\tif (val === undefined) return\n\tif (typeof val !== \"number\" || !Number.isFinite(val)) {\n\t\tthrow new TaxValidationError(field, val, \"Must be a finite number\")\n\t}\n}\n\nfunction checkNonNegative(field: string, val: number | undefined): void {\n\tif (val === undefined) return\n\tif (typeof val !== \"number\" || !Number.isFinite(val) || val < 0) {\n\t\tthrow new TaxValidationError(field, val, \"Must be a non-negative finite number\")\n\t}\n}\n\nfunction checkNonNegativeInt(field: string, val: number | undefined): void {\n\tif (val === undefined) return\n\tif (typeof val !== \"number\" || !Number.isSafeInteger(val) || val < 0) {\n\t\tthrow new TaxValidationError(field, val, \"Must be a non-negative integer\")\n\t}\n}\n\nfunction validateNoOrphanStateInputs(input: UsTaxInput): void {\n\tconst orphan = [\n\t\t[\"stateDependents\", input.stateDependents],\n\t\t[\"stateWithholding\", input.stateWithholding],\n\t\t[\"stateCredits\", input.stateCredits],\n\t].find(([, value]) => value !== undefined)\n\tif (orphan) {\n\t\tthrow new TaxValidationError(String(orphan[0]), orphan[1], \"Requires a `state` code\")\n\t}\n}\n\nfunction validateStateCreditsInput(credits: UsStateCreditsInput | undefined): void {\n\tif (!credits) return\n\tcheckNonNegative(\"stateCredits.nonRefundable\", credits.nonRefundable)\n\tcheckNonNegative(\"stateCredits.refundable\", credits.refundable)\n}\n\nfunction validateCreditsInput(credits: UsTaxInput[\"credits\"]): void {\n\tif (!credits) return\n\tcheckNonNegativeInt(\n\t\t\"qualifyingChildrenForChildTaxCredit\",\n\t\tcredits.qualifyingChildrenForChildTaxCredit,\n\t)\n\tcheckNonNegativeInt(\"otherDependents\", credits.otherDependents)\n\tcheckNonNegativeInt(\"eitcQualifyingChildren\", credits.eitcQualifyingChildren)\n\tcheckNonNegative(\"eitcInvestmentIncome\", credits.eitcInvestmentIncome)\n\tcheckNonNegativeInt(\"qualifyingIndividualsForCare\", credits.qualifyingIndividualsForCare)\n\tcheckNonNegative(\"childAndDependentCareExpenses\", credits.childAndDependentCareExpenses)\n\tcheckNonNegative(\"foreignTaxCredit\", credits.foreignTaxCredit)\n\tcheckNonNegative(\"customNonRefundableCredits\", credits.customNonRefundableCredits)\n\tcheckNonNegative(\"customRefundableCredits\", credits.customRefundableCredits)\n\tfor (const student of credits.educationStudents ?? []) {\n\t\tif (!student) {\n\t\t\tthrow new TaxValidationError(\"educationStudents\", student, \"Invalid student entry\")\n\t\t}\n\t\tcheckNonNegative(\"educationStudent.qualifiedExpenses\", student.qualifiedExpenses)\n\t}\n}\n\n/**\n * Validates statutory US tax input parameters against bounds and types.\n */\nexport function validateUsInput(input: UsTaxInput): void {\n\tif (input.taxYear !== undefined && input.taxYear !== 2026) {\n\t\tthrow new TaxValidationError(\n\t\t\t\"taxYear\",\n\t\t\tinput.taxYear,\n\t\t\t\"Unsupported tax year; currently only 2026 is supported\",\n\t\t)\n\t}\n\tif (!VALID_STATUSES.includes(input.filingStatus)) {\n\t\tthrow new TaxValidationError(\"filingStatus\", input.filingStatus, \"Invalid filing status\")\n\t}\n\tcheckNonNegative(\"withholding\", input.withholding)\n\tcheckNonNegative(\"amtPreferences\", input.amtPreferences)\n\tcheckNonNegative(\"income.w2Wages\", input.income.w2Wages)\n\t// Self-employment may be negative for Schedule C net business losses\n\tcheckFiniteNumber(\"income.selfEmploymentNetEarnings\", input.income.selfEmploymentNetEarnings)\n\tif (input.state !== undefined && !US_STATE_CODES.includes(input.state)) {\n\t\tthrow new TaxValidationError(\"state\", input.state, \"Unsupported US state code\")\n\t}\n\tif (input.state === undefined) validateNoOrphanStateInputs(input)\n\tcheckNonNegativeInt(\"stateDependents\", input.stateDependents)\n\tcheckNonNegative(\"stateWithholding\", input.stateWithholding)\n\tvalidateStateCreditsInput(input.stateCredits)\n\tvalidateCreditsInput(input.credits)\n}\n","import { evaluateBrackets } from \"../core/brackets\"\nimport { toMinorUnits } from \"../core/money\"\nimport type { TaxResult } from \"../core/system\"\nimport { buildUsTaxResult } from \"./calculate-result\"\nimport { US_2026_PARAMETERS } from \"./parameters\"\nimport { calculateUsAgi } from \"./stages/agi\"\nimport { calculateUsAmt, resolveAmtSaltCents } from \"./stages/amt\"\nimport { calculateUsCredits } from \"./stages/credits\"\nimport { calculateUsDeductions } from \"./stages/deductions\"\nimport { calculateUsFica } from \"./stages/fica\"\nimport { calculateUsNiit } from \"./stages/niit\"\nimport { calculateUsPreferentialStacking } from \"./stages/preferential\"\nimport { calculateUsScheduleSe } from \"./stages/se\"\nimport { calculateUsStateTax } from \"./stages/state\"\nimport type { UsTaxBreakdown, UsTaxInput } from \"./types\"\nimport { validateUsInput } from \"./validate\"\n\n/**\n * Executes the 2026 US federal, payroll, and optional state income tax pipeline.\n *\n * Purpose: Chains federal AGI, deductions, brackets, AMT, NIIT, payroll, credits, and the\n * state stage into one result.\n * Units: Inputs and outputs are major USD; internal arithmetic uses integer cents.\n * Throws: TaxValidationError if any input is invalid.\n *\n * @statute IRC § 1 et seq.; state individual income tax statutes.\n */\nexport function executeUsTaxCalculation(input: UsTaxInput): TaxResult<\"USD\", UsTaxBreakdown> {\n\tvalidateUsInput(input)\n\tconst seRes = calculateUsScheduleSe(input.income, US_2026_PARAMETERS)\n\tconst seTax = input.adjustments?.deductibleSelfEmploymentTax ?? seRes.deductiblePortionDollars\n\tconst adjustments = { ...input.adjustments, deductibleSelfEmploymentTax: seTax }\n\n\tconst agiRes = calculateUsAgi(input.income, adjustments, input.filingStatus, US_2026_PARAMETERS)\n\tconst stateRes = calculateUsStateTax(\n\t\tinput,\n\t\tagiRes.agiCents,\n\t\tinput.filingStatus,\n\t\tUS_2026_PARAMETERS.currency,\n\t)\n\tconst dedRes = calculateUsDeductions(\n\t\tinput,\n\t\tagiRes.agiCents,\n\t\tagiRes.preferentialGrossCents,\n\t\tinput.filingStatus,\n\t\tUS_2026_PARAMETERS,\n\t)\n\tconst ordRes = evaluateBrackets(\n\t\tdedRes.ordinaryTaxableCents,\n\t\tUS_2026_PARAMETERS.ordinaryBrackets[input.filingStatus],\n\t\tMath.max(0, agiRes.grossIncomeCents),\n\t\t\"ordinaryTaxableIncome\",\n\t)\n\tconst prefRes = calculateUsPreferentialStacking(\n\t\tdedRes.ordinaryTaxableCents,\n\t\tdedRes.taxableIncomeCents,\n\t\tUS_2026_PARAMETERS.preferentialBrackets[input.filingStatus],\n\t)\n\tconst regularTaxCents = ordRes.totalTax + prefRes.preferentialTaxCents\n\n\tconst saltCents = resolveAmtSaltCents(dedRes, US_2026_PARAMETERS.currency)\n\tconst amtRes = calculateUsAmt(\n\t\tdedRes.taxableIncomeCents,\n\t\tsaltCents,\n\t\tinput.amtPreferences,\n\t\tregularTaxCents,\n\t\tinput.filingStatus,\n\t\tUS_2026_PARAMETERS,\n\t)\n\tconst niitRes = calculateUsNiit(input, agiRes.agiCents, input.filingStatus, US_2026_PARAMETERS)\n\tconst ficaRes = calculateUsFica(\n\t\tinput.income,\n\t\tinput.filingStatus,\n\t\tinput.includeFica ?? true,\n\t\tUS_2026_PARAMETERS,\n\t)\n\n\tconst creditsRes = calculateUsCredits(\n\t\tinput,\n\t\tagiRes.agiCents,\n\t\tregularTaxCents + amtRes.amtTaxCents,\n\t\tUS_2026_PARAMETERS,\n\t)\n\tconst taxAfterNonRefCents =\n\t\tregularTaxCents + amtRes.amtTaxCents - creditsRes.allowedNonRefundableCents\n\tconst federalTaxCents =\n\t\ttaxAfterNonRefCents + niitRes.taxCents + ficaRes.totalFicaCents + seRes.totalSeTaxCents\n\tconst totalTaxCents = federalTaxCents + stateRes.totalTaxCents\n\tconst withhCents = toMinorUnits(\n\t\tinput.withholding ?? 0,\n\t\tUS_2026_PARAMETERS.currency,\n\t\t\"withholding\",\n\t)\n\tconst federalNetCents = federalTaxCents - creditsRes.totalRefundableCents - withhCents\n\tconst netTaxCents = federalNetCents + stateRes.netTaxCents\n\n\treturn buildUsTaxResult({\n\t\tagiRes,\n\t\tdedRes,\n\t\tordTaxCents: ordRes.totalTax,\n\t\tordMarginalRate: ordRes.marginalRate,\n\t\tordSlices: ordRes.slices,\n\t\tprefRes,\n\t\tregularTaxCents,\n\t\tamtRes,\n\t\tniitRes,\n\t\tficaRes,\n\t\tseRes,\n\t\tcreditsRes,\n\t\tstateRes,\n\t\ttotalTaxCents,\n\t\twithhCents,\n\t\tnetTaxCents,\n\t})\n}\n","import type { TaxResult, TaxSystem } from \"../core/system\"\nimport { executeUsTaxCalculation } from \"./calculate\"\nimport type { UsTaxBreakdown, UsTaxInput } from \"./types\"\n\n/**\n * US Federal and state Individual Income Tax System implementation for 2026.\n *\n * @statute IRC § 1 et seq.; state individual income tax statutes for Tax Year 2026.\n */\nexport const us: TaxSystem<UsTaxInput, \"USD\", UsTaxBreakdown> = {\n\tjurisdiction: \"US\",\n\ttaxYear: 2026,\n\tcurrency: \"USD\",\n\tcalculate(input: UsTaxInput): TaxResult<\"USD\", UsTaxBreakdown> {\n\t\treturn executeUsTaxCalculation(input)\n\t},\n}\n\n/**\n * Calculates 2026 US federal and optional state Individual Income Tax for the specified input.\n *\n * @statute IRC § 1 et seq.; state individual income tax statutes for Tax Year 2026.\n */\nexport function calculateUsTax(input: UsTaxInput): TaxResult<\"USD\", UsTaxBreakdown> {\n\treturn us.calculate(input)\n}\n"],"mappings":";;;;;;;;AAgBA,MAAa,cAA+B;CAC3C,gBAAgB;EACf,QAAQ;EACR,wBAAwB;EACxB,2BAA2B;EAC3B,mBAAmB;CACpB;CACA,oBAAoB;EACnB,QAAQ;EACR,wBAAwB;EACxB,2BAA2B;EAC3B,mBAAmB;CACpB;CACA,cAAc;CACd,kBAAkB;EACjB,QAAQ;EACR,wBAAwB;EACxB,2BAA2B;EAC3B,mBAAmB;CACpB;CACA,QAAQ;CACR,QAAQ;AACT;;;;;;;AC9BA,MAAa,4BAA2E;CACvF,QAAQ;EACP;GAAE,MAAM;GAAW,MAAM;EAAI;EAC7B;GAAE,MAAM;GAAW,MAAM;EAAK;EAC9B;GAAE,MAAM;GAAY,MAAM;EAAK;EAC/B;GAAE,MAAM;GAAY,MAAM;EAAK;EAC/B;GAAE,MAAM;GAAY,MAAM;EAAK;EAC/B;GAAE,MAAM;GAAY,MAAM;EAAK;EAC/B;GAAE,MAAM;GAAM,MAAM;EAAK;CAC1B;CACA,wBAAwB;EACvB;GAAE,MAAM;GAAW,MAAM;EAAI;EAC7B;GAAE,MAAM;GAAY,MAAM;EAAK;EAC/B;GAAE,MAAM;GAAY,MAAM;EAAK;EAC/B;GAAE,MAAM;GAAY,M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