policyengine-household-wizard 0.1.0 → 0.3.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.
Files changed (106) hide show
  1. package/README.md +50 -5
  2. package/dist/WizardReviewList-DhLx8Bla.cjs +1 -0
  3. package/dist/WizardReviewList-oY1HqmLw.js +354 -0
  4. package/dist/index-B_OXaS4a.cjs +1 -0
  5. package/dist/index-CIL8FXNR.cjs +1 -0
  6. package/dist/index-DWM0giHt.js +220 -0
  7. package/dist/index-fgLnXugs.js +225 -0
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +34 -28
  11. package/dist/primitives/WizardReviewList.d.ts +3 -2
  12. package/dist/primitives/WizardReviewList.d.ts.map +1 -1
  13. package/dist/primitives/index.d.ts +12 -10
  14. package/dist/primitives/index.d.ts.map +1 -1
  15. package/dist/primitives/types.d.ts +18 -0
  16. package/dist/primitives/types.d.ts.map +1 -1
  17. package/dist/primitives/useWizardStepFocus.d.ts +13 -0
  18. package/dist/primitives/useWizardStepFocus.d.ts.map +1 -0
  19. package/dist/primitives/useWizardSteps.d.ts +2 -2
  20. package/dist/primitives/useWizardSteps.d.ts.map +1 -1
  21. package/dist/primitives.cjs +1 -1
  22. package/dist/primitives.d.ts +1 -1
  23. package/dist/primitives.js +5 -4
  24. package/dist/uk-household/adapters/householdImpactRequest.d.ts +91 -0
  25. package/dist/uk-household/adapters/householdImpactRequest.d.ts.map +1 -0
  26. package/dist/uk-household/adapters/index.d.ts +2 -0
  27. package/dist/uk-household/adapters/index.d.ts.map +1 -0
  28. package/dist/uk-household/children.d.ts +18 -0
  29. package/dist/uk-household/children.d.ts.map +1 -0
  30. package/dist/uk-household/codes.d.ts +22 -0
  31. package/dist/uk-household/codes.d.ts.map +1 -0
  32. package/dist/uk-household/defaults.d.ts +56 -0
  33. package/dist/uk-household/defaults.d.ts.map +1 -0
  34. package/dist/uk-household/draft.d.ts +37 -0
  35. package/dist/uk-household/draft.d.ts.map +1 -0
  36. package/dist/uk-household/index.d.ts +10 -0
  37. package/dist/uk-household/index.d.ts.map +1 -0
  38. package/dist/uk-household/serialize.d.ts +4 -0
  39. package/dist/uk-household/serialize.d.ts.map +1 -0
  40. package/dist/uk-household/statePension.d.ts +42 -0
  41. package/dist/uk-household/statePension.d.ts.map +1 -0
  42. package/dist/uk-household/types.d.ts +134 -0
  43. package/dist/uk-household/types.d.ts.map +1 -0
  44. package/dist/uk-household/validate.d.ts +59 -0
  45. package/dist/uk-household/validate.d.ts.map +1 -0
  46. package/dist/uk-household-adapters.cjs +1 -0
  47. package/dist/uk-household-adapters.d.ts +1 -0
  48. package/dist/uk-household-adapters.js +5 -0
  49. package/dist/uk-household.cjs +1 -0
  50. package/dist/uk-household.d.ts +1 -0
  51. package/dist/uk-household.js +220 -0
  52. package/dist/us-household/adapters/index.d.ts +1 -1
  53. package/dist/us-household/adapters/v1Payload.d.ts +119 -3
  54. package/dist/us-household/adapters/v1Payload.d.ts.map +1 -1
  55. package/dist/us-household/amount.d.ts +8 -0
  56. package/dist/us-household/amount.d.ts.map +1 -0
  57. package/dist/us-household/draft.d.ts +1 -1
  58. package/dist/us-household/index.d.ts +9 -8
  59. package/dist/us-household/index.d.ts.map +1 -1
  60. package/dist/us-household/normalize.d.ts +1 -1
  61. package/dist/us-household/normalize.d.ts.map +1 -1
  62. package/dist/us-household/serialize.d.ts +1 -1
  63. package/dist/us-household/serialize.d.ts.map +1 -1
  64. package/dist/us-household/tippedOccupations.d.ts +40 -0
  65. package/dist/us-household/tippedOccupations.d.ts.map +1 -0
  66. package/dist/us-household/types.d.ts +138 -18
  67. package/dist/us-household/types.d.ts.map +1 -1
  68. package/dist/us-household/validate.d.ts +1 -1
  69. package/dist/us-household/validate.d.ts.map +1 -1
  70. package/dist/us-household-adapters.cjs +1 -1
  71. package/dist/us-household-adapters.d.ts +1 -1
  72. package/dist/us-household-adapters.js +3 -90
  73. package/dist/us-household.cjs +1 -1
  74. package/dist/us-household.d.ts +1 -1
  75. package/dist/us-household.js +346 -246
  76. package/dist/validation.d.ts +16 -0
  77. package/dist/validation.d.ts.map +1 -0
  78. package/package.json +16 -2
  79. package/src/primitives/WizardReviewList.tsx +35 -18
  80. package/src/primitives/index.ts +3 -0
  81. package/src/primitives/types.ts +20 -0
  82. package/src/primitives/useWizardStepFocus.ts +42 -0
  83. package/src/primitives/useWizardSteps.ts +181 -84
  84. package/src/styles.css +9 -0
  85. package/src/uk-household/adapters/householdImpactRequest.ts +164 -0
  86. package/src/uk-household/adapters/index.ts +9 -0
  87. package/src/uk-household/children.ts +23 -0
  88. package/src/uk-household/codes.ts +67 -0
  89. package/src/uk-household/defaults.ts +101 -0
  90. package/src/uk-household/draft.ts +138 -0
  91. package/src/uk-household/index.ts +75 -0
  92. package/src/uk-household/serialize.ts +189 -0
  93. package/src/uk-household/statePension.ts +69 -0
  94. package/src/uk-household/types.ts +159 -0
  95. package/src/uk-household/validate.ts +190 -0
  96. package/src/us-household/adapters/v1Payload.ts +211 -18
  97. package/src/us-household/amount.ts +10 -0
  98. package/src/us-household/index.ts +11 -0
  99. package/src/us-household/normalize.ts +79 -4
  100. package/src/us-household/serialize.ts +5 -1
  101. package/src/us-household/tippedOccupations.ts +145 -0
  102. package/src/us-household/types.ts +144 -15
  103. package/src/us-household/validate.ts +101 -4
  104. package/src/validation.ts +12 -0
  105. package/dist/WizardReviewList-De9RTK_4.js +0 -245
  106. package/dist/WizardReviewList-tfP9LcqU.cjs +0 -1
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # policyengine-household-wizard
2
2
 
