tailwind-clamp 4.0.2 → 4.0.4
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/README.md +12 -15
- package/dist/index.js +1829 -151
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,344 +1,450 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var at = (t, e, n) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var y = (t, e, n) => at(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
function je(t, e) {
|
|
5
|
+
return { handler: t, config: e };
|
|
3
6
|
}
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
return { handler: r
|
|
7
|
+
je.withOptions = function(t, e = () => ({})) {
|
|
8
|
+
function n(r) {
|
|
9
|
+
return { handler: t(r), config: e(r) };
|
|
7
10
|
}
|
|
8
|
-
return
|
|
11
|
+
return n.__isOptionsFunction = !0, n;
|
|
9
12
|
};
|
|
10
|
-
var
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"skewX(var(--tw-skew-x))",
|
|
15
|
-
"skewY(var(--tw-skew-y))",
|
|
16
|
-
"scaleX(var(--tw-scale-x))",
|
|
17
|
-
"scaleY(var(--tw-scale-y))"
|
|
18
|
-
].join(" "), L = (r) => {
|
|
19
|
-
switch (r) {
|
|
13
|
+
var st = je;
|
|
14
|
+
const ut = (t) => {
|
|
15
|
+
switch (t) {
|
|
16
|
+
// Sizing & Spacing
|
|
20
17
|
case "p":
|
|
21
18
|
return {
|
|
19
|
+
type: "spacing",
|
|
22
20
|
key: "padding",
|
|
23
21
|
props: ["padding"]
|
|
24
22
|
};
|
|
25
23
|
case "pt":
|
|
26
24
|
return {
|
|
25
|
+
type: "spacing",
|
|
27
26
|
key: "padding",
|
|
28
27
|
props: ["paddingTop"]
|
|
29
28
|
};
|
|
30
29
|
case "pb":
|
|
31
30
|
return {
|
|
31
|
+
type: "spacing",
|
|
32
32
|
key: "padding",
|
|
33
33
|
props: ["paddingBottom"]
|
|
34
34
|
};
|
|
35
35
|
case "pl":
|
|
36
36
|
return {
|
|
37
|
+
type: "spacing",
|
|
37
38
|
key: "padding",
|
|
38
39
|
props: ["paddingLeft"]
|
|
39
40
|
};
|
|
40
41
|
case "ps":
|
|
41
42
|
return {
|
|
43
|
+
type: "spacing",
|
|
42
44
|
key: "padding",
|
|
43
45
|
props: ["paddingInlineStart"]
|
|
44
46
|
};
|
|
45
47
|
case "pr":
|
|
46
48
|
return {
|
|
49
|
+
type: "spacing",
|
|
47
50
|
key: "padding",
|
|
48
51
|
props: ["paddingRight"]
|
|
49
52
|
};
|
|
50
53
|
case "pe":
|
|
51
54
|
return {
|
|
55
|
+
type: "spacing",
|
|
52
56
|
key: "padding",
|
|
53
57
|
props: ["paddingInlineEnd"]
|
|
54
58
|
};
|
|
55
59
|
case "px":
|
|
56
60
|
return {
|
|
61
|
+
type: "spacing",
|
|
57
62
|
key: "padding",
|
|
58
63
|
props: ["paddingInline"]
|
|
59
64
|
};
|
|
60
65
|
case "py":
|
|
61
66
|
return {
|
|
67
|
+
type: "spacing",
|
|
62
68
|
key: "padding",
|
|
63
69
|
props: ["paddingBlock"]
|
|
64
70
|
};
|
|
65
71
|
case "m":
|
|
66
72
|
return {
|
|
73
|
+
type: "spacing",
|
|
67
74
|
key: "margin",
|
|
68
75
|
props: ["margin"]
|
|
69
76
|
};
|
|
70
77
|
case "mt":
|
|
71
78
|
return {
|
|
79
|
+
type: "spacing",
|
|
72
80
|
key: "margin",
|
|
73
81
|
props: ["marginTop"]
|
|
74
82
|
};
|
|
75
83
|
case "mb":
|
|
76
84
|
return {
|
|
85
|
+
type: "spacing",
|
|
77
86
|
key: "margin",
|
|
78
87
|
props: ["marginBottom"]
|
|
79
88
|
};
|
|
80
89
|
case "ml":
|
|
81
90
|
return {
|
|
91
|
+
type: "spacing",
|
|
82
92
|
key: "margin",
|
|
83
93
|
props: ["marginLeft"]
|
|
84
94
|
};
|
|
85
95
|
case "ms":
|
|
86
96
|
return {
|
|
97
|
+
type: "spacing",
|
|
87
98
|
key: "margin",
|
|
88
99
|
props: ["marginInlineStart"]
|
|
89
100
|
};
|
|
90
101
|
case "mr":
|
|
91
102
|
return {
|
|
103
|
+
type: "spacing",
|
|
92
104
|
key: "margin",
|
|
93
105
|
props: ["marginRight"]
|
|
94
106
|
};
|
|
95
107
|
case "me":
|
|
96
108
|
return {
|
|
109
|
+
type: "spacing",
|
|
97
110
|
key: "margin",
|
|
98
111
|
props: ["marginInlineEnd"]
|
|
99
112
|
};
|
|
100
113
|
case "mx":
|
|
101
114
|
return {
|
|
115
|
+
type: "spacing",
|
|
102
116
|
key: "margin",
|
|
103
117
|
props: ["marginInline"]
|
|
104
118
|
};
|
|
105
119
|
case "my":
|
|
106
120
|
return {
|
|
121
|
+
type: "spacing",
|
|
107
122
|
key: "margin",
|
|
108
123
|
props: ["marginBlock"]
|
|
109
124
|
};
|
|
110
125
|
case "inset":
|
|
111
126
|
return {
|
|
127
|
+
type: "spacing",
|
|
112
128
|
key: "inset",
|
|
113
129
|
props: ["inset"]
|
|
114
130
|
};
|
|
115
131
|
case "inset-x":
|
|
116
132
|
return {
|
|
133
|
+
type: "spacing",
|
|
117
134
|
key: "inset",
|
|
118
135
|
props: ["insetInline"]
|
|
119
136
|
};
|
|
120
137
|
case "inset-y":
|
|
121
138
|
return {
|
|
139
|
+
type: "spacing",
|
|
122
140
|
key: "inset",
|
|
123
141
|
props: ["insetBlock"]
|
|
124
142
|
};
|
|
125
143
|
case "start":
|
|
126
144
|
return {
|
|
145
|
+
type: "spacing",
|
|
127
146
|
key: "inset",
|
|
128
147
|
props: ["insetInlineStart"]
|
|
129
148
|
};
|
|
130
149
|
case "end":
|
|
131
150
|
return {
|
|
151
|
+
type: "spacing",
|
|
132
152
|
key: "inset",
|
|
133
153
|
props: ["insetInlineEnd"]
|
|
134
154
|
};
|
|
135
155
|
case "top":
|
|
136
156
|
return {
|
|
157
|
+
type: "spacing",
|
|
137
158
|
key: "inset",
|
|
138
159
|
props: ["top"]
|
|
139
160
|
};
|
|
140
161
|
case "left":
|
|
141
162
|
return {
|
|
163
|
+
type: "spacing",
|
|
142
164
|
key: "inset",
|
|
143
165
|
props: ["left"]
|
|
144
166
|
};
|
|
145
167
|
case "right":
|
|
146
168
|
return {
|
|
169
|
+
type: "spacing",
|
|
147
170
|
key: "inset",
|
|
148
171
|
props: ["right"]
|
|
149
172
|
};
|
|
150
173
|
case "bottom":
|
|
151
174
|
return {
|
|
175
|
+
type: "spacing",
|
|
152
176
|
key: "inset",
|
|
153
177
|
props: ["bottom"]
|
|
154
178
|
};
|
|
155
|
-
case "text":
|
|
156
|
-
return {
|
|
157
|
-
key: "fontSize",
|
|
158
|
-
props: ["fontSize"]
|
|
159
|
-
};
|
|
160
179
|
case "gap":
|
|
161
180
|
return {
|
|
181
|
+
type: "spacing",
|
|
162
182
|
key: "gap",
|
|
163
183
|
props: ["gap"]
|
|
164
184
|
};
|
|
165
185
|
case "gap-x":
|
|
166
186
|
return {
|
|
187
|
+
type: "spacing",
|
|
167
188
|
key: "gap",
|
|
168
189
|
props: ["columnGap"]
|
|
169
190
|
};
|
|
170
191
|
case "gap-y":
|
|
171
192
|
return {
|
|
193
|
+
type: "spacing",
|
|
172
194
|
key: "gap",
|
|
173
195
|
props: ["rowGap"]
|
|
174
196
|
};
|
|
175
197
|
case "w":
|
|
176
198
|
return {
|
|
199
|
+
type: "spacing",
|
|
177
200
|
key: "width",
|
|
178
201
|
props: ["width"]
|
|
179
202
|
};
|
|
180
203
|
case "h":
|
|
181
204
|
return {
|
|
205
|
+
type: "spacing",
|
|
182
206
|
key: "height",
|
|
183
207
|
props: ["height"]
|
|
184
208
|
};
|
|
185
209
|
case "size":
|
|
186
210
|
return {
|
|
211
|
+
type: "spacing",
|
|
187
212
|
key: "size",
|
|
188
213
|
props: ["width", "height"]
|
|
189
214
|
};
|
|
190
215
|
case "min-w":
|
|
191
216
|
return {
|
|
217
|
+
type: "spacing",
|
|
192
218
|
key: "minWidth",
|
|
193
219
|
props: ["minWidth"]
|
|
194
220
|
};
|
|
195
221
|
case "min-h":
|
|
196
222
|
return {
|
|
223
|
+
type: "spacing",
|
|
197
224
|
key: "minHeight",
|
|
198
225
|
props: ["minHeight"]
|
|
199
226
|
};
|
|
200
227
|
case "max-w":
|
|
201
228
|
return {
|
|
229
|
+
type: "spacing",
|
|
202
230
|
key: "maxWidth",
|
|
203
231
|
props: ["maxWidth"]
|
|
204
232
|
};
|
|
205
233
|
case "max-h":
|
|
206
234
|
return {
|
|
235
|
+
type: "spacing",
|
|
207
236
|
key: "maxHeight",
|
|
208
237
|
props: ["maxHeight"]
|
|
209
238
|
};
|
|
210
|
-
case "
|
|
211
|
-
return {
|
|
212
|
-
key: "borderRadius",
|
|
213
|
-
props: ["borderRadius"]
|
|
214
|
-
};
|
|
215
|
-
case "rounded-t":
|
|
216
|
-
return {
|
|
217
|
-
key: "borderRadius",
|
|
218
|
-
props: ["borderTopLeftRadius", "borderTopRightRadius"]
|
|
219
|
-
};
|
|
220
|
-
case "rounded-r":
|
|
221
|
-
return {
|
|
222
|
-
key: "borderRadius",
|
|
223
|
-
props: ["borderTopRightRadius", "borderBottomRightRadius"]
|
|
224
|
-
};
|
|
225
|
-
case "rounded-b":
|
|
226
|
-
return {
|
|
227
|
-
key: "borderRadius",
|
|
228
|
-
props: ["borderBottomLeftRadius", "borderBottomRightRadius"]
|
|
229
|
-
};
|
|
230
|
-
case "rounded-l":
|
|
231
|
-
return {
|
|
232
|
-
key: "borderRadius",
|
|
233
|
-
props: ["borderTopLeftRadius", "borderBottomLeftRadius"]
|
|
234
|
-
};
|
|
235
|
-
case "rounded-tl":
|
|
236
|
-
return {
|
|
237
|
-
key: "borderRadius",
|
|
238
|
-
props: ["borderTopLeftRadius"]
|
|
239
|
-
};
|
|
240
|
-
case "rounded-tr":
|
|
241
|
-
return {
|
|
242
|
-
key: "borderRadius",
|
|
243
|
-
props: ["borderTopRightRadius"]
|
|
244
|
-
};
|
|
245
|
-
case "rounded-bl":
|
|
239
|
+
case "scroll-m":
|
|
246
240
|
return {
|
|
247
|
-
|
|
248
|
-
|
|
241
|
+
type: "spacing",
|
|
242
|
+
key: "scrollMargin",
|
|
243
|
+
props: ["scrollMargin"]
|
|
249
244
|
};
|
|
250
|
-
case "
|
|
245
|
+
case "translate":
|
|
251
246
|
return {
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
type: "spacing",
|
|
248
|
+
key: "translate",
|
|
249
|
+
props: [
|
|
250
|
+
"--tw-translate-x",
|
|
251
|
+
"--tw-translate-y",
|
|
252
|
+
{ translate: "var(--tw-translate-x) var(--tw-translate-y)" }
|
|
253
|
+
]
|
|
254
254
|
};
|
|
255
255
|
case "translate-x":
|
|
256
256
|
return {
|
|
257
|
+
type: "spacing",
|
|
257
258
|
key: "translate",
|
|
258
259
|
props: [
|
|
259
260
|
"--tw-translate-x",
|
|
260
|
-
{ "
|
|
261
|
-
{ transform: V }
|
|
261
|
+
{ translate: "var(--tw-translate-x) var(--tw-translate-y)" }
|
|
262
262
|
]
|
|
263
263
|
};
|
|
264
264
|
case "translate-y":
|
|
265
265
|
return {
|
|
266
|
+
type: "spacing",
|
|
266
267
|
key: "translate",
|
|
267
268
|
props: [
|
|
268
269
|
"--tw-translate-y",
|
|
269
|
-
{ "
|
|
270
|
-
{ transform: V }
|
|
270
|
+
{ translate: "var(--tw-translate-x) var(--tw-translate-y)" }
|
|
271
271
|
]
|
|
272
272
|
};
|
|
273
|
+
// Border & Stroke
|
|
273
274
|
case "stroke":
|
|
274
275
|
return {
|
|
276
|
+
type: "regular",
|
|
275
277
|
key: "strokeWidth",
|
|
276
278
|
props: ["strokeWidth"]
|
|
277
279
|
};
|
|
278
|
-
case "leading":
|
|
279
|
-
return {
|
|
280
|
-
key: "lineHeight",
|
|
281
|
-
props: ["lineHeight"]
|
|
282
|
-
};
|
|
283
280
|
case "border":
|
|
284
281
|
return {
|
|
282
|
+
type: "regular",
|
|
285
283
|
key: "borderWidth",
|
|
286
284
|
props: ["borderWidth"]
|
|
287
285
|
};
|
|
288
286
|
case "border-t":
|
|
289
287
|
return {
|
|
288
|
+
type: "regular",
|
|
290
289
|
key: "borderWidth",
|
|
291
290
|
props: ["borderTopWidth"]
|
|
292
291
|
};
|
|
293
292
|
case "border-b":
|
|
294
293
|
return {
|
|
294
|
+
type: "regular",
|
|
295
295
|
key: "borderWidth",
|
|
296
296
|
props: ["borderBottomWidth"]
|
|
297
297
|
};
|
|
298
298
|
case "border-l":
|
|
299
299
|
return {
|
|
300
|
+
type: "regular",
|
|
300
301
|
key: "borderWidth",
|
|
301
302
|
props: ["borderLeftWidth"]
|
|
302
303
|
};
|
|
303
304
|
case "border-s":
|
|
304
305
|
return {
|
|
306
|
+
type: "regular",
|
|
305
307
|
key: "borderWidth",
|
|
306
308
|
props: ["borderInlineStartWidth"]
|
|
307
309
|
};
|
|
308
310
|
case "border-r":
|
|
309
311
|
return {
|
|
312
|
+
type: "regular",
|
|
310
313
|
key: "borderWidth",
|
|
311
314
|
props: ["borderRightWidth"]
|
|
312
315
|
};
|
|
313
316
|
case "border-e":
|
|
314
317
|
return {
|
|
318
|
+
type: "regular",
|
|
315
319
|
key: "borderWidth",
|
|
316
320
|
props: ["borderInlineEndWidth"]
|
|
317
321
|
};
|
|
318
322
|
case "border-x":
|
|
319
323
|
return {
|
|
324
|
+
type: "regular",
|
|
320
325
|
key: "borderWidth",
|
|
321
326
|
props: ["borderInlineWidth"]
|
|
322
327
|
};
|
|
323
328
|
case "border-y":
|
|
324
329
|
return {
|
|
330
|
+
type: "regular",
|
|
325
331
|
key: "borderWidth",
|
|
326
332
|
props: ["borderBlockWidth"]
|
|
327
333
|
};
|
|
328
|
-
|
|
334
|
+
// Border Radius
|
|
335
|
+
case "rounded":
|
|
329
336
|
return {
|
|
330
|
-
|
|
331
|
-
|
|
337
|
+
type: "regular",
|
|
338
|
+
key: "borderRadius",
|
|
339
|
+
props: ["borderRadius"]
|
|
340
|
+
};
|
|
341
|
+
case "rounded-s":
|
|
342
|
+
return {
|
|
343
|
+
type: "regular",
|
|
344
|
+
key: "borderRadius",
|
|
345
|
+
props: ["borderStartStartRadius", "borderEndStartRadius"]
|
|
346
|
+
};
|
|
347
|
+
case "rounded-ss":
|
|
348
|
+
return {
|
|
349
|
+
type: "regular",
|
|
350
|
+
key: "borderRadius",
|
|
351
|
+
props: ["borderStartStartRadius"]
|
|
352
|
+
};
|
|
353
|
+
case "rounded-se":
|
|
354
|
+
return {
|
|
355
|
+
type: "regular",
|
|
356
|
+
key: "borderRadius",
|
|
357
|
+
props: ["borderStartEndRadius"]
|
|
358
|
+
};
|
|
359
|
+
case "rounded-e":
|
|
360
|
+
return {
|
|
361
|
+
type: "regular",
|
|
362
|
+
key: "borderRadius",
|
|
363
|
+
props: ["borderStartEndRadius", "borderEndEndRadius"]
|
|
364
|
+
};
|
|
365
|
+
case "rounded-ee":
|
|
366
|
+
return {
|
|
367
|
+
type: "regular",
|
|
368
|
+
key: "borderRadius",
|
|
369
|
+
props: ["borderEndEndRadius"]
|
|
370
|
+
};
|
|
371
|
+
case "rounded-es":
|
|
372
|
+
return {
|
|
373
|
+
type: "regular",
|
|
374
|
+
key: "borderRadius",
|
|
375
|
+
props: ["borderEndStartRadius"]
|
|
376
|
+
};
|
|
377
|
+
case "rounded-t":
|
|
378
|
+
return {
|
|
379
|
+
type: "regular",
|
|
380
|
+
key: "borderRadius",
|
|
381
|
+
props: ["borderTopLeftRadius", "borderTopRightRadius"]
|
|
382
|
+
};
|
|
383
|
+
case "rounded-r":
|
|
384
|
+
return {
|
|
385
|
+
type: "regular",
|
|
386
|
+
key: "borderRadius",
|
|
387
|
+
props: ["borderTopRightRadius", "borderBottomRightRadius"]
|
|
388
|
+
};
|
|
389
|
+
case "rounded-b":
|
|
390
|
+
return {
|
|
391
|
+
type: "regular",
|
|
392
|
+
key: "borderRadius",
|
|
393
|
+
props: ["borderBottomLeftRadius", "borderBottomRightRadius"]
|
|
394
|
+
};
|
|
395
|
+
case "rounded-l":
|
|
396
|
+
return {
|
|
397
|
+
type: "regular",
|
|
398
|
+
key: "borderRadius",
|
|
399
|
+
props: ["borderTopLeftRadius", "borderBottomLeftRadius"]
|
|
400
|
+
};
|
|
401
|
+
case "rounded-tl":
|
|
402
|
+
return {
|
|
403
|
+
type: "regular",
|
|
404
|
+
key: "borderRadius",
|
|
405
|
+
props: ["borderTopLeftRadius"]
|
|
406
|
+
};
|
|
407
|
+
case "rounded-tr":
|
|
408
|
+
return {
|
|
409
|
+
type: "regular",
|
|
410
|
+
key: "borderRadius",
|
|
411
|
+
props: ["borderTopRightRadius"]
|
|
412
|
+
};
|
|
413
|
+
case "rounded-bl":
|
|
414
|
+
return {
|
|
415
|
+
type: "regular",
|
|
416
|
+
key: "borderRadius",
|
|
417
|
+
props: ["borderBottomLeftRadius"]
|
|
418
|
+
};
|
|
419
|
+
case "rounded-br":
|
|
420
|
+
return {
|
|
421
|
+
type: "regular",
|
|
422
|
+
key: "borderRadius",
|
|
423
|
+
props: ["borderBottomRightRadius"]
|
|
424
|
+
};
|
|
425
|
+
case "leading":
|
|
426
|
+
return {
|
|
427
|
+
type: "regular",
|
|
428
|
+
key: "lineHeight",
|
|
429
|
+
props: ["lineHeight"]
|
|
332
430
|
};
|
|
333
431
|
case "tracking":
|
|
334
432
|
return {
|
|
433
|
+
type: "regular",
|
|
335
434
|
key: "letterSpacing",
|
|
336
435
|
props: ["letterSpacing"]
|
|
337
436
|
};
|
|
437
|
+
// Type
|
|
438
|
+
case "text":
|
|
439
|
+
return {
|
|
440
|
+
type: "fontSize",
|
|
441
|
+
key: "fontSize",
|
|
442
|
+
props: ["fontSize"]
|
|
443
|
+
};
|
|
338
444
|
default:
|
|
339
445
|
return null;
|
|
340
446
|
}
|
|
341
|
-
},
|
|
447
|
+
}, le = {
|
|
342
448
|
error() {
|
|
343
449
|
console.log("\x1B[31m", ...arguments, "\x1B[0m");
|
|
344
450
|
},
|
|
@@ -351,96 +457,1668 @@ const V = [
|
|
|
351
457
|
log() {
|
|
352
458
|
console.log("\x1B[90m", ...arguments, "\x1B[0m");
|
|
353
459
|
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
460
|
+
};
|
|
461
|
+
class ke extends Error {
|
|
462
|
+
constructor(n, r, o, i) {
|
|
463
|
+
super(n);
|
|
464
|
+
y(this, "sourceStart");
|
|
465
|
+
y(this, "sourceEnd");
|
|
466
|
+
y(this, "parserState");
|
|
467
|
+
this.name = "ParseError", this.sourceStart = r, this.sourceEnd = o, this.parserState = i;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
class j extends ke {
|
|
471
|
+
constructor(n, r, o, i, s) {
|
|
472
|
+
super(n, r, o, i);
|
|
473
|
+
y(this, "token");
|
|
474
|
+
this.token = s;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const z = { UnexpectedNewLineInString: "Unexpected newline while consuming a string token.", UnexpectedEOFInString: "Unexpected EOF while consuming a string token.", UnexpectedEOFInComment: "Unexpected EOF while consuming a comment.", UnexpectedEOFInURL: "Unexpected EOF while consuming a url token.", UnexpectedEOFInEscapedCodePoint: "Unexpected EOF while consuming an escaped code point.", UnexpectedCharacterInURL: "Unexpected character while consuming a url token.", InvalidEscapeSequenceInURL: "Invalid escape sequence while consuming a url token.", InvalidEscapeSequenceAfterBackslash: 'Invalid escape sequence after "\\"' };
|
|
478
|
+
function W(...t) {
|
|
479
|
+
let e = "";
|
|
480
|
+
for (let n = 0; n < t.length; n++) e += t[n][1];
|
|
481
|
+
return e;
|
|
482
|
+
}
|
|
483
|
+
const ee = 13, B = 45, te = 10, ne = 43, _ = 65533;
|
|
484
|
+
function ct(t) {
|
|
485
|
+
return t.source.codePointAt(t.cursor) === 60 && t.source.codePointAt(t.cursor + 1) === 33 && t.source.codePointAt(t.cursor + 2) === B && t.source.codePointAt(t.cursor + 3) === B;
|
|
486
|
+
}
|
|
487
|
+
function R(t) {
|
|
488
|
+
return t >= 48 && t <= 57;
|
|
489
|
+
}
|
|
490
|
+
function lt(t) {
|
|
491
|
+
return t >= 65 && t <= 90;
|
|
492
|
+
}
|
|
493
|
+
function dt(t) {
|
|
494
|
+
return t >= 97 && t <= 122;
|
|
495
|
+
}
|
|
496
|
+
function Z(t) {
|
|
497
|
+
return t >= 48 && t <= 57 || t >= 97 && t <= 102 || t >= 65 && t <= 70;
|
|
498
|
+
}
|
|
499
|
+
function pt(t) {
|
|
500
|
+
return dt(t) || lt(t);
|
|
501
|
+
}
|
|
502
|
+
function re(t) {
|
|
503
|
+
return pt(t) || ft(t) || t === 95;
|
|
504
|
+
}
|
|
505
|
+
function Oe(t) {
|
|
506
|
+
return re(t) || R(t) || t === B;
|
|
507
|
+
}
|
|
508
|
+
function ft(t) {
|
|
509
|
+
return t === 183 || t === 8204 || t === 8205 || t === 8255 || t === 8256 || t === 8204 || 192 <= t && t <= 214 || 216 <= t && t <= 246 || 248 <= t && t <= 893 || 895 <= t && t <= 8191 || 8304 <= t && t <= 8591 || 11264 <= t && t <= 12271 || 12289 <= t && t <= 55295 || 63744 <= t && t <= 64975 || 65008 <= t && t <= 65533 || t === 0 || !!oe(t) || t >= 65536;
|
|
510
|
+
}
|
|
511
|
+
function Ee(t) {
|
|
512
|
+
return t === te || t === ee || t === 12;
|
|
513
|
+
}
|
|
514
|
+
function K(t) {
|
|
515
|
+
return t === 32 || t === te || t === 9 || t === ee || t === 12;
|
|
516
|
+
}
|
|
517
|
+
function oe(t) {
|
|
518
|
+
return t >= 55296 && t <= 57343;
|
|
519
|
+
}
|
|
520
|
+
function ue(t) {
|
|
521
|
+
return t.source.codePointAt(t.cursor) === 92 && !Ee(t.source.codePointAt(t.cursor + 1) ?? -1);
|
|
522
|
+
}
|
|
523
|
+
function ye(t, e) {
|
|
524
|
+
return e.source.codePointAt(e.cursor) === B ? e.source.codePointAt(e.cursor + 1) === B || !!re(e.source.codePointAt(e.cursor + 1) ?? -1) || e.source.codePointAt(e.cursor + 1) === 92 && !Ee(e.source.codePointAt(e.cursor + 2) ?? -1) : !!re(e.source.codePointAt(e.cursor) ?? -1) || ue(e);
|
|
525
|
+
}
|
|
526
|
+
function We(t) {
|
|
527
|
+
return t.source.codePointAt(t.cursor) === ne || t.source.codePointAt(t.cursor) === B ? !!R(t.source.codePointAt(t.cursor + 1) ?? -1) || t.source.codePointAt(t.cursor + 1) === 46 && R(t.source.codePointAt(t.cursor + 2) ?? -1) : t.source.codePointAt(t.cursor) === 46 ? R(t.source.codePointAt(t.cursor + 1) ?? -1) : R(t.source.codePointAt(t.cursor) ?? -1);
|
|
528
|
+
}
|
|
529
|
+
function vt(t) {
|
|
530
|
+
return t.source.codePointAt(t.cursor) === 47 && t.source.codePointAt(t.cursor + 1) === 42;
|
|
531
|
+
}
|
|
532
|
+
function mt(t) {
|
|
533
|
+
return t.source.codePointAt(t.cursor) === B && t.source.codePointAt(t.cursor + 1) === B && t.source.codePointAt(t.cursor + 2) === 62;
|
|
534
|
+
}
|
|
535
|
+
var a, l, Pe;
|
|
536
|
+
function gt(t) {
|
|
537
|
+
switch (t) {
|
|
538
|
+
case a.OpenParen:
|
|
539
|
+
return a.CloseParen;
|
|
540
|
+
case a.CloseParen:
|
|
541
|
+
return a.OpenParen;
|
|
542
|
+
case a.OpenCurly:
|
|
543
|
+
return a.CloseCurly;
|
|
544
|
+
case a.CloseCurly:
|
|
545
|
+
return a.OpenCurly;
|
|
546
|
+
case a.OpenSquare:
|
|
547
|
+
return a.CloseSquare;
|
|
548
|
+
case a.CloseSquare:
|
|
549
|
+
return a.OpenSquare;
|
|
550
|
+
default:
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
function ht(t) {
|
|
555
|
+
switch (t[0]) {
|
|
556
|
+
case a.OpenParen:
|
|
557
|
+
return [a.CloseParen, ")", -1, -1, void 0];
|
|
558
|
+
case a.CloseParen:
|
|
559
|
+
return [a.OpenParen, "(", -1, -1, void 0];
|
|
560
|
+
case a.OpenCurly:
|
|
561
|
+
return [a.CloseCurly, "}", -1, -1, void 0];
|
|
562
|
+
case a.CloseCurly:
|
|
563
|
+
return [a.OpenCurly, "{", -1, -1, void 0];
|
|
564
|
+
case a.OpenSquare:
|
|
565
|
+
return [a.CloseSquare, "]", -1, -1, void 0];
|
|
566
|
+
case a.CloseSquare:
|
|
567
|
+
return [a.OpenSquare, "[", -1, -1, void 0];
|
|
568
|
+
default:
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
function Ct(t, e) {
|
|
573
|
+
for (e.advanceCodePoint(2); ; ) {
|
|
574
|
+
const n = e.readCodePoint();
|
|
575
|
+
if (n === void 0) {
|
|
576
|
+
const r = [a.Comment, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
577
|
+
return t.onParseError(new j(z.UnexpectedEOFInComment, e.representationStart, e.representationEnd, ["4.3.2. Consume comments", "Unexpected EOF"], r)), r;
|
|
578
|
+
}
|
|
579
|
+
if (n === 42 && e.source.codePointAt(e.cursor) !== void 0 && e.source.codePointAt(e.cursor) === 47) {
|
|
580
|
+
e.advanceCodePoint();
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return [a.Comment, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
585
|
+
}
|
|
586
|
+
function be(t, e) {
|
|
587
|
+
const n = e.readCodePoint();
|
|
588
|
+
if (n === void 0) return t.onParseError(new ke(z.UnexpectedEOFInEscapedCodePoint, e.representationStart, e.representationEnd, ["4.3.7. Consume an escaped code point", "Unexpected EOF"])), _;
|
|
589
|
+
if (Z(n)) {
|
|
590
|
+
const r = [n];
|
|
591
|
+
let o;
|
|
592
|
+
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && Z(o) && r.length < 6; ) r.push(o), e.advanceCodePoint();
|
|
593
|
+
K(e.source.codePointAt(e.cursor) ?? -1) && (e.source.codePointAt(e.cursor) === ee && e.source.codePointAt(e.cursor + 1) === te && e.advanceCodePoint(), e.advanceCodePoint());
|
|
594
|
+
const i = parseInt(String.fromCodePoint(...r), 16);
|
|
595
|
+
return i === 0 || oe(i) || i > 1114111 ? _ : i;
|
|
596
|
+
}
|
|
597
|
+
return n === 0 || oe(n) ? _ : n;
|
|
598
|
+
}
|
|
599
|
+
function Se(t, e) {
|
|
600
|
+
const n = [];
|
|
601
|
+
for (; ; ) {
|
|
602
|
+
const r = e.source.codePointAt(e.cursor) ?? -1;
|
|
603
|
+
if (r === 0 || oe(r)) n.push(_), e.advanceCodePoint(+(r > 65535) + 1);
|
|
604
|
+
else if (Oe(r)) n.push(r), e.advanceCodePoint(+(r > 65535) + 1);
|
|
605
|
+
else {
|
|
606
|
+
if (!ue(e)) return n;
|
|
607
|
+
e.advanceCodePoint(), n.push(be(t, e));
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function Et(t, e) {
|
|
612
|
+
e.advanceCodePoint();
|
|
613
|
+
const n = e.source.codePointAt(e.cursor);
|
|
614
|
+
if (n !== void 0 && (Oe(n) || ue(e))) {
|
|
615
|
+
let r = Pe.Unrestricted;
|
|
616
|
+
ye(0, e) && (r = Pe.ID);
|
|
617
|
+
const o = Se(t, e);
|
|
618
|
+
return [a.Hash, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...o), type: r }];
|
|
619
|
+
}
|
|
620
|
+
return [a.Delim, "#", e.representationStart, e.representationEnd, { value: "#" }];
|
|
621
|
+
}
|
|
622
|
+
function yt(t, e) {
|
|
623
|
+
let n = l.Integer;
|
|
624
|
+
for (e.source.codePointAt(e.cursor) !== ne && e.source.codePointAt(e.cursor) !== B || e.advanceCodePoint(); R(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
625
|
+
if (e.source.codePointAt(e.cursor) === 46 && R(e.source.codePointAt(e.cursor + 1) ?? -1)) for (e.advanceCodePoint(2), n = l.Number; R(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
626
|
+
if (e.source.codePointAt(e.cursor) === 101 || e.source.codePointAt(e.cursor) === 69) {
|
|
627
|
+
if (R(e.source.codePointAt(e.cursor + 1) ?? -1)) e.advanceCodePoint(2);
|
|
628
|
+
else {
|
|
629
|
+
if (e.source.codePointAt(e.cursor + 1) !== B && e.source.codePointAt(e.cursor + 1) !== ne || !R(e.source.codePointAt(e.cursor + 2) ?? -1)) return n;
|
|
630
|
+
e.advanceCodePoint(3);
|
|
631
|
+
}
|
|
632
|
+
for (n = l.Number; R(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
633
|
+
}
|
|
634
|
+
return n;
|
|
635
|
+
}
|
|
636
|
+
function we(t, e) {
|
|
637
|
+
let n;
|
|
638
|
+
{
|
|
639
|
+
const i = e.source.codePointAt(e.cursor);
|
|
640
|
+
i === B ? n = "-" : i === ne && (n = "+");
|
|
641
|
+
}
|
|
642
|
+
const r = yt(0, e), o = parseFloat(e.source.slice(e.representationStart, e.representationEnd + 1));
|
|
643
|
+
if (ye(0, e)) {
|
|
644
|
+
const i = Se(t, e);
|
|
645
|
+
return [a.Dimension, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n, type: r, unit: String.fromCodePoint(...i) }];
|
|
646
|
+
}
|
|
647
|
+
return e.source.codePointAt(e.cursor) === 37 ? (e.advanceCodePoint(), [a.Percentage, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n }]) : [a.Number, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n, type: r }];
|
|
648
|
+
}
|
|
649
|
+
function Pt(t) {
|
|
650
|
+
for (; K(t.source.codePointAt(t.cursor) ?? -1); ) t.advanceCodePoint();
|
|
651
|
+
return [a.Whitespace, t.source.slice(t.representationStart, t.representationEnd + 1), t.representationStart, t.representationEnd, void 0];
|
|
652
|
+
}
|
|
653
|
+
(function(t) {
|
|
654
|
+
t.Comment = "comment", t.AtKeyword = "at-keyword-token", t.BadString = "bad-string-token", t.BadURL = "bad-url-token", t.CDC = "CDC-token", t.CDO = "CDO-token", t.Colon = "colon-token", t.Comma = "comma-token", t.Delim = "delim-token", t.Dimension = "dimension-token", t.EOF = "EOF-token", t.Function = "function-token", t.Hash = "hash-token", t.Ident = "ident-token", t.Number = "number-token", t.Percentage = "percentage-token", t.Semicolon = "semicolon-token", t.String = "string-token", t.URL = "url-token", t.Whitespace = "whitespace-token", t.OpenParen = "(-token", t.CloseParen = ")-token", t.OpenSquare = "[-token", t.CloseSquare = "]-token", t.OpenCurly = "{-token", t.CloseCurly = "}-token", t.UnicodeRange = "unicode-range-token";
|
|
655
|
+
})(a || (a = {})), function(t) {
|
|
656
|
+
t.Integer = "integer", t.Number = "number";
|
|
657
|
+
}(l || (l = {})), function(t) {
|
|
658
|
+
t.Unrestricted = "unrestricted", t.ID = "id";
|
|
659
|
+
}(Pe || (Pe = {}));
|
|
660
|
+
class kt {
|
|
661
|
+
constructor(e) {
|
|
662
|
+
y(this, "cursor", 0);
|
|
663
|
+
y(this, "source", "");
|
|
664
|
+
y(this, "representationStart", 0);
|
|
665
|
+
y(this, "representationEnd", -1);
|
|
666
|
+
this.source = e;
|
|
667
|
+
}
|
|
668
|
+
advanceCodePoint(e = 1) {
|
|
669
|
+
this.cursor = this.cursor + e, this.representationEnd = this.cursor - 1;
|
|
670
|
+
}
|
|
671
|
+
readCodePoint() {
|
|
672
|
+
const e = this.source.codePointAt(this.cursor);
|
|
673
|
+
if (e !== void 0) return this.cursor = this.cursor + 1, this.representationEnd = this.cursor - 1, e;
|
|
674
|
+
}
|
|
675
|
+
unreadCodePoint(e = 1) {
|
|
676
|
+
this.cursor = this.cursor - e, this.representationEnd = this.cursor - 1;
|
|
677
|
+
}
|
|
678
|
+
resetRepresentation() {
|
|
679
|
+
this.representationStart = this.cursor, this.representationEnd = -1;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
function bt(t, e) {
|
|
683
|
+
let n = "";
|
|
684
|
+
const r = e.readCodePoint();
|
|
685
|
+
for (; ; ) {
|
|
686
|
+
const o = e.readCodePoint();
|
|
687
|
+
if (o === void 0) {
|
|
688
|
+
const i = [a.String, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
689
|
+
return t.onParseError(new j(z.UnexpectedEOFInString, e.representationStart, e.representationEnd, ["4.3.5. Consume a string token", "Unexpected EOF"], i)), i;
|
|
690
|
+
}
|
|
691
|
+
if (Ee(o)) {
|
|
692
|
+
e.unreadCodePoint();
|
|
693
|
+
const i = [a.BadString, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
694
|
+
return t.onParseError(new j(z.UnexpectedNewLineInString, e.representationStart, e.source.codePointAt(e.cursor) === ee && e.source.codePointAt(e.cursor + 1) === te ? e.representationEnd + 2 : e.representationEnd + 1, ["4.3.5. Consume a string token", "Unexpected newline"], i)), i;
|
|
695
|
+
}
|
|
696
|
+
if (o === r) return [a.String, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
697
|
+
if (o !== 92) o === 0 || oe(o) ? n += String.fromCodePoint(_) : n += String.fromCodePoint(o);
|
|
698
|
+
else {
|
|
699
|
+
if (e.source.codePointAt(e.cursor) === void 0) continue;
|
|
700
|
+
if (Ee(e.source.codePointAt(e.cursor) ?? -1)) {
|
|
701
|
+
e.source.codePointAt(e.cursor) === ee && e.source.codePointAt(e.cursor + 1) === te && e.advanceCodePoint(), e.advanceCodePoint();
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
n += String.fromCodePoint(be(t, e));
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
function St(t) {
|
|
709
|
+
return !(t.length !== 3 || t[0] !== 117 && t[0] !== 85 || t[1] !== 114 && t[1] !== 82 || t[2] !== 108 && t[2] !== 76);
|
|
710
|
+
}
|
|
711
|
+
function Ne(t, e) {
|
|
712
|
+
for (; ; ) {
|
|
713
|
+
const n = e.source.codePointAt(e.cursor);
|
|
714
|
+
if (n === void 0) return;
|
|
715
|
+
if (n === 41) return void e.advanceCodePoint();
|
|
716
|
+
ue(e) ? (e.advanceCodePoint(), be(t, e)) : e.advanceCodePoint();
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
function At(t, e) {
|
|
720
|
+
for (; K(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
721
|
+
let n = "";
|
|
722
|
+
for (; ; ) {
|
|
723
|
+
if (e.source.codePointAt(e.cursor) === void 0) {
|
|
724
|
+
const i = [a.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
725
|
+
return t.onParseError(new j(z.UnexpectedEOFInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "Unexpected EOF"], i)), i;
|
|
726
|
+
}
|
|
727
|
+
if (e.source.codePointAt(e.cursor) === 41) return e.advanceCodePoint(), [a.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
728
|
+
if (K(e.source.codePointAt(e.cursor) ?? -1)) {
|
|
729
|
+
for (e.advanceCodePoint(); K(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
730
|
+
if (e.source.codePointAt(e.cursor) === void 0) {
|
|
731
|
+
const i = [a.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
732
|
+
return t.onParseError(new j(z.UnexpectedEOFInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "Consume as much whitespace as possible", "Unexpected EOF"], i)), i;
|
|
733
|
+
}
|
|
734
|
+
return e.source.codePointAt(e.cursor) === 41 ? (e.advanceCodePoint(), [a.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }]) : (Ne(t, e), [a.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0]);
|
|
735
|
+
}
|
|
736
|
+
const o = e.source.codePointAt(e.cursor);
|
|
737
|
+
if (o === 34 || o === 39 || o === 40 || (r = o ?? -1) === 11 || r === 127 || 0 <= r && r <= 8 || 14 <= r && r <= 31) {
|
|
738
|
+
Ne(t, e);
|
|
739
|
+
const i = [a.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
740
|
+
return t.onParseError(new j(z.UnexpectedCharacterInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", `Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`], i)), i;
|
|
741
|
+
}
|
|
742
|
+
if (o === 92) {
|
|
743
|
+
if (ue(e)) {
|
|
744
|
+
e.advanceCodePoint(), n += String.fromCodePoint(be(t, e));
|
|
745
|
+
continue;
|
|
746
|
+
}
|
|
747
|
+
Ne(t, e);
|
|
748
|
+
const i = [a.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
749
|
+
return t.onParseError(new j(z.InvalidEscapeSequenceInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "U+005C REVERSE SOLIDUS (\\)", "The input stream does not start with a valid escape sequence"], i)), i;
|
|
750
|
+
}
|
|
751
|
+
e.source.codePointAt(e.cursor) === 0 || oe(e.source.codePointAt(e.cursor) ?? -1) ? (n += String.fromCodePoint(_), e.advanceCodePoint()) : (n += e.source[e.cursor], e.advanceCodePoint());
|
|
752
|
+
}
|
|
753
|
+
var r;
|
|
754
|
+
}
|
|
755
|
+
function Ie(t, e) {
|
|
756
|
+
const n = Se(t, e);
|
|
757
|
+
if (e.source.codePointAt(e.cursor) !== 40) return [a.Ident, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
758
|
+
if (St(n)) {
|
|
759
|
+
e.advanceCodePoint();
|
|
760
|
+
let r = 0;
|
|
761
|
+
for (; ; ) {
|
|
762
|
+
const o = K(e.source.codePointAt(e.cursor) ?? -1), i = K(e.source.codePointAt(e.cursor + 1) ?? -1);
|
|
763
|
+
if (o && i) {
|
|
764
|
+
r += 1, e.advanceCodePoint(1);
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
const s = o ? e.source.codePointAt(e.cursor + 1) : e.source.codePointAt(e.cursor);
|
|
768
|
+
if (s === 34 || s === 39) return r > 0 && e.unreadCodePoint(r), [a.Function, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
return At(t, e);
|
|
772
|
+
}
|
|
773
|
+
return e.advanceCodePoint(), [a.Function, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
774
|
+
}
|
|
775
|
+
function Dt(t) {
|
|
776
|
+
return !(t.source.codePointAt(t.cursor) !== 117 && t.source.codePointAt(t.cursor) !== 85 || t.source.codePointAt(t.cursor + 1) !== ne || t.source.codePointAt(t.cursor + 2) !== 63 && !Z(t.source.codePointAt(t.cursor + 2) ?? -1));
|
|
777
|
+
}
|
|
778
|
+
function Bt(t, e) {
|
|
779
|
+
e.advanceCodePoint(2);
|
|
780
|
+
const n = [], r = [];
|
|
781
|
+
let o;
|
|
782
|
+
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && n.length < 6 && Z(o); ) n.push(o), e.advanceCodePoint();
|
|
783
|
+
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && n.length < 6 && o === 63; ) r.length === 0 && r.push(...n), n.push(48), r.push(70), e.advanceCodePoint();
|
|
784
|
+
if (!r.length && e.source.codePointAt(e.cursor) === B && Z(e.source.codePointAt(e.cursor + 1) ?? -1)) for (e.advanceCodePoint(); (o = e.source.codePointAt(e.cursor)) !== void 0 && r.length < 6 && Z(o); ) r.push(o), e.advanceCodePoint();
|
|
785
|
+
if (!r.length) {
|
|
786
|
+
const u = parseInt(String.fromCodePoint(...n), 16);
|
|
787
|
+
return [a.UnicodeRange, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { startOfRange: u, endOfRange: u }];
|
|
788
|
+
}
|
|
789
|
+
const i = parseInt(String.fromCodePoint(...n), 16), s = parseInt(String.fromCodePoint(...r), 16);
|
|
790
|
+
return [a.UnicodeRange, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { startOfRange: i, endOfRange: s }];
|
|
791
|
+
}
|
|
792
|
+
function Ft(t, e) {
|
|
793
|
+
const n = wt(t), r = [];
|
|
794
|
+
for (; !n.endOfFile(); ) r.push(n.nextToken());
|
|
795
|
+
return r.push(n.nextToken()), r;
|
|
796
|
+
}
|
|
797
|
+
function wt(t, e) {
|
|
798
|
+
const n = t.css.valueOf(), r = t.unicodeRangesAllowed ?? !1, o = new kt(n), i = { onParseError: Nt };
|
|
799
|
+
return { nextToken: function() {
|
|
800
|
+
o.resetRepresentation();
|
|
801
|
+
const u = o.source.codePointAt(o.cursor);
|
|
802
|
+
if (u === void 0) return [a.EOF, "", -1, -1, void 0];
|
|
803
|
+
if (u === 47 && vt(o)) return Ct(i, o);
|
|
804
|
+
if (r && (u === 117 || u === 85) && Dt(o)) return Bt(0, o);
|
|
805
|
+
if (re(u)) return Ie(i, o);
|
|
806
|
+
if (R(u)) return we(i, o);
|
|
807
|
+
switch (u) {
|
|
808
|
+
case 44:
|
|
809
|
+
return o.advanceCodePoint(), [a.Comma, ",", o.representationStart, o.representationEnd, void 0];
|
|
810
|
+
case 58:
|
|
811
|
+
return o.advanceCodePoint(), [a.Colon, ":", o.representationStart, o.representationEnd, void 0];
|
|
812
|
+
case 59:
|
|
813
|
+
return o.advanceCodePoint(), [a.Semicolon, ";", o.representationStart, o.representationEnd, void 0];
|
|
814
|
+
case 40:
|
|
815
|
+
return o.advanceCodePoint(), [a.OpenParen, "(", o.representationStart, o.representationEnd, void 0];
|
|
816
|
+
case 41:
|
|
817
|
+
return o.advanceCodePoint(), [a.CloseParen, ")", o.representationStart, o.representationEnd, void 0];
|
|
818
|
+
case 91:
|
|
819
|
+
return o.advanceCodePoint(), [a.OpenSquare, "[", o.representationStart, o.representationEnd, void 0];
|
|
820
|
+
case 93:
|
|
821
|
+
return o.advanceCodePoint(), [a.CloseSquare, "]", o.representationStart, o.representationEnd, void 0];
|
|
822
|
+
case 123:
|
|
823
|
+
return o.advanceCodePoint(), [a.OpenCurly, "{", o.representationStart, o.representationEnd, void 0];
|
|
824
|
+
case 125:
|
|
825
|
+
return o.advanceCodePoint(), [a.CloseCurly, "}", o.representationStart, o.representationEnd, void 0];
|
|
826
|
+
case 39:
|
|
827
|
+
case 34:
|
|
828
|
+
return bt(i, o);
|
|
829
|
+
case 35:
|
|
830
|
+
return Et(i, o);
|
|
831
|
+
case ne:
|
|
832
|
+
case 46:
|
|
833
|
+
return We(o) ? we(i, o) : (o.advanceCodePoint(), [a.Delim, o.source[o.representationStart], o.representationStart, o.representationEnd, { value: o.source[o.representationStart] }]);
|
|
834
|
+
case te:
|
|
835
|
+
case ee:
|
|
836
|
+
case 12:
|
|
837
|
+
case 9:
|
|
838
|
+
case 32:
|
|
839
|
+
return Pt(o);
|
|
840
|
+
case B:
|
|
841
|
+
return We(o) ? we(i, o) : mt(o) ? (o.advanceCodePoint(3), [a.CDC, "-->", o.representationStart, o.representationEnd, void 0]) : ye(0, o) ? Ie(i, o) : (o.advanceCodePoint(), [a.Delim, "-", o.representationStart, o.representationEnd, { value: "-" }]);
|
|
842
|
+
case 60:
|
|
843
|
+
return ct(o) ? (o.advanceCodePoint(4), [a.CDO, "<!--", o.representationStart, o.representationEnd, void 0]) : (o.advanceCodePoint(), [a.Delim, "<", o.representationStart, o.representationEnd, { value: "<" }]);
|
|
844
|
+
case 64:
|
|
845
|
+
if (o.advanceCodePoint(), ye(0, o)) {
|
|
846
|
+
const c = Se(i, o);
|
|
847
|
+
return [a.AtKeyword, o.source.slice(o.representationStart, o.representationEnd + 1), o.representationStart, o.representationEnd, { value: String.fromCodePoint(...c) }];
|
|
848
|
+
}
|
|
849
|
+
return [a.Delim, "@", o.representationStart, o.representationEnd, { value: "@" }];
|
|
850
|
+
case 92: {
|
|
851
|
+
if (ue(o)) return Ie(i, o);
|
|
852
|
+
o.advanceCodePoint();
|
|
853
|
+
const c = [a.Delim, "\\", o.representationStart, o.representationEnd, { value: "\\" }];
|
|
854
|
+
return i.onParseError(new j(z.InvalidEscapeSequenceAfterBackslash, o.representationStart, o.representationEnd, ["4.3.1. Consume a token", "U+005C REVERSE SOLIDUS (\\)", "The input stream does not start with a valid escape sequence"], c)), c;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return o.advanceCodePoint(), [a.Delim, o.source[o.representationStart], o.representationStart, o.representationEnd, { value: o.source[o.representationStart] }];
|
|
858
|
+
}, endOfFile: function() {
|
|
859
|
+
return o.source.codePointAt(o.cursor) === void 0;
|
|
860
|
+
} };
|
|
861
|
+
}
|
|
862
|
+
function Nt() {
|
|
863
|
+
}
|
|
864
|
+
function It(t, e) {
|
|
865
|
+
const n = [];
|
|
866
|
+
for (const u of e) n.push(u.codePointAt(0));
|
|
867
|
+
const r = xt(n);
|
|
868
|
+
r[0] === 101 && Ce(r, 0, r[0]);
|
|
869
|
+
const o = String.fromCodePoint(...r), i = t[4].signCharacter === "+" ? t[4].signCharacter : "", s = t[4].value.toString();
|
|
870
|
+
t[1] = `${i}${s}${o}`, t[4].unit = e;
|
|
871
|
+
}
|
|
872
|
+
function xt(t) {
|
|
873
|
+
let e = 0;
|
|
874
|
+
t[0] === B && t[1] === B ? e = 2 : t[0] === B && t[1] ? (e = 2, re(t[1]) || (e += Ce(t, 1, t[1]))) : re(t[0]) ? e = 1 : (e = 1, e += Ce(t, 0, t[0]));
|
|
875
|
+
for (let n = e; n < t.length; n++) Oe(t[n]) || (n += Ce(t, n, t[n]));
|
|
876
|
+
return t;
|
|
877
|
+
}
|
|
878
|
+
function Ce(t, e, n) {
|
|
879
|
+
const r = n.toString(16), o = [];
|
|
880
|
+
for (const s of r) o.push(s.codePointAt(0));
|
|
881
|
+
const i = t[e + 1];
|
|
882
|
+
return e === t.length - 1 || i && Z(i) ? (t.splice(e, 1, 92, ...o, 32), 1 + o.length) : (t.splice(e, 1, 92, ...o), o.length);
|
|
883
|
+
}
|
|
884
|
+
const Ot = Object.values(a);
|
|
885
|
+
function Ge(t) {
|
|
886
|
+
return !!Array.isArray(t) && !(t.length < 4) && !!Ot.includes(t[0]) && typeof t[1] == "string" && typeof t[2] == "number" && typeof t[3] == "number";
|
|
887
|
+
}
|
|
888
|
+
function D(t) {
|
|
889
|
+
if (!t) return !1;
|
|
890
|
+
switch (t[0]) {
|
|
891
|
+
case a.Dimension:
|
|
892
|
+
case a.Number:
|
|
893
|
+
case a.Percentage:
|
|
894
|
+
return !0;
|
|
895
|
+
default:
|
|
896
|
+
return !1;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
function Je(t) {
|
|
900
|
+
if (!t) return !1;
|
|
901
|
+
switch (t[0]) {
|
|
902
|
+
case a.Whitespace:
|
|
903
|
+
case a.Comment:
|
|
904
|
+
return !0;
|
|
905
|
+
default:
|
|
906
|
+
return !1;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
function Y(t) {
|
|
910
|
+
return !!t && t[0] === a.Comma;
|
|
911
|
+
}
|
|
912
|
+
function Ye(t) {
|
|
913
|
+
return !!t && t[0] === a.Comment;
|
|
914
|
+
}
|
|
915
|
+
function Le(t) {
|
|
916
|
+
return !!t && t[0] === a.Delim;
|
|
917
|
+
}
|
|
918
|
+
function k(t) {
|
|
919
|
+
return !!t && t[0] === a.Dimension;
|
|
920
|
+
}
|
|
921
|
+
function G(t) {
|
|
922
|
+
return !!t && t[0] === a.EOF;
|
|
923
|
+
}
|
|
924
|
+
function Tt(t) {
|
|
925
|
+
return !!t && t[0] === a.Function;
|
|
926
|
+
}
|
|
927
|
+
function de(t) {
|
|
928
|
+
return !!t && t[0] === a.Ident;
|
|
929
|
+
}
|
|
930
|
+
function h(t) {
|
|
931
|
+
return !!t && t[0] === a.Number;
|
|
932
|
+
}
|
|
933
|
+
function A(t) {
|
|
934
|
+
return !!t && t[0] === a.Percentage;
|
|
935
|
+
}
|
|
936
|
+
function Te(t) {
|
|
937
|
+
return !!t && t[0] === a.Whitespace;
|
|
938
|
+
}
|
|
939
|
+
function Ze(t) {
|
|
940
|
+
return !!t && t[0] === a.OpenParen;
|
|
941
|
+
}
|
|
942
|
+
function Rt(t) {
|
|
943
|
+
return !!t && t[0] === a.CloseParen;
|
|
944
|
+
}
|
|
945
|
+
function Mt(t) {
|
|
946
|
+
return !!t && t[0] === a.OpenSquare;
|
|
947
|
+
}
|
|
948
|
+
function Ut(t) {
|
|
949
|
+
return !!t && t[0] === a.OpenCurly;
|
|
950
|
+
}
|
|
951
|
+
var M;
|
|
952
|
+
function Ke(t) {
|
|
953
|
+
let e = t.slice();
|
|
954
|
+
return (n, r, o) => {
|
|
955
|
+
let i = -1;
|
|
956
|
+
for (let s = e.indexOf(r); s < e.length && (i = n.indexOf(e[s]), i === -1 || i < o); s++) ;
|
|
957
|
+
return i === -1 || i === o && r === n[o] && (i++, i >= n.length) ? -1 : (e = n.slice(), i);
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function Re(t, e) {
|
|
961
|
+
const n = e[0];
|
|
962
|
+
if (Ze(n) || Ut(n) || Mt(n)) {
|
|
963
|
+
const r = Lt(t, e);
|
|
964
|
+
return { advance: r.advance, node: r.node };
|
|
965
|
+
}
|
|
966
|
+
if (Tt(n)) {
|
|
967
|
+
const r = Wt(t, e);
|
|
968
|
+
return { advance: r.advance, node: r.node };
|
|
969
|
+
}
|
|
970
|
+
if (Te(n)) {
|
|
971
|
+
const r = Xe(t, e);
|
|
972
|
+
return { advance: r.advance, node: r.node };
|
|
973
|
+
}
|
|
974
|
+
if (Ye(n)) {
|
|
975
|
+
const r = qt(t, e);
|
|
976
|
+
return { advance: r.advance, node: r.node };
|
|
977
|
+
}
|
|
978
|
+
return { advance: 1, node: new d(n) };
|
|
979
|
+
}
|
|
980
|
+
(function(t) {
|
|
981
|
+
t.Function = "function", t.SimpleBlock = "simple-block", t.Whitespace = "whitespace", t.Comment = "comment", t.Token = "token";
|
|
982
|
+
})(M || (M = {}));
|
|
983
|
+
class Qe {
|
|
984
|
+
constructor() {
|
|
985
|
+
y(this, "value", []);
|
|
986
|
+
}
|
|
987
|
+
indexOf(e) {
|
|
988
|
+
return this.value.indexOf(e);
|
|
989
|
+
}
|
|
990
|
+
at(e) {
|
|
991
|
+
if (typeof e == "number") return e < 0 && (e = this.value.length + e), this.value[e];
|
|
992
|
+
}
|
|
993
|
+
forEach(e, n) {
|
|
994
|
+
if (this.value.length === 0) return;
|
|
995
|
+
const r = Ke(this.value);
|
|
996
|
+
let o = 0;
|
|
997
|
+
for (; o < this.value.length; ) {
|
|
998
|
+
const i = this.value[o];
|
|
999
|
+
let s;
|
|
1000
|
+
if (n && (s = { ...n }), e({ node: i, parent: this, state: s }, o) === !1) return !1;
|
|
1001
|
+
if (o = r(this.value, i, o), o === -1) break;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
walk(e, n) {
|
|
1005
|
+
this.value.length !== 0 && this.forEach((r, o) => e(r, o) !== !1 && (!("walk" in r.node) || !this.value.includes(r.node) || r.node.walk(e, r.state) !== !1) && void 0, n);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
class F extends Qe {
|
|
1009
|
+
constructor(n, r, o) {
|
|
1010
|
+
super();
|
|
1011
|
+
y(this, "type", M.Function);
|
|
1012
|
+
y(this, "name");
|
|
1013
|
+
y(this, "endToken");
|
|
1014
|
+
this.name = n, this.endToken = r, this.value = o;
|
|
1015
|
+
}
|
|
1016
|
+
getName() {
|
|
1017
|
+
return this.name[4].value;
|
|
1018
|
+
}
|
|
1019
|
+
normalize() {
|
|
1020
|
+
G(this.endToken) && (this.endToken = [a.CloseParen, ")", -1, -1, void 0]);
|
|
1021
|
+
}
|
|
1022
|
+
tokens() {
|
|
1023
|
+
return G(this.endToken) ? [this.name, ...this.value.flatMap((n) => n.tokens())] : [this.name, ...this.value.flatMap((n) => n.tokens()), this.endToken];
|
|
1024
|
+
}
|
|
1025
|
+
toString() {
|
|
1026
|
+
const n = this.value.map((r) => Ge(r) ? W(r) : r.toString()).join("");
|
|
1027
|
+
return W(this.name) + n + W(this.endToken);
|
|
1028
|
+
}
|
|
1029
|
+
toJSON() {
|
|
1030
|
+
return { type: this.type, name: this.getName(), tokens: this.tokens(), value: this.value.map((n) => n.toJSON()) };
|
|
1031
|
+
}
|
|
1032
|
+
isFunctionNode() {
|
|
1033
|
+
return F.isFunctionNode(this);
|
|
1034
|
+
}
|
|
1035
|
+
static isFunctionNode(n) {
|
|
1036
|
+
return !!n && n instanceof F && n.type === M.Function;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
function Wt(t, e) {
|
|
1040
|
+
const n = [];
|
|
1041
|
+
let r = 1;
|
|
1042
|
+
for (; ; ) {
|
|
1043
|
+
const o = e[r];
|
|
1044
|
+
if (!o || G(o)) return t.onParseError(new ke("Unexpected EOF while consuming a function.", e[0][2], e[e.length - 1][3], ["5.4.9. Consume a function", "Unexpected EOF"])), { advance: e.length, node: new F(e[0], o, n) };
|
|
1045
|
+
if (Rt(o)) return { advance: r + 1, node: new F(e[0], o, n) };
|
|
1046
|
+
if (Je(o)) {
|
|
1047
|
+
const s = _e(t, e.slice(r));
|
|
1048
|
+
r += s.advance, n.push(...s.nodes);
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1051
|
+
const i = Re(t, e.slice(r));
|
|
1052
|
+
r += i.advance, n.push(i.node);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
class ie extends Qe {
|
|
1056
|
+
constructor(n, r, o) {
|
|
1057
|
+
super();
|
|
1058
|
+
y(this, "type", M.SimpleBlock);
|
|
1059
|
+
y(this, "startToken");
|
|
1060
|
+
y(this, "endToken");
|
|
1061
|
+
this.startToken = n, this.endToken = r, this.value = o;
|
|
1062
|
+
}
|
|
1063
|
+
normalize() {
|
|
1064
|
+
if (G(this.endToken)) {
|
|
1065
|
+
const n = ht(this.startToken);
|
|
1066
|
+
n && (this.endToken = n);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
tokens() {
|
|
1070
|
+
return G(this.endToken) ? [this.startToken, ...this.value.flatMap((n) => n.tokens())] : [this.startToken, ...this.value.flatMap((n) => n.tokens()), this.endToken];
|
|
1071
|
+
}
|
|
1072
|
+
toString() {
|
|
1073
|
+
const n = this.value.map((r) => Ge(r) ? W(r) : r.toString()).join("");
|
|
1074
|
+
return W(this.startToken) + n + W(this.endToken);
|
|
1075
|
+
}
|
|
1076
|
+
toJSON() {
|
|
1077
|
+
return { type: this.type, startToken: this.startToken, tokens: this.tokens(), value: this.value.map((n) => n.toJSON()) };
|
|
1078
|
+
}
|
|
1079
|
+
isSimpleBlockNode() {
|
|
1080
|
+
return ie.isSimpleBlockNode(this);
|
|
1081
|
+
}
|
|
1082
|
+
static isSimpleBlockNode(n) {
|
|
1083
|
+
return !!n && n instanceof ie && n.type === M.SimpleBlock;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
function Lt(t, e) {
|
|
1087
|
+
const n = gt(e[0][0]);
|
|
1088
|
+
if (!n) throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");
|
|
1089
|
+
const r = [];
|
|
1090
|
+
let o = 1;
|
|
1091
|
+
for (; ; ) {
|
|
1092
|
+
const i = e[o];
|
|
1093
|
+
if (!i || G(i)) return t.onParseError(new ke("Unexpected EOF while consuming a simple block.", e[0][2], e[e.length - 1][3], ["5.4.8. Consume a simple block", "Unexpected EOF"])), { advance: e.length, node: new ie(e[0], i, r) };
|
|
1094
|
+
if (i[0] === n) return { advance: o + 1, node: new ie(e[0], i, r) };
|
|
1095
|
+
if (Je(i)) {
|
|
1096
|
+
const u = _e(t, e.slice(o));
|
|
1097
|
+
o += u.advance, r.push(...u.nodes);
|
|
1098
|
+
continue;
|
|
1099
|
+
}
|
|
1100
|
+
const s = Re(t, e.slice(o));
|
|
1101
|
+
o += s.advance, r.push(s.node);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
class I {
|
|
1105
|
+
constructor(e) {
|
|
1106
|
+
y(this, "type", M.Whitespace);
|
|
1107
|
+
y(this, "value");
|
|
1108
|
+
this.value = e;
|
|
1109
|
+
}
|
|
1110
|
+
tokens() {
|
|
1111
|
+
return this.value;
|
|
1112
|
+
}
|
|
1113
|
+
toString() {
|
|
1114
|
+
return W(...this.value);
|
|
1115
|
+
}
|
|
1116
|
+
toJSON() {
|
|
1117
|
+
return { type: this.type, tokens: this.tokens() };
|
|
1118
|
+
}
|
|
1119
|
+
isWhitespaceNode() {
|
|
1120
|
+
return I.isWhitespaceNode(this);
|
|
1121
|
+
}
|
|
1122
|
+
static isWhitespaceNode(e) {
|
|
1123
|
+
return !!e && e instanceof I && e.type === M.Whitespace;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function Xe(t, e) {
|
|
1127
|
+
let n = 0;
|
|
1128
|
+
for (; ; ) {
|
|
1129
|
+
const r = e[n];
|
|
1130
|
+
if (!Te(r)) return { advance: n, node: new I(e.slice(0, n)) };
|
|
1131
|
+
n++;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
class ae {
|
|
1135
|
+
constructor(e) {
|
|
1136
|
+
y(this, "type", M.Comment);
|
|
1137
|
+
y(this, "value");
|
|
1138
|
+
this.value = e;
|
|
1139
|
+
}
|
|
1140
|
+
tokens() {
|
|
1141
|
+
return [this.value];
|
|
1142
|
+
}
|
|
1143
|
+
toString() {
|
|
1144
|
+
return W(this.value);
|
|
1145
|
+
}
|
|
1146
|
+
toJSON() {
|
|
1147
|
+
return { type: this.type, tokens: this.tokens() };
|
|
1148
|
+
}
|
|
1149
|
+
isCommentNode() {
|
|
1150
|
+
return ae.isCommentNode(this);
|
|
1151
|
+
}
|
|
1152
|
+
static isCommentNode(e) {
|
|
1153
|
+
return !!e && e instanceof ae && e.type === M.Comment;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
function qt(t, e) {
|
|
1157
|
+
return { advance: 1, node: new ae(e[0]) };
|
|
1158
|
+
}
|
|
1159
|
+
function _e(t, e) {
|
|
1160
|
+
const n = [];
|
|
1161
|
+
let r = 0;
|
|
1162
|
+
for (; ; ) if (Te(e[r])) {
|
|
1163
|
+
const o = Xe(0, e.slice(r));
|
|
1164
|
+
r += o.advance, n.push(o.node);
|
|
1165
|
+
} else {
|
|
1166
|
+
if (!Ye(e[r])) return { advance: r, nodes: n };
|
|
1167
|
+
n.push(new ae(e[r])), r++;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
class d {
|
|
1171
|
+
constructor(e) {
|
|
1172
|
+
y(this, "type", M.Token);
|
|
1173
|
+
y(this, "value");
|
|
1174
|
+
this.value = e;
|
|
1175
|
+
}
|
|
1176
|
+
tokens() {
|
|
1177
|
+
return [this.value];
|
|
1178
|
+
}
|
|
1179
|
+
toString() {
|
|
1180
|
+
return this.value[1];
|
|
1181
|
+
}
|
|
1182
|
+
toJSON() {
|
|
1183
|
+
return { type: this.type, tokens: this.tokens() };
|
|
1184
|
+
}
|
|
1185
|
+
isTokenNode() {
|
|
1186
|
+
return d.isTokenNode(this);
|
|
1187
|
+
}
|
|
1188
|
+
static isTokenNode(e) {
|
|
1189
|
+
return !!e && e instanceof d && e.type === M.Token;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
function $t(t, e) {
|
|
1193
|
+
const n = { onParseError: (e == null ? void 0 : e.onParseError) ?? (() => {
|
|
1194
|
+
}) }, r = [...t];
|
|
1195
|
+
if (t.length === 0) return [];
|
|
1196
|
+
G(r[r.length - 1]) && r.push([a.EOF, "", r[r.length - 1][2], r[r.length - 1][3], void 0]);
|
|
1197
|
+
const o = [];
|
|
1198
|
+
let i = [], s = 0;
|
|
1199
|
+
for (; ; ) {
|
|
1200
|
+
if (!r[s] || G(r[s])) return i.length && o.push(i), o;
|
|
1201
|
+
if (Y(r[s])) {
|
|
1202
|
+
o.push(i), i = [], s++;
|
|
1203
|
+
continue;
|
|
1204
|
+
}
|
|
1205
|
+
const u = Re(n, t.slice(s));
|
|
1206
|
+
i.push(u.node), s += u.advance;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
function zt(t, e, n) {
|
|
1210
|
+
if (t.length === 0) return;
|
|
1211
|
+
const r = Ke(t);
|
|
1212
|
+
let o = 0;
|
|
1213
|
+
for (; o < t.length; ) {
|
|
1214
|
+
const i = t[o];
|
|
1215
|
+
if (e({ node: i, parent: { value: t }, state: void 0 }, o) === !1) return !1;
|
|
1216
|
+
if (o = r(t, i, o), o === -1) break;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
function Vt(t, e, n) {
|
|
1220
|
+
t.length !== 0 && zt(t, (r, o) => e(r, o) !== !1 && (!("walk" in r.node) || !t.includes(r.node) || r.node.walk(e, r.state) !== !1) && void 0);
|
|
1221
|
+
}
|
|
1222
|
+
function Ht(t, e) {
|
|
1223
|
+
for (let n = 0; n < t.length; n++)
|
|
1224
|
+
Vt(t[n], (r, o) => {
|
|
1225
|
+
if (typeof o != "number") return;
|
|
1226
|
+
const i = e(r.node);
|
|
1227
|
+
i && (Array.isArray(i) ? r.parent.value.splice(o, 1, ...i) : r.parent.value.splice(o, 1, i));
|
|
1228
|
+
});
|
|
1229
|
+
return t;
|
|
1230
|
+
}
|
|
1231
|
+
function jt(t) {
|
|
1232
|
+
return ie.isSimpleBlockNode(t);
|
|
1233
|
+
}
|
|
1234
|
+
function ce(t) {
|
|
1235
|
+
return F.isFunctionNode(t);
|
|
1236
|
+
}
|
|
1237
|
+
function et(t) {
|
|
1238
|
+
return I.isWhitespaceNode(t);
|
|
1239
|
+
}
|
|
1240
|
+
function tt(t) {
|
|
1241
|
+
return ae.isCommentNode(t);
|
|
1242
|
+
}
|
|
1243
|
+
function Q(t) {
|
|
1244
|
+
return et(t) || tt(t);
|
|
1245
|
+
}
|
|
1246
|
+
function g(t) {
|
|
1247
|
+
return d.isTokenNode(t);
|
|
1248
|
+
}
|
|
1249
|
+
const Gt = /[A-Z]/g;
|
|
1250
|
+
function x(t) {
|
|
1251
|
+
return t.replace(Gt, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
|
|
1252
|
+
}
|
|
1253
|
+
const Jt = /* @__PURE__ */ new Map([["cm", (t) => t], ["mm", (t) => 10 * t], ["q", (t) => 40 * t], ["in", (t) => t / 2.54], ["pc", (t) => t / 2.54 * 6], ["pt", (t) => t / 2.54 * 72], ["px", (t) => t / 2.54 * 96]]), Ae = /* @__PURE__ */ new Map([["deg", (t) => t], ["grad", (t) => t / 0.9], ["rad", (t) => t / 180 * Math.PI], ["turn", (t) => t / 360]]), pe = /* @__PURE__ */ new Map([["deg", (t) => 0.9 * t], ["grad", (t) => t], ["rad", (t) => 0.9 * t / 180 * Math.PI], ["turn", (t) => 0.9 * t / 360]]), Yt = /* @__PURE__ */ new Map([["hz", (t) => t], ["khz", (t) => t / 1e3]]), Zt = /* @__PURE__ */ new Map([["cm", (t) => 2.54 * t], ["mm", (t) => 25.4 * t], ["q", (t) => 25.4 * t * 4], ["in", (t) => t], ["pc", (t) => 6 * t], ["pt", (t) => 72 * t], ["px", (t) => 96 * t]]), Kt = /* @__PURE__ */ new Map([["hz", (t) => 1e3 * t], ["khz", (t) => t]]), Qt = /* @__PURE__ */ new Map([["cm", (t) => t / 10], ["mm", (t) => t], ["q", (t) => 4 * t], ["in", (t) => t / 25.4], ["pc", (t) => t / 25.4 * 6], ["pt", (t) => t / 25.4 * 72], ["px", (t) => t / 25.4 * 96]]), Xt = /* @__PURE__ */ new Map([["ms", (t) => t], ["s", (t) => t / 1e3]]), _t = /* @__PURE__ */ new Map([["cm", (t) => t / 6 * 2.54], ["mm", (t) => t / 6 * 25.4], ["q", (t) => t / 6 * 25.4 * 4], ["in", (t) => t / 6], ["pc", (t) => t], ["pt", (t) => t / 6 * 72], ["px", (t) => t / 6 * 96]]), en = /* @__PURE__ */ new Map([["cm", (t) => t / 72 * 2.54], ["mm", (t) => t / 72 * 25.4], ["q", (t) => t / 72 * 25.4 * 4], ["in", (t) => t / 72], ["pc", (t) => t / 72 * 6], ["pt", (t) => t], ["px", (t) => t / 72 * 96]]), tn = /* @__PURE__ */ new Map([["cm", (t) => t / 96 * 2.54], ["mm", (t) => t / 96 * 25.4], ["q", (t) => t / 96 * 25.4 * 4], ["in", (t) => t / 96], ["pc", (t) => t / 96 * 6], ["pt", (t) => t / 96 * 72], ["px", (t) => t]]), nn = /* @__PURE__ */ new Map([["cm", (t) => t / 4 / 10], ["mm", (t) => t / 4], ["q", (t) => t], ["in", (t) => t / 4 / 25.4], ["pc", (t) => t / 4 / 25.4 * 6], ["pt", (t) => t / 4 / 25.4 * 72], ["px", (t) => t / 4 / 25.4 * 96]]), nt = /* @__PURE__ */ new Map([["deg", (t) => 180 * t / Math.PI], ["grad", (t) => 180 * t / Math.PI / 0.9], ["rad", (t) => t], ["turn", (t) => 180 * t / Math.PI / 360]]), rn = /* @__PURE__ */ new Map([["ms", (t) => 1e3 * t], ["s", (t) => t]]), fe = /* @__PURE__ */ new Map([["deg", (t) => 360 * t], ["grad", (t) => 360 * t / 0.9], ["rad", (t) => 360 * t / 180 * Math.PI], ["turn", (t) => t]]), on = /* @__PURE__ */ new Map([["cm", Jt], ["mm", Qt], ["q", nn], ["in", Zt], ["pc", _t], ["pt", en], ["px", tn], ["ms", Xt], ["s", rn], ["deg", Ae], ["grad", pe], ["rad", nt], ["turn", fe], ["hz", Yt], ["khz", Kt]]);
|
|
1254
|
+
function O(t, e) {
|
|
1255
|
+
if (!k(t) || !k(e)) return e;
|
|
1256
|
+
const n = x(t[4].unit), r = x(e[4].unit);
|
|
1257
|
+
if (n === r) return e;
|
|
1258
|
+
const o = on.get(r);
|
|
1259
|
+
if (!o) return e;
|
|
1260
|
+
const i = o.get(n);
|
|
1261
|
+
if (!i) return e;
|
|
1262
|
+
const s = i(e[4].value), u = [a.Dimension, "", e[2], e[3], { ...e[4], signCharacter: s < 0 ? "-" : void 0, type: Number.isInteger(s) ? l.Integer : l.Number, value: s }];
|
|
1263
|
+
return It(u, t[4].unit), u;
|
|
1264
|
+
}
|
|
1265
|
+
function an(t) {
|
|
1266
|
+
if (t.length !== 2) return -1;
|
|
1267
|
+
const e = t[0].value;
|
|
1268
|
+
let n = t[1].value;
|
|
1269
|
+
if (h(e) && h(n)) {
|
|
1270
|
+
const r = e[4].value + n[4].value;
|
|
1271
|
+
return new d([a.Number, r.toString(), e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number }]);
|
|
1272
|
+
}
|
|
1273
|
+
if (A(e) && A(n)) {
|
|
1274
|
+
const r = e[4].value + n[4].value;
|
|
1275
|
+
return new d([a.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1276
|
+
}
|
|
1277
|
+
if (k(e) && k(n) && (n = O(e, n), x(e[4].unit) === x(n[4].unit))) {
|
|
1278
|
+
const r = e[4].value + n[4].value;
|
|
1279
|
+
return new d([a.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number, unit: e[4].unit }]);
|
|
1280
|
+
}
|
|
1281
|
+
return -1;
|
|
1282
|
+
}
|
|
1283
|
+
function sn(t) {
|
|
1284
|
+
if (t.length !== 2) return -1;
|
|
1285
|
+
const e = t[0].value, n = t[1].value;
|
|
1286
|
+
if (h(e) && h(n)) {
|
|
1287
|
+
const r = e[4].value / n[4].value;
|
|
1288
|
+
return new d([a.Number, r.toString(), e[2], n[3], { value: r, type: Number.isInteger(r) ? l.Integer : l.Number }]);
|
|
1289
|
+
}
|
|
1290
|
+
if (A(e) && h(n)) {
|
|
1291
|
+
const r = e[4].value / n[4].value;
|
|
1292
|
+
return new d([a.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1293
|
+
}
|
|
1294
|
+
if (k(e) && h(n)) {
|
|
1295
|
+
const r = e[4].value / n[4].value;
|
|
1296
|
+
return new d([a.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: Number.isInteger(r) ? l.Integer : l.Number, unit: e[4].unit }]);
|
|
1297
|
+
}
|
|
1298
|
+
return -1;
|
|
1299
|
+
}
|
|
1300
|
+
function J(t) {
|
|
1301
|
+
return !!t && typeof t == "object" && "inputs" in t && Array.isArray(t.inputs) && "operation" in t;
|
|
1302
|
+
}
|
|
1303
|
+
function N(t) {
|
|
1304
|
+
if (t === -1) return -1;
|
|
1305
|
+
const e = [];
|
|
1306
|
+
for (let n = 0; n < t.inputs.length; n++) {
|
|
1307
|
+
const r = t.inputs[n];
|
|
1308
|
+
if (g(r)) {
|
|
1309
|
+
e.push(r);
|
|
1310
|
+
continue;
|
|
1311
|
+
}
|
|
1312
|
+
const o = N(r);
|
|
1313
|
+
if (o === -1) return -1;
|
|
1314
|
+
e.push(o);
|
|
1315
|
+
}
|
|
1316
|
+
return t.operation(e);
|
|
1317
|
+
}
|
|
1318
|
+
function un(t) {
|
|
1319
|
+
if (t.length !== 2) return -1;
|
|
1320
|
+
const e = t[0].value, n = t[1].value;
|
|
1321
|
+
if (h(e) && h(n)) {
|
|
1322
|
+
const r = e[4].value * n[4].value;
|
|
1323
|
+
return new d([a.Number, r.toString(), e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number }]);
|
|
1324
|
+
}
|
|
1325
|
+
if (A(e) && h(n)) {
|
|
1326
|
+
const r = e[4].value * n[4].value;
|
|
1327
|
+
return new d([a.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1328
|
+
}
|
|
1329
|
+
if (h(e) && A(n)) {
|
|
1330
|
+
const r = e[4].value * n[4].value;
|
|
1331
|
+
return new d([a.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1332
|
+
}
|
|
1333
|
+
if (k(e) && h(n)) {
|
|
1334
|
+
const r = e[4].value * n[4].value;
|
|
1335
|
+
return new d([a.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number, unit: e[4].unit }]);
|
|
1336
|
+
}
|
|
1337
|
+
if (h(e) && k(n)) {
|
|
1338
|
+
const r = e[4].value * n[4].value;
|
|
1339
|
+
return new d([a.Dimension, r.toString() + n[4].unit, e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number, unit: n[4].unit }]);
|
|
1340
|
+
}
|
|
1341
|
+
return -1;
|
|
1342
|
+
}
|
|
1343
|
+
function se(t, e) {
|
|
1344
|
+
for (let n = 0; n < t.length; n++) {
|
|
1345
|
+
const r = t[n];
|
|
1346
|
+
if (!g(r)) continue;
|
|
1347
|
+
const o = r.value;
|
|
1348
|
+
if (!de(o)) continue;
|
|
1349
|
+
const i = x(o[4].value);
|
|
1350
|
+
switch (i) {
|
|
1351
|
+
case "e":
|
|
1352
|
+
t.splice(n, 1, new d([a.Number, Math.E.toString(), o[2], o[3], { value: Math.E, type: l.Number }]));
|
|
1353
|
+
break;
|
|
1354
|
+
case "pi":
|
|
1355
|
+
t.splice(n, 1, new d([a.Number, Math.PI.toString(), o[2], o[3], { value: Math.PI, type: l.Number }]));
|
|
1356
|
+
break;
|
|
1357
|
+
case "infinity":
|
|
1358
|
+
t.splice(n, 1, new d([a.Number, "infinity", o[2], o[3], { value: 1 / 0, type: l.Number }]));
|
|
1359
|
+
break;
|
|
1360
|
+
case "-infinity":
|
|
1361
|
+
t.splice(n, 1, new d([a.Number, "-infinity", o[2], o[3], { value: -1 / 0, type: l.Number }]));
|
|
1362
|
+
break;
|
|
1363
|
+
case "nan":
|
|
1364
|
+
t.splice(n, 1, new d([a.Number, "NaN", o[2], o[3], { value: Number.NaN, type: l.Number }]));
|
|
1365
|
+
break;
|
|
1366
|
+
default:
|
|
1367
|
+
if (e.has(i)) {
|
|
1368
|
+
const s = e.get(i);
|
|
1369
|
+
t.splice(n, 1, new d(s));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return t;
|
|
1374
|
+
}
|
|
1375
|
+
function De(t) {
|
|
1376
|
+
if (t.length !== 1) return -1;
|
|
1377
|
+
const e = t[0].value;
|
|
1378
|
+
return D(e) ? t[0] : -1;
|
|
1379
|
+
}
|
|
1380
|
+
function H(t, e, n) {
|
|
1381
|
+
return k(e) ? ve(t, e[4].unit, n) : A(e) ? cn(t, n) : h(e) ? $(t, n) : -1;
|
|
1382
|
+
}
|
|
1383
|
+
function ve(t, e, n) {
|
|
1384
|
+
const r = t.tokens();
|
|
1385
|
+
return { inputs: [new d([a.Dimension, n.toString() + e, r[0][2], r[r.length - 1][3], { value: n, type: Number.isInteger(n) ? l.Integer : l.Number, unit: e }])], operation: De };
|
|
1386
|
+
}
|
|
1387
|
+
function cn(t, e) {
|
|
1388
|
+
const n = t.tokens();
|
|
1389
|
+
return { inputs: [new d([a.Percentage, e.toString() + "%", n[0][2], n[n.length - 1][3], { value: e }])], operation: De };
|
|
1390
|
+
}
|
|
1391
|
+
function $(t, e) {
|
|
1392
|
+
const n = t.tokens();
|
|
1393
|
+
return { inputs: [new d([a.Number, e.toString(), n[0][2], n[n.length - 1][3], { value: e, type: Number.isInteger(e) ? l.Integer : l.Number }])], operation: De };
|
|
1394
|
+
}
|
|
1395
|
+
function ln(t, e) {
|
|
1396
|
+
const n = e.value;
|
|
1397
|
+
return h(n) ? ve(t, "rad", Math.acos(n[4].value)) : -1;
|
|
1398
|
+
}
|
|
1399
|
+
function dn(t, e) {
|
|
1400
|
+
const n = e.value;
|
|
1401
|
+
return h(n) ? ve(t, "rad", Math.asin(n[4].value)) : -1;
|
|
1402
|
+
}
|
|
1403
|
+
function pn(t, e) {
|
|
1404
|
+
const n = e.value;
|
|
1405
|
+
return h(n) ? ve(t, "rad", Math.atan(n[4].value)) : -1;
|
|
1406
|
+
}
|
|
1407
|
+
function Be(t) {
|
|
1408
|
+
return k(t) || h(t);
|
|
1409
|
+
}
|
|
1410
|
+
function Me(t) {
|
|
1411
|
+
if (t.length === 0) return !0;
|
|
1412
|
+
const e = t[0];
|
|
1413
|
+
if (!D(e)) return !1;
|
|
1414
|
+
if (t.length === 1) return !0;
|
|
1415
|
+
if (k(e)) {
|
|
1416
|
+
const n = x(e[4].unit);
|
|
1417
|
+
for (let r = 1; r < t.length; r++) {
|
|
1418
|
+
const o = t[r];
|
|
1419
|
+
if (e[0] !== o[0] || n !== x(o[4].unit)) return !1;
|
|
1420
|
+
}
|
|
1421
|
+
return !0;
|
|
1422
|
+
}
|
|
1423
|
+
for (let n = 1; n < t.length; n++) {
|
|
1424
|
+
const r = t[n];
|
|
1425
|
+
if (e[0] !== r[0]) return !1;
|
|
1426
|
+
}
|
|
1427
|
+
return !0;
|
|
1428
|
+
}
|
|
1429
|
+
function V(t, e) {
|
|
1430
|
+
return !!D(t) && (k(t) ? t[0] === e[0] && x(t[4].unit) === x(e[4].unit) : t[0] === e[0]);
|
|
1431
|
+
}
|
|
1432
|
+
function fn(t, e, n) {
|
|
1433
|
+
const r = e.value;
|
|
1434
|
+
if (!Be(r)) return -1;
|
|
1435
|
+
const o = O(r, n.value);
|
|
1436
|
+
return V(r, o) ? ve(t, "rad", Math.atan2(r[4].value, o[4].value)) : -1;
|
|
1437
|
+
}
|
|
1438
|
+
function vn(t, e, n) {
|
|
1439
|
+
const r = e.value;
|
|
1440
|
+
return !D(r) || !n.rawPercentages && A(r) ? -1 : H(t, r, Math.abs(r[4].value));
|
|
1441
|
+
}
|
|
1442
|
+
function mn(t, e, n, r, o) {
|
|
1443
|
+
if (!g(e) || !g(n) || !g(r)) return -1;
|
|
1444
|
+
const i = e.value;
|
|
1445
|
+
if (!D(i) || !o.rawPercentages && A(i)) return -1;
|
|
1446
|
+
const s = O(i, n.value);
|
|
1447
|
+
if (!V(i, s)) return -1;
|
|
1448
|
+
const u = O(i, r.value);
|
|
1449
|
+
return V(i, u) ? H(t, i, Math.max(i[4].value, Math.min(s[4].value, u[4].value))) : -1;
|
|
1450
|
+
}
|
|
1451
|
+
function gn(t, e) {
|
|
1452
|
+
const n = e.value;
|
|
1453
|
+
if (!Be(n)) return -1;
|
|
1454
|
+
let r = n[4].value;
|
|
1455
|
+
if (k(n)) switch (n[4].unit.toLowerCase()) {
|
|
1456
|
+
case "rad":
|
|
1457
|
+
break;
|
|
1458
|
+
case "deg":
|
|
1459
|
+
r = Ae.get("rad")(n[4].value);
|
|
1460
|
+
break;
|
|
1461
|
+
case "grad":
|
|
1462
|
+
r = pe.get("rad")(n[4].value);
|
|
1463
|
+
break;
|
|
1464
|
+
case "turn":
|
|
1465
|
+
r = fe.get("rad")(n[4].value);
|
|
1466
|
+
break;
|
|
1467
|
+
default:
|
|
1468
|
+
return -1;
|
|
1469
|
+
}
|
|
1470
|
+
return r = Math.cos(r), $(t, r);
|
|
1471
|
+
}
|
|
1472
|
+
function hn(t, e) {
|
|
1473
|
+
const n = e.value;
|
|
1474
|
+
return h(n) ? $(t, Math.exp(n[4].value)) : -1;
|
|
1475
|
+
}
|
|
1476
|
+
function Cn(t, e, n) {
|
|
1477
|
+
if (!e.every(g)) return -1;
|
|
1478
|
+
const r = e[0].value;
|
|
1479
|
+
if (!D(r) || !n.rawPercentages && A(r)) return -1;
|
|
1480
|
+
const o = e.map((u) => O(r, u.value));
|
|
1481
|
+
if (!Me(o)) return -1;
|
|
1482
|
+
const i = o.map((u) => u[4].value), s = Math.hypot(...i);
|
|
1483
|
+
return H(t, r, s);
|
|
1484
|
+
}
|
|
1485
|
+
function qe(t, e, n) {
|
|
1486
|
+
if (!e.every(g)) return -1;
|
|
1487
|
+
const r = e[0].value;
|
|
1488
|
+
if (!D(r) || !n.rawPercentages && A(r)) return -1;
|
|
1489
|
+
const o = e.map((u) => O(r, u.value));
|
|
1490
|
+
if (!Me(o)) return -1;
|
|
1491
|
+
const i = o.map((u) => u[4].value), s = Math.max(...i);
|
|
1492
|
+
return H(t, r, s);
|
|
1493
|
+
}
|
|
1494
|
+
function $e(t, e, n) {
|
|
1495
|
+
if (!e.every(g)) return -1;
|
|
1496
|
+
const r = e[0].value;
|
|
1497
|
+
if (!D(r) || !n.rawPercentages && A(r)) return -1;
|
|
1498
|
+
const o = e.map((u) => O(r, u.value));
|
|
1499
|
+
if (!Me(o)) return -1;
|
|
1500
|
+
const i = o.map((u) => u[4].value), s = Math.min(...i);
|
|
1501
|
+
return H(t, r, s);
|
|
1502
|
+
}
|
|
1503
|
+
function En(t, e, n) {
|
|
1504
|
+
const r = e.value;
|
|
1505
|
+
if (!D(r)) return -1;
|
|
1506
|
+
const o = O(r, n.value);
|
|
1507
|
+
if (!V(r, o)) return -1;
|
|
1508
|
+
let i;
|
|
1509
|
+
return i = o[4].value === 0 ? Number.NaN : Number.isFinite(r[4].value) && (Number.isFinite(o[4].value) || (o[4].value !== Number.POSITIVE_INFINITY || r[4].value !== Number.NEGATIVE_INFINITY && !Object.is(0 * r[4].value, -0)) && (o[4].value !== Number.NEGATIVE_INFINITY || r[4].value !== Number.POSITIVE_INFINITY && !Object.is(0 * r[4].value, 0))) ? Number.isFinite(o[4].value) ? (r[4].value % o[4].value + o[4].value) % o[4].value : r[4].value : Number.NaN, H(t, r, i);
|
|
1510
|
+
}
|
|
1511
|
+
function yn(t, e, n) {
|
|
1512
|
+
const r = e.value, o = n.value;
|
|
1513
|
+
return !h(r) || !V(r, o) ? -1 : $(t, Math.pow(r[4].value, o[4].value));
|
|
1514
|
+
}
|
|
1515
|
+
function Pn(t, e, n) {
|
|
1516
|
+
const r = e.value;
|
|
1517
|
+
if (!D(r)) return -1;
|
|
1518
|
+
const o = O(r, n.value);
|
|
1519
|
+
if (!V(r, o)) return -1;
|
|
1520
|
+
let i;
|
|
1521
|
+
return i = o[4].value === 0 ? Number.NaN : Number.isFinite(r[4].value) ? Number.isFinite(o[4].value) ? r[4].value % o[4].value : r[4].value : Number.NaN, H(t, r, i);
|
|
1522
|
+
}
|
|
1523
|
+
function kn(t, e, n, r, o) {
|
|
1524
|
+
const i = n.value;
|
|
1525
|
+
if (!D(i) || !o.rawPercentages && A(i)) return -1;
|
|
1526
|
+
const s = O(i, r.value);
|
|
1527
|
+
if (!V(i, s)) return -1;
|
|
1528
|
+
let u;
|
|
1529
|
+
if (s[4].value === 0) u = Number.NaN;
|
|
1530
|
+
else if (Number.isFinite(i[4].value) || Number.isFinite(s[4].value)) if (!Number.isFinite(i[4].value) && Number.isFinite(s[4].value)) u = i[4].value;
|
|
1531
|
+
else if (Number.isFinite(i[4].value) && !Number.isFinite(s[4].value)) switch (e) {
|
|
1532
|
+
case "down":
|
|
1533
|
+
u = i[4].value < 0 ? -1 / 0 : Object.is(-0, 0 * i[4].value) ? -0 : 0;
|
|
1534
|
+
break;
|
|
1535
|
+
case "up":
|
|
1536
|
+
u = i[4].value > 0 ? 1 / 0 : Object.is(0, 0 * i[4].value) ? 0 : -0;
|
|
1537
|
+
break;
|
|
1538
|
+
default:
|
|
1539
|
+
u = Object.is(0, 0 * i[4].value) ? 0 : -0;
|
|
1540
|
+
}
|
|
1541
|
+
else if (Number.isFinite(s[4].value)) switch (e) {
|
|
1542
|
+
case "down":
|
|
1543
|
+
u = Math.floor(i[4].value / s[4].value) * s[4].value;
|
|
1544
|
+
break;
|
|
1545
|
+
case "up":
|
|
1546
|
+
u = Math.ceil(i[4].value / s[4].value) * s[4].value;
|
|
1547
|
+
break;
|
|
1548
|
+
case "to-zero":
|
|
1549
|
+
u = Math.trunc(i[4].value / s[4].value) * s[4].value;
|
|
1550
|
+
break;
|
|
1551
|
+
default: {
|
|
1552
|
+
let c = Math.floor(i[4].value / s[4].value) * s[4].value, p = Math.ceil(i[4].value / s[4].value) * s[4].value;
|
|
1553
|
+
if (c > p) {
|
|
1554
|
+
const m = c;
|
|
1555
|
+
c = p, p = m;
|
|
1556
|
+
}
|
|
1557
|
+
const v = Math.abs(i[4].value - c), f = Math.abs(i[4].value - p);
|
|
1558
|
+
u = v === f ? p : v < f ? c : p;
|
|
1559
|
+
break;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
else u = i[4].value;
|
|
1563
|
+
else u = Number.NaN;
|
|
1564
|
+
return H(t, i, u);
|
|
1565
|
+
}
|
|
1566
|
+
function bn(t, e, n) {
|
|
1567
|
+
const r = e.value;
|
|
1568
|
+
return !D(r) || !n.rawPercentages && A(r) ? -1 : $(t, Math.sign(r[4].value));
|
|
1569
|
+
}
|
|
1570
|
+
function Sn(t, e) {
|
|
1571
|
+
const n = e.value;
|
|
1572
|
+
if (!Be(n)) return -1;
|
|
1573
|
+
let r = n[4].value;
|
|
1574
|
+
if (k(n)) switch (x(n[4].unit)) {
|
|
1575
|
+
case "rad":
|
|
1576
|
+
break;
|
|
1577
|
+
case "deg":
|
|
1578
|
+
r = Ae.get("rad")(n[4].value);
|
|
1579
|
+
break;
|
|
1580
|
+
case "grad":
|
|
1581
|
+
r = pe.get("rad")(n[4].value);
|
|
1582
|
+
break;
|
|
1583
|
+
case "turn":
|
|
1584
|
+
r = fe.get("rad")(n[4].value);
|
|
1585
|
+
break;
|
|
1586
|
+
default:
|
|
1587
|
+
return -1;
|
|
1588
|
+
}
|
|
1589
|
+
return r = Math.sin(r), $(t, r);
|
|
1590
|
+
}
|
|
1591
|
+
function An(t, e) {
|
|
1592
|
+
const n = e.value;
|
|
1593
|
+
return h(n) ? $(t, Math.sqrt(n[4].value)) : -1;
|
|
1594
|
+
}
|
|
1595
|
+
function Dn(t, e) {
|
|
1596
|
+
const n = e.value;
|
|
1597
|
+
if (!Be(n)) return -1;
|
|
1598
|
+
const r = n[4].value;
|
|
1599
|
+
let o = 0, i = n[4].value;
|
|
1600
|
+
if (k(n)) switch (x(n[4].unit)) {
|
|
1601
|
+
case "rad":
|
|
1602
|
+
o = nt.get("deg")(r);
|
|
1603
|
+
break;
|
|
1604
|
+
case "deg":
|
|
1605
|
+
o = r, i = Ae.get("rad")(r);
|
|
1606
|
+
break;
|
|
1607
|
+
case "grad":
|
|
1608
|
+
o = pe.get("deg")(r), i = pe.get("rad")(r);
|
|
1609
|
+
break;
|
|
1610
|
+
case "turn":
|
|
1611
|
+
o = fe.get("deg")(r), i = fe.get("rad")(r);
|
|
1612
|
+
break;
|
|
1613
|
+
default:
|
|
1614
|
+
return -1;
|
|
1615
|
+
}
|
|
1616
|
+
const s = o / 90;
|
|
1617
|
+
return i = o % 90 == 0 && s % 2 != 0 ? s > 0 ? 1 / 0 : -1 / 0 : Math.tan(i), $(t, i);
|
|
1618
|
+
}
|
|
1619
|
+
function Bn(t) {
|
|
1620
|
+
if (t.length !== 2) return -1;
|
|
1621
|
+
const e = t[0].value;
|
|
1622
|
+
let n = t[1].value;
|
|
1623
|
+
if (h(e) && h(n)) {
|
|
1624
|
+
const r = e[4].value - n[4].value;
|
|
1625
|
+
return new d([a.Number, r.toString(), e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number }]);
|
|
1626
|
+
}
|
|
1627
|
+
if (A(e) && A(n)) {
|
|
1628
|
+
const r = e[4].value - n[4].value;
|
|
1629
|
+
return new d([a.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1630
|
+
}
|
|
1631
|
+
if (k(e) && k(n) && (n = O(e, n), x(e[4].unit) === x(n[4].unit))) {
|
|
1632
|
+
const r = e[4].value - n[4].value;
|
|
1633
|
+
return new d([a.Dimension, r.toString() + e[4].unit, e[2], n[3], { value: r, type: e[4].type === l.Integer && n[4].type === l.Integer ? l.Integer : l.Number, unit: e[4].unit }]);
|
|
1634
|
+
}
|
|
1635
|
+
return -1;
|
|
1636
|
+
}
|
|
1637
|
+
function Fn(t, e) {
|
|
1638
|
+
if (e.length === 1) {
|
|
1639
|
+
const n = e[0];
|
|
1640
|
+
if (!n || !g(n)) return -1;
|
|
1641
|
+
const r = n.value;
|
|
1642
|
+
return h(r) ? $(t, Math.log(r[4].value)) : -1;
|
|
1643
|
+
}
|
|
1644
|
+
if (e.length === 2) {
|
|
1645
|
+
const n = e[0];
|
|
1646
|
+
if (!n || !g(n)) return -1;
|
|
1647
|
+
const r = n.value;
|
|
1648
|
+
if (!h(r)) return -1;
|
|
1649
|
+
const o = e[1];
|
|
1650
|
+
if (!o || !g(o)) return -1;
|
|
1651
|
+
const i = o.value;
|
|
1652
|
+
return h(i) ? $(t, Math.log(r[4].value) / Math.log(i[4].value)) : -1;
|
|
1653
|
+
}
|
|
1654
|
+
return -1;
|
|
1655
|
+
}
|
|
1656
|
+
const wn = /^none$/i;
|
|
1657
|
+
function xe(t) {
|
|
1658
|
+
if (Array.isArray(t)) {
|
|
1659
|
+
const n = t.filter((r) => !(et(r) && tt(r)));
|
|
1660
|
+
return n.length === 1 && xe(n[0]);
|
|
1661
|
+
}
|
|
1662
|
+
if (!g(t)) return !1;
|
|
1663
|
+
const e = t.value;
|
|
1664
|
+
return !!de(e) && wn.test(e[4].value);
|
|
1665
|
+
}
|
|
1666
|
+
function Nn(t, e, n, r, o, i) {
|
|
1667
|
+
const s = n.value;
|
|
1668
|
+
if (!D(s)) return -1;
|
|
1669
|
+
const u = O(s, r.value);
|
|
1670
|
+
if (!V(s, u)) return -1;
|
|
1671
|
+
let c, p = null;
|
|
1672
|
+
if (o && (p = O(s, o.value), !V(s, p))) return -1;
|
|
1673
|
+
if (Number.isFinite(s[4].value)) if (Number.isFinite(u[4].value)) if (Number.isFinite(u[4].value - s[4].value)) if (p && !Number.isFinite(p[4].value)) c = s[4].value;
|
|
1674
|
+
else {
|
|
1675
|
+
const v = In(xn([e, W(s), W(u), o ? `by ${o.toString()}` : ""].join(",")), i.randomSeed);
|
|
1676
|
+
let f = s[4].value, m = u[4].value;
|
|
1677
|
+
if (f > m && ([f, m] = [m, f]), p && (p[4].value <= 0 || Math.abs(f - m) / p[4].value > 1e10) && (p = null), p) {
|
|
1678
|
+
const C = Math.abs(f - m), b = v();
|
|
1679
|
+
c = f + Math.floor(C / p[4].value * b) * p[4].value;
|
|
1680
|
+
} else {
|
|
1681
|
+
const C = v();
|
|
1682
|
+
c = Number((C * (m - f) + f).toFixed(5));
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
else c = Number.NaN;
|
|
1686
|
+
else c = Number.NaN;
|
|
1687
|
+
else c = Number.NaN;
|
|
1688
|
+
return H(t, s, c);
|
|
1689
|
+
}
|
|
1690
|
+
function In(t = 0.34944106645296036, e = 0.19228640875738723, n = 0.8784393832007205, r = 0.04850964319275053) {
|
|
1691
|
+
return () => {
|
|
1692
|
+
const o = ((t |= 0) + (e |= 0) | 0) + (r |= 0) | 0;
|
|
1693
|
+
return r = r + 1 | 0, t = e ^ e >>> 9, e = (n |= 0) + (n << 3) | 0, n = (n = n << 21 | n >>> 11) + o | 0, (o >>> 0) / 4294967296;
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
function xn(t) {
|
|
1697
|
+
let e = 0, n = 0, r = 0;
|
|
1698
|
+
e = ~e;
|
|
1699
|
+
for (let o = 0, i = t.length; o < i; o++) r = 255 & (e ^ t.charCodeAt(o)), n = +("0x" + "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substring(9 * r, 9 * r + 8)), e = e >>> 8 ^ n;
|
|
1700
|
+
return ~e >>> 0;
|
|
1701
|
+
}
|
|
1702
|
+
const Ue = /* @__PURE__ */ new Map([["abs", function(e, n, r) {
|
|
1703
|
+
return L(e, n, r, vn);
|
|
1704
|
+
}], ["acos", function(e, n, r) {
|
|
1705
|
+
return L(e, n, r, ln);
|
|
1706
|
+
}], ["asin", function(e, n, r) {
|
|
1707
|
+
return L(e, n, r, dn);
|
|
1708
|
+
}], ["atan", function(e, n, r) {
|
|
1709
|
+
return L(e, n, r, pn);
|
|
1710
|
+
}], ["atan2", function(e, n, r) {
|
|
1711
|
+
return ge(e, n, r, fn);
|
|
1712
|
+
}], ["calc", w], ["clamp", function(e, n, r) {
|
|
1713
|
+
const o = se([...e.value.filter((E) => !Q(E))], n), i = [], s = [], u = [];
|
|
1714
|
+
{
|
|
1715
|
+
let E = i;
|
|
1716
|
+
for (let me = 0; me < o.length; me++) {
|
|
1717
|
+
const P = o[me];
|
|
1718
|
+
if (g(P) && Y(P.value)) {
|
|
1719
|
+
if (E === u) return -1;
|
|
1720
|
+
if (E === s) {
|
|
1721
|
+
E = u;
|
|
1722
|
+
continue;
|
|
1723
|
+
}
|
|
1724
|
+
if (E === i) {
|
|
1725
|
+
E = s;
|
|
1726
|
+
continue;
|
|
1727
|
+
}
|
|
1728
|
+
return -1;
|
|
1729
|
+
}
|
|
1730
|
+
E.push(P);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
const c = xe(i), p = xe(u);
|
|
1734
|
+
if (c && p) return w(T(s), n, r);
|
|
1735
|
+
const v = N(w(T(s), n, r));
|
|
1736
|
+
if (v === -1) return -1;
|
|
1737
|
+
if (c) {
|
|
1738
|
+
const E = N(w(T(u), n, r));
|
|
1739
|
+
return E === -1 ? -1 : $e((f = v, m = E, new F([a.Function, "min(", -1, -1, { value: "min" }], [a.CloseParen, ")", -1, -1, void 0], [f, new d([a.Comma, ",", -1, -1, void 0]), m])), [v, E], r);
|
|
1740
|
+
}
|
|
1741
|
+
if (p) {
|
|
1742
|
+
const E = N(w(T(i), n, r));
|
|
1743
|
+
return E === -1 ? -1 : qe(Rn(E, v), [E, v], r);
|
|
1744
|
+
}
|
|
1745
|
+
var f, m;
|
|
1746
|
+
const C = N(w(T(i), n, r));
|
|
1747
|
+
if (C === -1) return -1;
|
|
1748
|
+
const b = N(w(T(u), n, r));
|
|
1749
|
+
return b === -1 ? -1 : mn(e, C, v, b, r);
|
|
1750
|
+
}], ["cos", function(e, n, r) {
|
|
1751
|
+
return L(e, n, r, gn);
|
|
1752
|
+
}], ["exp", function(e, n, r) {
|
|
1753
|
+
return L(e, n, r, hn);
|
|
1754
|
+
}], ["hypot", function(e, n, r) {
|
|
1755
|
+
return he(e, e.value, n, r, Cn);
|
|
1756
|
+
}], ["log", function(e, n, r) {
|
|
1757
|
+
return he(e, e.value, n, r, Fn);
|
|
1758
|
+
}], ["max", function(e, n, r) {
|
|
1759
|
+
return he(e, e.value, n, r, qe);
|
|
1760
|
+
}], ["min", function(e, n, r) {
|
|
1761
|
+
return he(e, e.value, n, r, $e);
|
|
1762
|
+
}], ["mod", function(e, n, r) {
|
|
1763
|
+
return ge(e, n, r, En);
|
|
1764
|
+
}], ["pow", function(e, n, r) {
|
|
1765
|
+
return ge(e, n, r, yn);
|
|
1766
|
+
}], ["random", function(e, n, r) {
|
|
1767
|
+
const o = e.value.filter((m) => !Q(m));
|
|
1768
|
+
let i = "";
|
|
1769
|
+
const s = [], u = [];
|
|
1770
|
+
for (let m = 0; m < o.length; m++) {
|
|
1771
|
+
const C = o[m];
|
|
1772
|
+
if (!i && u.length === 0 && g(C) && de(C.value)) {
|
|
1773
|
+
const b = C.value[4].value.toLowerCase();
|
|
1774
|
+
if (b === "per-element" || b.startsWith("--")) {
|
|
1775
|
+
i = b;
|
|
1776
|
+
const E = o[m + 1];
|
|
1777
|
+
if (!g(E) || !Y(E.value)) return -1;
|
|
1778
|
+
m++;
|
|
1779
|
+
continue;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
if (g(C) && Y(C.value)) {
|
|
1783
|
+
const b = o[m + 1];
|
|
1784
|
+
if (u.length > 0 && g(b) && de(b.value)) {
|
|
1785
|
+
const E = b.value[4].value.toLowerCase();
|
|
1786
|
+
if (E === "by" || E.startsWith("--")) {
|
|
1787
|
+
s.push(...o.slice(m + 2));
|
|
1788
|
+
break;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
u.push(C);
|
|
1793
|
+
}
|
|
1794
|
+
const c = ot(u, n, r);
|
|
1795
|
+
if (c === -1) return -1;
|
|
1796
|
+
const [p, v] = c;
|
|
1797
|
+
let f = null;
|
|
1798
|
+
return s.length && (f = rt(s, n, r), f === -1) ? -1 : Nn(e, i, p, v, f, r);
|
|
1799
|
+
}], ["rem", function(e, n, r) {
|
|
1800
|
+
return ge(e, n, r, Pn);
|
|
1801
|
+
}], ["round", function(e, n, r) {
|
|
1802
|
+
const o = se([...e.value.filter((f) => !Q(f))], n);
|
|
1803
|
+
let i = "", s = !1;
|
|
1804
|
+
const u = [], c = [];
|
|
1805
|
+
{
|
|
1806
|
+
let f = u;
|
|
1807
|
+
for (let m = 0; m < o.length; m++) {
|
|
1808
|
+
const C = o[m];
|
|
1809
|
+
if (!i && u.length === 0 && c.length === 0 && g(C) && de(C.value)) {
|
|
1810
|
+
const b = C.value[4].value.toLowerCase();
|
|
1811
|
+
if (Tn.has(b)) {
|
|
1812
|
+
i = b;
|
|
1813
|
+
continue;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
if (g(C) && Y(C.value)) {
|
|
1817
|
+
if (f === c) return -1;
|
|
1818
|
+
if (f === u && i && u.length === 0) continue;
|
|
1819
|
+
if (f === u) {
|
|
1820
|
+
s = !0, f = c;
|
|
1821
|
+
continue;
|
|
1822
|
+
}
|
|
1823
|
+
return -1;
|
|
1824
|
+
}
|
|
1825
|
+
f.push(C);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
const p = N(w(T(u), n, r));
|
|
1829
|
+
if (p === -1) return -1;
|
|
1830
|
+
s || c.length !== 0 || c.push(new d([a.Number, "1", -1, -1, { value: 1, type: l.Integer }]));
|
|
1831
|
+
const v = N(w(T(c), n, r));
|
|
1832
|
+
return v === -1 ? -1 : (i || (i = "nearest"), kn(e, i, p, v, r));
|
|
1833
|
+
}], ["sign", function(e, n, r) {
|
|
1834
|
+
return L(e, n, r, bn);
|
|
1835
|
+
}], ["sin", function(e, n, r) {
|
|
1836
|
+
return L(e, n, r, Sn);
|
|
1837
|
+
}], ["sqrt", function(e, n, r) {
|
|
1838
|
+
return L(e, n, r, An);
|
|
1839
|
+
}], ["tan", function(e, n, r) {
|
|
1840
|
+
return L(e, n, r, Dn);
|
|
1841
|
+
}]]);
|
|
1842
|
+
function w(t, e, n) {
|
|
1843
|
+
const r = se([...t.value.filter((i) => !Q(i))], e);
|
|
1844
|
+
if (r.length === 1 && g(r[0])) return { inputs: [r[0]], operation: De };
|
|
1845
|
+
let o = 0;
|
|
1846
|
+
for (; o < r.length; ) {
|
|
1847
|
+
const i = r[o];
|
|
1848
|
+
if (jt(i) && Ze(i.startToken)) {
|
|
1849
|
+
const s = w(i, e, n);
|
|
1850
|
+
if (s === -1) return -1;
|
|
1851
|
+
r.splice(o, 1, s);
|
|
1852
|
+
} else if (ce(i)) {
|
|
1853
|
+
const s = Ue.get(i.getName().toLowerCase());
|
|
1854
|
+
if (!s) return -1;
|
|
1855
|
+
const u = s(i, e, n);
|
|
1856
|
+
if (u === -1) return -1;
|
|
1857
|
+
r.splice(o, 1, u);
|
|
1858
|
+
} else o++;
|
|
1859
|
+
}
|
|
1860
|
+
if (o = 0, r.length === 1 && J(r[0])) return r[0];
|
|
1861
|
+
for (; o < r.length; ) {
|
|
1862
|
+
const i = r[o];
|
|
1863
|
+
if (!i || !g(i) && !J(i)) {
|
|
1864
|
+
o++;
|
|
1865
|
+
continue;
|
|
1866
|
+
}
|
|
1867
|
+
const s = r[o + 1];
|
|
1868
|
+
if (!s || !g(s)) {
|
|
1869
|
+
o++;
|
|
1870
|
+
continue;
|
|
1871
|
+
}
|
|
1872
|
+
const u = s.value;
|
|
1873
|
+
if (!Le(u) || u[4].value !== "*" && u[4].value !== "/") {
|
|
1874
|
+
o++;
|
|
1875
|
+
continue;
|
|
1876
|
+
}
|
|
1877
|
+
const c = r[o + 2];
|
|
1878
|
+
if (!c || !g(c) && !J(c)) return -1;
|
|
1879
|
+
u[4].value !== "*" ? u[4].value !== "/" ? o++ : r.splice(o, 3, { inputs: [i, c], operation: sn }) : r.splice(o, 3, { inputs: [i, c], operation: un });
|
|
1880
|
+
}
|
|
1881
|
+
if (o = 0, r.length === 1 && J(r[0])) return r[0];
|
|
1882
|
+
for (; o < r.length; ) {
|
|
1883
|
+
const i = r[o];
|
|
1884
|
+
if (!i || !g(i) && !J(i)) {
|
|
1885
|
+
o++;
|
|
1886
|
+
continue;
|
|
1887
|
+
}
|
|
1888
|
+
const s = r[o + 1];
|
|
1889
|
+
if (!s || !g(s)) {
|
|
1890
|
+
o++;
|
|
1891
|
+
continue;
|
|
1892
|
+
}
|
|
1893
|
+
const u = s.value;
|
|
1894
|
+
if (!Le(u) || u[4].value !== "+" && u[4].value !== "-") {
|
|
1895
|
+
o++;
|
|
1896
|
+
continue;
|
|
1897
|
+
}
|
|
1898
|
+
const c = r[o + 2];
|
|
1899
|
+
if (!c || !g(c) && !J(c)) return -1;
|
|
1900
|
+
u[4].value !== "+" ? u[4].value !== "-" ? o++ : r.splice(o, 3, { inputs: [i, c], operation: Bn }) : r.splice(o, 3, { inputs: [i, c], operation: an });
|
|
1901
|
+
}
|
|
1902
|
+
return r.length === 1 && J(r[0]) ? r[0] : -1;
|
|
1903
|
+
}
|
|
1904
|
+
function L(t, e, n, r) {
|
|
1905
|
+
const o = rt(t.value, e, n);
|
|
1906
|
+
return o === -1 ? -1 : r(t, o, n);
|
|
1907
|
+
}
|
|
1908
|
+
function rt(t, e, n) {
|
|
1909
|
+
const r = N(w(T(se([...t.filter((o) => !Q(o))], e)), e, n));
|
|
1910
|
+
return r === -1 ? -1 : r;
|
|
1911
|
+
}
|
|
1912
|
+
function ge(t, e, n, r) {
|
|
1913
|
+
const o = ot(t.value, e, n);
|
|
1914
|
+
if (o === -1) return -1;
|
|
1915
|
+
const [i, s] = o;
|
|
1916
|
+
return r(t, i, s, n);
|
|
1917
|
+
}
|
|
1918
|
+
function ot(t, e, n) {
|
|
1919
|
+
const r = se([...t.filter((c) => !Q(c))], e), o = [], i = [];
|
|
1920
|
+
{
|
|
1921
|
+
let c = o;
|
|
1922
|
+
for (let p = 0; p < r.length; p++) {
|
|
1923
|
+
const v = r[p];
|
|
1924
|
+
if (g(v) && Y(v.value)) {
|
|
1925
|
+
if (c === i) return -1;
|
|
1926
|
+
if (c === o) {
|
|
1927
|
+
c = i;
|
|
1928
|
+
continue;
|
|
1929
|
+
}
|
|
1930
|
+
return -1;
|
|
1931
|
+
}
|
|
1932
|
+
c.push(v);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
const s = N(w(T(o), e, n));
|
|
1936
|
+
if (s === -1) return -1;
|
|
1937
|
+
const u = N(w(T(i), e, n));
|
|
1938
|
+
return u === -1 ? -1 : [s, u];
|
|
1939
|
+
}
|
|
1940
|
+
function he(t, e, n, r, o) {
|
|
1941
|
+
const i = On(t.value, n, r);
|
|
1942
|
+
return i === -1 ? -1 : o(t, i, r);
|
|
1943
|
+
}
|
|
1944
|
+
function On(t, e, n) {
|
|
1945
|
+
const r = se([...t.filter((i) => !Q(i))], e), o = [];
|
|
1946
|
+
{
|
|
1947
|
+
const i = [];
|
|
1948
|
+
let s = [];
|
|
1949
|
+
for (let u = 0; u < r.length; u++) {
|
|
1950
|
+
const c = r[u];
|
|
1951
|
+
g(c) && Y(c.value) ? (i.push(s), s = []) : s.push(c);
|
|
1952
|
+
}
|
|
1953
|
+
i.push(s);
|
|
1954
|
+
for (let u = 0; u < i.length; u++) {
|
|
1955
|
+
if (i[u].length === 0) return -1;
|
|
1956
|
+
const c = N(w(T(i[u]), e, n));
|
|
1957
|
+
if (c === -1) return -1;
|
|
1958
|
+
o.push(c);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return o;
|
|
1962
|
+
}
|
|
1963
|
+
const Tn = /* @__PURE__ */ new Set(["nearest", "up", "down", "to-zero"]);
|
|
1964
|
+
function T(t) {
|
|
1965
|
+
return new F([a.Function, "calc(", -1, -1, { value: "calc" }], [a.CloseParen, ")", -1, -1, void 0], t);
|
|
1966
|
+
}
|
|
1967
|
+
function Rn(t, e) {
|
|
1968
|
+
return new F([a.Function, "max(", -1, -1, { value: "max" }], [a.CloseParen, ")", -1, -1, void 0], [t, new d([a.Comma, ",", -1, -1, void 0]), e]);
|
|
1969
|
+
}
|
|
1970
|
+
function Mn(t) {
|
|
1971
|
+
if (t === -1) return -1;
|
|
1972
|
+
if (ce(t)) return t;
|
|
1973
|
+
const e = t.value;
|
|
1974
|
+
return D(e) && Number.isNaN(e[4].value) ? h(e) ? new F([a.Function, "calc(", e[2], e[3], { value: "calc" }], [a.CloseParen, ")", e[2], e[3], void 0], [new d([a.Ident, "NaN", e[2], e[3], { value: "NaN" }])]) : k(e) ? new F([a.Function, "calc(", e[2], e[3], { value: "calc" }], [a.CloseParen, ")", e[2], e[3], void 0], [new d([a.Ident, "NaN", e[2], e[3], { value: "NaN" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Delim, "*", e[2], e[3], { value: "*" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Dimension, "1" + e[4].unit, e[2], e[3], { value: 1, type: l.Integer, unit: e[4].unit }])]) : A(e) ? new F([a.Function, "calc(", e[2], e[3], { value: "calc" }], [a.CloseParen, ")", e[2], e[3], void 0], [new d([a.Ident, "NaN", e[2], e[3], { value: "NaN" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Delim, "*", e[2], e[3], { value: "*" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Percentage, "1%", e[2], e[3], { value: 1 }])]) : -1 : t;
|
|
1975
|
+
}
|
|
1976
|
+
function Un(t) {
|
|
1977
|
+
if (t === -1) return -1;
|
|
1978
|
+
if (ce(t)) return t;
|
|
1979
|
+
const e = t.value;
|
|
1980
|
+
if (!D(e) || Number.isFinite(e[4].value) || Number.isNaN(e[4].value)) return t;
|
|
1981
|
+
let n = "";
|
|
1982
|
+
return Number.NEGATIVE_INFINITY === e[4].value && (n = "-"), h(e) ? new F([a.Function, "calc(", e[2], e[3], { value: "calc" }], [a.CloseParen, ")", e[2], e[3], void 0], [new d([a.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }])]) : k(e) ? new F([a.Function, "calc(", e[2], e[3], { value: "calc" }], [a.CloseParen, ")", e[2], e[3], void 0], [new d([a.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Delim, "*", e[2], e[3], { value: "*" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Dimension, "1" + e[4].unit, e[2], e[3], { value: 1, type: l.Integer, unit: e[4].unit }])]) : new F([a.Function, "calc(", e[2], e[3], { value: "calc" }], [a.CloseParen, ")", e[2], e[3], void 0], [new d([a.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Delim, "*", e[2], e[3], { value: "*" }]), new I([[a.Whitespace, " ", e[2], e[3], void 0]]), new d([a.Percentage, "1%", e[2], e[3], { value: 1 }])]);
|
|
1983
|
+
}
|
|
1984
|
+
function Wn(t) {
|
|
1985
|
+
if (t === -1) return -1;
|
|
1986
|
+
if (ce(t)) return t;
|
|
1987
|
+
const e = t.value;
|
|
1988
|
+
return D(e) && Object.is(-0, e[4].value) && (e[1] === "-0" || (A(e) ? e[1] = "-0%" : k(e) ? e[1] = "-0" + e[4].unit : e[1] = "-0")), t;
|
|
1989
|
+
}
|
|
1990
|
+
function Ln(t, e = 13) {
|
|
1991
|
+
if (t === -1) return -1;
|
|
1992
|
+
if (e <= 0 || ce(t)) return t;
|
|
1993
|
+
const n = t.value;
|
|
1994
|
+
if (!D(n) || Number.isInteger(n[4].value)) return t;
|
|
1995
|
+
const r = Number(n[4].value.toFixed(e)).toString();
|
|
1996
|
+
return h(n) ? n[1] = r : A(n) ? n[1] = r + "%" : k(n) && (n[1] = r + n[4].unit), t;
|
|
1997
|
+
}
|
|
1998
|
+
function qn(t, e) {
|
|
1999
|
+
let n = t;
|
|
2000
|
+
return n = Ln(n, e == null ? void 0 : e.precision), n = Wn(n), n = Mn(n), n = Un(n), n;
|
|
2001
|
+
}
|
|
2002
|
+
function $n(t) {
|
|
2003
|
+
return /* @__PURE__ */ new Map();
|
|
2004
|
+
}
|
|
2005
|
+
function zn(t, e) {
|
|
2006
|
+
return Vn($t(Ft({ css: t }), {}), e).map((n) => n.map((r) => W(...r.tokens())).join("")).join(",");
|
|
2007
|
+
}
|
|
2008
|
+
function Vn(t, e) {
|
|
2009
|
+
const n = $n();
|
|
2010
|
+
return Ht(t, (r) => {
|
|
2011
|
+
if (!ce(r)) return;
|
|
2012
|
+
const o = Ue.get(r.getName().toLowerCase());
|
|
2013
|
+
if (!o) return;
|
|
2014
|
+
const i = qn(N(o(r, n, {})), e);
|
|
2015
|
+
return i !== -1 ? i : void 0;
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
new Set(Ue.keys());
|
|
2019
|
+
const q = (t, e) => {
|
|
2020
|
+
const n = `${t || e}`, r = parseFloat(n);
|
|
2021
|
+
let o = "unsupported";
|
|
2022
|
+
const i = n.match(/px|rem|em/);
|
|
2023
|
+
return i && (o = i[0]), r === 0 && o === "unsupported" && (o = "zero"), { number: r, unit: o };
|
|
2024
|
+
}, ze = (t) => {
|
|
2025
|
+
const e = {};
|
|
2026
|
+
if (typeof t == "string")
|
|
2027
|
+
e.fontSize = q(t);
|
|
2028
|
+
else if (Array.isArray(t)) {
|
|
2029
|
+
if (e.fontSize = q(t[0]), typeof t[1] == "string")
|
|
2030
|
+
e.lineHeight = q(t[1]);
|
|
2031
|
+
else if (typeof t[1] == "object") {
|
|
2032
|
+
if ("lineHeight" in t[1]) {
|
|
2033
|
+
let n = t[1].lineHeight;
|
|
2034
|
+
typeof n == "string" && n.includes("calc") && (n = zn(n));
|
|
2035
|
+
const r = q(n);
|
|
2036
|
+
r.unit === "unsupported" ? e.lineHeight = {
|
|
2037
|
+
number: n * e.fontSize.number,
|
|
2038
|
+
unit: e.fontSize.unit
|
|
2039
|
+
} : e.lineHeight = r;
|
|
2040
|
+
}
|
|
2041
|
+
"letterSpacing" in t[1] && (e.letterSpacing = q(t[1].letterSpacing));
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
return e;
|
|
2045
|
+
}, Ve = (t, e, n, r = null) => t.number === e.number ? (le.error(
|
|
2046
|
+
`Same value for start an end${r ? ` (${r})` : ""}: "clamp-[${n}]".`
|
|
2047
|
+
), null) : t.unit !== e.unit && t.unit !== "zero" && e.unit !== "zero" ? (le.error(
|
|
2048
|
+
`Units need to match${r ? ` (${r})` : ""}: "clamp-[${n}]" ${t.unit} !== ${e.unit}.`
|
|
2049
|
+
), null) : t.unit === "unsupported" || e.unit === "unsupported" ? (le.error(
|
|
2050
|
+
`Only px, rem and em units are supported${r ? ` (${r})` : ""}: "clamp-[${n}]".`
|
|
2051
|
+
), null) : !0, He = (t, e, n = { number: 23.4375, unit: "rem" }, r = { number: 90, unit: "rem" }) => {
|
|
2052
|
+
const o = t.unit === "zero" ? e.unit : t.unit, i = o === "px";
|
|
2053
|
+
let s = t.number, u = e.number, c = !1, p = n.number, v = r.number;
|
|
2054
|
+
n.unit !== "px" && i && (p = n.number * 16), n.unit === "px" && !i && (p = n.number / 16), r.unit !== "px" && i && (v = r.number * 16), r.unit === "px" && !i && (v = r.number / 16), u < s && s < 0 && u < 0 ? (s = Math.abs(s), u = Math.abs(u), c = !0) : u < s && s > 0 && u > 0 ? (s = s * -1, u = u * -1, c = !0) : u < s && (s = Math.abs(s) * -1, u = Math.abs(u), c = !0);
|
|
2055
|
+
const f = (u - s) / (v - p), m = `${(s - p * f).toFixed(6)}${o} + ${(100 * f).toFixed(6)}vw`, C = `clamp(${s}${o}, ${m}, ${u}${o})`;
|
|
2056
|
+
return c ? `calc(${C} * -1)` : C;
|
|
2057
|
+
}, Hn = {
|
|
2058
|
+
minViewportWidth: "23.4375rem",
|
|
2059
|
+
maxViewportWidth: "90rem"
|
|
2060
|
+
}, Gn = st.withOptions(function(t = {}) {
|
|
2061
|
+
const e = { ...Hn, ...t };
|
|
2062
|
+
return function({ matchUtilities: n, theme: r, config: o }) {
|
|
2063
|
+
n(
|
|
397
2064
|
{
|
|
398
2065
|
clamp: (i) => {
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
e().theme.screens[n[4]] || n[4] || r.maxViewportWidth || w.maxViewportWidth
|
|
403
|
-
);
|
|
404
|
-
if (n.length < 3)
|
|
405
|
-
return y.error(
|
|
2066
|
+
const s = i.split(",");
|
|
2067
|
+
if (s.length < 3)
|
|
2068
|
+
return le.error(
|
|
406
2069
|
`The clamp utility requires at least 3 arguments: "clamp-[${i}]".`
|
|
407
2070
|
), {};
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
2071
|
+
const u = q(
|
|
2072
|
+
o().theme.screens[s[3]] || s[3],
|
|
2073
|
+
e.minViewportWidth
|
|
2074
|
+
), c = q(
|
|
2075
|
+
o().theme.screens[s[4]] || s[4],
|
|
2076
|
+
e.maxViewportWidth
|
|
2077
|
+
), p = ut(s[0]);
|
|
2078
|
+
if (!p)
|
|
2079
|
+
return le.error(
|
|
2080
|
+
`Property "${s[0]}" is not supported: "clamp-[${i}]".`
|
|
412
2081
|
), {};
|
|
413
|
-
const { key:
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
),
|
|
418
|
-
|
|
419
|
-
),
|
|
420
|
-
return Object.keys(
|
|
421
|
-
if (
|
|
422
|
-
if ((
|
|
423
|
-
|
|
424
|
-
else if (
|
|
425
|
-
const
|
|
426
|
-
|
|
2082
|
+
const { key: v, props: f, type: m } = p;
|
|
2083
|
+
if (m === "fontSize") {
|
|
2084
|
+
const P = ze(
|
|
2085
|
+
o().theme[v][s[1]] || s[1]
|
|
2086
|
+
), U = ze(
|
|
2087
|
+
o().theme[v][s[2]] || s[2]
|
|
2088
|
+
), X = {};
|
|
2089
|
+
return Object.keys(P).forEach((S) => {
|
|
2090
|
+
if (S in U) {
|
|
2091
|
+
if ((S === "letterSpacing" || S === "lineHeight") && P[S].number === U[S].number && P[S].unit === U[S].unit)
|
|
2092
|
+
X[S] = `${P[S].number}${P[S].unit}`;
|
|
2093
|
+
else if (Ve(P[S], U[S], i, S)) {
|
|
2094
|
+
const Fe = He(P[S], U[S], u, c);
|
|
2095
|
+
X[S] = Fe;
|
|
427
2096
|
}
|
|
428
2097
|
}
|
|
429
|
-
}), Object.keys(
|
|
2098
|
+
}), Object.keys(X).length > 0 ? X : {};
|
|
2099
|
+
}
|
|
2100
|
+
let C = q(o().theme[v][s[1]] || s[1]), b = q(o().theme[v][s[2]] || s[2]);
|
|
2101
|
+
if (m === "spacing") {
|
|
2102
|
+
const P = q(r("spacing.1")), U = s[1].startsWith("-"), X = s[2].startsWith("-"), S = U ? s[1].slice(1) : s[1], Fe = X ? s[2].slice(1) : s[2];
|
|
2103
|
+
C = {
|
|
2104
|
+
number: P.number * S,
|
|
2105
|
+
unit: P.unit
|
|
2106
|
+
}, b = {
|
|
2107
|
+
number: P.number * Fe,
|
|
2108
|
+
unit: P.unit
|
|
2109
|
+
};
|
|
430
2110
|
}
|
|
431
|
-
|
|
432
|
-
if (g && (k.number = k.number * -1), f && (x.number = x.number * -1), !B(k, x, i))
|
|
2111
|
+
if (!Ve(C, b, i))
|
|
433
2112
|
return {};
|
|
434
|
-
const
|
|
435
|
-
return
|
|
2113
|
+
const E = He(C, b, u, c);
|
|
2114
|
+
return f.reduce((P, U) => (typeof U == "string" ? P[U] = E : P = { ...P, ...U }, P), {});
|
|
436
2115
|
}
|
|
437
2116
|
},
|
|
438
|
-
{ values:
|
|
2117
|
+
{ values: r("clamp") }
|
|
439
2118
|
);
|
|
440
2119
|
};
|
|
441
2120
|
});
|
|
442
2121
|
export {
|
|
443
|
-
|
|
444
|
-
j as default
|
|
2122
|
+
Gn as default
|
|
445
2123
|
};
|
|
446
2124
|
//# sourceMappingURL=index.js.map
|