@tenphi/eslint-plugin-tasty 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +100 -20
- package/dist/config.js.map +1 -1
- package/dist/configs.js +5 -4
- package/dist/configs.js.map +1 -1
- package/dist/constants.js +67 -2
- package/dist/constants.js.map +1 -1
- package/dist/context.js +40 -7
- package/dist/context.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/parsers/state-key-parser.js +486 -0
- package/dist/parsers/state-key-parser.js.map +1 -0
- package/dist/parsers/utils.js +128 -0
- package/dist/parsers/utils.js.map +1 -0
- package/dist/parsers/value-parser.js +613 -0
- package/dist/parsers/value-parser.js.map +1 -0
- package/dist/rules/consistent-token-usage.js +20 -19
- package/dist/rules/consistent-token-usage.js.map +1 -1
- package/dist/rules/known-property.js +31 -30
- package/dist/rules/known-property.js.map +1 -1
- package/dist/rules/no-duplicate-state.js +12 -11
- package/dist/rules/no-duplicate-state.js.map +1 -1
- package/dist/rules/no-important.js +12 -11
- package/dist/rules/no-important.js.map +1 -1
- package/dist/rules/no-nested-selector.js +15 -14
- package/dist/rules/no-nested-selector.js.map +1 -1
- package/dist/rules/no-nested-state-map.js +19 -18
- package/dist/rules/no-nested-state-map.js.map +1 -1
- package/dist/rules/no-raw-color-values.js +15 -14
- package/dist/rules/no-raw-color-values.js.map +1 -1
- package/dist/rules/no-runtime-styles-mutation.js +6 -5
- package/dist/rules/no-runtime-styles-mutation.js.map +1 -1
- package/dist/rules/no-unknown-state-alias.js +12 -11
- package/dist/rules/no-unknown-state-alias.js.map +1 -1
- package/dist/rules/prefer-shorthand-property.js +19 -18
- package/dist/rules/prefer-shorthand-property.js.map +1 -1
- package/dist/rules/require-default-state.js +22 -21
- package/dist/rules/require-default-state.js.map +1 -1
- package/dist/rules/static-no-dynamic-values.js +7 -6
- package/dist/rules/static-no-dynamic-values.js.map +1 -1
- package/dist/rules/static-valid-selector.js +1 -1
- package/dist/rules/valid-boolean-property.js +19 -18
- package/dist/rules/valid-boolean-property.js.map +1 -1
- package/dist/rules/valid-color-token.js +33 -21
- package/dist/rules/valid-color-token.js.map +1 -1
- package/dist/rules/valid-custom-property.js +31 -19
- package/dist/rules/valid-custom-property.js.map +1 -1
- package/dist/rules/valid-custom-unit.js +12 -16
- package/dist/rules/valid-custom-unit.js.map +1 -1
- package/dist/rules/valid-directional-modifier.js +21 -20
- package/dist/rules/valid-directional-modifier.js.map +1 -1
- package/dist/rules/valid-preset.js +5 -2
- package/dist/rules/valid-preset.js.map +1 -1
- package/dist/rules/valid-radius-shape.js +19 -18
- package/dist/rules/valid-radius-shape.js.map +1 -1
- package/dist/rules/valid-recipe.js +5 -2
- package/dist/rules/valid-recipe.js.map +1 -1
- package/dist/rules/valid-state-definition.js +70 -0
- package/dist/rules/valid-state-definition.js.map +1 -0
- package/dist/rules/valid-state-key.js +39 -102
- package/dist/rules/valid-state-key.js.map +1 -1
- package/dist/rules/valid-styles-structure.js +39 -38
- package/dist/rules/valid-styles-structure.js.map +1 -1
- package/dist/rules/valid-sub-element.js +21 -20
- package/dist/rules/valid-sub-element.js.map +1 -1
- package/dist/rules/valid-transition.js +19 -18
- package/dist/rules/valid-transition.js.map +1 -1
- package/dist/rules/valid-value.js +117 -64
- package/dist/rules/valid-value.js.map +1 -1
- package/package.json +1 -8
- package/dist/parser.js +0 -46
- package/dist/parser.js.map +0 -1
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { BUILT_IN_UNITS, CSS_UNITS } from "../constants.js";
|
|
2
|
+
import { checkBracketBalance, scanTokens } from "./utils.js";
|
|
3
|
+
|
|
4
|
+
//#region src/parsers/value-parser.ts
|
|
5
|
+
const RE_UNIT_NUM = /^[+-]?(?:\d*\.\d+|\d+)([a-z][a-z0-9]*)$/;
|
|
6
|
+
const RE_NUMBER = /^[+-]?(?:\d*\.\d+|\d+)$/;
|
|
7
|
+
const RE_CSS_UNIT_NUM = /^[+-]?(?:\d*\.\d+|\d+)([a-z%]+)$/;
|
|
8
|
+
const COLOR_FUNCS = new Set([
|
|
9
|
+
"rgb",
|
|
10
|
+
"rgba",
|
|
11
|
+
"hsl",
|
|
12
|
+
"hsla",
|
|
13
|
+
"hwb",
|
|
14
|
+
"lab",
|
|
15
|
+
"lch",
|
|
16
|
+
"oklab",
|
|
17
|
+
"oklch",
|
|
18
|
+
"color",
|
|
19
|
+
"device-cmyk",
|
|
20
|
+
"gray",
|
|
21
|
+
"color-mix",
|
|
22
|
+
"color-contrast"
|
|
23
|
+
]);
|
|
24
|
+
const CSS_FUNCS = new Set([
|
|
25
|
+
"calc",
|
|
26
|
+
"min",
|
|
27
|
+
"max",
|
|
28
|
+
"clamp",
|
|
29
|
+
"var",
|
|
30
|
+
"env",
|
|
31
|
+
"attr",
|
|
32
|
+
"counter",
|
|
33
|
+
"counters",
|
|
34
|
+
"image-set",
|
|
35
|
+
"linear-gradient",
|
|
36
|
+
"radial-gradient",
|
|
37
|
+
"conic-gradient",
|
|
38
|
+
"repeating-linear-gradient",
|
|
39
|
+
"repeating-radial-gradient",
|
|
40
|
+
"repeating-conic-gradient",
|
|
41
|
+
"url",
|
|
42
|
+
"fit-content",
|
|
43
|
+
"minmax",
|
|
44
|
+
"repeat",
|
|
45
|
+
"cubic-bezier",
|
|
46
|
+
"steps",
|
|
47
|
+
"linear",
|
|
48
|
+
"rotate",
|
|
49
|
+
"scale",
|
|
50
|
+
"translate",
|
|
51
|
+
"skew",
|
|
52
|
+
"matrix",
|
|
53
|
+
"perspective",
|
|
54
|
+
"rotate3d",
|
|
55
|
+
"rotateX",
|
|
56
|
+
"rotateY",
|
|
57
|
+
"rotateZ",
|
|
58
|
+
"scale3d",
|
|
59
|
+
"scaleX",
|
|
60
|
+
"scaleY",
|
|
61
|
+
"scaleZ",
|
|
62
|
+
"translate3d",
|
|
63
|
+
"translateX",
|
|
64
|
+
"translateY",
|
|
65
|
+
"translateZ",
|
|
66
|
+
"skewX",
|
|
67
|
+
"skewY",
|
|
68
|
+
"matrix3d",
|
|
69
|
+
"blur",
|
|
70
|
+
"brightness",
|
|
71
|
+
"contrast",
|
|
72
|
+
"drop-shadow",
|
|
73
|
+
"grayscale",
|
|
74
|
+
"hue-rotate",
|
|
75
|
+
"invert",
|
|
76
|
+
"opacity",
|
|
77
|
+
"saturate",
|
|
78
|
+
"sepia",
|
|
79
|
+
"polygon",
|
|
80
|
+
"circle",
|
|
81
|
+
"ellipse",
|
|
82
|
+
"inset",
|
|
83
|
+
"path",
|
|
84
|
+
"light-dark"
|
|
85
|
+
]);
|
|
86
|
+
const VALUE_KEYWORDS = new Set([
|
|
87
|
+
"auto",
|
|
88
|
+
"none",
|
|
89
|
+
"normal",
|
|
90
|
+
"inherit",
|
|
91
|
+
"initial",
|
|
92
|
+
"unset",
|
|
93
|
+
"revert",
|
|
94
|
+
"revert-layer",
|
|
95
|
+
"max-content",
|
|
96
|
+
"min-content",
|
|
97
|
+
"fit-content",
|
|
98
|
+
"stretch",
|
|
99
|
+
"transparent",
|
|
100
|
+
"currentcolor",
|
|
101
|
+
"currentColor",
|
|
102
|
+
"block",
|
|
103
|
+
"inline",
|
|
104
|
+
"inline-block",
|
|
105
|
+
"flex",
|
|
106
|
+
"inline-flex",
|
|
107
|
+
"grid",
|
|
108
|
+
"inline-grid",
|
|
109
|
+
"contents",
|
|
110
|
+
"table",
|
|
111
|
+
"table-row",
|
|
112
|
+
"table-cell",
|
|
113
|
+
"list-item",
|
|
114
|
+
"flow-root",
|
|
115
|
+
"static",
|
|
116
|
+
"relative",
|
|
117
|
+
"absolute",
|
|
118
|
+
"fixed",
|
|
119
|
+
"sticky",
|
|
120
|
+
"visible",
|
|
121
|
+
"hidden",
|
|
122
|
+
"scroll",
|
|
123
|
+
"clip",
|
|
124
|
+
"overlay",
|
|
125
|
+
"center",
|
|
126
|
+
"start",
|
|
127
|
+
"end",
|
|
128
|
+
"flex-start",
|
|
129
|
+
"flex-end",
|
|
130
|
+
"space-between",
|
|
131
|
+
"space-around",
|
|
132
|
+
"space-evenly",
|
|
133
|
+
"baseline",
|
|
134
|
+
"row",
|
|
135
|
+
"column",
|
|
136
|
+
"row-reverse",
|
|
137
|
+
"column-reverse",
|
|
138
|
+
"wrap",
|
|
139
|
+
"nowrap",
|
|
140
|
+
"dense",
|
|
141
|
+
"solid",
|
|
142
|
+
"dashed",
|
|
143
|
+
"dotted",
|
|
144
|
+
"double",
|
|
145
|
+
"groove",
|
|
146
|
+
"ridge",
|
|
147
|
+
"outset",
|
|
148
|
+
"top",
|
|
149
|
+
"right",
|
|
150
|
+
"bottom",
|
|
151
|
+
"left",
|
|
152
|
+
"top-left",
|
|
153
|
+
"top-right",
|
|
154
|
+
"bottom-left",
|
|
155
|
+
"bottom-right",
|
|
156
|
+
"round",
|
|
157
|
+
"ellipse",
|
|
158
|
+
"leaf",
|
|
159
|
+
"backleaf",
|
|
160
|
+
"min",
|
|
161
|
+
"max",
|
|
162
|
+
"bold",
|
|
163
|
+
"bolder",
|
|
164
|
+
"lighter",
|
|
165
|
+
"italic",
|
|
166
|
+
"oblique",
|
|
167
|
+
"uppercase",
|
|
168
|
+
"lowercase",
|
|
169
|
+
"capitalize",
|
|
170
|
+
"line-through",
|
|
171
|
+
"underline",
|
|
172
|
+
"overline",
|
|
173
|
+
"wavy",
|
|
174
|
+
"pointer",
|
|
175
|
+
"default",
|
|
176
|
+
"text",
|
|
177
|
+
"move",
|
|
178
|
+
"grab",
|
|
179
|
+
"grabbing",
|
|
180
|
+
"not-allowed",
|
|
181
|
+
"crosshair",
|
|
182
|
+
"wait",
|
|
183
|
+
"help",
|
|
184
|
+
"col-resize",
|
|
185
|
+
"row-resize",
|
|
186
|
+
"n-resize",
|
|
187
|
+
"s-resize",
|
|
188
|
+
"e-resize",
|
|
189
|
+
"w-resize",
|
|
190
|
+
"ne-resize",
|
|
191
|
+
"nw-resize",
|
|
192
|
+
"se-resize",
|
|
193
|
+
"sw-resize",
|
|
194
|
+
"ew-resize",
|
|
195
|
+
"ns-resize",
|
|
196
|
+
"zoom-in",
|
|
197
|
+
"zoom-out",
|
|
198
|
+
"cover",
|
|
199
|
+
"contain",
|
|
200
|
+
"fill",
|
|
201
|
+
"no-repeat",
|
|
202
|
+
"repeat-x",
|
|
203
|
+
"repeat-y",
|
|
204
|
+
"border-box",
|
|
205
|
+
"padding-box",
|
|
206
|
+
"content-box",
|
|
207
|
+
"break-word",
|
|
208
|
+
"break-all",
|
|
209
|
+
"keep-all",
|
|
210
|
+
"anywhere",
|
|
211
|
+
"pre",
|
|
212
|
+
"pre-wrap",
|
|
213
|
+
"pre-line",
|
|
214
|
+
"balance",
|
|
215
|
+
"smooth",
|
|
216
|
+
"horizontal",
|
|
217
|
+
"vertical",
|
|
218
|
+
"both",
|
|
219
|
+
"mandatory",
|
|
220
|
+
"proximity",
|
|
221
|
+
"collapse",
|
|
222
|
+
"preserve",
|
|
223
|
+
"preserve-breaks",
|
|
224
|
+
"break-spaces",
|
|
225
|
+
"pretty",
|
|
226
|
+
"stable",
|
|
227
|
+
"transform",
|
|
228
|
+
"opacity",
|
|
229
|
+
"infinite",
|
|
230
|
+
"alternate",
|
|
231
|
+
"alternate-reverse",
|
|
232
|
+
"reverse",
|
|
233
|
+
"forwards",
|
|
234
|
+
"backwards",
|
|
235
|
+
"running",
|
|
236
|
+
"paused",
|
|
237
|
+
"ease",
|
|
238
|
+
"ease-in",
|
|
239
|
+
"ease-out",
|
|
240
|
+
"ease-in-out",
|
|
241
|
+
"step-start",
|
|
242
|
+
"step-end",
|
|
243
|
+
"thin",
|
|
244
|
+
"always",
|
|
245
|
+
"both-edges",
|
|
246
|
+
"fixed",
|
|
247
|
+
"inset",
|
|
248
|
+
"clip",
|
|
249
|
+
"ltr",
|
|
250
|
+
"rtl",
|
|
251
|
+
"embed",
|
|
252
|
+
"isolate",
|
|
253
|
+
"isolate-override",
|
|
254
|
+
"plaintext",
|
|
255
|
+
"horizontal-tb",
|
|
256
|
+
"vertical-rl",
|
|
257
|
+
"vertical-lr",
|
|
258
|
+
"sideways-rl",
|
|
259
|
+
"sideways-lr",
|
|
260
|
+
"monospace",
|
|
261
|
+
"serif",
|
|
262
|
+
"sans-serif",
|
|
263
|
+
"cursive",
|
|
264
|
+
"fantasy",
|
|
265
|
+
"system-ui",
|
|
266
|
+
"ui-serif",
|
|
267
|
+
"ui-sans-serif",
|
|
268
|
+
"ui-monospace",
|
|
269
|
+
"ui-rounded",
|
|
270
|
+
"to",
|
|
271
|
+
"strong",
|
|
272
|
+
"tight",
|
|
273
|
+
"icon"
|
|
274
|
+
]);
|
|
275
|
+
function toSet(input) {
|
|
276
|
+
if (!input) return /* @__PURE__ */ new Set();
|
|
277
|
+
return input instanceof Set ? input : new Set(input);
|
|
278
|
+
}
|
|
279
|
+
function classifyToken(raw, offset, errors, opts) {
|
|
280
|
+
const token = raw.trim();
|
|
281
|
+
if (!token) return {
|
|
282
|
+
type: "keyword",
|
|
283
|
+
value: ""
|
|
284
|
+
};
|
|
285
|
+
if (token.startsWith("\"") && token.endsWith("\"") || token.startsWith("'") && token.endsWith("'")) return {
|
|
286
|
+
type: "string",
|
|
287
|
+
value: token.slice(1, -1),
|
|
288
|
+
raw: token
|
|
289
|
+
};
|
|
290
|
+
if (token === "!important") return {
|
|
291
|
+
type: "important",
|
|
292
|
+
raw: token
|
|
293
|
+
};
|
|
294
|
+
if (token.startsWith("$$")) {
|
|
295
|
+
const name = token.slice(2);
|
|
296
|
+
if (/^[a-z_][a-z0-9-_]*$/i.test(name)) return {
|
|
297
|
+
type: "custom-prop-ref",
|
|
298
|
+
name,
|
|
299
|
+
raw: token
|
|
300
|
+
};
|
|
301
|
+
errors.push({
|
|
302
|
+
message: `Invalid custom property reference '${token}'.`,
|
|
303
|
+
offset,
|
|
304
|
+
length: token.length,
|
|
305
|
+
raw: token
|
|
306
|
+
});
|
|
307
|
+
return {
|
|
308
|
+
type: "unknown",
|
|
309
|
+
raw: token
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
if (token.startsWith("##")) {
|
|
313
|
+
const name = token.slice(2);
|
|
314
|
+
if (/^[a-z_][a-z0-9-_]*$/i.test(name)) return {
|
|
315
|
+
type: "color-ref",
|
|
316
|
+
name,
|
|
317
|
+
raw: token
|
|
318
|
+
};
|
|
319
|
+
errors.push({
|
|
320
|
+
message: `Invalid color reference '${token}'.`,
|
|
321
|
+
offset,
|
|
322
|
+
length: token.length,
|
|
323
|
+
raw: token
|
|
324
|
+
});
|
|
325
|
+
return {
|
|
326
|
+
type: "unknown",
|
|
327
|
+
raw: token
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
if (token.startsWith("$")) {
|
|
331
|
+
const name = token.slice(1);
|
|
332
|
+
if (/^[a-z_][a-z0-9-_]*$/i.test(name)) return {
|
|
333
|
+
type: "custom-prop",
|
|
334
|
+
name,
|
|
335
|
+
raw: token
|
|
336
|
+
};
|
|
337
|
+
errors.push({
|
|
338
|
+
message: `Invalid custom property syntax '${token}'.`,
|
|
339
|
+
offset,
|
|
340
|
+
length: token.length,
|
|
341
|
+
raw: token
|
|
342
|
+
});
|
|
343
|
+
return {
|
|
344
|
+
type: "unknown",
|
|
345
|
+
raw: token
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
if (token.startsWith("#")) {
|
|
349
|
+
if (token.length === 1) {
|
|
350
|
+
errors.push({
|
|
351
|
+
message: "Empty color token name.",
|
|
352
|
+
offset,
|
|
353
|
+
length: 1,
|
|
354
|
+
raw: token
|
|
355
|
+
});
|
|
356
|
+
return {
|
|
357
|
+
type: "unknown",
|
|
358
|
+
raw: token
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
return classifyColorToken(token, offset, errors);
|
|
362
|
+
}
|
|
363
|
+
if (token.startsWith("(") && token.endsWith(")")) return {
|
|
364
|
+
type: "group-expr",
|
|
365
|
+
inner: token.slice(1, -1),
|
|
366
|
+
raw: token
|
|
367
|
+
};
|
|
368
|
+
const openIdx = token.indexOf("(");
|
|
369
|
+
if (openIdx > 0 && token.endsWith(")")) {
|
|
370
|
+
const fname = token.slice(0, openIdx);
|
|
371
|
+
const args = token.slice(openIdx + 1, -1);
|
|
372
|
+
if (opts.skipFuncValidation) return {
|
|
373
|
+
type: "css-function",
|
|
374
|
+
name: fname,
|
|
375
|
+
args,
|
|
376
|
+
raw: token
|
|
377
|
+
};
|
|
378
|
+
const knownFuncs = toSet(opts.knownFuncs);
|
|
379
|
+
if (COLOR_FUNCS.has(fname) || CSS_FUNCS.has(fname) || knownFuncs.has(fname)) return {
|
|
380
|
+
type: "css-function",
|
|
381
|
+
name: fname,
|
|
382
|
+
args,
|
|
383
|
+
raw: token
|
|
384
|
+
};
|
|
385
|
+
errors.push({
|
|
386
|
+
message: `Unknown function '${fname}()'.`,
|
|
387
|
+
offset,
|
|
388
|
+
length: token.length,
|
|
389
|
+
raw: token
|
|
390
|
+
});
|
|
391
|
+
return {
|
|
392
|
+
type: "css-function",
|
|
393
|
+
name: fname,
|
|
394
|
+
args,
|
|
395
|
+
raw: token
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
const unitMatch = token.match(RE_UNIT_NUM);
|
|
399
|
+
if (unitMatch) {
|
|
400
|
+
const unit = unitMatch[1];
|
|
401
|
+
const numVal = parseFloat(token.slice(0, -unit.length));
|
|
402
|
+
if (opts.skipUnitValidation) return {
|
|
403
|
+
type: "custom-unit",
|
|
404
|
+
value: numVal,
|
|
405
|
+
unit,
|
|
406
|
+
raw: token
|
|
407
|
+
};
|
|
408
|
+
const knownUnits = toSet(opts.knownUnits);
|
|
409
|
+
if (BUILT_IN_UNITS.has(unit) || knownUnits.has(unit)) return {
|
|
410
|
+
type: "custom-unit",
|
|
411
|
+
value: numVal,
|
|
412
|
+
unit,
|
|
413
|
+
raw: token
|
|
414
|
+
};
|
|
415
|
+
if (CSS_UNITS.has(unit)) return {
|
|
416
|
+
type: "css-unit",
|
|
417
|
+
value: numVal,
|
|
418
|
+
unit,
|
|
419
|
+
raw: token
|
|
420
|
+
};
|
|
421
|
+
errors.push({
|
|
422
|
+
message: `Unknown unit '${unit}' in '${token}'.`,
|
|
423
|
+
offset,
|
|
424
|
+
length: token.length,
|
|
425
|
+
raw: token
|
|
426
|
+
});
|
|
427
|
+
return {
|
|
428
|
+
type: "unknown",
|
|
429
|
+
raw: token
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
const cssUnitMatch = token.match(RE_CSS_UNIT_NUM);
|
|
433
|
+
if (cssUnitMatch) {
|
|
434
|
+
const unit = cssUnitMatch[1];
|
|
435
|
+
const numVal = parseFloat(token.slice(0, -unit.length));
|
|
436
|
+
if (CSS_UNITS.has(unit)) return {
|
|
437
|
+
type: "css-unit",
|
|
438
|
+
value: numVal,
|
|
439
|
+
unit,
|
|
440
|
+
raw: token
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
if (RE_NUMBER.test(token)) return {
|
|
444
|
+
type: "number",
|
|
445
|
+
value: parseFloat(token),
|
|
446
|
+
raw: token
|
|
447
|
+
};
|
|
448
|
+
if (VALUE_KEYWORDS.has(token) || VALUE_KEYWORDS.has(token.toLowerCase())) return {
|
|
449
|
+
type: "keyword",
|
|
450
|
+
value: token
|
|
451
|
+
};
|
|
452
|
+
if (token.startsWith("var(") && token.endsWith(")")) return {
|
|
453
|
+
type: "css-function",
|
|
454
|
+
name: "var",
|
|
455
|
+
args: token.slice(4, -1),
|
|
456
|
+
raw: token
|
|
457
|
+
};
|
|
458
|
+
return {
|
|
459
|
+
type: "unknown",
|
|
460
|
+
raw: token
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
function classifyColorToken(token, offset, errors) {
|
|
464
|
+
const raw = token;
|
|
465
|
+
const name = token.slice(1);
|
|
466
|
+
if (name.length === 0) {
|
|
467
|
+
errors.push({
|
|
468
|
+
message: "Empty color token name.",
|
|
469
|
+
offset,
|
|
470
|
+
length: token.length,
|
|
471
|
+
raw
|
|
472
|
+
});
|
|
473
|
+
return {
|
|
474
|
+
type: "unknown",
|
|
475
|
+
raw
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
const dotIndex = name.indexOf(".");
|
|
479
|
+
if (dotIndex !== -1) {
|
|
480
|
+
const tokenName = name.slice(0, dotIndex);
|
|
481
|
+
const opacitySuffix = name.slice(dotIndex + 1);
|
|
482
|
+
if (tokenName.length === 0) {
|
|
483
|
+
errors.push({
|
|
484
|
+
message: "Empty color token name before opacity.",
|
|
485
|
+
offset,
|
|
486
|
+
length: token.length,
|
|
487
|
+
raw
|
|
488
|
+
});
|
|
489
|
+
return {
|
|
490
|
+
type: "unknown",
|
|
491
|
+
raw
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
if (opacitySuffix.startsWith("$")) return {
|
|
495
|
+
type: "color-token",
|
|
496
|
+
name: tokenName,
|
|
497
|
+
opacity: opacitySuffix,
|
|
498
|
+
raw
|
|
499
|
+
};
|
|
500
|
+
if (opacitySuffix.length === 0) {
|
|
501
|
+
errors.push({
|
|
502
|
+
message: "Trailing dot with no opacity value.",
|
|
503
|
+
offset,
|
|
504
|
+
length: token.length,
|
|
505
|
+
raw
|
|
506
|
+
});
|
|
507
|
+
return {
|
|
508
|
+
type: "unknown",
|
|
509
|
+
raw
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
const opacity = Number(opacitySuffix);
|
|
513
|
+
if (isNaN(opacity)) {
|
|
514
|
+
errors.push({
|
|
515
|
+
message: `Invalid opacity value '${opacitySuffix}'.`,
|
|
516
|
+
offset,
|
|
517
|
+
length: token.length,
|
|
518
|
+
raw
|
|
519
|
+
});
|
|
520
|
+
return {
|
|
521
|
+
type: "unknown",
|
|
522
|
+
raw
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
if (opacity < 0) {
|
|
526
|
+
errors.push({
|
|
527
|
+
message: "Opacity cannot be negative.",
|
|
528
|
+
offset,
|
|
529
|
+
length: token.length,
|
|
530
|
+
raw
|
|
531
|
+
});
|
|
532
|
+
return {
|
|
533
|
+
type: "unknown",
|
|
534
|
+
raw
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
if (opacity > 100) {
|
|
538
|
+
errors.push({
|
|
539
|
+
message: `Opacity '${opacitySuffix}' exceeds 100.`,
|
|
540
|
+
offset,
|
|
541
|
+
length: token.length,
|
|
542
|
+
raw
|
|
543
|
+
});
|
|
544
|
+
return {
|
|
545
|
+
type: "unknown",
|
|
546
|
+
raw
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
return {
|
|
550
|
+
type: "color-token",
|
|
551
|
+
name: tokenName,
|
|
552
|
+
opacity: opacitySuffix,
|
|
553
|
+
raw
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
return {
|
|
557
|
+
type: "color-token",
|
|
558
|
+
name,
|
|
559
|
+
raw
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Parse a style value string into typed tokens organized by
|
|
564
|
+
* comma-separated groups and slash-separated parts.
|
|
565
|
+
*/
|
|
566
|
+
function parseValue(src, opts = {}) {
|
|
567
|
+
const errors = [];
|
|
568
|
+
const bracketError = checkBracketBalance(src);
|
|
569
|
+
if (bracketError) {
|
|
570
|
+
errors.push({
|
|
571
|
+
message: bracketError.message,
|
|
572
|
+
offset: bracketError.position,
|
|
573
|
+
length: 1
|
|
574
|
+
});
|
|
575
|
+
return {
|
|
576
|
+
groups: [],
|
|
577
|
+
errors
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
const scanned = scanTokens(src);
|
|
581
|
+
const groups = [];
|
|
582
|
+
let currentParts = [];
|
|
583
|
+
let currentTokens = [];
|
|
584
|
+
const endPart = () => {
|
|
585
|
+
if (currentTokens.length > 0) {
|
|
586
|
+
currentParts.push({ tokens: currentTokens });
|
|
587
|
+
currentTokens = [];
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
const endGroup = () => {
|
|
591
|
+
endPart();
|
|
592
|
+
if (currentParts.length > 0) groups.push({ parts: currentParts });
|
|
593
|
+
else groups.push({ parts: [{ tokens: [] }] });
|
|
594
|
+
currentParts = [];
|
|
595
|
+
};
|
|
596
|
+
for (const scanned_token of scanned) {
|
|
597
|
+
if (scanned_token.value) {
|
|
598
|
+
const classified = classifyToken(scanned_token.value, scanned_token.offset, errors, opts);
|
|
599
|
+
currentTokens.push(classified);
|
|
600
|
+
}
|
|
601
|
+
if (scanned_token.isSlash) endPart();
|
|
602
|
+
if (scanned_token.isComma) endGroup();
|
|
603
|
+
}
|
|
604
|
+
if (currentTokens.length > 0 || currentParts.length > 0 || groups.length === 0) endGroup();
|
|
605
|
+
return {
|
|
606
|
+
groups,
|
|
607
|
+
errors
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
//#endregion
|
|
612
|
+
export { parseValue };
|
|
613
|
+
//# sourceMappingURL=value-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-parser.js","names":[],"sources":["../../src/parsers/value-parser.ts"],"sourcesContent":["import { scanTokens, checkBracketBalance } from './utils.js';\nimport { BUILT_IN_UNITS, CSS_UNITS } from '../constants.js';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type ValueToken =\n | { type: 'color-token'; name: string; opacity?: string; raw: string }\n | { type: 'color-ref'; name: string; raw: string }\n | { type: 'custom-prop'; name: string; raw: string }\n | { type: 'custom-prop-ref'; name: string; raw: string }\n | { type: 'custom-unit'; value: number; unit: string; raw: string }\n | { type: 'css-unit'; value: number; unit: string; raw: string }\n | { type: 'number'; value: number; raw: string }\n | { type: 'keyword'; value: string }\n | { type: 'css-function'; name: string; args: string; raw: string }\n | { type: 'string'; value: string; raw: string }\n | { type: 'important'; raw: string }\n | { type: 'group-expr'; inner: string; raw: string }\n | { type: 'unknown'; raw: string };\n\nexport interface ValueError {\n message: string;\n offset: number;\n length: number;\n raw?: string;\n}\n\nexport interface ValuePart {\n tokens: ValueToken[];\n}\n\nexport interface ValueGroup {\n parts: ValuePart[];\n}\n\nexport interface ValueParseResult {\n groups: ValueGroup[];\n errors: ValueError[];\n}\n\nexport interface ValueParserOptions {\n knownUnits?: Set<string> | string[];\n knownFuncs?: Set<string> | string[];\n skipUnitValidation?: boolean;\n skipFuncValidation?: boolean;\n}\n\n// ============================================================================\n// Constants\n// ============================================================================\n\nconst RE_UNIT_NUM = /^[+-]?(?:\\d*\\.\\d+|\\d+)([a-z][a-z0-9]*)$/;\nconst RE_NUMBER = /^[+-]?(?:\\d*\\.\\d+|\\d+)$/;\nconst RE_CSS_UNIT_NUM = /^[+-]?(?:\\d*\\.\\d+|\\d+)([a-z%]+)$/;\n\nconst COLOR_FUNCS = new Set([\n 'rgb',\n 'rgba',\n 'hsl',\n 'hsla',\n 'hwb',\n 'lab',\n 'lch',\n 'oklab',\n 'oklch',\n 'color',\n 'device-cmyk',\n 'gray',\n 'color-mix',\n 'color-contrast',\n]);\n\nconst CSS_FUNCS = new Set([\n 'calc',\n 'min',\n 'max',\n 'clamp',\n 'var',\n 'env',\n 'attr',\n 'counter',\n 'counters',\n 'image-set',\n 'linear-gradient',\n 'radial-gradient',\n 'conic-gradient',\n 'repeating-linear-gradient',\n 'repeating-radial-gradient',\n 'repeating-conic-gradient',\n 'url',\n 'fit-content',\n 'minmax',\n 'repeat',\n 'cubic-bezier',\n 'steps',\n 'linear',\n 'rotate',\n 'scale',\n 'translate',\n 'skew',\n 'matrix',\n 'perspective',\n 'rotate3d',\n 'rotateX',\n 'rotateY',\n 'rotateZ',\n 'scale3d',\n 'scaleX',\n 'scaleY',\n 'scaleZ',\n 'translate3d',\n 'translateX',\n 'translateY',\n 'translateZ',\n 'skewX',\n 'skewY',\n 'matrix3d',\n 'blur',\n 'brightness',\n 'contrast',\n 'drop-shadow',\n 'grayscale',\n 'hue-rotate',\n 'invert',\n 'opacity',\n 'saturate',\n 'sepia',\n 'polygon',\n 'circle',\n 'ellipse',\n 'inset',\n 'path',\n 'light-dark',\n]);\n\nconst VALUE_KEYWORDS = new Set([\n 'auto',\n 'none',\n 'normal',\n 'inherit',\n 'initial',\n 'unset',\n 'revert',\n 'revert-layer',\n 'max-content',\n 'min-content',\n 'fit-content',\n 'stretch',\n 'transparent',\n 'currentcolor',\n 'currentColor',\n // display\n 'block',\n 'inline',\n 'inline-block',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'contents',\n 'table',\n 'table-row',\n 'table-cell',\n 'list-item',\n 'flow-root',\n // position\n 'static',\n 'relative',\n 'absolute',\n 'fixed',\n 'sticky',\n // overflow\n 'visible',\n 'hidden',\n 'scroll',\n 'clip',\n 'overlay',\n // flex/align\n 'center',\n 'start',\n 'end',\n 'flex-start',\n 'flex-end',\n 'space-between',\n 'space-around',\n 'space-evenly',\n 'baseline',\n // flow\n 'row',\n 'column',\n 'row-reverse',\n 'column-reverse',\n 'wrap',\n 'nowrap',\n 'dense',\n // border\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n // directional\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n // radius shapes\n 'round',\n 'ellipse',\n 'leaf',\n 'backleaf',\n // dimension modifiers\n 'min',\n 'max',\n // text\n 'bold',\n 'bolder',\n 'lighter',\n 'italic',\n 'oblique',\n 'uppercase',\n 'lowercase',\n 'capitalize',\n 'line-through',\n 'underline',\n 'overline',\n 'wavy',\n // cursor\n 'pointer',\n 'default',\n 'text',\n 'move',\n 'grab',\n 'grabbing',\n 'not-allowed',\n 'crosshair',\n 'wait',\n 'help',\n 'col-resize',\n 'row-resize',\n 'n-resize',\n 's-resize',\n 'e-resize',\n 'w-resize',\n 'ne-resize',\n 'nw-resize',\n 'se-resize',\n 'sw-resize',\n 'ew-resize',\n 'ns-resize',\n 'zoom-in',\n 'zoom-out',\n // misc\n 'cover',\n 'contain',\n 'fill',\n 'no-repeat',\n 'repeat-x',\n 'repeat-y',\n 'border-box',\n 'padding-box',\n 'content-box',\n 'break-word',\n 'break-all',\n 'keep-all',\n 'anywhere',\n 'pre',\n 'pre-wrap',\n 'pre-line',\n 'balance',\n 'smooth',\n 'horizontal',\n 'vertical',\n 'both',\n 'mandatory',\n 'proximity',\n // white-space\n 'collapse',\n 'preserve',\n 'preserve-breaks',\n 'break-spaces',\n // text-wrap\n 'pretty',\n 'stable',\n // will-change\n 'transform',\n 'opacity',\n // animation\n 'infinite',\n 'alternate',\n 'alternate-reverse',\n 'reverse',\n 'forwards',\n 'backwards',\n 'running',\n 'paused',\n 'ease',\n 'ease-in',\n 'ease-out',\n 'ease-in-out',\n 'step-start',\n 'step-end',\n // scrollbar\n 'thin',\n 'always',\n 'both-edges',\n // width/height\n 'fixed',\n // shadow\n 'inset',\n // textOverflow\n 'clip',\n // other\n 'ltr',\n 'rtl',\n 'embed',\n 'isolate',\n 'isolate-override',\n 'plaintext',\n 'horizontal-tb',\n 'vertical-rl',\n 'vertical-lr',\n 'sideways-rl',\n 'sideways-lr',\n 'monospace',\n 'serif',\n 'sans-serif',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-monospace',\n 'ui-rounded',\n 'to',\n // misc\n 'strong',\n 'tight',\n 'icon',\n]);\n\n// ============================================================================\n// Classifier\n// ============================================================================\n\nfunction toSet(input?: Set<string> | string[]): Set<string> {\n if (!input) return new Set();\n return input instanceof Set ? input : new Set(input);\n}\n\nfunction classifyToken(\n raw: string,\n offset: number,\n errors: ValueError[],\n opts: ValueParserOptions,\n): ValueToken {\n const token = raw.trim();\n if (!token) return { type: 'keyword', value: '' };\n\n // Quoted strings\n if (\n (token.startsWith('\"') && token.endsWith('\"')) ||\n (token.startsWith(\"'\") && token.endsWith(\"'\"))\n ) {\n return { type: 'string', value: token.slice(1, -1), raw: token };\n }\n\n // !important\n if (token === '!important') {\n return { type: 'important', raw: token };\n }\n\n // Double prefix: $$name (custom property reference for transitions)\n if (token.startsWith('$$')) {\n const name = token.slice(2);\n if (/^[a-z_][a-z0-9-_]*$/i.test(name)) {\n return { type: 'custom-prop-ref', name, raw: token };\n }\n errors.push({\n message: `Invalid custom property reference '${token}'.`,\n offset,\n length: token.length,\n raw: token,\n });\n return { type: 'unknown', raw: token };\n }\n\n // Double prefix: ##name (color reference for transitions)\n if (token.startsWith('##')) {\n const name = token.slice(2);\n if (/^[a-z_][a-z0-9-_]*$/i.test(name)) {\n return { type: 'color-ref', name, raw: token };\n }\n errors.push({\n message: `Invalid color reference '${token}'.`,\n offset,\n length: token.length,\n raw: token,\n });\n return { type: 'unknown', raw: token };\n }\n\n // Custom property: $name\n if (token.startsWith('$')) {\n const name = token.slice(1);\n if (/^[a-z_][a-z0-9-_]*$/i.test(name)) {\n return { type: 'custom-prop', name, raw: token };\n }\n errors.push({\n message: `Invalid custom property syntax '${token}'.`,\n offset,\n length: token.length,\n raw: token,\n });\n return { type: 'unknown', raw: token };\n }\n\n // Color token: #name, #name.N, #name.$prop, or bare # (error)\n if (token.startsWith('#')) {\n if (token.length === 1) {\n errors.push({\n message: 'Empty color token name.',\n offset,\n length: 1,\n raw: token,\n });\n return { type: 'unknown', raw: token };\n }\n return classifyColorToken(token, offset, errors);\n }\n\n // Parenthesized expression: (expr) — fallback, auto-calc, etc.\n if (token.startsWith('(') && token.endsWith(')')) {\n return { type: 'group-expr', inner: token.slice(1, -1), raw: token };\n }\n\n // Function call: name(...)\n const openIdx = token.indexOf('(');\n if (openIdx > 0 && token.endsWith(')')) {\n const fname = token.slice(0, openIdx);\n const args = token.slice(openIdx + 1, -1);\n\n if (opts.skipFuncValidation) {\n return { type: 'css-function', name: fname, args, raw: token };\n }\n\n const knownFuncs = toSet(opts.knownFuncs);\n\n if (\n COLOR_FUNCS.has(fname) ||\n CSS_FUNCS.has(fname) ||\n knownFuncs.has(fname)\n ) {\n return { type: 'css-function', name: fname, args, raw: token };\n }\n\n // Unknown function — still return as css-function but flag it\n errors.push({\n message: `Unknown function '${fname}()'.`,\n offset,\n length: token.length,\n raw: token,\n });\n return { type: 'css-function', name: fname, args, raw: token };\n }\n\n // Unit number: 2x, 1.5r, 10px, 50%, 1fr\n const unitMatch = token.match(RE_UNIT_NUM);\n if (unitMatch) {\n const unit = unitMatch[1];\n const numVal = parseFloat(token.slice(0, -unit.length));\n\n if (opts.skipUnitValidation) {\n return { type: 'custom-unit', value: numVal, unit, raw: token };\n }\n\n const knownUnits = toSet(opts.knownUnits);\n\n if (BUILT_IN_UNITS.has(unit) || knownUnits.has(unit)) {\n return { type: 'custom-unit', value: numVal, unit, raw: token };\n }\n if (CSS_UNITS.has(unit)) {\n return { type: 'css-unit', value: numVal, unit, raw: token };\n }\n\n errors.push({\n message: `Unknown unit '${unit}' in '${token}'.`,\n offset,\n length: token.length,\n raw: token,\n });\n return { type: 'unknown', raw: token };\n }\n\n // CSS unit with % (RE_UNIT_NUM doesn't match % since it expects alpha)\n const cssUnitMatch = token.match(RE_CSS_UNIT_NUM);\n if (cssUnitMatch) {\n const unit = cssUnitMatch[1];\n const numVal = parseFloat(token.slice(0, -unit.length));\n if (CSS_UNITS.has(unit)) {\n return { type: 'css-unit', value: numVal, unit, raw: token };\n }\n }\n\n // Plain number\n if (RE_NUMBER.test(token)) {\n return { type: 'number', value: parseFloat(token), raw: token };\n }\n\n // Known keyword\n if (VALUE_KEYWORDS.has(token) || VALUE_KEYWORDS.has(token.toLowerCase())) {\n return { type: 'keyword', value: token };\n }\n\n // CSS custom property function var(--name)\n if (token.startsWith('var(') && token.endsWith(')')) {\n return {\n type: 'css-function',\n name: 'var',\n args: token.slice(4, -1),\n raw: token,\n };\n }\n\n // Unknown token\n return { type: 'unknown', raw: token };\n}\n\nfunction classifyColorToken(\n token: string,\n offset: number,\n errors: ValueError[],\n): ValueToken {\n const raw = token;\n\n // Strip leading #\n const name = token.slice(1);\n\n if (name.length === 0) {\n errors.push({\n message: 'Empty color token name.',\n offset,\n length: token.length,\n raw,\n });\n return { type: 'unknown', raw };\n }\n\n // Check for opacity suffix\n const dotIndex = name.indexOf('.');\n if (dotIndex !== -1) {\n const tokenName = name.slice(0, dotIndex);\n const opacitySuffix = name.slice(dotIndex + 1);\n\n if (tokenName.length === 0) {\n errors.push({\n message: 'Empty color token name before opacity.',\n offset,\n length: token.length,\n raw,\n });\n return { type: 'unknown', raw };\n }\n\n // Dynamic opacity from CSS custom property\n if (opacitySuffix.startsWith('$')) {\n return { type: 'color-token', name: tokenName, opacity: opacitySuffix, raw };\n }\n\n if (opacitySuffix.length === 0) {\n errors.push({\n message: 'Trailing dot with no opacity value.',\n offset,\n length: token.length,\n raw,\n });\n return { type: 'unknown', raw };\n }\n\n const opacity = Number(opacitySuffix);\n if (isNaN(opacity)) {\n errors.push({\n message: `Invalid opacity value '${opacitySuffix}'.`,\n offset,\n length: token.length,\n raw,\n });\n return { type: 'unknown', raw };\n }\n if (opacity < 0) {\n errors.push({\n message: 'Opacity cannot be negative.',\n offset,\n length: token.length,\n raw,\n });\n return { type: 'unknown', raw };\n }\n if (opacity > 100) {\n errors.push({\n message: `Opacity '${opacitySuffix}' exceeds 100.`,\n offset,\n length: token.length,\n raw,\n });\n return { type: 'unknown', raw };\n }\n\n return {\n type: 'color-token',\n name: tokenName,\n opacity: opacitySuffix,\n raw,\n };\n }\n\n return { type: 'color-token', name, raw };\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\n/**\n * Parse a style value string into typed tokens organized by\n * comma-separated groups and slash-separated parts.\n */\nexport function parseValue(\n src: string,\n opts: ValueParserOptions = {},\n): ValueParseResult {\n const errors: ValueError[] = [];\n\n // Check bracket balance first\n const bracketError = checkBracketBalance(src);\n if (bracketError) {\n errors.push({\n message: bracketError.message,\n offset: bracketError.position,\n length: 1,\n });\n return { groups: [], errors };\n }\n\n const scanned = scanTokens(src);\n\n const groups: ValueGroup[] = [];\n let currentParts: ValuePart[] = [];\n let currentTokens: ValueToken[] = [];\n\n const endPart = () => {\n if (currentTokens.length > 0) {\n currentParts.push({ tokens: currentTokens });\n currentTokens = [];\n }\n };\n\n const endGroup = () => {\n endPart();\n if (currentParts.length > 0) {\n groups.push({ parts: currentParts });\n } else {\n groups.push({ parts: [{ tokens: [] }] });\n }\n currentParts = [];\n };\n\n for (const scanned_token of scanned) {\n if (scanned_token.value) {\n const classified = classifyToken(\n scanned_token.value,\n scanned_token.offset,\n errors,\n opts,\n );\n currentTokens.push(classified);\n }\n if (scanned_token.isSlash) endPart();\n if (scanned_token.isComma) endGroup();\n }\n\n // Push final group\n if (currentTokens.length > 0 || currentParts.length > 0 || groups.length === 0) {\n endGroup();\n }\n\n return { groups, errors };\n}\n\n/**\n * Extract all tokens of a specific type from a parse result.\n */\nexport function extractTokensByType<T extends ValueToken['type']>(\n result: ValueParseResult,\n type: T,\n): Extract<ValueToken, { type: T }>[] {\n const tokens: Extract<ValueToken, { type: T }>[] = [];\n for (const group of result.groups) {\n for (const part of group.parts) {\n for (const token of part.tokens) {\n if (token.type === type) {\n tokens.push(token as Extract<ValueToken, { type: T }>);\n }\n }\n }\n }\n return tokens;\n}\n\n/**\n * Get a flat list of all tokens from a parse result.\n */\nexport function flattenTokens(result: ValueParseResult): ValueToken[] {\n const tokens: ValueToken[] = [];\n for (const group of result.groups) {\n for (const part of group.parts) {\n tokens.push(...part.tokens);\n }\n }\n return tokens;\n}\n"],"mappings":";;;;AAqDA,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,kBAAkB;AAExB,MAAM,cAAc,IAAI,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,YAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,iBAAiB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CAEA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACD,CAAC;AAMF,SAAS,MAAM,OAA6C;AAC1D,KAAI,CAAC,MAAO,wBAAO,IAAI,KAAK;AAC5B,QAAO,iBAAiB,MAAM,QAAQ,IAAI,IAAI,MAAM;;AAGtD,SAAS,cACP,KACA,QACA,QACA,MACY;CACZ,MA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