3
- Shared wizard primitives and a US household draft contract for PolicyEngine
4
- apps (cliff-watch, Coverage Compass, app-v2, and standalone calculators).
3
+ Shared wizard primitives and US and UK household draft contracts for
4
+ PolicyEngine apps (cliff-watch, Coverage Compass, app-v2, the UK Autumn Budget
5
+ 2026 dashboard, and standalone calculators).
5
6
 
6
- The package ships two surfaces:
7
+ The package ships three surfaces:
7
8
 
8
9
  - **Wizard primitives** — copy-neutral React primitives for step state, progress,
9
10
  navigation, option cards, and review screens. No household-specific code.
@@ -11,6 +12,11 @@ The package ships two surfaces:
11
12
  marital status (issue #1044), validation rules, URL serialization,
12
13
  state-filtered counties, and adapters to the PolicyEngine API V1 household
13
14
  payload.
15
+ - **UK household model** (`policyengine-household-wizard/uk-household`) — the
16
+ household the UK Autumn Budget 2026 dashboard asks about: a draft type,
17
+ typical answers with their ONS sources, validation against the household
18
+ impact API's bounds, State Pension age by year, URL serialization, and an
19
+ adapter to that API's request. See [`docs/uk-household.md`](docs/uk-household.md).
14
20
 
15
21
  ## Install
16
22
 
@@ -64,7 +70,8 @@ function MyWizard() {
64
70
  }
65
71
  ```
66
72
 
67
- See [`docs/api.md`](docs/api.md) for the full API and [`docs/migration.md`](docs/migration.md)
73
+ See [`docs/api.md`](docs/api.md) for wizard navigation and focus APIs, [`docs/uk-household.md`](docs/uk-household.md)
74
+ for the UK household model, and [`docs/migration.md`](docs/migration.md)
68
75
  for migrating from each app's local wizard.
69
76
 
70
77
  ## Design decisions
@@ -82,6 +89,39 @@ for migrating from each app's local wizard.
82
89
  - **Adapters, not a UI shell.** Apps render their own form layouts and pass
83
90
  the draft through `validate()` and `toV1HouseholdPayload()` (or their own
84
91
  app-specific adapter) at submit time.
92
+ - **No income field overrides another.** An input on a PolicyEngine US total
93
+ such as `social_security` replaces the sum of its components, so components
94
+ sent alongside it are left out of the total. `socialSecurityIncome`
95
+ therefore sets `social_security_retirement` and `ssdiAmount` sets
96
+ `social_security_disability`; the model adds them. Pensions work the same
97
+ way: `publicPensionIncome` and `privatePensionIncome` set the components of
98
+ `taxable_pension_income`, which state rules read. A pension of unknown
99
+ source (`pensionIncome`) is sent as private, and fields that share a
100
+ variable are summed. Expenses set inputs too: `mortgageInterest` sets
101
+ `home_mortgage_interest`, not `mortgage_interest`, a computed total the
102
+ federal interest deduction ignores (the tests keep it as a guarded total
103
+ that no field may set). Tips are taxed as wages in PolicyEngine US, so
104
+ `tipIncome` sets `tip_income` and is also added to `employment_income`;
105
+ with a listed `tippedOccupationCode` (`TIPPED_OCCUPATIONS`, from the final
106
+ section 224 regulations) they can qualify for the 2025-2028 tip deduction. Property tests check the
107
+ adapter against a snapshot of the PolicyEngine US variable graph (refresh it
108
+ with `bun run regenerate-variable-graph`). Each total the adapter sets
109
+ directly, and each variable that more than one field sets, is listed with
110
+ its reason in `tests/us-household/v1PayloadInvariants.test.ts`.
111
+ - **Computed variables go to everyone or no one.** PolicyEngine stores each
112
+ person variable as one array covering everyone in the simulation, so an
113
+ input for one person on a variable the model computes gives everyone else
114
+ a stored default instead of the computed value: `ssi` sent for one adult
115
+ zeroed the other adult's SSI. The adapter therefore sends computed
116
+ variables for every person or no one, except employment income,
117
+ self-employment income and long-term capital gains, which
118
+ policyengine-us's Simulation moves onto input variables. `kind` is sent for everyone as `is_tax_unit_dependent`.
119
+ `isFullTimeStudent` is sent as the input `is_full_time_college_student`,
120
+ and only from age 18, because the model counts ages 5 to 17 as K-12
121
+ students. `ssiAmount` is sent as `ssi` only when every person has an
122
+ amount; `validate()` asks for the missing ones, and an entered 0 is sent as
123
+ `takes_up_ssi_if_eligible: false`. Property tests check this against the
124
+ variable graph snapshot, which records which variables the model computes.
85
125
 
86
126
  ## Repository structure
87
127
 
@@ -91,8 +131,10 @@ src/
91
131
  us-household/ types, draft, validate, normalize, serialize, counties
92
132
  adapters/ toV1HouseholdPayload — PolicyEngine API V1 envelope
93
133
  data/ counties-by-state.json
134
+ uk-household/ types, codes, defaults, draft, validate, serialize, State Pension
135
+ adapters/ toHouseholdImpactRequest — the UK Autumn Budget dashboard's API
94
136
  tests/ vitest unit and round-trip tests
95
- scripts/ generate-counties.ts
137
+ scripts/ generate-counties.ts, generate-variable-graph.ts
96
138
  ```
97
139
 
98
140
  ## Development
@@ -102,6 +144,8 @@ bun install
102
144
  bun run test
103
145
  bun run typecheck
104
146
  bun run build
147
+ bun run check:consumer-types # NodeNext (ESM and CommonJS) and Bundler apps type-check against dist
148
+ bun run test:live # adapter output against api.policyengine.org (network)
105
149
  ```
106
150
 
107
151
  Changes follow the towncrier convention used by `@policyengine/ui-kit`. Add a
@@ -114,3 +158,4 @@ echo "Describe your change." > changelog.d/your-branch.added.md
114
158
  Fragment types: `added` (minor), `changed` (patch), `fixed` (patch),
115
159
  `removed` (minor), `breaking` (major). The release workflow on `main` bumps
116
160
  the version, builds the changelog, publishes to npm, and commits the bump.
161
+ See [release setup and verification](docs/releasing.md) for npm trusted publishing.
@@ -0,0 +1 @@
1
+ "use strict";const a=require("react"),d=require("react/jsx-runtime");function I(c){return{id:c.id,label:c.label}}function S(c,f){var u,t;return((u=c.find(s=>s.id===f))==null?void 0:u.id)??((t=c[0])==null?void 0:t.id)??null}function H({steps:c,state:f,initialStepId:u,onStepChange:t,onComplete:s,onInvalidStep:n,advanceRequest:o}){const e=a.useMemo(()=>c.filter(i=>!i.isVisible||i.isVisible(f)),[c,f]),p=a.useMemo(()=>e.map(I),[e]),[r,h]=a.useState(()=>S(e,u)),[m,j]=a.useState(()=>r===null?[]:[r]),[R,W]=a.useState(null),[V,N]=a.useState(0),w=a.useCallback(()=>W(null),[]),v=a.useCallback(i=>{h(i),i!==null&&j(b=>b.includes(i)?b:[...b,i]),w()},[w]);a.useEffect(()=>{var i;e.some(b=>b.id===r)||v(((i=e[0])==null?void 0:i.id)??null)},[e,r,v]);const E=a.useRef(t);a.useEffect(()=>{E.current=t},[t]);const B=a.useRef(r);a.useEffect(()=>{var i;B.current!==r&&(B.current=r,r!==null&&((i=E.current)==null||i.call(E,r)))},[r]);const P=e.findIndex(i=>i.id===r),z=P>=0?P:e.length>0?0:-1,l=e[z]??null,F=l?I(l):null,$=e.length,g=$===0||z===$-1,k=l!=null&&l.isComplete?l.isComplete(f):!0,x=a.useCallback(i=>{v(i),W(i),N(b=>b+1),n==null||n(i)},[v,n]),A=a.useCallback(()=>{const i=e.find(b=>b.isComplete&&!b.isComplete(f));return i?(x(i.id),!1):(w(),!0)},[e,f,x,w]),M=a.useCallback(()=>{if(!(!l||g)){if(!k){x(l.id);return}v(e[z+1].id)}},[l,g,k,x,v,e,z]),y=a.useCallback(()=>{if(l){if(!k){x(l.id);return}g?A()&&(s==null||s()):M()}},[l,k,x,g,A,s,M]),D=a.useRef(null);a.useEffect(()=>{!o||D.current===o||(D.current=o,l!=null&&l.autoAdvance&&o.stepId===l.id&&y())},[o,l,y]);const T=a.useCallback(()=>{w(),z>0&&v(e[z-1].id)},[w,z,v,e]),C=a.useCallback(i=>{e.some(b=>b.id===i)&&v(i)},[e,v]),O=a.useCallback(()=>{const i=S(e,u);v(i),j(i===null?[]:[i])},[e,u,v]),K=a.useCallback(i=>{i.preventDefault(),l!=null&&l.autoAdvance||y()},[l,y]),U=a.useCallback(i=>{l!=null&&l.autoAdvance&&i.key==="Enter"&&i.target.tagName==="INPUT"&&i.preventDefault()},[l]),G=a.useCallback(i=>m.includes(i),[m]);return{visibleSteps:p,currentStep:F,currentStepIndex:z,totalSteps:$,isFirstStep:z<=0,isLastStep:g,canAdvance:k,visitedStepIds:m,hasVisitedStep:G,validationStepId:R,validationAttempt:V,clearValidation:w,validateAll:A,advance:y,handleSubmit:K,handleKeyDown:U,goNext:M,goBack:T,goToStep:C,reset:O}}function J({stepId:c,hasError:f=!1,errorRevision:u,preventScroll:t=!1,onStepFocus:s}){const n=a.useRef(null),o=a.useRef(null),e=a.useRef({preventScroll:t,onStepFocus:s});return a.useEffect(()=>{e.current={preventScroll:t,onStepFocus:s}},[t,s]),a.useEffect(()=>{var p,r;c===null||!n.current||(n.current.focus({preventScroll:e.current.preventScroll}),(r=(p=e.current).onStepFocus)==null||r.call(p))},[c]),a.useEffect(()=>{var p;f&&((p=o.current)==null||p.focus({preventScroll:e.current.preventScroll}))},[c,f,u]),{headingRef:n,errorRef:o}}function L({totalSteps:c,currentStepIndex:f,currentStepLabel:u,className:t,...s}){const n=Math.max(c,0),o=Math.max(0,Math.min(f,n-1)),e=n>0?(o+1)/n*100:0,p=n>0?o+1:0,r={width:`${e}%`};return d.jsxs("div",{role:"group","aria-label":s["aria-label"]??"Wizard progress",className:["pe-wizard-progress",t].filter(Boolean).join(" "),...s,children:[d.jsxs("div",{className:"pe-wizard-progress-topline",children:[d.jsxs("span",{"data-testid":"pe-wizard-progress-step",children:["Step ",p," of ",n]}),u?d.jsx("span",{"data-testid":"pe-wizard-progress-label",children:u}):null]}),d.jsx("div",{className:"pe-wizard-progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":p,"aria-valuetext":u,children:d.jsx("div",{className:"pe-wizard-progress-bar",style:r})})]})}function Q({selected:c=!1,title:f,description:u,onSelect:t,onClick:s,className:n,type:o,disabled:e,...p}){const r=["pe-wizard-option-card"];return c&&r.push("pe-wizard-option-card--selected"),n&&r.push(n),d.jsxs("button",{type:o??"button",role:"radio","aria-checked":c,"aria-disabled":e?!0:void 0,disabled:e,className:r.join(" "),onClick:h=>{e||(s==null||s(h),h.defaultPrevented||t==null||t())},...p,children:[d.jsx("span",{className:"pe-wizard-option-card-title",children:f}),u?d.jsx("span",{className:"pe-wizard-option-card-description",children:u}):null]})}function X({canAdvance:c,isFirstStep:f,isLastStep:u,backLabel:t="Back",continueLabel:s="Continue",submitLabel:n="Submit",busyLabel:o,busy:e=!1,onBack:p,onContinue:r,onSubmit:h,leadingActions:m,trailingActions:j,hideBack:R=!1,className:W,...V}){const N=e||!c,w=e&&o?o:u?n:s,v=()=>{N||(u?h==null||h():r==null||r())};return d.jsxs("div",{className:["pe-wizard-nav",W].filter(Boolean).join(" "),...V,children:[m?d.jsx("div",{className:"pe-wizard-nav-leading",children:m}):null,R?null:d.jsx("button",{type:"button",className:"pe-wizard-nav-back",onClick:p,disabled:f||e,"aria-label":typeof t=="string"?t:void 0,children:t}),d.jsx("button",{type:"button",className:"pe-wizard-nav-primary",onClick:v,disabled:N,"aria-disabled":N,children:w}),j?d.jsx("div",{className:"pe-wizard-nav-trailing",children:j}):null]})}function Y({items:c,className:f,...u}){const t=a.useId();return d.jsx("div",{className:["pe-wizard-review-list",f].filter(Boolean).join(" "),role:"list",...u,children:c.map((s,n)=>{const o=`${t}-${n}-value`,e=["pe-wizard-review-item"];s.missing&&e.push("pe-wizard-review-item--missing");const p=typeof s.onEdit=="function",r=d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"pe-wizard-review-item-label",children:s.label}),d.jsx("span",{id:o,className:"pe-wizard-review-item-value",children:s.missing&&(s.value===null||s.value===void 0||s.value==="")?"Missing":s.value})]});return p?d.jsx("div",{role:"listitem",className:"pe-wizard-review-listitem",children:d.jsx("button",{type:"button",className:e.join(" "),"data-testid":`pe-wizard-review-${s.id}`,onClick:s.onEdit,"aria-describedby":o,"aria-label":s.editAriaLabel??(typeof s.label=="string"?`${s.editLabel??"Edit"} ${s.label}`:void 0),children:r})},s.id):d.jsx("div",{role:"listitem",className:e.join(" "),"data-testid":`pe-wizard-review-${s.id}`,children:r},s.id)})})}exports.WizardNavigation=X;exports.WizardOptionCard=Q;exports.WizardProgress=L;exports.WizardReviewList=Y;exports.useWizardStepFocus=J;exports.useWizardSteps=H;
@@ -0,0 +1,354 @@
1
+ import { useMemo as O, useState as M, useCallback as w, useEffect as b, useRef as y, useId as L } from "react";
2
+ import { jsxs as x, jsx as f, Fragment as S } from "react/jsx-runtime";
3
+ function U(n) {
4
+ return { id: n.id, label: n.label };
5
+ }
6
+ function G(n, o) {
7
+ var d, l;
8
+ return ((d = n.find((i) => i.id === o)) == null ? void 0 : d.id) ?? ((l = n[0]) == null ? void 0 : l.id) ?? null;
9
+ }
10
+ function ee({
11
+ steps: n,
12
+ state: o,
13
+ initialStepId: d,
14
+ onStepChange: l,
15
+ onComplete: i,
16
+ onInvalidStep: t,
17
+ advanceRequest: c
18
+ }) {
19
+ const e = O(
20
+ () => n.filter((a) => !a.isVisible || a.isVisible(o)),
21
+ [n, o]
22
+ ), u = O(
23
+ () => e.map(U),
24
+ [e]
25
+ ), [r, z] = M(
26
+ () => G(e, d)
27
+ ), [N, j] = M(
28
+ () => r === null ? [] : [r]
29
+ ), [D, A] = M(null), [E, W] = M(0), m = w(() => A(null), []), p = w(
30
+ (a) => {
31
+ z(a), a !== null && j(
32
+ (v) => v.includes(a) ? v : [...v, a]
33
+ ), m();
34
+ },
35
+ [m]
36
+ );
37
+ b(() => {
38
+ var a;
39
+ e.some((v) => v.id === r) || p(((a = e[0]) == null ? void 0 : a.id) ?? null);
40
+ }, [e, r, p]);
41
+ const B = y(l);
42
+ b(() => {
43
+ B.current = l;
44
+ }, [l]);
45
+ const F = y(r);
46
+ b(() => {
47
+ var a;
48
+ F.current !== r && (F.current = r, r !== null && ((a = B.current) == null || a.call(B, r)));
49
+ }, [r]);
50
+ const R = e.findIndex(
51
+ (a) => a.id === r
52
+ ), h = R >= 0 ? R : e.length > 0 ? 0 : -1, s = e[h] ?? null, H = s ? U(s) : null, I = e.length, k = I === 0 || h === I - 1, V = s != null && s.isComplete ? s.isComplete(o) : !0, g = w(
53
+ (a) => {
54
+ p(a), A(a), W((v) => v + 1), t == null || t(a);
55
+ },
56
+ [p, t]
57
+ ), P = w(() => {
58
+ const a = e.find(
59
+ (v) => v.isComplete && !v.isComplete(o)
60
+ );
61
+ return a ? (g(a.id), !1) : (m(), !0);
62
+ }, [e, o, g, m]), T = w(() => {
63
+ if (!(!s || k)) {
64
+ if (!V) {
65
+ g(s.id);
66
+ return;
67
+ }
68
+ p(e[h + 1].id);
69
+ }
70
+ }, [
71
+ s,
72
+ k,
73
+ V,
74
+ g,
75
+ p,
76
+ e,
77
+ h
78
+ ]), $ = w(() => {
79
+ if (s) {
80
+ if (!V) {
81
+ g(s.id);
82
+ return;
83
+ }
84
+ k ? P() && (i == null || i()) : T();
85
+ }
86
+ }, [
87
+ s,
88
+ V,
89
+ g,
90
+ k,
91
+ P,
92
+ i,
93
+ T
94
+ ]), K = y(null);
95
+ b(() => {
96
+ !c || K.current === c || (K.current = c, s != null && s.autoAdvance && c.stepId === s.id && $());
97
+ }, [c, s, $]);
98
+ const J = w(() => {
99
+ m(), h > 0 && p(e[h - 1].id);
100
+ }, [m, h, p, e]), Q = w(
101
+ (a) => {
102
+ e.some((v) => v.id === a) && p(a);
103
+ },
104
+ [e, p]
105
+ ), X = w(() => {
106
+ const a = G(e, d);
107
+ p(a), j(a === null ? [] : [a]);
108
+ }, [e, d, p]), Y = w(
109
+ (a) => {
110
+ a.preventDefault(), s != null && s.autoAdvance || $();
111
+ },
112
+ [s, $]
113
+ ), Z = w(
114
+ (a) => {
115
+ s != null && s.autoAdvance && a.key === "Enter" && a.target.tagName === "INPUT" && a.preventDefault();
116
+ },
117
+ [s]
118
+ ), _ = w(
119
+ (a) => N.includes(a),
120
+ [N]
121
+ );
122
+ return {
123
+ visibleSteps: u,
124
+ currentStep: H,
125
+ currentStepIndex: h,
126
+ totalSteps: I,
127
+ isFirstStep: h <= 0,
128
+ isLastStep: k,
129
+ canAdvance: V,
130
+ visitedStepIds: N,
131
+ hasVisitedStep: _,
132
+ validationStepId: D,
133
+ validationAttempt: E,
134
+ clearValidation: m,
135
+ validateAll: P,
136
+ advance: $,
137
+ handleSubmit: Y,
138
+ handleKeyDown: Z,
139
+ goNext: T,
140
+ goBack: J,
141
+ goToStep: Q,
142
+ reset: X
143
+ };
144
+ }
145
+ function ie({
146
+ stepId: n,
147
+ hasError: o = !1,
148
+ errorRevision: d,
149
+ preventScroll: l = !1,
150
+ onStepFocus: i
151
+ }) {
152
+ const t = y(null), c = y(null), e = y({ preventScroll: l, onStepFocus: i });
153
+ return b(() => {
154
+ e.current = { preventScroll: l, onStepFocus: i };
155
+ }, [l, i]), b(() => {
156
+ var u, r;
157
+ n === null || !t.current || (t.current.focus({
158
+ preventScroll: e.current.preventScroll
159
+ }), (r = (u = e.current).onStepFocus) == null || r.call(u));
160
+ }, [n]), b(() => {
161
+ var u;
162
+ o && ((u = c.current) == null || u.focus({
163
+ preventScroll: e.current.preventScroll
164
+ }));
165
+ }, [n, o, d]), { headingRef: t, errorRef: c };
166
+ }
167
+ function ae({
168
+ totalSteps: n,
169
+ currentStepIndex: o,
170
+ currentStepLabel: d,
171
+ className: l,
172
+ ...i
173
+ }) {
174
+ const t = Math.max(n, 0), c = Math.max(0, Math.min(o, t - 1)), e = t > 0 ? (c + 1) / t * 100 : 0, u = t > 0 ? c + 1 : 0, r = { width: `${e}%` };
175
+ return /* @__PURE__ */ x(
176
+ "div",
177
+ {
178
+ role: "group",
179
+ "aria-label": i["aria-label"] ?? "Wizard progress",
180
+ className: ["pe-wizard-progress", l].filter(Boolean).join(" "),
181
+ ...i,
182
+ children: [
183
+ /* @__PURE__ */ x("div", { className: "pe-wizard-progress-topline", children: [
184
+ /* @__PURE__ */ x("span", { "data-testid": "pe-wizard-progress-step", children: [
185
+ "Step ",
186
+ u,
187
+ " of ",
188
+ t
189
+ ] }),
190
+ d ? /* @__PURE__ */ f("span", { "data-testid": "pe-wizard-progress-label", children: d }) : null
191
+ ] }),
192
+ /* @__PURE__ */ f(
193
+ "div",
194
+ {
195
+ className: "pe-wizard-progress-track",
196
+ role: "progressbar",
197
+ "aria-valuemin": 0,
198
+ "aria-valuemax": t,
199
+ "aria-valuenow": u,
200
+ "aria-valuetext": d,
201
+ children: /* @__PURE__ */ f("div", { className: "pe-wizard-progress-bar", style: r })
202
+ }
203
+ )
204
+ ]
205
+ }
206
+ );
207
+ }
208
+ function re({
209
+ selected: n = !1,
210
+ title: o,
211
+ description: d,
212
+ onSelect: l,
213
+ onClick: i,
214
+ className: t,
215
+ type: c,
216
+ disabled: e,
217
+ ...u
218
+ }) {
219
+ const r = ["pe-wizard-option-card"];
220
+ return n && r.push("pe-wizard-option-card--selected"), t && r.push(t), /* @__PURE__ */ x(
221
+ "button",
222
+ {
223
+ type: c ?? "button",
224
+ role: "radio",
225
+ "aria-checked": n,
226
+ "aria-disabled": e ? !0 : void 0,
227
+ disabled: e,
228
+ className: r.join(" "),
229
+ onClick: (z) => {
230
+ e || (i == null || i(z), z.defaultPrevented || l == null || l());
231
+ },
232
+ ...u,
233
+ children: [
234
+ /* @__PURE__ */ f("span", { className: "pe-wizard-option-card-title", children: o }),
235
+ d ? /* @__PURE__ */ f("span", { className: "pe-wizard-option-card-description", children: d }) : null
236
+ ]
237
+ }
238
+ );
239
+ }
240
+ function se({
241
+ canAdvance: n,
242
+ isFirstStep: o,
243
+ isLastStep: d,
244
+ backLabel: l = "Back",
245
+ continueLabel: i = "Continue",
246
+ submitLabel: t = "Submit",
247
+ busyLabel: c,
248
+ busy: e = !1,
249
+ onBack: u,
250
+ onContinue: r,
251
+ onSubmit: z,
252
+ leadingActions: N,
253
+ trailingActions: j,
254
+ hideBack: D = !1,
255
+ className: A,
256
+ ...E
257
+ }) {
258
+ const W = e || !n, m = e && c ? c : d ? t : i, p = () => {
259
+ W || (d ? z == null || z() : r == null || r());
260
+ };
261
+ return /* @__PURE__ */ x(
262
+ "div",
263
+ {
264
+ className: ["pe-wizard-nav", A].filter(Boolean).join(" "),
265
+ ...E,
266
+ children: [
267
+ N ? /* @__PURE__ */ f("div", { className: "pe-wizard-nav-leading", children: N }) : null,
268
+ D ? null : /* @__PURE__ */ f(
269
+ "button",
270
+ {
271
+ type: "button",
272
+ className: "pe-wizard-nav-back",
273
+ onClick: u,
274
+ disabled: o || e,
275
+ "aria-label": typeof l == "string" ? l : void 0,
276
+ children: l
277
+ }
278
+ ),
279
+ /* @__PURE__ */ f(
280
+ "button",
281
+ {
282
+ type: "button",
283
+ className: "pe-wizard-nav-primary",
284
+ onClick: p,
285
+ disabled: W,
286
+ "aria-disabled": W,
287
+ children: m
288
+ }
289
+ ),
290
+ j ? /* @__PURE__ */ f("div", { className: "pe-wizard-nav-trailing", children: j }) : null
291
+ ]
292
+ }
293
+ );
294
+ }
295
+ function le({
296
+ items: n,
297
+ className: o,
298
+ ...d
299
+ }) {
300
+ const l = L();
301
+ return /* @__PURE__ */ f(
302
+ "div",
303
+ {
304
+ className: ["pe-wizard-review-list", o].filter(Boolean).join(" "),
305
+ role: "list",
306
+ ...d,
307
+ children: n.map((i, t) => {
308
+ const c = `${l}-${t}-value`, e = ["pe-wizard-review-item"];
309
+ i.missing && e.push("pe-wizard-review-item--missing");
310
+ const u = typeof i.onEdit == "function", r = /* @__PURE__ */ x(S, { children: [
311
+ /* @__PURE__ */ f("span", { className: "pe-wizard-review-item-label", children: i.label }),
312
+ /* @__PURE__ */ f("span", { id: c, className: "pe-wizard-review-item-value", children: i.missing && (i.value === null || i.value === void 0 || i.value === "") ? "Missing" : i.value })
313
+ ] });
314
+ return u ? /* @__PURE__ */ f(
315
+ "div",
316
+ {
317
+ role: "listitem",
318
+ className: "pe-wizard-review-listitem",
319
+ children: /* @__PURE__ */ f(
320
+ "button",
321
+ {
322
+ type: "button",
323
+ className: e.join(" "),
324
+ "data-testid": `pe-wizard-review-${i.id}`,
325
+ onClick: i.onEdit,
326
+ "aria-describedby": c,
327
+ "aria-label": i.editAriaLabel ?? (typeof i.label == "string" ? `${i.editLabel ?? "Edit"} ${i.label}` : void 0),
328
+ children: r
329
+ }
330
+ )
331
+ },
332
+ i.id
333
+ ) : /* @__PURE__ */ f(
334
+ "div",
335
+ {
336
+ role: "listitem",
337
+ className: e.join(" "),
338
+ "data-testid": `pe-wizard-review-${i.id}`,
339
+ children: r
340
+ },
341
+ i.id
342
+ );
343
+ })
344
+ }
345
+ );
346
+ }
347
+ export {
348
+ se as W,
349
+ re as a,
350
+ ae as b,
351
+ le as c,
352
+ ee as d,
353
+ ie as u
354
+ };
@@ -0,0 +1 @@
1
+ "use strict";const S={1:"Beverage and food service",2:"Entertainment and events",3:"Hospitality and guest services",4:"Home services",5:"Personal services",6:"Personal appearance and wellness",7:"Recreation and instruction",8:"Transportation and delivery"},U=[[101,"Bartenders"],[102,"Wait staff"],[103,"Food or beverage servers, non-restaurant"],[104,"Dining room and cafeteria attendants and bartender helpers"],[105,"Chefs and cooks"],[106,"Food preparation workers"],[107,"Fast food and counter workers"],[108,"Dishwashers"],[109,"Host staff, restaurant, lounge, and coffee shop"],[110,"Bakers"],[201,"Gambling dealers"],[202,"Gambling change persons and booth cashiers"],[203,"Gambling cage workers"],[204,"Gambling and sports book writers and runners"],[205,"Dancers"],[206,"Musicians and singers"],[207,"Disc jockeys, except radio"],[208,"Entertainers and performers"],[209,"Digital content creators"],[210,"Ushers, lobby attendants, and ticket takers"],[211,"Locker room, coatroom, and dressing room attendants"],[301,"Baggage porters and bellhops"],[302,"Concierges"],[303,"Hotel, motel, and resort desk clerks"],[304,"Maids and housekeeping cleaners"],[401,"Home maintenance and repair workers"],[402,"Home landscaping and groundskeeping workers"],[403,"Home electricians"],[404,"Home plumbers"],[405,"Home heating and air conditioning mechanics and installers"],[406,"Home appliance installers and repairers"],[407,"Home cleaning service workers"],[408,"Locksmiths"],[409,"Roadside assistance workers"],[501,"Personal care and service workers"],[502,"Private event planners"],[503,"Private event and portrait photographers"],[504,"Private event videographers"],[505,"Event officiants"],[506,"Pet and show animal caretakers"],[507,"Tutors"],[508,"Nannies and babysitters"],[509,"Visual artists"],[510,"Floral designers"],[601,"Skincare specialists"],[602,"Massage therapists"],[603,"Barbers, hairdressers, hairstylists, and cosmetologists"],[604,"Shampooers"],[605,"Manicurists and pedicurists"],[606,"Eyebrow and eyelash technicians"],[607,"Makeup artists"],[608,"Exercise trainers and group fitness instructors"],[609,"Tattoo artists and piercers"],[610,"Tailors"],[611,"Shoe and leather workers and repairers"],[701,"Golf caddies"],[702,"Self-enrichment teachers"],[703,"Recreational and tour pilots"],[704,"Tour guides"],[705,"Travel guides"],[706,"Sports and recreation instructors"],[801,"Parking and valet attendants"],[802,"Taxi and rideshare drivers and chauffeurs"],[803,"Shuttle drivers"],[804,"Goods delivery people"],[805,"Personal vehicle and equipment cleaners"],[806,"Private and charter bus drivers"],[807,"Water taxi operators and charter boat workers"],[808,"Rickshaw, pedicab, and carriage drivers"],[809,"Home movers"],[810,"Gas pump attendant"]],T=U.map(([e,t])=>({code:e,label:t,category:S[Math.floor(e/100)]})),y=new Map(T.map(e=>[e.code,e]));function N(e){return y.get(e)}function v(e){return typeof e=="number"&&y.has(e)}function O(e){const t=typeof e=="string"&&/^\s*\d+\s*$/.test(e)?Number(e):e;return t===0?0:v(t)?t:void 0}function _(e){const t=typeof e=="string"&&e.trim()!==""?Number(e):e;return typeof t=="number"&&Number.isFinite(t)?t:void 0}const D={household:"household",family:"family",taxUnit:"tax_unit",spmUnit:"spm_unit",maritalUnit:"marital_unit"},x={household:"your household",family:"your family",taxUnit:"your tax unit",spmUnit:"your household",maritalUnit:"your marital unit"},w={isDisabled:"is_disabled",isBlind:"is_blind",isFullTimeStudent:"is_full_time_college_student",isPregnant:"is_pregnant",needsCare:"is_incapable_of_self_care"},H=18,R="takes_up_ssi_if_eligible",I={employmentIncome:"employment_income",tipIncome:"tip_income",selfEmploymentIncome:"self_employment_income",socialSecurityIncome:"social_security_retirement",ssiAmount:"ssi",ssdiAmount:"social_security_disability",pensionIncome:"taxable_private_pension_income",publicPensionIncome:"taxable_public_pension_income",privatePensionIncome:"taxable_private_pension_income",dividendIncome:"qualified_dividend_income",nonQualifiedDividendIncome:"non_qualified_dividend_income",shortTermCapitalGains:"short_term_capital_gains",longTermCapitalGains:"long_term_capital_gains",taxableInterestIncome:"taxable_interest_income",rentalIncome:"rental_income",unemploymentCompensation:"unemployment_compensation",childSupportReceived:"child_support_received",miscellaneousIncome:"miscellaneous_income"},B={tipIncome:"employment_income"},G={charitableCashDonations:"charitable_cash_donations",mortgageInterest:"home_mortgage_interest",realEstateTaxes:"real_estate_taxes"},L="treasury_tipped_occupation_code",M=[...Object.entries(I),...Object.entries(B),...Object.entries(G)];function o(e,t){return{[e]:t}}function V(e,t){var r;const i={};e.age!==null&&e.age!==void 0&&(i.age=o(t,e.age)),i.is_tax_unit_dependent=o(t,e.kind==="dependent");const p=_(e.age),h=p!==void 0&&p<H;for(const[s,c]of Object.entries(w)){const d=e[s];s==="isFullTimeStudent"&&h||typeof d=="boolean"&&(i[c]=o(t,d))}for(const[s,c]of M){const d=_(e[s]);if(d!==void 0&&s!=="ssiAmount"){const l=(r=i[c])==null?void 0:r[t],m=typeof l=="number"?l+d:d;i[c]=o(t,m)}}const a=O(e.tippedOccupationCode);return a!==void 0&&(i[L]=o(t,a)),i}function A(e,t={}){const{groupKeyStyle:i="short",includeMaritalUnit:p=!1,label:h=null}=t,a=i==="verbose"?x:D,r=String(e.year),s=e.people.map(n=>n.id),c=e.people.map(n=>_(n.ssiAmount)),d=c.every(n=>n!==void 0)&&c.some(n=>n!==0),l={};e.people.forEach((n,u)=>{const g=V(n,r),f=c[u];f===0&&(g[R]=o(r,!1)),d&&f!==void 0&&(g[I.ssiAmount]=o(r,f)),l[n.id]=g});const m={members:[...s]};e.state&&(m.state_name=o(r,e.state)),e.county&&(m.county=o(r,e.county));const P={[a.family]:{members:[...s]}},E={[a.taxUnit]:{members:[...s]}},C={[a.spmUnit]:{members:[...s]}},k={[a.household]:m},b={};if(p){const n=e.people.filter(u=>u.kind==="adult");b[a.maritalUnit]={members:n.slice(0,2).map(u=>u.id)}}return{country_id:"us",label:h,data:{people:l,families:P,marital_units:b,tax_units:E,spm_units:C,households:k}}}function F(e,t={}){return A(e,t).data}exports.NOT_A_TIPPED_OCCUPATION=0;exports.TIPPED_OCCUPATIONS=T;exports.getTippedOccupation=N;exports.isTippedOccupationCode=v;exports.toAmount=_;exports.toTippedOccupationCode=O;exports.toV1HouseholdPayload=A;exports.toV1HouseholdSituation=F;
@@ -0,0 +1 @@
1
+ "use strict";const R=[{code:"NORTH_EAST",name:"North East"},{code:"NORTH_WEST",name:"North West"},{code:"YORKSHIRE",name:"Yorkshire and the Humber"},{code:"EAST_MIDLANDS",name:"East Midlands"},{code:"WEST_MIDLANDS",name:"West Midlands"},{code:"EAST_OF_ENGLAND",name:"East of England"},{code:"LONDON",name:"London"},{code:"SOUTH_EAST",name:"South East"},{code:"SOUTH_WEST",name:"South West"},{code:"WALES",name:"Wales"},{code:"SCOTLAND",name:"Scotland"},{code:"NORTHERN_IRELAND",name:"Northern Ireland"}],D=["RENT_PRIVATELY","RENT_FROM_COUNCIL","RENT_FROM_HA","OWNED_WITH_MORTGAGE","OWNED_OUTRIGHT"],f=["RENT_PRIVATELY","RENT_FROM_COUNCIL","RENT_FROM_HA"],b=["NONE","PLAN_1","PLAN_2","PLAN_4","PLAN_5","POSTGRADUATE"],$=["A","B","C","D","E","F","G","H","I"],h=(e,a)=>typeof a=="string"&&e.includes(a),v=e=>h(R.map(a=>a.code),e),x=e=>h(D,e),Y=e=>h(b,e),H=e=>h($,e),U=e=>h(f,e);function X(e){var a;return((a=R.find(r=>r.code===e))==null?void 0:a.name)??e}const z=2026,Q=34200,Z="£34,200 is the UK median salary in April 2026 (ONS Annual Survey of Hours and Earnings, provisional).",y={NORTH_EAST:790,NORTH_WEST:975,YORKSHIRE:869,EAST_MIDLANDS:928,WEST_MIDLANDS:983,EAST_OF_ENGLAND:1298,LONDON:2338,SOUTH_EAST:1438,SOUTH_WEST:1251,WALES:848,SCOTLAND:1011,NORTHERN_IRELAND:879},w=1406,ee=e=>e==="NORTHERN_IRELAND"?"July 2026":"September 2026";function G(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(y,e)?y[e]:w}const F={petrol:620,diesel:340,electricity:1040},ne={salary:{statistic:"Median gross annual pay, all employee jobs, UK, April 2026 (provisional): £34,229",publication:"ONS, Annual Survey of Hours and Earnings 2026, Table 6.7a",url:"https://www.ons.gov.uk/employmentandlabourmarket/peopleinwork/earningsandworkinghours/datasets/agegroupashetable6"},rent:{statistic:"Average monthly private rent by region, September 2026 (Northern Ireland: July 2026)",publication:"ONS, Price Index of Private Rents, published 21 October 2026",url:"https://www.ons.gov.uk/economy/inflationandpriceindices/datasets/priceindexofprivaterentsukmonthlypricestatistics"},spending:{statistic:"Average weekly household spending on petrol, diesel and electricity, FYE 2025",publication:"ONS, Family Spending in the UK, FYE 2025, Workbook 1, Table A1",url:"https://www.ons.gov.uk/peoplepopulationandcommunity/personalandhouseholdfinances/expenditure/datasets/familyspendingworkbook1detailedexpenditureandtrends"}},T={years:{2026:{state_pension_age:66,full_new_state_pension:12547.6},2027:{state_pension_age:67,full_new_state_pension:13036.97},2028:{state_pension_age:67,full_new_state_pension:13362.92},2029:{state_pension_age:67,full_new_state_pension:13696.98},2030:{state_pension_age:67,full_new_state_pension:14039.42},2031:{state_pension_age:67,full_new_state_pension:14390.39}}};function M(e,a=T){const r=Object.keys(a.years).map(Number).sort((n,c)=>n-c),p=r.find(n=>n>=e)??r[r.length-1],d=a.years[String(p)];return{age:d.state_pension_age,full:d.full_new_state_pension}}function S(e,a,r=T){return e>=M(a,r).age}const N=e=>typeof e=="number"&&Number.isFinite(e),I=19,k=16,W="Children are 0 to 19. Someone aged 20 or over is not a dependant for Child Benefit or Universal Credit, so leave them out.",q=e=>e>=k&&e<=I,te=5,L={adultAge:{min:16,max:100},childAge:{min:0,max:I},maxChildren:10,maxAmount:1e7,maxMonthlyRent:1e5,maxMonthlyChildcare:1e4,maxSpending:1e5,maxStatePension:1e5},B=[2026,2027,2028,2029,2030,2031],A=e=>typeof e=="number"&&Number.isInteger(e),ie=e=>typeof e=="number"&&Number.isFinite(e),oe=e=>`£${e.toLocaleString("en-GB")}`;function V(e,a){var O,P,K;const{year:r,years:p=B,statePension:d}=a,n=L,c=[],o=(t,s,i)=>c.push({code:t,path:s,message:i});(!A(r)||!p.includes(r))&&o("year.unsupported","year",`${String(r)} is not a year this calculation covers.`),!A(e.salaryYear)||!p.includes(e.salaryYear)?o("salaryYear.unsupported","salaryYear",`Salaries cannot be entered for ${String(e.salaryYear)}.`):A(r)&&e.salaryYear>r&&o("salaryYear.afterYear","salaryYear",`Salaries are entered for ${e.salaryYear}, after ${r}; they can only be grown forward.`);const g=(t,s,i,m)=>{i==null?o(`${t}.required`,t,`${s} is required.`):m(i)||o(`${t}.invalid`,t,`Unknown ${s.toLowerCase()} "${String(i)}".`)};g("region","Region",e.region,v),g("tenure","Housing",e.tenure,x),g("councilTaxBand","Council Tax band",e.councilTaxBand,H),typeof e.claimsUniversalCredit!="boolean"&&o("claimsUniversalCredit.required","claimsUniversalCredit","Whether the household claims Universal Credit is required.");const l=(t,s,i,m,{optional:J=!1}={})=>{i==null?J||o(`${t}.required`,t,`${s} is required.`):ie(i)?i<0?o(`${t}.negative`,t,`${s} cannot be negative.`):i>m&&o(`${t}.tooLarge`,t,`${s} cannot be more than ${oe(m)}.`):o(`${t}.notANumber`,t,`${s} must be a number.`)},u=(t,s,i)=>{i==null?o(`${t}.required`,t,`${s} is required.`):A(i)?(i<n.adultAge.min||i>n.adultAge.max)&&o(`${t}.outOfRange`,t,`${s} must be from ${n.adultAge.min} to ${n.adultAge.max}.`):o(`${t}.notWhole`,t,`${s} must be a whole number of years.`)},{head:_,partner:E}=e;u("head.age","Your age",_.age),l("head.employmentIncome","Your salary",_.employmentIncome,n.maxAmount),l("head.privatePensionIncome","Your private pension",_.privatePensionIncome,n.maxAmount,{optional:!0}),l("head.dividendIncome","Dividends",_.dividendIncome,n.maxAmount),l("head.savingsInterestIncome","Savings interest",_.savingsInterestIncome,n.maxAmount),l("head.propertyIncome","Property income",_.propertyIncome,n.maxAmount),l("head.salarySacrificePensionContributions","Salary sacrifice",_.salarySacrificePensionContributions,n.maxAmount),Y(_.studentLoanPlan)||o("head.studentLoanPlan.invalid","head.studentLoanPlan",`Unknown student loan plan "${String(_.studentLoanPlan)}".`),N(_.statePension)&&S(_.age,r,d)&&l("head.statePension","Your State Pension",_.statePension,n.maxStatePension),e.hasPartner&&(u("partner.age","Your partner's age",E.age),l("partner.employmentIncome","Your partner's salary",E.employmentIncome,n.maxAmount),l("partner.privatePensionIncome","Your partner's private pension",E.privatePensionIncome,n.maxAmount,{optional:!0}),N(E.statePension)&&S(E.age,r,d)&&l("partner.statePension","Your partner's State Pension",E.statePension,n.maxStatePension)),e.children.length>n.maxChildren&&o("children.tooMany","children",`At most ${n.maxChildren} children can be entered.`);for(let t=0;t<e.children.length;t++){const s=e.children[t];if(s==null){o(`children[${t}].required`,`children[${t}]`,`Child ${t+1}'s details are missing.`);continue}const i=`children[${t}].age`,m=`Child ${t+1}'s age`;s.age===null||s.age===void 0?o(`${i}.required`,i,`${m} is required.`):A(s.age)?s.age<n.childAge.min?o(`${i}.negative`,i,`${m} cannot be negative.`):s.age>n.childAge.max&&o(`${i}.tooOld`,i,W):o(`${i}.notWhole`,i,`${m} must be a whole number of years.`)}return U(e.tenure)&&l("monthlyRent","Rent",e.monthlyRent,n.maxMonthlyRent,{optional:!0}),e.children.length>0&&l("monthlyChildcare","Childcare",e.monthlyChildcare,n.maxMonthlyChildcare),l("spending.petrol","Petrol spending",(O=e.spending)==null?void 0:O.petrol,n.maxSpending),l("spending.diesel","Diesel spending",(P=e.spending)==null?void 0:P.diesel,n.maxSpending),l("spending.electricity","Electricity spending",(K=e.spending)==null?void 0:K.electricity,n.maxSpending,{optional:!0}),c.length===0?{ok:!0,issues:[]}:{ok:!1,issues:c}}function se(e,a){return V(e,a).ok}const{adultAge:C}=L,ae=e=>typeof e=="number"&&Number.isInteger(e)&&e>=C.min&&e<=C.max;function re(e,{year:a,policies:r,include:p=[],statePension:d}){const{head:n,partner:c,hasPartner:o}=e,g=e.children.map(u=>q(u.age)?{age:u.age,in_education:u.inEducation!==!1}:{age:u.age}),l=U(e.tenure);return{year:a,policies:[...r],household:{age:n.age,employment_income:n.employmentIncome,has_partner:!!o,...o||ae(c.age)?{partner_age:c.age}:{},partner_employment_income:o?c.employmentIncome:0,children:g,region:e.region,claims_universal_credit:!!e.claimsUniversalCredit,tenure:e.tenure,monthly_rent:l?j(e):0,dividend_income:n.dividendIncome,savings_interest_income:n.savingsInterestIncome,private_pension_income:n.privatePensionIncome??0,partner_private_pension_income:o?c.privatePensionIncome??0:0,property_income:n.propertyIncome,petrol_spending:e.spending.petrol,diesel_spending:e.spending.diesel,electricity_spending:e.spending.electricity??F.electricity,salary_sacrifice_pension_contributions:n.salarySacrificePensionContributions,student_loan_plan:n.studentLoanPlan,council_tax_band:e.councilTaxBand,monthly_childcare:g.length?e.monthlyChildcare:0,salary_year:e.salaryYear,...N(n.statePension)&&S(n.age,a,d)?{state_pension:n.statePension}:{},...o&&N(c.statePension)&&S(c.age,a,d)?{partner_state_pension:c.statePension}:{}},include:[...p]}}function j(e){return typeof e.monthlyRent=="number"&&Number.isFinite(e.monthlyRent)?e.monthlyRent:G(e.region)}exports.UK_AVERAGE_RENT=w;exports.UK_CHILD_AGE_MESSAGE=W;exports.UK_COUNCIL_TAX_BANDS=$;exports.UK_DEFAULT_SALARY=Q;exports.UK_DEFAULT_SALARY_NOTE=Z;exports.UK_DEFAULT_SOURCES=ne;exports.UK_DEFAULT_SPENDING=F;exports.UK_HOUSEHOLD_LIMITS=L;exports.UK_NEW_CHILD_AGE=te;exports.UK_OLDEST_CHILD_AGE=I;exports.UK_POLICY_YEARS=B;exports.UK_REGIONAL_RENT=y;exports.UK_REGIONS=R;exports.UK_RENTING_TENURES=f;exports.UK_SALARY_YEAR=z;exports.UK_STATE_PENSION=T;exports.UK_STUDENT_LOAN_PLANS=b;exports.UK_TENURES=D;exports.UK_YOUNG_PERSON_AGE=k;exports.asksEducation=q;exports.atStatePensionAge=S;exports.getRegionName=X;exports.isComplete=se;exports.isRenting=U;exports.isUKCouncilTaxBand=H;exports.isUKRegion=v;exports.isUKStudentLoanPlan=Y;exports.isUKTenure=x;exports.monthlyRentFor=j;exports.regionalRent=G;exports.regionalRentMonth=ee;exports.statePensionEntered=N;exports.statePensionFor=M;exports.toHouseholdImpactRequest=re;exports.validate=V;