@uselazuli/cli 0.0.0-stage → 1.0.2

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 (179) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/LICENSE +21 -0
  3. package/README.md +202 -2
  4. package/agents/lazuli-design-reviewer.md +30 -0
  5. package/agents/lazuli-first-look.md +22 -0
  6. package/agents/lazuli-task-tester.md +25 -0
  7. package/bin/lazuli.mjs +747 -0
  8. package/package.json +11 -4
  9. package/rules/accessibility/HYPOTHESES.md +8 -0
  10. package/rules/accessibility/_area.yaml +7 -0
  11. package/rules/accessibility/operable.yaml +100 -0
  12. package/rules/accessibility/perceivable.yaml +153 -0
  13. package/rules/accessibility/robust.yaml +24 -0
  14. package/rules/accessibility/understandable.yaml +72 -0
  15. package/rules/color/HYPOTHESES.md +27 -0
  16. package/rules/color/_area.yaml +10 -0
  17. package/rules/color/adapt.yaml +183 -0
  18. package/rules/color/create.yaml +259 -0
  19. package/rules/color/review.yaml +215 -0
  20. package/rules/color/signal.yaml +196 -0
  21. package/rules/content/HYPOTHESES.md +19 -0
  22. package/rules/content/_area.yaml +8 -0
  23. package/rules/content/review.yaml +378 -0
  24. package/rules/content/voice.yaml +144 -0
  25. package/rules/content/writing.yaml +202 -0
  26. package/rules/data/HYPOTHESES.md +11 -0
  27. package/rules/data/_area.yaml +7 -0
  28. package/rules/data/charts.yaml +189 -0
  29. package/rules/data/dashboards.yaml +141 -0
  30. package/rules/data/review.yaml +159 -0
  31. package/rules/graphic/HYPOTHESES.md +18 -0
  32. package/rules/graphic/_area.yaml +8 -0
  33. package/rules/graphic/identity.yaml +141 -0
  34. package/rules/graphic/pieces.yaml +164 -0
  35. package/rules/graphic/review.yaml +271 -0
  36. package/rules/graphic/symbol.yaml +141 -0
  37. package/rules/motion/HYPOTHESES.md +19 -0
  38. package/rules/motion/_area.yaml +7 -0
  39. package/rules/motion/micro.yaml +143 -0
  40. package/rules/motion/review.yaml +347 -0
  41. package/rules/motion/transitions.yaml +169 -0
  42. package/rules/typography/HYPOTHESES.md +12 -0
  43. package/rules/typography/_area.yaml +8 -0
  44. package/rules/typography/adapt.yaml +45 -0
  45. package/rules/typography/create.yaml +126 -0
  46. package/rules/typography/review.yaml +127 -0
  47. package/rules/ui/HYPOTHESES.md +23 -0
  48. package/rules/ui/_area.yaml +9 -0
  49. package/rules/ui/compose.yaml +246 -0
  50. package/rules/ui/grid.yaml +75 -0
  51. package/rules/ui/review.yaml +400 -0
  52. package/rules/ui/states.yaml +257 -0
  53. package/rules/ux/HYPOTHESES.md +13 -0
  54. package/rules/ux/_area.yaml +8 -0
  55. package/rules/ux/flows.yaml +164 -0
  56. package/rules/ux/forms.yaml +142 -0
  57. package/rules/ux/review.yaml +186 -0
  58. package/skills/lazuli/SKILL.md +183 -0
  59. package/skills/lazuli/procedures/create.md +29 -0
  60. package/skills/lazuli/procedures/explain-decisions.md +22 -0
  61. package/skills/lazuli/procedures/improve.md +30 -0
  62. package/skills/lazuli/procedures/remember-this.md +41 -0
  63. package/skills/lazuli/procedures/review-design.md +36 -0
  64. package/skills/lazuli/procedures/show-options.md +33 -0
  65. package/skills/lazuli-accessibility-check/SKILL.md +68 -0
  66. package/skills/lazuli-color-context-and-culture/SKILL.md +53 -0
  67. package/skills/lazuli-color-context-and-culture/references/sectors.md +26 -0
  68. package/skills/lazuli-color-palette-by-intent/SKILL.md +54 -0
  69. package/skills/lazuli-color-palette-by-intent/references/intent-chords.md +51 -0
  70. package/skills/lazuli-color-screen-review/SKILL.md +51 -0
  71. package/skills/lazuli-color-states-and-signals/SKILL.md +53 -0
  72. package/skills/lazuli-content-interface-writing/SKILL.md +53 -0
  73. package/skills/lazuli-content-voice/SKILL.md +40 -0
  74. package/skills/lazuli-data-charts-and-dashboards/SKILL.md +59 -0
  75. package/skills/lazuli-graphic-derived-pieces/SKILL.md +40 -0
  76. package/skills/lazuli-graphic-derived-pieces/references/piece-template.html +24 -0
  77. package/skills/lazuli-graphic-identity/SKILL.md +45 -0
  78. package/skills/lazuli-motion-micro-and-transitions/SKILL.md +49 -0
  79. package/skills/lazuli-typography-choose-and-pair/SKILL.md +50 -0
  80. package/skills/lazuli-typography-screen-review/SKILL.md +51 -0
  81. package/skills/lazuli-ui-composition/SKILL.md +42 -0
  82. package/skills/lazuli-ui-composition/references/option-template.html +34 -0
  83. package/skills/lazuli-ui-layout-review/SKILL.md +47 -0
  84. package/skills/lazuli-ui-states-and-system/SKILL.md +54 -0
  85. package/skills/lazuli-ux-flows-and-forms/SKILL.md +51 -0
  86. package/skills/lazuli-ux-task-test/SKILL.md +44 -0
  87. package/src/browser.mjs +162 -0
  88. package/src/commands/capture.mjs +313 -0
  89. package/src/commands/catalog.mjs +37 -0
  90. package/src/commands/check-design.mjs +463 -0
  91. package/src/commands/check-goals.mjs +57 -0
  92. package/src/commands/compare-designs.mjs +160 -0
  93. package/src/commands/draft-memo.mjs +162 -0
  94. package/src/commands/hooks.mjs +345 -0
  95. package/src/commands/install-hooks.mjs +120 -0
  96. package/src/commands/install.mjs +132 -0
  97. package/src/commands/list-rules.mjs +49 -0
  98. package/src/commands/map-page.mjs +594 -0
  99. package/src/commands/record-answers.mjs +79 -0
  100. package/src/commands/record-log.mjs +325 -0
  101. package/src/commands/record-task.mjs +250 -0
  102. package/src/commands/render-options.mjs +227 -0
  103. package/src/commands/start-project.mjs +32 -0
  104. package/src/measure/a11y.mjs +391 -0
  105. package/src/measure/asset.mjs +206 -0
  106. package/src/measure/at-rest.mjs +49 -0
  107. package/src/measure/cases.mjs +566 -0
  108. package/src/measure/chart-read.mjs +401 -0
  109. package/src/measure/chart.mjs +264 -0
  110. package/src/measure/coherence.mjs +145 -0
  111. package/src/measure/color.mjs +86 -0
  112. package/src/measure/content.mjs +82 -0
  113. package/src/measure/cvd.mjs +24 -0
  114. package/src/measure/extreme.mjs +241 -0
  115. package/src/measure/forms.mjs +150 -0
  116. package/src/measure/in-page/a11y.js +522 -0
  117. package/src/measure/in-page/color.js +348 -0
  118. package/src/measure/in-page/composition.js +1496 -0
  119. package/src/measure/in-page/contrast.js +15 -0
  120. package/src/measure/in-page/cvd.js +173 -0
  121. package/src/measure/in-page/extreme.js +377 -0
  122. package/src/measure/in-page/frames.js +781 -0
  123. package/src/measure/in-page/look.js +28 -0
  124. package/src/measure/in-page/motion-probe.js +171 -0
  125. package/src/measure/in-page/style.js +107 -0
  126. package/src/measure/in-page/svg-strokes.js +112 -0
  127. package/src/measure/in-page/svg-uses.js +50 -0
  128. package/src/measure/in-page/symbol.js +123 -0
  129. package/src/measure/in-page/type.js +269 -0
  130. package/src/measure/in-page/weight.js +207 -0
  131. package/src/measure/layout.mjs +100 -0
  132. package/src/measure/motion.mjs +509 -0
  133. package/src/measure/piece.mjs +195 -0
  134. package/src/measure/registry.mjs +253 -0
  135. package/src/measure/rhythm.mjs +81 -0
  136. package/src/measure/signature.mjs +65 -0
  137. package/src/measure/states.mjs +240 -0
  138. package/src/measure/style.mjs +13 -0
  139. package/src/measure/symbol.mjs +268 -0
  140. package/src/measure/terms.mjs +153 -0
  141. package/src/measure/tiles.mjs +20 -0
  142. package/src/measure/timeline.mjs +621 -0
  143. package/src/measure/type.mjs +167 -0
  144. package/src/measure/weight.mjs +18 -0
  145. package/src/private-strings.mjs +81 -0
  146. package/src/project/blind.mjs +70 -0
  147. package/src/project/edits.mjs +154 -0
  148. package/src/project/gate.mjs +168 -0
  149. package/src/project/lazuli-md.mjs +521 -0
  150. package/src/project/log.mjs +335 -0
  151. package/src/project/match.mjs +200 -0
  152. package/src/project/records.mjs +380 -0
  153. package/src/project/tasks.mjs +153 -0
  154. package/src/report/evaluate.mjs +27 -0
  155. package/src/report/evaluators/a11y.mjs +227 -0
  156. package/src/report/evaluators/chart.mjs +151 -0
  157. package/src/report/evaluators/coherence.mjs +103 -0
  158. package/src/report/evaluators/color.mjs +133 -0
  159. package/src/report/evaluators/content.mjs +112 -0
  160. package/src/report/evaluators/extreme.mjs +87 -0
  161. package/src/report/evaluators/forms.mjs +116 -0
  162. package/src/report/evaluators/layout.mjs +103 -0
  163. package/src/report/evaluators/motion.mjs +280 -0
  164. package/src/report/evaluators/piece.mjs +69 -0
  165. package/src/report/evaluators/rhythm.mjs +99 -0
  166. package/src/report/evaluators/states.mjs +39 -0
  167. package/src/report/evaluators/style.mjs +35 -0
  168. package/src/report/evaluators/symbol.mjs +110 -0
  169. package/src/report/evaluators/terms.mjs +49 -0
  170. package/src/report/evaluators/type.mjs +166 -0
  171. package/src/report/evaluators/weight.mjs +51 -0
  172. package/src/report/evidence.mjs +4 -0
  173. package/src/report/finding.mjs +11 -0
  174. package/src/report/format.mjs +215 -0
  175. package/src/rules/hypotheses.mjs +28 -0
  176. package/src/rules/load.mjs +274 -0
  177. package/src/rules/public-text.mjs +56 -0
  178. package/src/rules/schema.mjs +220 -0
  179. package/templates/LAZULI.md +88 -0
