tailwind-clamp 4.0.4 → 4.0.6
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.html +249 -0
- package/README.md +23 -19
- package/dist/index.js +873 -738
- 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 +3 -2
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
var ut = Object.defineProperty;
|
|
2
|
+
var ct = (t, e, n) => e in t ? ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var E = (t, e, n) => ct(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
function Je(t, e) {
|
|
5
5
|
return { handler: t, config: e };
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
Je.withOptions = function(t, e = () => ({})) {
|
|
8
8
|
function n(r) {
|
|
9
9
|
return { handler: t(r), config: e(r) };
|
|
10
10
|
}
|
|
11
11
|
return n.__isOptionsFunction = !0, n;
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
const
|
|
13
|
+
var lt = Je;
|
|
14
|
+
const pt = (t) => {
|
|
15
15
|
switch (t) {
|
|
16
16
|
// Sizing & Spacing
|
|
17
17
|
case "p":
|
|
@@ -242,6 +242,108 @@ const ut = (t) => {
|
|
|
242
242
|
key: "scrollMargin",
|
|
243
243
|
props: ["scrollMargin"]
|
|
244
244
|
};
|
|
245
|
+
case "scroll-mx":
|
|
246
|
+
return {
|
|
247
|
+
type: "spacing",
|
|
248
|
+
key: "scrollMargin",
|
|
249
|
+
props: ["scrollMarginInline"]
|
|
250
|
+
};
|
|
251
|
+
case "scroll-my":
|
|
252
|
+
return {
|
|
253
|
+
type: "spacing",
|
|
254
|
+
key: "scrollMargin",
|
|
255
|
+
props: ["scrollMarginBlock"]
|
|
256
|
+
};
|
|
257
|
+
case "scroll-ms":
|
|
258
|
+
return {
|
|
259
|
+
type: "spacing",
|
|
260
|
+
key: "scrollMargin",
|
|
261
|
+
props: ["scrollMarginInlineStart"]
|
|
262
|
+
};
|
|
263
|
+
case "scroll-me":
|
|
264
|
+
return {
|
|
265
|
+
type: "spacing",
|
|
266
|
+
key: "scrollMargin",
|
|
267
|
+
props: ["scrollMarginInlineEnd"]
|
|
268
|
+
};
|
|
269
|
+
case "scroll-mt":
|
|
270
|
+
return {
|
|
271
|
+
type: "spacing",
|
|
272
|
+
key: "scrollMargin",
|
|
273
|
+
props: ["scrollMarginTop"]
|
|
274
|
+
};
|
|
275
|
+
case "scroll-mb":
|
|
276
|
+
return {
|
|
277
|
+
type: "spacing",
|
|
278
|
+
key: "scrollMargin",
|
|
279
|
+
props: ["scrollMarginBottom"]
|
|
280
|
+
};
|
|
281
|
+
case "scroll-ml":
|
|
282
|
+
return {
|
|
283
|
+
type: "spacing",
|
|
284
|
+
key: "scrollMargin",
|
|
285
|
+
props: ["scrollMarginLeft"]
|
|
286
|
+
};
|
|
287
|
+
case "scroll-mr":
|
|
288
|
+
return {
|
|
289
|
+
type: "spacing",
|
|
290
|
+
key: "scrollMargin",
|
|
291
|
+
props: ["scrollMarginRight"]
|
|
292
|
+
};
|
|
293
|
+
case "scroll-p":
|
|
294
|
+
return {
|
|
295
|
+
type: "spacing",
|
|
296
|
+
key: "scrollPadding",
|
|
297
|
+
props: ["scrollPadding"]
|
|
298
|
+
};
|
|
299
|
+
case "scroll-px":
|
|
300
|
+
return {
|
|
301
|
+
type: "spacing",
|
|
302
|
+
key: "scrollPadding",
|
|
303
|
+
props: ["scrollPaddingInline"]
|
|
304
|
+
};
|
|
305
|
+
case "scroll-py":
|
|
306
|
+
return {
|
|
307
|
+
type: "spacing",
|
|
308
|
+
key: "scrollPadding",
|
|
309
|
+
props: ["scrollPaddingBlock"]
|
|
310
|
+
};
|
|
311
|
+
case "scroll-ps":
|
|
312
|
+
return {
|
|
313
|
+
type: "spacing",
|
|
314
|
+
key: "scrollPadding",
|
|
315
|
+
props: ["scrollPaddingInlineStart"]
|
|
316
|
+
};
|
|
317
|
+
case "scroll-pe":
|
|
318
|
+
return {
|
|
319
|
+
type: "spacing",
|
|
320
|
+
key: "scrollPadding",
|
|
321
|
+
props: ["scrollPaddingInlineEnd"]
|
|
322
|
+
};
|
|
323
|
+
case "scroll-pt":
|
|
324
|
+
return {
|
|
325
|
+
type: "spacing",
|
|
326
|
+
key: "scrollPadding",
|
|
327
|
+
props: ["scrollPaddingTop"]
|
|
328
|
+
};
|
|
329
|
+
case "scroll-pb":
|
|
330
|
+
return {
|
|
331
|
+
type: "spacing",
|
|
332
|
+
key: "scrollPadding",
|
|
333
|
+
props: ["scrollPaddingBottom"]
|
|
334
|
+
};
|
|
335
|
+
case "scroll-pl":
|
|
336
|
+
return {
|
|
337
|
+
type: "spacing",
|
|
338
|
+
key: "scrollPadding",
|
|
339
|
+
props: ["scrollPaddingLeft"]
|
|
340
|
+
};
|
|
341
|
+
case "scroll-pr":
|
|
342
|
+
return {
|
|
343
|
+
type: "spacing",
|
|
344
|
+
key: "scrollPadding",
|
|
345
|
+
props: ["scrollPaddingRight"]
|
|
346
|
+
};
|
|
245
347
|
case "translate":
|
|
246
348
|
return {
|
|
247
349
|
type: "spacing",
|
|
@@ -444,7 +546,7 @@ const ut = (t) => {
|
|
|
444
546
|
default:
|
|
445
547
|
return null;
|
|
446
548
|
}
|
|
447
|
-
},
|
|
549
|
+
}, de = {
|
|
448
550
|
error() {
|
|
449
551
|
console.log("\x1B[31m", ...arguments, "\x1B[0m");
|
|
450
552
|
},
|
|
@@ -458,211 +560,211 @@ const ut = (t) => {
|
|
|
458
560
|
console.log("\x1B[90m", ...arguments, "\x1B[0m");
|
|
459
561
|
}
|
|
460
562
|
};
|
|
461
|
-
class
|
|
563
|
+
class be extends Error {
|
|
462
564
|
constructor(n, r, o, i) {
|
|
463
565
|
super(n);
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
566
|
+
E(this, "sourceStart");
|
|
567
|
+
E(this, "sourceEnd");
|
|
568
|
+
E(this, "parserState");
|
|
467
569
|
this.name = "ParseError", this.sourceStart = r, this.sourceEnd = o, this.parserState = i;
|
|
468
570
|
}
|
|
469
571
|
}
|
|
470
|
-
class
|
|
471
|
-
constructor(n, r, o, i,
|
|
572
|
+
class J extends be {
|
|
573
|
+
constructor(n, r, o, i, a) {
|
|
472
574
|
super(n, r, o, i);
|
|
473
|
-
|
|
474
|
-
this.token =
|
|
575
|
+
E(this, "token");
|
|
576
|
+
this.token = a;
|
|
475
577
|
}
|
|
476
578
|
}
|
|
477
|
-
const
|
|
579
|
+
const H = { 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
580
|
function W(...t) {
|
|
479
581
|
let e = "";
|
|
480
582
|
for (let n = 0; n < t.length; n++) e += t[n][1];
|
|
481
583
|
return e;
|
|
482
584
|
}
|
|
483
|
-
const
|
|
484
|
-
function
|
|
585
|
+
const ne = 13, B = 45, re = 10, oe = 43, te = 65533;
|
|
586
|
+
function dt(t) {
|
|
485
587
|
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
588
|
}
|
|
487
589
|
function R(t) {
|
|
488
590
|
return t >= 48 && t <= 57;
|
|
489
591
|
}
|
|
490
|
-
function
|
|
592
|
+
function ft(t) {
|
|
491
593
|
return t >= 65 && t <= 90;
|
|
492
594
|
}
|
|
493
|
-
function
|
|
595
|
+
function vt(t) {
|
|
494
596
|
return t >= 97 && t <= 122;
|
|
495
597
|
}
|
|
496
|
-
function
|
|
598
|
+
function Q(t) {
|
|
497
599
|
return t >= 48 && t <= 57 || t >= 97 && t <= 102 || t >= 65 && t <= 70;
|
|
498
600
|
}
|
|
499
|
-
function
|
|
500
|
-
return
|
|
601
|
+
function gt(t) {
|
|
602
|
+
return vt(t) || ft(t);
|
|
501
603
|
}
|
|
502
|
-
function
|
|
503
|
-
return
|
|
604
|
+
function ie(t) {
|
|
605
|
+
return gt(t) || mt(t) || t === 95;
|
|
504
606
|
}
|
|
505
|
-
function
|
|
506
|
-
return
|
|
607
|
+
function Me(t) {
|
|
608
|
+
return ie(t) || R(t) || t === B;
|
|
507
609
|
}
|
|
508
|
-
function
|
|
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 || !!
|
|
610
|
+
function mt(t) {
|
|
611
|
+
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 || !!se(t) || t >= 65536;
|
|
510
612
|
}
|
|
511
613
|
function Ee(t) {
|
|
512
|
-
return t ===
|
|
614
|
+
return t === re || t === ne || t === 12;
|
|
513
615
|
}
|
|
514
|
-
function
|
|
515
|
-
return t === 32 || t ===
|
|
616
|
+
function X(t) {
|
|
617
|
+
return t === 32 || t === re || t === 9 || t === ne || t === 12;
|
|
516
618
|
}
|
|
517
|
-
function
|
|
619
|
+
function se(t) {
|
|
518
620
|
return t >= 55296 && t <= 57343;
|
|
519
621
|
}
|
|
520
|
-
function
|
|
622
|
+
function le(t) {
|
|
521
623
|
return t.source.codePointAt(t.cursor) === 92 && !Ee(t.source.codePointAt(t.cursor + 1) ?? -1);
|
|
522
624
|
}
|
|
523
|
-
function
|
|
524
|
-
return e.source.codePointAt(e.cursor) === B ? e.source.codePointAt(e.cursor + 1) === B || !!
|
|
625
|
+
function Pe(t, e) {
|
|
626
|
+
return e.source.codePointAt(e.cursor) === B ? e.source.codePointAt(e.cursor + 1) === B || !!ie(e.source.codePointAt(e.cursor + 1) ?? -1) || e.source.codePointAt(e.cursor + 1) === 92 && !Ee(e.source.codePointAt(e.cursor + 2) ?? -1) : !!ie(e.source.codePointAt(e.cursor) ?? -1) || le(e);
|
|
525
627
|
}
|
|
526
|
-
function
|
|
527
|
-
return t.source.codePointAt(t.cursor) ===
|
|
628
|
+
function qe(t) {
|
|
629
|
+
return t.source.codePointAt(t.cursor) === oe || 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
630
|
}
|
|
529
|
-
function
|
|
631
|
+
function ht(t) {
|
|
530
632
|
return t.source.codePointAt(t.cursor) === 47 && t.source.codePointAt(t.cursor + 1) === 42;
|
|
531
633
|
}
|
|
532
|
-
function
|
|
634
|
+
function Ct(t) {
|
|
533
635
|
return t.source.codePointAt(t.cursor) === B && t.source.codePointAt(t.cursor + 1) === B && t.source.codePointAt(t.cursor + 2) === 62;
|
|
534
636
|
}
|
|
535
|
-
var
|
|
536
|
-
function
|
|
637
|
+
var s, l, ke;
|
|
638
|
+
function yt(t) {
|
|
537
639
|
switch (t) {
|
|
538
|
-
case
|
|
539
|
-
return
|
|
540
|
-
case
|
|
541
|
-
return
|
|
542
|
-
case
|
|
543
|
-
return
|
|
544
|
-
case
|
|
545
|
-
return
|
|
546
|
-
case
|
|
547
|
-
return
|
|
548
|
-
case
|
|
549
|
-
return
|
|
640
|
+
case s.OpenParen:
|
|
641
|
+
return s.CloseParen;
|
|
642
|
+
case s.CloseParen:
|
|
643
|
+
return s.OpenParen;
|
|
644
|
+
case s.OpenCurly:
|
|
645
|
+
return s.CloseCurly;
|
|
646
|
+
case s.CloseCurly:
|
|
647
|
+
return s.OpenCurly;
|
|
648
|
+
case s.OpenSquare:
|
|
649
|
+
return s.CloseSquare;
|
|
650
|
+
case s.CloseSquare:
|
|
651
|
+
return s.OpenSquare;
|
|
550
652
|
default:
|
|
551
653
|
return null;
|
|
552
654
|
}
|
|
553
655
|
}
|
|
554
|
-
function
|
|
656
|
+
function Et(t) {
|
|
555
657
|
switch (t[0]) {
|
|
556
|
-
case
|
|
557
|
-
return [
|
|
558
|
-
case
|
|
559
|
-
return [
|
|
560
|
-
case
|
|
561
|
-
return [
|
|
562
|
-
case
|
|
563
|
-
return [
|
|
564
|
-
case
|
|
565
|
-
return [
|
|
566
|
-
case
|
|
567
|
-
return [
|
|
658
|
+
case s.OpenParen:
|
|
659
|
+
return [s.CloseParen, ")", -1, -1, void 0];
|
|
660
|
+
case s.CloseParen:
|
|
661
|
+
return [s.OpenParen, "(", -1, -1, void 0];
|
|
662
|
+
case s.OpenCurly:
|
|
663
|
+
return [s.CloseCurly, "}", -1, -1, void 0];
|
|
664
|
+
case s.CloseCurly:
|
|
665
|
+
return [s.OpenCurly, "{", -1, -1, void 0];
|
|
666
|
+
case s.OpenSquare:
|
|
667
|
+
return [s.CloseSquare, "]", -1, -1, void 0];
|
|
668
|
+
case s.CloseSquare:
|
|
669
|
+
return [s.OpenSquare, "[", -1, -1, void 0];
|
|
568
670
|
default:
|
|
569
671
|
return null;
|
|
570
672
|
}
|
|
571
673
|
}
|
|
572
|
-
function
|
|
674
|
+
function Pt(t, e) {
|
|
573
675
|
for (e.advanceCodePoint(2); ; ) {
|
|
574
676
|
const n = e.readCodePoint();
|
|
575
677
|
if (n === void 0) {
|
|
576
|
-
const r = [
|
|
577
|
-
return t.onParseError(new
|
|
678
|
+
const r = [s.Comment, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
679
|
+
return t.onParseError(new J(H.UnexpectedEOFInComment, e.representationStart, e.representationEnd, ["4.3.2. Consume comments", "Unexpected EOF"], r)), r;
|
|
578
680
|
}
|
|
579
681
|
if (n === 42 && e.source.codePointAt(e.cursor) !== void 0 && e.source.codePointAt(e.cursor) === 47) {
|
|
580
682
|
e.advanceCodePoint();
|
|
581
683
|
break;
|
|
582
684
|
}
|
|
583
685
|
}
|
|
584
|
-
return [
|
|
686
|
+
return [s.Comment, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
585
687
|
}
|
|
586
|
-
function
|
|
688
|
+
function Se(t, e) {
|
|
587
689
|
const n = e.readCodePoint();
|
|
588
|
-
if (n === void 0) return t.onParseError(new
|
|
589
|
-
if (
|
|
690
|
+
if (n === void 0) return t.onParseError(new be(H.UnexpectedEOFInEscapedCodePoint, e.representationStart, e.representationEnd, ["4.3.7. Consume an escaped code point", "Unexpected EOF"])), te;
|
|
691
|
+
if (Q(n)) {
|
|
590
692
|
const r = [n];
|
|
591
693
|
let o;
|
|
592
|
-
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 &&
|
|
593
|
-
|
|
694
|
+
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && Q(o) && r.length < 6; ) r.push(o), e.advanceCodePoint();
|
|
695
|
+
X(e.source.codePointAt(e.cursor) ?? -1) && (e.source.codePointAt(e.cursor) === ne && e.source.codePointAt(e.cursor + 1) === re && e.advanceCodePoint(), e.advanceCodePoint());
|
|
594
696
|
const i = parseInt(String.fromCodePoint(...r), 16);
|
|
595
|
-
return i === 0 ||
|
|
697
|
+
return i === 0 || se(i) || i > 1114111 ? te : i;
|
|
596
698
|
}
|
|
597
|
-
return n === 0 ||
|
|
699
|
+
return n === 0 || se(n) ? te : n;
|
|
598
700
|
}
|
|
599
|
-
function
|
|
701
|
+
function Ae(t, e) {
|
|
600
702
|
const n = [];
|
|
601
703
|
for (; ; ) {
|
|
602
704
|
const r = e.source.codePointAt(e.cursor) ?? -1;
|
|
603
|
-
if (r === 0 ||
|
|
604
|
-
else if (
|
|
705
|
+
if (r === 0 || se(r)) n.push(te), e.advanceCodePoint(+(r > 65535) + 1);
|
|
706
|
+
else if (Me(r)) n.push(r), e.advanceCodePoint(+(r > 65535) + 1);
|
|
605
707
|
else {
|
|
606
|
-
if (!
|
|
607
|
-
e.advanceCodePoint(), n.push(
|
|
708
|
+
if (!le(e)) return n;
|
|
709
|
+
e.advanceCodePoint(), n.push(Se(t, e));
|
|
608
710
|
}
|
|
609
711
|
}
|
|
610
712
|
}
|
|
611
|
-
function
|
|
713
|
+
function kt(t, e) {
|
|
612
714
|
e.advanceCodePoint();
|
|
613
715
|
const n = e.source.codePointAt(e.cursor);
|
|
614
|
-
if (n !== void 0 && (
|
|
615
|
-
let r =
|
|
616
|
-
|
|
617
|
-
const o =
|
|
618
|
-
return [
|
|
716
|
+
if (n !== void 0 && (Me(n) || le(e))) {
|
|
717
|
+
let r = ke.Unrestricted;
|
|
718
|
+
Pe(0, e) && (r = ke.ID);
|
|
719
|
+
const o = Ae(t, e);
|
|
720
|
+
return [s.Hash, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...o), type: r }];
|
|
619
721
|
}
|
|
620
|
-
return [
|
|
722
|
+
return [s.Delim, "#", e.representationStart, e.representationEnd, { value: "#" }];
|
|
621
723
|
}
|
|
622
|
-
function
|
|
724
|
+
function bt(t, e) {
|
|
623
725
|
let n = l.Integer;
|
|
624
|
-
for (e.source.codePointAt(e.cursor) !==
|
|
726
|
+
for (e.source.codePointAt(e.cursor) !== oe && e.source.codePointAt(e.cursor) !== B || e.advanceCodePoint(); R(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
625
727
|
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
728
|
if (e.source.codePointAt(e.cursor) === 101 || e.source.codePointAt(e.cursor) === 69) {
|
|
627
729
|
if (R(e.source.codePointAt(e.cursor + 1) ?? -1)) e.advanceCodePoint(2);
|
|
628
730
|
else {
|
|
629
|
-
if (e.source.codePointAt(e.cursor + 1) !== B && e.source.codePointAt(e.cursor + 1) !==
|
|
731
|
+
if (e.source.codePointAt(e.cursor + 1) !== B && e.source.codePointAt(e.cursor + 1) !== oe || !R(e.source.codePointAt(e.cursor + 2) ?? -1)) return n;
|
|
630
732
|
e.advanceCodePoint(3);
|
|
631
733
|
}
|
|
632
734
|
for (n = l.Number; R(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
633
735
|
}
|
|
634
736
|
return n;
|
|
635
737
|
}
|
|
636
|
-
function
|
|
738
|
+
function Ne(t, e) {
|
|
637
739
|
let n;
|
|
638
740
|
{
|
|
639
741
|
const i = e.source.codePointAt(e.cursor);
|
|
640
|
-
i === B ? n = "-" : i ===
|
|
742
|
+
i === B ? n = "-" : i === oe && (n = "+");
|
|
641
743
|
}
|
|
642
|
-
const r =
|
|
643
|
-
if (
|
|
644
|
-
const i =
|
|
645
|
-
return [
|
|
744
|
+
const r = bt(0, e), o = parseFloat(e.source.slice(e.representationStart, e.representationEnd + 1));
|
|
745
|
+
if (Pe(0, e)) {
|
|
746
|
+
const i = Ae(t, e);
|
|
747
|
+
return [s.Dimension, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n, type: r, unit: String.fromCodePoint(...i) }];
|
|
646
748
|
}
|
|
647
|
-
return e.source.codePointAt(e.cursor) === 37 ? (e.advanceCodePoint(), [
|
|
749
|
+
return e.source.codePointAt(e.cursor) === 37 ? (e.advanceCodePoint(), [s.Percentage, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n }]) : [s.Number, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: o, signCharacter: n, type: r }];
|
|
648
750
|
}
|
|
649
|
-
function
|
|
650
|
-
for (;
|
|
651
|
-
return [
|
|
751
|
+
function St(t) {
|
|
752
|
+
for (; X(t.source.codePointAt(t.cursor) ?? -1); ) t.advanceCodePoint();
|
|
753
|
+
return [s.Whitespace, t.source.slice(t.representationStart, t.representationEnd + 1), t.representationStart, t.representationEnd, void 0];
|
|
652
754
|
}
|
|
653
755
|
(function(t) {
|
|
654
756
|
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
|
-
})(
|
|
757
|
+
})(s || (s = {})), function(t) {
|
|
656
758
|
t.Integer = "integer", t.Number = "number";
|
|
657
759
|
}(l || (l = {})), function(t) {
|
|
658
760
|
t.Unrestricted = "unrestricted", t.ID = "id";
|
|
659
|
-
}(
|
|
660
|
-
class
|
|
761
|
+
}(ke || (ke = {}));
|
|
762
|
+
class At {
|
|
661
763
|
constructor(e) {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
764
|
+
E(this, "cursor", 0);
|
|
765
|
+
E(this, "source", "");
|
|
766
|
+
E(this, "representationStart", 0);
|
|
767
|
+
E(this, "representationEnd", -1);
|
|
666
768
|
this.source = e;
|
|
667
769
|
}
|
|
668
770
|
advanceCodePoint(e = 1) {
|
|
@@ -679,310 +781,310 @@ class kt {
|
|
|
679
781
|
this.representationStart = this.cursor, this.representationEnd = -1;
|
|
680
782
|
}
|
|
681
783
|
}
|
|
682
|
-
function
|
|
784
|
+
function Dt(t, e) {
|
|
683
785
|
let n = "";
|
|
684
786
|
const r = e.readCodePoint();
|
|
685
787
|
for (; ; ) {
|
|
686
788
|
const o = e.readCodePoint();
|
|
687
789
|
if (o === void 0) {
|
|
688
|
-
const i = [
|
|
689
|
-
return t.onParseError(new
|
|
790
|
+
const i = [s.String, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
791
|
+
return t.onParseError(new J(H.UnexpectedEOFInString, e.representationStart, e.representationEnd, ["4.3.5. Consume a string token", "Unexpected EOF"], i)), i;
|
|
690
792
|
}
|
|
691
793
|
if (Ee(o)) {
|
|
692
794
|
e.unreadCodePoint();
|
|
693
|
-
const i = [
|
|
694
|
-
return t.onParseError(new
|
|
795
|
+
const i = [s.BadString, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
796
|
+
return t.onParseError(new J(H.UnexpectedNewLineInString, e.representationStart, e.source.codePointAt(e.cursor) === ne && e.source.codePointAt(e.cursor + 1) === re ? e.representationEnd + 2 : e.representationEnd + 1, ["4.3.5. Consume a string token", "Unexpected newline"], i)), i;
|
|
695
797
|
}
|
|
696
|
-
if (o === r) return [
|
|
697
|
-
if (o !== 92) o === 0 ||
|
|
798
|
+
if (o === r) return [s.String, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
799
|
+
if (o !== 92) o === 0 || se(o) ? n += String.fromCodePoint(te) : n += String.fromCodePoint(o);
|
|
698
800
|
else {
|
|
699
801
|
if (e.source.codePointAt(e.cursor) === void 0) continue;
|
|
700
802
|
if (Ee(e.source.codePointAt(e.cursor) ?? -1)) {
|
|
701
|
-
e.source.codePointAt(e.cursor) ===
|
|
803
|
+
e.source.codePointAt(e.cursor) === ne && e.source.codePointAt(e.cursor + 1) === re && e.advanceCodePoint(), e.advanceCodePoint();
|
|
702
804
|
continue;
|
|
703
805
|
}
|
|
704
|
-
n += String.fromCodePoint(
|
|
806
|
+
n += String.fromCodePoint(Se(t, e));
|
|
705
807
|
}
|
|
706
808
|
}
|
|
707
809
|
}
|
|
708
|
-
function
|
|
810
|
+
function Bt(t) {
|
|
709
811
|
return !(t.length !== 3 || t[0] !== 117 && t[0] !== 85 || t[1] !== 114 && t[1] !== 82 || t[2] !== 108 && t[2] !== 76);
|
|
710
812
|
}
|
|
711
|
-
function
|
|
813
|
+
function Ie(t, e) {
|
|
712
814
|
for (; ; ) {
|
|
713
815
|
const n = e.source.codePointAt(e.cursor);
|
|
714
816
|
if (n === void 0) return;
|
|
715
817
|
if (n === 41) return void e.advanceCodePoint();
|
|
716
|
-
|
|
818
|
+
le(e) ? (e.advanceCodePoint(), Se(t, e)) : e.advanceCodePoint();
|
|
717
819
|
}
|
|
718
820
|
}
|
|
719
|
-
function
|
|
720
|
-
for (;
|
|
821
|
+
function Ft(t, e) {
|
|
822
|
+
for (; X(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
721
823
|
let n = "";
|
|
722
824
|
for (; ; ) {
|
|
723
825
|
if (e.source.codePointAt(e.cursor) === void 0) {
|
|
724
|
-
const i = [
|
|
725
|
-
return t.onParseError(new
|
|
826
|
+
const i = [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
827
|
+
return t.onParseError(new J(H.UnexpectedEOFInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "Unexpected EOF"], i)), i;
|
|
726
828
|
}
|
|
727
|
-
if (e.source.codePointAt(e.cursor) === 41) return e.advanceCodePoint(), [
|
|
728
|
-
if (
|
|
729
|
-
for (e.advanceCodePoint();
|
|
829
|
+
if (e.source.codePointAt(e.cursor) === 41) return e.advanceCodePoint(), [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
830
|
+
if (X(e.source.codePointAt(e.cursor) ?? -1)) {
|
|
831
|
+
for (e.advanceCodePoint(); X(e.source.codePointAt(e.cursor) ?? -1); ) e.advanceCodePoint();
|
|
730
832
|
if (e.source.codePointAt(e.cursor) === void 0) {
|
|
731
|
-
const i = [
|
|
732
|
-
return t.onParseError(new
|
|
833
|
+
const i = [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }];
|
|
834
|
+
return t.onParseError(new J(H.UnexpectedEOFInURL, e.representationStart, e.representationEnd, ["4.3.6. Consume a url token", "Consume as much whitespace as possible", "Unexpected EOF"], i)), i;
|
|
733
835
|
}
|
|
734
|
-
return e.source.codePointAt(e.cursor) === 41 ? (e.advanceCodePoint(), [
|
|
836
|
+
return e.source.codePointAt(e.cursor) === 41 ? (e.advanceCodePoint(), [s.URL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: n }]) : (Ie(t, e), [s.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0]);
|
|
735
837
|
}
|
|
736
838
|
const o = e.source.codePointAt(e.cursor);
|
|
737
839
|
if (o === 34 || o === 39 || o === 40 || (r = o ?? -1) === 11 || r === 127 || 0 <= r && r <= 8 || 14 <= r && r <= 31) {
|
|
738
|
-
|
|
739
|
-
const i = [
|
|
740
|
-
return t.onParseError(new
|
|
840
|
+
Ie(t, e);
|
|
841
|
+
const i = [s.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
842
|
+
return t.onParseError(new J(H.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
843
|
}
|
|
742
844
|
if (o === 92) {
|
|
743
|
-
if (
|
|
744
|
-
e.advanceCodePoint(), n += String.fromCodePoint(
|
|
845
|
+
if (le(e)) {
|
|
846
|
+
e.advanceCodePoint(), n += String.fromCodePoint(Se(t, e));
|
|
745
847
|
continue;
|
|
746
848
|
}
|
|
747
|
-
|
|
748
|
-
const i = [
|
|
749
|
-
return t.onParseError(new
|
|
849
|
+
Ie(t, e);
|
|
850
|
+
const i = [s.BadURL, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, void 0];
|
|
851
|
+
return t.onParseError(new J(H.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
852
|
}
|
|
751
|
-
e.source.codePointAt(e.cursor) === 0 ||
|
|
853
|
+
e.source.codePointAt(e.cursor) === 0 || se(e.source.codePointAt(e.cursor) ?? -1) ? (n += String.fromCodePoint(te), e.advanceCodePoint()) : (n += e.source[e.cursor], e.advanceCodePoint());
|
|
752
854
|
}
|
|
753
855
|
var r;
|
|
754
856
|
}
|
|
755
|
-
function
|
|
756
|
-
const n =
|
|
757
|
-
if (e.source.codePointAt(e.cursor) !== 40) return [
|
|
758
|
-
if (
|
|
857
|
+
function xe(t, e) {
|
|
858
|
+
const n = Ae(t, e);
|
|
859
|
+
if (e.source.codePointAt(e.cursor) !== 40) return [s.Ident, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
860
|
+
if (Bt(n)) {
|
|
759
861
|
e.advanceCodePoint();
|
|
760
862
|
let r = 0;
|
|
761
863
|
for (; ; ) {
|
|
762
|
-
const o =
|
|
864
|
+
const o = X(e.source.codePointAt(e.cursor) ?? -1), i = X(e.source.codePointAt(e.cursor + 1) ?? -1);
|
|
763
865
|
if (o && i) {
|
|
764
866
|
r += 1, e.advanceCodePoint(1);
|
|
765
867
|
continue;
|
|
766
868
|
}
|
|
767
|
-
const
|
|
768
|
-
if (
|
|
869
|
+
const a = o ? e.source.codePointAt(e.cursor + 1) : e.source.codePointAt(e.cursor);
|
|
870
|
+
if (a === 34 || a === 39) return r > 0 && e.unreadCodePoint(r), [s.Function, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
769
871
|
break;
|
|
770
872
|
}
|
|
771
|
-
return
|
|
873
|
+
return Ft(t, e);
|
|
772
874
|
}
|
|
773
|
-
return e.advanceCodePoint(), [
|
|
875
|
+
return e.advanceCodePoint(), [s.Function, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { value: String.fromCodePoint(...n) }];
|
|
774
876
|
}
|
|
775
|
-
function
|
|
776
|
-
return !(t.source.codePointAt(t.cursor) !== 117 && t.source.codePointAt(t.cursor) !== 85 || t.source.codePointAt(t.cursor + 1) !==
|
|
877
|
+
function wt(t) {
|
|
878
|
+
return !(t.source.codePointAt(t.cursor) !== 117 && t.source.codePointAt(t.cursor) !== 85 || t.source.codePointAt(t.cursor + 1) !== oe || t.source.codePointAt(t.cursor + 2) !== 63 && !Q(t.source.codePointAt(t.cursor + 2) ?? -1));
|
|
777
879
|
}
|
|
778
|
-
function
|
|
880
|
+
function Nt(t, e) {
|
|
779
881
|
e.advanceCodePoint(2);
|
|
780
882
|
const n = [], r = [];
|
|
781
883
|
let o;
|
|
782
|
-
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && n.length < 6 &&
|
|
884
|
+
for (; (o = e.source.codePointAt(e.cursor)) !== void 0 && n.length < 6 && Q(o); ) n.push(o), e.advanceCodePoint();
|
|
783
885
|
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 &&
|
|
886
|
+
if (!r.length && e.source.codePointAt(e.cursor) === B && Q(e.source.codePointAt(e.cursor + 1) ?? -1)) for (e.advanceCodePoint(); (o = e.source.codePointAt(e.cursor)) !== void 0 && r.length < 6 && Q(o); ) r.push(o), e.advanceCodePoint();
|
|
785
887
|
if (!r.length) {
|
|
786
888
|
const u = parseInt(String.fromCodePoint(...n), 16);
|
|
787
|
-
return [
|
|
889
|
+
return [s.UnicodeRange, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { startOfRange: u, endOfRange: u }];
|
|
788
890
|
}
|
|
789
|
-
const i = parseInt(String.fromCodePoint(...n), 16),
|
|
790
|
-
return [
|
|
891
|
+
const i = parseInt(String.fromCodePoint(...n), 16), a = parseInt(String.fromCodePoint(...r), 16);
|
|
892
|
+
return [s.UnicodeRange, e.source.slice(e.representationStart, e.representationEnd + 1), e.representationStart, e.representationEnd, { startOfRange: i, endOfRange: a }];
|
|
791
893
|
}
|
|
792
|
-
function
|
|
793
|
-
const n =
|
|
894
|
+
function It(t, e) {
|
|
895
|
+
const n = xt(t), r = [];
|
|
794
896
|
for (; !n.endOfFile(); ) r.push(n.nextToken());
|
|
795
897
|
return r.push(n.nextToken()), r;
|
|
796
898
|
}
|
|
797
|
-
function
|
|
798
|
-
const n = t.css.valueOf(), r = t.unicodeRangesAllowed ?? !1, o = new
|
|
899
|
+
function xt(t, e) {
|
|
900
|
+
const n = t.css.valueOf(), r = t.unicodeRangesAllowed ?? !1, o = new At(n), i = { onParseError: Tt };
|
|
799
901
|
return { nextToken: function() {
|
|
800
902
|
o.resetRepresentation();
|
|
801
903
|
const u = o.source.codePointAt(o.cursor);
|
|
802
|
-
if (u === void 0) return [
|
|
803
|
-
if (u === 47 &&
|
|
804
|
-
if (r && (u === 117 || u === 85) &&
|
|
805
|
-
if (
|
|
806
|
-
if (R(u)) return
|
|
904
|
+
if (u === void 0) return [s.EOF, "", -1, -1, void 0];
|
|
905
|
+
if (u === 47 && ht(o)) return Pt(i, o);
|
|
906
|
+
if (r && (u === 117 || u === 85) && wt(o)) return Nt(0, o);
|
|
907
|
+
if (ie(u)) return xe(i, o);
|
|
908
|
+
if (R(u)) return Ne(i, o);
|
|
807
909
|
switch (u) {
|
|
808
910
|
case 44:
|
|
809
|
-
return o.advanceCodePoint(), [
|
|
911
|
+
return o.advanceCodePoint(), [s.Comma, ",", o.representationStart, o.representationEnd, void 0];
|
|
810
912
|
case 58:
|
|
811
|
-
return o.advanceCodePoint(), [
|
|
913
|
+
return o.advanceCodePoint(), [s.Colon, ":", o.representationStart, o.representationEnd, void 0];
|
|
812
914
|
case 59:
|
|
813
|
-
return o.advanceCodePoint(), [
|
|
915
|
+
return o.advanceCodePoint(), [s.Semicolon, ";", o.representationStart, o.representationEnd, void 0];
|
|
814
916
|
case 40:
|
|
815
|
-
return o.advanceCodePoint(), [
|
|
917
|
+
return o.advanceCodePoint(), [s.OpenParen, "(", o.representationStart, o.representationEnd, void 0];
|
|
816
918
|
case 41:
|
|
817
|
-
return o.advanceCodePoint(), [
|
|
919
|
+
return o.advanceCodePoint(), [s.CloseParen, ")", o.representationStart, o.representationEnd, void 0];
|
|
818
920
|
case 91:
|
|
819
|
-
return o.advanceCodePoint(), [
|
|
921
|
+
return o.advanceCodePoint(), [s.OpenSquare, "[", o.representationStart, o.representationEnd, void 0];
|
|
820
922
|
case 93:
|
|
821
|
-
return o.advanceCodePoint(), [
|
|
923
|
+
return o.advanceCodePoint(), [s.CloseSquare, "]", o.representationStart, o.representationEnd, void 0];
|
|
822
924
|
case 123:
|
|
823
|
-
return o.advanceCodePoint(), [
|
|
925
|
+
return o.advanceCodePoint(), [s.OpenCurly, "{", o.representationStart, o.representationEnd, void 0];
|
|
824
926
|
case 125:
|
|
825
|
-
return o.advanceCodePoint(), [
|
|
927
|
+
return o.advanceCodePoint(), [s.CloseCurly, "}", o.representationStart, o.representationEnd, void 0];
|
|
826
928
|
case 39:
|
|
827
929
|
case 34:
|
|
828
|
-
return
|
|
930
|
+
return Dt(i, o);
|
|
829
931
|
case 35:
|
|
830
|
-
return
|
|
831
|
-
case
|
|
932
|
+
return kt(i, o);
|
|
933
|
+
case oe:
|
|
832
934
|
case 46:
|
|
833
|
-
return
|
|
834
|
-
case
|
|
835
|
-
case
|
|
935
|
+
return qe(o) ? Ne(i, o) : (o.advanceCodePoint(), [s.Delim, o.source[o.representationStart], o.representationStart, o.representationEnd, { value: o.source[o.representationStart] }]);
|
|
936
|
+
case re:
|
|
937
|
+
case ne:
|
|
836
938
|
case 12:
|
|
837
939
|
case 9:
|
|
838
940
|
case 32:
|
|
839
|
-
return
|
|
941
|
+
return St(o);
|
|
840
942
|
case B:
|
|
841
|
-
return
|
|
943
|
+
return qe(o) ? Ne(i, o) : Ct(o) ? (o.advanceCodePoint(3), [s.CDC, "-->", o.representationStart, o.representationEnd, void 0]) : Pe(0, o) ? xe(i, o) : (o.advanceCodePoint(), [s.Delim, "-", o.representationStart, o.representationEnd, { value: "-" }]);
|
|
842
944
|
case 60:
|
|
843
|
-
return
|
|
945
|
+
return dt(o) ? (o.advanceCodePoint(4), [s.CDO, "<!--", o.representationStart, o.representationEnd, void 0]) : (o.advanceCodePoint(), [s.Delim, "<", o.representationStart, o.representationEnd, { value: "<" }]);
|
|
844
946
|
case 64:
|
|
845
|
-
if (o.advanceCodePoint(),
|
|
846
|
-
const c =
|
|
847
|
-
return [
|
|
947
|
+
if (o.advanceCodePoint(), Pe(0, o)) {
|
|
948
|
+
const c = Ae(i, o);
|
|
949
|
+
return [s.AtKeyword, o.source.slice(o.representationStart, o.representationEnd + 1), o.representationStart, o.representationEnd, { value: String.fromCodePoint(...c) }];
|
|
848
950
|
}
|
|
849
|
-
return [
|
|
951
|
+
return [s.Delim, "@", o.representationStart, o.representationEnd, { value: "@" }];
|
|
850
952
|
case 92: {
|
|
851
|
-
if (
|
|
953
|
+
if (le(o)) return xe(i, o);
|
|
852
954
|
o.advanceCodePoint();
|
|
853
|
-
const c = [
|
|
854
|
-
return i.onParseError(new
|
|
955
|
+
const c = [s.Delim, "\\", o.representationStart, o.representationEnd, { value: "\\" }];
|
|
956
|
+
return i.onParseError(new J(H.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
957
|
}
|
|
856
958
|
}
|
|
857
|
-
return o.advanceCodePoint(), [
|
|
959
|
+
return o.advanceCodePoint(), [s.Delim, o.source[o.representationStart], o.representationStart, o.representationEnd, { value: o.source[o.representationStart] }];
|
|
858
960
|
}, endOfFile: function() {
|
|
859
961
|
return o.source.codePointAt(o.cursor) === void 0;
|
|
860
962
|
} };
|
|
861
963
|
}
|
|
862
|
-
function
|
|
964
|
+
function Tt() {
|
|
863
965
|
}
|
|
864
|
-
function
|
|
966
|
+
function Ot(t, e) {
|
|
865
967
|
const n = [];
|
|
866
968
|
for (const u of e) n.push(u.codePointAt(0));
|
|
867
|
-
const r =
|
|
868
|
-
r[0] === 101 &&
|
|
869
|
-
const o = String.fromCodePoint(...r), i = t[4].signCharacter === "+" ? t[4].signCharacter : "",
|
|
870
|
-
t[1] = `${i}${
|
|
969
|
+
const r = Mt(n);
|
|
970
|
+
r[0] === 101 && ye(r, 0, r[0]);
|
|
971
|
+
const o = String.fromCodePoint(...r), i = t[4].signCharacter === "+" ? t[4].signCharacter : "", a = t[4].value.toString();
|
|
972
|
+
t[1] = `${i}${a}${o}`, t[4].unit = e;
|
|
871
973
|
}
|
|
872
|
-
function
|
|
974
|
+
function Mt(t) {
|
|
873
975
|
let e = 0;
|
|
874
|
-
t[0] === B && t[1] === B ? e = 2 : t[0] === B && t[1] ? (e = 2,
|
|
875
|
-
for (let n = e; n < t.length; n++)
|
|
976
|
+
t[0] === B && t[1] === B ? e = 2 : t[0] === B && t[1] ? (e = 2, ie(t[1]) || (e += ye(t, 1, t[1]))) : ie(t[0]) ? e = 1 : (e = 1, e += ye(t, 0, t[0]));
|
|
977
|
+
for (let n = e; n < t.length; n++) Me(t[n]) || (n += ye(t, n, t[n]));
|
|
876
978
|
return t;
|
|
877
979
|
}
|
|
878
|
-
function
|
|
980
|
+
function ye(t, e, n) {
|
|
879
981
|
const r = n.toString(16), o = [];
|
|
880
|
-
for (const
|
|
982
|
+
for (const a of r) o.push(a.codePointAt(0));
|
|
881
983
|
const i = t[e + 1];
|
|
882
|
-
return e === t.length - 1 || i &&
|
|
984
|
+
return e === t.length - 1 || i && Q(i) ? (t.splice(e, 1, 92, ...o, 32), 1 + o.length) : (t.splice(e, 1, 92, ...o), o.length);
|
|
883
985
|
}
|
|
884
|
-
const
|
|
885
|
-
function
|
|
886
|
-
return !!Array.isArray(t) && !(t.length < 4) && !!
|
|
986
|
+
const Rt = Object.values(s);
|
|
987
|
+
function Ye(t) {
|
|
988
|
+
return !!Array.isArray(t) && !(t.length < 4) && !!Rt.includes(t[0]) && typeof t[1] == "string" && typeof t[2] == "number" && typeof t[3] == "number";
|
|
887
989
|
}
|
|
888
990
|
function D(t) {
|
|
889
991
|
if (!t) return !1;
|
|
890
992
|
switch (t[0]) {
|
|
891
|
-
case
|
|
892
|
-
case
|
|
893
|
-
case
|
|
993
|
+
case s.Dimension:
|
|
994
|
+
case s.Number:
|
|
995
|
+
case s.Percentage:
|
|
894
996
|
return !0;
|
|
895
997
|
default:
|
|
896
998
|
return !1;
|
|
897
999
|
}
|
|
898
1000
|
}
|
|
899
|
-
function
|
|
1001
|
+
function Ze(t) {
|
|
900
1002
|
if (!t) return !1;
|
|
901
1003
|
switch (t[0]) {
|
|
902
|
-
case
|
|
903
|
-
case
|
|
1004
|
+
case s.Whitespace:
|
|
1005
|
+
case s.Comment:
|
|
904
1006
|
return !0;
|
|
905
1007
|
default:
|
|
906
1008
|
return !1;
|
|
907
1009
|
}
|
|
908
1010
|
}
|
|
909
|
-
function
|
|
910
|
-
return !!t && t[0] ===
|
|
1011
|
+
function K(t) {
|
|
1012
|
+
return !!t && t[0] === s.Comma;
|
|
911
1013
|
}
|
|
912
|
-
function
|
|
913
|
-
return !!t && t[0] ===
|
|
1014
|
+
function Ke(t) {
|
|
1015
|
+
return !!t && t[0] === s.Comment;
|
|
914
1016
|
}
|
|
915
|
-
function
|
|
916
|
-
return !!t && t[0] ===
|
|
1017
|
+
function $e(t) {
|
|
1018
|
+
return !!t && t[0] === s.Delim;
|
|
917
1019
|
}
|
|
918
1020
|
function k(t) {
|
|
919
|
-
return !!t && t[0] ===
|
|
1021
|
+
return !!t && t[0] === s.Dimension;
|
|
920
1022
|
}
|
|
921
|
-
function
|
|
922
|
-
return !!t && t[0] ===
|
|
1023
|
+
function Y(t) {
|
|
1024
|
+
return !!t && t[0] === s.EOF;
|
|
923
1025
|
}
|
|
924
|
-
function
|
|
925
|
-
return !!t && t[0] ===
|
|
1026
|
+
function Ut(t) {
|
|
1027
|
+
return !!t && t[0] === s.Function;
|
|
926
1028
|
}
|
|
927
|
-
function
|
|
928
|
-
return !!t && t[0] ===
|
|
1029
|
+
function fe(t) {
|
|
1030
|
+
return !!t && t[0] === s.Ident;
|
|
929
1031
|
}
|
|
930
1032
|
function h(t) {
|
|
931
|
-
return !!t && t[0] ===
|
|
1033
|
+
return !!t && t[0] === s.Number;
|
|
932
1034
|
}
|
|
933
|
-
function
|
|
934
|
-
return !!t && t[0] ===
|
|
1035
|
+
function S(t) {
|
|
1036
|
+
return !!t && t[0] === s.Percentage;
|
|
935
1037
|
}
|
|
936
|
-
function
|
|
937
|
-
return !!t && t[0] ===
|
|
1038
|
+
function Re(t) {
|
|
1039
|
+
return !!t && t[0] === s.Whitespace;
|
|
938
1040
|
}
|
|
939
|
-
function
|
|
940
|
-
return !!t && t[0] ===
|
|
1041
|
+
function Qe(t) {
|
|
1042
|
+
return !!t && t[0] === s.OpenParen;
|
|
941
1043
|
}
|
|
942
|
-
function
|
|
943
|
-
return !!t && t[0] ===
|
|
1044
|
+
function Wt(t) {
|
|
1045
|
+
return !!t && t[0] === s.CloseParen;
|
|
944
1046
|
}
|
|
945
|
-
function
|
|
946
|
-
return !!t && t[0] ===
|
|
1047
|
+
function Lt(t) {
|
|
1048
|
+
return !!t && t[0] === s.OpenSquare;
|
|
947
1049
|
}
|
|
948
|
-
function
|
|
949
|
-
return !!t && t[0] ===
|
|
1050
|
+
function qt(t) {
|
|
1051
|
+
return !!t && t[0] === s.OpenCurly;
|
|
950
1052
|
}
|
|
951
|
-
var
|
|
952
|
-
function
|
|
1053
|
+
var U;
|
|
1054
|
+
function Xe(t) {
|
|
953
1055
|
let e = t.slice();
|
|
954
1056
|
return (n, r, o) => {
|
|
955
1057
|
let i = -1;
|
|
956
|
-
for (let
|
|
1058
|
+
for (let a = e.indexOf(r); a < e.length && (i = n.indexOf(e[a]), i === -1 || i < o); a++) ;
|
|
957
1059
|
return i === -1 || i === o && r === n[o] && (i++, i >= n.length) ? -1 : (e = n.slice(), i);
|
|
958
1060
|
};
|
|
959
1061
|
}
|
|
960
|
-
function
|
|
1062
|
+
function Ue(t, e) {
|
|
961
1063
|
const n = e[0];
|
|
962
|
-
if (
|
|
963
|
-
const r =
|
|
1064
|
+
if (Qe(n) || qt(n) || Lt(n)) {
|
|
1065
|
+
const r = zt(t, e);
|
|
964
1066
|
return { advance: r.advance, node: r.node };
|
|
965
1067
|
}
|
|
966
|
-
if (
|
|
967
|
-
const r =
|
|
1068
|
+
if (Ut(n)) {
|
|
1069
|
+
const r = $t(t, e);
|
|
968
1070
|
return { advance: r.advance, node: r.node };
|
|
969
1071
|
}
|
|
970
|
-
if (
|
|
971
|
-
const r =
|
|
1072
|
+
if (Re(n)) {
|
|
1073
|
+
const r = et(t, e);
|
|
972
1074
|
return { advance: r.advance, node: r.node };
|
|
973
1075
|
}
|
|
974
|
-
if (
|
|
975
|
-
const r =
|
|
1076
|
+
if (Ke(n)) {
|
|
1077
|
+
const r = Vt(t, e);
|
|
976
1078
|
return { advance: r.advance, node: r.node };
|
|
977
1079
|
}
|
|
978
|
-
return { advance: 1, node: new
|
|
1080
|
+
return { advance: 1, node: new p(n) };
|
|
979
1081
|
}
|
|
980
1082
|
(function(t) {
|
|
981
1083
|
t.Function = "function", t.SimpleBlock = "simple-block", t.Whitespace = "whitespace", t.Comment = "comment", t.Token = "token";
|
|
982
|
-
})(
|
|
983
|
-
class
|
|
1084
|
+
})(U || (U = {}));
|
|
1085
|
+
class _e {
|
|
984
1086
|
constructor() {
|
|
985
|
-
|
|
1087
|
+
E(this, "value", []);
|
|
986
1088
|
}
|
|
987
1089
|
indexOf(e) {
|
|
988
1090
|
return this.value.indexOf(e);
|
|
@@ -992,12 +1094,12 @@ class Qe {
|
|
|
992
1094
|
}
|
|
993
1095
|
forEach(e, n) {
|
|
994
1096
|
if (this.value.length === 0) return;
|
|
995
|
-
const r =
|
|
1097
|
+
const r = Xe(this.value);
|
|
996
1098
|
let o = 0;
|
|
997
1099
|
for (; o < this.value.length; ) {
|
|
998
1100
|
const i = this.value[o];
|
|
999
|
-
let
|
|
1000
|
-
if (n && (
|
|
1101
|
+
let a;
|
|
1102
|
+
if (n && (a = { ...n }), e({ node: i, parent: this, state: a }, o) === !1) return !1;
|
|
1001
1103
|
if (o = r(this.value, i, o), o === -1) break;
|
|
1002
1104
|
}
|
|
1003
1105
|
}
|
|
@@ -1005,25 +1107,25 @@ class Qe {
|
|
|
1005
1107
|
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
1108
|
}
|
|
1007
1109
|
}
|
|
1008
|
-
class F extends
|
|
1110
|
+
class F extends _e {
|
|
1009
1111
|
constructor(n, r, o) {
|
|
1010
1112
|
super();
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1113
|
+
E(this, "type", U.Function);
|
|
1114
|
+
E(this, "name");
|
|
1115
|
+
E(this, "endToken");
|
|
1014
1116
|
this.name = n, this.endToken = r, this.value = o;
|
|
1015
1117
|
}
|
|
1016
1118
|
getName() {
|
|
1017
1119
|
return this.name[4].value;
|
|
1018
1120
|
}
|
|
1019
1121
|
normalize() {
|
|
1020
|
-
|
|
1122
|
+
Y(this.endToken) && (this.endToken = [s.CloseParen, ")", -1, -1, void 0]);
|
|
1021
1123
|
}
|
|
1022
1124
|
tokens() {
|
|
1023
|
-
return
|
|
1125
|
+
return Y(this.endToken) ? [this.name, ...this.value.flatMap((n) => n.tokens())] : [this.name, ...this.value.flatMap((n) => n.tokens()), this.endToken];
|
|
1024
1126
|
}
|
|
1025
1127
|
toString() {
|
|
1026
|
-
const n = this.value.map((r) =>
|
|
1128
|
+
const n = this.value.map((r) => Ye(r) ? W(r) : r.toString()).join("");
|
|
1027
1129
|
return W(this.name) + n + W(this.endToken);
|
|
1028
1130
|
}
|
|
1029
1131
|
toJSON() {
|
|
@@ -1033,78 +1135,78 @@ class F extends Qe {
|
|
|
1033
1135
|
return F.isFunctionNode(this);
|
|
1034
1136
|
}
|
|
1035
1137
|
static isFunctionNode(n) {
|
|
1036
|
-
return !!n && n instanceof F && n.type ===
|
|
1138
|
+
return !!n && n instanceof F && n.type === U.Function;
|
|
1037
1139
|
}
|
|
1038
1140
|
}
|
|
1039
|
-
function
|
|
1141
|
+
function $t(t, e) {
|
|
1040
1142
|
const n = [];
|
|
1041
1143
|
let r = 1;
|
|
1042
1144
|
for (; ; ) {
|
|
1043
1145
|
const o = e[r];
|
|
1044
|
-
if (!o ||
|
|
1045
|
-
if (
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1048
|
-
r +=
|
|
1146
|
+
if (!o || Y(o)) return t.onParseError(new be("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) };
|
|
1147
|
+
if (Wt(o)) return { advance: r + 1, node: new F(e[0], o, n) };
|
|
1148
|
+
if (Ze(o)) {
|
|
1149
|
+
const a = tt(t, e.slice(r));
|
|
1150
|
+
r += a.advance, n.push(...a.nodes);
|
|
1049
1151
|
continue;
|
|
1050
1152
|
}
|
|
1051
|
-
const i =
|
|
1153
|
+
const i = Ue(t, e.slice(r));
|
|
1052
1154
|
r += i.advance, n.push(i.node);
|
|
1053
1155
|
}
|
|
1054
1156
|
}
|
|
1055
|
-
class
|
|
1157
|
+
class ae extends _e {
|
|
1056
1158
|
constructor(n, r, o) {
|
|
1057
1159
|
super();
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1160
|
+
E(this, "type", U.SimpleBlock);
|
|
1161
|
+
E(this, "startToken");
|
|
1162
|
+
E(this, "endToken");
|
|
1061
1163
|
this.startToken = n, this.endToken = r, this.value = o;
|
|
1062
1164
|
}
|
|
1063
1165
|
normalize() {
|
|
1064
|
-
if (
|
|
1065
|
-
const n =
|
|
1166
|
+
if (Y(this.endToken)) {
|
|
1167
|
+
const n = Et(this.startToken);
|
|
1066
1168
|
n && (this.endToken = n);
|
|
1067
1169
|
}
|
|
1068
1170
|
}
|
|
1069
1171
|
tokens() {
|
|
1070
|
-
return
|
|
1172
|
+
return Y(this.endToken) ? [this.startToken, ...this.value.flatMap((n) => n.tokens())] : [this.startToken, ...this.value.flatMap((n) => n.tokens()), this.endToken];
|
|
1071
1173
|
}
|
|
1072
1174
|
toString() {
|
|
1073
|
-
const n = this.value.map((r) =>
|
|
1175
|
+
const n = this.value.map((r) => Ye(r) ? W(r) : r.toString()).join("");
|
|
1074
1176
|
return W(this.startToken) + n + W(this.endToken);
|
|
1075
1177
|
}
|
|
1076
1178
|
toJSON() {
|
|
1077
1179
|
return { type: this.type, startToken: this.startToken, tokens: this.tokens(), value: this.value.map((n) => n.toJSON()) };
|
|
1078
1180
|
}
|
|
1079
1181
|
isSimpleBlockNode() {
|
|
1080
|
-
return
|
|
1182
|
+
return ae.isSimpleBlockNode(this);
|
|
1081
1183
|
}
|
|
1082
1184
|
static isSimpleBlockNode(n) {
|
|
1083
|
-
return !!n && n instanceof
|
|
1185
|
+
return !!n && n instanceof ae && n.type === U.SimpleBlock;
|
|
1084
1186
|
}
|
|
1085
1187
|
}
|
|
1086
|
-
function
|
|
1087
|
-
const n =
|
|
1188
|
+
function zt(t, e) {
|
|
1189
|
+
const n = yt(e[0][0]);
|
|
1088
1190
|
if (!n) throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");
|
|
1089
1191
|
const r = [];
|
|
1090
1192
|
let o = 1;
|
|
1091
1193
|
for (; ; ) {
|
|
1092
1194
|
const i = e[o];
|
|
1093
|
-
if (!i ||
|
|
1094
|
-
if (i[0] === n) return { advance: o + 1, node: new
|
|
1095
|
-
if (
|
|
1096
|
-
const u =
|
|
1195
|
+
if (!i || Y(i)) return t.onParseError(new be("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 ae(e[0], i, r) };
|
|
1196
|
+
if (i[0] === n) return { advance: o + 1, node: new ae(e[0], i, r) };
|
|
1197
|
+
if (Ze(i)) {
|
|
1198
|
+
const u = tt(t, e.slice(o));
|
|
1097
1199
|
o += u.advance, r.push(...u.nodes);
|
|
1098
1200
|
continue;
|
|
1099
1201
|
}
|
|
1100
|
-
const
|
|
1101
|
-
o +=
|
|
1202
|
+
const a = Ue(t, e.slice(o));
|
|
1203
|
+
o += a.advance, r.push(a.node);
|
|
1102
1204
|
}
|
|
1103
1205
|
}
|
|
1104
1206
|
class I {
|
|
1105
1207
|
constructor(e) {
|
|
1106
|
-
|
|
1107
|
-
|
|
1208
|
+
E(this, "type", U.Whitespace);
|
|
1209
|
+
E(this, "value");
|
|
1108
1210
|
this.value = e;
|
|
1109
1211
|
}
|
|
1110
1212
|
tokens() {
|
|
@@ -1120,21 +1222,21 @@ class I {
|
|
|
1120
1222
|
return I.isWhitespaceNode(this);
|
|
1121
1223
|
}
|
|
1122
1224
|
static isWhitespaceNode(e) {
|
|
1123
|
-
return !!e && e instanceof I && e.type ===
|
|
1225
|
+
return !!e && e instanceof I && e.type === U.Whitespace;
|
|
1124
1226
|
}
|
|
1125
1227
|
}
|
|
1126
|
-
function
|
|
1228
|
+
function et(t, e) {
|
|
1127
1229
|
let n = 0;
|
|
1128
1230
|
for (; ; ) {
|
|
1129
1231
|
const r = e[n];
|
|
1130
|
-
if (!
|
|
1232
|
+
if (!Re(r)) return { advance: n, node: new I(e.slice(0, n)) };
|
|
1131
1233
|
n++;
|
|
1132
1234
|
}
|
|
1133
1235
|
}
|
|
1134
|
-
class
|
|
1236
|
+
class ue {
|
|
1135
1237
|
constructor(e) {
|
|
1136
|
-
|
|
1137
|
-
|
|
1238
|
+
E(this, "type", U.Comment);
|
|
1239
|
+
E(this, "value");
|
|
1138
1240
|
this.value = e;
|
|
1139
1241
|
}
|
|
1140
1242
|
tokens() {
|
|
@@ -1147,30 +1249,30 @@ class ae {
|
|
|
1147
1249
|
return { type: this.type, tokens: this.tokens() };
|
|
1148
1250
|
}
|
|
1149
1251
|
isCommentNode() {
|
|
1150
|
-
return
|
|
1252
|
+
return ue.isCommentNode(this);
|
|
1151
1253
|
}
|
|
1152
1254
|
static isCommentNode(e) {
|
|
1153
|
-
return !!e && e instanceof
|
|
1255
|
+
return !!e && e instanceof ue && e.type === U.Comment;
|
|
1154
1256
|
}
|
|
1155
1257
|
}
|
|
1156
|
-
function
|
|
1157
|
-
return { advance: 1, node: new
|
|
1258
|
+
function Vt(t, e) {
|
|
1259
|
+
return { advance: 1, node: new ue(e[0]) };
|
|
1158
1260
|
}
|
|
1159
|
-
function
|
|
1261
|
+
function tt(t, e) {
|
|
1160
1262
|
const n = [];
|
|
1161
1263
|
let r = 0;
|
|
1162
|
-
for (; ; ) if (
|
|
1163
|
-
const o =
|
|
1264
|
+
for (; ; ) if (Re(e[r])) {
|
|
1265
|
+
const o = et(0, e.slice(r));
|
|
1164
1266
|
r += o.advance, n.push(o.node);
|
|
1165
1267
|
} else {
|
|
1166
|
-
if (!
|
|
1167
|
-
n.push(new
|
|
1268
|
+
if (!Ke(e[r])) return { advance: r, nodes: n };
|
|
1269
|
+
n.push(new ue(e[r])), r++;
|
|
1168
1270
|
}
|
|
1169
1271
|
}
|
|
1170
|
-
class
|
|
1272
|
+
class p {
|
|
1171
1273
|
constructor(e) {
|
|
1172
|
-
|
|
1173
|
-
|
|
1274
|
+
E(this, "type", U.Token);
|
|
1275
|
+
E(this, "value");
|
|
1174
1276
|
this.value = e;
|
|
1175
1277
|
}
|
|
1176
1278
|
tokens() {
|
|
@@ -1183,32 +1285,32 @@ class d {
|
|
|
1183
1285
|
return { type: this.type, tokens: this.tokens() };
|
|
1184
1286
|
}
|
|
1185
1287
|
isTokenNode() {
|
|
1186
|
-
return
|
|
1288
|
+
return p.isTokenNode(this);
|
|
1187
1289
|
}
|
|
1188
1290
|
static isTokenNode(e) {
|
|
1189
|
-
return !!e && e instanceof
|
|
1291
|
+
return !!e && e instanceof p && e.type === U.Token;
|
|
1190
1292
|
}
|
|
1191
1293
|
}
|
|
1192
|
-
function
|
|
1294
|
+
function Ht(t, e) {
|
|
1193
1295
|
const n = { onParseError: (e == null ? void 0 : e.onParseError) ?? (() => {
|
|
1194
1296
|
}) }, r = [...t];
|
|
1195
1297
|
if (t.length === 0) return [];
|
|
1196
|
-
|
|
1298
|
+
Y(r[r.length - 1]) && r.push([s.EOF, "", r[r.length - 1][2], r[r.length - 1][3], void 0]);
|
|
1197
1299
|
const o = [];
|
|
1198
|
-
let i = [],
|
|
1300
|
+
let i = [], a = 0;
|
|
1199
1301
|
for (; ; ) {
|
|
1200
|
-
if (!r[
|
|
1201
|
-
if (
|
|
1202
|
-
o.push(i), i = [],
|
|
1302
|
+
if (!r[a] || Y(r[a])) return i.length && o.push(i), o;
|
|
1303
|
+
if (K(r[a])) {
|
|
1304
|
+
o.push(i), i = [], a++;
|
|
1203
1305
|
continue;
|
|
1204
1306
|
}
|
|
1205
|
-
const u =
|
|
1206
|
-
i.push(u.node),
|
|
1307
|
+
const u = Ue(n, t.slice(a));
|
|
1308
|
+
i.push(u.node), a += u.advance;
|
|
1207
1309
|
}
|
|
1208
1310
|
}
|
|
1209
|
-
function
|
|
1311
|
+
function jt(t, e, n) {
|
|
1210
1312
|
if (t.length === 0) return;
|
|
1211
|
-
const r =
|
|
1313
|
+
const r = Xe(t);
|
|
1212
1314
|
let o = 0;
|
|
1213
1315
|
for (; o < t.length; ) {
|
|
1214
1316
|
const i = t[o];
|
|
@@ -1216,88 +1318,88 @@ function zt(t, e, n) {
|
|
|
1216
1318
|
if (o = r(t, i, o), o === -1) break;
|
|
1217
1319
|
}
|
|
1218
1320
|
}
|
|
1219
|
-
function
|
|
1220
|
-
t.length !== 0 &&
|
|
1321
|
+
function Gt(t, e, n) {
|
|
1322
|
+
t.length !== 0 && jt(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
1323
|
}
|
|
1222
|
-
function
|
|
1324
|
+
function Jt(t, e) {
|
|
1223
1325
|
for (let n = 0; n < t.length; n++)
|
|
1224
|
-
|
|
1326
|
+
Gt(t[n], (r, o) => {
|
|
1225
1327
|
if (typeof o != "number") return;
|
|
1226
1328
|
const i = e(r.node);
|
|
1227
1329
|
i && (Array.isArray(i) ? r.parent.value.splice(o, 1, ...i) : r.parent.value.splice(o, 1, i));
|
|
1228
1330
|
});
|
|
1229
1331
|
return t;
|
|
1230
1332
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1333
|
+
function Yt(t) {
|
|
1334
|
+
return ae.isSimpleBlockNode(t);
|
|
1233
1335
|
}
|
|
1234
|
-
function
|
|
1336
|
+
function pe(t) {
|
|
1235
1337
|
return F.isFunctionNode(t);
|
|
1236
1338
|
}
|
|
1237
|
-
function
|
|
1339
|
+
function nt(t) {
|
|
1238
1340
|
return I.isWhitespaceNode(t);
|
|
1239
1341
|
}
|
|
1240
|
-
function
|
|
1241
|
-
return
|
|
1342
|
+
function rt(t) {
|
|
1343
|
+
return ue.isCommentNode(t);
|
|
1242
1344
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return
|
|
1345
|
+
function _(t) {
|
|
1346
|
+
return nt(t) || rt(t);
|
|
1245
1347
|
}
|
|
1246
|
-
function
|
|
1247
|
-
return
|
|
1348
|
+
function m(t) {
|
|
1349
|
+
return p.isTokenNode(t);
|
|
1248
1350
|
}
|
|
1249
|
-
const
|
|
1351
|
+
const Zt = /[A-Z]/g;
|
|
1250
1352
|
function x(t) {
|
|
1251
|
-
return t.replace(
|
|
1353
|
+
return t.replace(Zt, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
|
|
1252
1354
|
}
|
|
1253
|
-
const
|
|
1254
|
-
function
|
|
1355
|
+
const Kt = /* @__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]]), De = /* @__PURE__ */ new Map([["deg", (t) => t], ["grad", (t) => t / 0.9], ["rad", (t) => t / 180 * Math.PI], ["turn", (t) => t / 360]]), ve = /* @__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]]), Qt = /* @__PURE__ */ new Map([["hz", (t) => t], ["khz", (t) => t / 1e3]]), Xt = /* @__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]]), _t = /* @__PURE__ */ new Map([["hz", (t) => 1e3 * t], ["khz", (t) => t]]), en = /* @__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]]), tn = /* @__PURE__ */ new Map([["ms", (t) => t], ["s", (t) => t / 1e3]]), nn = /* @__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]]), rn = /* @__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]]), on = /* @__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]]), sn = /* @__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]]), ot = /* @__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]]), an = /* @__PURE__ */ new Map([["ms", (t) => 1e3 * t], ["s", (t) => t]]), ge = /* @__PURE__ */ new Map([["deg", (t) => 360 * t], ["grad", (t) => 360 * t / 0.9], ["rad", (t) => 360 * t / 180 * Math.PI], ["turn", (t) => t]]), un = /* @__PURE__ */ new Map([["cm", Kt], ["mm", en], ["q", sn], ["in", Xt], ["pc", nn], ["pt", rn], ["px", on], ["ms", tn], ["s", an], ["deg", De], ["grad", ve], ["rad", ot], ["turn", ge], ["hz", Qt], ["khz", _t]]);
|
|
1356
|
+
function T(t, e) {
|
|
1255
1357
|
if (!k(t) || !k(e)) return e;
|
|
1256
1358
|
const n = x(t[4].unit), r = x(e[4].unit);
|
|
1257
1359
|
if (n === r) return e;
|
|
1258
|
-
const o =
|
|
1360
|
+
const o = un.get(r);
|
|
1259
1361
|
if (!o) return e;
|
|
1260
1362
|
const i = o.get(n);
|
|
1261
1363
|
if (!i) return e;
|
|
1262
|
-
const
|
|
1263
|
-
return
|
|
1364
|
+
const a = i(e[4].value), u = [s.Dimension, "", e[2], e[3], { ...e[4], signCharacter: a < 0 ? "-" : void 0, type: Number.isInteger(a) ? l.Integer : l.Number, value: a }];
|
|
1365
|
+
return Ot(u, t[4].unit), u;
|
|
1264
1366
|
}
|
|
1265
|
-
function
|
|
1367
|
+
function cn(t) {
|
|
1266
1368
|
if (t.length !== 2) return -1;
|
|
1267
1369
|
const e = t[0].value;
|
|
1268
1370
|
let n = t[1].value;
|
|
1269
1371
|
if (h(e) && h(n)) {
|
|
1270
1372
|
const r = e[4].value + n[4].value;
|
|
1271
|
-
return new
|
|
1373
|
+
return new p([s.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
1374
|
}
|
|
1273
|
-
if (
|
|
1375
|
+
if (S(e) && S(n)) {
|
|
1274
1376
|
const r = e[4].value + n[4].value;
|
|
1275
|
-
return new
|
|
1377
|
+
return new p([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1276
1378
|
}
|
|
1277
|
-
if (k(e) && k(n) && (n =
|
|
1379
|
+
if (k(e) && k(n) && (n = T(e, n), x(e[4].unit) === x(n[4].unit))) {
|
|
1278
1380
|
const r = e[4].value + n[4].value;
|
|
1279
|
-
return new
|
|
1381
|
+
return new p([s.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
1382
|
}
|
|
1281
1383
|
return -1;
|
|
1282
1384
|
}
|
|
1283
|
-
function
|
|
1385
|
+
function ln(t) {
|
|
1284
1386
|
if (t.length !== 2) return -1;
|
|
1285
1387
|
const e = t[0].value, n = t[1].value;
|
|
1286
1388
|
if (h(e) && h(n)) {
|
|
1287
1389
|
const r = e[4].value / n[4].value;
|
|
1288
|
-
return new
|
|
1390
|
+
return new p([s.Number, r.toString(), e[2], n[3], { value: r, type: Number.isInteger(r) ? l.Integer : l.Number }]);
|
|
1289
1391
|
}
|
|
1290
|
-
if (
|
|
1392
|
+
if (S(e) && h(n)) {
|
|
1291
1393
|
const r = e[4].value / n[4].value;
|
|
1292
|
-
return new
|
|
1394
|
+
return new p([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1293
1395
|
}
|
|
1294
1396
|
if (k(e) && h(n)) {
|
|
1295
1397
|
const r = e[4].value / n[4].value;
|
|
1296
|
-
return new
|
|
1398
|
+
return new p([s.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
1399
|
}
|
|
1298
1400
|
return -1;
|
|
1299
1401
|
}
|
|
1300
|
-
function
|
|
1402
|
+
function Z(t) {
|
|
1301
1403
|
return !!t && typeof t == "object" && "inputs" in t && Array.isArray(t.inputs) && "operation" in t;
|
|
1302
1404
|
}
|
|
1303
1405
|
function N(t) {
|
|
@@ -1305,7 +1407,7 @@ function N(t) {
|
|
|
1305
1407
|
const e = [];
|
|
1306
1408
|
for (let n = 0; n < t.inputs.length; n++) {
|
|
1307
1409
|
const r = t.inputs[n];
|
|
1308
|
-
if (
|
|
1410
|
+
if (m(r)) {
|
|
1309
1411
|
e.push(r);
|
|
1310
1412
|
continue;
|
|
1311
1413
|
}
|
|
@@ -1315,99 +1417,99 @@ function N(t) {
|
|
|
1315
1417
|
}
|
|
1316
1418
|
return t.operation(e);
|
|
1317
1419
|
}
|
|
1318
|
-
function
|
|
1420
|
+
function pn(t) {
|
|
1319
1421
|
if (t.length !== 2) return -1;
|
|
1320
1422
|
const e = t[0].value, n = t[1].value;
|
|
1321
1423
|
if (h(e) && h(n)) {
|
|
1322
1424
|
const r = e[4].value * n[4].value;
|
|
1323
|
-
return new
|
|
1425
|
+
return new p([s.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
1426
|
}
|
|
1325
|
-
if (
|
|
1427
|
+
if (S(e) && h(n)) {
|
|
1326
1428
|
const r = e[4].value * n[4].value;
|
|
1327
|
-
return new
|
|
1429
|
+
return new p([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1328
1430
|
}
|
|
1329
|
-
if (h(e) &&
|
|
1431
|
+
if (h(e) && S(n)) {
|
|
1330
1432
|
const r = e[4].value * n[4].value;
|
|
1331
|
-
return new
|
|
1433
|
+
return new p([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1332
1434
|
}
|
|
1333
1435
|
if (k(e) && h(n)) {
|
|
1334
1436
|
const r = e[4].value * n[4].value;
|
|
1335
|
-
return new
|
|
1437
|
+
return new p([s.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
1438
|
}
|
|
1337
1439
|
if (h(e) && k(n)) {
|
|
1338
1440
|
const r = e[4].value * n[4].value;
|
|
1339
|
-
return new
|
|
1441
|
+
return new p([s.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
1442
|
}
|
|
1341
1443
|
return -1;
|
|
1342
1444
|
}
|
|
1343
|
-
function
|
|
1445
|
+
function ce(t, e) {
|
|
1344
1446
|
for (let n = 0; n < t.length; n++) {
|
|
1345
1447
|
const r = t[n];
|
|
1346
|
-
if (!
|
|
1448
|
+
if (!m(r)) continue;
|
|
1347
1449
|
const o = r.value;
|
|
1348
|
-
if (!
|
|
1450
|
+
if (!fe(o)) continue;
|
|
1349
1451
|
const i = x(o[4].value);
|
|
1350
1452
|
switch (i) {
|
|
1351
1453
|
case "e":
|
|
1352
|
-
t.splice(n, 1, new
|
|
1454
|
+
t.splice(n, 1, new p([s.Number, Math.E.toString(), o[2], o[3], { value: Math.E, type: l.Number }]));
|
|
1353
1455
|
break;
|
|
1354
1456
|
case "pi":
|
|
1355
|
-
t.splice(n, 1, new
|
|
1457
|
+
t.splice(n, 1, new p([s.Number, Math.PI.toString(), o[2], o[3], { value: Math.PI, type: l.Number }]));
|
|
1356
1458
|
break;
|
|
1357
1459
|
case "infinity":
|
|
1358
|
-
t.splice(n, 1, new
|
|
1460
|
+
t.splice(n, 1, new p([s.Number, "infinity", o[2], o[3], { value: 1 / 0, type: l.Number }]));
|
|
1359
1461
|
break;
|
|
1360
1462
|
case "-infinity":
|
|
1361
|
-
t.splice(n, 1, new
|
|
1463
|
+
t.splice(n, 1, new p([s.Number, "-infinity", o[2], o[3], { value: -1 / 0, type: l.Number }]));
|
|
1362
1464
|
break;
|
|
1363
1465
|
case "nan":
|
|
1364
|
-
t.splice(n, 1, new
|
|
1466
|
+
t.splice(n, 1, new p([s.Number, "NaN", o[2], o[3], { value: Number.NaN, type: l.Number }]));
|
|
1365
1467
|
break;
|
|
1366
1468
|
default:
|
|
1367
1469
|
if (e.has(i)) {
|
|
1368
|
-
const
|
|
1369
|
-
t.splice(n, 1, new
|
|
1470
|
+
const a = e.get(i);
|
|
1471
|
+
t.splice(n, 1, new p(a));
|
|
1370
1472
|
}
|
|
1371
1473
|
}
|
|
1372
1474
|
}
|
|
1373
1475
|
return t;
|
|
1374
1476
|
}
|
|
1375
|
-
function
|
|
1477
|
+
function Be(t) {
|
|
1376
1478
|
if (t.length !== 1) return -1;
|
|
1377
1479
|
const e = t[0].value;
|
|
1378
1480
|
return D(e) ? t[0] : -1;
|
|
1379
1481
|
}
|
|
1380
|
-
function
|
|
1381
|
-
return k(e) ?
|
|
1482
|
+
function G(t, e, n) {
|
|
1483
|
+
return k(e) ? me(t, e[4].unit, n) : S(e) ? dn(t, n) : h(e) ? $(t, n) : -1;
|
|
1382
1484
|
}
|
|
1383
|
-
function
|
|
1485
|
+
function me(t, e, n) {
|
|
1384
1486
|
const r = t.tokens();
|
|
1385
|
-
return { inputs: [new
|
|
1487
|
+
return { inputs: [new p([s.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: Be };
|
|
1386
1488
|
}
|
|
1387
|
-
function
|
|
1489
|
+
function dn(t, e) {
|
|
1388
1490
|
const n = t.tokens();
|
|
1389
|
-
return { inputs: [new
|
|
1491
|
+
return { inputs: [new p([s.Percentage, e.toString() + "%", n[0][2], n[n.length - 1][3], { value: e }])], operation: Be };
|
|
1390
1492
|
}
|
|
1391
1493
|
function $(t, e) {
|
|
1392
1494
|
const n = t.tokens();
|
|
1393
|
-
return { inputs: [new
|
|
1495
|
+
return { inputs: [new p([s.Number, e.toString(), n[0][2], n[n.length - 1][3], { value: e, type: Number.isInteger(e) ? l.Integer : l.Number }])], operation: Be };
|
|
1394
1496
|
}
|
|
1395
|
-
function
|
|
1497
|
+
function fn(t, e) {
|
|
1396
1498
|
const n = e.value;
|
|
1397
|
-
return h(n) ?
|
|
1499
|
+
return h(n) ? me(t, "rad", Math.acos(n[4].value)) : -1;
|
|
1398
1500
|
}
|
|
1399
|
-
function
|
|
1501
|
+
function vn(t, e) {
|
|
1400
1502
|
const n = e.value;
|
|
1401
|
-
return h(n) ?
|
|
1503
|
+
return h(n) ? me(t, "rad", Math.asin(n[4].value)) : -1;
|
|
1402
1504
|
}
|
|
1403
|
-
function
|
|
1505
|
+
function gn(t, e) {
|
|
1404
1506
|
const n = e.value;
|
|
1405
|
-
return h(n) ?
|
|
1507
|
+
return h(n) ? me(t, "rad", Math.atan(n[4].value)) : -1;
|
|
1406
1508
|
}
|
|
1407
|
-
function
|
|
1509
|
+
function Fe(t) {
|
|
1408
1510
|
return k(t) || h(t);
|
|
1409
1511
|
}
|
|
1410
|
-
function
|
|
1512
|
+
function We(t) {
|
|
1411
1513
|
if (t.length === 0) return !0;
|
|
1412
1514
|
const e = t[0];
|
|
1413
1515
|
if (!D(e)) return !1;
|
|
@@ -1426,109 +1528,109 @@ function Me(t) {
|
|
|
1426
1528
|
}
|
|
1427
1529
|
return !0;
|
|
1428
1530
|
}
|
|
1429
|
-
function
|
|
1531
|
+
function j(t, e) {
|
|
1430
1532
|
return !!D(t) && (k(t) ? t[0] === e[0] && x(t[4].unit) === x(e[4].unit) : t[0] === e[0]);
|
|
1431
1533
|
}
|
|
1432
|
-
function
|
|
1534
|
+
function mn(t, e, n) {
|
|
1433
1535
|
const r = e.value;
|
|
1434
|
-
if (!
|
|
1435
|
-
const o =
|
|
1436
|
-
return
|
|
1536
|
+
if (!Fe(r)) return -1;
|
|
1537
|
+
const o = T(r, n.value);
|
|
1538
|
+
return j(r, o) ? me(t, "rad", Math.atan2(r[4].value, o[4].value)) : -1;
|
|
1437
1539
|
}
|
|
1438
|
-
function
|
|
1540
|
+
function hn(t, e, n) {
|
|
1439
1541
|
const r = e.value;
|
|
1440
|
-
return !D(r) || !n.rawPercentages &&
|
|
1542
|
+
return !D(r) || !n.rawPercentages && S(r) ? -1 : G(t, r, Math.abs(r[4].value));
|
|
1441
1543
|
}
|
|
1442
|
-
function
|
|
1443
|
-
if (!
|
|
1544
|
+
function Cn(t, e, n, r, o) {
|
|
1545
|
+
if (!m(e) || !m(n) || !m(r)) return -1;
|
|
1444
1546
|
const i = e.value;
|
|
1445
|
-
if (!D(i) || !o.rawPercentages &&
|
|
1446
|
-
const
|
|
1447
|
-
if (!
|
|
1448
|
-
const u =
|
|
1449
|
-
return
|
|
1547
|
+
if (!D(i) || !o.rawPercentages && S(i)) return -1;
|
|
1548
|
+
const a = T(i, n.value);
|
|
1549
|
+
if (!j(i, a)) return -1;
|
|
1550
|
+
const u = T(i, r.value);
|
|
1551
|
+
return j(i, u) ? G(t, i, Math.max(i[4].value, Math.min(a[4].value, u[4].value))) : -1;
|
|
1450
1552
|
}
|
|
1451
|
-
function
|
|
1553
|
+
function yn(t, e) {
|
|
1452
1554
|
const n = e.value;
|
|
1453
|
-
if (!
|
|
1555
|
+
if (!Fe(n)) return -1;
|
|
1454
1556
|
let r = n[4].value;
|
|
1455
1557
|
if (k(n)) switch (n[4].unit.toLowerCase()) {
|
|
1456
1558
|
case "rad":
|
|
1457
1559
|
break;
|
|
1458
1560
|
case "deg":
|
|
1459
|
-
r =
|
|
1561
|
+
r = De.get("rad")(n[4].value);
|
|
1460
1562
|
break;
|
|
1461
1563
|
case "grad":
|
|
1462
|
-
r =
|
|
1564
|
+
r = ve.get("rad")(n[4].value);
|
|
1463
1565
|
break;
|
|
1464
1566
|
case "turn":
|
|
1465
|
-
r =
|
|
1567
|
+
r = ge.get("rad")(n[4].value);
|
|
1466
1568
|
break;
|
|
1467
1569
|
default:
|
|
1468
1570
|
return -1;
|
|
1469
1571
|
}
|
|
1470
1572
|
return r = Math.cos(r), $(t, r);
|
|
1471
1573
|
}
|
|
1472
|
-
function
|
|
1574
|
+
function En(t, e) {
|
|
1473
1575
|
const n = e.value;
|
|
1474
1576
|
return h(n) ? $(t, Math.exp(n[4].value)) : -1;
|
|
1475
1577
|
}
|
|
1476
|
-
function
|
|
1477
|
-
if (!e.every(
|
|
1578
|
+
function Pn(t, e, n) {
|
|
1579
|
+
if (!e.every(m)) return -1;
|
|
1478
1580
|
const r = e[0].value;
|
|
1479
|
-
if (!D(r) || !n.rawPercentages &&
|
|
1480
|
-
const o = e.map((u) =>
|
|
1481
|
-
if (!
|
|
1482
|
-
const i = o.map((u) => u[4].value),
|
|
1483
|
-
return
|
|
1484
|
-
}
|
|
1485
|
-
function
|
|
1486
|
-
if (!e.every(
|
|
1581
|
+
if (!D(r) || !n.rawPercentages && S(r)) return -1;
|
|
1582
|
+
const o = e.map((u) => T(r, u.value));
|
|
1583
|
+
if (!We(o)) return -1;
|
|
1584
|
+
const i = o.map((u) => u[4].value), a = Math.hypot(...i);
|
|
1585
|
+
return G(t, r, a);
|
|
1586
|
+
}
|
|
1587
|
+
function ze(t, e, n) {
|
|
1588
|
+
if (!e.every(m)) return -1;
|
|
1487
1589
|
const r = e[0].value;
|
|
1488
|
-
if (!D(r) || !n.rawPercentages &&
|
|
1489
|
-
const o = e.map((u) =>
|
|
1490
|
-
if (!
|
|
1491
|
-
const i = o.map((u) => u[4].value),
|
|
1492
|
-
return
|
|
1493
|
-
}
|
|
1494
|
-
function
|
|
1495
|
-
if (!e.every(
|
|
1590
|
+
if (!D(r) || !n.rawPercentages && S(r)) return -1;
|
|
1591
|
+
const o = e.map((u) => T(r, u.value));
|
|
1592
|
+
if (!We(o)) return -1;
|
|
1593
|
+
const i = o.map((u) => u[4].value), a = Math.max(...i);
|
|
1594
|
+
return G(t, r, a);
|
|
1595
|
+
}
|
|
1596
|
+
function Ve(t, e, n) {
|
|
1597
|
+
if (!e.every(m)) return -1;
|
|
1496
1598
|
const r = e[0].value;
|
|
1497
|
-
if (!D(r) || !n.rawPercentages &&
|
|
1498
|
-
const o = e.map((u) =>
|
|
1499
|
-
if (!
|
|
1500
|
-
const i = o.map((u) => u[4].value),
|
|
1501
|
-
return
|
|
1599
|
+
if (!D(r) || !n.rawPercentages && S(r)) return -1;
|
|
1600
|
+
const o = e.map((u) => T(r, u.value));
|
|
1601
|
+
if (!We(o)) return -1;
|
|
1602
|
+
const i = o.map((u) => u[4].value), a = Math.min(...i);
|
|
1603
|
+
return G(t, r, a);
|
|
1502
1604
|
}
|
|
1503
|
-
function
|
|
1605
|
+
function kn(t, e, n) {
|
|
1504
1606
|
const r = e.value;
|
|
1505
1607
|
if (!D(r)) return -1;
|
|
1506
|
-
const o =
|
|
1507
|
-
if (!
|
|
1608
|
+
const o = T(r, n.value);
|
|
1609
|
+
if (!j(r, o)) return -1;
|
|
1508
1610
|
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,
|
|
1611
|
+
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, G(t, r, i);
|
|
1510
1612
|
}
|
|
1511
|
-
function
|
|
1613
|
+
function bn(t, e, n) {
|
|
1512
1614
|
const r = e.value, o = n.value;
|
|
1513
|
-
return !h(r) || !
|
|
1615
|
+
return !h(r) || !j(r, o) ? -1 : $(t, Math.pow(r[4].value, o[4].value));
|
|
1514
1616
|
}
|
|
1515
|
-
function
|
|
1617
|
+
function Sn(t, e, n) {
|
|
1516
1618
|
const r = e.value;
|
|
1517
1619
|
if (!D(r)) return -1;
|
|
1518
|
-
const o =
|
|
1519
|
-
if (!
|
|
1620
|
+
const o = T(r, n.value);
|
|
1621
|
+
if (!j(r, o)) return -1;
|
|
1520
1622
|
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,
|
|
1623
|
+
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, G(t, r, i);
|
|
1522
1624
|
}
|
|
1523
|
-
function
|
|
1625
|
+
function An(t, e, n, r, o) {
|
|
1524
1626
|
const i = n.value;
|
|
1525
|
-
if (!D(i) || !o.rawPercentages &&
|
|
1526
|
-
const
|
|
1527
|
-
if (!
|
|
1627
|
+
if (!D(i) || !o.rawPercentages && S(i)) return -1;
|
|
1628
|
+
const a = T(i, r.value);
|
|
1629
|
+
if (!j(i, a)) return -1;
|
|
1528
1630
|
let u;
|
|
1529
|
-
if (
|
|
1530
|
-
else if (Number.isFinite(i[4].value) || Number.isFinite(
|
|
1531
|
-
else if (Number.isFinite(i[4].value) && !Number.isFinite(
|
|
1631
|
+
if (a[4].value === 0) u = Number.NaN;
|
|
1632
|
+
else if (Number.isFinite(i[4].value) || Number.isFinite(a[4].value)) if (!Number.isFinite(i[4].value) && Number.isFinite(a[4].value)) u = i[4].value;
|
|
1633
|
+
else if (Number.isFinite(i[4].value) && !Number.isFinite(a[4].value)) switch (e) {
|
|
1532
1634
|
case "down":
|
|
1533
1635
|
u = i[4].value < 0 ? -1 / 0 : Object.is(-0, 0 * i[4].value) ? -0 : 0;
|
|
1534
1636
|
break;
|
|
@@ -1538,286 +1640,286 @@ function kn(t, e, n, r, o) {
|
|
|
1538
1640
|
default:
|
|
1539
1641
|
u = Object.is(0, 0 * i[4].value) ? 0 : -0;
|
|
1540
1642
|
}
|
|
1541
|
-
else if (Number.isFinite(
|
|
1643
|
+
else if (Number.isFinite(a[4].value)) switch (e) {
|
|
1542
1644
|
case "down":
|
|
1543
|
-
u = Math.floor(i[4].value /
|
|
1645
|
+
u = Math.floor(i[4].value / a[4].value) * a[4].value;
|
|
1544
1646
|
break;
|
|
1545
1647
|
case "up":
|
|
1546
|
-
u = Math.ceil(i[4].value /
|
|
1648
|
+
u = Math.ceil(i[4].value / a[4].value) * a[4].value;
|
|
1547
1649
|
break;
|
|
1548
1650
|
case "to-zero":
|
|
1549
|
-
u = Math.trunc(i[4].value /
|
|
1651
|
+
u = Math.trunc(i[4].value / a[4].value) * a[4].value;
|
|
1550
1652
|
break;
|
|
1551
1653
|
default: {
|
|
1552
|
-
let c = Math.floor(i[4].value /
|
|
1553
|
-
if (c >
|
|
1554
|
-
const
|
|
1555
|
-
c =
|
|
1654
|
+
let c = Math.floor(i[4].value / a[4].value) * a[4].value, d = Math.ceil(i[4].value / a[4].value) * a[4].value;
|
|
1655
|
+
if (c > d) {
|
|
1656
|
+
const v = c;
|
|
1657
|
+
c = d, d = v;
|
|
1556
1658
|
}
|
|
1557
|
-
const
|
|
1558
|
-
u =
|
|
1659
|
+
const g = Math.abs(i[4].value - c), f = Math.abs(i[4].value - d);
|
|
1660
|
+
u = g === f ? d : g < f ? c : d;
|
|
1559
1661
|
break;
|
|
1560
1662
|
}
|
|
1561
1663
|
}
|
|
1562
1664
|
else u = i[4].value;
|
|
1563
1665
|
else u = Number.NaN;
|
|
1564
|
-
return
|
|
1666
|
+
return G(t, i, u);
|
|
1565
1667
|
}
|
|
1566
|
-
function
|
|
1668
|
+
function Dn(t, e, n) {
|
|
1567
1669
|
const r = e.value;
|
|
1568
|
-
return !D(r) || !n.rawPercentages &&
|
|
1670
|
+
return !D(r) || !n.rawPercentages && S(r) ? -1 : $(t, Math.sign(r[4].value));
|
|
1569
1671
|
}
|
|
1570
|
-
function
|
|
1672
|
+
function Bn(t, e) {
|
|
1571
1673
|
const n = e.value;
|
|
1572
|
-
if (!
|
|
1674
|
+
if (!Fe(n)) return -1;
|
|
1573
1675
|
let r = n[4].value;
|
|
1574
1676
|
if (k(n)) switch (x(n[4].unit)) {
|
|
1575
1677
|
case "rad":
|
|
1576
1678
|
break;
|
|
1577
1679
|
case "deg":
|
|
1578
|
-
r =
|
|
1680
|
+
r = De.get("rad")(n[4].value);
|
|
1579
1681
|
break;
|
|
1580
1682
|
case "grad":
|
|
1581
|
-
r =
|
|
1683
|
+
r = ve.get("rad")(n[4].value);
|
|
1582
1684
|
break;
|
|
1583
1685
|
case "turn":
|
|
1584
|
-
r =
|
|
1686
|
+
r = ge.get("rad")(n[4].value);
|
|
1585
1687
|
break;
|
|
1586
1688
|
default:
|
|
1587
1689
|
return -1;
|
|
1588
1690
|
}
|
|
1589
1691
|
return r = Math.sin(r), $(t, r);
|
|
1590
1692
|
}
|
|
1591
|
-
function
|
|
1693
|
+
function Fn(t, e) {
|
|
1592
1694
|
const n = e.value;
|
|
1593
1695
|
return h(n) ? $(t, Math.sqrt(n[4].value)) : -1;
|
|
1594
1696
|
}
|
|
1595
|
-
function
|
|
1697
|
+
function wn(t, e) {
|
|
1596
1698
|
const n = e.value;
|
|
1597
|
-
if (!
|
|
1699
|
+
if (!Fe(n)) return -1;
|
|
1598
1700
|
const r = n[4].value;
|
|
1599
1701
|
let o = 0, i = n[4].value;
|
|
1600
1702
|
if (k(n)) switch (x(n[4].unit)) {
|
|
1601
1703
|
case "rad":
|
|
1602
|
-
o =
|
|
1704
|
+
o = ot.get("deg")(r);
|
|
1603
1705
|
break;
|
|
1604
1706
|
case "deg":
|
|
1605
|
-
o = r, i =
|
|
1707
|
+
o = r, i = De.get("rad")(r);
|
|
1606
1708
|
break;
|
|
1607
1709
|
case "grad":
|
|
1608
|
-
o =
|
|
1710
|
+
o = ve.get("deg")(r), i = ve.get("rad")(r);
|
|
1609
1711
|
break;
|
|
1610
1712
|
case "turn":
|
|
1611
|
-
o =
|
|
1713
|
+
o = ge.get("deg")(r), i = ge.get("rad")(r);
|
|
1612
1714
|
break;
|
|
1613
1715
|
default:
|
|
1614
1716
|
return -1;
|
|
1615
1717
|
}
|
|
1616
|
-
const
|
|
1617
|
-
return i = o % 90 == 0 &&
|
|
1718
|
+
const a = o / 90;
|
|
1719
|
+
return i = o % 90 == 0 && a % 2 != 0 ? a > 0 ? 1 / 0 : -1 / 0 : Math.tan(i), $(t, i);
|
|
1618
1720
|
}
|
|
1619
|
-
function
|
|
1721
|
+
function Nn(t) {
|
|
1620
1722
|
if (t.length !== 2) return -1;
|
|
1621
1723
|
const e = t[0].value;
|
|
1622
1724
|
let n = t[1].value;
|
|
1623
1725
|
if (h(e) && h(n)) {
|
|
1624
1726
|
const r = e[4].value - n[4].value;
|
|
1625
|
-
return new
|
|
1727
|
+
return new p([s.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
1728
|
}
|
|
1627
|
-
if (
|
|
1729
|
+
if (S(e) && S(n)) {
|
|
1628
1730
|
const r = e[4].value - n[4].value;
|
|
1629
|
-
return new
|
|
1731
|
+
return new p([s.Percentage, r.toString() + "%", e[2], n[3], { value: r }]);
|
|
1630
1732
|
}
|
|
1631
|
-
if (k(e) && k(n) && (n =
|
|
1733
|
+
if (k(e) && k(n) && (n = T(e, n), x(e[4].unit) === x(n[4].unit))) {
|
|
1632
1734
|
const r = e[4].value - n[4].value;
|
|
1633
|
-
return new
|
|
1735
|
+
return new p([s.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
1736
|
}
|
|
1635
1737
|
return -1;
|
|
1636
1738
|
}
|
|
1637
|
-
function
|
|
1739
|
+
function In(t, e) {
|
|
1638
1740
|
if (e.length === 1) {
|
|
1639
1741
|
const n = e[0];
|
|
1640
|
-
if (!n || !
|
|
1742
|
+
if (!n || !m(n)) return -1;
|
|
1641
1743
|
const r = n.value;
|
|
1642
1744
|
return h(r) ? $(t, Math.log(r[4].value)) : -1;
|
|
1643
1745
|
}
|
|
1644
1746
|
if (e.length === 2) {
|
|
1645
1747
|
const n = e[0];
|
|
1646
|
-
if (!n || !
|
|
1748
|
+
if (!n || !m(n)) return -1;
|
|
1647
1749
|
const r = n.value;
|
|
1648
1750
|
if (!h(r)) return -1;
|
|
1649
1751
|
const o = e[1];
|
|
1650
|
-
if (!o || !
|
|
1752
|
+
if (!o || !m(o)) return -1;
|
|
1651
1753
|
const i = o.value;
|
|
1652
1754
|
return h(i) ? $(t, Math.log(r[4].value) / Math.log(i[4].value)) : -1;
|
|
1653
1755
|
}
|
|
1654
1756
|
return -1;
|
|
1655
1757
|
}
|
|
1656
|
-
const
|
|
1657
|
-
function
|
|
1758
|
+
const xn = /^none$/i;
|
|
1759
|
+
function Oe(t) {
|
|
1658
1760
|
if (Array.isArray(t)) {
|
|
1659
|
-
const n = t.filter((r) => !(
|
|
1660
|
-
return n.length === 1 &&
|
|
1761
|
+
const n = t.filter((r) => !(nt(r) && rt(r)));
|
|
1762
|
+
return n.length === 1 && Oe(n[0]);
|
|
1661
1763
|
}
|
|
1662
|
-
if (!
|
|
1764
|
+
if (!m(t)) return !1;
|
|
1663
1765
|
const e = t.value;
|
|
1664
|
-
return !!
|
|
1665
|
-
}
|
|
1666
|
-
function
|
|
1667
|
-
const
|
|
1668
|
-
if (!D(
|
|
1669
|
-
const u =
|
|
1670
|
-
if (!
|
|
1671
|
-
let c,
|
|
1672
|
-
if (o && (
|
|
1673
|
-
if (Number.isFinite(
|
|
1766
|
+
return !!fe(e) && xn.test(e[4].value);
|
|
1767
|
+
}
|
|
1768
|
+
function Tn(t, e, n, r, o, i) {
|
|
1769
|
+
const a = n.value;
|
|
1770
|
+
if (!D(a)) return -1;
|
|
1771
|
+
const u = T(a, r.value);
|
|
1772
|
+
if (!j(a, u)) return -1;
|
|
1773
|
+
let c, d = null;
|
|
1774
|
+
if (o && (d = T(a, o.value), !j(a, d))) return -1;
|
|
1775
|
+
if (Number.isFinite(a[4].value)) if (Number.isFinite(u[4].value)) if (Number.isFinite(u[4].value - a[4].value)) if (d && !Number.isFinite(d[4].value)) c = a[4].value;
|
|
1674
1776
|
else {
|
|
1675
|
-
const
|
|
1676
|
-
let f =
|
|
1677
|
-
if (f >
|
|
1678
|
-
const C = Math.abs(f -
|
|
1679
|
-
c = f + Math.floor(C /
|
|
1777
|
+
const g = On(Mn([e, W(a), W(u), o ? `by ${o.toString()}` : ""].join(",")), i.randomSeed);
|
|
1778
|
+
let f = a[4].value, v = u[4].value;
|
|
1779
|
+
if (f > v && ([f, v] = [v, f]), d && (d[4].value <= 0 || Math.abs(f - v) / d[4].value > 1e10) && (d = null), d) {
|
|
1780
|
+
const C = Math.abs(f - v), P = g();
|
|
1781
|
+
c = f + Math.floor(C / d[4].value * P) * d[4].value;
|
|
1680
1782
|
} else {
|
|
1681
|
-
const C =
|
|
1682
|
-
c = Number((C * (
|
|
1783
|
+
const C = g();
|
|
1784
|
+
c = Number((C * (v - f) + f).toFixed(5));
|
|
1683
1785
|
}
|
|
1684
1786
|
}
|
|
1685
1787
|
else c = Number.NaN;
|
|
1686
1788
|
else c = Number.NaN;
|
|
1687
1789
|
else c = Number.NaN;
|
|
1688
|
-
return
|
|
1790
|
+
return G(t, a, c);
|
|
1689
1791
|
}
|
|
1690
|
-
function
|
|
1792
|
+
function On(t = 0.34944106645296036, e = 0.19228640875738723, n = 0.8784393832007205, r = 0.04850964319275053) {
|
|
1691
1793
|
return () => {
|
|
1692
1794
|
const o = ((t |= 0) + (e |= 0) | 0) + (r |= 0) | 0;
|
|
1693
1795
|
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
1796
|
};
|
|
1695
1797
|
}
|
|
1696
|
-
function
|
|
1798
|
+
function Mn(t) {
|
|
1697
1799
|
let e = 0, n = 0, r = 0;
|
|
1698
1800
|
e = ~e;
|
|
1699
1801
|
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
1802
|
return ~e >>> 0;
|
|
1701
1803
|
}
|
|
1702
|
-
const
|
|
1703
|
-
return L(e, n, r,
|
|
1804
|
+
const Le = /* @__PURE__ */ new Map([["abs", function(e, n, r) {
|
|
1805
|
+
return L(e, n, r, hn);
|
|
1704
1806
|
}], ["acos", function(e, n, r) {
|
|
1705
|
-
return L(e, n, r,
|
|
1807
|
+
return L(e, n, r, fn);
|
|
1706
1808
|
}], ["asin", function(e, n, r) {
|
|
1707
|
-
return L(e, n, r,
|
|
1809
|
+
return L(e, n, r, vn);
|
|
1708
1810
|
}], ["atan", function(e, n, r) {
|
|
1709
|
-
return L(e, n, r,
|
|
1811
|
+
return L(e, n, r, gn);
|
|
1710
1812
|
}], ["atan2", function(e, n, r) {
|
|
1711
|
-
return
|
|
1813
|
+
return he(e, n, r, mn);
|
|
1712
1814
|
}], ["calc", w], ["clamp", function(e, n, r) {
|
|
1713
|
-
const o =
|
|
1815
|
+
const o = ce([...e.value.filter((y) => !_(y))], n), i = [], a = [], u = [];
|
|
1714
1816
|
{
|
|
1715
|
-
let
|
|
1716
|
-
for (let
|
|
1717
|
-
const
|
|
1718
|
-
if (
|
|
1719
|
-
if (
|
|
1720
|
-
if (
|
|
1721
|
-
|
|
1817
|
+
let y = i;
|
|
1818
|
+
for (let z = 0; z < o.length; z++) {
|
|
1819
|
+
const V = o[z];
|
|
1820
|
+
if (m(V) && K(V.value)) {
|
|
1821
|
+
if (y === u) return -1;
|
|
1822
|
+
if (y === a) {
|
|
1823
|
+
y = u;
|
|
1722
1824
|
continue;
|
|
1723
1825
|
}
|
|
1724
|
-
if (
|
|
1725
|
-
|
|
1826
|
+
if (y === i) {
|
|
1827
|
+
y = a;
|
|
1726
1828
|
continue;
|
|
1727
1829
|
}
|
|
1728
1830
|
return -1;
|
|
1729
1831
|
}
|
|
1730
|
-
|
|
1832
|
+
y.push(V);
|
|
1731
1833
|
}
|
|
1732
1834
|
}
|
|
1733
|
-
const c =
|
|
1734
|
-
if (c &&
|
|
1735
|
-
const
|
|
1736
|
-
if (
|
|
1835
|
+
const c = Oe(i), d = Oe(u);
|
|
1836
|
+
if (c && d) return w(M(a), n, r);
|
|
1837
|
+
const g = N(w(M(a), n, r));
|
|
1838
|
+
if (g === -1) return -1;
|
|
1737
1839
|
if (c) {
|
|
1738
|
-
const
|
|
1739
|
-
return
|
|
1840
|
+
const y = N(w(M(u), n, r));
|
|
1841
|
+
return y === -1 ? -1 : Ve((f = g, v = y, new F([s.Function, "min(", -1, -1, { value: "min" }], [s.CloseParen, ")", -1, -1, void 0], [f, new p([s.Comma, ",", -1, -1, void 0]), v])), [g, y], r);
|
|
1740
1842
|
}
|
|
1741
|
-
if (
|
|
1742
|
-
const
|
|
1743
|
-
return
|
|
1843
|
+
if (d) {
|
|
1844
|
+
const y = N(w(M(i), n, r));
|
|
1845
|
+
return y === -1 ? -1 : ze(Wn(y, g), [y, g], r);
|
|
1744
1846
|
}
|
|
1745
|
-
var f,
|
|
1746
|
-
const C = N(w(
|
|
1847
|
+
var f, v;
|
|
1848
|
+
const C = N(w(M(i), n, r));
|
|
1747
1849
|
if (C === -1) return -1;
|
|
1748
|
-
const
|
|
1749
|
-
return
|
|
1850
|
+
const P = N(w(M(u), n, r));
|
|
1851
|
+
return P === -1 ? -1 : Cn(e, C, g, P, r);
|
|
1750
1852
|
}], ["cos", function(e, n, r) {
|
|
1751
|
-
return L(e, n, r,
|
|
1853
|
+
return L(e, n, r, yn);
|
|
1752
1854
|
}], ["exp", function(e, n, r) {
|
|
1753
|
-
return L(e, n, r,
|
|
1855
|
+
return L(e, n, r, En);
|
|
1754
1856
|
}], ["hypot", function(e, n, r) {
|
|
1755
|
-
return
|
|
1857
|
+
return Ce(e, e.value, n, r, Pn);
|
|
1756
1858
|
}], ["log", function(e, n, r) {
|
|
1757
|
-
return
|
|
1859
|
+
return Ce(e, e.value, n, r, In);
|
|
1758
1860
|
}], ["max", function(e, n, r) {
|
|
1759
|
-
return
|
|
1861
|
+
return Ce(e, e.value, n, r, ze);
|
|
1760
1862
|
}], ["min", function(e, n, r) {
|
|
1761
|
-
return
|
|
1863
|
+
return Ce(e, e.value, n, r, Ve);
|
|
1762
1864
|
}], ["mod", function(e, n, r) {
|
|
1763
|
-
return
|
|
1865
|
+
return he(e, n, r, kn);
|
|
1764
1866
|
}], ["pow", function(e, n, r) {
|
|
1765
|
-
return
|
|
1867
|
+
return he(e, n, r, bn);
|
|
1766
1868
|
}], ["random", function(e, n, r) {
|
|
1767
|
-
const o = e.value.filter((
|
|
1869
|
+
const o = e.value.filter((v) => !_(v));
|
|
1768
1870
|
let i = "";
|
|
1769
|
-
const
|
|
1770
|
-
for (let
|
|
1771
|
-
const C = o[
|
|
1772
|
-
if (!i && u.length === 0 &&
|
|
1773
|
-
const
|
|
1774
|
-
if (
|
|
1775
|
-
i =
|
|
1776
|
-
const
|
|
1777
|
-
if (!
|
|
1778
|
-
|
|
1871
|
+
const a = [], u = [];
|
|
1872
|
+
for (let v = 0; v < o.length; v++) {
|
|
1873
|
+
const C = o[v];
|
|
1874
|
+
if (!i && u.length === 0 && m(C) && fe(C.value)) {
|
|
1875
|
+
const P = C.value[4].value.toLowerCase();
|
|
1876
|
+
if (P === "per-element" || P.startsWith("--")) {
|
|
1877
|
+
i = P;
|
|
1878
|
+
const y = o[v + 1];
|
|
1879
|
+
if (!m(y) || !K(y.value)) return -1;
|
|
1880
|
+
v++;
|
|
1779
1881
|
continue;
|
|
1780
1882
|
}
|
|
1781
1883
|
}
|
|
1782
|
-
if (
|
|
1783
|
-
const
|
|
1784
|
-
if (u.length > 0 &&
|
|
1785
|
-
const
|
|
1786
|
-
if (
|
|
1787
|
-
|
|
1884
|
+
if (m(C) && K(C.value)) {
|
|
1885
|
+
const P = o[v + 1];
|
|
1886
|
+
if (u.length > 0 && m(P) && fe(P.value)) {
|
|
1887
|
+
const y = P.value[4].value.toLowerCase();
|
|
1888
|
+
if (y === "by" || y.startsWith("--")) {
|
|
1889
|
+
a.push(...o.slice(v + 2));
|
|
1788
1890
|
break;
|
|
1789
1891
|
}
|
|
1790
1892
|
}
|
|
1791
1893
|
}
|
|
1792
1894
|
u.push(C);
|
|
1793
1895
|
}
|
|
1794
|
-
const c =
|
|
1896
|
+
const c = st(u, n, r);
|
|
1795
1897
|
if (c === -1) return -1;
|
|
1796
|
-
const [
|
|
1898
|
+
const [d, g] = c;
|
|
1797
1899
|
let f = null;
|
|
1798
|
-
return
|
|
1900
|
+
return a.length && (f = it(a, n, r), f === -1) ? -1 : Tn(e, i, d, g, f, r);
|
|
1799
1901
|
}], ["rem", function(e, n, r) {
|
|
1800
|
-
return
|
|
1902
|
+
return he(e, n, r, Sn);
|
|
1801
1903
|
}], ["round", function(e, n, r) {
|
|
1802
|
-
const o =
|
|
1803
|
-
let i = "",
|
|
1904
|
+
const o = ce([...e.value.filter((f) => !_(f))], n);
|
|
1905
|
+
let i = "", a = !1;
|
|
1804
1906
|
const u = [], c = [];
|
|
1805
1907
|
{
|
|
1806
1908
|
let f = u;
|
|
1807
|
-
for (let
|
|
1808
|
-
const C = o[
|
|
1809
|
-
if (!i && u.length === 0 && c.length === 0 &&
|
|
1810
|
-
const
|
|
1811
|
-
if (
|
|
1812
|
-
i =
|
|
1909
|
+
for (let v = 0; v < o.length; v++) {
|
|
1910
|
+
const C = o[v];
|
|
1911
|
+
if (!i && u.length === 0 && c.length === 0 && m(C) && fe(C.value)) {
|
|
1912
|
+
const P = C.value[4].value.toLowerCase();
|
|
1913
|
+
if (Un.has(P)) {
|
|
1914
|
+
i = P;
|
|
1813
1915
|
continue;
|
|
1814
1916
|
}
|
|
1815
1917
|
}
|
|
1816
|
-
if (
|
|
1918
|
+
if (m(C) && K(C.value)) {
|
|
1817
1919
|
if (f === c) return -1;
|
|
1818
1920
|
if (f === u && i && u.length === 0) continue;
|
|
1819
1921
|
if (f === u) {
|
|
1820
|
-
|
|
1922
|
+
a = !0, f = c;
|
|
1821
1923
|
continue;
|
|
1822
1924
|
}
|
|
1823
1925
|
return -1;
|
|
@@ -1825,103 +1927,103 @@ const Ue = /* @__PURE__ */ new Map([["abs", function(e, n, r) {
|
|
|
1825
1927
|
f.push(C);
|
|
1826
1928
|
}
|
|
1827
1929
|
}
|
|
1828
|
-
const
|
|
1829
|
-
if (
|
|
1830
|
-
|
|
1831
|
-
const
|
|
1832
|
-
return
|
|
1930
|
+
const d = N(w(M(u), n, r));
|
|
1931
|
+
if (d === -1) return -1;
|
|
1932
|
+
a || c.length !== 0 || c.push(new p([s.Number, "1", -1, -1, { value: 1, type: l.Integer }]));
|
|
1933
|
+
const g = N(w(M(c), n, r));
|
|
1934
|
+
return g === -1 ? -1 : (i || (i = "nearest"), An(e, i, d, g, r));
|
|
1833
1935
|
}], ["sign", function(e, n, r) {
|
|
1834
|
-
return L(e, n, r,
|
|
1936
|
+
return L(e, n, r, Dn);
|
|
1835
1937
|
}], ["sin", function(e, n, r) {
|
|
1836
|
-
return L(e, n, r,
|
|
1938
|
+
return L(e, n, r, Bn);
|
|
1837
1939
|
}], ["sqrt", function(e, n, r) {
|
|
1838
|
-
return L(e, n, r,
|
|
1940
|
+
return L(e, n, r, Fn);
|
|
1839
1941
|
}], ["tan", function(e, n, r) {
|
|
1840
|
-
return L(e, n, r,
|
|
1942
|
+
return L(e, n, r, wn);
|
|
1841
1943
|
}]]);
|
|
1842
1944
|
function w(t, e, n) {
|
|
1843
|
-
const r =
|
|
1844
|
-
if (r.length === 1 &&
|
|
1945
|
+
const r = ce([...t.value.filter((i) => !_(i))], e);
|
|
1946
|
+
if (r.length === 1 && m(r[0])) return { inputs: [r[0]], operation: Be };
|
|
1845
1947
|
let o = 0;
|
|
1846
1948
|
for (; o < r.length; ) {
|
|
1847
1949
|
const i = r[o];
|
|
1848
|
-
if (
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1851
|
-
r.splice(o, 1,
|
|
1852
|
-
} else if (
|
|
1853
|
-
const
|
|
1854
|
-
if (!
|
|
1855
|
-
const u =
|
|
1950
|
+
if (Yt(i) && Qe(i.startToken)) {
|
|
1951
|
+
const a = w(i, e, n);
|
|
1952
|
+
if (a === -1) return -1;
|
|
1953
|
+
r.splice(o, 1, a);
|
|
1954
|
+
} else if (pe(i)) {
|
|
1955
|
+
const a = Le.get(i.getName().toLowerCase());
|
|
1956
|
+
if (!a) return -1;
|
|
1957
|
+
const u = a(i, e, n);
|
|
1856
1958
|
if (u === -1) return -1;
|
|
1857
1959
|
r.splice(o, 1, u);
|
|
1858
1960
|
} else o++;
|
|
1859
1961
|
}
|
|
1860
|
-
if (o = 0, r.length === 1 &&
|
|
1962
|
+
if (o = 0, r.length === 1 && Z(r[0])) return r[0];
|
|
1861
1963
|
for (; o < r.length; ) {
|
|
1862
1964
|
const i = r[o];
|
|
1863
|
-
if (!i || !
|
|
1965
|
+
if (!i || !m(i) && !Z(i)) {
|
|
1864
1966
|
o++;
|
|
1865
1967
|
continue;
|
|
1866
1968
|
}
|
|
1867
|
-
const
|
|
1868
|
-
if (!
|
|
1969
|
+
const a = r[o + 1];
|
|
1970
|
+
if (!a || !m(a)) {
|
|
1869
1971
|
o++;
|
|
1870
1972
|
continue;
|
|
1871
1973
|
}
|
|
1872
|
-
const u =
|
|
1873
|
-
if (
|
|
1974
|
+
const u = a.value;
|
|
1975
|
+
if (!$e(u) || u[4].value !== "*" && u[4].value !== "/") {
|
|
1874
1976
|
o++;
|
|
1875
1977
|
continue;
|
|
1876
1978
|
}
|
|
1877
1979
|
const c = r[o + 2];
|
|
1878
|
-
if (!c || !
|
|
1879
|
-
u[4].value !== "*" ? u[4].value !== "/" ? o++ : r.splice(o, 3, { inputs: [i, c], operation:
|
|
1980
|
+
if (!c || !m(c) && !Z(c)) return -1;
|
|
1981
|
+
u[4].value !== "*" ? u[4].value !== "/" ? o++ : r.splice(o, 3, { inputs: [i, c], operation: ln }) : r.splice(o, 3, { inputs: [i, c], operation: pn });
|
|
1880
1982
|
}
|
|
1881
|
-
if (o = 0, r.length === 1 &&
|
|
1983
|
+
if (o = 0, r.length === 1 && Z(r[0])) return r[0];
|
|
1882
1984
|
for (; o < r.length; ) {
|
|
1883
1985
|
const i = r[o];
|
|
1884
|
-
if (!i || !
|
|
1986
|
+
if (!i || !m(i) && !Z(i)) {
|
|
1885
1987
|
o++;
|
|
1886
1988
|
continue;
|
|
1887
1989
|
}
|
|
1888
|
-
const
|
|
1889
|
-
if (!
|
|
1990
|
+
const a = r[o + 1];
|
|
1991
|
+
if (!a || !m(a)) {
|
|
1890
1992
|
o++;
|
|
1891
1993
|
continue;
|
|
1892
1994
|
}
|
|
1893
|
-
const u =
|
|
1894
|
-
if (
|
|
1995
|
+
const u = a.value;
|
|
1996
|
+
if (!$e(u) || u[4].value !== "+" && u[4].value !== "-") {
|
|
1895
1997
|
o++;
|
|
1896
1998
|
continue;
|
|
1897
1999
|
}
|
|
1898
2000
|
const c = r[o + 2];
|
|
1899
|
-
if (!c || !
|
|
1900
|
-
u[4].value !== "+" ? u[4].value !== "-" ? o++ : r.splice(o, 3, { inputs: [i, c], operation:
|
|
2001
|
+
if (!c || !m(c) && !Z(c)) return -1;
|
|
2002
|
+
u[4].value !== "+" ? u[4].value !== "-" ? o++ : r.splice(o, 3, { inputs: [i, c], operation: Nn }) : r.splice(o, 3, { inputs: [i, c], operation: cn });
|
|
1901
2003
|
}
|
|
1902
|
-
return r.length === 1 &&
|
|
2004
|
+
return r.length === 1 && Z(r[0]) ? r[0] : -1;
|
|
1903
2005
|
}
|
|
1904
2006
|
function L(t, e, n, r) {
|
|
1905
|
-
const o =
|
|
2007
|
+
const o = it(t.value, e, n);
|
|
1906
2008
|
return o === -1 ? -1 : r(t, o, n);
|
|
1907
2009
|
}
|
|
1908
|
-
function
|
|
1909
|
-
const r = N(w(
|
|
2010
|
+
function it(t, e, n) {
|
|
2011
|
+
const r = N(w(M(ce([...t.filter((o) => !_(o))], e)), e, n));
|
|
1910
2012
|
return r === -1 ? -1 : r;
|
|
1911
2013
|
}
|
|
1912
|
-
function
|
|
1913
|
-
const o =
|
|
2014
|
+
function he(t, e, n, r) {
|
|
2015
|
+
const o = st(t.value, e, n);
|
|
1914
2016
|
if (o === -1) return -1;
|
|
1915
|
-
const [i,
|
|
1916
|
-
return r(t, i,
|
|
2017
|
+
const [i, a] = o;
|
|
2018
|
+
return r(t, i, a, n);
|
|
1917
2019
|
}
|
|
1918
|
-
function
|
|
1919
|
-
const r =
|
|
2020
|
+
function st(t, e, n) {
|
|
2021
|
+
const r = ce([...t.filter((c) => !_(c))], e), o = [], i = [];
|
|
1920
2022
|
{
|
|
1921
2023
|
let c = o;
|
|
1922
|
-
for (let
|
|
1923
|
-
const
|
|
1924
|
-
if (g
|
|
2024
|
+
for (let d = 0; d < r.length; d++) {
|
|
2025
|
+
const g = r[d];
|
|
2026
|
+
if (m(g) && K(g.value)) {
|
|
1925
2027
|
if (c === i) return -1;
|
|
1926
2028
|
if (c === o) {
|
|
1927
2029
|
c = i;
|
|
@@ -1929,99 +2031,99 @@ function ot(t, e, n) {
|
|
|
1929
2031
|
}
|
|
1930
2032
|
return -1;
|
|
1931
2033
|
}
|
|
1932
|
-
c.push(
|
|
2034
|
+
c.push(g);
|
|
1933
2035
|
}
|
|
1934
2036
|
}
|
|
1935
|
-
const
|
|
1936
|
-
if (
|
|
1937
|
-
const u = N(w(
|
|
1938
|
-
return u === -1 ? -1 : [
|
|
2037
|
+
const a = N(w(M(o), e, n));
|
|
2038
|
+
if (a === -1) return -1;
|
|
2039
|
+
const u = N(w(M(i), e, n));
|
|
2040
|
+
return u === -1 ? -1 : [a, u];
|
|
1939
2041
|
}
|
|
1940
|
-
function
|
|
1941
|
-
const i =
|
|
2042
|
+
function Ce(t, e, n, r, o) {
|
|
2043
|
+
const i = Rn(t.value, n, r);
|
|
1942
2044
|
return i === -1 ? -1 : o(t, i, r);
|
|
1943
2045
|
}
|
|
1944
|
-
function
|
|
1945
|
-
const r =
|
|
2046
|
+
function Rn(t, e, n) {
|
|
2047
|
+
const r = ce([...t.filter((i) => !_(i))], e), o = [];
|
|
1946
2048
|
{
|
|
1947
2049
|
const i = [];
|
|
1948
|
-
let
|
|
2050
|
+
let a = [];
|
|
1949
2051
|
for (let u = 0; u < r.length; u++) {
|
|
1950
2052
|
const c = r[u];
|
|
1951
|
-
|
|
2053
|
+
m(c) && K(c.value) ? (i.push(a), a = []) : a.push(c);
|
|
1952
2054
|
}
|
|
1953
|
-
i.push(
|
|
2055
|
+
i.push(a);
|
|
1954
2056
|
for (let u = 0; u < i.length; u++) {
|
|
1955
2057
|
if (i[u].length === 0) return -1;
|
|
1956
|
-
const c = N(w(
|
|
2058
|
+
const c = N(w(M(i[u]), e, n));
|
|
1957
2059
|
if (c === -1) return -1;
|
|
1958
2060
|
o.push(c);
|
|
1959
2061
|
}
|
|
1960
2062
|
}
|
|
1961
2063
|
return o;
|
|
1962
2064
|
}
|
|
1963
|
-
const
|
|
1964
|
-
function
|
|
1965
|
-
return new F([
|
|
2065
|
+
const Un = /* @__PURE__ */ new Set(["nearest", "up", "down", "to-zero"]);
|
|
2066
|
+
function M(t) {
|
|
2067
|
+
return new F([s.Function, "calc(", -1, -1, { value: "calc" }], [s.CloseParen, ")", -1, -1, void 0], t);
|
|
1966
2068
|
}
|
|
1967
|
-
function
|
|
1968
|
-
return new F([
|
|
2069
|
+
function Wn(t, e) {
|
|
2070
|
+
return new F([s.Function, "max(", -1, -1, { value: "max" }], [s.CloseParen, ")", -1, -1, void 0], [t, new p([s.Comma, ",", -1, -1, void 0]), e]);
|
|
1969
2071
|
}
|
|
1970
|
-
function
|
|
2072
|
+
function Ln(t) {
|
|
1971
2073
|
if (t === -1) return -1;
|
|
1972
|
-
if (
|
|
2074
|
+
if (pe(t)) return t;
|
|
1973
2075
|
const e = t.value;
|
|
1974
|
-
return D(e) && Number.isNaN(e[4].value) ? h(e) ? new F([
|
|
2076
|
+
return D(e) && Number.isNaN(e[4].value) ? h(e) ? new F([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new p([s.Ident, "NaN", e[2], e[3], { value: "NaN" }])]) : k(e) ? new F([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new p([s.Ident, "NaN", e[2], e[3], { value: "NaN" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Delim, "*", e[2], e[3], { value: "*" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Dimension, "1" + e[4].unit, e[2], e[3], { value: 1, type: l.Integer, unit: e[4].unit }])]) : S(e) ? new F([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new p([s.Ident, "NaN", e[2], e[3], { value: "NaN" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Delim, "*", e[2], e[3], { value: "*" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Percentage, "1%", e[2], e[3], { value: 1 }])]) : -1 : t;
|
|
1975
2077
|
}
|
|
1976
|
-
function
|
|
2078
|
+
function qn(t) {
|
|
1977
2079
|
if (t === -1) return -1;
|
|
1978
|
-
if (
|
|
2080
|
+
if (pe(t)) return t;
|
|
1979
2081
|
const e = t.value;
|
|
1980
2082
|
if (!D(e) || Number.isFinite(e[4].value) || Number.isNaN(e[4].value)) return t;
|
|
1981
2083
|
let n = "";
|
|
1982
|
-
return Number.NEGATIVE_INFINITY === e[4].value && (n = "-"), h(e) ? new F([
|
|
2084
|
+
return Number.NEGATIVE_INFINITY === e[4].value && (n = "-"), h(e) ? new F([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new p([s.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }])]) : k(e) ? new F([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new p([s.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Delim, "*", e[2], e[3], { value: "*" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Dimension, "1" + e[4].unit, e[2], e[3], { value: 1, type: l.Integer, unit: e[4].unit }])]) : new F([s.Function, "calc(", e[2], e[3], { value: "calc" }], [s.CloseParen, ")", e[2], e[3], void 0], [new p([s.Ident, n + "infinity", e[2], e[3], { value: n + "infinity" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Delim, "*", e[2], e[3], { value: "*" }]), new I([[s.Whitespace, " ", e[2], e[3], void 0]]), new p([s.Percentage, "1%", e[2], e[3], { value: 1 }])]);
|
|
1983
2085
|
}
|
|
1984
|
-
function
|
|
2086
|
+
function $n(t) {
|
|
1985
2087
|
if (t === -1) return -1;
|
|
1986
|
-
if (
|
|
2088
|
+
if (pe(t)) return t;
|
|
1987
2089
|
const e = t.value;
|
|
1988
|
-
return D(e) && Object.is(-0, e[4].value) && (e[1] === "-0" || (
|
|
2090
|
+
return D(e) && Object.is(-0, e[4].value) && (e[1] === "-0" || (S(e) ? e[1] = "-0%" : k(e) ? e[1] = "-0" + e[4].unit : e[1] = "-0")), t;
|
|
1989
2091
|
}
|
|
1990
|
-
function
|
|
2092
|
+
function zn(t, e = 13) {
|
|
1991
2093
|
if (t === -1) return -1;
|
|
1992
|
-
if (e <= 0 ||
|
|
2094
|
+
if (e <= 0 || pe(t)) return t;
|
|
1993
2095
|
const n = t.value;
|
|
1994
2096
|
if (!D(n) || Number.isInteger(n[4].value)) return t;
|
|
1995
2097
|
const r = Number(n[4].value.toFixed(e)).toString();
|
|
1996
|
-
return h(n) ? n[1] = r :
|
|
2098
|
+
return h(n) ? n[1] = r : S(n) ? n[1] = r + "%" : k(n) && (n[1] = r + n[4].unit), t;
|
|
1997
2099
|
}
|
|
1998
|
-
function
|
|
2100
|
+
function Vn(t, e) {
|
|
1999
2101
|
let n = t;
|
|
2000
|
-
return n =
|
|
2102
|
+
return n = zn(n, e == null ? void 0 : e.precision), n = $n(n), n = Ln(n), n = qn(n), n;
|
|
2001
2103
|
}
|
|
2002
|
-
function
|
|
2104
|
+
function Hn(t) {
|
|
2003
2105
|
return /* @__PURE__ */ new Map();
|
|
2004
2106
|
}
|
|
2005
|
-
function
|
|
2006
|
-
return
|
|
2107
|
+
function jn(t, e) {
|
|
2108
|
+
return Gn(Ht(It({ css: t }), {}), e).map((n) => n.map((r) => W(...r.tokens())).join("")).join(",");
|
|
2007
2109
|
}
|
|
2008
|
-
function
|
|
2009
|
-
const n =
|
|
2010
|
-
return
|
|
2011
|
-
if (!
|
|
2012
|
-
const o =
|
|
2110
|
+
function Gn(t, e) {
|
|
2111
|
+
const n = Hn();
|
|
2112
|
+
return Jt(t, (r) => {
|
|
2113
|
+
if (!pe(r)) return;
|
|
2114
|
+
const o = Le.get(r.getName().toLowerCase());
|
|
2013
2115
|
if (!o) return;
|
|
2014
|
-
const i =
|
|
2116
|
+
const i = Vn(N(o(r, n, {})), e);
|
|
2015
2117
|
return i !== -1 ? i : void 0;
|
|
2016
2118
|
});
|
|
2017
2119
|
}
|
|
2018
|
-
new Set(
|
|
2019
|
-
const q = (t
|
|
2020
|
-
const
|
|
2021
|
-
let
|
|
2022
|
-
const
|
|
2023
|
-
return
|
|
2024
|
-
},
|
|
2120
|
+
new Set(Le.keys());
|
|
2121
|
+
const q = (t) => {
|
|
2122
|
+
const e = `${t}`, n = parseFloat(e);
|
|
2123
|
+
let r = "unsupported";
|
|
2124
|
+
const o = e.match(/px|rem|em/);
|
|
2125
|
+
return o && (r = o[0]), n === 0 && r === "unsupported" && (r = "zero"), { number: n, unit: r };
|
|
2126
|
+
}, He = (t) => {
|
|
2025
2127
|
const e = {};
|
|
2026
2128
|
if (typeof t == "string")
|
|
2027
2129
|
e.fontSize = q(t);
|
|
@@ -2031,7 +2133,7 @@ const q = (t, e) => {
|
|
|
2031
2133
|
else if (typeof t[1] == "object") {
|
|
2032
2134
|
if ("lineHeight" in t[1]) {
|
|
2033
2135
|
let n = t[1].lineHeight;
|
|
2034
|
-
typeof n == "string" && n.includes("calc") && (n =
|
|
2136
|
+
typeof n == "string" && n.includes("calc") && (n = jn(n));
|
|
2035
2137
|
const r = q(n);
|
|
2036
2138
|
r.unit === "unsupported" ? e.lineHeight = {
|
|
2037
2139
|
number: n * e.fontSize.number,
|
|
@@ -2042,83 +2144,116 @@ const q = (t, e) => {
|
|
|
2042
2144
|
}
|
|
2043
2145
|
}
|
|
2044
2146
|
return e;
|
|
2045
|
-
},
|
|
2147
|
+
}, Te = (t, e, n, r = null) => t.number === e.number ? (de.error(
|
|
2046
2148
|
`Same value for start an end${r ? ` (${r})` : ""}: "clamp-[${n}]".`
|
|
2047
|
-
), null) : t.unit !== e.unit && t.unit !== "zero" && e.unit !== "zero" ? (
|
|
2149
|
+
), null) : t.unit !== e.unit && t.unit !== "zero" && e.unit !== "zero" ? (de.error(
|
|
2048
2150
|
`Units need to match${r ? ` (${r})` : ""}: "clamp-[${n}]" ${t.unit} !== ${e.unit}.`
|
|
2049
|
-
), null) : t.unit === "unsupported" || e.unit === "unsupported" ? (
|
|
2151
|
+
), null) : t.unit === "unsupported" || e.unit === "unsupported" ? (de.error(
|
|
2050
2152
|
`Only px, rem and em units are supported${r ? ` (${r})` : ""}: "clamp-[${n}]".`
|
|
2051
|
-
), null) : !0,
|
|
2052
|
-
const
|
|
2053
|
-
let
|
|
2054
|
-
n.unit !== "px" &&
|
|
2055
|
-
const
|
|
2056
|
-
return
|
|
2057
|
-
},
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2153
|
+
), null) : !0, je = (t, e, n = { number: 23.4375, unit: "rem" }, r = { number: 90, unit: "rem" }, o = !1) => {
|
|
2154
|
+
const i = t.unit === "zero" ? e.unit : t.unit, a = i === "px";
|
|
2155
|
+
let u = t.number, c = e.number, d = !1, g = n.number, f = r.number;
|
|
2156
|
+
n.unit !== "px" && a && (g = n.number * 16), n.unit === "px" && !a && (g = n.number / 16), r.unit !== "px" && a && (f = r.number * 16), r.unit === "px" && !a && (f = r.number / 16), c < u && u < 0 && c < 0 ? (u = Math.abs(u), c = Math.abs(c), d = !0) : c < u && u > 0 && c > 0 ? (u = u * -1, c = c * -1, d = !0) : c < u && (u = Math.abs(u) * -1, c = Math.abs(c), d = !0);
|
|
2157
|
+
const v = (c - u) / (f - g), C = `${(u - g * v).toFixed(6)}${i} + ${(100 * v).toFixed(6)}${o ? "cqw" : "vw"}`, P = `clamp(${u}${i}, ${C}, ${c}${i})`;
|
|
2158
|
+
return d ? `calc(${P} * -1)` : P;
|
|
2159
|
+
}, Jn = {
|
|
2160
|
+
minSize: "23.4375rem",
|
|
2161
|
+
maxSize: "90rem"
|
|
2162
|
+
};
|
|
2163
|
+
function Ge(t, e, n, r) {
|
|
2164
|
+
if (!t)
|
|
2165
|
+
return {
|
|
2166
|
+
...q(e),
|
|
2167
|
+
isContainer: !1
|
|
2168
|
+
};
|
|
2169
|
+
const o = t.startsWith("@"), i = o ? t.slice(1) : t, a = o ? r[i] || i : n[i] || i;
|
|
2170
|
+
return {
|
|
2171
|
+
...q(a),
|
|
2172
|
+
isContainer: o
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
const Kn = lt.withOptions(function(t = {}) {
|
|
2176
|
+
const e = { ...Jn, ...t };
|
|
2062
2177
|
return function({ matchUtilities: n, theme: r, config: o }) {
|
|
2063
2178
|
n(
|
|
2064
2179
|
{
|
|
2065
2180
|
clamp: (i) => {
|
|
2066
|
-
const
|
|
2067
|
-
if (
|
|
2068
|
-
return
|
|
2181
|
+
const a = i.split(",");
|
|
2182
|
+
if (a.length < 3)
|
|
2183
|
+
return de.error(
|
|
2069
2184
|
`The clamp utility requires at least 3 arguments: "clamp-[${i}]".`
|
|
2070
2185
|
), {};
|
|
2071
|
-
const u =
|
|
2072
|
-
|
|
2073
|
-
e.
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2186
|
+
const u = r("screens"), c = r("containers"), d = Ge(
|
|
2187
|
+
a[3],
|
|
2188
|
+
e.minSize,
|
|
2189
|
+
u,
|
|
2190
|
+
c
|
|
2191
|
+
), g = Ge(
|
|
2192
|
+
a[4],
|
|
2193
|
+
e.maxSize,
|
|
2194
|
+
u,
|
|
2195
|
+
c
|
|
2196
|
+
);
|
|
2197
|
+
if (!Te(d, g, i))
|
|
2198
|
+
return {};
|
|
2199
|
+
const f = d.isContainer, v = pt(a[0]);
|
|
2200
|
+
if (!v)
|
|
2201
|
+
return de.error(
|
|
2202
|
+
`Property "${a[0]}" is not supported: "clamp-[${i}]".`
|
|
2081
2203
|
), {};
|
|
2082
|
-
const { key:
|
|
2083
|
-
if (
|
|
2084
|
-
const
|
|
2085
|
-
o().theme[
|
|
2086
|
-
),
|
|
2087
|
-
o().theme[
|
|
2088
|
-
),
|
|
2089
|
-
return Object.keys(
|
|
2090
|
-
if (
|
|
2091
|
-
if ((
|
|
2092
|
-
|
|
2093
|
-
else if (
|
|
2094
|
-
const
|
|
2095
|
-
|
|
2204
|
+
const { key: C, props: P, type: y } = v;
|
|
2205
|
+
if (y === "fontSize") {
|
|
2206
|
+
const A = He(
|
|
2207
|
+
o().theme[C][a[1]] || a[1]
|
|
2208
|
+
), O = He(
|
|
2209
|
+
o().theme[C][a[2]] || a[2]
|
|
2210
|
+
), ee = {};
|
|
2211
|
+
return Object.keys(A).forEach((b) => {
|
|
2212
|
+
if (b in O) {
|
|
2213
|
+
if ((b === "letterSpacing" || b === "lineHeight") && A[b].number === O[b].number && A[b].unit === O[b].unit)
|
|
2214
|
+
ee[b] = `${A[b].number}${A[b].unit}`;
|
|
2215
|
+
else if (Te(A[b], O[b], i, b)) {
|
|
2216
|
+
const we = je(
|
|
2217
|
+
A[b],
|
|
2218
|
+
O[b],
|
|
2219
|
+
d,
|
|
2220
|
+
g,
|
|
2221
|
+
f
|
|
2222
|
+
);
|
|
2223
|
+
ee[b] = we;
|
|
2096
2224
|
}
|
|
2097
2225
|
}
|
|
2098
|
-
}),
|
|
2226
|
+
}), ee;
|
|
2099
2227
|
}
|
|
2100
|
-
let
|
|
2101
|
-
if (
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2104
|
-
number:
|
|
2105
|
-
unit:
|
|
2106
|
-
},
|
|
2107
|
-
number:
|
|
2108
|
-
unit:
|
|
2109
|
-
};
|
|
2228
|
+
let z = q(o().theme[C][a[1]] || a[1]), V = q(o().theme[C][a[2]] || a[2]);
|
|
2229
|
+
if (y === "spacing") {
|
|
2230
|
+
const A = q(r("spacing.1")), O = a[1].startsWith("-"), ee = a[2].startsWith("-"), b = O ? a[1].slice(1) : a[1], we = ee ? a[2].slice(1) : a[2];
|
|
2231
|
+
z = {
|
|
2232
|
+
number: A.number * b,
|
|
2233
|
+
unit: A.unit
|
|
2234
|
+
}, V = {
|
|
2235
|
+
number: A.number * we,
|
|
2236
|
+
unit: A.unit
|
|
2237
|
+
}, O && (z.number = z.number * -1), ee && (V.number = V.number * -1);
|
|
2110
2238
|
}
|
|
2111
|
-
if (!
|
|
2239
|
+
if (!Te(z, V, i))
|
|
2112
2240
|
return {};
|
|
2113
|
-
const
|
|
2114
|
-
return
|
|
2241
|
+
const at = je(z, V, d, g, f);
|
|
2242
|
+
return P.reduce((A, O) => (typeof O == "string" ? A[O] = at : A = { ...A, ...O }, A), {});
|
|
2115
2243
|
}
|
|
2116
2244
|
},
|
|
2117
|
-
{ values: r("clamp") }
|
|
2245
|
+
{ values: r("clamp") },
|
|
2246
|
+
{
|
|
2247
|
+
supportsNegativeValues: !1,
|
|
2248
|
+
modifiers: {
|
|
2249
|
+
pattern: /[\w-]+(?:,[\w-]+){2}/
|
|
2250
|
+
// Matches "text,lg,3xl" format
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2118
2253
|
);
|
|
2119
2254
|
};
|
|
2120
2255
|
});
|
|
2121
2256
|
export {
|
|
2122
|
-
|
|
2257
|
+
Kn as default
|
|
2123
2258
|
};
|
|
2124
2259
|
//# sourceMappingURL=index.js.map
|