@specship/specship-linux-arm64 0.28.0 → 0.29.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/lib/dist/bin/specship.js +37 -0
- package/lib/dist/bin/specship.js.map +1 -1
- package/lib/dist/commands/specship/spec.md +7 -1
- package/lib/dist/design-md/check.d.ts +51 -0
- package/lib/dist/design-md/check.d.ts.map +1 -0
- package/lib/dist/design-md/check.js +335 -0
- package/lib/dist/design-md/check.js.map +1 -0
- package/lib/dist/design-md/css.d.ts +40 -0
- package/lib/dist/design-md/css.d.ts.map +1 -0
- package/lib/dist/design-md/css.js +224 -0
- package/lib/dist/design-md/css.js.map +1 -0
- package/lib/dist/design-md/extract.d.ts +84 -0
- package/lib/dist/design-md/extract.d.ts.map +1 -0
- package/lib/dist/design-md/extract.js +595 -0
- package/lib/dist/design-md/extract.js.map +1 -0
- package/lib/dist/design-md/maintain.d.ts +45 -0
- package/lib/dist/design-md/maintain.d.ts.map +1 -0
- package/lib/dist/design-md/maintain.js +127 -0
- package/lib/dist/design-md/maintain.js.map +1 -0
- package/lib/dist/design-md/render.d.ts +28 -0
- package/lib/dist/design-md/render.d.ts.map +1 -0
- package/lib/dist/design-md/render.js +178 -0
- package/lib/dist/design-md/render.js.map +1 -0
- package/lib/dist/design-md/upkeep.d.ts +48 -0
- package/lib/dist/design-md/upkeep.d.ts.map +1 -0
- package/lib/dist/design-md/upkeep.js +169 -0
- package/lib/dist/design-md/upkeep.js.map +1 -0
- package/lib/dist/design-md/verify.d.ts +65 -0
- package/lib/dist/design-md/verify.d.ts.map +1 -0
- package/lib/dist/design-md/verify.js +311 -0
- package/lib/dist/design-md/verify.js.map +1 -0
- package/lib/dist/installer/gemini-commands.d.ts.map +1 -1
- package/lib/dist/installer/gemini-commands.js +7 -0
- package/lib/dist/installer/gemini-commands.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts +1 -1
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +7 -2
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/skills/design-md/SKILL.md +172 -0
- package/lib/dist/skills/design-md/references/authored-sections.md +90 -0
- package/lib/dist/skills/design-md/references/sources.md +71 -0
- package/lib/dist/spec-quality/postcheck.d.ts +7 -1
- package/lib/dist/spec-quality/postcheck.d.ts.map +1 -1
- package/lib/dist/spec-quality/postcheck.js +31 -0
- package/lib/dist/spec-quality/postcheck.js.map +1 -1
- package/lib/dist/workflows/defaults/claude-design-implement.yaml +34 -5
- package/lib/dist/workflows/defaults/spec-implement.yaml +16 -0
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A small, dependency-free CSS reader for design.md (DESIGNMD-DOC,
|
|
4
|
+
* REQ-DESIGNMD-001).
|
|
5
|
+
*
|
|
6
|
+
* It does not validate CSS or compute the cascade. It walks the text and
|
|
7
|
+
* records what is written: each rule's selector and declarations verbatim
|
|
8
|
+
* (whitespace collapsed), the `@media` / `@supports` / `@container` condition
|
|
9
|
+
* a rule sits under, `@keyframes` bodies and `@font-face` blocks. Native CSS
|
|
10
|
+
* nesting is flattened (`&` replaced by the parent selector). The output order
|
|
11
|
+
* is source order, so the same text always yields the same result.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.collapse = collapse;
|
|
15
|
+
exports.splitTopLevel = splitTopLevel;
|
|
16
|
+
exports.parseDeclarationList = parseDeclarationList;
|
|
17
|
+
exports.parseCss = parseCss;
|
|
18
|
+
const CONDITIONAL_AT_RULES = /^@(media|supports|container|layer|document|scope)\b/i;
|
|
19
|
+
const KEYFRAMES_AT_RULE = /^@(-webkit-|-moz-)?keyframes\s+/i;
|
|
20
|
+
function collapse(text) {
|
|
21
|
+
return text.replace(/\s+/g, ' ').trim();
|
|
22
|
+
}
|
|
23
|
+
/** Remove comments, leaving strings intact. */
|
|
24
|
+
function stripComments(text) {
|
|
25
|
+
let out = '';
|
|
26
|
+
let i = 0;
|
|
27
|
+
while (i < text.length) {
|
|
28
|
+
const ch = text[i];
|
|
29
|
+
if (ch === '"' || ch === "'") {
|
|
30
|
+
const end = skipString(text, i);
|
|
31
|
+
out += text.slice(i, end);
|
|
32
|
+
i = end;
|
|
33
|
+
}
|
|
34
|
+
else if (ch === '/' && text[i + 1] === '*') {
|
|
35
|
+
const end = text.indexOf('*/', i + 2);
|
|
36
|
+
i = end === -1 ? text.length : end + 2;
|
|
37
|
+
out += ' ';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
out += ch;
|
|
41
|
+
i++;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/** Index just past the string literal starting at `start`. */
|
|
47
|
+
function skipString(text, start) {
|
|
48
|
+
const quote = text[start];
|
|
49
|
+
let i = start + 1;
|
|
50
|
+
while (i < text.length) {
|
|
51
|
+
if (text[i] === '\\')
|
|
52
|
+
i += 2;
|
|
53
|
+
else if (text[i] === quote)
|
|
54
|
+
return i + 1;
|
|
55
|
+
else
|
|
56
|
+
i++;
|
|
57
|
+
}
|
|
58
|
+
return text.length;
|
|
59
|
+
}
|
|
60
|
+
/** Index of the `}` matching the `{` at `open`. */
|
|
61
|
+
function matchBrace(text, open) {
|
|
62
|
+
let depth = 0;
|
|
63
|
+
let i = open;
|
|
64
|
+
while (i < text.length) {
|
|
65
|
+
const ch = text[i];
|
|
66
|
+
if (ch === '"' || ch === "'") {
|
|
67
|
+
i = skipString(text, i);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (ch === '{')
|
|
71
|
+
depth++;
|
|
72
|
+
else if (ch === '}') {
|
|
73
|
+
depth--;
|
|
74
|
+
if (depth === 0)
|
|
75
|
+
return i;
|
|
76
|
+
}
|
|
77
|
+
i++;
|
|
78
|
+
}
|
|
79
|
+
return text.length;
|
|
80
|
+
}
|
|
81
|
+
/** Split one block's contents into top-level statements and nested blocks. */
|
|
82
|
+
function scan(text) {
|
|
83
|
+
const items = [];
|
|
84
|
+
let buf = '';
|
|
85
|
+
let parens = 0;
|
|
86
|
+
let i = 0;
|
|
87
|
+
while (i < text.length) {
|
|
88
|
+
const ch = text[i];
|
|
89
|
+
if (ch === '"' || ch === "'") {
|
|
90
|
+
const end = skipString(text, i);
|
|
91
|
+
buf += text.slice(i, end);
|
|
92
|
+
i = end;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (ch === '(')
|
|
96
|
+
parens++;
|
|
97
|
+
else if (ch === ')')
|
|
98
|
+
parens = Math.max(0, parens - 1);
|
|
99
|
+
if (parens === 0 && ch === ';') {
|
|
100
|
+
if (buf.trim())
|
|
101
|
+
items.push({ kind: 'stmt', text: buf.trim() });
|
|
102
|
+
buf = '';
|
|
103
|
+
i++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (parens === 0 && ch === '{') {
|
|
107
|
+
const close = matchBrace(text, i);
|
|
108
|
+
items.push({ kind: 'block', prelude: buf.trim(), body: text.slice(i + 1, close) });
|
|
109
|
+
buf = '';
|
|
110
|
+
i = close + 1;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
buf += ch;
|
|
114
|
+
i++;
|
|
115
|
+
}
|
|
116
|
+
if (buf.trim())
|
|
117
|
+
items.push({ kind: 'stmt', text: buf.trim() });
|
|
118
|
+
return items;
|
|
119
|
+
}
|
|
120
|
+
/** Split on commas that are not inside parentheses or brackets. */
|
|
121
|
+
function splitTopLevel(text, sep = ',') {
|
|
122
|
+
const parts = [];
|
|
123
|
+
let depth = 0;
|
|
124
|
+
let buf = '';
|
|
125
|
+
for (let i = 0; i < text.length; i++) {
|
|
126
|
+
const ch = text[i];
|
|
127
|
+
if (ch === '(' || ch === '[')
|
|
128
|
+
depth++;
|
|
129
|
+
else if (ch === ')' || ch === ']')
|
|
130
|
+
depth = Math.max(0, depth - 1);
|
|
131
|
+
if (ch === sep && depth === 0) {
|
|
132
|
+
parts.push(buf);
|
|
133
|
+
buf = '';
|
|
134
|
+
}
|
|
135
|
+
else
|
|
136
|
+
buf += ch;
|
|
137
|
+
}
|
|
138
|
+
parts.push(buf);
|
|
139
|
+
return parts.map((p) => p.trim()).filter(Boolean);
|
|
140
|
+
}
|
|
141
|
+
function nestSelector(parent, child) {
|
|
142
|
+
const own = splitTopLevel(collapse(child));
|
|
143
|
+
if (!parent)
|
|
144
|
+
return own.join(', ');
|
|
145
|
+
const parents = splitTopLevel(parent);
|
|
146
|
+
const combined = [];
|
|
147
|
+
for (const p of parents) {
|
|
148
|
+
for (const c of own)
|
|
149
|
+
combined.push(c.includes('&') ? c.replace(/&/g, p) : `${p} ${c}`);
|
|
150
|
+
}
|
|
151
|
+
return combined.join(', ');
|
|
152
|
+
}
|
|
153
|
+
function parseDeclaration(text) {
|
|
154
|
+
const colon = text.indexOf(':');
|
|
155
|
+
if (colon <= 0)
|
|
156
|
+
return null;
|
|
157
|
+
const property = collapse(text.slice(0, colon));
|
|
158
|
+
const value = collapse(text.slice(colon + 1));
|
|
159
|
+
if (!property || /\s/.test(property))
|
|
160
|
+
return null;
|
|
161
|
+
// An empty value is valid only for a custom property (`--tw-blur: ;`), and
|
|
162
|
+
// it matters: Tailwind composes `backdrop-filter` / `filter` from such
|
|
163
|
+
// variables, so dropping them changes what renders.
|
|
164
|
+
if (!value && !property.startsWith('--'))
|
|
165
|
+
return null;
|
|
166
|
+
// Custom property names are case-sensitive; standard ones are not.
|
|
167
|
+
return { property: property.startsWith('--') ? property : property.toLowerCase(), value };
|
|
168
|
+
}
|
|
169
|
+
/** Parse a `style=""` attribute or any `prop: value; …` list. */
|
|
170
|
+
function parseDeclarationList(text) {
|
|
171
|
+
return scan(stripComments(text))
|
|
172
|
+
.filter((item) => item.kind === 'stmt')
|
|
173
|
+
.map((item) => parseDeclaration(item.text))
|
|
174
|
+
.filter((d) => d !== null);
|
|
175
|
+
}
|
|
176
|
+
function walk(items, out, media, selector) {
|
|
177
|
+
const declarations = [];
|
|
178
|
+
for (const item of items) {
|
|
179
|
+
if (item.kind !== 'stmt')
|
|
180
|
+
continue;
|
|
181
|
+
if (item.text.startsWith('@')) {
|
|
182
|
+
const imp = /^@import\s+(.+)$/i.exec(item.text);
|
|
183
|
+
if (imp)
|
|
184
|
+
out.imports.push(collapse(imp[1]));
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const decl = parseDeclaration(item.text);
|
|
188
|
+
if (decl)
|
|
189
|
+
declarations.push(decl);
|
|
190
|
+
}
|
|
191
|
+
if (selector && declarations.length > 0) {
|
|
192
|
+
out.rules.push(media ? { selector, declarations, media } : { selector, declarations });
|
|
193
|
+
}
|
|
194
|
+
for (const item of items) {
|
|
195
|
+
if (item.kind !== 'block')
|
|
196
|
+
continue;
|
|
197
|
+
const prelude = collapse(item.prelude);
|
|
198
|
+
if (KEYFRAMES_AT_RULE.test(prelude)) {
|
|
199
|
+
const name = prelude.replace(KEYFRAMES_AT_RULE, '').trim();
|
|
200
|
+
const body = collapse(item.body);
|
|
201
|
+
out.keyframes.push(media ? { name, body, media } : { name, body });
|
|
202
|
+
}
|
|
203
|
+
else if (/^@font-face\b/i.test(prelude)) {
|
|
204
|
+
out.fontFaces.push(parseDeclarationList(item.body));
|
|
205
|
+
}
|
|
206
|
+
else if (CONDITIONAL_AT_RULES.test(prelude)) {
|
|
207
|
+
const condition = /^@layer\b/i.test(prelude) ? media : media ? `${media} and ${prelude}` : prelude;
|
|
208
|
+
walk(scan(item.body), out, condition, selector);
|
|
209
|
+
}
|
|
210
|
+
else if (prelude.startsWith('@')) {
|
|
211
|
+
// @page, @property, … — keep their declarations under the at-rule prelude.
|
|
212
|
+
walk(scan(item.body), out, media, prelude);
|
|
213
|
+
}
|
|
214
|
+
else if (prelude) {
|
|
215
|
+
walk(scan(item.body), out, media, nestSelector(selector, prelude));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function parseCss(text) {
|
|
220
|
+
const out = { rules: [], keyframes: [], fontFaces: [], imports: [] };
|
|
221
|
+
walk(scan(stripComments(text)), out, undefined, undefined);
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/design-md/css.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAiCH,4BAEC;AA6FD,sCAeC;AA4BD,oDAKC;AAuCD,4BAIC;AA7LD,MAAM,oBAAoB,GAAG,sDAAsD,CAAC;AACpF,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;AAE7D,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC;AAED,+CAA+C;AAC/C,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACpB,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAChC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC1B,CAAC,GAAG,GAAG,CAAC;QACV,CAAC;aAAM,IAAI,EAAE,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,IAA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
|
|
2
|
+
* Deterministic design-value extraction for design.md (DESIGNMD-DOC,
|
|
3
|
+
* REQ-DESIGNMD-001).
|
|
4
|
+
*
|
|
5
|
+
* A low-end model asked to read a 2,000-line design snapshot rounds values,
|
|
6
|
+
* invents near-miss colors and misses state rules. This module does that
|
|
7
|
+
* reading in code instead: every custom property, every rule, every literal
|
|
8
|
+
* value, counted and attributed to the selectors that use it. Nothing here
|
|
9
|
+
* interprets the design — it records what is written.
|
|
10
|
+
*
|
|
11
|
+
* Sources: Claude Design snapshots (`.html` + the local stylesheets they
|
|
12
|
+
* link), plain `.css`, Figma code exports (`.tsx` / `.jsx`), and Figma
|
|
13
|
+
* variables exports (`.json`).
|
|
14
|
+
*/
|
|
15
|
+
import { CssDeclaration, CssKeyframes, CssRule, splitTopLevel } from './css';
|
|
16
|
+
export type SourceKind = 'html' | 'css' | 'code' | 'variables';
|
|
17
|
+
export interface DesignSource {
|
|
18
|
+
/** Project-relative path, `/`-separated. */
|
|
19
|
+
path: string;
|
|
20
|
+
sha256: string;
|
|
21
|
+
kind: SourceKind;
|
|
22
|
+
}
|
|
23
|
+
export interface CustomProperty {
|
|
24
|
+
selector: string;
|
|
25
|
+
name: string;
|
|
26
|
+
value: string;
|
|
27
|
+
media?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface DesignVariable {
|
|
30
|
+
name: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const INVENTORY_KINDS: readonly ["Colors", "Font families", "Font sizes", "Font weights", "Line heights", "Letter spacing", "Spacing", "Sizes", "Radii", "Borders", "Shadows", "Motion", "Opacity", "Z-index", "Breakpoints"];
|
|
34
|
+
export type InventoryKind = (typeof INVENTORY_KINDS)[number];
|
|
35
|
+
export interface InventoryEntry {
|
|
36
|
+
value: string;
|
|
37
|
+
count: number;
|
|
38
|
+
/** Selectors (or `file:line` for code) that use the value, sorted. */
|
|
39
|
+
usedBy: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface InlineSvg {
|
|
42
|
+
id: string;
|
|
43
|
+
/** The element's markup, whitespace collapsed. */
|
|
44
|
+
markup: string;
|
|
45
|
+
count: number;
|
|
46
|
+
}
|
|
47
|
+
export interface DesignExtraction {
|
|
48
|
+
sources: DesignSource[];
|
|
49
|
+
customProperties: CustomProperty[];
|
|
50
|
+
variables: DesignVariable[];
|
|
51
|
+
rules: CssRule[];
|
|
52
|
+
keyframes: CssKeyframes[];
|
|
53
|
+
fontFaces: CssDeclaration[][];
|
|
54
|
+
/** Remote stylesheet / font links, verbatim. */
|
|
55
|
+
fontLinks: string[];
|
|
56
|
+
inventories: Record<InventoryKind, InventoryEntry[]>;
|
|
57
|
+
/** Utility classes from code exports (`p-4`, `text-sm`), with counts. */
|
|
58
|
+
utilityClasses: InventoryEntry[];
|
|
59
|
+
/** Image / icon / font file references. */
|
|
60
|
+
assets: InventoryEntry[];
|
|
61
|
+
/** Indented element outline of HTML sources, with inline styles and text. */
|
|
62
|
+
outline: string[];
|
|
63
|
+
/** Distinct inline SVG elements (verbatim markup + use count). */
|
|
64
|
+
svgs: InlineSvg[];
|
|
65
|
+
outlineTruncated: boolean;
|
|
66
|
+
/** Local stylesheets the source links to that could not be read. */
|
|
67
|
+
missingLinks: string[];
|
|
68
|
+
}
|
|
69
|
+
export declare class DesignSourceError extends Error {
|
|
70
|
+
}
|
|
71
|
+
/** Max outline lines — the verbatim snapshot carries the rest. */
|
|
72
|
+
export declare const OUTLINE_LIMIT = 3000;
|
|
73
|
+
/** Every color literal written in a value, in order. */
|
|
74
|
+
export declare function colorLiterals(value: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Extract every literal visual value from the given sources. Paths resolve
|
|
77
|
+
* against `projectRoot`. Throws `DesignSourceError` when a source is missing
|
|
78
|
+
* or unreadable — the caller writes nothing in that case (REQ-DESIGNMD-001.A6).
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractDesign(paths: string[], opts: {
|
|
81
|
+
projectRoot: string;
|
|
82
|
+
}): DesignExtraction;
|
|
83
|
+
export { splitTopLevel };
|
|
84
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/design-md/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAA4C,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,eAAe,wMAgBlB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,gBAAgB,EAAE,cAAc,EAAE,CAAC;IAC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