@@ -0,0 +1,150 @@
1
+ import fs from "node:fs/promises";
2
+ import { restOn, restOff } from "./at-rest.mjs";
3
+ import { describeControls } from "./states.mjs";
4
+
5
+ let composition;
6
+
7
+ const plural = (n, one, many) => (n === 1 ? one : many);
8
+
9
+ // Definitions, not cutoffs (fixed before any site was read). Autocomplete is
10
+ // checked on every field but the ones that take no typed or chosen value about the person (a box to tick,
11
+ // a file, a slider, a color); a keyboard is checked only on fields that open one when typed into.
12
+ const NO_AUTOFILL = new Set(["checkbox", "radio", "file", "range", "color"]);
13
+ const KEYBOARD = new Set(["text", "search", "email", "tel", "url", "number", "password"]);
14
+ const takesAutofill = (f) => !NO_AUTOFILL.has(f.type);
15
+ const opensKeyboard = (f) => f.tag === "textarea" || (f.tag === "input" && KEYBOARD.has(f.type));
16
+ // Accepted autocomplete tokens per purpose: the purpose token and its equivalents.
17
+ const ACCEPTED = {
18
+ "street-address": ["street-address", "address-line1"],
19
+ name: ["name", "given-name", "family-name"],
20
+ tel: ["tel", "tel-national"],
21
+ bday: ["bday", "bday-day", "bday-month", "bday-year"],
22
+ };
23
+ const acceptedFor = (purpose) => ACCEPTED[purpose] ?? [purpose];
24
+ // The keyboard each kind of data needs, by type or inputmode.
25
+ const KEYBOARDS = {
26
+ email: { types: ["email"], modes: ["email"] },
27
+ tel: { types: ["tel"], modes: ["tel"] },
28
+ numeric: { types: ["number", "tel"], modes: ["numeric", "decimal", "tel"] },
29
+ };
30
+ const keyboardFor = (f) => (f.purpose === "email" ? "email" : f.purpose === "tel" ? "tel" : f.numeric ? "numeric" : null);
31
+ // Where a field's only name comes from, when no label is seen.
32
+ const SOURCE = { placeholder: "placeholder alone", "aria-label": "aria-label alone", title: "title alone", label: "hidden label", labelledby: "hidden aria-labelledby text" };
33
+
34
+ export const NO_FIELD_NOTE = "No visible form field on this page.";
35
+ export const NO_INVALID_NOTE = "No field is marked invalid in this render; error recovery needs a staged error render (the CLI never submits a form).";
36
+ // The reader's group for fields outside any form.
37
+ export const OUTSIDE = "(fields outside a form)";
38
+
39
+ // Questions of one form for the required check: each field once, the radios or checkboxes of one group
40
+ // once (required when any of them is, marked as the first marked one). A group's mark written on its
41
+ // legend is not read.
42
+ function questionsOf(fields) {
43
+ const out = [];
44
+ const groups = new Map();
45
+ for (const f of fields) {
46
+ if (f.group === null) {
47
+ out.push({ name: f.name, required: f.required, marked: f.marked });
48
+ continue;
49
+ }
50
+ const q = groups.get(f.group);
51
+ if (q) {
52
+ q.required ||= f.required;
53
+ q.marked ??= f.marked;
54
+ continue;
55
+ }
56
+ const fresh = { name: f.name, required: f.required, marked: f.marked };
57
+ groups.set(f.group, fresh);
58
+ out.push(fresh);
59
+ }
60
+ return out;
61
+ }
62
+
63
+ // Forms read at rest, never filled, clicked or submitted: visible labels, autocomplete tokens, keyboards,
64
+ // required marks, error links and questions per form. The only page writes are the at-rest style and
65
+ // its removal.
66
+ export async function measureForms(page) {
67
+ composition ??= await fs.readFile(new URL("./in-page/composition.js", import.meta.url), "utf8");
68
+ let raw;
69
+ try {
70
+ await page.evaluate(restOn());
71
+ raw = await page.evaluate(`(${composition})(${JSON.stringify({ read: "forms", keepPinned: true })})`);
72
+ } finally {
73
+ await page.evaluate(restOff()).catch(() => {});
74
+ }
75
+
76
+ // Copies named for the report, so the reader's Field.name is never overwritten.
77
+ const all = raw.forms.flatMap((form) => form.fields.map((field) => ({ field, kind: "field", label: field.name, selector: field.selector })));
78
+ describeControls(all);
79
+ const nameOf = new Map(all.map((c) => [c.field, c.name]));
80
+ const fields = all.map((c) => ({ ...c.field, name: c.name, named: c.field.name !== "" }));
81
+ const notes = [...raw.notes];
82
+
83
+ // Nameless fields belong to AR1 (the accessibility tree); they are out of this list.
84
+ const unlabeled = fields.filter((f) => f.named && !f.visibleLabel);
85
+ const labelSource = Object.fromEntries(unlabeled.map((f) => [f.name, SOURCE[f.nameFrom] ?? f.nameFrom]));
86
+
87
+ const autofill = fields.filter((f) => f.purpose !== null && takesAutofill(f));
88
+ const missing = autofill
89
+ .filter((f) => {
90
+ const tokens = f.autocomplete.split(/\s+/).filter(Boolean);
91
+ return f.autocomplete === "" || f.autocomplete === "off" || !acceptedFor(f.purpose).some((t) => tokens.includes(t));
92
+ })
93
+ .map((f) => ({ field: f.name, expected: f.purpose, found: f.autocomplete }));
94
+
95
+ const keyed = fields.filter((f) => opensKeyboard(f) && keyboardFor(f) !== null);
96
+ const mismatched = keyed
97
+ .filter((f) => {
98
+ const k = KEYBOARDS[keyboardFor(f)];
99
+ return !k.types.includes(f.type) && !k.modes.includes(f.inputmode);
100
+ })
101
+ .map((f) => ({ field: f.name, purpose: keyboardFor(f) }));
102
+
103
+ // Required marks: only in a form that has both required and optional questions; a field marked
104
+ // required that the form does not require is listed whatever the form.
105
+ let checked = 0;
106
+ const unmarked = [];
107
+ for (const form of raw.forms) {
108
+ if (form.selector === OUTSIDE) continue;
109
+ const qs = questionsOf(form.fields.map((f) => ({ ...f, name: nameOf.get(f) })));
110
+ const req = qs.filter((q) => q.required);
111
+ const opt = qs.filter((q) => !q.required);
112
+ if (!req.length || !opt.length) continue;
113
+ checked += 1;
114
+ if (req.every((q) => q.marked === "required") || opt.every((q) => q.marked === "optional")) continue;
115
+ unmarked.push(...req.filter((q) => q.marked !== "required").map((q) => q.name));
116
+ }
117
+ const required = {
118
+ checked,
119
+ // Fields marked required, each set against whether the form requires it (markedNotRequired).
120
+ marked: fields.filter((f) => f.marked === "required").length,
121
+ unmarked,
122
+ markedNotRequired: fields.filter((f) => f.marked === "required" && !f.required).map((f) => f.name),
123
+ };
124
+
125
+ const invalid = fields.filter((f) => f.invalid);
126
+ const errors = { checked: invalid.length, unlinked: invalid.filter((f) => f.errorText === null).map((f) => f.name) };
127
+
128
+ const unnamed = fields.filter((f) => !f.named).length;
129
+ if (fields.length === 0) notes.push(NO_FIELD_NOTE);
130
+ if (unnamed > 0) notes.push(`${unnamed} ${plural(unnamed, "field has no name at all; AR1 reports it.", "fields have no name at all; AR1 reports them.")}`);
131
+ if (errors.checked === 0) notes.push(NO_INVALID_NOTE);
132
+ const outside = raw.forms.find((f) => f.selector === OUTSIDE);
133
+ if (outside) {
134
+ const n = outside.fields.length;
135
+ notes.push(`${n} ${plural(n, "field outside a form was", "fields outside a form were")} not counted as one form.`);
136
+ }
137
+
138
+ return {
139
+ forms: raw.forms.map((f) => ({ selector: f.selector, questions: f.questions, fields: f.fields.length })),
140
+ fields: fields.length,
141
+ unnamed,
142
+ unlabeled: unlabeled.map((f) => f.name),
143
+ labelSource,
144
+ autocomplete: { checked: autofill.length, missing },
145
+ inputMode: { checked: keyed.length, mismatched },
146
+ required,
147
+ errors,
148
+ notes,
149
+ };
150
+ }
@@ -0,0 +1,522 @@
1
+ // Evaluated inside the page as a function expression: (opts) => report parts.
2
+ // Plain script, no imports. opts: { globalKey, minPx (number or null), maxTargets, clipGrow, helpersOnly,
3
+ // minSidePx (number or null), maxImages }.
4
+ // Leaves { selectorOf, infoOf, focusProbe, blurFocus, focusClip, refocus, reflowProbe, spacingProbe } on
5
+ // globalThis[opts.globalKey] so Node can describe the elements the accessibility tree points at and
6
+ // run the keyboard, reflow and text spacing passes; the caller deletes it. With helpersOnly it returns
7
+ // null right after installing them.
8
+ (opts) => {
9
+ const LETTER = /\p{L}/u;
10
+ const SKIP_TAGS = /^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE)$/;
11
+ const TARGET_SEL = "a[href], button, input:not([type=hidden]), select, textarea, [role=button], [role=link], [role=checkbox], [role=radio], [role=tab], [role=menuitem]";
12
+ const round = (n, d = 1) => Math.round(n * 10 ** d) / 10 ** d;
13
+ const norm = (s) => (s || "").replace(/\s+/g, " ").trim();
14
+ const clip = (s, n = 80) => (s.length > n ? `${s.slice(0, n - 3)}...` : s);
15
+
16
+ const selectorOf = (el) => {
17
+ const tag = el.tagName.toLowerCase();
18
+ if (el.id) return `${tag}#${CSS.escape(el.id)}`;
19
+ const first = (el.getAttribute("class") || "").split(/\s+/).find(Boolean);
20
+ return first ? `${tag}.${CSS.escape(first)}` : tag;
21
+ };
22
+ const infoOf = (el) => ({
23
+ selector: selectorOf(el),
24
+ src: el.currentSrc || el.getAttribute("src") || "",
25
+ decorative: el.getAttribute("alt") === "" || /^(presentation|none)$/.test(el.getAttribute("role") || ""),
26
+ isImage: el.tagName === "IMG" || el.getAttribute("role") === "img",
27
+ });
28
+ const labelOf = (el) =>
29
+ clip(norm(el.getAttribute("aria-label") || el.textContent || el.getAttribute("title") || el.getAttribute("value") || ""), 40);
30
+ const api = { selectorOf, infoOf };
31
+ globalThis[opts.globalKey] = api;
32
+
33
+ // Visually hidden boxes (sr-only, skip links) are not targets a pointer reaches.
34
+ const HIDDEN_CLIP = /^(rect\(0(px)?,? 0(px)?,? 0(px)?,? 0(px)?\)|inset\(\s*(?:(?:50|100)%\s*)+\))/;
35
+ const hiddenByBox = (el) => {
36
+ for (let e = el; e && e !== document.body && e !== document.documentElement; e = e.parentElement) {
37
+ const s = getComputedStyle(e);
38
+ const r = e.getBoundingClientRect();
39
+ const clips = s.overflowX !== "visible" || s.overflowY !== "visible";
40
+ if (clips && r.width <= 1 && r.height <= 1) return true;
41
+ if (s.clip !== "auto" && HIDDEN_CLIP.test(s.clip)) return true;
42
+ if (s.clipPath !== "none" && HIDDEN_CLIP.test(s.clipPath)) return true;
43
+ }
44
+ return false;
45
+ };
46
+ const visibleRect = (el) => {
47
+ const r = el.getBoundingClientRect();
48
+ if (!r.width || !r.height || hiddenByBox(el)) return null;
49
+ if (typeof el.checkVisibility === "function") {
50
+ return el.checkVisibility({ opacityProperty: true, visibilityProperty: true }) ? r : null;
51
+ }
52
+ for (let e = el; e; e = e.parentElement) {
53
+ const s = getComputedStyle(e);
54
+ if (s.display === "none" || s.visibility === "hidden" || parseFloat(s.opacity) === 0) return null;
55
+ }
56
+ return r;
57
+ };
58
+
59
+ // ---- Keyboard focus: one probe per Tab press, run from Node. ----
60
+ const deepActive = () => {
61
+ let a = document.activeElement;
62
+ while (a && a.shadowRoot && a.shadowRoot.activeElement) a = a.shadowRoot.activeElement;
63
+ return a;
64
+ };
65
+ const insideOf = (el, node) => {
66
+ for (let n = node; n; n = n.parentNode || n.host) if (n === el) return true;
67
+ return false;
68
+ };
69
+ const deepElementAt = (x, y) => {
70
+ let hit = document.elementFromPoint(x, y);
71
+ while (hit && hit.shadowRoot) {
72
+ const inner = hit.shadowRoot.elementFromPoint(x, y);
73
+ if (!inner || inner === hit) break;
74
+ hit = inner;
75
+ }
76
+ return hit;
77
+ };
78
+ const focusState = { seen: new WeakSet(), last: null, snap: null };
79
+ // What can draw a focus indicator: outline, shadow, border and background, on a box or its ::before/::after.
80
+ // A line that is not drawn (style none or zero width) counts as absent, whatever its color or offset.
81
+ const lineSig = (s, p) =>
82
+ s[`${p}Style`] === "none" || s[`${p}Style`] === "hidden" || parseFloat(s[`${p}Width`]) === 0
83
+ ? "none"
84
+ : [s[`${p}Style`], s[`${p}Width`], s[`${p}Color`], p === "outline" ? s.outlineOffset : ""].join(" ");
85
+ const sigOf = (el, pseudo) => {
86
+ const s = getComputedStyle(el, pseudo);
87
+ const parts = [
88
+ lineSig(s, "outline"), s.boxShadow, lineSig(s, "borderTop"), lineSig(s, "borderRight"), lineSig(s, "borderBottom"), lineSig(s, "borderLeft"),
89
+ s.backgroundColor, s.backgroundImage,
90
+ ];
91
+ if (pseudo) parts.push(s.content, s.display, s.opacity);
92
+ return parts.join("|");
93
+ };
94
+ // The element and its ancestors below body, with the styles that could carry its indicator.
95
+ const ringSnapshot = (el) => {
96
+ const list = [];
97
+ for (let e = el; e && e !== document.body && e !== document.documentElement; e = e.parentElement) {
98
+ list.push({ e, box: sigOf(e), before: sigOf(e, "::before"), after: sigOf(e, "::after") });
99
+ }
100
+ return list;
101
+ };
102
+ // The containing block of an absolutely positioned box inside `el` (el included): the nearest positioned
103
+ // or transformed one, else the viewport.
104
+ const containingBlock = (el) => {
105
+ for (let e = el; e && e !== document.body && e !== document.documentElement; e = e.parentElement) {
106
+ const s = getComputedStyle(e);
107
+ if (s.position !== "static" || s.transform !== "none") return e.getBoundingClientRect();
108
+ }
109
+ return null;
110
+ };
111
+ // kind: none (nothing but the page has focus), same (focus did not move), seen (back on an element
112
+ // already visited), new (first visit: carries the clip to compare and whether it is entirely covered).
113
+ api.focusProbe = () => {
114
+ const el = deepActive();
115
+ if (!el || el === document.body || el === document.documentElement) return { kind: "none" };
116
+ // Focus inside a frame: the page only sees the frame element, and Tab moves through its controls.
117
+ if (el.tagName === "IFRAME" || el.tagName === "FRAME") return { kind: "frame" };
118
+ const same = el === focusState.last;
119
+ const seen = focusState.seen.has(el);
120
+ focusState.last = el;
121
+ focusState.seen.add(el);
122
+ const out = { kind: same ? "same" : seen ? "seen" : "new", selector: selectorOf(el), label: labelOf(el), clip: null, obscured: false };
123
+ if (out.kind !== "new") return out;
124
+ const r = el.getBoundingClientRect();
125
+ const s = getComputedStyle(el);
126
+ // A box too small to see, fully transparent or visually hidden (the indicator sits on a sibling): not judged.
127
+ if (r.width < 1 || r.height < 1 || parseFloat(s.opacity) === 0 || hiddenByBox(el)) return out;
128
+ const vw = document.documentElement.clientWidth;
129
+ const vh = innerHeight;
130
+ const x0 = Math.max(0, Math.floor(r.left - opts.clipGrow));
131
+ const y0 = Math.max(0, Math.floor(r.top - opts.clipGrow));
132
+ const x1 = Math.min(vw, Math.ceil(r.right + opts.clipGrow));
133
+ const y1 = Math.min(vh, Math.ceil(r.bottom + opts.clipGrow));
134
+ if (x1 > x0 && y1 > y0) {
135
+ out.clip = { x: x0, y: y0, width: x1 - x0, height: y1 - y0 };
136
+ focusState.snap = { el, list: ringSnapshot(el) };
137
+ }
138
+ if (s.pointerEvents === "none") return out;
139
+ // Nine points: corners (1 px inside), edge midpoints, centre. Points outside the viewport are not tested.
140
+ const inX = r.width >= 3 ? 1 : 0;
141
+ const inY = r.height >= 3 ? 1 : 0;
142
+ const xs = [r.left + inX, (r.left + r.right) / 2, r.right - inX];
143
+ const ys = [r.top + inY, (r.top + r.bottom) / 2, r.bottom - inY];
144
+ const labels = el.labels ? [...el.labels] : [];
145
+ let tested = 0;
146
+ let shown = 0;
147
+ for (const x of xs) {
148
+ for (const y of ys) {
149
+ if (x < 0 || y < 0 || x >= vw || y >= vh) continue;
150
+ tested += 1;
151
+ const hit = deepElementAt(x, y);
152
+ if (hit && (insideOf(el, hit) || labels.some((l) => insideOf(l, hit)))) shown += 1;
153
+ }
154
+ }
155
+ out.obscured = tested > 0 && shown === 0;
156
+ return out;
157
+ };
158
+ // Moves focus off the current element and back, so the same box can be pictured without it.
159
+ api.blurFocus = () => {
160
+ const el = deepActive();
161
+ if (el && el !== document.body) el.blur();
162
+ };
163
+ // Called with focus moved off: the clip of the last new stop, grown to the nearest box (the element or an
164
+ // ancestor) whose indicator styles changed with focus, or to the containing block of a positioned
165
+ // ::before/::after that changed (a stretched link's ring). Capped at the viewport. Null without a stop.
166
+ api.focusClip = ({ clip }) => {
167
+ const snap = focusState.snap;
168
+ if (!snap || !snap.el.isConnected) return clip;
169
+ let region = null;
170
+ for (const { e, box, before, after } of snap.list) {
171
+ if (!e.isConnected) continue;
172
+ if (sigOf(e) !== box) {
173
+ region = e.getBoundingClientRect();
174
+ break;
175
+ }
176
+ const pseudo = sigOf(e, "::before") !== before ? "::before" : sigOf(e, "::after") !== after ? "::after" : null;
177
+ if (pseudo) {
178
+ const pos = getComputedStyle(e, pseudo).position;
179
+ region = pos === "fixed" ? null : pos === "absolute" ? containingBlock(e) : e.getBoundingClientRect();
180
+ if (pos === "fixed" || (pos === "absolute" && !region)) region = { left: 0, top: 0, right: Infinity, bottom: Infinity };
181
+ break;
182
+ }
183
+ }
184
+ if (!region) return clip;
185
+ const vw = document.documentElement.clientWidth;
186
+ const vh = innerHeight;
187
+ const x0 = Math.max(0, Math.floor(Math.min(clip.x, region.left - opts.clipGrow)));
188
+ const y0 = Math.max(0, Math.floor(Math.min(clip.y, region.top - opts.clipGrow)));
189
+ const x1 = Math.min(vw, Math.ceil(Math.max(clip.x + clip.width, region.right + opts.clipGrow)));
190
+ const y1 = Math.min(vh, Math.ceil(Math.max(clip.y + clip.height, region.bottom + opts.clipGrow)));
191
+ return x1 > x0 && y1 > y0 ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : clip;
192
+ };
193
+ api.refocus = () => {
194
+ if (focusState.last && focusState.last.isConnected) focusState.last.focus({ preventScroll: true });
195
+ };
196
+
197
+ // ---- Reflow (WCAG 1.4.10) ----
198
+ const EXEMPT_2D = "table, pre, code, canvas, svg, video, iframe, img, [role=img], [role=application]";
199
+ // A box that clips its content and itself fits inside the width keeps the page from scrolling sideways.
200
+ const clippedWithin = (el, width) => {
201
+ for (let p = el.parentElement; p; p = p.parentElement) {
202
+ if (p === document.body || p === document.documentElement) break;
203
+ if (getComputedStyle(p).overflowX !== "visible" && p.getBoundingClientRect().right <= width + 0.5) return true;
204
+ }
205
+ return false;
206
+ };
207
+ api.reflowProbe = ({ width, maxScanned }) => {
208
+ const all = document.querySelectorAll("*");
209
+ const scanned = Math.min(all.length, maxScanned);
210
+ const over = new Set();
211
+ for (let i = 0; i < scanned; i += 1) {
212
+ const el = all[i];
213
+ const r = el.getBoundingClientRect();
214
+ if ((r.width === 0 && r.height === 0) || r.right <= width + 0.5) continue;
215
+ if (el.closest(EXEMPT_2D) || clippedWithin(el, width)) continue;
216
+ // Content nobody can see or reach (a closed off-canvas drawer) does not make anyone scroll sideways.
217
+ if (el.closest("[inert], [aria-hidden=true]")) continue;
218
+ if (typeof el.checkVisibility === "function" && !el.checkVisibility({ opacityProperty: true, visibilityProperty: true })) continue;
219
+ over.add(el);
220
+ }
221
+ // The outermost box of each run of offenders, once per selector.
222
+ const offenders = [];
223
+ for (const el of over) {
224
+ if (!over.has(el.parentElement)) {
225
+ const sel = selectorOf(el);
226
+ if (!offenders.includes(sel)) offenders.push(sel);
227
+ }
228
+ }
229
+ return { scrollWidth: document.documentElement.scrollWidth, offenders, scanned, total: all.length };
230
+ };
231
+
232
+ // ---- Text spacing (WCAG 1.4.12) ----
233
+ const rectsMeet = (a, b) => Math.min(a.right, b.right) - Math.max(a.left, b.left) > 1 && Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top) > 1;
234
+ // The area the element's text can show in: cut by the element itself and every ancestor that clips
235
+ // (overflow other than visible; html and body excepted). Text spilling out of a box that does not clip stays.
236
+ const clipArea = (el) => {
237
+ const box = { left: -Infinity, top: -Infinity, right: Infinity, bottom: Infinity };
238
+ for (let p = el; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {
239
+ const s = getComputedStyle(p);
240
+ if (s.overflowX === "visible" && s.overflowY === "visible") continue;
241
+ const pr = p.getBoundingClientRect();
242
+ if (s.overflowX !== "visible") {
243
+ box.left = Math.max(box.left, pr.left);
244
+ box.right = Math.min(box.right, pr.right);
245
+ }
246
+ if (s.overflowY !== "visible") {
247
+ box.top = Math.max(box.top, pr.top);
248
+ box.bottom = Math.min(box.bottom, pr.bottom);
249
+ }
250
+ }
251
+ return box;
252
+ };
253
+ // The part of the box an ancestor with overflow other than visible does not cut away (html and body excepted).
254
+ const visibleBox = (el) => {
255
+ const r = el.getBoundingClientRect();
256
+ const a = clipArea(el.parentElement);
257
+ return { left: Math.max(r.left, a.left), top: Math.max(r.top, a.top), right: Math.min(r.right, a.right), bottom: Math.min(r.bottom, a.bottom) };
258
+ };
259
+ // A box laid out in the normal flow: neither it nor an ancestor is absolute, fixed, sticky or transformed.
260
+ // Out-of-flow boxes (a designed card deck, a carousel slide) are placed on purpose and may overlap.
261
+ const IDENTITY = /^matrix\(1, 0, 0, 1, 0, 0\)$/;
262
+ const flowMemo = new Map();
263
+ const inFlow = (el) => {
264
+ if (!el || el === document.body || el === document.documentElement) return true;
265
+ if (flowMemo.has(el)) return flowMemo.get(el);
266
+ const s = getComputedStyle(el);
267
+ const moved = (s.transform !== "none" && !IDENTITY.test(s.transform)) || s.translate !== "none" || s.rotate !== "none" || s.scale !== "none";
268
+ const own = !/^(absolute|fixed|sticky)$/.test(s.position) && !moved;
269
+ const v = own && inFlow(el.parentElement);
270
+ flowMemo.set(el, v);
271
+ return v;
272
+ };
273
+ // The rects of the element's own text (its direct text nodes), cut to the area it can show in.
274
+ const textRects = (el) => {
275
+ const box = clipArea(el);
276
+ const out = [];
277
+ for (const c of el.childNodes) {
278
+ if (c.nodeType !== Node.TEXT_NODE || !LETTER.test(c.nodeValue)) continue;
279
+ const range = document.createRange();
280
+ range.selectNodeContents(c);
281
+ for (const r of range.getClientRects()) {
282
+ const cut = { left: Math.max(r.left, box.left), top: Math.max(r.top, box.top), right: Math.min(r.right, box.right), bottom: Math.min(r.bottom, box.bottom) };
283
+ if (cut.right - cut.left > 0 && cut.bottom - cut.top > 0) out.push(cut);
284
+ }
285
+ }
286
+ return out;
287
+ };
288
+ const boundsOf = (rects) =>
289
+ rects.length === 0
290
+ ? null
291
+ : rects.reduce((a, r) => ({ left: Math.min(a.left, r.left), top: Math.min(a.top, r.top), right: Math.max(a.right, r.right), bottom: Math.max(a.bottom, r.bottom) }));
292
+ api.spacingProbe = ({ css, maxScanned, maxBlocks }) => {
293
+ const all = document.querySelectorAll("body *");
294
+ const scanned = Math.min(all.length, maxScanned);
295
+ const clippers = [];
296
+ const blocks = [];
297
+ let totalBlocks = 0;
298
+ for (let i = 0; i < scanned; i += 1) {
299
+ const el = all[i];
300
+ if (SKIP_TAGS.test(el.tagName)) continue;
301
+ const s = getComputedStyle(el);
302
+ if (s.display === "none") continue;
303
+ const ariaHidden = Boolean(el.closest("[aria-hidden=true]"));
304
+ if (!ariaHidden && (/^(hidden|clip)$/.test(s.overflowX) || /^(hidden|clip)$/.test(s.overflowY)) && LETTER.test(el.textContent)) clippers.push(el);
305
+ // Only blocks that have a box now: one inside a collapsed or hidden ancestor has none, and would
306
+ // "appear" as an overlap when the style change reflows the page.
307
+ // Flow blocks only: not inline, in the normal flow, not in an aria-hidden subtree (a duplicated ticker list).
308
+ if (s.display !== "inline" && s.visibility !== "hidden" && !ariaHidden && inFlow(el) && [...el.childNodes].some((c) => c.nodeType === Node.TEXT_NODE && LETTER.test(c.nodeValue))) {
309
+ const r = visibleBox(el);
310
+ if (r.right - r.left > 0 && r.bottom - r.top > 0 && (typeof el.checkVisibility !== "function" || el.checkVisibility({ visibilityProperty: true }))) {
311
+ totalBlocks += 1;
312
+ if (blocks.length < maxBlocks) blocks.push(el);
313
+ }
314
+ }
315
+ }
316
+ const overflows = (el) => el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1;
317
+ const snap = () => {
318
+ const text = blocks.map(textRects);
319
+ return { over: clippers.map(overflows), boxes: blocks.map(visibleBox), text, bounds: text.map(boundsOf) };
320
+ };
321
+ const before = snap();
322
+ const style = document.createElement("style");
323
+ style.textContent = css;
324
+ document.head.appendChild(style);
325
+ const after = snap();
326
+ const clipped = clippers
327
+ .map((el, i) => ({ el, i }))
328
+ .filter(({ i }) => !before.over[i] && after.over[i])
329
+ .map(({ el }) => ({ selector: selectorOf(el), text: clip(norm(el.textContent), 40) }));
330
+ const overlapped = [];
331
+ for (let i = 0; i < blocks.length; i += 1) {
332
+ for (let j = i + 1; j < blocks.length; j += 1) {
333
+ if (blocks[i].contains(blocks[j]) || blocks[j].contains(blocks[i])) continue;
334
+ // Pairs whose boxes already met before the override are a layout choice, not a spacing failure.
335
+ // After it, the text itself must meet: lines of one block over lines of the other.
336
+ const bi = after.bounds[i];
337
+ const bj = after.bounds[j];
338
+ if (!bi || !bj || !rectsMeet(bi, bj) || rectsMeet(before.boxes[i], before.boxes[j])) continue;
339
+ if (after.text[i].some((a) => after.text[j].some((b) => rectsMeet(a, b)))) {
340
+ overlapped.push({ selector: `${selectorOf(blocks[i])} and ${selectorOf(blocks[j])}`, text: clip(norm(blocks[i].textContent), 40) });
341
+ }
342
+ }
343
+ }
344
+ return { clipped, overlapped, scanned, total: all.length, totalBlocks, blocks: blocks.length };
345
+ };
346
+
347
+ // Helpers only: another page of the same document gets the probes without the page-wide measurements.
348
+ if (opts.helpersOnly) return null;
349
+
350
+ const headings = [];
351
+ for (const h of document.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]")) {
352
+ // Only what takes a heading out of the outline hides it: display none, visibility hidden, aria-hidden.
353
+ // A visually hidden (sr-only) heading is still a heading.
354
+ if (h.closest("[aria-hidden=true]")) continue;
355
+ if (typeof h.checkVisibility === "function" ? !h.checkVisibility({ visibilityProperty: true }) : getComputedStyle(h).display === "none") continue;
356
+ const level = /^H[1-6]$/.test(h.tagName) ? Number(h.tagName[1]) : Number(h.getAttribute("aria-level")) || 2;
357
+ headings.push({ level, text: clip(norm(h.textContent)) });
358
+ }
359
+
360
+ // A link in a sentence: it is display inline, and the text of its own line context has letters
361
+ // outside any control. That text is the block's own text nodes plus those of inline descendants;
362
+ // nested block-level children are other line contexts and do not count.
363
+ const inSentence = (el) => {
364
+ if (el.tagName !== "A" || getComputedStyle(el).display !== "inline") return false;
365
+ let block = el.parentElement;
366
+ while (block && getComputedStyle(block).display === "inline") block = block.parentElement;
367
+ if (!block) return false;
368
+ const hasWords = (node) => {
369
+ for (const child of node.childNodes) {
370
+ if (child.nodeType === Node.TEXT_NODE) {
371
+ if (LETTER.test(child.nodeValue)) return true;
372
+ } else if (child.nodeType === Node.ELEMENT_NODE) {
373
+ if (child === el || SKIP_TAGS.test(child.tagName) || child.matches(TARGET_SEL)) continue;
374
+ if (getComputedStyle(child).display === "inline" && hasWords(child)) return true;
375
+ }
376
+ }
377
+ return false;
378
+ };
379
+ return hasWords(block);
380
+ };
381
+ // True when the author gave the control a size: width or height attribute, inline style, or a matching style rule.
382
+ const given = (v) => Boolean(v) && v !== "auto";
383
+ const authorSized = (el) => {
384
+ if (el.hasAttribute("width") || el.hasAttribute("height") || given(el.style.width) || given(el.style.height)) return true;
385
+ const visit = (rules) => {
386
+ for (const rule of rules) {
387
+ // A style rule has an (empty) cssRules list too, so test for the style first.
388
+ if (rule.style && rule.selectorText) {
389
+ if (given(rule.style.width) || given(rule.style.height)) {
390
+ try {
391
+ if (el.matches(rule.selectorText)) return true;
392
+ } catch { /* a selector this browser cannot parse */ }
393
+ }
394
+ }
395
+ if (rule.cssRules && rule.cssRules.length > 0 && (!rule.media || matchMedia(rule.media.mediaText).matches)) {
396
+ if (visit(rule.cssRules)) return true;
397
+ }
398
+ }
399
+ return false;
400
+ };
401
+ for (const sheet of document.styleSheets) {
402
+ let rules;
403
+ try {
404
+ rules = sheet.cssRules;
405
+ } catch {
406
+ continue; // a cross-origin sheet that cannot be read
407
+ }
408
+ if (visit(rules)) return true;
409
+ }
410
+ return false;
411
+ };
412
+
413
+ const circleHitsBox = (cx, cy, r, b) => {
414
+ const dx = Math.max(b.left - cx, 0, cx - b.right);
415
+ const dy = Math.max(b.top - cy, 0, cy - b.bottom);
416
+ return dx * dx + dy * dy < r * r;
417
+ };
418
+
419
+ let targets = [];
420
+ let totalTargets = 0;
421
+ if (Number.isFinite(opts.minPx) && opts.minPx > 0) {
422
+ const min = opts.minPx;
423
+ const all = [];
424
+ for (const el of document.querySelectorAll(TARGET_SEL)) {
425
+ if (el.disabled || el.getAttribute("aria-disabled") === "true") continue;
426
+ const r = visibleRect(el);
427
+ if (!r) continue;
428
+ totalTargets += 1;
429
+ if (all.length >= opts.maxTargets) continue;
430
+ all.push({ el, r });
431
+ }
432
+ const small = all.filter(({ el, r }) => {
433
+ if (r.width >= min && r.height >= min) return false;
434
+ // A native checkbox or radio keeps its size from the browser (user agent control exception),
435
+ // unless the author set its width or height.
436
+ if (el.tagName === "INPUT" && /^(checkbox|radio)$/.test(el.type) && getComputedStyle(el).appearance !== "none" && !authorSized(el)) return false;
437
+ return !inSentence(el);
438
+ });
439
+ const smallSet = new Set(small.map((s) => s.el));
440
+ const centre = (r) => ({ x: r.left + r.width / 2, y: r.top + r.height / 2 });
441
+ targets = small
442
+ .filter(({ el, r }) => {
443
+ const c = centre(r);
444
+ // The spacing exception: a circle of min px on this box meets no other target's box and no other undersized target's circle.
445
+ const clear = all.every((o) => {
446
+ if (o.el === el || o.el.contains(el) || el.contains(o.el)) return true;
447
+ if (circleHitsBox(c.x, c.y, min / 2, o.r)) return false;
448
+ if (smallSet.has(o.el)) {
449
+ const oc = centre(o.r);
450
+ if (Math.hypot(oc.x - c.x, oc.y - c.y) < min) return false;
451
+ }
452
+ return true;
453
+ });
454
+ return !clear;
455
+ })
456
+ .map(({ el, r }) => ({ selector: selectorOf(el), label: labelOf(el), w: round(r.width), h: round(r.height) }));
457
+ }
458
+
459
+ // Visible img elements with both rendered sides at least minSidePx (from the rule data), and whether each is
460
+ // marked decorative: alt="", role presentation or none, or inside an aria-hidden subtree. Off without the cutoff.
461
+ // treatment (opts.treatment: { filters, blends } from the CR14 rule data, or null): the color-changing filter
462
+ // functions of the image or an ancestor up to its nearest section, article or body, and its mix-blend-mode
463
+ // when not normal, as one text; null when none.
464
+ // The identity value of each color filter function (CSS Filter Effects: the function leaves the image as it
465
+ // is); an omitted argument is the function's default, never the identity except for hue-rotate. url() always
466
+ // counts.
467
+ const FILTER_IDENTITY = { grayscale: 0, sepia: 0, invert: 0, saturate: 1, contrast: 1, brightness: 1, "hue-rotate": 0 };
468
+ const identity = (name, arg) => {
469
+ if (!(name in FILTER_IDENTITY)) return false;
470
+ const a = arg.trim();
471
+ if (a === "") return name === "hue-rotate";
472
+ const n = parseFloat(a);
473
+ if (!Number.isFinite(n)) return false;
474
+ return (a.endsWith("%") ? n / 100 : n) === FILTER_IDENTITY[name];
475
+ };
476
+ const treatmentOf = (el) => {
477
+ const rule = opts.treatment;
478
+ if (!rule || !Array.isArray(rule.filters)) return null;
479
+ const names = [];
480
+ let blend = null;
481
+ for (let node = el; node && node.nodeType === 1; node = node.parentElement) {
482
+ const cs = getComputedStyle(node);
483
+ for (const m of String(cs.filter).matchAll(/([a-z-]+)\(((?:[^()]|\([^()]*\))*)\)/g)) {
484
+ if (identity(m[1], m[2])) continue;
485
+ if (rule.filters.includes(m[1]) && !names.includes(m[1])) names.push(m[1]);
486
+ }
487
+ if (rule.blends === true && !blend && cs.mixBlendMode && cs.mixBlendMode !== "normal") blend = cs.mixBlendMode;
488
+ if (/^(section|article|body)$/i.test(node.tagName) && node !== el) break;
489
+ }
490
+ const parts = [...names, ...(blend ? ["mix-blend-mode " + blend] : [])];
491
+ return parts.length > 0 ? parts.join(", ") : null;
492
+ };
493
+ const largeImages = [];
494
+ let totalLarge = 0;
495
+ if (Number.isFinite(opts.minSidePx) && opts.minSidePx > 0) {
496
+ for (const el of document.querySelectorAll("img")) {
497
+ const r = visibleRect(el);
498
+ if (!r || r.width < opts.minSidePx || r.height < opts.minSidePx) continue;
499
+ totalLarge += 1;
500
+ if (largeImages.length >= opts.maxImages) continue;
501
+ const info = infoOf(el);
502
+ largeImages.push({
503
+ selector: info.selector,
504
+ src: info.src.slice(0, 200),
505
+ decorative: info.decorative || Boolean(el.closest("[aria-hidden=true]")),
506
+ widthPx: round(r.width),
507
+ heightPx: round(r.height),
508
+ treatment: treatmentOf(el),
509
+ });
510
+ }
511
+ }
512
+
513
+ return {
514
+ title: document.title,
515
+ lang: (document.documentElement.getAttribute("lang") || "").trim(),
516
+ headings,
517
+ targets,
518
+ totalTargets,
519
+ largeImages,
520
+ totalLarge,
521
+ };
522
+ }